content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
_menu_name = "Networking" _ordering = [ "wpa_cli", "network", "nmap", "upnp"]
_menu_name = 'Networking' _ordering = ['wpa_cli', 'network', 'nmap', 'upnp']
i = 0 while True: n, q = map(int, input().split()) if n == 0 and q == 0: break marble_numbers = [] while n>0: n -= 1 num = int(input()) marble_numbers.append(num) marble_numbers.sort() i += 1 print(f"CASE# {i}:") while q > 0: q -= 1 qy = int(input()) if qy in marble_numbers: print(f"{qy} found at {marble_numbers.index(qy) + 1}") else: print(f"{qy} not found")
i = 0 while True: (n, q) = map(int, input().split()) if n == 0 and q == 0: break marble_numbers = [] while n > 0: n -= 1 num = int(input()) marble_numbers.append(num) marble_numbers.sort() i += 1 print(f'CASE# {i}:') while q > 0: q -= 1 qy = int(input()) if qy in marble_numbers: print(f'{qy} found at {marble_numbers.index(qy) + 1}') else: print(f'{qy} not found')
class Board: ''' A 3x3 board for TicTacToe ''' __board = '' __print_board = '' def __init__(self): self.__board = [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']] self.make_printable() def __str__(self): self.make_printable() return self.__print_board def get_board(self): return self.__board def make_printable(self): c_gap = ' ----------- ' r_gap = ' | ' self.__print_board = c_gap + '\n' for l_board in self.__board: self.__print_board += r_gap for d in l_board: self.__print_board += d self.__print_board += r_gap self.__print_board += '\n' + c_gap + '\n' def is_space_available(self, pos: str): row1 = self.__board[0] row2 = self.__board[1] row3 = self.__board[2] if not pos.isdigit(): return False r1 = range(1, 4).count(int(pos)) and row1[int(pos) - 1] == str(pos) r2 = range(4, 7).count(int(pos)) and row2[int(pos) - 4] == str(pos) r3 = range(7, 10).count(int(pos)) and row3[int(pos) - 7] == str(pos) return r1 or r2 or r3 def is_full(self): board = self.__board for row in board: for elem in row: if elem.isdigit(): return False return True def place(self, marker: str, pos: str): if not (int(pos) >= 1 and int(pos) <= 9): return False for row in self.__board: if pos in row: row[row.index(pos)] = marker return True return False
class Board: """ A 3x3 board for TicTacToe """ __board = '' __print_board = '' def __init__(self): self.__board = [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']] self.make_printable() def __str__(self): self.make_printable() return self.__print_board def get_board(self): return self.__board def make_printable(self): c_gap = ' ----------- ' r_gap = ' | ' self.__print_board = c_gap + '\n' for l_board in self.__board: self.__print_board += r_gap for d in l_board: self.__print_board += d self.__print_board += r_gap self.__print_board += '\n' + c_gap + '\n' def is_space_available(self, pos: str): row1 = self.__board[0] row2 = self.__board[1] row3 = self.__board[2] if not pos.isdigit(): return False r1 = range(1, 4).count(int(pos)) and row1[int(pos) - 1] == str(pos) r2 = range(4, 7).count(int(pos)) and row2[int(pos) - 4] == str(pos) r3 = range(7, 10).count(int(pos)) and row3[int(pos) - 7] == str(pos) return r1 or r2 or r3 def is_full(self): board = self.__board for row in board: for elem in row: if elem.isdigit(): return False return True def place(self, marker: str, pos: str): if not (int(pos) >= 1 and int(pos) <= 9): return False for row in self.__board: if pos in row: row[row.index(pos)] = marker return True return False
#TempConvert_loop.py for i in range(3): val = input("Input the temp:(32C)") if val[-1] in ['C','c']: f = 1.8 * float(val[0:-1]) + 32 print("Converted temp is: %.2fF"%f) elif val[-1] in ['F','f']: c = (float(val[0:-1]) - 32) / 1.8 print("Converted temp is: %.2fC"%c) else: print("Wrong input")
for i in range(3): val = input('Input the temp:(32C)') if val[-1] in ['C', 'c']: f = 1.8 * float(val[0:-1]) + 32 print('Converted temp is: %.2fF' % f) elif val[-1] in ['F', 'f']: c = (float(val[0:-1]) - 32) / 1.8 print('Converted temp is: %.2fC' % c) else: print('Wrong input')
CLASSIFIER_SCALE = 1.1 CLASSIFIER_NEIGHBORS = 5 CLASSIFIER_MIN_SZ = (50, 50) MIN_SAMPLES_PER_USER = 50 FACE_BOX_COLOR = (255, 0, 255) FACE_TXT_COLOR = (115, 249, 255) LBP_RADIUS = 2 LBP_NEIGHBORS = 16 LBP_GRID_X = 8 LBP_GRID_Y = 8 KNOWN_USER_FILE = 'users.lst' LBPH_MACHINE_LEARNING_FILE = 'lbph_face_recognizer.yaml' HEURISTIC_FILE_PREFIX = 'heuristic_face_recognizer' LIB_FACE_RECOGNITION_FILE_PREFIX = 'lib_face_recognition' ALLOWED_METHODS = ['lbph_machinelearning', 'heuristic', 'lib_face_recognition'] HEURISTIC_CERTAIN = .15
classifier_scale = 1.1 classifier_neighbors = 5 classifier_min_sz = (50, 50) min_samples_per_user = 50 face_box_color = (255, 0, 255) face_txt_color = (115, 249, 255) lbp_radius = 2 lbp_neighbors = 16 lbp_grid_x = 8 lbp_grid_y = 8 known_user_file = 'users.lst' lbph_machine_learning_file = 'lbph_face_recognizer.yaml' heuristic_file_prefix = 'heuristic_face_recognizer' lib_face_recognition_file_prefix = 'lib_face_recognition' allowed_methods = ['lbph_machinelearning', 'heuristic', 'lib_face_recognition'] heuristic_certain = 0.15
potencia = int(input()) tempo = int(input()) qw = potencia / 1000 hr = tempo / 60 kwh = hr * qw print('{:.1f} kWh'.format(kwh))
potencia = int(input()) tempo = int(input()) qw = potencia / 1000 hr = tempo / 60 kwh = hr * qw print('{:.1f} kWh'.format(kwh))
n = 60 for i in range(10000): 2 ** n
n = 60 for i in range(10000): 2 ** n
class Calculator: def __init__(self, socket): self.socket = socket def run(self): self.socket.emit('response', 'Here is your result')
class Calculator: def __init__(self, socket): self.socket = socket def run(self): self.socket.emit('response', 'Here is your result')
#import sys def interpret_bf_code(bf_code, memory_size = 30000): ''' (str, (int)) -> str This function interprets code in the BrainFuck language, which is passed in via bf_code parameter and returns the output of executing that code. If so specified in BrainFuck code, the function reads input from user. ''' instruction_PTR = 0 memory_PTR = memory_size // 2 memory = [0] * memory_size Output = "" while instruction_PTR < len(bf_code): ch = bf_code[instruction_PTR] if ch == '>': memory_PTR = (memory_PTR + 1) % memory_size; elif ch == '<': memory_PTR = (memory_PTR - 1) % memory_size; elif ch == '+': memory[memory_PTR] = memory[memory_PTR] + 1; elif ch == '-': memory[memory_PTR] = memory[memory_PTR] - 1; elif ch == '.': # chr(int) -> char converts int to a char with corresponding ASCII code out_ch = chr( memory[memory_PTR] ) Output = Output + out_ch elif ch == ',': # ord(char) -> int converts char to its corresponding ASCII code in_ch = input("Input 1 byte in form of a single character: ") memory[memory_PTR] = ord(in_ch[0]) elif ch == '[': if memory[memory_PTR] == 0: loops = 1 while loops > 0: instruction_PTR +=1 if bf_code[instruction_PTR] == '[': loops += 1 elif bf_code[instruction_PTR] == ']': loops -= 1 elif ch == ']': loops = 1 while loops > 0: instruction_PTR -=1 if bf_code[instruction_PTR] == '[': loops -= 1 elif bf_code[instruction_PTR] == ']': loops += 1 instruction_PTR -= 1 instruction_PTR +=1 print(Output) return Output #if len(sys.argv) >= 2: # bf_code = sys.argv[1] # interpret_bf_code(bf_code) if __name__ == "__main__": bf_test_code = input("Type in BrainFuck code: ") interpret_bf_code(bf_test_code)
def interpret_bf_code(bf_code, memory_size=30000): """ (str, (int)) -> str This function interprets code in the BrainFuck language, which is passed in via bf_code parameter and returns the output of executing that code. If so specified in BrainFuck code, the function reads input from user. """ instruction_ptr = 0 memory_ptr = memory_size // 2 memory = [0] * memory_size output = '' while instruction_PTR < len(bf_code): ch = bf_code[instruction_PTR] if ch == '>': memory_ptr = (memory_PTR + 1) % memory_size elif ch == '<': memory_ptr = (memory_PTR - 1) % memory_size elif ch == '+': memory[memory_PTR] = memory[memory_PTR] + 1 elif ch == '-': memory[memory_PTR] = memory[memory_PTR] - 1 elif ch == '.': out_ch = chr(memory[memory_PTR]) output = Output + out_ch elif ch == ',': in_ch = input('Input 1 byte in form of a single character: ') memory[memory_PTR] = ord(in_ch[0]) elif ch == '[': if memory[memory_PTR] == 0: loops = 1 while loops > 0: instruction_ptr += 1 if bf_code[instruction_PTR] == '[': loops += 1 elif bf_code[instruction_PTR] == ']': loops -= 1 elif ch == ']': loops = 1 while loops > 0: instruction_ptr -= 1 if bf_code[instruction_PTR] == '[': loops -= 1 elif bf_code[instruction_PTR] == ']': loops += 1 instruction_ptr -= 1 instruction_ptr += 1 print(Output) return Output if __name__ == '__main__': bf_test_code = input('Type in BrainFuck code: ') interpret_bf_code(bf_test_code)
# flatten 2D arrays into a single array A = [[1, 2, 3], [4], [5, 6]] # iterative version def flatten_iterative(A): result = [] for array in A: for element in array: result.append(element) return result print(flatten_iterative(A)) # recursively traverse 2 dimensional list out of order. def traverse_list(A): result = [] def traverse_list_rec(A, i, j): if i >= len(A) or j >= len(A[i]): return traverse_list_rec(A, i + 1, j) traverse_list_rec(A, i, j + 1) result.append(A[i][j]) traverse_list_rec(A, 0, 0) return result print(traverse_list(A)) # recursively traverse 2 dimensional list in order. def flatten(A): result = [] def flatten_recursive(A, i, j, result): if i == len(A): return if j == len(A[i]): flatten_recursive(A, i + 1, 0, result) return result.append(A[i][j]) flatten_recursive(A, i, j + 1, result) flatten_recursive(A, 0, 0, result) return result print(flatten(A))
a = [[1, 2, 3], [4], [5, 6]] def flatten_iterative(A): result = [] for array in A: for element in array: result.append(element) return result print(flatten_iterative(A)) def traverse_list(A): result = [] def traverse_list_rec(A, i, j): if i >= len(A) or j >= len(A[i]): return traverse_list_rec(A, i + 1, j) traverse_list_rec(A, i, j + 1) result.append(A[i][j]) traverse_list_rec(A, 0, 0) return result print(traverse_list(A)) def flatten(A): result = [] def flatten_recursive(A, i, j, result): if i == len(A): return if j == len(A[i]): flatten_recursive(A, i + 1, 0, result) return result.append(A[i][j]) flatten_recursive(A, i, j + 1, result) flatten_recursive(A, 0, 0, result) return result print(flatten(A))
# This class provides a way to drive a robot which has a drive train equipped # with separate motors powering the left and right sides of a robot. # Two different drive methods exist: # Arcade Drive: combines 2-axes of a joystick to control steering and driving speed. # Tank Drive: uses two joysticks to control motor speeds left and right. # A Pololu Maestro is used to send PWM signals to left and right motor controllers. # When using motor controllers, the maestro's speed setting can be used to tune the # responsiveness of the robot. Low values dampen acceleration, making for a more # stable robot. High values increase responsiveness, but can lead to a tippy robot. # Try values around 50 to 100. RESPONSIVENESS = 60 # this is also considered "speed" # These are the motor controller limits, measured in Maestro units. # These default values typically work fine and align with maestro's default limits. # Vaules should be adjusted so that center stops the motors and the min/max values # limit speed range you want for your robot. MIN = 4000 CENTER = 6000 MAX = 8000 class SimpleServo: # Pass the maestro controller object and the maestro channel numbers being used # for the left and right motor controllers. See maestro.py on how to instantiate maestro. def __init__(self, maestro, channel): self.maestro = maestro self.channel = channel # Init motor accel/speed params self.maestro.setAccel(self.channel, 0) self.maestro.setSpeed(self.channel, RESPONSIVENESS) # Motor min/center/max values self.min = MIN self.center = CENTER self.max = MAX # speed is -1.0 to 1.0 def drive(self, amount): # convert to servo units if (amount >= 0): target = int(self.center + (self.max - self.center) * amount) else: target = int(self.center + (self.center - self.min) * amount) self.maestro.setTarget(self.channel, target) # Set both motors to stopped (center) position def stop(self): self.maestro.setAccel(self.channel, self.center) # Close should be used when shutting down Drive object def close(self): self.stop()
responsiveness = 60 min = 4000 center = 6000 max = 8000 class Simpleservo: def __init__(self, maestro, channel): self.maestro = maestro self.channel = channel self.maestro.setAccel(self.channel, 0) self.maestro.setSpeed(self.channel, RESPONSIVENESS) self.min = MIN self.center = CENTER self.max = MAX def drive(self, amount): if amount >= 0: target = int(self.center + (self.max - self.center) * amount) else: target = int(self.center + (self.center - self.min) * amount) self.maestro.setTarget(self.channel, target) def stop(self): self.maestro.setAccel(self.channel, self.center) def close(self): self.stop()
if __name__ == '__main__': l = input().strip().split() data = [int(i) for i in l] n = int(input()) sum = [0 for i in range(0, len(data)+1)] sum[0] = data[0] for i in range(1, len(data)): sum[i] = sum[i-1] + data[i] # print(sum) found = False for length in range(0, len(data)): for t in range(length+1, len(data)): if sum[t] - sum[t-length-1] >= n: print(length+1) found = True # print(data[t], data[t-length]) break if found: break if not found: print("-1")
if __name__ == '__main__': l = input().strip().split() data = [int(i) for i in l] n = int(input()) sum = [0 for i in range(0, len(data) + 1)] sum[0] = data[0] for i in range(1, len(data)): sum[i] = sum[i - 1] + data[i] found = False for length in range(0, len(data)): for t in range(length + 1, len(data)): if sum[t] - sum[t - length - 1] >= n: print(length + 1) found = True break if found: break if not found: print('-1')
i = 1 while True: inp = input() if inp == "Hajj": inp = "Hajj-e-Akbar" elif inp == "Umrah": inp = "Hajj-e-Asghar" else: break print("Case {}: {}".format(i, inp)) i += 1
i = 1 while True: inp = input() if inp == 'Hajj': inp = 'Hajj-e-Akbar' elif inp == 'Umrah': inp = 'Hajj-e-Asghar' else: break print('Case {}: {}'.format(i, inp)) i += 1
class Report: def __init__(self, report): self.report = report @property def name(self): return self.report['name'] @property def filename(self): return self.report['filename'] @property def klass(self): return self.report['class'] @property def skip(self): return self.report['skip']
class Report: def __init__(self, report): self.report = report @property def name(self): return self.report['name'] @property def filename(self): return self.report['filename'] @property def klass(self): return self.report['class'] @property def skip(self): return self.report['skip']
def main_menu(): input_map = {'1': 'compute', '2': 'storage', '3': 'default', '4': 'exit'} print('\nSelect from the options below:') print(' 1. Set up or remove a compute service') print(' 2. Set up or remove a storage service') print(' 3. Change settings for compute or storage service (i.e. defaults)') print(' 4. Exit configuration') selection = input(f"{'/'.join(input_map)}> ") if selection not in input_map: raise Exception("Invalid selection") return input_map[selection] def main_service_menu(service): input_map = {'1': 'add', '2': 'remove'} print('\nDo you want to:') print(f' 1. Set up a new {service} service') print(f' 2. Remove a {service} service') selection = input(f"{'/'.join(input_map)}> ") if selection not in input_map: raise Exception("Invalid selection") return input_map[selection] def default_service_menu(): input_map = {'1': 'compute', '2': 'storage'} print('\nDo you want to:') print(f' 1. Change default compute service') print(f' 2. Change default storage service') selection = input(f"{'/'.join(input_map)}> ") if selection not in input_map: raise Exception("Invalid selection") return input_map[selection]
def main_menu(): input_map = {'1': 'compute', '2': 'storage', '3': 'default', '4': 'exit'} print('\nSelect from the options below:') print(' 1. Set up or remove a compute service') print(' 2. Set up or remove a storage service') print(' 3. Change settings for compute or storage service (i.e. defaults)') print(' 4. Exit configuration') selection = input(f"{'/'.join(input_map)}> ") if selection not in input_map: raise exception('Invalid selection') return input_map[selection] def main_service_menu(service): input_map = {'1': 'add', '2': 'remove'} print('\nDo you want to:') print(f' 1. Set up a new {service} service') print(f' 2. Remove a {service} service') selection = input(f"{'/'.join(input_map)}> ") if selection not in input_map: raise exception('Invalid selection') return input_map[selection] def default_service_menu(): input_map = {'1': 'compute', '2': 'storage'} print('\nDo you want to:') print(f' 1. Change default compute service') print(f' 2. Change default storage service') selection = input(f"{'/'.join(input_map)}> ") if selection not in input_map: raise exception('Invalid selection') return input_map[selection]
class Request: pass class DirectoryInfoRequest(Request): def __init__(self, path): super().__init__() self.path = path class AdditionalEntryPropertiesRequest(Request): def __init__(self, filepath): super().__init__() self.filepath = filepath
class Request: pass class Directoryinforequest(Request): def __init__(self, path): super().__init__() self.path = path class Additionalentrypropertiesrequest(Request): def __init__(self, filepath): super().__init__() self.filepath = filepath
version_info = (0, 0, '6a1') __version__ = '.'.join(map(str, version_info)) if __name__ == '__main__': print(__version__)
version_info = (0, 0, '6a1') __version__ = '.'.join(map(str, version_info)) if __name__ == '__main__': print(__version__)
#!/usr/local/bin/python3 try: arquivo = open('pessoas.csv') for it in arquivo: print('Nome {}, Idade {}'.format(*it.strip().split(','))) finally: arquivo.close()
try: arquivo = open('pessoas.csv') for it in arquivo: print('Nome {}, Idade {}'.format(*it.strip().split(','))) finally: arquivo.close()
@authenticated def delete(self): model = self.db.query([model_name]).filter([delete_filter]).first() self.db.delete(model) self.db.commit() return JsonResponse(self, '000')
@authenticated def delete(self): model = self.db.query([model_name]).filter([delete_filter]).first() self.db.delete(model) self.db.commit() return json_response(self, '000')
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def longestZigZag(self, root: TreeNode) -> int: self.result = 0 self.dfs(root) return self.result def dfs(self, root): if root == None: return 0, 0 if root.left == None and root.right == None: return 0, 0 rootL, rootR = 0, 0 if root.left == None: rootL = 0 else: l, r = self.dfs(root.left) rootL = r + 1 if root.right == None: rootR = 0 else: l, r = self.dfs(root.right) rootR = l + 1 self.result = max(self.result, rootL, rootR) return rootL, rootR node1 = TreeNode(1) node2 = TreeNode(2) node3 = TreeNode(3) node4 = TreeNode(4) node5 = TreeNode(5) node6 = TreeNode(6) node7 = TreeNode(7) node8 = TreeNode(8) node1.right = node2 node2.left = node3 node2.right = node4 node4.left = node5 node4.right = node6 node5.right = node7 node7.right = node8 s = Solution() result = s.longestZigZag(node1) print(result)
class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def longest_zig_zag(self, root: TreeNode) -> int: self.result = 0 self.dfs(root) return self.result def dfs(self, root): if root == None: return (0, 0) if root.left == None and root.right == None: return (0, 0) (root_l, root_r) = (0, 0) if root.left == None: root_l = 0 else: (l, r) = self.dfs(root.left) root_l = r + 1 if root.right == None: root_r = 0 else: (l, r) = self.dfs(root.right) root_r = l + 1 self.result = max(self.result, rootL, rootR) return (rootL, rootR) node1 = tree_node(1) node2 = tree_node(2) node3 = tree_node(3) node4 = tree_node(4) node5 = tree_node(5) node6 = tree_node(6) node7 = tree_node(7) node8 = tree_node(8) node1.right = node2 node2.left = node3 node2.right = node4 node4.left = node5 node4.right = node6 node5.right = node7 node7.right = node8 s = solution() result = s.longestZigZag(node1) print(result)
def equal_slices(total, num, per_person): res = num * per_person if res <= total: return True return False foo = equal_slices(11, 11, 1) print(str(foo))
def equal_slices(total, num, per_person): res = num * per_person if res <= total: return True return False foo = equal_slices(11, 11, 1) print(str(foo))
class FileExtractorTimeoutException(Exception): pass class ParamsInvalidException(Exception): pass class NoProperExtractorFindException(Exception): def __init__(self): super().__init__('NoProperExtractorFind Exception')
class Fileextractortimeoutexception(Exception): pass class Paramsinvalidexception(Exception): pass class Noproperextractorfindexception(Exception): def __init__(self): super().__init__('NoProperExtractorFind Exception')
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Purpose: Agent API Methods ''' __author__ = 'Matt Joyce' __email__ = 'matt@joyce.nyc' __copyright__ = 'Copyright 2016, Symphony Communication Services LLC' class Base(object): def __init__(self, *args, **kwargs): super(Base, self).__init__(*args, **kwargs) def test_echo(self, test_string): ''' echo test ''' response, status_code = self.__agent__.Util.post_v1_util_echo( sessionToken=self.__session__, keyManagerToken=self.__keymngr__, echoInput={"message": test_string} ).result() self.logger.debug('%s: %s' % (status_code, response)) return status_code, response def create_datafeed(self): ''' create datafeed ''' response, status_code = self.__agent__.Datafeed.post_v4_datafeed_create( sessionToken=self.__session__, keyManagerToken=self.__keymngr__ ).result() # return the token self.logger.debug('%s: %s' % (status_code, response)) return status_code, response['id'] def read_datafeed(self, datafeed_id): ''' get datafeed ''' response, status_code = self.__agent__.Datafeed.get_v4_datafeed_id_read( sessionToken=self.__session__, keyManagerToken=self.__keymngr__, id=datafeed_id ).result() self.logger.debug('%s: %s' % (status_code, response)) return status_code, response def send_message(self, threadid, msgFormat, message): ''' send message to threadid/stream ''' # using deprecated v3 message create because of bug in codegen of v4 ( multipart/form-data ) response, status_code = self.__agent__.Messages.post_v3_stream_sid_message_create( sessionToken=self.__session__, keyManagerToken=self.__keymngr__, sid=threadid, message={"format": msgFormat, "message": message} ).result() self.logger.debug('%s: %s' % (status_code, response)) return status_code, response def read_stream(self, stream_id, since_epoch): ''' get datafeed ''' response, status_code = self.__agent__.Messages.get_v4_stream_sid_message( sessionToken=self.__session__, keyManagerToken=self.__keymngr__, sid=stream_id, since=since_epoch ).result() self.logger.debug('%s: %s' % (status_code, response)) return status_code, response
""" Purpose: Agent API Methods """ __author__ = 'Matt Joyce' __email__ = 'matt@joyce.nyc' __copyright__ = 'Copyright 2016, Symphony Communication Services LLC' class Base(object): def __init__(self, *args, **kwargs): super(Base, self).__init__(*args, **kwargs) def test_echo(self, test_string): """ echo test """ (response, status_code) = self.__agent__.Util.post_v1_util_echo(sessionToken=self.__session__, keyManagerToken=self.__keymngr__, echoInput={'message': test_string}).result() self.logger.debug('%s: %s' % (status_code, response)) return (status_code, response) def create_datafeed(self): """ create datafeed """ (response, status_code) = self.__agent__.Datafeed.post_v4_datafeed_create(sessionToken=self.__session__, keyManagerToken=self.__keymngr__).result() self.logger.debug('%s: %s' % (status_code, response)) return (status_code, response['id']) def read_datafeed(self, datafeed_id): """ get datafeed """ (response, status_code) = self.__agent__.Datafeed.get_v4_datafeed_id_read(sessionToken=self.__session__, keyManagerToken=self.__keymngr__, id=datafeed_id).result() self.logger.debug('%s: %s' % (status_code, response)) return (status_code, response) def send_message(self, threadid, msgFormat, message): """ send message to threadid/stream """ (response, status_code) = self.__agent__.Messages.post_v3_stream_sid_message_create(sessionToken=self.__session__, keyManagerToken=self.__keymngr__, sid=threadid, message={'format': msgFormat, 'message': message}).result() self.logger.debug('%s: %s' % (status_code, response)) return (status_code, response) def read_stream(self, stream_id, since_epoch): """ get datafeed """ (response, status_code) = self.__agent__.Messages.get_v4_stream_sid_message(sessionToken=self.__session__, keyManagerToken=self.__keymngr__, sid=stream_id, since=since_epoch).result() self.logger.debug('%s: %s' % (status_code, response)) return (status_code, response)
s = input() k1 = input() k2 = input() out = "" for c in s: found = False for i in range(len(k1)): if c == k1[i]: out += k2[i] found = True break elif c == k2[i]: out += k1[i] found = True break if not found: out += c print(out)
s = input() k1 = input() k2 = input() out = '' for c in s: found = False for i in range(len(k1)): if c == k1[i]: out += k2[i] found = True break elif c == k2[i]: out += k1[i] found = True break if not found: out += c print(out)
# This program converts the speeds 60 kph # through 130 kph (in 10 kph increments) # to mph. START_SPEED = 60 END_SPEED = 131 INCREMENT = 10 CONVERSION_FACTOR = 0.6214 # Print the table headings. print('KPH\tMPH') print('--------------') # Print the speeds for kph in range(START_SPEED, END_SPEED, INCREMENT): mph = kph * CONVERSION_FACTOR print(kph, '\t', format(mph, '.1f'))
start_speed = 60 end_speed = 131 increment = 10 conversion_factor = 0.6214 print('KPH\tMPH') print('--------------') for kph in range(START_SPEED, END_SPEED, INCREMENT): mph = kph * CONVERSION_FACTOR print(kph, '\t', format(mph, '.1f'))
d = dict() d['quincy'] = 1 d['beau'] = 5 d['kris'] = 9 for (k,i) in d.items(): print(k, i)
d = dict() d['quincy'] = 1 d['beau'] = 5 d['kris'] = 9 for (k, i) in d.items(): print(k, i)
# Africa 2010 # Problem A: Store Credit # Jon Hanson # # Declare Variables # ifile = 'input.txt' # simple input ofile = 'output.txt' # simple output #ifile = 'A-large-practice.in' # official input #ofile = 'A-large-practice.out' # official output caselist = [] # list containing cases # # Problem State (Case) Class # class CredCase(object): def __init__(self,credit,itemCount,items): # Initialize: self.credit = int(credit) # credit amount self.itemCount = int(itemCount) # item count self.items = list(map(int,items.split())) # item values list self.cost = -1 # total cost self.solution = [] # output list def trySolution(self,indices): cost = self.items[indices[0]] + self.items[indices[1]] if (cost <= self.credit) and (cost > self.cost): self.cost = cost self.solution = [x+1 for x in indices] # # Read Input File # with open(ifile) as f: cases = int(f.readline()) for n in range(0,cases): case = CredCase(f.readline(),f.readline(),f.readline()) caselist.append(case) # # Conduct Algorithm # for n in range(0,cases): case = caselist[n] for i in range(0,case.itemCount): for j in range( (i+1) , case.itemCount ): case.trySolution( [i,j] ) if case.credit == case.cost: break if case.credit == case.cost: break # # Write Output File # with open(ofile,'w') as f: for n in range(0,cases): case = caselist[n] casestr = 'Case #'+str(n+1)+': ' casestr = casestr+str(case.solution[0])+' '+str(case.solution[1])+'\n' checkstr = 'Check: Credit='+str(case.credit) checkstr += ' Cost='+str(case.cost) checkstr += ' Item'+str(case.solution[0])+'=' checkstr += str(case.items[case.solution[0]-1]) checkstr += ' Item'+str(case.solution[1])+'=' checkstr += str(case.items[case.solution[1]-1])+'\n' f.write(casestr) #f.write(checkstr)
ifile = 'input.txt' ofile = 'output.txt' caselist = [] class Credcase(object): def __init__(self, credit, itemCount, items): self.credit = int(credit) self.itemCount = int(itemCount) self.items = list(map(int, items.split())) self.cost = -1 self.solution = [] def try_solution(self, indices): cost = self.items[indices[0]] + self.items[indices[1]] if cost <= self.credit and cost > self.cost: self.cost = cost self.solution = [x + 1 for x in indices] with open(ifile) as f: cases = int(f.readline()) for n in range(0, cases): case = cred_case(f.readline(), f.readline(), f.readline()) caselist.append(case) for n in range(0, cases): case = caselist[n] for i in range(0, case.itemCount): for j in range(i + 1, case.itemCount): case.trySolution([i, j]) if case.credit == case.cost: break if case.credit == case.cost: break with open(ofile, 'w') as f: for n in range(0, cases): case = caselist[n] casestr = 'Case #' + str(n + 1) + ': ' casestr = casestr + str(case.solution[0]) + ' ' + str(case.solution[1]) + '\n' checkstr = 'Check: Credit=' + str(case.credit) checkstr += ' Cost=' + str(case.cost) checkstr += ' Item' + str(case.solution[0]) + '=' checkstr += str(case.items[case.solution[0] - 1]) checkstr += ' Item' + str(case.solution[1]) + '=' checkstr += str(case.items[case.solution[1] - 1]) + '\n' f.write(casestr)
# Crie um programa que leia varios numeros # inteiros pelo teclado. O programa so # vai parar quando o usuario digitar o # valor 999, que eh a condicao de parada. # No final, mostre quantos numeros foram # digitados e qual foi a soma entre eles # (desconsiderando o flag). n = s = c = 0 while True: n = int(input('Digite um numero [999 para parar]: ')) if n == 999: break s += n c += 1 print(f'A soma dos numeros eh: {s}') print(f'A quantidade de numero digitada foi: {c}')
n = s = c = 0 while True: n = int(input('Digite um numero [999 para parar]: ')) if n == 999: break s += n c += 1 print(f'A soma dos numeros eh: {s}') print(f'A quantidade de numero digitada foi: {c}')
class AdapterError(Exception): pass class ServiceAPIError(Exception): pass
class Adaptererror(Exception): pass class Serviceapierror(Exception): pass
#!/usr/bin/env python problem4 = max(i*j for i in range(100, 1000+1) for j in range(i, 1000+1) \ if str(i*j) == str(i*j)[::-1]) print(problem4)
problem4 = max((i * j for i in range(100, 1000 + 1) for j in range(i, 1000 + 1) if str(i * j) == str(i * j)[::-1])) print(problem4)
#!/usr/bin/env python class Solution: def search(self, nums: 'List[int]', target: 'int') -> 'int': lo, hi = 0, len(nums)-1 while lo <= hi: mi = lo + (hi-lo)//2 if target == nums[mi]: return mi if nums[lo] <= nums[mi]: if nums[lo] <= target < nums[mi]: hi = mi-1 else: lo = mi+1 else: if nums[mi] < target <= nums[hi]: lo = mi+1 else: hi = mi-1 return -1 sol = Solution() nums = [] nums = [4,5,6,7,0,1,2] nums = [3,1] target = 1 for target in nums: print(sol.search(nums, target))
class Solution: def search(self, nums: 'List[int]', target: 'int') -> 'int': (lo, hi) = (0, len(nums) - 1) while lo <= hi: mi = lo + (hi - lo) // 2 if target == nums[mi]: return mi if nums[lo] <= nums[mi]: if nums[lo] <= target < nums[mi]: hi = mi - 1 else: lo = mi + 1 elif nums[mi] < target <= nums[hi]: lo = mi + 1 else: hi = mi - 1 return -1 sol = solution() nums = [] nums = [4, 5, 6, 7, 0, 1, 2] nums = [3, 1] target = 1 for target in nums: print(sol.search(nums, target))
def add_time(start, duration, day=None): time, period = start.split() initial_period = period hr_start, min_start = time.split(':') hr_duration, min_duration = duration.split(':') min_new = int(min_start) + int(min_duration) hr_new = int(hr_start) + int(hr_duration) periods_later = 0 days_later = 0 DAYS_OF_WEEK = [ "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" ] if min_new > 59: min_new -= 60 hr_new += 1 hr_new_period = hr_new while hr_new > 12: hr_new -= 12 while hr_new_period > 11: hr_new_period -= 12 period = "PM" if period == "AM" else "AM" periods_later += 1 if periods_later % 2 != 0: if initial_period == "PM": periods_later += 1 else: periods_later -= 1 days_later = periods_later / 2 new_time = f"{hr_new}:{str(min_new).zfill(2)} {period}" if day: day_index = DAYS_OF_WEEK.index(day.title()) new_day_index = int((day_index + days_later) % 7) new_time += f", {DAYS_OF_WEEK[new_day_index]}" if days_later == 1: new_time += " (next day)" if days_later > 1: new_time += f" ({int(days_later)} days later)" return new_time
def add_time(start, duration, day=None): (time, period) = start.split() initial_period = period (hr_start, min_start) = time.split(':') (hr_duration, min_duration) = duration.split(':') min_new = int(min_start) + int(min_duration) hr_new = int(hr_start) + int(hr_duration) periods_later = 0 days_later = 0 days_of_week = ['Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'] if min_new > 59: min_new -= 60 hr_new += 1 hr_new_period = hr_new while hr_new > 12: hr_new -= 12 while hr_new_period > 11: hr_new_period -= 12 period = 'PM' if period == 'AM' else 'AM' periods_later += 1 if periods_later % 2 != 0: if initial_period == 'PM': periods_later += 1 else: periods_later -= 1 days_later = periods_later / 2 new_time = f'{hr_new}:{str(min_new).zfill(2)} {period}' if day: day_index = DAYS_OF_WEEK.index(day.title()) new_day_index = int((day_index + days_later) % 7) new_time += f', {DAYS_OF_WEEK[new_day_index]}' if days_later == 1: new_time += ' (next day)' if days_later > 1: new_time += f' ({int(days_later)} days later)' return new_time
# Histogram of life_exp, 15 bins plt.hist(life_exp, bins = 15) # Show and clear plot plt.show() plt.clf() # Histogram of life_exp1950, 15 bins plt.hist(life_exp1950, bins = 15) # Show and clear plot again plt.show() plt.clf()
plt.hist(life_exp, bins=15) plt.show() plt.clf() plt.hist(life_exp1950, bins=15) plt.show() plt.clf()
class Solution(object): def numberToWords(self, num): under_twenty = ["", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"] under_hundred_above_twenty = ["Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety", "Hundred"] thousands = ["" , "Thousand", "Million", "Billion"] def printer(remainder): res_print = "" # Handle zero case if remainder == 0: return " " # Get the hundreds digit if remainder >= 100: res_print += str( under_twenty[int(remainder/100)]) + " Hundred " # Get tens and ones digit, accounting for zero tens = remainder%100 # Under 20 is a special case due to english diction if tens < 20: res_print += under_twenty[tens] + " " elif tens < 100: res_print += under_hundred_above_twenty[ int(tens/10) - 2 ] + " " res_print += under_twenty[tens%10] + " " return res_print # Handle edge case if num == 0: return "Zero" # We subdivide the number into every thousands res = "" thousand_count = 0 # 123000 has the same start as 123, thus we keep dividing by 1000 while float(num / 1000.0) > 0.00001: # Use a helper function to determine the suffix, and add it to the beginning suffix = printer(num%1000) if suffix != " ": res = printer(num % 1000) + thousands[thousand_count] + " " + res # Update the thousand_count thousand_count +=1 # Update num and round it num = int(num/1000) res = res.split() res = " ".join(res) return res.strip() z = Solution() num = 1000001000 print(z.numberToWords(num))
class Solution(object): def number_to_words(self, num): under_twenty = ['', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Eleven', 'Twelve', 'Thirteen', 'Fourteen', 'Fifteen', 'Sixteen', 'Seventeen', 'Eighteen', 'Nineteen'] under_hundred_above_twenty = ['Twenty', 'Thirty', 'Forty', 'Fifty', 'Sixty', 'Seventy', 'Eighty', 'Ninety', 'Hundred'] thousands = ['', 'Thousand', 'Million', 'Billion'] def printer(remainder): res_print = '' if remainder == 0: return ' ' if remainder >= 100: res_print += str(under_twenty[int(remainder / 100)]) + ' Hundred ' tens = remainder % 100 if tens < 20: res_print += under_twenty[tens] + ' ' elif tens < 100: res_print += under_hundred_above_twenty[int(tens / 10) - 2] + ' ' res_print += under_twenty[tens % 10] + ' ' return res_print if num == 0: return 'Zero' res = '' thousand_count = 0 while float(num / 1000.0) > 1e-05: suffix = printer(num % 1000) if suffix != ' ': res = printer(num % 1000) + thousands[thousand_count] + ' ' + res thousand_count += 1 num = int(num / 1000) res = res.split() res = ' '.join(res) return res.strip() z = solution() num = 1000001000 print(z.numberToWords(num))
#!/usr/bin/env python # Software License Agreement (BSD License) # # Copyright (c) 2011, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided # with the distribution. # * Neither the name of Willow Garage, Inc. nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. def bonus(robot): # a nice bit of goodness from the turtlebot driver by Xuwen Cao and # Morgan Quigley song = ( (76, 16), (76, 16), (72, 8), (76, 16), (79, 32), (67, 32), (72, 24), (67, 24), (64, 24), (69, 16), (71, 16), (70, 8), (69, 16), (79, 16), (76, 16), (72, 8), (74, 16), (71, 24), (60, 16), (79, 8), (78, 8), (77, 8), (74, 8), (75, 8), (76, 16), (67, 8), (69, 8), (72, 16), (69, 8), (72, 8), (74, 8), (60, 16), (79, 8), (78, 8), (77, 8), (74, 8), (75, 8), (76, 16), (76, 4), (78, 4), (84, 16), (84, 8), (84, 16), (84, 16), (60, 16), (79, 8), (78, 8), (77, 8), (74, 8), (75, 8), (76, 16), (67, 8), (69, 8), (72, 16), (69, 8), (72, 8), (74, 16), (70, 4), (72, 4), (75, 16), (69, 4), (71, 4), (74, 16), (67, 4), (69, 4), (72, 16), (67, 8), (67, 16), (60, 24), ) # have to make sure robot is in full mode robot.sci.send([128, 132]) robot.sci.send([140, 1, len(song)]) for note in song: robot.sci.send(note) robot.sci.play_song(1) # From: http://www.harmony-central.com/MIDI/Doc/table2.html MIDI_TABLE = {'rest': 0, 'R': 0, 'pause': 0, 'G1': 31, 'G#1': 32, 'A1': 33, 'A#1': 34, 'B1': 35, 'C2': 36, 'C#2': 37, 'D2': 38, 'D#2': 39, 'E2': 40, 'F2': 41, 'F#2': 42, 'G2': 43, 'G#2': 44, 'A2': 45, 'A#2': 46, 'B2': 47, 'C3': 48, 'C#3': 49, 'D3': 50, 'D#3': 51, 'E3': 52, 'F3': 53, 'F#3': 54, 'G3': 55, 'G#3': 56, 'A3': 57, 'A#3': 58, 'B3': 59, 'C4': 60, 'C#4': 61, 'D4': 62, 'D#4': 63, 'E4': 64, 'F4': 65, 'F#4': 66, 'G4': 67, 'G#4': 68, 'A4': 69, 'A#4': 70, 'B4': 71, 'C5': 72, 'C#5': 73, 'D5': 74, 'D#5': 75, 'E5': 76, 'F5': 77, 'F#5': 78, 'G5': 79, 'G#5': 80, 'A5': 81, 'A#5': 82, 'B5': 83, 'C6': 84, 'C#6': 85, 'D6': 86, 'D#6': 87, 'E6': 88, 'F6': 89, 'F#6': 90, 'G6': 91, 'G#6': 92, 'A6': 93, 'A#6': 94, 'B6': 95, 'C7': 96, 'C#7': 97, 'D7': 98, 'D#7': 99, 'E7': 100, 'F7': 101, 'F#7': 102, 'G7': 103, 'G#7': 104, 'A7': 105, 'A#7': 106, 'B7': 107, 'C8': 108, 'C#8': 109, 'D8': 110, 'D#8': 111, 'E8': 112, 'F8': 113, 'F#8': 114, 'G8': 115, 'G#8': 116, 'A8': 117, 'A#8': 118, 'B8': 119, 'C9': 120, 'C#9': 121, 'D9': 122, 'D#9': 123, 'E9': 124, 'F9': 125, 'F#9': 126, 'G9': 127}
def bonus(robot): song = ((76, 16), (76, 16), (72, 8), (76, 16), (79, 32), (67, 32), (72, 24), (67, 24), (64, 24), (69, 16), (71, 16), (70, 8), (69, 16), (79, 16), (76, 16), (72, 8), (74, 16), (71, 24), (60, 16), (79, 8), (78, 8), (77, 8), (74, 8), (75, 8), (76, 16), (67, 8), (69, 8), (72, 16), (69, 8), (72, 8), (74, 8), (60, 16), (79, 8), (78, 8), (77, 8), (74, 8), (75, 8), (76, 16), (76, 4), (78, 4), (84, 16), (84, 8), (84, 16), (84, 16), (60, 16), (79, 8), (78, 8), (77, 8), (74, 8), (75, 8), (76, 16), (67, 8), (69, 8), (72, 16), (69, 8), (72, 8), (74, 16), (70, 4), (72, 4), (75, 16), (69, 4), (71, 4), (74, 16), (67, 4), (69, 4), (72, 16), (67, 8), (67, 16), (60, 24)) robot.sci.send([128, 132]) robot.sci.send([140, 1, len(song)]) for note in song: robot.sci.send(note) robot.sci.play_song(1) midi_table = {'rest': 0, 'R': 0, 'pause': 0, 'G1': 31, 'G#1': 32, 'A1': 33, 'A#1': 34, 'B1': 35, 'C2': 36, 'C#2': 37, 'D2': 38, 'D#2': 39, 'E2': 40, 'F2': 41, 'F#2': 42, 'G2': 43, 'G#2': 44, 'A2': 45, 'A#2': 46, 'B2': 47, 'C3': 48, 'C#3': 49, 'D3': 50, 'D#3': 51, 'E3': 52, 'F3': 53, 'F#3': 54, 'G3': 55, 'G#3': 56, 'A3': 57, 'A#3': 58, 'B3': 59, 'C4': 60, 'C#4': 61, 'D4': 62, 'D#4': 63, 'E4': 64, 'F4': 65, 'F#4': 66, 'G4': 67, 'G#4': 68, 'A4': 69, 'A#4': 70, 'B4': 71, 'C5': 72, 'C#5': 73, 'D5': 74, 'D#5': 75, 'E5': 76, 'F5': 77, 'F#5': 78, 'G5': 79, 'G#5': 80, 'A5': 81, 'A#5': 82, 'B5': 83, 'C6': 84, 'C#6': 85, 'D6': 86, 'D#6': 87, 'E6': 88, 'F6': 89, 'F#6': 90, 'G6': 91, 'G#6': 92, 'A6': 93, 'A#6': 94, 'B6': 95, 'C7': 96, 'C#7': 97, 'D7': 98, 'D#7': 99, 'E7': 100, 'F7': 101, 'F#7': 102, 'G7': 103, 'G#7': 104, 'A7': 105, 'A#7': 106, 'B7': 107, 'C8': 108, 'C#8': 109, 'D8': 110, 'D#8': 111, 'E8': 112, 'F8': 113, 'F#8': 114, 'G8': 115, 'G#8': 116, 'A8': 117, 'A#8': 118, 'B8': 119, 'C9': 120, 'C#9': 121, 'D9': 122, 'D#9': 123, 'E9': 124, 'F9': 125, 'F#9': 126, 'G9': 127}
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def isSubtree(self, root: TreeNode, subRoot: TreeNode) -> bool: if not root: return False return self.isEqualtree(root, subRoot) or self.isSubtree(root.left, subRoot) or self.isSubtree(root.right, subRoot) def isEqualtree(self, root1, root2): if not root1 and not root2: return True if not root1 or not root2: return False if root1.val != root2.val: return False return self.isEqualtree(root1.left, root2.left) and self.isEqualtree(root1.right, root2.right)
class Solution: def is_subtree(self, root: TreeNode, subRoot: TreeNode) -> bool: if not root: return False return self.isEqualtree(root, subRoot) or self.isSubtree(root.left, subRoot) or self.isSubtree(root.right, subRoot) def is_equaltree(self, root1, root2): if not root1 and (not root2): return True if not root1 or not root2: return False if root1.val != root2.val: return False return self.isEqualtree(root1.left, root2.left) and self.isEqualtree(root1.right, root2.right)
'''Helper to filter sets of data''' class SetFilter: '''Helper class to filter list''' @staticmethod def diff(a_set, b_set): '''Filter by not intersection''' return not set(b_set).intersection(set(a_set)) @staticmethod def exact(a_set, b_set): '''Filter by eq''' return set(a_set) == set(b_set) @staticmethod def subset(a_set, b_set): '''Filter by intersection''' return set(a_set).intersection(set(b_set))
"""Helper to filter sets of data""" class Setfilter: """Helper class to filter list""" @staticmethod def diff(a_set, b_set): """Filter by not intersection""" return not set(b_set).intersection(set(a_set)) @staticmethod def exact(a_set, b_set): """Filter by eq""" return set(a_set) == set(b_set) @staticmethod def subset(a_set, b_set): """Filter by intersection""" return set(a_set).intersection(set(b_set))
# Solution to Exercise #1 # ... env = MultiAgentArena() obs = env.reset() while True: # Compute actions separately for each agent. a1 = dummy_trainer.compute_action(obs["agent1"]) a2 = dummy_trainer.compute_action(obs["agent2"]) # Send the action-dict to the env. obs, rewards, dones, _ = env.step({"agent1": a1, "agent2": a2}) # Get a rendered image from the env. out.clear_output(wait=True) env.render() time.sleep(0.1) if dones["agent1"]: break
env = multi_agent_arena() obs = env.reset() while True: a1 = dummy_trainer.compute_action(obs['agent1']) a2 = dummy_trainer.compute_action(obs['agent2']) (obs, rewards, dones, _) = env.step({'agent1': a1, 'agent2': a2}) out.clear_output(wait=True) env.render() time.sleep(0.1) if dones['agent1']: break
#!/usr/bin/env python # -*- coding: utf-8 -*- count = 0 while count < 10: count += 1 if count % 2 == 0: continue print(count, end=" ")
count = 0 while count < 10: count += 1 if count % 2 == 0: continue print(count, end=' ')
def bubble_sort(arr): length = len(arr) for i in range(length): for j in range(0, length - i - 1): if arr[j] > arr[j + 1]: arr[j], arr[j + 1] = arr[j + 1], arr[j] def main(): random_list = [12, 4, 5, 6, 25, 14, 15] bubble_sort(random_list) print(random_list) if __name__ == "__main__": main()
def bubble_sort(arr): length = len(arr) for i in range(length): for j in range(0, length - i - 1): if arr[j] > arr[j + 1]: (arr[j], arr[j + 1]) = (arr[j + 1], arr[j]) def main(): random_list = [12, 4, 5, 6, 25, 14, 15] bubble_sort(random_list) print(random_list) if __name__ == '__main__': main()
def bowling_score(frames): frames = [list(r) for r in frames.split(' ')] points = 0 for f in range(0, 8): if frames[f][0] == 'X': points += 10 if frames[f+1][0] == 'X': points += 10 if frames[f+2][0] == 'X': points += 10 else: points += int(frames[f+2][0]) elif frames[f+1][1] == '/': points += 10 else: points += int(frames[f+1][0]) + int(frames[f+1][1]) elif frames[f][1] == '/': points += 10 if frames[f+1][0] == 'X': points += 10 else: points += int(frames[f+1][0]) else: points += int(frames[f][0]) + int(frames[f][1]) if frames[8][0] == 'X': points += 10 if frames[9][0] == 'X': points += 10 if frames[9][1] == 'X': points += 10 else: points += int(frames[9][1]) elif frames[9][1] == '/': points += 10 else: points += int(frames[9][0]) + int(frames[9][1]) elif frames[8][1] == '/': points += 10 if frames[9][0] == 'X': points += 10 else: points += int(frames[9][0]) else: points += int(frames[8][0]) + int(frames[8][1]) if frames[9][0] == 'X': points += 10 if frames[9][1] == 'X': points += 10 if frames[9][2] == 'X': points += 10 else: points += int(frames[9][2]) elif frames[9][2] == '/': points += 10 else: points += int(frames[9][1]) + int(frames[9][2]) elif frames[9][1] == '/': points += 10 if frames[9][2] == 'X': points += 10 else: points += int(frames[9][2]) else: points += int(frames[9][0]) + int(frames[9][1]) return points if __name__ == '__main__': print(bowling_score('11 11 11 11 11 11 11 11 11 11')) print(bowling_score('X X X X X X X X X XXX')) print(bowling_score('00 5/ 4/ 53 33 22 4/ 5/ 45 XXX')) print(bowling_score('5/ 4/ 3/ 2/ 1/ 0/ X 9/ 4/ 8/8')) print(bowling_score('5/ 4/ 3/ 2/ 1/ 0/ X 9/ 4/ 7/2'))
def bowling_score(frames): frames = [list(r) for r in frames.split(' ')] points = 0 for f in range(0, 8): if frames[f][0] == 'X': points += 10 if frames[f + 1][0] == 'X': points += 10 if frames[f + 2][0] == 'X': points += 10 else: points += int(frames[f + 2][0]) elif frames[f + 1][1] == '/': points += 10 else: points += int(frames[f + 1][0]) + int(frames[f + 1][1]) elif frames[f][1] == '/': points += 10 if frames[f + 1][0] == 'X': points += 10 else: points += int(frames[f + 1][0]) else: points += int(frames[f][0]) + int(frames[f][1]) if frames[8][0] == 'X': points += 10 if frames[9][0] == 'X': points += 10 if frames[9][1] == 'X': points += 10 else: points += int(frames[9][1]) elif frames[9][1] == '/': points += 10 else: points += int(frames[9][0]) + int(frames[9][1]) elif frames[8][1] == '/': points += 10 if frames[9][0] == 'X': points += 10 else: points += int(frames[9][0]) else: points += int(frames[8][0]) + int(frames[8][1]) if frames[9][0] == 'X': points += 10 if frames[9][1] == 'X': points += 10 if frames[9][2] == 'X': points += 10 else: points += int(frames[9][2]) elif frames[9][2] == '/': points += 10 else: points += int(frames[9][1]) + int(frames[9][2]) elif frames[9][1] == '/': points += 10 if frames[9][2] == 'X': points += 10 else: points += int(frames[9][2]) else: points += int(frames[9][0]) + int(frames[9][1]) return points if __name__ == '__main__': print(bowling_score('11 11 11 11 11 11 11 11 11 11')) print(bowling_score('X X X X X X X X X XXX')) print(bowling_score('00 5/ 4/ 53 33 22 4/ 5/ 45 XXX')) print(bowling_score('5/ 4/ 3/ 2/ 1/ 0/ X 9/ 4/ 8/8')) print(bowling_score('5/ 4/ 3/ 2/ 1/ 0/ X 9/ 4/ 7/2'))
# -*- coding: utf-8 -*- __soap_format = ( '<?xml version="1.0" encoding="UTF-8"?>\n' '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" ' 'xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" ' 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' 'xmlns:xsd="http://www.w3.org/2001/XMLSchema" ' 'xmlns:ns1="{url}">' '<SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">' '<ns1:{action}>{params}</ns1:{action}>' '</SOAP-ENV:Body>' '</SOAP-ENV:Envelope>' ) __headers = { 'User-Agent': 'BSPlayer/2.x (1022.12362)', 'Content-Type': 'text/xml; charset=utf-8', 'Connection': 'close', } __subdomains = [1, 2, 3, 4, 5, 6, 7, 8, 101, 102, 103, 104, 105, 106, 107, 108, 109] def __get_url(core, service_name): context = core.services[service_name].context if not context.subdomain: time_seconds = core.datetime.now().second context.subdomain = __subdomains[time_seconds % len(__subdomains)] return "http://s%s.api.bsplayer-subtitles.com/v1.php" % context.subdomain def __validate_response(core, service_name, request, response, retry=True): if not retry: return None def get_retry_request(): core.time.sleep(2) request['validate'] = lambda response: __validate_response(core, service_name, request, response, retry=False) return request if response is None: return get_retry_request() if response.status_code != 200: return get_retry_request() response = __parse_response(core, service_name, response.text) if response is None: return None status_code = response.find('result/result') if status_code is None: status_code = response.find('result') if status_code.text != '200' and status_code.text != '402': return get_retry_request() results = response.findall('data/item') if not results: return get_retry_request() if len(results) == 0: return get_retry_request() return None def __get_request(core, service_name, action, params): url = __get_url(core, service_name) headers = __headers.copy() headers['SOAPAction'] = '"%s#%s"' % (url, action) request = { 'method': 'POST', 'url': url, 'data': __soap_format.format(url=url, action=action, params=params), 'headers': headers, 'validate': lambda response: __validate_response(core, service_name, request, response) } return request def __parse_response(core, service_name, response): try: tree = core.ElementTree.fromstring(response.strip()) return tree.find('.//return') except Exception as exc: core.logger.error('%s - %s' % (service_name, exc)) return None def __logout(core, service_name): context = core.services[service_name].context if not context.token: return action = 'logOut' params = '<handle>%s</handle>' % context.token request = __get_request(core, service_name, action, params) def logout(): core.request.execute(core, request) context.token = None thread = core.threading.Thread(target=logout) thread.start() def build_auth_request(core, service_name): action = 'logIn' params = ( '<username></username>' '<password></password>' '<AppID>BSPlayer v2.72</AppID>' ) return __get_request(core, service_name, action, params) def parse_auth_response(core, service_name, response): response = __parse_response(core, service_name, response) if response is None: return if response.find('result').text == '200': token = response.find('data').text core.services[service_name].context.token = token def build_search_requests(core, service_name, meta): token = core.services[service_name].context.token if not token: return [] action = 'searchSubtitles' params = ( '<handle>{token}</handle>' '<movieHash>{filehash}</movieHash>' '<movieSize>{filesize}</movieSize>' '<languageId>{lang_ids}</languageId>' '<imdbId>{imdb_id}</imdbId>' ).format( token=token, filesize=meta.filesize if meta.filesize else '0', filehash=meta.filehash if meta.filehash else '0', lang_ids=','.join(core.utils.get_lang_ids(meta.languages)), imdb_id=meta.imdb_id[2:] ) return [__get_request(core, service_name, action, params)] def parse_search_response(core, service_name, meta, response): __logout(core, service_name) service = core.services[service_name] response = __parse_response(core, service_name, response.text) if response is None: return [] if response.find('result/result').text != '200': return [] results = response.findall('data/item') if not results: return [] lang_ids = core.utils.get_lang_ids(meta.languages) def map_result(result): name = result.find('subName').text lang_id = result.find('subLang').text rating = result.find('subRating').text try: lang = meta.languages[lang_ids.index(lang_id)] except: lang = lang_id return { 'service_name': service_name, 'service': service.display_name, 'lang': lang, 'name': name, 'rating': int(round(float(rating) / 2)) if rating else 0, 'lang_code': core.kodi.xbmc.convertLanguage(lang, core.kodi.xbmc.ISO_639_1), 'sync': 'true' if meta.filehash else 'false', 'impaired': 'false', 'color': 'gold', 'action_args': { 'url': result.find('subDownloadLink').text, 'lang': lang, 'filename': name, 'gzip': True } } return list(map(map_result, results)) def build_download_request(core, service_name, args): request = { 'method': 'GET', 'url': args['url'] } return request
__soap_format = '<?xml version="1.0" encoding="UTF-8"?>\n<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="{url}"><SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><ns1:{action}>{params}</ns1:{action}></SOAP-ENV:Body></SOAP-ENV:Envelope>' __headers = {'User-Agent': 'BSPlayer/2.x (1022.12362)', 'Content-Type': 'text/xml; charset=utf-8', 'Connection': 'close'} __subdomains = [1, 2, 3, 4, 5, 6, 7, 8, 101, 102, 103, 104, 105, 106, 107, 108, 109] def __get_url(core, service_name): context = core.services[service_name].context if not context.subdomain: time_seconds = core.datetime.now().second context.subdomain = __subdomains[time_seconds % len(__subdomains)] return 'http://s%s.api.bsplayer-subtitles.com/v1.php' % context.subdomain def __validate_response(core, service_name, request, response, retry=True): if not retry: return None def get_retry_request(): core.time.sleep(2) request['validate'] = lambda response: __validate_response(core, service_name, request, response, retry=False) return request if response is None: return get_retry_request() if response.status_code != 200: return get_retry_request() response = __parse_response(core, service_name, response.text) if response is None: return None status_code = response.find('result/result') if status_code is None: status_code = response.find('result') if status_code.text != '200' and status_code.text != '402': return get_retry_request() results = response.findall('data/item') if not results: return get_retry_request() if len(results) == 0: return get_retry_request() return None def __get_request(core, service_name, action, params): url = __get_url(core, service_name) headers = __headers.copy() headers['SOAPAction'] = '"%s#%s"' % (url, action) request = {'method': 'POST', 'url': url, 'data': __soap_format.format(url=url, action=action, params=params), 'headers': headers, 'validate': lambda response: __validate_response(core, service_name, request, response)} return request def __parse_response(core, service_name, response): try: tree = core.ElementTree.fromstring(response.strip()) return tree.find('.//return') except Exception as exc: core.logger.error('%s - %s' % (service_name, exc)) return None def __logout(core, service_name): context = core.services[service_name].context if not context.token: return action = 'logOut' params = '<handle>%s</handle>' % context.token request = __get_request(core, service_name, action, params) def logout(): core.request.execute(core, request) context.token = None thread = core.threading.Thread(target=logout) thread.start() def build_auth_request(core, service_name): action = 'logIn' params = '<username></username><password></password><AppID>BSPlayer v2.72</AppID>' return __get_request(core, service_name, action, params) def parse_auth_response(core, service_name, response): response = __parse_response(core, service_name, response) if response is None: return if response.find('result').text == '200': token = response.find('data').text core.services[service_name].context.token = token def build_search_requests(core, service_name, meta): token = core.services[service_name].context.token if not token: return [] action = 'searchSubtitles' params = '<handle>{token}</handle><movieHash>{filehash}</movieHash><movieSize>{filesize}</movieSize><languageId>{lang_ids}</languageId><imdbId>{imdb_id}</imdbId>'.format(token=token, filesize=meta.filesize if meta.filesize else '0', filehash=meta.filehash if meta.filehash else '0', lang_ids=','.join(core.utils.get_lang_ids(meta.languages)), imdb_id=meta.imdb_id[2:]) return [__get_request(core, service_name, action, params)] def parse_search_response(core, service_name, meta, response): __logout(core, service_name) service = core.services[service_name] response = __parse_response(core, service_name, response.text) if response is None: return [] if response.find('result/result').text != '200': return [] results = response.findall('data/item') if not results: return [] lang_ids = core.utils.get_lang_ids(meta.languages) def map_result(result): name = result.find('subName').text lang_id = result.find('subLang').text rating = result.find('subRating').text try: lang = meta.languages[lang_ids.index(lang_id)] except: lang = lang_id return {'service_name': service_name, 'service': service.display_name, 'lang': lang, 'name': name, 'rating': int(round(float(rating) / 2)) if rating else 0, 'lang_code': core.kodi.xbmc.convertLanguage(lang, core.kodi.xbmc.ISO_639_1), 'sync': 'true' if meta.filehash else 'false', 'impaired': 'false', 'color': 'gold', 'action_args': {'url': result.find('subDownloadLink').text, 'lang': lang, 'filename': name, 'gzip': True}} return list(map(map_result, results)) def build_download_request(core, service_name, args): request = {'method': 'GET', 'url': args['url']} return request
ACCEL_FSR_2G = 0 ACCEL_FSR_4G = 1 ACCEL_FSR_8G = 2 ACCEL_FSR_16G = 3
accel_fsr_2_g = 0 accel_fsr_4_g = 1 accel_fsr_8_g = 2 accel_fsr_16_g = 3
SUCCESS = 0 FAILURE = 1 # NOTE: click.abort() uses this # for when tests are already running ALREADY_RUNNING = 2
success = 0 failure = 1 already_running = 2
karman_line_earth = 100_000*m // km karman_line_mars = 80_000*m // km karman_line_venus = 250_000*m // km
karman_line_earth = 100000 * m // km karman_line_mars = 80000 * m // km karman_line_venus = 250000 * m // km
class Car: def __init__(self, make, petrol_consumption): self.make = make self.petrol_consumption = petrol_consumption def petrol_calculation(self, price = 22.5): return self.petrol_consumption * price ford = Car("ford", 10) money = ford.petrol_calculation() print(money)
class Car: def __init__(self, make, petrol_consumption): self.make = make self.petrol_consumption = petrol_consumption def petrol_calculation(self, price=22.5): return self.petrol_consumption * price ford = car('ford', 10) money = ford.petrol_calculation() print(money)
# Mouse Move # # November 12, 2018 # By Robin Nash [c,r] = [int(i) for i in input().split(" ") if i != " "] x,y = 0,0 while True: pair = [int(i) for i in input().split(" ") if i != " "] if pair == [0,0]: break x += pair[0] y += pair[1] pair = [x,y] for i in range(2): if pair[i] > [c,r][i]: pair[i] = [c,r][i] if pair[i] < 0: pair[i] = 0 [x,y] = pair print(x,y) #1541983052.0
[c, r] = [int(i) for i in input().split(' ') if i != ' '] (x, y) = (0, 0) while True: pair = [int(i) for i in input().split(' ') if i != ' '] if pair == [0, 0]: break x += pair[0] y += pair[1] pair = [x, y] for i in range(2): if pair[i] > [c, r][i]: pair[i] = [c, r][i] if pair[i] < 0: pair[i] = 0 [x, y] = pair print(x, y)
class Solution: def thirdMax(self, nums: List[int]) -> int: hq = [] for x in nums: if x not in hq: if len(hq) < 3: heapq.heappush(hq, x) else: heapq.heappushpop(hq, x) if len(hq) < 3: return hq[-1] return hq[0]
class Solution: def third_max(self, nums: List[int]) -> int: hq = [] for x in nums: if x not in hq: if len(hq) < 3: heapq.heappush(hq, x) else: heapq.heappushpop(hq, x) if len(hq) < 3: return hq[-1] return hq[0]
s = input() k = int(input()) ans = set() for i in range(len(s)): for j in range(1, k+1): ans.add(s[i:i+j]) # print(ans) print(sorted(list(ans))[k-1])
s = input() k = int(input()) ans = set() for i in range(len(s)): for j in range(1, k + 1): ans.add(s[i:i + j]) print(sorted(list(ans))[k - 1])
# -*- coding: utf-8 -*- def test_task_run(): print("test task run module") assert 1 == 1
def test_task_run(): print('test task run module') assert 1 == 1
n=int(input("Enter the Decimal Number:")) def covbin(n): if(n==0): return 0 else: return (n%2)+(10*covbin(n//2)) print("Binary is=",covbin(n))
n = int(input('Enter the Decimal Number:')) def covbin(n): if n == 0: return 0 else: return n % 2 + 10 * covbin(n // 2) print('Binary is=', covbin(n))
__all__ = ['descriptor', 'es_transport', 'flushing_buffer', 'line_buffer', 'sqs_transport', 'transport_exceptions', 'transport_result', 'transport_utils']
__all__ = ['descriptor', 'es_transport', 'flushing_buffer', 'line_buffer', 'sqs_transport', 'transport_exceptions', 'transport_result', 'transport_utils']
def total_centro_custo(D_e): D_return = {} # Pecorre dados de cada pessoa for v in D_e.values(): if v['centro de custo'] not in D_return: D_return[v['centro de custo']] = 0 D_return[v['centro de custo']] += v['valor'] return D_return
def total_centro_custo(D_e): d_return = {} for v in D_e.values(): if v['centro de custo'] not in D_return: D_return[v['centro de custo']] = 0 D_return[v['centro de custo']] += v['valor'] return D_return
def print_n(s, n): while n >= 0: print(s) n -= 1
def print_n(s, n): while n >= 0: print(s) n -= 1
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). # You may not use this file except in compliance with the License. # A copy of the License is located at # # http://www.apache.org/licenses/LICENSE-2.0 # # or in the "license" file accompanying this file. This file is distributed # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either # express or implied. See the License for the specific language governing # permissions and limitations under the License. PACKAGE_XML_ELEMENT_ORDER = [ "name", "version", "description", "author", "maintainer", "license", "url", "buildtool_depend", "build_depend", "build_export_depend", "depend", "exec_depend", "test_depend", "member_of_group", "doc_depend", "conflict", "replace", "export", ] CMAKE_LISTS_RENAMED_VARIABLES = { "${CATKIN_DEVEL_PREFIX}/": "", "${CATKIN_GLOBAL_BIN_DESTINATION}": "bin", "${CATKIN_GLOBAL_INCLUDE_DESTINATION}": "include", "${CATKIN_GLOBAL_LIB_DESTINATION}": "lib", "${CATKIN_GLOBAL_LIBEXEC_DESTINATION}": "lib", "${CATKIN_GLOBAL_SHARE_DESTINATION}": "share", "${CATKIN_PACKAGE_BIN_DESTINATION}": "bin", "${CATKIN_PACKAGE_INCLUDE_DESTINATION}": "include/${PROJECT_NAME}", "${CATKIN_PACKAGE_LIB_DESTINATION}": "lib", "${CATKIN_PACKAGE_SHARE_DESTINATION}": "share/${PROJECT_NAME}", "CATKIN_ENABLE_TESTING": "BUILD_TESTING" } # Commands that are not used by ROS2 CMAKE_LISTS_DELETED_COMMANDS = [ "catkin_package", "roslaunch_add_file_check" ] # List of ROS packages that have been renamed in ROS 2 RENAMED_ROS_PACKAGES = { "tf": "tf2", "roscpp": "rclcpp", # This shouldn't be here anyways "rospy": "rclpy", # This shouldn't be here anyways "nodelet": "rclcpp", # This shouldn't be here anyways "message_generation": "rosidl_default_generators", # Shouldn't be here "message_runtime": "rosidl_default_runtime", # Shouldn't be here "rosconsole": "ros2_console", # Until ROS 2 replacement exists "rviz": "rviz2", "catkin": "ament_cmake" # Well.. it's not exactly a rename, but good enough } # List of packages that do not need to be found by CMake NO_CMAKE_FIND_PACKAGES = [ "rosidl_default_runtime", # Shouldn't be here "roslaunch", # They're probably trying to do roslaunch file testing "catkin" ] # List of packages that do not need to be found in package.xml NO_PKG_XML_DEPENDS = [ "roslaunch" ] # List of executables that have likely been renamed in ROS 2 RENAMED_ROS_EXECUTABLES = { "rviz": "rviz2" }
package_xml_element_order = ['name', 'version', 'description', 'author', 'maintainer', 'license', 'url', 'buildtool_depend', 'build_depend', 'build_export_depend', 'depend', 'exec_depend', 'test_depend', 'member_of_group', 'doc_depend', 'conflict', 'replace', 'export'] cmake_lists_renamed_variables = {'${CATKIN_DEVEL_PREFIX}/': '', '${CATKIN_GLOBAL_BIN_DESTINATION}': 'bin', '${CATKIN_GLOBAL_INCLUDE_DESTINATION}': 'include', '${CATKIN_GLOBAL_LIB_DESTINATION}': 'lib', '${CATKIN_GLOBAL_LIBEXEC_DESTINATION}': 'lib', '${CATKIN_GLOBAL_SHARE_DESTINATION}': 'share', '${CATKIN_PACKAGE_BIN_DESTINATION}': 'bin', '${CATKIN_PACKAGE_INCLUDE_DESTINATION}': 'include/${PROJECT_NAME}', '${CATKIN_PACKAGE_LIB_DESTINATION}': 'lib', '${CATKIN_PACKAGE_SHARE_DESTINATION}': 'share/${PROJECT_NAME}', 'CATKIN_ENABLE_TESTING': 'BUILD_TESTING'} cmake_lists_deleted_commands = ['catkin_package', 'roslaunch_add_file_check'] renamed_ros_packages = {'tf': 'tf2', 'roscpp': 'rclcpp', 'rospy': 'rclpy', 'nodelet': 'rclcpp', 'message_generation': 'rosidl_default_generators', 'message_runtime': 'rosidl_default_runtime', 'rosconsole': 'ros2_console', 'rviz': 'rviz2', 'catkin': 'ament_cmake'} no_cmake_find_packages = ['rosidl_default_runtime', 'roslaunch', 'catkin'] no_pkg_xml_depends = ['roslaunch'] renamed_ros_executables = {'rviz': 'rviz2'}
class CommandModule: def __init__(self, name, bus, conn, chan, conf): self.name = name self.conf = conf self.chan = chan self.conn = conn self.bus = bus def send(self, msg): self.conn.privmsg(self.chan, msg) def error(self, msg): self.status('error: {}'.format(msg)) def status(self, msg): self.send('[{}] {}'.format(self.name, msg)) def on_message(self, src, content): content = content.strip() words = content.split(' ') if len(words) == 0: return cmd = words[0] if cmd[0] != '!': return cmd = words[0][1:] if hasattr(self, 'cmd_'+cmd): getattr(self, 'cmd_'+cmd)(src, words[1:], content[len(words[0]):].strip(), src) def post(self, msg, *args, **kwargs): self.bus.post(self, msg, args, kwargs) def bus_handle(self, msg, args, kwargs): mname = 'busmsg_' + msg if hasattr(self, mname): getattr(self, mname)(*args, **kwargs)
class Commandmodule: def __init__(self, name, bus, conn, chan, conf): self.name = name self.conf = conf self.chan = chan self.conn = conn self.bus = bus def send(self, msg): self.conn.privmsg(self.chan, msg) def error(self, msg): self.status('error: {}'.format(msg)) def status(self, msg): self.send('[{}] {}'.format(self.name, msg)) def on_message(self, src, content): content = content.strip() words = content.split(' ') if len(words) == 0: return cmd = words[0] if cmd[0] != '!': return cmd = words[0][1:] if hasattr(self, 'cmd_' + cmd): getattr(self, 'cmd_' + cmd)(src, words[1:], content[len(words[0]):].strip(), src) def post(self, msg, *args, **kwargs): self.bus.post(self, msg, args, kwargs) def bus_handle(self, msg, args, kwargs): mname = 'busmsg_' + msg if hasattr(self, mname): getattr(self, mname)(*args, **kwargs)
text = input('Enter a text: ') character = input('Enter a character that you can search in "'+text+'": ') result = text.count(character) print('The character "'+character+'" appears '+str(result)+' times in "'+text+'".')
text = input('Enter a text: ') character = input('Enter a character that you can search in "' + text + '": ') result = text.count(character) print('The character "' + character + '" appears ' + str(result) + ' times in "' + text + '".')
class BME280: '''Class to mock temp sensor''' def __init__(self): '''Constructor for mock''' def get_temperature(self): '''Temp''' return 20.0
class Bme280: """Class to mock temp sensor""" def __init__(self): """Constructor for mock""" def get_temperature(self): """Temp""" return 20.0
def test_movie_tech_sections(ia): movie = ia.get_movie('0133093', info=['technical']) tech = movie.get('tech', []) assert set(tech.keys()) == set(['sound mix', 'color', 'aspect ratio', 'camera', 'laboratory', 'cinematographic process', 'printed film format', 'negative format', 'runtime', 'film length'])
def test_movie_tech_sections(ia): movie = ia.get_movie('0133093', info=['technical']) tech = movie.get('tech', []) assert set(tech.keys()) == set(['sound mix', 'color', 'aspect ratio', 'camera', 'laboratory', 'cinematographic process', 'printed film format', 'negative format', 'runtime', 'film length'])
#!/usr/bin/env python3 #Swimming in the pool excercise def getValue(): try: valueInput = int(input()) except ValueError: print("Wrong type") quit() else: return valueInput def calcResidue(length, coordinate): halfOfLength = length / 2 residue = length - coordinate if residue < halfOfLength: return residue else: return coordinate N = getValue() M = getValue() short = getValue() long = getValue() shortCalculated = short longCalculated = long if M < N: shortCalculated = calcResidue(M, short) else: longCalculated = calcResidue(N, long) if shortCalculated < longCalculated: print(shortCalculated) else: print(longCalculated)
def get_value(): try: value_input = int(input()) except ValueError: print('Wrong type') quit() else: return valueInput def calc_residue(length, coordinate): half_of_length = length / 2 residue = length - coordinate if residue < halfOfLength: return residue else: return coordinate n = get_value() m = get_value() short = get_value() long = get_value() short_calculated = short long_calculated = long if M < N: short_calculated = calc_residue(M, short) else: long_calculated = calc_residue(N, long) if shortCalculated < longCalculated: print(shortCalculated) else: print(longCalculated)
class Robot: def greet(self): print('Hello Viraj') class RobotChild(Robot): def greet(self): print('Hello Scott') # Instantiate RobotChild Class child = RobotChild() # Invoke Greet method from RobotChild class child.greet()
class Robot: def greet(self): print('Hello Viraj') class Robotchild(Robot): def greet(self): print('Hello Scott') child = robot_child() child.greet()
#!/usr/bin/env python3 def welcome(): print("Welcome") def hi(name): print("Hi " + name + "!") welcome() username = input("Who are there? ") hi(name=username) hi(username)
def welcome(): print('Welcome') def hi(name): print('Hi ' + name + '!') welcome() username = input('Who are there? ') hi(name=username) hi(username)
classes_names = [ 'book', 'bottle', 'cabinet', 'ceiling', 'chair', 'cone', 'counter', 'dishwasher', 'faucet', 'fire extinguisher', 'floor', 'garbage bin', 'microwave', 'paper towel dispenser', 'paper', 'pot', 'refridgerator', 'stove burner', 'table', 'unknown', 'wall', 'bowl', 'magnet', 'sink', 'air vent', 'box', 'door knob', 'door', 'scissor', 'tape dispenser', 'telephone cord', 'telephone', 'track light', 'cork board', 'cup', 'desk', 'laptop', 'air duct', 'basket', 'camera', 'pipe', 'shelves', 'stacked chairs', 'styrofoam object', 'whiteboard', 'computer', 'keyboard', 'ladder', 'monitor', 'stand', 'bar', 'motion camera', 'projector screen', 'speaker', 'bag', 'clock', 'green screen', 'mantel', 'window', 'ball', 'hole puncher', 'light', 'manilla envelope', 'picture', 'mail shelf', 'printer', 'stapler', 'fax machine', 'folder', 'jar', 'magazine', 'ruler', 'cable modem', 'fan', 'file', 'hand sanitizer', 'paper rack', 'vase', 'air conditioner', 'blinds', 'flower', 'plant', 'sofa', 'stereo', 'books', 'exit sign', 'room divider', 'bookshelf', 'curtain', 'projector', 'modem', 'wire', 'water purifier', 'column', 'hooks', 'hanging hooks', 'pen', 'electrical outlet', 'doll', 'eraser', 'pencil holder', 'water carboy', 'mouse', 'cable rack', 'wire rack', 'flipboard', 'map', 'paper cutter', 'tape', 'thermostat', 'heater', 'circuit breaker box', 'paper towel', 'stamp', 'duster', 'poster case', 'whiteboard marker', 'ethernet jack', 'pillow', 'hair brush', 'makeup brush', 'mirror', 'shower curtain', 'toilet', 'toiletries bag', 'toothbrush holder', 'toothbrush', 'toothpaste', 'platter', 'rug', 'squeeze tube', 'shower cap', 'soap', 'towel rod', 'towel', 'bathtub', 'candle', 'tissue box', 'toilet paper', 'container', 'clothes', 'electric toothbrush', 'floor mat', 'lamp', 'drum', 'flower pot', 'banana', 'candlestick', 'shoe', 'stool', 'urn', 'earplugs', 'mailshelf', 'placemat', 'excercise ball', 'alarm clock', 'bed', 'night stand', 'deoderant', 'headphones', 'headboard', 'basketball hoop', 'foot rest', 'laundry basket', 'sock', 'football', 'mens suit', 'cable box', 'dresser', 'dvd player', 'shaver', 'television', 'contact lens solution bottle', 'drawer', 'remote control', 'cologne', 'stuffed animal', 'lint roller', 'tray', 'lock', 'purse', 'toy bottle', 'crate', 'vasoline', 'gift wrapping roll', 'wall decoration', 'hookah', 'radio', 'bicycle', 'pen box', 'mask', 'shorts', 'hat', 'hockey glove', 'hockey stick', 'vuvuzela', 'dvd', 'chessboard', 'suitcase', 'calculator', 'flashcard', 'staple remover', 'umbrella', 'bench', 'yoga mat', 'backpack', 'cd', 'sign', 'hangers', 'notebook', 'hanger', 'security camera', 'folders', 'clothing hanger', 'stairs', 'glass rack', 'saucer', 'tag', 'dolly', 'machine', 'trolly', 'shopping baskets', 'gate', 'bookrack', 'blackboard', 'coffee bag', 'coffee packet', 'hot water heater', 'muffins', 'napkin dispenser', 'plaque', 'plastic tub', 'plate', 'coffee machine', 'napkin holder', 'radiator', 'coffee grinder', 'oven', 'plant pot', 'scarf', 'spice rack', 'stove', 'tea kettle', 'napkin', 'bag of chips', 'bread', 'cutting board', 'dish brush', 'serving spoon', 'sponge', 'toaster', 'cooking pan', 'kitchen items', 'ladel', 'spatula', 'spice stand', 'trivet', 'knife rack', 'knife', 'baking dish', 'dish scrubber', 'drying rack', 'vessel', 'kichen towel', 'tin foil', 'kitchen utensil', 'utensil', 'blender', 'garbage bag', 'sink protector', 'box of ziplock bags', 'spice bottle', 'pitcher', 'pizza box', 'toaster oven', 'step stool', 'vegetable peeler', 'washing machine', 'can opener', 'can of food', 'paper towel holder', 'spoon stand', 'spoon', 'wooden kitchen utensils', 'bag of flour', 'fruit', 'sheet of metal', 'waffle maker', 'cake', 'cell phone', 'tv stand', 'tablecloth', 'wine glass', 'sculpture', 'wall stand', 'iphone', 'coke bottle', 'piano', 'wine rack', 'guitar', 'light switch', 'shirts in hanger', 'router', 'glass pot', 'cart', 'vacuum cleaner', 'bin', 'coins', 'hand sculpture', 'ipod', 'jersey', 'blanket', 'ironing board', 'pen stand', 'mens tie', 'glass baking dish', 'utensils', 'frying pan', 'shopping cart', 'plastic bowl', 'wooden container', 'onion', 'potato', 'jacket', 'dvds', 'surge protector', 'tumbler', 'broom', 'can', 'crock pot', 'person', 'salt shaker', 'wine bottle', 'apple', 'eye glasses', 'menorah', 'bicycle helmet', 'fire alarm', 'water fountain', 'humidifier', 'necklace', 'chandelier', 'barrel', 'chest', 'decanter', 'wooden utensils', 'globe', 'sheets', 'fork', 'napkin ring', 'gift wrapping', 'bed sheets', 'spot light', 'lighting track', 'cannister', 'coffee table', 'mortar and pestle', 'stack of plates', 'ottoman', 'server', 'salt container', 'utensil container', 'phone jack', 'switchbox', 'casserole dish', 'oven handle', 'whisk', 'dish cover', 'electric mixer', 'decorative platter', 'drawer handle', 'fireplace', 'stroller', 'bookend', 'table runner', 'typewriter', 'ashtray', 'key', 'suit jacket', 'range hood', 'cleaning wipes', 'six pack of beer', 'decorative plate', 'watch', 'balloon', 'ipad', 'coaster', 'whiteboard eraser', 'toy', 'toys basket', 'toy truck', 'classroom board', 'chart stand', 'picture of fish', 'plastic box', 'pencil', 'carton', 'walkie talkie', 'binder', 'coat hanger', 'filing shelves', 'plastic crate', 'plastic rack', 'plastic tray', 'flag', 'poster board', 'lunch bag', 'board', 'leg of a girl', 'file holder', 'chart', 'glass pane', 'cardboard tube', 'bassinet', 'toy car', 'toy shelf', 'toy bin', 'toys shelf', 'educational display', 'placard', 'soft toy group', 'soft toy', 'toy cube', 'toy cylinder', 'toy rectangle', 'toy triangle', 'bucket', 'chalkboard', 'game table', 'storage shelvesbooks', 'toy cuboid', 'toy tree', 'wooden toy', 'toy box', 'toy phone', 'toy sink', 'toyhouse', 'notecards', 'toy trucks', 'wall hand sanitizer dispenser', 'cap stand', 'music stereo', 'toys rack', 'display board', 'lid of jar', 'stacked bins boxes', 'stacked plastic racks', 'storage rack', 'roll of paper towels', 'cables', 'power surge', 'cardboard sheet', 'banister', 'show piece', 'pepper shaker', 'kitchen island', 'excercise equipment', 'treadmill', 'ornamental plant', 'piano bench', 'sheet music', 'grandfather clock', 'iron grill', 'pen holder', 'toy doll', 'globe stand', 'telescope', 'magazine holder', 'file container', 'paper holder', 'flower box', 'pyramid', 'desk mat', 'cordless phone', 'desk drawer', 'envelope', 'window frame', 'id card', 'file stand', 'paper weight', 'toy plane', 'money', 'papers', 'comforter', 'crib', 'doll house', 'toy chair', 'toy sofa', 'plastic chair', 'toy house', 'child carrier', 'cloth bag', 'cradle', 'baby chair', 'chart roll', 'toys box', 'railing', 'clothing dryer', 'clothing washer', 'laundry detergent jug', 'clothing detergent', 'bottle of soap', 'box of paper', 'trolley', 'hand sanitizer dispenser', 'soap holder', 'water dispenser', 'photo', 'water cooler', 'foosball table', 'crayon', 'hoola hoop', 'horse toy', 'plastic toy container', 'pool table', 'game system', 'pool sticks', 'console system', 'video game', 'pool ball', 'trampoline', 'tricycle', 'wii', 'furniture', 'alarm', 'toy table', 'ornamental item', 'copper vessel', 'stick', 'car', 'mezuza', 'toy cash register', 'lid', 'paper bundle', 'business cards', 'clipboard', 'flatbed scanner', 'paper tray', 'mouse pad', 'display case', 'tree sculpture', 'basketball', 'fiberglass case', 'framed certificate', 'cordless telephone', 'shofar', 'trophy', 'cleaner', 'cloth drying stand', 'electric box', 'furnace', 'piece of wood', 'wooden pillar', 'drying stand', 'cane', 'clothing drying rack', 'iron box', 'excercise machine', 'sheet', 'rope', 'sticks', 'wooden planks', 'toilet plunger', 'bar of soap', 'toilet bowl brush', 'light bulb', 'drain', 'faucet handle', 'nailclipper', 'shaving cream', 'rolled carpet', 'clothing iron', 'window cover', 'charger and wire', 'quilt', 'mattress', 'hair dryer', 'stones', 'pepper grinder', 'cat cage', 'dish rack', 'curtain rod', 'calendar', 'head phones', 'cd disc', 'head phone', 'usb drive', 'water heater', 'pan', 'tuna cans', 'baby gate', 'spoon sets', 'cans of cat food', 'cat', 'flower basket', 'fruit platter', 'grapefruit', 'kiwi', 'hand blender', 'knobs', 'vessels', 'cell phone charger', 'wire basket', 'tub of tupperware', 'candelabra', 'litter box', 'shovel', 'cat bed', 'door way', 'belt', 'surge protect', 'glass', 'console controller', 'shoe rack', 'door frame', 'computer disk', 'briefcase', 'mail tray', 'file pad', 'letter stand', 'plastic cup of coffee', 'glass box', 'ping pong ball', 'ping pong racket', 'ping pong table', 'tennis racket', 'ping pong racquet', 'xbox', 'electric toothbrush base', 'toilet brush', 'toiletries', 'razor', 'bottle of contact lens solution', 'contact lens case', 'cream', 'glass container', 'container of skin cream', 'soap dish', 'scale', 'soap stand', 'cactus', 'door window reflection', 'ceramic frog', 'incense candle', 'storage space', 'door lock', 'toilet paper holder', 'tissue', 'personal care liquid', 'shower head', 'shower knob', 'knob', 'cream tube', 'perfume box', 'perfume', 'back scrubber', 'door facing trimreflection', 'doorreflection', 'light switchreflection', 'medicine tube', 'wallet', 'soap tray', 'door curtain', 'shower pipe', 'face wash cream', 'flashlight', 'shower base', 'window shelf', 'shower hose', 'toothpaste holder', 'soap box', 'incense holder', 'conch shell', 'roll of toilet paper', 'shower tube', 'bottle of listerine', 'bottle of hand wash liquid', 'tea pot', 'lazy susan', 'avocado', 'fruit stand', 'fruitplate', 'oil container', 'package of water', 'bottle of liquid', 'door way arch', 'jug', 'bulb', 'bagel', 'bag of bagels', 'banana peel', 'bag of oreo', 'flask', 'collander', 'brick', 'torch', 'dog bowl', 'wooden plank', 'eggs', 'grill', 'dog', 'chimney', 'dog cage', 'orange plastic cap', 'glass set', 'vessel set', 'mellon', 'aluminium foil', 'orange', 'peach', 'tea coaster', 'butterfly sculpture', 'corkscrew', 'heating tray', 'food processor', 'corn', 'squash', 'watermellon', 'vegetables', 'celery', 'glass dish', 'hot dogs', 'plastic dish', 'vegetable', 'sticker', 'chapstick', 'sifter', 'fruit basket', 'glove', 'measuring cup', 'water filter', 'wine accessory', 'dishes', 'file box', 'ornamental pot', 'dog toy', 'salt and pepper', 'electrical kettle', 'kitchen container plastic', 'pineapple', 'suger jar', 'steamer', 'charger', 'mug holder', 'orange juicer', 'juicer', 'bag of hot dog buns', 'hamburger bun', 'mug hanger', 'bottle of ketchup', 'toy kitchen', 'food wrapped on a tray', 'kitchen utensils', 'oven mitt', 'bottle of comet', 'wooden utensil', 'decorative dish', 'handle', 'label', 'flask set', 'cooking pot cover', 'tupperware', 'garlic', 'tissue roll', 'lemon', 'wine', 'decorative bottle', 'wire tray', 'tea cannister', 'clothing hamper', 'guitar case', 'wardrobe', 'boomerang', 'button', 'karate belts', 'medal', 'window seat', 'window box', 'necklace holder', 'beeper', 'webcam', 'fish tank', 'luggage', 'life jacket', 'shoelace', 'pen cup', 'eyeball plastic ball', 'toy pyramid', 'model boat', 'certificate', 'puppy toy', 'wire board', 'quill', 'canister', 'toy boat', 'antenna', 'bean bag', 'lint comb', 'travel bag', 'wall divider', 'toy chest', 'headband', 'luggage rack', 'bunk bed', 'lego', 'yarmulka', 'package of bedroom sheets', 'bedding package', 'comb', 'dollar bill', 'pig', 'storage bin', 'storage chest', 'slide', 'playpen', 'electronic drumset', 'ipod dock', 'microphone', 'music keyboard', 'music stand', 'microphone stand', 'album', 'kinect', 'inkwell', 'baseball', 'decorative bowl', 'book holder', 'toy horse', 'desser', 'toy apple', 'toy dog', 'scenary', 'drawer knob', 'shoe hanger', 'tent', 'figurine', 'soccer ball', 'hand weight', 'magic 8ball', 'bottle of perfume', 'sleeping bag', 'decoration item', 'envelopes', 'trinket', 'hand fan', 'sculpture of the chrysler building', 'sculpture of the eiffel tower', 'sculpture of the empire state building', 'jeans', 'garage door', 'case', 'rags', 'decorative item', 'toy stroller', 'shelf frame', 'cat house', 'can of beer', 'dog bed', 'lamp shade', 'bracelet', 'reflection of window shutters', 'decorative egg', 'indoor fountain', 'photo album', 'decorative candle', 'walkietalkie', 'serving dish', 'floor trim', 'mini display platform', 'american flag', 'vhs tapes', 'throw', 'newspapers', 'mantle', 'package of bottled water', 'serving platter', 'display platter', 'centerpiece', 'tea box', 'gold piece', 'wreathe', 'lectern', 'hammer', 'matchbox', 'pepper', 'yellow pepper', 'duck', 'eggplant', 'glass ware', 'sewing machine', 'rolled up rug', 'doily', 'coffee pot', 'torah', ]
classes_names = ['book', 'bottle', 'cabinet', 'ceiling', 'chair', 'cone', 'counter', 'dishwasher', 'faucet', 'fire extinguisher', 'floor', 'garbage bin', 'microwave', 'paper towel dispenser', 'paper', 'pot', 'refridgerator', 'stove burner', 'table', 'unknown', 'wall', 'bowl', 'magnet', 'sink', 'air vent', 'box', 'door knob', 'door', 'scissor', 'tape dispenser', 'telephone cord', 'telephone', 'track light', 'cork board', 'cup', 'desk', 'laptop', 'air duct', 'basket', 'camera', 'pipe', 'shelves', 'stacked chairs', 'styrofoam object', 'whiteboard', 'computer', 'keyboard', 'ladder', 'monitor', 'stand', 'bar', 'motion camera', 'projector screen', 'speaker', 'bag', 'clock', 'green screen', 'mantel', 'window', 'ball', 'hole puncher', 'light', 'manilla envelope', 'picture', 'mail shelf', 'printer', 'stapler', 'fax machine', 'folder', 'jar', 'magazine', 'ruler', 'cable modem', 'fan', 'file', 'hand sanitizer', 'paper rack', 'vase', 'air conditioner', 'blinds', 'flower', 'plant', 'sofa', 'stereo', 'books', 'exit sign', 'room divider', 'bookshelf', 'curtain', 'projector', 'modem', 'wire', 'water purifier', 'column', 'hooks', 'hanging hooks', 'pen', 'electrical outlet', 'doll', 'eraser', 'pencil holder', 'water carboy', 'mouse', 'cable rack', 'wire rack', 'flipboard', 'map', 'paper cutter', 'tape', 'thermostat', 'heater', 'circuit breaker box', 'paper towel', 'stamp', 'duster', 'poster case', 'whiteboard marker', 'ethernet jack', 'pillow', 'hair brush', 'makeup brush', 'mirror', 'shower curtain', 'toilet', 'toiletries bag', 'toothbrush holder', 'toothbrush', 'toothpaste', 'platter', 'rug', 'squeeze tube', 'shower cap', 'soap', 'towel rod', 'towel', 'bathtub', 'candle', 'tissue box', 'toilet paper', 'container', 'clothes', 'electric toothbrush', 'floor mat', 'lamp', 'drum', 'flower pot', 'banana', 'candlestick', 'shoe', 'stool', 'urn', 'earplugs', 'mailshelf', 'placemat', 'excercise ball', 'alarm clock', 'bed', 'night stand', 'deoderant', 'headphones', 'headboard', 'basketball hoop', 'foot rest', 'laundry basket', 'sock', 'football', 'mens suit', 'cable box', 'dresser', 'dvd player', 'shaver', 'television', 'contact lens solution bottle', 'drawer', 'remote control', 'cologne', 'stuffed animal', 'lint roller', 'tray', 'lock', 'purse', 'toy bottle', 'crate', 'vasoline', 'gift wrapping roll', 'wall decoration', 'hookah', 'radio', 'bicycle', 'pen box', 'mask', 'shorts', 'hat', 'hockey glove', 'hockey stick', 'vuvuzela', 'dvd', 'chessboard', 'suitcase', 'calculator', 'flashcard', 'staple remover', 'umbrella', 'bench', 'yoga mat', 'backpack', 'cd', 'sign', 'hangers', 'notebook', 'hanger', 'security camera', 'folders', 'clothing hanger', 'stairs', 'glass rack', 'saucer', 'tag', 'dolly', 'machine', 'trolly', 'shopping baskets', 'gate', 'bookrack', 'blackboard', 'coffee bag', 'coffee packet', 'hot water heater', 'muffins', 'napkin dispenser', 'plaque', 'plastic tub', 'plate', 'coffee machine', 'napkin holder', 'radiator', 'coffee grinder', 'oven', 'plant pot', 'scarf', 'spice rack', 'stove', 'tea kettle', 'napkin', 'bag of chips', 'bread', 'cutting board', 'dish brush', 'serving spoon', 'sponge', 'toaster', 'cooking pan', 'kitchen items', 'ladel', 'spatula', 'spice stand', 'trivet', 'knife rack', 'knife', 'baking dish', 'dish scrubber', 'drying rack', 'vessel', 'kichen towel', 'tin foil', 'kitchen utensil', 'utensil', 'blender', 'garbage bag', 'sink protector', 'box of ziplock bags', 'spice bottle', 'pitcher', 'pizza box', 'toaster oven', 'step stool', 'vegetable peeler', 'washing machine', 'can opener', 'can of food', 'paper towel holder', 'spoon stand', 'spoon', 'wooden kitchen utensils', 'bag of flour', 'fruit', 'sheet of metal', 'waffle maker', 'cake', 'cell phone', 'tv stand', 'tablecloth', 'wine glass', 'sculpture', 'wall stand', 'iphone', 'coke bottle', 'piano', 'wine rack', 'guitar', 'light switch', 'shirts in hanger', 'router', 'glass pot', 'cart', 'vacuum cleaner', 'bin', 'coins', 'hand sculpture', 'ipod', 'jersey', 'blanket', 'ironing board', 'pen stand', 'mens tie', 'glass baking dish', 'utensils', 'frying pan', 'shopping cart', 'plastic bowl', 'wooden container', 'onion', 'potato', 'jacket', 'dvds', 'surge protector', 'tumbler', 'broom', 'can', 'crock pot', 'person', 'salt shaker', 'wine bottle', 'apple', 'eye glasses', 'menorah', 'bicycle helmet', 'fire alarm', 'water fountain', 'humidifier', 'necklace', 'chandelier', 'barrel', 'chest', 'decanter', 'wooden utensils', 'globe', 'sheets', 'fork', 'napkin ring', 'gift wrapping', 'bed sheets', 'spot light', 'lighting track', 'cannister', 'coffee table', 'mortar and pestle', 'stack of plates', 'ottoman', 'server', 'salt container', 'utensil container', 'phone jack', 'switchbox', 'casserole dish', 'oven handle', 'whisk', 'dish cover', 'electric mixer', 'decorative platter', 'drawer handle', 'fireplace', 'stroller', 'bookend', 'table runner', 'typewriter', 'ashtray', 'key', 'suit jacket', 'range hood', 'cleaning wipes', 'six pack of beer', 'decorative plate', 'watch', 'balloon', 'ipad', 'coaster', 'whiteboard eraser', 'toy', 'toys basket', 'toy truck', 'classroom board', 'chart stand', 'picture of fish', 'plastic box', 'pencil', 'carton', 'walkie talkie', 'binder', 'coat hanger', 'filing shelves', 'plastic crate', 'plastic rack', 'plastic tray', 'flag', 'poster board', 'lunch bag', 'board', 'leg of a girl', 'file holder', 'chart', 'glass pane', 'cardboard tube', 'bassinet', 'toy car', 'toy shelf', 'toy bin', 'toys shelf', 'educational display', 'placard', 'soft toy group', 'soft toy', 'toy cube', 'toy cylinder', 'toy rectangle', 'toy triangle', 'bucket', 'chalkboard', 'game table', 'storage shelvesbooks', 'toy cuboid', 'toy tree', 'wooden toy', 'toy box', 'toy phone', 'toy sink', 'toyhouse', 'notecards', 'toy trucks', 'wall hand sanitizer dispenser', 'cap stand', 'music stereo', 'toys rack', 'display board', 'lid of jar', 'stacked bins boxes', 'stacked plastic racks', 'storage rack', 'roll of paper towels', 'cables', 'power surge', 'cardboard sheet', 'banister', 'show piece', 'pepper shaker', 'kitchen island', 'excercise equipment', 'treadmill', 'ornamental plant', 'piano bench', 'sheet music', 'grandfather clock', 'iron grill', 'pen holder', 'toy doll', 'globe stand', 'telescope', 'magazine holder', 'file container', 'paper holder', 'flower box', 'pyramid', 'desk mat', 'cordless phone', 'desk drawer', 'envelope', 'window frame', 'id card', 'file stand', 'paper weight', 'toy plane', 'money', 'papers', 'comforter', 'crib', 'doll house', 'toy chair', 'toy sofa', 'plastic chair', 'toy house', 'child carrier', 'cloth bag', 'cradle', 'baby chair', 'chart roll', 'toys box', 'railing', 'clothing dryer', 'clothing washer', 'laundry detergent jug', 'clothing detergent', 'bottle of soap', 'box of paper', 'trolley', 'hand sanitizer dispenser', 'soap holder', 'water dispenser', 'photo', 'water cooler', 'foosball table', 'crayon', 'hoola hoop', 'horse toy', 'plastic toy container', 'pool table', 'game system', 'pool sticks', 'console system', 'video game', 'pool ball', 'trampoline', 'tricycle', 'wii', 'furniture', 'alarm', 'toy table', 'ornamental item', 'copper vessel', 'stick', 'car', 'mezuza', 'toy cash register', 'lid', 'paper bundle', 'business cards', 'clipboard', 'flatbed scanner', 'paper tray', 'mouse pad', 'display case', 'tree sculpture', 'basketball', 'fiberglass case', 'framed certificate', 'cordless telephone', 'shofar', 'trophy', 'cleaner', 'cloth drying stand', 'electric box', 'furnace', 'piece of wood', 'wooden pillar', 'drying stand', 'cane', 'clothing drying rack', 'iron box', 'excercise machine', 'sheet', 'rope', 'sticks', 'wooden planks', 'toilet plunger', 'bar of soap', 'toilet bowl brush', 'light bulb', 'drain', 'faucet handle', 'nailclipper', 'shaving cream', 'rolled carpet', 'clothing iron', 'window cover', 'charger and wire', 'quilt', 'mattress', 'hair dryer', 'stones', 'pepper grinder', 'cat cage', 'dish rack', 'curtain rod', 'calendar', 'head phones', 'cd disc', 'head phone', 'usb drive', 'water heater', 'pan', 'tuna cans', 'baby gate', 'spoon sets', 'cans of cat food', 'cat', 'flower basket', 'fruit platter', 'grapefruit', 'kiwi', 'hand blender', 'knobs', 'vessels', 'cell phone charger', 'wire basket', 'tub of tupperware', 'candelabra', 'litter box', 'shovel', 'cat bed', 'door way', 'belt', 'surge protect', 'glass', 'console controller', 'shoe rack', 'door frame', 'computer disk', 'briefcase', 'mail tray', 'file pad', 'letter stand', 'plastic cup of coffee', 'glass box', 'ping pong ball', 'ping pong racket', 'ping pong table', 'tennis racket', 'ping pong racquet', 'xbox', 'electric toothbrush base', 'toilet brush', 'toiletries', 'razor', 'bottle of contact lens solution', 'contact lens case', 'cream', 'glass container', 'container of skin cream', 'soap dish', 'scale', 'soap stand', 'cactus', 'door window reflection', 'ceramic frog', 'incense candle', 'storage space', 'door lock', 'toilet paper holder', 'tissue', 'personal care liquid', 'shower head', 'shower knob', 'knob', 'cream tube', 'perfume box', 'perfume', 'back scrubber', 'door facing trimreflection', 'doorreflection', 'light switchreflection', 'medicine tube', 'wallet', 'soap tray', 'door curtain', 'shower pipe', 'face wash cream', 'flashlight', 'shower base', 'window shelf', 'shower hose', 'toothpaste holder', 'soap box', 'incense holder', 'conch shell', 'roll of toilet paper', 'shower tube', 'bottle of listerine', 'bottle of hand wash liquid', 'tea pot', 'lazy susan', 'avocado', 'fruit stand', 'fruitplate', 'oil container', 'package of water', 'bottle of liquid', 'door way arch', 'jug', 'bulb', 'bagel', 'bag of bagels', 'banana peel', 'bag of oreo', 'flask', 'collander', 'brick', 'torch', 'dog bowl', 'wooden plank', 'eggs', 'grill', 'dog', 'chimney', 'dog cage', 'orange plastic cap', 'glass set', 'vessel set', 'mellon', 'aluminium foil', 'orange', 'peach', 'tea coaster', 'butterfly sculpture', 'corkscrew', 'heating tray', 'food processor', 'corn', 'squash', 'watermellon', 'vegetables', 'celery', 'glass dish', 'hot dogs', 'plastic dish', 'vegetable', 'sticker', 'chapstick', 'sifter', 'fruit basket', 'glove', 'measuring cup', 'water filter', 'wine accessory', 'dishes', 'file box', 'ornamental pot', 'dog toy', 'salt and pepper', 'electrical kettle', 'kitchen container plastic', 'pineapple', 'suger jar', 'steamer', 'charger', 'mug holder', 'orange juicer', 'juicer', 'bag of hot dog buns', 'hamburger bun', 'mug hanger', 'bottle of ketchup', 'toy kitchen', 'food wrapped on a tray', 'kitchen utensils', 'oven mitt', 'bottle of comet', 'wooden utensil', 'decorative dish', 'handle', 'label', 'flask set', 'cooking pot cover', 'tupperware', 'garlic', 'tissue roll', 'lemon', 'wine', 'decorative bottle', 'wire tray', 'tea cannister', 'clothing hamper', 'guitar case', 'wardrobe', 'boomerang', 'button', 'karate belts', 'medal', 'window seat', 'window box', 'necklace holder', 'beeper', 'webcam', 'fish tank', 'luggage', 'life jacket', 'shoelace', 'pen cup', 'eyeball plastic ball', 'toy pyramid', 'model boat', 'certificate', 'puppy toy', 'wire board', 'quill', 'canister', 'toy boat', 'antenna', 'bean bag', 'lint comb', 'travel bag', 'wall divider', 'toy chest', 'headband', 'luggage rack', 'bunk bed', 'lego', 'yarmulka', 'package of bedroom sheets', 'bedding package', 'comb', 'dollar bill', 'pig', 'storage bin', 'storage chest', 'slide', 'playpen', 'electronic drumset', 'ipod dock', 'microphone', 'music keyboard', 'music stand', 'microphone stand', 'album', 'kinect', 'inkwell', 'baseball', 'decorative bowl', 'book holder', 'toy horse', 'desser', 'toy apple', 'toy dog', 'scenary', 'drawer knob', 'shoe hanger', 'tent', 'figurine', 'soccer ball', 'hand weight', 'magic 8ball', 'bottle of perfume', 'sleeping bag', 'decoration item', 'envelopes', 'trinket', 'hand fan', 'sculpture of the chrysler building', 'sculpture of the eiffel tower', 'sculpture of the empire state building', 'jeans', 'garage door', 'case', 'rags', 'decorative item', 'toy stroller', 'shelf frame', 'cat house', 'can of beer', 'dog bed', 'lamp shade', 'bracelet', 'reflection of window shutters', 'decorative egg', 'indoor fountain', 'photo album', 'decorative candle', 'walkietalkie', 'serving dish', 'floor trim', 'mini display platform', 'american flag', 'vhs tapes', 'throw', 'newspapers', 'mantle', 'package of bottled water', 'serving platter', 'display platter', 'centerpiece', 'tea box', 'gold piece', 'wreathe', 'lectern', 'hammer', 'matchbox', 'pepper', 'yellow pepper', 'duck', 'eggplant', 'glass ware', 'sewing machine', 'rolled up rug', 'doily', 'coffee pot', 'torah']
''' Return the nth Fibonacci number F0 = 0 F1 = 1 Fn = Fn-1 + Fn-2 ''' def Fibonacci(n): ''' return nth fibonacci number to reduce O(n), we invoke recursion only once during one call (Fn-1, Fn-2) ''' if n <= 1: return (n,0) else: (a,b) = Fibonacci(n-1) return (a+b,a) #print(Fibonacci(9)[0]) ''' sum the elements of a sequence recursively ''' def linear_sum(data): if len(data) == 0 : return 0 else: return data[len(data)-1]+linear_sum(data[0:len(data)-1]) # a = [4,3,6,2,8,9,3,2,8,5,1,7,2,8,3,7] # print(linear_sum(a)) # b = [4,3,6,2,8] # print(linear_sum(b)) ''' reverse a sequence with recursion ''' def reverse_seq(sequence,start,stop): if len(sequence[start:stop]) != 1: print(start,stop) sequence[stop-1],sequence[start] = sequence[start],sequence[stop-1] reverse_seq(sequence,start+1,stop-1) return sequence # a = [1,2,3,4,5] # print(reverse_seq(a,start= 0,stop = len(a))) ''' computing powers x**n = x * x**(n-1) ''' def compute_powers(x,n): if n == 0 : return 1 else: x = x * compute_powers(x,n-1) return x print(compute_powers(2,5))
""" Return the nth Fibonacci number F0 = 0 F1 = 1 Fn = Fn-1 + Fn-2 """ def fibonacci(n): """ return nth fibonacci number to reduce O(n), we invoke recursion only once during one call (Fn-1, Fn-2) """ if n <= 1: return (n, 0) else: (a, b) = fibonacci(n - 1) return (a + b, a) '\nsum the elements of a sequence recursively\n' def linear_sum(data): if len(data) == 0: return 0 else: return data[len(data) - 1] + linear_sum(data[0:len(data) - 1]) '\nreverse a sequence with recursion\n' def reverse_seq(sequence, start, stop): if len(sequence[start:stop]) != 1: print(start, stop) (sequence[stop - 1], sequence[start]) = (sequence[start], sequence[stop - 1]) reverse_seq(sequence, start + 1, stop - 1) return sequence '\ncomputing powers\nx**n = x * x**(n-1)\n' def compute_powers(x, n): if n == 0: return 1 else: x = x * compute_powers(x, n - 1) return x print(compute_powers(2, 5))
thisdict = { "brand":"Ford", "model":"Mustang", "year":1964 } for x in thisdict.values(): print(x)
thisdict = {'brand': 'Ford', 'model': 'Mustang', 'year': 1964} for x in thisdict.values(): print(x)
name = "ada lovelace" print(name.title()) print(name.upper()) print(name.lower())
name = 'ada lovelace' print(name.title()) print(name.upper()) print(name.lower())
def has_style(tag): return tag.has_attr('style') def has_class(tag): return tag.has_attr('class') def clean(soup): if soup.name == 'br' or soup.name == 'img' or soup.name == 'p' or soup.name == 'div': return try: ll = 0 for j in soup.strings: ll += len(j.replace('\n', '')) if ll == 0: soup.decompose() else: for child in soup.children: clean(child) except Exception as e: pass def dfs(soup, v): if soup.name == 'a' or soup.name == 'br': return try: lt = len(soup.get_text()) ls = len(str(soup)) a = soup.find_all('a') at = 0 for j in a: at += len(j.get_text()) lvt = lt - at v.append((soup, lt / ls * lvt)) for child in soup.children: dfs(child, v) except Exception as e: pass def extract(soup, text_only = True, remove_img = True): filt = ['script', 'noscript', 'style', 'embed', 'label', 'form', 'input', 'iframe', 'head', 'meta', 'link', 'object', 'aside', 'channel'] if remove_img: filt.append('img') for ff in filt: for i in soup.find_all(ff): i.decompose() for tag in soup.find_all(has_style): del tag['style'] for tag in soup.find_all(has_class): del tag['class'] clean(soup) LVT = len(soup.get_text()) for i in soup.find_all('a'): LVT -= len(i.get_text()) v = [] dfs(soup, v) mij = 0 for i in range(len(v)): if v[i][1] > v[mij][1]: mij = i if text_only: res = v[mij][0].get_text() else: res = str(v[mij][0]) return res, v[mij][1] / LVT
def has_style(tag): return tag.has_attr('style') def has_class(tag): return tag.has_attr('class') def clean(soup): if soup.name == 'br' or soup.name == 'img' or soup.name == 'p' or (soup.name == 'div'): return try: ll = 0 for j in soup.strings: ll += len(j.replace('\n', '')) if ll == 0: soup.decompose() else: for child in soup.children: clean(child) except Exception as e: pass def dfs(soup, v): if soup.name == 'a' or soup.name == 'br': return try: lt = len(soup.get_text()) ls = len(str(soup)) a = soup.find_all('a') at = 0 for j in a: at += len(j.get_text()) lvt = lt - at v.append((soup, lt / ls * lvt)) for child in soup.children: dfs(child, v) except Exception as e: pass def extract(soup, text_only=True, remove_img=True): filt = ['script', 'noscript', 'style', 'embed', 'label', 'form', 'input', 'iframe', 'head', 'meta', 'link', 'object', 'aside', 'channel'] if remove_img: filt.append('img') for ff in filt: for i in soup.find_all(ff): i.decompose() for tag in soup.find_all(has_style): del tag['style'] for tag in soup.find_all(has_class): del tag['class'] clean(soup) lvt = len(soup.get_text()) for i in soup.find_all('a'): lvt -= len(i.get_text()) v = [] dfs(soup, v) mij = 0 for i in range(len(v)): if v[i][1] > v[mij][1]: mij = i if text_only: res = v[mij][0].get_text() else: res = str(v[mij][0]) return (res, v[mij][1] / LVT)
# # PySNMP MIB module HIRSCHMANN-PIM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HIRSCHMANN-PIM-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:31:12 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, SingleValueConstraint, ConstraintsIntersection, ValueSizeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "ConstraintsUnion") hmPlatform4Multicast, = mibBuilder.importSymbols("HIRSCHMANN-MULTICAST-MIB", "hmPlatform4Multicast") InterfaceIndex, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex") ipMRouteNextHopGroup, ipMRouteSourceMask, ipMRouteNextHopIfIndex, ipMRouteNextHopAddress, ipMRouteNextHopSourceMask, ipMRouteGroup, ipMRouteNextHopSource, ipMRouteSource = mibBuilder.importSymbols("IPMROUTE-STD-MIB", "ipMRouteNextHopGroup", "ipMRouteSourceMask", "ipMRouteNextHopIfIndex", "ipMRouteNextHopAddress", "ipMRouteNextHopSourceMask", "ipMRouteGroup", "ipMRouteNextHopSource", "ipMRouteSource") ObjectGroup, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup") Gauge32, IpAddress, iso, Unsigned32, Bits, ModuleIdentity, ObjectIdentity, Integer32, TimeTicks, MibIdentifier, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter32, Counter64 = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "IpAddress", "iso", "Unsigned32", "Bits", "ModuleIdentity", "ObjectIdentity", "Integer32", "TimeTicks", "MibIdentifier", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter32", "Counter64") TruthValue, TextualConvention, RowStatus, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "TextualConvention", "RowStatus", "DisplayString") hmPIMMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 248, 15, 4, 99)) hmPIMMIB.setRevisions(('2006-02-06 12:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: hmPIMMIB.setRevisionsDescriptions(('Initial version, published as RFC 2934.',)) if mibBuilder.loadTexts: hmPIMMIB.setLastUpdated('200602061200Z') if mibBuilder.loadTexts: hmPIMMIB.setOrganization('Hirschmann Automation and Control GmbH') if mibBuilder.loadTexts: hmPIMMIB.setContactInfo('Customer Support Postal: Hirschmann Automation and Control GmbH Stuttgarter Str. 45-51 72654 Neckartenzlingen Germany Tel: +49 7127 14 1981 Web: http://www.hicomcenter.com/ E-Mail: hicomcenter@hirschmann.com') if mibBuilder.loadTexts: hmPIMMIB.setDescription('The Hirschmann Private Platform4 PIM MIB definitions for Platform devices.') hmPIMMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1)) hmPIMTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 0)) hmPIM = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1)) hmPIMJoinPruneInterval = MibScalar((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 1), Integer32()).setUnits('seconds').setMaxAccess("readwrite") if mibBuilder.loadTexts: hmPIMJoinPruneInterval.setStatus('current') if mibBuilder.loadTexts: hmPIMJoinPruneInterval.setDescription('The default interval at which periodic PIM-SM Join/Prune messages are to be sent.') hmPIMInterfaceTable = MibTable((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2), ) if mibBuilder.loadTexts: hmPIMInterfaceTable.setStatus('current') if mibBuilder.loadTexts: hmPIMInterfaceTable.setDescription("The (conceptual) table listing the router's PIM interfaces. IGMP and PIM are enabled on all interfaces listed in this table.") hmPIMInterfaceEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1), ).setIndexNames((0, "HIRSCHMANN-PIM-MIB", "hmPIMInterfaceIfIndex")) if mibBuilder.loadTexts: hmPIMInterfaceEntry.setStatus('current') if mibBuilder.loadTexts: hmPIMInterfaceEntry.setDescription('An entry (conceptual row) in the hmPIMInterfaceTable.') hmPIMInterfaceIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 1), InterfaceIndex()) if mibBuilder.loadTexts: hmPIMInterfaceIfIndex.setStatus('current') if mibBuilder.loadTexts: hmPIMInterfaceIfIndex.setDescription('The ifIndex value of this PIM interface.') hmPIMInterfaceAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 2), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: hmPIMInterfaceAddress.setStatus('current') if mibBuilder.loadTexts: hmPIMInterfaceAddress.setDescription('The IP address of the PIM interface.') hmPIMInterfaceNetMask = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 3), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: hmPIMInterfaceNetMask.setStatus('current') if mibBuilder.loadTexts: hmPIMInterfaceNetMask.setDescription('The network mask for the IP address of the PIM interface.') hmPIMInterfaceMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("dense", 1), ("sparse", 2), ("sparseDense", 3))).clone('dense')).setMaxAccess("readcreate") if mibBuilder.loadTexts: hmPIMInterfaceMode.setStatus('current') if mibBuilder.loadTexts: hmPIMInterfaceMode.setDescription('The configured mode of this PIM interface. A value of sparseDense is only valid for PIMv1.') hmPIMInterfaceDR = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 5), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: hmPIMInterfaceDR.setStatus('current') if mibBuilder.loadTexts: hmPIMInterfaceDR.setDescription('The Designated Router on this PIM interface. For point-to- point interfaces, this object has the value 0.0.0.0.') hmPIMInterfaceHelloInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 6), Integer32().clone(30)).setUnits('seconds').setMaxAccess("readcreate") if mibBuilder.loadTexts: hmPIMInterfaceHelloInterval.setStatus('current') if mibBuilder.loadTexts: hmPIMInterfaceHelloInterval.setDescription('The frequency at which PIM Hello messages are transmitted on this interface.') hmPIMInterfaceStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 7), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hmPIMInterfaceStatus.setStatus('current') if mibBuilder.loadTexts: hmPIMInterfaceStatus.setDescription('The status of this entry. Creating the entry enables PIM on the interface; destroying the entry disables PIM on the interface.') hmPIMInterfaceJoinPruneInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 8), Integer32()).setUnits('seconds').setMaxAccess("readcreate") if mibBuilder.loadTexts: hmPIMInterfaceJoinPruneInterval.setStatus('current') if mibBuilder.loadTexts: hmPIMInterfaceJoinPruneInterval.setDescription('The frequency at which PIM Join/Prune messages are transmitted on this PIM interface. The default value of this object is the hmPIMJoinPruneInterval.') hmPIMInterfaceCBSRPreference = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-1, 255))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hmPIMInterfaceCBSRPreference.setStatus('current') if mibBuilder.loadTexts: hmPIMInterfaceCBSRPreference.setDescription('The preference value for the local interface as a candidate bootstrap router. The value of -1 is used to indicate that the local interface is not a candidate BSR interface.') hmPIMNeighborTable = MibTable((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3), ) if mibBuilder.loadTexts: hmPIMNeighborTable.setStatus('current') if mibBuilder.loadTexts: hmPIMNeighborTable.setDescription("The (conceptual) table listing the router's PIM neighbors.") hmPIMNeighborEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3, 1), ).setIndexNames((0, "HIRSCHMANN-PIM-MIB", "hmPIMNeighborAddress")) if mibBuilder.loadTexts: hmPIMNeighborEntry.setStatus('current') if mibBuilder.loadTexts: hmPIMNeighborEntry.setDescription('An entry (conceptual row) in the hmPIMNeighborTable.') hmPIMNeighborAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3, 1, 1), IpAddress()) if mibBuilder.loadTexts: hmPIMNeighborAddress.setStatus('current') if mibBuilder.loadTexts: hmPIMNeighborAddress.setDescription('The IP address of the PIM neighbor for which this entry contains information.') hmPIMNeighborIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3, 1, 2), InterfaceIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: hmPIMNeighborIfIndex.setStatus('current') if mibBuilder.loadTexts: hmPIMNeighborIfIndex.setDescription('The value of ifIndex for the interface used to reach this PIM neighbor.') hmPIMNeighborUpTime = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3, 1, 3), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: hmPIMNeighborUpTime.setStatus('current') if mibBuilder.loadTexts: hmPIMNeighborUpTime.setDescription('The time since this PIM neighbor (last) became a neighbor of the local router.') hmPIMNeighborExpiryTime = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3, 1, 4), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: hmPIMNeighborExpiryTime.setStatus('current') if mibBuilder.loadTexts: hmPIMNeighborExpiryTime.setDescription('The minimum time remaining before this PIM neighbor will be aged out.') hmPIMNeighborMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("dense", 1), ("sparse", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: hmPIMNeighborMode.setStatus('deprecated') if mibBuilder.loadTexts: hmPIMNeighborMode.setDescription('The active PIM mode of this neighbor. This object is deprecated for PIMv2 routers since all neighbors on the interface must be either dense or sparse as determined by the protocol running on the interface.') hmPIMIpMRouteTable = MibTable((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4), ) if mibBuilder.loadTexts: hmPIMIpMRouteTable.setStatus('current') if mibBuilder.loadTexts: hmPIMIpMRouteTable.setDescription('The (conceptual) table listing PIM-specific information on a subset of the rows of the ipMRouteTable defined in the IP Multicast MIB.') hmPIMIpMRouteEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4, 1), ).setIndexNames((0, "IPMROUTE-STD-MIB", "ipMRouteGroup"), (0, "IPMROUTE-STD-MIB", "ipMRouteSource"), (0, "IPMROUTE-STD-MIB", "ipMRouteSourceMask")) if mibBuilder.loadTexts: hmPIMIpMRouteEntry.setStatus('current') if mibBuilder.loadTexts: hmPIMIpMRouteEntry.setDescription('An entry (conceptual row) in the hmPIMIpMRouteTable. There is one entry per entry in the ipMRouteTable whose incoming interface is running PIM.') hmPIMIpMRouteUpstreamAssertTimer = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4, 1, 1), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: hmPIMIpMRouteUpstreamAssertTimer.setStatus('current') if mibBuilder.loadTexts: hmPIMIpMRouteUpstreamAssertTimer.setDescription('The time remaining before the router changes its upstream neighbor back to its RPF neighbor. This timer is called the Assert timer in the PIM Sparse and Dense mode specification. A value of 0 indicates that no Assert has changed the upstream neighbor away from the RPF neighbor.') hmPIMIpMRouteAssertMetric = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hmPIMIpMRouteAssertMetric.setStatus('current') if mibBuilder.loadTexts: hmPIMIpMRouteAssertMetric.setDescription('The metric advertised by the assert winner on the upstream interface, or 0 if no such assert is in received.') hmPIMIpMRouteAssertMetricPref = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hmPIMIpMRouteAssertMetricPref.setStatus('current') if mibBuilder.loadTexts: hmPIMIpMRouteAssertMetricPref.setDescription('The preference advertised by the assert winner on the upstream interface, or 0 if no such assert is in effect.') hmPIMIpMRouteAssertRPTBit = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4, 1, 4), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: hmPIMIpMRouteAssertRPTBit.setStatus('current') if mibBuilder.loadTexts: hmPIMIpMRouteAssertRPTBit.setDescription('The value of the RPT-bit advertised by the assert winner on the upstream interface, or false if no such assert is in effect.') hmPIMIpMRouteFlags = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4, 1, 5), Bits().clone(namedValues=NamedValues(("rpt", 0), ("spt", 1)))).setMaxAccess("readonly") if mibBuilder.loadTexts: hmPIMIpMRouteFlags.setStatus('current') if mibBuilder.loadTexts: hmPIMIpMRouteFlags.setDescription('This object describes PIM-specific flags related to a multicast state entry. See the PIM Sparse Mode specification for the meaning of the RPT and SPT bits.') hmPIMIpMRouteNextHopTable = MibTable((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 7), ) if mibBuilder.loadTexts: hmPIMIpMRouteNextHopTable.setStatus('current') if mibBuilder.loadTexts: hmPIMIpMRouteNextHopTable.setDescription('The (conceptual) table listing PIM-specific information on a subset of the rows of the ipMRouteNextHopTable defined in the IP Multicast MIB.') hmPIMIpMRouteNextHopEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 7, 1), ).setIndexNames((0, "IPMROUTE-STD-MIB", "ipMRouteNextHopGroup"), (0, "IPMROUTE-STD-MIB", "ipMRouteNextHopSource"), (0, "IPMROUTE-STD-MIB", "ipMRouteNextHopSourceMask"), (0, "IPMROUTE-STD-MIB", "ipMRouteNextHopIfIndex"), (0, "IPMROUTE-STD-MIB", "ipMRouteNextHopAddress")) if mibBuilder.loadTexts: hmPIMIpMRouteNextHopEntry.setStatus('current') if mibBuilder.loadTexts: hmPIMIpMRouteNextHopEntry.setDescription('An entry (conceptual row) in the hmPIMIpMRouteNextHopTable. There is one entry per entry in the ipMRouteNextHopTable whose interface is running PIM and whose ipMRouteNextHopState is pruned(1).') hmPIMIpMRouteNextHopPruneReason = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 7, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("other", 1), ("prune", 2), ("assert", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: hmPIMIpMRouteNextHopPruneReason.setStatus('current') if mibBuilder.loadTexts: hmPIMIpMRouteNextHopPruneReason.setDescription('This object indicates why the downstream interface was pruned, whether in response to a PIM prune message or due to PIM Assert processing.') hmPIMRPTable = MibTable((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5), ) if mibBuilder.loadTexts: hmPIMRPTable.setStatus('deprecated') if mibBuilder.loadTexts: hmPIMRPTable.setDescription('The (conceptual) table listing PIM version 1 information for the Rendezvous Points (RPs) for IP multicast groups. This table is deprecated since its function is replaced by the hmPIMRPSetTable for PIM version 2.') hmPIMRPEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1), ).setIndexNames((0, "HIRSCHMANN-PIM-MIB", "hmPIMRPGroupAddress"), (0, "HIRSCHMANN-PIM-MIB", "hmPIMRPAddress")) if mibBuilder.loadTexts: hmPIMRPEntry.setStatus('deprecated') if mibBuilder.loadTexts: hmPIMRPEntry.setDescription('An entry (conceptual row) in the hmPIMRPTable. There is one entry per RP address for each IP multicast group.') hmPIMRPGroupAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1, 1), IpAddress()) if mibBuilder.loadTexts: hmPIMRPGroupAddress.setStatus('deprecated') if mibBuilder.loadTexts: hmPIMRPGroupAddress.setDescription('The IP multicast group address for which this entry contains information about an RP.') hmPIMRPAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1, 2), IpAddress()) if mibBuilder.loadTexts: hmPIMRPAddress.setStatus('deprecated') if mibBuilder.loadTexts: hmPIMRPAddress.setDescription('The unicast address of the RP.') hmPIMRPState = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("up", 1), ("down", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: hmPIMRPState.setStatus('deprecated') if mibBuilder.loadTexts: hmPIMRPState.setDescription('The state of the RP.') hmPIMRPStateTimer = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1, 4), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: hmPIMRPStateTimer.setStatus('deprecated') if mibBuilder.loadTexts: hmPIMRPStateTimer.setDescription('The minimum time remaining before the next state change. When hmPIMRPState is up, this is the minimum time which must expire until it can be declared down. When hmPIMRPState is down, this is the time until it will be declared up (in order to retry).') hmPIMRPLastChange = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1, 5), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: hmPIMRPLastChange.setStatus('deprecated') if mibBuilder.loadTexts: hmPIMRPLastChange.setDescription('The value of sysUpTime at the time when the corresponding instance of hmPIMRPState last changed its value.') hmPIMRPRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1, 6), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hmPIMRPRowStatus.setStatus('deprecated') if mibBuilder.loadTexts: hmPIMRPRowStatus.setDescription('The status of this row, by which new entries may be created, or old entries deleted from this table.') hmPIMRPSetTable = MibTable((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6), ) if mibBuilder.loadTexts: hmPIMRPSetTable.setStatus('current') if mibBuilder.loadTexts: hmPIMRPSetTable.setDescription('The (conceptual) table listing PIM information for candidate Rendezvous Points (RPs) for IP multicast groups. When the local router is the BSR, this information is obtained from received Candidate-RP-Advertisements. When the local router is not the BSR, this information is obtained from received RP-Set messages.') hmPIMRPSetEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1), ).setIndexNames((0, "HIRSCHMANN-PIM-MIB", "hmPIMRPSetComponent"), (0, "HIRSCHMANN-PIM-MIB", "hmPIMRPSetGroupAddress"), (0, "HIRSCHMANN-PIM-MIB", "hmPIMRPSetGroupMask"), (0, "HIRSCHMANN-PIM-MIB", "hmPIMRPSetAddress")) if mibBuilder.loadTexts: hmPIMRPSetEntry.setStatus('current') if mibBuilder.loadTexts: hmPIMRPSetEntry.setDescription('An entry (conceptual row) in the hmPIMRPSetTable.') hmPIMRPSetGroupAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1, 1), IpAddress()) if mibBuilder.loadTexts: hmPIMRPSetGroupAddress.setStatus('current') if mibBuilder.loadTexts: hmPIMRPSetGroupAddress.setDescription('The IP multicast group address which, when combined with hmPIMRPSetGroupMask, gives the group prefix for which this entry contains information about the Candidate-RP.') hmPIMRPSetGroupMask = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1, 2), IpAddress()) if mibBuilder.loadTexts: hmPIMRPSetGroupMask.setStatus('current') if mibBuilder.loadTexts: hmPIMRPSetGroupMask.setDescription('The multicast group address mask which, when combined with hmPIMRPSetGroupAddress, gives the group prefix for which this entry contains information about the Candidate-RP.') hmPIMRPSetAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1, 3), IpAddress()) if mibBuilder.loadTexts: hmPIMRPSetAddress.setStatus('current') if mibBuilder.loadTexts: hmPIMRPSetAddress.setDescription('The IP address of the Candidate-RP.') hmPIMRPSetHoldTime = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setUnits('seconds').setMaxAccess("readonly") if mibBuilder.loadTexts: hmPIMRPSetHoldTime.setStatus('current') if mibBuilder.loadTexts: hmPIMRPSetHoldTime.setDescription('The holdtime of a Candidate-RP. If the local router is not the BSR, this value is 0.') hmPIMRPSetExpiryTime = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1, 5), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: hmPIMRPSetExpiryTime.setStatus('current') if mibBuilder.loadTexts: hmPIMRPSetExpiryTime.setDescription('The minimum time remaining before the Candidate-RP will be declared down. If the local router is not the BSR, this value is 0.') hmPIMRPSetComponent = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))) if mibBuilder.loadTexts: hmPIMRPSetComponent.setStatus('current') if mibBuilder.loadTexts: hmPIMRPSetComponent.setDescription(' A number uniquely identifying the component. Each protocol instance connected to a separate domain should have a different index value.') hmPIMCandidateRPTable = MibTable((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 11), ) if mibBuilder.loadTexts: hmPIMCandidateRPTable.setStatus('current') if mibBuilder.loadTexts: hmPIMCandidateRPTable.setDescription('The (conceptual) table listing the IP multicast groups for which the local router is to advertise itself as a Candidate-RP when the value of hmPIMComponentCRPHoldTime is non-zero. If this table is empty, then the local router will advertise itself as a Candidate-RP for all groups (providing the value of hmPIMComponentCRPHoldTime is non- zero).') hmPIMCandidateRPEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 11, 1), ).setIndexNames((0, "HIRSCHMANN-PIM-MIB", "hmPIMCandidateRPGroupAddress"), (0, "HIRSCHMANN-PIM-MIB", "hmPIMCandidateRPGroupMask")) if mibBuilder.loadTexts: hmPIMCandidateRPEntry.setStatus('current') if mibBuilder.loadTexts: hmPIMCandidateRPEntry.setDescription('An entry (conceptual row) in the hmPIMCandidateRPTable.') hmPIMCandidateRPGroupAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 11, 1, 1), IpAddress()) if mibBuilder.loadTexts: hmPIMCandidateRPGroupAddress.setStatus('current') if mibBuilder.loadTexts: hmPIMCandidateRPGroupAddress.setDescription('The IP multicast group address which, when combined with hmPIMCandidateRPGroupMask, identifies a group prefix for which the local router will advertise itself as a Candidate-RP.') hmPIMCandidateRPGroupMask = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 11, 1, 2), IpAddress()) if mibBuilder.loadTexts: hmPIMCandidateRPGroupMask.setStatus('current') if mibBuilder.loadTexts: hmPIMCandidateRPGroupMask.setDescription('The multicast group address mask which, when combined with hmPIMCandidateRPGroupMask, identifies a group prefix for which the local router will advertise itself as a Candidate-RP.') hmPIMCandidateRPAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 11, 1, 3), IpAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hmPIMCandidateRPAddress.setStatus('current') if mibBuilder.loadTexts: hmPIMCandidateRPAddress.setDescription('The (unicast) address of the interface which will be advertised as a Candidate-RP.') hmPIMCandidateRPRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 11, 1, 4), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hmPIMCandidateRPRowStatus.setStatus('current') if mibBuilder.loadTexts: hmPIMCandidateRPRowStatus.setDescription('The status of this row, by which new entries may be created, or old entries deleted from this table.') hmPIMComponentTable = MibTable((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12), ) if mibBuilder.loadTexts: hmPIMComponentTable.setStatus('current') if mibBuilder.loadTexts: hmPIMComponentTable.setDescription('The (conceptual) table containing objects specific to a PIM domain. One row exists for each domain to which the router is connected. A PIM-SM domain is defined as an area of the network over which Bootstrap messages are forwarded. Typically, a PIM-SM router will be a member of exactly one domain. This table also supports, however, routers which may form a border between two PIM-SM domains and do not forward Bootstrap messages between them.') hmPIMComponentEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12, 1), ).setIndexNames((0, "HIRSCHMANN-PIM-MIB", "hmPIMComponentIndex")) if mibBuilder.loadTexts: hmPIMComponentEntry.setStatus('current') if mibBuilder.loadTexts: hmPIMComponentEntry.setDescription('An entry (conceptual row) in the hmPIMComponentTable.') hmPIMComponentIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))) if mibBuilder.loadTexts: hmPIMComponentIndex.setStatus('current') if mibBuilder.loadTexts: hmPIMComponentIndex.setDescription('A number uniquely identifying the component. Each protocol instance connected to a separate domain should have a different index value. Routers that only support membership in a single PIM-SM domain should use a hmPIMComponentIndex value of 1.') hmPIMComponentBSRAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12, 1, 2), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: hmPIMComponentBSRAddress.setStatus('current') if mibBuilder.loadTexts: hmPIMComponentBSRAddress.setDescription('The IP address of the bootstrap router (BSR) for the local PIM region.') hmPIMComponentBSRExpiryTime = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12, 1, 3), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: hmPIMComponentBSRExpiryTime.setStatus('current') if mibBuilder.loadTexts: hmPIMComponentBSRExpiryTime.setDescription('The minimum time remaining before the bootstrap router in the local domain will be declared down. For candidate BSRs, this is the time until the component sends an RP-Set message. For other routers, this is the time until it may accept an RP-Set message from a lower candidate BSR.') hmPIMComponentCRPHoldTime = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setUnits('seconds').setMaxAccess("readcreate") if mibBuilder.loadTexts: hmPIMComponentCRPHoldTime.setStatus('current') if mibBuilder.loadTexts: hmPIMComponentCRPHoldTime.setDescription('The holdtime of the component when it is a candidate RP in the local domain. The value of 0 is used to indicate that the local system is not a Candidate-RP.') hmPIMComponentStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12, 1, 5), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hmPIMComponentStatus.setStatus('current') if mibBuilder.loadTexts: hmPIMComponentStatus.setDescription('The status of this entry. Creating the entry creates another protocol instance; destroying the entry disables a protocol instance.') hmPIMNeighborLoss = NotificationType((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 0, 1)).setObjects(("HIRSCHMANN-PIM-MIB", "hmPIMNeighborIfIndex")) if mibBuilder.loadTexts: hmPIMNeighborLoss.setStatus('current') if mibBuilder.loadTexts: hmPIMNeighborLoss.setDescription('A hmPIMNeighborLoss trap signifies the loss of an adjacency with a neighbor. This trap should be generated when the neighbor timer expires, and the router has no other neighbors on the same interface with a lower IP address than itself.') hmPIMMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2)) hmPIMMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 1)) hmPIMMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2)) hmPIMV1MIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 1, 1)).setObjects(("HIRSCHMANN-PIM-MIB", "hmPIMV1MIBGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hmPIMV1MIBCompliance = hmPIMV1MIBCompliance.setStatus('deprecated') if mibBuilder.loadTexts: hmPIMV1MIBCompliance.setDescription('The compliance statement for routers running PIMv1 and implementing the PIM MIB.') hmPIMSparseV2MIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 1, 2)).setObjects(("HIRSCHMANN-PIM-MIB", "hmPIMV2MIBGroup"), ("HIRSCHMANN-PIM-MIB", "hmPIMV2CandidateRPMIBGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hmPIMSparseV2MIBCompliance = hmPIMSparseV2MIBCompliance.setStatus('current') if mibBuilder.loadTexts: hmPIMSparseV2MIBCompliance.setDescription('The compliance statement for routers running PIM Sparse Mode and implementing the PIM MIB.') hmPIMDenseV2MIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 1, 3)).setObjects(("HIRSCHMANN-PIM-MIB", "hmPIMDenseV2MIBGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hmPIMDenseV2MIBCompliance = hmPIMDenseV2MIBCompliance.setStatus('current') if mibBuilder.loadTexts: hmPIMDenseV2MIBCompliance.setDescription('The compliance statement for routers running PIM Dense Mode and implementing the PIM MIB.') hmPIMNotificationGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 1)).setObjects(("HIRSCHMANN-PIM-MIB", "hmPIMNeighborLoss")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hmPIMNotificationGroup = hmPIMNotificationGroup.setStatus('current') if mibBuilder.loadTexts: hmPIMNotificationGroup.setDescription('A collection of notifications for signaling important PIM events.') hmPIMV2MIBGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 2)).setObjects(("HIRSCHMANN-PIM-MIB", "hmPIMJoinPruneInterval"), ("HIRSCHMANN-PIM-MIB", "hmPIMNeighborIfIndex"), ("HIRSCHMANN-PIM-MIB", "hmPIMNeighborUpTime"), ("HIRSCHMANN-PIM-MIB", "hmPIMNeighborExpiryTime"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceAddress"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceNetMask"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceDR"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceHelloInterval"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceStatus"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceJoinPruneInterval"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceCBSRPreference"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceMode"), ("HIRSCHMANN-PIM-MIB", "hmPIMRPSetHoldTime"), ("HIRSCHMANN-PIM-MIB", "hmPIMRPSetExpiryTime"), ("HIRSCHMANN-PIM-MIB", "hmPIMComponentBSRAddress"), ("HIRSCHMANN-PIM-MIB", "hmPIMComponentBSRExpiryTime"), ("HIRSCHMANN-PIM-MIB", "hmPIMComponentCRPHoldTime"), ("HIRSCHMANN-PIM-MIB", "hmPIMComponentStatus"), ("HIRSCHMANN-PIM-MIB", "hmPIMIpMRouteFlags"), ("HIRSCHMANN-PIM-MIB", "hmPIMIpMRouteUpstreamAssertTimer")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hmPIMV2MIBGroup = hmPIMV2MIBGroup.setStatus('current') if mibBuilder.loadTexts: hmPIMV2MIBGroup.setDescription('A collection of objects to support management of PIM Sparse Mode (version 2) routers.') hmPIMDenseV2MIBGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 5)).setObjects(("HIRSCHMANN-PIM-MIB", "hmPIMNeighborIfIndex"), ("HIRSCHMANN-PIM-MIB", "hmPIMNeighborUpTime"), ("HIRSCHMANN-PIM-MIB", "hmPIMNeighborExpiryTime"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceAddress"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceNetMask"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceDR"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceHelloInterval"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceStatus"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceMode")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hmPIMDenseV2MIBGroup = hmPIMDenseV2MIBGroup.setStatus('current') if mibBuilder.loadTexts: hmPIMDenseV2MIBGroup.setDescription('A collection of objects to support management of PIM Dense Mode (version 2) routers.') hmPIMV2CandidateRPMIBGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 3)).setObjects(("HIRSCHMANN-PIM-MIB", "hmPIMCandidateRPAddress"), ("HIRSCHMANN-PIM-MIB", "hmPIMCandidateRPRowStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hmPIMV2CandidateRPMIBGroup = hmPIMV2CandidateRPMIBGroup.setStatus('current') if mibBuilder.loadTexts: hmPIMV2CandidateRPMIBGroup.setDescription('A collection of objects to support configuration of which groups a router is to advertise itself as a Candidate-RP.') hmPIMV1MIBGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 4)).setObjects(("HIRSCHMANN-PIM-MIB", "hmPIMJoinPruneInterval"), ("HIRSCHMANN-PIM-MIB", "hmPIMNeighborIfIndex"), ("HIRSCHMANN-PIM-MIB", "hmPIMNeighborUpTime"), ("HIRSCHMANN-PIM-MIB", "hmPIMNeighborExpiryTime"), ("HIRSCHMANN-PIM-MIB", "hmPIMNeighborMode"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceAddress"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceNetMask"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceJoinPruneInterval"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceStatus"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceMode"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceDR"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceHelloInterval"), ("HIRSCHMANN-PIM-MIB", "hmPIMRPState"), ("HIRSCHMANN-PIM-MIB", "hmPIMRPStateTimer"), ("HIRSCHMANN-PIM-MIB", "hmPIMRPLastChange"), ("HIRSCHMANN-PIM-MIB", "hmPIMRPRowStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hmPIMV1MIBGroup = hmPIMV1MIBGroup.setStatus('deprecated') if mibBuilder.loadTexts: hmPIMV1MIBGroup.setDescription('A collection of objects to support management of PIM (version 1) routers.') hmPIMNextHopGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 6)).setObjects(("HIRSCHMANN-PIM-MIB", "hmPIMIpMRouteNextHopPruneReason")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hmPIMNextHopGroup = hmPIMNextHopGroup.setStatus('current') if mibBuilder.loadTexts: hmPIMNextHopGroup.setDescription('A collection of optional objects to provide per-next hop information for diagnostic purposes. Supporting this group may add a large number of instances to a tree walk, but the information in this group can be extremely useful in tracking down multicast connectivity problems.') hmPIMAssertGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 7)).setObjects(("HIRSCHMANN-PIM-MIB", "hmPIMIpMRouteAssertMetric"), ("HIRSCHMANN-PIM-MIB", "hmPIMIpMRouteAssertMetricPref"), ("HIRSCHMANN-PIM-MIB", "hmPIMIpMRouteAssertRPTBit")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hmPIMAssertGroup = hmPIMAssertGroup.setStatus('current') if mibBuilder.loadTexts: hmPIMAssertGroup.setDescription('A collection of optional objects to provide extra information about the assert election process. There is no protocol reason to keep such information, but some implementations may already keep this information and make it available. These objects can also be very useful in debugging connectivity or duplicate packet problems, especially if the assert winner does not support the PIM and IP Multicast MIBs.') mibBuilder.exportSymbols("HIRSCHMANN-PIM-MIB", hmPIMComponentEntry=hmPIMComponentEntry, hmPIMInterfaceHelloInterval=hmPIMInterfaceHelloInterval, hmPIMCandidateRPTable=hmPIMCandidateRPTable, hmPIMIpMRouteNextHopTable=hmPIMIpMRouteNextHopTable, hmPIMMIBObjects=hmPIMMIBObjects, hmPIMIpMRouteAssertMetricPref=hmPIMIpMRouteAssertMetricPref, hmPIMIpMRouteTable=hmPIMIpMRouteTable, hmPIMDenseV2MIBGroup=hmPIMDenseV2MIBGroup, hmPIMCandidateRPEntry=hmPIMCandidateRPEntry, hmPIMJoinPruneInterval=hmPIMJoinPruneInterval, hmPIMMIBCompliances=hmPIMMIBCompliances, hmPIMCandidateRPAddress=hmPIMCandidateRPAddress, hmPIMComponentBSRExpiryTime=hmPIMComponentBSRExpiryTime, hmPIMMIB=hmPIMMIB, hmPIMIpMRouteAssertRPTBit=hmPIMIpMRouteAssertRPTBit, hmPIMComponentCRPHoldTime=hmPIMComponentCRPHoldTime, hmPIMRPLastChange=hmPIMRPLastChange, hmPIMComponentTable=hmPIMComponentTable, hmPIMNeighborIfIndex=hmPIMNeighborIfIndex, hmPIMRPSetTable=hmPIMRPSetTable, hmPIMComponentStatus=hmPIMComponentStatus, PYSNMP_MODULE_ID=hmPIMMIB, hmPIMMIBConformance=hmPIMMIBConformance, hmPIMRPStateTimer=hmPIMRPStateTimer, hmPIMNeighborTable=hmPIMNeighborTable, hmPIMNextHopGroup=hmPIMNextHopGroup, hmPIMAssertGroup=hmPIMAssertGroup, hmPIMNeighborMode=hmPIMNeighborMode, hmPIMInterfaceTable=hmPIMInterfaceTable, hmPIMRPSetAddress=hmPIMRPSetAddress, hmPIMInterfaceMode=hmPIMInterfaceMode, hmPIMSparseV2MIBCompliance=hmPIMSparseV2MIBCompliance, hmPIMRPGroupAddress=hmPIMRPGroupAddress, hmPIMCandidateRPRowStatus=hmPIMCandidateRPRowStatus, hmPIMRPSetHoldTime=hmPIMRPSetHoldTime, hmPIMRPTable=hmPIMRPTable, hmPIMIpMRouteAssertMetric=hmPIMIpMRouteAssertMetric, hmPIMMIBGroups=hmPIMMIBGroups, hmPIMInterfaceNetMask=hmPIMInterfaceNetMask, hmPIMRPSetEntry=hmPIMRPSetEntry, hmPIMInterfaceDR=hmPIMInterfaceDR, hmPIMInterfaceAddress=hmPIMInterfaceAddress, hmPIMIpMRouteEntry=hmPIMIpMRouteEntry, hmPIMV2CandidateRPMIBGroup=hmPIMV2CandidateRPMIBGroup, hmPIMNeighborEntry=hmPIMNeighborEntry, hmPIMRPSetGroupMask=hmPIMRPSetGroupMask, hmPIMTraps=hmPIMTraps, hmPIMIpMRouteUpstreamAssertTimer=hmPIMIpMRouteUpstreamAssertTimer, hmPIMInterfaceStatus=hmPIMInterfaceStatus, hmPIMRPAddress=hmPIMRPAddress, hmPIMInterfaceIfIndex=hmPIMInterfaceIfIndex, hmPIMRPEntry=hmPIMRPEntry, hmPIMNeighborUpTime=hmPIMNeighborUpTime, hmPIMNeighborLoss=hmPIMNeighborLoss, hmPIMInterfaceEntry=hmPIMInterfaceEntry, hmPIMNeighborAddress=hmPIMNeighborAddress, hmPIMCandidateRPGroupAddress=hmPIMCandidateRPGroupAddress, hmPIMRPRowStatus=hmPIMRPRowStatus, hmPIMDenseV2MIBCompliance=hmPIMDenseV2MIBCompliance, hmPIMNotificationGroup=hmPIMNotificationGroup, hmPIMIpMRouteNextHopPruneReason=hmPIMIpMRouteNextHopPruneReason, hmPIMCandidateRPGroupMask=hmPIMCandidateRPGroupMask, hmPIMComponentBSRAddress=hmPIMComponentBSRAddress, hmPIMRPSetComponent=hmPIMRPSetComponent, hmPIMV2MIBGroup=hmPIMV2MIBGroup, hmPIMV1MIBGroup=hmPIMV1MIBGroup, hmPIMInterfaceCBSRPreference=hmPIMInterfaceCBSRPreference, hmPIMRPSetGroupAddress=hmPIMRPSetGroupAddress, hmPIMComponentIndex=hmPIMComponentIndex, hmPIMInterfaceJoinPruneInterval=hmPIMInterfaceJoinPruneInterval, hmPIMNeighborExpiryTime=hmPIMNeighborExpiryTime, hmPIMRPSetExpiryTime=hmPIMRPSetExpiryTime, hmPIMV1MIBCompliance=hmPIMV1MIBCompliance, hmPIM=hmPIM, hmPIMIpMRouteFlags=hmPIMIpMRouteFlags, hmPIMRPState=hmPIMRPState, hmPIMIpMRouteNextHopEntry=hmPIMIpMRouteNextHopEntry)
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, constraints_intersection, value_size_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'SingleValueConstraint', 'ConstraintsIntersection', 'ValueSizeConstraint', 'ConstraintsUnion') (hm_platform4_multicast,) = mibBuilder.importSymbols('HIRSCHMANN-MULTICAST-MIB', 'hmPlatform4Multicast') (interface_index,) = mibBuilder.importSymbols('IF-MIB', 'InterfaceIndex') (ip_m_route_next_hop_group, ip_m_route_source_mask, ip_m_route_next_hop_if_index, ip_m_route_next_hop_address, ip_m_route_next_hop_source_mask, ip_m_route_group, ip_m_route_next_hop_source, ip_m_route_source) = mibBuilder.importSymbols('IPMROUTE-STD-MIB', 'ipMRouteNextHopGroup', 'ipMRouteSourceMask', 'ipMRouteNextHopIfIndex', 'ipMRouteNextHopAddress', 'ipMRouteNextHopSourceMask', 'ipMRouteGroup', 'ipMRouteNextHopSource', 'ipMRouteSource') (object_group, module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ObjectGroup', 'ModuleCompliance', 'NotificationGroup') (gauge32, ip_address, iso, unsigned32, bits, module_identity, object_identity, integer32, time_ticks, mib_identifier, notification_type, mib_scalar, mib_table, mib_table_row, mib_table_column, counter32, counter64) = mibBuilder.importSymbols('SNMPv2-SMI', 'Gauge32', 'IpAddress', 'iso', 'Unsigned32', 'Bits', 'ModuleIdentity', 'ObjectIdentity', 'Integer32', 'TimeTicks', 'MibIdentifier', 'NotificationType', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter32', 'Counter64') (truth_value, textual_convention, row_status, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TruthValue', 'TextualConvention', 'RowStatus', 'DisplayString') hm_pimmib = module_identity((1, 3, 6, 1, 4, 1, 248, 15, 4, 99)) hmPIMMIB.setRevisions(('2006-02-06 12:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: hmPIMMIB.setRevisionsDescriptions(('Initial version, published as RFC 2934.',)) if mibBuilder.loadTexts: hmPIMMIB.setLastUpdated('200602061200Z') if mibBuilder.loadTexts: hmPIMMIB.setOrganization('Hirschmann Automation and Control GmbH') if mibBuilder.loadTexts: hmPIMMIB.setContactInfo('Customer Support Postal: Hirschmann Automation and Control GmbH Stuttgarter Str. 45-51 72654 Neckartenzlingen Germany Tel: +49 7127 14 1981 Web: http://www.hicomcenter.com/ E-Mail: hicomcenter@hirschmann.com') if mibBuilder.loadTexts: hmPIMMIB.setDescription('The Hirschmann Private Platform4 PIM MIB definitions for Platform devices.') hm_pimmib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1)) hm_pim_traps = mib_identifier((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 0)) hm_pim = mib_identifier((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1)) hm_pim_join_prune_interval = mib_scalar((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 1), integer32()).setUnits('seconds').setMaxAccess('readwrite') if mibBuilder.loadTexts: hmPIMJoinPruneInterval.setStatus('current') if mibBuilder.loadTexts: hmPIMJoinPruneInterval.setDescription('The default interval at which periodic PIM-SM Join/Prune messages are to be sent.') hm_pim_interface_table = mib_table((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2)) if mibBuilder.loadTexts: hmPIMInterfaceTable.setStatus('current') if mibBuilder.loadTexts: hmPIMInterfaceTable.setDescription("The (conceptual) table listing the router's PIM interfaces. IGMP and PIM are enabled on all interfaces listed in this table.") hm_pim_interface_entry = mib_table_row((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1)).setIndexNames((0, 'HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceIfIndex')) if mibBuilder.loadTexts: hmPIMInterfaceEntry.setStatus('current') if mibBuilder.loadTexts: hmPIMInterfaceEntry.setDescription('An entry (conceptual row) in the hmPIMInterfaceTable.') hm_pim_interface_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 1), interface_index()) if mibBuilder.loadTexts: hmPIMInterfaceIfIndex.setStatus('current') if mibBuilder.loadTexts: hmPIMInterfaceIfIndex.setDescription('The ifIndex value of this PIM interface.') hm_pim_interface_address = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 2), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: hmPIMInterfaceAddress.setStatus('current') if mibBuilder.loadTexts: hmPIMInterfaceAddress.setDescription('The IP address of the PIM interface.') hm_pim_interface_net_mask = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 3), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: hmPIMInterfaceNetMask.setStatus('current') if mibBuilder.loadTexts: hmPIMInterfaceNetMask.setDescription('The network mask for the IP address of the PIM interface.') hm_pim_interface_mode = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('dense', 1), ('sparse', 2), ('sparseDense', 3))).clone('dense')).setMaxAccess('readcreate') if mibBuilder.loadTexts: hmPIMInterfaceMode.setStatus('current') if mibBuilder.loadTexts: hmPIMInterfaceMode.setDescription('The configured mode of this PIM interface. A value of sparseDense is only valid for PIMv1.') hm_pim_interface_dr = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 5), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: hmPIMInterfaceDR.setStatus('current') if mibBuilder.loadTexts: hmPIMInterfaceDR.setDescription('The Designated Router on this PIM interface. For point-to- point interfaces, this object has the value 0.0.0.0.') hm_pim_interface_hello_interval = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 6), integer32().clone(30)).setUnits('seconds').setMaxAccess('readcreate') if mibBuilder.loadTexts: hmPIMInterfaceHelloInterval.setStatus('current') if mibBuilder.loadTexts: hmPIMInterfaceHelloInterval.setDescription('The frequency at which PIM Hello messages are transmitted on this interface.') hm_pim_interface_status = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 7), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hmPIMInterfaceStatus.setStatus('current') if mibBuilder.loadTexts: hmPIMInterfaceStatus.setDescription('The status of this entry. Creating the entry enables PIM on the interface; destroying the entry disables PIM on the interface.') hm_pim_interface_join_prune_interval = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 8), integer32()).setUnits('seconds').setMaxAccess('readcreate') if mibBuilder.loadTexts: hmPIMInterfaceJoinPruneInterval.setStatus('current') if mibBuilder.loadTexts: hmPIMInterfaceJoinPruneInterval.setDescription('The frequency at which PIM Join/Prune messages are transmitted on this PIM interface. The default value of this object is the hmPIMJoinPruneInterval.') hm_pim_interface_cbsr_preference = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 9), integer32().subtype(subtypeSpec=value_range_constraint(-1, 255))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hmPIMInterfaceCBSRPreference.setStatus('current') if mibBuilder.loadTexts: hmPIMInterfaceCBSRPreference.setDescription('The preference value for the local interface as a candidate bootstrap router. The value of -1 is used to indicate that the local interface is not a candidate BSR interface.') hm_pim_neighbor_table = mib_table((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3)) if mibBuilder.loadTexts: hmPIMNeighborTable.setStatus('current') if mibBuilder.loadTexts: hmPIMNeighborTable.setDescription("The (conceptual) table listing the router's PIM neighbors.") hm_pim_neighbor_entry = mib_table_row((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3, 1)).setIndexNames((0, 'HIRSCHMANN-PIM-MIB', 'hmPIMNeighborAddress')) if mibBuilder.loadTexts: hmPIMNeighborEntry.setStatus('current') if mibBuilder.loadTexts: hmPIMNeighborEntry.setDescription('An entry (conceptual row) in the hmPIMNeighborTable.') hm_pim_neighbor_address = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3, 1, 1), ip_address()) if mibBuilder.loadTexts: hmPIMNeighborAddress.setStatus('current') if mibBuilder.loadTexts: hmPIMNeighborAddress.setDescription('The IP address of the PIM neighbor for which this entry contains information.') hm_pim_neighbor_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3, 1, 2), interface_index()).setMaxAccess('readonly') if mibBuilder.loadTexts: hmPIMNeighborIfIndex.setStatus('current') if mibBuilder.loadTexts: hmPIMNeighborIfIndex.setDescription('The value of ifIndex for the interface used to reach this PIM neighbor.') hm_pim_neighbor_up_time = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3, 1, 3), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: hmPIMNeighborUpTime.setStatus('current') if mibBuilder.loadTexts: hmPIMNeighborUpTime.setDescription('The time since this PIM neighbor (last) became a neighbor of the local router.') hm_pim_neighbor_expiry_time = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3, 1, 4), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: hmPIMNeighborExpiryTime.setStatus('current') if mibBuilder.loadTexts: hmPIMNeighborExpiryTime.setDescription('The minimum time remaining before this PIM neighbor will be aged out.') hm_pim_neighbor_mode = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('dense', 1), ('sparse', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: hmPIMNeighborMode.setStatus('deprecated') if mibBuilder.loadTexts: hmPIMNeighborMode.setDescription('The active PIM mode of this neighbor. This object is deprecated for PIMv2 routers since all neighbors on the interface must be either dense or sparse as determined by the protocol running on the interface.') hm_pim_ip_m_route_table = mib_table((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4)) if mibBuilder.loadTexts: hmPIMIpMRouteTable.setStatus('current') if mibBuilder.loadTexts: hmPIMIpMRouteTable.setDescription('The (conceptual) table listing PIM-specific information on a subset of the rows of the ipMRouteTable defined in the IP Multicast MIB.') hm_pim_ip_m_route_entry = mib_table_row((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4, 1)).setIndexNames((0, 'IPMROUTE-STD-MIB', 'ipMRouteGroup'), (0, 'IPMROUTE-STD-MIB', 'ipMRouteSource'), (0, 'IPMROUTE-STD-MIB', 'ipMRouteSourceMask')) if mibBuilder.loadTexts: hmPIMIpMRouteEntry.setStatus('current') if mibBuilder.loadTexts: hmPIMIpMRouteEntry.setDescription('An entry (conceptual row) in the hmPIMIpMRouteTable. There is one entry per entry in the ipMRouteTable whose incoming interface is running PIM.') hm_pim_ip_m_route_upstream_assert_timer = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4, 1, 1), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: hmPIMIpMRouteUpstreamAssertTimer.setStatus('current') if mibBuilder.loadTexts: hmPIMIpMRouteUpstreamAssertTimer.setDescription('The time remaining before the router changes its upstream neighbor back to its RPF neighbor. This timer is called the Assert timer in the PIM Sparse and Dense mode specification. A value of 0 indicates that no Assert has changed the upstream neighbor away from the RPF neighbor.') hm_pim_ip_m_route_assert_metric = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4, 1, 2), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hmPIMIpMRouteAssertMetric.setStatus('current') if mibBuilder.loadTexts: hmPIMIpMRouteAssertMetric.setDescription('The metric advertised by the assert winner on the upstream interface, or 0 if no such assert is in received.') hm_pim_ip_m_route_assert_metric_pref = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4, 1, 3), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hmPIMIpMRouteAssertMetricPref.setStatus('current') if mibBuilder.loadTexts: hmPIMIpMRouteAssertMetricPref.setDescription('The preference advertised by the assert winner on the upstream interface, or 0 if no such assert is in effect.') hm_pim_ip_m_route_assert_rpt_bit = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4, 1, 4), truth_value()).setMaxAccess('readonly') if mibBuilder.loadTexts: hmPIMIpMRouteAssertRPTBit.setStatus('current') if mibBuilder.loadTexts: hmPIMIpMRouteAssertRPTBit.setDescription('The value of the RPT-bit advertised by the assert winner on the upstream interface, or false if no such assert is in effect.') hm_pim_ip_m_route_flags = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4, 1, 5), bits().clone(namedValues=named_values(('rpt', 0), ('spt', 1)))).setMaxAccess('readonly') if mibBuilder.loadTexts: hmPIMIpMRouteFlags.setStatus('current') if mibBuilder.loadTexts: hmPIMIpMRouteFlags.setDescription('This object describes PIM-specific flags related to a multicast state entry. See the PIM Sparse Mode specification for the meaning of the RPT and SPT bits.') hm_pim_ip_m_route_next_hop_table = mib_table((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 7)) if mibBuilder.loadTexts: hmPIMIpMRouteNextHopTable.setStatus('current') if mibBuilder.loadTexts: hmPIMIpMRouteNextHopTable.setDescription('The (conceptual) table listing PIM-specific information on a subset of the rows of the ipMRouteNextHopTable defined in the IP Multicast MIB.') hm_pim_ip_m_route_next_hop_entry = mib_table_row((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 7, 1)).setIndexNames((0, 'IPMROUTE-STD-MIB', 'ipMRouteNextHopGroup'), (0, 'IPMROUTE-STD-MIB', 'ipMRouteNextHopSource'), (0, 'IPMROUTE-STD-MIB', 'ipMRouteNextHopSourceMask'), (0, 'IPMROUTE-STD-MIB', 'ipMRouteNextHopIfIndex'), (0, 'IPMROUTE-STD-MIB', 'ipMRouteNextHopAddress')) if mibBuilder.loadTexts: hmPIMIpMRouteNextHopEntry.setStatus('current') if mibBuilder.loadTexts: hmPIMIpMRouteNextHopEntry.setDescription('An entry (conceptual row) in the hmPIMIpMRouteNextHopTable. There is one entry per entry in the ipMRouteNextHopTable whose interface is running PIM and whose ipMRouteNextHopState is pruned(1).') hm_pim_ip_m_route_next_hop_prune_reason = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 7, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('other', 1), ('prune', 2), ('assert', 3)))).setMaxAccess('readonly') if mibBuilder.loadTexts: hmPIMIpMRouteNextHopPruneReason.setStatus('current') if mibBuilder.loadTexts: hmPIMIpMRouteNextHopPruneReason.setDescription('This object indicates why the downstream interface was pruned, whether in response to a PIM prune message or due to PIM Assert processing.') hm_pimrp_table = mib_table((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5)) if mibBuilder.loadTexts: hmPIMRPTable.setStatus('deprecated') if mibBuilder.loadTexts: hmPIMRPTable.setDescription('The (conceptual) table listing PIM version 1 information for the Rendezvous Points (RPs) for IP multicast groups. This table is deprecated since its function is replaced by the hmPIMRPSetTable for PIM version 2.') hm_pimrp_entry = mib_table_row((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1)).setIndexNames((0, 'HIRSCHMANN-PIM-MIB', 'hmPIMRPGroupAddress'), (0, 'HIRSCHMANN-PIM-MIB', 'hmPIMRPAddress')) if mibBuilder.loadTexts: hmPIMRPEntry.setStatus('deprecated') if mibBuilder.loadTexts: hmPIMRPEntry.setDescription('An entry (conceptual row) in the hmPIMRPTable. There is one entry per RP address for each IP multicast group.') hm_pimrp_group_address = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1, 1), ip_address()) if mibBuilder.loadTexts: hmPIMRPGroupAddress.setStatus('deprecated') if mibBuilder.loadTexts: hmPIMRPGroupAddress.setDescription('The IP multicast group address for which this entry contains information about an RP.') hm_pimrp_address = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1, 2), ip_address()) if mibBuilder.loadTexts: hmPIMRPAddress.setStatus('deprecated') if mibBuilder.loadTexts: hmPIMRPAddress.setDescription('The unicast address of the RP.') hm_pimrp_state = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('up', 1), ('down', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: hmPIMRPState.setStatus('deprecated') if mibBuilder.loadTexts: hmPIMRPState.setDescription('The state of the RP.') hm_pimrp_state_timer = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1, 4), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: hmPIMRPStateTimer.setStatus('deprecated') if mibBuilder.loadTexts: hmPIMRPStateTimer.setDescription('The minimum time remaining before the next state change. When hmPIMRPState is up, this is the minimum time which must expire until it can be declared down. When hmPIMRPState is down, this is the time until it will be declared up (in order to retry).') hm_pimrp_last_change = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1, 5), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: hmPIMRPLastChange.setStatus('deprecated') if mibBuilder.loadTexts: hmPIMRPLastChange.setDescription('The value of sysUpTime at the time when the corresponding instance of hmPIMRPState last changed its value.') hm_pimrp_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1, 6), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hmPIMRPRowStatus.setStatus('deprecated') if mibBuilder.loadTexts: hmPIMRPRowStatus.setDescription('The status of this row, by which new entries may be created, or old entries deleted from this table.') hm_pimrp_set_table = mib_table((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6)) if mibBuilder.loadTexts: hmPIMRPSetTable.setStatus('current') if mibBuilder.loadTexts: hmPIMRPSetTable.setDescription('The (conceptual) table listing PIM information for candidate Rendezvous Points (RPs) for IP multicast groups. When the local router is the BSR, this information is obtained from received Candidate-RP-Advertisements. When the local router is not the BSR, this information is obtained from received RP-Set messages.') hm_pimrp_set_entry = mib_table_row((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1)).setIndexNames((0, 'HIRSCHMANN-PIM-MIB', 'hmPIMRPSetComponent'), (0, 'HIRSCHMANN-PIM-MIB', 'hmPIMRPSetGroupAddress'), (0, 'HIRSCHMANN-PIM-MIB', 'hmPIMRPSetGroupMask'), (0, 'HIRSCHMANN-PIM-MIB', 'hmPIMRPSetAddress')) if mibBuilder.loadTexts: hmPIMRPSetEntry.setStatus('current') if mibBuilder.loadTexts: hmPIMRPSetEntry.setDescription('An entry (conceptual row) in the hmPIMRPSetTable.') hm_pimrp_set_group_address = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1, 1), ip_address()) if mibBuilder.loadTexts: hmPIMRPSetGroupAddress.setStatus('current') if mibBuilder.loadTexts: hmPIMRPSetGroupAddress.setDescription('The IP multicast group address which, when combined with hmPIMRPSetGroupMask, gives the group prefix for which this entry contains information about the Candidate-RP.') hm_pimrp_set_group_mask = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1, 2), ip_address()) if mibBuilder.loadTexts: hmPIMRPSetGroupMask.setStatus('current') if mibBuilder.loadTexts: hmPIMRPSetGroupMask.setDescription('The multicast group address mask which, when combined with hmPIMRPSetGroupAddress, gives the group prefix for which this entry contains information about the Candidate-RP.') hm_pimrp_set_address = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1, 3), ip_address()) if mibBuilder.loadTexts: hmPIMRPSetAddress.setStatus('current') if mibBuilder.loadTexts: hmPIMRPSetAddress.setDescription('The IP address of the Candidate-RP.') hm_pimrp_set_hold_time = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setUnits('seconds').setMaxAccess('readonly') if mibBuilder.loadTexts: hmPIMRPSetHoldTime.setStatus('current') if mibBuilder.loadTexts: hmPIMRPSetHoldTime.setDescription('The holdtime of a Candidate-RP. If the local router is not the BSR, this value is 0.') hm_pimrp_set_expiry_time = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1, 5), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: hmPIMRPSetExpiryTime.setStatus('current') if mibBuilder.loadTexts: hmPIMRPSetExpiryTime.setDescription('The minimum time remaining before the Candidate-RP will be declared down. If the local router is not the BSR, this value is 0.') hm_pimrp_set_component = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1, 6), integer32().subtype(subtypeSpec=value_range_constraint(1, 255))) if mibBuilder.loadTexts: hmPIMRPSetComponent.setStatus('current') if mibBuilder.loadTexts: hmPIMRPSetComponent.setDescription(' A number uniquely identifying the component. Each protocol instance connected to a separate domain should have a different index value.') hm_pim_candidate_rp_table = mib_table((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 11)) if mibBuilder.loadTexts: hmPIMCandidateRPTable.setStatus('current') if mibBuilder.loadTexts: hmPIMCandidateRPTable.setDescription('The (conceptual) table listing the IP multicast groups for which the local router is to advertise itself as a Candidate-RP when the value of hmPIMComponentCRPHoldTime is non-zero. If this table is empty, then the local router will advertise itself as a Candidate-RP for all groups (providing the value of hmPIMComponentCRPHoldTime is non- zero).') hm_pim_candidate_rp_entry = mib_table_row((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 11, 1)).setIndexNames((0, 'HIRSCHMANN-PIM-MIB', 'hmPIMCandidateRPGroupAddress'), (0, 'HIRSCHMANN-PIM-MIB', 'hmPIMCandidateRPGroupMask')) if mibBuilder.loadTexts: hmPIMCandidateRPEntry.setStatus('current') if mibBuilder.loadTexts: hmPIMCandidateRPEntry.setDescription('An entry (conceptual row) in the hmPIMCandidateRPTable.') hm_pim_candidate_rp_group_address = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 11, 1, 1), ip_address()) if mibBuilder.loadTexts: hmPIMCandidateRPGroupAddress.setStatus('current') if mibBuilder.loadTexts: hmPIMCandidateRPGroupAddress.setDescription('The IP multicast group address which, when combined with hmPIMCandidateRPGroupMask, identifies a group prefix for which the local router will advertise itself as a Candidate-RP.') hm_pim_candidate_rp_group_mask = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 11, 1, 2), ip_address()) if mibBuilder.loadTexts: hmPIMCandidateRPGroupMask.setStatus('current') if mibBuilder.loadTexts: hmPIMCandidateRPGroupMask.setDescription('The multicast group address mask which, when combined with hmPIMCandidateRPGroupMask, identifies a group prefix for which the local router will advertise itself as a Candidate-RP.') hm_pim_candidate_rp_address = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 11, 1, 3), ip_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hmPIMCandidateRPAddress.setStatus('current') if mibBuilder.loadTexts: hmPIMCandidateRPAddress.setDescription('The (unicast) address of the interface which will be advertised as a Candidate-RP.') hm_pim_candidate_rp_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 11, 1, 4), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hmPIMCandidateRPRowStatus.setStatus('current') if mibBuilder.loadTexts: hmPIMCandidateRPRowStatus.setDescription('The status of this row, by which new entries may be created, or old entries deleted from this table.') hm_pim_component_table = mib_table((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12)) if mibBuilder.loadTexts: hmPIMComponentTable.setStatus('current') if mibBuilder.loadTexts: hmPIMComponentTable.setDescription('The (conceptual) table containing objects specific to a PIM domain. One row exists for each domain to which the router is connected. A PIM-SM domain is defined as an area of the network over which Bootstrap messages are forwarded. Typically, a PIM-SM router will be a member of exactly one domain. This table also supports, however, routers which may form a border between two PIM-SM domains and do not forward Bootstrap messages between them.') hm_pim_component_entry = mib_table_row((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12, 1)).setIndexNames((0, 'HIRSCHMANN-PIM-MIB', 'hmPIMComponentIndex')) if mibBuilder.loadTexts: hmPIMComponentEntry.setStatus('current') if mibBuilder.loadTexts: hmPIMComponentEntry.setDescription('An entry (conceptual row) in the hmPIMComponentTable.') hm_pim_component_index = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 255))) if mibBuilder.loadTexts: hmPIMComponentIndex.setStatus('current') if mibBuilder.loadTexts: hmPIMComponentIndex.setDescription('A number uniquely identifying the component. Each protocol instance connected to a separate domain should have a different index value. Routers that only support membership in a single PIM-SM domain should use a hmPIMComponentIndex value of 1.') hm_pim_component_bsr_address = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12, 1, 2), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: hmPIMComponentBSRAddress.setStatus('current') if mibBuilder.loadTexts: hmPIMComponentBSRAddress.setDescription('The IP address of the bootstrap router (BSR) for the local PIM region.') hm_pim_component_bsr_expiry_time = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12, 1, 3), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: hmPIMComponentBSRExpiryTime.setStatus('current') if mibBuilder.loadTexts: hmPIMComponentBSRExpiryTime.setDescription('The minimum time remaining before the bootstrap router in the local domain will be declared down. For candidate BSRs, this is the time until the component sends an RP-Set message. For other routers, this is the time until it may accept an RP-Set message from a lower candidate BSR.') hm_pim_component_crp_hold_time = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setUnits('seconds').setMaxAccess('readcreate') if mibBuilder.loadTexts: hmPIMComponentCRPHoldTime.setStatus('current') if mibBuilder.loadTexts: hmPIMComponentCRPHoldTime.setDescription('The holdtime of the component when it is a candidate RP in the local domain. The value of 0 is used to indicate that the local system is not a Candidate-RP.') hm_pim_component_status = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12, 1, 5), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hmPIMComponentStatus.setStatus('current') if mibBuilder.loadTexts: hmPIMComponentStatus.setDescription('The status of this entry. Creating the entry creates another protocol instance; destroying the entry disables a protocol instance.') hm_pim_neighbor_loss = notification_type((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 0, 1)).setObjects(('HIRSCHMANN-PIM-MIB', 'hmPIMNeighborIfIndex')) if mibBuilder.loadTexts: hmPIMNeighborLoss.setStatus('current') if mibBuilder.loadTexts: hmPIMNeighborLoss.setDescription('A hmPIMNeighborLoss trap signifies the loss of an adjacency with a neighbor. This trap should be generated when the neighbor timer expires, and the router has no other neighbors on the same interface with a lower IP address than itself.') hm_pimmib_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2)) hm_pimmib_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 1)) hm_pimmib_groups = mib_identifier((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2)) hm_pimv1_mib_compliance = module_compliance((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 1, 1)).setObjects(('HIRSCHMANN-PIM-MIB', 'hmPIMV1MIBGroup')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hm_pimv1_mib_compliance = hmPIMV1MIBCompliance.setStatus('deprecated') if mibBuilder.loadTexts: hmPIMV1MIBCompliance.setDescription('The compliance statement for routers running PIMv1 and implementing the PIM MIB.') hm_pim_sparse_v2_mib_compliance = module_compliance((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 1, 2)).setObjects(('HIRSCHMANN-PIM-MIB', 'hmPIMV2MIBGroup'), ('HIRSCHMANN-PIM-MIB', 'hmPIMV2CandidateRPMIBGroup')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hm_pim_sparse_v2_mib_compliance = hmPIMSparseV2MIBCompliance.setStatus('current') if mibBuilder.loadTexts: hmPIMSparseV2MIBCompliance.setDescription('The compliance statement for routers running PIM Sparse Mode and implementing the PIM MIB.') hm_pim_dense_v2_mib_compliance = module_compliance((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 1, 3)).setObjects(('HIRSCHMANN-PIM-MIB', 'hmPIMDenseV2MIBGroup')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hm_pim_dense_v2_mib_compliance = hmPIMDenseV2MIBCompliance.setStatus('current') if mibBuilder.loadTexts: hmPIMDenseV2MIBCompliance.setDescription('The compliance statement for routers running PIM Dense Mode and implementing the PIM MIB.') hm_pim_notification_group = notification_group((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 1)).setObjects(('HIRSCHMANN-PIM-MIB', 'hmPIMNeighborLoss')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hm_pim_notification_group = hmPIMNotificationGroup.setStatus('current') if mibBuilder.loadTexts: hmPIMNotificationGroup.setDescription('A collection of notifications for signaling important PIM events.') hm_pimv2_mib_group = object_group((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 2)).setObjects(('HIRSCHMANN-PIM-MIB', 'hmPIMJoinPruneInterval'), ('HIRSCHMANN-PIM-MIB', 'hmPIMNeighborIfIndex'), ('HIRSCHMANN-PIM-MIB', 'hmPIMNeighborUpTime'), ('HIRSCHMANN-PIM-MIB', 'hmPIMNeighborExpiryTime'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceAddress'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceNetMask'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceDR'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceHelloInterval'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceStatus'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceJoinPruneInterval'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceCBSRPreference'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceMode'), ('HIRSCHMANN-PIM-MIB', 'hmPIMRPSetHoldTime'), ('HIRSCHMANN-PIM-MIB', 'hmPIMRPSetExpiryTime'), ('HIRSCHMANN-PIM-MIB', 'hmPIMComponentBSRAddress'), ('HIRSCHMANN-PIM-MIB', 'hmPIMComponentBSRExpiryTime'), ('HIRSCHMANN-PIM-MIB', 'hmPIMComponentCRPHoldTime'), ('HIRSCHMANN-PIM-MIB', 'hmPIMComponentStatus'), ('HIRSCHMANN-PIM-MIB', 'hmPIMIpMRouteFlags'), ('HIRSCHMANN-PIM-MIB', 'hmPIMIpMRouteUpstreamAssertTimer')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hm_pimv2_mib_group = hmPIMV2MIBGroup.setStatus('current') if mibBuilder.loadTexts: hmPIMV2MIBGroup.setDescription('A collection of objects to support management of PIM Sparse Mode (version 2) routers.') hm_pim_dense_v2_mib_group = object_group((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 5)).setObjects(('HIRSCHMANN-PIM-MIB', 'hmPIMNeighborIfIndex'), ('HIRSCHMANN-PIM-MIB', 'hmPIMNeighborUpTime'), ('HIRSCHMANN-PIM-MIB', 'hmPIMNeighborExpiryTime'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceAddress'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceNetMask'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceDR'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceHelloInterval'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceStatus'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceMode')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hm_pim_dense_v2_mib_group = hmPIMDenseV2MIBGroup.setStatus('current') if mibBuilder.loadTexts: hmPIMDenseV2MIBGroup.setDescription('A collection of objects to support management of PIM Dense Mode (version 2) routers.') hm_pimv2_candidate_rpmib_group = object_group((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 3)).setObjects(('HIRSCHMANN-PIM-MIB', 'hmPIMCandidateRPAddress'), ('HIRSCHMANN-PIM-MIB', 'hmPIMCandidateRPRowStatus')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hm_pimv2_candidate_rpmib_group = hmPIMV2CandidateRPMIBGroup.setStatus('current') if mibBuilder.loadTexts: hmPIMV2CandidateRPMIBGroup.setDescription('A collection of objects to support configuration of which groups a router is to advertise itself as a Candidate-RP.') hm_pimv1_mib_group = object_group((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 4)).setObjects(('HIRSCHMANN-PIM-MIB', 'hmPIMJoinPruneInterval'), ('HIRSCHMANN-PIM-MIB', 'hmPIMNeighborIfIndex'), ('HIRSCHMANN-PIM-MIB', 'hmPIMNeighborUpTime'), ('HIRSCHMANN-PIM-MIB', 'hmPIMNeighborExpiryTime'), ('HIRSCHMANN-PIM-MIB', 'hmPIMNeighborMode'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceAddress'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceNetMask'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceJoinPruneInterval'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceStatus'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceMode'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceDR'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceHelloInterval'), ('HIRSCHMANN-PIM-MIB', 'hmPIMRPState'), ('HIRSCHMANN-PIM-MIB', 'hmPIMRPStateTimer'), ('HIRSCHMANN-PIM-MIB', 'hmPIMRPLastChange'), ('HIRSCHMANN-PIM-MIB', 'hmPIMRPRowStatus')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hm_pimv1_mib_group = hmPIMV1MIBGroup.setStatus('deprecated') if mibBuilder.loadTexts: hmPIMV1MIBGroup.setDescription('A collection of objects to support management of PIM (version 1) routers.') hm_pim_next_hop_group = object_group((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 6)).setObjects(('HIRSCHMANN-PIM-MIB', 'hmPIMIpMRouteNextHopPruneReason')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hm_pim_next_hop_group = hmPIMNextHopGroup.setStatus('current') if mibBuilder.loadTexts: hmPIMNextHopGroup.setDescription('A collection of optional objects to provide per-next hop information for diagnostic purposes. Supporting this group may add a large number of instances to a tree walk, but the information in this group can be extremely useful in tracking down multicast connectivity problems.') hm_pim_assert_group = object_group((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 7)).setObjects(('HIRSCHMANN-PIM-MIB', 'hmPIMIpMRouteAssertMetric'), ('HIRSCHMANN-PIM-MIB', 'hmPIMIpMRouteAssertMetricPref'), ('HIRSCHMANN-PIM-MIB', 'hmPIMIpMRouteAssertRPTBit')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hm_pim_assert_group = hmPIMAssertGroup.setStatus('current') if mibBuilder.loadTexts: hmPIMAssertGroup.setDescription('A collection of optional objects to provide extra information about the assert election process. There is no protocol reason to keep such information, but some implementations may already keep this information and make it available. These objects can also be very useful in debugging connectivity or duplicate packet problems, especially if the assert winner does not support the PIM and IP Multicast MIBs.') mibBuilder.exportSymbols('HIRSCHMANN-PIM-MIB', hmPIMComponentEntry=hmPIMComponentEntry, hmPIMInterfaceHelloInterval=hmPIMInterfaceHelloInterval, hmPIMCandidateRPTable=hmPIMCandidateRPTable, hmPIMIpMRouteNextHopTable=hmPIMIpMRouteNextHopTable, hmPIMMIBObjects=hmPIMMIBObjects, hmPIMIpMRouteAssertMetricPref=hmPIMIpMRouteAssertMetricPref, hmPIMIpMRouteTable=hmPIMIpMRouteTable, hmPIMDenseV2MIBGroup=hmPIMDenseV2MIBGroup, hmPIMCandidateRPEntry=hmPIMCandidateRPEntry, hmPIMJoinPruneInterval=hmPIMJoinPruneInterval, hmPIMMIBCompliances=hmPIMMIBCompliances, hmPIMCandidateRPAddress=hmPIMCandidateRPAddress, hmPIMComponentBSRExpiryTime=hmPIMComponentBSRExpiryTime, hmPIMMIB=hmPIMMIB, hmPIMIpMRouteAssertRPTBit=hmPIMIpMRouteAssertRPTBit, hmPIMComponentCRPHoldTime=hmPIMComponentCRPHoldTime, hmPIMRPLastChange=hmPIMRPLastChange, hmPIMComponentTable=hmPIMComponentTable, hmPIMNeighborIfIndex=hmPIMNeighborIfIndex, hmPIMRPSetTable=hmPIMRPSetTable, hmPIMComponentStatus=hmPIMComponentStatus, PYSNMP_MODULE_ID=hmPIMMIB, hmPIMMIBConformance=hmPIMMIBConformance, hmPIMRPStateTimer=hmPIMRPStateTimer, hmPIMNeighborTable=hmPIMNeighborTable, hmPIMNextHopGroup=hmPIMNextHopGroup, hmPIMAssertGroup=hmPIMAssertGroup, hmPIMNeighborMode=hmPIMNeighborMode, hmPIMInterfaceTable=hmPIMInterfaceTable, hmPIMRPSetAddress=hmPIMRPSetAddress, hmPIMInterfaceMode=hmPIMInterfaceMode, hmPIMSparseV2MIBCompliance=hmPIMSparseV2MIBCompliance, hmPIMRPGroupAddress=hmPIMRPGroupAddress, hmPIMCandidateRPRowStatus=hmPIMCandidateRPRowStatus, hmPIMRPSetHoldTime=hmPIMRPSetHoldTime, hmPIMRPTable=hmPIMRPTable, hmPIMIpMRouteAssertMetric=hmPIMIpMRouteAssertMetric, hmPIMMIBGroups=hmPIMMIBGroups, hmPIMInterfaceNetMask=hmPIMInterfaceNetMask, hmPIMRPSetEntry=hmPIMRPSetEntry, hmPIMInterfaceDR=hmPIMInterfaceDR, hmPIMInterfaceAddress=hmPIMInterfaceAddress, hmPIMIpMRouteEntry=hmPIMIpMRouteEntry, hmPIMV2CandidateRPMIBGroup=hmPIMV2CandidateRPMIBGroup, hmPIMNeighborEntry=hmPIMNeighborEntry, hmPIMRPSetGroupMask=hmPIMRPSetGroupMask, hmPIMTraps=hmPIMTraps, hmPIMIpMRouteUpstreamAssertTimer=hmPIMIpMRouteUpstreamAssertTimer, hmPIMInterfaceStatus=hmPIMInterfaceStatus, hmPIMRPAddress=hmPIMRPAddress, hmPIMInterfaceIfIndex=hmPIMInterfaceIfIndex, hmPIMRPEntry=hmPIMRPEntry, hmPIMNeighborUpTime=hmPIMNeighborUpTime, hmPIMNeighborLoss=hmPIMNeighborLoss, hmPIMInterfaceEntry=hmPIMInterfaceEntry, hmPIMNeighborAddress=hmPIMNeighborAddress, hmPIMCandidateRPGroupAddress=hmPIMCandidateRPGroupAddress, hmPIMRPRowStatus=hmPIMRPRowStatus, hmPIMDenseV2MIBCompliance=hmPIMDenseV2MIBCompliance, hmPIMNotificationGroup=hmPIMNotificationGroup, hmPIMIpMRouteNextHopPruneReason=hmPIMIpMRouteNextHopPruneReason, hmPIMCandidateRPGroupMask=hmPIMCandidateRPGroupMask, hmPIMComponentBSRAddress=hmPIMComponentBSRAddress, hmPIMRPSetComponent=hmPIMRPSetComponent, hmPIMV2MIBGroup=hmPIMV2MIBGroup, hmPIMV1MIBGroup=hmPIMV1MIBGroup, hmPIMInterfaceCBSRPreference=hmPIMInterfaceCBSRPreference, hmPIMRPSetGroupAddress=hmPIMRPSetGroupAddress, hmPIMComponentIndex=hmPIMComponentIndex, hmPIMInterfaceJoinPruneInterval=hmPIMInterfaceJoinPruneInterval, hmPIMNeighborExpiryTime=hmPIMNeighborExpiryTime, hmPIMRPSetExpiryTime=hmPIMRPSetExpiryTime, hmPIMV1MIBCompliance=hmPIMV1MIBCompliance, hmPIM=hmPIM, hmPIMIpMRouteFlags=hmPIMIpMRouteFlags, hmPIMRPState=hmPIMRPState, hmPIMIpMRouteNextHopEntry=hmPIMIpMRouteNextHopEntry)
load( "@d2l_rules_csharp//csharp:defs.bzl", "csharp_register_toolchains", "csharp_repositories", "import_nuget_package", ) def selenium_register_dotnet(): csharp_register_toolchains() csharp_repositories() native.register_toolchains("//third_party/dotnet/ilmerge:all") import_nuget_package( name = "json.net", file = "third_party/dotnet/nuget/packages/newtonsoft.json.12.0.2.nupkg", sha256 = "056eec5d3d8b2a93f7ca5b026d34d9d5fe8c835b11e322faf1a2551da25c4e70", ) import_nuget_package( name = "moq", file = "third_party/dotnet/nuget/packages/moq.4.12.0.nupkg", sha256 = "339bbb71107e137a753a89c6b74adb5d9072f0916cf8f19f48b30ae29c41f434", ) import_nuget_package( name = "benderproxy", file = "third_party/dotnet/nuget/packages/benderproxy.1.0.0.nupkg", sha256 = "fd536dc97eb71268392173e7c4c0699795a31f6843470134ee068ade1be4b57d", ) import_nuget_package( name = "castle.core", file = "third_party/dotnet/nuget/packages/castle.core.4.4.0.nupkg", sha256 = "ee12c10079c1f9daebdb2538c37a34e5e317d800f2feb5cddd744f067d5dec66", ) import_nuget_package( name = "nunit", file = "third_party/dotnet/nuget/packages/nunit.3.12.0.nupkg" #sha256 = "056eec5d3d8b2a93f7ca5b026d34d9d5fe8c835b11e322faf1a2551da25c4e70", ) #import_nuget_package( # name = "system.threading.tasks.extensions", # package = "system.threading.tasks.extensions", # version = "4.5.1", #) #import_nuget_package( # name = "nunit", # package = "nunit", # version = "3.12.0", #)
load('@d2l_rules_csharp//csharp:defs.bzl', 'csharp_register_toolchains', 'csharp_repositories', 'import_nuget_package') def selenium_register_dotnet(): csharp_register_toolchains() csharp_repositories() native.register_toolchains('//third_party/dotnet/ilmerge:all') import_nuget_package(name='json.net', file='third_party/dotnet/nuget/packages/newtonsoft.json.12.0.2.nupkg', sha256='056eec5d3d8b2a93f7ca5b026d34d9d5fe8c835b11e322faf1a2551da25c4e70') import_nuget_package(name='moq', file='third_party/dotnet/nuget/packages/moq.4.12.0.nupkg', sha256='339bbb71107e137a753a89c6b74adb5d9072f0916cf8f19f48b30ae29c41f434') import_nuget_package(name='benderproxy', file='third_party/dotnet/nuget/packages/benderproxy.1.0.0.nupkg', sha256='fd536dc97eb71268392173e7c4c0699795a31f6843470134ee068ade1be4b57d') import_nuget_package(name='castle.core', file='third_party/dotnet/nuget/packages/castle.core.4.4.0.nupkg', sha256='ee12c10079c1f9daebdb2538c37a34e5e317d800f2feb5cddd744f067d5dec66') import_nuget_package(name='nunit', file='third_party/dotnet/nuget/packages/nunit.3.12.0.nupkg')
wifi_ssid = "" wifi_password = "" mqtt_username = "" mqtt_password = "" mqtt_address = "" mqtt_port = 8883
wifi_ssid = '' wifi_password = '' mqtt_username = '' mqtt_password = '' mqtt_address = '' mqtt_port = 8883
# NOTE: \a is the delimiter for chat pages # Quest ids can be found in Quests.py SCRIPT = ''' ID reward_100 SHOW laffMeter LERP_POS laffMeter 0 0 0 1 LERP_SCALE laffMeter 0.2 0.2 0.2 1 WAIT 1.5 ADD_LAFFMETER 1 WAIT 1 LERP_POS laffMeter -1.18 0 -0.87 1 LERP_SCALE laffMeter 0.075 0.075 0.075 1 WAIT 1 FINISH_QUEST_MOVIE # TUTORIAL ID tutorial_mickey LOAD_SFX soundRun "phase_3.5/audio/sfx/AV_footstep_runloop.ogg" LOAD_CC_DIALOGUE mickeyTutorialDialogue_1 "phase_3/audio/dial/CC_%s_tutorial02.ogg" LOAD_CC_DIALOGUE mickeyTutorialDialogue_2 "phase_3.5/audio/dial/CC_tom_tutorial_%s01.ogg" LOAD_CC_DIALOGUE mickeyTutorialDialogue_3a "phase_3/audio/dial/CC_%s_tutorial03.ogg" LOAD_CC_DIALOGUE mickeyTutorialDialogue_3b "phase_3/audio/dial/CC_%s_tutorial05.ogg" LOAD_DIALOGUE mickeyTutorialDialogue_4 "phase_3.5/audio/dial/CC_tom_tutorial_mickey02.ogg" LOCK_LOCALTOON REPARENTTO camera render POSHPRSCALE camera 11 7 3 52 0 0 1 1 1 LOAD_CLASSIC_CHAR classicChar REPARENTTO classicChar render POS classicChar 0 0 0 HPR classicChar 0 0 0 POS localToon 0 0 0 HPR localToon 0 0 0 WAIT 2 PLAY_SFX soundRun 1 LOOP_ANIM classicChar "run" LOOP_ANIM localToon "run" LERP_POS localToon -1.8 14.4 0 2 LERP_POS classicChar 0 17 0 2 WAIT 2 #LERP_HPR localToon -110 0 0 0.5 LERP_HPR localToon -70 0 0 0.5 LERP_HPR classicChar -120 0 0 0.5 WAIT 0.5 STOP_SFX soundRun LOOP_ANIM localToon "neutral" PLAY_ANIM classicChar "left-point-start" 1 WAIT 1.63 LOOP_ANIM classicChar "left-point" CC_CHAT_CONFIRM classicChar "QuestScriptTutorial%s_1" mickeyTutorialDialogue_1 PLAY_ANIM classicChar "left-point-start" -1.5 WAIT 1.0867 LOOP_ANIM classicChar "neutral" CC_CHAT_TO_CONFIRM npc classicChar "QuestScriptTutorial%s_2" "CFSpeech" mickeyTutorialDialogue_2 PLAY_ANIM classicChar "right-point-start" 1 WAIT 1.0867 LOOP_ANIM classicChar "right-point" CC_CHAT_CONFIRM classicChar "QuestScriptTutorial%s_3" mickeyTutorialDialogue_3a mickeyTutorialDialogue_3b PLAY_SFX soundRun 1 LOOP_ANIM classicChar "run" LERP_HPR classicChar -180 0 0 0.5 WAIT 0.5 LERP_POS classicChar 0 0 0 2 WAIT 2 STOP_SFX soundRun REPARENTTO classicChar hidden UNLOAD_CHAR classicChar #CHAT npc QuestScriptTutorialMickey_4 mickeyTutorialDialogue_4 REPARENTTO camera localToon POS localToon 1.6 9.8 0 HPR localToon 14 0 0 FREE_LOCALTOON LOCAL_CHAT_PERSIST npc QuestScriptTutorialMickey_4 mickeyTutorialDialogue_4 ID quest_assign_101 CLEAR_CHAT npc LOAD squirt1 "phase_3.5/models/gui/tutorial_gui" "squirt1" LOAD squirt2 "phase_3.5/models/gui/tutorial_gui" "squirt2" LOAD toonBuilding "phase_3.5/models/gui/tutorial_gui" "toon_buildings" LOAD cogBuilding "phase_3.5/models/gui/tutorial_gui" "suit_buildings" LOAD cogs "phase_3.5/models/gui/tutorial_gui" "suits" LOAD tart "phase_3.5/models/props/tart" LOAD flower "phase_3.5/models/props/squirting-flower" LOAD_DIALOGUE tomDialogue_01 "phase_3.5/audio/dial/CC_tom_tutorial_questscript01.ogg" LOAD_DIALOGUE tomDialogue_02 "phase_3.5/audio/dial/CC_tom_tutorial_questscript03.ogg" LOAD_DIALOGUE tomDialogue_03 "phase_3.5/audio/dial/CC_tom_tutorial_questscript04.ogg" LOAD_DIALOGUE tomDialogue_04 "phase_3.5/audio/dial/CC_tom_tutorial_questscript05.ogg" LOAD_DIALOGUE tomDialogue_05 "phase_3.5/audio/dial/CC_tom_tutorial_questscript06.ogg" LOAD_DIALOGUE tomDialogue_06 "phase_3.5/audio/dial/CC_tom_tutorial_questscript07.ogg" LOAD_DIALOGUE tomDialogue_07 "phase_3.5/audio/dial/CC_tom_tutorial_questscript08.ogg" LOAD_DIALOGUE tomDialogue_08 "phase_3.5/audio/dial/CC_tom_tutorial_questscript09.ogg" LOAD_DIALOGUE tomDialogue_09 "phase_3.5/audio/dial/CC_tom_tutorial_questscript10.ogg" LOAD_DIALOGUE tomDialogue_10 "phase_3.5/audio/dial/CC_tom_tutorial_questscript11.ogg" LOAD_DIALOGUE tomDialogue_11 "phase_3.5/audio/dial/CC_tom_tutorial_questscript12.ogg" LOAD_DIALOGUE tomDialogue_12 "phase_3.5/audio/dial/CC_tom_tutorial_questscript13.ogg" LOAD_DIALOGUE tomDialogue_13 "phase_3.5/audio/dial/CC_tom_tutorial_questscript14.ogg" LOAD_DIALOGUE tomDialogue_14 "phase_3.5/audio/dial/CC_tom_tutorial_questscript16.ogg" POSHPRSCALE cogs -1.05 7 0 0 0 0 1 1 1 POSHPRSCALE toonBuilding -1.05 7 0 0 0 0 1 1 1 POSHPRSCALE cogBuilding -1.05 7 0 0 0 0 1 1 1 POSHPRSCALE squirt1 -1.05 7 0 0 0 0 1 1 1 POSHPRSCALE squirt2 -1.05 7 0 0 0 0 1 1 1 REPARENTTO camera npc POS camera -2.2 5.2 3.3 HPR camera 215 5 0 WRTREPARENTTO camera localToon PLAY_ANIM npc "right-hand-start" 1 WAIT 1 REPARENTTO cogs aspect2d LERP_SCALE cogs 1 1 1 0.5 WAIT 1.0833 LOOP_ANIM npc "right-hand" 1 FUNCTION npc "angryEyes" FUNCTION npc "blinkEyes" LOCAL_CHAT_CONFIRM npc QuestScript101_1 "CFSpeech" tomDialogue_01 LOCAL_CHAT_CONFIRM npc QuestScript101_2 "CFSpeech" tomDialogue_02 REPARENTTO cogs hidden REPARENTTO toonBuilding camera LOCAL_CHAT_CONFIRM npc QuestScript101_3 "CFSpeech" tomDialogue_03 REPARENTTO toonBuilding hidden REPARENTTO cogBuilding camera FUNCTION npc "sadEyes" FUNCTION npc "blinkEyes" LOCAL_CHAT_CONFIRM npc QuestScript101_4 "CFSpeech" tomDialogue_04 REPARENTTO cogBuilding hidden REPARENTTO squirt1 camera FUNCTION npc "normalEyes" FUNCTION npc "blinkEyes" LOCAL_CHAT_CONFIRM npc QuestScript101_5 "CFSpeech" tomDialogue_05 REPARENTTO squirt1 hidden REPARENTTO squirt2 camera LOCAL_CHAT_CONFIRM npc QuestScript101_6 "CFSpeech" tomDialogue_06 PLAY_ANIM npc 'right-hand-start' -1.8 LERP_SCALE squirt2 1 1 0.01 0.5 WAIT 0.5 REPARENTTO squirt2 hidden WAIT 0.6574 LOOP_ANIM npc 'neutral' 1 LOCAL_CHAT_CONFIRM npc QuestScript101_7 "CFSpeech" tomDialogue_07 # Make it look like the client has no inventory. Since the toon.dc # specifies that the user really does have 1 of each item, we will # just put on a show for the client of not having any items then # handing them out. SET_INVENTORY 4 0 0 SET_INVENTORY 5 0 0 REPARENTTO inventory camera SHOW inventory SET_INVENTORY_DETAIL -1 POSHPRSCALE inventory -0.77 7.42 1.11 0 0 0 0.01 0.01 0.01 SET_INVENTORY_YPOS 4 0 -0.1 SET_INVENTORY_YPOS 5 0 -0.1 LERP_SCALE inventory 3 0.01 3 1 WAIT 1 REPARENTTO flower npc "**/1000/**/def_joint_right_hold" POSHPRSCALE flower 0.10 -0.14 0.20 180.00 287.10 168.69 0.70 0.70 0.70 PLAY_ANIM npc 'right-hand-start' 1.8 WAIT 1.1574 LOOP_ANIM npc 'right-hand' 1.1 WAIT 0.8 WRTREPARENTTO flower camera LERP_POSHPRSCALE flower -1.75 4.77 0.00 30.00 180.00 16.39 0.75 0.75 0.75 0.589 WAIT 1.094 LERP_POSHPRSCALE flower -1.76 7.42 -0.63 179.96 -89.9 -153.43 0.12 0.12 0.12 1 PLAY_ANIM npc 'right-hand-start' -1.5 WAIT 1 ADD_INVENTORY 5 0 1 POSHPRSCALE inventory -0.77 7.42 1.11 0 0 0 3 0.01 3 REPARENTTO flower hidden REPARENTTO tart npc "**/1000/**/def_joint_right_hold" POSHPRSCALE tart 0.19 0.02 0.00 0.00 0.00 349.38 0.34 0.34 0.34 PLAY_ANIM npc 'right-hand-start' 1.8 WAIT 1.1574 LOOP_ANIM npc 'right-hand' 1.1 WAIT 0.8 WRTREPARENTTO tart camera LERP_POSHPRSCALE tart -1.37 4.56 0 329.53 39.81 346.76 0.6 0.6 0.6 0.589 WAIT 1.094 LERP_POSHPRSCALE tart -1.66 7.42 -0.36 0 30 30 0.12 0.12 0.12 1.0 PLAY_ANIM npc 'right-hand-start' -1.5 WAIT 1 ADD_INVENTORY 4 0 1 POSHPRSCALE inventory -0.77 7.42 1.11 0 0 0 3 0.01 3 REPARENTTO tart hidden #PLAY_ANIM npc 'neutral' 1 #WAIT 2.0833 PLAY_ANIM npc 'right-hand-start' 1 WAIT 1.0 HIDE inventory REPARENTTO inventory hidden SET_INVENTORY_YPOS 4 0 0 SET_INVENTORY_YPOS 5 0 0 SET_INVENTORY_DETAIL 0 POSHPRSCALE inventory 0 0 0 0 0 0 1 1 1 OBSCURE_LAFFMETER 0 SHOW laffMeter POS laffMeter 0 0 0 SCALE laffMeter 0.075 0.075 0.075 LERP_POS laffMeter 1.7 0 0.87 1 LERP_SCALE laffMeter 0.2 0.2 0.2 0.6 WAIT 1.0833 LOOP_ANIM npc "right-hand" LOCAL_CHAT_CONFIRM npc QuestScript101_8 "CFSpeech" tomDialogue_08 LOCAL_CHAT_CONFIRM npc QuestScript101_9 "CFSpeech" tomDialogue_09 FUNCTION npc "sadEyes" FUNCTION npc "blinkEyes" LAFFMETER 15 15 WAIT 0.1 LAFFMETER 14 15 WAIT 0.1 LAFFMETER 13 15 WAIT 0.1 LAFFMETER 12 15 WAIT 0.1 LAFFMETER 11 15 WAIT 0.1 LAFFMETER 10 15 WAIT 0.1 LAFFMETER 9 15 WAIT 0.1 LAFFMETER 8 15 WAIT 0.1 LAFFMETER 7 15 WAIT 0.1 LAFFMETER 6 15 WAIT 0.1 LAFFMETER 5 15 WAIT 0.1 LAFFMETER 4 15 WAIT 0.1 LAFFMETER 3 15 WAIT 0.1 LAFFMETER 2 15 WAIT 0.1 LAFFMETER 1 15 WAIT 0.1 LAFFMETER 0 15 LOCAL_CHAT_CONFIRM npc QuestScript101_10 "CFSpeech" tomDialogue_10 FUNCTION npc "normalEyes" FUNCTION npc "blinkEyes" LAFFMETER 15 15 WAIT 0.5 LERP_POS laffMeter 0.15 0.15 0.15 1 LERP_SCALE laffMeter 0.085 0.085 0.085 0.6 PLAY_ANIM npc "right-hand-start" -2 WAIT 1.0625 LOOP_ANIM npc "neutral" WAIT 0.5 LERP_HPR npc -50 0 0 0.5 FUNCTION npc "surpriseEyes" FUNCTION npc "showSurpriseMuzzle" PLAY_ANIM npc "right-point-start" 1.5 WAIT 0.6944 LOOP_ANIM npc "right-point" LOCAL_CHAT_CONFIRM npc QuestScript101_11 "CFSpeech" tomDialogue_11 LOCAL_CHAT_CONFIRM npc QuestScript101_12 "CFSpeech" tomDialogue_12 PLAY_ANIM npc "right-point-start" -1 LERP_HPR npc -0.068 0 0 0.75 WAIT 1.0417 FUNCTION npc "angryEyes" FUNCTION npc "blinkEyes" FUNCTION npc "hideSurpriseMuzzle" LOOP_ANIM npc "neutral" FUNCTION localToon "questPage.showQuestsOnscreenTutorial" LOCAL_CHAT_CONFIRM npc QuestScript101_13 "CFSpeech" tomDialogue_13 FUNCTION localToon "questPage.hideQuestsOnscreenTutorial" LOCAL_CHAT_CONFIRM npc QuestScript101_14 1 "CFSpeech" tomDialogue_14 FUNCTION npc "normalEyes" FUNCTION npc "blinkEyes" # Cleanup UPON_TIMEOUT FUNCTION tart "removeNode" UPON_TIMEOUT FUNCTION flower "removeNode" UPON_TIMEOUT FUNCTION cogs "removeNode" UPON_TIMEOUT FUNCTION toonBuilding "removeNode" UPON_TIMEOUT FUNCTION cogBuilding "removeNode" UPON_TIMEOUT FUNCTION squirt1 "removeNode" UPON_TIMEOUT FUNCTION squirt2 "removeNode" UPON_TIMEOUT LOOP_ANIM npc "neutral" UPON_TIMEOUT HIDE inventory UPON_TIMEOUT SET_INVENTORY_DETAIL 0 UPON_TIMEOUT SHOW laffMeter UPON_TIMEOUT POS laffMeter 0.15 0.15 0.15 UPON_TIMEOUT SCALE laffMeter 0.085 0.085 0.085 UPON_TIMEOUT POSHPRSCALE inventory 0 0 0 0 0 0 1 1 1 POS localToon 0.776 14.6 0 HPR localToon 47.5 0 0 FINISH_QUEST_MOVIE # TUTORIAL HQ HARRY ID quest_incomplete_110 DEBUG "quest assign 110" LOAD_DIALOGUE harryDialogue_01 "phase_3.5/audio/dial/CC_harry_tutorial_questscript01.ogg" LOAD_DIALOGUE harryDialogue_02 "phase_3.5/audio/dial/CC_harry_tutorial_questscript02.ogg" LOAD_DIALOGUE harryDialogue_03 "phase_3.5/audio/dial/CC_harry_tutorial_questscript03.ogg" LOAD_DIALOGUE harryDialogue_04 "phase_3.5/audio/dial/CC_harry_tutorial_questscript04.ogg" LOAD_DIALOGUE harryDialogue_05 "phase_3.5/audio/dial/CC_harry_tutorial_questscript05.ogg" LOAD_DIALOGUE harryDialogue_06 "phase_3.5/audio/dial/CC_harry_tutorial_questscript06.ogg" LOAD_DIALOGUE harryDialogue_07 "phase_3.5/audio/dial/CC_harry_tutorial_questscript07.ogg" LOAD_DIALOGUE harryDialogue_08 "phase_3.5/audio/dial/CC_harry_tutorial_questscript08.ogg" LOAD_DIALOGUE harryDialogue_09 "phase_3.5/audio/dial/CC_harry_tutorial_questscript09.ogg" LOAD_DIALOGUE harryDialogue_10 "phase_3.5/audio/dial/CC_harry_tutorial_questscript10.ogg" LOAD_DIALOGUE harryDialogue_11 "phase_3.5/audio/dial/CC_harry_tutorial_questscript11.ogg" SET_MUSIC_VOLUME 0.4 activityMusic 0.5 0.7 LOCAL_CHAT_CONFIRM npc QuestScript110_1 harryDialogue_01 OBSCURE_BOOK 0 SHOW bookOpenButton LOCAL_CHAT_CONFIRM npc QuestScript110_2 harryDialogue_02 # ARROWS_ON 0.92 -0.89 0 1.22 -0.64 90 ARROWS_ON 1.364477 -0.89 0 1.664477 -0.64 90 LOCAL_CHAT_PERSIST npc QuestScript110_3 harryDialogue_03 WAIT_EVENT "enterStickerBook" ARROWS_OFF SHOW_BOOK HIDE bookPrevArrow HIDE bookNextArrow CLEAR_CHAT npc WAIT 0.5 TOON_HEAD npc -0.2 -0.45 1 LOCAL_CHAT_CONFIRM npc QuestScript110_4 harryDialogue_04 ARROWS_ON 0.85 -0.75 -90 0.85 -0.75 -90 SHOW bookNextArrow LOCAL_CHAT_PERSIST npc QuestScript110_5 harryDialogue_05 WAIT_EVENT "stickerBookPageChange-4" HIDE bookPrevArrow HIDE bookNextArrow ARROWS_OFF CLEAR_CHAT npc WAIT 0.5 LOCAL_CHAT_CONFIRM npc QuestScript110_6 harryDialogue_06 ARROWS_ON 0.85 -0.75 -90 0.85 -0.75 -90 SHOW bookNextArrow LOCAL_CHAT_PERSIST npc QuestScript110_7 harryDialogue_07 WAIT_EVENT "stickerBookPageChange-5" HIDE bookNextArrow HIDE bookPrevArrow ARROWS_OFF CLEAR_CHAT npc LOCAL_CHAT_CONFIRM npc QuestScript110_8 harryDialogue_08 LOCAL_CHAT_CONFIRM npc QuestScript110_9 harryDialogue_09 LOCAL_CHAT_PERSIST npc QuestScript110_10 harryDialogue_10 ENABLE_CLOSE_BOOK ARROWS_ON 1.364477 -0.89 0 1.664477 -0.64 90 WAIT_EVENT "exitStickerBook" ARROWS_OFF TOON_HEAD npc 0 0 0 HIDE_BOOK HIDE bookOpenButton LOCAL_CHAT_CONFIRM npc QuestScript110_11 1 harryDialogue_11 SET_MUSIC_VOLUME 0.7 activityMusic 1.0 0.4 # Lots of cleanup UPON_TIMEOUT DEBUG "testing upon death" UPON_TIMEOUT OBSCURE_BOOK 0 UPON_TIMEOUT ARROWS_OFF UPON_TIMEOUT HIDE_BOOK UPON_TIMEOUT COLOR_SCALE bookOpenButton 1 1 1 1 UPON_TIMEOUT TOON_HEAD npc 0 0 0 UPON_TIMEOUT SHOW bookOpenButton FINISH_QUEST_MOVIE # TUTORIAL FLIPPY ID tutorial_blocker LOAD_DIALOGUE blockerDialogue_01 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker01.ogg" LOAD_DIALOGUE blockerDialogue_02 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker02.ogg" LOAD_DIALOGUE blockerDialogue_03 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker03.ogg" LOAD_DIALOGUE blockerDialogue_04 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker04.ogg" LOAD_DIALOGUE blockerDialogue_05a "phase_3.5/audio/dial/CC_flippy_tutorial_blocker05.ogg" LOAD_DIALOGUE blockerDialogue_05b "phase_3.5/audio/dial/CC_flippy_tutorial_blocker06.ogg" LOAD_DIALOGUE blockerDialogue_06 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker07.ogg" LOAD_DIALOGUE blockerDialogue_07 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker08.ogg" LOAD_DIALOGUE blockerDialogue_08 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker09.ogg" HIDE localToon REPARENTTO camera npc FUNCTION npc "stopLookAround" #POS camera 0.0 6.0 4.0 #HPR camera 180.0 0.0 0.0 LERP_POSHPR camera 0.0 6.0 4.0 180.0 0.0 0.0 0.5 SET_MUSIC_VOLUME 0.4 music 0.5 0.8 LOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_1 blockerDialogue_01 WAIT 0.8 LOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_2 blockerDialogue_02 WAIT 0.8 #POS camera -5.0 -9.0 6.0 #HPR camera -25.0 -10.0 0.0 LERP_POSHPR camera -5.0 -9.0 6.0 -25.0 -10.0 0.0 0.5 POS localToon 203.8 18.64 -0.475 HPR localToon -90.0 0.0 0.0 SHOW localToon LOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_3 blockerDialogue_03 OBSCURE_CHAT 1 0 0 SHOW chatScButton WAIT 0.6 ARROWS_ON -1.3644 0.91 180 -1.5644 0.74 -90 LOCAL_CHAT_PERSIST npc QuestScriptTutorialBlocker_4 blockerDialogue_04 WAIT_EVENT "enterSpeedChat" ARROWS_OFF BLACK_CAT_LISTEN 1 WAIT_EVENT "SCChatEvent" BLACK_CAT_LISTEN 0 WAIT 0.5 CLEAR_CHAT localToon REPARENTTO camera localToon LOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_5 "CFSpeech" blockerDialogue_05a blockerDialogue_05b LOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_6 "CFSpeech" blockerDialogue_06 OBSCURE_CHAT 0 0 0 SHOW chatNormalButton WAIT 0.6 LOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_7 "CFSpeech" blockerDialogue_07 LOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_8 1 "CFSpeech" blockerDialogue_08 SET_MUSIC_VOLUME 0.8 music 1.0 0.4 LOOP_ANIM npc "walk" LERP_HPR npc 270 0 0 0.5 WAIT 0.5 LOOP_ANIM npc "run" LERP_POS npc 217.4 18.81 -0.475 0.75 LERP_HPR npc 240 0 0 0.75 WAIT 0.75 LERP_POS npc 222.4 15.0 -0.475 0.35 LERP_HPR npc 180 0 0 0.35 WAIT 0.35 LERP_POS npc 222.4 5.0 -0.475 0.75 WAIT 0.75 REPARENTTO npc hidden FREE_LOCALTOON UPON_TIMEOUT ARROWS_OFF UPON_TIMEOUT OBSCURE_CHAT 0 0 0 UPON_TIMEOUT REPARENTTO camera localToon FINISH_QUEST_MOVIE ID quest_incomplete_120 CHAT_CONFIRM npc QuestScript120_1 # ANIM CHAT_CONFIRM npc QuestScript120_2 1 FINISH_QUEST_MOVIE ID quest_assign_121 CHAT_CONFIRM npc QuestScript121_1 1 FINISH_QUEST_MOVIE ID quest_assign_130 CHAT_CONFIRM npc QuestScript130_1 1 FINISH_QUEST_MOVIE ID quest_assign_131 CHAT_CONFIRM npc QuestScript131_1 1 FINISH_QUEST_MOVIE ID quest_assign_140 CHAT_CONFIRM npc QuestScript140_1 1 FINISH_QUEST_MOVIE ID quest_assign_141 CHAT_CONFIRM npc QuestScript141_1 1 FINISH_QUEST_MOVIE # TUTORIAL COG ID quest_incomplete_145 CHAT_CONFIRM npc QuestScript145_1 1 LOAD frame "phase_4/models/gui/tfa_images" "FrameBlankA" LOAD tunnel "phase_4/models/gui/tfa_images" "tunnelSignA" POSHPRSCALE tunnel 0 0 0 0 0 0 0.8 0.8 0.8 REPARENTTO tunnel frame POSHPRSCALE frame 0 0 0 0 0 0 0.1 0.1 0.1 REPARENTTO frame aspect2d LERP_SCALE frame 1.0 1.0 1.0 1.0 WAIT 3.0 LERP_SCALE frame 0.1 0.1 0.1 0.5 WAIT 0.5 REPARENTTO frame hidden CHAT_CONFIRM npc QuestScript145_2 1 UPON_TIMEOUT FUNCTION frame "removeNode" FINISH_QUEST_MOVIE # TUTORIAL FRIENDS ID quest_incomplete_150 CHAT_CONFIRM npc QuestScript150_1 ARROWS_ON 1.65 0.51 -120 1.65 0.51 -120 SHOW_FRIENDS_LIST CHAT_CONFIRM npc QuestScript150_2 ARROWS_OFF HIDE_FRIENDS_LIST CHAT_CONFIRM npc QuestScript150_3 HIDE bFriendsList CHAT_CONFIRM npc QuestScript150_4 1 UPON_TIMEOUT HIDE_FRIENDS_LIST UPON_TIMEOUT ARROWS_OFF FINISH_QUEST_MOVIE # First Task: Assign Visit to Jester Chester ID quest_assign_600 PLAY_ANIM npc "wave" 1 CHAT npc QuestScript600_1 LOAD_IMAGE logo "phase_3/maps/toontown-logo.png" REPARENTTO logo aspect2d POSHPRSCALE logo -0.4 7 0 0 0 0 0 0 0 LERP_SCALE logo 0.4 0.2 0.2 0.5 WAIT 2.5 LOOP_ANIM npc "neutral" LERP_SCALE logo 0 0 0 0.5 WAIT 0.5 FUNCTION logo "destroy" CLEAR_CHAT npc CHAT_CONFIRM npc QuestScript600_2 CHAT_CONFIRM npc QuestScript600_3 CHAT_CONFIRM npc QuestScript600_4 CHAT_CONFIRM npc QuestScript600_5 PLAY_ANIM npc "wave" 1 CHAT_CONFIRM npc QuestScript600_6 LOOP_ANIM npc "neutral" FINISH_QUEST_MOVIE # Loopys Balls ID quest_assign_10301 POSE_ANIM npc "wave" 20 CHAT_CONFIRM npc QuestScript10301_1 POSE_ANIM npc "neutral" 1 CHAT_CONFIRM npc QuestScript10301_2 POSE_ANIM npc "shrug" 25 CHAT_CONFIRM npc QuestScript10301_3 POSE_ANIM npc "think" 40 CHAT_CONFIRM npc QuestScript10301_4 POSE_ANIM npc "conked" 20 CHAT_CONFIRM npc QuestScript10301_5 POSE_ANIM npc "shrug" 25 CHAT_CONFIRM npc QuestScript10301_6 POSE_ANIM npc "think" 40 CHAT_CONFIRM npc QuestScript10301_7 POSE_ANIM npc "shrug" 25 CHAT_CONFIRM npc QuestScript10301_8 LOOP_ANIM npc "neutral" FINISH_QUEST_MOVIE # Loopys Balls ID quest_incomplete_10301 POSE_ANIM npc "wave" 20 CHAT_CONFIRM npc QuestScript10301_1 POSE_ANIM npc "neutral" 1 CHAT_CONFIRM npc QuestScript10301_2 POSE_ANIM npc "shrug" 25 CHAT_CONFIRM npc QuestScript10301_3 POSE_ANIM npc "think" 40 CHAT_CONFIRM npc QuestScript10301_4 POSE_ANIM npc "conked" 20 CHAT_CONFIRM npc QuestScript10301_5 POSE_ANIM npc "shrug" 25 CHAT_CONFIRM npc QuestScript10301_6 POSE_ANIM npc "think" 40 CHAT_CONFIRM npc QuestScript10301_7 POSE_ANIM npc "shrug" 25 CHAT_CONFIRM npc QuestScript10301_8 LOOP_ANIM npc "neutral" FINISH_QUEST_MOVIE '''
script = '\nID reward_100\nSHOW laffMeter\nLERP_POS laffMeter 0 0 0 1\nLERP_SCALE laffMeter 0.2 0.2 0.2 1\nWAIT 1.5\nADD_LAFFMETER 1\nWAIT 1\nLERP_POS laffMeter -1.18 0 -0.87 1\nLERP_SCALE laffMeter 0.075 0.075 0.075 1\nWAIT 1\nFINISH_QUEST_MOVIE\n\n# TUTORIAL\n\nID tutorial_mickey\nLOAD_SFX soundRun "phase_3.5/audio/sfx/AV_footstep_runloop.ogg"\nLOAD_CC_DIALOGUE mickeyTutorialDialogue_1 "phase_3/audio/dial/CC_%s_tutorial02.ogg"\nLOAD_CC_DIALOGUE mickeyTutorialDialogue_2 "phase_3.5/audio/dial/CC_tom_tutorial_%s01.ogg"\nLOAD_CC_DIALOGUE mickeyTutorialDialogue_3a "phase_3/audio/dial/CC_%s_tutorial03.ogg"\nLOAD_CC_DIALOGUE mickeyTutorialDialogue_3b "phase_3/audio/dial/CC_%s_tutorial05.ogg"\nLOAD_DIALOGUE mickeyTutorialDialogue_4 "phase_3.5/audio/dial/CC_tom_tutorial_mickey02.ogg"\nLOCK_LOCALTOON\nREPARENTTO camera render\nPOSHPRSCALE camera 11 7 3 52 0 0 1 1 1\nLOAD_CLASSIC_CHAR classicChar\nREPARENTTO classicChar render\nPOS classicChar 0 0 0\nHPR classicChar 0 0 0\nPOS localToon 0 0 0\nHPR localToon 0 0 0\nWAIT 2\nPLAY_SFX soundRun 1\nLOOP_ANIM classicChar "run"\nLOOP_ANIM localToon "run"\nLERP_POS localToon -1.8 14.4 0 2\nLERP_POS classicChar 0 17 0 2\nWAIT 2\n#LERP_HPR localToon -110 0 0 0.5\nLERP_HPR localToon -70 0 0 0.5\nLERP_HPR classicChar -120 0 0 0.5\nWAIT 0.5\nSTOP_SFX soundRun\nLOOP_ANIM localToon "neutral"\nPLAY_ANIM classicChar "left-point-start" 1\nWAIT 1.63\nLOOP_ANIM classicChar "left-point"\nCC_CHAT_CONFIRM classicChar "QuestScriptTutorial%s_1" mickeyTutorialDialogue_1\nPLAY_ANIM classicChar "left-point-start" -1.5\nWAIT 1.0867\nLOOP_ANIM classicChar "neutral"\nCC_CHAT_TO_CONFIRM npc classicChar "QuestScriptTutorial%s_2" "CFSpeech" mickeyTutorialDialogue_2\nPLAY_ANIM classicChar "right-point-start" 1\nWAIT 1.0867\nLOOP_ANIM classicChar "right-point"\nCC_CHAT_CONFIRM classicChar "QuestScriptTutorial%s_3" mickeyTutorialDialogue_3a mickeyTutorialDialogue_3b\nPLAY_SFX soundRun 1\nLOOP_ANIM classicChar "run"\nLERP_HPR classicChar -180 0 0 0.5\nWAIT 0.5\nLERP_POS classicChar 0 0 0 2\nWAIT 2\nSTOP_SFX soundRun\nREPARENTTO classicChar hidden\nUNLOAD_CHAR classicChar\n#CHAT npc QuestScriptTutorialMickey_4 mickeyTutorialDialogue_4\nREPARENTTO camera localToon\nPOS localToon 1.6 9.8 0\nHPR localToon 14 0 0\nFREE_LOCALTOON\nLOCAL_CHAT_PERSIST npc QuestScriptTutorialMickey_4 mickeyTutorialDialogue_4\n\nID quest_assign_101\nCLEAR_CHAT npc\nLOAD squirt1 "phase_3.5/models/gui/tutorial_gui" "squirt1"\nLOAD squirt2 "phase_3.5/models/gui/tutorial_gui" "squirt2"\nLOAD toonBuilding "phase_3.5/models/gui/tutorial_gui" "toon_buildings"\nLOAD cogBuilding "phase_3.5/models/gui/tutorial_gui" "suit_buildings"\nLOAD cogs "phase_3.5/models/gui/tutorial_gui" "suits"\nLOAD tart "phase_3.5/models/props/tart"\nLOAD flower "phase_3.5/models/props/squirting-flower"\nLOAD_DIALOGUE tomDialogue_01 "phase_3.5/audio/dial/CC_tom_tutorial_questscript01.ogg"\nLOAD_DIALOGUE tomDialogue_02 "phase_3.5/audio/dial/CC_tom_tutorial_questscript03.ogg"\nLOAD_DIALOGUE tomDialogue_03 "phase_3.5/audio/dial/CC_tom_tutorial_questscript04.ogg"\nLOAD_DIALOGUE tomDialogue_04 "phase_3.5/audio/dial/CC_tom_tutorial_questscript05.ogg"\nLOAD_DIALOGUE tomDialogue_05 "phase_3.5/audio/dial/CC_tom_tutorial_questscript06.ogg"\nLOAD_DIALOGUE tomDialogue_06 "phase_3.5/audio/dial/CC_tom_tutorial_questscript07.ogg"\nLOAD_DIALOGUE tomDialogue_07 "phase_3.5/audio/dial/CC_tom_tutorial_questscript08.ogg"\nLOAD_DIALOGUE tomDialogue_08 "phase_3.5/audio/dial/CC_tom_tutorial_questscript09.ogg"\nLOAD_DIALOGUE tomDialogue_09 "phase_3.5/audio/dial/CC_tom_tutorial_questscript10.ogg"\nLOAD_DIALOGUE tomDialogue_10 "phase_3.5/audio/dial/CC_tom_tutorial_questscript11.ogg"\nLOAD_DIALOGUE tomDialogue_11 "phase_3.5/audio/dial/CC_tom_tutorial_questscript12.ogg"\nLOAD_DIALOGUE tomDialogue_12 "phase_3.5/audio/dial/CC_tom_tutorial_questscript13.ogg"\nLOAD_DIALOGUE tomDialogue_13 "phase_3.5/audio/dial/CC_tom_tutorial_questscript14.ogg"\nLOAD_DIALOGUE tomDialogue_14 "phase_3.5/audio/dial/CC_tom_tutorial_questscript16.ogg"\nPOSHPRSCALE cogs -1.05 7 0 0 0 0 1 1 1\nPOSHPRSCALE toonBuilding -1.05 7 0 0 0 0 1 1 1\nPOSHPRSCALE cogBuilding -1.05 7 0 0 0 0 1 1 1\nPOSHPRSCALE squirt1 -1.05 7 0 0 0 0 1 1 1\nPOSHPRSCALE squirt2 -1.05 7 0 0 0 0 1 1 1\nREPARENTTO camera npc\nPOS camera -2.2 5.2 3.3\nHPR camera 215 5 0\nWRTREPARENTTO camera localToon\nPLAY_ANIM npc "right-hand-start" 1\nWAIT 1\nREPARENTTO cogs aspect2d\nLERP_SCALE cogs 1 1 1 0.5\nWAIT 1.0833\nLOOP_ANIM npc "right-hand" 1\nFUNCTION npc "angryEyes"\nFUNCTION npc "blinkEyes"\nLOCAL_CHAT_CONFIRM npc QuestScript101_1 "CFSpeech" tomDialogue_01\nLOCAL_CHAT_CONFIRM npc QuestScript101_2 "CFSpeech" tomDialogue_02\nREPARENTTO cogs hidden\nREPARENTTO toonBuilding camera\nLOCAL_CHAT_CONFIRM npc QuestScript101_3 "CFSpeech" tomDialogue_03\nREPARENTTO toonBuilding hidden\nREPARENTTO cogBuilding camera\nFUNCTION npc "sadEyes"\nFUNCTION npc "blinkEyes"\nLOCAL_CHAT_CONFIRM npc QuestScript101_4 "CFSpeech" tomDialogue_04\nREPARENTTO cogBuilding hidden\nREPARENTTO squirt1 camera\nFUNCTION npc "normalEyes"\nFUNCTION npc "blinkEyes"\nLOCAL_CHAT_CONFIRM npc QuestScript101_5 "CFSpeech" tomDialogue_05\nREPARENTTO squirt1 hidden\nREPARENTTO squirt2 camera\nLOCAL_CHAT_CONFIRM npc QuestScript101_6 "CFSpeech" tomDialogue_06\nPLAY_ANIM npc \'right-hand-start\' -1.8\nLERP_SCALE squirt2 1 1 0.01 0.5\nWAIT 0.5\nREPARENTTO squirt2 hidden\nWAIT 0.6574\nLOOP_ANIM npc \'neutral\' 1\nLOCAL_CHAT_CONFIRM npc QuestScript101_7 "CFSpeech" tomDialogue_07\n# Make it look like the client has no inventory. Since the toon.dc\n# specifies that the user really does have 1 of each item, we will\n# just put on a show for the client of not having any items then\n# handing them out.\nSET_INVENTORY 4 0 0\nSET_INVENTORY 5 0 0\nREPARENTTO inventory camera\nSHOW inventory\nSET_INVENTORY_DETAIL -1\nPOSHPRSCALE inventory -0.77 7.42 1.11 0 0 0 0.01 0.01 0.01\nSET_INVENTORY_YPOS 4 0 -0.1\nSET_INVENTORY_YPOS 5 0 -0.1\nLERP_SCALE inventory 3 0.01 3 1\nWAIT 1\nREPARENTTO flower npc "**/1000/**/def_joint_right_hold"\nPOSHPRSCALE flower 0.10 -0.14 0.20 180.00 287.10 168.69 0.70 0.70 0.70\nPLAY_ANIM npc \'right-hand-start\' 1.8\nWAIT 1.1574\nLOOP_ANIM npc \'right-hand\' 1.1\nWAIT 0.8\nWRTREPARENTTO flower camera\nLERP_POSHPRSCALE flower -1.75 4.77 0.00 30.00 180.00 16.39 0.75 0.75 0.75 0.589\nWAIT 1.094\nLERP_POSHPRSCALE flower -1.76 7.42 -0.63 179.96 -89.9 -153.43 0.12 0.12 0.12 1\nPLAY_ANIM npc \'right-hand-start\' -1.5\nWAIT 1\nADD_INVENTORY 5 0 1\nPOSHPRSCALE inventory -0.77 7.42 1.11 0 0 0 3 0.01 3\nREPARENTTO flower hidden\nREPARENTTO tart npc "**/1000/**/def_joint_right_hold"\nPOSHPRSCALE tart 0.19 0.02 0.00 0.00 0.00 349.38 0.34 0.34 0.34\nPLAY_ANIM npc \'right-hand-start\' 1.8\nWAIT 1.1574\nLOOP_ANIM npc \'right-hand\' 1.1\nWAIT 0.8\nWRTREPARENTTO tart camera\nLERP_POSHPRSCALE tart -1.37 4.56 0 329.53 39.81 346.76 0.6 0.6 0.6 0.589\nWAIT 1.094\nLERP_POSHPRSCALE tart -1.66 7.42 -0.36 0 30 30 0.12 0.12 0.12 1.0\nPLAY_ANIM npc \'right-hand-start\' -1.5\nWAIT 1\nADD_INVENTORY 4 0 1\nPOSHPRSCALE inventory -0.77 7.42 1.11 0 0 0 3 0.01 3\nREPARENTTO tart hidden\n#PLAY_ANIM npc \'neutral\' 1\n#WAIT 2.0833\nPLAY_ANIM npc \'right-hand-start\' 1\nWAIT 1.0\nHIDE inventory\nREPARENTTO inventory hidden\nSET_INVENTORY_YPOS 4 0 0\nSET_INVENTORY_YPOS 5 0 0\nSET_INVENTORY_DETAIL 0\nPOSHPRSCALE inventory 0 0 0 0 0 0 1 1 1\nOBSCURE_LAFFMETER 0\nSHOW laffMeter\nPOS laffMeter 0 0 0\nSCALE laffMeter 0.075 0.075 0.075\nLERP_POS laffMeter 1.7 0 0.87 1\nLERP_SCALE laffMeter 0.2 0.2 0.2 0.6\nWAIT 1.0833\nLOOP_ANIM npc "right-hand"\nLOCAL_CHAT_CONFIRM npc QuestScript101_8 "CFSpeech" tomDialogue_08\nLOCAL_CHAT_CONFIRM npc QuestScript101_9 "CFSpeech" tomDialogue_09\nFUNCTION npc "sadEyes"\nFUNCTION npc "blinkEyes"\nLAFFMETER 15 15\nWAIT 0.1\nLAFFMETER 14 15\nWAIT 0.1\nLAFFMETER 13 15\nWAIT 0.1\nLAFFMETER 12 15\nWAIT 0.1\nLAFFMETER 11 15\nWAIT 0.1\nLAFFMETER 10 15\nWAIT 0.1\nLAFFMETER 9 15\nWAIT 0.1\nLAFFMETER 8 15\nWAIT 0.1\nLAFFMETER 7 15\nWAIT 0.1\nLAFFMETER 6 15\nWAIT 0.1\nLAFFMETER 5 15\nWAIT 0.1\nLAFFMETER 4 15\nWAIT 0.1\nLAFFMETER 3 15\nWAIT 0.1\nLAFFMETER 2 15\nWAIT 0.1\nLAFFMETER 1 15\nWAIT 0.1\nLAFFMETER 0 15\nLOCAL_CHAT_CONFIRM npc QuestScript101_10 "CFSpeech" tomDialogue_10\nFUNCTION npc "normalEyes"\nFUNCTION npc "blinkEyes"\nLAFFMETER 15 15\nWAIT 0.5\nLERP_POS laffMeter 0.15 0.15 0.15 1\nLERP_SCALE laffMeter 0.085 0.085 0.085 0.6\nPLAY_ANIM npc "right-hand-start" -2\nWAIT 1.0625\nLOOP_ANIM npc "neutral"\nWAIT 0.5\nLERP_HPR npc -50 0 0 0.5\nFUNCTION npc "surpriseEyes"\nFUNCTION npc "showSurpriseMuzzle"\nPLAY_ANIM npc "right-point-start" 1.5\nWAIT 0.6944\nLOOP_ANIM npc "right-point"\nLOCAL_CHAT_CONFIRM npc QuestScript101_11 "CFSpeech" tomDialogue_11\nLOCAL_CHAT_CONFIRM npc QuestScript101_12 "CFSpeech" tomDialogue_12\nPLAY_ANIM npc "right-point-start" -1\nLERP_HPR npc -0.068 0 0 0.75\nWAIT 1.0417\nFUNCTION npc "angryEyes"\nFUNCTION npc "blinkEyes"\nFUNCTION npc "hideSurpriseMuzzle"\nLOOP_ANIM npc "neutral"\nFUNCTION localToon "questPage.showQuestsOnscreenTutorial"\nLOCAL_CHAT_CONFIRM npc QuestScript101_13 "CFSpeech" tomDialogue_13\nFUNCTION localToon "questPage.hideQuestsOnscreenTutorial"\nLOCAL_CHAT_CONFIRM npc QuestScript101_14 1 "CFSpeech" tomDialogue_14\nFUNCTION npc "normalEyes"\nFUNCTION npc "blinkEyes"\n# Cleanup\nUPON_TIMEOUT FUNCTION tart "removeNode"\nUPON_TIMEOUT FUNCTION flower "removeNode"\nUPON_TIMEOUT FUNCTION cogs "removeNode"\nUPON_TIMEOUT FUNCTION toonBuilding "removeNode"\nUPON_TIMEOUT FUNCTION cogBuilding "removeNode"\nUPON_TIMEOUT FUNCTION squirt1 "removeNode"\nUPON_TIMEOUT FUNCTION squirt2 "removeNode"\nUPON_TIMEOUT LOOP_ANIM npc "neutral"\nUPON_TIMEOUT HIDE inventory\nUPON_TIMEOUT SET_INVENTORY_DETAIL 0\nUPON_TIMEOUT SHOW laffMeter\nUPON_TIMEOUT POS laffMeter 0.15 0.15 0.15\nUPON_TIMEOUT SCALE laffMeter 0.085 0.085 0.085\nUPON_TIMEOUT POSHPRSCALE inventory 0 0 0 0 0 0 1 1 1\nPOS localToon 0.776 14.6 0\nHPR localToon 47.5 0 0\nFINISH_QUEST_MOVIE\n\n# TUTORIAL HQ HARRY\n\nID quest_incomplete_110\nDEBUG "quest assign 110"\nLOAD_DIALOGUE harryDialogue_01 "phase_3.5/audio/dial/CC_harry_tutorial_questscript01.ogg"\nLOAD_DIALOGUE harryDialogue_02 "phase_3.5/audio/dial/CC_harry_tutorial_questscript02.ogg"\nLOAD_DIALOGUE harryDialogue_03 "phase_3.5/audio/dial/CC_harry_tutorial_questscript03.ogg"\nLOAD_DIALOGUE harryDialogue_04 "phase_3.5/audio/dial/CC_harry_tutorial_questscript04.ogg"\nLOAD_DIALOGUE harryDialogue_05 "phase_3.5/audio/dial/CC_harry_tutorial_questscript05.ogg"\nLOAD_DIALOGUE harryDialogue_06 "phase_3.5/audio/dial/CC_harry_tutorial_questscript06.ogg"\nLOAD_DIALOGUE harryDialogue_07 "phase_3.5/audio/dial/CC_harry_tutorial_questscript07.ogg"\nLOAD_DIALOGUE harryDialogue_08 "phase_3.5/audio/dial/CC_harry_tutorial_questscript08.ogg"\nLOAD_DIALOGUE harryDialogue_09 "phase_3.5/audio/dial/CC_harry_tutorial_questscript09.ogg"\nLOAD_DIALOGUE harryDialogue_10 "phase_3.5/audio/dial/CC_harry_tutorial_questscript10.ogg"\nLOAD_DIALOGUE harryDialogue_11 "phase_3.5/audio/dial/CC_harry_tutorial_questscript11.ogg"\nSET_MUSIC_VOLUME 0.4 activityMusic 0.5 0.7\nLOCAL_CHAT_CONFIRM npc QuestScript110_1 harryDialogue_01\nOBSCURE_BOOK 0\nSHOW bookOpenButton\nLOCAL_CHAT_CONFIRM npc QuestScript110_2 harryDialogue_02\n# ARROWS_ON 0.92 -0.89 0 1.22 -0.64 90\nARROWS_ON 1.364477 -0.89 0 1.664477 -0.64 90\nLOCAL_CHAT_PERSIST npc QuestScript110_3 harryDialogue_03\nWAIT_EVENT "enterStickerBook"\nARROWS_OFF\nSHOW_BOOK\nHIDE bookPrevArrow\nHIDE bookNextArrow\nCLEAR_CHAT npc\nWAIT 0.5\nTOON_HEAD npc -0.2 -0.45 1\nLOCAL_CHAT_CONFIRM npc QuestScript110_4 harryDialogue_04\nARROWS_ON 0.85 -0.75 -90 0.85 -0.75 -90\nSHOW bookNextArrow\nLOCAL_CHAT_PERSIST npc QuestScript110_5 harryDialogue_05\nWAIT_EVENT "stickerBookPageChange-4"\nHIDE bookPrevArrow\nHIDE bookNextArrow\nARROWS_OFF\nCLEAR_CHAT npc\nWAIT 0.5\nLOCAL_CHAT_CONFIRM npc QuestScript110_6 harryDialogue_06\nARROWS_ON 0.85 -0.75 -90 0.85 -0.75 -90\nSHOW bookNextArrow\nLOCAL_CHAT_PERSIST npc QuestScript110_7 harryDialogue_07\nWAIT_EVENT "stickerBookPageChange-5"\nHIDE bookNextArrow\nHIDE bookPrevArrow\nARROWS_OFF\nCLEAR_CHAT npc\nLOCAL_CHAT_CONFIRM npc QuestScript110_8 harryDialogue_08\nLOCAL_CHAT_CONFIRM npc QuestScript110_9 harryDialogue_09\nLOCAL_CHAT_PERSIST npc QuestScript110_10 harryDialogue_10\nENABLE_CLOSE_BOOK\nARROWS_ON 1.364477 -0.89 0 1.664477 -0.64 90\nWAIT_EVENT "exitStickerBook"\nARROWS_OFF\nTOON_HEAD npc 0 0 0\nHIDE_BOOK\nHIDE bookOpenButton\nLOCAL_CHAT_CONFIRM npc QuestScript110_11 1 harryDialogue_11\nSET_MUSIC_VOLUME 0.7 activityMusic 1.0 0.4\n# Lots of cleanup\nUPON_TIMEOUT DEBUG "testing upon death"\nUPON_TIMEOUT OBSCURE_BOOK 0\nUPON_TIMEOUT ARROWS_OFF\nUPON_TIMEOUT HIDE_BOOK\nUPON_TIMEOUT COLOR_SCALE bookOpenButton 1 1 1 1\nUPON_TIMEOUT TOON_HEAD npc 0 0 0\nUPON_TIMEOUT SHOW bookOpenButton\nFINISH_QUEST_MOVIE\n\n# TUTORIAL FLIPPY\n\nID tutorial_blocker\nLOAD_DIALOGUE blockerDialogue_01 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker01.ogg"\nLOAD_DIALOGUE blockerDialogue_02 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker02.ogg"\nLOAD_DIALOGUE blockerDialogue_03 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker03.ogg"\nLOAD_DIALOGUE blockerDialogue_04 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker04.ogg"\nLOAD_DIALOGUE blockerDialogue_05a "phase_3.5/audio/dial/CC_flippy_tutorial_blocker05.ogg"\nLOAD_DIALOGUE blockerDialogue_05b "phase_3.5/audio/dial/CC_flippy_tutorial_blocker06.ogg"\nLOAD_DIALOGUE blockerDialogue_06 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker07.ogg"\nLOAD_DIALOGUE blockerDialogue_07 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker08.ogg"\nLOAD_DIALOGUE blockerDialogue_08 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker09.ogg"\nHIDE localToon\nREPARENTTO camera npc\nFUNCTION npc "stopLookAround"\n#POS camera 0.0 6.0 4.0\n#HPR camera 180.0 0.0 0.0\nLERP_POSHPR camera 0.0 6.0 4.0 180.0 0.0 0.0 0.5\nSET_MUSIC_VOLUME 0.4 music 0.5 0.8\nLOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_1 blockerDialogue_01\nWAIT 0.8\nLOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_2 blockerDialogue_02\nWAIT 0.8\n#POS camera -5.0 -9.0 6.0\n#HPR camera -25.0 -10.0 0.0\nLERP_POSHPR camera -5.0 -9.0 6.0 -25.0 -10.0 0.0 0.5\nPOS localToon 203.8 18.64 -0.475\nHPR localToon -90.0 0.0 0.0\nSHOW localToon\nLOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_3 blockerDialogue_03\nOBSCURE_CHAT 1 0 0\nSHOW chatScButton\nWAIT 0.6\nARROWS_ON -1.3644 0.91 180 -1.5644 0.74 -90\nLOCAL_CHAT_PERSIST npc QuestScriptTutorialBlocker_4 blockerDialogue_04\nWAIT_EVENT "enterSpeedChat"\nARROWS_OFF\nBLACK_CAT_LISTEN 1\nWAIT_EVENT "SCChatEvent"\nBLACK_CAT_LISTEN 0\nWAIT 0.5\nCLEAR_CHAT localToon\nREPARENTTO camera localToon\nLOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_5 "CFSpeech" blockerDialogue_05a blockerDialogue_05b\nLOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_6 "CFSpeech" blockerDialogue_06\nOBSCURE_CHAT 0 0 0\nSHOW chatNormalButton\nWAIT 0.6\nLOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_7 "CFSpeech" blockerDialogue_07\nLOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_8 1 "CFSpeech" blockerDialogue_08\nSET_MUSIC_VOLUME 0.8 music 1.0 0.4\nLOOP_ANIM npc "walk"\nLERP_HPR npc 270 0 0 0.5\nWAIT 0.5\nLOOP_ANIM npc "run"\nLERP_POS npc 217.4 18.81 -0.475 0.75\nLERP_HPR npc 240 0 0 0.75\nWAIT 0.75\nLERP_POS npc 222.4 15.0 -0.475 0.35\nLERP_HPR npc 180 0 0 0.35\nWAIT 0.35\nLERP_POS npc 222.4 5.0 -0.475 0.75\nWAIT 0.75\nREPARENTTO npc hidden\nFREE_LOCALTOON\nUPON_TIMEOUT ARROWS_OFF\nUPON_TIMEOUT OBSCURE_CHAT 0 0 0\nUPON_TIMEOUT REPARENTTO camera localToon\nFINISH_QUEST_MOVIE\n\nID quest_incomplete_120\nCHAT_CONFIRM npc QuestScript120_1\n# ANIM\nCHAT_CONFIRM npc QuestScript120_2 1\nFINISH_QUEST_MOVIE\n\nID quest_assign_121\nCHAT_CONFIRM npc QuestScript121_1 1\nFINISH_QUEST_MOVIE\n\nID quest_assign_130\nCHAT_CONFIRM npc QuestScript130_1 1\nFINISH_QUEST_MOVIE\n\nID quest_assign_131\nCHAT_CONFIRM npc QuestScript131_1 1\nFINISH_QUEST_MOVIE\n\nID quest_assign_140\nCHAT_CONFIRM npc QuestScript140_1 1\nFINISH_QUEST_MOVIE\n\nID quest_assign_141\nCHAT_CONFIRM npc QuestScript141_1 1\nFINISH_QUEST_MOVIE\n\n# TUTORIAL COG\n\nID quest_incomplete_145\nCHAT_CONFIRM npc QuestScript145_1 1\nLOAD frame "phase_4/models/gui/tfa_images" "FrameBlankA"\nLOAD tunnel "phase_4/models/gui/tfa_images" "tunnelSignA"\nPOSHPRSCALE tunnel 0 0 0 0 0 0 0.8 0.8 0.8\nREPARENTTO tunnel frame\nPOSHPRSCALE frame 0 0 0 0 0 0 0.1 0.1 0.1\nREPARENTTO frame aspect2d\nLERP_SCALE frame 1.0 1.0 1.0 1.0\nWAIT 3.0\nLERP_SCALE frame 0.1 0.1 0.1 0.5\nWAIT 0.5\nREPARENTTO frame hidden\nCHAT_CONFIRM npc QuestScript145_2 1\nUPON_TIMEOUT FUNCTION frame "removeNode"\nFINISH_QUEST_MOVIE\n\n# TUTORIAL FRIENDS\n\nID quest_incomplete_150\nCHAT_CONFIRM npc QuestScript150_1\nARROWS_ON 1.65 0.51 -120 1.65 0.51 -120\nSHOW_FRIENDS_LIST\nCHAT_CONFIRM npc QuestScript150_2\nARROWS_OFF\nHIDE_FRIENDS_LIST\nCHAT_CONFIRM npc QuestScript150_3\nHIDE bFriendsList\nCHAT_CONFIRM npc QuestScript150_4 1\nUPON_TIMEOUT HIDE_FRIENDS_LIST\nUPON_TIMEOUT ARROWS_OFF\nFINISH_QUEST_MOVIE\n\n# First Task: Assign Visit to Jester Chester\nID quest_assign_600\nPLAY_ANIM npc "wave" 1\nCHAT npc QuestScript600_1\nLOAD_IMAGE logo "phase_3/maps/toontown-logo.png"\nREPARENTTO logo aspect2d\nPOSHPRSCALE logo -0.4 7 0 0 0 0 0 0 0\nLERP_SCALE logo 0.4 0.2 0.2 0.5\nWAIT 2.5\nLOOP_ANIM npc "neutral"\nLERP_SCALE logo 0 0 0 0.5\nWAIT 0.5\nFUNCTION logo "destroy"\nCLEAR_CHAT npc\nCHAT_CONFIRM npc QuestScript600_2\nCHAT_CONFIRM npc QuestScript600_3\nCHAT_CONFIRM npc QuestScript600_4\nCHAT_CONFIRM npc QuestScript600_5\nPLAY_ANIM npc "wave" 1\nCHAT_CONFIRM npc QuestScript600_6\nLOOP_ANIM npc "neutral"\nFINISH_QUEST_MOVIE\n\n# Loopys Balls\nID quest_assign_10301\nPOSE_ANIM npc "wave" 20\nCHAT_CONFIRM npc QuestScript10301_1\nPOSE_ANIM npc "neutral" 1\nCHAT_CONFIRM npc QuestScript10301_2\nPOSE_ANIM npc "shrug" 25\nCHAT_CONFIRM npc QuestScript10301_3\nPOSE_ANIM npc "think" 40\nCHAT_CONFIRM npc QuestScript10301_4\nPOSE_ANIM npc "conked" 20\nCHAT_CONFIRM npc QuestScript10301_5\nPOSE_ANIM npc "shrug" 25\nCHAT_CONFIRM npc QuestScript10301_6\nPOSE_ANIM npc "think" 40\nCHAT_CONFIRM npc QuestScript10301_7\nPOSE_ANIM npc "shrug" 25\nCHAT_CONFIRM npc QuestScript10301_8\nLOOP_ANIM npc "neutral"\nFINISH_QUEST_MOVIE\n\n# Loopys Balls\nID quest_incomplete_10301\nPOSE_ANIM npc "wave" 20\nCHAT_CONFIRM npc QuestScript10301_1\nPOSE_ANIM npc "neutral" 1\nCHAT_CONFIRM npc QuestScript10301_2\nPOSE_ANIM npc "shrug" 25\nCHAT_CONFIRM npc QuestScript10301_3\nPOSE_ANIM npc "think" 40\nCHAT_CONFIRM npc QuestScript10301_4\nPOSE_ANIM npc "conked" 20\nCHAT_CONFIRM npc QuestScript10301_5\nPOSE_ANIM npc "shrug" 25\nCHAT_CONFIRM npc QuestScript10301_6\nPOSE_ANIM npc "think" 40\nCHAT_CONFIRM npc QuestScript10301_7\nPOSE_ANIM npc "shrug" 25\nCHAT_CONFIRM npc QuestScript10301_8\nLOOP_ANIM npc "neutral"\nFINISH_QUEST_MOVIE\n'
while True: valores = input().split() n = int(valores[0]) d = a = int(valores[1]) e = b = int(valores[2]) if n == 0 and a == 0 and b == 0: break while e != 0: d, e = e, d % e c = (a * b) // d a_l = len(range(a, n + 1, a)) b_l = len(range(b, n + 1, b)) c_l = len(range(c, n + 1, c)) print(a_l + b_l - c_l)
while True: valores = input().split() n = int(valores[0]) d = a = int(valores[1]) e = b = int(valores[2]) if n == 0 and a == 0 and (b == 0): break while e != 0: (d, e) = (e, d % e) c = a * b // d a_l = len(range(a, n + 1, a)) b_l = len(range(b, n + 1, b)) c_l = len(range(c, n + 1, c)) print(a_l + b_l - c_l)
def convert_to_string(idx_list, form_manager): w_list = [] for i in range(len(idx_list)): w_list.append(form_manager.get_idx_symbol(int(idx_list[i]))) return " ".join(w_list) def is_all_same(c1, c2, form_manager): all_same = False if len(c1) == len(c2): all_same = True for j in range(len(c1)): if c1[j] != c2[j]: all_same = False break return all_same def compute_accuracy(candidate_list, reference_list, form_manager): if len(candidate_list) != len(reference_list): print( "candidate list has length {}, reference list has length {}\n".format( len(candidate_list), len(reference_list) ) ) len_min = min(len(candidate_list), len(reference_list)) c = 0 for i in range(len_min): if is_all_same(candidate_list[i], reference_list[i], form_manager): c = c + 1 else: pass return c / float(len_min) def compute_tree_accuracy(candidate_list_, reference_list_, form_manager): candidate_list = [] for i in range(len(candidate_list_)): candidate_list.append(candidate_list_[i]) reference_list = [] for i in range(len(reference_list_)): reference_list.append(reference_list_[i]) return compute_accuracy(candidate_list, reference_list, form_manager)
def convert_to_string(idx_list, form_manager): w_list = [] for i in range(len(idx_list)): w_list.append(form_manager.get_idx_symbol(int(idx_list[i]))) return ' '.join(w_list) def is_all_same(c1, c2, form_manager): all_same = False if len(c1) == len(c2): all_same = True for j in range(len(c1)): if c1[j] != c2[j]: all_same = False break return all_same def compute_accuracy(candidate_list, reference_list, form_manager): if len(candidate_list) != len(reference_list): print('candidate list has length {}, reference list has length {}\n'.format(len(candidate_list), len(reference_list))) len_min = min(len(candidate_list), len(reference_list)) c = 0 for i in range(len_min): if is_all_same(candidate_list[i], reference_list[i], form_manager): c = c + 1 else: pass return c / float(len_min) def compute_tree_accuracy(candidate_list_, reference_list_, form_manager): candidate_list = [] for i in range(len(candidate_list_)): candidate_list.append(candidate_list_[i]) reference_list = [] for i in range(len(reference_list_)): reference_list.append(reference_list_[i]) return compute_accuracy(candidate_list, reference_list, form_manager)
def test_geoadd(judge_command): judge_command( 'GEOADD Sicily 13.361389 38.115556 "Palermo" 15.087269 37.502669 "Catania"', { "command": "GEOADD", "key": "Sicily", "longitude": "15.087269", "latitude": "37.502669", "member": '"Catania"', }, ) def test_georadiusbymember(judge_command): judge_command( "GEORADIUSBYMEMBER Sicily Agrigento 100 km", { "command": "GEORADIUSBYMEMBER", "key": "Sicily", "member": "Agrigento", "float": "100", "distunit": "km", }, ) def test_georadius(judge_command): judge_command( "GEORADIUS Sicily 15 37 200 km WITHDIST WITHCOORD ", { "command": "GEORADIUS", "key": "Sicily", "longitude": "15", "latitude": "37", "float": "200", "distunit": "km", "geochoice": "WITHCOORD", }, )
def test_geoadd(judge_command): judge_command('GEOADD Sicily 13.361389 38.115556 "Palermo" 15.087269 37.502669 "Catania"', {'command': 'GEOADD', 'key': 'Sicily', 'longitude': '15.087269', 'latitude': '37.502669', 'member': '"Catania"'}) def test_georadiusbymember(judge_command): judge_command('GEORADIUSBYMEMBER Sicily Agrigento 100 km', {'command': 'GEORADIUSBYMEMBER', 'key': 'Sicily', 'member': 'Agrigento', 'float': '100', 'distunit': 'km'}) def test_georadius(judge_command): judge_command('GEORADIUS Sicily 15 37 200 km WITHDIST WITHCOORD ', {'command': 'GEORADIUS', 'key': 'Sicily', 'longitude': '15', 'latitude': '37', 'float': '200', 'distunit': 'km', 'geochoice': 'WITHCOORD'})
# Copyright 2019 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'recipe_engine/cipd', 'recipe_engine/commit_position', 'recipe_engine/context', 'recipe_engine/file', 'recipe_engine/golang', 'recipe_engine/json', 'recipe_engine/nodejs', 'recipe_engine/path', 'recipe_engine/raw_io', 'recipe_engine/step', 'depot_tools/depot_tools', 'depot_tools/git', 'depot_tools/git_cl', ]
python_version_compatibility = 'PY2+3' deps = ['recipe_engine/cipd', 'recipe_engine/commit_position', 'recipe_engine/context', 'recipe_engine/file', 'recipe_engine/golang', 'recipe_engine/json', 'recipe_engine/nodejs', 'recipe_engine/path', 'recipe_engine/raw_io', 'recipe_engine/step', 'depot_tools/depot_tools', 'depot_tools/git', 'depot_tools/git_cl']
class Cup(object): def __init__(self, name): self.name = name self.price = 0 class MyClass: pass def myfunc(): pass if __name__ == '__main__': cup1 = Cup('aaa') cup2 = Cup('bbb') # get attribute of object print(getattr(cup1, 'name')) print(getattr(cup2, 'name')) try: name = getattr(cup1, 'country') except Exception as e: print('occured getattr except:' + str(e)) # check attribute print(hasattr(cup2, 'new_name')) print(getattr(cup2, 'new_name', 'default')) # set attribute setattr(cup2, 'new_name', 'default') print(hasattr(cup2, 'new_name'), end='\n\n') # access class attribute obj = MyClass() print(obj.__class__.__name__) print(myfunc.__name__)
class Cup(object): def __init__(self, name): self.name = name self.price = 0 class Myclass: pass def myfunc(): pass if __name__ == '__main__': cup1 = cup('aaa') cup2 = cup('bbb') print(getattr(cup1, 'name')) print(getattr(cup2, 'name')) try: name = getattr(cup1, 'country') except Exception as e: print('occured getattr except:' + str(e)) print(hasattr(cup2, 'new_name')) print(getattr(cup2, 'new_name', 'default')) setattr(cup2, 'new_name', 'default') print(hasattr(cup2, 'new_name'), end='\n\n') obj = my_class() print(obj.__class__.__name__) print(myfunc.__name__)
# set, himpunan: super_hero = {'superman','ironman','hulk','flash'} print(super_hero) print('1=====================') super_hero.add('gundala') super_hero.add('121') print(super_hero) print('2=====================') super_hero.add('hulk') print(super_hero) print(sorted(super_hero)) print('3=====================') ganjil = {1,3,5,7,9} genap = {2,4,6,8,10} prima = {2,3,5,7} print(ganjil.union(genap)) print(ganjil.intersection(prima))
super_hero = {'superman', 'ironman', 'hulk', 'flash'} print(super_hero) print('1=====================') super_hero.add('gundala') super_hero.add('121') print(super_hero) print('2=====================') super_hero.add('hulk') print(super_hero) print(sorted(super_hero)) print('3=====================') ganjil = {1, 3, 5, 7, 9} genap = {2, 4, 6, 8, 10} prima = {2, 3, 5, 7} print(ganjil.union(genap)) print(ganjil.intersection(prima))
# Python carefully avoids evaluating bools more than once in a variety of situations. # Eg: # In the statement # if a or b: # it doesn't simply compute (a or b) and then evaluate the result to decide whether to # jump. If a is true it jumps directly to the body of the if statement. # We can confirm that this behaviour is correct in python code. # A Bool that raises an exception if evaluated twice! class ExplodingBool(): def __init__(self, value): self.value = value self.booled = False def __bool__(self): assert not self.booled self.booled = True return self.value y = (ExplodingBool(False) and False and True and False) print(y) if (ExplodingBool(True) or False or True or False): pass assert ExplodingBool(True) or False while ExplodingBool(False) and False: pass # if ExplodingBool(False) and False and True and False: # pass
class Explodingbool: def __init__(self, value): self.value = value self.booled = False def __bool__(self): assert not self.booled self.booled = True return self.value y = exploding_bool(False) and False and True and False print(y) if exploding_bool(True) or False or True or False: pass assert exploding_bool(True) or False while exploding_bool(False) and False: pass
def firstZero(arr, low, high): if (high >= low): # Check if mid element is first 0 mid = low + int((high - low) / 2) if (( mid == 0 or arr[mid-1] == 1) and arr[mid] == 0): return mid # If mid element is not 0 if (arr[mid] == 1): return firstZero(arr, (mid + 1), high) # If mid element is 0, but not first 0 else: return firstZero(arr, low, (mid - 1)) return -1 # A wrapper over recursive # function firstZero() def countZeroes(arr, n): # Find index of first zero in given array first = firstZero(arr, 0, n - 1) # If 0 is not present at all, return 0 if (first == -1): return 0 return (n - first) # Driver Code arr = [1, 1, 1, 0, 0, 0, 0, 0] n = len(arr) print("Count of zeroes is", countZeroes(arr, n))
def first_zero(arr, low, high): if high >= low: mid = low + int((high - low) / 2) if (mid == 0 or arr[mid - 1] == 1) and arr[mid] == 0: return mid if arr[mid] == 1: return first_zero(arr, mid + 1, high) else: return first_zero(arr, low, mid - 1) return -1 def count_zeroes(arr, n): first = first_zero(arr, 0, n - 1) if first == -1: return 0 return n - first arr = [1, 1, 1, 0, 0, 0, 0, 0] n = len(arr) print('Count of zeroes is', count_zeroes(arr, n))
# augmented vertex class Vertex: def __init__(self, element, location): self.element = element self.location = location def getElement(self): return self.element def setElement(self, element): self.element = element def getLocation(self): return self.location def setLocation(self, location): self.location = location def isIndeterminate(self): return False def toString(self): return str(self.location)
class Vertex: def __init__(self, element, location): self.element = element self.location = location def get_element(self): return self.element def set_element(self, element): self.element = element def get_location(self): return self.location def set_location(self, location): self.location = location def is_indeterminate(self): return False def to_string(self): return str(self.location)
def get_node_info(file): nodes = set() df = [line.strip().split() for line in open('input/%s.txt' % file).readlines() if line.startswith('/dev')] for nodeinfo in df: # Filesystem Size Used Avail Use% # /dev/grid/node-x0-y0 92T 68T 24T 73% _, x, y = nodeinfo[0].split('-') size = int(nodeinfo[1][:-1]) used = int(nodeinfo[2][:-1]) node = (int(x[1:]), int(y[1:]), size, used) nodes.add(node) return nodes def get_pair_count(nodes): pair_count = 0 for a in nodes: ax, ay, _, au = a if au == 0: continue for b in nodes: bx, by, bs, bu = b if bx == ax and by == ay: continue if au <= (bs-bu): pair_count += 1 return pair_count def make_grid(nodes, reg): max_x = max([n[0] for n in nodes]) max_y = max([n[1] for n in nodes]) grid = [[None for x in range(max_x + 1)]for y in range(max_y + 1)] walls = [] empty = (0,0) for node in nodes: x, y, _, u = node if u == 0: char = '0' empty = (x,y) elif u > reg: char = '#' walls.append((x,y)) else: char = '.' grid[y][x] = char grid[0][max_x] = 'D' return grid, max_x, empty, walls def swap(a,b,grid): new = copy_grid(grid) ax, ay = a bx, by = b node_a = grid[ay][ax] node_b = grid[by][bx] new[by][bx] = node_a new[ay][ax] = node_b return new def copy_grid(grid): return [[x for x in y] for y in grid] def find_empty(grid): for y in range(len(grid)): for x in range(len(grid[0])): if grid[y][x] == '0': return (x,y) def find_data(grid): for y in range(len(grid)): for x in range(len(grid[0])): if grid[y][x] == 'D': return (x,y) def print_grid(grid): for row in grid: print(' '.join(row)) print() def solve(input, reg): nodes = get_node_info(input) print("Part 1:", get_pair_count(nodes)) grid, max_x, empty, walls = make_grid(nodes, reg) goal = (0,0) data = (max_x, 0) wall_edge = min([w[0] for w in walls if w[1] < empty[1]]) step_count = 0 # move to left of wall old_empty = empty while empty[0] >= wall_edge: empty = (empty[0] - 1, empty[1]) step_count += 1 grid = swap(old_empty, empty, grid) # go up to top row old_empty = empty while empty[1] != 0: empty = (empty[0], empty[1] - 1) step_count += 1 grid = swap(old_empty, empty, grid) # move next to data old_empty = empty while empty[0] != data[0] - 1: empty = (empty[0] + 1, empty[1]) step_count += 1 grid = swap(old_empty, empty, grid) # swap data, move empty around to left, repeat while data != goal: grid = swap(empty, data, grid) empty = find_empty(grid) data = find_data(grid) step_count += 1 if data != goal: # down 1, left 2, up 1 old_empty = empty empty = (empty[0], empty[1] + 1) grid = swap(empty, old_empty, grid) step_count += 1 old_empty = empty empty = (empty[0]-2, empty[1]) grid = swap(empty, old_empty, grid) step_count += 2 old_empty = empty empty = (empty[0], empty[1] - 1) grid = swap(empty, old_empty, grid) step_count += 1 print("Part 2:", step_count) solve('day22', 100)
def get_node_info(file): nodes = set() df = [line.strip().split() for line in open('input/%s.txt' % file).readlines() if line.startswith('/dev')] for nodeinfo in df: (_, x, y) = nodeinfo[0].split('-') size = int(nodeinfo[1][:-1]) used = int(nodeinfo[2][:-1]) node = (int(x[1:]), int(y[1:]), size, used) nodes.add(node) return nodes def get_pair_count(nodes): pair_count = 0 for a in nodes: (ax, ay, _, au) = a if au == 0: continue for b in nodes: (bx, by, bs, bu) = b if bx == ax and by == ay: continue if au <= bs - bu: pair_count += 1 return pair_count def make_grid(nodes, reg): max_x = max([n[0] for n in nodes]) max_y = max([n[1] for n in nodes]) grid = [[None for x in range(max_x + 1)] for y in range(max_y + 1)] walls = [] empty = (0, 0) for node in nodes: (x, y, _, u) = node if u == 0: char = '0' empty = (x, y) elif u > reg: char = '#' walls.append((x, y)) else: char = '.' grid[y][x] = char grid[0][max_x] = 'D' return (grid, max_x, empty, walls) def swap(a, b, grid): new = copy_grid(grid) (ax, ay) = a (bx, by) = b node_a = grid[ay][ax] node_b = grid[by][bx] new[by][bx] = node_a new[ay][ax] = node_b return new def copy_grid(grid): return [[x for x in y] for y in grid] def find_empty(grid): for y in range(len(grid)): for x in range(len(grid[0])): if grid[y][x] == '0': return (x, y) def find_data(grid): for y in range(len(grid)): for x in range(len(grid[0])): if grid[y][x] == 'D': return (x, y) def print_grid(grid): for row in grid: print(' '.join(row)) print() def solve(input, reg): nodes = get_node_info(input) print('Part 1:', get_pair_count(nodes)) (grid, max_x, empty, walls) = make_grid(nodes, reg) goal = (0, 0) data = (max_x, 0) wall_edge = min([w[0] for w in walls if w[1] < empty[1]]) step_count = 0 old_empty = empty while empty[0] >= wall_edge: empty = (empty[0] - 1, empty[1]) step_count += 1 grid = swap(old_empty, empty, grid) old_empty = empty while empty[1] != 0: empty = (empty[0], empty[1] - 1) step_count += 1 grid = swap(old_empty, empty, grid) old_empty = empty while empty[0] != data[0] - 1: empty = (empty[0] + 1, empty[1]) step_count += 1 grid = swap(old_empty, empty, grid) while data != goal: grid = swap(empty, data, grid) empty = find_empty(grid) data = find_data(grid) step_count += 1 if data != goal: old_empty = empty empty = (empty[0], empty[1] + 1) grid = swap(empty, old_empty, grid) step_count += 1 old_empty = empty empty = (empty[0] - 2, empty[1]) grid = swap(empty, old_empty, grid) step_count += 2 old_empty = empty empty = (empty[0], empty[1] - 1) grid = swap(empty, old_empty, grid) step_count += 1 print('Part 2:', step_count) solve('day22', 100)
class Problem: initial_state = [None, None, None, None, None, None, None, None] row = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] col = [0,1,2,3,4,5,6,7] def check_if_attacked(self, state): # returns True if attacked try: index = state.index(None) - 1 except ValueError: index = 7 if index == 0: return False for i in range(0,index): if (state[i][0] == state[index][0]) or (state[i][1] == state[index][1]): return True #row and column attack check if abs(ord(state[i][0]) - ord(state[index][0])) == abs(int(state[i][1]) - int(state[index][1])): return True #diagonal attack detect return False def actions(self, state): all_actions = [] #find the first (leftmost) None position try: index = state.index(None) # returns the first index on None or raises ValueError in None is not found except ValueError: return [state] for i in range(0,8): next_state = state[:] next_state[index] = Problem.row[index] + str(i) if not self.check_if_attacked(next_state): all_actions.append(next_state) return all_actions def result(self, state, action): return action def goal_test(self, state): try: state.index(None) return False except ValueError: return True def step_cost(self, par_state=None, action=None, child_state=None): return 0 class Node: def __init__(self, state, parent, action, path_cost): self.state = state self.parent = parent self.action = action self.path_cost = path_cost def child_node(problem, parent, action): state = problem.result(parent.state, action) path_cost = parent.path_cost + problem.step_cost(parent.state, action) return Node(state, parent, action, path_cost) def compare(node): return node.path_cost class Frontier: def __init__(self): self.p_queue = [] def is_empty(self): return len(self.p_queue) == 0 def insert(self, node): self.p_queue.append(node) self.p_queue = sorted(self.p_queue, key=compare, reverse=True) def pop(self): return self.p_queue.pop() def contains_state(self, state): for node in self.p_queue[:]: if node.state == state: return True return False def replace_if_higher_path_cost_with_same_state(self,node): for i in range(len(self.p_queue)): if self.p_queue[i].state == node.state: if self.p_queue[i].path_cost > node.path_cost: self.p_queue[i] = node def uniform_cost_search(problem): node = Node(problem.initial_state.copy(),None, None, 0) frontier = Frontier() frontier.insert(node) explored = [] n=1 while True: if frontier.is_empty(): return "failure" node = frontier.pop() #print("popped from frontier") if problem.goal_test(node.state): print (str(n) +" "+ str(node.state)) paint(node.state) n = n+1 explored.append(node.state) for action in problem.actions(node.state): #print(action) child = child_node(problem, node, action) if (child.state not in explored) and (not frontier.contains_state(child.state)): frontier.insert(child) #print('inserted in frontier') else: frontier.replace_if_higher_path_cost_with_same_state(child) def paint(state): print(" _ _ _ _ _ _ _ _ ") for i in range(7,-1,-1): prnt_str = str(i) for j in range(0,8): prnt_str = prnt_str + "|" if int(state[j][1]) == i : prnt_str = prnt_str + "Q" else: prnt_str = prnt_str + " " prnt_str = prnt_str + "|" print(prnt_str) #print(" - - - - - - - - ") print(" a b c d e f g h ") problem = Problem() uniform_cost_search(problem)
class Problem: initial_state = [None, None, None, None, None, None, None, None] row = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] col = [0, 1, 2, 3, 4, 5, 6, 7] def check_if_attacked(self, state): try: index = state.index(None) - 1 except ValueError: index = 7 if index == 0: return False for i in range(0, index): if state[i][0] == state[index][0] or state[i][1] == state[index][1]: return True if abs(ord(state[i][0]) - ord(state[index][0])) == abs(int(state[i][1]) - int(state[index][1])): return True return False def actions(self, state): all_actions = [] try: index = state.index(None) except ValueError: return [state] for i in range(0, 8): next_state = state[:] next_state[index] = Problem.row[index] + str(i) if not self.check_if_attacked(next_state): all_actions.append(next_state) return all_actions def result(self, state, action): return action def goal_test(self, state): try: state.index(None) return False except ValueError: return True def step_cost(self, par_state=None, action=None, child_state=None): return 0 class Node: def __init__(self, state, parent, action, path_cost): self.state = state self.parent = parent self.action = action self.path_cost = path_cost def child_node(problem, parent, action): state = problem.result(parent.state, action) path_cost = parent.path_cost + problem.step_cost(parent.state, action) return node(state, parent, action, path_cost) def compare(node): return node.path_cost class Frontier: def __init__(self): self.p_queue = [] def is_empty(self): return len(self.p_queue) == 0 def insert(self, node): self.p_queue.append(node) self.p_queue = sorted(self.p_queue, key=compare, reverse=True) def pop(self): return self.p_queue.pop() def contains_state(self, state): for node in self.p_queue[:]: if node.state == state: return True return False def replace_if_higher_path_cost_with_same_state(self, node): for i in range(len(self.p_queue)): if self.p_queue[i].state == node.state: if self.p_queue[i].path_cost > node.path_cost: self.p_queue[i] = node def uniform_cost_search(problem): node = node(problem.initial_state.copy(), None, None, 0) frontier = frontier() frontier.insert(node) explored = [] n = 1 while True: if frontier.is_empty(): return 'failure' node = frontier.pop() if problem.goal_test(node.state): print(str(n) + ' ' + str(node.state)) paint(node.state) n = n + 1 explored.append(node.state) for action in problem.actions(node.state): child = child_node(problem, node, action) if child.state not in explored and (not frontier.contains_state(child.state)): frontier.insert(child) else: frontier.replace_if_higher_path_cost_with_same_state(child) def paint(state): print(' _ _ _ _ _ _ _ _ ') for i in range(7, -1, -1): prnt_str = str(i) for j in range(0, 8): prnt_str = prnt_str + '|' if int(state[j][1]) == i: prnt_str = prnt_str + 'Q' else: prnt_str = prnt_str + ' ' prnt_str = prnt_str + '|' print(prnt_str) print(' a b c d e f g h ') problem = problem() uniform_cost_search(problem)
# Easy # https://leetcode.com/problems/climbing-stairs/ class Solution: # Time complexity : O(n) # Space complexity: O(1) # Fibonacci sequence def climbStairs(self, n: int) -> int: a, b = 1, 2 for _ in range(1, n): a, b = b, a + b return a
class Solution: def climb_stairs(self, n: int) -> int: (a, b) = (1, 2) for _ in range(1, n): (a, b) = (b, a + b) return a
file = {'amy':5, 'bob':8, 'candy':6, 'doby':9, 'john':0} print("Amy's number is:" +'\n\t' + str(file['amy']) +'.') print("\nBob's number is:" +'\n\t' + str(file['bob']) +'.')
file = {'amy': 5, 'bob': 8, 'candy': 6, 'doby': 9, 'john': 0} print("Amy's number is:" + '\n\t' + str(file['amy']) + '.') print("\nBob's number is:" + '\n\t' + str(file['bob']) + '.')
class Solution: def myAtoi(self, str): if len(str) == 0: return 0 res = 0 max_int = 2147483647 min_int = -2147483648 for i in range(0, len(str)): c = str[i] if c != ' ': break s = str[i:] pos = False if s[0] == '-': pos = False s = s[1:] elif s[0] == '+': pos = True s = s[1:] else: pos = True s = s for c in s: if c >= '0' and c <= '9': res = res*10 + int(c) else: break if not pos: res = -res if res > max_int: res = max_int if res < min_int: res = min_int return res a = Solution() r = a.myAtoi("") print(r) r = a.myAtoi(" ab") print(r) r = a.myAtoi(" -123") print(r)
class Solution: def my_atoi(self, str): if len(str) == 0: return 0 res = 0 max_int = 2147483647 min_int = -2147483648 for i in range(0, len(str)): c = str[i] if c != ' ': break s = str[i:] pos = False if s[0] == '-': pos = False s = s[1:] elif s[0] == '+': pos = True s = s[1:] else: pos = True s = s for c in s: if c >= '0' and c <= '9': res = res * 10 + int(c) else: break if not pos: res = -res if res > max_int: res = max_int if res < min_int: res = min_int return res a = solution() r = a.myAtoi('') print(r) r = a.myAtoi(' ab') print(r) r = a.myAtoi(' -123') print(r)
class Config: def __init__(self): self.basename = 'delta_video' self.directory = '/home/eleanor/Documents/gcamp_analysis_files_temp/171019-06-bottom-experiment/data' self.topics = ['/multi_tracker/1/delta_video',] self.record_length_hours = 1
class Config: def __init__(self): self.basename = 'delta_video' self.directory = '/home/eleanor/Documents/gcamp_analysis_files_temp/171019-06-bottom-experiment/data' self.topics = ['/multi_tracker/1/delta_video'] self.record_length_hours = 1
class Memory: def __init__(self, size): self.mem = bytearray(size) self.bin_size = 0 def read8(self, addr): val = self.mem[addr] #if addr > self.bin_size: # print(f'Read {val:02x} at {addr}') return val def write8(self, addr, val): self.mem[addr] = val def write_bin(self, addr, data): self.mem[addr: addr+len(data)] = data self.bin_size = addr + len(data) def __len__(self): return len(self.mem) class MemoryMap: def __init__(self, mems): self.mems = mems def resolve_addr(self, addr): for start, m in self.mems: if start <= addr < start + len(m): return m, start raise IndexError(f'Access to unmapped memory {addr:x}') def read8(self, addr): mem, start = self.resolve_addr(addr) val = mem.read8(addr - start) #print(f'Read {val:x} at {addr}') return val def write8(self, addr, val): #print(f'Write {val:x} at {addr}') mem, start = self.resolve_addr(addr) mem.write8(addr - start, val)
class Memory: def __init__(self, size): self.mem = bytearray(size) self.bin_size = 0 def read8(self, addr): val = self.mem[addr] return val def write8(self, addr, val): self.mem[addr] = val def write_bin(self, addr, data): self.mem[addr:addr + len(data)] = data self.bin_size = addr + len(data) def __len__(self): return len(self.mem) class Memorymap: def __init__(self, mems): self.mems = mems def resolve_addr(self, addr): for (start, m) in self.mems: if start <= addr < start + len(m): return (m, start) raise index_error(f'Access to unmapped memory {addr:x}') def read8(self, addr): (mem, start) = self.resolve_addr(addr) val = mem.read8(addr - start) return val def write8(self, addr, val): (mem, start) = self.resolve_addr(addr) mem.write8(addr - start, val)
__author__ = 'Jeffrey Seifried' __description__ = 'A library for forecasting sun positions' __email__ = 'jeffrey.seifried@gmail.com' __program__ = 'analemma' __url__ = 'http://github.com/jeffseif/{}'.format(__program__) __version__ = '1.0.0' __year__ = '2020'
__author__ = 'Jeffrey Seifried' __description__ = 'A library for forecasting sun positions' __email__ = 'jeffrey.seifried@gmail.com' __program__ = 'analemma' __url__ = 'http://github.com/jeffseif/{}'.format(__program__) __version__ = '1.0.0' __year__ = '2020'
# flake8: noqa # https://github.com/trezor/python-mnemonic/blob/master/vectors.json trezor_vectors = { "english": [ { "id": 0, "entropy": "00000000000000000000000000000000", "mnemonic": "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about", "salt": "TREZOR", "binary": "00000000000 00000000000 00000000000 00000000000 00000000000 00000000000 00000000000 00000000000 00000000000 00000000000 00000000000 0000000", "checksum": "0011", "seed": "c55257c360c07c72029aebc1b53c05ed0362ada38ead3e3e9efa3708e53495531f09a6987599d18264c1e1c92f2cf141630c7a3c4ab7c81b2f001698e7463b04", "root": { "private_key": "cbedc75b0d6412c85c79bc13875112ef912fd1e756631b5a00330866f22ff184", "public_key": "02f632717d78bf73e74aa8461e2e782532abae4eed5110241025afb59ebfd3d2fd", "xpub": "xpub661MyMwAqRbcGB88KaFbLGiYAat55APKhtWg4uYMkXAmfuSTbq2QYsn9sKJCj1YqZPafsboef4h4YbXXhNhPwMbkHTpkf3zLhx7HvFw1NDy", "xpriv": "xprv9s21ZrQH143K3h3fDYiay8mocZ3afhfULfb5GX8kCBdno77K4HiA15Tg23wpbeF1pLfs1c5SPmYHrEpTuuRhxMwvKDwqdKiGJS9XFKzUsAF", "parent_fingerprint": "00", "fingerprint": "b4e3f5ed", "depth": 0, "index": 0, "chain_code": "a3fa8c983223306de0f0f65e74ebb1e98aba751633bf91d5fb56529aa5c132c1" }, "derived_node": { "path": "m/7'/13'/8'/65'/6/44/16/18'/7", "public_key": "026381791f9bf7ec99538a408d61c911737a30488c78004feb34a73295776c2f17", "private_key": "b4749323ef65b3898c8cf3f9978fa437c9113a3a91b26320a1047032ab9eaf47", "xpub": "xpub6Qo94BJ44WgahcCbte4pYt2UU5AGBrkt4PyKWzG3KA9AR1EbERqbTo69Wtc4cXnB2DiuFcxwEDRNdQh1GXwF1jqHrwZS3KRS6X7eaceREJd", "xpriv": "xprvABonefmAE98HV888ncXpBk5jv3KmnQ32hB3iibrRkpcBYCuSgtXLuzmffeBwvMLcouHL2WdJEZiiXJDB6cMDKytYPy37Em7BNCytyBhJd5A", "parent_fingerprint": "fc4ca6e2", "fingerprint": "264f90ed", "depth": 9, "index": 7, "chain_code": "3c063c0a452d20fba1b1cc476a886def7096116dd0cb8400d90f6f55507bcca6" } } ] } # generated with: https://iancoleman.io/bip39/#english test_vectors = { "english": [ { "id": 0, "entropy": "a4e3fc4c0161698a22707cfbf30f7f83", "mnemonic": "pilot cable basic actress bird shallow mean auto winner observe that all", "salt": None, "binary": "10100100111 00011111111 00010011000 00000010110 00010110100 11000101000 10001001110 00001111100 11111011111 10011000011 11011111111 0000011", "checksum": "0011", "seed": "af44c7ad86ba0a5f46d4c1e785c846db14e0f3d62b69c2ab7efa012a9c9155c024975d6897e36fe9e9e6f0bde55fdf325ff308914ed1b316da0f755f9dd7347d", "root": { "private_key": "c6796958d07afe0af1ba9a11da2b7a22d6226b4ff7ff5324c7c876cfc1ea0f1c", "public_key": "029cfe11e5f33a2601083ff5e29d9b7f134f5edc6b7636674a7286ecf6d23804df", "xpub": "xpub661MyMwAqRbcFXwuU8c1uEfmER2GW8A7XfaR9Cw41RCGr1xmr4WaLdU9cGPvcJXaaNYLFuu9bMimhKmGgaFja9BxcBAo98Eim1UuUu1dXAn", "xpriv": "xprv9s21ZrQH143K33sSN751Y6j2gPBn6fSGASepLpXST5fHyDddJXCKnq9fm1gRmHk4CPPcEF9gBmJvPBf74ExYM6Ybe6zwA7HfX8dQkRFY9S4", "parent_fingerprint": "00", "fingerprint": "f3ac0f3f", "depth": 0, "index": 0, "chain_code": "6399431d3f454a4acbe0f1cbb2d9a392a43dbea34e7fea952bdda675adde6e6e" }, "derived_node": { "path": "m/55'/16'/34'/20/19'/97/21'/88'", "public_key": "039b8a22c4fb43cb4b52596fc2050357dd9771950d6b6881c6e4b2e78e1943f51d", "private_key": "258dc521c0581a788a2f08fd64be0f4d29c0c7384031960e6b6986526bcb039f", "xpub": "xpub6NjKMZDHrzmR8m4poa48Xzj3qeS32QQBbfXffSK5N4F6SLE35fFrBT9qECJ77LMic44hNnWTR86qVjE8r4DsMSNVztB1vyoYNvhzrg91zXV", "xpriv": "xprvA9jxx3gQ2dD7vGzMhYX8ArnKHcbYcwgLESc4s3uToii7ZXttY7wbdeqMNtRdhhepm7cEKKparnDqeigAPgj7KTj7Gw5ZGUKCRBYbkd3sdGo", "parent_fingerprint": "e33b22ce", "fingerprint": "93195471", "depth": 8, "index": 2147483736, "chain_code": "18eb1b59d8a529c9fdbfbce7f6cb03cc9b1bd80b2fc5abee1944b32a32c136f8" } }, { "id": 1, "entropy": "8cfc94f3846c43fa893b4950155de2369772c91e", "mnemonic": "mind tool diagram angle service wool ceiling hard exotic priority joy honey jaguar goose kit", "salt": None, "binary": "10001100111 11100100101 00111100111 00001000110 11000100001 11111101010 00100100111 01101001001 01010000000 10101010111 01111000100 01101101001 01110111001 01100100100 011110", "checksum": "10111", "seed": "82555df2fd8c76fca417c83fc7ed0552a0310299eed41d3a45cf49e1ac056e21126e64d988052b9dbc0e04bd6b3580c51ab6a4ec5a62c5dba2039bd372e7d137", "root": { "private_key": "9fee59092ebbedc782277cf75bc85f9db0ea559818eb20de865c4897eb2144f4", "public_key": "0357ffdd29d20d72d2061c154353835b9cd34016d6f63755a04d70a7033e2919b3", "xpub": "xpub661MyMwAqRbcFyPp6zb6ZPcsuqVkvUm2Y61Gn7cRrkp2xxCD8ot9tgJQDKG6R6DWopMQrVoUhMChoCZcS4PKSFFx5AoNPAGFizikrRVTmpn", "xpriv": "xprv9s21ZrQH143K3VKLzy46CFg9MofGX23BAs5fyjCpJRH469s4bGZuLsyvN2qGCAYoJYmHyT6XVVkhm7DHGyHSyYPintmfgxYrwKHzCgCthir", "parent_fingerprint": "00", "fingerprint": "94db54c0", "depth": 0, "index": 0, "chain_code": "8faa80cab7372c9e12e2f54a445e434b5d2cb310bc92d7e304b914360a89278a" }, "derived_node": { "path": "m/96'/2'/10/81'/60'/90'", "public_key": "0229d3838c6703a16aa9e7f8604dd308f36980ca891783f9e46dcc8d0a7c7da5ed", "private_key": "6f7ae238af855eb9e0cee63333a4c05ef4c24a54a6951dcdf298ea13c85e2050", "xpub": "xpub6JuoVny9rzjMruCwjgP66H9bLt97ow3jgg6Sjt5Eny85LQKoQzA6E9xhmFcVoQR2PoYnTTDMcXnyo1MZPHeW4PFBxaN6VitafnfA3csorkr", "xpriv": "xprvA5vT6HSG2dB4eR8Uder5j9CrnrJdQUKtKTAqwVfdEdb6TbzesSqqgMeDv17Qa6M5jxRcbhDTTfzzBxuJqMURrsXnRXNJUwkRsqNmTHEs6Qx", "parent_fingerprint": "db9f3893", "fingerprint": "11b20e3d", "depth": 6, "index": 2147483738, "chain_code": "91f4c0395a78095692132cb1f632834ab821c373057ccdb5637f7f9f34837fdd" } }, { "id": 2, "entropy": "15bf57143a38579300d9f4cbd65adaebe01398fbeb8f44f0", "mnemonic": "between wide shallow inner lyrics sister address direct slim ready repeat style abuse small use impose eager liberty", "salt": None, "binary": "00010101101 11111010101 11000101000 01110100011 10000101011 11001001100 00000011011 00111110100 11001011110 10110010110 10110110101 11010111110 00000001001 11001100011 11101111101 01110001111 01000100111 10000", "checksum": "000111", "seed": "db6b9728bce174c1c14976415cfe06d63509e127f38ba265cf672315b5ed15953828f0fe5e9922654c07d3284f7ac11f814b564e87f94210d3bcc153ec6f698b", "root": { "private_key": "3a4014ab104dc69ba3820e3c1e9740998dfdd0b912f1f83268c639bac5fa64f0", "public_key": "03230ac7166adf9664a911a4d4785a60e79e983f950b99fe9dc228dd1438c0aa36", "xpub": "xpub661MyMwAqRbcFtZZGjnmsUKVffkBYUraocCexn2maSi1keXzdsaam5fwHRrwFaLNe1dCjqQQMgcGSQfaiD5BFuDbvy3cdkWrq3939hHHns9", "xpriv": "xprv9s21ZrQH143K3QV6AiFmWLNm7duh928jSPH4APdA27B2srCr6LGLDHMTS94eTRRBfnoLErXZEXbkAHpybohWnb4tp8sv3cSK7nJKtpcwJ4U", "parent_fingerprint": "00", "fingerprint": "b46fe1d0", "depth": 0, "index": 0, "chain_code": "874c576e48fdc3ebf6f0822b4d18498d0a545d6684dfd683ef215fd0273870e8" }, "derived_node": { "path": "m/87/19/76/25'/96'", "public_key": "03540f45d9145cd5c9bdbf67b674df050255ac19380b0b6f3cc57dff99e17b836a", "private_key": "c3c055a5154dafa361e82d585393d82a8bf3f82cbe96f7c4e2e758de7ac90a0e", "xpub": "xpub6FwAvDCcTWuqD2hVZHoi3WhtWZbf2XBeo36HRFwCLLk85DxzvHau5dmx8o7VKsdrv98yigghdX6PkgeGvoe4LZ39Hoex2ZhGtJ53W4Tdnmn", "xpriv": "xprvA2wpWhfid9MXzYd2TGGhgNm9xXmAd4ToRpAgcsXan1D9CRdrNkGeXqTUHWzAimdLSuZCMCqMhu545mtYP4mj13q5RWDbuyBHBbwMeaPcAyU", "parent_fingerprint": "46ae4850", "fingerprint": "94d1cc4b", "depth": 5, "index": 2147483744, "chain_code": "309cff07ed70166ebe30ec31ee7a4c261fa9dfa6bdae249d498a84f4d224d472" } }, { "id": 3, "entropy": "a05a7afb69e2cd81c838a7d1ad4132d06bef59042b0388512881b61a", "mnemonic": "park stable salute stable coast science can belt spider head erosion patch same prosper awful gather marriage matter call history pluck", "salt": None, "binary": "10100000010 11010011110 10111110110 11010011110 00101100110 11000000111 00100000111 00010100111 11010001101 01101010000 01001100101 10100000110 10111110111 10101100100 00010000101 01100000011 10001000010 10001001010 00100000011 01101100001 1010", "checksum": "0110101", "seed": "1929655fd266457fc620dd471f424b8351999338c837db07ec362dab19f11dbb2c2aff18d0a063a9d91239f81181d0fcebe327c37803b45012a8163fe3b716b6", "root": { "private_key": "a01b94f79e8c29ee63b8c27e40ef63f1cfe8f4cac870d0de5d20e889b1d8a13a", "public_key": "031225fa5e457da949ab1021931887131c7a53c06df0fce4d6a3dd5819aa5776e0", "xpub": "xpub661MyMwAqRbcFJsyHbfuQsjnh3qjSfXkxkEXa5JHoSbyU7UNoiXU3FXfcKUbdFqC5cyxexpUAYPZP6K9AU9C4FjfuiX743buQgF5k7BwUND", "xpriv": "xprv9s21ZrQH143K2poWBa8u3jo4921F3CoubXJvmgtgF74zbK9EGBDDVTDBm3acAnd1cvowkj1pvi7PK3Ab6XrwYfJPWmQtCp5kor3tbqkreJ6", "parent_fingerprint": "00", "fingerprint": "056dd4ec", "depth": 0, "index": 0, "chain_code": "4cf7eb64f359de9cdb7f2c05baf3267a2f1f96e1fc68333c60e92ff3dbbf0b78" }, "derived_node": { "path": "m/85'/15/76", "public_key": "02029099fda4c09fa365c85cf785fb790270125bc0d9a584e1707ca2d85209eab2", "private_key": "921255b836b8215d67d18949b217f3b3edf77cc0d185d37ff85da85d6ca0657e", "xpub": "xpub6CnpKCiJ2WSFtjfzoreA69jdgCrLK2vVrzEhvJHHEDjREWLU2SYKwVkMVML9Gt22pMY2aa4RdEXedECPgyoegRy76vaPNpj8QzFwAxeRKmn", "xpriv": "xprv9yoTuhBQC8sxgFbXhq79j1nu8B1quaCeVmK77usfftCSMi1KUuE5PhRse7PaX8uh8stKfMGjNGN6ZiXVXBL54daSjmLvEe57u3m8mbGvHGv", "parent_fingerprint": "9aedbb6f", "fingerprint": "6ad6b30a", "depth": 3, "index": 76, "chain_code": "ec33efe03c9ad429a6e2cba47cdbc396ae2bded480c628f760396794e6f52729" } }, { "id": 4, "entropy": "39281ecca67d16aa629115340d8ad4923bd49ec2d6f17669fce458087ee89a92", "mnemonic": "decrease domain rebel erupt sphere festival medal cargo cross hobby release caught run exhaust area taste island exit decorate quote margin inmate heart frog", "salt": None, "binary": "00111001001 01000000111 10110011001 01001100111 11010001011 01010101001 10001010010 00100010101 00110100000 01101100010 10110101001 00100100011 10111101010 01001111011 00001011010 11011110001 01110110011 01001111111 00111001000 10110000000 10000111111 01110100010 01101010010 010", "checksum": "11101001", "seed": "c11b0ff978d88c0ae9f7c349733bbd1b7baf2237663e3064a4c62bc4f5a578e4fb14fc43c38f85bfe83a15790397d7a301df5233d7d520cd2cc974cd33ae47b2", "root": { "private_key": "36f0fcac8ff8e73506ae26aa1db732918e0db5c5635330eaed951e12eacedf3e", "public_key": "02800f0237e39dce74f506c508985d4d71f8020342d7dfe781ca5cfb73e63eb43e", "xpub": "xpub661MyMwAqRbcGYp55aa3wf9WqTuPGdFnwyhFBALErewiMiBkeDrXsZ6qDbUbawSiHVgqvqobbNdosLY7aJgsNVv4DtwPAWKEjgCaSEjvdBg", "xpriv": "xprv9s21ZrQH143K44jbyZ33aXCnHS4tsAXwakmeNmvdJKQjUurc6gYHKknMNKtdTiC7jPbnEBmTWDEJ4HpxobatUpEKQgrshDpv8R1NrCkdWyT", "parent_fingerprint": "00", "fingerprint": "ea6be3d5", "depth": 0, "index": 0, "chain_code": "c989c416cf4c4e3d3708c25893ab6c01bcb9893e153929ab9204eb374ab76a63" }, "derived_node": { "path": "m/51'", "public_key": "028f08404abc652f3170f471591cab170f153a0772adf69d33116212f9219537cc", "private_key": "e74f8cedbafd94797fd0d21ecb06ccac46721602ccb8a0fe86cdb54335d03691", "xpub": "xpub69cS8waJoeNVm5qKbGi2eyspJLHgP1zyZWgFJt2knTHGUhF45C8tthWzJ5cJTKQA77UvXkKvpdGh49ewZhDyQD2vFcSyTz3qjvstaxjPd4F", "xpriv": "xprv9vd5jS3QyGpCYbkrVFB2Hqw5kJTByZH8CHkeWVd9E7kHbtuuXepeLuCWSqFQy8o3iwPrPyw5trAwCpW9HvecxQkCNBeHUHmXiAu9mUWDviW", "parent_fingerprint": "ea6be3d5", "fingerprint": "97f01095", "depth": 1, "index": 2147483699, "chain_code": "bfad5d31ac996363d635dad2304f9582e81ddd7cc8249c3cd5b327706103cb6e" } }, ] } public_path_mnemonic = "decrease domain rebel erupt sphere festival medal cargo cross hobby release caught run exhaust area taste island exit decorate quote margin inmate heart frog" public_path = [ 'xpub661MyMwAqRbcGYp55aa3wf9WqTuPGdFnwyhFBALErewiMiBkeDrXsZ6qDbUbawSiHVgqvqobbNdosLY7aJgsNVv4DtwPAWKEjgCaSEjvdBg', 'xpub69cS8waATyqVK5tryNLyKKHMHzieRM4AQdG5aR9VSe29cJp4EyTrMDLHUi198chSiY86Dh1V57UPCdwSsNUPDKjhSeXvZ3ejvW76pRGFpQe', 'xpub6AB84inF91Uf26fue9dETg5rkNhDwEsWN2kpB7vJWHHuakuMeKPL7onruexAnWhLkEMv7Rjq2aA1z8h6iz4XX6tfRaiuZY83TQi4MR29UCN']
trezor_vectors = {'english': [{'id': 0, 'entropy': '00000000000000000000000000000000', 'mnemonic': 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about', 'salt': 'TREZOR', 'binary': '00000000000 00000000000 00000000000 00000000000 00000000000 00000000000 00000000000 00000000000 00000000000 00000000000 00000000000 0000000', 'checksum': '0011', 'seed': 'c55257c360c07c72029aebc1b53c05ed0362ada38ead3e3e9efa3708e53495531f09a6987599d18264c1e1c92f2cf141630c7a3c4ab7c81b2f001698e7463b04', 'root': {'private_key': 'cbedc75b0d6412c85c79bc13875112ef912fd1e756631b5a00330866f22ff184', 'public_key': '02f632717d78bf73e74aa8461e2e782532abae4eed5110241025afb59ebfd3d2fd', 'xpub': 'xpub661MyMwAqRbcGB88KaFbLGiYAat55APKhtWg4uYMkXAmfuSTbq2QYsn9sKJCj1YqZPafsboef4h4YbXXhNhPwMbkHTpkf3zLhx7HvFw1NDy', 'xpriv': 'xprv9s21ZrQH143K3h3fDYiay8mocZ3afhfULfb5GX8kCBdno77K4HiA15Tg23wpbeF1pLfs1c5SPmYHrEpTuuRhxMwvKDwqdKiGJS9XFKzUsAF', 'parent_fingerprint': '00', 'fingerprint': 'b4e3f5ed', 'depth': 0, 'index': 0, 'chain_code': 'a3fa8c983223306de0f0f65e74ebb1e98aba751633bf91d5fb56529aa5c132c1'}, 'derived_node': {'path': "m/7'/13'/8'/65'/6/44/16/18'/7", 'public_key': '026381791f9bf7ec99538a408d61c911737a30488c78004feb34a73295776c2f17', 'private_key': 'b4749323ef65b3898c8cf3f9978fa437c9113a3a91b26320a1047032ab9eaf47', 'xpub': 'xpub6Qo94BJ44WgahcCbte4pYt2UU5AGBrkt4PyKWzG3KA9AR1EbERqbTo69Wtc4cXnB2DiuFcxwEDRNdQh1GXwF1jqHrwZS3KRS6X7eaceREJd', 'xpriv': 'xprvABonefmAE98HV888ncXpBk5jv3KmnQ32hB3iibrRkpcBYCuSgtXLuzmffeBwvMLcouHL2WdJEZiiXJDB6cMDKytYPy37Em7BNCytyBhJd5A', 'parent_fingerprint': 'fc4ca6e2', 'fingerprint': '264f90ed', 'depth': 9, 'index': 7, 'chain_code': '3c063c0a452d20fba1b1cc476a886def7096116dd0cb8400d90f6f55507bcca6'}}]} test_vectors = {'english': [{'id': 0, 'entropy': 'a4e3fc4c0161698a22707cfbf30f7f83', 'mnemonic': 'pilot cable basic actress bird shallow mean auto winner observe that all', 'salt': None, 'binary': '10100100111 00011111111 00010011000 00000010110 00010110100 11000101000 10001001110 00001111100 11111011111 10011000011 11011111111 0000011', 'checksum': '0011', 'seed': 'af44c7ad86ba0a5f46d4c1e785c846db14e0f3d62b69c2ab7efa012a9c9155c024975d6897e36fe9e9e6f0bde55fdf325ff308914ed1b316da0f755f9dd7347d', 'root': {'private_key': 'c6796958d07afe0af1ba9a11da2b7a22d6226b4ff7ff5324c7c876cfc1ea0f1c', 'public_key': '029cfe11e5f33a2601083ff5e29d9b7f134f5edc6b7636674a7286ecf6d23804df', 'xpub': 'xpub661MyMwAqRbcFXwuU8c1uEfmER2GW8A7XfaR9Cw41RCGr1xmr4WaLdU9cGPvcJXaaNYLFuu9bMimhKmGgaFja9BxcBAo98Eim1UuUu1dXAn', 'xpriv': 'xprv9s21ZrQH143K33sSN751Y6j2gPBn6fSGASepLpXST5fHyDddJXCKnq9fm1gRmHk4CPPcEF9gBmJvPBf74ExYM6Ybe6zwA7HfX8dQkRFY9S4', 'parent_fingerprint': '00', 'fingerprint': 'f3ac0f3f', 'depth': 0, 'index': 0, 'chain_code': '6399431d3f454a4acbe0f1cbb2d9a392a43dbea34e7fea952bdda675adde6e6e'}, 'derived_node': {'path': "m/55'/16'/34'/20/19'/97/21'/88'", 'public_key': '039b8a22c4fb43cb4b52596fc2050357dd9771950d6b6881c6e4b2e78e1943f51d', 'private_key': '258dc521c0581a788a2f08fd64be0f4d29c0c7384031960e6b6986526bcb039f', 'xpub': 'xpub6NjKMZDHrzmR8m4poa48Xzj3qeS32QQBbfXffSK5N4F6SLE35fFrBT9qECJ77LMic44hNnWTR86qVjE8r4DsMSNVztB1vyoYNvhzrg91zXV', 'xpriv': 'xprvA9jxx3gQ2dD7vGzMhYX8ArnKHcbYcwgLESc4s3uToii7ZXttY7wbdeqMNtRdhhepm7cEKKparnDqeigAPgj7KTj7Gw5ZGUKCRBYbkd3sdGo', 'parent_fingerprint': 'e33b22ce', 'fingerprint': '93195471', 'depth': 8, 'index': 2147483736, 'chain_code': '18eb1b59d8a529c9fdbfbce7f6cb03cc9b1bd80b2fc5abee1944b32a32c136f8'}}, {'id': 1, 'entropy': '8cfc94f3846c43fa893b4950155de2369772c91e', 'mnemonic': 'mind tool diagram angle service wool ceiling hard exotic priority joy honey jaguar goose kit', 'salt': None, 'binary': '10001100111 11100100101 00111100111 00001000110 11000100001 11111101010 00100100111 01101001001 01010000000 10101010111 01111000100 01101101001 01110111001 01100100100 011110', 'checksum': '10111', 'seed': '82555df2fd8c76fca417c83fc7ed0552a0310299eed41d3a45cf49e1ac056e21126e64d988052b9dbc0e04bd6b3580c51ab6a4ec5a62c5dba2039bd372e7d137', 'root': {'private_key': '9fee59092ebbedc782277cf75bc85f9db0ea559818eb20de865c4897eb2144f4', 'public_key': '0357ffdd29d20d72d2061c154353835b9cd34016d6f63755a04d70a7033e2919b3', 'xpub': 'xpub661MyMwAqRbcFyPp6zb6ZPcsuqVkvUm2Y61Gn7cRrkp2xxCD8ot9tgJQDKG6R6DWopMQrVoUhMChoCZcS4PKSFFx5AoNPAGFizikrRVTmpn', 'xpriv': 'xprv9s21ZrQH143K3VKLzy46CFg9MofGX23BAs5fyjCpJRH469s4bGZuLsyvN2qGCAYoJYmHyT6XVVkhm7DHGyHSyYPintmfgxYrwKHzCgCthir', 'parent_fingerprint': '00', 'fingerprint': '94db54c0', 'depth': 0, 'index': 0, 'chain_code': '8faa80cab7372c9e12e2f54a445e434b5d2cb310bc92d7e304b914360a89278a'}, 'derived_node': {'path': "m/96'/2'/10/81'/60'/90'", 'public_key': '0229d3838c6703a16aa9e7f8604dd308f36980ca891783f9e46dcc8d0a7c7da5ed', 'private_key': '6f7ae238af855eb9e0cee63333a4c05ef4c24a54a6951dcdf298ea13c85e2050', 'xpub': 'xpub6JuoVny9rzjMruCwjgP66H9bLt97ow3jgg6Sjt5Eny85LQKoQzA6E9xhmFcVoQR2PoYnTTDMcXnyo1MZPHeW4PFBxaN6VitafnfA3csorkr', 'xpriv': 'xprvA5vT6HSG2dB4eR8Uder5j9CrnrJdQUKtKTAqwVfdEdb6TbzesSqqgMeDv17Qa6M5jxRcbhDTTfzzBxuJqMURrsXnRXNJUwkRsqNmTHEs6Qx', 'parent_fingerprint': 'db9f3893', 'fingerprint': '11b20e3d', 'depth': 6, 'index': 2147483738, 'chain_code': '91f4c0395a78095692132cb1f632834ab821c373057ccdb5637f7f9f34837fdd'}}, {'id': 2, 'entropy': '15bf57143a38579300d9f4cbd65adaebe01398fbeb8f44f0', 'mnemonic': 'between wide shallow inner lyrics sister address direct slim ready repeat style abuse small use impose eager liberty', 'salt': None, 'binary': '00010101101 11111010101 11000101000 01110100011 10000101011 11001001100 00000011011 00111110100 11001011110 10110010110 10110110101 11010111110 00000001001 11001100011 11101111101 01110001111 01000100111 10000', 'checksum': '000111', 'seed': 'db6b9728bce174c1c14976415cfe06d63509e127f38ba265cf672315b5ed15953828f0fe5e9922654c07d3284f7ac11f814b564e87f94210d3bcc153ec6f698b', 'root': {'private_key': '3a4014ab104dc69ba3820e3c1e9740998dfdd0b912f1f83268c639bac5fa64f0', 'public_key': '03230ac7166adf9664a911a4d4785a60e79e983f950b99fe9dc228dd1438c0aa36', 'xpub': 'xpub661MyMwAqRbcFtZZGjnmsUKVffkBYUraocCexn2maSi1keXzdsaam5fwHRrwFaLNe1dCjqQQMgcGSQfaiD5BFuDbvy3cdkWrq3939hHHns9', 'xpriv': 'xprv9s21ZrQH143K3QV6AiFmWLNm7duh928jSPH4APdA27B2srCr6LGLDHMTS94eTRRBfnoLErXZEXbkAHpybohWnb4tp8sv3cSK7nJKtpcwJ4U', 'parent_fingerprint': '00', 'fingerprint': 'b46fe1d0', 'depth': 0, 'index': 0, 'chain_code': '874c576e48fdc3ebf6f0822b4d18498d0a545d6684dfd683ef215fd0273870e8'}, 'derived_node': {'path': "m/87/19/76/25'/96'", 'public_key': '03540f45d9145cd5c9bdbf67b674df050255ac19380b0b6f3cc57dff99e17b836a', 'private_key': 'c3c055a5154dafa361e82d585393d82a8bf3f82cbe96f7c4e2e758de7ac90a0e', 'xpub': 'xpub6FwAvDCcTWuqD2hVZHoi3WhtWZbf2XBeo36HRFwCLLk85DxzvHau5dmx8o7VKsdrv98yigghdX6PkgeGvoe4LZ39Hoex2ZhGtJ53W4Tdnmn', 'xpriv': 'xprvA2wpWhfid9MXzYd2TGGhgNm9xXmAd4ToRpAgcsXan1D9CRdrNkGeXqTUHWzAimdLSuZCMCqMhu545mtYP4mj13q5RWDbuyBHBbwMeaPcAyU', 'parent_fingerprint': '46ae4850', 'fingerprint': '94d1cc4b', 'depth': 5, 'index': 2147483744, 'chain_code': '309cff07ed70166ebe30ec31ee7a4c261fa9dfa6bdae249d498a84f4d224d472'}}, {'id': 3, 'entropy': 'a05a7afb69e2cd81c838a7d1ad4132d06bef59042b0388512881b61a', 'mnemonic': 'park stable salute stable coast science can belt spider head erosion patch same prosper awful gather marriage matter call history pluck', 'salt': None, 'binary': '10100000010 11010011110 10111110110 11010011110 00101100110 11000000111 00100000111 00010100111 11010001101 01101010000 01001100101 10100000110 10111110111 10101100100 00010000101 01100000011 10001000010 10001001010 00100000011 01101100001 1010', 'checksum': '0110101', 'seed': '1929655fd266457fc620dd471f424b8351999338c837db07ec362dab19f11dbb2c2aff18d0a063a9d91239f81181d0fcebe327c37803b45012a8163fe3b716b6', 'root': {'private_key': 'a01b94f79e8c29ee63b8c27e40ef63f1cfe8f4cac870d0de5d20e889b1d8a13a', 'public_key': '031225fa5e457da949ab1021931887131c7a53c06df0fce4d6a3dd5819aa5776e0', 'xpub': 'xpub661MyMwAqRbcFJsyHbfuQsjnh3qjSfXkxkEXa5JHoSbyU7UNoiXU3FXfcKUbdFqC5cyxexpUAYPZP6K9AU9C4FjfuiX743buQgF5k7BwUND', 'xpriv': 'xprv9s21ZrQH143K2poWBa8u3jo4921F3CoubXJvmgtgF74zbK9EGBDDVTDBm3acAnd1cvowkj1pvi7PK3Ab6XrwYfJPWmQtCp5kor3tbqkreJ6', 'parent_fingerprint': '00', 'fingerprint': '056dd4ec', 'depth': 0, 'index': 0, 'chain_code': '4cf7eb64f359de9cdb7f2c05baf3267a2f1f96e1fc68333c60e92ff3dbbf0b78'}, 'derived_node': {'path': "m/85'/15/76", 'public_key': '02029099fda4c09fa365c85cf785fb790270125bc0d9a584e1707ca2d85209eab2', 'private_key': '921255b836b8215d67d18949b217f3b3edf77cc0d185d37ff85da85d6ca0657e', 'xpub': 'xpub6CnpKCiJ2WSFtjfzoreA69jdgCrLK2vVrzEhvJHHEDjREWLU2SYKwVkMVML9Gt22pMY2aa4RdEXedECPgyoegRy76vaPNpj8QzFwAxeRKmn', 'xpriv': 'xprv9yoTuhBQC8sxgFbXhq79j1nu8B1quaCeVmK77usfftCSMi1KUuE5PhRse7PaX8uh8stKfMGjNGN6ZiXVXBL54daSjmLvEe57u3m8mbGvHGv', 'parent_fingerprint': '9aedbb6f', 'fingerprint': '6ad6b30a', 'depth': 3, 'index': 76, 'chain_code': 'ec33efe03c9ad429a6e2cba47cdbc396ae2bded480c628f760396794e6f52729'}}, {'id': 4, 'entropy': '39281ecca67d16aa629115340d8ad4923bd49ec2d6f17669fce458087ee89a92', 'mnemonic': 'decrease domain rebel erupt sphere festival medal cargo cross hobby release caught run exhaust area taste island exit decorate quote margin inmate heart frog', 'salt': None, 'binary': '00111001001 01000000111 10110011001 01001100111 11010001011 01010101001 10001010010 00100010101 00110100000 01101100010 10110101001 00100100011 10111101010 01001111011 00001011010 11011110001 01110110011 01001111111 00111001000 10110000000 10000111111 01110100010 01101010010 010', 'checksum': '11101001', 'seed': 'c11b0ff978d88c0ae9f7c349733bbd1b7baf2237663e3064a4c62bc4f5a578e4fb14fc43c38f85bfe83a15790397d7a301df5233d7d520cd2cc974cd33ae47b2', 'root': {'private_key': '36f0fcac8ff8e73506ae26aa1db732918e0db5c5635330eaed951e12eacedf3e', 'public_key': '02800f0237e39dce74f506c508985d4d71f8020342d7dfe781ca5cfb73e63eb43e', 'xpub': 'xpub661MyMwAqRbcGYp55aa3wf9WqTuPGdFnwyhFBALErewiMiBkeDrXsZ6qDbUbawSiHVgqvqobbNdosLY7aJgsNVv4DtwPAWKEjgCaSEjvdBg', 'xpriv': 'xprv9s21ZrQH143K44jbyZ33aXCnHS4tsAXwakmeNmvdJKQjUurc6gYHKknMNKtdTiC7jPbnEBmTWDEJ4HpxobatUpEKQgrshDpv8R1NrCkdWyT', 'parent_fingerprint': '00', 'fingerprint': 'ea6be3d5', 'depth': 0, 'index': 0, 'chain_code': 'c989c416cf4c4e3d3708c25893ab6c01bcb9893e153929ab9204eb374ab76a63'}, 'derived_node': {'path': "m/51'", 'public_key': '028f08404abc652f3170f471591cab170f153a0772adf69d33116212f9219537cc', 'private_key': 'e74f8cedbafd94797fd0d21ecb06ccac46721602ccb8a0fe86cdb54335d03691', 'xpub': 'xpub69cS8waJoeNVm5qKbGi2eyspJLHgP1zyZWgFJt2knTHGUhF45C8tthWzJ5cJTKQA77UvXkKvpdGh49ewZhDyQD2vFcSyTz3qjvstaxjPd4F', 'xpriv': 'xprv9vd5jS3QyGpCYbkrVFB2Hqw5kJTByZH8CHkeWVd9E7kHbtuuXepeLuCWSqFQy8o3iwPrPyw5trAwCpW9HvecxQkCNBeHUHmXiAu9mUWDviW', 'parent_fingerprint': 'ea6be3d5', 'fingerprint': '97f01095', 'depth': 1, 'index': 2147483699, 'chain_code': 'bfad5d31ac996363d635dad2304f9582e81ddd7cc8249c3cd5b327706103cb6e'}}]} public_path_mnemonic = 'decrease domain rebel erupt sphere festival medal cargo cross hobby release caught run exhaust area taste island exit decorate quote margin inmate heart frog' public_path = ['xpub661MyMwAqRbcGYp55aa3wf9WqTuPGdFnwyhFBALErewiMiBkeDrXsZ6qDbUbawSiHVgqvqobbNdosLY7aJgsNVv4DtwPAWKEjgCaSEjvdBg', 'xpub69cS8waATyqVK5tryNLyKKHMHzieRM4AQdG5aR9VSe29cJp4EyTrMDLHUi198chSiY86Dh1V57UPCdwSsNUPDKjhSeXvZ3ejvW76pRGFpQe', 'xpub6AB84inF91Uf26fue9dETg5rkNhDwEsWN2kpB7vJWHHuakuMeKPL7onruexAnWhLkEMv7Rjq2aA1z8h6iz4XX6tfRaiuZY83TQi4MR29UCN']
# -*- coding: utf-8 -*- # Copyright 2011 Fanficdownloader team # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ## Just to shut up the appengine warning about "You are using the ## default Django version (0.96). The default Django version will ## change in an App Engine release in the near future. Please call ## use_library() to explicitly select a Django version. For more ## information see ## http://code.google.com/appengine/docs/python/tools/libraries.html#Django" pass
pass
# https://leetcode.com/problems/single-number-iii/ class Solution: def singleNumber(self, nums: List[int]) -> List[int]: d = {} for num in nums: if num in d: d[num] += 1 else: d[num] = 1 result = [] for key, value in d.items(): if value == 1: result.append(key) return result
class Solution: def single_number(self, nums: List[int]) -> List[int]: d = {} for num in nums: if num in d: d[num] += 1 else: d[num] = 1 result = [] for (key, value) in d.items(): if value == 1: result.append(key) return result
# https://stackoverflow.com/questions/1883980/find-the-nth-occurrence-of-substring-in-a-string def find_nth(haystack, needle, n): start = haystack.find(needle) while start >= 0 and n > 1: start = haystack.find(needle, start+len(needle)) n -= 1 return start file_to_be_read = input("Which file do you want to open? (Please specify the full filename.)\n") rtz_file = open(file_to_be_read, 'r') file_to_be_written = input("Which file do you want to write to? (The file ending 'rtz' will be added automagically.)\n") file = open(file_to_be_written + ".rtz", "w") count = 0 schedule_count = 0 date = "2018-04-06" hours = 10 minutes = 40 seconds = 11 for line in rtz_file: line = line.strip() if line: if "<!--" in line: pass else: if line.startswith('<waypoint id="'): count += 1 file.write(line[:14] + str(count) + line[find_nth(line, '"', 2):] + '\n') # file.write(line[:14] + str(count) + line[find_nth(line, '"', 2):]) if "</waypoint><waypoint" in line: count += 1 file.write(line[0:11] + '\n' + line[11:25] + str(count) + line[find_nth(line, '"', 2):] + '\n') # file.write(line[0:11] + '\n' + line[11:25] + str(count) + line[find_nth(line, '"', 2):]) else: if "<waypoint id=" in line: pass else: if "<scheduleElement eta=" in line: pass else: file.write(line + '\n') if "<calculated" in line: for number in range(count): schedule_count += 1 seconds += 13 if seconds < 45: seconds += 14 elif seconds > 59: seconds = 15 if minutes < 59: minutes += 1 elif minutes == 59: minutes = 0 hours += 1 if minutes < 9: file.write('<scheduleElement eta="' + date + "T" + str(hours) + ":0" + str(minutes) + ":" + str(seconds) + '.000Z"' + ' speed="12.00' + '"' + ' waypointId="' + str(schedule_count) + '"/>' + '\n') elif minutes >= 10: file.write('<scheduleElement eta="' + date + "T" + str(hours) + ":" + str(minutes) + ":" + str(seconds) + '.000Z"' + ' speed="12.00' + '"' + ' waypointId="' + str(schedule_count) + '"/>' + '\n') # file.write(line + '\n')
def find_nth(haystack, needle, n): start = haystack.find(needle) while start >= 0 and n > 1: start = haystack.find(needle, start + len(needle)) n -= 1 return start file_to_be_read = input('Which file do you want to open? (Please specify the full filename.)\n') rtz_file = open(file_to_be_read, 'r') file_to_be_written = input("Which file do you want to write to? (The file ending 'rtz' will be added automagically.)\n") file = open(file_to_be_written + '.rtz', 'w') count = 0 schedule_count = 0 date = '2018-04-06' hours = 10 minutes = 40 seconds = 11 for line in rtz_file: line = line.strip() if line: if '<!--' in line: pass else: if line.startswith('<waypoint id="'): count += 1 file.write(line[:14] + str(count) + line[find_nth(line, '"', 2):] + '\n') if '</waypoint><waypoint' in line: count += 1 file.write(line[0:11] + '\n' + line[11:25] + str(count) + line[find_nth(line, '"', 2):] + '\n') elif '<waypoint id=' in line: pass else: if '<scheduleElement eta=' in line: pass else: file.write(line + '\n') if '<calculated' in line: for number in range(count): schedule_count += 1 seconds += 13 if seconds < 45: seconds += 14 elif seconds > 59: seconds = 15 if minutes < 59: minutes += 1 elif minutes == 59: minutes = 0 hours += 1 if minutes < 9: file.write('<scheduleElement eta="' + date + 'T' + str(hours) + ':0' + str(minutes) + ':' + str(seconds) + '.000Z"' + ' speed="12.00' + '"' + ' waypointId="' + str(schedule_count) + '"/>' + '\n') elif minutes >= 10: file.write('<scheduleElement eta="' + date + 'T' + str(hours) + ':' + str(minutes) + ':' + str(seconds) + '.000Z"' + ' speed="12.00' + '"' + ' waypointId="' + str(schedule_count) + '"/>' + '\n')
a=int(input("Enter a number")) if a%2==0: print(a,"is an Even Number") else: print(a,"is an Odd Number")
a = int(input('Enter a number')) if a % 2 == 0: print(a, 'is an Even Number') else: print(a, 'is an Odd Number')
# wczytanie wszystkich trzech plikow with open('../dane/dane5-1.txt') as f: data1 = [] for line in f.readlines(): data1.append(int(line[:-1])) with open('../dane/dane5-2.txt') as f: data2 = [] for line in f.readlines(): data2.append(int(line[:-1])) with open('../dane/dane5-3.txt') as f: data3 = [] for line in f.readlines(): data3.append(int(line[:-1])) # laczy elementy obok siebie ktore maja ten sam znak def squish(data): new_data = [data[0]] prev_sign = data[0] for num in data[1:]: # jezeli pomnozone to te z tym samym znakiem beda dawaly dodatnia liczbe if num * prev_sign > 0: new_data[-1] += num else: new_data.append(num) prev_sign = num return new_data # zwraca najlepsza sume ciagu def best_sum(data): # najlepsza suma rec = -float('inf') # przechodze po kazdym zakresie for start in range(len(data)): # aktualna suma curr_sum = data[start] for end in range(start + 1, len(data)): # zliczenie sumy curr_sum += data[end] # jezeli suma wieksza od rekordu to zapisz if curr_sum > rec: rec = curr_sum return rec rec1 = best_sum(squish(data1)) rec2 = best_sum(squish(data2)) rec3 = best_sum(squish(data3)) # wyswietlenie odpowiedzi answer = f'5 b) Najlepsza suma dla dane5-1.txt: {rec1}; ' answer += f'Najlepsza suma dla dane5-2.txt: {rec2}; ' answer += f'Najlepsza suma dla dane5-3.txt: {rec3}' print(answer)
with open('../dane/dane5-1.txt') as f: data1 = [] for line in f.readlines(): data1.append(int(line[:-1])) with open('../dane/dane5-2.txt') as f: data2 = [] for line in f.readlines(): data2.append(int(line[:-1])) with open('../dane/dane5-3.txt') as f: data3 = [] for line in f.readlines(): data3.append(int(line[:-1])) def squish(data): new_data = [data[0]] prev_sign = data[0] for num in data[1:]: if num * prev_sign > 0: new_data[-1] += num else: new_data.append(num) prev_sign = num return new_data def best_sum(data): rec = -float('inf') for start in range(len(data)): curr_sum = data[start] for end in range(start + 1, len(data)): curr_sum += data[end] if curr_sum > rec: rec = curr_sum return rec rec1 = best_sum(squish(data1)) rec2 = best_sum(squish(data2)) rec3 = best_sum(squish(data3)) answer = f'5 b) Najlepsza suma dla dane5-1.txt: {rec1}; ' answer += f'Najlepsza suma dla dane5-2.txt: {rec2}; ' answer += f'Najlepsza suma dla dane5-3.txt: {rec3}' print(answer)
numbers = list(range(0, 110, 10)) numbers = (0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100) second = [] x = 0 while x < len(numbers): t = numbers[x] *2.5 if t % 2 == 0: second.append(int(t)) x += 1 print(second) print(x)
numbers = list(range(0, 110, 10)) numbers = (0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100) second = [] x = 0 while x < len(numbers): t = numbers[x] * 2.5 if t % 2 == 0: second.append(int(t)) x += 1 print(second) print(x)
class initial(object): pass INITIAL = initial() another = INITIAL print(another is INITIAL)
class Initial(object): pass initial = initial() another = INITIAL print(another is INITIAL)
# Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com) {*[1,2,3], *[4,5,6]} # EXPECTED: [ ..., BUILD_SET_UNPACK(2), ... ]
{*[1, 2, 3], *[4, 5, 6]} [..., build_set_unpack(2), ...]
def capital_indexes(string: str) -> list: return [index for index, char in enumerate(string) if char.isupper()] # return [letter for letter in range(len(indexes)) if indexes[letter].isupper()] def tests() -> None: print(capital_indexes("mYtESt")) # [1, 3, 4] print(capital_indexes("owO")) if __name__ == "__main__": tests()
def capital_indexes(string: str) -> list: return [index for (index, char) in enumerate(string) if char.isupper()] def tests() -> None: print(capital_indexes('mYtESt')) print(capital_indexes('owO')) if __name__ == '__main__': tests()
# dataset settings dataset_type = 'ImageNet' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='RandomResizedCrop', size=224, backend='pillow'), dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'), dict(type='Normalize', **img_norm_cfg), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label']) ] test_pipeline = [ dict(type='LoadImageFromFile'), dict(type='Resize', size=(256, -1), backend='pillow'), dict(type='CenterCrop', crop_size=224), dict(type='Normalize', **img_norm_cfg), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img']) ] data_root = 'data/' data = dict( samples_per_gpu=32, workers_per_gpu=2, train=dict( type=dataset_type, data_prefix=data_root+'imagenet1k/train', ann_file=data_root+'imagenet1k/meta/train.txt', pipeline=train_pipeline), val=dict( type=dataset_type, data_prefix=data_root+'imagenet1k/val', ann_file=data_root+'imagenet1k/meta/val.txt', pipeline=test_pipeline), test=dict( # replace `data/val` with `data/test` for standard test type=dataset_type, data_prefix=data_root+'imagenet1k/val', ann_file=data_root+'imagenet1k/meta/val.txt', pipeline=test_pipeline)) # model settings model = dict( type='ImageClassifier', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(3, ), style='pytorch'), neck=dict(type='GlobalAveragePooling'), head=dict( type='LinearClsHead', num_classes=1000, in_channels=2048, topk=(1, 5), dropout_ratio=0.0, loss=dict( type='LabelSmoothLoss', loss_weight=1.0, label_smooth_val=0.1, num_classes=1000), )) # optimizer optimizer = dict(type='SGD', lr=0.1, momentum=0.9, weight_decay=0.0001) optimizer_config = dict(grad_clip=None) # learning policy #lr_config = dict( # policy='CosineAnnealing', # min_lr=0, # warmup='linear', # warmup_iters=2500, # warmup_ratio=0.25) lr_config = dict(policy='step', step=[30, 60, 90]) runner = dict(type='EpochBasedRunner', max_epochs=100) # checkpoint saving checkpoint_config = dict(interval=100) evaluation = dict(interval=1, metric='accuracy') # yapf:disable log_config = dict( interval=100, hooks=[ dict(type='TextLoggerHook'), # dict(type='TensorboardLoggerHook') ]) # yapf:enable dist_params = dict(backend='nccl') log_level = 'INFO' load_from = None resume_from = None workflow = [('train', 1)]
dataset_type = 'ImageNet' img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) train_pipeline = [dict(type='LoadImageFromFile'), dict(type='RandomResizedCrop', size=224, backend='pillow'), dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'), dict(type='Normalize', **img_norm_cfg), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label'])] test_pipeline = [dict(type='LoadImageFromFile'), dict(type='Resize', size=(256, -1), backend='pillow'), dict(type='CenterCrop', crop_size=224), dict(type='Normalize', **img_norm_cfg), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img'])] data_root = 'data/' data = dict(samples_per_gpu=32, workers_per_gpu=2, train=dict(type=dataset_type, data_prefix=data_root + 'imagenet1k/train', ann_file=data_root + 'imagenet1k/meta/train.txt', pipeline=train_pipeline), val=dict(type=dataset_type, data_prefix=data_root + 'imagenet1k/val', ann_file=data_root + 'imagenet1k/meta/val.txt', pipeline=test_pipeline), test=dict(type=dataset_type, data_prefix=data_root + 'imagenet1k/val', ann_file=data_root + 'imagenet1k/meta/val.txt', pipeline=test_pipeline)) model = dict(type='ImageClassifier', backbone=dict(type='ResNet', depth=50, num_stages=4, out_indices=(3,), style='pytorch'), neck=dict(type='GlobalAveragePooling'), head=dict(type='LinearClsHead', num_classes=1000, in_channels=2048, topk=(1, 5), dropout_ratio=0.0, loss=dict(type='LabelSmoothLoss', loss_weight=1.0, label_smooth_val=0.1, num_classes=1000))) optimizer = dict(type='SGD', lr=0.1, momentum=0.9, weight_decay=0.0001) optimizer_config = dict(grad_clip=None) lr_config = dict(policy='step', step=[30, 60, 90]) runner = dict(type='EpochBasedRunner', max_epochs=100) checkpoint_config = dict(interval=100) evaluation = dict(interval=1, metric='accuracy') log_config = dict(interval=100, hooks=[dict(type='TextLoggerHook')]) dist_params = dict(backend='nccl') log_level = 'INFO' load_from = None resume_from = None workflow = [('train', 1)]
class StakeHolder: def __init__(self, staker, amount_pending_for_approval, amount_approved, block_no_created): self._staker = staker self._amount_pending_for_approval = amount_pending_for_approval self._amount_approved = amount_approved self._block_no_created = block_no_created def to_dict(self): return { "staker": self._staker, "amount_pending_for_approval": self._amount_pending_for_approval, "amount_approved": self._amount_approved, "block_no_created": self._block_no_created } @property def staker(self): return self._staker @property def amount_pending_for_approval(self): return self._amount_pending_for_approval @property def amount_approved(self): return self._amount_approved @property def block_no_created(self): return self._block_no_created
class Stakeholder: def __init__(self, staker, amount_pending_for_approval, amount_approved, block_no_created): self._staker = staker self._amount_pending_for_approval = amount_pending_for_approval self._amount_approved = amount_approved self._block_no_created = block_no_created def to_dict(self): return {'staker': self._staker, 'amount_pending_for_approval': self._amount_pending_for_approval, 'amount_approved': self._amount_approved, 'block_no_created': self._block_no_created} @property def staker(self): return self._staker @property def amount_pending_for_approval(self): return self._amount_pending_for_approval @property def amount_approved(self): return self._amount_approved @property def block_no_created(self): return self._block_no_created