content
stringlengths
7
1.05M
class Helper: @staticmethod def is_Empty(obj): flag = False if obj is None: flag = True elif not obj.strip(): flag = True else: flag = False return flag if __name__ == '__main__': print(Helper.is_Empty(None))
''' Lambda expressions are quick way of creating the anonymous functions: ''' #function without lamda expression: def square(num): return num ** 2 print(square(5)) #converting it into lambda expression: lambda num : num ** 2 #if we want we can assign this to variable like square2 = lambda num : num ** 2. # we are not going to use this very often, cause lamda function are anonymous print(square2(5)) print(list(map(lambda num : num **2, [1,2,3,4]))) ''' Map: map() --> map(func, *iterables) --> map object ''' def square(num): return num ** 2 my_nums = [1,2,3,4,5] #if I wanna get sqaure for all the list items, we can use map function, instead of for loop, for loop is costly #Method 1: for item in map(square, my_nums): print(item) #method 2: list(map(square, my_nums)) def splicer(mystring): if len(mystring) % 2 == 0: return 'EVEN' else: return mystring[0] names = ['andy', 'sally', 'eve'] print(list(map(splicer, names))) ''' Filter: iterate function that returns either true or false ''' def check_even(num): return num % 2 == 0 my_numbers = [1,2,3,4,5,6] print(list(filter(check_even, my_numbers)))
# -*- coding: utf-8 -*- """ \file identity/views.py \brief Implements the core views for django-identity. \author Erich Healy (cactuscommander) [email protected] \author Ryan Leckey (mehcode) [email protected] \copyright Copyright 2012 © Concordus Applications, Inc. All Rights Reserved. """
# Builds the Netty fork of Tomcat Native. See http://netty.io/wiki/forked-tomcat-native.html { 'targets': [ { 'target_name': 'netty-tcnative-so', 'product_name': 'netty-tcnative', 'type': 'shared_library', 'sources': [ 'src/c/address.c', 'src/c/bb.c', 'src/c/dir.c', 'src/c/error.c', 'src/c/file.c', 'src/c/info.c', 'src/c/jnilib.c', 'src/c/lock.c', 'src/c/misc.c', 'src/c/mmap.c', 'src/c/multicast.c', 'src/c/network.c', 'src/c/os.c', 'src/c/os_unix_system.c', 'src/c/os_unix_uxpipe.c', 'src/c/poll.c', 'src/c/pool.c', 'src/c/proc.c', 'src/c/shm.c', 'src/c/ssl.c', 'src/c/sslcontext.c', 'src/c/sslinfo.c', 'src/c/sslnetwork.c', 'src/c/ssl_private.h', 'src/c/sslutils.c', 'src/c/stdlib.c', 'src/c/tcn_api.h', 'src/c/tcn.h', 'src/c/tcn_version.h', 'src/c/thread.c', 'src/c/user.c', ], 'include_dirs': [ '../apache-portable-runtime/src/include', ], 'defines': [ 'HAVE_OPENSSL', ], 'cflags': [ '-w', ], 'dependencies': [ '../apache-portable-runtime/apr.gyp:apr', '../boringssl/boringssl.gyp:boringssl', ], 'variables': { 'use_native_jni_exports': 1, }, }, { 'target_name': 'netty-tcnative', 'type': 'none', 'variables': { 'java_in_dir': 'src/java', 'javac_includes': [ '**/org/apache/tomcat/jni/*.java' ], 'run_findbugs': 0, }, 'includes': [ '../../build/java.gypi' ], 'dependencies': [ 'netty-tcnative-so', 'rename_netty_tcnative_so_file', ], 'export_dependent_settings': [ 'rename_netty_tcnative_so_file', ], }, { # libnetty-tcnative shared library should have a specific name when # it is copied to the test APK. This target renames (actually makes # a copy of) the 'so' file if it has a different name. 'target_name': 'rename_netty_tcnative_so_file', 'type': 'none', 'conditions': [ ['component=="shared_library"', { 'actions': [ { 'action_name': 'copy', 'inputs': ['<(PRODUCT_DIR)/lib/libnetty-tcnative.cr.so'], 'outputs': ['<(PRODUCT_DIR)/lib/libnetty-tcnative.so'], 'action': [ 'cp', '<@(_inputs)', '<@(_outputs)', ], }], }], ], 'dependencies': [ 'netty-tcnative-so', ], 'direct_dependent_settings': { 'variables': { 'netty_tcnative_so_file_location': '<(PRODUCT_DIR)/lib/libnetty-tcnative.so', }, }, }, ], }
#!/usr/bin/python3 def set_dependencies(source_nodes): """Sets contract node dependencies. Arguments: source_nodes: list of SourceUnit objects. Returns: SourceUnit objects where all ContractDefinition nodes contain 'dependencies' and 'libraries' attributes.""" symbol_map = get_symbol_map(source_nodes) contract_list = [x for i in source_nodes for x in i if x.nodeType == "ContractDefinition"] # add immediate dependencies for contract in contract_list: contract.dependencies = set() contract.libraries = dict( (_get_type_name(i.typeName), i.libraryName.name) for i in contract.nodes if i.nodeType == "UsingForDirective" ) # listed dependencies for key in contract.contractDependencies: contract.dependencies.add(symbol_map[key]) # using .. for libraries for node in contract.children(filters={"nodeType": "UsingForDirective"}): ref_node = symbol_map[node.libraryName.referencedDeclaration] contract.libraries[_get_type_name(node.typeName)] = ref_node contract.dependencies.add(ref_node) # imported contracts used as types in assignment for node in contract.children(filters={"nodeType": "UserDefinedTypeName"}): ref_id = node.referencedDeclaration if ref_id in symbol_map: contract.dependencies.add(symbol_map[ref_id]) # imported contracts as types, no assignment for node in contract.children( filters={"nodeType": "FunctionCall", "expression.nodeType": "Identifier"} ): if node.typeDescriptions["typeString"].startswith("contract "): ref_id = node.expression.referencedDeclaration if ref_id in symbol_map: contract.dependencies.add(symbol_map[ref_id]) # unlinked libraries for node in contract.children(filters={"nodeType": "Identifier"}): ref_node = symbol_map.get(node.referencedDeclaration) if ref_node is None: continue if ref_node.nodeType in ("EnumDefinition", "StructDefinition"): contract.dependencies.add(ref_node) if ref_node.nodeType == "ContractDefinition" and ref_node.contractKind == "library": contract.dependencies.add(ref_node) # prevent recursion errors from self-dependency contract.dependencies.discard(contract) # add dependencies of dependencies for contract in contract_list: current_deps = contract.dependencies while True: expanded_deps = set(x for i in current_deps for x in getattr(i, "dependencies", [])) expanded_deps |= current_deps expanded_deps.discard(contract) if current_deps == expanded_deps: break current_deps = expanded_deps current_deps |= {symbol_map[i] for i in contract.linearizedBaseContracts} contract.dependencies = current_deps # convert dependency sets to lists for contract in contract_list: if contract in contract.dependencies: # a contract should not list itself as a dependency contract.dependencies.remove(contract) contract.dependencies = sorted(contract.dependencies, key=lambda k: k.name) return source_nodes def get_symbol_map(source_nodes): """Generates a dict of {'id': SourceUnit} used for linking nodes. Arguments: source_nodes: list of SourceUnit objects.""" symbol_map = {} for node in source_nodes: for key, value in ((k, x) for k, v in node.exportedSymbols.items() for x in v): try: symbol_map[value] = node[key] except KeyError: # solc >=0.7.2 may include exported symbols that reference # other contracts, handle this gracefully pass return symbol_map def _get_type_name(node): if node is None: return None if hasattr(node, "name"): return node.name if hasattr(node, "typeDescriptions"): return node.typeDescriptions["typeString"] return None
# https://www.acmicpc.net/problem/9020 if __name__ == '__main__': input = __import__('sys').stdin.readline N = 10_001 T = int(input()) is_prime = [True for _ in range(N)] sqrt = int(N ** (1 / 2)) is_prime[0] = is_prime[1] = False for idx in range(2, sqrt + 1): if not is_prime[idx]: continue for num in range(idx + idx, N, idx): is_prime[num] = False for _ in range(T): N = int(input()) for num in range(N // 2, -1, -1): if is_prime[num] and is_prime[N - num]: print(num, N - num) break
def bin_value(num): return bin(num) [2:] def remove0b(num): return num [2:] numberA = int(input("")) numberB = int(input("")) binaryA = bin_value(numberA) binaryB = bin_value(numberB) sum = bin(int(binaryA,2) + int(binaryB,2)) cleaned = remove0b(sum) binaryA = str(binaryA) binaryB = str(binaryB) sum = str(cleaned) answer = binaryA + " + " + binaryB + " = " + sum print(answer)
# HEAD # Classes - Setters are shallow # DESCRIPTION # Describes how setting of inherited attributes and values function # RESOURCES # # Creating Parent class class Parent(): par_cent = "parent" # Parent Init method def __init__(self, val): self.par_cent = val print("Parent Instantiated with ", self.par_cent) # Creating ParentTwo class class Child(Parent): # Child Init method def __init__(self, val_two): print("Child Instantiated with ", val_two) # Explicit Instantiation of parent init # Instantiate parent once and passing args # Parent assigns value storing it in object to access # Parent default value remains self.p = super() self.p.__init__(val_two) obj = Child(10) print(""" Value of par_cent is assigned & fetched from Child class & default refs of parent remains """) print("obj.par_cent", obj.par_cent) print("obj.p.par_cent, id(obj.p), id(obj)", obj.p.par_cent, id(obj.p), id(obj))
#!/usr/bin/env python # encoding: utf-8 ''' @author: Jason Lee @license: (C) Copyright @ Jason Lee @contact: [email protected] @file: jianzhi_offer_31.py @time: 2019/4/23 16:09 @desc: ''' class Solution: def FindGreatestSumOfSubArray(self, array): if not array: return 0 f = array for i in range(1, len(array)): if f[i-1] <= 0: f[i] = array[i] else: f[i] = f[i-1] + array[i] return max(f) if __name__ == '__main__': res = Solution() array = [6,-3,-2,7,-15,1,2,2] b = res.FindGreatestSumOfSubArray(array) print(b)
def get_eig_Jacobian(pars, fp): """ Simulate the Wilson-Cowan equations Args: pars : Parameter dictionary fp : fixed point (E, I), array Returns: evals : 2x1 vector of eigenvalues of the Jacobian matrix """ #get the parameters tau_E, a_E, theta_E = pars['tau_E'], pars['a_E'], pars['theta_E'] tau_I, a_I, theta_I = pars['tau_I'], pars['a_I'], pars['theta_I'] wEE, wEI = pars['wEE'], pars['wEI'] wIE, wII = pars['wIE'], pars['wII'] I_ext_E, I_ext_I = pars['I_ext_E'], pars['I_ext_I'] #initialization E = fp[0] I = fp[1] J = np.zeros((2,2)) #Jacobian matrix J[0,0] = (-1 + wEE*dF(wEE*E-wEI*I+I_ext_E,a_E,theta_E))/tau_E #dGE_dE J[0,1] = (-wEI*dF(wEE*E-wEI*I+I_ext_E,a_E,theta_E))/tau_E #dGE_dI J[1,0] = (wIE*dF(wIE*E-wII*I+I_ext_I,a_I,theta_I))/tau_I #dGI_dE J[1,1] = (-1 - wII*dF(wIE*E-wII*I,a_I+I_ext_I,theta_I))/tau_I #dGI_dI # Eigenvalues evals = np.linalg.eig(J)[0] return evals eig_1 = get_eig_Jacobian(pars, x_fp_1) eig_2 = get_eig_Jacobian(pars, x_fp_2) eig_3 = get_eig_Jacobian(pars, x_fp_3) print(eig_1, 'Stable point') print(eig_2, 'Unstable point') print(eig_3, 'Stable point')
k, n, w = map(int, input().split()) x = 1 money = 0 while x <= w and money != -1: money += k * x x += 1 money_toborrow = money - n if money_toborrow >= 0: print(money_toborrow) else: print(0)
def fatorial (n): r = 1 for num in range (n, 1, -1): r *= num return r def dobro (n): num = n * 2 return num def triplo (n): num = n * 3 return num
#####################################Data class class RealNews(object): def __init__(self, date, headline, description,distype, url="", imageurl="",location=""): self.date = date self.headline = headline self.description = description self.url = url self.distype = distype self.imageurl = imageurl self.location = location @staticmethod def from_dict(source): self.date = source['date'] self.headline = source['headline'] self.description = source['description'] self.url = source['url'] self.distype = source['distype'] self.imageurl = source['imageurl'] self.location = source['location'] def to_dict(self): return { 'date': self.date, 'headline' : self.headline, 'description' : self.description, 'url' : self.url, 'distype' : self.distype, 'imageurl' : self.imageurl, 'location' : self.location, } def __repr__(self): return(f"News( date: {self.date}, headline : {self.headline}, description : {self.description}, url : {self.url}, distype : {self.distype}, imageurl : {self.imageurl}, location : {self.location})") #####################################write Data # date = input('Enter date: ') # headline = input('Enter headlines: ') # description = input('Enter description: ') # distype = input('Enter disaster type: ') # url = input('Enter url: ') # imageurl = input('Enter image url: ') # location = input('Enter location: ')
bicicleta=["bike","cannon","cargo", "CALOI"] #Armazenamento de farias mensagens/lista em uma string print(bicicleta[0].title()) print(bicicleta[1]) print(bicicleta[2]) print(bicicleta[3]) print(bicicleta[-1]) print(bicicleta[-2]) print(bicicleta[-3]) print(bicicleta[-4].title()) #como imprimir uma mensagem especifica de uma strings que contem varias mensagens/listas mensagem="Minha Primeira Bicicleta foi uma " + bicicleta[3].title() + "!" print(mensagem)
""" Utilitary methods to display ouputs """ # Add color to a string def str_color(message, rgbcol): r, g, b = rgbcol return "\033[38;2;{};{};{}m{}\033[0m".format(r, g, b, message) # print(squares from a palette) def print_palette(rgbcols, size=2): str_palette = "" for col in rgbcols: str_palette += str_color("██"*size, col) # for s in range(size): print(str_palette)
class Subtract: def __init__(self,fnum,snum): self.fnum=fnum self.snum=snum def allSub(self): self.sub=self.fnum-self.snum return self.sub
model = Sequential() model.add(LSTM(50, return_sequences = True, input_shape = (x_train.shape[1], 1))) model.add(LSTM(50, return_sequences = False)) model.add(Dense(25)) model.add(Dense(1)) #Compiling the model model.compile(optimizer = 'adam', loss = 'mean_squared_error') #using rmse
DEFAULT_REDIS_PORT = 6379 # Number of seconds to sleep upon successful end to allow graceful termination of subprocesses. TERMINATION_TIME = 3 # Max caps on parameters MAX_NUM_STEPS = 10000 MAX_OBSERVATION_DELTA = 5000 MAX_VIDEO_FPS = 60
# -*- coding: utf-8 -*- """Utils for celery.""" def init_celery(celery, app): celery.conf.update(app.config) celery.conf.update( task_serializer='json', accept_content=['json'], # Ignore other content result_serializer='json', timezone='Europe/Berlin', enable_utc=True ) TaskBase = celery.Task class ContextTask(TaskBase): abstract = True def __call__(self, *args, **kwargs): with app.app_context(): return TaskBase.__call__(self, *args, **kwargs) celery.Task = ContextTask
key = input().strip() value = input().strip() count = int(input()) result = '' for entry in range(count): keys, values = input().split(' => ') if key in keys: result += f'{keys}:\n' if value in values: all_values = '\n'.join([f'-{v}' for v in values.split(';') if value in v]) result += f'{all_values}\n' print(result)
""" Written by Jesse Evers Finds the factorial of a number. """ def factorial(num): # While num > 1, multiply num by num - 1 if num > 1: return num * factorial(num - 1) return num print(factorial(10))
n1 = float(input('Primeiro número: ')) n2 = float(input('Segundo número: ')) n3 = float(input('Terceiro número: ')) menor = n1 if n2<n1 and n2<n3: menor = n2 if n3<n1 and n3<n2: menor = n3 maior = n1 if n2>n1 and n2>n3: maior = n2 if n3>n1 and n3>n2: maior = n3 print('{} é o maior'.format(maior)) print('{} é o menor'.format(menor)) '''if n1 > n2: if n1 > n3: if n2 > n3: print('{} é o maior'.format(n1)) print('{} é o menor'.format(n3)) else: print('{} é o maior'.format(n1)) print('{} é o menor'.format(n2)) else: print('{} é o maior'.format(n3)) print('{} é o menor'.format(n2)) else: if n1 > n3: print('{} é o maior'.format(n2)) print('{} é o menor'.format(n3)) else: if n2 > n3: print('{} é o maior'.format(n2)) print('{} é o menor'.format(n1)) else: print('{} é o maior'.format(n3)) print('{} é o menor'.format(n1))'''
''' Author : MiKueen Level : Medium Problem Statement : Product of Array Except Self Given an array nums of n integers where n > 1, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i]. Example: Input: [1,2,3,4] Output: [24,12,8,6] Constraint: It's guaranteed that the product of the elements of any prefix or suffix of the array (including the whole array) fits in a 32 bit integer. Note: Please solve it without division and in O(n). Follow up: Could you solve it with constant space complexity? (The output array does not count as extra space for the purpose of space complexity analysis.) ''' class Solution: def productExceptSelf(self, nums: List[int]) -> List[int]: # Time Complexity - O(n) # Space Complexity - O(1) res = [1] * len(nums) left = right = 1 for i in range(len(nums)): j = -(i+1) res[i] *= left res[j] *= right left *= nums[i] right *= nums[j] return res
name = str(input()) salary = float(input()) sales = float(input()) total = salary + (sales * 0.15) print(f'TOTAL = R$ {total:.2f}')
class Parameters: WINDOW_WIDTH = 500 WINDOW_HEIGHT = 600 BASE_HEIGHT = 100 BASE_IMAGE = "base.png" BACKGROUND_IMAGE = "bg.png" BIRD_IMAGES = ["bird1.png", "bird2.png", "bird3.png"] PIPE_IMAGES = ["pipe.png"]
# It make a node class node: def __init__(self, symbol): self.symbol = symbol self.edges = [] self.shortest_distance = float('inf') self.shortest_path_via = None # Adds another node as a weighted edge def add_edge(self, node, distance): self.edges.append([node, distance]) # Checks every node it has an edge to, and updates it if neccessary def update_edges(self): for edge in self.edges: distance_via = self.shortest_distance + edge[1] if distance_via < edge[0].shortest_distance: edge[0].shortest_distance = distance_via edge[0].shortest_path_via = self def get_node(nodes, symbol): """ Searches "nodes" for node with symbol "symbol" and returns it if found. PARAMS:\n nodes (array): array of nodes to search from symbol (str): string to search matches for RETURNS:\n node: if match is found None: if no match found """ for node in nodes: if node.symbol == symbol: return node return None def make_nodes(edge_data, *args): """ Takes an array of edges and makes them into node objects. PARAMS: edge_data (arr): array of edges with format [start_node (str), end_node (str), distance (int)] *args (boolean): True if you want digraph, False if not (default is True) Can save time when entering edges by hand. *args (array[str]): array of symbols to use for nodes that may not have edges and are not included in "edge_data" RETURNS: array: array of the nodes that it created """ nodes = [] # Decide if digraph or not if len(args) > 0: digraph = args[0] else: digraph = False # Fill in empty nodes if len(args) > 1: for symbol in args[1]: nodes.append(node(symbol)) # Make edges into nodes and couple them for edge in edge_data: node1 = get_node(nodes, edge[0]) node2 = get_node(nodes, edge[1]) if node1 == None: node1 = node(edge[0]) if node2 == None: node2 = node(edge[1]) node1.add_edge(node2, edge[2]) if not digraph: node2.add_edge(node1, edge[2]) # REMOVE THIS IF YOU WANT DIGRAPH 2/2 if node1 not in nodes: nodes.append(node1) if node2 not in nodes: nodes.append(node2) return nodes def get_path_array(node): """ Takes an end node and gives you every node (in order) for the shortest path to it. PARAMS: node (node): end node RETURNS: array[nodes]: every note you need to visit (in order) """ if node.shortest_path_via == None: return [node] else: return get_path_array(node.shortest_path_via) + [node] def dijkstra(nodes, start, end): """ Finds the fastest way from "start" to "end" (usually what dijkstra does). PARAMS: nodes (array): array of nodes start (node): start of path end (node): end of path RETURNS array[node]: path of nodes from "start" to "end" (inclusive) if one is found None: if no path is found """ queue = [] path = [] # Setup queue = nodes.copy() start.shortest_distance = 0 queue.sort(key=lambda node: node.shortest_distance) # Exploration loop while queue[0] != end: node = queue[0] node.update_edges() path.append(queue.pop(0)) queue.sort(key=lambda node: node.shortest_distance) # Test if there actually was a path found if end.shortest_distance == float('inf'): print("End has not been found") return None return get_path_array(end)
d=dict() for _ in range(int(input())): s=input().split(' ',1) d[s[0]]=list(map(int,s[1].split())) d=dict(sorted(d.items(), key=lambda x: x[0])) d=dict(sorted(d.items(), key=lambda x: x[1][2],reverse=True)) d=dict(sorted(d.items(), key=lambda x: x[1][1],reverse=True)) d=dict(sorted(d.items(), key=lambda x: x[1][0],reverse=True)) for i,j in d.items():print(i,*j,sep=" ")
def my_func(count=4): for i in range (1, 5): print("count", count) if count == 2: print("count", count) count = count - 1 my_func()
""" 217. Contains Duplicate https://leetcode.com/problems/contains-duplicate/ Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct. Example: Input: [1,2,3,1] Output: true """ # Runtime: 128ms class Solution: def containsDuplicate(self, nums: List[int]) -> bool: hash_map = {} for num in nums: if num not in hash_map: hash_map[num] = hash_map.get(0, num,) + 1 else: return True return False
class Aumento: codigo = 0 nome = '' preco = 0.0 aumento = 0.0 def main(): p = Aumento() p.codigo = int(input('Informe o código do produto: ')) p.nome = str(input('Informe o nome do produto: ')) p.preco = float(input('Informe o preço do produto: R$ ')) p.aumento = (p.preco*0.1) + p.preco print(f'valor com aumento = R$ {p.aumento:.2f}.') main()
s = str(input()) ss = ''.join(list(reversed(s))) sss = ss[:2] ssss = ''.join(list(reversed(sss))) print(ssss)
num=5 for i in range(1,num+1): toPrint="" end=int(i*(i+1)/2) a=list(j for j in range(end+1-i,end+1)) for x in a: toPrint+=" "+str(x) print(toPrint) toPrint="" #output ''' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 '''
if __name__ == '__main__': x = int(input()) y = int(input()) z = int(input()) n = int(input()) ar = [] #p=0 for i in range(x+1): for j in range(y+1): for k in range(z+1): if (i+j+k) != n: ar.append([i,j,k]) print(ar) """for i in range ( x + 1 ): for j in range( y + 1): if i+j != n: ar.append([]) ar[p] = [ i , j ] p+=1 print ar """
expected_output = { 'mstp': { 'mst_instances': { 0: { 'mst_id': 0, 'bridge_priority': 32768, 'bridge_sysid': 0, 'bridge_address': '00e3.04ff.ad03', 'topology_change_flag': False, 'topology_detected_flag': False, 'topology_changes': 0, 'time_since_topology_change': '142:22:13', 'times': { 'hold': 1, 'topology_change': 70, 'notification': 10, 'max_age': 40, 'hello': 10, 'forwarding_delay': 30, }, 'timers' : { 'hello': 0, 'topology_change': 0, 'notification': 0, }, 'root_of_the_spanning_tree': True, 'interfaces': { 'Port-channel30': { 'name': 'Port-channel30', 'bridge_assurance_inconsistent': True, 'vpc_peer_link_inconsistent': True, 'port_num': 4125, 'status': 'broken', 'cost': 500, 'port_priority': 128, 'port_identifier': '128.4125', 'designated_root_priority': 32768, 'designated_root_address': '0023.04ff.ad03', 'designated_bridge_priority': 61440, 'designated_bridge_address': '4055.39ff.fee7', 'designated_port_id': '128.4125', 'designated_path_cost': 0, 'timers': { 'message_age': 0, 'forward_delay': 0, 'hold': 0, }, 'port_type' : 'network', 'number_of_forward_transitions': 0, 'link_type': 'point-to-point', 'internal': True, 'peer_type': 'STP', 'pvst_simulation': True, 'counters': { 'bpdu_sent': 110, 'bpdu_received': 0 } } } } }, 'hello_time': 10, 'max_age': 40, 'forwarding_delay': 30 } }
#THIS IS HANGMAN print('"Hangman"\nA game where you will try to guess which the hidden word is!') print('\n') word = input('Input the word to guess:\n') while True: if word.isalpha(): break else: word = input('Wrong input, type a valid word:\n') number_of_letters = len(word) word_listed_letters = list(word) print('\n'*15 + 'This space is given for hiding the word\n') print('_ '*(number_of_letters - 1) + '_') letters = [letter for letter in bytearray(range(97, 123)).decode("utf-8")] letters_left = letters #Function to check if the letter to use is valid def isletter(): letter = input('') while True: if letter in letters_left: break else: letter = input('Wrong input, type a valid letter:\n') return letter #Function to display the hangman according to the chances remaining def hangman_display(c): if c == 1: print('-'*10) elif c == 2: print('|\n'*10) hangman_display(1) elif c == 3: print('_'*6) hangman_display(2) elif c == 4: print('_'*6) print('| |\n'*3 + '|\n'*7) elif c == 5: print('_'*6) print('| |\n'*3 + '| O\n' + '|\n'*6) elif c == 6: print('_' * 6) print('| |\n' * 3 + '| O\n' + '| |' + '|\n' * 5) elif c == 7: print('_' * 6) print('| |\n' * 3 + '| O\n' + '| |\n' + '| /|\n' + '|\n' * 5) elif c == 8: print('_' * 6) print('| |\n' * 3 + '| O\n' + '| |\n' + '| /|\\\n' + '|\n' * 5) elif c == 9: print('_' * 6) print('| |\n' * 3 + '| O\n' + '| |\n' + '| /|\\\n' + '/\n' + '|\n' * 4) elif c == 10: print('_' * 6) print('| |\n' * 3 + '| O\n' + '| |\n' + '| /|\\\n' + '/\\\n' + '|\n' * 4) '''count = 0 if try in word: ind = [i for i in range(number_of_letters) if word[i] == try] else: letters_left.remove(try) count += 1 hangman_display(count) ''' while True: #To check if the input is a valid letter while True: letter = input('\nInput letter to guess:\n') if letter in letters_left: break else: letter = input('Wrong input, type a valid letter:\n') if letter in word: position = [p for p in range(number_of_letters) if word[p] == letter] for times in range(len(position)): blanks = position[0] print('_ ' * blanks + word[position[0]] + ' ', end='') if len(position) > 1: blanks = position[1] - position[0] - 1 position = position[1:]
dataset_type = "SuperviselyDataset" data_root = '/data/slyproject' class_names = ['Car', 'Pedestrian', 'Cyclist', 'DontCare'] point_cloud_range = [0, -40, -3, 70.4, 40, 1] input_modality = dict(use_lidar=True, use_camera=False) file_client_args = dict(backend='disk') # db_sampler = dict( # data_root=data_root, # info_path=data_root + 'train/dataset.npy', # rate=1.0, # prepare=dict( # filter_by_difficulty=[-1], # filter_by_min_points=dict(Car=5, Pedestrian=10, Cyclist=10)), # classes=class_names, # sample_groups=dict(Car=1, Pedestrian=1, Cyclist=1), # points_loader=dict( # type='LoadPointsFromSlyFile', # coord_type='LIDAR', # load_dim=4, # use_dim=[0, 1, 2, 3], # file_client_args=file_client_args)) train_pipeline = [ dict( type='LoadPointsFromSlyFile'), dict( type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True), #dict(type='ObjectSample', db_sampler=db_sampler), dict(type='RandomFlip3D', flip_ratio_bev_horizontal=0.5), dict( type='GlobalRotScaleTrans', rot_range=[-0.78539816, 0.78539816], scale_ratio_range=[0.95, 1.05]), dict(type='PointsRangeFilter', point_cloud_range=point_cloud_range), dict(type='ObjectRangeFilter', point_cloud_range=point_cloud_range), dict(type='PointShuffle'), dict(type='DefaultFormatBundle3D', class_names=class_names), dict(type='Collect3D', keys=['points', 'gt_bboxes_3d', 'gt_labels_3d']) ] test_pipeline = [ dict(type='LoadPointsFromSlyFile')] # construct a pipeline for data and gt loading in show function # please keep its loading function consistent with test_pipeline (e.g. client) eval_pipeline = [ dict( type='LoadPointsFromSlyFile'), dict( type='DefaultFormatBundle3D', class_names=class_names, with_label=False), dict(type='Collect3D', keys=['points']) ] data = dict( samples_per_gpu=1, workers_per_gpu=1, train=dict( type='RepeatDataset', times=2, dataset=dict( type=dataset_type, data_root=data_root)), val=dict( type=dataset_type, data_root=data_root), test=dict( type=dataset_type, data_root=data_root)) evaluation = dict(interval=1, pipeline=eval_pipeline)
LIST_ASSIGNED_USER_ROLE_RESPONSE = """ [ { "id": "IFIFAX2BIRGUSTQ", "label": "Application Administrator", "type": "APP_ADMIN", "status": "ACTIVE", "created": "2019-02-06T16:17:40.000Z", "lastUpdated": "2019-02-06T16:17:40.000Z", "assignmentType": "USER", "_links": { "assignee": { "href": "http://{yourOktaDomain}/api/v1/users/00ur32Vg0fvpyHZeQ0g3" } } }, { "id": "JBCUYUC7IRCVGS27IFCE2SKO", "label": "Help Desk Administrator", "type": "HELP_DESK_ADMIN", "status": "ACTIVE", "created": "2019-02-06T16:17:40.000Z", "lastUpdated": "2019-02-06T16:17:40.000Z", "assignmentType": "USER", "_links": { "assignee": { "href": "http://{yourOktaDomain}/api/v1/users/00ur32Vg0fvpyHZeQ0g3" } } } ] """ LIST_ASSIGNED_GROUP_ROLE_RESPONSE = """ [ { "id": "IFIFAX2BIRGUSTQ", "label": "Application Administrator", "type": "APP_ADMIN", "status": "ACTIVE", "created": "2019-02-27T14:48:59.000Z", "lastUpdated": "2019-02-27T14:48:59.000Z", "assignmentType": "GROUP", "_links": { "assignee": { "href": "http://{yourOktaDomain}/api/v1/groups/00gsr2IepS8YhHRFf0g3" } } }, { "id": "JBCUYUC7IRCVGS27IFCE2SKO", "label": "Help Desk Administrator", "type": "HELP_DESK_ADMIN", "status": "ACTIVE", "created": "2019-02-06T16:17:40.000Z", "lastUpdated": "2019-02-06T16:17:40.000Z", "assignmentType": "GROUP", "_links": { "assignee": { "href": "http://{yourOktaDomain}/api/v1/users/00ur32Vg0fvpyHZeQ0g3" } } } ] """
while True: num = int(input("Enter a number: ")) if num % 2 == 0: print(num, "is an even number") else: print(f"{num} is a odd number")
# Initialisierung mit () tupel_eins = (1, True, 4.5, "hallo") # Elemente abfragen wie bei Listen viereinhalb = tuple_eins[2] #4.5 hallo = tuple_eins[-1] #'hello' vordere = tuple_eins[:2] #(1, True) # Elemente verändern, unmöglich ! tupel_eins[0] = "neuer Wert" #TypeError # Ganzes Tuple austauschen, möglich ! tupel_eins = ("neuer Wert", True, 4.5, "hallo") # mehrere Werte gleichzeitig abfragen positions_tupel = (45.65, 198.12) (x, y) = positions_tuple # x: 45.65, y: 198.12 # unter anderem nützlich für startwerte (x, y, z) = (0, 100, 200) #x: 0, y: 100, z:200 # Liste zu Tupel umwandeln liste = [1,2,3] tupel_aus_liste = tuple(liste)
__package_name__ = 'python-utils' __version__ = '2.5.0' __author__ = 'Rick van Hattem' __author_email__ = '[email protected]' __description__ = ( 'Python Utils is a module with some convenient utilities not included ' 'with the standard Python install') __url__ = 'https://github.com/WoLpH/python-utils'
class BBUtil(object): def __init__(self,width,height): super(BBUtil, self).__init__() self.width=width self.height=height def xywh_to_tlwh(self, bbox_xywh): x,y,w,h = bbox_xywh xmin = max(int(round(x - (w / 2))),0) ymin = max(int(round(y - (h / 2))),0) return [xmin,ymin,int(w),int(h)] def tlwh_to_xyxy(self, bbox_tlwh): x,y,w,h = bbox_tlwh x1 = max(int(x),0) x2 = min(int(x+w),self.width-1) y1 = max(int(y),0) y2 = min(int(y+h),self.height-1) return [x1,y1,x2,y2] def xywh_to_xyxy(self, bbox_xywh): x,y,w,h = bbox_xywh x1 = max(int(x-w/2),0) x2 = min(int(x+w/2),self.width-1) y1 = max(int(y-h/2),0) y2 = min(int(y+h/2),self.height-1) return [x1,y1,x2,y2] def xyxy_to_tlwh(self, bbox_xyxy): x1,y1,x2,y2 = bbox_xyxy t = x1 l = y1 w = int(x2-x1) h = int(y2-y1) return [t,l,w,h] def float_to_int(self,bbox_xyxy): x1,y1,x2,y2 = bbox_xyxy return [int(x1*self.width), int(y1*self.height), int(x2*self.width), int(y2*self.height)] def int_to_float(self,bbox_xyxy): x1,y1,x2,y2 = [float(item) for item in bbox_xyxy] return [x1/self.width, y1/self.height, x2/self.width, y2/self.height]
class Storage: __storage = 0 def __init__(self, capacity): self.capacity = capacity self.storage = [] def add_product(self, product): if not Storage.__storage == self.capacity: self.storage.append(product) Storage.__storage += 1 def get_products(self): return self.storage
# A CAN bus. class Bus(object): """A CAN bus. """ def __init__(self, name, comment=None, baudrate=None, fd_baudrate=None, autosar_specifics=None): self._name = name # If the 'comment' argument is a string, we assume that is an # English comment. This is slightly hacky, because the # function's behavior depends on the type of the passed # argument, but it is quite convenient... if isinstance(comment, str): # use the first comment in the dictionary as "The" comment self._comments = { None: comment } else: # assume that we have either no comment at all or a # multi-lingual dictionary self._comments = comment self._baudrate = baudrate self._fd_baudrate = fd_baudrate self._autosar = autosar_specifics @property def name(self): """The bus name as a string. """ return self._name @property def comment(self): """The bus' comment, or ``None`` if unavailable. Note that we implicitly try to return the English comment if multiple languages were specified. """ if self._comments is None: return None elif self._comments.get(None) is not None: return self._comments.get(None) elif self._comments.get("FOR-ALL") is not None: return self._comments.get("FOR-ALL") return self._comments.get('EN') @property def comments(self): """The dictionary with the descriptions of the bus in multiple languages. ``None`` if unavailable. """ return self._comments @property def baudrate(self): """The bus baudrate, or ``None`` if unavailable. """ return self._baudrate @property def fd_baudrate(self): """The baudrate used for the payload of CAN-FD frames, or ``None`` if unavailable. """ return self._fd_baudrate @property def autosar(self): """An object containing AUTOSAR specific properties of the bus. """ return self._autosar @autosar.setter def autosar(self, value): self._autosar = value def __repr__(self): return "bus('{}', {})".format( self._name, "'" + self.comment + "'" if self.comment is not None else None)
def signFinder (s): plus = s.count("-") minus = s.count("+") total = plus+minus if total == 1: return True else: return False
"""Postgres Connector error classes.""" class PostgresConnectorError(Exception): """Base class for all errors.""" class PostgresClientError(PostgresConnectorError): """An error specific to the PostgreSQL driver."""
def binary_search(arr, target): low, high = 0, len(arr)-1 while low < high: mid = (low + high)/2 if arr[mid] == target: return mid elif arr[mid] > target: high = mid - 1 else: low = mid + 1 return high if __name__ == "__main__": lst = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] print(binary_search(lst,15))
''' Write a function that takes a string of braces, and determines if the order of the braces is valid. It should return true if the string is valid, and false if it's invalid. This Kata is similar to the Valid Parentheses Kata, but introduces new characters: brackets [], and curly braces {}. Thanks to @arnedag for the idea! All input strings will be nonempty, and will only consist of parentheses, brackets and curly braces: ()[]{}. What is considered Valid? A string of braces is considered valid if all braces are matched with the correct brace. Examples "(){}[]" => True "([{}])" => True "(}" => False "[(])" => False "[({})](]" => False ''' # 别人实现的,我抄了一个一个题的实现办法,但显然脑筋没有能急转弯 def validBraces(s): while '{}' in s or '()' in s or '[]' in s: s = s.replace('{}', '') s = s.replace('[]', '') s = s.replace('()', '') return s == '' opposite = {')': '(', ']': '[', '}': '{'} keys = [')', ']', '}'] def dirReduc(plan): new_plan = [] for d in plan: if d in keys: if new_plan and new_plan[-1] == opposite[d]: new_plan.pop() else: new_plan.append(d) else: new_plan.append(d) if len(new_plan) > 0: return False return True if __name__ == '__main__': print(dirReduc('[({})](]'))
#EP1 ''' def getPentagonalNumber(n): i = 1 for i in range(1,n+1): s = (i*(3*i-1)*1.0)/2 print (str(s)+' ',end='') if i%10==0: print() getPentagonalNumber(100) ''' #EP2 ''' def sum(n): s= 0 while(n%10!=0): a=n%10 b=n//10 s=s+a n=b print(s) a= eval(raw_input("enter a int:")) sum(a) ''' #EP3 ''' def display(n1,n2,n3): b=[n1,n2,n3] b.sort() print(b) a1,a2,a3=eval(raw_input("enter three numbers:")) display(a1,a2,a3) ''' #EP4 ''' inves = eval(input("the amount inversted:")) monthly = eval(input("annual interest rate:")) print("annual\tfuture value") def funtureinver(inves,monthly,years): return inves*pow((1+monthly/100/12),years*12) for i in range(1,31): c=funtureinver(inves,monthly,i) print("%d\t%.2f"%(i,c),end=" ") print() ''' #EP5 ''' def printchars(c1,c2,number): m=0 a=ord(c1) b=ord(c2)+1 for i in range(a,b): print(chr(i),end='') m=m+1 if(m%number==0): print("") a,b=input("enter start to end ascii:").split(',') c = eval(input("enter number:")) printchars('1','Z',10) ''' #EP6 ''' def number(year): if((year%4==0)&(year%100!=0))|(year%400==0): print("%d:366"%(i)) else: print("%d:365"%(i)) for i in range(2010,2021): number(i) ''' #EP7 ''' def distance(a1,b1,a2,b2): print(((a1-a2)*(a1-a2)+(b1-b2)*(b1-b2))**0.5) a1,b1=eval(raw_input("enter a1 and a2 for point1: ")) a2,b2=eval(raw_input("enter a1 and a2 for point2: ")) distance(a1,b1,a2,b2) ''' #EP8 ''' import math print ("p\t2^p-1") def n(a): f=0 for j in range(2,int(math.sqrt(a)+1)): if a%j==0 : f = 0 else : f = 1 return f print("2\t3") for i in range(1,32): c=pow(2,i)-1 if(n(c)): print("%d\t%d"%(i,c)) ''' #EP9 ''' from time import * print(ctime(time())) ''' #EP10 ''' import random n = random.randint(1,6) m = random.randint(1,6) s = n+m if (s==2)|(s==3)|(s==12): print("you rolled {} + {} = {}\nyou lose".format(n,m,s)) elif (s==7)|(s==11): print("you rolled {} + {} = {}\nyou win".format(n,m,s)) else : print("you rolled {} + {} = {}\nyou is {}".format(n,m,s,s)) n1 = random.randint(1,6) m1 = random.randint(1,6) s1 = n1+m1 if(s1!=s): print("you rolled {} + {} = {}\nyou lose".format(n1,m1,s1)) else : print("you rolled {} + {} = {}\nyou win".format(n1,m1,s1)) ''' #EP11
# -*- coding: utf-8 -*- """ Created on Fri Feb 19 13:45:46 2021 @author: Lakhan Kumawat """ mylist=input().split() k=int(input()) k1=k mylist1=mylist mylist1.sort() mylist.sort() max1=max(mylist1) #print(mylist,mylist1) #remove k-1th max from list1 and print max while(k1-1!=0): while(max(mylist1)==max1): mylist1.remove(max(mylist1)) max1=max(mylist1) k1-=1 #remove k-1th min from list and print min min2=min(mylist) while(k-1!=0): while(min(mylist)==min2): mylist.remove(min(mylist)) min2=min(mylist1) k-=1 #finally sum of kth max and kth min print(int(max(mylist1))+int(min(mylist)))
# coding=utf-8 __author__ = 'co2y' __email__ = '[email protected]' __version__ = '0.0.1'
""" Errors relating to partitioning """ # Partitioning partitionWarning = ("Partitioning suggests no partitions.\n" "Recommend running with different partitioning method or disable partitioning")
def main(): full_name = get_full_name() print() password = get_password() print() first_name = get_first_name(full_name) print("Hi " + first_name + ", thanks for creating an account.") def get_full_name(): while True: name = input("Enter full name: ").strip() if " " in name: return name else: print("You must enter your full name.") def get_first_name(full_name): index1 = full_name.find(" ") first_name = full_name[:index1] return first_name def get_password(): while True: digit = False cap_letter = False password = input("Enter password: ").strip() for char in password: if char.isdigit(): digit = True elif char.isupper(): cap_letter = True if digit == False or cap_letter == False or len(password) < 8: print("Password must be 8 characters or more \n" + "with at least one digit and one uppercase letter.") else: return password if __name__ == "__main__": main()
#EVALUATION OF THE MODEL def evaluate_model(model, X_test, y_test): _, score = model.evaluate(X_test, y_test, verbose = 0) print(score) def predict_model(model, X): y = model.predict(X) print(y) def predict_class_model(model, X): y = model.predict_classes(X) print(y)
class Solution: def removeKdigits(self, num: str, k: int) -> str: if len(num) == 0 and len(num) <= k : return "0" st = [num[0]] i = 1 while i < len(num): while len(st) > 0 and int(st[-1]) > int(num[i]) and k > 0: st.pop() k-=1 st.append(num[i]) i+=1 while k > 0 : st.pop() k-=1 while len(st) > 0 and st[0] == "0" : st.pop(0) if len(st) == 0 : return "0" else : return "".join(st) #python special class Solution: def removeKdigits(self, num: str, k: int) -> str: stack = [] for n in num: while k > 0 and stack and stack[-1] > n: stack.pop() k -= 1 stack.append(n) ans = stack[:-k] if k else stack return "".join(ans).lstrip('0') or "0"
file_input = open("motivation.txt",'w') file_input.write("Never give up") file_input.write("\nRise above hate") file_input.write("\nNo body remember second place") file_input.close()
__title__ = "django-kindeditor" __description__ = "Django admin KindEditor integration." __url__ = "https://github.com/waketzheng/django-kindeditor" __version__ = "0.3.0" __author__ = "Waket Zheng" __author_email__ = "[email protected]" __license__ = "MIT" __copyright__ = "Copyright 2019 Waket Zheng"
class BoundingBox: x: int y: int x2: int y2: int cx: int cy: int width: int height: int def __init__(self, x: int, y: int, width: int, height: int): self.x = x self.y = y self.width = width self.height = height self.x2 = x + width - 1 self.y2 = y + height - 1 self.cx = round(x + width / 2) self.cy = round(y + height / 2)
#!/usr/bin/env python3 def convert_to_celsius(fahrenheit: float) -> float: return (fahrenheit - 32.0) * 5.0 / 9.0 def above_freezing(celsius: float) -> bool: return celsius > 0 fahrenheit = float(input('Enter the temperature in degrees Fahrenheit: ')) celsius = convert_to_celsius(fahrenheit) print(celsius) if above_freezing(celsius): print('It is above freezing.') else: print('It is below freezing.')
numero = str(input('digite um numero')) print('unidade: {}'.format(numero[1])) print('dezena: {}'.format(numero[2])) print('centena: {} '.format(numero[3])) print('unidade de milhar: {}'.format(numero[4]))
def floydwarshall(G): """ Compute and return the all pairs shortest paths solution. Notice the returned path cost matrix P has modified entries. For example, P[i][j] contains a tuple (c, v1) where c is the cost of the shortest path from i to j, and v1 is the first vertex along said path after i. If there is no such vertex, then it is -1. """ N = len(G) P = [[(G[i][j],j) for j in range(N)] for i in range(N)] for i in range(N): P[i][i] = (0, -1) for k in range(N): for i in range(N): for j in range(N): alt = P[i][k][0] + P[k][j][0] if P[i][j][0] > alt: P[i][j] = (alt, P[i][k][1]) return P def printpath(P, u, w): """ Given modified path cost matrix (see floydwarshall) return shortest path from i to j. """ path = [u] while P[u][w][1] != -1: path.append(P[u][w][1]) u = P[u][w][1] return path def pprint(matrix): #https://stackoverflow.com/questions/13214809/ """ Pretty print matrix with proper spacing. Don't worry about this. """ s = [[str(e) for e in row] for row in matrix] lens = [max(map(len, col)) for col in zip(*s)] fmt = '\t'.join('{{:{}}}'.format(x) for x in lens) table = [fmt.format(*row) for row in s] print('\n'.join(table)) ''' Let us create the following weighted graph (graph art stolen from g4g) 10 (0)------->(3) | /|\ 5 | | | | 1 \|/ | (1)------->(2) 3 ''' inf = float('inf') G = [ [inf , 5 , inf, 10 ], [inf , inf, 3 , inf], [inf , inf, inf, 1 ], [inf , inf, inf, inf]] print('Edge Cost Matrix') pprint(G) P = floydwarshall(G) print('Path Cost Matrix') pprint(P) print(printpath(P, 0, 2))
def binary_search(array: list, valor_buscado, inicio=0, fin=None): if fin == None: fin = len(array)-1 if inicio > fin: return f"No se encontró el valor: {valor_buscado}" medio = (inicio + fin)//2 if valor_buscado == array[medio]: return f"El valor {valor_buscado} está el indice {medio} " if valor_buscado < array[medio]: return binary_search(array, valor_buscado, inicio, medio-1) return binary_search(array, valor_buscado, medio+1, fin) array = [-23, 4, 7, 12, 52, 94] print(binary_search(array, 0)) #No se encontró el valor: 0 print(binary_search(array, 52))# Encontrado en el indice 4
""" Tema: Arrays Curso: Estructura de Datos Lineales (Python). Plataforma: Platzi. Profesor: Hector Vega. Alumno: @edinsonrequena. """ class Array(object): """A simple array""" def __init__(self, capacity: int, fill_value=None) -> None: self.items = list() for i in range(capacity): self.items.append(fill_value) def __len__(self) -> int: """ Method to Know the array's lenght """ count = 0 for i in self.items: count += 1 return count def __str__(self) -> str: """Returns string representation of the array""" return str(self.items) def __iter__(self): """ Method to iter the array """ current = 0 while current < len(self.items): yield current current += 1 def __getitem__(self, index: any) -> any: """ returns a specific index """ return self.items[index] def __setitem__(self, index, new_item): """ set item in a specific index """ self.items[index] = new_item return self.items def __fillslots__(self): """ return a sequence of numbers according to the array's length """ slots = self.items for i in range(len(slots)): slots[i] = i + 1 return slots def __sumlements__(self) -> list or None: """ return the sum of all array's elements if and only if the elements are integers """ arr = self.items try: for i in range(len(arr)): if type(arr[i]) != int: raise TypeError('Solo se pueden sumar enteros') return sum(arr) except TypeError as e: print(e) def __add__(self, index, item): """ returns the array with de new element """ arr = self.items return arr[:index] + [item] + arr[index:] def __append__(self, item): """ returns the array with de new element at the end """ arr = self.items return arr[:] + [item] def __pop__(self, index): """ returns the array without the select element """ arr = self.items arr.pop() return arr
CODE = { 200: {'code': 200, 'msg': "ok"}, 201: {'code': 201, 'msg': "no data"}, 400: {'code': 400, 'msg': "Bad Request"}, # 请求错误 401: {'code': 401, 'msg': "Unauthorized"}, # 没有用户凭证 403: {'code': 403, 'msg': 'Forbidden'}, # 拒绝授权 418: {'code': 418, 'msg': 'happy new year'}, 429: {'code': 429, 'msg': "Too many request"}, 460: {'code': 460, 'msg': 'Reach the upper limit'}, # 自定义,达到上限 500: {'code': 500, 'msg': "Internal Server Error"} # 服务器异常 }
# # @lc app=leetcode id=231 lang=python3 # # [231] Power of Two # # @lc code=start class Solution: def isPowerOfTwo(self, n: int) -> bool: # 每次向下除2, 看最后的结果 if n < 1: return False elif n == 1: return True return self.isPowerOfTwo(n/2) def test(self): assert(self.isPowerOfTwo(1)==True) assert(self.isPowerOfTwo(16)==True) assert(self.isPowerOfTwo(218)==False) sol = Solution() sol.test() # @lc code=end
def f(): '''f''' pass def f1(): pass f2 = f if True: def g(): pass else: def h(): pass class C: def i(self): pass def j(self): def j2(self): pass class C2: def k(self): pass
# 450. Delete_Node_in_a_BST # [email protected] # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def deleteNode(self, root, key): """ :type root: TreeNode :type key: int :rtype: TreeNode """ # // search key in the tree, if key is found, return root. # // if key found at node n: # // + node has no left/right: return null # // + node has either left/right: return right/left # // + node has both left and right: # // + find minval of right. # // + set minval to current node found # // + delete min in right. # // time complexity: O(height of tree) # // space complexity: O(n) if root is None: return None # search the key if root.val > key: root.left = self.deleteNode(root.left, key) elif root.val < key: root.right = self.deleteNode(root.right, key) else: # key is found if root.left is None: return root.right elif root.right is None: return root.left minValue = root.right while minValue.left: # find min value minValue = minValue.left # replace current found minValue.left = root.left return root.right return root
""" Day 8 - Part 1 https://adventofcode.com/2021/day/8 By NORXND @ 08.12.2021 (C) NORXND 2021 - Under The MIT License """ input_file = open('Day8/input.txt', 'r') entries = [] for entry in input_file.readlines(): entry = entry.strip().split(" | ") patterns = entry[0].split(" ") output = entry[1].split(" ") entries.append({ "Patterns": patterns, "Output": output, }) segments = { 1: 2, 4: 4, 7: 3, 8: 7, } matches = [] for entry in entries: for output in entry["Output"]: if len(output) in segments.values(): matches.append(output) print(len(matches))
IPlist = ['209.85.238.4','216.239.51.98','64.233.173.198','64.3.17.208','64.233.173.238'] # for address in range(len(IPlist)): # IPlist[address] = '%3s.%3s.%3s.%3s' % tuple(IPlist[address].split('.')) # IPlist.sort(reverse=False) # for address in range(len(IPlist)): # IPlist[address] = IPlist[address].replace(' ', '') # IPlist.sort(key=lambda address: list(map(int, address.split('.')))) IPlist.sort(key=lambda address: list(map(str, address.split('.')))) print(IPlist)
class Ponto(object): def __init__(self, x, y): #método construtor (cria ponto) self.x = x self.y = y def exibe_ponto(self): print('Coordenadas -> x: ', self.x, ', y: ', self.y) def set_x(self, x): self.x = x def set_y(self, y): self.y = y def distancia_entre(self, q): dx = q.x - self.x dy = q.y - self.y return (dx*dx+dy*dy)**0.5 class ponto_n(Ponto): def __init__(self, x, y, nome): super().__init__(x, y) self.nome = nome def exibe_ponto(self): print('Ponto: ', self.nome) super().exibe_ponto() p = Ponto(2.0,1.0) q = Ponto(3.4, 2.1) p1 = ponto_n(2, 1, 'P') q1 = ponto_n(3.4, 2.1, 'Q') p.exibe_ponto() q.exibe_ponto() p1.exibe_ponto() q1.exibe_ponto() print('A distância entre o ponto p e q é: ', p.distancia_entre(q))
class Base1: def FuncA(self): print("Base1::FuncA") class Base2: def FuncA(self): print("Base2::FuncA") class Child(Base1, Base2): pass def main(): obj=Child() obj.FuncA() if __name__ == "__main__": main()
#custo de uma viagem. ate 200km( R$0,50), mais q isso (R$0,45) distancia = float(input('Informe a distância: ')) print('Por essa distância {}km: '.format(distancia)) if distancia <= 200: preco = distancia * 0.50 print('O valor da passagem será de R${:.2f}.'.format(preco)) else: preco = distancia * 0.45 print('O valor da passagem será de R${:.2f}.'.format(preco))
KIND_RETRIEVE_DATA = { "_embedded": { "naam": { "_embedded": { "inOnderzoek": { "_embedded": { "datumIngangOnderzoek": { "dag": None, "datum": None, "jaar": None, "maand": None, } }, "geslachtsnaam": False, "voornamen": False, "voorvoegsel": False, } }, "geslachtsnaam": "Maykin Kind", "voorletters": "K", "voornamen": "Media Kind", "voorvoegsel": "van", }, "geboorte": { "_embedded": { "datum": {"dag": 15, "datum": "1999-06-15", "jaar": 1999, "maand": 6}, "land": {"code": "6030", "omschrijving": "Nederland"}, "plaats": {"code": "624", "omschrijving": "Amsterdam"}, "inOnderzoek": { "_embedded": { "datumIngangOnderzoek": { "dag": None, "datum": None, "jaar": None, "maand": None, } }, "datum": False, "land": False, "plaats": False, }, } }, "inOnderzoek": { "_embedded": { "datumIngangOnderzoek": { "dag": None, "datum": None, "jaar": None, "maand": None, } }, "burgerservicenummer": False, }, }, "burgerservicenummer": "456789123", "geheimhoudingPersoonsgegevens": True, "leeftijd": 21, } KIND_RETRIEVE_DATA_NO_DATES = { "_embedded": { "naam": { "_embedded": { "inOnderzoek": { "_embedded": { "datumIngangOnderzoek": { "dag": None, "datum": None, "jaar": None, "maand": None, } }, "geslachtsnaam": False, "voornamen": False, "voorvoegsel": False, } }, "geslachtsnaam": "Maykin Kind", "voorletters": "K", "voornamen": "Media Kind", "voorvoegsel": "van", }, "geboorte": { "_embedded": { "datum": {"dag": None, "datum": None, "jaar": None, "maand": None}, "land": {"code": "6030", "omschrijving": "Nederland"}, "plaats": {"code": "624", "omschrijving": "Amsterdam"}, "inOnderzoek": { "_embedded": { "datumIngangOnderzoek": { "dag": None, "datum": None, "jaar": None, "maand": None, } }, "datum": False, "land": False, "plaats": False, }, } }, "inOnderzoek": { "_embedded": { "datumIngangOnderzoek": { "dag": None, "datum": None, "jaar": None, "maand": None, } }, "burgerservicenummer": False, }, }, "burgerservicenummer": "456789123", "geheimhoudingPersoonsgegevens": True, "leeftijd": 0, }
# -*- coding: utf-8 -*- #from pkg_resources import resource_filename class dlib_model: def pose_predictor_model_location(): return "./models/dlib/shape_predictor_68_face_landmarks.dat" def pose_predictor_five_point_model_location(): return "./models/dlib/shape_predictor_5_face_landmarks.dat" def face_recognition_model_location(): return "./models/dlib/dlib_face_recognition_resnet_model_v1_for_asian.dat" def cnn_face_detector_model_location(): return "./models/dlib/mmod_human_face_detector.dat" class opencv_model: def caff_model_location(): return "./models/opencv/res10_300x300_ssd_iter_140000_fp16.caffemodel" def caff_cfgfile_location(): return "./models/opencv/deploy.prototxt" def tensorflow_model_location(): return "./models/opencv/opencv_face_detector_uint8.pb" def tensorflow_cfgfile_location(): return "./models/opencv/opencv_face_detector.pbtxt" class classifier_model: def classifier_location(): return "./models/classifier/face_classifier.pkl"
# %% [705. Design HashSet](https://leetcode.com/problems/design-hashset/) class MyHashSet(set): remove = set.discard contains = set.__contains__
# # # you have some similar items that you want to store # a1 = 3 # a2 = 5 # a3 = 8 # # ... # a100 = 151 # # # # # # # There has to be a better way # # # # # # # # # # # What is a list after all? # # # # # # # # # * ordered # # # # # # # # # * collection of arbitrary objects (anything goes in) # # # # # # # # # * nested (onion principle, Matroyshka) # # # # # # # # # * mutable - maināmas vērtības # # # # # # # # # * dynamic - size can change # # # # # # # trade_off - not the most efficient as far as memory usage goes # ## for more space efficiency there are Python libraries such as numpy with ndarray structures which are based C arrays # empty_list = [] # alternative would be empty_list = list() print(empty_list) # we can add values later print(len(empty_list)) # my_list = [5, 6, "Valdis", True, 3.65, "alus"] # most common way of creating a list using [el1, el2] print(my_list) print(type(my_list), len(my_list)) # # print(my_list[0]) # so list index starts at 0 for the first element # # major difference with string is that lists are mutable my_list[1] = "Mr. 50" # lists are mutable (unlike strings) types inside also will change on the run print(my_list) drink = my_list[-1] # last element print(my_list[-1], drink, my_list[5]) # again like in string we have indexes in both directions # # # typically we do not need an index for items when looping for el in my_list: print(el, "is type", type(el)) # # Pythonic way to show index is to enumerate for i, el in enumerate(my_list): # if we need index , default start is 0 print(i, el, "is type", type(el)) print(f"Item no. {i} is {el}") # # # i can start index at some value for i,el in enumerate(my_list, start=1000): # if we need index to start at some number print(f"Item no. {i} is {el}") # list_2d = list(enumerate(my_list)) print(list_2d) # numbers = list(range(10)) # range is not a list it used to be in Python 2.7, it is ready on demand print(numbers) # # print(len(my_list)) # for i in range(len(my_list)): # this way is not encouraged, this is too C like, no need for this style # print(f"Item no. {i} is {my_list[i]}") drinks = ["water", "juice", "coffee", "tea", "milk", "beer"] # idioms for drink in drinks: # list in plural item in singular print(drink) # # List slicing - we can use it to get a part of the list print(my_list[:3]) # so we only print the first 3 elements from the list print(my_list[-2:]) # last two print(my_list[1:4]) # from the second to the fourth, fifth is not included print( my_list[1:-1]) # from the second to the last but one print(my_list[::2]) # jumping over every 2nd one my_numbers = list(range(100,200,10)) # no 0 lidz 9, also shows how to create a list from another sequence like object print(my_numbers) print(numbers) print(numbers[::2]) # evens starting with 0, since we jump to every 2nd one print(numbers[1::2]) # so odd numbers here print(my_numbers[::2]) # even starting with 0, 2, 4 print(my_numbers[1::2]) # all odd indexed numbers, index 1, 3, 5, 7 # # # # print(my_list[1::2]) # start with 2nd element and then take every 2nd element # # print(my_list[-1], my_list[len(my_list)-1]) # last element, we use the short syntax print(my_numbers[::-1]) print(my_list[::-1]) print(numbers[::-1]) print(reversed(numbers)) # this we would use when we do not need the list completely for looping # # why would you use such a construction # # because you do not want to create a new list in memory, you want to use the original for n in reversed(numbers): # this is more efficient than numbers[::-1] because we do not create a new list in memory print(n) # print(list(reversed(numbers))) my_reversed_numbers = my_numbers[::-1] print(my_reversed_numbers) # # # # print(reversed(my_list)) # returns an iterator - so not a list but sort of prepared to list collection # # # # print(list(reversed(my_list))) # so we need to cast it to list # # # # print(my_list[::-1]) # so same as above when used on a list # # empty_list = [] # more common # also_empty_list = list() # print(empty_list, also_empty_list) food = "kartupelis" print(food) food_chars = list(food) # so type casing just like str, int, float, bool etc # list will work with any sequence type - and str is a sequence type print(food_chars) print("OLD and TIRED", food_chars[5]) food_chars[5] = "m" # so replacing the 6th elemen - in this case a letter p with m print("NEW and FRESH", food_chars[5]) print(food_chars) maybe_food = str(food_chars) # not quite what we want, but it is a string print(maybe_food) # just a string of what printing a list would look like # so maybe_food is a string, but it is not a list anymore food_again = "".join(food_chars) # "" shows what we are putting between each character, in this case nothing print(food_again) food_again_with_space = " ".join(food_chars) # "" shows what we are putting between each character print(food_again_with_space) food_again_with_smile = "**😁**".join(food_chars) # "" shows what we are putting between each character print(food_again_with_smile) small_list = ["Valdis", "likes", "beer"] separator = "===" new_text = separator.join(small_list) print(new_text) # num_string = "||".join(numbers) # we will need to convert numbers to theri str representation # print(num_string) # # # print(list("kartupelis")) # can create a list out of string print("kartupelis".split("p")) # i could split string by something sentence = "A quick brown fox jumped over a sleeping dog" print(sentence) # string words = sentence.split(" ") # we split by some character in this case whitespace print(words) # list with words # # sentence_with_exclams = ".!.".join(words) # print(sentence_with_exclams) # # # # # # # # # how to check for existance in list print(my_list) print("3.65 is in my list?", 3.65 in my_list) # print(66 in my_list) print("Valdis" in my_list) print(my_list[2]) # Valdis print("al" in "Valdis", "al" in my_list[2]) print("al" in my_list) # this is false,because in needs a exact match, to get partial we need to go deeper # # # # # # # # # # # iterate over items # print("*"*20) # # for it in my_list: # # print(it) # # needle = "al" # what we want to find in our list for item in my_list: print("Checking ", item) if type(item) == str and needle in item: # not all types have in operator print(f"Found {needle=} in {item=}") # python 3.8 and up, good for debuggin print(f"Found needle={needle} in item={item}") # for python 3.7 # # # # # # # # # # # # # # # # # # # # my_list.append() my_list.append("Bauskas alus") # adds "Bauskas alus" at the end of my_list my_list.append("Valmiermuižas alus") # IN PLACE methods, means we modify the list print(my_list) # # # # # # # # # # # example how to filter something find_list = [] # so we have an empty list in beginning needle = "al" for item in my_list: # i can reuse item in the loop # if needle in item: will not work because we have non strings in list if type(item) == str and needle in item: print(f"Found {needle=} in {item=}") find_list.append(item) print(f"{needle=} found in {find_list=}") # # # # # # # # # ps the above could be done simpler with list comprehension # # # # # # # # # # # # # out of place meaning find_list stays the same new_list = my_list + ["Kalējs", "Audējs"] # OUT OF PLACE addition, my_list is not modified print(len(new_list), len(my_list)) print(my_list) print(new_list) # # new_list += ["Malējs", "Salīgais"] # shorthand for new_list = new_list + [new items ] so flattened print(new_list) new_list.append(["Svarīgais", "Mazais"]) #notice append added a list a s nested print(new_list) # notice that we have a list in the list print(new_list[-1]) print(new_list[-1][-1], new_list[-1][1]) # in this case for size 2 1 and -1 give same results new_list.extend(["Fantastiskais", "Lapsa"]) # very similar to += IN PLACE print(new_list) # # # # # print(f"{str(my_list)}") # not quite what we want # # # # # # how to convert all values to str str_list = [] for item in my_list: str_list.append(str(item)) # so if item is already string nothing will happen print(str_list) # # number_str_list = [] for num in numbers: number_str_list.append(str(num)) print(numbers) # list of integers print(number_str_list) # a list of strings # number_string = ",".join(number_str_list) print(number_string) # # i can go in reverse as well numbers_deconstructed = number_string.split(",") print(numbers_deconstructed) # # my_numbers = [] # for it in numbers_deconstructed: # my_numbers.append(int(it)) # print(my_numbers) # # # # # # # # # # # # # list comprehensions make it even short # print(my_list) str_list_2 = [str(item) for item in my_list] # so i go through each item and make a new list with string versions of all items print(str_list_2) # # square_list = [] for n in range(10): square_list.append(n**2) print(square_list) # list comprehension example of square_list squares = [n**2 for n in my_numbers] # a new list with squares of original numbers print(squares) # # wierd_squares = [n*n or 9000 for n in my_numbers] # we could utilie or for 0 # # print(wierd_squares) # # list comprehension can serve as a filter just_numbers = [1,5,2,2,5,7,9,1,5,11,10] odd_numbers = [n for n in just_numbers if n%2 == 1] print(odd_numbers) # print(numbers) odd_squares = [n*n for n in numbers if n%2 == 1] print(odd_squares) # # # same idea as above # odd_squares_also = [] # for n in my_numbers: # if n%2 == 1: # odd_squares_also.append(n*n) # # advantage of long approach is that here we can do more stuff,print etc # print(odd_squares_also) # print(str_list) print(str_list_2) # # print("Lists have equal values inside?",str_list == str_list_2) # check if lists contain equal values print("Lists are physically same?", str_list is str_list_2) # check if our variables reference the same list str_list_3 = str_list # so str_list_3 is a shortcut to same values as, NOT A COPY! print(str_list == str_list_3, str_list is str_list_3) str_list_copy = str_list.copy() # create a new list with same values print(str_list == str_list_copy, str_list is str_list_copy) print(id(str_list)) print(id(str_list_3)) print(id(str_list_copy)) # # print(needle) # # # # # # # need needle of course # # # # so i can add if as filter to list comprehension beer_list = [item for item in str_list if needle in item] print(beer_list) beer_list = beer_list[1:] #get rid of Valdis (first element with index 0) in my beer list print(beer_list) # # beer_list += ["Užavas alus"] # we create a list on demand - list literal beer_list = beer_list + ["Užavas alus"] # # # # # similar to beer_list.append("Užavas alus") # print(beer_list) # # # # # # squares = [num*num for num in range(10)] # so we come up with num on the spot # # # # print(squares) # # # squares_matrix = [[num, "squared", num*num] for num in range(10)] # # # print(squares_matrix) # so list of lists (2d array basically) # # # print(squares_matrix[9][2], squares_matrix[-1][-1]) # # # beer_list += ["Malējs"] # same as new_list = new_list + ["Malējs"] # # # # # # new_list # # print(beer_list[-1]) print(beer_list) last_beer = beer_list[-1] print(last_beer) print(beer_list) # beer_list = beer_list[:-1] #so i get rid of last element # print(last_beer, beer_list) beer_list.append("Malējs") print(beer_list) last_beer = beer_list.pop() # also IN PLACE meaning i destroyed the last value print(last_beer, beer_list) beer_list.reverse() # so i reverse the list IN PLACE print(beer_list) beer_list.reverse() # so i reverse the list IN PLACE print(beer_list) # # # # # # # print(f"We took out {last_beer}") # # # # # print(beer_list) # # # # # beer_list.append(last_beer) # # # # # print(beer_list) # # beer_count = 0 for el in beer_list: if "alus" in el: # if "alus" == el: # so count will be for exact matches beer_count += 1 print(beer_count) # # # # # # # so above count can be done with count method print(beer_list.count("alus")) # only exact matches print(beer_list.index("alus")) # will be 0 since we start counting with 0 # # # print(beer_list.find("Mālenīetis")) # find does not exist for lists, unlike string beer_list.extend(["Labietis", "Mālpils alus"]) # again in place similar to += print(beer_list) print(beer_list.index("Mālpils alus")) # beer_with_zh = [el for el in beer_list if "ža" in el] # print(beer_with_zh) # # # # print(len(beer_with_zh)) # # # # beer_in_description = [el for el in beer_list if "alus" in el] # # # # print(beer_in_description) # # # # # has_alus_count = len([el for el in beer_list if "alus" in el]) # # # # # print(has_alus_count) # # beer_list.insert(2, "Cēsu sula") # so it will insert BEFORE index 2 (meaning before 3rd element) print(beer_list) beer_list.insert(5, "Cēsu sula") # in general we want append instead of insert for speed print(beer_list) beer_list.remove("Cēsu sula") # removes first occurance IN PLACE print(beer_list) # # we could keep removing, but easier is to use a list comprehension to make a new list clean_beers = [el for el in beer_list if el != "Cēsu sula"] print(clean_beers) # # while "Cēsu sula" in beer_list.copy(): # careful with looping and changing element size # print("found Cēsu sula") # beer_list.remove("Cēsu sula") # # print(beer_list) # # # # # # # # # # # beer_list.remove("Cēsu sula") # again in place first match # # # # # # # # # print(beer_list) # # # # # # # # # beer_list.remove("alus") # # # # # # # # # print(beer_list) # # # # # # # # # beer_list.remove("alus") # # # # # # # # # print(beer_list) # # # # beer_list.reverse() # in place reversal # # print(beer_list) new_beer_list = beer_list[::-1] # so i save the reversed list but keep the original print(new_beer_list) # # # # # # # # # # # # so if we have comparable data types inside (so same types) new_beer_list.sort() # in place sort, modifies existing print(new_beer_list) # num_list = [1,2,3,0, -5.5, 2.7, True, False, 0.5, 0] # we can compare int, float and bool # print(num_list) # print(num_list.sort()) # returns None! because IN PLACE # print(num_list) # # # # sorted_by_len = sorted(new_beer_list, key=len) # out of place meaning returns new list # # print(sorted_by_len) # # # # # sorted_by_len_rev = sorted(new_beer_list, key=len, reverse=True) # out of place meaning returns new list # # # # # print(sorted_by_len_rev) # # # # # print( min(beer_list), max(beer_list)) # by alphabet # # numbers = [1, 4, -5, 3.16, 10, 9000, 5] print(min(numbers),max(numbers), sum(numbers), sum(numbers)/len(numbers)) my_sorted_numbers = sorted(numbers) # OUT OF PLACE sort we need to save it in new variable print(my_sorted_numbers) # # avg = round(sum(numbers)/len(numbers), 2) # # print(avg) # # # saved_sort_asc = sorted(numbers) # out of place does not modify numbers # print(saved_sort_asc) # # # # # # # # # # sorted(numbers, reverse=True) # out of place does not modify numbers # # # # # print(numbers) # # # # # print(numbers.sort()) # in place meaning it modifies the numbers # # # # # print(numbers) # # # # # # # # # # numbers.remove(9000) # will remove in place first 9000 found in the list # # # # # # # # # # numbers # # # # # # # # # # min(numbers), max(numbers) # # # print(sum(my_numbers), min(my_numbers), max(my_numbers)) # # # # # # # # # our own sum # # # total = 0 # # # for n in my_numbers: # # # total += n # # # # useful if we want to do more stuff with individual elements in list # # # print(total) # # # # # # sentence = "Quick brown fox jumped over a sleeping dog" # # # # words = sentence.split() # default split is by whitespace convert into a list of words # # # # print(words) # # # # words[2] = "bear" # i can a modify a list # # # # print(words) # # # # # # # # # # so str(words) will not work exactly so we need something else # # # # print(str(words)) # not what we want) # # # # new_sentence = " ".join(words) # we will lose any double or triple whitespace # # # # print(new_sentence) # # # # compressed_sent = "".join(words) # all words together # # # # print(compressed_sent) # # # # funky_sentence = "*:*".join(words) # we will lose any double or triple whitespace # # # # print(funky_sentence) # # # # # # # # # # # # we can create a list of letters # # # # food = "kartupelis" # # # # letters = list(food) # list with all letters # # # # print(letters) # # # # letters[5] = "m" # # # # new_word = "".join(letters) # we join by nothing so no spaces in the new word # # # # print(new_word) # # # # print(words) # # new_list = [] # # for word in words: # # new_list.append(word.capitalize()) # # print(new_list) # # # # # # # # # # # list comprehension same as above # # new_list_2 = [w.capitalize() for w in words] # # print(new_list_2) # # # # filtered_list = [w for w in words if w.startswith("b")] # # # # print(filtered_list) # # # # filtered_list = [w.upper() for w in words if w.startswith("b")] # # # # print(filtered_list) # # # # # # # # # # filtered_list_2 = [w for w in words if w[0] == "b"] # # # # # # # # # # filtered_list_2 # # # # # # # # # # filtered_list_3 = [w.upper() for w in words if w[0] == "b"] # # # # # # # # # filtered_list_3 # # # # # # print("Hello") # # # # # # # # # # # numbers = list(range(10)) # we cast to list our range object # # # # # # # # # print(numbers) # # # # squares = [] # # # # for n in range(10): # could also use range(10) # # # # squares.append(n*n) # # # # print(squares) # # # # squares_2 = [n*n for n in range(10)] # list comprehension of the above # # # # print(squares_2) # # # # even_squares = [n*n for n in range(10) if n % 2 == 0] # # # # print(even_squares) # # # # # # # # # # # print("Whew we need a beer now don't we ?") # # # # # # # # # # # # food # # # # # print(food) # # # # # char_codes = [ord(c) for c in food] # # # # # print(char_codes) # # # # # char_codes_list = [[f"Char:{c}", ord(c)] for c in food] # # # # # print(char_codes_list) # # # # # # # # # # print(char_codes_list[0]) # # # # # # # # # # print(char_codes_list[0][0]) # # # # # # # # # # print(char_codes_list[-1]) # # # # # # # # # # print(char_codes_list[-1][-1]) # # # # # # # # so list of lists of characters # # # # # # # chars = [[c for c in list(word)] for word in sentence.split()] # # # # # # # print(chars) #
words_count = int(input()) words_dict = {} def add_word(word,definition): words_dict[word] = definition def translate_sentence(words_list): sentence = "" for word in words_list: if word in words_dict: sentence += words_dict[word] + " " else: sentence += word + " " return sentence for i in range(words_count + 1): text = input() words = text.split(" ") if len(words) == 2: add_word(words[0] ,words[1]) else: print(translate_sentence(words))
''' Control Structures A statement used to control the flow of execution in a program is called a control structure. Types of control structures 1. Sequence ****************************************************** In a sequential structure the statements are executed in the same order in which they are specified in the program, the control flows from one statement to the other in a logical sequence, all sequences are executed exactly as run. It means that no statement is kept and no statement is executed more than once. Statement # 1 Statement # 2 Statement # 3 Statement # 4 An example Start | input base | input height | input height | calculate area Area = 1/2 * base * height | Display Area | End 2. Selection ****************************************************** A selection structure selects a statement or set of statements to execute on the basis of a condition. In this structure, a statement or set of statements is executed when the condition is True. And ignored when the condition is False. An example Suppose a program that imputs the temperature and then displays the message on the screen. If the temperature is greater than 35, the it displays the message "Hot day". When the temperature is between 25 and 35 the it displays the message "Pleasant day". If it is less than 25, then it displays the message "cool day". Flowchart of simple selection. Condition T or F T F (if True) (if False) Statement #1 Statement #2 3. Repetition A repetition structure executes a statement or set of statements repeadadly. It is also known as iterations or loops. An example. Suspose we want to display a message to the screen "Hello World" one thousand times! It takes huge time to write that code and it takes more space as well. (lenghty awkward looking code) It is very easy to perform this task usig loops or repetition structure. Flowchart of Repetition _______ | | | | | Condition = F | T or F | | | T | | | | | Statement | |_______| | | End of loop 4. Relational or Comparision Operators. Less than, greater than or equal to. Sometime we need to do a lot of comparisions in order to see whether a specific command should be executed. The conditional statements are used to specify conditions in programs. A relatinal operator compares two values. It produces a result as True or False. The relation operators are sometimes called the conditional operators as they test conditions that are tru or false. RELATIONAL OR COMPARISION OPERATORS > Greater than returns true if the value on the left side of > is greater than the value on the righr side. Otherwise, it returns false. >>> # greator than operator (>) >>> 10 > 3 True >>> 10 > 13 False < Less than operator returns true if the value on the left side < is less than the value on the rught side. Otherwise it returns false. >>> # Less Than operator (<) >>> 3 < 7 True >>> 10 < 7 False == Equals operator returns true if the value on both sides of == are equal. Otherwise returns false. == The assignment operator is used to assign the value on the right hand side of any expression to the variable on the left hand side while the equal equal operator which is Gradley comparision operator is used to compare the two to values on the left and right hand side of this operator. >>> 10 == 10 True >>> 10 == 11 False >= Greater that or equal to operator returns true if the value on the left side of >= us greator than or equal to the value on the right hand side. Otherwise returns false. >>> # Greater that or equal to operator (>=) >>> 10 >= 9 True >>> 10 >= 10 True >>> 10 >= 11 False <= Less that or equal to operator returns true if the value on the left of <= is less than or equal to value on right side. Otherwise returns false. >>> # Lesser than or equal to operator >>> 10 <= 10 True >>> 10 <= 11 True >>> 10 <= 9 False != The not equal to operator. Returns true if the value on the left side of != is not equal to the value on the right. Otherwise returns false. >>> # not equal to operator >>> 10 != 10 False >>> 10 == 10 True >>> 3 != 5 True '''
#33 # Time: O(logn) # Space: O(1) # Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. # (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). # # You are given a target value to search. If found in the array return its index, otherwise return -1. # # You may assume no duplicate exists in the array. class binarySearchSol(): def searchInRotatedArrayI(self,nums,target): left,right=0,len(nums)-1 while left<=right: mid=(left+right)//2 if nums[mid]==target: return mid elif (nums[mid]>nums[left] and nums[left]<=target<nums[mid]) or \ (nums[mid]<nums[left] and not (nums[mid]<target<=nums[right])): right=mid-1 else: left=mid+1 return -1
# Número de quantos alunos vão ser cadastrados numeroAlunos = int(input('Quantos alunos quer cadastrar? ')) notasAlunos = {} todosAlunos = [] # Usei um for que se repete na quantidade de vezes no número de alunos for i in range(numeroAlunos): notasAlunos['aluno'] = input('Qual o nome do aluno? ') # Pegando o nome do aluno n1 = float(input('Qual a 1° nota? ')) # Pegando as notas n2 = float(input('Qual a 2° nota? ')) n3 = float(input('Qual a 3° nota? ')) n4 = float(input('Qual a 4° nota? ')) notasAlunos['notas'] = n1, n2, n3, n4 # Atribuindo todas as notas media = (n1 + n2 + n3 + n4) / 4 # Calculando a média # if para aprovado se a média for maior ou igual a 7 # if para reprovado se a média for menor a 7 if media >= 7: notasAlunos['status'] = 'Aprovado' if media < 7: notasAlunos['status'] = 'Reprovado' # Fazendo uma cópia dos dados e adicionando ao dicionário todosAlunos todosAlunos.append(notasAlunos.copy()) # Print na tela do resultado print('_' * 30) print('Notas dos alunos:') print('_' * 30) # Dois for uma para a lista e o outro para o dicionário for e in todosAlunos: for i,j in e.items(): print('{} = {}'.format(i, j)) print('_' * 30)
"""Chapter 8 Practice Question 3 Draw the complete truth tables for the and, or, and not operators. """ def notTruthTable() -> None: """Not truth table. Prints a truth table for the not operator. Returns: None. Only prints out a table. """ print(" _________________________\n", "|not A | Evaluates to:|\n", "|_________|______________|\n", "|not False| True |\n", "|not True | False |\n", "|_________|______________|\n") return None def andTruthTable() -> None: """And truth table. Prints a truth table for the and operator. Returns: None. Only prints out a table. """ print(" _______________________________\n", "|A and B | Evaluates to:|\n", "|_______________|______________|\n", "|False and False| False |\n", "|False and True | False |\n", "|True and False | False |\n", "|True and True | True |\n", "|_______________|______________|\n") return None def orTruthTable() -> None: """Or truth table. Prints a truth table for the or operator. Returns: None. Only prints out a table. """ print(" ______________________________\n", "|A or B | Evaluates to:|\n", "|______________|______________|\n", "|False or False| False |\n", "|False or True | True |\n", "|True or False | True |\n", "|True or True | True |\n", "|______________|______________|\n") return None def main(): notTruthTable() andTruthTable() orTruthTable() # If Question3.py is run (instead of imported as a module), call # the main() function: if __name__ == '__main__': main()
""" -*- coding: utf-8 -*- Time : 2019/7/19 8:25 Author : Hansybx """ class Res: code = 200 msg = '' info = {} def __init__(self, code, msg, info): self.code = code self.msg = msg self.info = info
''' 输入一棵二叉树的根节点,判断该树是不是平衡二叉树。如果某二叉树中任意节点的左右子树的深度相差不超过1,那么它就是一棵平衡二叉树。   示例 1: 给定二叉树 [3,9,20,null,null,15,7] 3 / \ 9 20 / \ 15 7 返回 true 。 示例 2: 给定二叉树 [1,2,2,3,3,null,null,4,4] 1 / \ 2 2 / \ 3 3 / \ 4 4 返回 false 。 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/ping-heng-er-cha-shu-lcof ''' # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def isBalanced(self, root: TreeNode) -> bool: def recur(root): if not root:return 0 left = recur(root.left) if left == -1 : return -1 right = recur(root.right) if right == -1 : return -1 return max(left,right)+1 if abs(left - right) <= 1 else -1 return recur(root) != -1
class Task: def __init__(self,name,due_date): self.name = name self.due_date = due_date self.comments=[] self.completed=False def change_name(self,new_name:str): if self.name==new_name: return f"Name cannot be the same." self.name=new_name return self.name def change_due_date(self,new_date:str): if self.due_date==new_date: return "Date cannot be the same." self.due_date=new_date return self.due_date def add_comment(self,comment:str): self.comments.append(comment) def edit_comment(self,comment_number:int,new_comment:str): if 0<comment_number>=len(self.comments): return "Cannot find comment." self.comments[comment_number]=new_comment return f"{', '.join([x for x in self.comments])}" def details(self): return f"Name: {self.name} - Due Date: {self.due_date}"
class BITree: def __init__(self, nums): self.n = len(nums) self.arr = [0 for _ in range(self.n)] self.bitree = [0 for _ in range(self.n + 1)] for i in range(self.n): self.update(i, nums[i]) def update(self, i, val): diff = val - self.arr[i] self.arr[i] = val i += 1 while i <= self.n: self.bitree[i] += diff i += i & (-i) def sumRange(self, i, j): return self._getSum(j) - self._getSum(i - 1) def _getSum(self, i): i += 1 sum = 0 while i > 0: sum += self.bitree[i] i -= i & (-i) return sum class Solution: """ @param: A: An integer array """ def __init__(self, A): self.bitree = BITree(A) """ @param: start: An integer @param: end: An integer @return: The sum from start to end """ def query(self, start, end): return self.bitree.sumRange(start, end) """ @param: index: An integer @param: value: An integer @return: nothing """ def modify(self, index, value): self.bitree.update(index, value)
class Solution(object): def hammingWeight(self, n): """ :type n: int :rtype: int """ res = 0 while n: res += 1 n &= (n-1) return res def hammingWeight(self, n): for i in range(33): if not n: return i n &= (n - 1) # cheat def hammingWeight(self, n): return bin(n).count('1')
""" 133 / 133 test cases passed. Runtime: 56 ms Memory Usage: 15.1 MB """ class Solution: def searchMatrix(self, matrix: List[List[int]], target: int) -> bool: m, n = len(matrix), len(matrix[0]) l, r = 0, m * n - 1 while l < r: mid = (l + r + 1) >> 1 if matrix[mid // n][mid % n] <= target: l = mid else: r = mid - 1 return matrix[r // n][r % n] == target
class ManuscriptSubjectAreaService: def __init__(self, df): self._df = df self._subject_areas_by_id_map = df.groupby( 'version_id')['subject_area'].apply(sorted).to_dict() @staticmethod def from_database(db, valid_version_ids=None): df = db.manuscript_subject_area.read_frame() if valid_version_ids is not None: df = df[df['version_id'].isin(valid_version_ids)] return ManuscriptSubjectAreaService(df) def get_ids_by_subject_areas(self, subject_areas): df = self._df[self._df['subject_area'].str.lower().isin( [s.lower() for s in subject_areas] )] return set(df['version_id']) def get_subject_areas_by_id(self, manuscript_version_id): return self._subject_areas_by_id_map.get(manuscript_version_id, []) def get_all_subject_areas(self): return set(self._df['subject_area'].unique())
def _cc_stamp_header(ctx): out = ctx.outputs.out args = ctx.actions.args() args.add("--stable_status", ctx.info_file) args.add("--volatile_status", ctx.version_file) args.add("--output_header", out) ctx.actions.run( outputs = [out], inputs = [ctx.info_file, ctx.version_file], arguments = [args], executable = ctx.executable.tool, ) return DefaultInfo(files = depset([out])) cc_stamp_header = rule( implementation = _cc_stamp_header, attrs = { "out": attr.output( doc = "C++ header file to generate", mandatory = True, ), "tool": attr.label( default = Label("@rules_cc_stamp//cc_stamp_header_generator"), cfg = "exec", executable = True, ), }, )
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 11 11:47:23 2021 @author: Claire He Selecting Topics : paper suggest topic selection policy-wise using Meade (2017) work on dissent in policies. We may want to use the same method to select Using Lasso regression shrinkage """
def permute(obj_list, l, r, level): """Helper function to implement the nAr permutation operation Arguments: obj_list -- the list of objects from which the permutation should be generated l -- left end point of current permutation r -- right end point (exclusive) of current permutation level -- used to stop the recursion prematruely according to r """ if level == 0: print(obj_list[:l]) else: for i in range(l, r): obj_list[l], obj_list[i] = obj_list[i], obj_list[l] permute(obj_list, l + 1, r, level - 1) obj_list[l], obj_list[i] = obj_list[i], obj_list[l] def nAr(obj_list, n, r): """Implement the nAr permutation operation Arguments: obj_list -- the list of objects from which the permutation should be generated n -- number of elements in object list r -- number of chosen elements """ assert len(obj_list) == n and r <= n, "incorrect input!" permute(obj_list, 0, n, r) obj_list = [1, 2, 3] nAr(obj_list, len(obj_list), 2)
print('Challenge 14: WAF to check if a number is present in a list or not.') test_list = [ 1, 6, 3, 5, 3, 4 ] print("Checking if 6 exists in list: ") # Checking if 6 exists in list # using loop for i in test_list: if(i == 6) : print ("Element Exists")
# dictionaries friends = ["john", "andre", "mark", "robert"] ages = [23, 43, 54, 12] biodatas_dict = dict(zip(friends, ages)) print(biodatas_dict) # list biodatas_list = list(zip(friends, ages)) print(biodatas_list) # tuple biodatas_tuple = tuple(zip(friends, ages)) print(biodatas_tuple)
#!/usr/bin/env python def count_fish(lanternfish: list, repro_day: int) -> int: return len([x for x in lanternfish if x == repro_day]) def pass_one_day(fish_age_hash: dict, day: int, lanternfish: list=None): if day == 0: if not lanternfish: raise AttributeError("Error: lanternfish list must be passed as arg") new_fish_age_hash = { 'zero': count_fish(lanternfish, 1), 'one': count_fish(lanternfish, 2), 'two': count_fish(lanternfish, 3), 'three': count_fish(lanternfish, 4), 'four': count_fish(lanternfish, 5), 'five': count_fish(lanternfish, 6), 'six': count_fish(lanternfish, 0) + count_fish(lanternfish, 7), 'seven': count_fish(lanternfish, 8), 'eight': count_fish(lanternfish, 0), } else: new_fish_age_hash = { 'zero': fish_age_hash['one'], 'one': fish_age_hash['two'], 'two': fish_age_hash['three'], 'three': fish_age_hash['four'], 'four': fish_age_hash['five'], 'five': fish_age_hash['six'], 'six': fish_age_hash['zero'] + fish_age_hash['seven'], 'seven': fish_age_hash['eight'], 'eight': fish_age_hash['zero'], } return new_fish_age_hash # Import data with open('/home/agaspari/aoc2021/dec_6/dec6_input.txt') as f: lanternfish = [int(x) for x in f.read().split(',')] # Task 1 fish_age_hash = dict() for day in range(0, 80): fish_age_hash = pass_one_day(fish_age_hash, day, lanternfish) print(sum([v for v in fish_age_hash.values()])) # Task 2 fish_age_hash = dict() for day in range(0, 256): fish_age_hash = pass_one_day(fish_age_hash, day, lanternfish) print(sum([v for v in fish_age_hash.values()]))
class MyClass: def __call__(self): print('__call__') c = MyClass() c() c.__call__() print() c.__call__ = lambda: print('overriding call') c() c.__call__()
token = 'Ndhhfghfgh' firebase = { "apiKey": "AIzaSyBYHMxJYFVWP6xH55gAY1TJpVECq4KRjKM", "authDomain": "test24-13912.firebaseapp.com", "databaseURL": "https://test24-13912-default-rtdb.firebaseio.com", "projectId": "test24-13912", "storageBucket": "test24-13912.appspot.com", "messagingSenderId": "939334214645", "appId": "1:939334214645:web:3d8f56ea422989878f76bc", "measurementId": "G-C95H67C4ZD" }
class InstagramQueryId: USER_MEDIAS = '17880160963012870' USER_STORIES = '17890626976041463' STORIES = '17873473675158481'
class person: def __init__(self, first_name, last_name, age): self.first_name = first_name self.last_name = last_name self.age = age def get_full_name(self): return f"{self.first_name} {self.last_name}" def introduce(self): return f"Hi. I'm {self.first_name}. {self.last_name}. I'm {self.age} years old" Phuong = person ('Phoang', 'hoang', 25) full_name = Phuong.get_full_name print(f"{full_name}: {Phuong.introduce()}") #print (f" i'm {Phuong.first_name} {Phuong.last_name}. I'm {Phuong.age} years old") #https://www.youtube.com/c/TechWithTim/playlists
# factoryboy_utils.py @classmethod def _get_manager(cls, model_class): return super(cls, cls)._get_manager(model_class).using(cls.database) class DBAwareFactory(object): """ Context manager to make model factories db aware Usage: with DBAwareFactory(PersonFactory, 'db_qa') as personfactory_on_qa: person_on_qa = personfactory_on_qa() ... """ def __init__(self, cls, db): # Take a copy of the original cls self.original_cls = cls # Patch with needed bits for dynamic db support setattr(cls, 'database', db) setattr(cls, '_get_manager', _get_manager) # save the patched class self.patched_cls = cls def __enter__(self): return self.patched_cls def __exit__(self, type, value, traceback): return self.original_cls
# # PySNMP MIB module HPN-ICF-FLASH-MAN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-FLASH-MAN-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:26:48 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint, SingleValueConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsIntersection") PhysicalIndex, = mibBuilder.importSymbols("ENTITY-MIB", "PhysicalIndex") CounterBasedGauge64, = mibBuilder.importSymbols("HCNUM-TC", "CounterBasedGauge64") hpnicfCommon, = mibBuilder.importSymbols("HPN-ICF-OID-MIB", "hpnicfCommon") InetAddress, InetAddressType = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddress", "InetAddressType") NotificationGroup, ObjectGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ObjectGroup", "ModuleCompliance") ModuleIdentity, TimeTicks, Counter64, Integer32, ObjectIdentity, IpAddress, Bits, Unsigned32, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter32, Gauge32, iso, NotificationType = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "TimeTicks", "Counter64", "Integer32", "ObjectIdentity", "IpAddress", "Bits", "Unsigned32", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter32", "Gauge32", "iso", "NotificationType") TruthValue, RowStatus, TextualConvention, DisplayString, TimeStamp = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "RowStatus", "TextualConvention", "DisplayString", "TimeStamp") hpnicfFlash = ModuleIdentity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5)) hpnicfFlash.setRevisions(('2013-05-23 00:00',)) if mibBuilder.loadTexts: hpnicfFlash.setLastUpdated('201305230000Z') if mibBuilder.loadTexts: hpnicfFlash.setOrganization('') class HpnicfFlashOperationStatus(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31)) namedValues = NamedValues(("opInProgress", 1), ("opSuccess", 2), ("opInvalid", 3), ("opInvalidProtocol", 4), ("opInvalidSourceName", 5), ("opInvalidDestName", 6), ("opInvalidServerAddress", 7), ("opDeviceBusy", 8), ("opDeviceOpenError", 9), ("opDeviceError", 10), ("opDeviceNotProgrammable", 11), ("opDeviceFull", 12), ("opFileOpenError", 13), ("opFileTransferError", 14), ("opFileChecksumError", 15), ("opNoMemory", 16), ("opAuthFail", 17), ("opTimeout", 18), ("opUnknownFailure", 19), ("opDeleteFileOpenError", 20), ("opDeleteInvalidDevice", 21), ("opDeleteInvalidFunction", 22), ("opDeleteOperationError", 23), ("opDeleteInvalidFileName", 24), ("opDeleteDeviceBusy", 25), ("opDeleteParaError", 26), ("opDeleteInvalidPath", 27), ("opDeleteFileNotExistInSlave", 28), ("opDeleteFileFailedInSlave", 29), ("opSlaveFull", 30), ("opCopyToSlaveFailure", 31)) class HpnicfFlashPartitionUpgradeMode(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3)) namedValues = NamedValues(("unknown", 1), ("rxbootFLH", 2), ("direct", 3)) class HpnicfFlashPartitionStatus(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3)) namedValues = NamedValues(("readOnly", 1), ("runFromFlash", 2), ("readWrite", 3)) hpnicfFlashManMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1)) hpnicfFlashDevice = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1)) hpnicfFlhSupportNum = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhSupportNum.setStatus('current') hpnicfFlashTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 2), ) if mibBuilder.loadTexts: hpnicfFlashTable.setStatus('current') hpnicfFlashEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 2, 1), ).setIndexNames((0, "HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhIndex")) if mibBuilder.loadTexts: hpnicfFlashEntry.setStatus('current') hpnicfFlhIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhIndex.setStatus('current') hpnicfFlhSize = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 2, 1, 2), Integer32()).setUnits('bytes').setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhSize.setStatus('deprecated') hpnicfFlhPos = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 2, 1, 3), PhysicalIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhPos.setStatus('current') hpnicfFlhName = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 2, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhName.setStatus('current') hpnicfFlhChipNum = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 2, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhChipNum.setStatus('current') hpnicfFlhDescr = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 2, 1, 6), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhDescr.setStatus('current') hpnicfFlhInitTime = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 2, 1, 8), TimeStamp()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhInitTime.setStatus('current') hpnicfFlhRemovable = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 2, 1, 9), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhRemovable.setStatus('current') hpnicfFlhPartitionBool = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 2, 1, 11), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfFlhPartitionBool.setStatus('current') hpnicfFlhMinPartitionSize = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 2, 1, 12), Integer32()).setUnits('bytes').setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhMinPartitionSize.setStatus('current') hpnicfFlhMaxPartitions = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 2, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 8))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhMaxPartitions.setStatus('current') hpnicfFlhPartitionNum = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 2, 1, 14), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhPartitionNum.setStatus('current') hpnicfFlhKbyteSize = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 2, 1, 15), Integer32()).setUnits('kbytes').setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhKbyteSize.setStatus('current') hpnicfFlhHCSize = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 2, 1, 16), CounterBasedGauge64()).setUnits('bytes').setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhHCSize.setStatus('current') hpnicfFlashChips = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 3)) hpnicfFlhChipTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 3, 1), ) if mibBuilder.loadTexts: hpnicfFlhChipTable.setStatus('current') hpnicfFlhChipEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 3, 1, 1), ).setIndexNames((0, "HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhIndex"), (0, "HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhChipSerialNo")) if mibBuilder.loadTexts: hpnicfFlhChipEntry.setStatus('current') hpnicfFlhChipSerialNo = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 3, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 64))) if mibBuilder.loadTexts: hpnicfFlhChipSerialNo.setStatus('current') hpnicfFlhChipID = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 3, 1, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 5))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhChipID.setStatus('current') hpnicfFlhChipDescr = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 3, 1, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhChipDescr.setStatus('current') hpnicfFlhChipWriteTimesLimit = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 3, 1, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhChipWriteTimesLimit.setStatus('current') hpnicfFlhChipWriteTimes = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 3, 1, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhChipWriteTimes.setStatus('current') hpnicfFlhChipEraseTimesLimit = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 3, 1, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhChipEraseTimesLimit.setStatus('current') hpnicfFlhChipEraseTimes = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 3, 1, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhChipEraseTimes.setStatus('current') hpnicfFlashPartitions = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4)) hpnicfFlhPartitionTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 1), ) if mibBuilder.loadTexts: hpnicfFlhPartitionTable.setStatus('current') hpnicfFlhPartitionEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 1, 1), ).setIndexNames((0, "HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhIndex"), (0, "HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhPartIndex")) if mibBuilder.loadTexts: hpnicfFlhPartitionEntry.setStatus('current') hpnicfFlhPartIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 8))) if mibBuilder.loadTexts: hpnicfFlhPartIndex.setStatus('current') hpnicfFlhPartFirstChip = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhPartFirstChip.setStatus('current') hpnicfFlhPartLastChip = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhPartLastChip.setStatus('current') hpnicfFlhPartSpace = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 1, 1, 4), Integer32()).setUnits('bytes').setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhPartSpace.setStatus('deprecated') hpnicfFlhPartSpaceFree = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 1, 1, 5), Gauge32()).setUnits('bytes').setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhPartSpaceFree.setStatus('deprecated') hpnicfFlhPartFileNum = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 1, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhPartFileNum.setStatus('current') hpnicfFlhPartChecksumMethod = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("simpleChecksum", 1), ("undefined", 2), ("simpleCRC", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhPartChecksumMethod.setStatus('current') hpnicfFlhPartStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 1, 1, 8), HpnicfFlashPartitionStatus()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhPartStatus.setStatus('current') hpnicfFlhPartUpgradeMode = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 1, 1, 9), HpnicfFlashPartitionUpgradeMode()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhPartUpgradeMode.setStatus('current') hpnicfFlhPartName = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 1, 1, 10), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhPartName.setStatus('current') hpnicfFlhPartRequireErase = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 1, 1, 11), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhPartRequireErase.setStatus('current') hpnicfFlhPartFileNameLen = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 1, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 256))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhPartFileNameLen.setStatus('current') hpnicfFlhPartBootable = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 1, 1, 13), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhPartBootable.setStatus('current') hpnicfFlhPartPathForGlobalOpt = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 1, 1, 14), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfFlhPartPathForGlobalOpt.setStatus('current') hpnicfFlhPartHCSpace = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 1, 1, 15), CounterBasedGauge64()).setUnits('bytes').setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhPartHCSpace.setStatus('current') hpnicfFlhPartHCSpaceFree = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 1, 1, 16), CounterBasedGauge64()).setUnits('bytes').setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhPartHCSpaceFree.setStatus('current') hpnicfFlhFiles = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 2)) hpnicfFlhFileTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 2, 1), ) if mibBuilder.loadTexts: hpnicfFlhFileTable.setStatus('current') hpnicfFlhFileEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 2, 1, 1), ).setIndexNames((0, "HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhIndex"), (0, "HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhPartIndex"), (0, "HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhFileIndex")) if mibBuilder.loadTexts: hpnicfFlhFileEntry.setStatus('current') hpnicfFlhFileIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))) if mibBuilder.loadTexts: hpnicfFlhFileIndex.setStatus('current') hpnicfFlhFileName = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 2, 1, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhFileName.setStatus('current') hpnicfFlhFileSize = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 2, 1, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhFileSize.setStatus('deprecated') hpnicfFlhFileStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 2, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("deleted", 1), ("invalidChecksum", 2), ("valid", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhFileStatus.setStatus('current') hpnicfFlhFileChecksum = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 2, 1, 1, 5), OctetString()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhFileChecksum.setStatus('current') hpnicfFlhFileHCSize = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 1, 4, 2, 1, 1, 6), CounterBasedGauge64()).setUnits('bytes').setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhFileHCSize.setStatus('current') hpnicfFlashOperate = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 2)) hpnicfFlhOpTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 2, 1), ) if mibBuilder.loadTexts: hpnicfFlhOpTable.setStatus('current') hpnicfFlhOpEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 2, 1, 1), ).setIndexNames((0, "HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhOperIndex")) if mibBuilder.loadTexts: hpnicfFlhOpEntry.setStatus('current') hpnicfFlhOperIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))) if mibBuilder.loadTexts: hpnicfFlhOperIndex.setStatus('current') hpnicfFlhOperType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("net2FlashWithErase", 1), ("net2FlashWithoutErase", 2), ("flash2Net", 3), ("delete", 4), ("rename", 5)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfFlhOperType.setStatus('current') hpnicfFlhOperProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 2, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("ftp", 1), ("tftp", 2), ("clusterftp", 3), ("clustertftp", 4))).clone('ftp')).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfFlhOperProtocol.setStatus('current') hpnicfFlhOperServerAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 2, 1, 1, 4), IpAddress().clone(hexValue="FFFFFFFF")).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfFlhOperServerAddress.setStatus('deprecated') hpnicfFlhOperServerUser = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 2, 1, 1, 5), DisplayString()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfFlhOperServerUser.setStatus('current') hpnicfFlhOperPassword = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 2, 1, 1, 6), DisplayString()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfFlhOperPassword.setStatus('current') hpnicfFlhOperSourceFile = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 2, 1, 1, 7), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 255))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfFlhOperSourceFile.setStatus('current') hpnicfFlhOperDestinationFile = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 2, 1, 1, 8), DisplayString()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfFlhOperDestinationFile.setStatus('current') hpnicfFlhOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 2, 1, 1, 9), HpnicfFlashOperationStatus()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhOperStatus.setStatus('current') hpnicfFlhOperEndNotification = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 2, 1, 1, 10), TruthValue().clone('false')).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfFlhOperEndNotification.setStatus('current') hpnicfFlhOperProgress = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 2, 1, 1, 11), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhOperProgress.setStatus('current') hpnicfFlhOperRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 2, 1, 1, 12), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfFlhOperRowStatus.setStatus('current') hpnicfFlhOperServerPort = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 2, 1, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfFlhOperServerPort.setStatus('current') hpnicfFlhOperFailReason = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 2, 1, 1, 14), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFlhOperFailReason.setStatus('current') hpnicfFlhOperSrvAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 2, 1, 1, 15), InetAddressType()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfFlhOperSrvAddrType.setStatus('current') hpnicfFlhOperSrvAddrRev = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 2, 1, 1, 16), InetAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfFlhOperSrvAddrRev.setStatus('current') hpnicfFlhOperSrvVPNName = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 2, 1, 1, 17), DisplayString()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfFlhOperSrvVPNName.setStatus('current') hpnicfFlashNotification = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 3)) hpnicfFlhOperNotification = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 1, 3, 1)).setObjects(("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhOperStatus")) if mibBuilder.loadTexts: hpnicfFlhOperNotification.setStatus('current') hpnicfFlashMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 2)) hpnicfFlhMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 2, 1)) hpnicfFlhMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 2, 1, 1)).setObjects(("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhGroup"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhPartitionGroup"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhFileGroup"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhOperationGroup"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhNotificationGroup"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhChipGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hpnicfFlhMIBCompliance = hpnicfFlhMIBCompliance.setStatus('current') hpnicfFlashMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 2, 2)) hpnicfFlhGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 2, 2, 1)).setObjects(("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhSupportNum"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhSize"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhPos"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhName"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhChipNum"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhDescr"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhInitTime"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhRemovable"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhPartitionBool"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhMinPartitionSize"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhMaxPartitions"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhPartitionNum"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhIndex"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhKbyteSize")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hpnicfFlhGroup = hpnicfFlhGroup.setStatus('current') hpnicfFlhChipGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 2, 2, 3)).setObjects(("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhChipID"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhChipDescr"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhChipWriteTimesLimit"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhChipWriteTimes"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhChipEraseTimesLimit"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhChipEraseTimes")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hpnicfFlhChipGroup = hpnicfFlhChipGroup.setStatus('current') hpnicfFlhPartitionGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 2, 2, 4)).setObjects(("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhPartFirstChip"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhPartLastChip"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhPartSpace"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhPartSpaceFree"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhPartFileNum"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhPartChecksumMethod"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhPartStatus"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhPartUpgradeMode"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhPartName"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhPartRequireErase"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhPartFileNameLen"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhPartBootable"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhPartPathForGlobalOpt")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hpnicfFlhPartitionGroup = hpnicfFlhPartitionGroup.setStatus('current') hpnicfFlhFileGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 2, 2, 5)).setObjects(("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhFileName"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhFileSize"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhFileStatus"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhFileChecksum")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hpnicfFlhFileGroup = hpnicfFlhFileGroup.setStatus('current') hpnicfFlhOperationGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 2, 2, 6)).setObjects(("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhOperType"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhOperProtocol"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhOperServerAddress"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhOperServerUser"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhOperPassword"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhOperSourceFile"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhOperDestinationFile"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhOperStatus"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhOperEndNotification"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhOperProgress"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhOperRowStatus"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhOperServerPort"), ("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhOperFailReason")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hpnicfFlhOperationGroup = hpnicfFlhOperationGroup.setStatus('current') hpnicfFlhNotificationGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 5, 2, 2, 7)).setObjects(("HPN-ICF-FLASH-MAN-MIB", "hpnicfFlhOperNotification")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hpnicfFlhNotificationGroup = hpnicfFlhNotificationGroup.setStatus('current') mibBuilder.exportSymbols("HPN-ICF-FLASH-MAN-MIB", HpnicfFlashPartitionUpgradeMode=HpnicfFlashPartitionUpgradeMode, hpnicfFlhChipTable=hpnicfFlhChipTable, hpnicfFlhFileHCSize=hpnicfFlhFileHCSize, hpnicfFlhChipDescr=hpnicfFlhChipDescr, hpnicfFlhOperSrvAddrType=hpnicfFlhOperSrvAddrType, hpnicfFlashOperate=hpnicfFlashOperate, hpnicfFlhPartStatus=hpnicfFlhPartStatus, hpnicfFlhPartitionBool=hpnicfFlhPartitionBool, hpnicfFlhOperSrvAddrRev=hpnicfFlhOperSrvAddrRev, hpnicfFlashMIBConformance=hpnicfFlashMIBConformance, hpnicfFlhDescr=hpnicfFlhDescr, hpnicfFlhFileName=hpnicfFlhFileName, hpnicfFlhHCSize=hpnicfFlhHCSize, hpnicfFlhOperSrvVPNName=hpnicfFlhOperSrvVPNName, hpnicfFlhPartFileNum=hpnicfFlhPartFileNum, hpnicfFlhMIBCompliances=hpnicfFlhMIBCompliances, hpnicfFlhSize=hpnicfFlhSize, hpnicfFlhPartHCSpace=hpnicfFlhPartHCSpace, hpnicfFlhOperType=hpnicfFlhOperType, hpnicfFlhPartitionEntry=hpnicfFlhPartitionEntry, hpnicfFlhOperProtocol=hpnicfFlhOperProtocol, hpnicfFlhFileStatus=hpnicfFlhFileStatus, hpnicfFlhPartRequireErase=hpnicfFlhPartRequireErase, hpnicfFlashDevice=hpnicfFlashDevice, hpnicfFlhOperRowStatus=hpnicfFlhOperRowStatus, hpnicfFlhOperationGroup=hpnicfFlhOperationGroup, hpnicfFlhPartitionNum=hpnicfFlhPartitionNum, hpnicfFlhFileIndex=hpnicfFlhFileIndex, hpnicfFlhChipID=hpnicfFlhChipID, hpnicfFlhOperServerUser=hpnicfFlhOperServerUser, hpnicfFlhOperDestinationFile=hpnicfFlhOperDestinationFile, hpnicfFlhOperIndex=hpnicfFlhOperIndex, hpnicfFlhChipWriteTimesLimit=hpnicfFlhChipWriteTimesLimit, hpnicfFlhNotificationGroup=hpnicfFlhNotificationGroup, hpnicfFlhOperEndNotification=hpnicfFlhOperEndNotification, hpnicfFlhSupportNum=hpnicfFlhSupportNum, hpnicfFlhPartChecksumMethod=hpnicfFlhPartChecksumMethod, hpnicfFlhPos=hpnicfFlhPos, hpnicfFlhOperSourceFile=hpnicfFlhOperSourceFile, hpnicfFlhPartFirstChip=hpnicfFlhPartFirstChip, hpnicfFlhFileGroup=hpnicfFlhFileGroup, hpnicfFlhOperFailReason=hpnicfFlhOperFailReason, hpnicfFlhFileEntry=hpnicfFlhFileEntry, hpnicfFlhChipNum=hpnicfFlhChipNum, hpnicfFlhPartSpace=hpnicfFlhPartSpace, hpnicfFlashTable=hpnicfFlashTable, hpnicfFlhMinPartitionSize=hpnicfFlhMinPartitionSize, hpnicfFlhFiles=hpnicfFlhFiles, HpnicfFlashPartitionStatus=HpnicfFlashPartitionStatus, hpnicfFlhPartIndex=hpnicfFlhPartIndex, hpnicfFlhInitTime=hpnicfFlhInitTime, hpnicfFlhPartitionTable=hpnicfFlhPartitionTable, hpnicfFlhOpTable=hpnicfFlhOpTable, hpnicfFlhOperNotification=hpnicfFlhOperNotification, hpnicfFlhChipWriteTimes=hpnicfFlhChipWriteTimes, hpnicfFlhFileTable=hpnicfFlhFileTable, hpnicfFlash=hpnicfFlash, PYSNMP_MODULE_ID=hpnicfFlash, hpnicfFlhChipEraseTimes=hpnicfFlhChipEraseTimes, hpnicfFlashMIBGroups=hpnicfFlashMIBGroups, hpnicfFlhMaxPartitions=hpnicfFlhMaxPartitions, hpnicfFlhChipSerialNo=hpnicfFlhChipSerialNo, hpnicfFlashChips=hpnicfFlashChips, hpnicfFlhPartName=hpnicfFlhPartName, hpnicfFlhOperServerAddress=hpnicfFlhOperServerAddress, hpnicfFlhChipEntry=hpnicfFlhChipEntry, hpnicfFlhName=hpnicfFlhName, hpnicfFlhPartSpaceFree=hpnicfFlhPartSpaceFree, hpnicfFlhOperProgress=hpnicfFlhOperProgress, hpnicfFlashEntry=hpnicfFlashEntry, hpnicfFlhPartPathForGlobalOpt=hpnicfFlhPartPathForGlobalOpt, hpnicfFlhOperPassword=hpnicfFlhOperPassword, hpnicfFlashManMIBObjects=hpnicfFlashManMIBObjects, hpnicfFlhPartUpgradeMode=hpnicfFlhPartUpgradeMode, hpnicfFlashPartitions=hpnicfFlashPartitions, hpnicfFlhIndex=hpnicfFlhIndex, hpnicfFlashNotification=hpnicfFlashNotification, hpnicfFlhOperServerPort=hpnicfFlhOperServerPort, hpnicfFlhChipEraseTimesLimit=hpnicfFlhChipEraseTimesLimit, hpnicfFlhOperStatus=hpnicfFlhOperStatus, hpnicfFlhOpEntry=hpnicfFlhOpEntry, hpnicfFlhGroup=hpnicfFlhGroup, hpnicfFlhPartHCSpaceFree=hpnicfFlhPartHCSpaceFree, hpnicfFlhRemovable=hpnicfFlhRemovable, hpnicfFlhPartLastChip=hpnicfFlhPartLastChip, hpnicfFlhChipGroup=hpnicfFlhChipGroup, hpnicfFlhKbyteSize=hpnicfFlhKbyteSize, hpnicfFlhFileSize=hpnicfFlhFileSize, hpnicfFlhPartitionGroup=hpnicfFlhPartitionGroup, hpnicfFlhPartBootable=hpnicfFlhPartBootable, HpnicfFlashOperationStatus=HpnicfFlashOperationStatus, hpnicfFlhMIBCompliance=hpnicfFlhMIBCompliance, hpnicfFlhFileChecksum=hpnicfFlhFileChecksum, hpnicfFlhPartFileNameLen=hpnicfFlhPartFileNameLen)
# # PySNMP MIB module BENU-IP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BENU-IP-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:37:23 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") ConstraintsUnion, ValueSizeConstraint, ValueRangeConstraint, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsIntersection", "SingleValueConstraint") benuPlatform, = mibBuilder.importSymbols("BENU-PLATFORM-MIB", "benuPlatform") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") ModuleIdentity, Counter32, Unsigned32, ObjectIdentity, Integer32, NotificationType, IpAddress, MibIdentifier, TimeTicks, MibScalar, MibTable, MibTableRow, MibTableColumn, iso, Counter64, Gauge32, Bits = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "Counter32", "Unsigned32", "ObjectIdentity", "Integer32", "NotificationType", "IpAddress", "MibIdentifier", "TimeTicks", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "Counter64", "Gauge32", "Bits") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") bIPMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 39406, 1, 6)) bIPMIB.setRevisions(('2014-12-17 00:00', '2013-11-28 00:00', '2013-05-31 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: bIPMIB.setRevisionsDescriptions(('updated MIB file with change in bIPNotifObjects', 'Marked bIPPortTxFramesWoErrExclPausFrame as deprecated as it is not supported. Removed unnecessary IMPORTS and added missing. Also, Changed SYNTAX of bIPPortIndex from Integer32 to Unsigned32.', 'Initial Version',)) if mibBuilder.loadTexts: bIPMIB.setLastUpdated('201412170000Z') if mibBuilder.loadTexts: bIPMIB.setOrganization('Benu Networks') if mibBuilder.loadTexts: bIPMIB.setContactInfo('Benu Networks Inc, 300 Concord Road, Billerca MA 01821 Email: [email protected]') if mibBuilder.loadTexts: bIPMIB.setDescription('This MIB module defines IP utilization statistics. Copyright (C) 2001, 2008 by Benu Networks, Inc. All rights reserved.') bIPMIBObjects = ObjectIdentity((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1)) if mibBuilder.loadTexts: bIPMIBObjects.setStatus('current') if mibBuilder.loadTexts: bIPMIBObjects.setDescription('MIB objects for IP utilization statistics are defined in this branch.') bIPNotifObjects = ObjectIdentity((1, 3, 6, 1, 4, 1, 39406, 1, 6, 0)) if mibBuilder.loadTexts: bIPNotifObjects.setStatus('current') if mibBuilder.loadTexts: bIPNotifObjects.setDescription('Notifications of IP utilization statistics are defined in this branch.') bIPPortTable = MibTable((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1), ) if mibBuilder.loadTexts: bIPPortTable.setStatus('current') if mibBuilder.loadTexts: bIPPortTable.setDescription('The table of IP utilization performance metrics of each interface.') bIPPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1), ).setIndexNames((0, "BENU-IP-MIB", "bIPPortIndex")) if mibBuilder.loadTexts: bIPPortEntry.setStatus('current') if mibBuilder.loadTexts: bIPPortEntry.setDescription('An entry containing IP utilization performance metrics for each interface.') bIPPortIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 1), Unsigned32()) if mibBuilder.loadTexts: bIPPortIndex.setStatus('current') if mibBuilder.loadTexts: bIPPortIndex.setDescription('Interface index of the port This will be similar to ifIndex of IF-MIB.') bIPPortInterfaceName = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortInterfaceName.setStatus('current') if mibBuilder.loadTexts: bIPPortInterfaceName.setDescription('Name of the interface associated with this port.') bIPPortTxBytesInFrameWoErr = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 3), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortTxBytesInFrameWoErr.setStatus('current') if mibBuilder.loadTexts: bIPPortTxBytesInFrameWoErr.setDescription('Total bytes transmitted without errors.') bIPPortTxFramesWoErrExclPausFrame = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 4), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortTxFramesWoErrExclPausFrame.setStatus('deprecated') if mibBuilder.loadTexts: bIPPortTxFramesWoErrExclPausFrame.setDescription('Total frames transmitted without errors excluding pause frames.') bIPPortTxBcastFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 5), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortTxBcastFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortTxBcastFrames.setDescription('Total broadcast frames transmitted.') bIPPortTxL2McastFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 6), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortTxL2McastFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortTxL2McastFrames.setDescription('Total Layer 2 multicast frames transmitted.') bIPPortTxPausFrame = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 7), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortTxPausFrame.setStatus('current') if mibBuilder.loadTexts: bIPPortTxPausFrame.setDescription('Total broadcast frames transmitted.') bIPPortTx64byteFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 8), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortTx64byteFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortTx64byteFrames.setDescription('Total 64-byte frames transmitted.') bIPPortTx65to127byteFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 9), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortTx65to127byteFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortTx65to127byteFrames.setDescription('Total 65 to 127-byte frames transmitted.') bIPPortTx128to255byteFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 10), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortTx128to255byteFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortTx128to255byteFrames.setDescription('Total 128 to 255-byte frames transmitted.') bIPPortTx256to511byteFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 11), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortTx256to511byteFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortTx256to511byteFrames.setDescription('Total 256 to 511-byte frames transmitted.') bIPPortTx512to1023byteFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 12), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortTx512to1023byteFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortTx512to1023byteFrames.setDescription('Total 512 to 1023-byte frames transmitted.') bIPPortTx1024to1518byteFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 13), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortTx1024to1518byteFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortTx1024to1518byteFrames.setDescription('Total 1024 to 1518-byte frames transmitted.') bIPPortTx1519to1522byteFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 14), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortTx1519to1522byteFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortTx1519to1522byteFrames.setDescription('Total 1519 to 1522-byte frames transmitted.') bIPPortTx1523toMaxByteFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 15), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortTx1523toMaxByteFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortTx1523toMaxByteFrames.setDescription('Total 1523 to Max-byte frames transmitted.') bIPPortTx17to63byteFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 16), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortTx17to63byteFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortTx17to63byteFrames.setDescription('Total 17 to 63-byte frames transmitted.') bIPPortTxBadFcsFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 17), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortTxBadFcsFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortTxBadFcsFrames.setDescription('Total bad FCS frames transmitted.') bIPPortRxBytesInFrameWoErr = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 18), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortRxBytesInFrameWoErr.setStatus('current') if mibBuilder.loadTexts: bIPPortRxBytesInFrameWoErr.setDescription('Total bytes received without errors.') bIPPortRxBcastFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 19), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortRxBcastFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortRxBcastFrames.setDescription('Total broadcast frames received.') bIPPortRxL2McastFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 20), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortRxL2McastFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortRxL2McastFrames.setDescription('Total multicase frames received.') bIPPortRxPausFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 21), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortRxPausFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortRxPausFrames.setDescription('Total pause frames received.') bIPPortRx64byteFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 22), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortRx64byteFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortRx64byteFrames.setDescription('Total 64-byte frames received.') bIPPortRx65to127byteFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 23), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortRx65to127byteFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortRx65to127byteFrames.setDescription('Total 65 to 127-byte frames received.') bIPPortRx128to255byteFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 24), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortRx128to255byteFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortRx128to255byteFrames.setDescription('Total 128 to 255-byte frames received.') bIPPortRx256to511byteFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 25), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortRx256to511byteFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortRx256to511byteFrames.setDescription('Total 256 to 511-byte frames received.') bIPPortRx512to1023byteFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 26), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortRx512to1023byteFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortRx512to1023byteFrames.setDescription('Total 512 to 1023-byte frames received.') bIPPortRx1024to1518byteFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 27), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortRx1024to1518byteFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortRx1024to1518byteFrames.setDescription('Total 1024 to 1518-byte frames received.') bIPPortRx1519to1522byteFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 28), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortRx1519to1522byteFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortRx1519to1522byteFrames.setDescription('Total 1519 to 1522-byte frames received.') bIPPortRx1523to10368byteFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 29), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortRx1523to10368byteFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortRx1523to10368byteFrames.setDescription('Total 1523 to 10368-byte frames received.') bIPPortRxShortFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 30), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortRxShortFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortRxShortFrames.setDescription('Total short frames received.') bIPPortRxJabberFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 31), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortRxJabberFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortRxJabberFrames.setDescription('Total jabber frames received.') bIPPortRxOvrSzFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 32), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortRxOvrSzFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortRxOvrSzFrames.setDescription('Total oversize frames received.') bIPPortRxLenFldErrFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 33), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortRxLenFldErrFrames.setStatus('current') if mibBuilder.loadTexts: bIPPortRxLenFldErrFrames.setDescription('Total length field error frames received.') bIPPortRxSymbErrs = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 34), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortRxSymbErrs.setStatus('current') if mibBuilder.loadTexts: bIPPortRxSymbErrs.setDescription('Total symbol error frames received.') bIPPortRxIntrPktJunk = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 1, 6, 1, 1, 1, 35), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: bIPPortRxIntrPktJunk.setStatus('current') if mibBuilder.loadTexts: bIPPortRxIntrPktJunk.setDescription('Total inter packet junk error frames received.') mibBuilder.exportSymbols("BENU-IP-MIB", bIPPortTx64byteFrames=bIPPortTx64byteFrames, bIPPortRxJabberFrames=bIPPortRxJabberFrames, bIPPortIndex=bIPPortIndex, bIPPortTx65to127byteFrames=bIPPortTx65to127byteFrames, bIPPortTx1523toMaxByteFrames=bIPPortTx1523toMaxByteFrames, bIPPortTxFramesWoErrExclPausFrame=bIPPortTxFramesWoErrExclPausFrame, bIPPortTxL2McastFrames=bIPPortTxL2McastFrames, PYSNMP_MODULE_ID=bIPMIB, bIPPortRxSymbErrs=bIPPortRxSymbErrs, bIPPortRx512to1023byteFrames=bIPPortRx512to1023byteFrames, bIPPortRx256to511byteFrames=bIPPortRx256to511byteFrames, bIPPortRx65to127byteFrames=bIPPortRx65to127byteFrames, bIPPortRxLenFldErrFrames=bIPPortRxLenFldErrFrames, bIPNotifObjects=bIPNotifObjects, bIPPortTxBadFcsFrames=bIPPortTxBadFcsFrames, bIPPortRx1024to1518byteFrames=bIPPortRx1024to1518byteFrames, bIPPortRx128to255byteFrames=bIPPortRx128to255byteFrames, bIPPortRxOvrSzFrames=bIPPortRxOvrSzFrames, bIPPortRxPausFrames=bIPPortRxPausFrames, bIPPortTx1024to1518byteFrames=bIPPortTx1024to1518byteFrames, bIPPortRxBytesInFrameWoErr=bIPPortRxBytesInFrameWoErr, bIPPortTx17to63byteFrames=bIPPortTx17to63byteFrames, bIPPortRx1519to1522byteFrames=bIPPortRx1519to1522byteFrames, bIPPortRxBcastFrames=bIPPortRxBcastFrames, bIPPortTable=bIPPortTable, bIPPortTx1519to1522byteFrames=bIPPortTx1519to1522byteFrames, bIPPortTxBcastFrames=bIPPortTxBcastFrames, bIPPortRxShortFrames=bIPPortRxShortFrames, bIPPortTx128to255byteFrames=bIPPortTx128to255byteFrames, bIPMIBObjects=bIPMIBObjects, bIPPortTx512to1023byteFrames=bIPPortTx512to1023byteFrames, bIPPortEntry=bIPPortEntry, bIPPortTx256to511byteFrames=bIPPortTx256to511byteFrames, bIPPortRx64byteFrames=bIPPortRx64byteFrames, bIPPortRx1523to10368byteFrames=bIPPortRx1523to10368byteFrames, bIPPortInterfaceName=bIPPortInterfaceName, bIPMIB=bIPMIB, bIPPortRxIntrPktJunk=bIPPortRxIntrPktJunk, bIPPortRxL2McastFrames=bIPPortRxL2McastFrames, bIPPortTxBytesInFrameWoErr=bIPPortTxBytesInFrameWoErr, bIPPortTxPausFrame=bIPPortTxPausFrame)