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
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}')
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.')
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)
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
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))
''' 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
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')
# 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)
#!/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])
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)
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 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]))
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
# 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
# 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'}
# 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 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
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 ')
n = int(input()) space = n-1 for i in range(n): for k in range(space): print(" ",end="") for j in range(i+1): print("* ",end="") print() space -= 1
n = int(input()) space = n - 1 for i in range(n): for k in range(space): print(' ', end='') for j in range(i + 1): print('* ', end='') print() space -= 1
type = 'MMDetector' config = '/home/linkinpark213/Source/mmdetection/configs/faster_rcnn/faster_rcnn_x101_64x4d_fpn_1x_coco.py' checkpoint = 'https://open-mmlab.s3.ap-northeast-2.amazonaws.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_x101_64x4d_fpn_1x_coco/faster_rcnn_x101_64x4d_fpn_1x_coco_20200204-833ee192.pth' conf_threshold = 0.5
type = 'MMDetector' config = '/home/linkinpark213/Source/mmdetection/configs/faster_rcnn/faster_rcnn_x101_64x4d_fpn_1x_coco.py' checkpoint = 'https://open-mmlab.s3.ap-northeast-2.amazonaws.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_x101_64x4d_fpn_1x_coco/faster_rcnn_x101_64x4d_fpn_1x_coco_20200204-833ee192.pth' conf_threshold = 0.5
j = 1 while j <= 9: i = 1 while i <= j: print(f'{i}*{j}={i*j}' , end='\t') i += 1 j += 1 print()
j = 1 while j <= 9: i = 1 while i <= j: print(f'{i}*{j}={i * j}', end='\t') i += 1 j += 1 print()
# This Document class simulates the HTML DOM document object. class Document: def __init__(self, window): self.window = window self.created_elements_index = 0 # This property is required to ensure that every created HTML element can be accessed using a unique reference. def getElementById(self, id): # This method simulates the document.getElementById() JavaScript method # that returns the element that has the ID attribute with the specified value. # Furthermore an HTML_Element object is created including all methods/(properties) related to an HTML element. return HTML_Element(self.window, "document.getElementById('" + id + "')") def createElement(self, tagName): # This method is similar to the document.createElement() JavaScript method # that creates an Element Node with the specified name. # A created HTML_Element object including all methods/(properties) related to an HTML element is returned. # To create an element that can be referenced, # the element is added to the Python.Created_Elements_references object as a new property. # If the HTML element no longer needs to be accessed, the respective property of the Python.Created_Elements_references object should be deleted. # Therefore, the deleteReference_command parameter of the __init__ function is given the JavaScript code to be executed # when creating an HTML_Element object to delete the respective property of the Python.Created_Elements_references object. self.created_elements_index += 1 self.window.execute('Python.Created_Elements_references.e' + str(self.created_elements_index) + ' = document.createElement("' + self.specialchars(tagName) + '");') return HTML_Element(self.window, 'Python.Created_Elements_references.e' + str(self.created_elements_index), 'delete Python.Created_Elements_references.e' + str(self.created_elements_index)) def specialchars(self, s): s = s.replace("\\", "\\\\") return s.replace('"', '\\"') # This class includes all methods/(properties) related to an HTML element. class HTML_Element: def __init__(self, window, element, deleteReference_command=None): self.window = window # The Window object is required to communicate with JavaScript. self.element = element # This property contains the JavaScript code to access the HTML element. self.deleteReference_command = deleteReference_command # This property is needed in case an HTML element is created. # It contains the JavaScript code to delete the respective property # of the Python.Created_Elements_references object so that the # HTML element can no longer be accessed. # In the following way, simulated JavaScript HTML DOM attributes can be added to this class: # @property # async def attribute(self): # return await self.window.get(self.element + ".attribute;") # @attribute.setter # def attribute(self, val): # self.window.execute(self.element + '.attribute = "' + self.specialchars(val) + '";') # It changes/returns the value of an element. @property async def value(self): return await self.window.get(self.element + ".value;") @value.setter def value(self, val): self.window.execute(self.element + '.value = "' + self.specialchars(val) + '";') # It changes/returns the inner HTML of an element. @property async def innerHTML(self): return await self.window.get(self.element + ".innerHTML;") @innerHTML.setter def innerHTML(self, val): self.window.execute(self.element + '.innerHTML = "' + self.specialchars(val) + '";') # This method makes it easy to access the attributes of HTML elements that have not yet been simulated in this class. async def attribute(self, attr, val=None): if val == None: return await self.window.get(self.element + "." + self.specialchars(attr) + ";") else: self.window.execute(self.element + '.' + attr + ' = "' + self.specialchars(val) + '";') # This method changes the attribute value of an HTML element. def setAttribute(self, attr, val): self.window.execute(self.element + '.setAttribute("' + self.specialchars(attr) + '", "' + self.specialchars(val) + '");') # The HTML element is added to the body. def append_this_to_body(self): self.window.execute('document.body.appendChild(' + self.element + ');') # In case an HTML element has been created, JavaScript code is passed during the initialization of the HTML_Element object # allowing to delete the respective property of the Python.Created_Elements_references object # so that the HTML element can no longer be accessed. def deleteReference(self): if self.deleteReference_command != None: self.window.execute(self.deleteReference_command) def specialchars(self, s): s = s.replace("\\", "\\\\") return s.replace('"', '\\"')
class Document: def __init__(self, window): self.window = window self.created_elements_index = 0 def get_element_by_id(self, id): return html__element(self.window, "document.getElementById('" + id + "')") def create_element(self, tagName): self.created_elements_index += 1 self.window.execute('Python.Created_Elements_references.e' + str(self.created_elements_index) + ' = document.createElement("' + self.specialchars(tagName) + '");') return html__element(self.window, 'Python.Created_Elements_references.e' + str(self.created_elements_index), 'delete Python.Created_Elements_references.e' + str(self.created_elements_index)) def specialchars(self, s): s = s.replace('\\', '\\\\') return s.replace('"', '\\"') class Html_Element: def __init__(self, window, element, deleteReference_command=None): self.window = window self.element = element self.deleteReference_command = deleteReference_command @property async def value(self): return await self.window.get(self.element + '.value;') @value.setter def value(self, val): self.window.execute(self.element + '.value = "' + self.specialchars(val) + '";') @property async def innerHTML(self): return await self.window.get(self.element + '.innerHTML;') @innerHTML.setter def inner_html(self, val): self.window.execute(self.element + '.innerHTML = "' + self.specialchars(val) + '";') async def attribute(self, attr, val=None): if val == None: return await self.window.get(self.element + '.' + self.specialchars(attr) + ';') else: self.window.execute(self.element + '.' + attr + ' = "' + self.specialchars(val) + '";') def set_attribute(self, attr, val): self.window.execute(self.element + '.setAttribute("' + self.specialchars(attr) + '", "' + self.specialchars(val) + '");') def append_this_to_body(self): self.window.execute('document.body.appendChild(' + self.element + ');') def delete_reference(self): if self.deleteReference_command != None: self.window.execute(self.deleteReference_command) def specialchars(self, s): s = s.replace('\\', '\\\\') return s.replace('"', '\\"')
# Resample and tidy china: china_annual china_annual = china.resample('A').last().pct_change(10).dropna() # Resample and tidy us: us_annual us_annual = us.resample('A').last().pct_change(10).dropna() # Concatenate china_annual and us_annual: gdp gdp = pd.concat([china_annual,us_annual],join='inner',axis=1) # Resample gdp and print print(gdp.resample('10A').last())
china_annual = china.resample('A').last().pct_change(10).dropna() us_annual = us.resample('A').last().pct_change(10).dropna() gdp = pd.concat([china_annual, us_annual], join='inner', axis=1) print(gdp.resample('10A').last())
train = dict( batch_size=10, num_workers=4, use_amp=True, num_epochs=100, num_iters=30000, epoch_based=True, lr=0.0001, optimizer=dict( mode="adamw", set_to_none=True, group_mode="r3", # ['trick', 'r3', 'all', 'finetune'], cfg=dict(), ), grad_acc_step=1, sche_usebatch=True, scheduler=dict( warmup=dict( num_iters=0, ), mode="poly", cfg=dict( lr_decay=0.9, min_coef=0.001, ), ), save_num_models=1, ms=dict( enable=False, extra_scales=[0.75, 1.25, 1.5], ), grad_clip=dict( enable=False, mode="value", # or 'norm' cfg=dict(), ), ema=dict( enable=False, cmp_with_origin=True, force_cpu=False, decay=0.9998, ), )
train = dict(batch_size=10, num_workers=4, use_amp=True, num_epochs=100, num_iters=30000, epoch_based=True, lr=0.0001, optimizer=dict(mode='adamw', set_to_none=True, group_mode='r3', cfg=dict()), grad_acc_step=1, sche_usebatch=True, scheduler=dict(warmup=dict(num_iters=0), mode='poly', cfg=dict(lr_decay=0.9, min_coef=0.001)), save_num_models=1, ms=dict(enable=False, extra_scales=[0.75, 1.25, 1.5]), grad_clip=dict(enable=False, mode='value', cfg=dict()), ema=dict(enable=False, cmp_with_origin=True, force_cpu=False, decay=0.9998))
examples = [ { "file": "FILENAME", "info": [ { "turn_num": 1, "user": "USER QUERY", "system": "HUMAN RESPONSE", "HDSA": "HDSA RESPONSE", "MarCo": "MarCo RESPONSE", "MarCo vs. system": { "Readability": ["Tie", "MarCo", "System"], "Completion": ["MarCo", "MarCo", "Tie"] } }, ... ] } ]
examples = [{'file': 'FILENAME', 'info': [{'turn_num': 1, 'user': 'USER QUERY', 'system': 'HUMAN RESPONSE', 'HDSA': 'HDSA RESPONSE', 'MarCo': 'MarCo RESPONSE', 'MarCo vs. system': {'Readability': ['Tie', 'MarCo', 'System'], 'Completion': ['MarCo', 'MarCo', 'Tie']}}, ...]}]
# ____ _____ # | _ \ __ _ _ |_ _| __ __ _ ___ ___ _ __ # | |_) / _` | | | || || '__/ _` |/ __/ _ \ '__| # | _ < (_| | |_| || || | | (_| | (_| __/ | # |_| \_\__,_|\__, ||_||_| \__,_|\___\___|_| # |___/ # VERSION = (0, 0, 1) __version__ = '.'.join(map(str, VERSION))
version = (0, 0, 1) __version__ = '.'.join(map(str, VERSION))
A, B = map(int, input().split()) result = 0 for i in range(A, B + 1): if (A + B + i) % 3 == 0: result += 1 print(result)
(a, b) = map(int, input().split()) result = 0 for i in range(A, B + 1): if (A + B + i) % 3 == 0: result += 1 print(result)
# Search in Rotated Sorted Array: https://leetcode.com/problems/search-in-rotated-sorted-array/ # There is an integer array nums sorted in ascending order (with distinct values). # Prior to being passed to your function, nums is rotated at an unknown pivot index k (0 <= k < nums.length) such that the resulting array is [nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]] (0-indexed). For example, [0,1,2,4,5,6,7] might be rotated at pivot index 3 and become [4,5,6,7,0,1,2]. # Given the array nums after the rotation and an integer target, return the index of target if it is in nums, or -1 if it is not in nums. # You must write an algorithm with O(log n) runtime complexity. # Okay the simplest solution to this problem is to do a simple linear search which would take o(n) and is trivial # so to improve on this normally what we do is a binary search because it is shifted there is probably a slight # difference # Actually you can quickly determine if you are including a part of the switch by comparing the first value in you search # to the middle if the start is < mid point then you know it is sorted and you can continually normally # otherwise y ou know that there was a switch and you need to go the opposite direction class Solution: def search(self, nums, target): start, end = 0, len(nums) - 1 while start <= end: mid = start + (end - start) // 2 if nums[mid] == target: return mid # if we have a normal bs then we know that elif nums[mid] >= nums[start]: # Check if our target is between start and mid # Or if it is in the previous section as we rotated across if target >= nums[start] and target < nums[mid]: end = mid - 1 else: start = mid + 1 # other wise we know we need to search in rotated across area else: if target <= nums[end] and target > nums[mid]: start = mid + 1 else: end = mid - 1 # if we didn't find the value return -1 return -1 # This problem seemed really hard at first but honestly since we know that it is a normal binary search if we look at the start and mid point we can # quickly revert this to an almost normal implementation of the binary search algo # This should run in o(log(n)) time and o(1) space as we are cutting the array in half every time and storing no information outside of that array # Score Card # Did I need hints? Slightly I kept messing up the moving of the start and end points # Did you finish within 30 min? 22 # Was the solution optimal? Yup this runs in o(n+m) time in worst case and uses o(1) space # Were there any bugs? See my hints # 4 4 5 3 = 4
class Solution: def search(self, nums, target): (start, end) = (0, len(nums) - 1) while start <= end: mid = start + (end - start) // 2 if nums[mid] == target: return mid elif nums[mid] >= nums[start]: if target >= nums[start] and target < nums[mid]: end = mid - 1 else: start = mid + 1 elif target <= nums[end] and target > nums[mid]: start = mid + 1 else: end = mid - 1 return -1
def init_logger(logger_type, data): logger_profile = [] log_header = 'run_time,read_time,' # what sesnors are we logging? for k, v in data.items(): if(data[k]['device'] != ''): # check to see if our device is setup for kk, vv in data[k]['sensors'].items(): if(data[k]['sensors'][kk]['read'] == True and data[k]['sensors'][kk]['log_on'] == True): log_header += data[k]['sensors'][kk]['log_name'] + "," logger_profile.append((k,'sensors',kk)) print(log_header.strip(",")) return logger_profile def logger(logger_profile, data, start_read, end_read): log = '' i = 0 log += ("{0:0.4f},{1:0.4f},").format(start_read, end_read) for x in logger_profile: if(type(data[x[0]][x[1]][x[2]]['value']) is tuple or type(data[x[0]][x[1]][x[2]]['value']) is map): y = list(data[x[0]][x[1]][x[2]]['value']) # this isnt the best thing to do here, lets clean it up later log += (data[x[0]][x[1]][x[2]]['log_format'] + ",").format(y[0], y[1], y[2]) elif(type(data[x[0]][x[1]][x[2]]['value']) is int): log += ("{},").format(data[x[0]][x[1]][x[2]]['value']) else: log += (data[x[0]][x[1]][x[2]]['log_format'] + ",").format(data[x[0]][x[1]][x[2]]['value']) print(log.strip(","))
def init_logger(logger_type, data): logger_profile = [] log_header = 'run_time,read_time,' for (k, v) in data.items(): if data[k]['device'] != '': for (kk, vv) in data[k]['sensors'].items(): if data[k]['sensors'][kk]['read'] == True and data[k]['sensors'][kk]['log_on'] == True: log_header += data[k]['sensors'][kk]['log_name'] + ',' logger_profile.append((k, 'sensors', kk)) print(log_header.strip(',')) return logger_profile def logger(logger_profile, data, start_read, end_read): log = '' i = 0 log += '{0:0.4f},{1:0.4f},'.format(start_read, end_read) for x in logger_profile: if type(data[x[0]][x[1]][x[2]]['value']) is tuple or type(data[x[0]][x[1]][x[2]]['value']) is map: y = list(data[x[0]][x[1]][x[2]]['value']) log += (data[x[0]][x[1]][x[2]]['log_format'] + ',').format(y[0], y[1], y[2]) elif type(data[x[0]][x[1]][x[2]]['value']) is int: log += '{},'.format(data[x[0]][x[1]][x[2]]['value']) else: log += (data[x[0]][x[1]][x[2]]['log_format'] + ',').format(data[x[0]][x[1]][x[2]]['value']) print(log.strip(','))
class Solution(object): def XXX(self, root): def dfs(node, num, ret): if node is None: return num num += 1 return max(dfs(node.left, num, ret), dfs(node.right, num, ret)) num -= 1 return dfs(root, 0, 0)
class Solution(object): def xxx(self, root): def dfs(node, num, ret): if node is None: return num num += 1 return max(dfs(node.left, num, ret), dfs(node.right, num, ret)) num -= 1 return dfs(root, 0, 0)
# Copyright 2012 Kevin Gillette. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. _ord = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_" _table = dict((c, i) for i, c in enumerate(_ord)) def encode(n, len=0): out = "" while n > 0 or len > 0: out = _ord[n & 63] + out n >>= 6 len -= 1 return out def decode(input): n = 0 for c in input: c = _table.get(c) if c is None: raise ValueError("Invalid character in input: " + c) n = n << 6 | c return n
_ord = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_' _table = dict(((c, i) for (i, c) in enumerate(_ord))) def encode(n, len=0): out = '' while n > 0 or len > 0: out = _ord[n & 63] + out n >>= 6 len -= 1 return out def decode(input): n = 0 for c in input: c = _table.get(c) if c is None: raise value_error('Invalid character in input: ' + c) n = n << 6 | c return n
class User: def __init__(self,name): self.name=name def show(self): print(self.name) user =User("ada66") user.show()
class User: def __init__(self, name): self.name = name def show(self): print(self.name) user = user('ada66') user.show()
def merge(left, right): results = [] while(len(left) and len(right)): if left[0] < right[0]: results.append(left.pop(0)) print(left) else: results.append(right.pop(0)) print(right) return [*results, *left, *right] print(merge([3, 8, 12], [5, 10, 15])) def merge_sort(arr): if len(arr) == 1: return arr center = len(arr) // 2 print(center) left = arr[0: center] right = arr[center:] print(left, right) return merge(merge_sort(left), merge_sort(right)) print(merge_sort([22, 3, 15, 13, 822, 14, 15, 22, 75,]))
def merge(left, right): results = [] while len(left) and len(right): if left[0] < right[0]: results.append(left.pop(0)) print(left) else: results.append(right.pop(0)) print(right) return [*results, *left, *right] print(merge([3, 8, 12], [5, 10, 15])) def merge_sort(arr): if len(arr) == 1: return arr center = len(arr) // 2 print(center) left = arr[0:center] right = arr[center:] print(left, right) return merge(merge_sort(left), merge_sort(right)) print(merge_sort([22, 3, 15, 13, 822, 14, 15, 22, 75]))
SIZE = 400 END_SCORE = 4000 GRID_LEN = 3 WINAT = 2048 GRID_PADDING = 10 CHROMOSOME_LEN = pow(GRID_LEN, 4) + 4*GRID_LEN*GRID_LEN + 1*(pow(GRID_LEN, 4)) TOURNAMENT_SELECTION_SIZE = 4 MUTATION_RATE = 0.4 NUMBER_OF_ELITE_CHROMOSOMES = 4 POPULATION_SIZE = 10 GEN_MAX = 10000 DONOTHINGINPUT_MAX = 5 BACKGROUND_COLOR_GAME = "#92877d" BACKGROUND_COLOR_CELL_EMPTY = "#9e948a" FONT = ("Verdana", 40, "bold") KEY_UP_ALT = "\'\\uf700\'" KEY_DOWN_ALT = "\'\\uf701\'" KEY_LEFT_ALT = "\'\\uf702\'" KEY_RIGHT_ALT = "\'\\uf703\'" KEY_UP = 'w' KEY_DOWN = 's' KEY_LEFT = 'a' KEY_RIGHT = 'd' KEY_BACK = 'b' KEY_J = "'j'" KEY_K = "'k'" KEY_L = "'l'" KEY_H = "'h'"
size = 400 end_score = 4000 grid_len = 3 winat = 2048 grid_padding = 10 chromosome_len = pow(GRID_LEN, 4) + 4 * GRID_LEN * GRID_LEN + 1 * pow(GRID_LEN, 4) tournament_selection_size = 4 mutation_rate = 0.4 number_of_elite_chromosomes = 4 population_size = 10 gen_max = 10000 donothinginput_max = 5 background_color_game = '#92877d' background_color_cell_empty = '#9e948a' font = ('Verdana', 40, 'bold') key_up_alt = "'\\uf700'" key_down_alt = "'\\uf701'" key_left_alt = "'\\uf702'" key_right_alt = "'\\uf703'" key_up = 'w' key_down = 's' key_left = 'a' key_right = 'd' key_back = 'b' key_j = "'j'" key_k = "'k'" key_l = "'l'" key_h = "'h'"
#!/usr/bin/env python ''' ch8q2a1.py Function1 = obtain_os_version -- process the show version output and return the OS version (Version 15.0(1)M4) else return None. Looking for line such as: Cisco IOS Software, C880 Software (C880DATA-UNIVERSALK9-M), Version 15.0(1)M4, RELEASE SOFTWARE (fc1) ''' def obtain_os_version(show_ver_file): ' Return OS Version or None ' os_version = None show_ver_list = show_ver_file.split('\n') for line in show_ver_list: if "Cisco IOS Software" in line: os_version = line.split(', ')[2] return os_version return os_version
""" ch8q2a1.py Function1 = obtain_os_version -- process the show version output and return the OS version (Version 15.0(1)M4) else return None. Looking for line such as: Cisco IOS Software, C880 Software (C880DATA-UNIVERSALK9-M), Version 15.0(1)M4, RELEASE SOFTWARE (fc1) """ def obtain_os_version(show_ver_file): """ Return OS Version or None """ os_version = None show_ver_list = show_ver_file.split('\n') for line in show_ver_list: if 'Cisco IOS Software' in line: os_version = line.split(', ')[2] return os_version return os_version
# 5 # / \ # 3 7 # / \ / \ # 2 4 6 8 tree = Node(5) insert(tree, Node(3)) insert(tree, Node(2)) insert(tree, Node(4)) insert(tree, Node(7)) insert(tree, Node(6)) insert(tree, Node(8)) # 5 3 2 4 7 6 8 preorder(tree)
tree = node(5) insert(tree, node(3)) insert(tree, node(2)) insert(tree, node(4)) insert(tree, node(7)) insert(tree, node(6)) insert(tree, node(8)) preorder(tree)
# Copyright (C) 2021 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # These examples are taken from the TensorFlow specification: # # https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/mirror-pad def test(name, input_dims, input_values, paddings, mode, output_dims, output_values): t = Input("t", ("TENSOR_FLOAT32", input_dims)) paddings = Parameter("paddings", ("TENSOR_INT32", [len(input_dims), 2]), paddings) output = Output("output", ("TENSOR_FLOAT32", output_dims)) model = Model().Operation("MIRROR_PAD", t, paddings, mode).To(output) quant8_asymm_type = ("TENSOR_QUANT8_ASYMM", 0.5, 4) quant8_asymm = DataTypeConverter(name="quant8_asymm").Identify({ t: quant8_asymm_type, output: quant8_asymm_type, }) quant8_asymm_signed_type = ("TENSOR_QUANT8_ASYMM_SIGNED", 0.25, -9) quant8_asymm_signed = DataTypeConverter(name="quant8_asymm_signed").Identify({ t: quant8_asymm_signed_type, output: quant8_asymm_signed_type, }) Example({ t: input_values, output: output_values, }, model=model, name=name).AddVariations("float16", quant8_asymm, quant8_asymm_signed, "int32") test("summary", [2, 3], [1, 2, 3, # input_dims, input_values 4, 5, 6], [1, 1, # paddings 2, 2], 1, # mode = SYMMETRIC [4, 7], [2, 1, 1, 2, 3, 3, 2, # output_dims, output_values 2, 1, 1, 2, 3, 3, 2, 5, 4, 4, 5, 6, 6, 5, 5, 4, 4, 5, 6, 6, 5]) test("mode_reflect", [3], [1, 2, 3], # input_dims, input_values [0, 2], # paddings 0, # mode = REFLECT [5], [1, 2, 3, 2, 1]) # output_dims, output_values test("mode_symmetric", [3], [1, 2, 3], # input_dims, input_values [0, 2], # paddings 1, # mode = SYMMETRIC [5], [1, 2, 3, 3, 2]) # output_dims, output_values
def test(name, input_dims, input_values, paddings, mode, output_dims, output_values): t = input('t', ('TENSOR_FLOAT32', input_dims)) paddings = parameter('paddings', ('TENSOR_INT32', [len(input_dims), 2]), paddings) output = output('output', ('TENSOR_FLOAT32', output_dims)) model = model().Operation('MIRROR_PAD', t, paddings, mode).To(output) quant8_asymm_type = ('TENSOR_QUANT8_ASYMM', 0.5, 4) quant8_asymm = data_type_converter(name='quant8_asymm').Identify({t: quant8_asymm_type, output: quant8_asymm_type}) quant8_asymm_signed_type = ('TENSOR_QUANT8_ASYMM_SIGNED', 0.25, -9) quant8_asymm_signed = data_type_converter(name='quant8_asymm_signed').Identify({t: quant8_asymm_signed_type, output: quant8_asymm_signed_type}) example({t: input_values, output: output_values}, model=model, name=name).AddVariations('float16', quant8_asymm, quant8_asymm_signed, 'int32') test('summary', [2, 3], [1, 2, 3, 4, 5, 6], [1, 1, 2, 2], 1, [4, 7], [2, 1, 1, 2, 3, 3, 2, 2, 1, 1, 2, 3, 3, 2, 5, 4, 4, 5, 6, 6, 5, 5, 4, 4, 5, 6, 6, 5]) test('mode_reflect', [3], [1, 2, 3], [0, 2], 0, [5], [1, 2, 3, 2, 1]) test('mode_symmetric', [3], [1, 2, 3], [0, 2], 1, [5], [1, 2, 3, 3, 2])
class SemanticException(Exception): def __init__(self, message, token=None): if token is None: super(SemanticException, self).__init__(message) else: super(SemanticException, self).__init__(message + ': ' + token.__str__())
class Semanticexception(Exception): def __init__(self, message, token=None): if token is None: super(SemanticException, self).__init__(message) else: super(SemanticException, self).__init__(message + ': ' + token.__str__())
keys = { "x" :"x", "y" :"y", "l" :"left", "left" :"left", "r" :"right", "right" :"right", "t" :"top", "top" :"top", "b" :"bottom", "bottom":"bottom", "w" :"width", "width" :"width", "h" :"height", "height":"height", "a" :"align", "align" :"align", "d" :"dock", "dock" :"dock" } align_values_reversed = { "TopLeft":"tl,lt,topleft,lefttop", "Top":"t,top", "TopRight":"tr,rt,topright,righttop", "Right":"r,right", "BottomRight":"br,rb,bottomright,rightbottom", "Bottom":"b,bottom", "BottomLeft":"bl,lb,bottomleft,leftbottom", "Left":"l,left", "Center":"c,center", } def GenerateAlignValue(): global align_values_reversed d = {} for k in align_values_reversed: for v in align_values_reversed[k].split(","): d[v] = k return d; def ComputeHash(s): s = s.upper() h = 0 index = 0 for k in s: ch_id = (ord(k)-ord('A'))+1 #h = h * 2 + ch_id h = h + ch_id + index index+=2 #h += ch_id return h def ComputeHashes(d_list): d = {} for k in d_list: h = ComputeHash(k) if not h in d: d[h] = d_list[k] if d[h]!=d_list[k]: print("Colission: key:'"+k+"' mapped to '"+d_list[k]+"' has the same hash as keys mapped to '"+d[h]+"' !") return None return d def CreateKeys(): res = ComputeHashes(keys) if not res: return d = {} for k in keys: d[keys[k]] = 1 s = "constexpr unsigned char LAYOUT_KEY_NONE = 0;\n" v = 1; idx = 1 for k in d: s += "constexpr unsigned short LAYOUT_KEY_"+k.upper()+" = %d;\n"%(idx); s += "constexpr unsigned short LAYOUT_FLAG_"+k.upper()+" = 0x%04X;\n"%(v); v *= 2 idx+=1 s += "\n" s += "constexpr unsigned char _layout_translate_map_["+str(max(res)+1)+"] = {" for h in range(0,max(res)+1): if h in res: s += "LAYOUT_KEY_"+res[h].upper()+"," else: s += "LAYOUT_KEY_NONE," s = s[:-1] + "};\n" s += "\n"; s += "inline unsigned char HashToLayoutKey(unsigned int hash) {\n"; s += " if (hash>="+str(max(res)+1)+") return LAYOUT_KEY_NONE;\n"; s += " return _layout_translate_map_[hash];\n" s += "};\n" return s def CreateAlignValues(): av = GenerateAlignValue() res = ComputeHashes(av) if not res: return s = "" #s += "/* HASH VALUES FOR ALIGN:\n" #for h in res: # s += " %s => %d\n"%(res[h],h) #s += "*/\n" s += "constexpr unsigned char _align_translate_map_["+str(max(res)+1)+"] = {" for h in range(0,max(res)+1): if h in res: s += "(unsigned char)Alignament::"+res[h]+"," else: s += "0xFF," s = s[:-1] + "};\n" s += "\n"; s += "inline bool HashToAlignament(unsigned int hash, Alignament & align) {\n"; s += " if (hash>="+str(max(res)+1)+") return false;\n"; s += " auto ch = _align_translate_map_[hash];\n"; s += " if (ch == 0xFF) return false;\n"; s += " align = static_cast<Alignament>(ch);\n"; s += " return true;\n" s += "};\n" return s s = "\n//=========================================" s += "\n// THIS CODE WAS AUTOMATICALLY GENERATED !" s += "\n//=========================================" s += "\n" s += "\n"+CreateKeys() s += "\n" s += "\n"+CreateAlignValues() s += "\n" s += "\n//=========================================" s += "\n// END OF AUTOMATICALLY GENERATED CODE" s += "\n//=========================================" s += "\n" print(s)
keys = {'x': 'x', 'y': 'y', 'l': 'left', 'left': 'left', 'r': 'right', 'right': 'right', 't': 'top', 'top': 'top', 'b': 'bottom', 'bottom': 'bottom', 'w': 'width', 'width': 'width', 'h': 'height', 'height': 'height', 'a': 'align', 'align': 'align', 'd': 'dock', 'dock': 'dock'} align_values_reversed = {'TopLeft': 'tl,lt,topleft,lefttop', 'Top': 't,top', 'TopRight': 'tr,rt,topright,righttop', 'Right': 'r,right', 'BottomRight': 'br,rb,bottomright,rightbottom', 'Bottom': 'b,bottom', 'BottomLeft': 'bl,lb,bottomleft,leftbottom', 'Left': 'l,left', 'Center': 'c,center'} def generate_align_value(): global align_values_reversed d = {} for k in align_values_reversed: for v in align_values_reversed[k].split(','): d[v] = k return d def compute_hash(s): s = s.upper() h = 0 index = 0 for k in s: ch_id = ord(k) - ord('A') + 1 h = h + ch_id + index index += 2 return h def compute_hashes(d_list): d = {} for k in d_list: h = compute_hash(k) if not h in d: d[h] = d_list[k] if d[h] != d_list[k]: print("Colission: key:'" + k + "' mapped to '" + d_list[k] + "' has the same hash as keys mapped to '" + d[h] + "' !") return None return d def create_keys(): res = compute_hashes(keys) if not res: return d = {} for k in keys: d[keys[k]] = 1 s = 'constexpr unsigned char LAYOUT_KEY_NONE = 0;\n' v = 1 idx = 1 for k in d: s += 'constexpr unsigned short LAYOUT_KEY_' + k.upper() + ' = %d;\n' % idx s += 'constexpr unsigned short LAYOUT_FLAG_' + k.upper() + ' = 0x%04X;\n' % v v *= 2 idx += 1 s += '\n' s += 'constexpr unsigned char _layout_translate_map_[' + str(max(res) + 1) + '] = {' for h in range(0, max(res) + 1): if h in res: s += 'LAYOUT_KEY_' + res[h].upper() + ',' else: s += 'LAYOUT_KEY_NONE,' s = s[:-1] + '};\n' s += '\n' s += 'inline unsigned char HashToLayoutKey(unsigned int hash) {\n' s += '\tif (hash>=' + str(max(res) + 1) + ') return LAYOUT_KEY_NONE;\n' s += '\treturn _layout_translate_map_[hash];\n' s += '};\n' return s def create_align_values(): av = generate_align_value() res = compute_hashes(av) if not res: return s = '' s += 'constexpr unsigned char _align_translate_map_[' + str(max(res) + 1) + '] = {' for h in range(0, max(res) + 1): if h in res: s += '(unsigned char)Alignament::' + res[h] + ',' else: s += '0xFF,' s = s[:-1] + '};\n' s += '\n' s += 'inline bool HashToAlignament(unsigned int hash, Alignament & align) {\n' s += '\tif (hash>=' + str(max(res) + 1) + ') return false;\n' s += '\tauto ch = _align_translate_map_[hash];\n' s += '\tif (ch == 0xFF) return false;\n' s += '\talign = static_cast<Alignament>(ch);\n' s += '\treturn true;\n' s += '};\n' return s s = '\n//=========================================' s += '\n// THIS CODE WAS AUTOMATICALLY GENERATED !' s += '\n//=========================================' s += '\n' s += '\n' + create_keys() s += '\n' s += '\n' + create_align_values() s += '\n' s += '\n//=========================================' s += '\n// END OF AUTOMATICALLY GENERATED CODE' s += '\n//=========================================' s += '\n' print(s)