content
stringlengths
7
1.05M
dic = {} while True: perg = str(input('Deseja fazer um comentário ? [S/N] ')).strip().upper()[0] if perg == 'S': dic['coment'] = str(input('Qual o seu comentário ? ')).strip().upper() print('Obrigado pelo seu comentário') elif perg == 'N': print('Até mais !') break else: print('Resposta incorreta') while True: try: perg_1 = str(input('Deseja avaliar em estrelas ? [S/N]')).upper().strip()[0] while True: if perg_1 == 'S': try: dic['estrelas'] = int(input('Quantas estrelas você avalia para o nosso serviço ? [0 - 5]')) if dic['estrelas'] <= 5: print('Muito obrigado pela sua resposta !') break else: print('Resposta Incorreta') except (ValueError, IndexError): print('Resposta Incorreta') elif perg_1 == 'N': print('Até mais !') break else: print('Resposta Incorreta') break except (ValueError, IndexError): print('Resposta Incorreta')
def field_to_string(string): return " ".join(string.split("_")).capitalize() def parse_details(data): if not data: raise ValueError("data must not be null, empty, etc.") if isinstance(data, dict): items = list(data.items()) max_key_len = len(max(map(str, data.keys()), key=len)) + 1 max_val_len = len(max(map(str, data.values()), key=len)) + 1 if len(items) > 1: return ( "├ " + "\n├ ".join( [ f"`{field_to_string(k):<{max_key_len}}: {v:<{max_val_len}}`" for k, v in items[:-1] ] ) + f"\n└ `{field_to_string(items[-1][0]):<{max_key_len}}: {items[-1][1]:<{max_key_len}}`" ) return f"└ {field_to_string(items[-1][0])}: {items[-1][1]}" elif isinstance(data, list): items = data if len(items) > 1: return ( "├ " + "\n├ ".join([value for value in items[:-1]]) + f"\n└ {items[-1]}" ) return f"└ {items[-1]}" def parse_list_details(data, item_emoji="➡️"): if not data: return "" if isinstance(data, dict): return "\n".join( [ f"\n{item_emoji} {title}\n{parse_details(stats)}" for title, stats in data.items() ] ) elif isinstance(data, list): return f"{data[0]}\n{parse_details(data[1:])}" def parse_global(stats, items, title, emoji, footer=""): return f""" *{title}* {parse_details(stats)} {parse_list_details(items, item_emoji=emoji)} {footer} """
class LPGeneralException(Exception): """Raised when generic exceptions when using 'LPData' class""" def __init__(self, msg): self.msg = msg class LPOptimizationFailedException(Exception): """Raised when optimization fails when using LPData class""" pass
def make_singleton(class_): def __new__(cls, *args, **kwargs): raise Exception('class', cls.__name__, 'is a singleton') class_.__new__ = __new__
def main(): a = int(input("Insira a idade do nadador: ")) if(a <= 5): print("Categoria: Bebe") elif(a > 5 and a <= 7): print("Categoria: Infantil A") elif(a >= 8 and a <= 10): print("Categoria: Infantil B") elif(a >= 11 and a <= 13): print("Categoria: Juvenil A") elif(a >= 14 and a <= 17): print("Categoria: Juvenil B") else: print("Categoria: Senior") main()
class Translation(object): START_TEXT = """Hello Stranger, Welcome To Valhalla. """ ###################### HELP_USER = """**TF Does This Bot Do?** **⁘ ¯\_(ツ)_/¯ Nothing. Ha Ha Ha** **⁘ No,Seriously Tho (•_•)** """ DOWNLOAD_MSG = " **Downloading....**" DOWNLOAD_FAIL_MSG = "**Failed To Download File**" UPLOAD_MSG = "**Uploading....**" UPLOAD_FAIL_MSG = "**Failed To Upload File**" #UPLOAD_DONE_MSG = "**Done!**"
#Contains an (x,y) point, usually in projected coords. class Point: def __init__(self, x:float, y:float): self.x = x self.y = y def __repr__(self): return "Point(%f,%f)" % (self.x, self.y) def __str__(self): return "(%f,%f)" % (self.x, self.y) #Contains a (lat/lng) location, usually as +/- rather than E/W class Location: def __init__(self, lat:float, lng:float): self.lat = lat self.lng = lng def __repr__(self): return "Location(%f,%f)" % (self.lat, self.lng) def __str__(self): return "(%f,%f)" % (self.lat, self.lng)
class Node: pass class BinaryNode(Node): def __init__(self, des, src1, src2): self.des=des self.src1=src1 self.src2=src2 class AdduNode(BinaryNode): def __str__(self): return f'addu {self.des}, {self.src1}, {self.src2}' class MuloNode(BinaryNode): def __str__(self): return f'mulo {self.des}, {self.src1}, {self.src2}' class DivuNode(BinaryNode): def __str__(self): return f'divu {self.des}, {self.src1}, {self.src2}' class SubuNode(BinaryNode): def __str__(self): return f'subu {self.des}, {self.src1}, {self.src2}' class SeqNode(BinaryNode): def __str__(self): return f'seq {self.des}, {self.src1}, {self.src2}' class SneNode(BinaryNode): def __str__(self): return f'sne {self.des}, {self.src1}, {self.src2}' class SgeuNode(BinaryNode): def __str__(self): return f'sgeu {self.des}, {self.src1}, {self.src2}' class SgtuNode(BinaryNode): def __str__(self): return f'sgtu {self.des}, {self.src1}, {self.src2}' class SleuNode(BinaryNode): def __str__(self): return f'sleu {self.des}, {self.src1}, {self.src2}' class SltuNode(BinaryNode): def __str__(self): return f'sltu {self.des}, {self.src1}, {self.src2}' class BNode(Node): def __init__(self, lab): self.lab=lab def __str__(self): return f'b {self.lab}' class BeqzNode(Node): def __init__(self,src, lab): self.src=src self.lab=lab def __str__(self): return f'beqz {self.src}, {self.lab}' class JNode(Node): def __init__(self, lab): self.lab=lab def __str__(self): return f'j {self.lab}' class JrNode(Node): def __init__(self, src): self.src=src def __str__(self): return f'jr {self.src}' class AddressNode(Node): pass class ConstAddrNode(AddressNode): def __init__(self, const): self.const=const def __str__(self): return self.const class RegAddrNode(AddressNode): def __init__(self, reg, const=None): self.const=const self.reg=reg def __str__(self): if self.const: return f'{self.const}({self.reg})' else: return f'({self.reg})' class SymbolAddrNode(AddressNode): def __init__(self, symbol, const=None, reg=None): self.symbol=symbol self.const=const self.reg=reg def __str__(self): if self.const and self.reg: return f'{self.symbol} + {self.const}({self.reg})' if self.const: return f'{self.symbol} + {self.const}' return self.symbol class LoadAddrNode(Node): def __init__(self, des, addr): self.des=des self.addr=addr class LaNode(LoadAddrNode): def __str__(self): return f'la {self.des}, {self.addr}' class LbuNode(LoadAddrNode): def __str__(self): return f'lbu {self.des}, {self.addr}' class LhuNode(LoadAddrNode): def __str__(self): return f'lhu {self.des}, {self.addr}' class LwNode(LoadAddrNode): def __str__(self): return f'lw {self.des}, {self.addr}' class Ulhu(LoadAddrNode): def __str__(self): return f'ulhu {self.des}, {self.addr}' class Ulw(LoadAddrNode): def __str__(self): return f'ulw {self.des}, {self.addr}' class LoadConstNode(Node): def __init__(self, des, const): self.des=des self.const=const class LuiNode(LoadConstNode): def __str__(self): return f'lui {self.des}, {self.const}' class LiNode(LoadConstNode): def __str__(self): return f'li {self.des}, {self.const}' class Move(Node): def __init__(self, src, des): self.des=des self.src=src def __str__(self): return f'move {self.des}, {self.src}' class UnaryNode(Node): def __init__(self, des, src): self.des=des self.src=src class NotNode(UnaryNode): def __str__(self): return f'la {self.des}, {self.src}' class SyscallNode(Node): def __str__(self): return 'syscall'
n, m = map(int, input().split()) connected = [] seeds = [] for i in range(0, n): connected.append([]) for i in range(0, m): a, b = map(int, input().split()) if (b not in connected[a-1]): connected[a-1].append(b) if (a not in connected[b-1]): connected[b-1].append(a) print(connected) # for each pasture for i in range(0, n): # for each seed for j in range(1, 4): valid = True # for each other pasture for k in range(1, 4): if k == j: continue if k in connected[j]: valid = False break if valid: seeds.append(k) break print(seeds)
class Rule: def __init__(self, rule_id): self.rule_id = rule_id def __eq__(self, other): return self.rule_id == other.rule_id class RuleSet: def __init__(self, **kwargs): self.rules = {} for k, v in kwargs.items(): self.rules[k] = Rule(v) def __getattr__(self, attr_name): return self.rules[attr_name] def __add__(self, other): result = self.__class__() result.rules.update(self.rules) result.rules.update(other.rules) return result
class Solution(object): def validPalindrome(self, s): """ :type s: str :rtype: bool """ l, r = 0, len(s)-1 count = 0 def get_result(l,r,s,count,forward=True): while l < r: if s[l] == s[r]: l += 1; r -= 1 elif count < 1: if not forward: r -=1 else: l += 1 count += 1 else: return False return True result1 = get_result(l,r,s, count) result2 = get_result(l,r,s,count,forward=False) return result1 or result2 abc = Solution() print (abc.validPalindrome("abca"))
#! /usr/bin/python # -*- coding: iso-8859-15 -*- def sc(n): if n > 1: r = sc(n - 1) + n ** 3 else: r = 1 return r a = int(input("Desde: ")) b = int(input("Hasta: ")) for i in range(a, b+1): if sc(i): print ("Numero primo: ",i)
sum( 1, 2, 3, 5, ) sum( 1, 2, 3, 5)
class AccountError(Exception): """ Raised when the API can't locate any accounts for the user """ pass
class BackendError(Exception): pass class FieldError(Exception): pass
def read_spreadsheet(): file_name = "Data/day2.txt" file = open(file_name, "r") spreadsheet = [] for line in file: line = list(map(int, line.split())) spreadsheet.append(line) return spreadsheet def checksum(spreadsheet): total = 0 for row in spreadsheet: total += max(row) - min(row) print(f"Part one: {total}") def divisible_checksum(spreadsheet): total = 0 for row in spreadsheet: for i in range(len(row)-1): for j in range(i+1, len(row)): if row[i]%row[j] == 0: total += row[i]//row[j] if row[j]%row[i] == 0: total += row[j]//row[i] print(f"Part two: {total}") if __name__ == "__main__": spreadsheet = read_spreadsheet() checksum(spreadsheet) divisible_checksum(spreadsheet)
#!/usr/bin/env python3 # recherche empirique aiguille = list() for t in range(0, 43200): h = t / 120 m = (t / 10) % 360 if abs(abs(h - m) - 90) < 0.05 or abs(abs(h - m) - 270) < 0.05: if len(aiguille) > 0 and (t - aiguille[-1][0]) < 2: del aiguille[-1] hh, mm = int(h / 30), int(m / 6) aiguille.append((t, f"{hh:02d}:{mm:02d}:{t%60:02d} {h:6.2f} {m:6.2f}")) # calcul exact exact = list() for i in range(22): h = (90 + 180 * i) / 11 m = (12 * h) % 360 hh, mm, ss = int(h / 30), int(m / 6), int(120 * h) % 60 fmt = f"{hh:02d}:{mm:02d}:{ss:02d} {h:6.2f} {m:6.2f}" exact.append(fmt) # affichage for i, ((_, v), w) in enumerate(zip(aiguille, exact)): print(f"{i+1:2} {v} {w}")
""" Given a string S, find the longest palindromic substring in S. Substring of string S: S[i...j] where 0 <= i <= j < len(S) Palindrome string: A string which reads the same backwards. More formally, S is palindrome if reverse(S) = S. Incase of conflict, return the substring which occurs first ( with the least starting index ). Example : Input : "aaaabaaa" Output : "aaabaaa" """ class Solution: # Method 01 :: Using string reverse function def longestSubstring(self, s): n = len(s) if n < 2 or s == s[::-1]: return s longest_sq, start = 1, 0 for i in range(1, n): odd = s[i-longest_sq -1 : i+1] even = s[i -longest_sq : i+1] if i-longest_sq -1 >= 0 and odd == odd[::-1]: start = i - longest_sq -1 longest_sq += 2 continue if i-longest_sq >= 0 and even == even[::-1]: start = i -longest_sq longest_sq += 1 return s[start: start+longest_sq] # Method 02 :: Looping for every char to check if they are equal or not def longestPalindrome(self, s): n = len(s) if n < 2 or s == s[::-1]: return s start, low, high, maxlen = 0,0,0,1 for i in range(1, n): # working on odd len palindrome low, high = i-1, i while (low >= 0 and high < n) and (s[low] == s[high]): if high -low +1 > maxlen: start = low maxlen = high - low + 1 high += 1 low -= 1 # working on even palindrome string low, high = i-1, i+1 while (low >= 0 and high < n) and s[low] == s[high]: if high - low + 1 > maxlen: maxlen = high - low + 1 start = low high += 1 low -= 1 return s[start: start+ maxlen] s = Solution() print(s.longestSubstring("aaaabaaa")) print(s.longestPalindrome("abax"))
""" Constants and methods used in testing """ class Colors(): WHITE = 'rgba(255, 255, 255, 1)' RED_ERROR = 'rgba(220, 53, 69, 1)' users = { 'valid_user': {'first_name':'Shinji', 'last_name': 'Ikari', 'user_name': 'sikari', 'address1': '123 Main St.', 'country': 'United States', 'state': 'California', 'zip': '12345', 'name_on_card': 'John Galt', 'number_on_card': '1111111111111', 'cvv': '111'}, 'user_wo_username':{ 'first_name':'Shinji', 'last_name': 'Ikari', 'address1': '123 Main St.', 'country': 'United States', 'state': 'California', 'zip': '12345', 'name_on_card': 'John Galt', 'number_on_card': '1111111111111', 'cvv': '111' }, 'user_invalid_cc':{ 'first_name':'Shinji', 'last_name': 'Ikari', 'user_name': 'sikari', 'address1': '123 Main St.', 'country': 'United States', 'state': 'California', 'zip': '12345', 'name_on_card': 'John Galt', 'number_on_card': '4671100111123', 'cvv': '111' }, }
# Iterate through the array and maintain the min_so_far value. at each step profit = max(profit, arr[i]-min_so_far) class Solution: def maxProfit(self, prices: List[int]) -> int: i = 0 max_profit = 0 min_so_far = 99999 for i in range(len(prices)): max_profit = max(max_profit, prices[i]-min_so_far) min_so_far = min(min_so_far, prices[i]) return max_profit
def f(xs): ys = 'string' for x in xs: g(ys) def g(x): return x.lower()
def get_standard_config_dictionary(values): run_dict = {} run_dict['Configuration Name'] = values['standard_name_input'] run_dict['Model file'] = values['standard_model_input'] var_values = list(filter(''.__ne__, values['standard_value_input'].split('\n'))) run_dict['Parameter values'] = list(map(lambda x: x.strip(), var_values)) run_dict['Repetitions'] = values['standard_repetition_input'] run_dict['Ticks per run'] = values['standard_tick_input'] reporters = list(filter(''.__ne__, values['standard_reporter_input'].split('\n'))) run_dict['NetLogo reporters'] = list(map(lambda x: x.strip(), reporters)) setup_commands = list(filter(''.__ne__, values['standard_setup_input'].split('\n'))) run_dict['Setup commands'] = list(map(lambda x: x.strip(), setup_commands)) run_dict['Parallel executors'] = values['standard_process_input'] return run_dict
A, B, C = input() .split() A = float(A) B = float(B) C = float(C) triangulo = float(A * C /2) circulo = float(3.14159 * C**2) trapezio = float(((A + B) * C) /2) quadrado = float(B * B) retangulo = float(A * B) print("TRIANGULO: %0.3f" %triangulo) print("CIRCULO: %0.3f" %circulo) print("TRAPEZIO: %0.3f" %trapezio) print("QUADRADO: %0.3f" %quadrado) print("RETANGULO: %0.3f" %retangulo)
__all__ = [ 'TargetApiError', 'TargetApiParamsError', 'TargetApiBadRequestError', 'TargetApiUnauthorizedError', 'TargetApiNotFoundError', 'TargetApiMethodNotAllowedError', 'TargetApiServerError', 'TargetApiServiceUnavailableError', 'TargetApiParameterNotImplementedError', 'TargetApiUnknownError' ] class TargetApiError(Exception): """ Errors from Target API client """ def __init__(self, *args, **kwargs): super(TargetApiError, self).__init__() self.args = args self.code = kwargs.pop('code', None) self.msg = kwargs.pop('msg', None) def __str__(self): # pragma: no cover if self.code is not None or self.msg is not None: return 'TargetAPI error: %(msg)s (%(code)s)' % self.__dict__ return Exception.__str__(self) class TargetApiParamsError(TargetApiError): """ Error, when validate of request parameters is False """ def __init__(self, *args, **kwargs): super(TargetApiParamsError, self).__init__() self.msg = kwargs.pop('msg', 'Invalid parameters') def __str__(self): return 'TargetAPI error: %(msg)s' % self.__dict__ class TargetApiBadRequestError(TargetApiError): """ Server return 400 code - Bad request """ def __init__(self, *args, **kwargs): super(TargetApiBadRequestError, self).__init__() self.code = kwargs.pop('code', 400) self.msg = kwargs.pop('msg', 'Bad request') class TargetApiUnauthorizedError(TargetApiError): """ Server return 401 code - Unauthorized (Bad credentials) """ def __init__(self, *args, **kwargs): super(TargetApiUnauthorizedError, self).__init__() self.code = kwargs.pop('code', 401) self.msg = kwargs.pop('msg', 'Unauthorized') class TargetApiNotFoundError(TargetApiError): """ Server return 404 code - Not found """ def __init__(self, *args, **kwargs): super(TargetApiNotFoundError, self).__init__() self.code = kwargs.pop('code', 404) self.msg = kwargs.pop('msg', 'Not found') class TargetApiMethodNotAllowedError(TargetApiError): """ Server return 405 code - Method not allowed """ def __init__(self, *args, **kwargs): super(TargetApiMethodNotAllowedError, self).__init__() self.code = kwargs.pop('code', 405) self.msg = kwargs.pop('msg', 'Method not allowed') class TargetApiServerError(TargetApiError): """ Server return 500 code - Internal server error """ def __init__(self, *args, **kwargs): super(TargetApiServerError, self).__init__() self.code = kwargs.pop('code', 500) self.msg = kwargs.pop('msg', 'Internal server error') class TargetApiServiceUnavailableError(TargetApiError): """ Server return 503 code - Service is unavailable """ def __init__(self, *args, **kwargs): super(TargetApiServiceUnavailableError, self).__init__() self.code = kwargs.pop('code', 503) self.msg = kwargs.pop('msg', 'Service unavailable') class TargetApiParameterNotImplementedError(TargetApiError): """ Error, when some required parameter is not implemented """ def __init__(self, *args, **kwargs): super(TargetApiParameterNotImplementedError, self).__init__() self.parameter = kwargs.pop('parameter', '') def __str__(self): if self.parameter is not None: return 'TargetAPI error: Parameter %(parameter)s not implemented' % self.__dict__ return 'TargetAPI error: Parameter not implemented' class TargetApiUnknownError(TargetApiError): """ Unknown error """ def __init__(self, *args, **kwargs): super(TargetApiUnknownError, self).__init__() self.msg = kwargs.pop('msg', 'Unknown error')
PAD = 0 UNK = 1 EOS = 2 BOS = 3 PAD_WORD = '<blank>' UNK_WORD = '<unk>' EOS_WORD = '<eos>' BOS_WORD = '<bos>'
#!/usr/bin/env python3 class Solution(object): def isNumber(self, s): """ :type s: str :rtype: bool """ state = [{}, {'blank': 1, 'sign': 2, 'digit': 3, '.': 4}, {'digit': 3, '.': 4}, {'digit': 3, '.': 5, 'e': 6, 'blank': 9}, {'digit': 5}, {'digit': 5, 'e': 6, 'blank': 9}, {'sign': 7, 'digit': 8}, {'digit': 8}, {'digit': 8, 'blank': 9}, {'blank': 9}] curr_state = 1 for c in s: if c >= '0' and c <= '9': c = 'digit' if c == ' ': c = 'blank' if c in ['+', '-']: c = 'sign' if c not in state[curr_state].keys(): return False curr_state = state[curr_state][c] if curr_state not in [3, 5, 8, 9]: return False return True if __name__ == "__main__": s = Solution() s1 = "2e10" result = s.isNumber(s1) print(result)
class File: def __init__(self, name: str, kind: str, content=None, base64=False): self.content = content self.name = name self.type = kind self.base64 = base64 def save(self, path): with open(path, 'wb') as f: f.write(self.content) def open(self, path): with open(path, 'rb') as f: self.content = f.read()
# README! # # You can add your own maps, just follow the format: # mapX = ("Name shown to the user", PUT THE THREE QUOTATION MARKS (""") HERE # MAP GOES HERE, you can use any characters, but you can only define the map's borders # PUT THREE QUOTATION MARKS (""") HERE # #################################### # # You MUST put the maps in this order: map1 map2 map3 map4 map5 map6 map7 etc. # Quotation marks like this # V map1 = ("Tall", """ ############################################################ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ############################################################ """) # <-- use the quotation marks like this map2 = ("Tall/thin", """ ################################### # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ################################### """) # <-- use the quotation marks like this map3 = ("T h i c c square", """ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ """) map4 = ("32x32 (because of characters' nature, which are taller than how large they are, this map will look rectangular", """ QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ """)
class Chain(): def __init__(self, val): self.val = val def add(self, b): self.val += b return self def sub(self, b): self.val -= b return self def mul(self, b): self.val *= b return self print(Chain(5).add(5).sub(2).mul(10))
#passed Test Set 1 in py # def romanToInt(s): # translations = { # "I": 1, # "V": 5, # "X": 10, # "L": 50, # "C": 100, # "D": 500, # "M": 1000 # } # number = 0 # s = s.replace("IV", "IIII").replace("IX", "VIIII") # s = s.replace("XL", "XXXX").replace("XC", "LXXXX") # s = s.replace("CD", "CCCC").replace("CM", "DCCCC") # for char in s: # number += translations[char] # print(number) def make_change(s): # num = 0; # temp = s s = s.replace("01","2"); s = s.replace("12","3"); s = s.replace("23","4"); s = s.replace("34","5"); s = s.replace("45","6"); s = s.replace("56","7"); s = s.replace("67","8"); s = s.replace("78","9"); s = s.replace("89","0"); s = s.replace("90","1"); return s; # if(temp == s): # # return num; # return s; # else: # return make_change(s); t=int(input()) tt=1 while(tt<=t): n=int(input()) s=input() # temp = s while(True): temp = s s = make_change(s) if(temp == s): break; # ans = make_change(s) print("Case #",tt,": ",s,sep='') tt+=1
EQUAL_ROWS_DATAFRAME_NAME = \ 'dataframe_of_equal_rows' NON_EQUAL_ROWS_DATAFRAME_NAME = \ 'dataframe_of_non_equal_rows'
# HEAD # Augmented Assignment Operators # DESCRIPTION # Describes basic usage of all the augmented operators available # RESOURCES # foo = 40 # Addition augmented operator foo += 1 print(foo) # Subtraction augmented operator foo -= 1 print(foo) # Multiplication augmented operator foo *= 1 print(foo) # Division augmented operator foo /= 2 print(foo) # Modulus augmented operator foo %= 3 print(foo) # Modulus augmented operator foo //= 3 print(foo) # Example Usage strOne = 'Testing' listOne = [1, 2] strOne += ' String' # concat for strings and lists print(strOne) listOne *= 2 # replication for strings and lists print(listOne)
def test_client_can_get_avatars(client): resp = client.get('/api/avatars') assert resp.status_code == 200 def test_client_gets_correct_avatars_fields(client): resp = client.get('/api/avatars') assert 'offset' in resp.json assert resp.json['offset'] is None assert 'total' in resp.json assert 'data' in resp.json assert resp.json['total'] == len(resp.json['data']) assert { 'avatar_id', 'category', 'uri', 'created_at', 'updated_at', } == set(resp.json['data'][0].keys()) def test_client_filters_avatars_fields(client): resp = client.get('/api/avatars?fields=category,created_at') avatars = resp.json['data'] assert { 'category', 'created_at', } == set(avatars[0].keys()) def test_client_offsets_avatars(client): resp_1 = client.get('/api/avatars') resp_2 = client.get('/api/avatars?offset=2') assert len(resp_1.json['data']) \ == len(resp_2.json['data']) + min(2, len(resp_1.json['data'])) def test_client_limits_avatars(client): resp_1 = client.get('/api/avatars?max_n_results=1') resp_2 = client.get('/api/avatars?max_n_results=2') assert len(resp_1.json['data']) <= 1 assert len(resp_2.json['data']) <= 2 def test_logged_off_client_cannot_create_avatar(client): resp = client.post('/api/avatars', data={ 'uri': 'http://newavatars.com/img.png', 'category': 'dummy', } ) assert resp.status_code == 401 def test_logged_in_user_cannot_create_avatar(client_with_tok): resp = client_with_tok.post('/api/avatars', data={ 'uri': 'http://newavatars.com/img.png', 'category': 'dummy', } ) assert resp.status_code == 401 def test_logged_in_mod_cannot_create_avatar(mod_with_tok): resp = mod_with_tok.post('/api/avatars', data={ 'uri': 'http://newavatars.com/img.png', 'category': 'dummy', } ) assert resp.status_code == 401 def test_logged_in_admin_can_create_avatar(admin_with_tok): resp = admin_with_tok.post('/api/avatars', data={ 'uri': 'http://newavatars.com/img.png', 'category': 'dummy', } ) assert resp.status_code == 200 def test_logged_in_admin_gets_correct_data_on_user_creation(admin_with_tok): resp = admin_with_tok.post('/api/avatars', data={ 'uri': 'http://newavatars.com/img.png', 'category': 'dummy', } ) assert 'data' in resp.json assert resp.json['data']['uri'] == 'http://newavatars.com/img.png' assert resp.json['data']['category'] == 'dummy' def test_client_can_get_avatar(client, avatar_id): resp = client.get('/api/avatars/{}'.format(avatar_id)) assert resp.status_code == 200 assert 'data' in resp.json def test_client_gets_correct_avatar_fields(client, avatar_id): resp = client.get('/api/avatars/{}'.format(avatar_id)) assert 'data' in resp.json assert { 'avatar_id', 'category', 'uri', 'created_at', 'updated_at', } == set(resp.json['data'].keys()) def test_logged_off_client_cannot_edit_avatar(client, avatar_id): resp = client.put('/api/avatars/{}'.format(avatar_id), data={ 'uri': 'http://newavatars.com/newimg.png', } ) assert resp.status_code == 401 def test_logged_in_user_cannot_edit_avatar(client_with_tok, avatar_id): resp = client_with_tok.put('/api/avatars/{}'.format(avatar_id), data={ 'uri': 'http://newavatars.com/newimg.png', } ) assert resp.status_code == 401 def test_logged_in_mod_cannot_edit_avatar(mod_with_tok, avatar_id): resp = mod_with_tok.put('/api/avatars/{}'.format(avatar_id), data={ 'uri': 'http://newavatars.com/newimg.png', } ) assert resp.status_code == 401 def test_logged_in_admin_can_edit_avatar(admin_with_tok, avatar_id): resp = admin_with_tok.put('/api/avatars/{}'.format(avatar_id), data={ 'uri': 'http://newavatars.com/img.png', 'category': 'dummy', } ) assert resp.status_code == 200 def test_logged_in_admin_gets_correct_put_fields(admin_with_tok, avatar_id): resp = admin_with_tok.put('/api/avatars/{}'.format(avatar_id), data={ 'category': 'newcategory', } ) assert 'data' in resp.json assert { 'avatar_id', 'category', 'uri', 'created_at', 'updated_at', } == set(resp.json['data'].keys()) def test_logged_in_admin_corretly_edits_avatar(admin_with_tok, avatar_id): resp_1 = admin_with_tok.get('/api/avatars/{}'.format(avatar_id)) resp_2 = admin_with_tok.put('/api/avatars/{}'.format(avatar_id), data={ 'category': resp_1.json['data']['category'] + '_altered', 'uri': resp_1.json['data']['uri'] + '.png', } ) resp_3 = admin_with_tok.get('/api/avatars/{}'.format(avatar_id)) assert resp_1.status_code == 200 assert resp_2.status_code == 200 assert resp_3.status_code == 200 assert resp_3.json['data']['category'] \ == resp_1.json['data']['category'] + '_altered' assert resp_3.json['data']['uri'] \ == resp_1.json['data']['uri'] + '.png' def test_logged_off_client_cannot_delete_avatar(client, avatar_id): resp = client.delete('/api/avatars/{}'.format(avatar_id)) assert resp.status_code == 401 def test_logged_in_user_cannot_delete_avatar(client_with_tok, avatar_id): resp = client_with_tok.delete('/api/avatars/{}'.format(avatar_id)) assert resp.status_code == 401 def test_logged_in_mod_cannot_delete_avatar(mod_with_tok, avatar_id): resp = mod_with_tok.delete('/api/avatars/{}'.format(avatar_id)) assert resp.status_code == 401 def test_logged_in_admin_can_delete_avatar(admin_with_tok, avatar_id): resp = admin_with_tok.delete('/api/avatars/{}'.format(avatar_id)) assert resp.status_code == 204 def test_logged_in_admin_corretly_deletes_avatar(admin_with_tok, avatar_id): resp_1 = admin_with_tok.get('/api/avatars/{}'.format(avatar_id)) resp_2 = admin_with_tok.delete('/api/avatars/{}'.format(avatar_id)) resp_3 = admin_with_tok.get('/api/avatars/{}'.format(avatar_id)) assert resp_1.status_code == 200 assert resp_2.status_code == 204 assert resp_3.status_code == 404
""" Question: Write a program that accepts a comma separated sequence of words as input and prints the words in a comma-separated sequence after sorting them alphabetically. Suppose the following input is supplied to the program: without,hello,bag,world Then, the output should be: bag,hello,without,world """ enter_string = input() items = [x for x in enter_string.split(',')] items.sort() print(','.join(items)) """ Input : lionel, christiano, diego, aguero Output : aguero, christiano, diego,lionel """
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def diameterOfBinaryTree(self, root: TreeNode) -> int: def helper(root): if root is None: return 0,0 if root.left is None and root.right is None: return 1,1 l1,m1 = helper(root.left) l2,m2 = helper(root.right) l = max(l1,l2) + 1 m = max(l1 + l2 + 1, m1 ,m2) return l,m l,m = helper(root) if m: return m -1 return m
data_in: str = str() balance: float = float() deposit: float = float() while True: data_in = input() if data_in == 'NoMoreMoney': break deposit = float(data_in) if deposit < 0: print('Invalid operation!') break print(f'Increase: {deposit:.2f}') balance += deposit print(f'Total: {balance:.2f}')
class Solution: # # Track unsorted indexes using sets (Revisited), O(n*m) time, O(n) space # def minDeletionSize(self, strs: List[str]) -> int: # n, m = len(strs), len(strs[0]) # unsorted = set(range(n-1)) # res = 0 # for j in range(m): # if any(strs[i][j] > strs[i+1][j] for i in unsorted): # res += 1 # else: # unsorted -= {i for i in unsorted if strs[i][j] < strs[i+1][j]} # return res # Track unsorted indexes using sets (Top Voted), O(n*m) time, O(n) space def minDeletionSize(self, A: List[str]) -> int: res, n, m = 0, len(A), len(A[0]) unsorted = set(range(n - 1)) for j in range(m): if any(A[i][j] > A[i + 1][j] for i in unsorted): res += 1 else: unsorted -= {i for i in unsorted if A[i][j] < A[i + 1][j]} return res
# code t = int(input()) for _ in range(t): n = int(input()) temp = list(map(int, input().split())) l = [temp[i:i+n] for i in range(0, len(temp), n)] del temp weight = 1 for i in range(n): l.append(list(map(int, input().split(',')))) row = 0 col = 0 suml = 0 while True: if row < n-1 and col < n-1: a = min(l[row+1][col], l[row][col+1]) if a == l[row+1][col]: row += 1 else: col += 1 suml += a if row == n-1 and col < n-1: col += 1 a = l[row][col] suml += a if row < n-1 and col == n-1: row += 1 a = l[row][col] suml += a if row == n-1 and col == n-1: a = l[row][col] suml += a print(suml) break
num = int(input("Digite um número Natural: ")) #cont = 0 #list = [] list_div = [] for c in range(1, num + 1): if num % c == 0: #cont += 1 list_div.append(c) #list.append(c) print(list) print('='*40) print(f'{num} possui {len(list_div)} divisores!\n' f'Os dividores de {num} são: {list_div}') if len(list_div) == 2: print(f'{num} é primo')
def Efrase(frase): nums = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9') if frase.count('.') == 1 and frase[len(frase) - 1] != '.' or frase == '.': return False elif frase.count('.') > 1: return False for j in range(0, 10): if nums[j] in frase: return False return True #entrada while True: try: frase = str(input()).strip().split() #processamento fraseValida = '' for i in range(0, len(frase)): #frase valida (eliminando palavras invalidas) if Efrase(frase[i]): fraseValida = fraseValida + ' ' + frase[i] fraseValida = fraseValida.strip().split() nPalavras = len(fraseValida) m = ponto = 0 for i in range(0, nPalavras): #calculando o tamanho medio das palavras m += len(fraseValida[i]) ponto += fraseValida[i].count('.') m -= ponto if nPalavras > 0: m = m // nPalavras else: m = 0 #saida if m <= 3: print(250) elif m <= 5: print(500) else: print(1000) except EOFError: break
#!/usr/bin/env python outlinks_file = open('link_graph_ly.txt', 'r') inlinks_file = open('link_graph_ly2.txt', 'w') inlinks = {} # url -> list of inlinks in url for line in outlinks_file.readlines(): urls = line.split() if (len(urls)) < 1: continue url = urls[0] inlinks[url] = [] outlinks_file.seek(0) for line in outlinks_file.readlines(): urls = line.split() if (len(urls)) < 1: continue url = urls[0] outlinks = urls[1:] for ol in outlinks: if ol in inlinks: inlinks[ol].append(url) # Write to file for url in inlinks: inlinks_file.write(url + ' ' + ' '.join(inlinks[url]) + '\n') inlinks_file.flush() inlinks_file.close()
''' Analysing the letter 'A' in a phrase. ''' phrase = str(input('Type any phrase: ')).strip().lower() print('The letter A appears {} times in this phrase.'.format(phrase.count('a'))) print('The first letter A appeared on the {}º position.'.format(phrase.find('a')+1)) print('The last letter A appeared on the {}º position.'.format(phrase.rfind('a')+1))
quiz = { 1 : { "question" : " Who developed the Python language?\n\n\n", "answer" : "Guido van Rossum" }, 2 : { "question" : "In which year was the Python language developed?\n\n\n", "answer" : "1989" }, 3 : { "question" : "In which language is Python written?\n\n\n", "answer" : "C" }, 4 : { "question" : "Which extension is the correct extension of the Python file?\n\n\n", "answer" : ".py" }, 5 : { "question" : "What do we use to define a block of code in Python language?\n\n\n", "answer" : "Indentation" }, 6 : { "question" : " Which character is used in Python to make a single line comment?\n\n\n", "answer" : "#" }, 7 : { "question" : " What is the method inside the class in python language?\n\n\n", "answer" : "Function" }, 8 : { "question" : "Which of the following is not a keyword in Python language? \n" " 1)val \n" " 2)raise\n" " 3)try \n" " 4)with\n\n\n", "answer" : "1" }, 9 : { "question" : "Which of the following words cannot be a variable in python language?\n" " 1)_val \n" " 2)val \n" " 3)try \n" " 4)_try_\n\n\n", "answer": "2" }, 10 : { "question" : "Which of the following operators is the correct option for power(ab)?\n" "1) a ^ b\n" "2) a**b\n" "3) a ^ ^ b\n" "4) a ^ * b\n\n\n", "answer" : "2" }, 11 : { "question" : "What happens when '2' == 2 is executed?\n\n\n", "answer" : "False" }, 12 : { "question" : "Which string method is used to check if all the given characters in a" " Python string defined in our program are alphabets?\n\n\n", "answer" : "isalpha()" }, 13 : { "question" : " Which string method is used to check if all the given characters " "in a Python string defined in our program are in lower case?\n\n\n", "answer" : "islower()" }, 14 : { "question" : "Which of the following is not a token defined in Python \n " " 1)Keywords \n" " 2) Comments \n" " 3)Literals \n" " 4)Operators \n\n\n", "answer" : "2" }, 15: { "question" : "Which one of the following is the type of literal collections provided to us in Python?\n" " 1)String literals\n " " 2)Numeric literals\n" " 3) List literals\n " " 4)Boolean literals\n\n\n", "answer" : "3" }, 16: { "question" : "Which of the following type of Python operator will only print True or False in output when we use it in our program?\n" " 1) Assignment operator\n" " 2)Membership operator\n" " 3)Arithmetic operator\n" " 4)Comparison operator\n\n\n", "answer" : "4" }, 17: { "question" : " Why ‘pass’ keyword is use in a Python program?\n" "1)Pass keyword is use to exit the given program.\n" "2)Pass keyword is use to execute nothing.\n" "3)Pass keyword is use to stop the execution of loop.\n" "4)Pass keyword is use to exit the given loop in program.\n\n\n", "answer" : "4" }, }
def init(cfg): data = {'_logLevel': 'WARN', '_moduleLogLevel': 'WARN'} if cfg['_stage'] == 'dev': data.update({ '_logLevel': 'DEBUG', '_moduleLogLevel': 'WARN', '_logFormat': '%(levelname)s: %(message)s' }) return data
"""Common configs for plots""" class Base(): font = { 'family': 'Times New Roman', 'size': 16, } class Legend(Base): font = {**Base.font, 'weight': 'bold'} class Tick(Base): font = {**Base.font, 'size': 12}
"""read()""" f = open("./test_file2", 'r', encoding = 'utf-8') # read a file line-by-line using a for loop for line in f: print(line, end='') # read individual lines of a file f5 = f.readline() f6 = f.readline() f7 = f.readline() print("f5\n", f5) print("f6\n", f6) print("f7\n", f7) # list of remaining lines of the entire file. f8 = f.readlines() print("f8\n", f8)
user1_input = int(input("Please enter number 1 : Rock or 2 : Scissors or 3 : Papers.")) user2_input = int(input("Please enter number 1 : Rock or 2 : Scissors or 3 : Papers.")) if user1_input == 1: user1_input = 'Rock' elif user1_input == 2: user1_input = 'Scissors' else: user1_input = 'Papers' if user2_input == 1: user2_input = 'Rock' elif user2_input == 2: user2_input = 'Scissors' else: user2_input = 'Papers' while user1_input != user2_input: if user1_input == 'Rock': if user2_input == 'Papers': print("User2 is the winner") break elif user2_input == 'Scissors': print("User1 is the winner") break elif user1_input == 'Scissors': if user2_input == 'Rock': print("User2 is the winner.") break elif user2_input == 'Papers': print("User1 is the winner.") break elif user1_input == 'Papers': if user2_input == 'Scissors': print("User2 is the winner.") break elif user2_input == 'Rock': print("User1 is the winner.") break # Another Solution attempted on 14/2/2020 while True: print("Please input your command") print("1 : Play Rock, Scissors and Paper Game") print("0 : Exit the Game\n") command = int(input("\nEnter your command")) if command == 0: break elif command == 1: choices = [] for i in range(1, 3): plays = ['Rock', 'Scissors', 'Players'] print(f'Enter play for user {i}\n') print("1. Rock \n", "2. Scissors \n", "3. Paper\n",) choice = int(input("\nPlease enter your choice")) if choice == 1: choices.append("Rock") if choice == 2: choices.append("Scissors") if choice == 3: choices.append("Paper") if choices[0] == choices[1]: print("===" * 10) print("It is a draw") print("===" * 10) else: if choices[0] == "Rock" and choices[1] == "Scissors": print("\nPlayer 1 is the winner\n") elif choices[0] == "Scissors" and choices[1] == "Paper": print("\nPlayer 1 is the winner\n") elif choices[0] == "Paper" and choices[1] == "Rock": print("\nPlayer1 is the winner\n") else: print("\nPlayer 2 is the winner\n")
class AdvancedBoxScore: def __init__(self, seconds_played, offensive_rating, defensive_rating, teammate_assist_percentage, assist_to_turnover_ratio, assists_per_100_possessions, offensive_rebound_percentage, defensive_rebound_percentage, turnovers_per_100_possessions, effective_field_goal_percentage, true_shooting_percentage): self.seconds_played = seconds_played self.offensive_rating = offensive_rating self.defensive_rating = defensive_rating self.teammate_assist_percentage = teammate_assist_percentage self.assist_to_turnover_ratio = assist_to_turnover_ratio self.assists_per_100_possessions = assists_per_100_possessions self.offensive_rebound_percentage = offensive_rebound_percentage self.defensive_rebound_percentage = defensive_rebound_percentage self.turnovers_per_100_possessions = turnovers_per_100_possessions self.effective_field_goal_percentage = effective_field_goal_percentage self.true_shooting_percentage = true_shooting_percentage def __unicode__(self): return '{0} | {1}'.format(self.get_additional_unicode(), self.get_base_unicode) def get_base_unicode(self): return 'seconds played: {seconds_played} | offensive rating: {offensive_rating} | ' \ 'defensive rating: {defensive_rating} | teammate assist percentage: {teammate_assist_percentage} |' \ 'assist to turnover ratio: {assist_to_turnover_ratio} | ' \ 'assists per 100 possessions: {assists_per_100_possessions} | ' \ 'offensive rebound percentage: {offensive_rebound_percentage} |' \ 'defensive rebound percentage: {defensive_rebound_percentage} |' \ 'turnovers per 100 possessions: {turnovers_per_100_possessions} |' \ 'effective field goal percentage: {effective_field_goal_percentage} |' \ 'true shooting percentage: {true_shooting_percentage}'\ .format(seconds_played=self.seconds_played, offensive_rating=self.offensive_rating, defensive_rating=self.defensive_rating, teammate_assist_percentage=self.teammate_assist_percentage, assist_to_turnover_ratio=self.assist_to_turnover_ratio, assists_per_100_possessions=self.assists_per_100_possessions, offensive_rebound_percentage=self.offensive_rebound_percentage, defensive_rebound_percentage=self.defensive_rebound_percentage, turnovers_per_100_possessions=self.turnovers_per_100_possessions, effective_field_goal_percentage=self.effective_field_goal_percentage, true_shooting_percentage=self.true_shooting_percentage) def get_additional_unicode(self): return NotImplementedError('Should be implemented in concrete class') class AdvancedPlayerBoxScore(AdvancedBoxScore): def __init__(self, player, seconds_played, offensive_rating, defensive_rating, teammate_assist_percentage, assist_to_turnover_ratio, assists_per_100_possessions, offensive_rebound_percentage, defensive_rebound_percentage, turnovers_per_100_possessions, effective_field_goal_percentage, true_shooting_percentage, usage_percentage): self.player = player self.usage_percentage = usage_percentage AdvancedBoxScore.__init__(self, seconds_played=seconds_played, offensive_rating=offensive_rating, defensive_rating=defensive_rating, teammate_assist_percentage=teammate_assist_percentage, assist_to_turnover_ratio=assist_to_turnover_ratio, assists_per_100_possessions=assists_per_100_possessions, offensive_rebound_percentage=offensive_rebound_percentage, defensive_rebound_percentage=defensive_rebound_percentage, turnovers_per_100_possessions=turnovers_per_100_possessions, effective_field_goal_percentage=effective_field_goal_percentage, true_shooting_percentage=true_shooting_percentage) def get_additional_unicode(self): return 'player: {player} | usage percentage: {usage_percentage}'.format(player=self.player, usage_percentage=self.usage_percentage) class AdvancedTeamBoxScore(AdvancedBoxScore): def __init__(self, team, seconds_played, offensive_rating, defensive_rating, teammate_assist_percentage, assist_to_turnover_ratio, assists_per_100_possessions, offensive_rebound_percentage, defensive_rebound_percentage, turnovers_per_100_possessions, effective_field_goal_percentage, true_shooting_percentage): self.team = team AdvancedBoxScore.__init__(self, seconds_played=seconds_played, offensive_rating=offensive_rating, defensive_rating=defensive_rating, teammate_assist_percentage=teammate_assist_percentage, assist_to_turnover_ratio=assist_to_turnover_ratio, assists_per_100_possessions=assists_per_100_possessions, offensive_rebound_percentage=offensive_rebound_percentage, defensive_rebound_percentage=defensive_rebound_percentage, turnovers_per_100_possessions=turnovers_per_100_possessions, effective_field_goal_percentage=effective_field_goal_percentage, true_shooting_percentage=true_shooting_percentage) def get_additional_unicode(self): return 'team: {team}'.format(team=self.team) class TraditionalBoxScore: def __init__(self, seconds_played, field_goals_made, field_goals_attempted, three_point_field_goals_made, three_point_field_goals_attempted, free_throws_made, free_throws_attempted, offensive_rebounds, defensive_rebounds, assists, steals, blocks, turnovers, personal_fouls): self.seconds_played = seconds_played self.field_goals_made = field_goals_made self.field_goals_attempted = field_goals_attempted self.three_point_field_goals_made = three_point_field_goals_made self.three_point_field_goals_attempted = three_point_field_goals_attempted self.free_throws_made = free_throws_made self.free_throws_attempted = free_throws_attempted self.offensive_rebounds = offensive_rebounds self.defensive_rebounds = defensive_rebounds self.assists = assists self.steals = steals self.blocks = blocks self.turnovers = turnovers self.personal_fouls = personal_fouls def __unicode__(self): return '{0} | {1}'.format(self.get_additional_unicode(), self.get_base_unicode()) def get_base_unicode(self): return 'seconds played: {seconds_played} | field goals made: {field_goals_made} |' \ 'field goals attempted: {field_goals_attempted} | ' \ 'three point field goals made: {three_point_field_goals_made} | ' \ 'three point field goals attempted: {three_point_field_goals_attempted} | ' \ 'free throws made: {free_throws_made} |' 'free throws attempted: {free_throws_attempted} | ' \ 'offensive rebounds: {offensive rebounds} |' 'defensive rebounds: {defensive rebounds} | ' \ 'assists: {assists} | steals: {steals} | blocks: {blocks} | turnovers: {turnovers} | ' \ 'personal fouls: {personal_fouls}'.format(seconds_played=self.seconds_played, field_goals_made=self.field_goals_made, field_goals_attempted=self.field_goals_attempted, three_point_field_goals_made=self.three_point_field_goals_made, three_point_field_goals_attempted=self.three_point_field_goals_attempted, free_throws_made=self.free_throws_made, free_throws_attempted=self.free_throws_attempted, offensive_rebounds=self.offensive_rebounds, defensive_rebounds=self.defensive_rebounds, assists=self.assists, steals=self.steals, blocks=self.blocks, turnovers=self.turnovers, personal_fouls=self.personal_fouls) def get_additional_unicode(self): raise NotImplementedError('Implement in concrete classes') class TraditionalPlayerBoxScore(TraditionalBoxScore): def __init__(self, player, seconds_played, field_goals_made, field_goals_attempted, three_point_field_goals_made, three_point_field_goals_attempted, free_throws_made, free_throws_attempted, offensive_rebounds, defensive_rebounds, assists, steals, blocks, turnovers, personal_fouls, plus_minus): self.player = player self.plus_minus = plus_minus TraditionalBoxScore.__init__(self, seconds_played=seconds_played, field_goals_made=field_goals_made, field_goals_attempted=field_goals_attempted, three_point_field_goals_made=three_point_field_goals_made, three_point_field_goals_attempted=three_point_field_goals_attempted, free_throws_made=free_throws_made, free_throws_attempted=free_throws_attempted, offensive_rebounds=offensive_rebounds, defensive_rebounds=defensive_rebounds, assists=assists, steals=steals, blocks=blocks, turnovers=turnovers, personal_fouls=personal_fouls) def get_additional_unicode(self): return 'player: {player} | plus minus: {plus_minus}'.format(player=self.player, plus_minus=self.plus_minus) class TraditionalTeamBoxScore(TraditionalBoxScore): def __init__(self, team, seconds_played, field_goals_made, field_goals_attempted, free_throws_attempted, three_point_field_goals_made, three_point_field_goals_attempted, free_throws_made, offensive_rebounds, defensive_rebounds, assists, steals, blocks, turnovers, personal_fouls): self.team = team TraditionalBoxScore.__init__(self, seconds_played=seconds_played, field_goals_made=field_goals_made, field_goals_attempted=field_goals_attempted, three_point_field_goals_made=three_point_field_goals_made, three_point_field_goals_attempted=three_point_field_goals_attempted, free_throws_made=free_throws_made, free_throws_attempted=free_throws_attempted, offensive_rebounds=offensive_rebounds, defensive_rebounds=defensive_rebounds, assists=assists, steals=steals, blocks=blocks, turnovers=turnovers, personal_fouls=personal_fouls) def get_additional_unicode(self): return 'team: {team}'.format(self.team) class GameBoxScore: def __init__(self, game_id, player_box_scores, team_box_scores): self.game_id = game_id self.player_box_scores = player_box_scores self.team_box_scores = team_box_scores
def solution(A): # write your code in Python 3.6 disks = [] for i,v in enumerate(A): disks.append((i-v,1)) disks.append((i+v,0)) disks.sort(key=lambda x: (x[0], not x[1])) active = 0 intersections = 0 for i,isBegin in disks: if isBegin: intersections += active active += 1 else: active -= 1 if intersections > 10**7: return -1 return intersections
""" Given an integer array, adjust each integers so that the difference of every adjcent integers are not greater than a given number target. If the array before adjustment is A, the array after adjustment is B, you should minimize the sum of |A[i]-B[i]| Note You can assume each number in the array is a positive integer and not greater than 100 Example Given [1,4,2,3] and target=1, one of the solutions is [2,3,2,3], the adjustment cost is 2 and it's minimal. Return 2. """ __author__ = 'Danyang' class Solution: def MinAdjustmentCost(self, A, target): """ state dp f[i][j] = min(f[i-1][k] + |a[i]-j|, for k j-l to j+l) comments: similar to Vertibi algorithm (Hidden Markov Model) :param A: An integer array. :param target: An integer. """ S = 100 n = len(A) f = [[1<<31 for _ in xrange(S+1)] for _ in xrange(n+1)] for j in xrange(S+1): f[0][j] = 0 for i in xrange(1, n+1): for j in xrange(1, S+1): for k in xrange(max(1, j-target), min(S, j+target)+1): f[i][j] = min(f[i][j], f[i-1][k]+abs(A[i-1]-j)) mini = 1<<31 for j in xrange(1, S+1): mini = min(mini, f[n][j]) return mini if __name__ == "__main__": assert Solution().MinAdjustmentCost([12, 3, 7, 4, 5, 13, 2, 8, 4, 7, 6, 5, 7], 2) == 19
def repeatedString(s, n): total = s.count("a") * int(n/len(s)) total += s[:n % len(s)].count("a") return total s = "aba" n = 10 n = int(n) repeatedString(s, n)
# ====================================================================== # Beverage Bandits # Advent of Code 2018 Day 15 -- Eric Wastl -- https://adventofcode.com # # Python implementation by Dr. Dean Earl Wright III # ====================================================================== # ====================================================================== # p e r s o n . p y # ====================================================================== "People and persons for the Advent of Code 2018 Day 15 puzzle" # ---------------------------------------------------------------------- # import # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # constants # ---------------------------------------------------------------------- ROW_MULT = 100 ADJACENT = [-100, -1, 1, 100] # ---------------------------------------------------------------------- # location # ---------------------------------------------------------------------- def row_col_to_loc(row, col): return row * ROW_MULT + col def loc_to_row_col(loc): return divmod(loc, ROW_MULT) def distance(loc1, loc2): loc1row, loc1col = loc_to_row_col(loc1) loc2row, loc2col = loc_to_row_col(loc2) return abs(loc1row - loc2row) + abs(loc1col - loc2col) def adjacent(loc1, loc2): return distance(loc1, loc2) == 1 # ====================================================================== # Person # ====================================================================== class Person(object): # pylint: disable=R0902, R0205 "Elf/Goblin for Beverage Bandits" def __init__(self, letter='#', location=0, attack=3): # 1. Set the initial values self.letter = letter self.location = location self.hitpoints = 200 self.attack = attack def distance(self, location): return distance(self.location, location) def attacks(self, other): other.hitpoints = max(0, other.hitpoints - self.attack) def adjacent(self): return [self.location + a for a in ADJACENT] # ====================================================================== # People # ====================================================================== class People(object): # pylint: disable=R0902, R0205 "Multiple Elf/Goblin for Beverage Bandits" def __init__(self, letter='#'): # 1. Set the initial values self.letter = letter self.persons = {} def __len__(self): return len(self.persons) def __getitem__(self, loc): if loc in self.persons: return self.persons[loc] else: raise AttributeError("No such location: %s" % loc) def __setitem__(self, loc, person): if self.letter != person.letter: raise ValueError("Incompatable letters: %s != %s" % (self.letter, person.letter)) if loc != person.location: raise ValueError("Incompatable locations: %s != %s" % (loc, person.location)) self.persons[loc] = person def __delitem__(self, loc): if loc in self.persons: del self.persons[loc] else: raise AttributeError("No such location: %s" % loc) def __iter__(self): return iter(self.persons) def __contains__(self, loc): return loc in self.persons def add(self, person): if self.letter != person.letter: raise ValueError("Incompatable letters: %s != %s" % (self.letter, person.letter)) if person.location in self.persons: raise ValueError("Location %s already occuried" % (person.location)) self.persons[person.location] = person def locations(self): keys = list(self.persons.keys()) keys.sort() return keys def hitpoints(self): return sum([x.hitpoints for x in self.persons.values()]) # ---------------------------------------------------------------------- # module initialization # ---------------------------------------------------------------------- if __name__ == '__main__': pass # ====================================================================== # end p e r s o n . p y end # ======================================================================
""" here we produce visualization with excel # one-time excel preparation in cmder xlwings addin install open excel enable Trust access to VBA File > Options > Trust Center > Trust Center Settings > Macro Settings # making the visualization workbook in cmder chdir this_directory xlwings quickstart book_report the result of this is in sol_book_report\* # studying the visualization in cmder type excel open with excel sol_book_report\book_report.xlsm open with sublime book_report.py """
""" 进程控制类 """ """ PCB 进程控制块 """ class PCB(object): def __init__(self, name, a_time, e_time, priority): self.name = name # 进程名 self.u_time = 0 # 已经被调度的时间 self.a_time = a_time # 进程到来的时间 self.e_time = e_time # 预计需要被调度的时间 self.priority = priority # 优先级 """ 进程控制块队列 """ class PCBList(object): def __init__(self): self.pcb_list = list() def append(self, pcb): self.pcb_list.append(pcb) def pop(self): return self.pcb_list.pop(0) def pop_min_e_time(self): index = 0 for i in range(0, len(self.pcb_list)): if self.pcb_list[i].e_time < self.pcb_list[index].e_time: index = i return self.pcb_list.pop(index) def pop_max_priority(self): index = 0 for i in range(0, len(self.pcb_list)): if self.pcb_list[i].priority < self.pcb_list[index].priority: index = i return self.pcb_list.pop(index) def empty(self): return len(self.pcb_list) == 0
def Singleton(cls): _instance = {} def _singleton(*args, **kwargs): if cls not in _instance: _instance[cls] = cls(*args, *kwargs) return _instance[cls] return _singleton @Singleton class A(object): def __init__(self, x): self.x = x if __name__ == '__main__': a = A(12) print(a.x)
"""501. Find Mode in Binary Search Tree""" # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution(object): def findMode(self, root): """ :type root: TreeNode :rtype: List[int] """ nums = [] if not root: return None self.dfs(root, nums) d = {} for num in nums: if num not in d: d[num] = 1 else: d[num] += 1 res = [] mode = max(d.values()) for key in d: if d[key] == mode: res.append(key) return res def dfs(self, node, nums): if not node: return self.dfs(node.left, nums) nums.append(node.val) self.dfs(node.right, nums)
def beau(vals, diff): lookup = set(vals) result = [] for x in vals: if x - diff in lookup and x + diff in lookup: result.append((x - diff, x, x + diff)) return result n, d = map(int, input().split()) values = tuple(map(int, input().split())) triplets = beau(values, d) print(len(triplets))
"""ex113 - Funcoes aprofundadas em Python""" def leiaInt(msg): while True: try: n = int(input(msg)) break except (ValueError, TypeError): print("\033[31mERRO: por favor, digite um numero inteiro valido.\033[m") continue return n def leiaFloat(msg): while True: try: n = float(input(msg)) break except (ValueError, TypeError): print("\033[31mERRO: por favor, digite um numero real valido.\033[m") continue return n n1 = leiaInt("Digite um numero inteiro: ") n2 = leiaFloat("Digite um numero real: ") print("O valor inteiro digitado foi {} e o real foi {}".format(n1, n2))
class matrix: def __init__(self, data): self.data = [data] if type(data[0]) != list else data #if not all(list(map(lambda x: len(x) == len(self.data[0]), self.data))): raise ValueError("Matrix shape is not OK") self.row = len(self.data) self.col = len(self.data[0]) self.shape = (self.row, self.col) #================================================================================== def __null__(self, shape, key = 1, diag = False): row, col = shape if row != col and diag: raise ValueError("Only square matrices could be diagonal") data = [[(key,(0, key)[i == j])[diag] for i in range(col)] for j in range(row)] return data #================================================================================== def __str__(self): return "{}".format(self.data) #================================================================================== def __repr__(self): str_ = "" for row in range(self.row): col_ = [] for col in range(self.col): col_.append(str(self.data[row][col])) str_ += "\t".join(col_) + "\n" return "Matrix({}x{})\n".format(self.row, self.col) + str_ #================================================================================== def __add__(self, other): if self.shape != other.shape: raise ValueError("Matrix shapes are not matched") data = self.__null__(self.shape, key = 0) for row in range(self.row): for col in range(self.col): data[row][col] = self.data[row][col] + other.data[row][col] return matrix(data) #================================================================================== def __sub__(self, other): if self.shape != other.shape: raise ValueError("Matrix shapes are not matched") data = self.__null__(self.shape, key = 0) for row in range(self.row): for col in range(self.col): data[row][col] = self.data[row][col] - other.data[row][col] return matrix(data) #================================================================================== def __mul__(self, other): if type(other) != matrix: raise ValueError("Non-matrix type variables must be placed at the left side of the matrix \n\t\t------> const * A(mxk)") elif self.col != other.row: raise ValueError("Matrix shapes did not satisfy the criteria of C(mxn) = A(mxk) * B(kxn)") data = self.__null__((self.row, other.col), key = 0) for row in range(self.row): for col in range(other.col): for mul in range(self.col): data[row][col] += self.data[row][mul] * other.data[mul][col] return matrix(data) #================================================================================== def __rmul__(self, const): data = self.__null__(self.shape, key = 0) for row in range(self.row): for col in range(self.col): data[row][col] = self.data[row][col] * const return matrix(data) #================================================================================== def __pow__(self, const): data = matrix(self.data) for i in range(const-1): data *= data return data #================================================================================== def __pos__(self): data = self.__null__(self.shape, key = 0) for row in range(self.row): for col in range(self.col): data[row][col] = +self.data[row][col] return matrix(data) #================================================================================== def __neg__(self): data = self.__null__(self.shape, key = 0) for row in range(self.row): for col in range(self.col): data[row][col] = -self.data[row][col] return matrix(data) #================================================================================== def __abs__(self): data = self.__null__(self.shape, key = 0) for row in range(self.row): for col in range(self.col): data[row][col] = abs(self.data[row][col]) return matrix(data) #================================================================================== def __int__(self): data = self.__null__(self.shape, key = 0) for row in range(self.row): for col in range(self.col): data[row][col] = int(self.data[row][col]) return matrix(data) #================================================================================== def __float__(self): data = self.__null__(self.shape, key = 0) for row in range(self.row): for col in range(self.col): data[row][col] = float(self.data[row][col]) return matrix(data) #================================================================================== def __and__(self, other): data = self.__null__(self.shape, key = 0) for row in range(self.row): for col in range(self.col): data[row][col] = self.data[row][col] & other.data[row][col] return matrix(data) #================================================================================== def __or__(self, other): data = self.__null__(self.shape, key = 0) for row in range(self.row): for col in range(self.col): data[row][col] = self.data[row][col] | other.data[row][col] return matrix(data) #================================================================================== def __lt__(self, const): data = self.__null__(self.shape, key = 0) for row in range(self.row): for col in range(self.col): data[row][col] = self.data[row][col] < const return matrix(data) #================================================================================== def __le__(self, const): data = self.__null__(self.shape, key = 0) for row in range(self.row): for col in range(self.col): data[row][col] = self.data[row][col] <= const return matrix(data) #================================================================================== def __eq__(self, const): data = self.__null__(self.shape, key = 0) for row in range(self.row): for col in range(self.col): data[row][col] = self.data[row][col] == const return matrix(data) #================================================================================== def __ne__(self, const): if self.shape != other.shape: raise ValueError("Matrix shapes are not matched") data = [] for i, j in zip(self.data, other.data): data.append(i != j) return matrix(data) #================================================================================== def __gt__(self, const): data = self.__null__(self.shape, key = 0) for row in range(self.row): for col in range(self.col): data[row][col] = self.data[row][col] > const return matrix(data) #================================================================================== def __ge__(self, const): data = self.__null__(self.shape, key = 0) for row in range(self.row): for col in range(self.col): data[row][col] = self.data[row][col] >= const return matrix(data) #================================================================================== def __getitem__(self, index): slide = [] for row in self.data[index[0]]: col_ = [] for col in row: col_.append(col[index[1]]) slide.append(col_) return matrix(slide) #================================================================================== def __setitem__(self, index, value): self.data[index] = value #================================================================================== def __iter__(self): return iter(self.data)
# In the Manager class of Self Check 11, override the getName method so that managers # have a * before their name (such as *Lin, Sally ). class Employee(): def __init__(self, name="", base_salary=0.0): self._name = name self._base_salary = base_salary def set_name(self, new_name): self._name = new_name def set_base_salary(self, new_salary): self._base_salary = new_salary def get_name(self): return self._name def get_salary(self): return self._base_salary class Manager(Employee): def __init__(self, name="", base_salary=0.0, bonus=0.0): super().__init__(name, base_salary) self._bonus = bonus def get_bonus(self): return self._bonus def get_name(self): return "* {}".format(super.get_name())
#!/usr/bin/env python # -*- coding:utf-8 -*- # TextReplaceResult.py # 2021, Lin Zhijun, https://github.com/toolgood/ToolGood.TextFilter.Api # MIT Licensed __all__ = ['ToolGood.TextFilter.TextReplaceResult'] class TextReplaceResult(): '返回码:0) 成功,1) 失败' code=0 '返回码详情描述' message="" '请求标识' requestId=0 '风险级别: PASS:正常内容,建议直接放行 REVIEW:可疑内容,建议人工审核 REJECT:违规内容,建议直接拦截' riskLevel="" '替换后的文本' resultText="" '风险详情, 详见 details' details=[]
typenames = {"int": 4} operations = {"+=", "-="} class VarNameCreator: state = 0 def __init__(self, state=0): self.state = state def char2latin(self, char): x = ('%s' % hex(ord(char)))[2:] #print(x, char) ans = [] #print(x) for el in x: if '0' <= el <= '9': ans.append(chr(ord(el) - ord('0') + ord('A'))) else: ans.append(chr(ord(el) + 10)) return "".join(ans) def newvar(self, readable_varname): self.state += 1 #print("newvar ", len(readable_varname)) name = [] for char in readable_varname: name.append(self.char2latin(char)) #name.append(self.char2latin(str(self.state))) res = "z".join(name) + 'variable' #print(readable_varname, "->", res) return res VarGen = VarNameCreator() class Codeline: def process(self): #print("line 45: ", self.tokens) #print(self.declarated) if (len(self.tokens) == 0 or len(self.tokens) == 1 and self.tokens[0] == ''): return if (self.tokens[0] in typenames): #this is declaration if len(self.tokens) == 1: #print("Invalid declaration in: %s" % (" ".join(self.tokens))) exit(0) name = self.tokens[1] self.declarated.append(name) self.data = '%s dd 0x0\n' % VarGen.newvar(name) #print("Declaration") #debug if (len(self.tokens) > 2): print("Operations after declacation are not supported: %s" % " ".join(self.tokens)) print("Use <type> <varname>") exit(0) else: if len(self.tokens) == 1: if self.tokens[0][0] == 'p': # print(myvar) myvarname = self.tokens[0][len("print("):-1] #print("printing... ", myvarname) myvar = "[" + VarGen.newvar(myvarname) + "]" self.external.append(myvarname) self.code += "\npush rax\nmov rax,%s\ncall printInt\nmov rax,endl\ncall print\npop rax\n" % myvar else: myvarname = self.tokens[0][len("get("):-1] #print("reading...", myvarname) myvar = VarGen.newvar(myvarname) #print("myvar", myvar) self.external.append(myvarname) #print() self.code += "\nmov rax, __buff2__\ncall getInput\nmov rax, __buff2__\nmov rbx, %s\ncall StrToInt\n" % myvar elif (len(self.tokens) != 3): print("Invalid format in %s. Only <myvarname> <operation> <const value (not expression) or varname>" % " ".join(self.tokens)) exit(0) else: ''' push rax; mov rax, myvar1; add/sub rax, myvar2/const num; mov myvar1, rax; pop rax; ''' #print("operation") self.external.append(self.tokens[0]) myvar1 = "[" + VarGen.newvar(self.tokens[0]) + "]" myvar2 = self.tokens[2] if '0' <= myvar2[0] <= '9' and (len(myvar2) < 3 or myvar2[1] != 'x'): myvar2 = str(hex(int(myvar2))) elif len(myvar2) >= 3 and myvar2[:2] == '0x': pass else: self.external.append(myvar2) myvar2 = "[" + VarGen.newvar(myvar2) + "]" operation = "add" if self.tokens[1] == '-=': operation = "sub" #print(myvar1, myvar2) self.code = "\n" + "push rax\n" + "mov rax,%s\n" % myvar1 self.code += operation + " rax,%s\n" % myvar2 + "mov %s,rax\n" % myvar1 self.code += "pop rax\n" + "\n" #print(self.declarated) ''' situations: declacation calling ''' def __init__(self, codeline): self.offset = 0 self.tokens = [] self.OFFSET_SYMB = " " self.external = [] self.declarated = [] self.code = '' self.data = '' while codeline.find(self.OFFSET_SYMB) == 0: self.offset += 1 codeline = codeline[len(self.OFFSET_SYMB):] self.tokens = [token for token in codeline.split(" ") if token != " "] self.process() def __str__(self): return "Codeline{" + "offset: " + str(self.offset) + " tokens: " + str(self.tokens) + "}" __repr__ = __str__ class Codeblock: commands = [] external = [] declarated = [] code = '' data = '' def process(self): #print("line 117") code = [] data = [] declvars = [] extvars = [] for el in self.commands: #print(el, el.declarated, el.external) data.append(el.data) code.append(el.code) declvars += (el.declarated) extvars += (el.external) self.code = "".join(code) self.data = "".join(data) if len(declvars) != len(set(declvars)): var = '' was = set() for el in declvars: if el not in was: was.add(el) else: var = el print("Double declaration of variable %s" % var) exit(0) new_vars = set(declvars) for el in extvars: if el not in new_vars: self.external.append(el) self.declarated = declvars def __init__(self, code): self.commands = code # codeblocks and codelines self.process() def __str__(self): if len(self.commands) != 0: OFFSET = self.commands[0].OFFSET_SYMB * self.commands[0].offset else: OFFSET = "" repr_string = [OFFSET + "{\n"] for el in self.commands: repr_string.append(OFFSET + str(el) + "\n") repr_string.append(OFFSET + "}\n") return "".join(repr_string) __repr__ = __str__ def make_program(self): code = ''' section .bss __buff__ resb 100 ;only for nums __buff2__ resb 100 __buffsize__ equ 100 section .text global _start exit: mov ebx,0 mov eax,1 int 0x80 ret StrToInt: push rdx mov rdx, rax dec rdx; xor rax, rax ;mov rax, 13; StrToIntLoop: inc rdx cmp byte [rdx], 0x30 jl eNd push rdx mov dl, 0xA mul dl; al = al * 10 pop rdx add al, [rdx] sub al, '0' jmp StrToIntLoop eNd: mov byte [rbx], al; not correct value in al pop rdx ret getInput: push rsi push rdi mov rdi, __buffsize__ - 1 + __buff2__ loopInput: mov byte [rdi], 0 dec rdi cmp rdi, __buff2__ jne loopInput mov rsi, rax xor rax, rax xor rdi, rdi mov rdx, __buffsize__ syscall pop rdi pop rsi ret print: push rdx push rcx push rbx xor rdx, rdx loopPrint: cmp byte [rax + rdx], 0x0; je loopPrintEnd inc rdx; jmp loopPrint loopPrintEnd: mov rcx, rax mov rax, 4 mov rbx, 1 ; first argument: file handle (stdout). int 0x80 ; call kernel. pop rbx pop rcx pop rdx ret printInt: push rbx push rdx mov rbx, __buff__ + __buffsize__ - 1; dec rbx; mov word [rbx], 0x0; loopPrintInt: push rbx mov ebx, 10 xor rdx, rdx div ebx; pop rbx; dec rbx; mov [rbx], dl; add word [rbx], '0' cmp rax, 0 jne loopPrintInt mov rax, rbx call print pop rdx pop rbx ret\n'''.replace("\t", " " * 4) code += "_start:\n" + self.code.replace("\n", "\n" + " " * 4) + "\n\n call exit\n\n" code += "section .data\n" + self.data + "\nendl db 0xA, 0x0" return code
#--------------------------------------- #Since : 2019/04/25 #Update: 2021/11/18 # -*- coding: utf-8 -*- #--------------------------------------- class Parameters: def __init__(self): #Game setting self.board_x = 8 # boad size self.board_y = self.board_x # boad size self.action_size = self.board_x * self.board_y + 1 # the maximum number of actions self.black = 1 # stone color of the first player self.white = -1 # stone color of the second player #------------------------ # AlphaZero #MCTS self.num_mcts_sims = 400 # the number of MCTS simulations self.cpuct = 1.25 # the exploration rate self.opening_train = 0 # the opening of a game for training self.opening_test = 0 # the opening of a game for test self.opening = self.opening_train # the opening of a game self.Temp = 40 # the temperature parameter of softmax function for calculating the move probability self.rnd_rate = 0.2 # the probability to select a move at random #Neural Network self.k_boards = 1 # the number of board states in one input self.input_channels = (self.k_boards * 2) + 1 # the number of channels of an input self.num_filters = 256 # the number of filters in the body self.num_filters_p = 2 # the number of filters in the policy head self.num_filters_v = 1 # the number of filters in the value head self.num_res = 5 # the number of redidual blocks in the body
print("Bienvenido al cajero automatico de este banco") print() usuario=int(input("Ingrese la cantidad de dinero que desea\n")) cant500 = usuario // 500 resto500 = usuario % 500 cant200 = resto500 // 200 resto200 = resto500 % 200 cant100 = resto200 // 100 resto100 = resto200 % 100 print("cant de billetes de 500: ", cant500) print() print("cant de billetes de 200: ", cant200) print() print("cant de billetes de 100: ", cant100)
def f(yan): xan = yan*3 xan -= 2 fin1 = [] tant = [0,1] for i in range(xan): shet = i shet2 = i+1 newr = tant[shet] + tant[shet2] tant.append(int(newr)) #2part for i in range(xan): gav = tant.pop() if (gav % 2 == 0): fin1.append(gav) fin1.append(0) fin1.sort() fin1.count(i%2 == 0) return fin1 print(f(int(input())))
#Perde 10 minutos de vida por cigarro. Informar quantos dias de vida perdeu q_d = int(input('Quantos cigarros por dia: ')) q_a = int(input('Fumante por quantos anos? ')) # Total de cigarros t_c = (q_d * q_a) * 364 # Total de dias perdidos. q_d = (t_c * 10) / 60 / 24 print(f'Você perdeu {q_d // 1:.0f} dias de vida fumando!')
""" Follow up for H-Index: What if the citations array is sorted in ascending order? Could you optimize your algorithm? """ __author__ = 'Daniel' class Solution(object): def hIndex(self, A): """ Given sorted -> binary search From linear search into bin search :type A: List[int] :rtype: int """ n = len(A) s = 0 e = n while s < e: m = (s+e)/2 if A[m] >= n-m: e = m else: s = m+1 return n-s if __name__ == "__main__": assert Solution().hIndex([0, 1, 3, 5, 6]) == 3
_BEGIN = 0 BLACK=0 WHITE=1 GRAY=2 _END = 12
def swap(s,n): res=bin(n)[2:]*(len(s)//len(bin(n)[2:])+1) index=0 string="" for i in range(len(s)): if not s[i].isalpha(): string+=s[i] continue string+=s[i].swapcase() if res[index]=="1" else s[i] index+=1 return string
class Solution: def XXX(self, s: str) -> int: blank_count = 0 start = 0 for index in range(len(s)): if s[index] != " ": if blank_count == 0: continue else: blank_count = 0 start = index else: blank_count += 1 return len(s) - blank_count - start
# class node to store data and next class Node: def __init__(self,data, next=None, prev=None): self.data = data self.next = next self.prev = prev # defining getter and setter for data, next and prev def getData(self): return self.data def setData(self, data): self.data = data def getNextNode(self): return self.next def setNextNode(self, node): self.next = node def getPrevNode(self): return self.prev def setPrevNode(self, node): self.prev = node # class Linked List class LinkedList: def __init__(self, head=None): self.head = head self.size = 0 def getSize(self): return self.size def addNode(self, data): node = Node(data, None, self.head) self.head = node # incrementing the size of the linked list self.size += 1 return True # delete a node from linked list def removeNode(self, value): prev = None curr = self.head while curr: if curr.getData() == value: if prev: prev.setNextNode(curr.getNextNode()) else: self.head = curr.getNextNode() return True prev = curr curr = curr.getNextNode() return False # find a node in the linked list def findNode(self,value): curr = self.head while curr: if curr.getData() == value: return True else: curr = curr.getNextNode() return False # print the linked list def printLL(self): curr = self.head while curr: print(curr.data) curr = curr.getNextNode() myList = LinkedList() print("Inserting") print(myList.addNode(5)) print(myList.addNode(15)) print(myList.addNode(25)) myList.printLL() print(myList.getSize()) print(myList.findNode(25)) print(myList.removeNode(25)) myList.printLL()
# Hello world ''' We will use this file to write our first statement in Python Pretty simple: print('Hello world') '''
class Point: def __init__(self, x, y): self.x = x self.y = y point = Point(3, 5) print(f"The Point x value is {point.x}") print(f"The Point y value is {point.y}")
# The Fibonacci Sequence # The Fibonacci sequence begins with fibonacci(0) = 0 and fibonacci(1) = 1 as its respective first and second terms. After these first two elements, each subsequent element is equal to the sum of the previous two elements. def fibonacci(n): if n == 0 or n == 1: return n return fibonacci(n - 1) + fibonacci(n- 2) fib_list = [] for i in range(0, 11): fib_list.append(fibonacci(i)) print(fib_list)
# Início do programa print("\n"*100) print("Neste jogo você deve convencer Deus a não destruir Sodoma e Gomorra.") print("No prompt 'Eu' Digite:") print("--> Senhor, e se houver xyz justos na cidade?") print("(Onde 'xyz' corresponde a um número entre 0 e 999)") print("BOA SORTE!!!") input("Tecle <ENTER> ") # Início do jogo print("\n"*100) numjust = 50 while numjust >= 10: justos = input("Eu: ") try: if int(justos[20:23]) == numjust: print("Deus: Não destruirei a cidade por amor dos {} justos".format(numjust)) if numjust < 45: numjust -= 5 numjust -= 5 # Jogo do tipo "quente ou frio". elif int(justos[20:23]) > numjust: print("Deus: Você não deveria pedir por menos justos?") elif int(justos[20:23]) < numjust: print("Deus: Você não gostaria de pedir por mais justos?") # Se digitar errado, começa tudo de novo. except ValueError: print("Deus: Acaso vou destruir as cidades sem consultar Abraao?") numjust = 50 input("Tecle <ENTER> ") # Fim do jogo print("\n"*100) print("\nDeus: Anjos, tirem Ló e sua família de lá...") print("\nAnjos: Sim, Senhor!") print("\n*** GAME OVER ***\n") input("\nTecle <ENTER> ")
""" category: Model Variations name: Steady State Distrubtion descr: Run repeated steady state calculations using random parameters (based on min/max parameter values) menu: yes icon: module.png tool: no """ items = tc_allItems() params = tc_getParameters(items) params2 = fromTC(params) avgvalues = params2[2][0] minvalues = params2[2][1] maxvalues = params2[2][2] #check if all min/max values ok s = "" for j in range(0,params.rows): if minvalues[j] == maxvalues[j]: #not ok s += tc_getRowName(params, j) + " " #show warning and then continue ok = 1 if len(s) > 0: tc_clear() #clear console ok = tc_askQuestion("warning: the following parameters have invalid ranges :- \n" + s + "\n\nContinue with analysis?") if ok == 1: n = int( tc_getNumber("Number of samples?") ) tc_holdPlot(1) colnames = [] output = [] for i in range(0,n): tc_showProgress("Sampling parameters", 100 * i/n) for j in range(0,params.rows): x = random.uniform(log(minvalues[j]), log(maxvalues[j])) tc_setMatrixValue(params, j, 0, exp(x)) tc_updateParameters(params) tc_printMatrix(params) ss = tc_getSteadyState() if len(colnames) == 0: colnames = fromTC(ss.rownames) for k in range(0,ss.rows): output.append( range(0,n) ); for k in range(0,ss.rows): output[k][i] = tc_getMatrixValue(ss,k,0) tc_showProgress("Sampling parameters", 100 ) tc_scatterplot(toTC(output,[],colnames), "Steady state distribution")
# -*- coding: utf-8 -*- """ eater.errors ~~~~~~~~~~~~ A place for errors that are raised by Eater. """ __all__ = [ 'EaterError', 'EaterTimeoutError', 'EaterConnectError', 'EaterUnexpectedError', 'EaterUnexpectedResponseError' ] class EaterError(Exception): """ Base Eater error. """ class EaterTimeoutError(EaterError): """ Raised if something times out. """ class EaterConnectError(EaterError): """ Raised if there is a connection error. """ class EaterUnexpectedError(EaterError): """ Raised when something unexpected happens. """ class EaterUnexpectedResponseError(EaterUnexpectedError): """ Raised when a response from an API is unexpected. """
class Cell: def __init__(self, number): self.number = number def __add__(self, other): return Cell(self.number + other.number) def __sub__(self, other): result = self.number - other.number if result > 0: return Cell(result) else: print('в первой клетке мало ячеек') return Cell(None) def __mul__(self, other): return Cell(self.number * other.number) def __floordiv__(self, other): return Cell(self.number // other.number) def make_order(self, rows): return '\\n'.join(['*' * rows for i in range(self.number // rows)]) + '\\n' + '*' * (self.number % rows) cell_1 = Cell(17) cell_2 = Cell(12) print(f' Сумма: {(cell_1 + cell_2).number}') print(f' Разность: {(cell_1 - cell_2).number}') print(f' Разность: {(cell_2 - cell_1).number}') print(f' Произведение: {(cell_1 * cell_2).number}') print(f' Деление: {(cell_1 // cell_2).number}') print(f' Деление: {(cell_2 // cell_1).number}') print(cell_2.make_order(5))
# # PySNMP MIB module WWP-LEOS-PORT-STATS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WWP-LEOS-PORT-STATS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:31:30 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint", "ConstraintsIntersection") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") TimeTicks, Bits, NotificationType, IpAddress, iso, Counter64, Integer32, Gauge32, ModuleIdentity, Unsigned32, ObjectIdentity, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "TimeTicks", "Bits", "NotificationType", "IpAddress", "iso", "Counter64", "Integer32", "Gauge32", "ModuleIdentity", "Unsigned32", "ObjectIdentity", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "MibIdentifier") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") wwpModulesLeos, wwpModules = mibBuilder.importSymbols("WWP-SMI", "wwpModulesLeos", "wwpModules") wwpLeosPortStatsMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3)) wwpLeosPortStatsMIB.setRevisions(('2012-11-16 00:00', '2010-02-12 00:00', '2001-04-03 17:00',)) if mibBuilder.loadTexts: wwpLeosPortStatsMIB.setLastUpdated('201211160000Z') if mibBuilder.loadTexts: wwpLeosPortStatsMIB.setOrganization('Ciena, Inc') wwpLeosPortStatsMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1)) wwpLeosPortStats = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1)) wwpLeosPortStatsMIBNotificationPrefix = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 2)) wwpLeosPortStatsMIBNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 2, 0)) wwpLeosPortStatsMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 3)) wwpLeosPortStatsMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 3, 1)) wwpLeosPortStatsMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 3, 2)) wwpLeosPortStatsReset = MibScalar((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("none", 0), ("reset", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosPortStatsReset.setStatus('current') wwpLeosPortStatsTable = MibTable((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2), ) if mibBuilder.loadTexts: wwpLeosPortStatsTable.setStatus('current') wwpLeosPortStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1), ).setIndexNames((0, "WWP-LEOS-PORT-STATS-MIB", "wwpLeosPortStatsPortId")) if mibBuilder.loadTexts: wwpLeosPortStatsEntry.setStatus('current') wwpLeosPortStatsPortId = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsPortId.setStatus('current') wwpLeosPortStatsRxBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsRxBytes.setStatus('current') wwpLeosPortStatsRxPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsRxPkts.setStatus('current') wwpLeosPortStatsRxCrcErrorPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsRxCrcErrorPkts.setStatus('current') wwpLeosPortStatsRxBcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsRxBcastPkts.setStatus('current') wwpLeosPortStatsUndersizePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsUndersizePkts.setStatus('current') wwpLeosPortStatsOversizePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsOversizePkts.setStatus('current') wwpLeosPortStatsFragmentPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsFragmentPkts.setStatus('current') wwpLeosPortStatsJabberPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsJabberPkts.setStatus('current') wwpLeosPortStats64BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStats64BytePkts.setStatus('current') wwpLeosPortStats65To127BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStats65To127BytePkts.setStatus('current') wwpLeosPortStats128To255BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStats128To255BytePkts.setStatus('current') wwpLeosPortStats256To511BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStats256To511BytePkts.setStatus('current') wwpLeosPortStats512To1023BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStats512To1023BytePkts.setStatus('current') wwpLeosPortStats1024To1518BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStats1024To1518BytePkts.setStatus('current') wwpLeosPortStatsTxBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTxBytes.setStatus('current') wwpLeosPortStatsTxTBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTxTBytes.setStatus('deprecated') wwpLeosPortStatsTxPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 18), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTxPkts.setStatus('current') wwpLeosPortStatsTxExDeferPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 19), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTxExDeferPkts.setStatus('current') wwpLeosPortStatsTxGiantPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 20), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTxGiantPkts.setStatus('current') wwpLeosPortStatsTxUnderRunPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 21), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTxUnderRunPkts.setStatus('current') wwpLeosPortStatsTxCrcErrorPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 22), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTxCrcErrorPkts.setStatus('current') wwpLeosPortStatsTxLCheckErrorPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 23), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTxLCheckErrorPkts.setStatus('current') wwpLeosPortStatsTxLOutRangePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 24), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTxLOutRangePkts.setStatus('current') wwpLeosPortStatsTxLateCollPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 25), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTxLateCollPkts.setStatus('current') wwpLeosPortStatsTxExCollPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 26), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTxExCollPkts.setStatus('current') wwpLeosPortStatsTxSingleCollPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 27), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTxSingleCollPkts.setStatus('current') wwpLeosPortStatsTxCollPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 28), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTxCollPkts.setStatus('current') wwpLeosPortStatsTxPausePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 29), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTxPausePkts.setStatus('current') wwpLeosPortStatsTxMcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 30), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTxMcastPkts.setStatus('current') wwpLeosPortStatsTxBcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 31), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTxBcastPkts.setStatus('current') wwpLeosPortStatsPortReset = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 32), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("none", 0), ("reset", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosPortStatsPortReset.setStatus('current') wwpLeosPortStatsRxMcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 33), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsRxMcastPkts.setStatus('current') wwpLeosPortStatsRxPausePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 34), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsRxPausePkts.setStatus('current') wwpLeosPortStats1519To2047BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 35), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStats1519To2047BytePkts.setStatus('current') wwpLeosPortStats2048To4095BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 36), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStats2048To4095BytePkts.setStatus('current') wwpLeosPortStats4096To9216BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 37), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStats4096To9216BytePkts.setStatus('current') wwpLeosPortStatsTxDeferPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 38), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTxDeferPkts.setStatus('current') wwpLeosPortStatsTx64BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 39), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTx64BytePkts.setStatus('current') wwpLeosPortStatsTx65To127BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 40), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTx65To127BytePkts.setStatus('current') wwpLeosPortStatsTx128To255BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 41), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTx128To255BytePkts.setStatus('current') wwpLeosPortStatsTx256To511BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 42), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTx256To511BytePkts.setStatus('current') wwpLeosPortStatsTx512To1023BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 43), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTx512To1023BytePkts.setStatus('current') wwpLeosPortStatsTx1024To1518BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 44), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTx1024To1518BytePkts.setStatus('current') wwpLeosPortStatsTx1519To2047BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 45), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTx1519To2047BytePkts.setStatus('current') wwpLeosPortStatsTx2048To4095BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 46), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTx2048To4095BytePkts.setStatus('current') wwpLeosPortStatsTx4096To9216BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 47), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTx4096To9216BytePkts.setStatus('current') wwpLeosPortStatsRxFpgaDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 48), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsRxFpgaDropPkts.setStatus('current') wwpLeosPortStatsPortLinkUp = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 49), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsPortLinkUp.setStatus('current') wwpLeosPortStatsPortLinkDown = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 50), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsPortLinkDown.setStatus('current') wwpLeosPortStatsPortLinkFlap = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 51), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsPortLinkFlap.setStatus('current') wwpLeosPortStatsRxUcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 52), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsRxUcastPkts.setStatus('current') wwpLeosPortStatsTxUcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 53), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTxUcastPkts.setStatus('current') wwpLeosPortStatsRxDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 54), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsRxDropPkts.setStatus('current') wwpLeosPortStatsRxDiscardPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 55), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsRxDiscardPkts.setStatus('current') wwpLeosPortStatsRxLOutRangePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 56), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsRxLOutRangePkts.setStatus('current') wwpLeosPortStatsRxFpgaBufferDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 57), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsRxFpgaBufferDropPkts.setStatus('current') wwpLeosPortStatsTxFpgaBufferDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 58), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsTxFpgaBufferDropPkts.setStatus('current') wwpLeosPortStatsFpgaVlanPriFilterDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 59), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsFpgaVlanPriFilterDropPkts.setStatus('current') wwpLeosPortStatsFpgaRxErrorPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 60), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsFpgaRxErrorPkts.setStatus('current') wwpLeosPortStatsFpgaRxCrcErrorPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 61), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsFpgaRxCrcErrorPkts.setStatus('current') wwpLeosPortStatsFpgaRxIpCrcErrorPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 62), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsFpgaRxIpCrcErrorPkts.setStatus('current') wwpLeosPortStatsRxInErrorPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 2, 1, 63), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortStatsRxInErrorPkts.setStatus('current') wwpLeosPortTotalStatsTable = MibTable((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3), ) if mibBuilder.loadTexts: wwpLeosPortTotalStatsTable.setStatus('current') wwpLeosPortTotalStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1), ).setIndexNames((0, "WWP-LEOS-PORT-STATS-MIB", "wwpLeosPortTotalStatsPortId")) if mibBuilder.loadTexts: wwpLeosPortTotalStatsEntry.setStatus('current') wwpLeosPortTotalStatsPortId = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsPortId.setStatus('current') wwpLeosPortTotalStatsRxBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsRxBytes.setStatus('current') wwpLeosPortTotalStatsRxPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsRxPkts.setStatus('current') wwpLeosPortTotalStatsRxCrcErrorPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsRxCrcErrorPkts.setStatus('current') wwpLeosPortTotalStatsRxBcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsRxBcastPkts.setStatus('current') wwpLeosPortTotalStatsUndersizePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsUndersizePkts.setStatus('current') wwpLeosPortTotalStatsOversizePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsOversizePkts.setStatus('current') wwpLeosPortTotalStatsFragmentPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsFragmentPkts.setStatus('current') wwpLeosPortTotalStatsJabberPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsJabberPkts.setStatus('current') wwpLeosPortTotalStats64BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStats64BytePkts.setStatus('current') wwpLeosPortTotalStats65To127BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStats65To127BytePkts.setStatus('current') wwpLeosPortTotalStats128To255BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStats128To255BytePkts.setStatus('current') wwpLeosPortTotalStats256To511BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStats256To511BytePkts.setStatus('current') wwpLeosPortTotalStats512To1023BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStats512To1023BytePkts.setStatus('current') wwpLeosPortTotalStats1024To1518BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStats1024To1518BytePkts.setStatus('current') wwpLeosPortTotalStatsTxBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTxBytes.setStatus('current') wwpLeosPortTotalStatsTxTBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTxTBytes.setStatus('deprecated') wwpLeosPortTotalStatsTxPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 18), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTxPkts.setStatus('current') wwpLeosPortTotalStatsTxExDeferPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 19), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTxExDeferPkts.setStatus('current') wwpLeosPortTotalStatsTxGiantPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 20), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTxGiantPkts.setStatus('current') wwpLeosPortTotalStatsTxUnderRunPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 21), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTxUnderRunPkts.setStatus('current') wwpLeosPortTotalStatsTxCrcErrorPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 22), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTxCrcErrorPkts.setStatus('current') wwpLeosPortTotalStatsTxLCheckErrorPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 23), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTxLCheckErrorPkts.setStatus('current') wwpLeosPortTotalStatsTxLOutRangePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 24), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTxLOutRangePkts.setStatus('current') wwpLeosPortTotalStatsTxLateCollPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 25), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTxLateCollPkts.setStatus('current') wwpLeosPortTotalStatsTxExCollPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 26), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTxExCollPkts.setStatus('current') wwpLeosPortTotalStatsTxSingleCollPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 27), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTxSingleCollPkts.setStatus('current') wwpLeosPortTotalStatsTxCollPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 28), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTxCollPkts.setStatus('current') wwpLeosPortTotalStatsTxPausePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 29), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTxPausePkts.setStatus('current') wwpLeosPortTotalStatsTxMcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 30), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTxMcastPkts.setStatus('current') wwpLeosPortTotalStatsTxBcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 31), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTxBcastPkts.setStatus('current') wwpLeosPortTotalStatsPortReset = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 32), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("none", 0), ("reset", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosPortTotalStatsPortReset.setStatus('current') wwpLeosPortTotalStatsRxMcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 33), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsRxMcastPkts.setStatus('current') wwpLeosPortTotalStatsRxPausePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 34), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsRxPausePkts.setStatus('current') wwpLeosPortTotalStats1519To2047BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 35), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStats1519To2047BytePkts.setStatus('current') wwpLeosPortTotalStats2048To4095BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 36), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStats2048To4095BytePkts.setStatus('current') wwpLeosPortTotalStats4096To9216BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 37), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStats4096To9216BytePkts.setStatus('current') wwpLeosPortTotalStatsTxDeferPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 38), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTxDeferPkts.setStatus('current') wwpLeosPortTotalStatsTx64BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 39), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTx64BytePkts.setStatus('current') wwpLeosPortTotalStatsTx65To127BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 40), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTx65To127BytePkts.setStatus('current') wwpLeosPortTotalStatsTx128To255BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 41), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTx128To255BytePkts.setStatus('current') wwpLeosPortTotalStatsTx256To511BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 42), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTx256To511BytePkts.setStatus('current') wwpLeosPortTotalStatsTx512To1023BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 43), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTx512To1023BytePkts.setStatus('current') wwpLeosPortTotalStatsTx1024To1518BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 44), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTx1024To1518BytePkts.setStatus('current') wwpLeosPortTotalStatsTx1519To2047BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 45), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTx1519To2047BytePkts.setStatus('current') wwpLeosPortTotalStatsTx2048To4095BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 46), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTx2048To4095BytePkts.setStatus('current') wwpLeosPortTotalStatsTx4096To9216BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 47), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTx4096To9216BytePkts.setStatus('current') wwpLeosPortTotalStatsRxFpgaDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 48), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsRxFpgaDropPkts.setStatus('current') wwpLeosPortTotalStatsPortLinkUp = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 49), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsPortLinkUp.setStatus('current') wwpLeosPortTotalStatsPortLinkDown = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 50), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsPortLinkDown.setStatus('current') wwpLeosPortTotalStatsPortLinkFlap = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 51), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsPortLinkFlap.setStatus('current') wwpLeosPortTotalStatsRxUcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 52), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsRxUcastPkts.setStatus('current') wwpLeosPortTotalStatsTxUcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 53), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTxUcastPkts.setStatus('current') wwpLeosPortTotalStatsRxDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 54), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsRxDropPkts.setStatus('current') wwpLeosPortTotalStatsRxDiscardPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 55), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsRxDiscardPkts.setStatus('current') wwpLeosPortTotalStatsRxLOutRangePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 56), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsRxLOutRangePkts.setStatus('current') wwpLeosPortTotalStatsRxFpgaBufferDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 57), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsRxFpgaBufferDropPkts.setStatus('current') wwpLeosPortTotalStatsTxFpgaBufferDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 58), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsTxFpgaBufferDropPkts.setStatus('current') wwpLeosPortTotalStatsFpgaVlanPriFilterDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 59), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsFpgaVlanPriFilterDropPkts.setStatus('current') wwpLeosPortTotalStatsFpgaRxErrorPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 60), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsFpgaRxErrorPkts.setStatus('current') wwpLeosPortTotalStatsFpgaRxCrcErrorPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 61), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsFpgaRxCrcErrorPkts.setStatus('current') wwpLeosPortTotalStatsFpgaRxIpCrcErrorPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 62), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsFpgaRxIpCrcErrorPkts.setStatus('current') wwpLeosPortTotalStatsRxInErrorPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 3, 1, 63), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalStatsRxInErrorPkts.setStatus('current') wwpLeosPortHCStatsTable = MibTable((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4), ) if mibBuilder.loadTexts: wwpLeosPortHCStatsTable.setStatus('current') wwpLeosPortHCStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1), ).setIndexNames((0, "WWP-LEOS-PORT-STATS-MIB", "wwpLeosPortHCStatsPortId")) if mibBuilder.loadTexts: wwpLeosPortHCStatsEntry.setStatus('current') wwpLeosPortHCStatsPortId = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsPortId.setStatus('current') wwpLeosPortHCStatsRxBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 2), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsRxBytes.setStatus('current') wwpLeosPortHCStatsRxPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 3), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsRxPkts.setStatus('current') wwpLeosPortHCStatsRxCrcErrorPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 4), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsRxCrcErrorPkts.setStatus('current') wwpLeosPortHCStatsRxBcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 5), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsRxBcastPkts.setStatus('current') wwpLeosPortHCStatsUndersizePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 6), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsUndersizePkts.setStatus('current') wwpLeosPortHCStatsOversizePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 7), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsOversizePkts.setStatus('current') wwpLeosPortHCStatsFragmentPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 8), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsFragmentPkts.setStatus('current') wwpLeosPortHCStatsJabberPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 9), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsJabberPkts.setStatus('current') wwpLeosPortHCStats64BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 10), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStats64BytePkts.setStatus('current') wwpLeosPortHCStats65To127BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 11), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStats65To127BytePkts.setStatus('current') wwpLeosPortHCStats128To255BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 12), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStats128To255BytePkts.setStatus('current') wwpLeosPortHCStats256To511BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 13), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStats256To511BytePkts.setStatus('current') wwpLeosPortHCStats512To1023BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 14), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStats512To1023BytePkts.setStatus('current') wwpLeosPortHCStats1024To1518BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 15), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStats1024To1518BytePkts.setStatus('current') wwpLeosPortHCStatsTxBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 16), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTxBytes.setStatus('current') wwpLeosPortHCStatsTxTBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 17), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTxTBytes.setStatus('deprecated') wwpLeosPortHCStatsTxPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 18), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTxPkts.setStatus('current') wwpLeosPortHCStatsTxExDeferPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 19), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTxExDeferPkts.setStatus('current') wwpLeosPortHCStatsTxGiantPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 20), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTxGiantPkts.setStatus('current') wwpLeosPortHCStatsTxUnderRunPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 21), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTxUnderRunPkts.setStatus('current') wwpLeosPortHCStatsTxCrcErrorPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 22), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTxCrcErrorPkts.setStatus('current') wwpLeosPortHCStatsTxLCheckErrorPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 23), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTxLCheckErrorPkts.setStatus('current') wwpLeosPortHCStatsTxLOutRangePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 24), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTxLOutRangePkts.setStatus('current') wwpLeosPortHCStatsTxLateCollPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 25), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTxLateCollPkts.setStatus('current') wwpLeosPortHCStatsTxExCollPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 26), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTxExCollPkts.setStatus('current') wwpLeosPortHCStatsTxSingleCollPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 27), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTxSingleCollPkts.setStatus('current') wwpLeosPortHCStatsTxCollPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 28), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTxCollPkts.setStatus('current') wwpLeosPortHCStatsTxPausePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 29), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTxPausePkts.setStatus('current') wwpLeosPortHCStatsTxMcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 30), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTxMcastPkts.setStatus('current') wwpLeosPortHCStatsTxBcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 31), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTxBcastPkts.setStatus('current') wwpLeosPortHCStatsPortReset = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 32), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("none", 0), ("reset", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosPortHCStatsPortReset.setStatus('current') wwpLeosPortHCStatsRxMcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 33), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsRxMcastPkts.setStatus('current') wwpLeosPortHCStatsRxPausePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 34), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsRxPausePkts.setStatus('current') wwpLeosPortHCStats1519To2047BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 35), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStats1519To2047BytePkts.setStatus('current') wwpLeosPortHCStats2048To4095BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 36), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStats2048To4095BytePkts.setStatus('current') wwpLeosPortHCStats4096To9216BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 37), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStats4096To9216BytePkts.setStatus('current') wwpLeosPortHCStatsTxDeferPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 38), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTxDeferPkts.setStatus('current') wwpLeosPortHCStatsTx64BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 39), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTx64BytePkts.setStatus('current') wwpLeosPortHCStatsTx65To127BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 40), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTx65To127BytePkts.setStatus('current') wwpLeosPortHCStatsTx128To255BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 41), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTx128To255BytePkts.setStatus('current') wwpLeosPortHCStatsTx256To511BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 42), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTx256To511BytePkts.setStatus('current') wwpLeosPortHCStatsTx512To1023BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 43), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTx512To1023BytePkts.setStatus('current') wwpLeosPortHCStatsTx1024To1518BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 44), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTx1024To1518BytePkts.setStatus('current') wwpLeosPortHCStatsTx1519To2047BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 45), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTx1519To2047BytePkts.setStatus('current') wwpLeosPortHCStatsTx2048To4095BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 46), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTx2048To4095BytePkts.setStatus('current') wwpLeosPortHCStatsTx4096To9216BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 47), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTx4096To9216BytePkts.setStatus('current') wwpLeosPortHCStatsRxUcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 48), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsRxUcastPkts.setStatus('current') wwpLeosPortHCStatsTxUcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 49), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsTxUcastPkts.setStatus('current') wwpLeosPortHCStatsRxDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 50), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsRxDropPkts.setStatus('current') wwpLeosPortHCStatsRxDiscardPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 51), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsRxDiscardPkts.setStatus('current') wwpLeosPortHCStatsRxLOutRangePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 52), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsRxLOutRangePkts.setStatus('current') wwpLeosPortHCStatsRxInErrorPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 53), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsRxInErrorPkts.setStatus('current') wwpLeosPortHCStatsLastRefresh = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 54), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsLastRefresh.setStatus('current') wwpLeosPortHCStatsLastChange = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 4, 1, 55), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortHCStatsLastChange.setStatus('current') wwpLeosPortTotalHCStatsTable = MibTable((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5), ) if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTable.setStatus('current') wwpLeosPortTotalHCStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1), ).setIndexNames((0, "WWP-LEOS-PORT-STATS-MIB", "wwpLeosPortTotalHCStatsPortId")) if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsEntry.setStatus('current') wwpLeosPortTotalHCStatsPortId = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsPortId.setStatus('current') wwpLeosPortTotalHCStatsRxBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 2), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsRxBytes.setStatus('current') wwpLeosPortTotalHCStatsRxPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 3), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsRxPkts.setStatus('current') wwpLeosPortTotalHCStatsRxCrcErrorPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 4), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsRxCrcErrorPkts.setStatus('current') wwpLeosPortTotalHCStatsRxBcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 5), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsRxBcastPkts.setStatus('current') wwpLeosPortTotalHCStatsUndersizePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 6), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsUndersizePkts.setStatus('current') wwpLeosPortTotalHCStatsOversizePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 7), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsOversizePkts.setStatus('current') wwpLeosPortTotalHCStatsFragmentPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 8), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsFragmentPkts.setStatus('current') wwpLeosPortTotalHCStatsJabberPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 9), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsJabberPkts.setStatus('current') wwpLeosPortTotalHCStats64BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 10), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStats64BytePkts.setStatus('current') wwpLeosPortTotalHCStats65To127BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 11), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStats65To127BytePkts.setStatus('current') wwpLeosPortTotalHCStats128To255BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 12), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStats128To255BytePkts.setStatus('current') wwpLeosPortTotalHCStats256To511BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 13), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStats256To511BytePkts.setStatus('current') wwpLeosPortTotalHCStats512To1023BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 14), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStats512To1023BytePkts.setStatus('current') wwpLeosPortTotalHCStats1024To1518BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 15), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStats1024To1518BytePkts.setStatus('current') wwpLeosPortTotalHCStatsTxBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 16), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTxBytes.setStatus('current') wwpLeosPortTotalHCStatsTxTBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 17), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTxTBytes.setStatus('deprecated') wwpLeosPortTotalHCStatsTxPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 18), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTxPkts.setStatus('current') wwpLeosPortTotalHCStatsTxExDeferPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 19), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTxExDeferPkts.setStatus('current') wwpLeosPortTotalHCStatsTxGiantPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 20), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTxGiantPkts.setStatus('current') wwpLeosPortTotalHCStatsTxUnderRunPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 21), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTxUnderRunPkts.setStatus('current') wwpLeosPortTotalHCStatsTxCrcErrorPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 22), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTxCrcErrorPkts.setStatus('current') wwpLeosPortTotalHCStatsTxLCheckErrorPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 23), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTxLCheckErrorPkts.setStatus('current') wwpLeosPortTotalHCStatsTxLOutRangePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 24), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTxLOutRangePkts.setStatus('current') wwpLeosPortTotalHCStatsTxLateCollPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 25), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTxLateCollPkts.setStatus('current') wwpLeosPortTotalHCStatsTxExCollPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 26), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTxExCollPkts.setStatus('current') wwpLeosPortTotalHCStatsTxSingleCollPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 27), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTxSingleCollPkts.setStatus('current') wwpLeosPortTotalHCStatsTxCollPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 28), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTxCollPkts.setStatus('current') wwpLeosPortTotalHCStatsTxPausePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 29), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTxPausePkts.setStatus('current') wwpLeosPortTotalHCStatsTxMcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 30), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTxMcastPkts.setStatus('current') wwpLeosPortTotalHCStatsTxBcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 31), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTxBcastPkts.setStatus('current') wwpLeosPortTotalHCStatsPortReset = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 32), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("none", 0), ("reset", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsPortReset.setStatus('current') wwpLeosPortTotalHCStatsRxMcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 33), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsRxMcastPkts.setStatus('current') wwpLeosPortTotalHCStatsRxPausePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 34), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsRxPausePkts.setStatus('current') wwpLeosPortTotalHCStats1519To2047BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 35), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStats1519To2047BytePkts.setStatus('current') wwpLeosPortTotalHCStats2048To4095BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 36), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStats2048To4095BytePkts.setStatus('current') wwpLeosPortTotalHCStats4096To9216BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 37), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStats4096To9216BytePkts.setStatus('current') wwpLeosPortTotalHCStatsTxDeferPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 38), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTxDeferPkts.setStatus('current') wwpLeosPortTotalHCStatsTx64BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 39), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTx64BytePkts.setStatus('current') wwpLeosPortTotalHCStatsTx65To127BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 40), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTx65To127BytePkts.setStatus('current') wwpLeosPortTotalHCStatsTx128To255BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 41), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTx128To255BytePkts.setStatus('current') wwpLeosPortTotalHCStatsTx256To511BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 42), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTx256To511BytePkts.setStatus('current') wwpLeosPortTotalHCStatsTx512To1023BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 43), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTx512To1023BytePkts.setStatus('current') wwpLeosPortTotalHCStatsTx1024To1518BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 44), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTx1024To1518BytePkts.setStatus('current') wwpLeosPortTotalHCStatsTx1519To2047BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 45), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTx1519To2047BytePkts.setStatus('current') wwpLeosPortTotalHCStatsTx2048To4095BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 46), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTx2048To4095BytePkts.setStatus('current') wwpLeosPortTotalHCStatsTx4096To9216BytePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 47), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTx4096To9216BytePkts.setStatus('current') wwpLeosPortTotalHCStatsRxUcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 48), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsRxUcastPkts.setStatus('current') wwpLeosPortTotalHCStatsTxUcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 49), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsTxUcastPkts.setStatus('current') wwpLeosPortTotalHCStatsRxDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 50), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsRxDropPkts.setStatus('current') wwpLeosPortTotalHCStatsRxDiscardPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 51), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsRxDiscardPkts.setStatus('current') wwpLeosPortTotalHCStatsRxLOutRangePkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 52), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsRxLOutRangePkts.setStatus('current') wwpLeosPortTotalHCStatsRxInErrorPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 53), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsRxInErrorPkts.setStatus('current') wwpLeosPortTotalHCStatsLastRefresh = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 54), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsLastRefresh.setStatus('current') wwpLeosPortTotalHCStatsLastChange = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 3, 1, 1, 5, 1, 55), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosPortTotalHCStatsLastChange.setStatus('current') mibBuilder.exportSymbols("WWP-LEOS-PORT-STATS-MIB", wwpLeosPortStatsRxFpgaBufferDropPkts=wwpLeosPortStatsRxFpgaBufferDropPkts, wwpLeosPortTotalStatsTxTBytes=wwpLeosPortTotalStatsTxTBytes, wwpLeosPortTotalHCStatsRxMcastPkts=wwpLeosPortTotalHCStatsRxMcastPkts, wwpLeosPortTotalHCStatsTxUcastPkts=wwpLeosPortTotalHCStatsTxUcastPkts, wwpLeosPortStatsTx1024To1518BytePkts=wwpLeosPortStatsTx1024To1518BytePkts, wwpLeosPortTotalStatsTxBytes=wwpLeosPortTotalStatsTxBytes, wwpLeosPortHCStatsTxBytes=wwpLeosPortHCStatsTxBytes, wwpLeosPortTotalStatsRxInErrorPkts=wwpLeosPortTotalStatsRxInErrorPkts, wwpLeosPortTotalStatsTxCrcErrorPkts=wwpLeosPortTotalStatsTxCrcErrorPkts, wwpLeosPortStatsRxBcastPkts=wwpLeosPortStatsRxBcastPkts, wwpLeosPortHCStatsTxLCheckErrorPkts=wwpLeosPortHCStatsTxLCheckErrorPkts, wwpLeosPortHCStats4096To9216BytePkts=wwpLeosPortHCStats4096To9216BytePkts, wwpLeosPortStatsPortReset=wwpLeosPortStatsPortReset, wwpLeosPortStatsPortId=wwpLeosPortStatsPortId, wwpLeosPortTotalStats256To511BytePkts=wwpLeosPortTotalStats256To511BytePkts, wwpLeosPortHCStatsTxCollPkts=wwpLeosPortHCStatsTxCollPkts, wwpLeosPortTotalStatsPortReset=wwpLeosPortTotalStatsPortReset, wwpLeosPortTotalHCStatsTxBcastPkts=wwpLeosPortTotalHCStatsTxBcastPkts, wwpLeosPortHCStatsTx64BytePkts=wwpLeosPortHCStatsTx64BytePkts, wwpLeosPortStatsFpgaRxErrorPkts=wwpLeosPortStatsFpgaRxErrorPkts, wwpLeosPortHCStatsTable=wwpLeosPortHCStatsTable, wwpLeosPortStatsRxDiscardPkts=wwpLeosPortStatsRxDiscardPkts, wwpLeosPortStatsFpgaRxCrcErrorPkts=wwpLeosPortStatsFpgaRxCrcErrorPkts, wwpLeosPortTotalStatsTx64BytePkts=wwpLeosPortTotalStatsTx64BytePkts, wwpLeosPortTotalHCStats4096To9216BytePkts=wwpLeosPortTotalHCStats4096To9216BytePkts, wwpLeosPortTotalStats4096To9216BytePkts=wwpLeosPortTotalStats4096To9216BytePkts, wwpLeosPortStatsRxFpgaDropPkts=wwpLeosPortStatsRxFpgaDropPkts, wwpLeosPortTotalStatsRxBcastPkts=wwpLeosPortTotalStatsRxBcastPkts, wwpLeosPortTotalStatsJabberPkts=wwpLeosPortTotalStatsJabberPkts, wwpLeosPortHCStatsTxMcastPkts=wwpLeosPortHCStatsTxMcastPkts, wwpLeosPortTotalHCStats128To255BytePkts=wwpLeosPortTotalHCStats128To255BytePkts, wwpLeosPortTotalHCStatsTxPkts=wwpLeosPortTotalHCStatsTxPkts, wwpLeosPortHCStatsRxUcastPkts=wwpLeosPortHCStatsRxUcastPkts, wwpLeosPortTotalStatsTx2048To4095BytePkts=wwpLeosPortTotalStatsTx2048To4095BytePkts, wwpLeosPortHCStatsRxBcastPkts=wwpLeosPortHCStatsRxBcastPkts, wwpLeosPortStatsTxMcastPkts=wwpLeosPortStatsTxMcastPkts, wwpLeosPortHCStatsPortReset=wwpLeosPortHCStatsPortReset, wwpLeosPortTotalHCStatsUndersizePkts=wwpLeosPortTotalHCStatsUndersizePkts, wwpLeosPortTotalStatsTxLOutRangePkts=wwpLeosPortTotalStatsTxLOutRangePkts, wwpLeosPortStatsTxBcastPkts=wwpLeosPortStatsTxBcastPkts, wwpLeosPortHCStatsUndersizePkts=wwpLeosPortHCStatsUndersizePkts, wwpLeosPortTotalStatsPortId=wwpLeosPortTotalStatsPortId, wwpLeosPortHCStatsTxSingleCollPkts=wwpLeosPortHCStatsTxSingleCollPkts, wwpLeosPortTotalStatsPortLinkFlap=wwpLeosPortTotalStatsPortLinkFlap, wwpLeosPortStatsTxLOutRangePkts=wwpLeosPortStatsTxLOutRangePkts, wwpLeosPortHCStatsTxTBytes=wwpLeosPortHCStatsTxTBytes, wwpLeosPortHCStatsTxUnderRunPkts=wwpLeosPortHCStatsTxUnderRunPkts, wwpLeosPortHCStatsRxLOutRangePkts=wwpLeosPortHCStatsRxLOutRangePkts, wwpLeosPortStats256To511BytePkts=wwpLeosPortStats256To511BytePkts, wwpLeosPortHCStatsTxExDeferPkts=wwpLeosPortHCStatsTxExDeferPkts, wwpLeosPortStats65To127BytePkts=wwpLeosPortStats65To127BytePkts, wwpLeosPortTotalHCStatsRxPkts=wwpLeosPortTotalHCStatsRxPkts, wwpLeosPortStatsFragmentPkts=wwpLeosPortStatsFragmentPkts, wwpLeosPortTotalStatsTxPausePkts=wwpLeosPortTotalStatsTxPausePkts, wwpLeosPortTotalHCStatsRxBcastPkts=wwpLeosPortTotalHCStatsRxBcastPkts, wwpLeosPortTotalStatsTx128To255BytePkts=wwpLeosPortTotalStatsTx128To255BytePkts, wwpLeosPortStats2048To4095BytePkts=wwpLeosPortStats2048To4095BytePkts, wwpLeosPortTotalStatsFpgaVlanPriFilterDropPkts=wwpLeosPortTotalStatsFpgaVlanPriFilterDropPkts, wwpLeosPortTotalStatsRxLOutRangePkts=wwpLeosPortTotalStatsRxLOutRangePkts, wwpLeosPortStatsMIB=wwpLeosPortStatsMIB, wwpLeosPortTotalStatsTx256To511BytePkts=wwpLeosPortTotalStatsTx256To511BytePkts, wwpLeosPortHCStatsLastRefresh=wwpLeosPortHCStatsLastRefresh, wwpLeosPortTotalStatsTable=wwpLeosPortTotalStatsTable, wwpLeosPortTotalHCStatsRxUcastPkts=wwpLeosPortTotalHCStatsRxUcastPkts, wwpLeosPortTotalStatsPortLinkDown=wwpLeosPortTotalStatsPortLinkDown, wwpLeosPortStatsTx65To127BytePkts=wwpLeosPortStatsTx65To127BytePkts, wwpLeosPortTotalStats1024To1518BytePkts=wwpLeosPortTotalStats1024To1518BytePkts, wwpLeosPortHCStatsTx128To255BytePkts=wwpLeosPortHCStatsTx128To255BytePkts, wwpLeosPortHCStatsJabberPkts=wwpLeosPortHCStatsJabberPkts, wwpLeosPortTotalStatsTx512To1023BytePkts=wwpLeosPortTotalStatsTx512To1023BytePkts, wwpLeosPortTotalStatsTx1024To1518BytePkts=wwpLeosPortTotalStatsTx1024To1518BytePkts, wwpLeosPortHCStats2048To4095BytePkts=wwpLeosPortHCStats2048To4095BytePkts, wwpLeosPortHCStatsRxDropPkts=wwpLeosPortHCStatsRxDropPkts, wwpLeosPortStatsTxPausePkts=wwpLeosPortStatsTxPausePkts, wwpLeosPortStatsRxPausePkts=wwpLeosPortStatsRxPausePkts, wwpLeosPortTotalStatsRxFpgaDropPkts=wwpLeosPortTotalStatsRxFpgaDropPkts, wwpLeosPortTotalHCStatsRxPausePkts=wwpLeosPortTotalHCStatsRxPausePkts, wwpLeosPortStatsRxBytes=wwpLeosPortStatsRxBytes, wwpLeosPortTotalStatsTx1519To2047BytePkts=wwpLeosPortTotalStatsTx1519To2047BytePkts, wwpLeosPortTotalStatsTxDeferPkts=wwpLeosPortTotalStatsTxDeferPkts, wwpLeosPortHCStatsTxLateCollPkts=wwpLeosPortHCStatsTxLateCollPkts, wwpLeosPortTotalStats512To1023BytePkts=wwpLeosPortTotalStats512To1023BytePkts, wwpLeosPortStatsMIBNotifications=wwpLeosPortStatsMIBNotifications, wwpLeosPortHCStatsTx65To127BytePkts=wwpLeosPortHCStatsTx65To127BytePkts, wwpLeosPortTotalStatsTxCollPkts=wwpLeosPortTotalStatsTxCollPkts, wwpLeosPortTotalHCStatsRxLOutRangePkts=wwpLeosPortTotalHCStatsRxLOutRangePkts, wwpLeosPortHCStatsTxPausePkts=wwpLeosPortHCStatsTxPausePkts, wwpLeosPortTotalStatsTxMcastPkts=wwpLeosPortTotalStatsTxMcastPkts, wwpLeosPortTotalHCStatsTx64BytePkts=wwpLeosPortTotalHCStatsTx64BytePkts, wwpLeosPortTotalStatsTx4096To9216BytePkts=wwpLeosPortTotalStatsTx4096To9216BytePkts, wwpLeosPortTotalStatsTxGiantPkts=wwpLeosPortTotalStatsTxGiantPkts, wwpLeosPortStatsReset=wwpLeosPortStatsReset, wwpLeosPortTotalStatsTxPkts=wwpLeosPortTotalStatsTxPkts, wwpLeosPortTotalStatsTxSingleCollPkts=wwpLeosPortTotalStatsTxSingleCollPkts, wwpLeosPortStatsPortLinkUp=wwpLeosPortStatsPortLinkUp, wwpLeosPortTotalHCStatsTxLCheckErrorPkts=wwpLeosPortTotalHCStatsTxLCheckErrorPkts, wwpLeosPortTotalStats1519To2047BytePkts=wwpLeosPortTotalStats1519To2047BytePkts, wwpLeosPortTotalHCStatsEntry=wwpLeosPortTotalHCStatsEntry, wwpLeosPortTotalHCStatsTxBytes=wwpLeosPortTotalHCStatsTxBytes, wwpLeosPortStatsTxTBytes=wwpLeosPortStatsTxTBytes, wwpLeosPortStatsRxLOutRangePkts=wwpLeosPortStatsRxLOutRangePkts, wwpLeosPortHCStatsTxDeferPkts=wwpLeosPortHCStatsTxDeferPkts, wwpLeosPortTotalHCStatsRxCrcErrorPkts=wwpLeosPortTotalHCStatsRxCrcErrorPkts, wwpLeosPortTotalStatsFpgaRxCrcErrorPkts=wwpLeosPortTotalStatsFpgaRxCrcErrorPkts, wwpLeosPortTotalStatsFpgaRxIpCrcErrorPkts=wwpLeosPortTotalStatsFpgaRxIpCrcErrorPkts, wwpLeosPortStatsRxUcastPkts=wwpLeosPortStatsRxUcastPkts, wwpLeosPortTotalStatsRxBytes=wwpLeosPortTotalStatsRxBytes, wwpLeosPortHCStatsRxCrcErrorPkts=wwpLeosPortHCStatsRxCrcErrorPkts, wwpLeosPortHCStatsTxCrcErrorPkts=wwpLeosPortHCStatsTxCrcErrorPkts, wwpLeosPortTotalHCStats256To511BytePkts=wwpLeosPortTotalHCStats256To511BytePkts, wwpLeosPortHCStats128To255BytePkts=wwpLeosPortHCStats128To255BytePkts, wwpLeosPortTotalHCStatsLastRefresh=wwpLeosPortTotalHCStatsLastRefresh, wwpLeosPortStatsPortLinkFlap=wwpLeosPortStatsPortLinkFlap, wwpLeosPortStats64BytePkts=wwpLeosPortStats64BytePkts, wwpLeosPortStatsMIBObjects=wwpLeosPortStatsMIBObjects, wwpLeosPortTotalHCStatsTxExDeferPkts=wwpLeosPortTotalHCStatsTxExDeferPkts, wwpLeosPortTotalHCStatsTxUnderRunPkts=wwpLeosPortTotalHCStatsTxUnderRunPkts, wwpLeosPortHCStats1024To1518BytePkts=wwpLeosPortHCStats1024To1518BytePkts, wwpLeosPortHCStatsRxPkts=wwpLeosPortHCStatsRxPkts, wwpLeosPortHCStatsTx4096To9216BytePkts=wwpLeosPortHCStatsTx4096To9216BytePkts, wwpLeosPortTotalStatsTxUcastPkts=wwpLeosPortTotalStatsTxUcastPkts, wwpLeosPortTotalStatsRxDiscardPkts=wwpLeosPortTotalStatsRxDiscardPkts, wwpLeosPortStatsTxPkts=wwpLeosPortStatsTxPkts, wwpLeosPortStatsTxUnderRunPkts=wwpLeosPortStatsTxUnderRunPkts, wwpLeosPortTotalStats2048To4095BytePkts=wwpLeosPortTotalStats2048To4095BytePkts, wwpLeosPortHCStatsTxLOutRangePkts=wwpLeosPortHCStatsTxLOutRangePkts, wwpLeosPortHCStatsEntry=wwpLeosPortHCStatsEntry, wwpLeosPortStatsTx256To511BytePkts=wwpLeosPortStatsTx256To511BytePkts, wwpLeosPortTotalHCStatsTxCrcErrorPkts=wwpLeosPortTotalHCStatsTxCrcErrorPkts, wwpLeosPortStats1519To2047BytePkts=wwpLeosPortStats1519To2047BytePkts, wwpLeosPortTotalStats65To127BytePkts=wwpLeosPortTotalStats65To127BytePkts, wwpLeosPortStatsJabberPkts=wwpLeosPortStatsJabberPkts, wwpLeosPortHCStatsTx512To1023BytePkts=wwpLeosPortHCStatsTx512To1023BytePkts, wwpLeosPortStatsTxLateCollPkts=wwpLeosPortStatsTxLateCollPkts, wwpLeosPortStatsRxDropPkts=wwpLeosPortStatsRxDropPkts, wwpLeosPortHCStatsTx1519To2047BytePkts=wwpLeosPortHCStatsTx1519To2047BytePkts, wwpLeosPortHCStatsRxMcastPkts=wwpLeosPortHCStatsRxMcastPkts, wwpLeosPortTotalHCStatsTable=wwpLeosPortTotalHCStatsTable, wwpLeosPortTotalStatsTxUnderRunPkts=wwpLeosPortTotalStatsTxUnderRunPkts, wwpLeosPortTotalStatsTxExDeferPkts=wwpLeosPortTotalStatsTxExDeferPkts, wwpLeosPortStatsRxCrcErrorPkts=wwpLeosPortStatsRxCrcErrorPkts, wwpLeosPortStatsTxDeferPkts=wwpLeosPortStatsTxDeferPkts, wwpLeosPortStatsTx512To1023BytePkts=wwpLeosPortStatsTx512To1023BytePkts, wwpLeosPortTotalStatsTxLCheckErrorPkts=wwpLeosPortTotalStatsTxLCheckErrorPkts, wwpLeosPortTotalHCStats65To127BytePkts=wwpLeosPortTotalHCStats65To127BytePkts, wwpLeosPortTotalHCStats1519To2047BytePkts=wwpLeosPortTotalHCStats1519To2047BytePkts, wwpLeosPortStatsTable=wwpLeosPortStatsTable, wwpLeosPortTotalHCStatsRxDiscardPkts=wwpLeosPortTotalHCStatsRxDiscardPkts, wwpLeosPortStats4096To9216BytePkts=wwpLeosPortStats4096To9216BytePkts, wwpLeosPortTotalHCStatsTx512To1023BytePkts=wwpLeosPortTotalHCStatsTx512To1023BytePkts, wwpLeosPortStatsMIBNotificationPrefix=wwpLeosPortStatsMIBNotificationPrefix, wwpLeosPortHCStatsTxGiantPkts=wwpLeosPortHCStatsTxGiantPkts, wwpLeosPortTotalStatsRxUcastPkts=wwpLeosPortTotalStatsRxUcastPkts, wwpLeosPortHCStats64BytePkts=wwpLeosPortHCStats64BytePkts, wwpLeosPortHCStatsRxInErrorPkts=wwpLeosPortHCStatsRxInErrorPkts, wwpLeosPortTotalHCStatsRxBytes=wwpLeosPortTotalHCStatsRxBytes, wwpLeosPortTotalStats64BytePkts=wwpLeosPortTotalStats64BytePkts, wwpLeosPortStatsTxExDeferPkts=wwpLeosPortStatsTxExDeferPkts, wwpLeosPortStatsRxPkts=wwpLeosPortStatsRxPkts, wwpLeosPortTotalHCStatsTxTBytes=wwpLeosPortTotalHCStatsTxTBytes, wwpLeosPortStatsMIBGroups=wwpLeosPortStatsMIBGroups, wwpLeosPortStatsTxCrcErrorPkts=wwpLeosPortStatsTxCrcErrorPkts, wwpLeosPortTotalStatsEntry=wwpLeosPortTotalStatsEntry, wwpLeosPortTotalHCStatsFragmentPkts=wwpLeosPortTotalHCStatsFragmentPkts, wwpLeosPortTotalStatsUndersizePkts=wwpLeosPortTotalStatsUndersizePkts, wwpLeosPortTotalStatsTxFpgaBufferDropPkts=wwpLeosPortTotalStatsTxFpgaBufferDropPkts, wwpLeosPortHCStatsTxPkts=wwpLeosPortHCStatsTxPkts, wwpLeosPortTotalHCStats2048To4095BytePkts=wwpLeosPortTotalHCStats2048To4095BytePkts, wwpLeosPortTotalHCStatsTx65To127BytePkts=wwpLeosPortTotalHCStatsTx65To127BytePkts, wwpLeosPortTotalStatsFpgaRxErrorPkts=wwpLeosPortTotalStatsFpgaRxErrorPkts, wwpLeosPortTotalHCStatsPortId=wwpLeosPortTotalHCStatsPortId, wwpLeosPortTotalStatsFragmentPkts=wwpLeosPortTotalStatsFragmentPkts, wwpLeosPortStats512To1023BytePkts=wwpLeosPortStats512To1023BytePkts, wwpLeosPortStats=wwpLeosPortStats, wwpLeosPortHCStatsTx256To511BytePkts=wwpLeosPortHCStatsTx256To511BytePkts, wwpLeosPortTotalHCStatsJabberPkts=wwpLeosPortTotalHCStatsJabberPkts, wwpLeosPortTotalHCStatsTx1024To1518BytePkts=wwpLeosPortTotalHCStatsTx1024To1518BytePkts, wwpLeosPortHCStatsRxBytes=wwpLeosPortHCStatsRxBytes, wwpLeosPortTotalHCStats64BytePkts=wwpLeosPortTotalHCStats64BytePkts, wwpLeosPortStatsTxExCollPkts=wwpLeosPortStatsTxExCollPkts, wwpLeosPortStatsTxGiantPkts=wwpLeosPortStatsTxGiantPkts, wwpLeosPortHCStats65To127BytePkts=wwpLeosPortHCStats65To127BytePkts, wwpLeosPortStats1024To1518BytePkts=wwpLeosPortStats1024To1518BytePkts, wwpLeosPortHCStatsTxUcastPkts=wwpLeosPortHCStatsTxUcastPkts, wwpLeosPortTotalHCStatsTxCollPkts=wwpLeosPortTotalHCStatsTxCollPkts, wwpLeosPortTotalStatsTx65To127BytePkts=wwpLeosPortTotalStatsTx65To127BytePkts, wwpLeosPortTotalStatsRxFpgaBufferDropPkts=wwpLeosPortTotalStatsRxFpgaBufferDropPkts, wwpLeosPortTotalHCStatsTxLOutRangePkts=wwpLeosPortTotalHCStatsTxLOutRangePkts, wwpLeosPortTotalHCStatsTxPausePkts=wwpLeosPortTotalHCStatsTxPausePkts, wwpLeosPortHCStatsOversizePkts=wwpLeosPortHCStatsOversizePkts, wwpLeosPortTotalStatsTxBcastPkts=wwpLeosPortTotalStatsTxBcastPkts, wwpLeosPortStatsTxBytes=wwpLeosPortStatsTxBytes, wwpLeosPortTotalHCStatsTxGiantPkts=wwpLeosPortTotalHCStatsTxGiantPkts, wwpLeosPortTotalHCStatsTxExCollPkts=wwpLeosPortTotalHCStatsTxExCollPkts, wwpLeosPortStatsTx1519To2047BytePkts=wwpLeosPortStatsTx1519To2047BytePkts, PYSNMP_MODULE_ID=wwpLeosPortStatsMIB, wwpLeosPortTotalStatsOversizePkts=wwpLeosPortTotalStatsOversizePkts, wwpLeosPortTotalHCStatsTxMcastPkts=wwpLeosPortTotalHCStatsTxMcastPkts, wwpLeosPortStatsTxLCheckErrorPkts=wwpLeosPortStatsTxLCheckErrorPkts, wwpLeosPortHCStats256To511BytePkts=wwpLeosPortHCStats256To511BytePkts, wwpLeosPortHCStatsTxExCollPkts=wwpLeosPortHCStatsTxExCollPkts, wwpLeosPortHCStatsTxBcastPkts=wwpLeosPortHCStatsTxBcastPkts, wwpLeosPortTotalHCStatsTx4096To9216BytePkts=wwpLeosPortTotalHCStatsTx4096To9216BytePkts, wwpLeosPortHCStatsTx2048To4095BytePkts=wwpLeosPortHCStatsTx2048To4095BytePkts, wwpLeosPortTotalStats128To255BytePkts=wwpLeosPortTotalStats128To255BytePkts, wwpLeosPortStatsTx128To255BytePkts=wwpLeosPortStatsTx128To255BytePkts, wwpLeosPortTotalStatsTxLateCollPkts=wwpLeosPortTotalStatsTxLateCollPkts, wwpLeosPortStatsFpgaVlanPriFilterDropPkts=wwpLeosPortStatsFpgaVlanPriFilterDropPkts, wwpLeosPortStatsTxFpgaBufferDropPkts=wwpLeosPortStatsTxFpgaBufferDropPkts, wwpLeosPortTotalStatsRxPkts=wwpLeosPortTotalStatsRxPkts, wwpLeosPortTotalHCStatsTx2048To4095BytePkts=wwpLeosPortTotalHCStatsTx2048To4095BytePkts, wwpLeosPortHCStatsLastChange=wwpLeosPortHCStatsLastChange, wwpLeosPortHCStats512To1023BytePkts=wwpLeosPortHCStats512To1023BytePkts, wwpLeosPortTotalHCStats512To1023BytePkts=wwpLeosPortTotalHCStats512To1023BytePkts, wwpLeosPortTotalHCStatsTxLateCollPkts=wwpLeosPortTotalHCStatsTxLateCollPkts, wwpLeosPortStatsFpgaRxIpCrcErrorPkts=wwpLeosPortStatsFpgaRxIpCrcErrorPkts, wwpLeosPortStatsRxInErrorPkts=wwpLeosPortStatsRxInErrorPkts, wwpLeosPortStatsUndersizePkts=wwpLeosPortStatsUndersizePkts, wwpLeosPortHCStatsTx1024To1518BytePkts=wwpLeosPortHCStatsTx1024To1518BytePkts, wwpLeosPortTotalHCStatsPortReset=wwpLeosPortTotalHCStatsPortReset, wwpLeosPortTotalStatsTxExCollPkts=wwpLeosPortTotalStatsTxExCollPkts, wwpLeosPortStatsOversizePkts=wwpLeosPortStatsOversizePkts, wwpLeosPortStatsTxSingleCollPkts=wwpLeosPortStatsTxSingleCollPkts, wwpLeosPortTotalStatsRxPausePkts=wwpLeosPortTotalStatsRxPausePkts, wwpLeosPortHCStatsRxPausePkts=wwpLeosPortHCStatsRxPausePkts, wwpLeosPortTotalHCStatsRxInErrorPkts=wwpLeosPortTotalHCStatsRxInErrorPkts, wwpLeosPortTotalHCStatsTx256To511BytePkts=wwpLeosPortTotalHCStatsTx256To511BytePkts, wwpLeosPortTotalStatsRxCrcErrorPkts=wwpLeosPortTotalStatsRxCrcErrorPkts, wwpLeosPortTotalHCStatsLastChange=wwpLeosPortTotalHCStatsLastChange, wwpLeosPortTotalStatsRxMcastPkts=wwpLeosPortTotalStatsRxMcastPkts, wwpLeosPortHCStats1519To2047BytePkts=wwpLeosPortHCStats1519To2047BytePkts, wwpLeosPortStatsMIBConformance=wwpLeosPortStatsMIBConformance, wwpLeosPortStatsTxUcastPkts=wwpLeosPortStatsTxUcastPkts, wwpLeosPortHCStatsRxDiscardPkts=wwpLeosPortHCStatsRxDiscardPkts, wwpLeosPortTotalHCStatsRxDropPkts=wwpLeosPortTotalHCStatsRxDropPkts, wwpLeosPortStats128To255BytePkts=wwpLeosPortStats128To255BytePkts, wwpLeosPortStatsMIBCompliances=wwpLeosPortStatsMIBCompliances, wwpLeosPortTotalStatsPortLinkUp=wwpLeosPortTotalStatsPortLinkUp, wwpLeosPortStatsEntry=wwpLeosPortStatsEntry, wwpLeosPortStatsTxCollPkts=wwpLeosPortStatsTxCollPkts, wwpLeosPortStatsTx2048To4095BytePkts=wwpLeosPortStatsTx2048To4095BytePkts, wwpLeosPortHCStatsFragmentPkts=wwpLeosPortHCStatsFragmentPkts, wwpLeosPortTotalHCStatsOversizePkts=wwpLeosPortTotalHCStatsOversizePkts, wwpLeosPortTotalStatsRxDropPkts=wwpLeosPortTotalStatsRxDropPkts, wwpLeosPortTotalHCStats1024To1518BytePkts=wwpLeosPortTotalHCStats1024To1518BytePkts, wwpLeosPortTotalHCStatsTxDeferPkts=wwpLeosPortTotalHCStatsTxDeferPkts, wwpLeosPortTotalHCStatsTx128To255BytePkts=wwpLeosPortTotalHCStatsTx128To255BytePkts, wwpLeosPortTotalHCStatsTx1519To2047BytePkts=wwpLeosPortTotalHCStatsTx1519To2047BytePkts, wwpLeosPortStatsTx4096To9216BytePkts=wwpLeosPortStatsTx4096To9216BytePkts, wwpLeosPortHCStatsPortId=wwpLeosPortHCStatsPortId, wwpLeosPortStatsPortLinkDown=wwpLeosPortStatsPortLinkDown, wwpLeosPortTotalHCStatsTxSingleCollPkts=wwpLeosPortTotalHCStatsTxSingleCollPkts, wwpLeosPortStatsRxMcastPkts=wwpLeosPortStatsRxMcastPkts, wwpLeosPortStatsTx64BytePkts=wwpLeosPortStatsTx64BytePkts) mibBuilder.exportSymbols("WWP-LEOS-PORT-STATS-MIB", )
""" Makes a list of the files to be copied from source to destination. Notes: Couldn't make this doctest work, so useful only as a visual test. >>> from GDLC.GDLC import * # Copy a list of files to the default directory: >>> template_copy(dir='~/GDLC/source/GDLC_unpacked') # doctest:+ELLIPSIS [PosixPath('.../mobi7/Images/author_footer.jpeg'), PosixPath('.../mobi7/Images/author_image.jpeg'), PosixPath('.../mobi7/Images/cover_image.jpeg'), PosixPath('.../mobi7/Images/cover_logo.jpeg'), PosixPath('.../mobi7/Images/cover_thumb.jpeg'), PosixPath('.../mobi8/mimetype'), PosixPath('.../mobi8/META-INF/container.xml'), PosixPath('.../mobi8/OEBPS/content.opf'), PosixPath('.../mobi8/OEBPS/toc.ncx'), PosixPath('.../mobi8/OEBPS/Styles/style0001.css'), PosixPath('.../mobi8/OEBPS/Styles/style0002.css'), PosixPath('.../mobi8/OEBPS/Images/author_footer.jpeg'), PosixPath('.../mobi8/OEBPS/Images/author_image.jpeg'), PosixPath('.../mobi8/OEBPS/Images/cover_image.jpeg'), PosixPath('.../mobi8/OEBPS/Images/cover_logo.jpeg'), PosixPath('.../mobi8/OEBPS/Text/cover_page.xhtml')] """
def partition(arr, left, right): pivot = arr[left] low = left + 1 high = right while low <= high: while low <= right and pivot > arr[low]: low += 1 while high > left and pivot < arr[high]: high -= 1 if (low <= high): arr[low], arr[high] = arr[high], arr[low] arr[left], arr[high] = arr[high], arr[left] return high def quick_sort(arr, left, right): if left > right: return pivot_idx = partition(arr, left, right) quick_sort(arr, left, pivot_idx - 1) quick_sort(arr, pivot_idx + 1, right) def print_array(arr, n): for i in range(n): print(arr[i], end=' ') print() arr = list(map(int, input().split())) size = len(arr) print_array(arr, size) quick_sort(arr, 0, size - 1) print_array(arr, size) ''' Input: 5 4 3 2 1 Output: 5 4 3 2 1 1 2 3 4 5 '''
# Copyright (c) 2019 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Constants used in CSIT.""" class Constants(object): """Constants used in CSIT. TODO: Yaml files are easier for humans to edit. Figure out how to set the attributes by parsing a file that works regardless of current working directory. """ # OpenVPP testing directory location at topology nodes REMOTE_FW_DIR = '/tmp/openvpp-testing' # shell scripts location RESOURCES_LIB_SH = 'resources/libraries/bash' # Python API provider location RESOURCES_PAPI_PROVIDER = 'resources/tools/papi/vpp_papi_provider.py' # vat templates location RESOURCES_TPL_VAT = 'resources/templates/vat' # Kubernetes templates location RESOURCES_TPL_K8S = 'resources/templates/kubernetes' # KernelVM templates location RESOURCES_TPL_VM = 'resources/templates/vm' # Container templates location RESOURCES_TPL_CONTAINER = 'resources/templates/container' # OpenVPP VAT binary name VAT_BIN_NAME = 'vpp_api_test' # VPP service unit name VPP_UNIT = 'vpp' # Number of system CPU cores. CPU_CNT_SYSTEM = 1 # Number of vswitch main thread CPU cores. CPU_CNT_MAIN = 1 # QEMU binary path QEMU_BIN_PATH = '/usr/bin' # QEMU VM kernel image path QEMU_VM_KERNEL = '/opt/boot/vmlinuz' # QEMU VM nested image path QEMU_VM_IMAGE = '/var/lib/vm/vhost-nested.img' # QEMU VM DPDK path QEMU_VM_DPDK = '/opt/dpdk-19.02' # TRex install version TREX_INSTALL_VERSION = '2.54' # TRex install directory TREX_INSTALL_DIR = '/opt/trex-core-2.54' # Honeycomb directory location at topology nodes: REMOTE_HC_DIR = '/opt/honeycomb' # Honeycomb persistence files location REMOTE_HC_PERSIST = '/var/lib/honeycomb/persist' # Honeycomb log file location REMOTE_HC_LOG = '/var/log/honeycomb/honeycomb.log' # Honeycomb templates location RESOURCES_TPL_HC = 'resources/templates/honeycomb' # ODL Client Restconf listener port ODL_PORT = 8181 # Sysctl kernel.core_pattern KERNEL_CORE_PATTERN = '/tmp/%p-%u-%g-%s-%t-%h-%e.core' # Core dump directory CORE_DUMP_DIR = '/tmp' # Equivalent to ~0 used in vpp code BITWISE_NON_ZERO = 0xffffffff # Maximum number of API calls per PapiExecutor execution PAPI_MAX_API_BULK = 250 # Mapping from NIC name to its bps limit. # TODO: Implement logic to lower limits to TG NIC or software. Or PCI. NIC_NAME_TO_LIMIT = { # TODO: Explain why ~40Gbps NICs are using ~25Gbps limit. "Cisco-VIC-1227": 10000000000, "Cisco-VIC-1385": 24500000000, "Intel-X520-DA2": 10000000000, "Intel-X553": 10000000000, "Intel-X710": 10000000000, "Intel-XL710": 24500000000, "Intel-XXV710": 24500000000, } # Suite file names use somewhat more rich (less readable) codes for NICs. NIC_NAME_TO_CODE = { "Cisco-VIC-1227": "10ge2p1vic1227", "Cisco-VIC-1385": "40ge2p1vic1385", "Intel-X520-DA2": "10ge2p1x520", "Intel-X553": "10ge2p1x553", "Intel-X710": "10ge2p1x710", "Intel-XL710": "40ge2p1xl710", "Intel-XXV710": "25ge2p1xxv710", } # TODO CSIT-1481: Crypto HW should be read from topology file instead. NIC_NAME_TO_CRYPTO_HW = { "Intel-X553": "HW_C3xxx", "Intel-X710": "HW_DH895xcc", "Intel-XL710": "HW_DH895xcc", } PERF_TYPE_TO_KEYWORD = { "mrr": "Traffic should pass with maximum rate", "ndrpdr": "Find NDR and PDR intervals using optimized search", "soak": "Find critical load using PLRsearch", } PERF_TYPE_TO_SUITE_DOC_VER = { "mrr" : '''fication:* In MaxReceivedRate tests TG sends traffic\\ | ... | at line rate and reports total received packets over trial period.\\''', # TODO: Figure out how to include the full "*[Ver] TG verification:*" # while keeping this readable and without breaking line length limit. "ndrpdr": '''fication:* TG finds and reports throughput NDR (Non Drop\\ | ... | Rate) with zero packet loss tolerance and throughput PDR (Partial Drop\\ | ... | Rate) with non-zero packet loss tolerance (LT) expressed in percentage\\ | ... | of packets transmitted. NDR and PDR are discovered for different\\ | ... | Ethernet L2 frame sizes using MLRsearch library.\\''', "soak": '''fication:* TG sends traffic at dynamically computed\\ | ... | rate as PLRsearch algorithm gathers data and improves its estimate\\ | ... | of a rate at which a prescribed small fraction of packets\\ | ... | would be lost. After set time, the serarch stops\\ | ... | and the algorithm reports its current estimate.\\''', } PERF_TYPE_TO_TEMPLATE_DOC_VER = { "mrr": '''Measure MaxReceivedRate for ${frame_size}B frames\\ | | ... | using burst trials throughput test.\\''', "ndrpdr": '''Measure NDR and PDR values using MLRsearch algorithm.\\''', "soak": '''Estimate critical rate using PLRsearch algorithm.\\''', }
sieve = [0] * 300001 for i in range(6, 300000, 7): sieve[i] = sieve[i+2] = 1 MSprimes = [] for i in range(6, 300000, 7): if sieve[i] == 1: MSprimes.append(i) for j in range(2*i, 300000, i): sieve[j] = 0 if sieve[i+2] == 1: MSprimes.append(i+2) for j in range(2*(i+2), 300000, i+2): sieve[j] = 0 while True: N = int(input()) if N == 1: break ansp = [x for x in MSprimes if N % x == 0] print('{}: {}'.format(N, ' '.join(map(str, ansp))))
N = int(input()) a = list(map(int, input().split())) a.sort(reverse=True) print(sum(a[1::2][:N]))
if m > 1: b = 'metros equivalem' else: b = 'metro equivale' #https://pt.stackoverflow.com/q/413280/101
# # # # # # # def modifyData(): file = open("data_origin.txt", 'r') printFile = open("raw_data.txt",'w+') while True: text = file.readline() res = text.split() if not text: break if res[3] == '실행' or res[3] == '출력': # 실행 중 에러 or 출력 한계 초과 for i in range(len(res)-2): if i == 3: printFile.write(res[3]+res[4]+res[5]) printFile.write(' ') elif i < 3: printFile.write(res[i]) printFile.write(' ') else: printFile.write(res[i+2]) printFile.write(' ') printFile.write('\n') elif res[3] == '컴파일' and res[4] == '중': # 컴파일 중 --- print('데이터 내에 \'컴파일 중\'인 데이터가 있습니다.\n') print(res[0],'번을 확인해주세요. (크롤링에서 제외됩니다)\n') else: for i in range(len(res)-1): if i == 3: printFile.write(res[3]+res[4]) printFile.write(' ') elif i < 3: printFile.write(res[i]) printFile.write(' ') else: printFile.write(res[i+1]) printFile.write(' ') printFile.write('\n') file.close() printFile.close() if __name__ == '__main__': modifyData() print('Done!') input('Press Any Key ')
# Test of 3.5+ GET_YIELD_FROM_ITER # Code is from https://stackoverflow.com/questions/41136410/python-yield-from-or-return-a-generator def add(a, b): return a + b def sqrt(a): return a ** 0.5 data1 = [*zip(range(1, 3))] # [(1,), (2,)] job1 = (sqrt, data1) def gen_factory(func, seq): """Generator factory returning a generator.""" # do stuff ... immediately when factory gets called print("build generator & return") return (func(*args) for args in seq) def gen_generator(func, seq): """Generator yielding from sub-generator inside.""" # do stuff ... first time when 'next' gets called print("build generator & yield") yield from (func(*args) for args in seq) gen_fac = gen_factory(*job1) print(gen_fac) # build generator & return <-- printed immediately print(next(gen_fac)) # start # Out: 1.0 print([*gen_fac]) # deplete rest of generator # Out: [1.4142135623730951]
__version__ = '0.1.0' def cli(): print("Hello from child CLI!")
input_data = '1901,12.3\n1902,45.6\n1903,78.9' print('input data is:') print(input_data) as_lines = input_data.split('\n') print('as lines:') print(as_lines) for line in as_lines: fields = line.split(',') year = int(fields[0]) value = float(fields[1]) print(year, ':', value)
def get_function_at(bv, addr): """ Gets the function that contains a given address, even if that address isn't the start of the function """ blocks = bv.get_basic_blocks_at(addr) return blocks[0].function if (blocks is not None and len(blocks) > 0) else None def find_mlil(func, addr): return find_in_IL(func.medium_level_il, addr) def find_llil(func, addr): return find_in_IL(func.low_level_il, addr) def find_lifted_il(func, addr): return find_in_IL(func.lifted_il, addr) def find_in_IL(il, addr): """ Finds everything at the given address within the IL function passed in """ out = [] for block in il: for instruction in block: if instruction.address == addr: out.append(instruction) return out def inst_in_func(func, addr): """ Finds an assembly function at the address given """ return func.view.get_disassembly(addr) def dereference_symbols(bv, il_instruction): """ If the instruction contains anything that looks vaguely like a hex number, see if there's a function there, and if so, replace it with the function symbol.""" if il_instruction is not None: out = [] for item in il_instruction.tokens: try: addr = int(str(item), 16) func = bv.get_function_at(addr) if func is not None: out.append(func.name) continue except ValueError: pass out.append(item) il_instruction.deref_tokens = out return il_instruction def parse_instruction(context, instr): """ Helps the GUI go from lists of instruction data to a cleanly formatted string """ if instr is not None: docs = context.get_doc_url(instr.split(' ')) instruction = context.escape(instr.replace(' ', ' ')) shortForm = context.newline.join("<a href=\"{href}\">{form}</a>".format(href=url, form=context.escape(short_form)) for short_form, url in docs) return instruction, shortForm else: return 'None', 'None' def parse_description(context, desc_list): return context.newline.join(context.escape(new_description) for new_description in desc_list) def parse_llil(context, llil_list): """ Helps the GUI go from lists of instruction data to a cleanly formatted string """ newText = "" for llil in llil_list: if llil is not None: tokens = llil.deref_tokens if hasattr(llil, 'deref_tokens') else llil.tokens newText += "{}: ".format(llil.instr_index) newText += ''.join(context.escape(str(token)) for token in tokens) else: newText += 'None' newText += context.newline if(len(llil_list) > 0): return newText.strip(context.newline) else: return 'None' def parse_mlil(context, mlil_list): """ Helps the GUI go from lists of instruction data to a cleanly formatted string """ newText = "" for mlil in mlil_list: if mlil is not None: tokens = mlil.deref_tokens if hasattr(mlil, 'deref_tokens') else mlil.tokens newText += "{}: ".format(mlil.instr_index) newText += (''.join(context.escape(str(token)) for token in tokens)) else: newText += ('None') newText += context.newline if(len(mlil_list) > 0): return newText.strip(context.newline) else: return 'None' def parse_state(context, state_list): if state_list is not None: return context.newline.join(context.escape(state) for state in state_list) else: return 'None' def rec_replace(in_str, old, new): """ Recursively replace a string in a string """ if old == new: return in_str if old not in in_str: return in_str return rec_replace(in_str.replace(old, new), old, new) def parse_flags(context, tuple_list_list): """ Helps the GUI go from lists of instruction data to a cleanly formatted string """ out = "" for f_read, f_written, lifted in tuple_list_list: if len(f_read) > 0: out += ("(Lifted IL: {}) ".format(lifted.instr_index) if len(tuple_list_list) > 1 else "") + "Reads: " + ', '.join(f_read) + context.newline if len(f_written) > 0: out += ("(Lifted IL: {}) ".format(lifted.instr_index) if len(tuple_list_list) > 1 else "") + "Writes: " + ', '.join(f_written) + context.newline out += context.newline out = rec_replace(out.strip(context.newline), context.newline*2, context.newline) out = "None" if len(out) == 0 else out return out
def _get_owner_from_details(details, default=None): result = default if details.get('owner_slackid') is not None: return '<@{}>'.format(details.get('owner_slackid')) elif details.get('owner_name') is not None: return details.get('owner_name') return result command_car_usage = 'Lookup car details including the owner (if known):\n' \ '`AA-12-BB` _(dashes are optional)_\n' \ '`tag AA-12-BB` _(register your car)_\n' \ '`tag AA-12-BB @slackid` _(register someone else)_\n' \ '`tag AA-12-BB "Jack Sparrow"` _(register someone on name)_\n' \ '`untag AA-12-BB` _(remove this entry)_\n' \ command_tag_usage = 'Register or unregister the owner of a car:\n' \ ' `tag AA-12-BB` _(you are the owner)_\n' \ ' `tag AA-12-BB @thatguy` _(or someone else with a slack handle)_\n' \ ' `tag AA-12-BB "The great pirate"` _(or a quoted string defining the owner)_\n' \ ' `untag AA-12-BB` _(removes this car)_' def command_invalid_owner(owner, min_chars=3, max_chars=32): return 'Invalid owner "{}" _(must be double-quoted, between {} - {} chars and normal text chars)_'.format( owner, min_chars, max_chars) def command_invalid_usage(nr_arguments): return 'Invalid nr of arguments. Expects at most 3, given {}.\nUsage:\n{}'.format( nr_arguments, command_car_usage) def command_invalid_licence_plate(text): return 'Input ({}) does not look like a valid licence plate (NL-patterns)'.format(text) def command_tag_added(plate, user_id=None, owner=None): if owner: return 'Added {} to "{}"'.format(plate, owner) else: return 'Added {} to <{}>'.format(plate, user_id) def command_untag(plate): return 'Removed the licence plate {}'.format(plate) def lookup_no_details_found(plate): return '`/car {}` lookup: No details found...'.format(plate) def lookup_found_with_details(plate, details): model = details.get('model') or '-' car_brand = details.get('brand') or '-' owner = _get_owner_from_details(details) or '- _(`/car tag` to add owner)_' apk = details.get('apk') or '-' price = details.get('price') or '-' bpm = details.get('bpm') or '-' acceleration = details.get('acceleration') or '-' if isinstance(price, int): price = '€ {:,d}'.format(price).replace(',', '.') if isinstance(bpm, int): price += " (€ {:,d} BPM)".format(bpm).replace(',', '.') return '''`/car {plate}` lookup: <https://autorapport.finnik.nl/kenteken/{plate}|*{car_brand} {model}*> • Owner: {owner} • Price: {price} • 0-100: {acceleration} sec • APK expires: {apk}'''.format(plate=plate, model=model, car_brand=car_brand, owner=owner, price=price, acceleration=acceleration, apk=apk) comment_no_plate_found = "No plates were found. Try `/car [license plate]` " \ "if _you_ can OCR a license plate from that image." def comment_found_with_details(plate, confidence, details): model = details.get('model') or '-' car_brand = details.get('brand') or '-' owner = _get_owner_from_details(details) or '- _(`/car tag` to add owner)_' apk = details.get('apk') or '-' price = details.get('price') or '-' acceleration = details.get('acceleration') or '-' if isinstance(price, int): price = '€ {:,d}'.format(price).replace(',', '.') return ''':mega: Found *{plate}*, it's a <https://autorapport.finnik.nl/kenteken/{plate}|*{car_brand} {model}*> ! _(confidence {confidence:.2f})_ • Owner: {owner} • Price: {price} • 0-100: {acceleration} sec • APK expires: {apk}'''.format(plate=plate, confidence=confidence, model=model, owner=owner, car_brand=car_brand, price=price, acceleration=acceleration, apk=apk) def comment_found_no_details(plate, confidence): return 'I found *{plate}* _(confidence {confidence:.2f})_, but no extra info associated with it...'.format( plate=plate, confidence=confidence) def comment_found_but_skipping(plate, confidence, threshold, is_valid): if not is_valid: return "Skipping licence plate '{plate}', it's NOT a valid NL pattern _(confidence {confidence:.2f})_".format( plate=plate, confidence=confidence) return "Skipping licence plate '{plate}', too low confidence ({confidence:.2f} < {threshold:.2f})".format( plate=plate, confidence=confidence, threshold=threshold)
"""Project metadata. """ __title__ = 'yummly' __summary__ = 'Python library for Yummly API: https://developer.yummly.com' __url__ = 'https://github.com/dgilland/yummly.py' __version__ = '0.5.0' __install_requires__ = ['requests>=1.1.0'] __author__ = 'Derrick Gilland' __email__ = 'dgilland@gmail.com' __license__ = 'MIT License'
def findDecision(obj): #obj[0]: Passanger, obj[1]: Weather, obj[2]: Temperature, obj[3]: Time, obj[4]: Coupon, obj[5]: Coupon_validity, obj[6]: Gender, obj[7]: Age, obj[8]: Maritalstatus, obj[9]: Children, obj[10]: Education, obj[11]: Occupation, obj[12]: Income, obj[13]: Bar, obj[14]: Coffeehouse, obj[15]: Restaurantlessthan20, obj[16]: Restaurant20to50, obj[17]: Direction_same, obj[18]: Distance # {"feature": "Age", "instances": 51, "metric_value": 0.9774, "depth": 1} if obj[7]<=3: # {"feature": "Weather", "instances": 34, "metric_value": 0.9975, "depth": 2} if obj[1]<=0: # {"feature": "Coupon", "instances": 28, "metric_value": 0.9852, "depth": 3} if obj[4]<=3: # {"feature": "Restaurantlessthan20", "instances": 17, "metric_value": 0.874, "depth": 4} if obj[15]<=2.0: # {"feature": "Occupation", "instances": 10, "metric_value": 1.0, "depth": 5} if obj[11]<=8: # {"feature": "Income", "instances": 7, "metric_value": 0.8631, "depth": 6} if obj[12]>4: return 'True' elif obj[12]<=4: # {"feature": "Passanger", "instances": 3, "metric_value": 0.9183, "depth": 7} if obj[0]>0: return 'False' elif obj[0]<=0: return 'True' else: return 'True' else: return 'False' elif obj[11]>8: return 'False' else: return 'False' elif obj[15]>2.0: return 'True' else: return 'True' elif obj[4]>3: # {"feature": "Time", "instances": 11, "metric_value": 0.9457, "depth": 4} if obj[3]<=1: return 'False' elif obj[3]>1: # {"feature": "Passanger", "instances": 5, "metric_value": 0.7219, "depth": 5} if obj[0]>0: return 'True' elif obj[0]<=0: # {"feature": "Children", "instances": 2, "metric_value": 1.0, "depth": 6} if obj[9]<=0: return 'True' elif obj[9]>0: return 'False' else: return 'False' else: return 'True' else: return 'True' else: return 'False' elif obj[1]>0: return 'False' else: return 'False' elif obj[7]>3: # {"feature": "Temperature", "instances": 17, "metric_value": 0.6723, "depth": 2} if obj[2]>30: # {"feature": "Bar", "instances": 14, "metric_value": 0.3712, "depth": 3} if obj[13]<=2.0: return 'True' elif obj[13]>2.0: # {"feature": "Coupon", "instances": 3, "metric_value": 0.9183, "depth": 4} if obj[4]<=0: return 'True' elif obj[4]>0: return 'False' else: return 'False' else: return 'True' elif obj[2]<=30: # {"feature": "Time", "instances": 3, "metric_value": 0.9183, "depth": 3} if obj[3]>0: return 'False' elif obj[3]<=0: return 'True' else: return 'True' else: return 'False' else: return 'True'
score = int(input()) if score >= 90: print("A") elif score >= 70: print("B") elif score >= 40: print("C") else: print("D")
{ "targets": [ { "target_name": "addon", "sources": ["./main_node.cpp", "./GhostServer/GhostServer/networkmanager.cpp"], "libraries": ["-lsfml-network", "-lsfml-system", "-lpthread"], } ] }
print('''Type the phrases bellow to know our answer: 1. Hello 2. How are you? 3. Good bye''') ps = (70 * '-') + '\nYou might have to try again if the phrases will be inserted differently.' print(ps) while True: userInput = str(input('Please input the choosen phrase: ')).upper() if userInput == 'HELLO': print('Hello to you too!') elif userInput == 'HOW ARE YOU?': print('Fine, thanks for asking.') elif userInput == 'GOOD BYE': break else: print('Try again.')
reference hitbtc_markets = hitbtc.load_markets() print(hitbtc.id, hitbtc_markets) print(bitmex.id, bitmex.load_markets()) print(huobipro.id, huobipro.load_markets()) print(hitbtc.fetch_order_book(hitbtc.symbols[0])) print(bitmex.fetch_ticker('BTC/USD')) print(huobipro.fetch_trades('LTC/USDT')) print(exmo.fetch_balance()) # sell one ฿ for market price and receive $ right now print(exmo.id, exmo.create_market_sell_order('BTC/USD', 1)) # limit buy BTC/EUR, you pay €2500 and receive ฿1 when the order is closed print(exmo.id, exmo.create_limit_buy_order('BTC/EUR', 1, 2500.00))
#!/usr/bin/env python # encoding: utf-8 """ sort_list_to_binary_tree.py Created by Shengwei on 2014-07-03. """ # https://oj.leetcode.com/problems/convert-sorted-list-to-binary-search-tree/ # tags: easy, tree, linked-list, sorted, convert, D&C """ Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. """ # Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None # # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # @param head, a list node # @return a tree node def sortedListToBST(self, head): cur, total = head, 0 while cur: total += 1 cur = cur.next def convert_list(h, length): if length == 0: return None cur = h for _ in xrange(length / 2): cur = cur.next # cur points at the very middle or # the right one of middle two root = TreeNode(cur.val) root.left = convert_list(h, length / 2) root.right = convert_list(cur.next, length - length / 2 - 1) return root return convert_list(head, total)
""" Tests for the PandaSpark module, you probably don't want to import this directly. """
class Member: def __init__( self, name: str, linkedin_url: str = None, github_url: str = None ) -> None: self.name = name self.linkedin_url = linkedin_url self.github_url = github_url def sidebar_markdown(self): markdown = f'<b style="display: inline-block; vertical-align: middle; height: 100%">{self.name}</b>' if self.linkedin_url is not None: markdown += f' <a href={self.linkedin_url} target="_blank"><img src="https://dst-studio-template.s3.eu-west-3.amazonaws.com/linkedin-logo-black.png" alt="linkedin" width="25" style="vertical-align: middle; margin-left: 5px"/></a> ' if self.github_url is not None: markdown += f' <a href={self.github_url} target="_blank"><img src="https://dst-studio-template.s3.eu-west-3.amazonaws.com/github-logo.png" alt="github" width="20" style="vertical-align: middle; margin-left: 5px"/></a> ' return markdown