content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
#!/usr/bin/python def modular_helper(base, exponent, modulus, prefactor=1): c = 1 for k in range(exponent): c = (c * base) % modulus return ((prefactor % modulus) * c) % modulus def fibN(n): phi = (1 + 5 ** 0.5) / 2 return int(phi ** n / 5 ** 0.5 + 0.5) # Alternate problem solutions start here def problem0012a(): p = primes(1000) n, Dn, cnt = 3, 2, 0 while cnt <= 500: n, n1 = n + 1, n if n1 % 2 == 0: n1 = n1 // 2 Dn1 = 1 for pi in p: if pi * pi > n1: Dn1 = 2 * Dn1 break exponent = 1 while n1 % pi == 0: exponent += 1 n1 = n1 / pi if exponent > 1: Dn1 = Dn1 * exponent if n1 == 1: break cnt = Dn * Dn1 Dn = Dn1 return (n - 1) * (n - 2) // 2 def problem0013a(): with open('problem0013.txt') as f: s = f.readlines() return int(str(sum(int(k[:11]) for k in s))[:10]) # solution due to veritas on Project Euler Forums def problem0014a(ub=1000000): table = {1: 1} def collatz(n): if not n in table: if n % 2 == 0: table[n] = collatz(n // 2) + 1 elif n % 4 == 1: table[n] = collatz((3 * n + 1) // 4) + 3 else: table[n] = collatz((3 * n + 1) // 2) + 2 return table[n] return max(xrange(ub // 2 + 1, ub, 2), key=collatz) # 13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1 # 13 -(3)-> 10 -(1)-> 5 -(3)-> 4 -(1)-> 2 -(1)-> 1 def veritas_iterative(ub=1000000): table = {1: 1} def collatz(n): seq, steps = [], [] while not n in table: seq.append(n) if n % 2 and n % 4 == 1: n, x = (3 * n + 1) // 4, 3 elif n % 2: n, x = (3 * n + 1) // 2, 2 else: n, x = n // 2, 1 steps.append(x) x = table[n] while seq: n, xn = seq.pop(), steps.pop() x = x + xn table[n] = x return x return max(xrange(ub // 2 + 1, ub, 2), key=collatz) def problem0026a(n=1000): return max(d for d in primes(n) if not any(10 ** x % d == 1 for x in range(1, d - 1))) def problem0031a(): def tally(*p): d = (100, 50, 20, 10, 5, 2, 1) return 200 - sum(k * v for k, v in zip(p, d)) c = 2 for p100 in range(2): mp50 = int(tally(p100) / 50) + 1 for p50 in range(mp50): mp20 = int(tally(p100, p50) / 20) + 1 for p20 in range(mp20): mp10 = int(tally(p100, p50, p20) / 10) + 1 for p10 in range(mp10): mp5 = int(tally(p100, p50, p20, p10) / 5) + 1 for p5 in range(mp5): mp2 = int(tally(p100, p50, p20, p10, p5) / 2) + 1 for p2 in range(mp2): c += 1 return c def problem0089a(): n2r = [(1000, 'M'), (900, 'CM'), (500, 'D'), (400, 'CD'), (100, 'C'), (90, 'XC'), (50, 'L'), (40, 'XL'), (10, 'X'), (9, 'IX'), (5, 'V'), (4, 'IV'), (1, 'I')] r2n = {b: a for a, b in n2r} def to_roman(x): s = [] while x: n, c = next((n, c) for n, c in n2r if x >= n) s.append(c) x = x - n return ''.join(s) def from_roman(r): k, s = 0, 0 while k < len(r): if r[k] not in ('I', 'X', 'C') or k == len(r) - 1: s = s + r2n[r[k]] elif r[k:k+2] in r2n: s = s + r2n[r[k:k+2]] k = k + 1 else: s = s + r2n[r[k]] k = k + 1 return s return sum(len(r) - len(to_roman(from_roman(r))) for r in data.readRoman()) def problem0097a(): # Note 7830457 = 29 * 270015 + 22 # (10 ** 10 - 1) * 2 ** 29 does not overflow a 64 bit integer p, b, e = 28433, 2, 7830457 d, m = divmod(e, 29) prefactor = 28433 * 2 ** m return modular_helper(2 ** 29, 270015, 10 ** 10, 28433 * 2 ** m) + 1
def modular_helper(base, exponent, modulus, prefactor=1): c = 1 for k in range(exponent): c = c * base % modulus return prefactor % modulus * c % modulus def fib_n(n): phi = (1 + 5 ** 0.5) / 2 return int(phi ** n / 5 ** 0.5 + 0.5) def problem0012a(): p = primes(1000) (n, dn, cnt) = (3, 2, 0) while cnt <= 500: (n, n1) = (n + 1, n) if n1 % 2 == 0: n1 = n1 // 2 dn1 = 1 for pi in p: if pi * pi > n1: dn1 = 2 * Dn1 break exponent = 1 while n1 % pi == 0: exponent += 1 n1 = n1 / pi if exponent > 1: dn1 = Dn1 * exponent if n1 == 1: break cnt = Dn * Dn1 dn = Dn1 return (n - 1) * (n - 2) // 2 def problem0013a(): with open('problem0013.txt') as f: s = f.readlines() return int(str(sum((int(k[:11]) for k in s)))[:10]) def problem0014a(ub=1000000): table = {1: 1} def collatz(n): if not n in table: if n % 2 == 0: table[n] = collatz(n // 2) + 1 elif n % 4 == 1: table[n] = collatz((3 * n + 1) // 4) + 3 else: table[n] = collatz((3 * n + 1) // 2) + 2 return table[n] return max(xrange(ub // 2 + 1, ub, 2), key=collatz) def veritas_iterative(ub=1000000): table = {1: 1} def collatz(n): (seq, steps) = ([], []) while not n in table: seq.append(n) if n % 2 and n % 4 == 1: (n, x) = ((3 * n + 1) // 4, 3) elif n % 2: (n, x) = ((3 * n + 1) // 2, 2) else: (n, x) = (n // 2, 1) steps.append(x) x = table[n] while seq: (n, xn) = (seq.pop(), steps.pop()) x = x + xn table[n] = x return x return max(xrange(ub // 2 + 1, ub, 2), key=collatz) def problem0026a(n=1000): return max((d for d in primes(n) if not any((10 ** x % d == 1 for x in range(1, d - 1))))) def problem0031a(): def tally(*p): d = (100, 50, 20, 10, 5, 2, 1) return 200 - sum((k * v for (k, v) in zip(p, d))) c = 2 for p100 in range(2): mp50 = int(tally(p100) / 50) + 1 for p50 in range(mp50): mp20 = int(tally(p100, p50) / 20) + 1 for p20 in range(mp20): mp10 = int(tally(p100, p50, p20) / 10) + 1 for p10 in range(mp10): mp5 = int(tally(p100, p50, p20, p10) / 5) + 1 for p5 in range(mp5): mp2 = int(tally(p100, p50, p20, p10, p5) / 2) + 1 for p2 in range(mp2): c += 1 return c def problem0089a(): n2r = [(1000, 'M'), (900, 'CM'), (500, 'D'), (400, 'CD'), (100, 'C'), (90, 'XC'), (50, 'L'), (40, 'XL'), (10, 'X'), (9, 'IX'), (5, 'V'), (4, 'IV'), (1, 'I')] r2n = {b: a for (a, b) in n2r} def to_roman(x): s = [] while x: (n, c) = next(((n, c) for (n, c) in n2r if x >= n)) s.append(c) x = x - n return ''.join(s) def from_roman(r): (k, s) = (0, 0) while k < len(r): if r[k] not in ('I', 'X', 'C') or k == len(r) - 1: s = s + r2n[r[k]] elif r[k:k + 2] in r2n: s = s + r2n[r[k:k + 2]] k = k + 1 else: s = s + r2n[r[k]] k = k + 1 return s return sum((len(r) - len(to_roman(from_roman(r))) for r in data.readRoman())) def problem0097a(): (p, b, e) = (28433, 2, 7830457) (d, m) = divmod(e, 29) prefactor = 28433 * 2 ** m return modular_helper(2 ** 29, 270015, 10 ** 10, 28433 * 2 ** m) + 1
class Vector2D: def __init__(self, vec: List[List[int]]): self.v = vec self.row=0 self.col=0 def next(self) -> int: if self.hasNext(): val=self.v[self.row][self.col] self.col+=1 return val else: return def hasNext(self) -> bool: while self.row<len(self.v): if self.col<len(self.v[self.row]): return True self.row+=1 self.col=0 return False # Your Vector2D object will be instantiated and called as such: # obj = Vector2D(vec) # param_1 = obj.next() # param_2 = obj.hasNext()
class Vector2D: def __init__(self, vec: List[List[int]]): self.v = vec self.row = 0 self.col = 0 def next(self) -> int: if self.hasNext(): val = self.v[self.row][self.col] self.col += 1 return val else: return def has_next(self) -> bool: while self.row < len(self.v): if self.col < len(self.v[self.row]): return True self.row += 1 self.col = 0 return False
# Create a dictionary with the roll number, name and marks # of n students in a class and display the names of students # who have marks above 75. n = int(input("Enter number of students: ")) result = {} for i in range(n): print("Enter Details of student No.", i+1) rno = int(input("Roll No: ")) name = input("Name: ") marks = int(input("Marks: ")) result[rno] = [name, marks] for student in result: if result[student][1] > 75: print(f'{result[student][0]} has marks more than 75')
n = int(input('Enter number of students: ')) result = {} for i in range(n): print('Enter Details of student No.', i + 1) rno = int(input('Roll No: ')) name = input('Name: ') marks = int(input('Marks: ')) result[rno] = [name, marks] for student in result: if result[student][1] > 75: print(f'{result[student][0]} has marks more than 75')
def abs(x: str) -> float: return x if x > 0 else -x # print(abs(10)) # print(abs(-10)) x = set() # print(type(x)) x.add(10) x.add(10) x.add(10) # print(x) # print(len(x)) # print([ord(character) for character in input()]) # print(x.__repr__()) # var = map(int, input().split()) # print(var) n = int(input()) print(sum(x ** 2 for x in range(1, n + 1)))
def abs(x: str) -> float: return x if x > 0 else -x x = set() x.add(10) x.add(10) x.add(10) n = int(input()) print(sum((x ** 2 for x in range(1, n + 1))))
first_number = 500 / 100 + 50 + 45 second_number = 250 - 50 print(first_number) print(second_number) total = first_number + second_number print(total)
first_number = 500 / 100 + 50 + 45 second_number = 250 - 50 print(first_number) print(second_number) total = first_number + second_number print(total)
CORE_URL = "https://www.gov.br/receitafederal/pt-br/assuntos/orientacao-tributaria/cadastros/consultas/dados-publicos-cnpj" CORE_URL_FILES = "http://200.152.38.155/CNPJ" CNAE_JSON_NAME = 'cnaes.json' NATJU_JSON_NAME = 'natju.json' QUAL_SOCIO_JSON_NAME = 'qual_socio.json' MOTIVOS_JSON_NAME = 'motivos.json' PAIS_JSON_NAME = 'pais.json' MUNIC_JSON_NAME = 'municipios.json'
core_url = 'https://www.gov.br/receitafederal/pt-br/assuntos/orientacao-tributaria/cadastros/consultas/dados-publicos-cnpj' core_url_files = 'http://200.152.38.155/CNPJ' cnae_json_name = 'cnaes.json' natju_json_name = 'natju.json' qual_socio_json_name = 'qual_socio.json' motivos_json_name = 'motivos.json' pais_json_name = 'pais.json' munic_json_name = 'municipios.json'
CLIENT_LOCK_QUEUE_REQUEST_TIME_OUT = 30000 CLIENT_UNLOCK_QUEUE_REQUEST_TIME_OUT = 30000 CLIENT_DEFAULT_DECLARE_QUEUES_REQUEST_TIME_OUT = 30000 CLIENT_DEFAULT_DECLARE_QUEUE_REQUEST_TIME_OUT = 30000 CLIENT_DEFAULT_DECLARE_EXCHANGES_REQUEST_TIME_OUT = 30000 CLIENT_DEFAULT_DECLARE_EXCHANGE_REQUEST_TIME_OUT = 30000 CLIENT_DEFAULT_DELETE_QUEUES_REQUEST_TIME_OUT = 30000 # Validation time outs; milliseconds. QM_LOCK_QUEUES_REQUEST_TIME_OUT = 30000 QM_UNLOCK_QUEUES_REQUEST_TIME_OUT = 30000 WORKER_VALIDATE_QUEUE_DELETION_TIMEOUT = 30000 WORKER_VALIDATE_DECLARATION_TIMEOUT = 30000
client_lock_queue_request_time_out = 30000 client_unlock_queue_request_time_out = 30000 client_default_declare_queues_request_time_out = 30000 client_default_declare_queue_request_time_out = 30000 client_default_declare_exchanges_request_time_out = 30000 client_default_declare_exchange_request_time_out = 30000 client_default_delete_queues_request_time_out = 30000 qm_lock_queues_request_time_out = 30000 qm_unlock_queues_request_time_out = 30000 worker_validate_queue_deletion_timeout = 30000 worker_validate_declaration_timeout = 30000
# Sometimes methods take arguments. # Try changing the argument passed to lpad. # Then try some whole different methods... catcher = 'Joyce' print(third_batter.lpad(10)) print(third_batter.startswith('M')) print(third_batter.endswith(''))
catcher = 'Joyce' print(third_batter.lpad(10)) print(third_batter.startswith('M')) print(third_batter.endswith(''))
count_shiny_gold_bag = 0 rules = {} with open("input.txt", "r") as f: lines = [line.rstrip() for line in f.readlines()] answered_yes_group = [] for line in lines: line = line.split(" bags contain ") line[1] = line[1].split(",") bags = [] for bag in line[1]: bag = bag.strip(" ") bags.append(bag.split(" ")) contained_bags = [] for bag in bags: bag = bag[1] + " " + bag[2] contained_bags.append(bag) if "other" in contained_bags[0]: contained_bags[0] = "None" rules[line[0]] = contained_bags bags = ["shiny gold"] for bag in bags: for rule in rules: if bag in rules[rule]: if rule not in bags: bags.append(rule) print(f"\nHow many bag colors can eventually contain at least one shiny gold bag? {len(bags) - 1}")
count_shiny_gold_bag = 0 rules = {} with open('input.txt', 'r') as f: lines = [line.rstrip() for line in f.readlines()] answered_yes_group = [] for line in lines: line = line.split(' bags contain ') line[1] = line[1].split(',') bags = [] for bag in line[1]: bag = bag.strip(' ') bags.append(bag.split(' ')) contained_bags = [] for bag in bags: bag = bag[1] + ' ' + bag[2] contained_bags.append(bag) if 'other' in contained_bags[0]: contained_bags[0] = 'None' rules[line[0]] = contained_bags bags = ['shiny gold'] for bag in bags: for rule in rules: if bag in rules[rule]: if rule not in bags: bags.append(rule) print(f'\nHow many bag colors can eventually contain at least one shiny gold bag? {len(bags) - 1}')
class ParserInterface(): def open(self): pass def get_data(self): pass def close(self): pass
class Parserinterface: def open(self): pass def get_data(self): pass def close(self): pass
# Number of bromine atoms in each species cfc11 = 0 cfc12 = 0 cfc113 = 0 cfc114 = 0 cfc115 = 0 carb_tet = 0 mcf = 0 hcfc22 = 0 hcfc141b = 0 hcfc142b = 0 halon1211 = 1 halon1202 = 2 halon1301 = 1 halon2402 = 2 ch3br = 1 ch3cl = 0 aslist = [cfc11, cfc12, cfc113, cfc114, cfc115, carb_tet, mcf, hcfc22, hcfc141b, hcfc142b, halon1211, halon1202, halon1301, halon2402, ch3br, ch3cl]
cfc11 = 0 cfc12 = 0 cfc113 = 0 cfc114 = 0 cfc115 = 0 carb_tet = 0 mcf = 0 hcfc22 = 0 hcfc141b = 0 hcfc142b = 0 halon1211 = 1 halon1202 = 2 halon1301 = 1 halon2402 = 2 ch3br = 1 ch3cl = 0 aslist = [cfc11, cfc12, cfc113, cfc114, cfc115, carb_tet, mcf, hcfc22, hcfc141b, hcfc142b, halon1211, halon1202, halon1301, halon2402, ch3br, ch3cl]
class S: ASSETS_PATH = "assets/" WINDOW_SIZE = (432, 768) @staticmethod def save_sprite(name, image): name = name.upper() if not hasattr(S, name): setattr(S, name, image) setattr(S, name + "_RECT", image.get_rect())
class S: assets_path = 'assets/' window_size = (432, 768) @staticmethod def save_sprite(name, image): name = name.upper() if not hasattr(S, name): setattr(S, name, image) setattr(S, name + '_RECT', image.get_rect())
#!/usr/bin/env python count = 3 list1 = [] while count > 0: num = int(input(">>> ")) list1.append(num) count -= 1 list1.sort() print(list1)
count = 3 list1 = [] while count > 0: num = int(input('>>> ')) list1.append(num) count -= 1 list1.sort() print(list1)
def Fun(): pass class A: def __init__(self): pass def Fun(self): pass try: print(Fun.__name__) print(A.__init__.__name__) print(A.Fun.__name__) print(A().Fun.__name__) except AttributeError: print('SKIP')
def fun(): pass class A: def __init__(self): pass def fun(self): pass try: print(Fun.__name__) print(A.__init__.__name__) print(A.Fun.__name__) print(a().Fun.__name__) except AttributeError: print('SKIP')
a = input() d = {'A':0,'B':0} for i in range(0,len(a),2): d[a[i]] += int(a[i+1]) if d['A'] > d['B']: print("A") else: print("B")
a = input() d = {'A': 0, 'B': 0} for i in range(0, len(a), 2): d[a[i]] += int(a[i + 1]) if d['A'] > d['B']: print('A') else: print('B')
# -*- coding: utf-8 -*- # this file is released under public domain and you can use without limitations ######################################################################### ## This is a sample controller ## - index is the default action of any application ## - user is required for authentication and authorization ## - download is for downloading files uploaded in the db (does streaming) ######################################################################### @auth.requires_membership('admins') def manage_author(): mydb.author.image.represent = lambda image, row: IMG(_src=URL('admin', 'download', args=image), _class='author_image', _width='50px', _onclick='$("#image_container").attr("src","'+URL("admin", "download", args=image)+'");document.getElementById("text_container").innerHTML = "'+str(row.name)+'"; $("#imageModal").modal("show");', ) if image else '' grid = SQLFORM.grid(mydb.author, headers={'author.image':'Autor'}, #user_signature=False #http://www.web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-grid, do not check login showbuttontext = False ) #return locals() return {'author': grid} @auth.requires_membership('admins') def manage_book(): mydb.book.image.represent = lambda image, row: IMG(_src=URL('admin', 'download', args=image), _class='book_image', _width='50px', _onclick='$("#image_container").attr("src","'+URL("admin", "download", args=image)+'");document.getElementById("text_container").innerHTML = "'+str(row.book[row] if 'trailer' in row.book else '')+'"; $("#imageModal").modal("show");', ) if image else '' mydb.author.image.represent = lambda image, row: IMG(_src=URL('admin', 'download', args=image), _class='author_image', _width='50px', _onclick='$("#image_container").attr("src","'+URL("admin", "download", args=image)+'");document.getElementById("text_container").innerHTML = "'+str(row.author['name'] if 'name' in row.author else row.as_dict())+'"; $("#imageModal").modal("show");', ) if image else '' mydb.author.name.readable = False grid = SQLFORM.grid(mydb.book, left = [ mydb.author.on( mydb.book.author == mydb.author.id )], fields = [ mydb.book.title, mydb.book.publish_date, mydb.book.isbn,mydb.book.trailer, mydb.book.image, mydb.author.image, mydb.author.name], #user_signature=False, maxtextlength=200, showbuttontext = False, headers={'book.image':'Buch','author.image':'Autor'} ) return {'books':grid} def download(): return response.download(request, mydb) #todo: receive variable quantities. x_number_of_quantities = book_copy. ''' TOOD - set the grid so that adding new entries is not allowed - add a custom button in the corresponding view pointing to new_hofb() ''' @auth.requires_membership('admins') def handling_of_the_book(): grid = SQLFORM.grid(mydb.handling_of_the_book, #user_signature=True, maxtextlength=200, showbuttontext = False, ) return {'handling_of_the_book':grid} def finish_book_order(i_status, i_status_2, i_check_in): logger.debug('finish_book_order with arguments {} {} {}'.format(i_status, i_status_2, i_check_in)) hb_id = mydb( mydb.book_order_checkout.id == request.args(0) ).select( mydb.book_order_checkout.handling_of_the_book )[0]["handling_of_the_book"] #get id of handle table logger.debug('book id: {}'.format(hb_id)) mydb(mydb.handling_of_the_book.id == hb_id).update(status=i_status) order_row = mydb( mydb.book_order_checkout.id == request.args(0) ).select()[0] #get row of table 'book_order_checkout' mydb(mydb.book_order_checkout.id == request.args(0)).delete() #delete row in table 'book_order_checkout' mydb.book_order_past.insert(check_out=order_row['check_out'],check_in=i_check_in,username=order_row['username'],user_id=order_row['user_id'],status=i_status_2,handling_of_the_book=hb_id) #backup oder in backup table redirect(URL('admin', 'requested_books')) #redirect back to checkin page @auth.requires_membership('admins') def lost_book(): #TODO fix, read book id from argument and then update the record finish_book_order(19, 19, '') @auth.requires_membership('admins') def checkin_book(): #TODO fix, read book id from argument and then update the record finish_book_order(17, 24, request.now) @auth.requires_membership('admins') def checkout(): #TODO fix, read book id from argument and then update the record hb_id = mydb( mydb.book_order_checkout.id == request.args(0) ).select( mydb.book_order_checkout.handling_of_the_book )[0]["handling_of_the_book"] #get id of handle table mydb(mydb.handling_of_the_book.id == hb_id).update(status=22) #set status to 'checked out' mydb(mydb.book_order_checkout.id == request.args(0)).update(status=22, check_out=request.now) #set status in table 'book_order_checkout' to 'checked out' and set check out date redirect(URL('admin', 'requested_books')) #redirect back to checkin page @auth.requires_membership('admins') def checkin(): grid = SQLFORM.grid(mydb.book_order_checkout.status == 22, #get books with status 'checked out' left = [ mydb.handling_of_the_book.on( mydb.handling_of_the_book.id == mydb.book_order_checkout.handling_of_the_book ), #left join handling table mydb.book.on( mydb.handling_of_the_book.book == mydb.book.id )], #left join book tabke fields = [ mydb.book_order_checkout.id, mydb.book.title,mydb.book_order_checkout.user_id, mydb.book_order_checkout.username, mydb.book_order_checkout.check_out ], #fields to display deletable = True, editable = True, create = False, maxtextlength=100, details = False, csv = False, links=[lambda row: A(T('Check in'), #button for checking in a book _href=URL('admin', 'checkin_book', args=row.book_order_checkout.id), _class='button btn btn-default', _name='btnUpdate' ), lambda row: A(T('Lost'), #button for marking a book as lost _href=URL('admin', 'lost_book', args=row.book_order_checkout.id), _class='button btn btn-default', _name='btnUpdate', showbuttontext = False, ) ] ) return {'checkin':grid} @auth.requires_membership('admins') def requested_books(): grid = SQLFORM.grid( mydb( (mydb.book_order_checkout.status == 21) | (mydb.book_order_checkout.status == 22) ), left = [ mydb.handling_of_the_book.on( mydb.handling_of_the_book.id == mydb.book_order_checkout.handling_of_the_book ), #left join handling table mydb.book.on( mydb.handling_of_the_book.book == mydb.book.id )], #left join book table fields = [ mydb.book_order_checkout.status, mydb.book_order_checkout.id, mydb.book.title,mydb.book.image, mydb.book_order_checkout.user_id, mydb.book_order_checkout.username, mydb.book_order_checkout.check_out ], #fields to be displayed deletable = False, editable = False, create = False, maxtextlength=100, details = False, csv = False, links=[ lambda row: create_buttons(row)], showbuttontext = False ) return dict(grid=grid) def create_buttons(row): buttons = [] if(row.book_order_checkout.status == 21): return A(T('Check out'), #button for checking in a book _href=URL('admin', 'checkout', args=row.book_order_checkout.id), _class='button btn btn-default', _name='btnUpdate' ) elif(row.book_order_checkout.status == 22): return DIV(A(T('Check in'), _href=URL('admin', 'checkin_book', args=row.book_order_checkout.id), _class='button btn btn-default', _name='btnUpdate' ) + A(T('Lost'), #button for checking in a book _href=URL('admin', 'lost_book', args=row.book_order_checkout.id), _class='button btn btn-default', _name='btnUpdate' )) return '' @auth.requires_membership('admins') def past_book_orders(): grid = SQLFORM.grid(mydb( mydb.book_order_past ), #show past book orders for logged in user left = [ mydb.handling_of_the_book.on( mydb.handling_of_the_book.id == mydb.book_order_past.handling_of_the_book ), #left join handling table mydb.book.on( mydb.handling_of_the_book.book == mydb.book.id )], #left join book table fields = [ mydb.book.title,mydb.book.image, mydb.book_order_past.check_out, mydb.book_order_past.username, mydb.book_order_past.check_in, mydb.book_order_past.status ], editable = False, maxtextlength=100, details = False, csv = False, showbuttontext = False ) return dict(past_book_orders=grid) #new_hofb() = new_handling_of_the_book(): def new_hofb(): #creating a standard SQLFORM from the handling_of_the_book table form = SQLFORM(mydb.handling_of_the_book, fields=['book', 'location'], ) #creating new quantity variables which are used to display an additional field to the form #as quantity is not part of the handling_of_the_book table quantity_label = LABEL('Quantity', _class='form-control-label col-sm-3', _for='handling_of_the_book_copy_quantity') quantity_input = DIV( INPUT(_name='quantity', _value=1, _type='number', _min="1", _id='handling_of_the_book_copy_quantity', _class='generic-widget form-control'), _class='col-sm-9' ) quantity_element = DIV( _class='form-group row', _id='handling_of_the_book_quantity__row') quantity_element.append(quantity_label) quantity_element.append(quantity_input) #adding quantity label and field, to the form, using the correct format (structure, classes, ids, ...) form[0].insert(-1, quantity_element) #hello world #TODO (1) handle the form input #TODO (2) create a new handling_of_the_book row "quantity" times, and insert them in the db #DONE (3) validate quantity (1 or more, error on 0 or negative) #DONE (4) tell the admin user the result of the action (ok, error) #attempting to get from variables and handle them (1 and 4, the rest if for later) #if form.accepts(request, session): #hell and damnation! the SQLFORM is inserting records automatically!!! I have to handle the additional values by hand... but how? #the work is done by the "accepts" method! nasty code! if form.process(onvalidation=new_hofb_validation, dbio=False).accepted: #we use the form vars, which are now validated book_id = int(form.vars.book) location_id = int(form.vars.location) quantity = int(form.vars.quantity) status = 17 #hard coding the status id, should be using a select but I do thid as placehodler, I'll do the select afterwards #TODO point (2) #create the records #insert the records for n in range(quantity): mydb.handling_of_the_book.insert(book=book_id, status=17, location=location_id) request.vars.book = mydb( mydb.book.id == book_id ).select( mydb.book.title )[0]['title'] request.vars.location = mydb( mydb.location.id == location_id ).select( mydb.location.location_name )[0]['location_name'] response.flash = 'Books records created' elif form.errors: response.flash = 'Please check the form for errors' else: response.flash = 'Dear Librarian, here you can add new books to the library. Beware of rats' logger.warn('errors in the form {}'.format(request.vars)) if request.vars.book is None: request.vars.book = '' request.vars.quantity = '' request.vars.location = '' return dict(form=form) ''' additional function to help validating the quantity in new_hofb form ''' def new_hofb_validation(form): quantity = form.vars.quantity #TODO check if quantity is in form.vars try: if quantity == None: #this should never happen as the html form should handle form.errors.quantity = "Quantity cannot be empty" elif int(quantity) < 1: #this should be handled by html5 number fields, but just in case... form.errors.quantity = "Quantity cannot be less than 1" except expression as identifier: form.errors.quantity = "Quantity must be a number" def authors_and_books(): #TODO reformat this as SQLFORM.grid ''' t = TABLE() header = TR(TH('Author'), TH('Books count'), TH('Books')) authors_rows = mydb(mydb.author.id > 0).select() for author_row in authors_rows: r = TR() print '-----' print author_row.id, author_row.name r.append( TD(author_row.name) ) books_rows = mydb(mydb.book.author == author_row.id).select() #print ('%s' % books_rows) count = 0 for book in books_rows: count = count + 1 print book.id, book.title #count = len(books_rows) r.append( TD(count) ) link = A('books', _href=URL(works_of_the_author, args=[author_row.id])) r.append( TD(link) ) t.append(r) ''' #TODO add counts column dict(header='name',body=lambda row: A(...)) #TODO add link column (use the link attribute as by SQLFORM.grid in chapter 7) t = SQLFORM.grid( mydb.author, #user_signature=False, deletable = False, editable = False, create = False, details = False, csv = False, links = [ {'header':'book_count','body':lambda row: _generate_author_books_count(row)}, {'header':'link_to_books', 'body':lambda row: A('link', _href=URL(works_of_the_author, args=[row.id]))} ] ) return {'out':t} @auth.requires_membership('admins') def works_of_the_author(): grid = SQLFORM.grid(mydb(mydb.book.author == request.args[0]), fields = [mydb.book.title, mydb.book.publish_date, mydb.book.isbn], user_signature=False, maxtextlength=200, showbuttontext = False ) return {'out':grid} @auth.requires_membership('admins') def user_overview(): grid = SQLFORM.grid(db(db.auth_user), left = [ db.auth_membership.on( db.auth_user.id == db.auth_membership.user_id ), db.auth_group.on( db.auth_membership.group_id == db.auth_group.id )], fields = [db.auth_user.username, db.auth_user.first_name, db.auth_user.last_name, db.auth_group.role, db.auth_user.registration_key], #user_signature=False, maxtextlength=200, links = [{'header':'', 'body':lambda row: _registration_button(row)}], showbuttontext = False, ) return {'users':grid} def _registration_button(row): try: btn = A('Status') registration_status = row.auth_user.registration_key ''' using URL with vars, so each value will have it's corresponding key if I had used args, then they would be sent in order but without key vars: code: vars={'username':row.auth_user.username,'value':'active'} output: http://127.0.0.1:8000/Bibi2/admin/update_registration_status?username=andrea&value=active args: code: args=[row.auth_user.username, 'active'] output: http://127.0.0.1:8000/Bibi2/admin/update_registration_status?andrea&active ''' if registration_status in ['pending', 'disabled', 'blocked']: #TODO check the various user registration possible states in the documentation btn = A('Activate', _class = 'btn btn-success', _href= URL('update_registration_status', vars={'username':row.auth_user.username,'value':'activate'})) else: btn = A('Disable', _class = 'btn btn-danger', _href= URL('update_registration_status', vars={'username':row.auth_user.username,'value':'disable'})) return btn except: return '' @auth.requires_membership('admins') def update_registration_status(): #read arguments from url #eg http://127.0.0.1:8000/Bibi2/admin/update_registration_status?username=testUser&value=active #how to read vars username = request.vars['username'] if 'username' in request.vars else None value = request.vars['value'] if 'value' in request.vars else None out = None ''' #how to read args username = request.args[0] if len(request.args) >= 1 else None value = request.args[1] if len(request.args) >= 2 else None ''' if (username != None and value != None): if (value == 'activate'): out = db(db.auth_user.username == username).update(registration_key=None) if (value == 'disable'): out = db(db.auth_user.username == username).update(registration_key='blocked') pass else: #do nothing because stuff is missing, or find a way to display some kind of unobstrusive error out = 0 redirect(URL('admin', 'user_overview')) return out def _generate_author_books_count( row ): books_rows = mydb(mydb.book.author == row.id).select() books_count = 0 for book in books_rows: books_count = books_count + 1 return books_count ''' option: from lambda call a function 'count': lambda row: generate_count_of_books(books_rows) count = 0 for book in books_rows: count = count + 1 return count 'link': lambda row: generate_author_book_link(link) def generate_count_of_books(): def generate_author_book_link(): return {'out':t} ''' def free_books(): return 0
@auth.requires_membership('admins') def manage_author(): mydb.author.image.represent = lambda image, row: img(_src=url('admin', 'download', args=image), _class='author_image', _width='50px', _onclick='$("#image_container").attr("src","' + url('admin', 'download', args=image) + '");document.getElementById("text_container").innerHTML = "' + str(row.name) + '"; $("#imageModal").modal("show");') if image else '' grid = SQLFORM.grid(mydb.author, headers={'author.image': 'Autor'}, showbuttontext=False) return {'author': grid} @auth.requires_membership('admins') def manage_book(): mydb.book.image.represent = lambda image, row: img(_src=url('admin', 'download', args=image), _class='book_image', _width='50px', _onclick='$("#image_container").attr("src","' + url('admin', 'download', args=image) + '");document.getElementById("text_container").innerHTML = "' + str(row.book[row] if 'trailer' in row.book else '') + '"; $("#imageModal").modal("show");') if image else '' mydb.author.image.represent = lambda image, row: img(_src=url('admin', 'download', args=image), _class='author_image', _width='50px', _onclick='$("#image_container").attr("src","' + url('admin', 'download', args=image) + '");document.getElementById("text_container").innerHTML = "' + str(row.author['name'] if 'name' in row.author else row.as_dict()) + '"; $("#imageModal").modal("show");') if image else '' mydb.author.name.readable = False grid = SQLFORM.grid(mydb.book, left=[mydb.author.on(mydb.book.author == mydb.author.id)], fields=[mydb.book.title, mydb.book.publish_date, mydb.book.isbn, mydb.book.trailer, mydb.book.image, mydb.author.image, mydb.author.name], maxtextlength=200, showbuttontext=False, headers={'book.image': 'Buch', 'author.image': 'Autor'}) return {'books': grid} def download(): return response.download(request, mydb) '\nTOOD\n- set the grid so that adding new entries is not allowed\n- add a custom button in the corresponding view pointing to new_hofb()\n' @auth.requires_membership('admins') def handling_of_the_book(): grid = SQLFORM.grid(mydb.handling_of_the_book, maxtextlength=200, showbuttontext=False) return {'handling_of_the_book': grid} def finish_book_order(i_status, i_status_2, i_check_in): logger.debug('finish_book_order with arguments {} {} {}'.format(i_status, i_status_2, i_check_in)) hb_id = mydb(mydb.book_order_checkout.id == request.args(0)).select(mydb.book_order_checkout.handling_of_the_book)[0]['handling_of_the_book'] logger.debug('book id: {}'.format(hb_id)) mydb(mydb.handling_of_the_book.id == hb_id).update(status=i_status) order_row = mydb(mydb.book_order_checkout.id == request.args(0)).select()[0] mydb(mydb.book_order_checkout.id == request.args(0)).delete() mydb.book_order_past.insert(check_out=order_row['check_out'], check_in=i_check_in, username=order_row['username'], user_id=order_row['user_id'], status=i_status_2, handling_of_the_book=hb_id) redirect(url('admin', 'requested_books')) @auth.requires_membership('admins') def lost_book(): finish_book_order(19, 19, '') @auth.requires_membership('admins') def checkin_book(): finish_book_order(17, 24, request.now) @auth.requires_membership('admins') def checkout(): hb_id = mydb(mydb.book_order_checkout.id == request.args(0)).select(mydb.book_order_checkout.handling_of_the_book)[0]['handling_of_the_book'] mydb(mydb.handling_of_the_book.id == hb_id).update(status=22) mydb(mydb.book_order_checkout.id == request.args(0)).update(status=22, check_out=request.now) redirect(url('admin', 'requested_books')) @auth.requires_membership('admins') def checkin(): grid = SQLFORM.grid(mydb.book_order_checkout.status == 22, left=[mydb.handling_of_the_book.on(mydb.handling_of_the_book.id == mydb.book_order_checkout.handling_of_the_book), mydb.book.on(mydb.handling_of_the_book.book == mydb.book.id)], fields=[mydb.book_order_checkout.id, mydb.book.title, mydb.book_order_checkout.user_id, mydb.book_order_checkout.username, mydb.book_order_checkout.check_out], deletable=True, editable=True, create=False, maxtextlength=100, details=False, csv=False, links=[lambda row: a(t('Check in'), _href=url('admin', 'checkin_book', args=row.book_order_checkout.id), _class='button btn btn-default', _name='btnUpdate'), lambda row: a(t('Lost'), _href=url('admin', 'lost_book', args=row.book_order_checkout.id), _class='button btn btn-default', _name='btnUpdate', showbuttontext=False)]) return {'checkin': grid} @auth.requires_membership('admins') def requested_books(): grid = SQLFORM.grid(mydb((mydb.book_order_checkout.status == 21) | (mydb.book_order_checkout.status == 22)), left=[mydb.handling_of_the_book.on(mydb.handling_of_the_book.id == mydb.book_order_checkout.handling_of_the_book), mydb.book.on(mydb.handling_of_the_book.book == mydb.book.id)], fields=[mydb.book_order_checkout.status, mydb.book_order_checkout.id, mydb.book.title, mydb.book.image, mydb.book_order_checkout.user_id, mydb.book_order_checkout.username, mydb.book_order_checkout.check_out], deletable=False, editable=False, create=False, maxtextlength=100, details=False, csv=False, links=[lambda row: create_buttons(row)], showbuttontext=False) return dict(grid=grid) def create_buttons(row): buttons = [] if row.book_order_checkout.status == 21: return a(t('Check out'), _href=url('admin', 'checkout', args=row.book_order_checkout.id), _class='button btn btn-default', _name='btnUpdate') elif row.book_order_checkout.status == 22: return div(a(t('Check in'), _href=url('admin', 'checkin_book', args=row.book_order_checkout.id), _class='button btn btn-default', _name='btnUpdate') + a(t('Lost'), _href=url('admin', 'lost_book', args=row.book_order_checkout.id), _class='button btn btn-default', _name='btnUpdate')) return '' @auth.requires_membership('admins') def past_book_orders(): grid = SQLFORM.grid(mydb(mydb.book_order_past), left=[mydb.handling_of_the_book.on(mydb.handling_of_the_book.id == mydb.book_order_past.handling_of_the_book), mydb.book.on(mydb.handling_of_the_book.book == mydb.book.id)], fields=[mydb.book.title, mydb.book.image, mydb.book_order_past.check_out, mydb.book_order_past.username, mydb.book_order_past.check_in, mydb.book_order_past.status], editable=False, maxtextlength=100, details=False, csv=False, showbuttontext=False) return dict(past_book_orders=grid) def new_hofb(): form = sqlform(mydb.handling_of_the_book, fields=['book', 'location']) quantity_label = label('Quantity', _class='form-control-label col-sm-3', _for='handling_of_the_book_copy_quantity') quantity_input = div(input(_name='quantity', _value=1, _type='number', _min='1', _id='handling_of_the_book_copy_quantity', _class='generic-widget form-control'), _class='col-sm-9') quantity_element = div(_class='form-group row', _id='handling_of_the_book_quantity__row') quantity_element.append(quantity_label) quantity_element.append(quantity_input) form[0].insert(-1, quantity_element) if form.process(onvalidation=new_hofb_validation, dbio=False).accepted: book_id = int(form.vars.book) location_id = int(form.vars.location) quantity = int(form.vars.quantity) status = 17 for n in range(quantity): mydb.handling_of_the_book.insert(book=book_id, status=17, location=location_id) request.vars.book = mydb(mydb.book.id == book_id).select(mydb.book.title)[0]['title'] request.vars.location = mydb(mydb.location.id == location_id).select(mydb.location.location_name)[0]['location_name'] response.flash = 'Books records created' elif form.errors: response.flash = 'Please check the form for errors' else: response.flash = 'Dear Librarian, here you can add new books to the library. Beware of rats' logger.warn('errors in the form {}'.format(request.vars)) if request.vars.book is None: request.vars.book = '' request.vars.quantity = '' request.vars.location = '' return dict(form=form) '\nadditional function to help validating the quantity in new_hofb form\n' def new_hofb_validation(form): quantity = form.vars.quantity try: if quantity == None: form.errors.quantity = 'Quantity cannot be empty' elif int(quantity) < 1: form.errors.quantity = 'Quantity cannot be less than 1' except expression as identifier: form.errors.quantity = 'Quantity must be a number' def authors_and_books(): """ t = TABLE() header = TR(TH('Author'), TH('Books count'), TH('Books')) authors_rows = mydb(mydb.author.id > 0).select() for author_row in authors_rows: r = TR() print '-----' print author_row.id, author_row.name r.append( TD(author_row.name) ) books_rows = mydb(mydb.book.author == author_row.id).select() #print ('%s' % books_rows) count = 0 for book in books_rows: count = count + 1 print book.id, book.title #count = len(books_rows) r.append( TD(count) ) link = A('books', _href=URL(works_of_the_author, args=[author_row.id])) r.append( TD(link) ) t.append(r) """ t = SQLFORM.grid(mydb.author, deletable=False, editable=False, create=False, details=False, csv=False, links=[{'header': 'book_count', 'body': lambda row: _generate_author_books_count(row)}, {'header': 'link_to_books', 'body': lambda row: a('link', _href=url(works_of_the_author, args=[row.id]))}]) return {'out': t} @auth.requires_membership('admins') def works_of_the_author(): grid = SQLFORM.grid(mydb(mydb.book.author == request.args[0]), fields=[mydb.book.title, mydb.book.publish_date, mydb.book.isbn], user_signature=False, maxtextlength=200, showbuttontext=False) return {'out': grid} @auth.requires_membership('admins') def user_overview(): grid = SQLFORM.grid(db(db.auth_user), left=[db.auth_membership.on(db.auth_user.id == db.auth_membership.user_id), db.auth_group.on(db.auth_membership.group_id == db.auth_group.id)], fields=[db.auth_user.username, db.auth_user.first_name, db.auth_user.last_name, db.auth_group.role, db.auth_user.registration_key], maxtextlength=200, links=[{'header': '', 'body': lambda row: _registration_button(row)}], showbuttontext=False) return {'users': grid} def _registration_button(row): try: btn = a('Status') registration_status = row.auth_user.registration_key "\n using URL with vars, so each value will have it's corresponding key\n if I had used args, then they would be sent in order but without key\n vars:\n code: vars={'username':row.auth_user.username,'value':'active'}\n output: http://127.0.0.1:8000/Bibi2/admin/update_registration_status?username=andrea&value=active\n\n args: \n code: args=[row.auth_user.username, 'active']\n output: http://127.0.0.1:8000/Bibi2/admin/update_registration_status?andrea&active\n " if registration_status in ['pending', 'disabled', 'blocked']: btn = a('Activate', _class='btn btn-success', _href=url('update_registration_status', vars={'username': row.auth_user.username, 'value': 'activate'})) else: btn = a('Disable', _class='btn btn-danger', _href=url('update_registration_status', vars={'username': row.auth_user.username, 'value': 'disable'})) return btn except: return '' @auth.requires_membership('admins') def update_registration_status(): username = request.vars['username'] if 'username' in request.vars else None value = request.vars['value'] if 'value' in request.vars else None out = None '\n #how to read args\n username = request.args[0] if len(request.args) >= 1 else None\n value = request.args[1] if len(request.args) >= 2 else None\n ' if username != None and value != None: if value == 'activate': out = db(db.auth_user.username == username).update(registration_key=None) if value == 'disable': out = db(db.auth_user.username == username).update(registration_key='blocked') pass else: out = 0 redirect(url('admin', 'user_overview')) return out def _generate_author_books_count(row): books_rows = mydb(mydb.book.author == row.id).select() books_count = 0 for book in books_rows: books_count = books_count + 1 return books_count "\n option: from lambda call a function\n\n 'count': lambda row:\n generate_count_of_books(books_rows)\n count = 0\n for book in books_rows:\n count = count + 1\n return count\n\n\n 'link': lambda row:\n generate_author_book_link(link)\n\n def generate_count_of_books():\n\n def generate_author_book_link(): \n\n \n\n \n return {'out':t}\n " def free_books(): return 0
# Leetcode 94. Binary Tree Inorder Traversal # # Link: https://leetcode.com/problems/binary-tree-inorder-traversal/ # Difficulty: Easy # Complexity: # O(N) time | where N represent the number of nodes in the tree # O(N) space | where N represent the number of nodes in the tree # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def inorderTraversal(self, root: Optional[TreeNode]) -> List[int]: def recursive(root): if not root: return [] return recursive(root.left) + [root.val] + recursive(root.right) def iterative(root): stack = [] result = [] while root or stack: while root: stack.append(root) root = root.left root = stack.pop() result.append(root.val) root = root.right return result return iterative(root)
class Solution: def inorder_traversal(self, root: Optional[TreeNode]) -> List[int]: def recursive(root): if not root: return [] return recursive(root.left) + [root.val] + recursive(root.right) def iterative(root): stack = [] result = [] while root or stack: while root: stack.append(root) root = root.left root = stack.pop() result.append(root.val) root = root.right return result return iterative(root)
def median(L): L.sort() return L[len(L) // 2] if __name__ == "__main__": L = [10, 17, 25, 1, 4, 15, 6] print(median(L))
def median(L): L.sort() return L[len(L) // 2] if __name__ == '__main__': l = [10, 17, 25, 1, 4, 15, 6] print(median(L))
def greet(bot_name, birth_year): print('Hello! My name is ' + bot_name + '.') print('I was created in ' + birth_year + '.') def remind_name(): print('Please, remind me your name.') name = input() print('What a great name you have, ' + name + '!') def guess_age(): # Remainders are the remains of dividing age by 3, 5 and 7. remainder3 = int(input('Enter the rest resulting from dividing your age by 3: > ')) remainder5 = int(input('Enter the rest resulting from dividing your age by 5: > ')) remainder7 = int(input('Enter the rest resulting from dividing your age by 7: > ')) # Guess how old you are your_age = (remainder3 * 70 + remainder5 * 21 + remainder7 * 15) % 105 print(f"Your age is", your_age, "that's a good time to start programming!") def count(): print('Now I will prove to you that I can count to any number you want.') num = int(input()) curr = 0 while curr <= num: print(curr, '!') curr = curr + 1 def test(): print("Let's test your programming knowledge.") # write your code here print("Why do we use methods? \n1. To repeat a statement multiple times.\n2. To decompose a program into several small subroutines.\n3. To determine the execution time of a program.\n4. To interrupt the execution of a program?") choose = input() while choose == 2: print('Completed, have a nice day!') else: print("error: Wrong answer!") def end(): print('Congratulations, have a nice day!') greet('borjauria', '2020') remind_name() guess_age() count() test() end()
def greet(bot_name, birth_year): print('Hello! My name is ' + bot_name + '.') print('I was created in ' + birth_year + '.') def remind_name(): print('Please, remind me your name.') name = input() print('What a great name you have, ' + name + '!') def guess_age(): remainder3 = int(input('Enter the rest resulting from dividing your age by 3: > ')) remainder5 = int(input('Enter the rest resulting from dividing your age by 5: > ')) remainder7 = int(input('Enter the rest resulting from dividing your age by 7: > ')) your_age = (remainder3 * 70 + remainder5 * 21 + remainder7 * 15) % 105 print(f'Your age is', your_age, "that's a good time to start programming!") def count(): print('Now I will prove to you that I can count to any number you want.') num = int(input()) curr = 0 while curr <= num: print(curr, '!') curr = curr + 1 def test(): print("Let's test your programming knowledge.") print('Why do we use methods? \n1. To repeat a statement multiple times.\n2. To decompose a program into several small subroutines.\n3. To determine the execution time of a program.\n4. To interrupt the execution of a program?') choose = input() while choose == 2: print('Completed, have a nice day!') else: print('error: Wrong answer!') def end(): print('Congratulations, have a nice day!') greet('borjauria', '2020') remind_name() guess_age() count() test() end()
self.description = "Install packages with huge descriptions" p1 = pmpkg("pkg1") p1.desc = 'A' * 500 * 1024 self.addpkg(p1) p2 = pmpkg("pkg2") p2.desc = 'A' * 600 * 1024 self.addpkg(p2) self.args = "-U %s %s" % (p1.filename(), p2.filename()) # We error out when fed a package with an invalid description; the second one # fits the bill in this case as the desc is > 512K self.addrule("PACMAN_RETCODE=1") self.addrule("!PKG_EXIST=pkg1") self.addrule("!PKG_EXIST=pkg1")
self.description = 'Install packages with huge descriptions' p1 = pmpkg('pkg1') p1.desc = 'A' * 500 * 1024 self.addpkg(p1) p2 = pmpkg('pkg2') p2.desc = 'A' * 600 * 1024 self.addpkg(p2) self.args = '-U %s %s' % (p1.filename(), p2.filename()) self.addrule('PACMAN_RETCODE=1') self.addrule('!PKG_EXIST=pkg1') self.addrule('!PKG_EXIST=pkg1')
# 99 Days of Code - Sung to the tune of "99 bottles of beer" x = 99 z = 1 while x > 1: y = x - 1 print(x , "days of code to complete,", x, "days of code.") print("Commit to win,then start again", y, "days of code to complete...") print() x = x - 1 if x == 1: print("1 day of code to complete,", "1 day of code") print("It wont be long so finish off strong, 1 day of code to complete.") print() print("No more days of code to complete, no more days of code") print("Don't be blue, just pick something new! 99 days of code to complete")
x = 99 z = 1 while x > 1: y = x - 1 print(x, 'days of code to complete,', x, 'days of code.') print('Commit to win,then start again', y, 'days of code to complete...') print() x = x - 1 if x == 1: print('1 day of code to complete,', '1 day of code') print('It wont be long so finish off strong, 1 day of code to complete.') print() print('No more days of code to complete, no more days of code') print("Don't be blue, just pick something new! 99 days of code to complete")
def dist(X, m): S = 0 for x in X: S += abs(x - m) return S T = int(input()) for ti in range(T): N, M, F = map(int, input().split()) X = [] Y = [] for fi in range(F): x, y = map(int, input().split()) X.append(x) Y.append(y) X = sorted(X) Y = sorted(Y) F = 2 if F & 1: xx = str(X[F // 2]) yy = str(Y[F // 2]) print('(Street: ' + xx + ', Avenue: ' + yy + ')') else: a = F // 2 b = (F // 2) - 1 A = dist(X, X[a]) + dist(Y, Y[a]) B = dist(X, X[b]) + dist(Y, Y[b]) print(A, B) if A < B: xx = str(X[a]) yy = str(Y[a]) print('(Street: ' + xx + ', Avenue: ' + yy + ')') else: xx = str(X[b]) yy = str(Y[b]) print('(Street: ' + xx + ', Avenue: ' + yy + ')')
def dist(X, m): s = 0 for x in X: s += abs(x - m) return S t = int(input()) for ti in range(T): (n, m, f) = map(int, input().split()) x = [] y = [] for fi in range(F): (x, y) = map(int, input().split()) X.append(x) Y.append(y) x = sorted(X) y = sorted(Y) f = 2 if F & 1: xx = str(X[F // 2]) yy = str(Y[F // 2]) print('(Street: ' + xx + ', Avenue: ' + yy + ')') else: a = F // 2 b = F // 2 - 1 a = dist(X, X[a]) + dist(Y, Y[a]) b = dist(X, X[b]) + dist(Y, Y[b]) print(A, B) if A < B: xx = str(X[a]) yy = str(Y[a]) print('(Street: ' + xx + ', Avenue: ' + yy + ')') else: xx = str(X[b]) yy = str(Y[b]) print('(Street: ' + xx + ', Avenue: ' + yy + ')')
# When squirrels get together for a party, they like to have acorns. A squirrel party is successful when the number of acorns is between 40 and 60, inclusively. During the weekends, there is no need for acorns. The party is always fun. # input num_acorns = int(input('Enter the number of acorns: ')) is_weekend = input('Is it the weekend? (Y/N): ') # processing & output if is_weekend == 'Y': print('The party was a success.') else: if num_acorns >= 40 and num_acorns <= 60: print('The party was a success.') else: print(':(')
num_acorns = int(input('Enter the number of acorns: ')) is_weekend = input('Is it the weekend? (Y/N): ') if is_weekend == 'Y': print('The party was a success.') elif num_acorns >= 40 and num_acorns <= 60: print('The party was a success.') else: print(':(')
# MIN-MAX HACKER EARTH n = int(input()) arr = str(input()) arr = arr.split() arr1 = [] for i in range(0,n,1): x = int(arr[i]) arr1 += [x] min_arr = min(arr1) max_arr = max(arr1) count = 0 for i in range(min_arr+1,max_arr,1): num = i for j in range(0,n,1): if num == arr1[j]: count = count + 1 break diff = max_arr - min_arr - 1 if count == diff: print("YES") else: print("NO")
n = int(input()) arr = str(input()) arr = arr.split() arr1 = [] for i in range(0, n, 1): x = int(arr[i]) arr1 += [x] min_arr = min(arr1) max_arr = max(arr1) count = 0 for i in range(min_arr + 1, max_arr, 1): num = i for j in range(0, n, 1): if num == arr1[j]: count = count + 1 break diff = max_arr - min_arr - 1 if count == diff: print('YES') else: print('NO')
del_items(0x800A0FE4) SetType(0x800A0FE4, "void VID_OpenModule__Fv()") del_items(0x800A10A4) SetType(0x800A10A4, "void InitScreens__Fv()") del_items(0x800A1194) SetType(0x800A1194, "void MEM_SetupMem__Fv()") del_items(0x800A11C0) SetType(0x800A11C0, "void SetupWorkRam__Fv()") del_items(0x800A1250) SetType(0x800A1250, "void SYSI_Init__Fv()") del_items(0x800A135C) SetType(0x800A135C, "void GM_Open__Fv()") del_items(0x800A1380) SetType(0x800A1380, "void PA_Open__Fv()") del_items(0x800A13B8) SetType(0x800A13B8, "void PAD_Open__Fv()") del_items(0x800A13FC) SetType(0x800A13FC, "void OVR_Open__Fv()") del_items(0x800A141C) SetType(0x800A141C, "void SCR_Open__Fv()") del_items(0x800A144C) SetType(0x800A144C, "void DEC_Open__Fv()") del_items(0x800A16C0) SetType(0x800A16C0, "char *GetVersionString__FPc(char *VersionString2)") del_items(0x800A1794) SetType(0x800A1794, "char *GetWord__FPc(char *VStr)")
del_items(2148143076) set_type(2148143076, 'void VID_OpenModule__Fv()') del_items(2148143268) set_type(2148143268, 'void InitScreens__Fv()') del_items(2148143508) set_type(2148143508, 'void MEM_SetupMem__Fv()') del_items(2148143552) set_type(2148143552, 'void SetupWorkRam__Fv()') del_items(2148143696) set_type(2148143696, 'void SYSI_Init__Fv()') del_items(2148143964) set_type(2148143964, 'void GM_Open__Fv()') del_items(2148144000) set_type(2148144000, 'void PA_Open__Fv()') del_items(2148144056) set_type(2148144056, 'void PAD_Open__Fv()') del_items(2148144124) set_type(2148144124, 'void OVR_Open__Fv()') del_items(2148144156) set_type(2148144156, 'void SCR_Open__Fv()') del_items(2148144204) set_type(2148144204, 'void DEC_Open__Fv()') del_items(2148144832) set_type(2148144832, 'char *GetVersionString__FPc(char *VersionString2)') del_items(2148145044) set_type(2148145044, 'char *GetWord__FPc(char *VStr)')
def arithmetic_arranger(problems, count_start=False): line_1 = "" line_2 = "" line_3 = "" line_4 = "" for i, problem in enumerate(problems): a, b, c = problem.split() d = max(len(a), len(c)) if len(problems) > 5: return "Error: Too many problems." if len(a) > 4 or len(c) > 4: return "Error: Numbers cannot be more than four digits." if b == "+" or b == "-": try: a = int(a) c = int(c) if b == "+": result = a + c else: result = a - c line_1 = line_1 + f'{a:>{d+2}}' line_2 = line_2 + b + f'{c:>{d+1}}' line_3 = line_3 + ''.rjust(d + 2, '-') line_4 = line_4 + str(result).rjust(d + 2) except ValueError: return "Error: Numbers must only contain digits." else: return "Error: Operator must be '+' or '-'." if i < len(problems) - 1: line_1 += " " line_2 += " " line_3 += " " line_4 += " " if count_start: arranged_problems = line_1 + '\n' + line_2 + '\n' + line_3 + '\n' + line_4 else: arranged_problems = line_1 + '\n' + line_2 + '\n' + line_3 return arranged_problems
def arithmetic_arranger(problems, count_start=False): line_1 = '' line_2 = '' line_3 = '' line_4 = '' for (i, problem) in enumerate(problems): (a, b, c) = problem.split() d = max(len(a), len(c)) if len(problems) > 5: return 'Error: Too many problems.' if len(a) > 4 or len(c) > 4: return 'Error: Numbers cannot be more than four digits.' if b == '+' or b == '-': try: a = int(a) c = int(c) if b == '+': result = a + c else: result = a - c line_1 = line_1 + f'{a:>{d + 2}}' line_2 = line_2 + b + f'{c:>{d + 1}}' line_3 = line_3 + ''.rjust(d + 2, '-') line_4 = line_4 + str(result).rjust(d + 2) except ValueError: return 'Error: Numbers must only contain digits.' else: return "Error: Operator must be '+' or '-'." if i < len(problems) - 1: line_1 += ' ' line_2 += ' ' line_3 += ' ' line_4 += ' ' if count_start: arranged_problems = line_1 + '\n' + line_2 + '\n' + line_3 + '\n' + line_4 else: arranged_problems = line_1 + '\n' + line_2 + '\n' + line_3 return arranged_problems
# Copyright (c) 2019 The Bazel Utils Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. def runtime_library(): return [ "_WINDOWS", "WIN32", ] def winver(): return [ "_WIN32_WINNT=0x0A00", "WINVER=0x0A00", ] def unicode(): return ["_UNICODE", "UNICODE"] def lean_and_mean(): return ["WIN32_LEAN_AND_MEAN"]
def runtime_library(): return ['_WINDOWS', 'WIN32'] def winver(): return ['_WIN32_WINNT=0x0A00', 'WINVER=0x0A00'] def unicode(): return ['_UNICODE', 'UNICODE'] def lean_and_mean(): return ['WIN32_LEAN_AND_MEAN']
def arithmetic_arranger(problems, solution=False): # Limit of 4 problems per call if len(problems) > 5: return "Error: Too many problems." # Declaring list to organise problems summa1 = [] summa2 = [] operator = [] # Organising problems in right list for problem in problems: prob_list = problem.split() summa1.append(prob_list[0]) summa2.append(prob_list[2]) operator.append(prob_list[1]) # Checking operator for char in operator: if char != "+" and char != "-": return "Error: Operator must be '+' or '-'." # Checking digits summa_total = [] summa_total = summa1 + summa2 for num in summa_total: if not num.isdigit(): return "Error: Numbers must only contain digits." # Checking length of digits for num in summa_total: if len(num) > 4: return "Error: Numbers cannot be more than four digits." # Solution for summa1, summa. divider and divider solution_1 = [] solution_2 = [] divider = [] answer = [] # solution_1 for i in range(len(summa1)): if len(summa1[i]) > len(summa2[i]): solution_1.append(" " * 2 + summa1[i]) else: solution_1.append(" " * (len(summa2[i]) - len(summa1[i])+2) + summa1[i]) # solution_2 for i in range(len(summa2)): if len(summa2[i]) > len(summa1[i]): solution_2.append(operator[i] + " " + summa2[i]) else: solution_2.append(operator[i] + " " * (len(summa1[i]) - len(summa2[i]) + 1) + summa2[i]) # divider for i in range(len(summa1)): divider.append("-" * (max(len(summa1[i]), len(summa2[i])) + 2)) # If solution equals True if solution: for i in range(len(summa1)): if operator[i] == "+": sol = str(int(summa1[i]) + int(summa2[i])) else: sol = str(int(summa1[i]) - int(summa2[i])) if len(sol) > max(len(summa1[i]), len(summa2[i])): answer.append(" " + sol) else: answer.append(" " * (max(len(summa1[i]), len(summa2[i])) - len(sol) + 2) + sol) arranged_problems = " ".join(solution_1) + "\n" + " ".join(solution_2) + "\n" + " ".join(divider) + "\n" + " ".join(answer) else: arranged_problems = " ".join(solution_1) + "\n" + " ".join(solution_2) + "\n" + " ".join( divider) return arranged_problems
def arithmetic_arranger(problems, solution=False): if len(problems) > 5: return 'Error: Too many problems.' summa1 = [] summa2 = [] operator = [] for problem in problems: prob_list = problem.split() summa1.append(prob_list[0]) summa2.append(prob_list[2]) operator.append(prob_list[1]) for char in operator: if char != '+' and char != '-': return "Error: Operator must be '+' or '-'." summa_total = [] summa_total = summa1 + summa2 for num in summa_total: if not num.isdigit(): return 'Error: Numbers must only contain digits.' for num in summa_total: if len(num) > 4: return 'Error: Numbers cannot be more than four digits.' solution_1 = [] solution_2 = [] divider = [] answer = [] for i in range(len(summa1)): if len(summa1[i]) > len(summa2[i]): solution_1.append(' ' * 2 + summa1[i]) else: solution_1.append(' ' * (len(summa2[i]) - len(summa1[i]) + 2) + summa1[i]) for i in range(len(summa2)): if len(summa2[i]) > len(summa1[i]): solution_2.append(operator[i] + ' ' + summa2[i]) else: solution_2.append(operator[i] + ' ' * (len(summa1[i]) - len(summa2[i]) + 1) + summa2[i]) for i in range(len(summa1)): divider.append('-' * (max(len(summa1[i]), len(summa2[i])) + 2)) if solution: for i in range(len(summa1)): if operator[i] == '+': sol = str(int(summa1[i]) + int(summa2[i])) else: sol = str(int(summa1[i]) - int(summa2[i])) if len(sol) > max(len(summa1[i]), len(summa2[i])): answer.append(' ' + sol) else: answer.append(' ' * (max(len(summa1[i]), len(summa2[i])) - len(sol) + 2) + sol) arranged_problems = ' '.join(solution_1) + '\n' + ' '.join(solution_2) + '\n' + ' '.join(divider) + '\n' + ' '.join(answer) else: arranged_problems = ' '.join(solution_1) + '\n' + ' '.join(solution_2) + '\n' + ' '.join(divider) return arranged_problems
''' PURPOSE The function capital_indexes takes a single parameter, which is a string. It returns a list of all the indexes in the string that have capital letters. EXAMPLE Calling capital_indexes("HeLlO") should return the list [0, 2, 4]. ''' def capital_indexes(input_str): try: input_str_len = len(input_str) # initialise list index_list = [] # loop through each character for x in range(input_str_len): # check whether the character is a capital if input_str[x].isupper(): # uncomment this line to manually check the string's capitals # print('character {} is a capital ({})'.format(x, input_str[x])) index_list.append(x) return index_list except TypeError: print('ERROR Input must be a string') except Exception as e: print("ERROR", e.__class__, "occurred.") # get input string input_str = "HeLlO" # submit string to function capital_index_list = capital_indexes(input_str) # print capital_index_list if not empty if capital_index_list: print(capital_index_list)
""" PURPOSE The function capital_indexes takes a single parameter, which is a string. It returns a list of all the indexes in the string that have capital letters. EXAMPLE Calling capital_indexes("HeLlO") should return the list [0, 2, 4]. """ def capital_indexes(input_str): try: input_str_len = len(input_str) index_list = [] for x in range(input_str_len): if input_str[x].isupper(): index_list.append(x) return index_list except TypeError: print('ERROR Input must be a string') except Exception as e: print('ERROR', e.__class__, 'occurred.') input_str = 'HeLlO' capital_index_list = capital_indexes(input_str) if capital_index_list: print(capital_index_list)
n,m = map(int, input().split()) arr = list(map(int, input().split())) a = set(map(int, input().split())) b = set(map(int,input().split())) print(n,m) print(arr) print(a) print(b) c = 0 for i in arr: if i in a: c = c +1 if i in b: c = c-1 print(c)
(n, m) = map(int, input().split()) arr = list(map(int, input().split())) a = set(map(int, input().split())) b = set(map(int, input().split())) print(n, m) print(arr) print(a) print(b) c = 0 for i in arr: if i in a: c = c + 1 if i in b: c = c - 1 print(c)
# Road to the Mine 1 (931060030) | Xenon 3rd Job lackey = 2159397 gelimer = 2154009 goon = 9300643 sm.lockInGameUI(True) sm.spawnNpc(lackey, 648, 28) # TO DO: Figure out why the lackey doesn't move and just spazes in place (initial start x: 1188) # sm.moveCamera(100, 738, ground) # sm.sendDelay(1000) # sm.moveCameraBack(100) # sm.moveNpcByTemplateId(lackey, True, 540, 60) # sm.sendDelay(4000) sm.removeEscapeButton() sm.setSpeakerID(lackey) sm.sendNext("Hey, what're you doing out here? And where did that other guy go? " "You don't look familiar...") sm.setPlayerAsSpeaker() sm.sendSay("I am a Black Wing.") sm.setSpeakerID(lackey) sm.sendSay("Are you now? Let me see here... I think I've seen your face before. " "I think I saw you in some orders I got from #p" + str(gelimer) + "#.") sm.setPlayerAsSpeaker() sm.sendSay("You are mistaken.") sm.setSpeakerID(lackey) sm.sendSay("I am? Maybe I'd better check with #p" + str(gelimer) + "#. " "I don't want to get into hot water. Come along!") sm.setPlayerAsSpeaker() sm.sendSay("Maybe I should have just taken this guy out...") sm.removeNpc(lackey) sm.spawnMob(goon, 648, 28, False) sm.chatScript("Defeat the Black Wings.") sm.lockInGameUI(False)
lackey = 2159397 gelimer = 2154009 goon = 9300643 sm.lockInGameUI(True) sm.spawnNpc(lackey, 648, 28) sm.removeEscapeButton() sm.setSpeakerID(lackey) sm.sendNext("Hey, what're you doing out here? And where did that other guy go? You don't look familiar...") sm.setPlayerAsSpeaker() sm.sendSay('I am a Black Wing.') sm.setSpeakerID(lackey) sm.sendSay("Are you now? Let me see here... I think I've seen your face before. I think I saw you in some orders I got from #p" + str(gelimer) + '#.') sm.setPlayerAsSpeaker() sm.sendSay('You are mistaken.') sm.setSpeakerID(lackey) sm.sendSay("I am? Maybe I'd better check with #p" + str(gelimer) + "#. I don't want to get into hot water. Come along!") sm.setPlayerAsSpeaker() sm.sendSay('Maybe I should have just taken this guy out...') sm.removeNpc(lackey) sm.spawnMob(goon, 648, 28, False) sm.chatScript('Defeat the Black Wings.') sm.lockInGameUI(False)
PWR_MGMT_1 = 0x6b ACCEL_CONFIG = 0x1C ACCEL_XOUT_H = 0x3B ACCEL_XOUT_L = 0x3C ACCEL_YOUT_H = 0x3D ACCEL_YOUT_L = 0x3E ACCEL_ZOUT_H = 0x3F ACCEL_ZOUT_L = 0x40 GYRO_CONFIG = 0x1B GYRO_XOUT_H = 0x43 GYRO_XOUT_L = 0x44 GYRO_YOUT_H = 0x45 GYRO_YOUT_L = 0x46 GYRO_ZOUT_H = 0x47 GYRO_ZOUT_L = 0x48 TEMP_H = 0x41 TEMP_L = 0x42
pwr_mgmt_1 = 107 accel_config = 28 accel_xout_h = 59 accel_xout_l = 60 accel_yout_h = 61 accel_yout_l = 62 accel_zout_h = 63 accel_zout_l = 64 gyro_config = 27 gyro_xout_h = 67 gyro_xout_l = 68 gyro_yout_h = 69 gyro_yout_l = 70 gyro_zout_h = 71 gyro_zout_l = 72 temp_h = 65 temp_l = 66
### ### Week 2: Before Class ### ## Make a list of the words one two three o'clock four o'clock rock words = ["one", "two", "three", "o'clock", "four", "o'clock", 'rock'] ## Pick out the first word as a string words[0] ## Pick out the first word as a list words[0:1] ## Pick out the last word as a string words[-1] ## Show how many words there are in the list len(words) ## Transform the list into a new list that only has numbers in it ## take as many steps as you need [len(w) for w in words] ## Count how many times o'clock appears in the list words.count("o'clock") print("No output for this")
words = ['one', 'two', 'three', "o'clock", 'four', "o'clock", 'rock'] words[0] words[0:1] words[-1] len(words) [len(w) for w in words] words.count("o'clock") print('No output for this')
word1 = input("Enter a word: ") word2 = input("Enter another word: ") word1 = word1.lower() word2 = word2.lower() dic1 = {} dic2 = {} for elm in word1: if elm in dic1.keys(): count = dic1[elm] count += 1 dic1[elm] = count else: dic1[elm] = 1 for elm in word2: if elm in dic2.keys(): count = dic2[elm] count += 1 dic2[elm] = count else: dic2[elm] = 1 if dic1 == dic2 and word1 != word2: print("Those strings are anagrams.") else: print("Those strings are not anagrams.")
word1 = input('Enter a word: ') word2 = input('Enter another word: ') word1 = word1.lower() word2 = word2.lower() dic1 = {} dic2 = {} for elm in word1: if elm in dic1.keys(): count = dic1[elm] count += 1 dic1[elm] = count else: dic1[elm] = 1 for elm in word2: if elm in dic2.keys(): count = dic2[elm] count += 1 dic2[elm] = count else: dic2[elm] = 1 if dic1 == dic2 and word1 != word2: print('Those strings are anagrams.') else: print('Those strings are not anagrams.')
S = input() if S[-2:] == 'ai': print(S[:-2] + 'AI') else: print(S + '-AI')
s = input() if S[-2:] == 'ai': print(S[:-2] + 'AI') else: print(S + '-AI')
def words(digit): for i in digit: num = int(i) if num == 1: print("One") if num == 2: print("Two") if num == 3: print("Three") if num == 4: print("Four") if num == 5: print("Five") if num == 6: print("Six") if num == 7: print("Seven") if num == 8: print("Eight") if num == 9: print("Nine") if num == 0: print("Zero") while True: try: digit = input("Enter a digit: ") words(digit) break except ValueError: print("Please enter a digit!!!")
def words(digit): for i in digit: num = int(i) if num == 1: print('One') if num == 2: print('Two') if num == 3: print('Three') if num == 4: print('Four') if num == 5: print('Five') if num == 6: print('Six') if num == 7: print('Seven') if num == 8: print('Eight') if num == 9: print('Nine') if num == 0: print('Zero') while True: try: digit = input('Enter a digit: ') words(digit) break except ValueError: print('Please enter a digit!!!')
# Sanitize a dependency so that it works correctly from code that includes # QCraft as a submodule. def clean_dep(dep): return str(Label(dep))
def clean_dep(dep): return str(label(dep))
def unatrag(s): if len(s)==0: return s else: return unatrag(s[1:]) + s[0] s=input("Unesite rijec: ") print(unatrag(s))
def unatrag(s): if len(s) == 0: return s else: return unatrag(s[1:]) + s[0] s = input('Unesite rijec: ') print(unatrag(s))
file_obj = open("squares.txt", "w") #Usar w de writing for number in range (13): square = number * number file_obj.write(str(square)) file_obj.write('\n') file_obj.close()
file_obj = open('squares.txt', 'w') for number in range(13): square = number * number file_obj.write(str(square)) file_obj.write('\n') file_obj.close()
# Exercise 4: Assume that we execute the following assignment statements: # width = 17 # height = 12.0 # For each of the following expressions, write the value of the expression and the type (of the value of the expression). # 1. width//2 # 2. width/2.0 # 3. height/3 # 4. 1 + 2 * 5 width = 17; height = 12.0; one = width//2; # result: 8 - type: int two = width/2.0; # result: 8.5 - type: float three = height/3; # result: 4.0 - type: float four = 1 + 2 * 5; # result: 11 - type: int print(four, type(four))
width = 17 height = 12.0 one = width // 2 two = width / 2.0 three = height / 3 four = 1 + 2 * 5 print(four, type(four))
altitude = int(input("Enter Altitude in ft:")) if altitude<=1000: print("Safe to land") elif altitude< 5000: print("Bring down to 1000") else: print("Turn Around and Try Again")
altitude = int(input('Enter Altitude in ft:')) if altitude <= 1000: print('Safe to land') elif altitude < 5000: print('Bring down to 1000') else: print('Turn Around and Try Again')
# -*- coding: utf-8 -*- ''' File name: code\comfortable_distance\sol_364.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x ''' # Solution to Project Euler Problem #364 :: Comfortable distance # # For more information see: # https://projecteuler.net/problem=364 # Problem Statement ''' There are N seats in a row. N people come after each other to fill the seats according to the following rules: If there is any seat whose adjacent seat(s) are not occupied take such a seat. If there is no such seat and there is any seat for which only one adjacent seat is occupied take such a seat. Otherwise take one of the remaining available seats. Let T(N) be the number of possibilities that N seats are occupied by N people with the given rules. The following figure shows T(4)=8. We can verify that T(10) = 61632 and T(1 000) mod 100 000 007 = 47255094. Find T(1 000 000) mod 100 000 007. ''' # Solution # Solution Approach ''' '''
""" File name: code\\comfortable_distance\\sol_364.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x """ '\nThere are N seats in a row. N people come after each other to fill the seats according to the following rules:\nIf there is any seat whose adjacent seat(s) are not occupied take such a seat.\nIf there is no such seat and there is any seat for which only one adjacent seat is occupied take such a seat.\nOtherwise take one of the remaining available seats. \n\nLet T(N) be the number of possibilities that N seats are occupied by N people with the given rules. The following figure shows T(4)=8.\n\n\n\n\n\nWe can verify that T(10) = 61632 and T(1 000) mod 100 000 007 = 47255094.\nFind T(1 000 000) mod 100 000 007.\n' '\n'
class Water(): regions = None outline_points = None def __init__(self): self.regions = [] self.outline_points = []
class Water: regions = None outline_points = None def __init__(self): self.regions = [] self.outline_points = []
1 "test" "equality" == "equality" 1.5 * 10 int
1 'test' 'equality' == 'equality' 1.5 * 10 int
class Classe: atributo_da_classe = 0 print(Classe.atributo_da_classe) Classe.atributo_da_classe = 5 print(Classe.atributo_da_classe)
class Classe: atributo_da_classe = 0 print(Classe.atributo_da_classe) Classe.atributo_da_classe = 5 print(Classe.atributo_da_classe)
# 917. Reverse Only Letters def reverseOnlyLetters(S): def isLetter(c): if (ord(c) >= 65 and ord(c) < 91) or (ord(c) >= 97 and ord(c) < 123): return True return False A = list(S) i, j = 0, len(A) - 1 while i < j: if isLetter(A[i]) and isLetter(A[j]): A[i], A[j] = A[j], A[i] i = i + 1 j = j - 1 if not isLetter(A[i]): i = i + 1 if not isLetter(A[j]): j = j - 1 return ''.join(A) print(reverseOnlyLetters("a-bC-dEf-ghIj")) def reverseOnlyLetters2(S): letter = [c for c in S if c.isalpha()] ans = [] for c in S: if c.isalpha(): ans.append(letter.pop()) else: ans.append(c) return ''.join(ans) def reverseOnlyLetters3(S): ans = [] j = len(S) - 1 for i, c in enumerate(S): if c.isalpha(): while not S[j].isalpha(): j -= 1 ans.append(S[j]) j -= 1 else: ans.append(c) return ''.join(ans)
def reverse_only_letters(S): def is_letter(c): if ord(c) >= 65 and ord(c) < 91 or (ord(c) >= 97 and ord(c) < 123): return True return False a = list(S) (i, j) = (0, len(A) - 1) while i < j: if is_letter(A[i]) and is_letter(A[j]): (A[i], A[j]) = (A[j], A[i]) i = i + 1 j = j - 1 if not is_letter(A[i]): i = i + 1 if not is_letter(A[j]): j = j - 1 return ''.join(A) print(reverse_only_letters('a-bC-dEf-ghIj')) def reverse_only_letters2(S): letter = [c for c in S if c.isalpha()] ans = [] for c in S: if c.isalpha(): ans.append(letter.pop()) else: ans.append(c) return ''.join(ans) def reverse_only_letters3(S): ans = [] j = len(S) - 1 for (i, c) in enumerate(S): if c.isalpha(): while not S[j].isalpha(): j -= 1 ans.append(S[j]) j -= 1 else: ans.append(c) return ''.join(ans)
a=str(input('Enter string')) if(a==a[::-1]): print('palindrome') else: print('not a palindrome')
a = str(input('Enter string')) if a == a[::-1]: print('palindrome') else: print('not a palindrome')
# # PySNMP MIB module CTRON-SSR-SMI-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-SSR-SMI-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:15:44 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint", "ValueSizeConstraint") cabletron, = mibBuilder.importSymbols("CTRON-OIDS", "cabletron") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, ModuleIdentity, iso, Gauge32, Bits, Unsigned32, ObjectIdentity, NotificationType, TimeTicks, Counter64, IpAddress, Integer32, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ModuleIdentity", "iso", "Gauge32", "Bits", "Unsigned32", "ObjectIdentity", "NotificationType", "TimeTicks", "Counter64", "IpAddress", "Integer32", "MibIdentifier") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") ssr = ModuleIdentity((1, 3, 6, 1, 4, 1, 52, 2501)) ssr.setRevisions(('2000-07-15 00:00',)) if mibBuilder.loadTexts: ssr.setLastUpdated('200007150000Z') if mibBuilder.loadTexts: ssr.setOrganization('Cabletron Systems, Inc') ssrMibs = ObjectIdentity((1, 3, 6, 1, 4, 1, 52, 2501, 1)) if mibBuilder.loadTexts: ssrMibs.setStatus('current') ssrTraps = ObjectIdentity((1, 3, 6, 1, 4, 1, 52, 2501, 10)) if mibBuilder.loadTexts: ssrTraps.setStatus('current') mibBuilder.exportSymbols("CTRON-SSR-SMI-MIB", PYSNMP_MODULE_ID=ssr, ssr=ssr, ssrTraps=ssrTraps, ssrMibs=ssrMibs)
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, constraints_intersection, value_range_constraint, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'SingleValueConstraint', 'ConstraintsIntersection', 'ValueRangeConstraint', 'ValueSizeConstraint') (cabletron,) = mibBuilder.importSymbols('CTRON-OIDS', 'cabletron') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (counter32, mib_scalar, mib_table, mib_table_row, mib_table_column, module_identity, iso, gauge32, bits, unsigned32, object_identity, notification_type, time_ticks, counter64, ip_address, integer32, mib_identifier) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ModuleIdentity', 'iso', 'Gauge32', 'Bits', 'Unsigned32', 'ObjectIdentity', 'NotificationType', 'TimeTicks', 'Counter64', 'IpAddress', 'Integer32', 'MibIdentifier') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') ssr = module_identity((1, 3, 6, 1, 4, 1, 52, 2501)) ssr.setRevisions(('2000-07-15 00:00',)) if mibBuilder.loadTexts: ssr.setLastUpdated('200007150000Z') if mibBuilder.loadTexts: ssr.setOrganization('Cabletron Systems, Inc') ssr_mibs = object_identity((1, 3, 6, 1, 4, 1, 52, 2501, 1)) if mibBuilder.loadTexts: ssrMibs.setStatus('current') ssr_traps = object_identity((1, 3, 6, 1, 4, 1, 52, 2501, 10)) if mibBuilder.loadTexts: ssrTraps.setStatus('current') mibBuilder.exportSymbols('CTRON-SSR-SMI-MIB', PYSNMP_MODULE_ID=ssr, ssr=ssr, ssrTraps=ssrTraps, ssrMibs=ssrMibs)
PROCESSOR_VERSION = "0.7.0" # Entities AREAS = "areas" CAMERAS = "cameras" ALL_AREAS = "ALL" # Metrics OCCUPANCY = "occupancy" SOCIAL_DISTANCING = "social-distancing" FACEMASK_USAGE = "facemask-usage" IN_OUT = "in-out" DWELL_TIME = "dwell-time"
processor_version = '0.7.0' areas = 'areas' cameras = 'cameras' all_areas = 'ALL' occupancy = 'occupancy' social_distancing = 'social-distancing' facemask_usage = 'facemask-usage' in_out = 'in-out' dwell_time = 'dwell-time'
''' URL: https://leetcode.com/problems/delete-columns-to-make-sorted/ Difficulty: Easy Description: Delete Columns to Make Sorted We are given an array A of N lowercase letter strings, all of the same length. Now, we may choose any set of deletion indices, and for each string, we delete all the characters in those indices. For example, if we have an array A = ["abcdef","uvwxyz"] and deletion indices {0, 2, 3}, then the final array after deletions is ["bef", "vyz"], and the remaining columns of A are ["b","v"], ["e","y"], and ["f","z"]. (Formally, the c-th column is [A[0][c], A[1][c], ..., A[A.length-1][c]]). Suppose we chose a set of deletion indices D such that after deletions, each remaining column in A is in non-decreasing sorted order. Return the minimum possible value of D.length. Example 1: Input: A = ["cba","daf","ghi"] Output: 1 Explanation: After choosing D = {1}, each column ["c","d","g"] and ["a","f","i"] are in non-decreasing sorted order. If we chose D = {}, then a column ["b","a","h"] would not be in non-decreasing sorted order. Example 2: Input: A = ["a","b"] Output: 0 Explanation: D = {} Example 3: Input: A = ["zyx","wvu","tsr"] Output: 3 Explanation: D = {0, 1, 2} Constraints: 1 <= A.length <= 100 1 <= A[i].length <= 1000 ''' class Solution: def minDeletionSize(self, A): if len(A[0]) == 1: return 0 count = 0 for i in range(len(A[0])): for j in range(len(A)-1): if A[j][i] > A[j+1][i]: count += 1 break return count
""" URL: https://leetcode.com/problems/delete-columns-to-make-sorted/ Difficulty: Easy Description: Delete Columns to Make Sorted We are given an array A of N lowercase letter strings, all of the same length. Now, we may choose any set of deletion indices, and for each string, we delete all the characters in those indices. For example, if we have an array A = ["abcdef","uvwxyz"] and deletion indices {0, 2, 3}, then the final array after deletions is ["bef", "vyz"], and the remaining columns of A are ["b","v"], ["e","y"], and ["f","z"]. (Formally, the c-th column is [A[0][c], A[1][c], ..., A[A.length-1][c]]). Suppose we chose a set of deletion indices D such that after deletions, each remaining column in A is in non-decreasing sorted order. Return the minimum possible value of D.length. Example 1: Input: A = ["cba","daf","ghi"] Output: 1 Explanation: After choosing D = {1}, each column ["c","d","g"] and ["a","f","i"] are in non-decreasing sorted order. If we chose D = {}, then a column ["b","a","h"] would not be in non-decreasing sorted order. Example 2: Input: A = ["a","b"] Output: 0 Explanation: D = {} Example 3: Input: A = ["zyx","wvu","tsr"] Output: 3 Explanation: D = {0, 1, 2} Constraints: 1 <= A.length <= 100 1 <= A[i].length <= 1000 """ class Solution: def min_deletion_size(self, A): if len(A[0]) == 1: return 0 count = 0 for i in range(len(A[0])): for j in range(len(A) - 1): if A[j][i] > A[j + 1][i]: count += 1 break return count
ACTIVE_CLASS = 'active' SELECTED_CLASS = 'selected' class MenuItem: def __init__(self, label, url, css_classes='', submenu=None): self.label = label self.url = url self.css_classes = css_classes self.submenu = submenu def status_class(self, request): css_class = '' if self.url == request.path: css_class = ACTIVE_CLASS if ( self.url != '/' and self.url in request.path and not self.url == request.path ): css_class = SELECTED_CLASS return css_class def get_css_classes(self): return self.css_classes def get_all_css_classes(self, request): return '%s %s' % \ (self.get_css_classes(), self.status_class(request))
active_class = 'active' selected_class = 'selected' class Menuitem: def __init__(self, label, url, css_classes='', submenu=None): self.label = label self.url = url self.css_classes = css_classes self.submenu = submenu def status_class(self, request): css_class = '' if self.url == request.path: css_class = ACTIVE_CLASS if self.url != '/' and self.url in request.path and (not self.url == request.path): css_class = SELECTED_CLASS return css_class def get_css_classes(self): return self.css_classes def get_all_css_classes(self, request): return '%s %s' % (self.get_css_classes(), self.status_class(request))
class Hyparams: user_count= 192403 item_count= 63001 cate_count= 801 predict_batch_size = 120 predict_ads_num = 100 batch_size = 128 hidden_units = 64 train_batch_size = 32 test_batch_size = 512 predict_batch_size = 32 predict_users_num = 1000 predict_ads_num = 100 save_dir = './save_path_fancy'
class Hyparams: user_count = 192403 item_count = 63001 cate_count = 801 predict_batch_size = 120 predict_ads_num = 100 batch_size = 128 hidden_units = 64 train_batch_size = 32 test_batch_size = 512 predict_batch_size = 32 predict_users_num = 1000 predict_ads_num = 100 save_dir = './save_path_fancy'
''' Created on 1.12.2016 @author: Darren '''''' Follow up for problem "Populating Next Right Pointers in Each Node". What if the given tree could be any binary tree? Would your previous solution still work? Note: You may only use constant extra space. For example, Given the following binary tree, 1 / \ 2 3 / \ \ 4 5 7 After calling your function, the tree should look like: 1 -> NULL / \ 2 -> 3 -> NULL / \ \ 4-> 5 -> 7 -> NULL " '''
""" Created on 1.12.2016 @author: Darren Follow up for problem "Populating Next Right Pointers in Each Node". What if the given tree could be any binary tree? Would your previous solution still work? Note: You may only use constant extra space. For example, Given the following binary tree, 1 / 2 3 / \\ 4 5 7 After calling your function, the tree should look like: 1 -> NULL / 2 -> 3 -> NULL / \\ 4-> 5 -> 7 -> NULL " """
def set_template(args): # task category args.task = 'VideoBDE' # network parameters args.n_feat = 32 # loss args.loss = '1*L1+2*HEM' # learning rata strategy args.lr = 1e-4 args.lr_decay = 100 args.gamma = 0.1 # data parameters args.data_train = 'SDR4K' args.data_test = 'SDR4K' args.n_sequence = 3 args.n_frames_per_video = 100 args.rgb_range = 65535 args.size_must_mode = 4 args.patch_size = 256 args.dir_data = "/home/medialab/workspace/hdd/zhen/EDVR/datasets/SDR4k/train/" args.dir_data_test = "/home/medialab/workspace/hdd/zhen/EDVR/datasets/SDR4k/val/" args.lbd = 4 args.hbd = 16 # train args.epochs = 500 # test args.test_every = 1000 args.print_every = 10 if args.template == 'CDVD_TSP': args.model = "CDVD_TSP" args.n_sequence = 5 args.n_resblock = 3 args.lr_decay = 200 elif args.template == 'VBDE': args.model = 'VBDE' args.n_resblock = 2 elif args.template == 'VBDE_DOWNFLOW': args.model = 'VBDE_DOWNFLOW' args.n_resblock = 3 args.lr_decay = 200 elif args.template == 'VBDE_QM': args.model = 'VBDE_QM' args.n_resblock = 3 args.lr_decay = 200 # bit-depth parameters args.low_bitdepth = 4 args.high_bitdepth = 16 elif args.template == 'VBDE_LAP': args.model = 'VBDE_LAP' args.n_resblock = 3 args.lr_decay = 50 elif args.template == 'MOTION_NET': args.task = 'OpticalFlow' args.model = 'MOTION_NET' args.n_sequence = 2 args.size_must_mode = 32 args.loss = '1*MNL' # small learning rate for training optical flow args.lr = 1e-5 args.lr_decay = 200 args.gamma = 0.5 args.data_train = 'SDR4K_FLOW' args.data_test = 'SDR4K_FLOW' args.video_samples = 500 elif args.template == 'C3D': args.task = 'VideoBDE' args.model = 'C3D' args.n_resblock = 3 args.loss = '1*L1+2*HEM+0.1*QCC' elif args.template == 'HYBRID_C3D': args.model = 'HYBRID_C3D' args.n_resblock = 4 args.scheduler = 'plateau' else: raise NotImplementedError('Template [{:s}] is not found'.format(args.template))
def set_template(args): args.task = 'VideoBDE' args.n_feat = 32 args.loss = '1*L1+2*HEM' args.lr = 0.0001 args.lr_decay = 100 args.gamma = 0.1 args.data_train = 'SDR4K' args.data_test = 'SDR4K' args.n_sequence = 3 args.n_frames_per_video = 100 args.rgb_range = 65535 args.size_must_mode = 4 args.patch_size = 256 args.dir_data = '/home/medialab/workspace/hdd/zhen/EDVR/datasets/SDR4k/train/' args.dir_data_test = '/home/medialab/workspace/hdd/zhen/EDVR/datasets/SDR4k/val/' args.lbd = 4 args.hbd = 16 args.epochs = 500 args.test_every = 1000 args.print_every = 10 if args.template == 'CDVD_TSP': args.model = 'CDVD_TSP' args.n_sequence = 5 args.n_resblock = 3 args.lr_decay = 200 elif args.template == 'VBDE': args.model = 'VBDE' args.n_resblock = 2 elif args.template == 'VBDE_DOWNFLOW': args.model = 'VBDE_DOWNFLOW' args.n_resblock = 3 args.lr_decay = 200 elif args.template == 'VBDE_QM': args.model = 'VBDE_QM' args.n_resblock = 3 args.lr_decay = 200 args.low_bitdepth = 4 args.high_bitdepth = 16 elif args.template == 'VBDE_LAP': args.model = 'VBDE_LAP' args.n_resblock = 3 args.lr_decay = 50 elif args.template == 'MOTION_NET': args.task = 'OpticalFlow' args.model = 'MOTION_NET' args.n_sequence = 2 args.size_must_mode = 32 args.loss = '1*MNL' args.lr = 1e-05 args.lr_decay = 200 args.gamma = 0.5 args.data_train = 'SDR4K_FLOW' args.data_test = 'SDR4K_FLOW' args.video_samples = 500 elif args.template == 'C3D': args.task = 'VideoBDE' args.model = 'C3D' args.n_resblock = 3 args.loss = '1*L1+2*HEM+0.1*QCC' elif args.template == 'HYBRID_C3D': args.model = 'HYBRID_C3D' args.n_resblock = 4 args.scheduler = 'plateau' else: raise not_implemented_error('Template [{:s}] is not found'.format(args.template))
# # PySNMP MIB module UNCDZ-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/UNCDZ-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:28:43 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, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsIntersection, ValueSizeConstraint, SingleValueConstraint, ValueRangeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueSizeConstraint", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsUnion") NotificationGroup, ModuleCompliance, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance", "ObjectGroup") sysName, sysContact, sysLocation = mibBuilder.importSymbols("SNMPv2-MIB", "sysName", "sysContact", "sysLocation") iso, NotificationType, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn, IpAddress, MibIdentifier, Integer32, Counter64, TimeTicks, Unsigned32, enterprises, Gauge32, ModuleIdentity, ObjectIdentity, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "iso", "NotificationType", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "IpAddress", "MibIdentifier", "Integer32", "Counter64", "TimeTicks", "Unsigned32", "enterprises", "Gauge32", "ModuleIdentity", "ObjectIdentity", "Counter32") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") uncdz_MIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9839, 2, 1)).setLabel("uncdz-MIB") uncdz_MIB.setRevisions(('2004-08-12 15:52',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: uncdz_MIB.setRevisionsDescriptions(('This is the original version of the MIB.',)) if mibBuilder.loadTexts: uncdz_MIB.setLastUpdated('200408121552Z') if mibBuilder.loadTexts: uncdz_MIB.setOrganization('CAREL SpA') if mibBuilder.loadTexts: uncdz_MIB.setContactInfo(" Simone Ravazzolo Carel SpA Via dell'Industria, 11 35020 Brugine (PD) Italy Tel: +39 049 9716611 E-mail: [email protected] ") if mibBuilder.loadTexts: uncdz_MIB.setDescription('This is the MIB module for the UNIFLAIR UNCDZ device.') carel = MibIdentifier((1, 3, 6, 1, 4, 1, 9839)) systm = MibIdentifier((1, 3, 6, 1, 4, 1, 9839, 1)) agentRelease = MibScalar((1, 3, 6, 1, 4, 1, 9839, 1, 1), Integer32()).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: agentRelease.setStatus('current') if mibBuilder.loadTexts: agentRelease.setDescription('Release of the Agent.') agentCode = MibScalar((1, 3, 6, 1, 4, 1, 9839, 1, 2), Integer32()).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: agentCode.setStatus('current') if mibBuilder.loadTexts: agentCode.setDescription('Code of the Agent. 2=pCOWeb.') instruments = MibIdentifier((1, 3, 6, 1, 4, 1, 9839, 2)) pCOWebInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 9839, 2, 0)) pCOStatusgroup = MibIdentifier((1, 3, 6, 1, 4, 1, 9839, 2, 0, 10)) pCOId1_Status = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 0, 10, 1), Integer32()).setLabel("pCOId1-Status").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: pCOId1_Status.setStatus('current') if mibBuilder.loadTexts: pCOId1_Status.setDescription('Status of pCOId1. 0=Offline, 1=Init, 2=Online') pCOErrorsNumbergroup = MibIdentifier((1, 3, 6, 1, 4, 1, 9839, 2, 0, 11)) pCOId1_ErrorsNumber = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 0, 11, 1), Integer32()).setLabel("pCOId1-ErrorsNumber").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: pCOId1_ErrorsNumber.setStatus('current') if mibBuilder.loadTexts: pCOId1_ErrorsNumber.setDescription('Number of Communication Errors from pCOId1 to pCOWeb.') digitalObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1)) vent_on = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 1), Integer32()).setLabel("vent-on").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: vent_on.setStatus('current') if mibBuilder.loadTexts: vent_on.setDescription('System On (Fan)') compressore1 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 2), Integer32()).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: compressore1.setStatus('current') if mibBuilder.loadTexts: compressore1.setDescription('Compressor 1') compressore2 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 3), Integer32()).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: compressore2.setStatus('current') if mibBuilder.loadTexts: compressore2.setDescription('Compressor 2') compressore3 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 4), Integer32()).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: compressore3.setStatus('current') if mibBuilder.loadTexts: compressore3.setDescription('Compressor 3') compressore4 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 5), Integer32()).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: compressore4.setStatus('current') if mibBuilder.loadTexts: compressore4.setDescription('Compressor 4') out_h1 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 6), Integer32()).setLabel("out-h1").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: out_h1.setStatus('current') if mibBuilder.loadTexts: out_h1.setDescription('Heating 1') out_h2 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 7), Integer32()).setLabel("out-h2").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: out_h2.setStatus('current') if mibBuilder.loadTexts: out_h2.setDescription('Heating 2') out_h3 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 8), Integer32()).setLabel("out-h3").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: out_h3.setStatus('current') if mibBuilder.loadTexts: out_h3.setDescription('Heating 3') gas_caldo_on = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 9), Integer32()).setLabel("gas-caldo-on").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: gas_caldo_on.setStatus('current') if mibBuilder.loadTexts: gas_caldo_on.setDescription('Hot Gas Coil') on_deum = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 10), Integer32()).setLabel("on-deum").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: on_deum.setStatus('current') if mibBuilder.loadTexts: on_deum.setDescription('Dehumidification') power = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 11), Integer32()).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: power.setStatus('current') if mibBuilder.loadTexts: power.setDescription('Humidification') mal_access = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 12), Integer32()).setLabel("mal-access").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_access.setStatus('current') if mibBuilder.loadTexts: mal_access.setDescription('Tampering Alarm') mal_ata = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 13), Integer32()).setLabel("mal-ata").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_ata.setStatus('current') if mibBuilder.loadTexts: mal_ata.setDescription('Alarm: Room High Temperature') mal_bta = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 14), Integer32()).setLabel("mal-bta").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_bta.setStatus('current') if mibBuilder.loadTexts: mal_bta.setDescription('Alarm: Room Low Temperature') mal_aua = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 15), Integer32()).setLabel("mal-aua").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_aua.setStatus('current') if mibBuilder.loadTexts: mal_aua.setDescription('Alarm: Room High Humidity') mal_bua = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 16), Integer32()).setLabel("mal-bua").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_bua.setStatus('current') if mibBuilder.loadTexts: mal_bua.setDescription('Alarm: Room Low Humidity') mal_eap = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 17), Integer32()).setLabel("mal-eap").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_eap.setStatus('current') if mibBuilder.loadTexts: mal_eap.setDescription('Alarm: Room High/Low Temp./Humid.(Ext. Devices)') mal_filter = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 18), Integer32()).setLabel("mal-filter").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_filter.setStatus('current') if mibBuilder.loadTexts: mal_filter.setDescription('Alarm: Clogged Filter') mal_flood = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 19), Integer32()).setLabel("mal-flood").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_flood.setStatus('current') if mibBuilder.loadTexts: mal_flood.setDescription('Alarm: Water Leakage Detected') mal_flux = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 20), Integer32()).setLabel("mal-flux").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_flux.setStatus('current') if mibBuilder.loadTexts: mal_flux.setDescription('Alarm: Loss of Air Flow') mal_heater = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 21), Integer32()).setLabel("mal-heater").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_heater.setStatus('current') if mibBuilder.loadTexts: mal_heater.setDescription('Alarm: Heater Overheating') mal_hp1 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 22), Integer32()).setLabel("mal-hp1").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_hp1.setStatus('current') if mibBuilder.loadTexts: mal_hp1.setDescription('Alarm: High Pressure 1') mal_hp2 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 23), Integer32()).setLabel("mal-hp2").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_hp2.setStatus('current') if mibBuilder.loadTexts: mal_hp2.setDescription('Alarm: High Pressure 2') mal_lp1 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 24), Integer32()).setLabel("mal-lp1").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_lp1.setStatus('current') if mibBuilder.loadTexts: mal_lp1.setDescription('Alarm: Low Pressure 1') mal_lp2 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 25), Integer32()).setLabel("mal-lp2").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_lp2.setStatus('current') if mibBuilder.loadTexts: mal_lp2.setDescription('Alarm: Low Pressure 2') mal_phase = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 26), Integer32()).setLabel("mal-phase").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_phase.setStatus('current') if mibBuilder.loadTexts: mal_phase.setDescription('Alarm: Wrong phase sequence') mal_smoke = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 27), Integer32()).setLabel("mal-smoke").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_smoke.setStatus('current') if mibBuilder.loadTexts: mal_smoke.setDescription('Alarm: SMOKE-FIRE DETECTED') mal_lan = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 28), Integer32()).setLabel("mal-lan").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_lan.setStatus('current') if mibBuilder.loadTexts: mal_lan.setDescription('Alarm: Interrupted LAN') mal_hcurr = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 29), Integer32()).setLabel("mal-hcurr").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_hcurr.setStatus('current') if mibBuilder.loadTexts: mal_hcurr.setDescription('Humidifier Alarm: High Current') mal_nopower = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 30), Integer32()).setLabel("mal-nopower").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_nopower.setStatus('current') if mibBuilder.loadTexts: mal_nopower.setDescription('Humidifier Alarm: Power Loss') mal_nowater = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 31), Integer32()).setLabel("mal-nowater").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_nowater.setStatus('current') if mibBuilder.loadTexts: mal_nowater.setDescription('Humidifier Alarm: Water Loss') mal_cw_dh = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 32), Integer32()).setLabel("mal-cw-dh").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_cw_dh.setStatus('current') if mibBuilder.loadTexts: mal_cw_dh.setDescription('Alarm: Chilled Water Temp. too High for Dehumidification') mal_tc_cw = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 33), Integer32()).setLabel("mal-tc-cw").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_tc_cw.setStatus('current') if mibBuilder.loadTexts: mal_tc_cw.setDescription('Alarm: CW Valve Failure or Water Flow too Low') mal_wflow = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 34), Integer32()).setLabel("mal-wflow").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_wflow.setStatus('current') if mibBuilder.loadTexts: mal_wflow.setDescription('Alarm: Loss of Water flow') mal_wht = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 35), Integer32()).setLabel("mal-wht").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_wht.setStatus('current') if mibBuilder.loadTexts: mal_wht.setDescription('Alarm: High chilled water temp.') mal_sonda_ta = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 36), Integer32()).setLabel("mal-sonda-ta").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_sonda_ta.setStatus('current') if mibBuilder.loadTexts: mal_sonda_ta.setDescription('Alarm: Room air Sensor Failure/Disconnected') mal_sonda_tac = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 37), Integer32()).setLabel("mal-sonda-tac").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_sonda_tac.setStatus('current') if mibBuilder.loadTexts: mal_sonda_tac.setDescription('Alarm: Hot water Sensor Failure/Disconnected') mal_sonda_tc = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 38), Integer32()).setLabel("mal-sonda-tc").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_sonda_tc.setStatus('current') if mibBuilder.loadTexts: mal_sonda_tc.setDescription('Alarm: Condensing water Sensor Failure/Disconnect.') mal_sonda_te = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 39), Integer32()).setLabel("mal-sonda-te").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_sonda_te.setStatus('current') if mibBuilder.loadTexts: mal_sonda_te.setDescription('Alarm: Outdoor temp. Sensor Failure/Disconnected') mal_sonda_tm = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 40), Integer32()).setLabel("mal-sonda-tm").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_sonda_tm.setStatus('current') if mibBuilder.loadTexts: mal_sonda_tm.setDescription('Alarm: Delivery temp. Sensor Failure/Disconnected') mal_sonda_ua = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 41), Integer32()).setLabel("mal-sonda-ua").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_sonda_ua.setStatus('current') if mibBuilder.loadTexts: mal_sonda_ua.setDescription('Alarm: Rel. Humidity Sensor Failure/Disconnected') mal_ore_compr1 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 42), Integer32()).setLabel("mal-ore-compr1").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_ore_compr1.setStatus('current') if mibBuilder.loadTexts: mal_ore_compr1.setDescription('Service Alarm: Compressor 1 hour counter threshold') mal_ore_compr2 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 43), Integer32()).setLabel("mal-ore-compr2").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_ore_compr2.setStatus('current') if mibBuilder.loadTexts: mal_ore_compr2.setDescription('Service Alarm: Compressor 2 hour counter threshold') mal_ore_compr3 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 44), Integer32()).setLabel("mal-ore-compr3").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_ore_compr3.setStatus('current') if mibBuilder.loadTexts: mal_ore_compr3.setDescription('Service Alarm: Compressor 3 hour counter threshold') mal_ore_compr4 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 45), Integer32()).setLabel("mal-ore-compr4").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_ore_compr4.setStatus('current') if mibBuilder.loadTexts: mal_ore_compr4.setDescription('Service Alarm: Compressor 4 hour counter threshold') mal_ore_filtro = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 46), Integer32()).setLabel("mal-ore-filtro").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_ore_filtro.setStatus('current') if mibBuilder.loadTexts: mal_ore_filtro.setDescription('Service Alarm: Air Filter hour counter threshold') mal_ore_risc1 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 47), Integer32()).setLabel("mal-ore-risc1").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_ore_risc1.setStatus('current') if mibBuilder.loadTexts: mal_ore_risc1.setDescription('Service Alarm: Heater 1 hour counter threshold') mal_ore_risc2 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 48), Integer32()).setLabel("mal-ore-risc2").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_ore_risc2.setStatus('current') if mibBuilder.loadTexts: mal_ore_risc2.setDescription('Service Alarm: Heater 2 hour counter threshold') mal_ore_umid = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 49), Integer32()).setLabel("mal-ore-umid").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_ore_umid.setStatus('current') if mibBuilder.loadTexts: mal_ore_umid.setDescription('Service Alarm: Humidifier hour counter threshold') mal_ore_unit = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 50), Integer32()).setLabel("mal-ore-unit").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: mal_ore_unit.setStatus('current') if mibBuilder.loadTexts: mal_ore_unit.setDescription('Service Alarm: Unit hour counter threshold') glb_al = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 51), Integer32()).setLabel("glb-al").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: glb_al.setStatus('current') if mibBuilder.loadTexts: glb_al.setDescription('General Alarm') or_al_2lev = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 52), Integer32()).setLabel("or-al-2lev").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: or_al_2lev.setStatus('current') if mibBuilder.loadTexts: or_al_2lev.setDescription('2nd Level Alarm') range_t_ext = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 53), Integer32()).setLabel("range-t-ext").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: range_t_ext.setStatus('current') if mibBuilder.loadTexts: range_t_ext.setDescription('Outdoor Temp. Sensor Fitted') range_t_circ = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 54), Integer32()).setLabel("range-t-circ").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: range_t_circ.setStatus('current') if mibBuilder.loadTexts: range_t_circ.setDescription('Closed Circuit (or Chilled) Water Temperature Sensor Fitted') range_t_man = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 55), Integer32()).setLabel("range-t-man").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: range_t_man.setStatus('current') if mibBuilder.loadTexts: range_t_man.setDescription('Delivery Temp. Sensor Fitted') range_t_ac = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 56), Integer32()).setLabel("range-t-ac").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: range_t_ac.setStatus('current') if mibBuilder.loadTexts: range_t_ac.setDescription('Hot water temp. Sensor Fitted') umid_al = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 57), Integer32()).setLabel("umid-al").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: umid_al.setStatus('current') if mibBuilder.loadTexts: umid_al.setDescription('Humidifier general alarm') range_u_amb = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 58), Integer32()).setLabel("range-u-amb").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: range_u_amb.setStatus('current') if mibBuilder.loadTexts: range_u_amb.setDescription('Relative Humidity Sensor Fitted') k_syson = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 60), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setLabel("k-syson").setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: k_syson.setStatus('current') if mibBuilder.loadTexts: k_syson.setDescription('Unit Remote Switch-On/Off Control') xs_res_al = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 61), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setLabel("xs-res-al").setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: xs_res_al.setStatus('current') if mibBuilder.loadTexts: xs_res_al.setDescription('Buzzer and Alarm Remote Reset Control') sleep_mode = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 63), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setLabel("sleep-mode").setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: sleep_mode.setStatus('current') if mibBuilder.loadTexts: sleep_mode.setDescription('Set Back Mode (Sleep Mode)') test_sm = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 64), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setLabel("test-sm").setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: test_sm.setStatus('current') if mibBuilder.loadTexts: test_sm.setDescription('Set Back mode: Cyclical Start of Fan') ab_mediath = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 65), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setLabel("ab-mediath").setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: ab_mediath.setStatus('current') if mibBuilder.loadTexts: ab_mediath.setDescription('Usage of T+ H Values: Local (0) / Mean (1)') ustdby1_2 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 66), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setLabel("ustdby1-2").setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: ustdby1_2.setStatus('current') if mibBuilder.loadTexts: ustdby1_2.setDescription('No. Of Stand-by Units: one (0) / two (1)') emerg = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 67), Integer32()).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: emerg.setStatus('current') if mibBuilder.loadTexts: emerg.setDescription('Unit in Emergency operation') analogObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2)) temp_amb = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 1), Integer32()).setLabel("temp-amb").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: temp_amb.setStatus('current') if mibBuilder.loadTexts: temp_amb.setDescription('Room Temperature') temp_ext = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 2), Integer32()).setLabel("temp-ext").setUnits('deg.C x 10').setMaxAccess("readonly") if mibBuilder.loadTexts: temp_ext.setStatus('current') if mibBuilder.loadTexts: temp_ext.setDescription('Outdoor Temperature') temp_mand = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 3), Integer32()).setLabel("temp-mand").setUnits('deg.C x 10').setMaxAccess("readonly") if mibBuilder.loadTexts: temp_mand.setStatus('current') if mibBuilder.loadTexts: temp_mand.setDescription('Delivery Air Temperature') temp_circ = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 4), Integer32()).setLabel("temp-circ").setUnits('deg.C x 10').setMaxAccess("readonly") if mibBuilder.loadTexts: temp_circ.setStatus('current') if mibBuilder.loadTexts: temp_circ.setDescription('Closed Circuit (or Chilled) Water Temperature') temp_ac = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 5), Integer32()).setLabel("temp-ac").setUnits('deg.C x 10').setMaxAccess("readonly") if mibBuilder.loadTexts: temp_ac.setStatus('current') if mibBuilder.loadTexts: temp_ac.setDescription('Hot Water Temperature') umid_amb = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 6), Integer32()).setLabel("umid-amb").setUnits('rH% x 10').setMaxAccess("readonly") if mibBuilder.loadTexts: umid_amb.setStatus('current') if mibBuilder.loadTexts: umid_amb.setDescription('Room Relative Humidity') t_set = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("t-set").setUnits('deg.C x 10').setMaxAccess("readwrite") if mibBuilder.loadTexts: t_set.setStatus('current') if mibBuilder.loadTexts: t_set.setDescription('Cooling Set Point') t_diff = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("t-diff").setUnits('deg.C x 10').setMaxAccess("readwrite") if mibBuilder.loadTexts: t_diff.setStatus('current') if mibBuilder.loadTexts: t_diff.setDescription('Cooling Prop.Band') t_set_c = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("t-set-c").setUnits('deg.C x 10').setMaxAccess("readwrite") if mibBuilder.loadTexts: t_set_c.setStatus('current') if mibBuilder.loadTexts: t_set_c.setDescription('Heating Set point') t_diff_c = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("t-diff-c").setUnits('deg.C x 10').setMaxAccess("readwrite") if mibBuilder.loadTexts: t_diff_c.setStatus('current') if mibBuilder.loadTexts: t_diff_c.setDescription('Heating Prop.Band') ht_set = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("ht-set").setUnits('deg.C').setMaxAccess("readwrite") if mibBuilder.loadTexts: ht_set.setStatus('current') if mibBuilder.loadTexts: ht_set.setDescription('Room High Temp. Alarm Threshold') lt_set = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("lt-set").setUnits('deg.C').setMaxAccess("readwrite") if mibBuilder.loadTexts: lt_set.setStatus('current') if mibBuilder.loadTexts: lt_set.setDescription('Room Low Temp. Alarm Threshold') t_set_sm = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("t-set-sm").setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: t_set_sm.setStatus('current') if mibBuilder.loadTexts: t_set_sm.setDescription('Setback Mode: Cooling Set Point') t_set_c_sm = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("t-set-c-sm").setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: t_set_c_sm.setStatus('current') if mibBuilder.loadTexts: t_set_c_sm.setDescription('Setback Mode: Heating Set Point') t_cw_dh = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("t-cw-dh").setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: t_cw_dh.setStatus('current') if mibBuilder.loadTexts: t_cw_dh.setDescription('CW Set Point to Start Dehumidification Cycle') htset_cw = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("htset-cw").setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: htset_cw.setStatus('current') if mibBuilder.loadTexts: htset_cw.setDescription('CW High Temperature Alarm Threshold') t_set_cw = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 17), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("t-set-cw").setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: t_set_cw.setStatus('current') if mibBuilder.loadTexts: t_set_cw.setDescription('CW Set Point to Start CW Operating Mode (TC only)') t_rc_es = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 18), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("t-rc-es").setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: t_rc_es.setStatus('current') if mibBuilder.loadTexts: t_rc_es.setDescription('Rad-cooler Set Point in E.S. Mode (ES Only)') t_rc_est = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 19), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("t-rc-est").setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: t_rc_est.setStatus('current') if mibBuilder.loadTexts: t_rc_est.setDescription('Rad-cooler Set Point in DX Mode (ES Only)') rampa_valv = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 20), Integer32()).setLabel("rampa-valv").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: rampa_valv.setStatus('current') if mibBuilder.loadTexts: rampa_valv.setDescription('0-10V Ramp 1 Value (CW Valve Ramp)') anaout2 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 21), Integer32()).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: anaout2.setStatus('current') if mibBuilder.loadTexts: anaout2.setDescription('0-10V Ramp 2 Value (HW Valve/Rad Cooler Ramp)') steam_production = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 22), Integer32()).setLabel("steam-production").setUnits('kg/h x 10').setMaxAccess("readonly") if mibBuilder.loadTexts: steam_production.setStatus('current') if mibBuilder.loadTexts: steam_production.setDescription('Humidifier: steam capacity') t_set_lm = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 23), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("t-set-lm").setUnits('deg.C').setMaxAccess("readwrite") if mibBuilder.loadTexts: t_set_lm.setStatus('current') if mibBuilder.loadTexts: t_set_lm.setDescription('Delivery Air Temperature Limit Set Point ') delta_lm = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 24), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("delta-lm").setUnits('deg.C x 10').setMaxAccess("readwrite") if mibBuilder.loadTexts: delta_lm.setStatus('current') if mibBuilder.loadTexts: delta_lm.setDescription('T+H Values: Mean/Local Diff. (aut. Changeover)') integerObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3)) ore_filtro = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 1), Integer32()).setLabel("ore-filtro").setUnits('h').setMaxAccess("readonly") if mibBuilder.loadTexts: ore_filtro.setStatus('current') if mibBuilder.loadTexts: ore_filtro.setDescription('Air Filter Working Houres') ore_unit = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 2), Integer32()).setLabel("ore-unit").setUnits('h').setMaxAccess("readonly") if mibBuilder.loadTexts: ore_unit.setStatus('current') if mibBuilder.loadTexts: ore_unit.setDescription('Unit Working Houres') ore_compr1 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 3), Integer32()).setLabel("ore-compr1").setUnits('h').setMaxAccess("readonly") if mibBuilder.loadTexts: ore_compr1.setStatus('current') if mibBuilder.loadTexts: ore_compr1.setDescription('Compressor 1 Working Houres') ore_compr2 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 4), Integer32()).setLabel("ore-compr2").setUnits('h').setMaxAccess("readonly") if mibBuilder.loadTexts: ore_compr2.setStatus('current') if mibBuilder.loadTexts: ore_compr2.setDescription('Compressor 2 Working Houres') ore_compr3 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 5), Integer32()).setLabel("ore-compr3").setUnits('h').setMaxAccess("readonly") if mibBuilder.loadTexts: ore_compr3.setStatus('current') if mibBuilder.loadTexts: ore_compr3.setDescription('Compressor 3 Working Houres') ore_compr4 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 6), Integer32()).setLabel("ore-compr4").setUnits('h').setMaxAccess("readonly") if mibBuilder.loadTexts: ore_compr4.setStatus('current') if mibBuilder.loadTexts: ore_compr4.setDescription('Compressor 4 Working Houres') ore_heat1 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 7), Integer32()).setLabel("ore-heat1").setUnits('h').setMaxAccess("readonly") if mibBuilder.loadTexts: ore_heat1.setStatus('current') if mibBuilder.loadTexts: ore_heat1.setDescription('Heater 1 Working Houres') ore_heat2 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 8), Integer32()).setLabel("ore-heat2").setUnits('h').setMaxAccess("readonly") if mibBuilder.loadTexts: ore_heat2.setStatus('current') if mibBuilder.loadTexts: ore_heat2.setDescription('Heater 2 Working Houres') ore_umid = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 9), Integer32()).setLabel("ore-umid").setUnits('h').setMaxAccess("readonly") if mibBuilder.loadTexts: ore_umid.setStatus('current') if mibBuilder.loadTexts: ore_umid.setDescription('Humidifier Working Houres') hdiff = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('rH%').setMaxAccess("readwrite") if mibBuilder.loadTexts: hdiff.setStatus('current') if mibBuilder.loadTexts: hdiff.setDescription('Dehumidification Proportional Band') hu_diff = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("hu-diff").setUnits('rH%').setMaxAccess("readwrite") if mibBuilder.loadTexts: hu_diff.setStatus('current') if mibBuilder.loadTexts: hu_diff.setDescription('Humidification Proportional Band') hh_set = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("hh-set").setUnits('rH%').setMaxAccess("readwrite") if mibBuilder.loadTexts: hh_set.setStatus('current') if mibBuilder.loadTexts: hh_set.setDescription('High Relative Humidity Alarm Threshold') lh_set = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("lh-set").setUnits('rH%').setMaxAccess("readwrite") if mibBuilder.loadTexts: lh_set.setStatus('current') if mibBuilder.loadTexts: lh_set.setDescription('Low Relative Humidity Alarm Threshold') hset = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('rH%').setMaxAccess("readwrite") if mibBuilder.loadTexts: hset.setStatus('current') if mibBuilder.loadTexts: hset.setDescription('Dehumidification Set Point') hset_sm = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 17), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("hset-sm").setUnits('rH%').setMaxAccess("readwrite") if mibBuilder.loadTexts: hset_sm.setStatus('current') if mibBuilder.loadTexts: hset_sm.setDescription('Setback Mode: Dehumidification Set Point') hu_set = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 18), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("hu-set").setUnits('rH%').setMaxAccess("readwrite") if mibBuilder.loadTexts: hu_set.setStatus('current') if mibBuilder.loadTexts: hu_set.setDescription('Humidification Set Point') hu_set_sm = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 19), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("hu-set-sm").setUnits('rH%').setMaxAccess("readwrite") if mibBuilder.loadTexts: hu_set_sm.setStatus('current') if mibBuilder.loadTexts: hu_set_sm.setDescription('Setback Mode: Humidification Set Point') restart_delay = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 20), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("restart-delay").setUnits('sec').setMaxAccess("readwrite") if mibBuilder.loadTexts: restart_delay.setStatus('current') if mibBuilder.loadTexts: restart_delay.setDescription('Restart Delay') regul_delay = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 21), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("regul-delay").setUnits('sec').setMaxAccess("readwrite") if mibBuilder.loadTexts: regul_delay.setStatus('current') if mibBuilder.loadTexts: regul_delay.setDescription('Regulation Start Transitory ') time_lowp = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 22), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("time-lowp").setUnits('sec').setMaxAccess("readwrite") if mibBuilder.loadTexts: time_lowp.setStatus('current') if mibBuilder.loadTexts: time_lowp.setDescription('Low Pressure Delay') alarm_delay = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 23), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("alarm-delay").setUnits('m').setMaxAccess("readwrite") if mibBuilder.loadTexts: alarm_delay.setStatus('current') if mibBuilder.loadTexts: alarm_delay.setDescription('Room T+H Alarm Delay') exc_time = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 24), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("exc-time").setUnits('m').setMaxAccess("readwrite") if mibBuilder.loadTexts: exc_time.setStatus('current') if mibBuilder.loadTexts: exc_time.setDescription('Anti-Hunting Constant of Room Regulation ') t_std_by = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 25), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("t-std-by").setUnits('h').setMaxAccess("readwrite") if mibBuilder.loadTexts: t_std_by.setStatus('current') if mibBuilder.loadTexts: t_std_by.setDescription('Stand-by Cycle Base Time') lan_unit = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 27), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("lan-unit").setUnits('n').setMaxAccess("readwrite") if mibBuilder.loadTexts: lan_unit.setStatus('current') if mibBuilder.loadTexts: lan_unit.setDescription('Total of units connected in LAN') ciclo_sm = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 28), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setLabel("ciclo-sm").setUnits('m').setMaxAccess("readwrite") if mibBuilder.loadTexts: ciclo_sm.setStatus('current') if mibBuilder.loadTexts: ciclo_sm.setDescription('Set Back Mode: Fan Cyclical Start Interval') mibBuilder.exportSymbols("UNCDZ-MIB", ore_compr3=ore_compr3, out_h3=out_h3, mal_smoke=mal_smoke, hset_sm=hset_sm, mal_lp1=mal_lp1, regul_delay=regul_delay, vent_on=vent_on, ore_umid=ore_umid, hset=hset, k_syson=k_syson, t_set_cw=t_set_cw, compressore1=compressore1, lh_set=lh_set, ore_filtro=ore_filtro, out_h2=out_h2, sleep_mode=sleep_mode, mal_sonda_tac=mal_sonda_tac, hu_set=hu_set, umid_al=umid_al, pCOStatusgroup=pCOStatusgroup, mal_wht=mal_wht, ore_compr4=ore_compr4, emerg=emerg, steam_production=steam_production, temp_ac=temp_ac, mal_ore_umid=mal_ore_umid, temp_mand=temp_mand, mal_hp2=mal_hp2, mal_ore_compr3=mal_ore_compr3, pCOId1_ErrorsNumber=pCOId1_ErrorsNumber, temp_circ=temp_circ, mal_aua=mal_aua, mal_cw_dh=mal_cw_dh, mal_ore_unit=mal_ore_unit, t_std_by=t_std_by, mal_ore_compr1=mal_ore_compr1, compressore3=compressore3, range_t_ac=range_t_ac, mal_flux=mal_flux, compressore2=compressore2, mal_sonda_ua=mal_sonda_ua, temp_amb=temp_amb, htset_cw=htset_cw, mal_ore_compr4=mal_ore_compr4, ciclo_sm=ciclo_sm, hh_set=hh_set, out_h1=out_h1, pCOId1_Status=pCOId1_Status, mal_eap=mal_eap, time_lowp=time_lowp, mal_phase=mal_phase, pCOWebInfo=pCOWebInfo, t_diff_c=t_diff_c, power=power, ustdby1_2=ustdby1_2, t_diff=t_diff, mal_flood=mal_flood, mal_sonda_tc=mal_sonda_tc, uncdz_MIB=uncdz_MIB, mal_nopower=mal_nopower, ore_heat2=ore_heat2, mal_tc_cw=mal_tc_cw, t_set_c=t_set_c, integerObjects=integerObjects, ore_compr1=ore_compr1, t_set=t_set, t_rc_est=t_rc_est, compressore4=compressore4, carel=carel, t_set_c_sm=t_set_c_sm, ht_set=ht_set, mal_ore_risc2=mal_ore_risc2, hu_diff=hu_diff, mal_access=mal_access, mal_ore_compr2=mal_ore_compr2, digitalObjects=digitalObjects, pCOErrorsNumbergroup=pCOErrorsNumbergroup, alarm_delay=alarm_delay, mal_heater=mal_heater, on_deum=on_deum, mal_lp2=mal_lp2, rampa_valv=rampa_valv, agentCode=agentCode, t_set_lm=t_set_lm, ore_compr2=ore_compr2, mal_hp1=mal_hp1, mal_ata=mal_ata, ab_mediath=ab_mediath, analogObjects=analogObjects, delta_lm=delta_lm, anaout2=anaout2, mal_lan=mal_lan, gas_caldo_on=gas_caldo_on, exc_time=exc_time, mal_ore_filtro=mal_ore_filtro, test_sm=test_sm, systm=systm, umid_amb=umid_amb, PYSNMP_MODULE_ID=uncdz_MIB, mal_bua=mal_bua, hu_set_sm=hu_set_sm, mal_ore_risc1=mal_ore_risc1, ore_unit=ore_unit, lt_set=lt_set, agentRelease=agentRelease, mal_sonda_ta=mal_sonda_ta, ore_heat1=ore_heat1, range_u_amb=range_u_amb, xs_res_al=xs_res_al, glb_al=glb_al, or_al_2lev=or_al_2lev, mal_bta=mal_bta, t_set_sm=t_set_sm, range_t_man=range_t_man, temp_ext=temp_ext, mal_hcurr=mal_hcurr, mal_wflow=mal_wflow, hdiff=hdiff, lan_unit=lan_unit, restart_delay=restart_delay, mal_nowater=mal_nowater, t_cw_dh=t_cw_dh, mal_filter=mal_filter, range_t_circ=range_t_circ, range_t_ext=range_t_ext, mal_sonda_te=mal_sonda_te, mal_sonda_tm=mal_sonda_tm, instruments=instruments, t_rc_es=t_rc_es)
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_size_constraint, single_value_constraint, value_range_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'ValueSizeConstraint', 'SingleValueConstraint', 'ValueRangeConstraint', 'ConstraintsUnion') (notification_group, module_compliance, object_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance', 'ObjectGroup') (sys_name, sys_contact, sys_location) = mibBuilder.importSymbols('SNMPv2-MIB', 'sysName', 'sysContact', 'sysLocation') (iso, notification_type, bits, mib_scalar, mib_table, mib_table_row, mib_table_column, ip_address, mib_identifier, integer32, counter64, time_ticks, unsigned32, enterprises, gauge32, module_identity, object_identity, counter32) = mibBuilder.importSymbols('SNMPv2-SMI', 'iso', 'NotificationType', 'Bits', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'IpAddress', 'MibIdentifier', 'Integer32', 'Counter64', 'TimeTicks', 'Unsigned32', 'enterprises', 'Gauge32', 'ModuleIdentity', 'ObjectIdentity', 'Counter32') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') uncdz_mib = module_identity((1, 3, 6, 1, 4, 1, 9839, 2, 1)).setLabel('uncdz-MIB') uncdz_MIB.setRevisions(('2004-08-12 15:52',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: uncdz_MIB.setRevisionsDescriptions(('This is the original version of the MIB.',)) if mibBuilder.loadTexts: uncdz_MIB.setLastUpdated('200408121552Z') if mibBuilder.loadTexts: uncdz_MIB.setOrganization('CAREL SpA') if mibBuilder.loadTexts: uncdz_MIB.setContactInfo(" Simone Ravazzolo Carel SpA Via dell'Industria, 11 35020 Brugine (PD) Italy Tel: +39 049 9716611 E-mail: [email protected] ") if mibBuilder.loadTexts: uncdz_MIB.setDescription('This is the MIB module for the UNIFLAIR UNCDZ device.') carel = mib_identifier((1, 3, 6, 1, 4, 1, 9839)) systm = mib_identifier((1, 3, 6, 1, 4, 1, 9839, 1)) agent_release = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 1, 1), integer32()).setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: agentRelease.setStatus('current') if mibBuilder.loadTexts: agentRelease.setDescription('Release of the Agent.') agent_code = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 1, 2), integer32()).setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: agentCode.setStatus('current') if mibBuilder.loadTexts: agentCode.setDescription('Code of the Agent. 2=pCOWeb.') instruments = mib_identifier((1, 3, 6, 1, 4, 1, 9839, 2)) p_co_web_info = mib_identifier((1, 3, 6, 1, 4, 1, 9839, 2, 0)) p_co_statusgroup = mib_identifier((1, 3, 6, 1, 4, 1, 9839, 2, 0, 10)) p_co_id1__status = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 0, 10, 1), integer32()).setLabel('pCOId1-Status').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: pCOId1_Status.setStatus('current') if mibBuilder.loadTexts: pCOId1_Status.setDescription('Status of pCOId1. 0=Offline, 1=Init, 2=Online') p_co_errors_numbergroup = mib_identifier((1, 3, 6, 1, 4, 1, 9839, 2, 0, 11)) p_co_id1__errors_number = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 0, 11, 1), integer32()).setLabel('pCOId1-ErrorsNumber').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: pCOId1_ErrorsNumber.setStatus('current') if mibBuilder.loadTexts: pCOId1_ErrorsNumber.setDescription('Number of Communication Errors from pCOId1 to pCOWeb.') digital_objects = mib_identifier((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1)) vent_on = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 1), integer32()).setLabel('vent-on').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: vent_on.setStatus('current') if mibBuilder.loadTexts: vent_on.setDescription('System On (Fan)') compressore1 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 2), integer32()).setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: compressore1.setStatus('current') if mibBuilder.loadTexts: compressore1.setDescription('Compressor 1') compressore2 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 3), integer32()).setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: compressore2.setStatus('current') if mibBuilder.loadTexts: compressore2.setDescription('Compressor 2') compressore3 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 4), integer32()).setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: compressore3.setStatus('current') if mibBuilder.loadTexts: compressore3.setDescription('Compressor 3') compressore4 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 5), integer32()).setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: compressore4.setStatus('current') if mibBuilder.loadTexts: compressore4.setDescription('Compressor 4') out_h1 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 6), integer32()).setLabel('out-h1').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: out_h1.setStatus('current') if mibBuilder.loadTexts: out_h1.setDescription('Heating 1') out_h2 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 7), integer32()).setLabel('out-h2').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: out_h2.setStatus('current') if mibBuilder.loadTexts: out_h2.setDescription('Heating 2') out_h3 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 8), integer32()).setLabel('out-h3').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: out_h3.setStatus('current') if mibBuilder.loadTexts: out_h3.setDescription('Heating 3') gas_caldo_on = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 9), integer32()).setLabel('gas-caldo-on').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: gas_caldo_on.setStatus('current') if mibBuilder.loadTexts: gas_caldo_on.setDescription('Hot Gas Coil') on_deum = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 10), integer32()).setLabel('on-deum').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: on_deum.setStatus('current') if mibBuilder.loadTexts: on_deum.setDescription('Dehumidification') power = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 11), integer32()).setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: power.setStatus('current') if mibBuilder.loadTexts: power.setDescription('Humidification') mal_access = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 12), integer32()).setLabel('mal-access').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_access.setStatus('current') if mibBuilder.loadTexts: mal_access.setDescription('Tampering Alarm') mal_ata = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 13), integer32()).setLabel('mal-ata').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_ata.setStatus('current') if mibBuilder.loadTexts: mal_ata.setDescription('Alarm: Room High Temperature') mal_bta = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 14), integer32()).setLabel('mal-bta').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_bta.setStatus('current') if mibBuilder.loadTexts: mal_bta.setDescription('Alarm: Room Low Temperature') mal_aua = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 15), integer32()).setLabel('mal-aua').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_aua.setStatus('current') if mibBuilder.loadTexts: mal_aua.setDescription('Alarm: Room High Humidity') mal_bua = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 16), integer32()).setLabel('mal-bua').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_bua.setStatus('current') if mibBuilder.loadTexts: mal_bua.setDescription('Alarm: Room Low Humidity') mal_eap = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 17), integer32()).setLabel('mal-eap').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_eap.setStatus('current') if mibBuilder.loadTexts: mal_eap.setDescription('Alarm: Room High/Low Temp./Humid.(Ext. Devices)') mal_filter = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 18), integer32()).setLabel('mal-filter').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_filter.setStatus('current') if mibBuilder.loadTexts: mal_filter.setDescription('Alarm: Clogged Filter') mal_flood = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 19), integer32()).setLabel('mal-flood').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_flood.setStatus('current') if mibBuilder.loadTexts: mal_flood.setDescription('Alarm: Water Leakage Detected') mal_flux = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 20), integer32()).setLabel('mal-flux').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_flux.setStatus('current') if mibBuilder.loadTexts: mal_flux.setDescription('Alarm: Loss of Air Flow') mal_heater = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 21), integer32()).setLabel('mal-heater').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_heater.setStatus('current') if mibBuilder.loadTexts: mal_heater.setDescription('Alarm: Heater Overheating') mal_hp1 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 22), integer32()).setLabel('mal-hp1').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_hp1.setStatus('current') if mibBuilder.loadTexts: mal_hp1.setDescription('Alarm: High Pressure 1') mal_hp2 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 23), integer32()).setLabel('mal-hp2').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_hp2.setStatus('current') if mibBuilder.loadTexts: mal_hp2.setDescription('Alarm: High Pressure 2') mal_lp1 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 24), integer32()).setLabel('mal-lp1').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_lp1.setStatus('current') if mibBuilder.loadTexts: mal_lp1.setDescription('Alarm: Low Pressure 1') mal_lp2 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 25), integer32()).setLabel('mal-lp2').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_lp2.setStatus('current') if mibBuilder.loadTexts: mal_lp2.setDescription('Alarm: Low Pressure 2') mal_phase = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 26), integer32()).setLabel('mal-phase').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_phase.setStatus('current') if mibBuilder.loadTexts: mal_phase.setDescription('Alarm: Wrong phase sequence') mal_smoke = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 27), integer32()).setLabel('mal-smoke').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_smoke.setStatus('current') if mibBuilder.loadTexts: mal_smoke.setDescription('Alarm: SMOKE-FIRE DETECTED') mal_lan = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 28), integer32()).setLabel('mal-lan').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_lan.setStatus('current') if mibBuilder.loadTexts: mal_lan.setDescription('Alarm: Interrupted LAN') mal_hcurr = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 29), integer32()).setLabel('mal-hcurr').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_hcurr.setStatus('current') if mibBuilder.loadTexts: mal_hcurr.setDescription('Humidifier Alarm: High Current') mal_nopower = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 30), integer32()).setLabel('mal-nopower').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_nopower.setStatus('current') if mibBuilder.loadTexts: mal_nopower.setDescription('Humidifier Alarm: Power Loss') mal_nowater = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 31), integer32()).setLabel('mal-nowater').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_nowater.setStatus('current') if mibBuilder.loadTexts: mal_nowater.setDescription('Humidifier Alarm: Water Loss') mal_cw_dh = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 32), integer32()).setLabel('mal-cw-dh').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_cw_dh.setStatus('current') if mibBuilder.loadTexts: mal_cw_dh.setDescription('Alarm: Chilled Water Temp. too High for Dehumidification') mal_tc_cw = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 33), integer32()).setLabel('mal-tc-cw').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_tc_cw.setStatus('current') if mibBuilder.loadTexts: mal_tc_cw.setDescription('Alarm: CW Valve Failure or Water Flow too Low') mal_wflow = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 34), integer32()).setLabel('mal-wflow').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_wflow.setStatus('current') if mibBuilder.loadTexts: mal_wflow.setDescription('Alarm: Loss of Water flow') mal_wht = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 35), integer32()).setLabel('mal-wht').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_wht.setStatus('current') if mibBuilder.loadTexts: mal_wht.setDescription('Alarm: High chilled water temp.') mal_sonda_ta = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 36), integer32()).setLabel('mal-sonda-ta').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_sonda_ta.setStatus('current') if mibBuilder.loadTexts: mal_sonda_ta.setDescription('Alarm: Room air Sensor Failure/Disconnected') mal_sonda_tac = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 37), integer32()).setLabel('mal-sonda-tac').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_sonda_tac.setStatus('current') if mibBuilder.loadTexts: mal_sonda_tac.setDescription('Alarm: Hot water Sensor Failure/Disconnected') mal_sonda_tc = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 38), integer32()).setLabel('mal-sonda-tc').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_sonda_tc.setStatus('current') if mibBuilder.loadTexts: mal_sonda_tc.setDescription('Alarm: Condensing water Sensor Failure/Disconnect.') mal_sonda_te = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 39), integer32()).setLabel('mal-sonda-te').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_sonda_te.setStatus('current') if mibBuilder.loadTexts: mal_sonda_te.setDescription('Alarm: Outdoor temp. Sensor Failure/Disconnected') mal_sonda_tm = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 40), integer32()).setLabel('mal-sonda-tm').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_sonda_tm.setStatus('current') if mibBuilder.loadTexts: mal_sonda_tm.setDescription('Alarm: Delivery temp. Sensor Failure/Disconnected') mal_sonda_ua = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 41), integer32()).setLabel('mal-sonda-ua').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_sonda_ua.setStatus('current') if mibBuilder.loadTexts: mal_sonda_ua.setDescription('Alarm: Rel. Humidity Sensor Failure/Disconnected') mal_ore_compr1 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 42), integer32()).setLabel('mal-ore-compr1').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_ore_compr1.setStatus('current') if mibBuilder.loadTexts: mal_ore_compr1.setDescription('Service Alarm: Compressor 1 hour counter threshold') mal_ore_compr2 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 43), integer32()).setLabel('mal-ore-compr2').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_ore_compr2.setStatus('current') if mibBuilder.loadTexts: mal_ore_compr2.setDescription('Service Alarm: Compressor 2 hour counter threshold') mal_ore_compr3 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 44), integer32()).setLabel('mal-ore-compr3').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_ore_compr3.setStatus('current') if mibBuilder.loadTexts: mal_ore_compr3.setDescription('Service Alarm: Compressor 3 hour counter threshold') mal_ore_compr4 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 45), integer32()).setLabel('mal-ore-compr4').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_ore_compr4.setStatus('current') if mibBuilder.loadTexts: mal_ore_compr4.setDescription('Service Alarm: Compressor 4 hour counter threshold') mal_ore_filtro = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 46), integer32()).setLabel('mal-ore-filtro').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_ore_filtro.setStatus('current') if mibBuilder.loadTexts: mal_ore_filtro.setDescription('Service Alarm: Air Filter hour counter threshold') mal_ore_risc1 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 47), integer32()).setLabel('mal-ore-risc1').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_ore_risc1.setStatus('current') if mibBuilder.loadTexts: mal_ore_risc1.setDescription('Service Alarm: Heater 1 hour counter threshold') mal_ore_risc2 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 48), integer32()).setLabel('mal-ore-risc2').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_ore_risc2.setStatus('current') if mibBuilder.loadTexts: mal_ore_risc2.setDescription('Service Alarm: Heater 2 hour counter threshold') mal_ore_umid = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 49), integer32()).setLabel('mal-ore-umid').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_ore_umid.setStatus('current') if mibBuilder.loadTexts: mal_ore_umid.setDescription('Service Alarm: Humidifier hour counter threshold') mal_ore_unit = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 50), integer32()).setLabel('mal-ore-unit').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: mal_ore_unit.setStatus('current') if mibBuilder.loadTexts: mal_ore_unit.setDescription('Service Alarm: Unit hour counter threshold') glb_al = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 51), integer32()).setLabel('glb-al').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: glb_al.setStatus('current') if mibBuilder.loadTexts: glb_al.setDescription('General Alarm') or_al_2lev = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 52), integer32()).setLabel('or-al-2lev').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: or_al_2lev.setStatus('current') if mibBuilder.loadTexts: or_al_2lev.setDescription('2nd Level Alarm') range_t_ext = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 53), integer32()).setLabel('range-t-ext').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: range_t_ext.setStatus('current') if mibBuilder.loadTexts: range_t_ext.setDescription('Outdoor Temp. Sensor Fitted') range_t_circ = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 54), integer32()).setLabel('range-t-circ').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: range_t_circ.setStatus('current') if mibBuilder.loadTexts: range_t_circ.setDescription('Closed Circuit (or Chilled) Water Temperature Sensor Fitted') range_t_man = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 55), integer32()).setLabel('range-t-man').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: range_t_man.setStatus('current') if mibBuilder.loadTexts: range_t_man.setDescription('Delivery Temp. Sensor Fitted') range_t_ac = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 56), integer32()).setLabel('range-t-ac').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: range_t_ac.setStatus('current') if mibBuilder.loadTexts: range_t_ac.setDescription('Hot water temp. Sensor Fitted') umid_al = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 57), integer32()).setLabel('umid-al').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: umid_al.setStatus('current') if mibBuilder.loadTexts: umid_al.setDescription('Humidifier general alarm') range_u_amb = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 58), integer32()).setLabel('range-u-amb').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: range_u_amb.setStatus('current') if mibBuilder.loadTexts: range_u_amb.setDescription('Relative Humidity Sensor Fitted') k_syson = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 60), integer32().subtype(subtypeSpec=value_range_constraint(0, 1))).setLabel('k-syson').setUnits('N/A').setMaxAccess('readwrite') if mibBuilder.loadTexts: k_syson.setStatus('current') if mibBuilder.loadTexts: k_syson.setDescription('Unit Remote Switch-On/Off Control') xs_res_al = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 61), integer32().subtype(subtypeSpec=value_range_constraint(0, 1))).setLabel('xs-res-al').setUnits('N/A').setMaxAccess('readwrite') if mibBuilder.loadTexts: xs_res_al.setStatus('current') if mibBuilder.loadTexts: xs_res_al.setDescription('Buzzer and Alarm Remote Reset Control') sleep_mode = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 63), integer32().subtype(subtypeSpec=value_range_constraint(0, 1))).setLabel('sleep-mode').setUnits('N/A').setMaxAccess('readwrite') if mibBuilder.loadTexts: sleep_mode.setStatus('current') if mibBuilder.loadTexts: sleep_mode.setDescription('Set Back Mode (Sleep Mode)') test_sm = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 64), integer32().subtype(subtypeSpec=value_range_constraint(0, 1))).setLabel('test-sm').setUnits('N/A').setMaxAccess('readwrite') if mibBuilder.loadTexts: test_sm.setStatus('current') if mibBuilder.loadTexts: test_sm.setDescription('Set Back mode: Cyclical Start of Fan') ab_mediath = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 65), integer32().subtype(subtypeSpec=value_range_constraint(0, 1))).setLabel('ab-mediath').setUnits('N/A').setMaxAccess('readwrite') if mibBuilder.loadTexts: ab_mediath.setStatus('current') if mibBuilder.loadTexts: ab_mediath.setDescription('Usage of T+ H Values: Local (0) / Mean (1)') ustdby1_2 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 66), integer32().subtype(subtypeSpec=value_range_constraint(0, 1))).setLabel('ustdby1-2').setUnits('N/A').setMaxAccess('readwrite') if mibBuilder.loadTexts: ustdby1_2.setStatus('current') if mibBuilder.loadTexts: ustdby1_2.setDescription('No. Of Stand-by Units: one (0) / two (1)') emerg = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 67), integer32()).setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: emerg.setStatus('current') if mibBuilder.loadTexts: emerg.setDescription('Unit in Emergency operation') analog_objects = mib_identifier((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2)) temp_amb = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 1), integer32()).setLabel('temp-amb').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: temp_amb.setStatus('current') if mibBuilder.loadTexts: temp_amb.setDescription('Room Temperature') temp_ext = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 2), integer32()).setLabel('temp-ext').setUnits('deg.C x 10').setMaxAccess('readonly') if mibBuilder.loadTexts: temp_ext.setStatus('current') if mibBuilder.loadTexts: temp_ext.setDescription('Outdoor Temperature') temp_mand = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 3), integer32()).setLabel('temp-mand').setUnits('deg.C x 10').setMaxAccess('readonly') if mibBuilder.loadTexts: temp_mand.setStatus('current') if mibBuilder.loadTexts: temp_mand.setDescription('Delivery Air Temperature') temp_circ = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 4), integer32()).setLabel('temp-circ').setUnits('deg.C x 10').setMaxAccess('readonly') if mibBuilder.loadTexts: temp_circ.setStatus('current') if mibBuilder.loadTexts: temp_circ.setDescription('Closed Circuit (or Chilled) Water Temperature') temp_ac = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 5), integer32()).setLabel('temp-ac').setUnits('deg.C x 10').setMaxAccess('readonly') if mibBuilder.loadTexts: temp_ac.setStatus('current') if mibBuilder.loadTexts: temp_ac.setDescription('Hot Water Temperature') umid_amb = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 6), integer32()).setLabel('umid-amb').setUnits('rH% x 10').setMaxAccess('readonly') if mibBuilder.loadTexts: umid_amb.setStatus('current') if mibBuilder.loadTexts: umid_amb.setDescription('Room Relative Humidity') t_set = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 7), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('t-set').setUnits('deg.C x 10').setMaxAccess('readwrite') if mibBuilder.loadTexts: t_set.setStatus('current') if mibBuilder.loadTexts: t_set.setDescription('Cooling Set Point') t_diff = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 8), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('t-diff').setUnits('deg.C x 10').setMaxAccess('readwrite') if mibBuilder.loadTexts: t_diff.setStatus('current') if mibBuilder.loadTexts: t_diff.setDescription('Cooling Prop.Band') t_set_c = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 9), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('t-set-c').setUnits('deg.C x 10').setMaxAccess('readwrite') if mibBuilder.loadTexts: t_set_c.setStatus('current') if mibBuilder.loadTexts: t_set_c.setDescription('Heating Set point') t_diff_c = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 10), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('t-diff-c').setUnits('deg.C x 10').setMaxAccess('readwrite') if mibBuilder.loadTexts: t_diff_c.setStatus('current') if mibBuilder.loadTexts: t_diff_c.setDescription('Heating Prop.Band') ht_set = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 11), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('ht-set').setUnits('deg.C').setMaxAccess('readwrite') if mibBuilder.loadTexts: ht_set.setStatus('current') if mibBuilder.loadTexts: ht_set.setDescription('Room High Temp. Alarm Threshold') lt_set = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 12), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('lt-set').setUnits('deg.C').setMaxAccess('readwrite') if mibBuilder.loadTexts: lt_set.setStatus('current') if mibBuilder.loadTexts: lt_set.setDescription('Room Low Temp. Alarm Threshold') t_set_sm = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 13), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('t-set-sm').setUnits('N/A').setMaxAccess('readwrite') if mibBuilder.loadTexts: t_set_sm.setStatus('current') if mibBuilder.loadTexts: t_set_sm.setDescription('Setback Mode: Cooling Set Point') t_set_c_sm = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 14), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('t-set-c-sm').setUnits('N/A').setMaxAccess('readwrite') if mibBuilder.loadTexts: t_set_c_sm.setStatus('current') if mibBuilder.loadTexts: t_set_c_sm.setDescription('Setback Mode: Heating Set Point') t_cw_dh = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 15), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('t-cw-dh').setUnits('N/A').setMaxAccess('readwrite') if mibBuilder.loadTexts: t_cw_dh.setStatus('current') if mibBuilder.loadTexts: t_cw_dh.setDescription('CW Set Point to Start Dehumidification Cycle') htset_cw = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 16), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('htset-cw').setUnits('N/A').setMaxAccess('readwrite') if mibBuilder.loadTexts: htset_cw.setStatus('current') if mibBuilder.loadTexts: htset_cw.setDescription('CW High Temperature Alarm Threshold') t_set_cw = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 17), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('t-set-cw').setUnits('N/A').setMaxAccess('readwrite') if mibBuilder.loadTexts: t_set_cw.setStatus('current') if mibBuilder.loadTexts: t_set_cw.setDescription('CW Set Point to Start CW Operating Mode (TC only)') t_rc_es = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 18), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('t-rc-es').setUnits('N/A').setMaxAccess('readwrite') if mibBuilder.loadTexts: t_rc_es.setStatus('current') if mibBuilder.loadTexts: t_rc_es.setDescription('Rad-cooler Set Point in E.S. Mode (ES Only)') t_rc_est = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 19), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('t-rc-est').setUnits('N/A').setMaxAccess('readwrite') if mibBuilder.loadTexts: t_rc_est.setStatus('current') if mibBuilder.loadTexts: t_rc_est.setDescription('Rad-cooler Set Point in DX Mode (ES Only)') rampa_valv = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 20), integer32()).setLabel('rampa-valv').setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: rampa_valv.setStatus('current') if mibBuilder.loadTexts: rampa_valv.setDescription('0-10V Ramp 1 Value (CW Valve Ramp)') anaout2 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 21), integer32()).setUnits('N/A').setMaxAccess('readonly') if mibBuilder.loadTexts: anaout2.setStatus('current') if mibBuilder.loadTexts: anaout2.setDescription('0-10V Ramp 2 Value (HW Valve/Rad Cooler Ramp)') steam_production = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 22), integer32()).setLabel('steam-production').setUnits('kg/h x 10').setMaxAccess('readonly') if mibBuilder.loadTexts: steam_production.setStatus('current') if mibBuilder.loadTexts: steam_production.setDescription('Humidifier: steam capacity') t_set_lm = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 23), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('t-set-lm').setUnits('deg.C').setMaxAccess('readwrite') if mibBuilder.loadTexts: t_set_lm.setStatus('current') if mibBuilder.loadTexts: t_set_lm.setDescription('Delivery Air Temperature Limit Set Point ') delta_lm = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 24), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('delta-lm').setUnits('deg.C x 10').setMaxAccess('readwrite') if mibBuilder.loadTexts: delta_lm.setStatus('current') if mibBuilder.loadTexts: delta_lm.setDescription('T+H Values: Mean/Local Diff. (aut. Changeover)') integer_objects = mib_identifier((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3)) ore_filtro = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 1), integer32()).setLabel('ore-filtro').setUnits('h').setMaxAccess('readonly') if mibBuilder.loadTexts: ore_filtro.setStatus('current') if mibBuilder.loadTexts: ore_filtro.setDescription('Air Filter Working Houres') ore_unit = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 2), integer32()).setLabel('ore-unit').setUnits('h').setMaxAccess('readonly') if mibBuilder.loadTexts: ore_unit.setStatus('current') if mibBuilder.loadTexts: ore_unit.setDescription('Unit Working Houres') ore_compr1 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 3), integer32()).setLabel('ore-compr1').setUnits('h').setMaxAccess('readonly') if mibBuilder.loadTexts: ore_compr1.setStatus('current') if mibBuilder.loadTexts: ore_compr1.setDescription('Compressor 1 Working Houres') ore_compr2 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 4), integer32()).setLabel('ore-compr2').setUnits('h').setMaxAccess('readonly') if mibBuilder.loadTexts: ore_compr2.setStatus('current') if mibBuilder.loadTexts: ore_compr2.setDescription('Compressor 2 Working Houres') ore_compr3 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 5), integer32()).setLabel('ore-compr3').setUnits('h').setMaxAccess('readonly') if mibBuilder.loadTexts: ore_compr3.setStatus('current') if mibBuilder.loadTexts: ore_compr3.setDescription('Compressor 3 Working Houres') ore_compr4 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 6), integer32()).setLabel('ore-compr4').setUnits('h').setMaxAccess('readonly') if mibBuilder.loadTexts: ore_compr4.setStatus('current') if mibBuilder.loadTexts: ore_compr4.setDescription('Compressor 4 Working Houres') ore_heat1 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 7), integer32()).setLabel('ore-heat1').setUnits('h').setMaxAccess('readonly') if mibBuilder.loadTexts: ore_heat1.setStatus('current') if mibBuilder.loadTexts: ore_heat1.setDescription('Heater 1 Working Houres') ore_heat2 = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 8), integer32()).setLabel('ore-heat2').setUnits('h').setMaxAccess('readonly') if mibBuilder.loadTexts: ore_heat2.setStatus('current') if mibBuilder.loadTexts: ore_heat2.setDescription('Heater 2 Working Houres') ore_umid = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 9), integer32()).setLabel('ore-umid').setUnits('h').setMaxAccess('readonly') if mibBuilder.loadTexts: ore_umid.setStatus('current') if mibBuilder.loadTexts: ore_umid.setDescription('Humidifier Working Houres') hdiff = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 12), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setUnits('rH%').setMaxAccess('readwrite') if mibBuilder.loadTexts: hdiff.setStatus('current') if mibBuilder.loadTexts: hdiff.setDescription('Dehumidification Proportional Band') hu_diff = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 13), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('hu-diff').setUnits('rH%').setMaxAccess('readwrite') if mibBuilder.loadTexts: hu_diff.setStatus('current') if mibBuilder.loadTexts: hu_diff.setDescription('Humidification Proportional Band') hh_set = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 14), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('hh-set').setUnits('rH%').setMaxAccess('readwrite') if mibBuilder.loadTexts: hh_set.setStatus('current') if mibBuilder.loadTexts: hh_set.setDescription('High Relative Humidity Alarm Threshold') lh_set = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 15), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('lh-set').setUnits('rH%').setMaxAccess('readwrite') if mibBuilder.loadTexts: lh_set.setStatus('current') if mibBuilder.loadTexts: lh_set.setDescription('Low Relative Humidity Alarm Threshold') hset = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 16), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setUnits('rH%').setMaxAccess('readwrite') if mibBuilder.loadTexts: hset.setStatus('current') if mibBuilder.loadTexts: hset.setDescription('Dehumidification Set Point') hset_sm = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 17), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('hset-sm').setUnits('rH%').setMaxAccess('readwrite') if mibBuilder.loadTexts: hset_sm.setStatus('current') if mibBuilder.loadTexts: hset_sm.setDescription('Setback Mode: Dehumidification Set Point') hu_set = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 18), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('hu-set').setUnits('rH%').setMaxAccess('readwrite') if mibBuilder.loadTexts: hu_set.setStatus('current') if mibBuilder.loadTexts: hu_set.setDescription('Humidification Set Point') hu_set_sm = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 19), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('hu-set-sm').setUnits('rH%').setMaxAccess('readwrite') if mibBuilder.loadTexts: hu_set_sm.setStatus('current') if mibBuilder.loadTexts: hu_set_sm.setDescription('Setback Mode: Humidification Set Point') restart_delay = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 20), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('restart-delay').setUnits('sec').setMaxAccess('readwrite') if mibBuilder.loadTexts: restart_delay.setStatus('current') if mibBuilder.loadTexts: restart_delay.setDescription('Restart Delay') regul_delay = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 21), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('regul-delay').setUnits('sec').setMaxAccess('readwrite') if mibBuilder.loadTexts: regul_delay.setStatus('current') if mibBuilder.loadTexts: regul_delay.setDescription('Regulation Start Transitory ') time_lowp = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 22), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('time-lowp').setUnits('sec').setMaxAccess('readwrite') if mibBuilder.loadTexts: time_lowp.setStatus('current') if mibBuilder.loadTexts: time_lowp.setDescription('Low Pressure Delay') alarm_delay = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 23), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('alarm-delay').setUnits('m').setMaxAccess('readwrite') if mibBuilder.loadTexts: alarm_delay.setStatus('current') if mibBuilder.loadTexts: alarm_delay.setDescription('Room T+H Alarm Delay') exc_time = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 24), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('exc-time').setUnits('m').setMaxAccess('readwrite') if mibBuilder.loadTexts: exc_time.setStatus('current') if mibBuilder.loadTexts: exc_time.setDescription('Anti-Hunting Constant of Room Regulation ') t_std_by = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 25), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('t-std-by').setUnits('h').setMaxAccess('readwrite') if mibBuilder.loadTexts: t_std_by.setStatus('current') if mibBuilder.loadTexts: t_std_by.setDescription('Stand-by Cycle Base Time') lan_unit = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 27), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('lan-unit').setUnits('n').setMaxAccess('readwrite') if mibBuilder.loadTexts: lan_unit.setStatus('current') if mibBuilder.loadTexts: lan_unit.setDescription('Total of units connected in LAN') ciclo_sm = mib_scalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 28), integer32().subtype(subtypeSpec=value_range_constraint(-32767, 32767))).setLabel('ciclo-sm').setUnits('m').setMaxAccess('readwrite') if mibBuilder.loadTexts: ciclo_sm.setStatus('current') if mibBuilder.loadTexts: ciclo_sm.setDescription('Set Back Mode: Fan Cyclical Start Interval') mibBuilder.exportSymbols('UNCDZ-MIB', ore_compr3=ore_compr3, out_h3=out_h3, mal_smoke=mal_smoke, hset_sm=hset_sm, mal_lp1=mal_lp1, regul_delay=regul_delay, vent_on=vent_on, ore_umid=ore_umid, hset=hset, k_syson=k_syson, t_set_cw=t_set_cw, compressore1=compressore1, lh_set=lh_set, ore_filtro=ore_filtro, out_h2=out_h2, sleep_mode=sleep_mode, mal_sonda_tac=mal_sonda_tac, hu_set=hu_set, umid_al=umid_al, pCOStatusgroup=pCOStatusgroup, mal_wht=mal_wht, ore_compr4=ore_compr4, emerg=emerg, steam_production=steam_production, temp_ac=temp_ac, mal_ore_umid=mal_ore_umid, temp_mand=temp_mand, mal_hp2=mal_hp2, mal_ore_compr3=mal_ore_compr3, pCOId1_ErrorsNumber=pCOId1_ErrorsNumber, temp_circ=temp_circ, mal_aua=mal_aua, mal_cw_dh=mal_cw_dh, mal_ore_unit=mal_ore_unit, t_std_by=t_std_by, mal_ore_compr1=mal_ore_compr1, compressore3=compressore3, range_t_ac=range_t_ac, mal_flux=mal_flux, compressore2=compressore2, mal_sonda_ua=mal_sonda_ua, temp_amb=temp_amb, htset_cw=htset_cw, mal_ore_compr4=mal_ore_compr4, ciclo_sm=ciclo_sm, hh_set=hh_set, out_h1=out_h1, pCOId1_Status=pCOId1_Status, mal_eap=mal_eap, time_lowp=time_lowp, mal_phase=mal_phase, pCOWebInfo=pCOWebInfo, t_diff_c=t_diff_c, power=power, ustdby1_2=ustdby1_2, t_diff=t_diff, mal_flood=mal_flood, mal_sonda_tc=mal_sonda_tc, uncdz_MIB=uncdz_MIB, mal_nopower=mal_nopower, ore_heat2=ore_heat2, mal_tc_cw=mal_tc_cw, t_set_c=t_set_c, integerObjects=integerObjects, ore_compr1=ore_compr1, t_set=t_set, t_rc_est=t_rc_est, compressore4=compressore4, carel=carel, t_set_c_sm=t_set_c_sm, ht_set=ht_set, mal_ore_risc2=mal_ore_risc2, hu_diff=hu_diff, mal_access=mal_access, mal_ore_compr2=mal_ore_compr2, digitalObjects=digitalObjects, pCOErrorsNumbergroup=pCOErrorsNumbergroup, alarm_delay=alarm_delay, mal_heater=mal_heater, on_deum=on_deum, mal_lp2=mal_lp2, rampa_valv=rampa_valv, agentCode=agentCode, t_set_lm=t_set_lm, ore_compr2=ore_compr2, mal_hp1=mal_hp1, mal_ata=mal_ata, ab_mediath=ab_mediath, analogObjects=analogObjects, delta_lm=delta_lm, anaout2=anaout2, mal_lan=mal_lan, gas_caldo_on=gas_caldo_on, exc_time=exc_time, mal_ore_filtro=mal_ore_filtro, test_sm=test_sm, systm=systm, umid_amb=umid_amb, PYSNMP_MODULE_ID=uncdz_MIB, mal_bua=mal_bua, hu_set_sm=hu_set_sm, mal_ore_risc1=mal_ore_risc1, ore_unit=ore_unit, lt_set=lt_set, agentRelease=agentRelease, mal_sonda_ta=mal_sonda_ta, ore_heat1=ore_heat1, range_u_amb=range_u_amb, xs_res_al=xs_res_al, glb_al=glb_al, or_al_2lev=or_al_2lev, mal_bta=mal_bta, t_set_sm=t_set_sm, range_t_man=range_t_man, temp_ext=temp_ext, mal_hcurr=mal_hcurr, mal_wflow=mal_wflow, hdiff=hdiff, lan_unit=lan_unit, restart_delay=restart_delay, mal_nowater=mal_nowater, t_cw_dh=t_cw_dh, mal_filter=mal_filter, range_t_circ=range_t_circ, range_t_ext=range_t_ext, mal_sonda_te=mal_sonda_te, mal_sonda_tm=mal_sonda_tm, instruments=instruments, t_rc_es=t_rc_es)
class Settings: def __init__( self, workdir: str, outdir: str, threads: int, debug: bool): self.workdir = workdir self.outdir = outdir self.threads = threads self.debug = debug class Logger: def __init__(self, name: str): self.name = name def info(self, msg: str): print(msg, flush=True) class Processor: settings: Settings workdir: str outdir: str threads: int debug: bool logger: Logger def __init__(self, settings: Settings): self.settings = settings self.workdir = settings.workdir self.outdir = settings.outdir self.threads = settings.threads self.debug = settings.debug self.logger = Logger(name=self.__class__.__name__)
class Settings: def __init__(self, workdir: str, outdir: str, threads: int, debug: bool): self.workdir = workdir self.outdir = outdir self.threads = threads self.debug = debug class Logger: def __init__(self, name: str): self.name = name def info(self, msg: str): print(msg, flush=True) class Processor: settings: Settings workdir: str outdir: str threads: int debug: bool logger: Logger def __init__(self, settings: Settings): self.settings = settings self.workdir = settings.workdir self.outdir = settings.outdir self.threads = settings.threads self.debug = settings.debug self.logger = logger(name=self.__class__.__name__)
#import base64 # #data = "abc123!?$*&()'-=@~" # ## Standard Base64 Encoding #encodedBytes = base64.b64encode(data.encode("utf-8")) #encodedStr = str(encodedBytes, "utf-8") # #print(encodedStr) # l = [x for x in range(10)] for x in range(10): l.pop(0) print(l)
l = [x for x in range(10)] for x in range(10): l.pop(0) print(l)
f = open('input.txt') adapters = [] for line in f: adapters.append(int(line[:-1])) adapters.sort() adapters.append(adapters[-1] + 3) differences = {} previous = 0 for adapter in adapters: current_difference = adapter - previous if not current_difference in differences: differences[current_difference] = 0 differences[current_difference] += 1 previous = adapter print(differences[1] * differences[3])
f = open('input.txt') adapters = [] for line in f: adapters.append(int(line[:-1])) adapters.sort() adapters.append(adapters[-1] + 3) differences = {} previous = 0 for adapter in adapters: current_difference = adapter - previous if not current_difference in differences: differences[current_difference] = 0 differences[current_difference] += 1 previous = adapter print(differences[1] * differences[3])
# LinkNode/Marker ID Table # -1: Unassigned (Temporary) # 0 ~ 50: Reserved for Joint ID # FRAME_ID = 'viz_frame'
frame_id = 'viz_frame'
''' Statement Given a list of numbers, find and print the elements that appear in it only once. Such elements should be printed in the order in which they occur in the original list. Example input 4 3 5 2 5 1 3 5 Example output 4 2 1 ''' arr = input().split() for i in arr: if arr.count(i) == 1: print(i, end=" ")
""" Statement Given a list of numbers, find and print the elements that appear in it only once. Such elements should be printed in the order in which they occur in the original list. Example input 4 3 5 2 5 1 3 5 Example output 4 2 1 """ arr = input().split() for i in arr: if arr.count(i) == 1: print(i, end=' ')
class Source: pass class URL(Source): def __init__(self, url, method="GET", data=None): self.url = url self.method = method self.data = data def get_data(self, scraper): return scraper.request(method=self.method, url=self.url, data=self.data).content def __str__(self): return self.url class NullSource(Source): def get_data(self, scraper): return None def __str__(self): return self.__class__.__name__
class Source: pass class Url(Source): def __init__(self, url, method='GET', data=None): self.url = url self.method = method self.data = data def get_data(self, scraper): return scraper.request(method=self.method, url=self.url, data=self.data).content def __str__(self): return self.url class Nullsource(Source): def get_data(self, scraper): return None def __str__(self): return self.__class__.__name__
fs = 44100. dt = 1. / fs def rawsco_to_ndf(rawsco): clock, rate, nsamps, score = rawsco if rate == 44100: ar = True else: ar = False max_i = score.shape[0] samp = 0 t = 0. # ('apu', ch, func, func_val, natoms, offset) ndf = [ ('clock', int(clock)), ('apu', 'ch', 'p1', 0, 0, 0), ('apu', 'ch', 'p2', 0, 0, 0), ('apu', 'ch', 'tr', 0, 0, 0), ('apu', 'ch', 'no', 0, 0, 0), ('apu', 'p1', 'du', 0, 1, 0), ('apu', 'p1', 'lh', 1, 1, 0), ('apu', 'p1', 'cv', 1, 1, 0), ('apu', 'p1', 'vo', 0, 1, 0), ('apu', 'p1', 'ss', 7, 2, 1), # This is necessary to prevent channel silence for low notes ('apu', 'p2', 'du', 0, 3, 0), ('apu', 'p2', 'lh', 1, 3, 0), ('apu', 'p2', 'cv', 1, 3, 0), ('apu', 'p2', 'vo', 0, 3, 0), ('apu', 'p2', 'ss', 7, 4, 1), # This is necessary to prevent channel silence for low notes ('apu', 'tr', 'lh', 1, 5, 0), ('apu', 'tr', 'lr', 127, 5, 0), ('apu', 'no', 'lh', 1, 6, 0), ('apu', 'no', 'cv', 1, 6, 0), ('apu', 'no', 'vo', 0, 6, 0), ] ch_to_last_tl = {ch:0 for ch in ['p1', 'p2']} ch_to_last_th = {ch:0 for ch in ['p1', 'p2']} ch_to_last_timer = {ch:0 for ch in ['p1', 'p2', 'tr']} ch_to_last_du = {ch:0 for ch in ['p1', 'p2']} ch_to_last_volume = {ch:0 for ch in ['p1', 'p2', 'no']} last_no_np = 0 last_no_nl = 0 for i in range(max_i): for j, ch in enumerate(['p1', 'p2']): th, tl, volume, du = score[i, j] timer = (th << 8) + tl last_timer = ch_to_last_timer[ch] # NOTE: This will never be perfect reconstruction because phase is not incremented when the channel is off retrigger = False if last_timer == 0 and timer != 0: ndf.append(('apu', 'ch', ch, 1, 0, 0)) retrigger = True elif last_timer != 0 and timer == 0: ndf.append(('apu', 'ch', ch, 0, 0, 0)) if du != ch_to_last_du[ch]: ndf.append(('apu', ch, 'du', du, 0, 0)) ch_to_last_du[ch] = du if volume > 0 and volume != ch_to_last_volume[ch]: ndf.append(('apu', ch, 'vo', volume, 0, 0)) ch_to_last_volume[ch] = volume if tl != ch_to_last_tl[ch]: ndf.append(('apu', ch, 'tl', tl, 0, 2)) ch_to_last_tl[ch] = tl if retrigger or th != ch_to_last_th[ch]: ndf.append(('apu', ch, 'th', th, 0, 3)) ch_to_last_th[ch] = th ch_to_last_timer[ch] = timer j = 2 ch = 'tr' th, tl, _, _ = score[i, j] timer = (th << 8) + tl last_timer = ch_to_last_timer[ch] if last_timer == 0 and timer != 0: ndf.append(('apu', 'ch', ch, 1, 0, 0)) elif last_timer != 0 and timer == 0: ndf.append(('apu', 'ch', ch, 0, 0, 0)) if timer != last_timer: ndf.append(('apu', ch, 'tl', tl, 0, 2)) ndf.append(('apu', ch, 'th', th, 0, 3)) ch_to_last_timer[ch] = timer j = 3 ch = 'no' _, np, volume, nl = score[i, j] if last_no_np == 0 and np != 0: ndf.append(('apu', 'ch', ch, 1, 0, 0)) elif last_no_np != 0 and np == 0: ndf.append(('apu', 'ch', ch, 0, 0, 0)) if volume > 0 and volume != ch_to_last_volume[ch]: ndf.append(('apu', ch, 'vo', volume, 0, 0)) ch_to_last_volume[ch] = volume if nl != last_no_nl: ndf.append(('apu', ch, 'nl', nl, 0, 2)) last_no_nl = nl if np > 0 and np != last_no_np: ndf.append(('apu', ch, 'np', 16 - np, 0, 2)) ndf.append(('apu', ch, 'll', 0, 0, 3)) last_no_np = np if ar: wait_amt = 1 else: t += 1. / rate wait_amt = min(int(fs * t) - samp, nsamps - samp) ndf.append(('wait', wait_amt)) samp += wait_amt remaining = nsamps - samp assert remaining >= 0 if remaining > 0: ndf.append(('wait', remaining)) return ndf
fs = 44100.0 dt = 1.0 / fs def rawsco_to_ndf(rawsco): (clock, rate, nsamps, score) = rawsco if rate == 44100: ar = True else: ar = False max_i = score.shape[0] samp = 0 t = 0.0 ndf = [('clock', int(clock)), ('apu', 'ch', 'p1', 0, 0, 0), ('apu', 'ch', 'p2', 0, 0, 0), ('apu', 'ch', 'tr', 0, 0, 0), ('apu', 'ch', 'no', 0, 0, 0), ('apu', 'p1', 'du', 0, 1, 0), ('apu', 'p1', 'lh', 1, 1, 0), ('apu', 'p1', 'cv', 1, 1, 0), ('apu', 'p1', 'vo', 0, 1, 0), ('apu', 'p1', 'ss', 7, 2, 1), ('apu', 'p2', 'du', 0, 3, 0), ('apu', 'p2', 'lh', 1, 3, 0), ('apu', 'p2', 'cv', 1, 3, 0), ('apu', 'p2', 'vo', 0, 3, 0), ('apu', 'p2', 'ss', 7, 4, 1), ('apu', 'tr', 'lh', 1, 5, 0), ('apu', 'tr', 'lr', 127, 5, 0), ('apu', 'no', 'lh', 1, 6, 0), ('apu', 'no', 'cv', 1, 6, 0), ('apu', 'no', 'vo', 0, 6, 0)] ch_to_last_tl = {ch: 0 for ch in ['p1', 'p2']} ch_to_last_th = {ch: 0 for ch in ['p1', 'p2']} ch_to_last_timer = {ch: 0 for ch in ['p1', 'p2', 'tr']} ch_to_last_du = {ch: 0 for ch in ['p1', 'p2']} ch_to_last_volume = {ch: 0 for ch in ['p1', 'p2', 'no']} last_no_np = 0 last_no_nl = 0 for i in range(max_i): for (j, ch) in enumerate(['p1', 'p2']): (th, tl, volume, du) = score[i, j] timer = (th << 8) + tl last_timer = ch_to_last_timer[ch] retrigger = False if last_timer == 0 and timer != 0: ndf.append(('apu', 'ch', ch, 1, 0, 0)) retrigger = True elif last_timer != 0 and timer == 0: ndf.append(('apu', 'ch', ch, 0, 0, 0)) if du != ch_to_last_du[ch]: ndf.append(('apu', ch, 'du', du, 0, 0)) ch_to_last_du[ch] = du if volume > 0 and volume != ch_to_last_volume[ch]: ndf.append(('apu', ch, 'vo', volume, 0, 0)) ch_to_last_volume[ch] = volume if tl != ch_to_last_tl[ch]: ndf.append(('apu', ch, 'tl', tl, 0, 2)) ch_to_last_tl[ch] = tl if retrigger or th != ch_to_last_th[ch]: ndf.append(('apu', ch, 'th', th, 0, 3)) ch_to_last_th[ch] = th ch_to_last_timer[ch] = timer j = 2 ch = 'tr' (th, tl, _, _) = score[i, j] timer = (th << 8) + tl last_timer = ch_to_last_timer[ch] if last_timer == 0 and timer != 0: ndf.append(('apu', 'ch', ch, 1, 0, 0)) elif last_timer != 0 and timer == 0: ndf.append(('apu', 'ch', ch, 0, 0, 0)) if timer != last_timer: ndf.append(('apu', ch, 'tl', tl, 0, 2)) ndf.append(('apu', ch, 'th', th, 0, 3)) ch_to_last_timer[ch] = timer j = 3 ch = 'no' (_, np, volume, nl) = score[i, j] if last_no_np == 0 and np != 0: ndf.append(('apu', 'ch', ch, 1, 0, 0)) elif last_no_np != 0 and np == 0: ndf.append(('apu', 'ch', ch, 0, 0, 0)) if volume > 0 and volume != ch_to_last_volume[ch]: ndf.append(('apu', ch, 'vo', volume, 0, 0)) ch_to_last_volume[ch] = volume if nl != last_no_nl: ndf.append(('apu', ch, 'nl', nl, 0, 2)) last_no_nl = nl if np > 0 and np != last_no_np: ndf.append(('apu', ch, 'np', 16 - np, 0, 2)) ndf.append(('apu', ch, 'll', 0, 0, 3)) last_no_np = np if ar: wait_amt = 1 else: t += 1.0 / rate wait_amt = min(int(fs * t) - samp, nsamps - samp) ndf.append(('wait', wait_amt)) samp += wait_amt remaining = nsamps - samp assert remaining >= 0 if remaining > 0: ndf.append(('wait', remaining)) return ndf
#Write a program to input a string and check if it is a palindrome or not. #This solution is in python programing language str = input("Enter the string: ") if str == str[::-1]: print("String is Palindrome") else: print("String is not Palindrome")
str = input('Enter the string: ') if str == str[::-1]: print('String is Palindrome') else: print('String is not Palindrome')
buddy= "extremely loyal and cute" print(len(buddy)) print(buddy[0]) print(buddy[0:10]) print(buddy[0:]) print(buddy[:15]) print(buddy[:]) # len gives you the length or number of characters of the string. # So (len(buddy)) when printed = 24 as even spaces are counted. # [] these brackets help to dissect the components of the string. # so (buddy[0]) = e # so (buddy[0:10]) = extremely # so (buddy[0:]) = extremely loyal and cute # so (buddy[:15]) = extremely loyal # so (buddy[:]) = extremely loyal and print(buddy[-1]) # so print(buddy[-1]) = e print(buddy[-2]) print(buddy[-5:2]) # so print(buddy[-2]) = t
buddy = 'extremely loyal and cute' print(len(buddy)) print(buddy[0]) print(buddy[0:10]) print(buddy[0:]) print(buddy[:15]) print(buddy[:]) print(buddy[-1]) print(buddy[-2]) print(buddy[-5:2])
class Secret: # Dajngo secret key SECRET_KEY = '' # Amazone S3 AWS_STORAGE_BUCKET_NAME = '' AWS_ACCESS_KEY_ID = '' AWS_SECRET_ACCESS_KEY = ''
class Secret: secret_key = '' aws_storage_bucket_name = '' aws_access_key_id = '' aws_secret_access_key = ''
class MessageHandler: def __init__(self, name: str): self.name = name self.broker = None def process_message(self, data: bytes): pass
class Messagehandler: def __init__(self, name: str): self.name = name self.broker = None def process_message(self, data: bytes): pass
self.description = "Sysupgrade with same version, different epochs" sp = pmpkg("dummy", "2:2.0-1") sp.files = ["bin/dummynew"] self.addpkg2db("sync", sp) lp = pmpkg("dummy", "1:2.0-1") lp.files = ["bin/dummyold"] self.addpkg2db("local", lp) self.args = "-Su" self.addrule("PACMAN_RETCODE=0") self.addrule("PKG_VERSION=dummy|2:2.0-1") self.addrule("FILE_EXIST=bin/dummynew") self.addrule("!FILE_EXIST=bin/dummyold")
self.description = 'Sysupgrade with same version, different epochs' sp = pmpkg('dummy', '2:2.0-1') sp.files = ['bin/dummynew'] self.addpkg2db('sync', sp) lp = pmpkg('dummy', '1:2.0-1') lp.files = ['bin/dummyold'] self.addpkg2db('local', lp) self.args = '-Su' self.addrule('PACMAN_RETCODE=0') self.addrule('PKG_VERSION=dummy|2:2.0-1') self.addrule('FILE_EXIST=bin/dummynew') self.addrule('!FILE_EXIST=bin/dummyold')
def commonCharacterCount(s1, s2): dic1 = {} dic2 = {} sums = 0 for letter in s1: dic1[letter] = dic1.get(letter,0) + 1 for letter in s2: dic2[letter] = dic2.get(letter,0) + 1 for letter in dic1: if letter in dic2: sums = sums + min(dic1[letter],dic2[letter]) return sums
def common_character_count(s1, s2): dic1 = {} dic2 = {} sums = 0 for letter in s1: dic1[letter] = dic1.get(letter, 0) + 1 for letter in s2: dic2[letter] = dic2.get(letter, 0) + 1 for letter in dic1: if letter in dic2: sums = sums + min(dic1[letter], dic2[letter]) return sums
class QuickReplyButton: def __init__(self, title: str, payload: str): if not isinstance(title, str): raise TypeError("QuickReplyButton.title must be an instance of str") if not isinstance(payload, str): raise TypeError("QuickReplyButton.payload must be an instance of str") self.title = title self.payload = payload def to_dict(self): return { "content_type": "text", "title": self.title, "payload": self.payload } class QuickReply: def __init__(self): self.buttons = [] def add(self, button: QuickReplyButton): if not isinstance(button, QuickReplyButton): raise TypeError("button must be an instance of QuickReplyButton") self.buttons.append(button) def to_dict(self): return [button.to_dict() for button in self.buttons] class Button: def __init__(self, type: str, title: str, **kwargs): if not isinstance(title, str): raise TypeError("Button.title must be an instance of str") if not isinstance(type, str): raise TypeError("Button.type must be an instance of str") self.title = title self.type = type for k in kwargs: setattr(self, k, kwargs[k]) def to_dict(self): return dict(vars(self)) class Template: def __init__(self, type: str, text: str, **kwargs): if not isinstance(type, str): raise TypeError("Template.type must be an instance of str") if not isinstance(text, str): raise TypeError("Template.text must be an instance of str") self.type = type self.text = text for k in kwargs: setattr(self, k, kwargs[k]) def to_dict(self): res = { "type": "template", "payload": { "template_type": self.type, "text": self.text } } if hasattr(self, 'buttons'): res['payload'].update({"buttons": [b.to_dict() for b in self.buttons]}) return res class Message: def __init__(self, text: str = None, quick_reply: QuickReply = None, attachment=None): if text and not isinstance(text, str): raise TypeError("Message.text must be an instance of str") if quick_reply and not isinstance(quick_reply, QuickReply): raise TypeError("Message.quick_reply must be an instance of QuickReply") self.text = text self.quick_reply = quick_reply self.attachment = attachment def set_quick_reply(self, quick_reply): if not isinstance(quick_reply, QuickReply): raise TypeError("Message.quick_reply must be an instance of QuickReply") self.quick_reply = quick_reply def to_dict(self): msg = {} if self.text: msg['text'] = self.text if self.quick_reply: msg['quick_replies'] = self.quick_reply.to_dict() if self.attachment: msg['attachment'] = self.attachment.to_dict() return msg
class Quickreplybutton: def __init__(self, title: str, payload: str): if not isinstance(title, str): raise type_error('QuickReplyButton.title must be an instance of str') if not isinstance(payload, str): raise type_error('QuickReplyButton.payload must be an instance of str') self.title = title self.payload = payload def to_dict(self): return {'content_type': 'text', 'title': self.title, 'payload': self.payload} class Quickreply: def __init__(self): self.buttons = [] def add(self, button: QuickReplyButton): if not isinstance(button, QuickReplyButton): raise type_error('button must be an instance of QuickReplyButton') self.buttons.append(button) def to_dict(self): return [button.to_dict() for button in self.buttons] class Button: def __init__(self, type: str, title: str, **kwargs): if not isinstance(title, str): raise type_error('Button.title must be an instance of str') if not isinstance(type, str): raise type_error('Button.type must be an instance of str') self.title = title self.type = type for k in kwargs: setattr(self, k, kwargs[k]) def to_dict(self): return dict(vars(self)) class Template: def __init__(self, type: str, text: str, **kwargs): if not isinstance(type, str): raise type_error('Template.type must be an instance of str') if not isinstance(text, str): raise type_error('Template.text must be an instance of str') self.type = type self.text = text for k in kwargs: setattr(self, k, kwargs[k]) def to_dict(self): res = {'type': 'template', 'payload': {'template_type': self.type, 'text': self.text}} if hasattr(self, 'buttons'): res['payload'].update({'buttons': [b.to_dict() for b in self.buttons]}) return res class Message: def __init__(self, text: str=None, quick_reply: QuickReply=None, attachment=None): if text and (not isinstance(text, str)): raise type_error('Message.text must be an instance of str') if quick_reply and (not isinstance(quick_reply, QuickReply)): raise type_error('Message.quick_reply must be an instance of QuickReply') self.text = text self.quick_reply = quick_reply self.attachment = attachment def set_quick_reply(self, quick_reply): if not isinstance(quick_reply, QuickReply): raise type_error('Message.quick_reply must be an instance of QuickReply') self.quick_reply = quick_reply def to_dict(self): msg = {} if self.text: msg['text'] = self.text if self.quick_reply: msg['quick_replies'] = self.quick_reply.to_dict() if self.attachment: msg['attachment'] = self.attachment.to_dict() return msg
class EnigmaException(Exception): pass class PlugboardException(EnigmaException): pass class ReflectorException(EnigmaException): pass class RotorException(EnigmaException): pass
class Enigmaexception(Exception): pass class Plugboardexception(EnigmaException): pass class Reflectorexception(EnigmaException): pass class Rotorexception(EnigmaException): pass
def checks_in_string(string, check_list): for check in check_list: if check in string: return True return False
def checks_in_string(string, check_list): for check in check_list: if check in string: return True return False
def find_strongest_eggs(*args): eggs = args[0] div = args[1] res = [] strongest = [] is_strong = True n = div for _ in range(n): res.append([]) for i in range(1): if div == 1: res.append(eggs) break else: for j in range(len(eggs)): if j % 2 == 0: res[0].append(eggs[j]) else: res[1].append(eggs[j]) if div == 1: middle = len(res[1]) // 2 mid = res[1][middle] left = list(res[1][:middle]) right = list(reversed(res[1][middle + 1:])) while left and right: is_strong = True l = left.pop() r = right.pop() if mid <= l or mid <= r or r <= l: is_strong = False break if is_strong: strongest.append(mid) else: for el in res: middle = len(el) // 2 mid = el[middle] left = list(el[:middle]) right = list(reversed(el[middle+1:])) while left and right: is_strong = True l = left.pop() r = right.pop() if mid <= l or mid <= r or r <= l: is_strong = False break if is_strong: strongest.append(mid) return strongest test = ([-1, 7, 3, 15, 2, 12], 2) print(find_strongest_eggs(*test))
def find_strongest_eggs(*args): eggs = args[0] div = args[1] res = [] strongest = [] is_strong = True n = div for _ in range(n): res.append([]) for i in range(1): if div == 1: res.append(eggs) break else: for j in range(len(eggs)): if j % 2 == 0: res[0].append(eggs[j]) else: res[1].append(eggs[j]) if div == 1: middle = len(res[1]) // 2 mid = res[1][middle] left = list(res[1][:middle]) right = list(reversed(res[1][middle + 1:])) while left and right: is_strong = True l = left.pop() r = right.pop() if mid <= l or mid <= r or r <= l: is_strong = False break if is_strong: strongest.append(mid) else: for el in res: middle = len(el) // 2 mid = el[middle] left = list(el[:middle]) right = list(reversed(el[middle + 1:])) while left and right: is_strong = True l = left.pop() r = right.pop() if mid <= l or mid <= r or r <= l: is_strong = False break if is_strong: strongest.append(mid) return strongest test = ([-1, 7, 3, 15, 2, 12], 2) print(find_strongest_eggs(*test))
##PUT ALL INFO BETWEEN QUOTES BELOW AND RENAME THIS FILE TO 'creds.py' #Twilio API Account info ACCOUNT_SID = "" AUTH_TOKEN = "" # your cell phone number below (must begin with '+', example: "+15555555555") TO_PHONE = "" # your Twilio phone number below (must begin with '+', example: "+15555555555") FROM_PHONE = "" # Imgur ID CLIENT_ID = ""
account_sid = '' auth_token = '' to_phone = '' from_phone = '' client_id = ''
class ModeException(Exception): def __init__(self, message: str): super().__init__(message) class SizeException(Exception): def __init__(self, message: str): super().__init__(message) class PaddingException(Exception): def __init__(self, message: str): super().__init__(message) class ReshapingException(Exception): def __init__(self, message: str): super().__init__(message) class ShapeMismatch(Exception): def __init__(self, message: str): super().__init__(message)
class Modeexception(Exception): def __init__(self, message: str): super().__init__(message) class Sizeexception(Exception): def __init__(self, message: str): super().__init__(message) class Paddingexception(Exception): def __init__(self, message: str): super().__init__(message) class Reshapingexception(Exception): def __init__(self, message: str): super().__init__(message) class Shapemismatch(Exception): def __init__(self, message: str): super().__init__(message)
def function(a): pass function(10)
def function(a): pass function(10)
class Base1: def __init__(self, *args): print("Base1.__init__",args) class Clist1(Base1, list): pass class Ctuple1(Base1, tuple): pass a = Clist1() print(len(a)) a = Clist1([1, 2, 3]) print(len(a)) a = Ctuple1() print(len(a)) a = Ctuple1([1, 2, 3]) # TODO: Faults #print(len(a)) print("---") class Clist2(list, Base1): pass class Ctuple2(tuple, Base1): pass a = Clist2() print(len(a)) a = Clist2([1, 2, 3]) print(len(a)) #a = Ctuple2() #print(len(a)) #a = Ctuple2([1, 2, 3]) #print(len(a))
class Base1: def __init__(self, *args): print('Base1.__init__', args) class Clist1(Base1, list): pass class Ctuple1(Base1, tuple): pass a = clist1() print(len(a)) a = clist1([1, 2, 3]) print(len(a)) a = ctuple1() print(len(a)) a = ctuple1([1, 2, 3]) print('---') class Clist2(list, Base1): pass class Ctuple2(tuple, Base1): pass a = clist2() print(len(a)) a = clist2([1, 2, 3]) print(len(a))
# 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. _credential_properties = { 'blob': { 'type': 'string' }, 'project_id': { 'type': 'string' }, 'type': { 'type': 'string' }, 'user_id': { 'type': 'string' } } credential_create = { 'type': 'object', 'properties': _credential_properties, 'additionalProperties': True, 'oneOf': [ { 'title': 'ec2 credential requires project_id', 'required': ['blob', 'type', 'user_id', 'project_id'], 'properties': { 'type': { 'enum': ['ec2'] } } }, { 'title': 'non-ec2 credential does not require project_id', 'required': ['blob', 'type', 'user_id'], 'properties': { 'type': { 'not': { 'enum': ['ec2'] } } } } ] } credential_update = { 'type': 'object', 'properties': _credential_properties, 'minProperties': 1, 'additionalProperties': True }
_credential_properties = {'blob': {'type': 'string'}, 'project_id': {'type': 'string'}, 'type': {'type': 'string'}, 'user_id': {'type': 'string'}} credential_create = {'type': 'object', 'properties': _credential_properties, 'additionalProperties': True, 'oneOf': [{'title': 'ec2 credential requires project_id', 'required': ['blob', 'type', 'user_id', 'project_id'], 'properties': {'type': {'enum': ['ec2']}}}, {'title': 'non-ec2 credential does not require project_id', 'required': ['blob', 'type', 'user_id'], 'properties': {'type': {'not': {'enum': ['ec2']}}}}]} credential_update = {'type': 'object', 'properties': _credential_properties, 'minProperties': 1, 'additionalProperties': True}
def hash_function(s=b''): a, b, c, d = 0xa0, 0xb1, 0x11, 0x4d for byte in bytearray(s): a ^= byte b = b ^ a ^ 0x55 c = b ^ 0x94 d = c ^ byte ^ 0x74 return format(d << 24 | c << 16 | a << 8 | b, '08x')
def hash_function(s=b''): (a, b, c, d) = (160, 177, 17, 77) for byte in bytearray(s): a ^= byte b = b ^ a ^ 85 c = b ^ 148 d = c ^ byte ^ 116 return format(d << 24 | c << 16 | a << 8 | b, '08x')
def buy_card(n: int, p: list): d = [0]*(n+1) for i in range(1, n+1): for j in range(1, i+1): d[i] = max(d[i], d[i-j] + p[j-1]) return d[n] def test_buy_card(): assert buy_card(4, [1, 5, 6, 7]) == 10 assert buy_card(5, [10, 9, 8, 7, 6]) == 50 assert buy_card(10, [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]) == 55 assert buy_card(10, [5, 10, 11, 12, 13, 30, 35, 40, 45, 47]) == 50 assert buy_card(4, [5, 2, 8, 10]) == 20 assert buy_card(4, [3, 5, 15, 16]) == 18 if __name__ == "__main__": n = int(input()) p = list(map(int, input().split(' '))) print(buy_card(n, p))
def buy_card(n: int, p: list): d = [0] * (n + 1) for i in range(1, n + 1): for j in range(1, i + 1): d[i] = max(d[i], d[i - j] + p[j - 1]) return d[n] def test_buy_card(): assert buy_card(4, [1, 5, 6, 7]) == 10 assert buy_card(5, [10, 9, 8, 7, 6]) == 50 assert buy_card(10, [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]) == 55 assert buy_card(10, [5, 10, 11, 12, 13, 30, 35, 40, 45, 47]) == 50 assert buy_card(4, [5, 2, 8, 10]) == 20 assert buy_card(4, [3, 5, 15, 16]) == 18 if __name__ == '__main__': n = int(input()) p = list(map(int, input().split(' '))) print(buy_card(n, p))
class Item: item_id = 1 def __init__(self, name): self.name = name self.item_id = Item.item_id Item.item_id += 1 tv = Item('LG 42') computer = Item('Dell XPS') print(tv.item_id) print(computer.item_id) # prints: # 1 # 2
class Item: item_id = 1 def __init__(self, name): self.name = name self.item_id = Item.item_id Item.item_id += 1 tv = item('LG 42') computer = item('Dell XPS') print(tv.item_id) print(computer.item_id)
# Dit is weer een encoder, dus gebruik instellinen die daarbij horen. real_encoder = tf.keras.models.Sequential([ tf.keras.layers.Dense(784, activation=tf.nn.relu), tf.keras.layers.Dense(128, activation=tf.nn.relu), tf.keras.layers.Dense(2, activation=tf.nn.relu), tf.keras.layers.Dense(128, activation=tf.nn.relu), tf.keras.layers.Dense(784, activation=tf.nn.relu) ]) real_encoder.compile(loss=tf.keras.losses.mean_squared_error, optimizer=tf.keras.optimizers.RMSprop(lr=0.0001, rho=0.9, epsilon=None, decay=0.0), metrics = ['accuracy']) # Dus ook: trainen op de input. real_encoder.fit(xtr, xtr, epochs=10, batch_size=256) print("Training performance:", real_encoder.evaluate(xtr, xtr)) # Zoals wellicht verwacht wanneer er niet wordt getraind op de labels, # is het veel moeilijker de verschillend gelabelde plaatjes te onderscheiden # in de bottleneck-laag. De performance van het model lijkt ook heel laag. # Dit is echter niet zo'n betekenisvol getal: het is een maat voor hoe goed # afzonderlijke pixels worden gereconstrueerd, en voor het eventueel kunnen # herkennen van een plaatje kunnen die nog behoorlijk anders zijn, zoals we # hieronder zullen zien. # Predict de output, gegeven de input en laat ze beiden naast elkaar zien. real_constructed = real_encoder.predict(xtr) imsize = 28 aantal_im = len(xtr) deze = np.random.randint(0, aantal_im) plt.figure(figsize=(12, 24)) pp = plt.subplot(121) number = np.reshape(real_constructed[deze], [imsize, imsize]) pp.imshow(number, cmap='Greys') pp.set_xticklabels([]) pp.set_yticklabels([]) pp.set_title("Gereconstrueerd") pp = plt.subplot(122) number = np.reshape(xtr[deze], [imsize, imsize]) pp.imshow(number, cmap='Greys') pp.set_xticklabels([]) pp.set_yticklabels([]) pp.set_title("Oorspronkelijke digit"); print("Nog lang zo slecht niet!")
real_encoder = tf.keras.models.Sequential([tf.keras.layers.Dense(784, activation=tf.nn.relu), tf.keras.layers.Dense(128, activation=tf.nn.relu), tf.keras.layers.Dense(2, activation=tf.nn.relu), tf.keras.layers.Dense(128, activation=tf.nn.relu), tf.keras.layers.Dense(784, activation=tf.nn.relu)]) real_encoder.compile(loss=tf.keras.losses.mean_squared_error, optimizer=tf.keras.optimizers.RMSprop(lr=0.0001, rho=0.9, epsilon=None, decay=0.0), metrics=['accuracy']) real_encoder.fit(xtr, xtr, epochs=10, batch_size=256) print('Training performance:', real_encoder.evaluate(xtr, xtr)) real_constructed = real_encoder.predict(xtr) imsize = 28 aantal_im = len(xtr) deze = np.random.randint(0, aantal_im) plt.figure(figsize=(12, 24)) pp = plt.subplot(121) number = np.reshape(real_constructed[deze], [imsize, imsize]) pp.imshow(number, cmap='Greys') pp.set_xticklabels([]) pp.set_yticklabels([]) pp.set_title('Gereconstrueerd') pp = plt.subplot(122) number = np.reshape(xtr[deze], [imsize, imsize]) pp.imshow(number, cmap='Greys') pp.set_xticklabels([]) pp.set_yticklabels([]) pp.set_title('Oorspronkelijke digit') print('Nog lang zo slecht niet!')
SLOTS = [ [ 0, 5460, ["172.17.0.2", 7000, "cf0da23bbea0ac65fd93d272358b59cd7ce3af25"], ["172.17.0.2", 7003, "ab35b1210fcae1010a463c65e1616b51d3d7a00b"], ], [ 9995, 9995, ["172.17.0.2", 7000, "cf0da23bbea0ac65fd93d272358b59cd7ce3af25"], ["172.17.0.2", 7003, "ab35b1210fcae1010a463c65e1616b51d3d7a00b"], ], [ 12182, 12182, ["172.17.0.2", 7000, "cf0da23bbea0ac65fd93d272358b59cd7ce3af25"], ["172.17.0.2", 7003, "ab35b1210fcae1010a463c65e1616b51d3d7a00b"], ], [ 5461, 9994, ["172.17.0.2", 7001, "d0299b606a9f2634ddbfc321e4164c1fc1601dc4"], ["172.17.0.2", 7004, "8e691f344dbf1b398792a7bca48ec7f012a2cc35"], ], [ 9996, 10922, ["172.17.0.2", 7001, "d0299b606a9f2634ddbfc321e4164c1fc1601dc4"], ["172.17.0.2", 7004, "8e691f344dbf1b398792a7bca48ec7f012a2cc35"], ], [10923, 12181, ["172.17.0.2", 7002, "c80666a77621a0061a3af77a1fda46c94c2abcb9"]], [12183, 16383, ["172.17.0.2", 7002, "c80666a77621a0061a3af77a1fda46c94c2abcb9"]], ] INFO = { "cluster_state": "ok", "cluster_current_epoch": "1", "cluster_slots_assigned": "16384", "cluster_slots_ok": "16384", "cluster_slots_pfail": "0", "cluster_slots_fail": "0", "cluster_known_nodes": "6", "cluster_size": "3", "cluster_current_epoch": "1", "cluster_my_epoch": "1", }
slots = [[0, 5460, ['172.17.0.2', 7000, 'cf0da23bbea0ac65fd93d272358b59cd7ce3af25'], ['172.17.0.2', 7003, 'ab35b1210fcae1010a463c65e1616b51d3d7a00b']], [9995, 9995, ['172.17.0.2', 7000, 'cf0da23bbea0ac65fd93d272358b59cd7ce3af25'], ['172.17.0.2', 7003, 'ab35b1210fcae1010a463c65e1616b51d3d7a00b']], [12182, 12182, ['172.17.0.2', 7000, 'cf0da23bbea0ac65fd93d272358b59cd7ce3af25'], ['172.17.0.2', 7003, 'ab35b1210fcae1010a463c65e1616b51d3d7a00b']], [5461, 9994, ['172.17.0.2', 7001, 'd0299b606a9f2634ddbfc321e4164c1fc1601dc4'], ['172.17.0.2', 7004, '8e691f344dbf1b398792a7bca48ec7f012a2cc35']], [9996, 10922, ['172.17.0.2', 7001, 'd0299b606a9f2634ddbfc321e4164c1fc1601dc4'], ['172.17.0.2', 7004, '8e691f344dbf1b398792a7bca48ec7f012a2cc35']], [10923, 12181, ['172.17.0.2', 7002, 'c80666a77621a0061a3af77a1fda46c94c2abcb9']], [12183, 16383, ['172.17.0.2', 7002, 'c80666a77621a0061a3af77a1fda46c94c2abcb9']]] info = {'cluster_state': 'ok', 'cluster_current_epoch': '1', 'cluster_slots_assigned': '16384', 'cluster_slots_ok': '16384', 'cluster_slots_pfail': '0', 'cluster_slots_fail': '0', 'cluster_known_nodes': '6', 'cluster_size': '3', 'cluster_current_epoch': '1', 'cluster_my_epoch': '1'}
def emulate_catchup(replica, ppSeqNo=100): if replica.isMaster: replica.caught_up_till_3pc((replica.viewNo, ppSeqNo)) else: replica.catchup_clear_for_backup() def emulate_select_primaries(replica): replica.primaryName = 'SomeAnotherNode' replica._setup_for_non_master_after_view_change(replica.viewNo)
def emulate_catchup(replica, ppSeqNo=100): if replica.isMaster: replica.caught_up_till_3pc((replica.viewNo, ppSeqNo)) else: replica.catchup_clear_for_backup() def emulate_select_primaries(replica): replica.primaryName = 'SomeAnotherNode' replica._setup_for_non_master_after_view_change(replica.viewNo)
# this is the module which i will be #calling and using again and again def kolar(): print("I am a new module which will work i am call") # this file save with same python path with new file name
def kolar(): print('I am a new module which will work i am call')
f = open('Log-A.strace') lines = f.readlines() term = ' read(' term2 = 'pipe' term3 = 'tty' def extract_name(line, start_delimiter, end_delimiter): name_start = line.find(start_delimiter) name_end = line.find(end_delimiter, name_start + 1) name = line[name_start + 1 : name_end] return name names = [] counts = [] for line in lines: if 'read(' in line and 'pipe' not in line and 'tty' not in line: name = extract_name(line, '<', '>') if name not in names: names.append(name) counts.append(1) else: idx = names.index(name) counts[idx] += 1 for i in range(len(names)): name = names[i] count = counts[i] #print(name, count) print(name + '\t' + str(count)) # example output # ('/lib/x86_64-linux-gnu/libc-2.23.so', 4) # ('/etc/nsswitch.conf', 4) # ('/lib/x86_64-linux-gnu/libnss_compat-2.23.so', 2) # ('/lib/x86_64-linux-gnu/libnsl-2.23.so', 2) # ('/lib/x86_64-linux-gnu/libnss_nis-2.23.so', 2) # ('/lib/x86_64-linux-gnu/libnss_files-2.23.so', 2) # ('/lib/x86_64-linux-gnu/libselinux.so.1', 1) # ('/lib/x86_64-linux-gnu/libpcre.so.3.13.2', 1) # ('/lib/x86_64-linux-gnu/libdl-2.23.so', 1) # ('/lib/x86_64-linux-gnu/libpthread-2.23.so', 1) # ('/proc/filesystems', 2) # ('/etc/locale.alias', 2) # ('/proc/sys/kernel/ngroups_max', 2)
f = open('Log-A.strace') lines = f.readlines() term = ' read(' term2 = 'pipe' term3 = 'tty' def extract_name(line, start_delimiter, end_delimiter): name_start = line.find(start_delimiter) name_end = line.find(end_delimiter, name_start + 1) name = line[name_start + 1:name_end] return name names = [] counts = [] for line in lines: if 'read(' in line and 'pipe' not in line and ('tty' not in line): name = extract_name(line, '<', '>') if name not in names: names.append(name) counts.append(1) else: idx = names.index(name) counts[idx] += 1 for i in range(len(names)): name = names[i] count = counts[i] print(name + '\t' + str(count))
TEMPLATE_SOURCE_TYPE = "TemplateSourceType" # stairlight.yaml STAIRLIGHT_CONFIG_FILE_PREFIX = "stairlight" STAIRLIGHT_CONFIG_INCLUDE_SECTION = "Include" STAIRLIGHT_CONFIG_EXCLUDE_SECTION = "Exclude" STAIRLIGHT_CONFIG_SETTING_SECTION = "Settings" DEFAULT_TABLE_PREFIX = "DefaultTablePrefix" FILE_SYSTEM_PATH = "FileSystemPath" REGEX = "Regex" # mapping.yaml MAPPING_CONFIG_FILE_PREFIX = "mapping" MAPPING_CONFIG_GLOBAL_SECTION = "Global" MAPPING_CONFIG_MAPPING_SECTION = "Mapping" MAPPING_CONFIG_METADATA_SECTION = "Metadata" FILE_SUFFIX = "FileSuffix" LABELS = "Labels" MAPPING_PREFIX = "MappingPrefix" PARAMETERS = "Parameters" TABLE_NAME = "TableName" TABLES = "Tables" # GCS BUCKET_NAME = "BucketName" PROJECT_ID = "ProjectId" URI = "Uri" # Redash DATABASE_URL_ENVIRONMENT_VARIABLE = "DatabaseUrlEnvironmentVariable" DATA_SOURCE_NAME = "DataSourceName" QUERY_IDS = "QueryIds" QUERY_ID = "QueryId"
template_source_type = 'TemplateSourceType' stairlight_config_file_prefix = 'stairlight' stairlight_config_include_section = 'Include' stairlight_config_exclude_section = 'Exclude' stairlight_config_setting_section = 'Settings' default_table_prefix = 'DefaultTablePrefix' file_system_path = 'FileSystemPath' regex = 'Regex' mapping_config_file_prefix = 'mapping' mapping_config_global_section = 'Global' mapping_config_mapping_section = 'Mapping' mapping_config_metadata_section = 'Metadata' file_suffix = 'FileSuffix' labels = 'Labels' mapping_prefix = 'MappingPrefix' parameters = 'Parameters' table_name = 'TableName' tables = 'Tables' bucket_name = 'BucketName' project_id = 'ProjectId' uri = 'Uri' database_url_environment_variable = 'DatabaseUrlEnvironmentVariable' data_source_name = 'DataSourceName' query_ids = 'QueryIds' query_id = 'QueryId'
# # @lc app=leetcode id=696 lang=python3 # # [696] Count Binary Substrings # # https://leetcode.com/problems/count-binary-substrings/description/ # # algorithms # Easy (61.31%) # Total Accepted: 81.6K # Total Submissions: 132.8K # Testcase Example: '"00110011"' # # Give a binary string s, return the number of non-empty substrings that have # the same number of 0's and 1's, and all the 0's and all the 1's in these # substrings are grouped consecutively. # # Substrings that occur multiple times are counted the number of times they # occur. # # # Example 1: # # # Input: s = "00110011" # Output: 6 # Explanation: There are 6 substrings that have equal number of consecutive 1's # and 0's: "0011", "01", "1100", "10", "0011", and "01". # Notice that some of these substrings repeat and are counted the number of # times they occur. # Also, "00110011" is not a valid substring because all the 0's (and 1's) are # not grouped together. # # # Example 2: # # # Input: s = "10101" # Output: 4 # Explanation: There are 4 substrings: "10", "01", "10", "01" that have equal # number of consecutive 1's and 0's. # # # # Constraints: # # # 1 <= s.length <= 10^5 # s[i] is either '0' or '1'. # # # class Solution: def countBinarySubstrings(self, s: str) -> int: temp = [] current_length = 1 for i in range(1, len(s)): if s[i] != s[i - 1]: temp.append(current_length) current_length = 1 else: current_length += 1 temp.append(current_length) total = 0 for i in range(1, len(temp)): total += min(temp[i], temp[i - 1]) return total if __name__ == '__main__': print(Solution().countBinarySubstrings('10101'))
class Solution: def count_binary_substrings(self, s: str) -> int: temp = [] current_length = 1 for i in range(1, len(s)): if s[i] != s[i - 1]: temp.append(current_length) current_length = 1 else: current_length += 1 temp.append(current_length) total = 0 for i in range(1, len(temp)): total += min(temp[i], temp[i - 1]) return total if __name__ == '__main__': print(solution().countBinarySubstrings('10101'))
def reverse(s): target = list(s) for i in range(int(len(s) / 2)): swap = target[i] target[i] = target[len(s) - i - 1] target[len(s) - i - 1] = swap return ''.join(target) if __name__ == '__main__': s = 'abcdef' print(reverse(s)) print(s[::-1])
def reverse(s): target = list(s) for i in range(int(len(s) / 2)): swap = target[i] target[i] = target[len(s) - i - 1] target[len(s) - i - 1] = swap return ''.join(target) if __name__ == '__main__': s = 'abcdef' print(reverse(s)) print(s[::-1])
### Build String ### class Solution1: def backspaceCompare(self, S: str, T: str) -> bool: def check(S): S_new = [] for w in S: if w != "#": S_new.append(w) elif len(S_new): S_new.pop() return S_new return check(S) == check(T) ### Two Pointer ###
class Solution1: def backspace_compare(self, S: str, T: str) -> bool: def check(S): s_new = [] for w in S: if w != '#': S_new.append(w) elif len(S_new): S_new.pop() return S_new return check(S) == check(T)
class DiGraph: def __init__(self): self.nodes = dict() self.edges = [] def copy(self): H_ = __class__() H_.add_edges_from(self.edges) return H_ def __eq__(self, other): return len(set(self.edges) ^ set(other.edges)) == 0 def __str__(self): return str(self.edges) __repr__ = __str__ def maximal_non_branching_paths(self): # return list of paths (made up of graph nodes) paths = [] visited_edges = set() for node in self.nodes: if not self.is_1_in_1_out(node): if self.out_degree(node) > 0: out_edges = self.nodes[node]['out_edges'] for edge in out_edges: visited_edges.add(edge) to_node = edge.node_b non_branching_path = [edge] while self.is_1_in_1_out(to_node): out_edge = self.nodes[to_node]['out_edges'][0] non_branching_path.append(out_edge) visited_edges.add(out_edge) to_node = out_edge.node_b paths.append(non_branching_path) # everything left must be in a cycle cycle_edges = set( filter( lambda edge: edge not in visited_edges, self.edges)) while len(cycle_edges) > 0: edge = cycle_edges.pop() non_branching_path = [edge] start_node = edge.node_a to_node = edge.node_b while to_node != start_node: out_edge = self.nodes[to_node]['out_edges'][0] non_branching_path.append(out_edge) cycle_edges.remove(out_edge) visited_edges.add(out_edge) to_node = out_edge.node_b paths.append(non_branching_path) return paths def neighbor_graphs(self, sub_graph, super_graph, k): # generator for the k-plus neighbors if k >= 0: yield sub_graph for neighbor in sub_graph.plus_neighbors(super_graph): yield from neighbor.neighbor_graphs(neighbor, super_graph, k - 1) def adjacent_graphs(self, sub_graph, super_graph, k): if k >= 0: yield sub_graph for neighbor in sub_graph.plus_neighbors(super_graph): yield from neighbor.adjacent_graphs(neighbor, super_graph, k - 1) for neighbor in sub_graph.minus_neighbors(): yield from neighbor.adjacent_graphs(neighbor, super_graph, k - 1) def plus_neighbor_edges(self, super_graph): # TODO this is ugly, make neater paths = list() # first generate paths for edge in self.edges: from_, to = edge.node_a, edge.node_b from_super_edges = super_graph.nodes[to]['out_edges'] to_super_edges = super_graph.nodes[from_]['in_edges'] def not_in_H(edge): return edge not in self.edges from_super_edges = filter(not_in_H, from_super_edges) to_super_edges = filter(not_in_H, to_super_edges) paths.extend(from_super_edges) paths.extend(to_super_edges) from_super_edges = super_graph.nodes[from_]['out_edges'] to_super_edges = super_graph.nodes[to]['in_edges'] def not_in_H(edge): return edge not in self.edges from_super_edges = filter(not_in_H, from_super_edges) to_super_edges = filter(not_in_H, to_super_edges) paths.extend(from_super_edges) paths.extend(to_super_edges) paths = set(paths) return paths def plus_neighbors(self, super_graph): paths = self.plus_neighbor_edges(super_graph) # then generate a graph for each unique path for path in paths: H_ = self.copy() H_.add_edge(path) yield H_ def minus_neighbors(self): for edge in self.edges: H_ = self.copy() H_.remove_edge(edge) yield H_ def add_edge(self, edge): node_a, node_b = edge.node_a, edge.node_b self.add_node(node_a) self.add_node(node_b) self.nodes[node_a]['out_edges'].append(edge) self.nodes[node_b]['in_edges'].append(edge) self.edges.append(edge) def add_node(self, node): if node not in self.nodes: self.nodes[node] = {'in_edges': [], 'out_edges': []} def in_degree(self, node): return len(self.nodes[node]['in_edges']) def out_degree(self, node): return len(self.nodes[node]['out_edges']) def is_1_in_1_out(self, node): return self.in_degree(node) == 1 and self.out_degree(node) == 1 def add_edges_from(self, edges): for edge in edges: self.add_edge(edge) def add_nodes_from(self, nodes): for node in nodes: self.add_node(node) def remove_edge(self, edge): node_a, node_b = edge.node_a, edge.node_b self.nodes[node_a]['out_edges'].remove(edge) self.nodes[node_b]['in_edges'].remove(edge) self.edges.remove(edge) if len(self.nodes[node_a]['out_edges']) + \ len(self.nodes[node_a]['in_edges']) == 0: self.nodes.pop(node_a) if len(self.nodes[node_b]['out_edges']) + \ len(self.nodes[node_b]['in_edges']) == 0: self.nodes.pop(node_b) def remove_node(self, node): for edge in self.nodes[node]['in_edges']: self.remove_edge(edge) for edge in self.nodes[node]['out_edges']: self.remove_edge(edge) assert node not in self.nodes def remove_edges_from(self, edges): for edge in edges: self.remove_edge(edge) def remove_nodes_from(self, nodes): for node in nodes: self.remove_node(node) def subgraph_from_edgelist(self, edges): # TODO assert edges are in graph pass class RedBlueDiGraph(DiGraph): RED = 'red' BLUE = 'blue' def __init__(self): super(RedBlueDiGraph, self).__init__() self.coverage = 0 self.color = dict() def __str__(self): return str([(edge, self.color[edge]) for edge in self.edges]) def copy(self): H_ = __class__() colors = [self.color[edge] for edge in self.edges] H_.add_edges_from(self.edges, colors=colors) H_.coverage = self.coverage #H_.color = dict(self.color) return H_ def score(self, alpha): paths = self.maximal_non_branching_paths() total_path_length = sum([len(path) for path in paths]) avg_path_length = total_path_length / \ len(paths) if len(paths) > 0 else 0 return alpha * self.coverage + (1 - alpha) * avg_path_length def add_edge(self, edge, color): super(RedBlueDiGraph, self).add_edge(edge) if color == self.RED: self.color[edge] = self.RED self.coverage += 1 else: self.coverage -= 1 self.color[edge] = self.BLUE def add_edges_from(self, edges, colors=None): if colors is not None: assert len(colors) == len(edges) for i, edge in enumerate(edges): self.add_edge(edge, color=colors[i]) else: super(RedBlueDiGraph, self).add_edges_from(edges) def plus_neighbors(self, super_graph): paths = self.plus_neighbor_edges(super_graph) # then generate a graph for each unique path for path in paths: H_ = self.copy() H_.add_edge(path, color=super_graph.color[path]) yield H_ def calculate_coverage(self): return self.coverage def remove_edge(self, edge): if self.color[edge] == self.RED: self.coverage -= 1 else: self.coverage += 1 super(RedBlueDiGraph, self).remove_edge(edge) if edge not in self.edges: self.color.pop(edge)
class Digraph: def __init__(self): self.nodes = dict() self.edges = [] def copy(self): h_ = __class__() H_.add_edges_from(self.edges) return H_ def __eq__(self, other): return len(set(self.edges) ^ set(other.edges)) == 0 def __str__(self): return str(self.edges) __repr__ = __str__ def maximal_non_branching_paths(self): paths = [] visited_edges = set() for node in self.nodes: if not self.is_1_in_1_out(node): if self.out_degree(node) > 0: out_edges = self.nodes[node]['out_edges'] for edge in out_edges: visited_edges.add(edge) to_node = edge.node_b non_branching_path = [edge] while self.is_1_in_1_out(to_node): out_edge = self.nodes[to_node]['out_edges'][0] non_branching_path.append(out_edge) visited_edges.add(out_edge) to_node = out_edge.node_b paths.append(non_branching_path) cycle_edges = set(filter(lambda edge: edge not in visited_edges, self.edges)) while len(cycle_edges) > 0: edge = cycle_edges.pop() non_branching_path = [edge] start_node = edge.node_a to_node = edge.node_b while to_node != start_node: out_edge = self.nodes[to_node]['out_edges'][0] non_branching_path.append(out_edge) cycle_edges.remove(out_edge) visited_edges.add(out_edge) to_node = out_edge.node_b paths.append(non_branching_path) return paths def neighbor_graphs(self, sub_graph, super_graph, k): if k >= 0: yield sub_graph for neighbor in sub_graph.plus_neighbors(super_graph): yield from neighbor.neighbor_graphs(neighbor, super_graph, k - 1) def adjacent_graphs(self, sub_graph, super_graph, k): if k >= 0: yield sub_graph for neighbor in sub_graph.plus_neighbors(super_graph): yield from neighbor.adjacent_graphs(neighbor, super_graph, k - 1) for neighbor in sub_graph.minus_neighbors(): yield from neighbor.adjacent_graphs(neighbor, super_graph, k - 1) def plus_neighbor_edges(self, super_graph): paths = list() for edge in self.edges: (from_, to) = (edge.node_a, edge.node_b) from_super_edges = super_graph.nodes[to]['out_edges'] to_super_edges = super_graph.nodes[from_]['in_edges'] def not_in_h(edge): return edge not in self.edges from_super_edges = filter(not_in_H, from_super_edges) to_super_edges = filter(not_in_H, to_super_edges) paths.extend(from_super_edges) paths.extend(to_super_edges) from_super_edges = super_graph.nodes[from_]['out_edges'] to_super_edges = super_graph.nodes[to]['in_edges'] def not_in_h(edge): return edge not in self.edges from_super_edges = filter(not_in_H, from_super_edges) to_super_edges = filter(not_in_H, to_super_edges) paths.extend(from_super_edges) paths.extend(to_super_edges) paths = set(paths) return paths def plus_neighbors(self, super_graph): paths = self.plus_neighbor_edges(super_graph) for path in paths: h_ = self.copy() H_.add_edge(path) yield H_ def minus_neighbors(self): for edge in self.edges: h_ = self.copy() H_.remove_edge(edge) yield H_ def add_edge(self, edge): (node_a, node_b) = (edge.node_a, edge.node_b) self.add_node(node_a) self.add_node(node_b) self.nodes[node_a]['out_edges'].append(edge) self.nodes[node_b]['in_edges'].append(edge) self.edges.append(edge) def add_node(self, node): if node not in self.nodes: self.nodes[node] = {'in_edges': [], 'out_edges': []} def in_degree(self, node): return len(self.nodes[node]['in_edges']) def out_degree(self, node): return len(self.nodes[node]['out_edges']) def is_1_in_1_out(self, node): return self.in_degree(node) == 1 and self.out_degree(node) == 1 def add_edges_from(self, edges): for edge in edges: self.add_edge(edge) def add_nodes_from(self, nodes): for node in nodes: self.add_node(node) def remove_edge(self, edge): (node_a, node_b) = (edge.node_a, edge.node_b) self.nodes[node_a]['out_edges'].remove(edge) self.nodes[node_b]['in_edges'].remove(edge) self.edges.remove(edge) if len(self.nodes[node_a]['out_edges']) + len(self.nodes[node_a]['in_edges']) == 0: self.nodes.pop(node_a) if len(self.nodes[node_b]['out_edges']) + len(self.nodes[node_b]['in_edges']) == 0: self.nodes.pop(node_b) def remove_node(self, node): for edge in self.nodes[node]['in_edges']: self.remove_edge(edge) for edge in self.nodes[node]['out_edges']: self.remove_edge(edge) assert node not in self.nodes def remove_edges_from(self, edges): for edge in edges: self.remove_edge(edge) def remove_nodes_from(self, nodes): for node in nodes: self.remove_node(node) def subgraph_from_edgelist(self, edges): pass class Redbluedigraph(DiGraph): red = 'red' blue = 'blue' def __init__(self): super(RedBlueDiGraph, self).__init__() self.coverage = 0 self.color = dict() def __str__(self): return str([(edge, self.color[edge]) for edge in self.edges]) def copy(self): h_ = __class__() colors = [self.color[edge] for edge in self.edges] H_.add_edges_from(self.edges, colors=colors) H_.coverage = self.coverage return H_ def score(self, alpha): paths = self.maximal_non_branching_paths() total_path_length = sum([len(path) for path in paths]) avg_path_length = total_path_length / len(paths) if len(paths) > 0 else 0 return alpha * self.coverage + (1 - alpha) * avg_path_length def add_edge(self, edge, color): super(RedBlueDiGraph, self).add_edge(edge) if color == self.RED: self.color[edge] = self.RED self.coverage += 1 else: self.coverage -= 1 self.color[edge] = self.BLUE def add_edges_from(self, edges, colors=None): if colors is not None: assert len(colors) == len(edges) for (i, edge) in enumerate(edges): self.add_edge(edge, color=colors[i]) else: super(RedBlueDiGraph, self).add_edges_from(edges) def plus_neighbors(self, super_graph): paths = self.plus_neighbor_edges(super_graph) for path in paths: h_ = self.copy() H_.add_edge(path, color=super_graph.color[path]) yield H_ def calculate_coverage(self): return self.coverage def remove_edge(self, edge): if self.color[edge] == self.RED: self.coverage -= 1 else: self.coverage += 1 super(RedBlueDiGraph, self).remove_edge(edge) if edge not in self.edges: self.color.pop(edge)
''' Problem 34 @author: Kevin Ji ''' FACTORIALS = [1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800] def factorial(number): return FACTORIALS[number] def is_curious_num(number): temp_num = number curious_sum = 0 while temp_num > 0: curious_sum += factorial(temp_num % 10) temp_num //= 10 return number == curious_sum # Tests #print(is_curious_num(145)) # True #print(is_curious_num(100)) # False cur_sum = 0 for num in range(3, 1000000): if is_curious_num(num): cur_sum += num print(cur_sum)
""" Problem 34 @author: Kevin Ji """ factorials = [1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800] def factorial(number): return FACTORIALS[number] def is_curious_num(number): temp_num = number curious_sum = 0 while temp_num > 0: curious_sum += factorial(temp_num % 10) temp_num //= 10 return number == curious_sum cur_sum = 0 for num in range(3, 1000000): if is_curious_num(num): cur_sum += num print(cur_sum)
n= int(input("Digite o valor de n: ")) sub = n - 1 fat = n while n != 0: while sub != 1: fat = fat * sub sub = sub -1 print(fat)
n = int(input('Digite o valor de n: ')) sub = n - 1 fat = n while n != 0: while sub != 1: fat = fat * sub sub = sub - 1 print(fat)
class Neuron: # TODO: Create abstraction of generic unsupervised neuron pass
class Neuron: pass
expected_output = { 'switch': { "1": { 'system_temperature_state': 'ok', } } }
expected_output = {'switch': {'1': {'system_temperature_state': 'ok'}}}
# # WAP to accept a number and display all the factors which are prime ( prime factors) user_Inp = int(input("Enter number: ")) for i in range(1, user_Inp+1): c = 0 if(user_Inp % i == 0): for j in range(1, i+1): if(i % j == 0): c += 1 if(c <= 2): print(i, end=' ')
user__inp = int(input('Enter number: ')) for i in range(1, user_Inp + 1): c = 0 if user_Inp % i == 0: for j in range(1, i + 1): if i % j == 0: c += 1 if c <= 2: print(i, end=' ')
N, K = list(map(int, input().split(' '))) cnt = 0 while True: if N == 1: break; if N % K == 0: N /= K else: N -= 1 cnt += 1 print(cnt)
(n, k) = list(map(int, input().split(' '))) cnt = 0 while True: if N == 1: break if N % K == 0: n /= K else: n -= 1 cnt += 1 print(cnt)
class Solution: def nextLargerNodes(self, head: ListNode) -> List[int]: st = [] res = [] while head: while st and st[-1][1] < head.val: idx, v = st.pop() res[idx] = head.val st.append((len(res), head.val)) res.append(0) head = head.next return res
class Solution: def next_larger_nodes(self, head: ListNode) -> List[int]: st = [] res = [] while head: while st and st[-1][1] < head.val: (idx, v) = st.pop() res[idx] = head.val st.append((len(res), head.val)) res.append(0) head = head.next return res
def find_matches(match_info, results): for target_match_info, obj in results: if target_match_info.equals(match_info): yield target_match_info, obj
def find_matches(match_info, results): for (target_match_info, obj) in results: if target_match_info.equals(match_info): yield (target_match_info, obj)
def test(): print('testing basic math ops') assert 1+1 == 2 assert 10-1 == 9 assert 10 / 2 == 5 assert int(100.9) == 100 print('testing bitwise ops') print(100 ^ 0xd008) assert 100 ^ 0xd008 == 53356 print( 100 & 199 ) assert (100 & 199) == 68 ## TODO fixme print('TODO fix `100 & 199 == 68`') assert 100 & 199 == 68 test()
def test(): print('testing basic math ops') assert 1 + 1 == 2 assert 10 - 1 == 9 assert 10 / 2 == 5 assert int(100.9) == 100 print('testing bitwise ops') print(100 ^ 53256) assert 100 ^ 53256 == 53356 print(100 & 199) assert 100 & 199 == 68 print('TODO fix `100 & 199 == 68`') assert 100 & 199 == 68 test()
phrase = 'Coding For All' phrase = phrase.split() abrv = phrase[0][0] + phrase[1][0] + phrase[2][0] print(abrv)
phrase = 'Coding For All' phrase = phrase.split() abrv = phrase[0][0] + phrase[1][0] + phrase[2][0] print(abrv)