content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
valores = input().split() valores = list(map(int,valores)) h1, h2 = valores if(h1 == h2): print('O JOGO DUROU %d HORA(S)' %24) else: if(h2 < h1): print('O JOGO DUROU %d HORA(S)' %((24 - h1) + h2)) else: print('O JOGO DUROU %d HORA(S)' %(h2 - h1))
valores = input().split() valores = list(map(int, valores)) (h1, h2) = valores if h1 == h2: print('O JOGO DUROU %d HORA(S)' % 24) elif h2 < h1: print('O JOGO DUROU %d HORA(S)' % (24 - h1 + h2)) else: print('O JOGO DUROU %d HORA(S)' % (h2 - h1))
def WriteOBJ(filename, vertrices, vts, vns, facesV, facesVt, facesVn): f=file(filename,"w+") for vertex in vertrices: f.write("v ") for i in range(len(vertex)): f.write(str(vertex[i])) f.write(" ") f.write("\n") if len(vts) != 0: for vt in vts: f.write("vt ") for i in range(len(vt)): f.write(str(vt[i])) f.write(" ") f.write("\n") if len(vns) != 0: for vn in vns: f.write("vn ") for i in range(len(vn)): f.write(str(vn[i])) f.write(" ") f.write("\n") if len(vts) != 0 and len(vns) != 0: for (faceV, faceVt, faceVn) in zip(facesV, facesVt, facesVn): f.write("f ") for i in range(len(faceV)): f.write(str(faceV[i])) f.write("/") f.write(str(faceVt[i])) f.write("/") f.write(str(faceVn[i])) f.write(" ") f.write("\n") if len(vts) != 0 and len(vns) == 0: for (faceV, faceVt) in zip(facesV, facesVt): f.write("f ") for i in range(len(faceV)): f.write(str(faceV[i])) f.write("/") f.write(str(faceVt[i])) f.write(" ") f.write("\n") if len(vts) == 0 and len(vns) == 0: for faceV in facesV: f.write("f ") for i in range(len(faceV)): f.write(str(faceV[i])) f.write(" ") f.write("\n") f.close
def write_obj(filename, vertrices, vts, vns, facesV, facesVt, facesVn): f = file(filename, 'w+') for vertex in vertrices: f.write('v ') for i in range(len(vertex)): f.write(str(vertex[i])) f.write(' ') f.write('\n') if len(vts) != 0: for vt in vts: f.write('vt ') for i in range(len(vt)): f.write(str(vt[i])) f.write(' ') f.write('\n') if len(vns) != 0: for vn in vns: f.write('vn ') for i in range(len(vn)): f.write(str(vn[i])) f.write(' ') f.write('\n') if len(vts) != 0 and len(vns) != 0: for (face_v, face_vt, face_vn) in zip(facesV, facesVt, facesVn): f.write('f ') for i in range(len(faceV)): f.write(str(faceV[i])) f.write('/') f.write(str(faceVt[i])) f.write('/') f.write(str(faceVn[i])) f.write(' ') f.write('\n') if len(vts) != 0 and len(vns) == 0: for (face_v, face_vt) in zip(facesV, facesVt): f.write('f ') for i in range(len(faceV)): f.write(str(faceV[i])) f.write('/') f.write(str(faceVt[i])) f.write(' ') f.write('\n') if len(vts) == 0 and len(vns) == 0: for face_v in facesV: f.write('f ') for i in range(len(faceV)): f.write(str(faceV[i])) f.write(' ') f.write('\n') f.close
num1=10 num2=20 num3=30 num4=40 num5=50 num6=60 nihaoma=weijialan
num1 = 10 num2 = 20 num3 = 30 num4 = 40 num5 = 50 num6 = 60 nihaoma = weijialan
while True: try: chars = input() # nums = int(chars) level0 = ['zero'] level1 = ['','one','two','three','four','five','six', 'seven',' eight','nine', 'ten'] level1_1= ['','eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixten', 'seventeen', 'eighteen', 'nineteen'] level2 = ['','','twenty','thirty', 'forty', 'fifty','sixty',' seventy', 'eighty', 'ninety'] high = ['','thousand','million','billion'] levelAnd = ['and'] def threeNumTran(num3): if len(num3) == 0: return '' out = [] length = len(num3) one = int(num3[-1]) two = int(num3[-2]) if length >1 else 0 three = int(num3[-3]) if length >2 else 0 if two == 1: out.append(level1_1[one]) else: out.extend([level2[two] ,level1[one]]) if three != 0: out = [level1[three] , 'hundred' , 'and'] + out # print(out) return ' '.join([x for x in out if len(x)!=0]) # def high2Val(numThousand): # n = int(num123 # Thousand // 3) # left = numThousand % 3 # return [high[left]] + ['billion' for _ in range(n)] def pos2Unit(pos): # assert pos % 3 == 0 numThousand = int( (pos-1) // 3) n = int(numThousand // 3) left = numThousand % 3 r = [high[left]] + ['billion' for _ in range(n)] r = [x for x in r if len(x)!=0] return ' '.join(r) def pos2Unit_dfs(pos): if pos < 3: if pos == 0: return [] if pos == 1: return ['thousand'] if pos == 2: return ['million'] return pos2Unit_dfs(pos-3) + ['billion'] length = len(chars) parts = [] units = [] for i in range(length, -1,-3): ed = i st = i-3 if i-3>0 else 0 num3 = chars[st:ed] if len(num3) != 0: part = threeNumTran(num3) pos = length - st unit = pos2Unit(pos) parts.append(part) units.append(unit) res = [] for k,v in zip(parts, units): # print(k,v) # if len(k)!=0: # r = [k,v] res.append(' '.join([k,v])) output = ' '.join(reversed(res)) print(output) except : break
while True: try: chars = input() level0 = ['zero'] level1 = ['', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', ' eight', 'nine', 'ten'] level1_1 = ['', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixten', 'seventeen', 'eighteen', 'nineteen'] level2 = ['', '', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', ' seventy', 'eighty', 'ninety'] high = ['', 'thousand', 'million', 'billion'] level_and = ['and'] def three_num_tran(num3): if len(num3) == 0: return '' out = [] length = len(num3) one = int(num3[-1]) two = int(num3[-2]) if length > 1 else 0 three = int(num3[-3]) if length > 2 else 0 if two == 1: out.append(level1_1[one]) else: out.extend([level2[two], level1[one]]) if three != 0: out = [level1[three], 'hundred', 'and'] + out return ' '.join([x for x in out if len(x) != 0]) def pos2_unit(pos): num_thousand = int((pos - 1) // 3) n = int(numThousand // 3) left = numThousand % 3 r = [high[left]] + ['billion' for _ in range(n)] r = [x for x in r if len(x) != 0] return ' '.join(r) def pos2_unit_dfs(pos): if pos < 3: if pos == 0: return [] if pos == 1: return ['thousand'] if pos == 2: return ['million'] return pos2_unit_dfs(pos - 3) + ['billion'] length = len(chars) parts = [] units = [] for i in range(length, -1, -3): ed = i st = i - 3 if i - 3 > 0 else 0 num3 = chars[st:ed] if len(num3) != 0: part = three_num_tran(num3) pos = length - st unit = pos2_unit(pos) parts.append(part) units.append(unit) res = [] for (k, v) in zip(parts, units): res.append(' '.join([k, v])) output = ' '.join(reversed(res)) print(output) except: break
items = [2, 25, 9] divisor = 12 for item in items: if item%divisor == 0: found = item break else: # nobreak items.append(divisor) found = divisor print("{items} contains {found} which is a multiple of {divisor}" .format(**locals()))
items = [2, 25, 9] divisor = 12 for item in items: if item % divisor == 0: found = item break else: items.append(divisor) found = divisor print('{items} contains {found} which is a multiple of {divisor}'.format(**locals()))
class Solution: def hIndex(self, citations): n = len(citations) at_least = [0] * (n + 2) for c in citations: at_least[min(c, n + 1)] += 1 for i in xrange(n, -1, -1): at_least[i] += at_least[i + 1] for i in xrange(n, -1, -1): if at_least[i] >= i: return i
class Solution: def h_index(self, citations): n = len(citations) at_least = [0] * (n + 2) for c in citations: at_least[min(c, n + 1)] += 1 for i in xrange(n, -1, -1): at_least[i] += at_least[i + 1] for i in xrange(n, -1, -1): if at_least[i] >= i: return i
class ColumnRef: table = '' column = '' cascade_row = None def __init__(self, table, column, cascade_row=True): # cascade_row=True means that row in table should be removed # if value in column that owns reference is not found. # i.e, reference from stop_times.stop_id to stops.stop_id has cascade_row=True, # since stops should be pruned if not used in trips, and same for the reverse. But a # reference from stops.stop_id to stops.parent_station has cascade_row=False self.table = table self.column = column self.cascade_row = cascade_row
class Columnref: table = '' column = '' cascade_row = None def __init__(self, table, column, cascade_row=True): self.table = table self.column = column self.cascade_row = cascade_row
""" Author: Cameron Tee A class keeping track of the game stats. Only one life in Flappy Bird. This class controls the game state (whether playing or not). """ class GameStats(): def __init__(self, settings): """ Initialise the gamestats object. """ self.settings = settings self.reset_stats() #Begin the game in an inactive state self.game_active = False #Hiscore should never be reset self.hiscore = 0 def reset_stats(self): """ Score and the single life are reset between attempts """ self.lives_left = self.settings.lives self.score = 0
""" Author: Cameron Tee A class keeping track of the game stats. Only one life in Flappy Bird. This class controls the game state (whether playing or not). """ class Gamestats: def __init__(self, settings): """ Initialise the gamestats object. """ self.settings = settings self.reset_stats() self.game_active = False self.hiscore = 0 def reset_stats(self): """ Score and the single life are reset between attempts """ self.lives_left = self.settings.lives self.score = 0
''' URL: https://leetcode.com/problems/move-zeroes/ Difficulty: Easy Title: Move Zeroes ''' ################### Code ################### class Solution: def moveZeroes(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ zeroCount = 0 i = 0 while i < len(nums): if nums[i] == 0: nums.pop(i) zeroCount += 1 else: i += 1 nums.extend([0] * zeroCount)
""" URL: https://leetcode.com/problems/move-zeroes/ Difficulty: Easy Title: Move Zeroes """ class Solution: def move_zeroes(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ zero_count = 0 i = 0 while i < len(nums): if nums[i] == 0: nums.pop(i) zero_count += 1 else: i += 1 nums.extend([0] * zeroCount)
numbers = [1,2,3,4,5,6,7,11] res = 0 for num in numbers: res = res + num print("with sum: ",sum(numbers)) print("without sum: ",res)
numbers = [1, 2, 3, 4, 5, 6, 7, 11] res = 0 for num in numbers: res = res + num print('with sum: ', sum(numbers)) print('without sum: ', res)
def remove_duplicates(S: str) -> str: r = S[0] for i in range(1, len(S)): if len(r) == 0: r += S[i] else: if r[-1] == S[i]: if len(r) == 1: r = '' else: r = r[:-1] else: r += S[i] return r
def remove_duplicates(S: str) -> str: r = S[0] for i in range(1, len(S)): if len(r) == 0: r += S[i] elif r[-1] == S[i]: if len(r) == 1: r = '' else: r = r[:-1] else: r += S[i] return r
f1, f2 = map(float, input().split()) flutuacao = 1.0 * (1.0 + f1/100) * (1 + f2/100) print("%.6f" % ((flutuacao - 1.0)*100))
(f1, f2) = map(float, input().split()) flutuacao = 1.0 * (1.0 + f1 / 100) * (1 + f2 / 100) print('%.6f' % ((flutuacao - 1.0) * 100))
class Primes: def __init__(self, first, last=None): self.curr = None if last is None: self.first = 2 self.last = first else: self.first = first self.last = last def __iter__(self): return self def __next__(self): if self.curr is None: self.curr = 2 return self.curr while self.curr < self.last: self.curr += 1 if Primes.__prime(self.curr): return self.curr raise StopIteration() def __prime(n): for d in range(2, n): if n % d == 0: return False return True for p in Primes(100): print(p)
class Primes: def __init__(self, first, last=None): self.curr = None if last is None: self.first = 2 self.last = first else: self.first = first self.last = last def __iter__(self): return self def __next__(self): if self.curr is None: self.curr = 2 return self.curr while self.curr < self.last: self.curr += 1 if Primes.__prime(self.curr): return self.curr raise stop_iteration() def __prime(n): for d in range(2, n): if n % d == 0: return False return True for p in primes(100): print(p)
a, b = map(int, input().split()) while a != 0 and b != 0: if a > 0 and b > 0: print("primeiro") elif a < 0 < b: print("segundo") elif a < 0 and b < 0: print("terceiro") elif a > 0 > b: print("quarto") a, b = map(int, input().split())
(a, b) = map(int, input().split()) while a != 0 and b != 0: if a > 0 and b > 0: print('primeiro') elif a < 0 < b: print('segundo') elif a < 0 and b < 0: print('terceiro') elif a > 0 > b: print('quarto') (a, b) = map(int, input().split())
# https://github.com/michal037 class Singleton: def __new__(cls, *_, **__): self = object.__new__(cls) cls.__new__ = lambda *a, **b: self return self def singleton(self): self.__class__.__new__ = lambda *c, **d: self ### EXAMPLE 1 ### EXAMPLE 1 ### EXAMPLE 1 ### EXAMPLE 1 ### EXAMPLE 1 ########## class MyClass(Singleton): def __init__(self, a, *args, **kwargs): self.val = a print(f'a = {a}') for arg in args: print(f'next arg = {arg}') for key, value in kwargs.items(): print(f'{key} = {value}') print() a = MyClass(1, 2, 3, hi='hello', it='works') b = MyClass(4, 5, 6, cc='hello', dd='works') # Proof that it's the same object. print(f'{{a.val, b.val}} = {{{a.val}, {b.val}}}') # {4, 4} print(f'(a is b) = {a is b}') # True print() ### EXAMPLE 2 ### EXAMPLE 2 ### EXAMPLE 2 ### EXAMPLE 2 ### EXAMPLE 2 ########## class Test(Singleton): # Assuming that we are overriding the __new__ magic method, # we have to manually trigger .singleton() method. def __new__(cls): self = object.__new__(cls) self.value = 'hi' return self t1 = Test() t2 = Test() print(f'(t1 is t2) = {t1 is t2}') # False t2.singleton() # From now, the constructor always returns reference to the same object. t3 = Test() print(f'(t2 is t3) = {t2 is t3}') # True
class Singleton: def __new__(cls, *_, **__): self = object.__new__(cls) cls.__new__ = lambda *a, **b: self return self def singleton(self): self.__class__.__new__ = lambda *c, **d: self class Myclass(Singleton): def __init__(self, a, *args, **kwargs): self.val = a print(f'a = {a}') for arg in args: print(f'next arg = {arg}') for (key, value) in kwargs.items(): print(f'{key} = {value}') print() a = my_class(1, 2, 3, hi='hello', it='works') b = my_class(4, 5, 6, cc='hello', dd='works') print(f'{{a.val, b.val}} = {{{a.val}, {b.val}}}') print(f'(a is b) = {a is b}') print() class Test(Singleton): def __new__(cls): self = object.__new__(cls) self.value = 'hi' return self t1 = test() t2 = test() print(f'(t1 is t2) = {t1 is t2}') t2.singleton() t3 = test() print(f'(t2 is t3) = {t2 is t3}')
""" Write a function, connected_components_count, that takes in the adjacency list of an undirected graph. The function should return the number of connected components within the graph. depth first n = number of nodes e = number edges Time: O(e) Space: O(n) """ def count(graph): visited = set() count = 0 for node in graph: if explore(graph, node, visited) == True: count += 1 return count def explore(graph, current, visited): if current in visited: return False visited.add(current) for neighbor in graph[current]: explore(graph, neighbor, visited) return True
""" Write a function, connected_components_count, that takes in the adjacency list of an undirected graph. The function should return the number of connected components within the graph. depth first n = number of nodes e = number edges Time: O(e) Space: O(n) """ def count(graph): visited = set() count = 0 for node in graph: if explore(graph, node, visited) == True: count += 1 return count def explore(graph, current, visited): if current in visited: return False visited.add(current) for neighbor in graph[current]: explore(graph, neighbor, visited) return True
class TriggerPool: def __init__(self): self.triggers = [] # Trigger list self.results = [] # Result list def add(self, trigger): """add one trigger to the pool""" self.triggers.append(trigger) def test(self, model, data): """test untested triggers""" untested_triggers = range(len(self.results), len(self.triggers)) for i in untested_triggers: self.results.append(model.test(data, 0.1, self.triggers[i])) def expand(self, num=1): """add new triggers based on self-expansion rules""" scores = [result.accuracy() for result in self.results] # TODO: add density punishment best_trigger = self.triggers[scores.index(max(scores))] def spawn(trigger): return trigger.duplicate().add_noise(type_="Gaussian",args={"std":0.1}) for i in range(num): self.add(spawn(best_trigger)) def success_triggers(self, threshold=90): """threshold 0~100. return a list of triggers""" return [self.triggers[i] for i in range(len(self.results)) if self.results[i].accuracy() >= threshold]
class Triggerpool: def __init__(self): self.triggers = [] self.results = [] def add(self, trigger): """add one trigger to the pool""" self.triggers.append(trigger) def test(self, model, data): """test untested triggers""" untested_triggers = range(len(self.results), len(self.triggers)) for i in untested_triggers: self.results.append(model.test(data, 0.1, self.triggers[i])) def expand(self, num=1): """add new triggers based on self-expansion rules""" scores = [result.accuracy() for result in self.results] best_trigger = self.triggers[scores.index(max(scores))] def spawn(trigger): return trigger.duplicate().add_noise(type_='Gaussian', args={'std': 0.1}) for i in range(num): self.add(spawn(best_trigger)) def success_triggers(self, threshold=90): """threshold 0~100. return a list of triggers""" return [self.triggers[i] for i in range(len(self.results)) if self.results[i].accuracy() >= threshold]
def climbStairs(n: int) -> int: stairs = [1, 1] for i in range(2, n + 1): stairs.append(stairs[-1] + stairs[-2]) return stairs[n]
def climb_stairs(n: int) -> int: stairs = [1, 1] for i in range(2, n + 1): stairs.append(stairs[-1] + stairs[-2]) return stairs[n]
text=input('Enter and check if your input is a palindrome or not: ') ltext=text.lower() rtext="".join((reversed(ltext))) if rtext==ltext: print('Your input is a palindrome.') else: print('Your input is not a palindrome.')
text = input('Enter and check if your input is a palindrome or not: ') ltext = text.lower() rtext = ''.join(reversed(ltext)) if rtext == ltext: print('Your input is a palindrome.') else: print('Your input is not a palindrome.')
""" Running Successfully import unittest import math from PIL import Image from SyntheticDataset2.ImageCreator.specified_target_with_background import SpecifiedTargetWithBackground class SpecifiedTargetWithBackgroundTestCase(unittest.TestCase): def setUp(self): self.path_to_background = "tests/images/competition_grass_1.JPG" self.test_image1 = SpecifiedTargetWithBackground("circle", "?", "A", (255, 255, 255, 255), (255, 0, 0, 255), 0).create_specified_target_with_background() self.test_image2 = SpecifiedTargetWithBackground("semicircle", "E", "E", (0, 255, 0, 255), (0, 0, 255, 255), 45).create_specified_target_with_background() self.test_image3 = SpecifiedTargetWithBackground("cross", "D", "I", (255, 255, 0, 255), (255, 0, 255, 255), 90).create_specified_target_with_background() self.test_image4 = SpecifiedTargetWithBackground("heptagon", "S", "O", (0, 255, 255, 255), (0, 0, 0, 255), 135).create_specified_target_with_background() self.test_image5 = SpecifiedTargetWithBackground("star", "N", "U", (66, 66, 66, 255), (233, 233, 233, 255), 180).create_specified_target_with_background() ''' Settings: PPSI = 10 SINGLE_TARGET_SIZE_IN_INCHES = 24 SINGLE_TARGET_PROPORTIONALITY = 2.5 PIXELIZATION_LEVEL = 0 NOISE_LEVEL = 0 ''' def test_create_specified_target_with_specified_background(self): self.assertTrue(abs(max(self.test_image1.width, self.test_image1.height) - 260) < 3) self.assertTrue(self.test_image1.load()[self.test_image1.width/2, self.test_image1.height/2] == (255, 255, 255)) self.assertTrue(abs(max(self.test_image2.width, self.test_image2.height) - 260) < 3) self.assertTrue(self.test_image2.load()[self.test_image2.width/2, self.test_image2.height/2] == (0, 255, 0)) self.assertTrue(abs(max(self.test_image2.width, self.test_image2.height) - 260) < 3) self.assertTrue(self.test_image3.load()[self.test_image3.width/2, self.test_image3.height/2] == (255, 0, 255)) self.assertTrue(abs(max(self.test_image2.width, self.test_image2.height) - 260) < 3) self.assertTrue(self.test_image4.load()[self.test_image4.width/2, self.test_image4.height/2] == (0, 255, 255)) self.assertTrue(abs(max(self.test_image2.width, self.test_image2.height) - 260) < 3) self.assertTrue(self.test_image5.load()[self.test_image5.width/2, self.test_image5.height/2] == (66, 66, 66)) """
""" Running Successfully import unittest import math from PIL import Image from SyntheticDataset2.ImageCreator.specified_target_with_background import SpecifiedTargetWithBackground class SpecifiedTargetWithBackgroundTestCase(unittest.TestCase): def setUp(self): self.path_to_background = "tests/images/competition_grass_1.JPG" self.test_image1 = SpecifiedTargetWithBackground("circle", "?", "A", (255, 255, 255, 255), (255, 0, 0, 255), 0).create_specified_target_with_background() self.test_image2 = SpecifiedTargetWithBackground("semicircle", "E", "E", (0, 255, 0, 255), (0, 0, 255, 255), 45).create_specified_target_with_background() self.test_image3 = SpecifiedTargetWithBackground("cross", "D", "I", (255, 255, 0, 255), (255, 0, 255, 255), 90).create_specified_target_with_background() self.test_image4 = SpecifiedTargetWithBackground("heptagon", "S", "O", (0, 255, 255, 255), (0, 0, 0, 255), 135).create_specified_target_with_background() self.test_image5 = SpecifiedTargetWithBackground("star", "N", "U", (66, 66, 66, 255), (233, 233, 233, 255), 180).create_specified_target_with_background() ''' Settings: PPSI = 10 SINGLE_TARGET_SIZE_IN_INCHES = 24 SINGLE_TARGET_PROPORTIONALITY = 2.5 PIXELIZATION_LEVEL = 0 NOISE_LEVEL = 0 ''' def test_create_specified_target_with_specified_background(self): self.assertTrue(abs(max(self.test_image1.width, self.test_image1.height) - 260) < 3) self.assertTrue(self.test_image1.load()[self.test_image1.width/2, self.test_image1.height/2] == (255, 255, 255)) self.assertTrue(abs(max(self.test_image2.width, self.test_image2.height) - 260) < 3) self.assertTrue(self.test_image2.load()[self.test_image2.width/2, self.test_image2.height/2] == (0, 255, 0)) self.assertTrue(abs(max(self.test_image2.width, self.test_image2.height) - 260) < 3) self.assertTrue(self.test_image3.load()[self.test_image3.width/2, self.test_image3.height/2] == (255, 0, 255)) self.assertTrue(abs(max(self.test_image2.width, self.test_image2.height) - 260) < 3) self.assertTrue(self.test_image4.load()[self.test_image4.width/2, self.test_image4.height/2] == (0, 255, 255)) self.assertTrue(abs(max(self.test_image2.width, self.test_image2.height) - 260) < 3) self.assertTrue(self.test_image5.load()[self.test_image5.width/2, self.test_image5.height/2] == (66, 66, 66)) """
def kmp(s): p = [-1] k = -1 for c in s: while k >= 0 and s[k] != c: k = p[k] k += 1 p.append(k) return p def period(s): k = len(s) - kmp(s)[-1] if len(s) % k == 0: return k return len(s) s = input() m = int(input()) p = period(s) print(m // p % (10**9 + 7))
def kmp(s): p = [-1] k = -1 for c in s: while k >= 0 and s[k] != c: k = p[k] k += 1 p.append(k) return p def period(s): k = len(s) - kmp(s)[-1] if len(s) % k == 0: return k return len(s) s = input() m = int(input()) p = period(s) print(m // p % (10 ** 9 + 7))
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def split(self, head): slow = head fast = head slow_pre = head while fast and fast.next: slow_pre = slow slow, fast = slow.next, fast.next.next slow_pre.next = None return head, slow def merge(self, p1, p2): if not p2: return p1 if not p1: return p2 head = ListNode() p = head while p1 and p2: if p1.val < p2.val: p.next = ListNode(p1.val) p = p.next p1 = p1.next else: p.next = ListNode(p2.val) p = p.next p2 = p2.next if p1: p.next = p1 elif p2: p.next = p2 return head.next def mergeSort(self, head): if not head or not head.next: return head p1, p2 = self.split(head) p1 = self.mergeSort(p1) p2 = self.mergeSort(p2) head = self.merge(p1, p2) return head def sortList(self, head: ListNode) -> ListNode: return self.mergeSort(head)
class Listnode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def split(self, head): slow = head fast = head slow_pre = head while fast and fast.next: slow_pre = slow (slow, fast) = (slow.next, fast.next.next) slow_pre.next = None return (head, slow) def merge(self, p1, p2): if not p2: return p1 if not p1: return p2 head = list_node() p = head while p1 and p2: if p1.val < p2.val: p.next = list_node(p1.val) p = p.next p1 = p1.next else: p.next = list_node(p2.val) p = p.next p2 = p2.next if p1: p.next = p1 elif p2: p.next = p2 return head.next def merge_sort(self, head): if not head or not head.next: return head (p1, p2) = self.split(head) p1 = self.mergeSort(p1) p2 = self.mergeSort(p2) head = self.merge(p1, p2) return head def sort_list(self, head: ListNode) -> ListNode: return self.mergeSort(head)
""" File: circulararray.py Author: Brian Atwell Date: August 21, 2018 Descrioption: This a python implementation of a circular array using a list. This implementation could be used as a queue or an array. Copyright (c) 2018, Brian Atwell All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. All advertising materials mentioning features or use of this software must display the following acknowledgement: This product includes software developed by the Brian Atwell. 4. Neither Brian Atwell nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY Brian Atwell ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Brian Atwell BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ class CircularArray: def __init__(self, size): self.array = [] self.size = size self.startPos=0 self.count=0 def __getitem__(self, key): if key >= self.size: return None pos=(self.startPos+key)%self.size return self.array[pos] def __setitem__(self, idx, value): if idx > self.size: return if idx > (self.count+1) or self.count >= self.size: return if idx == (self.count+1): count+=1 pos=(self.startPos+idx)%self.size self.array[pos] = value def __len__(self): return self.count def append(self, obj): if (self.count) >= self.size: return self.count+=1 if len(self.array) < self.count or len(self.array) < self.size: self.array.append(obj) else: pos=(self.startPos+self.count-1)%self.size self.array[pos]=obj def clear(self): self.startPos=0 self.endPos=0 #def copy(self): def generator(self): idx = 0 pos=self.startPos while idx < self.count: yield self.array[pos] pos=(pos+1)%self.size idx+=1 #def extend(self): def index(self, value): pos = 0 for obj in self.generator(): if obj == value: return pos pos+=1 def insert(self, idx, obj): curObj=obj nextObj=None pos=(self.startPos+idx)%self.size while idx <= self.count: pos=(pos+1)%self.size nextObj=self.array[pos] self.arry[pos]=curObj curObj = nextObj idx+=1 def popFirst(self): if self.count == 0: return None retObj = self.array[self.startPos] self.startPos = (self.startPos+1) % self.size self.count -= 1 return retObj def pop(self): if self.count == 0: return None pos = (self.startPos+self.count) % self.size retObj = self.array[pos] self.count-=1 return retObj def size(self): return self.size def toList(self): retList = [] for obj in self.generator(): retList.append(obj) return retList
""" File: circulararray.py Author: Brian Atwell Date: August 21, 2018 Descrioption: This a python implementation of a circular array using a list. This implementation could be used as a queue or an array. Copyright (c) 2018, Brian Atwell All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. All advertising materials mentioning features or use of this software must display the following acknowledgement: This product includes software developed by the Brian Atwell. 4. Neither Brian Atwell nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY Brian Atwell ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Brian Atwell BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ class Circulararray: def __init__(self, size): self.array = [] self.size = size self.startPos = 0 self.count = 0 def __getitem__(self, key): if key >= self.size: return None pos = (self.startPos + key) % self.size return self.array[pos] def __setitem__(self, idx, value): if idx > self.size: return if idx > self.count + 1 or self.count >= self.size: return if idx == self.count + 1: count += 1 pos = (self.startPos + idx) % self.size self.array[pos] = value def __len__(self): return self.count def append(self, obj): if self.count >= self.size: return self.count += 1 if len(self.array) < self.count or len(self.array) < self.size: self.array.append(obj) else: pos = (self.startPos + self.count - 1) % self.size self.array[pos] = obj def clear(self): self.startPos = 0 self.endPos = 0 def generator(self): idx = 0 pos = self.startPos while idx < self.count: yield self.array[pos] pos = (pos + 1) % self.size idx += 1 def index(self, value): pos = 0 for obj in self.generator(): if obj == value: return pos pos += 1 def insert(self, idx, obj): cur_obj = obj next_obj = None pos = (self.startPos + idx) % self.size while idx <= self.count: pos = (pos + 1) % self.size next_obj = self.array[pos] self.arry[pos] = curObj cur_obj = nextObj idx += 1 def pop_first(self): if self.count == 0: return None ret_obj = self.array[self.startPos] self.startPos = (self.startPos + 1) % self.size self.count -= 1 return retObj def pop(self): if self.count == 0: return None pos = (self.startPos + self.count) % self.size ret_obj = self.array[pos] self.count -= 1 return retObj def size(self): return self.size def to_list(self): ret_list = [] for obj in self.generator(): retList.append(obj) return retList
def solve(arr, duration): if len(arr) == 0: return 0 result = 0 start = arr[0] for i in range(1, len(arr)): if arr[i] - arr[i - 1] > duration: result += arr[i - 1] + duration - start start = arr[i] result += arr[-1] + duration - start return result A = [1, 2, 3, 4, 5, 6, 7, 8, 9] B = 5 print(solve(A, B))
def solve(arr, duration): if len(arr) == 0: return 0 result = 0 start = arr[0] for i in range(1, len(arr)): if arr[i] - arr[i - 1] > duration: result += arr[i - 1] + duration - start start = arr[i] result += arr[-1] + duration - start return result a = [1, 2, 3, 4, 5, 6, 7, 8, 9] b = 5 print(solve(A, B))
class Solution: def setZeroes(self, matrix): rows, cols = set(), set() for i, r in enumerate(matrix): for j, c in enumerate(r): if c == 0: rows.add(i) cols.add(j) l = len(matrix[0]) for r in rows: matrix[r] = [0] * l for c in cols: for r in matrix: r[c] = 0
class Solution: def set_zeroes(self, matrix): (rows, cols) = (set(), set()) for (i, r) in enumerate(matrix): for (j, c) in enumerate(r): if c == 0: rows.add(i) cols.add(j) l = len(matrix[0]) for r in rows: matrix[r] = [0] * l for c in cols: for r in matrix: r[c] = 0
""" Base Controller for interacting with the Scene """ class BaseController: def __init__(self): super(BaseController, self).__init__() def start(self): raise NotImplementedError() def reset(self, scene_name=None): raise NotImplementedError() def step(self, action, raise_for_failure=False): raise NotImplementedError()
""" Base Controller for interacting with the Scene """ class Basecontroller: def __init__(self): super(BaseController, self).__init__() def start(self): raise not_implemented_error() def reset(self, scene_name=None): raise not_implemented_error() def step(self, action, raise_for_failure=False): raise not_implemented_error()
counter = 0 b = 106700 c = 123700 step = 17 for target in range(b, c + step, step): flag = False d = 2 while d != target: e = target // d if e < d: break if target % d == 0: flag = True #print("d: {0:d} e: {1:d} b: {2:d}".format(d, e, target)) break d += 1 if flag: counter += 1 else: print("Prime: {0:d}".format(target)) print("{0:d}".format(counter)) #905 is correct
counter = 0 b = 106700 c = 123700 step = 17 for target in range(b, c + step, step): flag = False d = 2 while d != target: e = target // d if e < d: break if target % d == 0: flag = True break d += 1 if flag: counter += 1 else: print('Prime: {0:d}'.format(target)) print('{0:d}'.format(counter))
class Person: def __init__(self, name, age): self.name = name self.age = age def sayHello(self): print("Hello my name is {} and I am {} years old".format(self.name, self.age)) worker = Person("Alina", 21) print(worker.age) print(worker.name) worker.sayHello()
class Person: def __init__(self, name, age): self.name = name self.age = age def say_hello(self): print('Hello my name is {} and I am {} years old'.format(self.name, self.age)) worker = person('Alina', 21) print(worker.age) print(worker.name) worker.sayHello()
def partition(a,l,r): #assert: Previous proof but partitions between l and r # It considers the first element as a pivot and moves all smaller element to left of it and greater elements to right x=a[l] n=len(a) i=l j=r while(i<j): if a[i]>=x and a[j]<=x: a[i],a[j]=a[j],a[i] i+=1 j-=1 elif a[i]<x: i+=1 else: j-=1 return(a,i) def kth(a,l,r,k): if (k>0 and k<= r-l+1): # Partition the array around last element and get position of the pivot element in partioned array (array,pos_i)=partition(a,l,r) # if position is same as k if (pos_i-l==k-1): return a[pos_i] # If position is more then k, apply recursion for left sub array if (pos_i-l>k-1): return kth(a,l,pos_i-1,k) else: #apply recursion for the right sub array return kth(a,pos_i+1,r,k-pos_i+l-1) else: return ": Seriously? Imagine asking for 7th biggest slice of pizza with 6 pieces" arr = [12, 3, 5, 7, 4, 19, 26] n = len(arr) k = 2; print(k,"th smallest element is",kth(arr, 0, n - 1, k)) #Time Complexity: #The time comlpexity depends upon the pivot chosen #If the pivot decreases size of array by 1 element (Worst case) the time complexity is O(n^2) #If the pivot decreases size of array by some fraction (Maybe n/2) (Best case) the time complexity is O(n) (=n/2+n/4+n/8+.... < n)
def partition(a, l, r): x = a[l] n = len(a) i = l j = r while i < j: if a[i] >= x and a[j] <= x: (a[i], a[j]) = (a[j], a[i]) i += 1 j -= 1 elif a[i] < x: i += 1 else: j -= 1 return (a, i) def kth(a, l, r, k): if k > 0 and k <= r - l + 1: (array, pos_i) = partition(a, l, r) if pos_i - l == k - 1: return a[pos_i] if pos_i - l > k - 1: return kth(a, l, pos_i - 1, k) else: return kth(a, pos_i + 1, r, k - pos_i + l - 1) else: return ': Seriously? Imagine asking for 7th biggest slice of pizza with 6 pieces' arr = [12, 3, 5, 7, 4, 19, 26] n = len(arr) k = 2 print(k, 'th smallest element is', kth(arr, 0, n - 1, k))
user_createaccount = []# Empty user_create account class User: def __init__(self,username,password,email): """ created insatances of the user class """ self.username = username self.email = email self.password = password User.user = {"username":self.username, "email":self.email, "password":self.password} def save_account(self): User.user_createaccount.append(self) def generate_password(): pass @classmethod def return_user(cls): return cls.user
user_createaccount = [] class User: def __init__(self, username, password, email): """ created insatances of the user class """ self.username = username self.email = email self.password = password User.user = {'username': self.username, 'email': self.email, 'password': self.password} def save_account(self): User.user_createaccount.append(self) def generate_password(): pass @classmethod def return_user(cls): return cls.user
''' Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the nodes in each of the two partitions. Example: Input: head = 1->4->3->2->5->2, x = 3 Output: 1->2->2->4->3->5 Runtime: 20 ms, faster than 99.90% of Python3 online submissions for Partition List. Memory Usage: 14.1 MB, less than 100.00% of Python3 online submissions for Partition List. ''' # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next def swap_node(x, y): tmp = x.next tmp1 = y.next.next x.next = y.next x = x.next x.next = tmp y.next = tmp1 return x, y class Solution: def partition(self, head: ListNode, x: int) -> ListNode: if head is None or head.next is None: return head first = ListNode(-1) first.next = head p = first while (p.next): if p.next.val >= x: in_pos = p break p = p.next if p.next is None: return first.next while (p and p.next): if p.next.val < x: in_pos, p = swap_node(in_pos, p) continue if p.next is None: return first.next # elif p.next.next is None: # prev = p p = p.next if p.val < x: tmp = in_pos.next in_pos.next = p in_pos = in_pos.next in_pos.next = tmp prev.next = None return first.next
""" Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the nodes in each of the two partitions. Example: Input: head = 1->4->3->2->5->2, x = 3 Output: 1->2->2->4->3->5 Runtime: 20 ms, faster than 99.90% of Python3 online submissions for Partition List. Memory Usage: 14.1 MB, less than 100.00% of Python3 online submissions for Partition List. """ def swap_node(x, y): tmp = x.next tmp1 = y.next.next x.next = y.next x = x.next x.next = tmp y.next = tmp1 return (x, y) class Solution: def partition(self, head: ListNode, x: int) -> ListNode: if head is None or head.next is None: return head first = list_node(-1) first.next = head p = first while p.next: if p.next.val >= x: in_pos = p break p = p.next if p.next is None: return first.next while p and p.next: if p.next.val < x: (in_pos, p) = swap_node(in_pos, p) continue if p.next is None: return first.next p = p.next if p.val < x: tmp = in_pos.next in_pos.next = p in_pos = in_pos.next in_pos.next = tmp prev.next = None return first.next
# coding=utf-8 # See main file for licence # pylint: disable=W0401,W0403 # # by Mazoea s.r.o. # """ Tesseract constants. """ size_of_int32 = 4 NUM_CP_BUCKETS = 24 CLASSES_PER_CP = 32 NUM_BITS_PER_CLASS = 2 BITS_PER_WERD = (8 * size_of_int32) BITS_PER_CP_VECTOR = (CLASSES_PER_CP * NUM_BITS_PER_CLASS) WERDS_PER_CP_VECTOR = (BITS_PER_CP_VECTOR / BITS_PER_WERD) CLASS_PRUNER_STRUCT_SIZE = NUM_CP_BUCKETS * \ NUM_CP_BUCKETS * NUM_CP_BUCKETS * WERDS_PER_CP_VECTOR PROTOS_PER_PROTO_SET = 64 NUM_PP_PARAMS = 3 WERDS_PER_PP_VECTOR = ( (PROTOS_PER_PROTO_SET + BITS_PER_WERD - 1) / BITS_PER_WERD) MAX_NUM_CONFIGS = 64 WERDS_PER_CONFIG_VEC = ((MAX_NUM_CONFIGS + BITS_PER_WERD - 1) / BITS_PER_WERD) NUM_PP_BUCKETS = 64 PROTO_PRUNER_SIZE = NUM_PP_PARAMS * NUM_PP_BUCKETS * WERDS_PER_PP_VECTOR # dawg FORWARD_EDGE = 0 BACKWARD_EDGE = 1 MARKER_FLAG = 1 DIRECTION_FLAG = 2 WERD_END_FLAG = 4 LETTER_START_BIT = 0 NUM_FLAG_BITS = 3 # PICO_FEATURE_LENGTH = 0.05 PROTO_PRUNER_SCALE = 4.0 INT_CHAR_NORM_RANGE = 256 PROTOS_PER_PP_WERD = BITS_PER_WERD PRUNER_X = 0 PRUNER_Y = 1
""" Tesseract constants. """ size_of_int32 = 4 num_cp_buckets = 24 classes_per_cp = 32 num_bits_per_class = 2 bits_per_werd = 8 * size_of_int32 bits_per_cp_vector = CLASSES_PER_CP * NUM_BITS_PER_CLASS werds_per_cp_vector = BITS_PER_CP_VECTOR / BITS_PER_WERD class_pruner_struct_size = NUM_CP_BUCKETS * NUM_CP_BUCKETS * NUM_CP_BUCKETS * WERDS_PER_CP_VECTOR protos_per_proto_set = 64 num_pp_params = 3 werds_per_pp_vector = (PROTOS_PER_PROTO_SET + BITS_PER_WERD - 1) / BITS_PER_WERD max_num_configs = 64 werds_per_config_vec = (MAX_NUM_CONFIGS + BITS_PER_WERD - 1) / BITS_PER_WERD num_pp_buckets = 64 proto_pruner_size = NUM_PP_PARAMS * NUM_PP_BUCKETS * WERDS_PER_PP_VECTOR forward_edge = 0 backward_edge = 1 marker_flag = 1 direction_flag = 2 werd_end_flag = 4 letter_start_bit = 0 num_flag_bits = 3 pico_feature_length = 0.05 proto_pruner_scale = 4.0 int_char_norm_range = 256 protos_per_pp_werd = BITS_PER_WERD pruner_x = 0 pruner_y = 1
# Copyright 2020 Rubrik, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. """ Collection of methods for live mount of a virtual machine. """ ERROR_MESSAGES = { 'INVALID_FIELD_TYPE': "'{}' is an invalid value for '{}'. Value must be in {}.", 'REQUIRED_ARGUMENT': '{} field is required.', 'REQUIRED_KEYS_IN_CONFIG': "Config field should contain datastoreId, hostId or clusterId and snapshotId.", 'INVALID_CONFIG': "'{}' is an invalid value for field config." } def create_vm_livemount(self, snapshot_fid: str, host_id: str = None, vm_name: str = None, disable_network: bool = None, remove_network_devices: bool = None, power_on: bool = None, keep_mac_addresses: bool = None, data_store_name: str = None, create_data_store_only: bool = None, vlan: int = None, should_recover_tags: bool = None): """ Perform a live mount of a virtual machine snapshot. Args: snapshot_fid: The Snapshot FID of the snapshot. host_id: The Host ID. vm_name: The VM Name. disable_network: Whether to disable network. remove_network_devices: Whether to remove network devices. power_on: Whether to power on. keep_mac_addresses: Whether to keep MAC address. data_store_name: Name of the data store. create_data_store_only: Whether to create data store. vlan: VLAN ID. should_recover_tags: Whether to recover tags. Returns: dict: Dictionary containing live mount information Raises: RequestException: If the query to Polaris returned an error """ try: snapshot_fid = self.validate_id(snapshot_fid, "snapshot_fid") query_name = "gps_vm_livemount" variables = { "snapshotFid": snapshot_fid, "hostID": host_id, "vmName": vm_name, "datastoreName": data_store_name } if disable_network: variables['disableNetwork'] = self.to_boolean(disable_network) if remove_network_devices: variables['removeNetworkDevices'] = self.to_boolean(remove_network_devices) if power_on: variables['powerOn'] = self.to_boolean(power_on) if keep_mac_addresses: variables['keepMacAddresses'] = self.to_boolean(keep_mac_addresses) if create_data_store_only: variables['createDatastoreOnly'] = self.to_boolean(create_data_store_only) if should_recover_tags: variables['shouldRecoverTags'] = self.to_boolean(should_recover_tags) if vlan: variables['vlan'] = int(vlan) response = self._query_raw(query_name=query_name, variables=variables) return response except Exception: raise def create_vm_snapshot(self, snapshot_id: str, sla_id: str = None): """ Create snapshot of a system. Args: snapshot_id: The Snapshot ID of the snapshot that needs to be created. sla_id: The SLA ID of the snapshot that needs to be created. Returns: dict: Dictionary containing snapshot information. Raises: RequestException: If the query to Polaris returned an error """ try: variables = {} snapshot_id = self.validate_id(snapshot_id, "snapshot_id") variables['snappableId'] = snapshot_id if sla_id: variables['slaID'] = sla_id.strip() return self._query_raw(query_name="gps_vm_snapshot_create", variables=variables) except Exception: raise def list_vsphere_hosts(self, first: int, after: str = None, filters: list = None, sort_by: enumerate = None, sort_order: enumerate = None): """ Retrieves a list of available Vsphere hosts. Args: after: The next page cursor to retrieve the next set of results. first : Number of results to retrieve in the response. filters: Filters the SLA result. Supported fields of class GlobalSlaQueryFilterInputField. sort_by: Sorts the result using HierarchySortByField. sort_order: Sorting orders ASC or DESC. Returns: dict: Dictionary containing list of Vsphere hosts. Raises: ValueError: If input is invalid RequestException: If the query to Polaris returned an error. """ try: variables = {} if not first: raise ValueError(ERROR_MESSAGES['REQUIRED_ARGUMENT'].format("first")) first = self.check_first_arg(first) variables['first'] = first if isinstance(filters, str): filters = [filters] if filters: variables['filter'] = filters if after: variables['after'] = after.strip() if sort_by: supported_sla_sort_by = self.get_enum_values(name="HierarchySortByField") if sort_by not in supported_sla_sort_by: raise ValueError(ERROR_MESSAGES['INVALID_FIELD_TYPE'].format(sort_by, 'sort_by', supported_sla_sort_by)) variables['sortBy'] = sort_by if sort_order: supported_sla_sort_order = self.get_enum_values(name="HierarchySortOrder") if sort_order not in supported_sla_sort_order: raise ValueError( ERROR_MESSAGES['INVALID_FIELD_TYPE'].format(sort_order, 'sort_order', supported_sla_sort_order)) variables['sortOrder'] = sort_order return self._query_raw(query_name="gps_vm_hosts", variables=variables) except Exception: raise def export_vm_snapshot(self, config: dict, id_: str): """ Export a snapshot of a virtual machine. Args: id_: The object ID. config: Configuration parameters for exporting snapshot. Returns: dict: Dictionary containing snapshot information. Raises: ValueError: If input is invalid RequestException: If the query to Polaris returned an error """ try: variables = {} id_ = self.validate_id(id_, "id_") variables['id'] = id_ if not config: raise ValueError(ERROR_MESSAGES['REQUIRED_ARGUMENT'].format("config")) if not isinstance(config, dict): raise ValueError(ERROR_MESSAGES['INVALID_CONFIG'].format(config)) data_store_id = config.get('datastoreId', '') host_id = config.get('hostId', '') cluster_id = config.get('clusterId', '') snapshot_id = config.get("requiredRecoveryParameters", {}).get("snapshotId", '') if not data_store_id or (not host_id and not cluster_id) or not snapshot_id: raise ValueError(ERROR_MESSAGES['REQUIRED_KEYS_IN_CONFIG']) variables['config'] = config return self._query_raw(query_name="gps_vm_export", variables=variables) except Exception: raise def list_vsphere_datastores(self, host_id: str, first: int = None, after: str = None, filters: list = None, sort_by: enumerate = None, sort_order: enumerate = None): """ Retrieves a list of datastores on a Vsphere host. Args: host_id: The Host ID. after: The next page cursor to retrieve the next set of results. first : Number of results to retrieve in the response. filters: Filters the SLA result. Supported fields of class GlobalSlaQueryFilterInputField. sort_by: Sorts the result using HierarchySortByField. sort_order: Sorting orders ASC or DESC. Returns: dict: Dictionary containing list of Vsphere datastores. Raises: ValueError: If input is invalid RequestException: If the query to Polaris returned an error. """ try: variables = {} host_id = self.validate_id(host_id, "host_id") variables['hostId'] = host_id first = self.check_first_arg(first) if first: variables['first'] = first if isinstance(filters, str): filters = [filters] if filters: variables['filter'] = filters if after: variables['after'] = after.strip() if sort_by: supported_sla_sort_by = self.get_enum_values(name="HierarchySortByField") if sort_by not in supported_sla_sort_by: raise ValueError(ERROR_MESSAGES['INVALID_FIELD_TYPE'].format(sort_by, 'sort_by', supported_sla_sort_by)) variables['sortBy'] = sort_by if sort_order: supported_sla_sort_order = self.get_enum_values(name="HierarchySortOrder") if sort_order not in supported_sla_sort_order: raise ValueError( ERROR_MESSAGES['INVALID_FIELD_TYPE'].format(sort_order, 'sort_order', supported_sla_sort_order)) variables['sortOrder'] = sort_order return self._query_raw(query_name="gps_vm_datastores", variables=variables) except Exception: raise def get_async_request_result(self, request_id: str, cluster_id: str): """ Retrieves the result of an asynchronous request. These requests can be triggered by calling functions such as export_vm_snapshot, create_vm_livemount, request_download_snapshot_files or create_vm_snapshot. Args: request_id: The ID of the asynchronous request. cluster_id: The ID of the cluster where the request was made. Returns: dict: Dictionary containing the result of the request. Raises: ValueError: If input is invalid RequestException: If the query to Polaris returned an error. """ try: query_name = "gps_async_request_result" variables = {} if not request_id: raise ValueError(ERROR_MESSAGES['REQUIRED_ARGUMENT'].format("request_id")) variables['id'] = request_id if not cluster_id: raise ValueError(ERROR_MESSAGES['REQUIRED_ARGUMENT'].format("cluster_id")) variables['clusterUuid'] = cluster_id return self._query_raw(query_name=query_name, variables=variables) except Exception: raise
""" Collection of methods for live mount of a virtual machine. """ error_messages = {'INVALID_FIELD_TYPE': "'{}' is an invalid value for '{}'. Value must be in {}.", 'REQUIRED_ARGUMENT': '{} field is required.', 'REQUIRED_KEYS_IN_CONFIG': 'Config field should contain datastoreId, hostId or clusterId and snapshotId.', 'INVALID_CONFIG': "'{}' is an invalid value for field config."} def create_vm_livemount(self, snapshot_fid: str, host_id: str=None, vm_name: str=None, disable_network: bool=None, remove_network_devices: bool=None, power_on: bool=None, keep_mac_addresses: bool=None, data_store_name: str=None, create_data_store_only: bool=None, vlan: int=None, should_recover_tags: bool=None): """ Perform a live mount of a virtual machine snapshot. Args: snapshot_fid: The Snapshot FID of the snapshot. host_id: The Host ID. vm_name: The VM Name. disable_network: Whether to disable network. remove_network_devices: Whether to remove network devices. power_on: Whether to power on. keep_mac_addresses: Whether to keep MAC address. data_store_name: Name of the data store. create_data_store_only: Whether to create data store. vlan: VLAN ID. should_recover_tags: Whether to recover tags. Returns: dict: Dictionary containing live mount information Raises: RequestException: If the query to Polaris returned an error """ try: snapshot_fid = self.validate_id(snapshot_fid, 'snapshot_fid') query_name = 'gps_vm_livemount' variables = {'snapshotFid': snapshot_fid, 'hostID': host_id, 'vmName': vm_name, 'datastoreName': data_store_name} if disable_network: variables['disableNetwork'] = self.to_boolean(disable_network) if remove_network_devices: variables['removeNetworkDevices'] = self.to_boolean(remove_network_devices) if power_on: variables['powerOn'] = self.to_boolean(power_on) if keep_mac_addresses: variables['keepMacAddresses'] = self.to_boolean(keep_mac_addresses) if create_data_store_only: variables['createDatastoreOnly'] = self.to_boolean(create_data_store_only) if should_recover_tags: variables['shouldRecoverTags'] = self.to_boolean(should_recover_tags) if vlan: variables['vlan'] = int(vlan) response = self._query_raw(query_name=query_name, variables=variables) return response except Exception: raise def create_vm_snapshot(self, snapshot_id: str, sla_id: str=None): """ Create snapshot of a system. Args: snapshot_id: The Snapshot ID of the snapshot that needs to be created. sla_id: The SLA ID of the snapshot that needs to be created. Returns: dict: Dictionary containing snapshot information. Raises: RequestException: If the query to Polaris returned an error """ try: variables = {} snapshot_id = self.validate_id(snapshot_id, 'snapshot_id') variables['snappableId'] = snapshot_id if sla_id: variables['slaID'] = sla_id.strip() return self._query_raw(query_name='gps_vm_snapshot_create', variables=variables) except Exception: raise def list_vsphere_hosts(self, first: int, after: str=None, filters: list=None, sort_by: enumerate=None, sort_order: enumerate=None): """ Retrieves a list of available Vsphere hosts. Args: after: The next page cursor to retrieve the next set of results. first : Number of results to retrieve in the response. filters: Filters the SLA result. Supported fields of class GlobalSlaQueryFilterInputField. sort_by: Sorts the result using HierarchySortByField. sort_order: Sorting orders ASC or DESC. Returns: dict: Dictionary containing list of Vsphere hosts. Raises: ValueError: If input is invalid RequestException: If the query to Polaris returned an error. """ try: variables = {} if not first: raise value_error(ERROR_MESSAGES['REQUIRED_ARGUMENT'].format('first')) first = self.check_first_arg(first) variables['first'] = first if isinstance(filters, str): filters = [filters] if filters: variables['filter'] = filters if after: variables['after'] = after.strip() if sort_by: supported_sla_sort_by = self.get_enum_values(name='HierarchySortByField') if sort_by not in supported_sla_sort_by: raise value_error(ERROR_MESSAGES['INVALID_FIELD_TYPE'].format(sort_by, 'sort_by', supported_sla_sort_by)) variables['sortBy'] = sort_by if sort_order: supported_sla_sort_order = self.get_enum_values(name='HierarchySortOrder') if sort_order not in supported_sla_sort_order: raise value_error(ERROR_MESSAGES['INVALID_FIELD_TYPE'].format(sort_order, 'sort_order', supported_sla_sort_order)) variables['sortOrder'] = sort_order return self._query_raw(query_name='gps_vm_hosts', variables=variables) except Exception: raise def export_vm_snapshot(self, config: dict, id_: str): """ Export a snapshot of a virtual machine. Args: id_: The object ID. config: Configuration parameters for exporting snapshot. Returns: dict: Dictionary containing snapshot information. Raises: ValueError: If input is invalid RequestException: If the query to Polaris returned an error """ try: variables = {} id_ = self.validate_id(id_, 'id_') variables['id'] = id_ if not config: raise value_error(ERROR_MESSAGES['REQUIRED_ARGUMENT'].format('config')) if not isinstance(config, dict): raise value_error(ERROR_MESSAGES['INVALID_CONFIG'].format(config)) data_store_id = config.get('datastoreId', '') host_id = config.get('hostId', '') cluster_id = config.get('clusterId', '') snapshot_id = config.get('requiredRecoveryParameters', {}).get('snapshotId', '') if not data_store_id or (not host_id and (not cluster_id)) or (not snapshot_id): raise value_error(ERROR_MESSAGES['REQUIRED_KEYS_IN_CONFIG']) variables['config'] = config return self._query_raw(query_name='gps_vm_export', variables=variables) except Exception: raise def list_vsphere_datastores(self, host_id: str, first: int=None, after: str=None, filters: list=None, sort_by: enumerate=None, sort_order: enumerate=None): """ Retrieves a list of datastores on a Vsphere host. Args: host_id: The Host ID. after: The next page cursor to retrieve the next set of results. first : Number of results to retrieve in the response. filters: Filters the SLA result. Supported fields of class GlobalSlaQueryFilterInputField. sort_by: Sorts the result using HierarchySortByField. sort_order: Sorting orders ASC or DESC. Returns: dict: Dictionary containing list of Vsphere datastores. Raises: ValueError: If input is invalid RequestException: If the query to Polaris returned an error. """ try: variables = {} host_id = self.validate_id(host_id, 'host_id') variables['hostId'] = host_id first = self.check_first_arg(first) if first: variables['first'] = first if isinstance(filters, str): filters = [filters] if filters: variables['filter'] = filters if after: variables['after'] = after.strip() if sort_by: supported_sla_sort_by = self.get_enum_values(name='HierarchySortByField') if sort_by not in supported_sla_sort_by: raise value_error(ERROR_MESSAGES['INVALID_FIELD_TYPE'].format(sort_by, 'sort_by', supported_sla_sort_by)) variables['sortBy'] = sort_by if sort_order: supported_sla_sort_order = self.get_enum_values(name='HierarchySortOrder') if sort_order not in supported_sla_sort_order: raise value_error(ERROR_MESSAGES['INVALID_FIELD_TYPE'].format(sort_order, 'sort_order', supported_sla_sort_order)) variables['sortOrder'] = sort_order return self._query_raw(query_name='gps_vm_datastores', variables=variables) except Exception: raise def get_async_request_result(self, request_id: str, cluster_id: str): """ Retrieves the result of an asynchronous request. These requests can be triggered by calling functions such as export_vm_snapshot, create_vm_livemount, request_download_snapshot_files or create_vm_snapshot. Args: request_id: The ID of the asynchronous request. cluster_id: The ID of the cluster where the request was made. Returns: dict: Dictionary containing the result of the request. Raises: ValueError: If input is invalid RequestException: If the query to Polaris returned an error. """ try: query_name = 'gps_async_request_result' variables = {} if not request_id: raise value_error(ERROR_MESSAGES['REQUIRED_ARGUMENT'].format('request_id')) variables['id'] = request_id if not cluster_id: raise value_error(ERROR_MESSAGES['REQUIRED_ARGUMENT'].format('cluster_id')) variables['clusterUuid'] = cluster_id return self._query_raw(query_name=query_name, variables=variables) except Exception: raise
def factorial(n): fact=1 for i in range(1,n+1): fact*=i print(fact) factorial(5)
def factorial(n): fact = 1 for i in range(1, n + 1): fact *= i print(fact) factorial(5)
print('''@#############################################################MMMMMMMMMMMMMMMMMMBBBBMMMMBB&AMBAHM###MMMMMMM# @hG&&AA&&A&G&&&&GG&AA&&&&&AAAAAA&&&G&&&GGhh&AAAG93XX39h93X225iiiS5SSSSSSSiSiSSisssssiisssi:.;s;iXX25Sii25SSA @hAAHAAHAHAAAAAAAAAAAAAAAAAAAAAAAHHHAAAG&&3Ssi5G&GG&&GG9333X2552222222255525rrSSS55SSSiSS5X;:Xri2SX252r ;A9A @GAHHHHHHAAAAAAAAA&AAAAAAAAAHHHAh25iiS29B@Hr sAX9GAAGh3333XX22222XXX5iS55Sii552225SS2X2iih&A: ,;X22r:;:ihA @GAAHHHHAAAAAGG&&&G&&&AA&AA&XSsii55Sirrrs&@#r s::::r53h9XX3X252252XX2SiiiiS55525SS5irr239GGAHX39222XA3,:hA @3GAAAAA&AAAA&GGGGhhhGGGGG2i2hAAhir;:. G@9 .;....:;rr53X25SS5552225rrisiSSiiiiiiir:Shh9999;iX223G&hAA9& @29&G933GAAAAA&Gh933393&MMM#@HXs:,:,, ,@@, r, ,;;;r52SiiSiiiiisrsiissssrsssSXh399X2222222X99hGAHh& #5XX2X999hhGGGGGh33XXX2B#AH#MGir:::,,. r@A ,r ::,:iSisssrrsssssssrrrssss5X3XX2222riX2X3333G5.;& #iS52XX222222X99993XX2X##323HMB9Sr;;;, &@; s, ;;.:srsssrrrrrrr;r;rrsiSS5522252222X3333X3h2:rG #iS22255225222XXXXXXX5G@#X3#AGAB#A2rrr;, ,@A. ;s, .AS ssrssrrrrrrr;rrrssiiSSiS555222sr9XXX339GA3G #s52222222552XXXX22225M@Ai####H3X3hAAG2i;, ,#@r. :Sr. ,;; ,srrr;rr::;;;rrrrssiiiiSS55222XSs22S2399332h #s522222255SSSS22252SX@@2;MAX29H#B&XS2HA&32ssA@X;:;Xs;::;sirr::r5rrrr;;;:::;;rrrrrsssssiSSSri3X95S3X33XXXX59 #s5X22222255SiiiSSSSiA@@;5#Xr;;;r5&MMH@#3S5H&B@@2:,SMhSSi:i2ss;.rsrr;;;;;;;;rrrrrrsssii5252rsXXis933X22XX2i3 #i52222222225SSiiiiis#@B:HMXs:,,,...:r2B@@##AA@A;.. @@A2Sr;, .ssr;;;;;;;rrrrr;,,rsiSSi:rX3X23i;XX255225SsX #i52222222225SSiiisr5@@&r#HXr;:: .;h@@@@G: #A:, rSr;;;;;;rr;rrrr;..riSi,;;;2X22X9hXX2555Siir2 #i5XXXX2222555Siiis;A@@9i#G2ir;;,. :A#@A. A; .ir;;;;;;rs;:rrrrr::sSiS;;93X2X922X2225SSiiir2 #i2XXXXXXX2255SSiirr##@3XB35Siii;:,.. h#@h;. ,B, :r;;;;;;rrrrrrrrsi;r5iS232Sr.i2r;;25,:2, s5is2 #SX9X33XXXXX255SisiB@##&&AX2SiiSi;;:. ,A#@X; ;A. ..;r;;;;rrrrrrrrrsr;ri22222Si::X5,r5Ss:rSr;sr X @23h333333XX225SirB@###AH&X2ssrrs;;:...,. rA#@5;, X9, . rr;:;rrrrrrrrrsisrSrr55522X5iiX32SSss5ir2srrrX @39hhhh9333XX25isr#@MGB#M&2irr;;;::;,,,,:,,iH@#i:, A2:,,. .rrr;;rrrrrrrrrsriS5s;5SS5irX2525iiS5SSSSSS5X23 @X9GGGG993XXX2Siri@##s:A@#G5sr;:,::::;:,. .5#@Mr:,,BS;;:, .,;rrrr;;;;rrr;rssrsiS5iriSSSS55SiiiSiiiSSiiS22SX @XhG&&GGh93X25Sir9@#B9XAH&#@HXi;:,,,,,,,,,;G##A;:,iMrrr;:..:rirr;;;;,;rr;,r;;siiiir;iiiiiiiiiSSiiiSSSiS2XXiX @3h&&&GGh93X25Sir3@#HhA@M2:;B@@#AXr,.,,,, :A##3;;;AHsr;:;rr3X:r;;;;;;rr;:rrrrsrssssiiisssssiiiiiiSSSS22XX2iX @3h&AGhh9XXX25Sir3@##&B#AGhsi2A#@@@#Ah9&hi2##M3r;r#Mh95i9A&2 ,;;;;;;;;;;;;rsisrrrrsssrsssssissssiiSS52XX25s2 @3GA&Gh933X225Si;&@#AAM##Gi;..,:;;rS3GH#@@@@##@MB#@MAHBH&S: :r;;;;;;:,:r;;;,..rrrrrrrrrr,;ssrrsssii552225Sr5 @3GGGGh993X22SSi;X@MGAAXG#BS:. :9M2:,,2@r.;;, ;;;::::;,:;;;;: ,:;;;;;;r;;rr;rrrsiiiS55SSSirS @3hhhhh93XX25Sis;&@MBBAr.rH@#hr, i@#X, :Mr. :;:,:::::,:;;;;;;rr:,:,;;;;;;r;;,;rrrsssiiiiiis;S @X39h9933X22SSisrM@MAH#M9iX@@@@B5r:, .i@Hr: rs .;: ;;s222srrr:,,,::::;:,:::,;. :;;;;;;;;rrrsrrrsrr;i @X99993XX225SSiri@#AXAMM#BXh@@@@@@@@#BGX2SAM#&;rXG;:SB@@@sr2M@@#2:sXAHhi;;;;r. ;;::,,,,::,,:;iS23h22s;rr;;:s @X993XXX225SSisr3@#BAHBXSX2;;h##@@@@@@@@@@#M@#X&@@@@@@@H. ;G@MB&;;2isS9HMHA3i:;XHMXis,,:,;S&&3##H2;:,:::,::s @X393X2225Sii35s&###BMM3sr;r5H#&ii5GMBAM@@@#@@H@@@Hr. ;i r##GGr ;srr;;,, :. :rsXM92@HGA#@@2 .hH&G&hX5i593SS @2X3XX225Sii2#@@#HH###Mh2i;,;HAs:. ,,,:5ABX;,.Xi 2 2@A&G3Srrrr:::,,:::,,;iAAM@@@@@#HH3iGG99h&H##AX;, r @2XXX22SS2A#@@@@##M###M&hhiri#&:., :A@Bi: ;r i:5@B3sX25ir;;:,,,,,,,:.:sS&h#@@#MHA&AHGXXX3hhG&3srr;s @2XX255XhM@@@@#######@@#HAhX&@Hr:;: .H@X:is;r:. :S5@MGr.:;;:,:r;;r;,. .:. s2H@#@@MA&G&&Ss33333h99G&GH#A @2Xh93MBA@@@#######BB#@@@BAAM#AXi;rr. .A@9:,::r:. S3#AX;,.. .,,.:s;,:,, .rs:2A@@Mr;GAGh9h;:3XXi.S33GAA&3& @X2Si29A@@########B95XB@@@BBB#B&&Srs; .S#@MA2;rr. :MAGs:,.,,,,::, ,:.:r5r;9A2XM@#&..&BAGG&A&933X2X3X9hAHHH #3h2SisSB#BBM##M###A52M#M@##MH&3Xir;:,,;X@#i;;:S; .HH5i, .,:,::,;, .;;s2939#H9A@@#@@@BG9X999333339X222X9hGH #2M###A9XBMM#BHBMMMAA##AXG@###ASr;;;:,:;3#3;:,;G;,:AArrr..::;,;:.:;,rh5s9AAM#A&##HHHHAh3XXX3GG3393X2X3X2252A #sA#M#@#AA#@#&AHAHHH##HA5.:M#3A@hr;;::,:9MAi5,S2:;Ghr;s;,:;:;:;;;;rr3hiiAHAAAXA#MBHAAh9hhGGs :XG9339Gh3XX99A #iGA2hHMBHHAGGAAGGH#@BAB3 i@@r:M@9r::,:9#B:,:&r;A2s;rssr;;;::srrss5hXiXABBBHB@MHA&AA&&&&&&i iAhGAAG3XXX39A @2AHir59MB5rsXAMBAM#AGGAX:;Ar.s, rGM9r:sX#G;.2@BGX;r,;i32iir;r5r5X2AAS2#@@####MMBAGGGX23X9&AMHA&&GhhX22XGAAB @GHAirShHASi2&&AAAAA99hXsiMG .9#G&@@@#@##B2r@#Ss;;: ,iXXXh2rhh2&GAH2SM@@###MHAAAAhh99h&HiiBHHA&Ghhh9GAAHAAB @AAA9GHAHMHBBAhGA&H@BGHHA@@5SB@@@##MBMMBHAB&Xr,,,,;,.rXrShh5S9SX3G&s5@@@#MBHHHAA&GAAAAHAA99BAA&&GGGh3hGAAAAH @9&HMBBAMBMBAhAA93&BHGGhAB#M@@M35sr;;:;rSXX;. ,.,;:;X&S9XsrsriA@A;s@@#MMMBHHHHBh;X&&&AX;iHG&&&GhhGGAAAAAHHM @9AMMMBAhX523&AXS2hhXXhhXX9GGh5srr;;::;i93r:.:2SrS35iA&GAi;r5SH#5:i@@#MBBB#MBHBBM9BBA22BMBAGG&AAHMBAAG9hh&AB @GGAA32sr;;sSii2XG9irS5522X3XX99hGA&&9hAhS;:;X9siA&52A222Si3AA2;i33@#ABMBH&GHHX3BHM##MX9&AHBHHB#@G3HH&G93X2A @#H&h333335iiiXX3S;;ihSsi5X9hhh&A&G9GGh2sr;rAA22h5:;3HA3i3MBAX9@@@##BBM2hMS9HHSriAsGBM#BAGAHMM#2 .GAHAAGXA @BMMM#MAAA9Xh&3h2si5XG5sr;;rsiisssiSirrrsrXBA9GA5::2H9&A2SXG#@@@@@##MBM55MHM##@@#@#G&AHHAAAAB@s G#AHAHBB @&ABB#####HH&X399G3X22iS5Sr:;;::sSSs;ri52GH&h3X2SXG95r:,sA..:s9A#@@#@MM@@M###@H. 2@MAAHHHB## :;sA@@#BHA&B @&A&AHBM#@@@@MHAGGh3222239X25ShMX552hHHB#@#&GAHMBG5r:,s#@X.:;;;2@@BB##@####MM@ S@@#####@B ,X@@##MMBAB @A&HBHMMBH##@@#MMM##@@@A9A#HG@@@@GAHH#@#&X5SsiXS;, :B@@r .... r@G;H@####BMB#@: ,rr;2@@@@@@@@2;sH@#@@MMMBBAB @AB#HAHBBH2G2S5X3933hAMMAGX5s#@@@s;rr;::... .9@@X S#@#####M#@@ ,rs.r@@@@#2s:rG@@#@##HBBBAB @HMM359GAirs;;rr;;;;:::::,,, G@@@: ,2H@@M. :, ;H@@#####@@@ ;Si;X; s. i@#&B@MHHHAM @ABX2@&s;:;;rr;::,,. #BA#, 2@@@BBB . :rrSir;:9@@#####@@@..;;2r i ;2M@#H#MHHHHAB @&Xrr9@@B2r;,.,... r@93M; ;#@#BBXr ....:H#5M###@@2.;;.;r. S#AGH@@MHHM@#BAHAB @r;sirS@@@@@&: ... ..... ,@AA#H h@@BA#s .,, ;Hi#@@@3 r92:GG@@@@@@#&M#HBMMA&B #r532i;:A@@@@@5 .,:::;;:,.. 5@HH#@, ,HB&AA#2 ..,r. 2@. . ;A#HB@@@@@@@M@B##MAGHBB #S22i;;,.:i@@@@@r, ,@#M#@@ 5@@AhAA: ... Xr :, 3M3s@@@@#M@#@BH#HH#MhH #iiirrr;:. 2@@@@@&s: .. B@#@@@; .B@Bh9A9 ,,r..r. ,A; .r. ,2AAM@@@@@@M@AA99MAMHM #sssssrr;:,. 3@@@@@@@; 5@3rrsX#@@@A3r2& ., ...,r:rh, XA;:,. r&MM@@#@@H#A&H929G#AB @iSisrrr;;;,. r@@@@@@@@&Sh@B, ..:s&#B&M s&; .:r;2, i2rsX; ,5;2hs;XGH#@@@@MM#BB#9hhX&5A #iSisrrrr;;::, ,r9@@@@@@@2.,;;;;rr:..i#@5 . .. :XBX; :;. ;Air;,s:,H@@@M#h 2@@@@@#A@B&#3&3SA #iiirrr;;r;;:, ,A@@@M;5X222H@B3ir:3@#2AHHAA&GG9#r . .9hA@@#9s ;r. .2,r@@A5X3@@#@#. 5@@@@@@@@@#HAXA @SSiisisr;;:,.. :#@#H@@BHHA@@@@@, M@@@@@@@@@@@@#&i :;2@@#B@#X; , ,sH#A#@#XG##AB@X .;Sh&@@@@B&A @XXXXXSr;:::,,:::::,,:;rH@M@@@#35A&s29i,,@@#AM@@@@@@@@@@@@@5 . .#@@s , ,. .H@@HhX3HMH3S5#@B; s@@#H @&&h2s;;;;;;;;r;;r2H@@@@@@XhHMhGA@2;59GA9@@@MGSr;:,,,,,,r#@@#s: , r@@#@53:s,A@@@#AAHHhXi:,s@@#r 2@# @XXSrr;;;rrsrrS&@@@@@@@@@@M&AHB#@#&hGG92r2@s 9@@@Ar . .A@@@@#@###M###MBAh99i;.,5@@X:, :. :@ @iissiissiS3M@@@@@@@@@@@#@@G&hG#MMHA2r;:,h#B5 S@@@#&:rAB@@@@@@@##A&&ABMHh3GGS;. .3@B;:;, sA,X @issS252&#@@@@@@@@#H3Sr.,#@2isssi2;::,.:h#AH@@i ,9@@@@@@@@@@@@@#A3X3&H#MHAGh2s;. ,9#5,;;.;AG #rs552B@@@@@@B9Sr;:.. ;@@@#Srr;:,,,.,&HBA59H#@B. .2BX, ,2AB##&iiX39HMHHh32r:. .9#r.,:5h #59A@@@@@B3ir;:::,:::,i@@@@@@@GSsrrs3@9 . 5#MM@@i .iH@AsrssSAHA#A&2;, ,AG;2;r @h#@@#&2isrr;;;:;;;r;r@@@@@@XA@@@@@@@, .i@@#@@#: ..,.,::..rh@#XsrrSAAG@BAs:, r@@ : @AMHhX2Ssrrrrrrssiii9@@@@@@r :@@@@@A .. .M@@@@@&; .,,;;rrr;S5##S;;riA3X@#As:, :@2 . @AA&32irrrrsi5222iS#@@@@@@r ,..@@@#@A ... ;hM@@@@@X :r25is;##, :;sBS2@#ASr:::,:h& : @GG32Siiii52X22i;2@@@@@@9. .. ##AA#5 r@@@@@; ... .... ,;s5X:;;#A .;s#i5#HG2iss2M&. : @9hh3XX39h925Ss;A@@@@@X. .. S@BH#2 A@#@@h ...... ..:;rrsX: r:#A ,;#r2#AAAM@@2: . i @&HBHHHAGXSsssr#@@@@h, ,:::;:..@@@@@ .,,,,..... ;h@@@@, .:::....;siri, ;,#H, :M;A#B#@3;;:r,;@ @A##BHAGX55SSr2@@@A;,:riiSiiisr,r@@@@i,;;;;:;;,,:;::, .s#@@A .:;rr:,:;;i@,ii,MHr,:rB#i#@9r:,.r,;@@ @A##BA&9X2225rB@@G:ri522222255ir:@@@@3;s;ssrr;,.,,,. i@@2,... .,;iSi;:r@@@@S,&h&@@#@##M2i ,:X@@# @&HMHG3Xisiir#@&s:;rssrrr;::;r;;,&@@@G.:,,.. S;.,,:,,. ,r3&3rB@#5@h;rs9@#&32A#HSsG@@@XH @&AB&3X2Sssri@s .,:::::::, ,,,. 5@MG. .,,::,:::::,.. .,,::::::;i2X@@#;s@#XS::53XS2M@@@@@MMAA @AHA&G325Sisir,:::,,,,,.. @@9 ,;;;rsis;rr;;::,........... .:rirr;rr;9@@@H#@@@MAM@@@@@@@@@@@MB# @h3XXX333X2ir;;;;;;;;;:,,,,,,... A@@,;rsiiSSiiiir..:,.. ..,:;;;;rsiri&###@#@@@@@@@@@@@@@2r293iH #255issiiSSSiisr;;;;::;,:;;;;rrrrriBHsssi;,;rrrr;;;:::,,,.. .,::;;rrrs2BMBMMMMBMM#@@@@@@@#9XS292A''') print('''The way I see it, our fates appear to be intertwined. In a land brimming with Hollows, could that really be mere chance? So, what do you say? Why not help one another on this lonely journey?''') choice = input('Choose fellow warrior.\nYes or No?\n').lower() if choice == 'yes': print('Lets get going then.') print('I am bored now, so bye lul.') else: print('Ahh warrior, so you decided to continue your own adventure. \ Then I shall not bother you for I too have to seek my own sun')
print('@#############################################################MMMMMMMMMMMMMMMMMMBBBBMMMMBB&AMBAHM###MMMMMMM#\n@hG&&AA&&A&G&&&&GG&AA&&&&&AAAAAA&&&G&&&GGhh&AAAG93XX39h93X225iiiS5SSSSSSSiSiSSisssssiisssi:.;s;iXX25Sii25SSA\n@hAAHAAHAHAAAAAAAAAAAAAAAAAAAAAAAHHHAAAG&&3Ssi5G&GG&&GG9333X2552222222255525rrSSS55SSSiSS5X;:Xri2SX252r ;A9A\n@GAHHHHHHAAAAAAAAA&AAAAAAAAAHHHAh25iiS29B@Hr sAX9GAAGh3333XX22222XXX5iS55Sii552225SS2X2iih&A: ,;X22r:;:ihA\n@GAAHHHHAAAAAGG&&&G&&&AA&AA&XSsii55Sirrrs&@#r s::::r53h9XX3X252252XX2SiiiiS55525SS5irr239GGAHX39222XA3,:hA\n@3GAAAAA&AAAA&GGGGhhhGGGGG2i2hAAhir;:. G@9 .;....:;rr53X25SS5552225rrisiSSiiiiiiir:Shh9999;iX223G&hAA9&\n@29&G933GAAAAA&Gh933393&MMM#@HXs:,:,, ,@@, r, ,;;;r52SiiSiiiiisrsiissssrsssSXh399X2222222X99hGAHh&\n#5XX2X999hhGGGGGh33XXX2B#AH#MGir:::,,. r@A ,r ::,:iSisssrrsssssssrrrssss5X3XX2222riX2X3333G5.;&\n#iS52XX222222X99993XX2X##323HMB9Sr;;;, &@; s, ;;.:srsssrrrrrrr;r;rrsiSS5522252222X3333X3h2:rG\n#iS22255225222XXXXXXX5G@#X3#AGAB#A2rrr;, ,@A. ;s, .AS ssrssrrrrrrr;rrrssiiSSiS555222sr9XXX339GA3G\n#s52222222552XXXX22225M@Ai####H3X3hAAG2i;, ,#@r. :Sr. ,;; ,srrr;rr::;;;rrrrssiiiiSS55222XSs22S2399332h\n#s522222255SSSS22252SX@@2;MAX29H#B&XS2HA&32ssA@X;:;Xs;::;sirr::r5rrrr;;;:::;;rrrrrsssssiSSSri3X95S3X33XXXX59\n#s5X22222255SiiiSSSSiA@@;5#Xr;;;r5&MMH@#3S5H&B@@2:,SMhSSi:i2ss;.rsrr;;;;;;;;rrrrrrsssii5252rsXXis933X22XX2i3\n#i52222222225SSiiiiis#@B:HMXs:,,,...:r2B@@##AA@A;.. @@A2Sr;, .ssr;;;;;;;rrrrr;,,rsiSSi:rX3X23i;XX255225SsX\n#i52222222225SSiiisr5@@&r#HXr;:: .;h@@@@G: #A:, rSr;;;;;;rr;rrrr;..riSi,;;;2X22X9hXX2555Siir2\n#i5XXXX2222555Siiis;A@@9i#G2ir;;,. :A#@A. A; .ir;;;;;;rs;:rrrrr::sSiS;;93X2X922X2225SSiiir2\n#i2XXXXXXX2255SSiirr##@3XB35Siii;:,.. h#@h;. ,B, :r;;;;;;rrrrrrrrsi;r5iS232Sr.i2r;;25,:2, s5is2\n#SX9X33XXXXX255SisiB@##&&AX2SiiSi;;:. ,A#@X; ;A. ..;r;;;;rrrrrrrrrsr;ri22222Si::X5,r5Ss:rSr;sr X\n@23h333333XX225SirB@###AH&X2ssrrs;;:...,. rA#@5;, X9, . rr;:;rrrrrrrrrsisrSrr55522X5iiX32SSss5ir2srrrX\n@39hhhh9333XX25isr#@MGB#M&2irr;;;::;,,,,:,,iH@#i:, A2:,,. .rrr;;rrrrrrrrrsriS5s;5SS5irX2525iiS5SSSSSS5X23\n@X9GGGG993XXX2Siri@##s:A@#G5sr;:,::::;:,. .5#@Mr:,,BS;;:, .,;rrrr;;;;rrr;rssrsiS5iriSSSS55SiiiSiiiSSiiS22SX\n@XhG&&GGh93X25Sir9@#B9XAH&#@HXi;:,,,,,,,,,;G##A;:,iMrrr;:..:rirr;;;;,;rr;,r;;siiiir;iiiiiiiiiSSiiiSSSiS2XXiX\n@3h&&&GGh93X25Sir3@#HhA@M2:;B@@#AXr,.,,,, :A##3;;;AHsr;:;rr3X:r;;;;;;rr;:rrrrsrssssiiisssssiiiiiiSSSS22XX2iX\n@3h&AGhh9XXX25Sir3@##&B#AGhsi2A#@@@#Ah9&hi2##M3r;r#Mh95i9A&2 ,;;;;;;;;;;;;rsisrrrrsssrsssssissssiiSS52XX25s2\n@3GA&Gh933X225Si;&@#AAM##Gi;..,:;;rS3GH#@@@@##@MB#@MAHBH&S: :r;;;;;;:,:r;;;,..rrrrrrrrrr,;ssrrsssii552225Sr5\n@3GGGGh993X22SSi;X@MGAAXG#BS:. :9M2:,,2@r.;;, ;;;::::;,:;;;;: ,:;;;;;;r;;rr;rrrsiiiS55SSSirS\n@3hhhhh93XX25Sis;&@MBBAr.rH@#hr, i@#X, :Mr. :;:,:::::,:;;;;;;rr:,:,;;;;;;r;;,;rrrsssiiiiiis;S\n@X39h9933X22SSisrM@MAH#M9iX@@@@B5r:, .i@Hr: rs .;: ;;s222srrr:,,,::::;:,:::,;. :;;;;;;;;rrrsrrrsrr;i\n@X99993XX225SSiri@#AXAMM#BXh@@@@@@@@#BGX2SAM#&;rXG;:SB@@@sr2M@@#2:sXAHhi;;;;r. ;;::,,,,::,,:;iS23h22s;rr;;:s\n@X993XXX225SSisr3@#BAHBXSX2;;h##@@@@@@@@@@#M@#X&@@@@@@@H. ;G@MB&;;2isS9HMHA3i:;XHMXis,,:,;S&&3##H2;:,:::,::s\n@X393X2225Sii35s&###BMM3sr;r5H#&ii5GMBAM@@@#@@H@@@Hr. ;i r##GGr ;srr;;,, :. :rsXM92@HGA#@@2 .hH&G&hX5i593SS\n@2X3XX225Sii2#@@#HH###Mh2i;,;HAs:. ,,,:5ABX;,.Xi 2 2@A&G3Srrrr:::,,:::,,;iAAM@@@@@#HH3iGG99h&H##AX;, r\n@2XXX22SS2A#@@@@##M###M&hhiri#&:., :A@Bi: ;r i:5@B3sX25ir;;:,,,,,,,:.:sS&h#@@#MHA&AHGXXX3hhG&3srr;s\n@2XX255XhM@@@@#######@@#HAhX&@Hr:;: .H@X:is;r:. :S5@MGr.:;;:,:r;;r;,. .:. s2H@#@@MA&G&&Ss33333h99G&GH#A\n@2Xh93MBA@@@#######BB#@@@BAAM#AXi;rr. .A@9:,::r:. S3#AX;,.. .,,.:s;,:,, .rs:2A@@Mr;GAGh9h;:3XXi.S33GAA&3&\n@X2Si29A@@########B95XB@@@BBB#B&&Srs; .S#@MA2;rr. :MAGs:,.,,,,::, ,:.:r5r;9A2XM@#&..&BAGG&A&933X2X3X9hAHHH\n#3h2SisSB#BBM##M###A52M#M@##MH&3Xir;:,,;X@#i;;:S; .HH5i, .,:,::,;, .;;s2939#H9A@@#@@@BG9X999333339X222X9hGH\n#2M###A9XBMM#BHBMMMAA##AXG@###ASr;;;:,:;3#3;:,;G;,:AArrr..::;,;:.:;,rh5s9AAM#A&##HHHHAh3XXX3GG3393X2X3X2252A\n#sA#M#@#AA#@#&AHAHHH##HA5.:M#3A@hr;;::,:9MAi5,S2:;Ghr;s;,:;:;:;;;;rr3hiiAHAAAXA#MBHAAh9hhGGs :XG9339Gh3XX99A\n#iGA2hHMBHHAGGAAGGH#@BAB3 i@@r:M@9r::,:9#B:,:&r;A2s;rssr;;;::srrss5hXiXABBBHB@MHA&AA&&&&&&i iAhGAAG3XXX39A\n@2AHir59MB5rsXAMBAM#AGGAX:;Ar.s, rGM9r:sX#G;.2@BGX;r,;i32iir;r5r5X2AAS2#@@####MMBAGGGX23X9&AMHA&&GhhX22XGAAB\n@GHAirShHASi2&&AAAAA99hXsiMG .9#G&@@@#@##B2r@#Ss;;: ,iXXXh2rhh2&GAH2SM@@###MHAAAAhh99h&HiiBHHA&Ghhh9GAAHAAB\n@AAA9GHAHMHBBAhGA&H@BGHHA@@5SB@@@##MBMMBHAB&Xr,,,,;,.rXrShh5S9SX3G&s5@@@#MBHHHAA&GAAAAHAA99BAA&&GGGh3hGAAAAH\n@9&HMBBAMBMBAhAA93&BHGGhAB#M@@M35sr;;:;rSXX;. ,.,;:;X&S9XsrsriA@A;s@@#MMMBHHHHBh;X&&&AX;iHG&&&GhhGGAAAAAHHM\n@9AMMMBAhX523&AXS2hhXXhhXX9GGh5srr;;::;i93r:.:2SrS35iA&GAi;r5SH#5:i@@#MBBB#MBHBBM9BBA22BMBAGG&AAHMBAAG9hh&AB\n@GGAA32sr;;sSii2XG9irS5522X3XX99hGA&&9hAhS;:;X9siA&52A222Si3AA2;i33@#ABMBH&GHHX3BHM##MX9&AHBHHB#@G3HH&G93X2A\n@#H&h333335iiiXX3S;;ihSsi5X9hhh&A&G9GGh2sr;rAA22h5:;3HA3i3MBAX9@@@##BBM2hMS9HHSriAsGBM#BAGAHMM#2 .GAHAAGXA\n@BMMM#MAAA9Xh&3h2si5XG5sr;;rsiisssiSirrrsrXBA9GA5::2H9&A2SXG#@@@@@##MBM55MHM##@@#@#G&AHHAAAAB@s G#AHAHBB\n@&ABB#####HH&X399G3X22iS5Sr:;;::sSSs;ri52GH&h3X2SXG95r:,sA..:s9A#@@#@MM@@M###@H. 2@MAAHHHB## :;sA@@#BHA&B\n@&A&AHBM#@@@@MHAGGh3222239X25ShMX552hHHB#@#&GAHMBG5r:,s#@X.:;;;2@@BB##@####MM@ S@@#####@B ,X@@##MMBAB\n@A&HBHMMBH##@@#MMM##@@@A9A#HG@@@@GAHH#@#&X5SsiXS;, :B@@r .... r@G;H@####BMB#@: ,rr;2@@@@@@@@2;sH@#@@MMMBBAB\n@AB#HAHBBH2G2S5X3933hAMMAGX5s#@@@s;rr;::... .9@@X S#@#####M#@@ ,rs.r@@@@#2s:rG@@#@##HBBBAB\n@HMM359GAirs;;rr;;;;:::::,,, G@@@: ,2H@@M. :, ;H@@#####@@@ ;Si;X; s. i@#&B@MHHHAM\n@ABX2@&s;:;;rr;::,,. #BA#, 2@@@BBB . :rrSir;:9@@#####@@@..;;2r i ;2M@#H#MHHHHAB\n@&Xrr9@@B2r;,.,... r@93M; ;#@#BBXr ....:H#5M###@@2.;;.;r. S#AGH@@MHHM@#BAHAB\n@r;sirS@@@@@&: ... ..... ,@AA#H h@@BA#s .,, ;Hi#@@@3 r92:GG@@@@@@#&M#HBMMA&B\n#r532i;:A@@@@@5 .,:::;;:,.. 5@HH#@, ,HB&AA#2 ..,r. 2@. . ;A#HB@@@@@@@M@B##MAGHBB\n#S22i;;,.:i@@@@@r, ,@#M#@@ 5@@AhAA: ... Xr :, 3M3s@@@@#M@#@BH#HH#MhH\n#iiirrr;:. 2@@@@@&s: .. B@#@@@; .B@Bh9A9 ,,r..r. ,A; .r. ,2AAM@@@@@@M@AA99MAMHM\n#sssssrr;:,. 3@@@@@@@; 5@3rrsX#@@@A3r2& ., ...,r:rh, XA;:,. r&MM@@#@@H#A&H929G#AB\n@iSisrrr;;;,. r@@@@@@@@&Sh@B, ..:s&#B&M s&; .:r;2, i2rsX; ,5;2hs;XGH#@@@@MM#BB#9hhX&5A\n#iSisrrrr;;::, ,r9@@@@@@@2.,;;;;rr:..i#@5 . .. :XBX; :;. ;Air;,s:,H@@@M#h 2@@@@@#A@B&#3&3SA\n#iiirrr;;r;;:, ,A@@@M;5X222H@B3ir:3@#2AHHAA&GG9#r . .9hA@@#9s ;r. .2,r@@A5X3@@#@#. 5@@@@@@@@@#HAXA\n@SSiisisr;;:,.. :#@#H@@BHHA@@@@@, M@@@@@@@@@@@@#&i :;2@@#B@#X; , ,sH#A#@#XG##AB@X .;Sh&@@@@B&A\n@XXXXXSr;:::,,:::::,,:;rH@M@@@#35A&s29i,,@@#AM@@@@@@@@@@@@@5 . .#@@s , ,. .H@@HhX3HMH3S5#@B; s@@#H\n@&&h2s;;;;;;;;r;;r2H@@@@@@XhHMhGA@2;59GA9@@@MGSr;:,,,,,,r#@@#s: , r@@#@53:s,A@@@#AAHHhXi:,s@@#r 2@#\n@XXSrr;;;rrsrrS&@@@@@@@@@@M&AHB#@#&hGG92r2@s 9@@@Ar . .A@@@@#@###M###MBAh99i;.,5@@X:, :. :@\n@iissiissiS3M@@@@@@@@@@@#@@G&hG#MMHA2r;:,h#B5 S@@@#&:rAB@@@@@@@##A&&ABMHh3GGS;. .3@B;:;, sA,X\n@issS252&#@@@@@@@@#H3Sr.,#@2isssi2;::,.:h#AH@@i ,9@@@@@@@@@@@@@#A3X3&H#MHAGh2s;. ,9#5,;;.;AG\n#rs552B@@@@@@B9Sr;:.. ;@@@#Srr;:,,,.,&HBA59H#@B. .2BX, ,2AB##&iiX39HMHHh32r:. .9#r.,:5h\n#59A@@@@@B3ir;:::,:::,i@@@@@@@GSsrrs3@9 . 5#MM@@i .iH@AsrssSAHA#A&2;, ,AG;2;r\n@h#@@#&2isrr;;;:;;;r;r@@@@@@XA@@@@@@@, .i@@#@@#: ..,.,::..rh@#XsrrSAAG@BAs:, r@@ :\n@AMHhX2Ssrrrrrrssiii9@@@@@@r :@@@@@A .. .M@@@@@&; .,,;;rrr;S5##S;;riA3X@#As:, :@2 .\n@AA&32irrrrsi5222iS#@@@@@@r ,..@@@#@A ... ;hM@@@@@X :r25is;##, :;sBS2@#ASr:::,:h& :\n@GG32Siiii52X22i;2@@@@@@9. .. ##AA#5 r@@@@@; ... .... ,;s5X:;;#A .;s#i5#HG2iss2M&. :\n@9hh3XX39h925Ss;A@@@@@X. .. S@BH#2 A@#@@h ...... ..:;rrsX: r:#A ,;#r2#AAAM@@2: . i\n@&HBHHHAGXSsssr#@@@@h, ,:::;:..@@@@@ .,,,,..... ;h@@@@, .:::....;siri, ;,#H, :M;A#B#@3;;:r,;@\n@A##BHAGX55SSr2@@@A;,:riiSiiisr,r@@@@i,;;;;:;;,,:;::, .s#@@A .:;rr:,:;;i@,ii,MHr,:rB#i#@9r:,.r,;@@\n@A##BA&9X2225rB@@G:ri522222255ir:@@@@3;s;ssrr;,.,,,. i@@2,... .,;iSi;:r@@@@S,&h&@@#@##M2i ,:X@@#\n@&HMHG3Xisiir#@&s:;rssrrr;::;r;;,&@@@G.:,,.. S;.,,:,,. ,r3&3rB@#5@h;rs9@#&32A#HSsG@@@XH\n@&AB&3X2Sssri@s .,:::::::, ,,,. 5@MG. .,,::,:::::,.. .,,::::::;i2X@@#;s@#XS::53XS2M@@@@@MMAA\n@AHA&G325Sisir,:::,,,,,.. @@9 ,;;;rsis;rr;;::,........... .:rirr;rr;9@@@H#@@@MAM@@@@@@@@@@@MB#\n@h3XXX333X2ir;;;;;;;;;:,,,,,,... A@@,;rsiiSSiiiir..:,.. ..,:;;;;rsiri&###@#@@@@@@@@@@@@@2r293iH\n#255issiiSSSiisr;;;;::;,:;;;;rrrrriBHsssi;,;rrrr;;;:::,,,.. .,::;;rrrs2BMBMMMMBMM#@@@@@@@#9XS292A') print('The way I see it, our fates appear to be intertwined.\nIn a land brimming with Hollows, could that really be mere chance?\nSo, what do you say? Why not help one another on this lonely journey?') choice = input('Choose fellow warrior.\nYes or No?\n').lower() if choice == 'yes': print('Lets get going then.') print('I am bored now, so bye lul.') else: print('Ahh warrior, so you decided to continue your own adventure. Then I shall not bother you for I too have to seek my own sun')
class InvalidTraceHeader(Exception): """Thrown if a bad trace header was passed in.""" class InvalidMessageID(Exception): """Thrown if a bad message id was passed in."""
class Invalidtraceheader(Exception): """Thrown if a bad trace header was passed in.""" class Invalidmessageid(Exception): """Thrown if a bad message id was passed in."""
# SETTINGS FILE # TOKEN - discord app token # BOT PREFIX - no explanation needed (uhh I think) # API_AUTH - hypixel api auth # DB_CLIENT - your DB URI # DB_NAME - no explanation needed # APPLICATION_ID - discord app id TOKEN='' BOT_PREFIX='$' API_AUTH='' DB_CLIENT = '' DB_NAME = '' APPLICATION_ID=''
token = '' bot_prefix = '$' api_auth = '' db_client = '' db_name = '' application_id = ''
# -*- coding: utf-8 -*- class Symbol(object): def __init__(self, symbol): self.number = int(symbol['number']) self.numberEx = int(symbol['numberEx']) self.name = symbol['name'] self.var = symbol['var'] def __str__(self): return '\t\t\t\tNumber: {0} \n\t\t\t\tNumberEx: {1} \n\t\t\t\tName: {2} \n\t\t\t\tVar: {3}'.format(self.number, self.numberEx, self.name, self.var)
class Symbol(object): def __init__(self, symbol): self.number = int(symbol['number']) self.numberEx = int(symbol['numberEx']) self.name = symbol['name'] self.var = symbol['var'] def __str__(self): return '\t\t\t\tNumber: {0} \n\t\t\t\tNumberEx: {1} \n\t\t\t\tName: {2} \n\t\t\t\tVar: {3}'.format(self.number, self.numberEx, self.name, self.var)
def mutate(soup): paragraphs = get_max_paragraph_set(soup) headline = soup.find('h1') html = str(headline) + '\n' for paragraph in paragraphs: html += str(paragraph) + '\n' return html def get_max_paragraph_set(soup): paragraph_map = build_paragraph_map(soup) key = get_max_key(paragraph_map) if key is None: raise NoParagraphsError() return paragraph_map[key] def get_max_key(paragraph_map): max_count = 0 max_key = None for key, paragraphs in paragraph_map.items(): count = len(paragraphs) if count > max_count: max_count = count max_key = key return max_key def build_paragraph_map(soup): paragraph_map = {} for paragraph in soup.find_all('p'): key = id(paragraph.parent) if key not in paragraph_map: paragraph_map[key] = [] paragraph_map[key].append(paragraph) return paragraph_map class NoParagraphsError(RuntimeError):pass
def mutate(soup): paragraphs = get_max_paragraph_set(soup) headline = soup.find('h1') html = str(headline) + '\n' for paragraph in paragraphs: html += str(paragraph) + '\n' return html def get_max_paragraph_set(soup): paragraph_map = build_paragraph_map(soup) key = get_max_key(paragraph_map) if key is None: raise no_paragraphs_error() return paragraph_map[key] def get_max_key(paragraph_map): max_count = 0 max_key = None for (key, paragraphs) in paragraph_map.items(): count = len(paragraphs) if count > max_count: max_count = count max_key = key return max_key def build_paragraph_map(soup): paragraph_map = {} for paragraph in soup.find_all('p'): key = id(paragraph.parent) if key not in paragraph_map: paragraph_map[key] = [] paragraph_map[key].append(paragraph) return paragraph_map class Noparagraphserror(RuntimeError): pass
a = 3 while a >= 3: print("CSK Wins") break user_input = input('Enter City') while user_input == 'Chennai': print('Chennai pasanga da') break user_in = input('Enter Country') while type(user_in) == str: if user_in == 'India': print('India is the best') break else: print('Other country is the best') break genre = input('Enter your Genre ') movie = input('Enter the movie ') if genre == 'Horror': print(movie,'is the best horror movie') else: print(movie, 'is different genre')
a = 3 while a >= 3: print('CSK Wins') break user_input = input('Enter City') while user_input == 'Chennai': print('Chennai pasanga da') break user_in = input('Enter Country') while type(user_in) == str: if user_in == 'India': print('India is the best') break else: print('Other country is the best') break genre = input('Enter your Genre ') movie = input('Enter the movie ') if genre == 'Horror': print(movie, 'is the best horror movie') else: print(movie, 'is different genre')
letters = 'aeiou' txt = input("Podaj tekst: ") txt = txt.casefold() count = {}.fromkeys(letters,0) for ch in txt: if ch in count: count[ch] +=1 print(count)
letters = 'aeiou' txt = input('Podaj tekst: ') txt = txt.casefold() count = {}.fromkeys(letters, 0) for ch in txt: if ch in count: count[ch] += 1 print(count)
""" Theory > Instance vs Class > Attributes, methods, inheritance, polymorphism """ class Scout(): pass ratarca = Scout()
""" Theory > Instance vs Class > Attributes, methods, inheritance, polymorphism """ class Scout: pass ratarca = scout()
#!/usr/bin/python3 class Line: def __init__(self, x1, y1, x2, y2): self.x1 = int(x1) self.y1 = int(y1) self.x2 = int(x2) self.y2 = int(y2) self.rangex = abs(self.x2 - self.x1) self.rangey = abs(self.y2 - self.y1) def print(self): print(str(self.x1) + "," + str(self.y1) + " -> " + str(self.x2) + "," + str(self.y2)) def check_for_touch(self, line): touches = 0 for y in range(self.rangey): for x in range(self.rangex): print(x,y) # for y in rangeY: # print(y) # for x in rangeX: # print("this: " + x,y) # if line.is_on(x, y): # touches += 1 return touches def is_on(self, ax, ay): for y in range(abs(self.y2 - self.y1)): for x in range(abs(self.x2 - self.x1)): startx = self.x1 starty = self.y1 print("is_on") if self.y1 > self.y2: starty = self.y2 if self.x1 > self.x2: startx = self.x2 if startx + x == ax and starty + y == ay: return True return False def show_result(): counter = 0 while(len(lines) > 1): line = lines[0] lines.pop(0); for l in lines: counter = counter + line.check_for_touch(l) return counter input_file = open("sample.txt") input_text = input_file.read().split("\n") coords = [] for coords_raw in input_text: coord_raw = coords_raw.split(" -> ") coord = [] for c in coord_raw: new_coord = c.split(",") coord.append(new_coord) coords.append(coord) lines = [] for c in coords: start_coord = c[0] end_coord = c[1] if start_coord[0] == end_coord[0] or start_coord[1] == end_coord[1]: lines.append(Line(start_coord[0], start_coord[1], end_coord[0], end_coord[1])) # print(len(lines)) print(show_result()) # for l in lines: # print(l.print())
class Line: def __init__(self, x1, y1, x2, y2): self.x1 = int(x1) self.y1 = int(y1) self.x2 = int(x2) self.y2 = int(y2) self.rangex = abs(self.x2 - self.x1) self.rangey = abs(self.y2 - self.y1) def print(self): print(str(self.x1) + ',' + str(self.y1) + ' -> ' + str(self.x2) + ',' + str(self.y2)) def check_for_touch(self, line): touches = 0 for y in range(self.rangey): for x in range(self.rangex): print(x, y) return touches def is_on(self, ax, ay): for y in range(abs(self.y2 - self.y1)): for x in range(abs(self.x2 - self.x1)): startx = self.x1 starty = self.y1 print('is_on') if self.y1 > self.y2: starty = self.y2 if self.x1 > self.x2: startx = self.x2 if startx + x == ax and starty + y == ay: return True return False def show_result(): counter = 0 while len(lines) > 1: line = lines[0] lines.pop(0) for l in lines: counter = counter + line.check_for_touch(l) return counter input_file = open('sample.txt') input_text = input_file.read().split('\n') coords = [] for coords_raw in input_text: coord_raw = coords_raw.split(' -> ') coord = [] for c in coord_raw: new_coord = c.split(',') coord.append(new_coord) coords.append(coord) lines = [] for c in coords: start_coord = c[0] end_coord = c[1] if start_coord[0] == end_coord[0] or start_coord[1] == end_coord[1]: lines.append(line(start_coord[0], start_coord[1], end_coord[0], end_coord[1])) print(show_result())
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def deleteDuplicates(self, head: ListNode) -> ListNode: # handle exceptions if head==None or head.next==None: return head prehead = ListNode(val=-1000, next=head) pre = prehead curr = head post = head.next counter = 1 while post: # traverse continuous duplicates while post.val==curr.val: post = post.next counter += 1 if post==None: break if post: if counter==1: # if no continuous duplicates exist pre = curr curr = post else: curr = post # if continuous duplicates exist pre.next = curr counter = 1 post = post.next else: if counter==1: curr.next = None else: pre.next = None break return prehead.next
class Solution: def delete_duplicates(self, head: ListNode) -> ListNode: if head == None or head.next == None: return head prehead = list_node(val=-1000, next=head) pre = prehead curr = head post = head.next counter = 1 while post: while post.val == curr.val: post = post.next counter += 1 if post == None: break if post: if counter == 1: pre = curr curr = post else: curr = post pre.next = curr counter = 1 post = post.next else: if counter == 1: curr.next = None else: pre.next = None break return prehead.next
# -*- coding: utf-8 -*- # Author: Daniel Yang <daniel.yj.yang@gmail.com> # # License: BSD 3 clause def demo(): # reference: https://scikit-learn.org/stable/modules/classes.html#module-sklearn.cluster # https://scikit-learn.org/stable/modules/clustering.html pass
def demo(): pass
# Event: LCCS Python Fundamental Skills Workshop # Date: May 2018 # Author: Joe English, PDST # eMail: computerscience@pdst.ie # Purpose: A program to demonstrate how to create lists # Lists can be created with data (each value is a list element) boysNames = ['John', 'Jim', 'Alex', 'Fred'] girlsNames = ['Sarah', 'Alex', 'Pat', 'Mary'] favouriteSongs = ['Moondance', 'Linger', 'Stairway to Heaven'] fruits = ['Strawberry', 'Lemon', 'Orange', 'Raspberry', 'Cherry'] vehicleCount = [0, 0, 0, 0, 0, 0] accountDetails = [1234, 'xyz', 'Alex', '1 Main Street', 827.56]
boys_names = ['John', 'Jim', 'Alex', 'Fred'] girls_names = ['Sarah', 'Alex', 'Pat', 'Mary'] favourite_songs = ['Moondance', 'Linger', 'Stairway to Heaven'] fruits = ['Strawberry', 'Lemon', 'Orange', 'Raspberry', 'Cherry'] vehicle_count = [0, 0, 0, 0, 0, 0] account_details = [1234, 'xyz', 'Alex', '1 Main Street', 827.56]
NL = b'\n' DATA_SIZE = 4 FRAME_SIZE = 4 HEADER_SIZE = DATA_SIZE + FRAME_SIZE TIMESTAMP_SIZE = 8 ATTEMPTS_SIZE = 2 MSG_ID_SIZE = 16 MSG_HEADER = TIMESTAMP_SIZE + ATTEMPTS_SIZE + MSG_ID_SIZE
nl = b'\n' data_size = 4 frame_size = 4 header_size = DATA_SIZE + FRAME_SIZE timestamp_size = 8 attempts_size = 2 msg_id_size = 16 msg_header = TIMESTAMP_SIZE + ATTEMPTS_SIZE + MSG_ID_SIZE
def run(df, docs): for doc in docs: doc.start("t11 - Transform Unique Id", df) # Creates a unique id df['nProcesso_agrupamento'] = str(df['nProcesso']) + '_' + str(df['agrupamento']) for doc in docs: doc.end(df) return df
def run(df, docs): for doc in docs: doc.start('t11 - Transform Unique Id', df) df['nProcesso_agrupamento'] = str(df['nProcesso']) + '_' + str(df['agrupamento']) for doc in docs: doc.end(df) return df
numbers = [9, 8, 72, 22, 21, 81, 2, 1, 11, 76, 32, 54] def highest_num(numbers_in): highest = numbers_in[0] for count in range(len(numbers_in)): if highest < numbers_in[count]: highest = numbers_in[count] return highest highest_out = highest_num(numbers) print("The highest number is", highest_out)
numbers = [9, 8, 72, 22, 21, 81, 2, 1, 11, 76, 32, 54] def highest_num(numbers_in): highest = numbers_in[0] for count in range(len(numbers_in)): if highest < numbers_in[count]: highest = numbers_in[count] return highest highest_out = highest_num(numbers) print('The highest number is', highest_out)
with (a, c,): pass with (a as b, c): pass async with (a, c,): pass async with (a as b, c): pass
with a, c: pass with a as b, c: pass async with a, c: pass async with a as b, c: pass
class FilasColumnas: def __init__(self, nombre, filas, columnas): self.nombre = nombre self.filas = filas self.columnas = columnas def getNombre(self): return self.nombre def getFilas(self): return self.filas def getColumnas(self): return self.filas
class Filascolumnas: def __init__(self, nombre, filas, columnas): self.nombre = nombre self.filas = filas self.columnas = columnas def get_nombre(self): return self.nombre def get_filas(self): return self.filas def get_columnas(self): return self.filas
#!/usr/bin/env python # coding: utf-8 # Write a function to which would return the greatest common of factor. # # <b> Input : 18, 27</b> # # <b> return: 9 </b> # # # In[1]: # Get the smallest of the both inputs # Loop through the find the GCD# def gcd(x,y): small=min(x,y) for i in range(1,small+1): if(x % i == 0) and (y % i ==0): gcd=i return gcd print(gcd(18,27)) # In[6]: def gcd(x,y): small=min(x,y) print("x",x) print("y",y) print("small",small) for i in range(1,small+1): if x % i == 0 and y % i == 0: print("i",i) gcd=i return gcd print(gcd(18,27)) # <b>Euclidean Algorithm</b> # In[13]: def gcd(x,y): while(y): x , y = y,x % y return x print(gcd(18,27)) # #### Recursion # In[12]: def gcd(x,y): if(y == 0): return x else: return gcd(y,x % y) print(gcd(18,27)) # In[ ]:
def gcd(x, y): small = min(x, y) for i in range(1, small + 1): if x % i == 0 and y % i == 0: gcd = i return gcd print(gcd(18, 27)) def gcd(x, y): small = min(x, y) print('x', x) print('y', y) print('small', small) for i in range(1, small + 1): if x % i == 0 and y % i == 0: print('i', i) gcd = i return gcd print(gcd(18, 27)) def gcd(x, y): while y: (x, y) = (y, x % y) return x print(gcd(18, 27)) def gcd(x, y): if y == 0: return x else: return gcd(y, x % y) print(gcd(18, 27))
peple = ["gilbert", "david", "richard"] print("welcome to my parlor, " + peple[0]) print("welcome to my parlor, " + peple[1]) print("welcome to my parlor, " + peple[2]) print("richard is too stupid to come, so his not comming.") peple = ["gilbert", "david"] print("welcome to my parlor, " + peple[0]) print("welcome to my parlor, " + peple[1])
peple = ['gilbert', 'david', 'richard'] print('welcome to my parlor, ' + peple[0]) print('welcome to my parlor, ' + peple[1]) print('welcome to my parlor, ' + peple[2]) print('richard is too stupid to come, so his not comming.') peple = ['gilbert', 'david'] print('welcome to my parlor, ' + peple[0]) print('welcome to my parlor, ' + peple[1])
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) class PyNvidiaMlPy(PythonPackage): """Python Bindings for the NVIDIA Management Library.""" homepage = "http://www.nvidia.com/" url = "https://pypi.io/packages/source/n/nvidia-ml-py/nvidia-ml-py-11.450.51.tar.gz" version('11.450.51', sha256='5aa6dd23a140b1ef2314eee5ca154a45397b03e68fd9ebc4f72005979f511c73')
class Pynvidiamlpy(PythonPackage): """Python Bindings for the NVIDIA Management Library.""" homepage = 'http://www.nvidia.com/' url = 'https://pypi.io/packages/source/n/nvidia-ml-py/nvidia-ml-py-11.450.51.tar.gz' version('11.450.51', sha256='5aa6dd23a140b1ef2314eee5ca154a45397b03e68fd9ebc4f72005979f511c73')
BINDING_ADDRESS = ':1080' # <ADDRESS>:<PORT> BINDING_PORT = 1080 LOCAL_CERT_FILE = './local.pem' REMOTE_CERT_FILE = './remote.pem' BACKLOG = 128 LOG_LEVEL = 'info' BLOCK_SIZE = 2048 # in bytes STAFF_BINDING_ADDRESS = '127.0.0.1' STAFF_TCP_PORT = 32000 STAFF_UDP_PORT = 32000 STAFF_PROXY = '127.0.0.1:1080' # <ADDRESS>:<PORT> STAFF_DNS = '8.8.8.8:53,8.8.4.4:53' STAFF_DNS_TIMEOUT = 5.0 # in seconds STAFF_DNS_CACHE_SIZE = 0 # max size for the local dns cache
binding_address = ':1080' binding_port = 1080 local_cert_file = './local.pem' remote_cert_file = './remote.pem' backlog = 128 log_level = 'info' block_size = 2048 staff_binding_address = '127.0.0.1' staff_tcp_port = 32000 staff_udp_port = 32000 staff_proxy = '127.0.0.1:1080' staff_dns = '8.8.8.8:53,8.8.4.4:53' staff_dns_timeout = 5.0 staff_dns_cache_size = 0
def return_after_n_recursion_one(n): return_after_n_recursion_one(n-1) def return_after_n_recursion_two(n): if n < 3: # Base return: identify a condition after which you will start returning return 'Cap' return_after_n_recursion_two(n-1) def return_after_n_recursion(n): if n < 3: # Base return: identify a condition after which you will start returning return 'Cap' return return_after_n_recursion(n-1) # recursive return if __name__ == '__main__': # Stack overflow # print(return_after_n_recursion_one(5)) # return none print(return_after_n_recursion_two(5)) # correct fucntion print(return_after_n_recursion(5)) # recursive fucntions usually should have two returns # inside classes while recursively looping class variables that might not be the case
def return_after_n_recursion_one(n): return_after_n_recursion_one(n - 1) def return_after_n_recursion_two(n): if n < 3: return 'Cap' return_after_n_recursion_two(n - 1) def return_after_n_recursion(n): if n < 3: return 'Cap' return return_after_n_recursion(n - 1) if __name__ == '__main__': print(return_after_n_recursion_two(5)) print(return_after_n_recursion(5))
def KadaneAlgo(alist, start, end): #Returns (l, r, m) such that alist[l:r] is the maximum subarray in #A[start:end] with sum m. Here A[start:end] means all A[x] for start <= x < #end. max_ending_at_i = max_seen_so_far = alist[start] max_left_at_i = max_left_so_far = start # max_right_at_i is always i + 1 max_right_so_far = start + 1 for i in range(start + 1, end): if max_ending_at_i > 0: max_ending_at_i += alist[i] else: max_ending_at_i = alist[i] max_left_at_i = i if max_ending_at_i > max_seen_so_far: max_seen_so_far = max_ending_at_i max_left_so_far = max_left_at_i max_right_so_far = i + 1 return max_left_so_far, max_right_so_far, max_seen_so_far alist = input('Enter the elements: ') alist = alist.split() alist = [int(x) for x in alist] start, end, maximum = KadaneAlgo(alist, 0, len(alist)) print('The maximum subarray starts at index {}, ends at index {}' ' and has sum {}.'.format(start, end - 1, maximum))
def kadane_algo(alist, start, end): max_ending_at_i = max_seen_so_far = alist[start] max_left_at_i = max_left_so_far = start max_right_so_far = start + 1 for i in range(start + 1, end): if max_ending_at_i > 0: max_ending_at_i += alist[i] else: max_ending_at_i = alist[i] max_left_at_i = i if max_ending_at_i > max_seen_so_far: max_seen_so_far = max_ending_at_i max_left_so_far = max_left_at_i max_right_so_far = i + 1 return (max_left_so_far, max_right_so_far, max_seen_so_far) alist = input('Enter the elements: ') alist = alist.split() alist = [int(x) for x in alist] (start, end, maximum) = kadane_algo(alist, 0, len(alist)) print('The maximum subarray starts at index {}, ends at index {} and has sum {}.'.format(start, end - 1, maximum))
# to allow api client save environment state to database. SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer' # we use cached_db backend for longlive and fast sessions. SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db' SESSION_COOKIE_NAME = 'sid' SESSION_COOKIE_AGE = 86400 * 60 # 2 months. Very important to remember users. if PRODUCTION: SESSION_COOKIE_DOMAIN = '.{{project_name}}.com'
session_serializer = 'django.contrib.sessions.serializers.PickleSerializer' session_engine = 'django.contrib.sessions.backends.cached_db' session_cookie_name = 'sid' session_cookie_age = 86400 * 60 if PRODUCTION: session_cookie_domain = '.{{project_name}}.com'
class GraphNode(object): def __init__(self, val): self.value = val self.children = [] def add_child(self, new_node): self.children.append(new_node) def remove_child(self, del_node): if del_node in self.children: self.children.remove(del_node) class Graph(object): def __init__(self, node_list): self.nodes = node_list def _read_adjacent_list(self, adjacent_list): for elem in adjacent_list: self.nodes.add(elem[0]) self.nodes.add(elem[1]) self.add_edge(GraphNode(elem[0]), GraphNode(elem[0])) def edge_list(self): edge_list = list() # set give better result, but we use here 2D list visited = set() queue = [self.nodes[0]] # Visit graph using BFS while len(queue) > 0: current_node = queue.pop(0) visited.add(current_node) for child in current_node.children: # Since is an undirected graph, we check both ways source = current_node.value dest = child.value if [source, dest] not in edge_list and [dest, source] not in edge_list: edge_list.append([source, dest]) if child not in visited: queue.append(child) return edge_list def adjacent_list(self): adjacent_list = list() visited = set() queue = [self.nodes[0]] # Visit graph using BFS while len(queue) > 0: current_node = queue.pop(0) visited.add(current_node) node_adjacent_list = list() for child in current_node.children: node_adjacent_list.append(child.value) if child not in visited: queue.append(child) adjacent_list.append(node_adjacent_list) return adjacent_list def adjacent_matrix(self): node_list = [node.value for node in self.nodes] node_list.sort() matrix = list([[0 for x in range(len(node_list))] for x in range(len(node_list))]) visited = set() queue = [self.nodes[0]] # Visit graph using BFS while len(queue) > 0: current_node = queue.pop(0) visited.add(current_node) for child in current_node.children: # Since is an undirected graph, we check both ways source_idx = node_list.index(current_node.value) dest_idx = node_list.index(child.value) matrix[source_idx][dest_idx] = 1 matrix[dest_idx][source_idx] = 1 if child not in visited: queue.append(child) return node_list, matrix def add_edge(self, node1, node2): if(node1 in self.nodes and node2 in self.nodes): node1.add_child(node2) node2.add_child(node1) def remove_edge(self, node1, node2): if(node1 in self.nodes and node2 in self.nodes): node1.remove_child(node2) node2.remove_child(node1) def dfs_search(self, root_node, search_value): # Sets are faster for lookups visited = set() # Start with a given root node stack = [root_node] # Repeat until the stack is empty while len(stack) > 0: # Pop out a node added recently current_node = stack.pop() # Mark it as visited visited.add(current_node) if current_node.value == search_value: return current_node # Check all the neighbours for child in current_node.children: # If a node hasn't been visited and is not in the stack if (child not in visited) and (child not in stack): stack.append(child) def dfs_search_recursive(self, start_node, search_value): # Set to keep track of visited nodes visited = set() return self.__dfs_recursion(start_node, visited, search_value) def __dfs_recursion(self, node, visited, search_value): if node.value == search_value: # Don't search in other branches, if found = True found = True return node visited.add(node) found = False result = None # Conditional recurse on each neighbour for child in node.children: if (child not in visited): result = self.__dfs_recursion(child, visited, search_value) # Once the match is found, no more recurse if found: break return result def bfs_search(self, root_node, search_value): # Sets are faster for lookups visited = set() queue = [root_node] while len(queue) > 0: current_node = queue.pop(0) visited.add(current_node) if current_node.value == search_value: return current_node for child in current_node.children: if child not in visited: queue.append(child) # Helper functions def print_edge(edge_list): for edge in edge_list: print(f" - {edge}") def print_adjacent_list(adjacent_list): for neighbour in adjacent_list: print(f" - {neighbour}") def print_adjacent_matrix(nodes, matrix): # Print column headers print(" " + ' '.join(map(str, nodes))) index = 0 for row in matrix: print(f" {nodes[index]} " + ' '.join(map(str, row))) index += 1 # Test Cases nodeG = GraphNode('G') nodeR = GraphNode('R') nodeA = GraphNode('A') nodeP = GraphNode('P') nodeH = GraphNode('H') nodeS = GraphNode('S') graph1 = Graph([nodeS,nodeH,nodeG,nodeP,nodeR,nodeA] ) graph1.add_edge(nodeG,nodeR) graph1.add_edge(nodeA,nodeR) graph1.add_edge(nodeA,nodeG) graph1.add_edge(nodeR,nodeP) graph1.add_edge(nodeH,nodeG) graph1.add_edge(nodeH,nodeP) graph1.add_edge(nodeS,nodeR) # DFS Tests print("DFS") print(" Iterative version") print(" Search A from S: " + "Pass" if (graph1.dfs_search(nodeS, 'A') == nodeA) else " Fail") print(" Search S from S: " + "Pass" if (graph1.dfs_search(nodeS, 'S') == nodeS) else " Fail") print(" Search R from S: " + "Pass" if (graph1.dfs_search(nodeS, 'R') == nodeR) else " Fail") print(" Recoursive version") print(" Search A from G: " + "Pass" if (graph1.dfs_search_recursive(nodeG, 'A') == nodeA) else " Fail") print(" Search A from S: " + "Pass" if (graph1.dfs_search_recursive(nodeS, 'A') == nodeA) else " Fail") print(" Search S from P: " + "Pass" if (graph1.dfs_search_recursive(nodeP, 'S') == nodeS) else " Fail") print(" Search R from H: " + "Pass" if (graph1.dfs_search_recursive(nodeH, 'R') == nodeR) else " Fail") # BFS Tests print("BFS") print(" Search A from S: " + "Pass" if (graph1.bfs_search(nodeS, 'A') == nodeA) else " Fail") print(" Search S from P: " + "Pass" if (graph1.bfs_search(nodeP, 'S') == nodeS) else " Fail") print(" Search R from H: " + "Pass" if (graph1.bfs_search(nodeH, 'R') == nodeR) else " Fail") # Edge list tests print("Edge list representation") #print_edge(graph1.edge_list()) print(" Pass" if (graph1.edge_list() == [['S', 'R'], ['R', 'G'], ['R', 'A'], ['R', 'P'], ['G', 'A'], ['G', 'H'], ['P', 'H']]) else " Fail") # Adjacent list tests print("Adjacent list representation") #print_adjacent_list(graph1.adjacent_list()) print(" Pass" if (graph1.adjacent_list() == [['R'], ['G', 'A', 'P', 'S'], ['R', 'A', 'H'], ['R', 'G'], ['R', 'H'], ['R', 'G'], ['G', 'P'], ['G', 'P']]) else " Fail") # Adjacent matrix tests print("Adjacent matrix representation") nodes, matrix = graph1.adjacent_matrix() #print_adjacent_matrix(nodes, matrix) print(" Pass" if (matrix == [[0, 1, 0, 0, 1, 0], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0], [0, 0, 1, 0, 1, 0], [1, 1, 0, 1, 0, 1], [0, 0, 0, 0, 1, 0]]) else " Fail")
class Graphnode(object): def __init__(self, val): self.value = val self.children = [] def add_child(self, new_node): self.children.append(new_node) def remove_child(self, del_node): if del_node in self.children: self.children.remove(del_node) class Graph(object): def __init__(self, node_list): self.nodes = node_list def _read_adjacent_list(self, adjacent_list): for elem in adjacent_list: self.nodes.add(elem[0]) self.nodes.add(elem[1]) self.add_edge(graph_node(elem[0]), graph_node(elem[0])) def edge_list(self): edge_list = list() visited = set() queue = [self.nodes[0]] while len(queue) > 0: current_node = queue.pop(0) visited.add(current_node) for child in current_node.children: source = current_node.value dest = child.value if [source, dest] not in edge_list and [dest, source] not in edge_list: edge_list.append([source, dest]) if child not in visited: queue.append(child) return edge_list def adjacent_list(self): adjacent_list = list() visited = set() queue = [self.nodes[0]] while len(queue) > 0: current_node = queue.pop(0) visited.add(current_node) node_adjacent_list = list() for child in current_node.children: node_adjacent_list.append(child.value) if child not in visited: queue.append(child) adjacent_list.append(node_adjacent_list) return adjacent_list def adjacent_matrix(self): node_list = [node.value for node in self.nodes] node_list.sort() matrix = list([[0 for x in range(len(node_list))] for x in range(len(node_list))]) visited = set() queue = [self.nodes[0]] while len(queue) > 0: current_node = queue.pop(0) visited.add(current_node) for child in current_node.children: source_idx = node_list.index(current_node.value) dest_idx = node_list.index(child.value) matrix[source_idx][dest_idx] = 1 matrix[dest_idx][source_idx] = 1 if child not in visited: queue.append(child) return (node_list, matrix) def add_edge(self, node1, node2): if node1 in self.nodes and node2 in self.nodes: node1.add_child(node2) node2.add_child(node1) def remove_edge(self, node1, node2): if node1 in self.nodes and node2 in self.nodes: node1.remove_child(node2) node2.remove_child(node1) def dfs_search(self, root_node, search_value): visited = set() stack = [root_node] while len(stack) > 0: current_node = stack.pop() visited.add(current_node) if current_node.value == search_value: return current_node for child in current_node.children: if child not in visited and child not in stack: stack.append(child) def dfs_search_recursive(self, start_node, search_value): visited = set() return self.__dfs_recursion(start_node, visited, search_value) def __dfs_recursion(self, node, visited, search_value): if node.value == search_value: found = True return node visited.add(node) found = False result = None for child in node.children: if child not in visited: result = self.__dfs_recursion(child, visited, search_value) if found: break return result def bfs_search(self, root_node, search_value): visited = set() queue = [root_node] while len(queue) > 0: current_node = queue.pop(0) visited.add(current_node) if current_node.value == search_value: return current_node for child in current_node.children: if child not in visited: queue.append(child) def print_edge(edge_list): for edge in edge_list: print(f' - {edge}') def print_adjacent_list(adjacent_list): for neighbour in adjacent_list: print(f' - {neighbour}') def print_adjacent_matrix(nodes, matrix): print(' ' + ' '.join(map(str, nodes))) index = 0 for row in matrix: print(f' {nodes[index]} ' + ' '.join(map(str, row))) index += 1 node_g = graph_node('G') node_r = graph_node('R') node_a = graph_node('A') node_p = graph_node('P') node_h = graph_node('H') node_s = graph_node('S') graph1 = graph([nodeS, nodeH, nodeG, nodeP, nodeR, nodeA]) graph1.add_edge(nodeG, nodeR) graph1.add_edge(nodeA, nodeR) graph1.add_edge(nodeA, nodeG) graph1.add_edge(nodeR, nodeP) graph1.add_edge(nodeH, nodeG) graph1.add_edge(nodeH, nodeP) graph1.add_edge(nodeS, nodeR) print('DFS') print(' Iterative version') print(' Search A from S: ' + 'Pass' if graph1.dfs_search(nodeS, 'A') == nodeA else ' Fail') print(' Search S from S: ' + 'Pass' if graph1.dfs_search(nodeS, 'S') == nodeS else ' Fail') print(' Search R from S: ' + 'Pass' if graph1.dfs_search(nodeS, 'R') == nodeR else ' Fail') print(' Recoursive version') print(' Search A from G: ' + 'Pass' if graph1.dfs_search_recursive(nodeG, 'A') == nodeA else ' Fail') print(' Search A from S: ' + 'Pass' if graph1.dfs_search_recursive(nodeS, 'A') == nodeA else ' Fail') print(' Search S from P: ' + 'Pass' if graph1.dfs_search_recursive(nodeP, 'S') == nodeS else ' Fail') print(' Search R from H: ' + 'Pass' if graph1.dfs_search_recursive(nodeH, 'R') == nodeR else ' Fail') print('BFS') print(' Search A from S: ' + 'Pass' if graph1.bfs_search(nodeS, 'A') == nodeA else ' Fail') print(' Search S from P: ' + 'Pass' if graph1.bfs_search(nodeP, 'S') == nodeS else ' Fail') print(' Search R from H: ' + 'Pass' if graph1.bfs_search(nodeH, 'R') == nodeR else ' Fail') print('Edge list representation') print(' Pass' if graph1.edge_list() == [['S', 'R'], ['R', 'G'], ['R', 'A'], ['R', 'P'], ['G', 'A'], ['G', 'H'], ['P', 'H']] else ' Fail') print('Adjacent list representation') print(' Pass' if graph1.adjacent_list() == [['R'], ['G', 'A', 'P', 'S'], ['R', 'A', 'H'], ['R', 'G'], ['R', 'H'], ['R', 'G'], ['G', 'P'], ['G', 'P']] else ' Fail') print('Adjacent matrix representation') (nodes, matrix) = graph1.adjacent_matrix() print(' Pass' if matrix == [[0, 1, 0, 0, 1, 0], [1, 0, 1, 0, 1, 0], [0, 1, 0, 1, 0, 0], [0, 0, 1, 0, 1, 0], [1, 1, 0, 1, 0, 1], [0, 0, 0, 0, 1, 0]] else ' Fail')
x = 'Hello "Prayuth"' # Single-Quote y = "Good Bye! 'Prayuth'" # Double-Quote z = x + y print(x) print(y) print(z)
x = 'Hello "Prayuth"' y = "Good Bye! 'Prayuth'" z = x + y print(x) print(y) print(z)
# built in def hammingWeight(self, n): """ :type n: int :rtype: int """ return bin(n).count('1') # Using bit operation to cancel a 1 in each round # Think of a number in binary n = XXXXXX1000, n - 1 is XXXXXX0111. n & (n - 1) will be XXXXXX0000 # which is just remove the last significant 1 def hammingWeight(self, n): """ :type n: int :rtype: int """ c = 0 while n: n &= n - 1 c += 1 return c class Solution: def hammingWeight(self, n: int) -> int: ans=0 while n>0: if n%2==1: ans+=1 n=n//2 return ans # Time: O(1) # Space:O(1) # use bit manipulation def hammingWeight(self, n: int) -> int: out = 0 while n > 0: # n & 1 means n%2 if n & 1: out += 1 # n>>=1 means n//2 n >>= 1 return out
def hamming_weight(self, n): """ :type n: int :rtype: int """ return bin(n).count('1') def hamming_weight(self, n): """ :type n: int :rtype: int """ c = 0 while n: n &= n - 1 c += 1 return c class Solution: def hamming_weight(self, n: int) -> int: ans = 0 while n > 0: if n % 2 == 1: ans += 1 n = n // 2 return ans def hamming_weight(self, n: int) -> int: out = 0 while n > 0: if n & 1: out += 1 n >>= 1 return out
class Solution: def findMedianSortedArrays(self, nums1, nums2) -> float: x = len(nums1) y = len(nums2) if y < x: # Making sure nums1 is the smaller length array return self.findMedianSortedArrays(nums2, nums1) maxV = float('inf') minV = float('-inf') start, end, median = 0, x, 0 # We know # partitionx + partitiony = (x+y+1)//2 while start <= end: # px -> partitionx and py -> partitiony px = start + (end - start) // 2 py = (x + y + 1) // 2 - px # leftx, rightx -> edge elements on nums1 # lefty, righty -> edge elements on nums2 leftx, rightx, lefty, righty = 0, 0, 0, 0 leftx = minV if px == 0 else nums1[px - 1] rightx = maxV if px == x else nums1[px] lefty = minV if py == 0 else nums2[py - 1] righty = maxV if py == y else nums2[py] if leftx <= righty and lefty <= rightx: # We found the spot for median if (x + y) % 2 == 0: median = (max(leftx, lefty) + min(rightx, righty)) / 2 return median else: median = max(leftx, lefty) return median elif leftx > righty: # We are too much in the right, move towards left end = px - 1 else: # We are too much in the left, move towards right start = px + 1 return -1
class Solution: def find_median_sorted_arrays(self, nums1, nums2) -> float: x = len(nums1) y = len(nums2) if y < x: return self.findMedianSortedArrays(nums2, nums1) max_v = float('inf') min_v = float('-inf') (start, end, median) = (0, x, 0) while start <= end: px = start + (end - start) // 2 py = (x + y + 1) // 2 - px (leftx, rightx, lefty, righty) = (0, 0, 0, 0) leftx = minV if px == 0 else nums1[px - 1] rightx = maxV if px == x else nums1[px] lefty = minV if py == 0 else nums2[py - 1] righty = maxV if py == y else nums2[py] if leftx <= righty and lefty <= rightx: if (x + y) % 2 == 0: median = (max(leftx, lefty) + min(rightx, righty)) / 2 return median else: median = max(leftx, lefty) return median elif leftx > righty: end = px - 1 else: start = px + 1 return -1
def substring_match(T, S): """ Simple substring matching. O(|S| * |T - S|) Time O(1) Space """ return any([T[idx:idx+len(S)] == S for idx in range(len(T) - len(S) + 1)]) """ for idx in range(len(T) - len(S) + 1): print(T[idx:idx + len(S)], S) if T[idx:idx + len(S)] == S: return True return False """ if __name__=="__main__": print("Expect True ", substring_match('hello world', 'hello')) print("Expect True ", substring_match('hello world', 'world')) print("Expect True ", substring_match('hello world', 'wor')) print("Expect False ", substring_match('hello world', 'blue')) print("Expect False ",substring_match('hello world', 'word'))
def substring_match(T, S): """ Simple substring matching. O(|S| * |T - S|) Time O(1) Space """ return any([T[idx:idx + len(S)] == S for idx in range(len(T) - len(S) + 1)]) '\n for idx in range(len(T) - len(S) + 1):\n print(T[idx:idx + len(S)], S)\n if T[idx:idx + len(S)] == S:\n return True\n return False\n' if __name__ == '__main__': print('Expect True ', substring_match('hello world', 'hello')) print('Expect True ', substring_match('hello world', 'world')) print('Expect True ', substring_match('hello world', 'wor')) print('Expect False ', substring_match('hello world', 'blue')) print('Expect False ', substring_match('hello world', 'word'))
def user_has_reporting_location(user): sql_location = user.sql_location if not sql_location: return False return not sql_location.location_type.administrative
def user_has_reporting_location(user): sql_location = user.sql_location if not sql_location: return False return not sql_location.location_type.administrative
class Solution: def canCompleteCircuit(self, gas, cost): sum = 0 total = 0 start = 0 for i in range(len(gas)): total += (gas[i] - cost[i]) if sum < 0: sum = gas[i] - cost[i] start = i else: sum += (gas[i] - cost[i]) return start if total >= 0 else -1 if __name__ == "__main__": solution = Solution() print(solution.canCompleteCircuit([1,2,3,4,5], [3,4,5,1,2])) print(solution.canCompleteCircuit([2,3,4], [3,4,3]))
class Solution: def can_complete_circuit(self, gas, cost): sum = 0 total = 0 start = 0 for i in range(len(gas)): total += gas[i] - cost[i] if sum < 0: sum = gas[i] - cost[i] start = i else: sum += gas[i] - cost[i] return start if total >= 0 else -1 if __name__ == '__main__': solution = solution() print(solution.canCompleteCircuit([1, 2, 3, 4, 5], [3, 4, 5, 1, 2])) print(solution.canCompleteCircuit([2, 3, 4], [3, 4, 3]))
""" Author: Xavid Ramirez Email: xavid.ramirez01@utrgv.edu Date: November 2, 2016 Desc: Hamming word encoding and decoding program. The python program Will take either a set of bits to encode or decode. Encode will encode the bits into Hamming Encoding. Decoding will check the given bits, check the parities, fix parities if needed, return the correct word, and return the unencoded bit word. Dependencies: Python 3 License: MIT """ class Hamming: def __init__(self): self.query() def query(self): """ Prompt user if they would like to encode or decode, then begin process for that subclass """ command = input("Would you like to Encode or Decode? ") if "encode" in command.lower(): bits = input("Please enter the bit word to be encoded in hamming code: ") data = Encode(bits) data.start() elif "decode" in command.lower(): bits = input("\nPlease enter the bit word to be decoded in hamming code: ") print("\n") data = Decode(bits) data.analyze() else: #If user enters invalid command, run to here and close program. print("You entered an invalid command!") class Encode: def __init__(self,bits=None): self.bits = list(bits) if bits != None else bits self.blank = True if bits == None else False self.MaxParity = self.encode_FindLargestParity() self.ErrorLog = [] def encode(self,P): """ Function to encode the given Parity for given bits """ pData = [] if P == 1: #If parity bit is 1, then use slicing on the list to get the parity bits (every other bit, remove first bit) pData.extend(self.bits[::P+1]) pData.pop(0) self.encode_setParityBit(pData,P) elif P in [2,4,8,16,32,64,128,256]: #For given Parity bit in range, and for range in j to p, pull out the bits for that parity # EX: Parity 2 => take two, ignore two, take two, ignore 2 etc... # EX: Parity 4 => take four, ignore four, take four, ignore 4 etc.. for i in range( (P-1), len(self.bits), (P*2) ): for j in range(0,P): try: pData.append(self.bits[i+j]) except IndexError: #Exception for index out of range to ErrorLog list of errors, just for logging purposes #List is known to hit out of range for large parity bits self.ErrorLog.append("During parity bit" + str(P) +" check. Index out of range at " + str(i+j)) #Pop the first bit, as it is the parity, we need to find this parity, not encode it and it is set to NONE here pData.pop(0) #Run the encoding function for given Parity bit P self.encode_setParityBit(pData,P) def start(self): """ Prepair the list for encoding """ """ 1. For every location for a possible Parity, insert None into that specific location, shifting the next bit to the following location 2. Now for every parity up to the Maximum Parity for the given bits, encode the Parity bit (find the parity for sequence) 3. Print out the encoded output """ prepped = [] prepped.extend(self.bits) for i in [1,2,4,8,16,32,64,128,256]: if i < self.MaxParity: prepped.insert(i-1,None) elif i == self.MaxParity: prepped.insert(i-1,None) break self.bits = prepped for i in [1,2,4,8,16,32,64,128,256]: if i == self.MaxParity: self.encode(i) break elif i == 1: self.encode(1) else: self.encode(i) print("Encoding Complete...\n") output = ''.join(self.bits) print("Output => " + output) def encode_setParityBit(self,pData,P): """ Encode the parity bit """ #If number of 1's in parity bit sequence are even seto P to 0 #otherwise set P to 1 if pData.count('1') % 2 == 0: self.bits[P-1] = '0' elif pData.count('1') % 2 != 0: self.bits[P-1] = '1' def encode_FindLargestParity(self): """For given range of bits, find the largest Possible Parity for given number of bits """ for i in [256,128,64,32,16,8,4,2,1]: if i <= len(self.bits): return i class Decode: def __init__(self, bits=None): self.bits = list(bits) if bits != None else bits self.blank = True if bits == None else False self.error = False self.errorBit = 0 self.MaxParity = self.decode_FindLargestParity() self.ErrorLog = [] self.parityBits = [] def decode_FindLargestParity(self): """ Find the largest possible parity for given bits """ maxP = 0 for i in [1,2,4,8,16,32,64,128,256]: if len(self.bits) - i >= 0: maxP = i return maxP def analyze(self): """ Decode the list for each parity up to the max parity possible for given bit sequence """ for i in [1,2,4,8,16,32,64,128,256]: if i == self.MaxParity: self.decode(i) break else: self.decode(i) """If there is an error, self.erroBit should contain the error bit, go and fix it, then re-analyze Other wise, the test is complete, go give out the decoded bits """ if self.error == True: self.error = False print("\nError found in bit " + str(self.errorBit) + "... Fixing Error...\n") self.FixError() print("Rerunning parity analysis....") self.analyze() else: print("\nTest Complete!") print("\nCorrected encoded bits => " + ''.join(self.bits)) #Go print out decoded word self.outputDecodedWord() def outputDecodedWord(self): """ Print out decoded bit sequence """ output = self.bits for i in [256,128,64,32,16,8,4,2,1]: if i <= self.MaxParity: output.pop(i-1) output = ''.join(output) print("Decoded bits => " + output) def decode(self,P): """Decode""" pData = [] pVal = 0 if P == 1: #If parity bit is 1, then use slicing on the list to get the parity bits (every other bit, remove first bit) pData.extend(self.bits[::P+1]) pVal = pData[0] pData.pop(0) self.parityAnalysis(pData,P,pVal) elif P in [2,4,8,16,32,64,128,256]: #For given Parity bit in range, and for range in j to p, pull out the bits for that parity # EX: Parity 2 => take two, ignore two, take two, ignore 2 etc... # EX: Parity 4 => take four, ignore four, take four, ignore 4 etc.. for i in range( (P-1), len(self.bits), (P*2) ): for j in range(0, P): try: pData.append(self.bits[i+j]) except IndexError: self.ErrorLog.append("During parity bit" + str(P) +" check. Index out of range at " + str(i+j)) pVal = pData[0] #Pop the first bit, this is the bit that will be analyzed and corected if needed. pData.pop(0) self.parityAnalysis(pData,P,pVal) def parityAnalysis(self, pData, P, pVal): """ This function alayzes the sequence for a Given parity, the value of the parity and marks erro if Parity is incorrect """ print("Data for Parity Bit " + str(P) + " = { " + str(pData) + " }") print("P" + str(P) + " currently = " + str(pVal)) """ If number of 1's are odd and Parity is 1 then there is no error If number of 1's are even and Parity is 0 then there is no error Otherwise it is Incorrect, mark error flag Calculate the errorBit """ if pData.count('1') % 2 == 0 and pVal == '0': print("Parity Bit " + str(P) + " is Correct...\n") elif pData.count('1') % 2 != 0 and pVal == '1': print("Parity Bit " + str(P) + " is Correct...\n") else: print("Parity Bit " + str(P) + " is Incorrect!\n") self.errorBit += (int(pVal) * int(P)) self.error = True def FixError(self): """ Flip the value of the Error bit """ if self.bits[self.errorBit] == '1': self.bits[self.errorBit] = '0' else: self.bits[self.errorBit] = '1' def main(): hamming = Hamming() if __name__ == '__main__': main()
""" Author: Xavid Ramirez Email: xavid.ramirez01@utrgv.edu Date: November 2, 2016 Desc: Hamming word encoding and decoding program. The python program Will take either a set of bits to encode or decode. Encode will encode the bits into Hamming Encoding. Decoding will check the given bits, check the parities, fix parities if needed, return the correct word, and return the unencoded bit word. Dependencies: Python 3 License: MIT """ class Hamming: def __init__(self): self.query() def query(self): """ Prompt user if they would like to encode or decode, then begin process for that subclass """ command = input('Would you like to Encode or Decode? ') if 'encode' in command.lower(): bits = input('Please enter the bit word to be encoded in hamming code: ') data = encode(bits) data.start() elif 'decode' in command.lower(): bits = input('\nPlease enter the bit word to be decoded in hamming code: ') print('\n') data = decode(bits) data.analyze() else: print('You entered an invalid command!') class Encode: def __init__(self, bits=None): self.bits = list(bits) if bits != None else bits self.blank = True if bits == None else False self.MaxParity = self.encode_FindLargestParity() self.ErrorLog = [] def encode(self, P): """ Function to encode the given Parity for given bits """ p_data = [] if P == 1: pData.extend(self.bits[::P + 1]) pData.pop(0) self.encode_setParityBit(pData, P) elif P in [2, 4, 8, 16, 32, 64, 128, 256]: for i in range(P - 1, len(self.bits), P * 2): for j in range(0, P): try: pData.append(self.bits[i + j]) except IndexError: self.ErrorLog.append('During parity bit' + str(P) + ' check. Index out of range at ' + str(i + j)) pData.pop(0) self.encode_setParityBit(pData, P) def start(self): """ Prepair the list for encoding """ '\n\t\t\t1. For every location for a possible Parity,\n\t\t\tinsert None into that specific location, shifting\n\t\t\tthe next bit to the following location\n\t\t\t2. Now for every parity up to the Maximum Parity for\n\t\t\tthe given bits, encode the Parity bit (find the parity for sequence)\n\t\t\t3. Print out the encoded output\n\t\t' prepped = [] prepped.extend(self.bits) for i in [1, 2, 4, 8, 16, 32, 64, 128, 256]: if i < self.MaxParity: prepped.insert(i - 1, None) elif i == self.MaxParity: prepped.insert(i - 1, None) break self.bits = prepped for i in [1, 2, 4, 8, 16, 32, 64, 128, 256]: if i == self.MaxParity: self.encode(i) break elif i == 1: self.encode(1) else: self.encode(i) print('Encoding Complete...\n') output = ''.join(self.bits) print('Output => ' + output) def encode_set_parity_bit(self, pData, P): """ Encode the parity bit """ if pData.count('1') % 2 == 0: self.bits[P - 1] = '0' elif pData.count('1') % 2 != 0: self.bits[P - 1] = '1' def encode__find_largest_parity(self): """For given range of bits, find the largest Possible Parity for given number of bits """ for i in [256, 128, 64, 32, 16, 8, 4, 2, 1]: if i <= len(self.bits): return i class Decode: def __init__(self, bits=None): self.bits = list(bits) if bits != None else bits self.blank = True if bits == None else False self.error = False self.errorBit = 0 self.MaxParity = self.decode_FindLargestParity() self.ErrorLog = [] self.parityBits = [] def decode__find_largest_parity(self): """ Find the largest possible parity for given bits """ max_p = 0 for i in [1, 2, 4, 8, 16, 32, 64, 128, 256]: if len(self.bits) - i >= 0: max_p = i return maxP def analyze(self): """ Decode the list for each parity up to the max parity possible for given bit sequence """ for i in [1, 2, 4, 8, 16, 32, 64, 128, 256]: if i == self.MaxParity: self.decode(i) break else: self.decode(i) 'If there is an error, self.erroBit should contain the error bit, go and fix it, then re-analyze\n\t\t\tOther wise, the test is complete, go give out the decoded bits\n\t\t' if self.error == True: self.error = False print('\nError found in bit ' + str(self.errorBit) + '... Fixing Error...\n') self.FixError() print('Rerunning parity analysis....') self.analyze() else: print('\nTest Complete!') print('\nCorrected encoded bits => ' + ''.join(self.bits)) self.outputDecodedWord() def output_decoded_word(self): """ Print out decoded bit sequence """ output = self.bits for i in [256, 128, 64, 32, 16, 8, 4, 2, 1]: if i <= self.MaxParity: output.pop(i - 1) output = ''.join(output) print('Decoded bits => ' + output) def decode(self, P): """Decode""" p_data = [] p_val = 0 if P == 1: pData.extend(self.bits[::P + 1]) p_val = pData[0] pData.pop(0) self.parityAnalysis(pData, P, pVal) elif P in [2, 4, 8, 16, 32, 64, 128, 256]: for i in range(P - 1, len(self.bits), P * 2): for j in range(0, P): try: pData.append(self.bits[i + j]) except IndexError: self.ErrorLog.append('During parity bit' + str(P) + ' check. Index out of range at ' + str(i + j)) p_val = pData[0] pData.pop(0) self.parityAnalysis(pData, P, pVal) def parity_analysis(self, pData, P, pVal): """ This function alayzes the sequence for a Given parity, the value of the parity and marks erro if Parity is incorrect """ print('Data for Parity Bit ' + str(P) + ' = { ' + str(pData) + ' }') print('P' + str(P) + ' currently = ' + str(pVal)) "\n\t\t\tIf number of 1's are odd and Parity is 1 then there is no error\n\t\t\tIf number of 1's are even and Parity is 0 then there is no error\n\t\t\tOtherwise it is Incorrect, mark error flag\n\t\t\tCalculate the errorBit\n\t\t" if pData.count('1') % 2 == 0 and pVal == '0': print('Parity Bit ' + str(P) + ' is Correct...\n') elif pData.count('1') % 2 != 0 and pVal == '1': print('Parity Bit ' + str(P) + ' is Correct...\n') else: print('Parity Bit ' + str(P) + ' is Incorrect!\n') self.errorBit += int(pVal) * int(P) self.error = True def fix_error(self): """ Flip the value of the Error bit """ if self.bits[self.errorBit] == '1': self.bits[self.errorBit] = '0' else: self.bits[self.errorBit] = '1' def main(): hamming = hamming() if __name__ == '__main__': main()
def encrypt(text,s): result = "" # transverse the plain text for i in range(len(text)): char = text[i] # Encrypt uppercase characters in plain text if (char.isupper()): result += chr((ord(char) + s-65) % 26 + 65) # Encrypt lowercase characters in plain text else: result += chr((ord(char) + s - 97) % 26 + 97) return result #check the above function text = "ATTACKATONCYE" s = 4 print ("Plain Text : " + text) print ("Shift pattern : " + str(s)) print ("Cipher: " + encrypt(text,s))
def encrypt(text, s): result = '' for i in range(len(text)): char = text[i] if char.isupper(): result += chr((ord(char) + s - 65) % 26 + 65) else: result += chr((ord(char) + s - 97) % 26 + 97) return result text = 'ATTACKATONCYE' s = 4 print('Plain Text : ' + text) print('Shift pattern : ' + str(s)) print('Cipher: ' + encrypt(text, s))
def amount_of_elements_smaller(matrix, i, j): '''Count the amount of elements smaller than m[i][j] in the (square) matrix. Each column and row is sorted in ascending order. >>> amount_of_elements_smaller([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 1, 1) 4 ''' size = len(matrix) assert size == len(matrix[0]) split = matrix[i][j] jdx = size - 1 amount = 0 for idx in range(size): while matrix[idx][jdx] >= split: jdx -= 1 if jdx < 0: return amount amount += jdx + 1 return amount
def amount_of_elements_smaller(matrix, i, j): """Count the amount of elements smaller than m[i][j] in the (square) matrix. Each column and row is sorted in ascending order. >>> amount_of_elements_smaller([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 1, 1) 4 """ size = len(matrix) assert size == len(matrix[0]) split = matrix[i][j] jdx = size - 1 amount = 0 for idx in range(size): while matrix[idx][jdx] >= split: jdx -= 1 if jdx < 0: return amount amount += jdx + 1 return amount
class FieldTypeError(Exception): """Value has wrong datatype""" pass class ToManyMatchesError(Exception): """Found multiple Nodes instead of one.""" pass class DoesNotExist(Exception): """Object Does not exist.""" pass class RelationshipMatchError(Exception): """Err with Relationships.""" pass class DeletionError(Exception): """Err by deleting an instance"""
class Fieldtypeerror(Exception): """Value has wrong datatype""" pass class Tomanymatcheserror(Exception): """Found multiple Nodes instead of one.""" pass class Doesnotexist(Exception): """Object Does not exist.""" pass class Relationshipmatcherror(Exception): """Err with Relationships.""" pass class Deletionerror(Exception): """Err by deleting an instance"""
# coding: utf-8 # __The Data Set__ # In[1]: r = open('la_weather.csv', 'r') # In[2]: w = r.read() # In[3]: w_list = w.split('\n') # In[4]: weather = [] for w in w_list: wt = w.split(',') weather.append(wt) weather[:5] # In[5]: del weather[0] # In[6]: col_weather = [] for w in weather: col_weather.append(w[1]) col_weather[:5] # - Assign the first element of `col_weather` to `first_element` and display it using the `print()` function. # - Assign the last element of `col_weather` to `last_element` and display it using the `print()` function. # In[7]: first_element = col_weather[0] first_element # In[8]: last_element = col_weather[len(col_weather) - 1] last_element # __Dictionaries__ # In[9]: students = ['Tom','Jim','Sue','Ann'] scores = [70,80,85,75] # In[10]: indexes = [0,1,2,3] name = 'Sue' score = 0 for i in indexes: if students[i] == name: score = scores[i] print(score) # In[11]: # Make an empty dictionary like this: scores = {'Tom':70,'Jime':80,'Sue':85,'Ann':75} # In[12]: scores['Tom'] # __Practice populating a Dictionary__ # In[13]: superhero_ranks = {'Aquaman':1, 'Seperman':2} # In[14]: president_ranks = {} president_ranks["FDR"] = 1 president_ranks["Lincoln"] = 2 president_ranks["Aquaman"] = 3 fdr_rank = president_ranks["FDR"] lincoln_rank = president_ranks["Lincoln"] aquaman_rank = president_ranks["Aquaman"] # __Defining a Dictionary with Values__ # In[15]: random_values = {"key1": 10, "key2": "indubitably", "key3": "dataquest", 3: 5.6} # In[16]: random_values # In[17]: # Create a dictionary named `animals` animals = {7:'raven', 8:'goose', 9:'duck'} # In[18]: animals # In[19]: # Create a dictionary named `times` times = {'morning': 8, 'afternoon': 14, 'evening': 19, 'night': 23} times # __Modifying Dictionary Values__ # In[20]: students = { "Tom": 60, "Jim": 70 } # In[21]: # Add the key `Ann` and value 85 to the dictionary students students['Ann'] = 85 # In[22]: students # In[23]: # Replace the value for the key Tom with 80 students['Tom'] = 80 # In[24]: # Add 5 to the value for the key Jim students['Jim'] = students['Jim'] + 5 # In[25]: students # __The In Statement and Dictionaries__ # In[26]: planet_numbers = {"mercury": 1, "venus": 2, "earth": 3, "mars": 4} # In[27]: # Check whether `jupiter` is a key in `planet_numbers` jupiter_found = 'jupiter' in planet_numbers # In[28]: jupiter_found # In[29]: earth_found = 'earth' in planet_numbers # In[30]: earth_found # __The Else Statement__ # ```python # if temperature > 50: # print("It's hot!") # else: # print("It's cold!") # ``` # __Practicing with the Else Statement__ # In[31]: scores = [80, 100, 60, 30] high_scores = [] low_scores = [] for score in scores: if score > 70: high_scores.append(score) else: low_scores.append(score) # In[32]: high_scores # In[33]: low_scores # In[34]: planet_names = ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Neptune", "Uranus"] short_names = [] long_names = [] for name in planet_names: if len(name) > 5: long_names.append(name) else: short_names.append(name) # In[35]: short_names # In[36]: long_names # __Counting with Dictionaries__ # In[37]: pantry = ["apple", "orange", "grape", "apple", "orange", "apple", "tomato", "potato", "grape"] # In[38]: pantry_counts = {} for item in pantry: if item in pantry_counts: pantry_counts[item] += 1 else: pantry_counts[item] = 1 # In[39]: pantry_counts # In[40]: #print key and values for key, value in pantry_counts.items(): print(key, value) # __Counting the Weather__ # # - Count how many times each type of weather occurs in the `col_weather` list, and store the results in a new dictionary called `weather_counts`. # - When finished, `weather_counts` should contain a key for each different type of weather in the `weather` list, along with its associated frequency. Here's a preview of how the result should format the `weather_counts` dictionary. # In[41]: weather_counts = {} for weather in col_weather: if weather in weather_counts: weather_counts[weather] += 1 else: weather_counts[weather] = 1 # In[42]: weather_counts
r = open('la_weather.csv', 'r') w = r.read() w_list = w.split('\n') weather = [] for w in w_list: wt = w.split(',') weather.append(wt) weather[:5] del weather[0] col_weather = [] for w in weather: col_weather.append(w[1]) col_weather[:5] first_element = col_weather[0] first_element last_element = col_weather[len(col_weather) - 1] last_element students = ['Tom', 'Jim', 'Sue', 'Ann'] scores = [70, 80, 85, 75] indexes = [0, 1, 2, 3] name = 'Sue' score = 0 for i in indexes: if students[i] == name: score = scores[i] print(score) scores = {'Tom': 70, 'Jime': 80, 'Sue': 85, 'Ann': 75} scores['Tom'] superhero_ranks = {'Aquaman': 1, 'Seperman': 2} president_ranks = {} president_ranks['FDR'] = 1 president_ranks['Lincoln'] = 2 president_ranks['Aquaman'] = 3 fdr_rank = president_ranks['FDR'] lincoln_rank = president_ranks['Lincoln'] aquaman_rank = president_ranks['Aquaman'] random_values = {'key1': 10, 'key2': 'indubitably', 'key3': 'dataquest', 3: 5.6} random_values animals = {7: 'raven', 8: 'goose', 9: 'duck'} animals times = {'morning': 8, 'afternoon': 14, 'evening': 19, 'night': 23} times students = {'Tom': 60, 'Jim': 70} students['Ann'] = 85 students students['Tom'] = 80 students['Jim'] = students['Jim'] + 5 students planet_numbers = {'mercury': 1, 'venus': 2, 'earth': 3, 'mars': 4} jupiter_found = 'jupiter' in planet_numbers jupiter_found earth_found = 'earth' in planet_numbers earth_found scores = [80, 100, 60, 30] high_scores = [] low_scores = [] for score in scores: if score > 70: high_scores.append(score) else: low_scores.append(score) high_scores low_scores planet_names = ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn', 'Neptune', 'Uranus'] short_names = [] long_names = [] for name in planet_names: if len(name) > 5: long_names.append(name) else: short_names.append(name) short_names long_names pantry = ['apple', 'orange', 'grape', 'apple', 'orange', 'apple', 'tomato', 'potato', 'grape'] pantry_counts = {} for item in pantry: if item in pantry_counts: pantry_counts[item] += 1 else: pantry_counts[item] = 1 pantry_counts for (key, value) in pantry_counts.items(): print(key, value) weather_counts = {} for weather in col_weather: if weather in weather_counts: weather_counts[weather] += 1 else: weather_counts[weather] = 1 weather_counts
URL_CONFIG ="www.python.org" DEFAULT_VALUE = 1 DEFAULT_CONSTANT = 0
url_config = 'www.python.org' default_value = 1 default_constant = 0
class Solution: def reverse(self, x: int) -> int: negative = x<0 x = abs(x) reversed = 0 while x!= 0: reversed = reversed*10 + x%10 x //= 10 if reversed > 2**31-1: return 0 return reversed if not negative else -reversed
class Solution: def reverse(self, x: int) -> int: negative = x < 0 x = abs(x) reversed = 0 while x != 0: reversed = reversed * 10 + x % 10 x //= 10 if reversed > 2 ** 31 - 1: return 0 return reversed if not negative else -reversed
""" modules for income tax """ # import datetime class TaxReturn: """ Tax return class """ def hello(self, x): print("hello ", x) print("Hi") taxreturn = TaxReturn() taxreturn.hello("monkey")
""" modules for income tax """ class Taxreturn: """ Tax return class """ def hello(self, x): print('hello ', x) print('Hi') taxreturn = tax_return() taxreturn.hello('monkey')
# type: ignore __all__ = [ "meshc", "barh", "trisurf", "compass", "isonormals", "plotutils", "ezcontour", "streamslice", "scatter", "rgb2ind", "usev6plotapi", "quiver", "streamline", "triplot", "tetramesh", "rose", "patch", "comet", "voronoi", "contourslice", "histogram", "errorbar", "reducepatch", "ezgraph3", "interpstreamspeed", "shrinkfaces", "ezplot3", "ezpolar", "curl", "stream3", "contour", "contours", "coneplot", "rotate", "isosurface", "pie3", "specgraphhelper", "stem", "frame2im", "comet3", "ezmeshc", "contourf", "fplot", "quiver3", "isocolors", "soundview", "ellipsoid", "parseplotapi", "streamtube", "changeseriestype", "makebars", "bar3h", "image", "trimesh", "clabel", "fill", "spinmap", "plotmatrix", "ezsurf", "divergence", "ind2rgb", "pareto", "isocaps", "moviein", "pie", "contourc", "feather", "hgline2lineseries", "ezcontourf", "stairs", "surfc", "im2java", "ezplot", "im2frame", "colstyle", "movieview", "contour3", "rgbplot", "surf2patch", "dither", "contrast", "waterfall", "cylinder", "bar", "slice", "histogram2", "streamribbon", "pcolor", "ribbon", "isplotchild", "sphere", "reducevolume", "ezsurfc", "imagesc", "subvolume", "streamparticles", "volumebounds", "plotchild", "area", "meshz", "imageview", "stem3", "scatter3", "ezmesh", "plotdoneevent", "stream2", "vissuite", "bar3", "smooth3", ] def meshc(*args): raise NotImplementedError("meshc") def barh(*args): raise NotImplementedError("barh") def trisurf(*args): raise NotImplementedError("trisurf") def compass(*args): raise NotImplementedError("compass") def isonormals(*args): raise NotImplementedError("isonormals") def plotutils(*args): raise NotImplementedError("plotutils") def ezcontour(*args): raise NotImplementedError("ezcontour") def streamslice(*args): raise NotImplementedError("streamslice") def scatter(*args): raise NotImplementedError("scatter") def rgb2ind(*args): raise NotImplementedError("rgb2ind") def usev6plotapi(*args): raise NotImplementedError("usev6plotapi") def quiver(*args): raise NotImplementedError("quiver") def streamline(*args): raise NotImplementedError("streamline") def triplot(*args): raise NotImplementedError("triplot") def tetramesh(*args): raise NotImplementedError("tetramesh") def rose(*args): raise NotImplementedError("rose") def patch(*args): raise NotImplementedError("patch") def comet(*args): raise NotImplementedError("comet") def voronoi(*args): raise NotImplementedError("voronoi") def contourslice(*args): raise NotImplementedError("contourslice") def histogram(*args): raise NotImplementedError("histogram") def errorbar(*args): raise NotImplementedError("errorbar") def reducepatch(*args): raise NotImplementedError("reducepatch") def ezgraph3(*args): raise NotImplementedError("ezgraph3") def interpstreamspeed(*args): raise NotImplementedError("interpstreamspeed") def shrinkfaces(*args): raise NotImplementedError("shrinkfaces") def ezplot3(*args): raise NotImplementedError("ezplot3") def ezpolar(*args): raise NotImplementedError("ezpolar") def curl(*args): raise NotImplementedError("curl") def stream3(*args): raise NotImplementedError("stream3") def contour(*args): raise NotImplementedError("contour") def contours(*args): raise NotImplementedError("contours") def coneplot(*args): raise NotImplementedError("coneplot") def rotate(*args): raise NotImplementedError("rotate") def isosurface(*args): raise NotImplementedError("isosurface") def pie3(*args): raise NotImplementedError("pie3") def specgraphhelper(*args): raise NotImplementedError("specgraphhelper") def stem(*args): raise NotImplementedError("stem") def frame2im(*args): raise NotImplementedError("frame2im") def comet3(*args): raise NotImplementedError("comet3") def ezmeshc(*args): raise NotImplementedError("ezmeshc") def contourf(*args): raise NotImplementedError("contourf") def fplot(*args): raise NotImplementedError("fplot") def quiver3(*args): raise NotImplementedError("quiver3") def isocolors(*args): raise NotImplementedError("isocolors") def soundview(*args): raise NotImplementedError("soundview") def ellipsoid(*args): raise NotImplementedError("ellipsoid") def parseplotapi(*args): raise NotImplementedError("parseplotapi") def streamtube(*args): raise NotImplementedError("streamtube") def changeseriestype(*args): raise NotImplementedError("changeseriestype") def makebars(*args): raise NotImplementedError("makebars") def bar3h(*args): raise NotImplementedError("bar3h") def image(*args): raise NotImplementedError("image") def trimesh(*args): raise NotImplementedError("trimesh") def clabel(*args): raise NotImplementedError("clabel") def fill(*args): raise NotImplementedError("fill") def spinmap(*args): raise NotImplementedError("spinmap") def plotmatrix(*args): raise NotImplementedError("plotmatrix") def ezsurf(*args): raise NotImplementedError("ezsurf") def divergence(*args): raise NotImplementedError("divergence") def ind2rgb(*args): raise NotImplementedError("ind2rgb") def pareto(*args): raise NotImplementedError("pareto") def isocaps(*args): raise NotImplementedError("isocaps") def moviein(*args): raise NotImplementedError("moviein") def pie(*args): raise NotImplementedError("pie") def contourc(*args): raise NotImplementedError("contourc") def feather(*args): raise NotImplementedError("feather") def hgline2lineseries(*args): raise NotImplementedError("hgline2lineseries") def ezcontourf(*args): raise NotImplementedError("ezcontourf") def stairs(*args): raise NotImplementedError("stairs") def surfc(*args): raise NotImplementedError("surfc") def im2java(*args): raise NotImplementedError("im2java") def ezplot(*args): raise NotImplementedError("ezplot") def im2frame(*args): raise NotImplementedError("im2frame") def colstyle(*args): raise NotImplementedError("colstyle") def movieview(*args): raise NotImplementedError("movieview") def contour3(*args): raise NotImplementedError("contour3") def rgbplot(*args): raise NotImplementedError("rgbplot") def surf2patch(*args): raise NotImplementedError("surf2patch") def dither(*args): raise NotImplementedError("dither") def contrast(*args): raise NotImplementedError("contrast") def waterfall(*args): raise NotImplementedError("waterfall") def cylinder(*args): raise NotImplementedError("cylinder") def bar(*args): raise NotImplementedError("bar") def slice(*args): raise NotImplementedError("slice") def histogram2(*args): raise NotImplementedError("histogram2") def streamribbon(*args): raise NotImplementedError("streamribbon") def pcolor(*args): raise NotImplementedError("pcolor") def ribbon(*args): raise NotImplementedError("ribbon") def isplotchild(*args): raise NotImplementedError("isplotchild") def sphere(*args): raise NotImplementedError("sphere") def reducevolume(*args): raise NotImplementedError("reducevolume") def ezsurfc(*args): raise NotImplementedError("ezsurfc") def imagesc(*args): raise NotImplementedError("imagesc") def subvolume(*args): raise NotImplementedError("subvolume") def streamparticles(*args): raise NotImplementedError("streamparticles") def volumebounds(*args): raise NotImplementedError("volumebounds") def plotchild(*args): raise NotImplementedError("plotchild") def area(*args): raise NotImplementedError("area") def meshz(*args): raise NotImplementedError("meshz") def imageview(*args): raise NotImplementedError("imageview") def stem3(*args): raise NotImplementedError("stem3") def scatter3(*args): raise NotImplementedError("scatter3") def ezmesh(*args): raise NotImplementedError("ezmesh") def plotdoneevent(*args): raise NotImplementedError("plotdoneevent") def stream2(*args): raise NotImplementedError("stream2") def vissuite(*args): raise NotImplementedError("vissuite") def bar3(*args): raise NotImplementedError("bar3") def smooth3(*args): raise NotImplementedError("smooth3")
__all__ = ['meshc', 'barh', 'trisurf', 'compass', 'isonormals', 'plotutils', 'ezcontour', 'streamslice', 'scatter', 'rgb2ind', 'usev6plotapi', 'quiver', 'streamline', 'triplot', 'tetramesh', 'rose', 'patch', 'comet', 'voronoi', 'contourslice', 'histogram', 'errorbar', 'reducepatch', 'ezgraph3', 'interpstreamspeed', 'shrinkfaces', 'ezplot3', 'ezpolar', 'curl', 'stream3', 'contour', 'contours', 'coneplot', 'rotate', 'isosurface', 'pie3', 'specgraphhelper', 'stem', 'frame2im', 'comet3', 'ezmeshc', 'contourf', 'fplot', 'quiver3', 'isocolors', 'soundview', 'ellipsoid', 'parseplotapi', 'streamtube', 'changeseriestype', 'makebars', 'bar3h', 'image', 'trimesh', 'clabel', 'fill', 'spinmap', 'plotmatrix', 'ezsurf', 'divergence', 'ind2rgb', 'pareto', 'isocaps', 'moviein', 'pie', 'contourc', 'feather', 'hgline2lineseries', 'ezcontourf', 'stairs', 'surfc', 'im2java', 'ezplot', 'im2frame', 'colstyle', 'movieview', 'contour3', 'rgbplot', 'surf2patch', 'dither', 'contrast', 'waterfall', 'cylinder', 'bar', 'slice', 'histogram2', 'streamribbon', 'pcolor', 'ribbon', 'isplotchild', 'sphere', 'reducevolume', 'ezsurfc', 'imagesc', 'subvolume', 'streamparticles', 'volumebounds', 'plotchild', 'area', 'meshz', 'imageview', 'stem3', 'scatter3', 'ezmesh', 'plotdoneevent', 'stream2', 'vissuite', 'bar3', 'smooth3'] def meshc(*args): raise not_implemented_error('meshc') def barh(*args): raise not_implemented_error('barh') def trisurf(*args): raise not_implemented_error('trisurf') def compass(*args): raise not_implemented_error('compass') def isonormals(*args): raise not_implemented_error('isonormals') def plotutils(*args): raise not_implemented_error('plotutils') def ezcontour(*args): raise not_implemented_error('ezcontour') def streamslice(*args): raise not_implemented_error('streamslice') def scatter(*args): raise not_implemented_error('scatter') def rgb2ind(*args): raise not_implemented_error('rgb2ind') def usev6plotapi(*args): raise not_implemented_error('usev6plotapi') def quiver(*args): raise not_implemented_error('quiver') def streamline(*args): raise not_implemented_error('streamline') def triplot(*args): raise not_implemented_error('triplot') def tetramesh(*args): raise not_implemented_error('tetramesh') def rose(*args): raise not_implemented_error('rose') def patch(*args): raise not_implemented_error('patch') def comet(*args): raise not_implemented_error('comet') def voronoi(*args): raise not_implemented_error('voronoi') def contourslice(*args): raise not_implemented_error('contourslice') def histogram(*args): raise not_implemented_error('histogram') def errorbar(*args): raise not_implemented_error('errorbar') def reducepatch(*args): raise not_implemented_error('reducepatch') def ezgraph3(*args): raise not_implemented_error('ezgraph3') def interpstreamspeed(*args): raise not_implemented_error('interpstreamspeed') def shrinkfaces(*args): raise not_implemented_error('shrinkfaces') def ezplot3(*args): raise not_implemented_error('ezplot3') def ezpolar(*args): raise not_implemented_error('ezpolar') def curl(*args): raise not_implemented_error('curl') def stream3(*args): raise not_implemented_error('stream3') def contour(*args): raise not_implemented_error('contour') def contours(*args): raise not_implemented_error('contours') def coneplot(*args): raise not_implemented_error('coneplot') def rotate(*args): raise not_implemented_error('rotate') def isosurface(*args): raise not_implemented_error('isosurface') def pie3(*args): raise not_implemented_error('pie3') def specgraphhelper(*args): raise not_implemented_error('specgraphhelper') def stem(*args): raise not_implemented_error('stem') def frame2im(*args): raise not_implemented_error('frame2im') def comet3(*args): raise not_implemented_error('comet3') def ezmeshc(*args): raise not_implemented_error('ezmeshc') def contourf(*args): raise not_implemented_error('contourf') def fplot(*args): raise not_implemented_error('fplot') def quiver3(*args): raise not_implemented_error('quiver3') def isocolors(*args): raise not_implemented_error('isocolors') def soundview(*args): raise not_implemented_error('soundview') def ellipsoid(*args): raise not_implemented_error('ellipsoid') def parseplotapi(*args): raise not_implemented_error('parseplotapi') def streamtube(*args): raise not_implemented_error('streamtube') def changeseriestype(*args): raise not_implemented_error('changeseriestype') def makebars(*args): raise not_implemented_error('makebars') def bar3h(*args): raise not_implemented_error('bar3h') def image(*args): raise not_implemented_error('image') def trimesh(*args): raise not_implemented_error('trimesh') def clabel(*args): raise not_implemented_error('clabel') def fill(*args): raise not_implemented_error('fill') def spinmap(*args): raise not_implemented_error('spinmap') def plotmatrix(*args): raise not_implemented_error('plotmatrix') def ezsurf(*args): raise not_implemented_error('ezsurf') def divergence(*args): raise not_implemented_error('divergence') def ind2rgb(*args): raise not_implemented_error('ind2rgb') def pareto(*args): raise not_implemented_error('pareto') def isocaps(*args): raise not_implemented_error('isocaps') def moviein(*args): raise not_implemented_error('moviein') def pie(*args): raise not_implemented_error('pie') def contourc(*args): raise not_implemented_error('contourc') def feather(*args): raise not_implemented_error('feather') def hgline2lineseries(*args): raise not_implemented_error('hgline2lineseries') def ezcontourf(*args): raise not_implemented_error('ezcontourf') def stairs(*args): raise not_implemented_error('stairs') def surfc(*args): raise not_implemented_error('surfc') def im2java(*args): raise not_implemented_error('im2java') def ezplot(*args): raise not_implemented_error('ezplot') def im2frame(*args): raise not_implemented_error('im2frame') def colstyle(*args): raise not_implemented_error('colstyle') def movieview(*args): raise not_implemented_error('movieview') def contour3(*args): raise not_implemented_error('contour3') def rgbplot(*args): raise not_implemented_error('rgbplot') def surf2patch(*args): raise not_implemented_error('surf2patch') def dither(*args): raise not_implemented_error('dither') def contrast(*args): raise not_implemented_error('contrast') def waterfall(*args): raise not_implemented_error('waterfall') def cylinder(*args): raise not_implemented_error('cylinder') def bar(*args): raise not_implemented_error('bar') def slice(*args): raise not_implemented_error('slice') def histogram2(*args): raise not_implemented_error('histogram2') def streamribbon(*args): raise not_implemented_error('streamribbon') def pcolor(*args): raise not_implemented_error('pcolor') def ribbon(*args): raise not_implemented_error('ribbon') def isplotchild(*args): raise not_implemented_error('isplotchild') def sphere(*args): raise not_implemented_error('sphere') def reducevolume(*args): raise not_implemented_error('reducevolume') def ezsurfc(*args): raise not_implemented_error('ezsurfc') def imagesc(*args): raise not_implemented_error('imagesc') def subvolume(*args): raise not_implemented_error('subvolume') def streamparticles(*args): raise not_implemented_error('streamparticles') def volumebounds(*args): raise not_implemented_error('volumebounds') def plotchild(*args): raise not_implemented_error('plotchild') def area(*args): raise not_implemented_error('area') def meshz(*args): raise not_implemented_error('meshz') def imageview(*args): raise not_implemented_error('imageview') def stem3(*args): raise not_implemented_error('stem3') def scatter3(*args): raise not_implemented_error('scatter3') def ezmesh(*args): raise not_implemented_error('ezmesh') def plotdoneevent(*args): raise not_implemented_error('plotdoneevent') def stream2(*args): raise not_implemented_error('stream2') def vissuite(*args): raise not_implemented_error('vissuite') def bar3(*args): raise not_implemented_error('bar3') def smooth3(*args): raise not_implemented_error('smooth3')
#!/usr/bin/python print('Hello Git!') print("Nakano Masaki")
print('Hello Git!') print('Nakano Masaki')
a = [int(x) for x in input().split()] a.sort() #this command sorts the list in ascending order if a[-2]==a[-1]: print(a[-3]+a[1]) else: print(a[-2] + a[1])
a = [int(x) for x in input().split()] a.sort() if a[-2] == a[-1]: print(a[-3] + a[1]) else: print(a[-2] + a[1])
# The MessageQueue class provides an interface to be implemented by classes that store messages. class MessageQueue(object): # add a single message to the queue def add(self, folder_id, folder_path, message_type, parameters=None, sender_controller_id=None, sender_user_id=None, timestamp=None): pass # returns a list of message objects once some are ready def receive(self): pass
class Messagequeue(object): def add(self, folder_id, folder_path, message_type, parameters=None, sender_controller_id=None, sender_user_id=None, timestamp=None): pass def receive(self): pass
info = open("phonebook.txt", "r+").readlines() ph = {} for i in range(len(info)): word = info[i].split() ph[word[0]]=word[1] for i in sorted(ph.keys()): print(i,ph[i])
info = open('phonebook.txt', 'r+').readlines() ph = {} for i in range(len(info)): word = info[i].split() ph[word[0]] = word[1] for i in sorted(ph.keys()): print(i, ph[i])
print("Welcome to the roller coaster!") height = int(input("What is your height in cm? ")) canRide = False if height > 120: age = int(input("What is your age in years? ")) if age > 18: canRide = True else: canRide = False else: canRide = False if canRide: print('You can ride the roller coaster!') else: print('Sorry! You cannot ride the roller coaster')
print('Welcome to the roller coaster!') height = int(input('What is your height in cm? ')) can_ride = False if height > 120: age = int(input('What is your age in years? ')) if age > 18: can_ride = True else: can_ride = False else: can_ride = False if canRide: print('You can ride the roller coaster!') else: print('Sorry! You cannot ride the roller coaster')
# # PySNMP MIB module MYLEXDAC960SCSIRAIDCONTROLLER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MYLEXDAC960SCSIRAIDCONTROLLER-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:06:54 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, ConstraintsIntersection, SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ConstraintsIntersection", "SingleValueConstraint", "ValueRangeConstraint", "ValueSizeConstraint") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Counter32, NotificationType, ModuleIdentity, iso, TimeTicks, Counter64, ObjectIdentity, IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn, MibIdentifier, Integer32, Bits, Gauge32, enterprises, Unsigned32 = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "NotificationType", "ModuleIdentity", "iso", "TimeTicks", "Counter64", "ObjectIdentity", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "MibIdentifier", "Integer32", "Bits", "Gauge32", "enterprises", "Unsigned32") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") class DmiCounter(Counter32): pass class DmiInteger(Integer32): pass class DmiDisplaystring(DisplayString): pass class DmiDateX(OctetString): subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(28, 28) fixedLength = 28 class DmiComponentIndex(Integer32): pass mylex = MibIdentifier((1, 3, 6, 1, 4, 1, 1608)) mib = MibIdentifier((1, 3, 6, 1, 4, 1, 1608, 3)) v2 = MibIdentifier((1, 3, 6, 1, 4, 1, 1608, 3, 2)) dmtfGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1)) tComponentid = MibTable((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 1), ) if mibBuilder.loadTexts: tComponentid.setStatus('mandatory') eComponentid = MibTableRow((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 1, 1), ).setIndexNames((0, "MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "DmiComponentIndex")) if mibBuilder.loadTexts: eComponentid.setStatus('mandatory') a1Manufacturer = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 1, 1, 1), DmiDisplaystring()).setMaxAccess("readonly") if mibBuilder.loadTexts: a1Manufacturer.setStatus('mandatory') a1Product = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 1, 1, 2), DmiDisplaystring()).setMaxAccess("readonly") if mibBuilder.loadTexts: a1Product.setStatus('mandatory') a1Version = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 1, 1, 3), DmiDisplaystring()) if mibBuilder.loadTexts: a1Version.setStatus('mandatory') a1SerialNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 1, 1, 4), DmiDisplaystring()) if mibBuilder.loadTexts: a1SerialNumber.setStatus('mandatory') a1Installation = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 1, 1, 5), DmiDateX()) if mibBuilder.loadTexts: a1Installation.setStatus('mandatory') a1Verify = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 1, 1, 6), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a1Verify.setStatus('mandatory') tControllerInformation = MibTable((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2), ) if mibBuilder.loadTexts: tControllerInformation.setStatus('mandatory') eControllerInformation = MibTableRow((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1), ).setIndexNames((0, "MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "DmiComponentIndex"), (0, "MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "a2ControllerNumber")) if mibBuilder.loadTexts: eControllerInformation.setStatus('mandatory') a2ControllerNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 1), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a2ControllerNumber.setStatus('mandatory') a2OperationalState = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 2), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a2OperationalState.setStatus('mandatory') a2FirmwareRevision = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 3), DmiDisplaystring()).setMaxAccess("readonly") if mibBuilder.loadTexts: a2FirmwareRevision.setStatus('mandatory') a2ConfiguredChannels = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 4), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a2ConfiguredChannels.setStatus('mandatory') a2ActualChannels = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 5), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a2ActualChannels.setStatus('mandatory') a2MaximumLogicalDrives = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 6), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a2MaximumLogicalDrives.setStatus('mandatory') a2MaximumTargetsPerChannel = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 7), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a2MaximumTargetsPerChannel.setStatus('mandatory') a2MaximumTaggedRequests = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 8), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a2MaximumTaggedRequests.setStatus('mandatory') a2MaximumDataTransferSizePerIoRequestInK = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 9), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a2MaximumDataTransferSizePerIoRequestInK.setStatus('mandatory') a2MaximumConcurrentCommands = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 10), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a2MaximumConcurrentCommands.setStatus('mandatory') a2RebuildRate = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 11), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a2RebuildRate.setStatus('mandatory') a2LogicalSectorSizeInBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 12), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a2LogicalSectorSizeInBytes.setStatus('mandatory') a2PhysicalSectorSizeInBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 13), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a2PhysicalSectorSizeInBytes.setStatus('mandatory') a2CacheLineSizeInBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 14), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a2CacheLineSizeInBytes.setStatus('mandatory') a2DramSizeInMb = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 15), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a2DramSizeInMb.setStatus('mandatory') a2EpromSizeInKb = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 16), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a2EpromSizeInKb.setStatus('mandatory') a2BusType = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 17), DmiDisplaystring()).setMaxAccess("readonly") if mibBuilder.loadTexts: a2BusType.setStatus('mandatory') a2SystemBusNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 18), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a2SystemBusNumber.setStatus('mandatory') a2SlotNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 19), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a2SlotNumber.setStatus('mandatory') a2InterruptVectorNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 20), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a2InterruptVectorNumber.setStatus('mandatory') a2InterruptMode = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 21), DmiDisplaystring()).setMaxAccess("readonly") if mibBuilder.loadTexts: a2InterruptMode.setStatus('mandatory') tLogicalDriveInformation = MibTable((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 3), ) if mibBuilder.loadTexts: tLogicalDriveInformation.setStatus('mandatory') eLogicalDriveInformation = MibTableRow((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 3, 1), ).setIndexNames((0, "MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "DmiComponentIndex"), (0, "MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "a3ControllerNumber"), (0, "MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "a3LogicalDriveNumber")) if mibBuilder.loadTexts: eLogicalDriveInformation.setStatus('mandatory') a3ControllerNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 3, 1, 1), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ControllerNumber.setStatus('mandatory') a3LogicalDriveNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 3, 1, 2), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3LogicalDriveNumber.setStatus('mandatory') a3OperationalState = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 3, 1, 3), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3OperationalState.setStatus('mandatory') a3RaidLevel = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 3, 1, 4), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3RaidLevel.setStatus('mandatory') a3WritePolicy = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 3, 1, 5), DmiDisplaystring()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3WritePolicy.setStatus('mandatory') a3SizeInMb = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 3, 1, 6), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3SizeInMb.setStatus('mandatory') a3StripeSizeInBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 3, 1, 7), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3StripeSizeInBytes.setStatus('mandatory') a3PhysicalDriveMap = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 3, 1, 8), DmiDisplaystring()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3PhysicalDriveMap.setStatus('mandatory') tPhyicalDeviceInformation = MibTable((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4), ) if mibBuilder.loadTexts: tPhyicalDeviceInformation.setStatus('mandatory') ePhyicalDeviceInformation = MibTableRow((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1), ).setIndexNames((0, "MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "DmiComponentIndex"), (0, "MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "a4ControllerNumber"), (0, "MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "a4ScsiBusId"), (0, "MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "a4ScsiTargetId")) if mibBuilder.loadTexts: ePhyicalDeviceInformation.setStatus('mandatory') a4ControllerNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 1), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a4ControllerNumber.setStatus('mandatory') a4ScsiBusId = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 2), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a4ScsiBusId.setStatus('mandatory') a4ScsiTargetId = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 3), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a4ScsiTargetId.setStatus('mandatory') a4OperationalState = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 4), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a4OperationalState.setStatus('mandatory') a4VendorId = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 5), DmiDisplaystring()).setMaxAccess("readonly") if mibBuilder.loadTexts: a4VendorId.setStatus('mandatory') a4ProductId = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 6), DmiDisplaystring()).setMaxAccess("readonly") if mibBuilder.loadTexts: a4ProductId.setStatus('mandatory') a4ProductRevisionLevel = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 7), DmiDisplaystring()).setMaxAccess("readonly") if mibBuilder.loadTexts: a4ProductRevisionLevel.setStatus('mandatory') a4SizeInMb = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 8), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a4SizeInMb.setStatus('mandatory') a4DeviceType = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 9), DmiDisplaystring()).setMaxAccess("readonly") if mibBuilder.loadTexts: a4DeviceType.setStatus('mandatory') a4SoftErrorsCount = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 10), DmiCounter()).setMaxAccess("readonly") if mibBuilder.loadTexts: a4SoftErrorsCount.setStatus('mandatory') a4HardErrorsCount = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 11), DmiCounter()).setMaxAccess("readonly") if mibBuilder.loadTexts: a4HardErrorsCount.setStatus('mandatory') a4ParityErrorsCount = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 12), DmiCounter()).setMaxAccess("readonly") if mibBuilder.loadTexts: a4ParityErrorsCount.setStatus('mandatory') a4MiscErrorsCount = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 13), DmiCounter()).setMaxAccess("readonly") if mibBuilder.loadTexts: a4MiscErrorsCount.setStatus('mandatory') tMylexDac960ComponentInstrumentationInfo = MibTable((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 5), ) if mibBuilder.loadTexts: tMylexDac960ComponentInstrumentationInfo.setStatus('mandatory') eMylexDac960ComponentInstrumentationInfo = MibTableRow((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 5, 1), ).setIndexNames((0, "MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "DmiComponentIndex")) if mibBuilder.loadTexts: eMylexDac960ComponentInstrumentationInfo.setStatus('mandatory') a5CiRevision = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 5, 1, 1), DmiDisplaystring()).setMaxAccess("readonly") if mibBuilder.loadTexts: a5CiRevision.setStatus('mandatory') a5CiBuildDate = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 5, 1, 2), DmiDisplaystring()).setMaxAccess("readonly") if mibBuilder.loadTexts: a5CiBuildDate.setStatus('mandatory') a5MdacDeviceDriverRevision = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 5, 1, 3), DmiDisplaystring()).setMaxAccess("readonly") if mibBuilder.loadTexts: a5MdacDeviceDriverRevision.setStatus('mandatory') a5MdacDeviceDriverBuildDate = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 5, 1, 4), DmiDisplaystring()).setMaxAccess("readonly") if mibBuilder.loadTexts: a5MdacDeviceDriverBuildDate.setStatus('mandatory') tLogicalDriveStatistics = MibTable((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 6), ) if mibBuilder.loadTexts: tLogicalDriveStatistics.setStatus('mandatory') eLogicalDriveStatistics = MibTableRow((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 6, 1), ).setIndexNames((0, "MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "DmiComponentIndex"), (0, "MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "a6ControllerNumber"), (0, "MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "a6LogicalDriveNumber")) if mibBuilder.loadTexts: eLogicalDriveStatistics.setStatus('mandatory') a6ControllerNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 6, 1, 1), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a6ControllerNumber.setStatus('mandatory') a6LogicalDriveNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 6, 1, 2), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a6LogicalDriveNumber.setStatus('mandatory') a6ReadRequestsCount = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 6, 1, 3), DmiCounter()).setMaxAccess("readonly") if mibBuilder.loadTexts: a6ReadRequestsCount.setStatus('mandatory') a6AmountOfDataReadInMb = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 6, 1, 4), DmiCounter()).setMaxAccess("readonly") if mibBuilder.loadTexts: a6AmountOfDataReadInMb.setStatus('mandatory') a6WriteRequestsCount = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 6, 1, 5), DmiCounter()).setMaxAccess("readonly") if mibBuilder.loadTexts: a6WriteRequestsCount.setStatus('mandatory') a6AmountOfDataWrittenInMb = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 6, 1, 6), DmiCounter()).setMaxAccess("readonly") if mibBuilder.loadTexts: a6AmountOfDataWrittenInMb.setStatus('mandatory') a6ReadCacheHit = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 6, 1, 7), DmiCounter()).setMaxAccess("readonly") if mibBuilder.loadTexts: a6ReadCacheHit.setStatus('mandatory') tPhysicalDriveStatistics = MibTable((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 7), ) if mibBuilder.loadTexts: tPhysicalDriveStatistics.setStatus('mandatory') ePhysicalDriveStatistics = MibTableRow((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 7, 1), ).setIndexNames((0, "MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "DmiComponentIndex"), (0, "MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "a7ControllerNumber"), (0, "MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "a7ScsiBusId"), (0, "MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "a7ScsiTargetId")) if mibBuilder.loadTexts: ePhysicalDriveStatistics.setStatus('mandatory') a7ControllerNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 7, 1, 1), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a7ControllerNumber.setStatus('mandatory') a7ScsiBusId = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 7, 1, 2), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a7ScsiBusId.setStatus('mandatory') a7ScsiTargetId = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 7, 1, 3), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a7ScsiTargetId.setStatus('mandatory') a7ReadRequestsCount = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 7, 1, 4), DmiCounter()).setMaxAccess("readonly") if mibBuilder.loadTexts: a7ReadRequestsCount.setStatus('mandatory') a7AmountOfDataReadInKb = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 7, 1, 5), DmiCounter()).setMaxAccess("readonly") if mibBuilder.loadTexts: a7AmountOfDataReadInKb.setStatus('mandatory') a7WriteRequestsCount = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 7, 1, 6), DmiCounter()).setMaxAccess("readonly") if mibBuilder.loadTexts: a7WriteRequestsCount.setStatus('mandatory') a7AmountOfDataWrittenInKb = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 7, 1, 7), DmiCounter()).setMaxAccess("readonly") if mibBuilder.loadTexts: a7AmountOfDataWrittenInKb.setStatus('mandatory') tErrorControl = MibTable((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 98), ) if mibBuilder.loadTexts: tErrorControl.setStatus('mandatory') eErrorControl = MibTableRow((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 98, 1), ).setIndexNames((0, "MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "DmiComponentIndex"), (0, "MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "a98Selfid")) if mibBuilder.loadTexts: eErrorControl.setStatus('mandatory') a98Selfid = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 98, 1, 1), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a98Selfid.setStatus('mandatory') a98NumberOfFatalErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 98, 1, 2), DmiCounter()).setMaxAccess("readonly") if mibBuilder.loadTexts: a98NumberOfFatalErrors.setStatus('mandatory') a98NumberOfMajorErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 98, 1, 3), DmiCounter()).setMaxAccess("readonly") if mibBuilder.loadTexts: a98NumberOfMajorErrors.setStatus('mandatory') a98NumberOfWarnings = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 98, 1, 4), DmiCounter()).setMaxAccess("readonly") if mibBuilder.loadTexts: a98NumberOfWarnings.setStatus('mandatory') a98ErrorStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 98, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4))).clone(namedValues=NamedValues(("vOk", 0), ("vWarning", 1), ("vMajor", 2), ("vFatal", 3), ("vInformational", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: a98ErrorStatus.setStatus('mandatory') a98ErrorStatusType = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 98, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("vPost", 0), ("vRuntime", 1), ("vDiagnosticTest", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: a98ErrorStatusType.setStatus('mandatory') a98AlarmGeneration = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 98, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("vOff", 0), ("vOn", 1)))).setMaxAccess("readonly") if mibBuilder.loadTexts: a98AlarmGeneration.setStatus('mandatory') tMiftomib = MibTable((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 99), ) if mibBuilder.loadTexts: tMiftomib.setStatus('mandatory') eMiftomib = MibTableRow((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 99, 1), ).setIndexNames((0, "MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "DmiComponentIndex")) if mibBuilder.loadTexts: eMiftomib.setStatus('mandatory') a99MibName = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 99, 1, 1), DmiDisplaystring()).setMaxAccess("readonly") if mibBuilder.loadTexts: a99MibName.setStatus('mandatory') a99MibOid = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 99, 1, 2), DmiDisplaystring()).setMaxAccess("readonly") if mibBuilder.loadTexts: a99MibOid.setStatus('mandatory') a99DisableTrap = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 99, 1, 3), DmiInteger()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a99DisableTrap.setStatus('mandatory') tTrapGroup = MibTable((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999), ) if mibBuilder.loadTexts: tTrapGroup.setStatus('mandatory') eTrapGroup = MibTableRow((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1), ).setIndexNames((0, "MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "DmiComponentIndex")) if mibBuilder.loadTexts: eTrapGroup.setStatus('mandatory') a9999ErrorTime = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1, 1), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: a9999ErrorTime.setStatus('mandatory') a9999ErrorStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1, 2), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a9999ErrorStatus.setStatus('mandatory') a9999ErrorGroupId = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1, 3), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a9999ErrorGroupId.setStatus('mandatory') a9999ErrorInstanceId = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1, 4), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a9999ErrorInstanceId.setStatus('mandatory') a9999ComponentId = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1, 5), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a9999ComponentId.setStatus('mandatory') a9999GroupId = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1, 6), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a9999GroupId.setStatus('mandatory') a9999InstanceId = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1, 7), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a9999InstanceId.setStatus('mandatory') a9999VendorCode1 = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1, 8), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a9999VendorCode1.setStatus('mandatory') a9999VendorCode2 = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1, 9), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a9999VendorCode2.setStatus('mandatory') a9999VendorText = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1, 10), OctetString()).setMaxAccess("readonly") if mibBuilder.loadTexts: a9999VendorText.setStatus('mandatory') a9999ParentGroupId = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1, 11), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a9999ParentGroupId.setStatus('mandatory') a9999ParentInstanceId = MibTableColumn((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1, 12), DmiInteger()).setMaxAccess("readonly") if mibBuilder.loadTexts: a9999ParentInstanceId.setStatus('mandatory') mdacEventError = NotificationType((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1) + (0,1)).setObjects(("MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "a9999ErrorTime"), ("MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "a9999ErrorStatus"), ("MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "a9999ErrorGroupId"), ("MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "a9999ErrorInstanceId"), ("MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "a9999ComponentId"), ("MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "a9999GroupId"), ("MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "a9999InstanceId"), ("MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "a9999VendorCode1"), ("MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "a9999VendorCode2"), ("MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "a9999VendorText"), ("MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "a9999ParentGroupId"), ("MYLEXDAC960SCSIRAIDCONTROLLER-MIB", "a9999ParentInstanceId")) mibBuilder.exportSymbols("MYLEXDAC960SCSIRAIDCONTROLLER-MIB", eErrorControl=eErrorControl, a3OperationalState=a3OperationalState, a2MaximumConcurrentCommands=a2MaximumConcurrentCommands, a2SlotNumber=a2SlotNumber, a6ReadRequestsCount=a6ReadRequestsCount, a9999GroupId=a9999GroupId, a9999ParentInstanceId=a9999ParentInstanceId, tErrorControl=tErrorControl, a9999ErrorGroupId=a9999ErrorGroupId, a98ErrorStatus=a98ErrorStatus, a2OperationalState=a2OperationalState, a3SizeInMb=a3SizeInMb, a98NumberOfFatalErrors=a98NumberOfFatalErrors, DmiInteger=DmiInteger, a4HardErrorsCount=a4HardErrorsCount, dmtfGroups=dmtfGroups, mdacEventError=mdacEventError, a4DeviceType=a4DeviceType, a6ReadCacheHit=a6ReadCacheHit, a98Selfid=a98Selfid, a2MaximumLogicalDrives=a2MaximumLogicalDrives, a5CiRevision=a5CiRevision, a5MdacDeviceDriverBuildDate=a5MdacDeviceDriverBuildDate, a9999ErrorStatus=a9999ErrorStatus, a2PhysicalSectorSizeInBytes=a2PhysicalSectorSizeInBytes, a3LogicalDriveNumber=a3LogicalDriveNumber, a7AmountOfDataWrittenInKb=a7AmountOfDataWrittenInKb, eLogicalDriveStatistics=eLogicalDriveStatistics, v2=v2, a6AmountOfDataReadInMb=a6AmountOfDataReadInMb, DmiComponentIndex=DmiComponentIndex, a9999VendorCode2=a9999VendorCode2, tLogicalDriveInformation=tLogicalDriveInformation, a98NumberOfMajorErrors=a98NumberOfMajorErrors, a6ControllerNumber=a6ControllerNumber, eControllerInformation=eControllerInformation, a1Version=a1Version, a7ReadRequestsCount=a7ReadRequestsCount, tMiftomib=tMiftomib, ePhysicalDriveStatistics=ePhysicalDriveStatistics, a2BusType=a2BusType, a1Installation=a1Installation, a3RaidLevel=a3RaidLevel, a2InterruptMode=a2InterruptMode, a3ControllerNumber=a3ControllerNumber, a7ScsiTargetId=a7ScsiTargetId, a4ScsiBusId=a4ScsiBusId, a5CiBuildDate=a5CiBuildDate, a5MdacDeviceDriverRevision=a5MdacDeviceDriverRevision, a9999InstanceId=a9999InstanceId, a2RebuildRate=a2RebuildRate, a4VendorId=a4VendorId, a6AmountOfDataWrittenInMb=a6AmountOfDataWrittenInMb, tPhysicalDriveStatistics=tPhysicalDriveStatistics, a99MibOid=a99MibOid, a4SoftErrorsCount=a4SoftErrorsCount, tPhyicalDeviceInformation=tPhyicalDeviceInformation, a2MaximumDataTransferSizePerIoRequestInK=a2MaximumDataTransferSizePerIoRequestInK, a1Verify=a1Verify, a99MibName=a99MibName, a1SerialNumber=a1SerialNumber, a4ProductRevisionLevel=a4ProductRevisionLevel, a6LogicalDriveNumber=a6LogicalDriveNumber, a9999ParentGroupId=a9999ParentGroupId, tTrapGroup=tTrapGroup, a2InterruptVectorNumber=a2InterruptVectorNumber, a1Manufacturer=a1Manufacturer, a2SystemBusNumber=a2SystemBusNumber, a4OperationalState=a4OperationalState, a2CacheLineSizeInBytes=a2CacheLineSizeInBytes, DmiDateX=DmiDateX, a2ActualChannels=a2ActualChannels, a1Product=a1Product, mib=mib, DmiCounter=DmiCounter, eLogicalDriveInformation=eLogicalDriveInformation, a7AmountOfDataReadInKb=a7AmountOfDataReadInKb, a98NumberOfWarnings=a98NumberOfWarnings, a3PhysicalDriveMap=a3PhysicalDriveMap, a7ControllerNumber=a7ControllerNumber, ePhyicalDeviceInformation=ePhyicalDeviceInformation, a9999VendorText=a9999VendorText, a4ControllerNumber=a4ControllerNumber, a4SizeInMb=a4SizeInMb, a98AlarmGeneration=a98AlarmGeneration, tComponentid=tComponentid, a2LogicalSectorSizeInBytes=a2LogicalSectorSizeInBytes, eMiftomib=eMiftomib, a2MaximumTargetsPerChannel=a2MaximumTargetsPerChannel, a3StripeSizeInBytes=a3StripeSizeInBytes, a9999ErrorTime=a9999ErrorTime, a98ErrorStatusType=a98ErrorStatusType, a2ControllerNumber=a2ControllerNumber, tControllerInformation=tControllerInformation, eComponentid=eComponentid, a4ProductId=a4ProductId, a4MiscErrorsCount=a4MiscErrorsCount, eTrapGroup=eTrapGroup, tLogicalDriveStatistics=tLogicalDriveStatistics, a2MaximumTaggedRequests=a2MaximumTaggedRequests, a99DisableTrap=a99DisableTrap, a9999ComponentId=a9999ComponentId, a2ConfiguredChannels=a2ConfiguredChannels, tMylexDac960ComponentInstrumentationInfo=tMylexDac960ComponentInstrumentationInfo, DmiDisplaystring=DmiDisplaystring, a2FirmwareRevision=a2FirmwareRevision, a9999VendorCode1=a9999VendorCode1, eMylexDac960ComponentInstrumentationInfo=eMylexDac960ComponentInstrumentationInfo, a7WriteRequestsCount=a7WriteRequestsCount, a4ScsiTargetId=a4ScsiTargetId, a7ScsiBusId=a7ScsiBusId, a3WritePolicy=a3WritePolicy, a2DramSizeInMb=a2DramSizeInMb, a9999ErrorInstanceId=a9999ErrorInstanceId, a6WriteRequestsCount=a6WriteRequestsCount, a2EpromSizeInKb=a2EpromSizeInKb, a4ParityErrorsCount=a4ParityErrorsCount, mylex=mylex)
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, single_value_constraint, value_range_constraint, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ConstraintsIntersection', 'SingleValueConstraint', 'ValueRangeConstraint', 'ValueSizeConstraint') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (counter32, notification_type, module_identity, iso, time_ticks, counter64, object_identity, ip_address, mib_scalar, mib_table, mib_table_row, mib_table_column, mib_identifier, integer32, bits, gauge32, enterprises, unsigned32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter32', 'NotificationType', 'ModuleIdentity', 'iso', 'TimeTicks', 'Counter64', 'ObjectIdentity', 'IpAddress', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'MibIdentifier', 'Integer32', 'Bits', 'Gauge32', 'enterprises', 'Unsigned32') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') class Dmicounter(Counter32): pass class Dmiinteger(Integer32): pass class Dmidisplaystring(DisplayString): pass class Dmidatex(OctetString): subtype_spec = OctetString.subtypeSpec + value_size_constraint(28, 28) fixed_length = 28 class Dmicomponentindex(Integer32): pass mylex = mib_identifier((1, 3, 6, 1, 4, 1, 1608)) mib = mib_identifier((1, 3, 6, 1, 4, 1, 1608, 3)) v2 = mib_identifier((1, 3, 6, 1, 4, 1, 1608, 3, 2)) dmtf_groups = mib_identifier((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1)) t_componentid = mib_table((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 1)) if mibBuilder.loadTexts: tComponentid.setStatus('mandatory') e_componentid = mib_table_row((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 1, 1)).setIndexNames((0, 'MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'DmiComponentIndex')) if mibBuilder.loadTexts: eComponentid.setStatus('mandatory') a1_manufacturer = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 1, 1, 1), dmi_displaystring()).setMaxAccess('readonly') if mibBuilder.loadTexts: a1Manufacturer.setStatus('mandatory') a1_product = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 1, 1, 2), dmi_displaystring()).setMaxAccess('readonly') if mibBuilder.loadTexts: a1Product.setStatus('mandatory') a1_version = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 1, 1, 3), dmi_displaystring()) if mibBuilder.loadTexts: a1Version.setStatus('mandatory') a1_serial_number = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 1, 1, 4), dmi_displaystring()) if mibBuilder.loadTexts: a1SerialNumber.setStatus('mandatory') a1_installation = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 1, 1, 5), dmi_date_x()) if mibBuilder.loadTexts: a1Installation.setStatus('mandatory') a1_verify = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 1, 1, 6), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a1Verify.setStatus('mandatory') t_controller_information = mib_table((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2)) if mibBuilder.loadTexts: tControllerInformation.setStatus('mandatory') e_controller_information = mib_table_row((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1)).setIndexNames((0, 'MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'DmiComponentIndex'), (0, 'MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'a2ControllerNumber')) if mibBuilder.loadTexts: eControllerInformation.setStatus('mandatory') a2_controller_number = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 1), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a2ControllerNumber.setStatus('mandatory') a2_operational_state = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 2), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a2OperationalState.setStatus('mandatory') a2_firmware_revision = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 3), dmi_displaystring()).setMaxAccess('readonly') if mibBuilder.loadTexts: a2FirmwareRevision.setStatus('mandatory') a2_configured_channels = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 4), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a2ConfiguredChannels.setStatus('mandatory') a2_actual_channels = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 5), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a2ActualChannels.setStatus('mandatory') a2_maximum_logical_drives = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 6), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a2MaximumLogicalDrives.setStatus('mandatory') a2_maximum_targets_per_channel = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 7), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a2MaximumTargetsPerChannel.setStatus('mandatory') a2_maximum_tagged_requests = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 8), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a2MaximumTaggedRequests.setStatus('mandatory') a2_maximum_data_transfer_size_per_io_request_in_k = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 9), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a2MaximumDataTransferSizePerIoRequestInK.setStatus('mandatory') a2_maximum_concurrent_commands = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 10), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a2MaximumConcurrentCommands.setStatus('mandatory') a2_rebuild_rate = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 11), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a2RebuildRate.setStatus('mandatory') a2_logical_sector_size_in_bytes = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 12), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a2LogicalSectorSizeInBytes.setStatus('mandatory') a2_physical_sector_size_in_bytes = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 13), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a2PhysicalSectorSizeInBytes.setStatus('mandatory') a2_cache_line_size_in_bytes = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 14), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a2CacheLineSizeInBytes.setStatus('mandatory') a2_dram_size_in_mb = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 15), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a2DramSizeInMb.setStatus('mandatory') a2_eprom_size_in_kb = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 16), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a2EpromSizeInKb.setStatus('mandatory') a2_bus_type = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 17), dmi_displaystring()).setMaxAccess('readonly') if mibBuilder.loadTexts: a2BusType.setStatus('mandatory') a2_system_bus_number = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 18), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a2SystemBusNumber.setStatus('mandatory') a2_slot_number = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 19), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a2SlotNumber.setStatus('mandatory') a2_interrupt_vector_number = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 20), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a2InterruptVectorNumber.setStatus('mandatory') a2_interrupt_mode = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 2, 1, 21), dmi_displaystring()).setMaxAccess('readonly') if mibBuilder.loadTexts: a2InterruptMode.setStatus('mandatory') t_logical_drive_information = mib_table((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 3)) if mibBuilder.loadTexts: tLogicalDriveInformation.setStatus('mandatory') e_logical_drive_information = mib_table_row((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 3, 1)).setIndexNames((0, 'MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'DmiComponentIndex'), (0, 'MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'a3ControllerNumber'), (0, 'MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'a3LogicalDriveNumber')) if mibBuilder.loadTexts: eLogicalDriveInformation.setStatus('mandatory') a3_controller_number = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 3, 1, 1), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ControllerNumber.setStatus('mandatory') a3_logical_drive_number = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 3, 1, 2), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3LogicalDriveNumber.setStatus('mandatory') a3_operational_state = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 3, 1, 3), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3OperationalState.setStatus('mandatory') a3_raid_level = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 3, 1, 4), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3RaidLevel.setStatus('mandatory') a3_write_policy = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 3, 1, 5), dmi_displaystring()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3WritePolicy.setStatus('mandatory') a3_size_in_mb = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 3, 1, 6), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3SizeInMb.setStatus('mandatory') a3_stripe_size_in_bytes = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 3, 1, 7), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3StripeSizeInBytes.setStatus('mandatory') a3_physical_drive_map = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 3, 1, 8), dmi_displaystring()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3PhysicalDriveMap.setStatus('mandatory') t_phyical_device_information = mib_table((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4)) if mibBuilder.loadTexts: tPhyicalDeviceInformation.setStatus('mandatory') e_phyical_device_information = mib_table_row((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1)).setIndexNames((0, 'MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'DmiComponentIndex'), (0, 'MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'a4ControllerNumber'), (0, 'MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'a4ScsiBusId'), (0, 'MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'a4ScsiTargetId')) if mibBuilder.loadTexts: ePhyicalDeviceInformation.setStatus('mandatory') a4_controller_number = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 1), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a4ControllerNumber.setStatus('mandatory') a4_scsi_bus_id = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 2), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a4ScsiBusId.setStatus('mandatory') a4_scsi_target_id = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 3), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a4ScsiTargetId.setStatus('mandatory') a4_operational_state = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 4), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a4OperationalState.setStatus('mandatory') a4_vendor_id = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 5), dmi_displaystring()).setMaxAccess('readonly') if mibBuilder.loadTexts: a4VendorId.setStatus('mandatory') a4_product_id = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 6), dmi_displaystring()).setMaxAccess('readonly') if mibBuilder.loadTexts: a4ProductId.setStatus('mandatory') a4_product_revision_level = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 7), dmi_displaystring()).setMaxAccess('readonly') if mibBuilder.loadTexts: a4ProductRevisionLevel.setStatus('mandatory') a4_size_in_mb = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 8), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a4SizeInMb.setStatus('mandatory') a4_device_type = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 9), dmi_displaystring()).setMaxAccess('readonly') if mibBuilder.loadTexts: a4DeviceType.setStatus('mandatory') a4_soft_errors_count = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 10), dmi_counter()).setMaxAccess('readonly') if mibBuilder.loadTexts: a4SoftErrorsCount.setStatus('mandatory') a4_hard_errors_count = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 11), dmi_counter()).setMaxAccess('readonly') if mibBuilder.loadTexts: a4HardErrorsCount.setStatus('mandatory') a4_parity_errors_count = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 12), dmi_counter()).setMaxAccess('readonly') if mibBuilder.loadTexts: a4ParityErrorsCount.setStatus('mandatory') a4_misc_errors_count = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 4, 1, 13), dmi_counter()).setMaxAccess('readonly') if mibBuilder.loadTexts: a4MiscErrorsCount.setStatus('mandatory') t_mylex_dac960_component_instrumentation_info = mib_table((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 5)) if mibBuilder.loadTexts: tMylexDac960ComponentInstrumentationInfo.setStatus('mandatory') e_mylex_dac960_component_instrumentation_info = mib_table_row((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 5, 1)).setIndexNames((0, 'MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'DmiComponentIndex')) if mibBuilder.loadTexts: eMylexDac960ComponentInstrumentationInfo.setStatus('mandatory') a5_ci_revision = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 5, 1, 1), dmi_displaystring()).setMaxAccess('readonly') if mibBuilder.loadTexts: a5CiRevision.setStatus('mandatory') a5_ci_build_date = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 5, 1, 2), dmi_displaystring()).setMaxAccess('readonly') if mibBuilder.loadTexts: a5CiBuildDate.setStatus('mandatory') a5_mdac_device_driver_revision = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 5, 1, 3), dmi_displaystring()).setMaxAccess('readonly') if mibBuilder.loadTexts: a5MdacDeviceDriverRevision.setStatus('mandatory') a5_mdac_device_driver_build_date = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 5, 1, 4), dmi_displaystring()).setMaxAccess('readonly') if mibBuilder.loadTexts: a5MdacDeviceDriverBuildDate.setStatus('mandatory') t_logical_drive_statistics = mib_table((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 6)) if mibBuilder.loadTexts: tLogicalDriveStatistics.setStatus('mandatory') e_logical_drive_statistics = mib_table_row((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 6, 1)).setIndexNames((0, 'MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'DmiComponentIndex'), (0, 'MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'a6ControllerNumber'), (0, 'MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'a6LogicalDriveNumber')) if mibBuilder.loadTexts: eLogicalDriveStatistics.setStatus('mandatory') a6_controller_number = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 6, 1, 1), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a6ControllerNumber.setStatus('mandatory') a6_logical_drive_number = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 6, 1, 2), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a6LogicalDriveNumber.setStatus('mandatory') a6_read_requests_count = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 6, 1, 3), dmi_counter()).setMaxAccess('readonly') if mibBuilder.loadTexts: a6ReadRequestsCount.setStatus('mandatory') a6_amount_of_data_read_in_mb = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 6, 1, 4), dmi_counter()).setMaxAccess('readonly') if mibBuilder.loadTexts: a6AmountOfDataReadInMb.setStatus('mandatory') a6_write_requests_count = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 6, 1, 5), dmi_counter()).setMaxAccess('readonly') if mibBuilder.loadTexts: a6WriteRequestsCount.setStatus('mandatory') a6_amount_of_data_written_in_mb = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 6, 1, 6), dmi_counter()).setMaxAccess('readonly') if mibBuilder.loadTexts: a6AmountOfDataWrittenInMb.setStatus('mandatory') a6_read_cache_hit = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 6, 1, 7), dmi_counter()).setMaxAccess('readonly') if mibBuilder.loadTexts: a6ReadCacheHit.setStatus('mandatory') t_physical_drive_statistics = mib_table((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 7)) if mibBuilder.loadTexts: tPhysicalDriveStatistics.setStatus('mandatory') e_physical_drive_statistics = mib_table_row((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 7, 1)).setIndexNames((0, 'MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'DmiComponentIndex'), (0, 'MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'a7ControllerNumber'), (0, 'MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'a7ScsiBusId'), (0, 'MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'a7ScsiTargetId')) if mibBuilder.loadTexts: ePhysicalDriveStatistics.setStatus('mandatory') a7_controller_number = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 7, 1, 1), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a7ControllerNumber.setStatus('mandatory') a7_scsi_bus_id = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 7, 1, 2), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a7ScsiBusId.setStatus('mandatory') a7_scsi_target_id = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 7, 1, 3), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a7ScsiTargetId.setStatus('mandatory') a7_read_requests_count = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 7, 1, 4), dmi_counter()).setMaxAccess('readonly') if mibBuilder.loadTexts: a7ReadRequestsCount.setStatus('mandatory') a7_amount_of_data_read_in_kb = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 7, 1, 5), dmi_counter()).setMaxAccess('readonly') if mibBuilder.loadTexts: a7AmountOfDataReadInKb.setStatus('mandatory') a7_write_requests_count = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 7, 1, 6), dmi_counter()).setMaxAccess('readonly') if mibBuilder.loadTexts: a7WriteRequestsCount.setStatus('mandatory') a7_amount_of_data_written_in_kb = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 7, 1, 7), dmi_counter()).setMaxAccess('readonly') if mibBuilder.loadTexts: a7AmountOfDataWrittenInKb.setStatus('mandatory') t_error_control = mib_table((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 98)) if mibBuilder.loadTexts: tErrorControl.setStatus('mandatory') e_error_control = mib_table_row((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 98, 1)).setIndexNames((0, 'MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'DmiComponentIndex'), (0, 'MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'a98Selfid')) if mibBuilder.loadTexts: eErrorControl.setStatus('mandatory') a98_selfid = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 98, 1, 1), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a98Selfid.setStatus('mandatory') a98_number_of_fatal_errors = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 98, 1, 2), dmi_counter()).setMaxAccess('readonly') if mibBuilder.loadTexts: a98NumberOfFatalErrors.setStatus('mandatory') a98_number_of_major_errors = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 98, 1, 3), dmi_counter()).setMaxAccess('readonly') if mibBuilder.loadTexts: a98NumberOfMajorErrors.setStatus('mandatory') a98_number_of_warnings = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 98, 1, 4), dmi_counter()).setMaxAccess('readonly') if mibBuilder.loadTexts: a98NumberOfWarnings.setStatus('mandatory') a98_error_status = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 98, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4))).clone(namedValues=named_values(('vOk', 0), ('vWarning', 1), ('vMajor', 2), ('vFatal', 3), ('vInformational', 4)))).setMaxAccess('readonly') if mibBuilder.loadTexts: a98ErrorStatus.setStatus('mandatory') a98_error_status_type = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 98, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('vPost', 0), ('vRuntime', 1), ('vDiagnosticTest', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: a98ErrorStatusType.setStatus('mandatory') a98_alarm_generation = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 98, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('vOff', 0), ('vOn', 1)))).setMaxAccess('readonly') if mibBuilder.loadTexts: a98AlarmGeneration.setStatus('mandatory') t_miftomib = mib_table((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 99)) if mibBuilder.loadTexts: tMiftomib.setStatus('mandatory') e_miftomib = mib_table_row((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 99, 1)).setIndexNames((0, 'MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'DmiComponentIndex')) if mibBuilder.loadTexts: eMiftomib.setStatus('mandatory') a99_mib_name = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 99, 1, 1), dmi_displaystring()).setMaxAccess('readonly') if mibBuilder.loadTexts: a99MibName.setStatus('mandatory') a99_mib_oid = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 99, 1, 2), dmi_displaystring()).setMaxAccess('readonly') if mibBuilder.loadTexts: a99MibOid.setStatus('mandatory') a99_disable_trap = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 99, 1, 3), dmi_integer()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a99DisableTrap.setStatus('mandatory') t_trap_group = mib_table((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999)) if mibBuilder.loadTexts: tTrapGroup.setStatus('mandatory') e_trap_group = mib_table_row((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1)).setIndexNames((0, 'MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'DmiComponentIndex')) if mibBuilder.loadTexts: eTrapGroup.setStatus('mandatory') a9999_error_time = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1, 1), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: a9999ErrorTime.setStatus('mandatory') a9999_error_status = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1, 2), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a9999ErrorStatus.setStatus('mandatory') a9999_error_group_id = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1, 3), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a9999ErrorGroupId.setStatus('mandatory') a9999_error_instance_id = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1, 4), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a9999ErrorInstanceId.setStatus('mandatory') a9999_component_id = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1, 5), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a9999ComponentId.setStatus('mandatory') a9999_group_id = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1, 6), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a9999GroupId.setStatus('mandatory') a9999_instance_id = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1, 7), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a9999InstanceId.setStatus('mandatory') a9999_vendor_code1 = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1, 8), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a9999VendorCode1.setStatus('mandatory') a9999_vendor_code2 = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1, 9), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a9999VendorCode2.setStatus('mandatory') a9999_vendor_text = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1, 10), octet_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: a9999VendorText.setStatus('mandatory') a9999_parent_group_id = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1, 11), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a9999ParentGroupId.setStatus('mandatory') a9999_parent_instance_id = mib_table_column((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1, 12), dmi_integer()).setMaxAccess('readonly') if mibBuilder.loadTexts: a9999ParentInstanceId.setStatus('mandatory') mdac_event_error = notification_type((1, 3, 6, 1, 4, 1, 1608, 3, 2, 1, 9999, 1) + (0, 1)).setObjects(('MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'a9999ErrorTime'), ('MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'a9999ErrorStatus'), ('MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'a9999ErrorGroupId'), ('MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'a9999ErrorInstanceId'), ('MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'a9999ComponentId'), ('MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'a9999GroupId'), ('MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'a9999InstanceId'), ('MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'a9999VendorCode1'), ('MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'a9999VendorCode2'), ('MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'a9999VendorText'), ('MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'a9999ParentGroupId'), ('MYLEXDAC960SCSIRAIDCONTROLLER-MIB', 'a9999ParentInstanceId')) mibBuilder.exportSymbols('MYLEXDAC960SCSIRAIDCONTROLLER-MIB', eErrorControl=eErrorControl, a3OperationalState=a3OperationalState, a2MaximumConcurrentCommands=a2MaximumConcurrentCommands, a2SlotNumber=a2SlotNumber, a6ReadRequestsCount=a6ReadRequestsCount, a9999GroupId=a9999GroupId, a9999ParentInstanceId=a9999ParentInstanceId, tErrorControl=tErrorControl, a9999ErrorGroupId=a9999ErrorGroupId, a98ErrorStatus=a98ErrorStatus, a2OperationalState=a2OperationalState, a3SizeInMb=a3SizeInMb, a98NumberOfFatalErrors=a98NumberOfFatalErrors, DmiInteger=DmiInteger, a4HardErrorsCount=a4HardErrorsCount, dmtfGroups=dmtfGroups, mdacEventError=mdacEventError, a4DeviceType=a4DeviceType, a6ReadCacheHit=a6ReadCacheHit, a98Selfid=a98Selfid, a2MaximumLogicalDrives=a2MaximumLogicalDrives, a5CiRevision=a5CiRevision, a5MdacDeviceDriverBuildDate=a5MdacDeviceDriverBuildDate, a9999ErrorStatus=a9999ErrorStatus, a2PhysicalSectorSizeInBytes=a2PhysicalSectorSizeInBytes, a3LogicalDriveNumber=a3LogicalDriveNumber, a7AmountOfDataWrittenInKb=a7AmountOfDataWrittenInKb, eLogicalDriveStatistics=eLogicalDriveStatistics, v2=v2, a6AmountOfDataReadInMb=a6AmountOfDataReadInMb, DmiComponentIndex=DmiComponentIndex, a9999VendorCode2=a9999VendorCode2, tLogicalDriveInformation=tLogicalDriveInformation, a98NumberOfMajorErrors=a98NumberOfMajorErrors, a6ControllerNumber=a6ControllerNumber, eControllerInformation=eControllerInformation, a1Version=a1Version, a7ReadRequestsCount=a7ReadRequestsCount, tMiftomib=tMiftomib, ePhysicalDriveStatistics=ePhysicalDriveStatistics, a2BusType=a2BusType, a1Installation=a1Installation, a3RaidLevel=a3RaidLevel, a2InterruptMode=a2InterruptMode, a3ControllerNumber=a3ControllerNumber, a7ScsiTargetId=a7ScsiTargetId, a4ScsiBusId=a4ScsiBusId, a5CiBuildDate=a5CiBuildDate, a5MdacDeviceDriverRevision=a5MdacDeviceDriverRevision, a9999InstanceId=a9999InstanceId, a2RebuildRate=a2RebuildRate, a4VendorId=a4VendorId, a6AmountOfDataWrittenInMb=a6AmountOfDataWrittenInMb, tPhysicalDriveStatistics=tPhysicalDriveStatistics, a99MibOid=a99MibOid, a4SoftErrorsCount=a4SoftErrorsCount, tPhyicalDeviceInformation=tPhyicalDeviceInformation, a2MaximumDataTransferSizePerIoRequestInK=a2MaximumDataTransferSizePerIoRequestInK, a1Verify=a1Verify, a99MibName=a99MibName, a1SerialNumber=a1SerialNumber, a4ProductRevisionLevel=a4ProductRevisionLevel, a6LogicalDriveNumber=a6LogicalDriveNumber, a9999ParentGroupId=a9999ParentGroupId, tTrapGroup=tTrapGroup, a2InterruptVectorNumber=a2InterruptVectorNumber, a1Manufacturer=a1Manufacturer, a2SystemBusNumber=a2SystemBusNumber, a4OperationalState=a4OperationalState, a2CacheLineSizeInBytes=a2CacheLineSizeInBytes, DmiDateX=DmiDateX, a2ActualChannels=a2ActualChannels, a1Product=a1Product, mib=mib, DmiCounter=DmiCounter, eLogicalDriveInformation=eLogicalDriveInformation, a7AmountOfDataReadInKb=a7AmountOfDataReadInKb, a98NumberOfWarnings=a98NumberOfWarnings, a3PhysicalDriveMap=a3PhysicalDriveMap, a7ControllerNumber=a7ControllerNumber, ePhyicalDeviceInformation=ePhyicalDeviceInformation, a9999VendorText=a9999VendorText, a4ControllerNumber=a4ControllerNumber, a4SizeInMb=a4SizeInMb, a98AlarmGeneration=a98AlarmGeneration, tComponentid=tComponentid, a2LogicalSectorSizeInBytes=a2LogicalSectorSizeInBytes, eMiftomib=eMiftomib, a2MaximumTargetsPerChannel=a2MaximumTargetsPerChannel, a3StripeSizeInBytes=a3StripeSizeInBytes, a9999ErrorTime=a9999ErrorTime, a98ErrorStatusType=a98ErrorStatusType, a2ControllerNumber=a2ControllerNumber, tControllerInformation=tControllerInformation, eComponentid=eComponentid, a4ProductId=a4ProductId, a4MiscErrorsCount=a4MiscErrorsCount, eTrapGroup=eTrapGroup, tLogicalDriveStatistics=tLogicalDriveStatistics, a2MaximumTaggedRequests=a2MaximumTaggedRequests, a99DisableTrap=a99DisableTrap, a9999ComponentId=a9999ComponentId, a2ConfiguredChannels=a2ConfiguredChannels, tMylexDac960ComponentInstrumentationInfo=tMylexDac960ComponentInstrumentationInfo, DmiDisplaystring=DmiDisplaystring, a2FirmwareRevision=a2FirmwareRevision, a9999VendorCode1=a9999VendorCode1, eMylexDac960ComponentInstrumentationInfo=eMylexDac960ComponentInstrumentationInfo, a7WriteRequestsCount=a7WriteRequestsCount, a4ScsiTargetId=a4ScsiTargetId, a7ScsiBusId=a7ScsiBusId, a3WritePolicy=a3WritePolicy, a2DramSizeInMb=a2DramSizeInMb, a9999ErrorInstanceId=a9999ErrorInstanceId, a6WriteRequestsCount=a6WriteRequestsCount, a2EpromSizeInKb=a2EpromSizeInKb, a4ParityErrorsCount=a4ParityErrorsCount, mylex=mylex)
class GCodeSegment(): def __init__(self, code, number, x, y, z, raw): self.code = code self.number = number self.raw = raw self.x = x self.y = y self.z = z self.has_cords = (self.x is not None or self.y is not None or self.z is not None) if self.has_cords: if self.x == None: self.x = 0 if self.y == None: self.y = 0 if self.z == None: self.z = 0 if self.has_cords: print (f'\t{self.code} {self.number} ({self.x}, {self.y}, {self.z})') else: print (f'\t{self.code} {self.number}') def command(self): return self.code + self.number def get_cords(self): return (self.x, self.y, self.z) def has_cords(self): return self.has_cords def get_cord(self, cord): cord = cord.upper() if cord == 'X': return self.x elif cord == 'Y': return self.y elif cord == 'Z': return self.z
class Gcodesegment: def __init__(self, code, number, x, y, z, raw): self.code = code self.number = number self.raw = raw self.x = x self.y = y self.z = z self.has_cords = self.x is not None or self.y is not None or self.z is not None if self.has_cords: if self.x == None: self.x = 0 if self.y == None: self.y = 0 if self.z == None: self.z = 0 if self.has_cords: print(f'\t{self.code} {self.number} ({self.x}, {self.y}, {self.z})') else: print(f'\t{self.code} {self.number}') def command(self): return self.code + self.number def get_cords(self): return (self.x, self.y, self.z) def has_cords(self): return self.has_cords def get_cord(self, cord): cord = cord.upper() if cord == 'X': return self.x elif cord == 'Y': return self.y elif cord == 'Z': return self.z
print('Welcom to the Temperature Conventer.') fahrenheit = float(input('\nWhat is the given temperature in Fahrenheit degrees? ')) celsius = (fahrenheit - 32) * 5 / 9 celsius = round(celsius, 4) kelvin = (fahrenheit + 569.67) * 5 / 9 kelvin = round(kelvin, 4) print('\nThe given temperature is equal to:') print('\nFahrenheit degrees: \t ' + str(fahrenheit)) print('Celsius degrees: \t ' + str(celsius)) print('Kelvin degrees: \t ' + str(kelvin))
print('Welcom to the Temperature Conventer.') fahrenheit = float(input('\nWhat is the given temperature in Fahrenheit degrees? ')) celsius = (fahrenheit - 32) * 5 / 9 celsius = round(celsius, 4) kelvin = (fahrenheit + 569.67) * 5 / 9 kelvin = round(kelvin, 4) print('\nThe given temperature is equal to:') print('\nFahrenheit degrees: \t ' + str(fahrenheit)) print('Celsius degrees: \t ' + str(celsius)) print('Kelvin degrees: \t ' + str(kelvin))
StageDict = { "welcome":"welcome", "hasImg":"hasImg", "registed":"registed" }
stage_dict = {'welcome': 'welcome', 'hasImg': 'hasImg', 'registed': 'registed'}
# -*- coding: utf-8 -*- class CookieHandler(object): """This class intends to Handle the cookie field described by the OpenFlow Specification and present in OpenVSwitch. Cookie field has 64 bits. The first 32-bits are assigned to the id of ACL input. The next 4 bits are assigned to the operation type and the remaining 28 bits are filled by zeros. """ @staticmethod def get_cookie(id_acl, src_port=0, dst_port=0): id_acl = format(int(id_acl), '032b') src_port = format(int(src_port), '016b') dst_port = format(int(dst_port), '016b') cookie = id_acl + src_port + dst_port return int(cookie, 2) @staticmethod def get_id_acl(cookie): cookie = format(cookie, '064b') return int(cookie[0:32], 2) @staticmethod def get_src_port(cookie): cookie = format(cookie, '064b') return int(cookie[32:48], 2) @staticmethod def get_dst_port(cookie): cookie = format(cookie, '064b') return int(cookie[48:64], 2)
class Cookiehandler(object): """This class intends to Handle the cookie field described by the OpenFlow Specification and present in OpenVSwitch. Cookie field has 64 bits. The first 32-bits are assigned to the id of ACL input. The next 4 bits are assigned to the operation type and the remaining 28 bits are filled by zeros. """ @staticmethod def get_cookie(id_acl, src_port=0, dst_port=0): id_acl = format(int(id_acl), '032b') src_port = format(int(src_port), '016b') dst_port = format(int(dst_port), '016b') cookie = id_acl + src_port + dst_port return int(cookie, 2) @staticmethod def get_id_acl(cookie): cookie = format(cookie, '064b') return int(cookie[0:32], 2) @staticmethod def get_src_port(cookie): cookie = format(cookie, '064b') return int(cookie[32:48], 2) @staticmethod def get_dst_port(cookie): cookie = format(cookie, '064b') return int(cookie[48:64], 2)
# Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All contributing project authors may # be found in the AUTHORS file in the root of the source tree. { 'includes': [ '../../../webrtc/build/common.gypi', ], 'targets': [ { 'target_name': 'rbe_components', 'type': 'static_library', 'include_dirs': [ '<(webrtc_root)/modules/remote_bitrate_estimator', ], 'sources': [ '<(webrtc_root)/modules/remote_bitrate_estimator/test/bwe_test_logging.cc', '<(webrtc_root)/modules/remote_bitrate_estimator/test/bwe_test_logging.h', 'aimd_rate_control.cc', 'aimd_rate_control.h', 'inter_arrival.cc', 'inter_arrival.h', 'mimd_rate_control.cc', 'mimd_rate_control.h', 'overuse_detector.cc', 'overuse_detector.h', 'overuse_estimator.cc', 'overuse_estimator.h', 'remote_bitrate_estimator_abs_send_time.cc', 'remote_bitrate_estimator_single_stream.cc', 'remote_rate_control.cc', 'remote_rate_control.h', ], }, ], }
{'includes': ['../../../webrtc/build/common.gypi'], 'targets': [{'target_name': 'rbe_components', 'type': 'static_library', 'include_dirs': ['<(webrtc_root)/modules/remote_bitrate_estimator'], 'sources': ['<(webrtc_root)/modules/remote_bitrate_estimator/test/bwe_test_logging.cc', '<(webrtc_root)/modules/remote_bitrate_estimator/test/bwe_test_logging.h', 'aimd_rate_control.cc', 'aimd_rate_control.h', 'inter_arrival.cc', 'inter_arrival.h', 'mimd_rate_control.cc', 'mimd_rate_control.h', 'overuse_detector.cc', 'overuse_detector.h', 'overuse_estimator.cc', 'overuse_estimator.h', 'remote_bitrate_estimator_abs_send_time.cc', 'remote_bitrate_estimator_single_stream.cc', 'remote_rate_control.cc', 'remote_rate_control.h']}]}
class Solution: def removeElement(self, nums: List[int], val: int) -> int: i = 0 while i < len(nums): if nums[i] == val: nums.pop(i) else: i += 1 return len(nums)
class Solution: def remove_element(self, nums: List[int], val: int) -> int: i = 0 while i < len(nums): if nums[i] == val: nums.pop(i) else: i += 1 return len(nums)
class Base(): """ This class represents the base variation of the game upon which other variations can be built, utilizing the functionalities of this class. If the superclass does not override all of these functions in this class, an error is thrown. """ def __init__(self, players): raise NotImplementedError def play_a_round(self, players=None): """ Override this function in the superclass implementing a round of the game with players and deck """ raise NotImplementedError def end_game_reached(self): """ Override this function in the superclass to define the condition which states that the game is over and the winner is declared """ raise NotImplementedError def get_winner(self): """ Override this function in the superclass to return the winner of the game when called """ raise NotImplementedError def remove_players_lost(self): """ Override this function in the superclass to cleanup the players who lose the game either by losing all the cards or the losing condition defined in the variation """ raise NotImplementedError
class Base: """ This class represents the base variation of the game upon which other variations can be built, utilizing the functionalities of this class. If the superclass does not override all of these functions in this class, an error is thrown. """ def __init__(self, players): raise NotImplementedError def play_a_round(self, players=None): """ Override this function in the superclass implementing a round of the game with players and deck """ raise NotImplementedError def end_game_reached(self): """ Override this function in the superclass to define the condition which states that the game is over and the winner is declared """ raise NotImplementedError def get_winner(self): """ Override this function in the superclass to return the winner of the game when called """ raise NotImplementedError def remove_players_lost(self): """ Override this function in the superclass to cleanup the players who lose the game either by losing all the cards or the losing condition defined in the variation """ raise NotImplementedError
class Animal: def __init__(self, nombre): self.nombre = nombre def dormir(self): print("zZzZ") def mover(self): print("caminar") class Sponge(Animal): def mover(self): pass class Cat(Animal): def hacer_ruido(self): print("Meow") class Fish(Animal): def mover(self): print("swim") def hacer_ruido(self): print("glu glu") pelusa = Cat("Pelusa") pelusa.dormir() pelusa.mover() pelusa.hacer_ruido() nemo = Fish("Nemo") nemo.dormir() nemo.mover() nemo.hacer_ruido() bob = Sponge("Bob") bob.dormir() bob.mover()
class Animal: def __init__(self, nombre): self.nombre = nombre def dormir(self): print('zZzZ') def mover(self): print('caminar') class Sponge(Animal): def mover(self): pass class Cat(Animal): def hacer_ruido(self): print('Meow') class Fish(Animal): def mover(self): print('swim') def hacer_ruido(self): print('glu glu') pelusa = cat('Pelusa') pelusa.dormir() pelusa.mover() pelusa.hacer_ruido() nemo = fish('Nemo') nemo.dormir() nemo.mover() nemo.hacer_ruido() bob = sponge('Bob') bob.dormir() bob.mover()
{ 'targets': [ { 'target_name': 'ftdi_labtic', 'sources': [ 'src/ftdi_device.cc', 'src/ftdi_driver.cc' ], 'include_dirs+': [ 'src/', ], 'conditions': [ ['OS == "win"', { 'include_dirs+': [ 'lib/' ], 'link_settings': { "conditions" : [ ["target_arch=='ia32'", { 'libraries': [ '-l<(module_root_dir)/lib/i386/ftd2xx.lib', '-l<(module_root_dir)/lib/i386/FTChipID.lib' ] } ], ["target_arch=='x64'", { 'libraries': [ '-l<(module_root_dir)/lib/amd64/ftd2xx.lib', '-l<(module_root_dir)/lib/amd64/FTChipID.lib' ] }] ] } }], ['OS != "win"', { 'include_dirs+': [ '/usr/local/include/libftd2xx/' ], 'ldflags': [ '-Wl,-Map=output.map', ], 'link_settings': { 'libraries': [ '-lftd2xx' ] } } ] ], } ] }
{'targets': [{'target_name': 'ftdi_labtic', 'sources': ['src/ftdi_device.cc', 'src/ftdi_driver.cc'], 'include_dirs+': ['src/'], 'conditions': [['OS == "win"', {'include_dirs+': ['lib/'], 'link_settings': {'conditions': [["target_arch=='ia32'", {'libraries': ['-l<(module_root_dir)/lib/i386/ftd2xx.lib', '-l<(module_root_dir)/lib/i386/FTChipID.lib']}], ["target_arch=='x64'", {'libraries': ['-l<(module_root_dir)/lib/amd64/ftd2xx.lib', '-l<(module_root_dir)/lib/amd64/FTChipID.lib']}]]}}], ['OS != "win"', {'include_dirs+': ['/usr/local/include/libftd2xx/'], 'ldflags': ['-Wl,-Map=output.map'], 'link_settings': {'libraries': ['-lftd2xx']}}]]}]}
def print_head(msg: str): start = "| " end = " |" line = "-" * (len(msg) + len(start) + len(end)) print(line) print(start + msg + end) print(line)
def print_head(msg: str): start = '| ' end = ' |' line = '-' * (len(msg) + len(start) + len(end)) print(line) print(start + msg + end) print(line)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository") def rpmpack_dependencies(): go_rules_dependencies() go_register_toolchains() gazelle_dependencies() go_repository( name = "com_github_pkg_errors", importpath = "github.com/pkg/errors", tag = "v0.8.1", ) go_repository( name = "com_github_google_go_cmp", importpath = "github.com/google/go-cmp", tag = "v0.2.0", ) go_repository( name = "com_github_cavaliercoder_go_cpio", commit = "925f9528c45e", importpath = "github.com/cavaliercoder/go-cpio", ) go_repository( name = "com_github_ulikunitz_xz", importpath = "github.com/ulikunitz/xz", tag = "v0.5.6", )
load('@io_bazel_rules_go//go:deps.bzl', 'go_register_toolchains', 'go_rules_dependencies') load('@bazel_gazelle//:deps.bzl', 'gazelle_dependencies', 'go_repository') def rpmpack_dependencies(): go_rules_dependencies() go_register_toolchains() gazelle_dependencies() go_repository(name='com_github_pkg_errors', importpath='github.com/pkg/errors', tag='v0.8.1') go_repository(name='com_github_google_go_cmp', importpath='github.com/google/go-cmp', tag='v0.2.0') go_repository(name='com_github_cavaliercoder_go_cpio', commit='925f9528c45e', importpath='github.com/cavaliercoder/go-cpio') go_repository(name='com_github_ulikunitz_xz', importpath='github.com/ulikunitz/xz', tag='v0.5.6')
#rekursif adalah fungsi yg memanggil dirinya sendiri ok sip def cetak(x): print(x) if x>1: cetak(x-1) elif x<1: cetak(x+1) cetak(5)
def cetak(x): print(x) if x > 1: cetak(x - 1) elif x < 1: cetak(x + 1) cetak(5)
def more_zeros(s): s = "".join(dict.fromkeys(s)) # Getting rid of the duplicates in order s2 = [bin(ord(i))[2:] for i in s] s2 = [len(i)>2*i.count('1') for i in s2] return [i for j, i in enumerate(s) if s2[j]] print(more_zeros("DIGEST"))
def more_zeros(s): s = ''.join(dict.fromkeys(s)) s2 = [bin(ord(i))[2:] for i in s] s2 = [len(i) > 2 * i.count('1') for i in s2] return [i for (j, i) in enumerate(s) if s2[j]] print(more_zeros('DIGEST'))
tc = int(input()) while tc: tc -= 1 n, k = map(int, input().split()) if k > 0: print(n%k) else: print(n)
tc = int(input()) while tc: tc -= 1 (n, k) = map(int, input().split()) if k > 0: print(n % k) else: print(n)
arr = list(map(int,input().split())) i = 1 while True: if i not in arr: print(i) break i+=1
arr = list(map(int, input().split())) i = 1 while True: if i not in arr: print(i) break i += 1
""" Define citations for ESPEI """ ESPEI_CITATION = "B. Bocklund, R. Otis, A. Egorov, A. Obaied, I. Roslyakova, Z.-K. Liu, ESPEI for efficient thermodynamic database development, modification, and uncertainty quantification: application to Cu-Mg, MRS Commun. (2019) 1-10. doi:10.1557/mrc.2019.59." ESPEI_BIBTEX = """@article{Bocklund2019ESPEI, archivePrefix = {arXiv}, arxivId = {1902.01269}, author = {Bocklund, Brandon and Otis, Richard and Egorov, Aleksei and Obaied, Abdulmonem and Roslyakova, Irina and Liu, Zi-Kui}, doi = {10.1557/mrc.2019.59}, eprint = {1902.01269}, issn = {2159-6859}, journal = {MRS Communications}, month = {jun}, pages = {1--10}, title = {{ESPEI for efficient thermodynamic database development, modification, and uncertainty quantification: application to Cu-Mg}}, year = {2019} } """
""" Define citations for ESPEI """ espei_citation = 'B. Bocklund, R. Otis, A. Egorov, A. Obaied, I. Roslyakova, Z.-K. Liu, ESPEI for efficient thermodynamic database development, modification, and uncertainty quantification: application to Cu-Mg, MRS Commun. (2019) 1-10. doi:10.1557/mrc.2019.59.' espei_bibtex = '@article{Bocklund2019ESPEI,\narchivePrefix = {arXiv},\narxivId = {1902.01269},\nauthor = {Bocklund, Brandon and Otis, Richard and Egorov, Aleksei and Obaied, Abdulmonem and Roslyakova, Irina and Liu, Zi-Kui},\ndoi = {10.1557/mrc.2019.59},\neprint = {1902.01269},\nissn = {2159-6859},\njournal = {MRS Communications},\nmonth = {jun},\npages = {1--10},\ntitle = {{ESPEI for efficient thermodynamic database development, modification, and uncertainty quantification: application to Cu-Mg}},\nyear = {2019}\n}\n'
class Token: def __init__(self, t_type, lexeme, literal, line): self.type = t_type self.lexeme = lexeme self.literal = literal self.line = line def __repr__(self): return f"Token(type: {self.type}, lexeme: {self.lexeme}, literal: {self.literal}, line: {self.line})" class Node: pass class NumberNode(Node): def __init__(self, num): self.value = num def __repr__(self): return f"Number({self.value})" @property def children(self): return tuple() class BinOp(Node): def __init__(self, l, r, op): self.left = l self.right = r self.op = op def __repr__(self): return f"BinOp({self.left} {self.op} {self.right})" @property def children(self): return (self.left, self.op, self.right) class AssignVar(Node): def __init__(self, varname, v): self.name = varname self.value = v def __repr__(self): return f"Assign({self.name} = {self.value})" @property def children(self): return (self.name, self.value) class Variable(Node): def __init__(self, name): self.name = name def __repr__(self): return f"Variable({self.name})" @property def children(self): return (self.name,) class Call(Node): def __init__(self, value, args): self.value = value self.args = args def __repr__(self): return f"Call({self.value}, {self.args})" @property def children(self): return (self.value, self.args) class ArrayNode(Node): def __init__(self, elements): self.elements = elements def __repr__(self): return f"Array{self.elements}" @property def children(self): return self.elements class IndexFrom(Node): def __init__(self, value, idx): self.value = value self.idx = idx def __repr__(self): return f"IndexFrom({self.value}: {self.idx})" @property def children(self): return (self.value, self.idx) class SetAtIndex(Node): def __init__(self, value, idx, new): self.value = value self.idx = idx self.new = new def __repr__(self): return f"SetAtIndex({self.value}: {self.idx})" @property def children(self): return (self.value, self.idx, self.new)
class Token: def __init__(self, t_type, lexeme, literal, line): self.type = t_type self.lexeme = lexeme self.literal = literal self.line = line def __repr__(self): return f'Token(type: {self.type}, lexeme: {self.lexeme}, literal: {self.literal}, line: {self.line})' class Node: pass class Numbernode(Node): def __init__(self, num): self.value = num def __repr__(self): return f'Number({self.value})' @property def children(self): return tuple() class Binop(Node): def __init__(self, l, r, op): self.left = l self.right = r self.op = op def __repr__(self): return f'BinOp({self.left} {self.op} {self.right})' @property def children(self): return (self.left, self.op, self.right) class Assignvar(Node): def __init__(self, varname, v): self.name = varname self.value = v def __repr__(self): return f'Assign({self.name} = {self.value})' @property def children(self): return (self.name, self.value) class Variable(Node): def __init__(self, name): self.name = name def __repr__(self): return f'Variable({self.name})' @property def children(self): return (self.name,) class Call(Node): def __init__(self, value, args): self.value = value self.args = args def __repr__(self): return f'Call({self.value}, {self.args})' @property def children(self): return (self.value, self.args) class Arraynode(Node): def __init__(self, elements): self.elements = elements def __repr__(self): return f'Array{self.elements}' @property def children(self): return self.elements class Indexfrom(Node): def __init__(self, value, idx): self.value = value self.idx = idx def __repr__(self): return f'IndexFrom({self.value}: {self.idx})' @property def children(self): return (self.value, self.idx) class Setatindex(Node): def __init__(self, value, idx, new): self.value = value self.idx = idx self.new = new def __repr__(self): return f'SetAtIndex({self.value}: {self.idx})' @property def children(self): return (self.value, self.idx, self.new)
CONNECTION = { 'server': 'example@mail.com', 'user': 'user', 'password': 'password', 'port': 993 } CONTENT_TYPES = ['text/plain', 'text/html'] ATTACHMENT_DIR = '' ALLOWED_EXTENSIONS = ['csv']
connection = {'server': 'example@mail.com', 'user': 'user', 'password': 'password', 'port': 993} content_types = ['text/plain', 'text/html'] attachment_dir = '' allowed_extensions = ['csv']
class LNode: def __init__(self, elem, next_=None): self.elem = elem self.next = next_ class LCList: def __init__(self): self._rear = None def is_empty(self): return self._rear is None def prepend(self, elem): p = LNode(elem) if self._rear is None: p.next = p self._rear = p else: p.next = self._rear.next self._rear.next = p def append(self, elem): self.prepend(elem) self._rear = self._rear.next def pop(self): if self._rear is None: print("no data") p = self._rear.next if self._rear is p: self._rear = None else: self._rear.next = p.next return p.elem def printall(self): if self.is_empty(): return p = self._rear.next while True: print(p.elem) if p is self._rear: break p = p.next if __name__ == '__main__': print("main program") else: print("Load module "+__file__)
class Lnode: def __init__(self, elem, next_=None): self.elem = elem self.next = next_ class Lclist: def __init__(self): self._rear = None def is_empty(self): return self._rear is None def prepend(self, elem): p = l_node(elem) if self._rear is None: p.next = p self._rear = p else: p.next = self._rear.next self._rear.next = p def append(self, elem): self.prepend(elem) self._rear = self._rear.next def pop(self): if self._rear is None: print('no data') p = self._rear.next if self._rear is p: self._rear = None else: self._rear.next = p.next return p.elem def printall(self): if self.is_empty(): return p = self._rear.next while True: print(p.elem) if p is self._rear: break p = p.next if __name__ == '__main__': print('main program') else: print('Load module ' + __file__)
counter = 0 while counter <= 5: print("counter", counter) counter = counter + 1 else: print("counter has become false ")
counter = 0 while counter <= 5: print('counter', counter) counter = counter + 1 else: print('counter has become false ')