content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# Constructor with arguments or parameters default class Point: def __init__(self, x=0, y=0): self.x = x self.y = y def distance(self, point2): "Calculates distance between current point to given point2" x = point2.x - self.x y = point2.y - self.y d = x**2 + y**2 return d**0.5 p2 = Point(3,4) p1 = Point() distance = p1.distance(p2) print(distance)
class Point: def __init__(self, x=0, y=0): self.x = x self.y = y def distance(self, point2): """Calculates distance between current point to given point2""" x = point2.x - self.x y = point2.y - self.y d = x ** 2 + y ** 2 return d ** 0.5 p2 = point(3, 4) p1 = point() distance = p1.distance(p2) print(distance)
def encode(content: bytes): p = list(content) oa = ord('a') oz = ord('z') oA = ord('A') oZ = ord('Z') for i in range(len(p)): if oa <= p[i] <= oz: p[i] = oa + 25 - p[i] + oa elif oA <= p[i] <= oZ: p[i] = oA + 25 - p[i] + oA return bytes(p) def decode(cipher: bytes): return encode(cipher) if __name__ == '__main__': s = b'gsv_pvb_rh_zgyzhs' print(decode(s))
def encode(content: bytes): p = list(content) oa = ord('a') oz = ord('z') o_a = ord('A') o_z = ord('Z') for i in range(len(p)): if oa <= p[i] <= oz: p[i] = oa + 25 - p[i] + oa elif oA <= p[i] <= oZ: p[i] = oA + 25 - p[i] + oA return bytes(p) def decode(cipher: bytes): return encode(cipher) if __name__ == '__main__': s = b'gsv_pvb_rh_zgyzhs' print(decode(s))
# Write a function def equals(a, b) that checks whether two lists have the same # elements in the same order. # FUNCTIONS def equals(listA, listB): if len(listA) < len(listB) or len(listA) > len(listB): return False equalBool = False for i in range(len(listA)): if listA[i] == listB[i]: equalBool = True else: return False return equalBool # main def main(): exampleListA = [ 10, 15, 20, 34, 5 ] exampleListB = [ 15, 23, 21, 15, 2 ] exampleListC = [ 15, 23, 21, 15, 2 ] print("The lists: A, B, C =>", exampleListA, exampleListB, exampleListC) print("Are A and B equal:", equals(exampleListA, exampleListB)) print("Are A and C equal:", equals(exampleListA, exampleListC)) print("Are B and C equal:", equals(exampleListB, exampleListC)) # PROGRAM RUN main()
def equals(listA, listB): if len(listA) < len(listB) or len(listA) > len(listB): return False equal_bool = False for i in range(len(listA)): if listA[i] == listB[i]: equal_bool = True else: return False return equalBool def main(): example_list_a = [10, 15, 20, 34, 5] example_list_b = [15, 23, 21, 15, 2] example_list_c = [15, 23, 21, 15, 2] print('The lists: A, B, C =>', exampleListA, exampleListB, exampleListC) print('Are A and B equal:', equals(exampleListA, exampleListB)) print('Are A and C equal:', equals(exampleListA, exampleListC)) print('Are B and C equal:', equals(exampleListB, exampleListC)) main()
def old_test(): core = Core(User='',Password='',ip='192.168.61.2') core.start() #gain = Control(parent=core,Name='gain',ValueType=int) cg = ChangeGroup(parent=core,Id='mygroup') #create some control objects for i in range(1,10): l = Control(parent=core,Name='Mixer6x9Output{}Label'.format(i),ValueType=str) cg.AddControl(l) m = Control(parent=core,Name='Mixer6x9Output{}Mute'.format(i),ValueType=[int,float]) cg.AddControl(m) g = Control(parent=core,Name='Mixer6x9Output{}Gain'.format(i),ValueType=[int,float]) cg.AddControl(g) print(l,m,g) time.sleep(2) cg.AutoPoll(Rate=.1) while True: x = str(input("Control Name: ")) if(x): try: print(core.Objects[x].state) except: print("fail")
def old_test(): core = core(User='', Password='', ip='192.168.61.2') core.start() cg = change_group(parent=core, Id='mygroup') for i in range(1, 10): l = control(parent=core, Name='Mixer6x9Output{}Label'.format(i), ValueType=str) cg.AddControl(l) m = control(parent=core, Name='Mixer6x9Output{}Mute'.format(i), ValueType=[int, float]) cg.AddControl(m) g = control(parent=core, Name='Mixer6x9Output{}Gain'.format(i), ValueType=[int, float]) cg.AddControl(g) print(l, m, g) time.sleep(2) cg.AutoPoll(Rate=0.1) while True: x = str(input('Control Name: ')) if x: try: print(core.Objects[x].state) except: print('fail')
NODE_STATS_UPDATE_INTERVAL_SECONDS = 1 UPDATE_NODES_INTERVAL_SECONDS = 5 MAX_COUNT_OF_GCS_RPC_ERROR = 10 MAX_LOGS_TO_CACHE = 10000 LOG_PRUNE_THREASHOLD = 1.25
node_stats_update_interval_seconds = 1 update_nodes_interval_seconds = 5 max_count_of_gcs_rpc_error = 10 max_logs_to_cache = 10000 log_prune_threashold = 1.25
class Solution(object): def minTaps(self, n, ranges): """ :type n: int :type ranges: List[int] :rtype: int """ ranges = [(i-r,i+r) for i,r in enumerate(ranges)] ranges.sort(reverse = True) watered = 0 ans = 0 while ranges: far_right = [] while ranges and ranges[-1][0] <= watered: far_right.append(ranges.pop()[1]) if not far_right: return -1 watered = max(far_right) ans += 1 if watered >= n: return ans return ans abc = Solution() abc.minTaps(7, [1,2,1,0,2,1,0,1])
class Solution(object): def min_taps(self, n, ranges): """ :type n: int :type ranges: List[int] :rtype: int """ ranges = [(i - r, i + r) for (i, r) in enumerate(ranges)] ranges.sort(reverse=True) watered = 0 ans = 0 while ranges: far_right = [] while ranges and ranges[-1][0] <= watered: far_right.append(ranges.pop()[1]) if not far_right: return -1 watered = max(far_right) ans += 1 if watered >= n: return ans return ans abc = solution() abc.minTaps(7, [1, 2, 1, 0, 2, 1, 0, 1])
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"kcred": "extract.ipynb", "unzip": "extract.ipynb", "download_kaggle_dataset": "extract.ipynb"} modules = ["loader.py"] doc_url = "https://talosiot-will.github.io/agora/" git_url = "https://github.com/talosiot-will/agora/tree/master/" def custom_doc_links(name): return None
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'kcred': 'extract.ipynb', 'unzip': 'extract.ipynb', 'download_kaggle_dataset': 'extract.ipynb'} modules = ['loader.py'] doc_url = 'https://talosiot-will.github.io/agora/' git_url = 'https://github.com/talosiot-will/agora/tree/master/' def custom_doc_links(name): return None
def generate_python(fields): pkgSize = 0 pkgStr = '<' for field in fields: pkgSize += field.fieldType.length pkgStr += field.fieldType.charCode pyStr = 'PACKAGE_LEN = '+str(pkgSize)+'\n' pyStr += 'PACKAGE_CODE = "'+pkgStr+'"\n' pyStr += 'PACKAGE_FIELDS = ' + list( map(lambda f: f.name, fields) ).__str__() return pyStr
def generate_python(fields): pkg_size = 0 pkg_str = '<' for field in fields: pkg_size += field.fieldType.length pkg_str += field.fieldType.charCode py_str = 'PACKAGE_LEN = ' + str(pkgSize) + '\n' py_str += 'PACKAGE_CODE = "' + pkgStr + '"\n' py_str += 'PACKAGE_FIELDS = ' + list(map(lambda f: f.name, fields)).__str__() return pyStr
PLATFORM_COMPILER_FLAGS = [ '-std=c++14', '-Wall', '-Wextra', # For TestCommon.h '-Wno-pragmas', ]
platform_compiler_flags = ['-std=c++14', '-Wall', '-Wextra', '-Wno-pragmas']
x = 0 score = x # Question One print("What are the plants and trees release into the air?") answer_1 = input("a)air\nb)oxygen\nc)music\nd)zak's fart \n:") if answer_1.lower() == "b" or answer_1.lower() == "oxygen": print("Correct") x = x + 1 else: print("Incorrect, it's oxygen") # Question Two print("What color is the trash can you put the boxes in") answer_2 = input("a) orange\nb)blue\nc)green\nd)black\n:") if answer_2.lower() == "a" or answer_2.lower() == "orange": print("Correct") x = x + 1 else: print("Incorrect, it's orange") # Question Three print("True or False... scientists say that till 2050 there will be more plastic than fish in the ocean?") answer_3 = input(":") if answer_3.lower() == "true" or answer_3.lower() == "t": print("Correct") x = x + 1 else: print("Incorrect") # Question Four print("In the worldwide, how many single-use plastic bags are used per year?") answer_4 = input("a)300,000\nb)6 billions\nc)500 billions\nd)2 trillions\n:") if answer_4.lower() == "c" or answer_4 == "500 billions": print("Correct") x = x + 1 else: print("Incorrect, The last time the Toronto Maple Leafs won the Stanley Cup was 1967") # Question Five print("True or False... 60,000 marine creaturs are dying from plactic entanglement every year") answer_5 = input(":") if answer_5.lower() == "false" or answer_5.lower() == "f": print("Correct,100,000 marine creaturs are dying from plactic entanglement every year") x = x + 1 else: print("Incorrect, 100,000 marine creaturs are dying from plactic entanglement every year") # Question six print("How many people die everyday as result of drinking unclean water") answer_1 = input("a)1000\nb)300\nc)5000\nd)2670\n:") if answer_1.lower() == "c" or answer_1.lower() == "5000": print("Correct") x = x + 1 else: print("Incorrect, 5000 people die everyday as result of drinking unclean water") # Question seven print("What is the world's largest producer of carbon dioxide?") answer_2 = input("a)USA\nb)China\nc)france\nd)italy\n:") if answer_2.lower() == "b" or answer_2.lower() == "China": print("Correct") x = x + 1 else: print("Incorrect, it's China") # Question eight print("True or False... acidification of the ocean is the worst type of pollution?") answer_3 = input(":") if answer_3.lower() == "true" or answer_3.lower() == "t": print("Correct") x = x + 1 else: print("Incorrect") # Question nine print("How many kilograms of garbage a singlr person does i the USA?") answer_4 = input("a)0.5\nb)1\nc)3\nd)2\n:") if answer_4.lower() == "d" or answer_4 == "2": print("Correct") x = x + 1 else: print("Incorrect, a single person make 2 k kilograms of garbage") # Question ten print("The pollution in China doesn't change the weather in the USA?") answer_5 = input(":") if answer_5.lower() == "false" or answer_5.lower() == "f": print("Correct") x = x + 1 else: print("Incorrect,the pollution in China doesn't change the weather in the USA") #Total Score score = float(x / 5) * 100 print(x,"out of 5, that is",score, "%")
x = 0 score = x print('What are the plants and trees release into the air?') answer_1 = input("a)air\nb)oxygen\nc)music\nd)zak's fart \n:") if answer_1.lower() == 'b' or answer_1.lower() == 'oxygen': print('Correct') x = x + 1 else: print("Incorrect, it's oxygen") print('What color is the trash can you put the boxes in') answer_2 = input('a) orange\nb)blue\nc)green\nd)black\n:') if answer_2.lower() == 'a' or answer_2.lower() == 'orange': print('Correct') x = x + 1 else: print("Incorrect, it's orange") print('True or False... scientists say that till 2050 there will be more plastic than fish in the ocean?') answer_3 = input(':') if answer_3.lower() == 'true' or answer_3.lower() == 't': print('Correct') x = x + 1 else: print('Incorrect') print('In the worldwide, how many single-use plastic bags are used per year?') answer_4 = input('a)300,000\nb)6 billions\nc)500 billions\nd)2 trillions\n:') if answer_4.lower() == 'c' or answer_4 == '500 billions': print('Correct') x = x + 1 else: print('Incorrect, The last time the Toronto Maple Leafs won the Stanley Cup was 1967') print('True or False... 60,000 marine creaturs are dying from plactic entanglement every year') answer_5 = input(':') if answer_5.lower() == 'false' or answer_5.lower() == 'f': print('Correct,100,000 marine creaturs are dying from plactic entanglement every year') x = x + 1 else: print('Incorrect, 100,000 marine creaturs are dying from plactic entanglement every year') print('How many people die everyday as result of drinking unclean water') answer_1 = input('a)1000\nb)300\nc)5000\nd)2670\n:') if answer_1.lower() == 'c' or answer_1.lower() == '5000': print('Correct') x = x + 1 else: print('Incorrect, 5000 people die everyday as result of drinking unclean water') print("What is the world's largest producer of carbon dioxide?") answer_2 = input('a)USA\nb)China\nc)france\nd)italy\n:') if answer_2.lower() == 'b' or answer_2.lower() == 'China': print('Correct') x = x + 1 else: print("Incorrect, it's China") print('True or False... acidification of the ocean is the worst type of pollution?') answer_3 = input(':') if answer_3.lower() == 'true' or answer_3.lower() == 't': print('Correct') x = x + 1 else: print('Incorrect') print('How many kilograms of garbage a singlr person does i the USA?') answer_4 = input('a)0.5\nb)1\nc)3\nd)2\n:') if answer_4.lower() == 'd' or answer_4 == '2': print('Correct') x = x + 1 else: print('Incorrect, a single person make 2 k kilograms of garbage') print("The pollution in China doesn't change the weather in the USA?") answer_5 = input(':') if answer_5.lower() == 'false' or answer_5.lower() == 'f': print('Correct') x = x + 1 else: print("Incorrect,the pollution in China doesn't change the weather in the USA") score = float(x / 5) * 100 print(x, 'out of 5, that is', score, '%')
class BaseMarkupEngine(object): def __init__(self, message, obj=None): self.message = message self.obj = obj class BaseQuoteEngine(object): def __init__(self, post, username): self.post = post self.username = username
class Basemarkupengine(object): def __init__(self, message, obj=None): self.message = message self.obj = obj class Basequoteengine(object): def __init__(self, post, username): self.post = post self.username = username
''' Interpret text as though all letters are off by one key location Status: Accepted ''' ############################################################################### def main(): """Read input and print output""" lut, keys = {' ': ' '}, [] keys.append('`1234567890-=') keys.append('QWERTYUIOP[]\\') keys.append('ASDFGHJKL;\'') keys.append('ZXCVBNM,./') for row in keys: for index, k in enumerate(row[1:], start=1): lut[k] = row[index - 1] while True: try: print(''.join([lut[i] for i in input()])) except EOFError: break ############################################################################### if __name__ == '__main__': main()
""" Interpret text as though all letters are off by one key location Status: Accepted """ def main(): """Read input and print output""" (lut, keys) = ({' ': ' '}, []) keys.append('`1234567890-=') keys.append('QWERTYUIOP[]\\') keys.append("ASDFGHJKL;'") keys.append('ZXCVBNM,./') for row in keys: for (index, k) in enumerate(row[1:], start=1): lut[k] = row[index - 1] while True: try: print(''.join([lut[i] for i in input()])) except EOFError: break if __name__ == '__main__': main()
__author__ = "Cauani Castro" __copyright__ = "Copyright 2015, Cauani Castro" __credits__ = ["Cauani Castro"] __license__ = "Apache License 2.0" __version__ = "1.0" __maintainer__ = "Cauani Castro" __email__ = "[email protected]" __status__ = "Examination program" #funcao recursiva que acumula o resultado em variavel auxiliar, para melhorar a legibilidade do codigo def base3Para10(b3, exp, b10): if b3 % 10 > 2: print("O numero inserido nao esta na base 10!") return False aux = (b3 % 10)*(3**exp) if b3 < 10: return b10 + aux return base3Para10(b3//10, exp+1, b10+aux) def main(): print("Este programa ira receber uma serie de numeros na base 3, e ira converte-lo para a base 10, e imprimir o resultado.") print("Caso o usuario entre um numero fora da base 3, o programa ira alertar erro.") while True: b3 = int(input("Insira um numero na base 3 (Dominio {0, 1, 2}) [digite 0 para sair]\n")) if b3 == 0: break b10 = base3Para10(b3,0,0) if b10: print("O numero na base 3: %d, convertido para a base 10: %d" % (b3, b10)) print("\n#####################################") print(" FIM DO PROGRAMA") print("#####################################") return True if __name__ == '__main__': main()
__author__ = 'Cauani Castro' __copyright__ = 'Copyright 2015, Cauani Castro' __credits__ = ['Cauani Castro'] __license__ = 'Apache License 2.0' __version__ = '1.0' __maintainer__ = 'Cauani Castro' __email__ = '[email protected]' __status__ = 'Examination program' def base3_para10(b3, exp, b10): if b3 % 10 > 2: print('O numero inserido nao esta na base 10!') return False aux = b3 % 10 * 3 ** exp if b3 < 10: return b10 + aux return base3_para10(b3 // 10, exp + 1, b10 + aux) def main(): print('Este programa ira receber uma serie de numeros na base 3, e ira converte-lo para a base 10, e imprimir o resultado.') print('Caso o usuario entre um numero fora da base 3, o programa ira alertar erro.') while True: b3 = int(input('Insira um numero na base 3 (Dominio {0, 1, 2}) [digite 0 para sair]\n')) if b3 == 0: break b10 = base3_para10(b3, 0, 0) if b10: print('O numero na base 3: %d, convertido para a base 10: %d' % (b3, b10)) print('\n#####################################') print(' FIM DO PROGRAMA') print('#####################################') return True if __name__ == '__main__': main()
people_waiting = int(input()) wagon_state = input().split() len_ = len(wagon_state) counter = 0 is_full = False if people_waiting == 0: print(*wagon_state) exit(0) for el in range(len_): counter = int(wagon_state[el]) if counter == 4: is_full = True continue for people in range(4): if people_waiting == 0: break people_waiting -=1 counter += 1 wagon_state[el] = counter is_full = False if counter == 4: break if people_waiting == 0: break if is_full: print(f"There isn't enough space! {people_waiting} people in a queue!") print(*wagon_state) elif counter < 4: print(f"The lift has empty spots!") print(*wagon_state) elif people_waiting > 0: print(f"There isn't enough space! {people_waiting} people in a queue!") print(*wagon_state) else: print(*wagon_state)
people_waiting = int(input()) wagon_state = input().split() len_ = len(wagon_state) counter = 0 is_full = False if people_waiting == 0: print(*wagon_state) exit(0) for el in range(len_): counter = int(wagon_state[el]) if counter == 4: is_full = True continue for people in range(4): if people_waiting == 0: break people_waiting -= 1 counter += 1 wagon_state[el] = counter is_full = False if counter == 4: break if people_waiting == 0: break if is_full: print(f"There isn't enough space! {people_waiting} people in a queue!") print(*wagon_state) elif counter < 4: print(f'The lift has empty spots!') print(*wagon_state) elif people_waiting > 0: print(f"There isn't enough space! {people_waiting} people in a queue!") print(*wagon_state) else: print(*wagon_state)
name, age = "Shelby De Oliveira", 29 username = "shelb-doc" print ('Hello!') print("Name: {}\nAge: {}\nUsername: {}".format(name, age, username))
(name, age) = ('Shelby De Oliveira', 29) username = 'shelb-doc' print('Hello!') print('Name: {}\nAge: {}\nUsername: {}'.format(name, age, username))
#!/usr/bin/env python # -*- coding: utf8 -*- # coding: utf8 class Room(): def __init__(self, serv, room_name, admin_username, bot_username, lutra_username, website_url, user_list): # Class attributes self.serv = serv self.room_name = room_name self.admin_username = admin_username self.bot_username = bot_username self.lutra_username = lutra_username self.website_url = website_url self.user_list = user_list # Init LOGGER.info("Welcome in ["+self.room_name+"]") LOGGER.info("Connected users: " + str(self.user_list)) def on_user_joined(self, user): LOGGER.info("User (" + str(user) + ") joined the room.") for u in self.user_list: if user == u: LOGGER.warning("User (" + str(user) + ") is already in the user list.") return self.user_list.append(user) LOGGER.info("Connected users: " + str(self.user_list)) def on_user_left(self, user): LOGGER.info("User (" + str(user) + ") left the room.") present = False for u in self.user_list: if user == u: present = True break if present: self.user_list.remove(user) LOGGER.info("Connected users: " + str(self.user_list)) else: LOGGER.warning("User (" + str(user) + ") was not found in user list.") def send(self, msg): self.serv.privmsg(self.room_name, msg.decode("utf8"))
class Room: def __init__(self, serv, room_name, admin_username, bot_username, lutra_username, website_url, user_list): self.serv = serv self.room_name = room_name self.admin_username = admin_username self.bot_username = bot_username self.lutra_username = lutra_username self.website_url = website_url self.user_list = user_list LOGGER.info('Welcome in [' + self.room_name + ']') LOGGER.info('Connected users: ' + str(self.user_list)) def on_user_joined(self, user): LOGGER.info('User (' + str(user) + ') joined the room.') for u in self.user_list: if user == u: LOGGER.warning('User (' + str(user) + ') is already in the user list.') return self.user_list.append(user) LOGGER.info('Connected users: ' + str(self.user_list)) def on_user_left(self, user): LOGGER.info('User (' + str(user) + ') left the room.') present = False for u in self.user_list: if user == u: present = True break if present: self.user_list.remove(user) LOGGER.info('Connected users: ' + str(self.user_list)) else: LOGGER.warning('User (' + str(user) + ') was not found in user list.') def send(self, msg): self.serv.privmsg(self.room_name, msg.decode('utf8'))
""" Good morning! Here's your coding interview problem for today. This problem was asked by Microsoft. Given an array of numbers arr and a window of size k, print out the median of each window of size k starting from the left and moving right by one position each time. For example, given the following array and k = 3: [-1, 5, 13, 8, 2, 3, 3, 1] Your function should print out the following: 5 <- median of [-1, 5, 13] 8 <- median of [5, 13, 8] 8 <- median of [13, 8, 2] 3 <- median of [8, 2, 3] 3 <- median of [2, 3, 3] 3 <- median of [3, 3, 1] Recall that the median of an even-sized list is the average of the two middle numbers. """ def find_median_for_range(int_list, window_size): """Takes in a list of integers and a window size and returns the median for each window in the list""" isOddWindowSize = window_size % 2 != 0 for i in range(0, len(int_list) - window_size): if isOddWindowSize: print(int_list[i + window_size // 2]) else: left_index = (window_size - 1) // 2 right_index = left_index + 1 middle_average = ( int_list[i + left_index] + int_list[i + right_index]) / 2 print(middle_average)
""" Good morning! Here's your coding interview problem for today. This problem was asked by Microsoft. Given an array of numbers arr and a window of size k, print out the median of each window of size k starting from the left and moving right by one position each time. For example, given the following array and k = 3: [-1, 5, 13, 8, 2, 3, 3, 1] Your function should print out the following: 5 <- median of [-1, 5, 13] 8 <- median of [5, 13, 8] 8 <- median of [13, 8, 2] 3 <- median of [8, 2, 3] 3 <- median of [2, 3, 3] 3 <- median of [3, 3, 1] Recall that the median of an even-sized list is the average of the two middle numbers. """ def find_median_for_range(int_list, window_size): """Takes in a list of integers and a window size and returns the median for each window in the list""" is_odd_window_size = window_size % 2 != 0 for i in range(0, len(int_list) - window_size): if isOddWindowSize: print(int_list[i + window_size // 2]) else: left_index = (window_size - 1) // 2 right_index = left_index + 1 middle_average = (int_list[i + left_index] + int_list[i + right_index]) / 2 print(middle_average)
class Solution: def productExceptSelf(self, nums: list[int]) -> list[int]: result = [1] * len(nums) prefix = 1 for i in range(len(nums)): result[i] *= prefix prefix *= nums[i] postfix = 1 for i in range(len(nums) - 1, -1, -1): result[i] *= postfix postfix *= nums[i] return result
class Solution: def product_except_self(self, nums: list[int]) -> list[int]: result = [1] * len(nums) prefix = 1 for i in range(len(nums)): result[i] *= prefix prefix *= nums[i] postfix = 1 for i in range(len(nums) - 1, -1, -1): result[i] *= postfix postfix *= nums[i] return result
''' from os.path import expanduser, exists, split if __name__ == '__main__': print('[TPL] Test Extern Features') import multiprocessing multiprocessing.freeze_support() def ensure_hotspotter(): import matplotlib matplotlib.use('Qt4Agg', warn=True, force=True) # Look for hotspotter in ~/code hotspotter_dir = join(expanduser('~'), 'code', 'hotspotter') if not exists(hotspotter_dir): print('[jon] hotspotter_dir=%r DOES NOT EXIST!' % (hotspotter_dir,)) # Append hotspotter location (not dir) to PYTHON_PATH (i.e. sys.path) hotspotter_location = split(hotspotter_dir)[0] sys.path.append(hotspotter_location) # Import hotspotter io and drawing ensure_hotspotter() from hsviz import draw_func2 as df2 #from hsviz import viz from hscom import fileio as io # Read Image img_fpath = realpath('lena.png') image = io.imread(img_fpath) def spaced_elements(list_, n): indexes = np.arange(len(list_)) stride = len(indexes) // n return list_[indexes[0:-1:stride]] def test_detect(n=None, fnum=1, old=True): from hsviz import interact try: # Select kpts detect_kpts_func = detect_kpts_old if old else detect_kpts_new kpts, desc = detect_kpts_func(img_fpath, {}) kpts_ = kpts if n is None else spaced_elements(kpts, n) desc_ = desc if n is None else spaced_elements(desc, n) # Print info np.set_printoptions(threshold=5000, linewidth=5000, precision=3) print('----') print('detected %d keypoints' % len(kpts)) print('drawing %d/%d kpts' % (len(kpts_), len(kpts))) print(kpts_) print('----') # Draw kpts interaction.interact_keypoints(image, kpts_, desc_, fnum) #df2.imshow(image, fnum=fnum) #df2.draw_kpts2(kpts_, ell_alpha=.9, ell_linewidth=4, #ell_color='distinct', arrow=True, rect=True) df2.set_figtitle('old' if old else 'new') except Exception as ex: import traceback traceback.format_exc() print(ex) return locals() test_detect(n=10, fnum=1, old=True) test_detect(n=10, fnum=2, old=False) exec(df2.present()) '''
""" from os.path import expanduser, exists, split if __name__ == '__main__': print('[TPL] Test Extern Features') import multiprocessing multiprocessing.freeze_support() def ensure_hotspotter(): import matplotlib matplotlib.use('Qt4Agg', warn=True, force=True) # Look for hotspotter in ~/code hotspotter_dir = join(expanduser('~'), 'code', 'hotspotter') if not exists(hotspotter_dir): print('[jon] hotspotter_dir=%r DOES NOT EXIST!' % (hotspotter_dir,)) # Append hotspotter location (not dir) to PYTHON_PATH (i.e. sys.path) hotspotter_location = split(hotspotter_dir)[0] sys.path.append(hotspotter_location) # Import hotspotter io and drawing ensure_hotspotter() from hsviz import draw_func2 as df2 #from hsviz import viz from hscom import fileio as io # Read Image img_fpath = realpath('lena.png') image = io.imread(img_fpath) def spaced_elements(list_, n): indexes = np.arange(len(list_)) stride = len(indexes) // n return list_[indexes[0:-1:stride]] def test_detect(n=None, fnum=1, old=True): from hsviz import interact try: # Select kpts detect_kpts_func = detect_kpts_old if old else detect_kpts_new kpts, desc = detect_kpts_func(img_fpath, {}) kpts_ = kpts if n is None else spaced_elements(kpts, n) desc_ = desc if n is None else spaced_elements(desc, n) # Print info np.set_printoptions(threshold=5000, linewidth=5000, precision=3) print('----') print('detected %d keypoints' % len(kpts)) print('drawing %d/%d kpts' % (len(kpts_), len(kpts))) print(kpts_) print('----') # Draw kpts interaction.interact_keypoints(image, kpts_, desc_, fnum) #df2.imshow(image, fnum=fnum) #df2.draw_kpts2(kpts_, ell_alpha=.9, ell_linewidth=4, #ell_color='distinct', arrow=True, rect=True) df2.set_figtitle('old' if old else 'new') except Exception as ex: import traceback traceback.format_exc() print(ex) return locals() test_detect(n=10, fnum=1, old=True) test_detect(n=10, fnum=2, old=False) exec(df2.present()) """
MONGO_URI = 'mongodb://steemit:[email protected]:27017/SteemData' MONGO_DBNAME = 'SteemData' # 50 items per page by default PAGINATION_DEFAULT = 50 # allow 1000 requests per minute RATE_LIMIT_GET = (1000, 60) # change status message STATUS_ERR = 'ERROR' # change default response fields EXTRA_RESPONSE_FIELDS = ['ID_FIELD'] # no need to define schemas manually ALLOW_UNKNOWN = True # can use API from any js app (CORS) X_DOMAINS = '*' # X_HEADERS = '*' # our models DOMAIN = { 'Accounts': { 'id_field': 'name', 'item_lookup': True, 'additional_lookup': { 'url': 'regex("[\w]+")', 'field': 'name', }, }, 'Posts': { 'id_field': 'identifier', 'item_lookup': True, 'additional_lookup': { 'url': 'regex("@[\w]+/[\w]+")', 'field': 'identifier', }, }, 'Comments': { 'id_field': 'identifier', 'item_lookup': True, 'additional_lookup': { 'url': 'regex("@[\w]+/[\w]+")', 'field': 'identifier', }, }, 'PriceHistory': {}, 'Operations': {}, 'AccountOperations': {}, }
mongo_uri = 'mongodb://steemit:[email protected]:27017/SteemData' mongo_dbname = 'SteemData' pagination_default = 50 rate_limit_get = (1000, 60) status_err = 'ERROR' extra_response_fields = ['ID_FIELD'] allow_unknown = True x_domains = '*' domain = {'Accounts': {'id_field': 'name', 'item_lookup': True, 'additional_lookup': {'url': 'regex("[\\w]+")', 'field': 'name'}}, 'Posts': {'id_field': 'identifier', 'item_lookup': True, 'additional_lookup': {'url': 'regex("@[\\w]+/[\\w]+")', 'field': 'identifier'}}, 'Comments': {'id_field': 'identifier', 'item_lookup': True, 'additional_lookup': {'url': 'regex("@[\\w]+/[\\w]+")', 'field': 'identifier'}}, 'PriceHistory': {}, 'Operations': {}, 'AccountOperations': {}}
def wait(c): m = None while m != 'GO': m = (c.recv(300).decode().replace('\n','').strip()) pass
def wait(c): m = None while m != 'GO': m = c.recv(300).decode().replace('\n', '').strip() pass
# -*- coding: utf-8 -*- """ morse.py Class for converting between English and morse code @author: Douglas Daly @date: 1/6/2017 """ # # Class Definition # class Morse(object): """ Morse Code Translation Class """ def __init__(self): """ Default Constructor """ dict_tup = self.__generate_morse_code_dictionaries() self.__dict_to_morse = dict_tup[0] self.__dict_from_morse = dict_tup[1] def __generate_morse_code_dictionaries(self): """ Generates a dict object of Morse Code """ dict_morse = dict() dict_morse['.-'] = 'a' dict_morse['-...'] = 'b' dict_morse['-.-.'] = 'c' dict_morse['-..'] = 'd' dict_morse['.'] = 'e' dict_morse['..-.'] = 'f' dict_morse['--.'] = 'g' dict_morse['....'] = 'h' dict_morse['..'] = 'i' dict_morse['.---'] = 'j' dict_morse['-.-'] = 'k' dict_morse['.-..'] = 'l' dict_morse['--'] = 'm' dict_morse['-.'] = 'n' dict_morse['---'] = 'o' dict_morse['.--.'] = 'p' dict_morse['--.-'] = 'q' dict_morse['.-.'] = 'r' dict_morse['...'] = 's' dict_morse['-'] = 't' dict_morse['..-'] = 'u' dict_morse['...-'] = 'v' dict_morse['.--'] = 'w' dict_morse['-..-'] = 'x' dict_morse['-.--'] = 'y' dict_morse['--..'] = 'z' dict_morse['-----'] = '0' dict_morse['.----'] = '1' dict_morse['..---'] = '2' dict_morse['...--'] = '3' dict_morse['....-'] = '4' dict_morse['.....'] = '5' dict_morse['-....'] = '6' dict_morse['--...'] = '7' dict_morse['---..'] = '8' dict_morse['----.'] = '9' dict_morse['.-.-.-'] = '.' dict_morse['--..--'] = ',' dict_morse['..--..'] = '?' dict_morse['-.-.--'] = '!' dict_letters = dict() for key in dict_morse.keys(): dict_letters[dict_morse[key]] = key return (dict_letters, dict_morse) def convert_to(self, to_convert): """ Converts the given letter string to morse code """ to_convert = to_convert.lower() output = '|' for l in range(len(to_convert)): letter = to_convert[l] if letter == ' ': output += ' ' elif letter in self.__dict_to_morse.keys(): output += self.__dict_to_morse[letter] else: output += '*' output += '|' return output.strip() def convert_from(self, to_convert): """ Converts a morse string with spaces to the english letters """ # - Divy it up if to_convert.find('|') > -1: arr = to_convert.strip('|').split('|') else: arr = to_convert.strip().split(' ') output = '' for word in arr: output += self.convert_from_no_spaces(word, len(word)) return output def convert_from_no_spaces(self, to_convert, min_letters=1): """ Converts a string of . and -'s to Letters with no spaces/breaks """ cStr = '' outStr = '' for i in range(len(to_convert)): cStr += to_convert[i] if len(cStr) == min_letters: if cStr in self.__dict_from_morse.keys(): outStr += self.__dict_from_morse[cStr] else: outStr += ' ' cStr = '' return outStr
""" morse.py Class for converting between English and morse code @author: Douglas Daly @date: 1/6/2017 """ class Morse(object): """ Morse Code Translation Class """ def __init__(self): """ Default Constructor """ dict_tup = self.__generate_morse_code_dictionaries() self.__dict_to_morse = dict_tup[0] self.__dict_from_morse = dict_tup[1] def __generate_morse_code_dictionaries(self): """ Generates a dict object of Morse Code """ dict_morse = dict() dict_morse['.-'] = 'a' dict_morse['-...'] = 'b' dict_morse['-.-.'] = 'c' dict_morse['-..'] = 'd' dict_morse['.'] = 'e' dict_morse['..-.'] = 'f' dict_morse['--.'] = 'g' dict_morse['....'] = 'h' dict_morse['..'] = 'i' dict_morse['.---'] = 'j' dict_morse['-.-'] = 'k' dict_morse['.-..'] = 'l' dict_morse['--'] = 'm' dict_morse['-.'] = 'n' dict_morse['---'] = 'o' dict_morse['.--.'] = 'p' dict_morse['--.-'] = 'q' dict_morse['.-.'] = 'r' dict_morse['...'] = 's' dict_morse['-'] = 't' dict_morse['..-'] = 'u' dict_morse['...-'] = 'v' dict_morse['.--'] = 'w' dict_morse['-..-'] = 'x' dict_morse['-.--'] = 'y' dict_morse['--..'] = 'z' dict_morse['-----'] = '0' dict_morse['.----'] = '1' dict_morse['..---'] = '2' dict_morse['...--'] = '3' dict_morse['....-'] = '4' dict_morse['.....'] = '5' dict_morse['-....'] = '6' dict_morse['--...'] = '7' dict_morse['---..'] = '8' dict_morse['----.'] = '9' dict_morse['.-.-.-'] = '.' dict_morse['--..--'] = ',' dict_morse['..--..'] = '?' dict_morse['-.-.--'] = '!' dict_letters = dict() for key in dict_morse.keys(): dict_letters[dict_morse[key]] = key return (dict_letters, dict_morse) def convert_to(self, to_convert): """ Converts the given letter string to morse code """ to_convert = to_convert.lower() output = '|' for l in range(len(to_convert)): letter = to_convert[l] if letter == ' ': output += ' ' elif letter in self.__dict_to_morse.keys(): output += self.__dict_to_morse[letter] else: output += '*' output += '|' return output.strip() def convert_from(self, to_convert): """ Converts a morse string with spaces to the english letters """ if to_convert.find('|') > -1: arr = to_convert.strip('|').split('|') else: arr = to_convert.strip().split(' ') output = '' for word in arr: output += self.convert_from_no_spaces(word, len(word)) return output def convert_from_no_spaces(self, to_convert, min_letters=1): """ Converts a string of . and -'s to Letters with no spaces/breaks """ c_str = '' out_str = '' for i in range(len(to_convert)): c_str += to_convert[i] if len(cStr) == min_letters: if cStr in self.__dict_from_morse.keys(): out_str += self.__dict_from_morse[cStr] else: out_str += ' ' c_str = '' return outStr
class ResolveEventArgs(EventArgs): """ Provides data for loader resolution events,such as the System.AppDomain.TypeResolve,System.AppDomain.ResourceResolve,System.AppDomain.ReflectionOnlyAssemblyResolve,and System.AppDomain.AssemblyResolve events. ResolveEventArgs(name: str) ResolveEventArgs(name: str,requestingAssembly: Assembly) """ @staticmethod def __new__(self,name,requestingAssembly=None): """ __new__(cls: type,name: str) __new__(cls: type,name: str,requestingAssembly: Assembly) """ pass Name=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the name of the item to resolve. Get: Name(self: ResolveEventArgs) -> str """ RequestingAssembly=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the assembly whose dependency is being resolved. Get: RequestingAssembly(self: ResolveEventArgs) -> Assembly """
class Resolveeventargs(EventArgs): """ Provides data for loader resolution events,such as the System.AppDomain.TypeResolve,System.AppDomain.ResourceResolve,System.AppDomain.ReflectionOnlyAssemblyResolve,and System.AppDomain.AssemblyResolve events. ResolveEventArgs(name: str) ResolveEventArgs(name: str,requestingAssembly: Assembly) """ @staticmethod def __new__(self, name, requestingAssembly=None): """ __new__(cls: type,name: str) __new__(cls: type,name: str,requestingAssembly: Assembly) """ pass name = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Gets the name of the item to resolve.\n\n\n\nGet: Name(self: ResolveEventArgs) -> str\n\n\n\n' requesting_assembly = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Gets the assembly whose dependency is being resolved.\n\n\n\nGet: RequestingAssembly(self: ResolveEventArgs) -> Assembly\n\n\n\n'
def pesquisa_binaria(lista, item): baixo = 0 alto = len(lista) - 1 while baixo <= alto: meio = (baixo + alto) // 2 chute = lista[meio] if chute == item: return meio elif chute > item: alto = meio - 1 elif chute < item: baixo = meio + 1 return None if __name__ == '__main__': minha_lista = [x for x in range(101)] print(f'{pesquisa_binaria(minha_lista, 30)}') print(f'{pesquisa_binaria(minha_lista, 15)}') print(f'{pesquisa_binaria(minha_lista, 100)}') print(f'{pesquisa_binaria(minha_lista, 300)}') print(f'{pesquisa_binaria(minha_lista, 1)}') print(f'{pesquisa_binaria(minha_lista, 10)}') print(f'{pesquisa_binaria(minha_lista, 50)}') print(f'{pesquisa_binaria(minha_lista, 150)}')
def pesquisa_binaria(lista, item): baixo = 0 alto = len(lista) - 1 while baixo <= alto: meio = (baixo + alto) // 2 chute = lista[meio] if chute == item: return meio elif chute > item: alto = meio - 1 elif chute < item: baixo = meio + 1 return None if __name__ == '__main__': minha_lista = [x for x in range(101)] print(f'{pesquisa_binaria(minha_lista, 30)}') print(f'{pesquisa_binaria(minha_lista, 15)}') print(f'{pesquisa_binaria(minha_lista, 100)}') print(f'{pesquisa_binaria(minha_lista, 300)}') print(f'{pesquisa_binaria(minha_lista, 1)}') print(f'{pesquisa_binaria(minha_lista, 10)}') print(f'{pesquisa_binaria(minha_lista, 50)}') print(f'{pesquisa_binaria(minha_lista, 150)}')
# _*_coding : UTF_8_*_ # Author :Jie Shen # CreatTime :2022/1/17 20:53 class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class BuildTree: def __init__(self): pass def build_by_array(self, arr) -> ListNode: if arr is None or len(arr) == 0: return None head = ListNode(arr[0]) node = head for _ in range(1, len(arr)): node.next = ListNode(arr[_]) node = node.next return head def print_node(head: ListNode): print("node:", end="") if head is None: print(None) return while head is not None: print(head.val, end=",") head = head.next print() if __name__ == '__main__': arr = [1, 2, 3] b = BuildTree().build_by_array(arr) print_node(b)
class Listnode: def __init__(self, val=0, next=None): self.val = val self.next = next class Buildtree: def __init__(self): pass def build_by_array(self, arr) -> ListNode: if arr is None or len(arr) == 0: return None head = list_node(arr[0]) node = head for _ in range(1, len(arr)): node.next = list_node(arr[_]) node = node.next return head def print_node(head: ListNode): print('node:', end='') if head is None: print(None) return while head is not None: print(head.val, end=',') head = head.next print() if __name__ == '__main__': arr = [1, 2, 3] b = build_tree().build_by_array(arr) print_node(b)
# CAN THE WORD BE CONSTRUCTED? # Write a function 'can_construct(target, word_bank)' that accepts a # target string and an array of strings. # # The function should return a boolean indicating whether ot not the # 'target' can be constructed by concatenating elements of the 'word_bank' array. # # You may reuse elements of 'word_bank' as many times needed. # -------------------------------------- # A Brute force implementation # Time Complexity: O(n^m * m), extra "* m" on branch, i.e word_bank iteration we save suffix # Space Complexity: O(m^2) def can_construct_brute(target, word_bank): # Base condition - If target is empty string # it's always possible to create. if target == "": return True for word in word_bank: # We need to know if any word is a prefix # of the target & save the suffix, i.e remaing part if target.startswith(word): suffix = target[len(word):] if can_construct_brute(suffix, word_bank) == True: return True # Early return, if True. # Only after going through every word in word_bank, # we can be sure that target cannot be generated return False # -------------------------------------- # A DP implementation # Time Complexity: O(n*m *m) # Space Complexity: O(m^2) def can_construct_dp(target, word_bank, cache = {}): # First check if target word's status in cache already if target in cache: return cache[target] # Base condition if target == "": return True for word in word_bank: if target.startswith(word): suffix = target[len(word):] if can_construct_dp(suffix, word_bank, cache) == True: cache[target] = True return cache[target] # Early return, if True. cache[target] = False return cache[target] if __name__ == "__main__": print(can_construct_brute("abcdef", ["ab", "abc", "cd", "def", "abcd"])) # Output must be True. print(can_construct_brute("skateboard", ["bo", "rd", "ate", "t", "ska", "sk", "boar"])) # Output must be False. print(can_construct_brute("enterapotentpot", ["a", "p", "ent", "enter", "ot", "o", "t"])) # Output must be True. print(can_construct_dp("eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeef", [ "e", "ee", "eeee", "eeeeee", "eeeeeee", ])) # Output must be False.
def can_construct_brute(target, word_bank): if target == '': return True for word in word_bank: if target.startswith(word): suffix = target[len(word):] if can_construct_brute(suffix, word_bank) == True: return True return False def can_construct_dp(target, word_bank, cache={}): if target in cache: return cache[target] if target == '': return True for word in word_bank: if target.startswith(word): suffix = target[len(word):] if can_construct_dp(suffix, word_bank, cache) == True: cache[target] = True return cache[target] cache[target] = False return cache[target] if __name__ == '__main__': print(can_construct_brute('abcdef', ['ab', 'abc', 'cd', 'def', 'abcd'])) print(can_construct_brute('skateboard', ['bo', 'rd', 'ate', 't', 'ska', 'sk', 'boar'])) print(can_construct_brute('enterapotentpot', ['a', 'p', 'ent', 'enter', 'ot', 'o', 't'])) print(can_construct_dp('eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeef', ['e', 'ee', 'eeee', 'eeeeee', 'eeeeeee']))
class Mesh(object): 'Common class for all Mesh of the Finite Element Method.' def __init__(self): pass
class Mesh(object): """Common class for all Mesh of the Finite Element Method.""" def __init__(self): pass
# @Author Justin Noddell # def pagerank( G ): # params G *** a dict of pages and their respective links # returns a dict of pages and their respective pagerank values # # the purpose of this function is to execute the PageRank function def pagerank( G ): P = G.keys() # pages L = G.values() # links I = dict() # current PageRank estimate -- k:page, v:PageRank estimate R = dict() # better, resulting PageRank estimate -- k:page, v:PageRank estimate LAMBDA = 0.20 # chance of 'surprise me' button [go to random page] TAU = 0.02 # threshold of convergence # start each page to be equally likely, initialize R with values for p in P: I[p] = 1 / len(P) R[p] = 0 converged = False while not converged: converged = True # each page has a LAMBDA / len(P) chance of random selection for r in R: R[r] = LAMBDA / len(P) # Find the set of pages that such that (p, q) belong to L and q belongs to P for p in P: Q = [] for q in G[p]: if q in P and len(G[q]) > 0: Q.append( q ) if len(Q) > 0: for q in Q: delta = (1 - LAMBDA) * I[p] / len(Q) # Probability of of I[p] being at page p R[q] += delta else: for q in P: delta = (1 - LAMBDA) * I[p] / len(P) R[q] += delta # check for convergence for p in P: if abs(R[p] - I[p]) > TAU: converged = False # update PageRank estimate for r in R: I[r] = R[r] return R # def create_graph( src ): # params: src *** path to file detailing pages and links # returns a dict of pages and their respective links # # the purpose of this function is to take a text file as input, detailing pages and links, store and return that data def create_graph( src ): G = dict() infile = open( src, "r" ) # iterate by line for line in infile: page = "" link = "" tab_reached = False for letter in line: if ord(letter) == 9 or ord(letter) == 32: tab_reached = True elif not tab_reached: page = page + letter elif tab_reached and letter not in "\n": link = link + letter # add k, v to dict if page in G.keys(): G[page].append(link) else: G[page] = [link] # check if v exists as k if link not in G.keys(): G[link] = [] # close file infile.close() return G # def write_to_file(): # params R *** dict of pages and their PageRank values # does not return # # formats, writes results to output.txt def write_to_file( R ): outfile = open("output.txt", "w") for k, v in R.items(): output = k + "\t" + str(v) + "\n" outfile.write( output ) # close file outfile.close() # def main(): # params none # does not return # # execute the program def main(): G = create_graph( "connections.txt" ) R = pagerank( G ) write_to_file( R ) return 0 # call main main()
def pagerank(G): p = G.keys() l = G.values() i = dict() r = dict() lambda = 0.2 tau = 0.02 for p in P: I[p] = 1 / len(P) R[p] = 0 converged = False while not converged: converged = True for r in R: R[r] = LAMBDA / len(P) for p in P: q = [] for q in G[p]: if q in P and len(G[q]) > 0: Q.append(q) if len(Q) > 0: for q in Q: delta = (1 - LAMBDA) * I[p] / len(Q) R[q] += delta else: for q in P: delta = (1 - LAMBDA) * I[p] / len(P) R[q] += delta for p in P: if abs(R[p] - I[p]) > TAU: converged = False for r in R: I[r] = R[r] return R def create_graph(src): g = dict() infile = open(src, 'r') for line in infile: page = '' link = '' tab_reached = False for letter in line: if ord(letter) == 9 or ord(letter) == 32: tab_reached = True elif not tab_reached: page = page + letter elif tab_reached and letter not in '\n': link = link + letter if page in G.keys(): G[page].append(link) else: G[page] = [link] if link not in G.keys(): G[link] = [] infile.close() return G def write_to_file(R): outfile = open('output.txt', 'w') for (k, v) in R.items(): output = k + '\t' + str(v) + '\n' outfile.write(output) outfile.close() def main(): g = create_graph('connections.txt') r = pagerank(G) write_to_file(R) return 0 main()
''' MSDP Genie Ops Object Outputs for IOSXE ''' class MsdpOutput(object): # 'show ip msdp peer' ShowIpMsdpPeer = { 'vrf': { 'default': { 'peer': { '10.1.100.4': { 'session_state': 'Up', 'peer_as': 1, 'resets': '0', 'connect_source': 'Loopback0', 'connect_source_address': '10.1.100.2', 'elapsed_time': '00:41:18', 'statistics': { 'queue': { 'size_in': 0, 'size_out': 0 }, 'sent': { 'data_message': 42, 'sa_message': 0, 'sa_response': 0, 'data_packets': 0 }, 'received': { 'data_message': 50, 'sa_message': 27, 'sa_request': 0, 'data_packets': 6 }, 'established_transitions': 1, 'output_msg_discarded': 0, 'error': { 'rpf_failure': 27 } }, 'conn_count_cleared': '00:43:22', 'sa_filter': { 'in': { '(S,G)': { 'filter': 'none', 'route_map': 'none' }, 'RP': { 'filter': 'none', 'route_map': 'none' } }, 'out': { '(S,G)': { 'filter': 'none', 'route_map': 'none' }, 'RP': { 'filter': 'none', 'route_map': 'none' } } }, 'sa_request': { 'input_filter': 'none' }, 'ttl_threshold': 0, 'sa_learned_from': 0, 'signature_protection': False}}}}} # 'show ip msdp sa-cache' ShowIpMsdpSaCache = { 'vrf': { 'default': { 'num_of_sa_cache': 1, 'sa_cache': { '225.1.1.1 10.3.3.18': { 'group': '225.1.1.1', 'source_addr': '10.3.3.18', 'up_time': '00:00:10', 'expire': '00:05:49', 'peer_as': 3, 'peer': '10.1.100.4', 'origin_rp': { '10.3.100.8': { 'rp_address': '10.3.100.8'}}, 'peer_learned_from': '10.1.100.4', 'rpf_peer': '10.1.100.4', 'statistics': { 'received': { 'sa': 1, 'encapsulated_data_received': 1}}}}}}} MsdpInfo = { 'vrf': { 'default': { 'peer': { '10.1.100.4': { 'connect_source': 'Loopback0', 'elapsed_time': '00:41:18', 'peer_as': 1, 'session_state': 'established', 'statistics': { 'error': { 'rpf_failure': 27}, 'queue': { 'size_in': 0, 'size_out': 0}, 'received': { 'sa_message': 27, 'sa_request': 0}, 'sent': { 'sa_message': 0, 'sa_response': 0}}, 'ttl_threshold': 0}}, 'sa_cache': { '225.1.1.1 10.3.3.18': { 'expire': '00:05:49', 'group': '225.1.1.1', 'origin_rp': { '10.3.100.8': { 'rp_address': '10.3.100.8'}}, 'peer_learned_from': '10.1.100.4', 'rpf_peer': '10.1.100.4', 'source_addr': '10.3.3.18', 'up_time': '00:00:10'}}}}}
""" MSDP Genie Ops Object Outputs for IOSXE """ class Msdpoutput(object): show_ip_msdp_peer = {'vrf': {'default': {'peer': {'10.1.100.4': {'session_state': 'Up', 'peer_as': 1, 'resets': '0', 'connect_source': 'Loopback0', 'connect_source_address': '10.1.100.2', 'elapsed_time': '00:41:18', 'statistics': {'queue': {'size_in': 0, 'size_out': 0}, 'sent': {'data_message': 42, 'sa_message': 0, 'sa_response': 0, 'data_packets': 0}, 'received': {'data_message': 50, 'sa_message': 27, 'sa_request': 0, 'data_packets': 6}, 'established_transitions': 1, 'output_msg_discarded': 0, 'error': {'rpf_failure': 27}}, 'conn_count_cleared': '00:43:22', 'sa_filter': {'in': {'(S,G)': {'filter': 'none', 'route_map': 'none'}, 'RP': {'filter': 'none', 'route_map': 'none'}}, 'out': {'(S,G)': {'filter': 'none', 'route_map': 'none'}, 'RP': {'filter': 'none', 'route_map': 'none'}}}, 'sa_request': {'input_filter': 'none'}, 'ttl_threshold': 0, 'sa_learned_from': 0, 'signature_protection': False}}}}} show_ip_msdp_sa_cache = {'vrf': {'default': {'num_of_sa_cache': 1, 'sa_cache': {'225.1.1.1 10.3.3.18': {'group': '225.1.1.1', 'source_addr': '10.3.3.18', 'up_time': '00:00:10', 'expire': '00:05:49', 'peer_as': 3, 'peer': '10.1.100.4', 'origin_rp': {'10.3.100.8': {'rp_address': '10.3.100.8'}}, 'peer_learned_from': '10.1.100.4', 'rpf_peer': '10.1.100.4', 'statistics': {'received': {'sa': 1, 'encapsulated_data_received': 1}}}}}}} msdp_info = {'vrf': {'default': {'peer': {'10.1.100.4': {'connect_source': 'Loopback0', 'elapsed_time': '00:41:18', 'peer_as': 1, 'session_state': 'established', 'statistics': {'error': {'rpf_failure': 27}, 'queue': {'size_in': 0, 'size_out': 0}, 'received': {'sa_message': 27, 'sa_request': 0}, 'sent': {'sa_message': 0, 'sa_response': 0}}, 'ttl_threshold': 0}}, 'sa_cache': {'225.1.1.1 10.3.3.18': {'expire': '00:05:49', 'group': '225.1.1.1', 'origin_rp': {'10.3.100.8': {'rp_address': '10.3.100.8'}}, 'peer_learned_from': '10.1.100.4', 'rpf_peer': '10.1.100.4', 'source_addr': '10.3.3.18', 'up_time': '00:00:10'}}}}}
word = input() while not word == "end": print(f"{word} = {word[::-1]}") word = input() # text = input() # while text != "end": # text_reversed = "" # for ch in reversed(text): # text_reversed += ch # print(text + " = " + text_reversed) # text = input()
word = input() while not word == 'end': print(f'{word} = {word[::-1]}') word = input()
entrada = int(input()) for i in range(0, entrada): A, B = input().split(" ") x, y = int(A), int(B) if y == 0: print("divisao impossivel") else: resultado = x / y print(f"{resultado:.1f}")
entrada = int(input()) for i in range(0, entrada): (a, b) = input().split(' ') (x, y) = (int(A), int(B)) if y == 0: print('divisao impossivel') else: resultado = x / y print(f'{resultado:.1f}')
""" Common functions for protocols. Protocols define, how the communication with a backend service works. They usually come with a FactoryFromService class, that adapts the backend service interface, and implements a factory interface. """
""" Common functions for protocols. Protocols define, how the communication with a backend service works. They usually come with a FactoryFromService class, that adapts the backend service interface, and implements a factory interface. """
def generate_state(state, desired_len): while len(state) < desired_len: b = "".join(str((int(s) + 1) % 2) for s in reversed(state)) state = state + "0" + b return state[:desired_len] def checksum(state): res = [] f = True while f or len(state) % 2 == 0: f = False res = [] for i in range(len(state) // 2): res.append(1 if state[i * 2] == state[i * 2 + 1] else 0) state = res return "".join(map(str, res)) if __name__ == '__main__': print(checksum(generate_state("10111100110001111", 272))) print(checksum(generate_state("10111100110001111", 35651584)))
def generate_state(state, desired_len): while len(state) < desired_len: b = ''.join((str((int(s) + 1) % 2) for s in reversed(state))) state = state + '0' + b return state[:desired_len] def checksum(state): res = [] f = True while f or len(state) % 2 == 0: f = False res = [] for i in range(len(state) // 2): res.append(1 if state[i * 2] == state[i * 2 + 1] else 0) state = res return ''.join(map(str, res)) if __name__ == '__main__': print(checksum(generate_state('10111100110001111', 272))) print(checksum(generate_state('10111100110001111', 35651584)))
SCHEDULE_NONE = None SCHEDULE_HOURLY = '0 * * * *' SCHEDULE_DAILY = '0 0 * * *' SCHEDULE_WEEKLY = '0 0 * * 0' SCHEDULE_MONTHLY = '0 0 1 * *' SCHEDULE_YEARLY = '0 0 1 1 *'
schedule_none = None schedule_hourly = '0 * * * *' schedule_daily = '0 0 * * *' schedule_weekly = '0 0 * * 0' schedule_monthly = '0 0 1 * *' schedule_yearly = '0 0 1 1 *'
l = [*map(int, input().split())] r = 0 for i in l: if i > 0: r += 1 print(r)
l = [*map(int, input().split())] r = 0 for i in l: if i > 0: r += 1 print(r)
class Carbure: SUCCESS = "success" ERROR = "error" class CarbureError: INVALID_REGISTRATION_FORM = "Invalid registration form" INVALID_LOGIN_CREDENTIALS = "Invalid login or password" ACCOUNT_NOT_ACTIVATED = "Account not activated" OTP_EXPIRED_CODE = "OTP Code Expired" OTP_INVALID_CODE = "OTP Code Invalid" OTP_RATE_LIMITED = "OTP Rate Limited" OTP_UNKNOWN_ERROR = "OTP Unknown Error" OTP_INVALID_FORM = "OTP Invalid Form" PASSWORD_RESET_USER_NOT_FOUND = "User not found" PASSWORD_RESET_INVALID_FORM = "Password reset invalid form" PASSWORD_RESET_MISMATCH = "Passwords do not match" ACTIVATION_LINK_ERROR = "Could not send activation link" ACTIVATION_LINK_INVALID_FORM = "Activation link invalid form" ACTIVATION_COULD_NOT_ACTIVATE_USER = "Could not activate user account"
class Carbure: success = 'success' error = 'error' class Carbureerror: invalid_registration_form = 'Invalid registration form' invalid_login_credentials = 'Invalid login or password' account_not_activated = 'Account not activated' otp_expired_code = 'OTP Code Expired' otp_invalid_code = 'OTP Code Invalid' otp_rate_limited = 'OTP Rate Limited' otp_unknown_error = 'OTP Unknown Error' otp_invalid_form = 'OTP Invalid Form' password_reset_user_not_found = 'User not found' password_reset_invalid_form = 'Password reset invalid form' password_reset_mismatch = 'Passwords do not match' activation_link_error = 'Could not send activation link' activation_link_invalid_form = 'Activation link invalid form' activation_could_not_activate_user = 'Could not activate user account'
### Score - Linux P1_Wins = 0 CPU_Wins = 0 Game_Draws = 0
p1__wins = 0 cpu__wins = 0 game__draws = 0
# Merge Sort ''' Divide and Conquer Algorithm -> Divide: Divide equally until one element: each individual element is sorted -> Conquer: Combine elements by comparing ''' # Conquer def merge(arr,low,mid,high): # Create two arrays for two halves n1 = mid - low + 1; n2 = high - mid; # Declaring empty arrays Left = list() Right = list() for i in range(n1): Left.append(0) for j in range(n2): Right.append(0) # Creating left array for i in range(0,n1): Left[i] = arr[low+i] # Creating right array for j in range(0,n2): Right[j] = arr[mid+1+j] # Merging Both arrays i=0 j=0 k=low while (i<n1) and (j<n2): if(Left[i]<=Right[j]): arr[k]=Left[i] i = i+i else: arr[k]=Right[j] j = j+1 k=k+1 # Adding left over elements from both array if any while(i<n1): arr[k]=Left[i] i=i+1 k=k+1 while(j<n2): arr[k]=Right[j] j=j+1 k=k+1 # Divide def mergesort(array,low,high): if(low<high): mid = int((low+high)/2) mergesort(array,low,mid) mergesort(array,mid+1,high) merge(array,low,mid,high) # Driver Code print("Enter Array as space separated values: ") array = list(map(int,input().split(' '))) high = len(array)-1 mergesort(array,0,high) # Display Sorted Array print(array)
""" Divide and Conquer Algorithm -> Divide: Divide equally until one element: each individual element is sorted -> Conquer: Combine elements by comparing """ def merge(arr, low, mid, high): n1 = mid - low + 1 n2 = high - mid left = list() right = list() for i in range(n1): Left.append(0) for j in range(n2): Right.append(0) for i in range(0, n1): Left[i] = arr[low + i] for j in range(0, n2): Right[j] = arr[mid + 1 + j] i = 0 j = 0 k = low while i < n1 and j < n2: if Left[i] <= Right[j]: arr[k] = Left[i] i = i + i else: arr[k] = Right[j] j = j + 1 k = k + 1 while i < n1: arr[k] = Left[i] i = i + 1 k = k + 1 while j < n2: arr[k] = Right[j] j = j + 1 k = k + 1 def mergesort(array, low, high): if low < high: mid = int((low + high) / 2) mergesort(array, low, mid) mergesort(array, mid + 1, high) merge(array, low, mid, high) print('Enter Array as space separated values: ') array = list(map(int, input().split(' '))) high = len(array) - 1 mergesort(array, 0, high) print(array)
class Solution: def wordBreak(self, s, wordDict): """ :type s: str :type wordDict: List[str] :rtype: bool """ # iterative visited = [0] * (len(s) + 1) stack = [0] while stack: cur = stack.pop() print(cur) if visited[cur] or cur > len(s) + 1: continue visited[cur] = 1 if cur == len(s): return True for w in wordDict: if s[cur:].startswith(w): stack.append(cur + len(w)) return False # recursive # ret = False # visited = set() # def traverse(pos): # nonlocal wordDict, visited # if pos in visited: # return # visited.add(pos) # if pos == len(s): # ret = True # if pos >= len(s): # return # for w in wordDict: # cur = s[pos:] # if w in cur and cur.index(w) == 0: # traverse(pos + len(w)) # traverse(0) # return ret
class Solution: def word_break(self, s, wordDict): """ :type s: str :type wordDict: List[str] :rtype: bool """ visited = [0] * (len(s) + 1) stack = [0] while stack: cur = stack.pop() print(cur) if visited[cur] or cur > len(s) + 1: continue visited[cur] = 1 if cur == len(s): return True for w in wordDict: if s[cur:].startswith(w): stack.append(cur + len(w)) return False
DEFAULT_EQUIPMENT = [ ("Dumbbells","Generic dumbbells."), ("Barbell","Generic barbell with plate weights."), ("Squat Rack","Generic squat rack."), ("Leg Curl Machine","Generic machine to do leg curls on."), ("Leg Extension Machine","Generic machine to do leg extensions on."), ("Pull up bar","Generic horizontal bar to perform pull ups, chin ups, and other modified grip exercises."), ("Flat Bench","Generic horizontal bench that lies flat, can be adjustable."), ("Incline Bench","Generic weight bench that lies inclined, can be adjustable."), ("Upright Bench","Generic bench that sits at a 90 degree angle. Can be adjustable. Often used for seated military press."), ("Adjustable Bench","Generic weight bench that can have an adjustable angle."), ("Seated Cable Row Machine","Cabled machine for performing seated rows and other exercises."), ("Overhead Cable Machine","Cabled machine with a pulley mounted overhead for performing pulldowns and other exercises, pulley location may be adjustable."), ("Adjustable Cable Machine","Cabled machine with a pulley mounted at an ajustable location, used for many exercises."), ("Cable Fly Machine","Cabled machine to perform chest flys with."), ("Swiss Ball","Generic swiss ball."), ("Medicine Ball","Generic medicine ball."), ("Bosu Ball","Generic bosu ball."), ("Resistance Band","Generic resistance band."), ("Treadmill","Generic treadmill for running."), ("Stepper","Generic stepper machine."), ("Elliptical","Generic elliptical."), ("Erg Machine","Generic erg rowing machine."), ("Rope","Generic thick rope.") ]
default_equipment = [('Dumbbells', 'Generic dumbbells.'), ('Barbell', 'Generic barbell with plate weights.'), ('Squat Rack', 'Generic squat rack.'), ('Leg Curl Machine', 'Generic machine to do leg curls on.'), ('Leg Extension Machine', 'Generic machine to do leg extensions on.'), ('Pull up bar', 'Generic horizontal bar to perform pull ups, chin ups, and other modified grip exercises.'), ('Flat Bench', 'Generic horizontal bench that lies flat, can be adjustable.'), ('Incline Bench', 'Generic weight bench that lies inclined, can be adjustable.'), ('Upright Bench', 'Generic bench that sits at a 90 degree angle. Can be adjustable. Often used for seated military press.'), ('Adjustable Bench', 'Generic weight bench that can have an adjustable angle.'), ('Seated Cable Row Machine', 'Cabled machine for performing seated rows and other exercises.'), ('Overhead Cable Machine', 'Cabled machine with a pulley mounted overhead for performing pulldowns and other exercises, pulley location may be adjustable.'), ('Adjustable Cable Machine', 'Cabled machine with a pulley mounted at an ajustable location, used for many exercises.'), ('Cable Fly Machine', 'Cabled machine to perform chest flys with.'), ('Swiss Ball', 'Generic swiss ball.'), ('Medicine Ball', 'Generic medicine ball.'), ('Bosu Ball', 'Generic bosu ball.'), ('Resistance Band', 'Generic resistance band.'), ('Treadmill', 'Generic treadmill for running.'), ('Stepper', 'Generic stepper machine.'), ('Elliptical', 'Generic elliptical.'), ('Erg Machine', 'Generic erg rowing machine.'), ('Rope', 'Generic thick rope.')]
d = {2:0, 3:0, 4:0, 5:0} input() v = [int(x) for x in input().split()] for i in v: if i % 2 == 0: d[2] += 1 if i % 3 == 0: d[3] += 1 if i % 4 == 0: d[4] += 1 if i % 5 == 0: d[5] += 1 print(d[2], 'Multiplo(s) de 2') print(d[3], 'Multiplo(s) de 3') print(d[4], 'Multiplo(s) de 4') print(d[5], 'Multiplo(s) de 5')
d = {2: 0, 3: 0, 4: 0, 5: 0} input() v = [int(x) for x in input().split()] for i in v: if i % 2 == 0: d[2] += 1 if i % 3 == 0: d[3] += 1 if i % 4 == 0: d[4] += 1 if i % 5 == 0: d[5] += 1 print(d[2], 'Multiplo(s) de 2') print(d[3], 'Multiplo(s) de 3') print(d[4], 'Multiplo(s) de 4') print(d[5], 'Multiplo(s) de 5')
# Single line Comment """ Multi line Comment 1 Multi line Comment 2 """ print("Hello") print("Hello World") # By default end is new line charcter \n print("Hello", end=' & ') print("Hello World") print("Hello","Hello World", end=' ') print('Bye') print('Harry is \ngood boy ! Yes\t!') # \t for tab (6 spaces) , \' , \" print(' ')
""" Multi line Comment 1 Multi line Comment 2 """ print('Hello') print('Hello World') print('Hello', end=' & ') print('Hello World') print('Hello', 'Hello World', end=' ') print('Bye') print('Harry is \ngood boy ! Yes\t!') print(' ')
""" Space : O(1) Time : O(n) """ class NumArray: def __init__(self, nums: List[int]): self.nums = nums def update(self, i: int, val: int) -> None: self.nums[i] = val def sumRange(self, i: int, j: int) -> int: return sum(self.nums[i:j+1]) # Your NumArray object will be instantiated and called as such: # obj = NumArray(nums) # obj.update(i,val) # param_2 = obj.sumRange(i,j)
""" Space : O(1) Time : O(n) """ class Numarray: def __init__(self, nums: List[int]): self.nums = nums def update(self, i: int, val: int) -> None: self.nums[i] = val def sum_range(self, i: int, j: int) -> int: return sum(self.nums[i:j + 1])
def findDecision(obj): #obj[0]: Passanger, obj[1]: Weather, obj[2]: Time, obj[3]: Coupon, obj[4]: Coupon_validity, obj[5]: Gender, obj[6]: Age, obj[7]: Children, obj[8]: Education, obj[9]: Occupation, obj[10]: Income, obj[11]: Bar, obj[12]: Coffeehouse, obj[13]: Restaurant20to50, obj[14]: Direction_same, obj[15]: Distance # {"feature": "Income", "instances": 34, "metric_value": 0.99, "depth": 1} if obj[10]<=5: # {"feature": "Restaurant20to50", "instances": 25, "metric_value": 0.9896, "depth": 2} if obj[13]<=2.0: # {"feature": "Coffeehouse", "instances": 22, "metric_value": 0.9457, "depth": 3} if obj[12]<=3.0: # {"feature": "Occupation", "instances": 19, "metric_value": 0.9819, "depth": 4} if obj[9]>5: # {"feature": "Coupon", "instances": 12, "metric_value": 0.8113, "depth": 5} if obj[3]>3: return 'False' elif obj[3]<=3: # {"feature": "Coupon_validity", "instances": 5, "metric_value": 0.971, "depth": 6} if obj[4]<=0: return 'True' elif obj[4]>0: return 'False' else: return 'False' else: return 'True' elif obj[9]<=5: # {"feature": "Coupon", "instances": 7, "metric_value": 0.8631, "depth": 5} if obj[3]>0: return 'True' elif obj[3]<=0: return 'False' else: return 'False' else: return 'True' elif obj[12]>3.0: return 'False' else: return 'False' elif obj[13]>2.0: return 'True' else: return 'True' elif obj[10]>5: # {"feature": "Occupation", "instances": 9, "metric_value": 0.5033, "depth": 2} if obj[9]>0: return 'True' elif obj[9]<=0: return 'False' else: return 'False' else: return 'True'
def find_decision(obj): if obj[10] <= 5: if obj[13] <= 2.0: if obj[12] <= 3.0: if obj[9] > 5: if obj[3] > 3: return 'False' elif obj[3] <= 3: if obj[4] <= 0: return 'True' elif obj[4] > 0: return 'False' else: return 'False' else: return 'True' elif obj[9] <= 5: if obj[3] > 0: return 'True' elif obj[3] <= 0: return 'False' else: return 'False' else: return 'True' elif obj[12] > 3.0: return 'False' else: return 'False' elif obj[13] > 2.0: return 'True' else: return 'True' elif obj[10] > 5: if obj[9] > 0: return 'True' elif obj[9] <= 0: return 'False' else: return 'False' else: return 'True'
def test_limits(client): """Make sure that requesting resources with limits return a slice of the result.""" for i in range(100): badge = client.post("/api/event/1/badge", json={ "legal_name": "Test User {}".format(i) }).json assert(badge['legal_name'] == "Test User {}".format(i)) badges = client.get("/api/event/1/badge", query_string={"limit": 10}).json assert(len(badges) == 10) def test_offset(client): """Make sure that requesting resources with offsets return the correct range of data.""" for i in range(100): badge = client.post("/api/event/1/badge", json={ "legal_name": "Test User {}".format(i) }).json assert(badge['legal_name'] == "Test User {}".format(i)) badges = client.get("/api/event/1/badge", query_string={"offset": 10, "limit": 5, "full": True}).json assert(len(badges) == 5) assert(badges[0]["legal_name"] == "Test User 10") # Test with the default limit of 10 badges = client.get("/api/event/1/badge", query_string={"offset": 20, "full": True}).json assert(len(badges) == 10) assert(badges[0]["legal_name"] == "Test User 20") def test_page(client): """Make sure that requesting resources with pagination return the correct data.""" for i in range(100): badge = client.post("/api/event/1/badge", json={ "legal_name": "Test User {}".format(i) }).json assert(badge['legal_name'] == "Test User {}".format(i)) badges = client.get("/api/event/1/badge", query_string={"page": 3, "limit": 15, "full": True}).json assert(len(badges) == 15) assert(badges[0]["legal_name"] == "Test User 45") # Test with the default limit of 10 badges = client.get("/api/event/1/badge", query_string={"page": 5, "full": True}).json assert(len(badges) == 10) assert(badges[0]["legal_name"] == "Test User 50")
def test_limits(client): """Make sure that requesting resources with limits return a slice of the result.""" for i in range(100): badge = client.post('/api/event/1/badge', json={'legal_name': 'Test User {}'.format(i)}).json assert badge['legal_name'] == 'Test User {}'.format(i) badges = client.get('/api/event/1/badge', query_string={'limit': 10}).json assert len(badges) == 10 def test_offset(client): """Make sure that requesting resources with offsets return the correct range of data.""" for i in range(100): badge = client.post('/api/event/1/badge', json={'legal_name': 'Test User {}'.format(i)}).json assert badge['legal_name'] == 'Test User {}'.format(i) badges = client.get('/api/event/1/badge', query_string={'offset': 10, 'limit': 5, 'full': True}).json assert len(badges) == 5 assert badges[0]['legal_name'] == 'Test User 10' badges = client.get('/api/event/1/badge', query_string={'offset': 20, 'full': True}).json assert len(badges) == 10 assert badges[0]['legal_name'] == 'Test User 20' def test_page(client): """Make sure that requesting resources with pagination return the correct data.""" for i in range(100): badge = client.post('/api/event/1/badge', json={'legal_name': 'Test User {}'.format(i)}).json assert badge['legal_name'] == 'Test User {}'.format(i) badges = client.get('/api/event/1/badge', query_string={'page': 3, 'limit': 15, 'full': True}).json assert len(badges) == 15 assert badges[0]['legal_name'] == 'Test User 45' badges = client.get('/api/event/1/badge', query_string={'page': 5, 'full': True}).json assert len(badges) == 10 assert badges[0]['legal_name'] == 'Test User 50'
# cook your dish here try: n = int(input()) print(n) except: pass
try: n = int(input()) print(n) except: pass
a, b = map(int, input().split()) if a+b < 24: print(a+b) else: print((a+b)-24)
(a, b) = map(int, input().split()) if a + b < 24: print(a + b) else: print(a + b - 24)
class Dog: """A simple attempt to model a dog""" def __init__(self, name, age): """Initialize name and age attributes""" self.name=name self.age=age def sit(self): """Simulate a dog sitting in response to a command""" print(f"{self.name} is now sitting") def roll_over(self): """Simulate rolling over in response to a command""" print(f"{self.name} rolled over!") def run(self): """Simulate the dog running in response to a command""" print(f"The {self.age} old Dog is now running")
class Dog: """A simple attempt to model a dog""" def __init__(self, name, age): """Initialize name and age attributes""" self.name = name self.age = age def sit(self): """Simulate a dog sitting in response to a command""" print(f'{self.name} is now sitting') def roll_over(self): """Simulate rolling over in response to a command""" print(f'{self.name} rolled over!') def run(self): """Simulate the dog running in response to a command""" print(f'The {self.age} old Dog is now running')
# # PySNMP MIB module POLICY-DEVICE-AUX-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/POLICY-DEVICE-AUX-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:41:12 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsIntersection, ConstraintsUnion, ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint") InterfaceIndex, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex") SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString") ObjectGroup, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup") experimental, iso, MibIdentifier, IpAddress, TimeTicks, Gauge32, ModuleIdentity, Counter32, ObjectIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, NotificationType, Integer32, Unsigned32, Bits, Counter64 = mibBuilder.importSymbols("SNMPv2-SMI", "experimental", "iso", "MibIdentifier", "IpAddress", "TimeTicks", "Gauge32", "ModuleIdentity", "Counter32", "ObjectIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "NotificationType", "Integer32", "Unsigned32", "Bits", "Counter64") RowStatus, TextualConvention, StorageType, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "TextualConvention", "StorageType", "DisplayString") policyDeviceAuxMib = ModuleIdentity((1, 3, 6, 1, 3, 999)) if mibBuilder.loadTexts: policyDeviceAuxMib.setLastUpdated('200007121800Z') if mibBuilder.loadTexts: policyDeviceAuxMib.setOrganization('IETF RAP WG') if mibBuilder.loadTexts: policyDeviceAuxMib.setContactInfo('Kwok Ho Chan Nortel Networks, Inc. 600 Technology Park Drive Billerica, MA 01821 USA Phone: +1 978 288 8175 Email: [email protected] John Seligson Nortel Networks, Inc. 4401 Great America Parkway Santa Clara, CA USA 95054 Phone: +1 408 495-2992 Email: [email protected] Keith McCloghrie Cisco Systems, Inc. 170 West Tasman Drive, San Jose, CA 95134-1706 USA Phone: +1 408 526 5260 Email: [email protected]') if mibBuilder.loadTexts: policyDeviceAuxMib.setDescription('This module defines an infrastructure used for support of policy-based provisioning of a network device.') policyDeviceAuxObjects = MibIdentifier((1, 3, 6, 1, 3, 999, 1)) policyDeviceAuxConformance = MibIdentifier((1, 3, 6, 1, 3, 999, 2)) policyDeviceConfig = MibIdentifier((1, 3, 6, 1, 3, 999, 1, 1)) class Role(TextualConvention, OctetString): reference = 'Policy Core Information Model, draft-ietf-policy-core-info-model-06.txt' description = 'A role represents a functionality characteristic or capability of a resource to which policies are applied. Examples of roles include Backbone interface, Frame Relay interface, BGP-capable router, web server, firewall, etc. Valid characters are a-z, A-Z, 0-9, period, hyphen and underscore. A role must not start with an underscore.' status = 'current' subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(1, 31) class RoleCombination(TextualConvention, OctetString): description = "A Display string consisting of a set of roles concatenated with a '+' character where the roles are in lexicographic order from minimum to maximum. For example, a+b and b+a are NOT different role-combinations; rather, they are different formating of the same (one) role- combination. Notice the roles within a role-combination are in lexicographic order from minimum to maximum, hence, we declare: a+b is the valid formating of the role-combination, b+a is an invalid formating of the role-combination. Notice the need of zero-length role-combination as the role- combination of interfaces to which no roles have been assigned. This role-combination is also known as the null role-combination. (Note the deliberate use of lower case leters to avoid confusion with the ASCII NULL character which has a value of zero but length of one.)" status = 'current' subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(0, 255) policyInterfaceTable = MibTable((1, 3, 6, 1, 3, 999, 1, 1, 1), ) if mibBuilder.loadTexts: policyInterfaceTable.setStatus('current') if mibBuilder.loadTexts: policyInterfaceTable.setDescription("Policy information about a device's interfaces.") policyInterfaceEntry = MibTableRow((1, 3, 6, 1, 3, 999, 1, 1, 1, 1), ).setIndexNames((0, "POLICY-DEVICE-AUX-MIB", "policyInterfaceIfIndex")) if mibBuilder.loadTexts: policyInterfaceEntry.setStatus('current') if mibBuilder.loadTexts: policyInterfaceEntry.setDescription('A conceptual row in the policyInterfaceTable. Each row identifies policy infromation about a particular interface.') policyInterfaceIfIndex = MibTableColumn((1, 3, 6, 1, 3, 999, 1, 1, 1, 1, 1), InterfaceIndex()) if mibBuilder.loadTexts: policyInterfaceIfIndex.setStatus('current') if mibBuilder.loadTexts: policyInterfaceIfIndex.setDescription('The ifIndex value for which this conceptual row provides policy information.') policyInterfaceRoleCombo = MibTableColumn((1, 3, 6, 1, 3, 999, 1, 1, 1, 1, 2), RoleCombination()).setMaxAccess("readcreate") if mibBuilder.loadTexts: policyInterfaceRoleCombo.setStatus('current') if mibBuilder.loadTexts: policyInterfaceRoleCombo.setDescription('The role combination that is associated with this interface for the purpose of assigning policies to this interface.') policyInterfaceStorage = MibTableColumn((1, 3, 6, 1, 3, 999, 1, 1, 1, 1, 3), StorageType().clone('volatile')).setMaxAccess("readcreate") if mibBuilder.loadTexts: policyInterfaceStorage.setStatus('current') if mibBuilder.loadTexts: policyInterfaceStorage.setDescription('The storage type for this conceptual row. Conceptual rows having the value permanent(4) need not allow write-access to any columnar objects in the row. This object may not be modified if the associated policyInterfaceStatus object is equal to active(1).') policyInterfaceStatus = MibTableColumn((1, 3, 6, 1, 3, 999, 1, 1, 1, 1, 4), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: policyInterfaceStatus.setStatus('current') if mibBuilder.loadTexts: policyInterfaceStatus.setDescription('The status of this row. An entry may not exist in the active state unless all objects in the entry have an appropriate value. Row creation using only default values is supported.') policyDeviceCompliances = MibIdentifier((1, 3, 6, 1, 3, 999, 2, 1)) policyDeviceGroups = MibIdentifier((1, 3, 6, 1, 3, 999, 2, 2)) policyDeviceCompliance = ModuleCompliance((1, 3, 6, 1, 3, 999, 2, 1, 1)).setObjects(("POLICY-DEVICE-AUX-MIB", "policyInterfaceGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): policyDeviceCompliance = policyDeviceCompliance.setStatus('current') if mibBuilder.loadTexts: policyDeviceCompliance.setDescription('Describes the requirements for conformance to the Policy Auxiliary MIB.') policyInterfaceGroup = ObjectGroup((1, 3, 6, 1, 3, 999, 2, 2, 1)).setObjects(("POLICY-DEVICE-AUX-MIB", "policyInterfaceRoleCombo"), ("POLICY-DEVICE-AUX-MIB", "policyInterfaceStorage"), ("POLICY-DEVICE-AUX-MIB", "policyInterfaceStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): policyInterfaceGroup = policyInterfaceGroup.setStatus('current') if mibBuilder.loadTexts: policyInterfaceGroup.setDescription('Objects used to define interface to role combination mappings.') mibBuilder.exportSymbols("POLICY-DEVICE-AUX-MIB", policyInterfaceRoleCombo=policyInterfaceRoleCombo, Role=Role, policyInterfaceStatus=policyInterfaceStatus, policyDeviceConfig=policyDeviceConfig, policyInterfaceEntry=policyInterfaceEntry, policyInterfaceGroup=policyInterfaceGroup, policyDeviceCompliance=policyDeviceCompliance, RoleCombination=RoleCombination, policyDeviceAuxConformance=policyDeviceAuxConformance, policyDeviceAuxMib=policyDeviceAuxMib, policyInterfaceIfIndex=policyInterfaceIfIndex, policyInterfaceStorage=policyInterfaceStorage, policyDeviceGroups=policyDeviceGroups, policyDeviceAuxObjects=policyDeviceAuxObjects, policyDeviceCompliances=policyDeviceCompliances, policyInterfaceTable=policyInterfaceTable, PYSNMP_MODULE_ID=policyDeviceAuxMib)
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, value_range_constraint, value_size_constraint, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'ConstraintsUnion', 'ValueRangeConstraint', 'ValueSizeConstraint', 'SingleValueConstraint') (interface_index,) = mibBuilder.importSymbols('IF-MIB', 'InterfaceIndex') (snmp_admin_string,) = mibBuilder.importSymbols('SNMP-FRAMEWORK-MIB', 'SnmpAdminString') (object_group, module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ObjectGroup', 'ModuleCompliance', 'NotificationGroup') (experimental, iso, mib_identifier, ip_address, time_ticks, gauge32, module_identity, counter32, object_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, notification_type, integer32, unsigned32, bits, counter64) = mibBuilder.importSymbols('SNMPv2-SMI', 'experimental', 'iso', 'MibIdentifier', 'IpAddress', 'TimeTicks', 'Gauge32', 'ModuleIdentity', 'Counter32', 'ObjectIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'NotificationType', 'Integer32', 'Unsigned32', 'Bits', 'Counter64') (row_status, textual_convention, storage_type, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'RowStatus', 'TextualConvention', 'StorageType', 'DisplayString') policy_device_aux_mib = module_identity((1, 3, 6, 1, 3, 999)) if mibBuilder.loadTexts: policyDeviceAuxMib.setLastUpdated('200007121800Z') if mibBuilder.loadTexts: policyDeviceAuxMib.setOrganization('IETF RAP WG') if mibBuilder.loadTexts: policyDeviceAuxMib.setContactInfo('Kwok Ho Chan Nortel Networks, Inc. 600 Technology Park Drive Billerica, MA 01821 USA Phone: +1 978 288 8175 Email: [email protected] John Seligson Nortel Networks, Inc. 4401 Great America Parkway Santa Clara, CA USA 95054 Phone: +1 408 495-2992 Email: [email protected] Keith McCloghrie Cisco Systems, Inc. 170 West Tasman Drive, San Jose, CA 95134-1706 USA Phone: +1 408 526 5260 Email: [email protected]') if mibBuilder.loadTexts: policyDeviceAuxMib.setDescription('This module defines an infrastructure used for support of policy-based provisioning of a network device.') policy_device_aux_objects = mib_identifier((1, 3, 6, 1, 3, 999, 1)) policy_device_aux_conformance = mib_identifier((1, 3, 6, 1, 3, 999, 2)) policy_device_config = mib_identifier((1, 3, 6, 1, 3, 999, 1, 1)) class Role(TextualConvention, OctetString): reference = 'Policy Core Information Model, draft-ietf-policy-core-info-model-06.txt' description = 'A role represents a functionality characteristic or capability of a resource to which policies are applied. Examples of roles include Backbone interface, Frame Relay interface, BGP-capable router, web server, firewall, etc. Valid characters are a-z, A-Z, 0-9, period, hyphen and underscore. A role must not start with an underscore.' status = 'current' subtype_spec = OctetString.subtypeSpec + value_size_constraint(1, 31) class Rolecombination(TextualConvention, OctetString): description = "A Display string consisting of a set of roles concatenated with a '+' character where the roles are in lexicographic order from minimum to maximum. For example, a+b and b+a are NOT different role-combinations; rather, they are different formating of the same (one) role- combination. Notice the roles within a role-combination are in lexicographic order from minimum to maximum, hence, we declare: a+b is the valid formating of the role-combination, b+a is an invalid formating of the role-combination. Notice the need of zero-length role-combination as the role- combination of interfaces to which no roles have been assigned. This role-combination is also known as the null role-combination. (Note the deliberate use of lower case leters to avoid confusion with the ASCII NULL character which has a value of zero but length of one.)" status = 'current' subtype_spec = OctetString.subtypeSpec + value_size_constraint(0, 255) policy_interface_table = mib_table((1, 3, 6, 1, 3, 999, 1, 1, 1)) if mibBuilder.loadTexts: policyInterfaceTable.setStatus('current') if mibBuilder.loadTexts: policyInterfaceTable.setDescription("Policy information about a device's interfaces.") policy_interface_entry = mib_table_row((1, 3, 6, 1, 3, 999, 1, 1, 1, 1)).setIndexNames((0, 'POLICY-DEVICE-AUX-MIB', 'policyInterfaceIfIndex')) if mibBuilder.loadTexts: policyInterfaceEntry.setStatus('current') if mibBuilder.loadTexts: policyInterfaceEntry.setDescription('A conceptual row in the policyInterfaceTable. Each row identifies policy infromation about a particular interface.') policy_interface_if_index = mib_table_column((1, 3, 6, 1, 3, 999, 1, 1, 1, 1, 1), interface_index()) if mibBuilder.loadTexts: policyInterfaceIfIndex.setStatus('current') if mibBuilder.loadTexts: policyInterfaceIfIndex.setDescription('The ifIndex value for which this conceptual row provides policy information.') policy_interface_role_combo = mib_table_column((1, 3, 6, 1, 3, 999, 1, 1, 1, 1, 2), role_combination()).setMaxAccess('readcreate') if mibBuilder.loadTexts: policyInterfaceRoleCombo.setStatus('current') if mibBuilder.loadTexts: policyInterfaceRoleCombo.setDescription('The role combination that is associated with this interface for the purpose of assigning policies to this interface.') policy_interface_storage = mib_table_column((1, 3, 6, 1, 3, 999, 1, 1, 1, 1, 3), storage_type().clone('volatile')).setMaxAccess('readcreate') if mibBuilder.loadTexts: policyInterfaceStorage.setStatus('current') if mibBuilder.loadTexts: policyInterfaceStorage.setDescription('The storage type for this conceptual row. Conceptual rows having the value permanent(4) need not allow write-access to any columnar objects in the row. This object may not be modified if the associated policyInterfaceStatus object is equal to active(1).') policy_interface_status = mib_table_column((1, 3, 6, 1, 3, 999, 1, 1, 1, 1, 4), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: policyInterfaceStatus.setStatus('current') if mibBuilder.loadTexts: policyInterfaceStatus.setDescription('The status of this row. An entry may not exist in the active state unless all objects in the entry have an appropriate value. Row creation using only default values is supported.') policy_device_compliances = mib_identifier((1, 3, 6, 1, 3, 999, 2, 1)) policy_device_groups = mib_identifier((1, 3, 6, 1, 3, 999, 2, 2)) policy_device_compliance = module_compliance((1, 3, 6, 1, 3, 999, 2, 1, 1)).setObjects(('POLICY-DEVICE-AUX-MIB', 'policyInterfaceGroup')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): policy_device_compliance = policyDeviceCompliance.setStatus('current') if mibBuilder.loadTexts: policyDeviceCompliance.setDescription('Describes the requirements for conformance to the Policy Auxiliary MIB.') policy_interface_group = object_group((1, 3, 6, 1, 3, 999, 2, 2, 1)).setObjects(('POLICY-DEVICE-AUX-MIB', 'policyInterfaceRoleCombo'), ('POLICY-DEVICE-AUX-MIB', 'policyInterfaceStorage'), ('POLICY-DEVICE-AUX-MIB', 'policyInterfaceStatus')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): policy_interface_group = policyInterfaceGroup.setStatus('current') if mibBuilder.loadTexts: policyInterfaceGroup.setDescription('Objects used to define interface to role combination mappings.') mibBuilder.exportSymbols('POLICY-DEVICE-AUX-MIB', policyInterfaceRoleCombo=policyInterfaceRoleCombo, Role=Role, policyInterfaceStatus=policyInterfaceStatus, policyDeviceConfig=policyDeviceConfig, policyInterfaceEntry=policyInterfaceEntry, policyInterfaceGroup=policyInterfaceGroup, policyDeviceCompliance=policyDeviceCompliance, RoleCombination=RoleCombination, policyDeviceAuxConformance=policyDeviceAuxConformance, policyDeviceAuxMib=policyDeviceAuxMib, policyInterfaceIfIndex=policyInterfaceIfIndex, policyInterfaceStorage=policyInterfaceStorage, policyDeviceGroups=policyDeviceGroups, policyDeviceAuxObjects=policyDeviceAuxObjects, policyDeviceCompliances=policyDeviceCompliances, policyInterfaceTable=policyInterfaceTable, PYSNMP_MODULE_ID=policyDeviceAuxMib)
{ 'targets': [ { 'target_name': 'binding', 'sources': [ './src/fb-bindings.cc', './src/fb-bindings-blob.cc', './src/fb-bindings-fbresult.cc', './src/fb-bindings-connection.cc','./src/fb-bindings-eventblock.cc', './src/fb-bindings-fbeventemitter.cc', './src/fb-bindings-statement.cc', './src/fb-bindings-transaction.cc' ], 'include_dirs': [ '<(module_root_dir)/fb/include', "<!(node -e \"require('nan')\")" ], "conditions" : [ [ 'OS=="linux"', { 'libraries': [ '-lfbclient' ] } ], [ 'OS=="win" and target_arch=="ia32"', { "libraries" : [ '<(module_root_dir)/fb/lib/fbclient_ms.lib' ] } ], [ 'OS=="win" and target_arch=="x64"', { "libraries" : [ '<(module_root_dir)/fb/lib64/fbclient_ms.lib' ] } ], [ 'OS=="mac"', { "link_settings" : { "libraries": ['-L/Library/Frameworks/Firebird.framework/Libraries/', '-lfbclient'] } } ] ] } ] }
{'targets': [{'target_name': 'binding', 'sources': ['./src/fb-bindings.cc', './src/fb-bindings-blob.cc', './src/fb-bindings-fbresult.cc', './src/fb-bindings-connection.cc', './src/fb-bindings-eventblock.cc', './src/fb-bindings-fbeventemitter.cc', './src/fb-bindings-statement.cc', './src/fb-bindings-transaction.cc'], 'include_dirs': ['<(module_root_dir)/fb/include', '<!(node -e "require(\'nan\')")'], 'conditions': [['OS=="linux"', {'libraries': ['-lfbclient']}], ['OS=="win" and target_arch=="ia32"', {'libraries': ['<(module_root_dir)/fb/lib/fbclient_ms.lib']}], ['OS=="win" and target_arch=="x64"', {'libraries': ['<(module_root_dir)/fb/lib64/fbclient_ms.lib']}], ['OS=="mac"', {'link_settings': {'libraries': ['-L/Library/Frameworks/Firebird.framework/Libraries/', '-lfbclient']}}]]}]}
# Still waiting on what Neutral should be! ALIGNMENT_CHOICES = ( (0, 'Neutral'), (-1000, 'Evil'), (1000, 'Good'), ) SEX_CHOICES = ( (0, 'None'), (1, 'Male'), (2, 'Female'), ) WEAPON_TYPE_CHOICES = ( ('B', 'Blunt'), ('S', 'Sharp'), ) DIRECTION_CHOICES = ( (0, 'North'), (1, 'East'), (2, 'South'), (3, 'West'), (4, 'Up'), (5, 'Down'), ) DOOR_RESET_CHOICES = ( (0, 'Open'), (1, 'Closed'), (2, 'Locked'), ) DOOR_TRIGGER_TYPE_CHOICES = ( ('P', 'Prevent'), ('A', 'Allow'), ) ITEM_TYPE_CLASSES = [ 'Light', 'Fountain', 'Weapon', 'AnimalWeapon', 'Armor', 'AnimalArmor', 'Food', 'PetFood', 'Scroll', 'Potion', 'Pill', 'Wand', 'Staff', 'Fetish', 'Ring', 'Relic', 'Treasure', 'Furniture', 'Trash', 'Key', 'Boat', 'Decoration', 'Jewelry', 'DrinkContainer', 'Container', 'Money', ]
alignment_choices = ((0, 'Neutral'), (-1000, 'Evil'), (1000, 'Good')) sex_choices = ((0, 'None'), (1, 'Male'), (2, 'Female')) weapon_type_choices = (('B', 'Blunt'), ('S', 'Sharp')) direction_choices = ((0, 'North'), (1, 'East'), (2, 'South'), (3, 'West'), (4, 'Up'), (5, 'Down')) door_reset_choices = ((0, 'Open'), (1, 'Closed'), (2, 'Locked')) door_trigger_type_choices = (('P', 'Prevent'), ('A', 'Allow')) item_type_classes = ['Light', 'Fountain', 'Weapon', 'AnimalWeapon', 'Armor', 'AnimalArmor', 'Food', 'PetFood', 'Scroll', 'Potion', 'Pill', 'Wand', 'Staff', 'Fetish', 'Ring', 'Relic', 'Treasure', 'Furniture', 'Trash', 'Key', 'Boat', 'Decoration', 'Jewelry', 'DrinkContainer', 'Container', 'Money']
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Oct 10 09:23:08 2018 @author: misskeisha """ s = input() def palindrome(s): if len(s) <= 1: return True else: return s[0] == s[-1] and palindrome(s[1:-1]) print(palindrome(s))
""" Created on Wed Oct 10 09:23:08 2018 @author: misskeisha """ s = input() def palindrome(s): if len(s) <= 1: return True else: return s[0] == s[-1] and palindrome(s[1:-1]) print(palindrome(s))
# break # for i in range(1, 10): # print(i) # if i == 3: # break # continue for i in range(1, 10): if i == 4 or i == 7: continue print(i)
for i in range(1, 10): if i == 4 or i == 7: continue print(i)
#Cambio , remplazo de cadena de Letras print("=================================================================") archivo_texto = open("archivo.txt","r+") # Archivo de Lectura y escritura lista_texto=archivo_texto.readlines() lista_texto[1]= " Estas linea ha sido incluioda desde el exterior 2 \n" archivo_texto.seek(0) archivo_texto.writelines(lista_texto) archivo_texto.close()
print('=================================================================') archivo_texto = open('archivo.txt', 'r+') lista_texto = archivo_texto.readlines() lista_texto[1] = ' Estas linea ha sido incluioda desde el exterior 2 \n' archivo_texto.seek(0) archivo_texto.writelines(lista_texto) archivo_texto.close()
# 07/01/2019 def upc(n): digits = [int(x) for x in f'{n:011}'] M = (sum(digits[0::2]) * 3 + sum(digits[1::2])) % 10 return 0 if M == 0 else 10 - M assert upc(4210000526) == 4 assert upc(3600029145) == 2 assert upc(12345678910) == 4 assert upc(1234567) == 0
def upc(n): digits = [int(x) for x in f'{n:011}'] m = (sum(digits[0::2]) * 3 + sum(digits[1::2])) % 10 return 0 if M == 0 else 10 - M assert upc(4210000526) == 4 assert upc(3600029145) == 2 assert upc(12345678910) == 4 assert upc(1234567) == 0
# -*- coding: utf-8 -*- # # dependencies documentation build configuration file, created by Quark extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.napoleon' ] templates_path = ['_templates'] source_suffix = '.rst' master_doc = 'index' project = u'dependencies' copyright = u'2015, dependencies authors' author = u'dependencies authors' version = '0.0.1' release = '0.0.1' language = None exclude_patterns = ['_build'] pygments_style = 'sphinx' todo_include_todos = False html_theme = 'alabaster' html_static_path = ['_static'] htmlhelp_basename = 'dependenciesdoc' latex_elements = {} latex_documents = [ (master_doc, 'dependencies.tex', u'dependencies Documentation', u'dependencies authors', 'manual'), ] man_pages = [ (master_doc, 'dependencies', u'dependencies Documentation', [author], 1) ] texinfo_documents = [ (master_doc, 'dependencies', u'dependencies Documentation', author, 'dependencies', 'One line description of dependencies.', 'Miscellaneous'), ]
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.napoleon'] templates_path = ['_templates'] source_suffix = '.rst' master_doc = 'index' project = u'dependencies' copyright = u'2015, dependencies authors' author = u'dependencies authors' version = '0.0.1' release = '0.0.1' language = None exclude_patterns = ['_build'] pygments_style = 'sphinx' todo_include_todos = False html_theme = 'alabaster' html_static_path = ['_static'] htmlhelp_basename = 'dependenciesdoc' latex_elements = {} latex_documents = [(master_doc, 'dependencies.tex', u'dependencies Documentation', u'dependencies authors', 'manual')] man_pages = [(master_doc, 'dependencies', u'dependencies Documentation', [author], 1)] texinfo_documents = [(master_doc, 'dependencies', u'dependencies Documentation', author, 'dependencies', 'One line description of dependencies.', 'Miscellaneous')]
while True: try: number = input('Please input hex number: ') print(int(number, 16)) except: break;
while True: try: number = input('Please input hex number: ') print(int(number, 16)) except: break
print('-'* 23) print('\033[:31mCALCULADOR DE DESCONTOS\033[m') print('-'* 23) p = float(input('Valor do produto: ')) desc = (p / 100) * 95 # -> p - (p * 5 / 100) print(f'O produto que custava {p:.2f} com desconto de 5% sae por: {desc:.2f}'.replace('.', ','))
print('-' * 23) print('\x1b[:31mCALCULADOR DE DESCONTOS\x1b[m') print('-' * 23) p = float(input('Valor do produto: ')) desc = p / 100 * 95 print(f'O produto que custava {p:.2f} com desconto de 5% sae por: {desc:.2f}'.replace('.', ','))
limak, bob = map(int, input().split()) years = 0 while limak <= bob: limak *= 3 bob *= 2 years += 1 print(years)
(limak, bob) = map(int, input().split()) years = 0 while limak <= bob: limak *= 3 bob *= 2 years += 1 print(years)
"""Top-level package for ascii-art.""" __author__ = """Zero to Mastery""" __version__ = '0.1.0'
"""Top-level package for ascii-art.""" __author__ = 'Zero to Mastery' __version__ = '0.1.0'
#Settings for running headless_tests DEVELOPMENT_SERVER_HOST='localhost' DEVELOPMENT_SERVER_PORT=8004 PHANTOMJS_GHOSTDRIVER_PORT=8150
development_server_host = 'localhost' development_server_port = 8004 phantomjs_ghostdriver_port = 8150
# -*- coding: utf-8 -*- MINIMUM_PULSE_CYCLE = 0.5 MAXIMUM_PULSE_CYCLE = 1.2 PPG_SAMPLE_RATE = 200 PPG_FIR_FILTER_TAP_NUM = 200 PPG_FILTER_CUTOFF = [0.5, 5.0] PPG_SYSTOLIC_PEAK_DETECTION_THRESHOLD_COEFFICIENT = 0.5 TRAINING_DATA_RATIO = 0.75
minimum_pulse_cycle = 0.5 maximum_pulse_cycle = 1.2 ppg_sample_rate = 200 ppg_fir_filter_tap_num = 200 ppg_filter_cutoff = [0.5, 5.0] ppg_systolic_peak_detection_threshold_coefficient = 0.5 training_data_ratio = 0.75
# Turns on debugging features in Flask DEBUG = True # secret key: SECRET_KEY = "MySuperSecretKey" # Database connection parameters DB_HOST = "127.0.0.1" DB_PORT = 27017 DB_NAME = "cgbeacon2-test" DB_URI = f"mongodb://{DB_HOST}:{DB_PORT}/{DB_NAME}" # standalone MongoDB instance # DB_URI = "mongodb://localhost:27011,localhost:27012,localhost:27013/?replicaSet=rs0" # MongoDB replica set ORGANISATION = dict( id="scilifelab", # mandatory name="Clinical Genomics, SciLifeLab", # mandatory description="A science lab", address="", contactUrl="", info=[], logoUrl="", welcomeUrl="", ) BEACON_OBJ = dict( id="SciLifeLab-beacon", # mandatory name="SciLifeLab Stockholm Beacon", # mandatory organisation=ORGANISATION, # mandatory alternativeUrl="http//scilifelab.beacon_alt.se", createDateTime="2015-06-15T00:00.000Z", description="Beacon description", info=[], welcomeUrl="http//scilifelab.beacon.se", ) ############## OAUTH2 permissions layer ############## ### https://elixir-europe.org/services/compute/aai ### ELIXIR_OAUTH2 = dict( server="https://login.elixir-czech.org/oidc/jwk", # OAuth2 server that returns JWK public key issuers=["https://login.elixir-czech.org/oidc/"], # Authenticated Bearer token issuers userinfo="https://login.elixir-czech.org/oidc/userinfo", # Where to send access token to view user data (permissions, statuses, ...) audience=[], # List of strings. Service(s) the token is intended for. (key provided by the Beacon Network administrator) verify_aud=False, # if True, force verify audience for provided token bona_fide_requirements="https://doi.org/10.1038/s41431-018-0219-y", )
debug = True secret_key = 'MySuperSecretKey' db_host = '127.0.0.1' db_port = 27017 db_name = 'cgbeacon2-test' db_uri = f'mongodb://{DB_HOST}:{DB_PORT}/{DB_NAME}' organisation = dict(id='scilifelab', name='Clinical Genomics, SciLifeLab', description='A science lab', address='', contactUrl='', info=[], logoUrl='', welcomeUrl='') beacon_obj = dict(id='SciLifeLab-beacon', name='SciLifeLab Stockholm Beacon', organisation=ORGANISATION, alternativeUrl='http//scilifelab.beacon_alt.se', createDateTime='2015-06-15T00:00.000Z', description='Beacon description', info=[], welcomeUrl='http//scilifelab.beacon.se') elixir_oauth2 = dict(server='https://login.elixir-czech.org/oidc/jwk', issuers=['https://login.elixir-czech.org/oidc/'], userinfo='https://login.elixir-czech.org/oidc/userinfo', audience=[], verify_aud=False, bona_fide_requirements='https://doi.org/10.1038/s41431-018-0219-y')
string_input = input() num = int(input()) # def string(str, n): # new_string = "" # for i in range(0, n): # new_string += str # return new_string # def string(str, n): # return str*n # Recursion def string(str, n): if n < 1: return "" return str + string(str, n=n - 1) print(string(string_input, num))
string_input = input() num = int(input()) def string(str, n): if n < 1: return '' return str + string(str, n=n - 1) print(string(string_input, num))
def add_node(v): if v in graph: print(v,"already present") else: graph[v]=[] def add_edge(v1,v2): if v1 not in graph: print(v1," not present in graph") elif v2 not in graph: print(v2,"not present in graph") else: graph[v1].append(v2) graph[v2].append(v1) def delete_edge(v1,v2): if v1 not in graph: print(v1,"not present in graph") elif v2 not in graph: print(v2,"not present in graph") else: if v2 in graph[v1]: graph[v1].remove(v2) graph[v2].remove(v1) def DFSiterative(node,graph): visited=set() if node not in graph: print(node,"not in graph") return stack=[] stack.append(node) while stack: current=stack.pop() if current not in visited: print(current) visited.add(current) for i in graph[node]: stack.append(i) graph={} add_node('A') add_node('B') add_node('C') add_node('D') add_edge('A','D') add_edge('A','C') add_edge('C','D') add_edge('C','E') DFSiterative("A",graph) print(graph)
def add_node(v): if v in graph: print(v, 'already present') else: graph[v] = [] def add_edge(v1, v2): if v1 not in graph: print(v1, ' not present in graph') elif v2 not in graph: print(v2, 'not present in graph') else: graph[v1].append(v2) graph[v2].append(v1) def delete_edge(v1, v2): if v1 not in graph: print(v1, 'not present in graph') elif v2 not in graph: print(v2, 'not present in graph') elif v2 in graph[v1]: graph[v1].remove(v2) graph[v2].remove(v1) def df_siterative(node, graph): visited = set() if node not in graph: print(node, 'not in graph') return stack = [] stack.append(node) while stack: current = stack.pop() if current not in visited: print(current) visited.add(current) for i in graph[node]: stack.append(i) graph = {} add_node('A') add_node('B') add_node('C') add_node('D') add_edge('A', 'D') add_edge('A', 'C') add_edge('C', 'D') add_edge('C', 'E') df_siterative('A', graph) print(graph)
#!/usr/bin/env python # -*- coding: utf-8 -*- # Prince Prigio chart = ["accept", "allow", "apologise", "appeal", "appear", "approve", "await", "bear", "beat", "behave", "behold", "better", "brawl", "breed", "build", "christen", "claim", "complain", "correct", "count", "cover", "creep", "curl", "decline", "deserve", "despise", "disappear", "distress", "shun", "draw", "drop", "eat", "encourage", "exhaust", "expect", "expire", "express", "fall", "find", "float", "frighten", "get", "grow", "happen", "hover", "improve", "indebt", "inform", "interrupt", "irritate", "misbehave", "kneel", "know", "laugh", "leap", "lose", "manage", "matter", "meet", "misinterpret", "neglect", "offend", "offer", "open", "overdo", "overpower", "pledge", "poach", "possess", "prove", "put", "raise", "reach", "recover", "represent", "retire", "ride", "roll", "rush", "say", "seat", "seem", "send", "sign", "smoke", "soar", "spy", "raise", "start", "stone", "stop", "sup", "suppose", "teach", "tear", "tell", "threaten", "tire", "uncoil", "unite", "visit", "wake", "warn", "wash", "wild", "wish", "withdraw", "write"],
chart = (['accept', 'allow', 'apologise', 'appeal', 'appear', 'approve', 'await', 'bear', 'beat', 'behave', 'behold', 'better', 'brawl', 'breed', 'build', 'christen', 'claim', 'complain', 'correct', 'count', 'cover', 'creep', 'curl', 'decline', 'deserve', 'despise', 'disappear', 'distress', 'shun', 'draw', 'drop', 'eat', 'encourage', 'exhaust', 'expect', 'expire', 'express', 'fall', 'find', 'float', 'frighten', 'get', 'grow', 'happen', 'hover', 'improve', 'indebt', 'inform', 'interrupt', 'irritate', 'misbehave', 'kneel', 'know', 'laugh', 'leap', 'lose', 'manage', 'matter', 'meet', 'misinterpret', 'neglect', 'offend', 'offer', 'open', 'overdo', 'overpower', 'pledge', 'poach', 'possess', 'prove', 'put', 'raise', 'reach', 'recover', 'represent', 'retire', 'ride', 'roll', 'rush', 'say', 'seat', 'seem', 'send', 'sign', 'smoke', 'soar', 'spy', 'raise', 'start', 'stone', 'stop', 'sup', 'suppose', 'teach', 'tear', 'tell', 'threaten', 'tire', 'uncoil', 'unite', 'visit', 'wake', 'warn', 'wash', 'wild', 'wish', 'withdraw', 'write'],)
#! python # Problem # : 236A # Created on : 2019-01-14 23:41:28 def Main(): cnt = len(set(input())) print('IGNORE HIM!' if cnt & 1 else 'CHAT WITH HER!') if __name__ == '__main__': Main()
def main(): cnt = len(set(input())) print('IGNORE HIM!' if cnt & 1 else 'CHAT WITH HER!') if __name__ == '__main__': main()
class Node: def __init__(self, index): self.index = index self.visited = False self._neighbors = [] def __repr__(self): return str(self.index) @property def neighbors(self): return self._neighbors @neighbors.setter def neighbors(self, neighbor): self._neighbors.append(neighbor) class Graph: def __init__(self): self._nodes = {} self.connected_components = {} @property def nodes(self): return self._nodes @nodes.setter def nodes(self, index): self._nodes[index] = Node(index) def add_edge(self, index_1, index_2, directional=False): if directional: self.nodes[index_1].neighbors = self.nodes[index_2] else: self.nodes[index_1].neighbors = self.nodes[index_2] self.nodes[index_2].neighbors = self.nodes[index_1] def return_nodes_unvisited(self): return [node for node in list(self.nodes.values()) if not node.visited] def calculate_connected_components(self): nodes_unvisited = self.return_nodes_unvisited() while nodes_unvisited: node = nodes_unvisited[0] index = len(self.connected_components) self.connected_components[index] = [node] node.visited = True for neighbor in node.neighbors: self.connected_components[index].append(neighbor) neighbor.visited = True nodes_unvisited = self.return_nodes_unvisited() for index, connected_components in self.connected_components.items(): print(f'Componente {index + 1}: {str(connected_components)}') print(f'{len(self.connected_components)} componentes conectados')
class Node: def __init__(self, index): self.index = index self.visited = False self._neighbors = [] def __repr__(self): return str(self.index) @property def neighbors(self): return self._neighbors @neighbors.setter def neighbors(self, neighbor): self._neighbors.append(neighbor) class Graph: def __init__(self): self._nodes = {} self.connected_components = {} @property def nodes(self): return self._nodes @nodes.setter def nodes(self, index): self._nodes[index] = node(index) def add_edge(self, index_1, index_2, directional=False): if directional: self.nodes[index_1].neighbors = self.nodes[index_2] else: self.nodes[index_1].neighbors = self.nodes[index_2] self.nodes[index_2].neighbors = self.nodes[index_1] def return_nodes_unvisited(self): return [node for node in list(self.nodes.values()) if not node.visited] def calculate_connected_components(self): nodes_unvisited = self.return_nodes_unvisited() while nodes_unvisited: node = nodes_unvisited[0] index = len(self.connected_components) self.connected_components[index] = [node] node.visited = True for neighbor in node.neighbors: self.connected_components[index].append(neighbor) neighbor.visited = True nodes_unvisited = self.return_nodes_unvisited() for (index, connected_components) in self.connected_components.items(): print(f'Componente {index + 1}: {str(connected_components)}') print(f'{len(self.connected_components)} componentes conectados')
""" dummy tests """ #============================ helpers ========================================= #============================ tests =========================================== def test_dummy(): pass
""" dummy tests """ def test_dummy(): pass
# https://leetcode.com/problems/maximum-product-difference-between-two-pairs class Solution: def maxProductDifference(self, nums: List[int]) -> int: nums = sorted(nums) return (nums[-1] * nums[-2]) - (nums[0] * nums[1])
class Solution: def max_product_difference(self, nums: List[int]) -> int: nums = sorted(nums) return nums[-1] * nums[-2] - nums[0] * nums[1]
""" Contains functions implementing the Levenshtein distance algorithm. """ def relative(a, b): """Returns the relative distance between two strings, in the range [0-1] where 1 means total equality. """ d = distance(a,b) longer = float(max((len(a), len(b)))) shorter = float(min((len(a), len(b)))) r = ((longer - d) / longer) * (shorter / longer) return r def distance(s, t): """Returns the Levenshtein edit distance between two strings.""" m, n = len(s), len(t) d = [range(n+1)] d += [[i] for i in range(1,m+1)] for i in range(0,m): for j in range(0,n): cost = 1 if s[i] == t[j]: cost = 0 d[i+1].append(min(d[i][j+1]+1, # deletion d[i+1][j]+1, # insertion d[i][j]+cost) # substitution ) return d[m][n]
""" Contains functions implementing the Levenshtein distance algorithm. """ def relative(a, b): """Returns the relative distance between two strings, in the range [0-1] where 1 means total equality. """ d = distance(a, b) longer = float(max((len(a), len(b)))) shorter = float(min((len(a), len(b)))) r = (longer - d) / longer * (shorter / longer) return r def distance(s, t): """Returns the Levenshtein edit distance between two strings.""" (m, n) = (len(s), len(t)) d = [range(n + 1)] d += [[i] for i in range(1, m + 1)] for i in range(0, m): for j in range(0, n): cost = 1 if s[i] == t[j]: cost = 0 d[i + 1].append(min(d[i][j + 1] + 1, d[i + 1][j] + 1, d[i][j] + cost)) return d[m][n]
# Space: O(n) # Time: O(n) class Solution: def plusOne(self, digits): temp = ''.join(map(lambda x: str(x), digits)) temp = int(temp) + 1 temp = list(str(temp)) return list(map(lambda x: int(x), temp))
class Solution: def plus_one(self, digits): temp = ''.join(map(lambda x: str(x), digits)) temp = int(temp) + 1 temp = list(str(temp)) return list(map(lambda x: int(x), temp))
#Explain your work #Question 1 for x in range(a): print(a)
for x in range(a): print(a)
#!/usr/bin/python3 words = """art hue ink oil pen wax clay draw film form kiln line tone tube wood batik brush carve chalk color craft easel erase frame gesso glass glaze image latex liner media mixed model mural paint paper photo print quill quilt ruler scale shade stone style tools video wheel artist bridge canvas chisel crayon create depict design enamel eraser fresco hammer marble marker medium mobile mosaic museum pastel pencil poster pounce roller sculpt sketch vellum visual acrylic artwork cartoon carving casting collage compass drawing engrave etching exhibit gallery gilding gouache painter palette pigment portray pottery primary realism solvent stained stencil tempera textile tsquare varnish woodcut abstract airbrush artistic blending ceramics charcoal contrast critique decorate graffiti graphite hatching maquette marbling painting portrait printing quilting sculptor seascape template animation cloisonne decoupage encaustic engraving landscape porcelain portfolio sculpture secondary stippling undertone assemblage brightness creativity decorative exhibition illustrate lithograph paintbrush photograph proportion sketchbook turpentine watercolor waterscape calligraphy composition masterpiece perspective architecture glassblowing illustration installation stonecutting crosshatching """ all_valid_words = () start = 0 end = 0 for char in words : # append substring to the end of valid words tuple if char == "\n" : all_valid_words = all_valid_words + (words[start:end], ) start = end + 1 end = end + 1 # increment end pointer to keep looking for the end of the word else : end = end + 1 #print(all_valid_words) # example of successful lookup, yields one result "ink" #tiles = "inka" # example of no matches, yields zero results #tiles = "dow" tiles = "doasdflkjtewtasdflkjwerasdfzxcklvnmzwo" found_words = () for word in all_valid_words : all_letters_in_word = True tiles_left = tiles # check every letter in an art word for letter in word: # letter not in leftover tiles, so stop looking at remaining letters in word if letter not in tiles_left : all_letters_in_word = False break # update leftover tiles else : index = tiles_left.find(letter) tiles_left = tiles_left[0:index] + tiles_left[index+1:len(tiles_left)] # check why the inner for loop ended: break or found all letters? if all_letters_in_word : found_words = found_words + (word, ) #print(found_words) for w in found_words : print(w)
words = 'art\nhue\nink\noil\npen\nwax\nclay\ndraw\nfilm\nform\nkiln\nline\ntone\ntube\nwood\nbatik\nbrush\ncarve\nchalk\ncolor\ncraft\neasel\nerase\nframe\ngesso\nglass\nglaze\nimage\nlatex\nliner\nmedia\nmixed\nmodel\nmural\npaint\npaper\nphoto\nprint\nquill\nquilt\nruler\nscale\nshade\nstone\nstyle\ntools\nvideo\nwheel\nartist\nbridge\ncanvas\nchisel\ncrayon\ncreate\ndepict\ndesign\nenamel\neraser\nfresco\nhammer\nmarble\nmarker\nmedium\nmobile\nmosaic\nmuseum\npastel\npencil\nposter\npounce\nroller\nsculpt\nsketch\nvellum\nvisual\nacrylic\nartwork\ncartoon\ncarving\ncasting\ncollage\ncompass\ndrawing\nengrave\netching\nexhibit\ngallery\ngilding\ngouache\npainter\npalette\npigment\nportray\npottery\nprimary\nrealism\nsolvent\nstained\nstencil\ntempera\ntextile\ntsquare\nvarnish\nwoodcut\nabstract\nairbrush\nartistic\nblending\nceramics\ncharcoal\ncontrast\ncritique\ndecorate\ngraffiti\ngraphite\nhatching\nmaquette\nmarbling\npainting\nportrait\nprinting\nquilting\nsculptor\nseascape\ntemplate\nanimation\ncloisonne\ndecoupage\nencaustic\nengraving\nlandscape\nporcelain\nportfolio\nsculpture\nsecondary\nstippling\nundertone\nassemblage\nbrightness\ncreativity\ndecorative\nexhibition\nillustrate\nlithograph\npaintbrush\nphotograph\nproportion\nsketchbook\nturpentine\nwatercolor\nwaterscape\ncalligraphy\ncomposition\nmasterpiece\nperspective\narchitecture\nglassblowing\nillustration\ninstallation\nstonecutting\ncrosshatching\n' all_valid_words = () start = 0 end = 0 for char in words: if char == '\n': all_valid_words = all_valid_words + (words[start:end],) start = end + 1 end = end + 1 else: end = end + 1 tiles = 'doasdflkjtewtasdflkjwerasdfzxcklvnmzwo' found_words = () for word in all_valid_words: all_letters_in_word = True tiles_left = tiles for letter in word: if letter not in tiles_left: all_letters_in_word = False break else: index = tiles_left.find(letter) tiles_left = tiles_left[0:index] + tiles_left[index + 1:len(tiles_left)] if all_letters_in_word: found_words = found_words + (word,) for w in found_words: print(w)
# Licensed under an MIT open source license - see LICENSE def generate_saa_list(scouseobject): """ Returns a list constaining all spectral averaging areas. Parameters ---------- scouseobject : Instance of the scousepy class """ saa_list=[] for i in range(len(scouseobject.wsaa)): saa_dict = scouseobject.saa_dict[i] #for j in range(len(saa_dict.keys())): for key in saa_dict.keys(): # get the relavent SAA #SAA = saa_dict[j] SAA = saa_dict[key] if SAA.to_be_fit: saa_list.append([SAA.index, i]) return saa_list
def generate_saa_list(scouseobject): """ Returns a list constaining all spectral averaging areas. Parameters ---------- scouseobject : Instance of the scousepy class """ saa_list = [] for i in range(len(scouseobject.wsaa)): saa_dict = scouseobject.saa_dict[i] for key in saa_dict.keys(): saa = saa_dict[key] if SAA.to_be_fit: saa_list.append([SAA.index, i]) return saa_list
class Sentence: def __init__(self): self._tokens = [] self._metadata = [] def append_metadata(self, data): self._metadata.append(data) def append_token(self, token): self._tokens.append(token) def __bool__(self): return len(self._tokens) > 0 def __len__(self): return len(self._tokens) def __iter__(self): for tok in self._tokens: yield tok def __getitem__(self, idx): return self._tokens[idx] @property def metadata(self): return self._metadata def to_string(self, col_transform=None): s = [f"# {m}" for m in self._metadata] s += [t.to_string(transform=col_transform) for t in self._tokens] return "\n".join(s)
class Sentence: def __init__(self): self._tokens = [] self._metadata = [] def append_metadata(self, data): self._metadata.append(data) def append_token(self, token): self._tokens.append(token) def __bool__(self): return len(self._tokens) > 0 def __len__(self): return len(self._tokens) def __iter__(self): for tok in self._tokens: yield tok def __getitem__(self, idx): return self._tokens[idx] @property def metadata(self): return self._metadata def to_string(self, col_transform=None): s = [f'# {m}' for m in self._metadata] s += [t.to_string(transform=col_transform) for t in self._tokens] return '\n'.join(s)
class AppSettings: allow_extra_fields = True types = { # Slack 'domain': str, # come on, Okta, be consistent... # T-Sheets 'subDomain': str, # Engagedly 'acsUrl': str, # ACS URL 'audRestriction': str, # Entity ID # JIRA 'baseURL': str, # Your JIRA URL # ADP Employee Self Service Portal 'companyName': str, # Company Name 'url': str, 'requestIntegration': bool, 'authURL': str, 'usernameField': str, 'passwordField': str, 'buttonField': str, 'extraFieldSelector': str, 'extraFieldValue': str, 'optionalField1': str, 'optionalField1Value': str, 'optionalField2': str, 'optionalField2Value': str, 'optionalField3': str, 'optionalField3Value': str } def __init__(self): # The URL of the login page for this app self.url = None # str self.domain = None # str self.subDomain = None # str # Would you like Okta to add an integration for this app? self.requestIntegration = None # bool # The URL of the authenticating site for this app self.authURL = None # str # CSS selector for the username field in the login form self.usernameField = None # str # CSS selector for the password field in the login form self.passwordField = None # str # CSS selector for the login button in the login form self.buttonField = None # str # CSS selector for the extra field in the form self.extraFieldSelector = None # str # Value for extra field form field self.extraFieldValue = None # str # Name of the optional parameter in the login form self.optionalField1 = None # str # Name of the optional value in the login form self.optionalField1Value = None # str # Name of the optional parameter in the login form self.optionalField2 = None # str # Name of the optional value in the login form self.optionalField2Value = None # str # Name of the optional parameter in the login form self.optionalField3 = None # str # Name of the optional value in the login form self.optionalField3Value = None # str
class Appsettings: allow_extra_fields = True types = {'domain': str, 'subDomain': str, 'acsUrl': str, 'audRestriction': str, 'baseURL': str, 'companyName': str, 'url': str, 'requestIntegration': bool, 'authURL': str, 'usernameField': str, 'passwordField': str, 'buttonField': str, 'extraFieldSelector': str, 'extraFieldValue': str, 'optionalField1': str, 'optionalField1Value': str, 'optionalField2': str, 'optionalField2Value': str, 'optionalField3': str, 'optionalField3Value': str} def __init__(self): self.url = None self.domain = None self.subDomain = None self.requestIntegration = None self.authURL = None self.usernameField = None self.passwordField = None self.buttonField = None self.extraFieldSelector = None self.extraFieldValue = None self.optionalField1 = None self.optionalField1Value = None self.optionalField2 = None self.optionalField2Value = None self.optionalField3 = None self.optionalField3Value = None
N, K = map(int, input().split()) S = list(input()) Y = 0 if N == 1: print(0) exit(0) if S[0] == 'L': Y += 1 if S[N-1] == 'R': Y += 1 count = 0 X = 0 for i in range(N-1): if S[i] == 'R' and S[i+1] == 'L': X += 1 if S[i] == S[i+1]: count += 1 count += K*2 print(min(N-1, count))
(n, k) = map(int, input().split()) s = list(input()) y = 0 if N == 1: print(0) exit(0) if S[0] == 'L': y += 1 if S[N - 1] == 'R': y += 1 count = 0 x = 0 for i in range(N - 1): if S[i] == 'R' and S[i + 1] == 'L': x += 1 if S[i] == S[i + 1]: count += 1 count += K * 2 print(min(N - 1, count))
# # PySNMP MIB module CTRON-ROUTERS-INTERNAL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-ROUTERS-INTERNAL-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:15:01 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, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint, ValueSizeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsUnion") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") ModuleIdentity, IpAddress, Integer32, Gauge32, iso, ObjectIdentity, Counter32, NotificationType, enterprises, TimeTicks, Bits, Counter64, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, Unsigned32 = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "IpAddress", "Integer32", "Gauge32", "iso", "ObjectIdentity", "Counter32", "NotificationType", "enterprises", "TimeTicks", "Bits", "Counter64", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Unsigned32") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") cabletron = MibIdentifier((1, 3, 6, 1, 4, 1, 52)) mibs = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 4)) ctron = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 4, 1)) ctronExp = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 4, 2)) ctronRouterExp = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 4, 2, 2)) ctNetwork = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 4, 1, 3)) nwRouter = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 4, 2, 2, 2)) nwRtrTemp = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 4, 2, 2, 2, 99)) nwRtrTemp1 = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 4, 2, 2, 2, 99, 2)) nwRtrTemp2 = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 4, 2, 2, 2, 99, 2, 2)) nwRtrSoftReset = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 2, 2, 99, 2, 2, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0))).clone(namedValues=NamedValues(("reset", 0)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: nwRtrSoftReset.setStatus('mandatory') mibBuilder.exportSymbols("CTRON-ROUTERS-INTERNAL-MIB", ctron=ctron, ctronRouterExp=ctronRouterExp, ctronExp=ctronExp, nwRtrTemp2=nwRtrTemp2, cabletron=cabletron, nwRtrTemp1=nwRtrTemp1, nwRtrTemp=nwRtrTemp, nwRtrSoftReset=nwRtrSoftReset, mibs=mibs, nwRouter=nwRouter, ctNetwork=ctNetwork)
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, value_range_constraint, value_size_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ConstraintsIntersection', 'ValueRangeConstraint', 'ValueSizeConstraint', 'ConstraintsUnion') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (module_identity, ip_address, integer32, gauge32, iso, object_identity, counter32, notification_type, enterprises, time_ticks, bits, counter64, mib_identifier, mib_scalar, mib_table, mib_table_row, mib_table_column, unsigned32) = mibBuilder.importSymbols('SNMPv2-SMI', 'ModuleIdentity', 'IpAddress', 'Integer32', 'Gauge32', 'iso', 'ObjectIdentity', 'Counter32', 'NotificationType', 'enterprises', 'TimeTicks', 'Bits', 'Counter64', 'MibIdentifier', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Unsigned32') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') cabletron = mib_identifier((1, 3, 6, 1, 4, 1, 52)) mibs = mib_identifier((1, 3, 6, 1, 4, 1, 52, 4)) ctron = mib_identifier((1, 3, 6, 1, 4, 1, 52, 4, 1)) ctron_exp = mib_identifier((1, 3, 6, 1, 4, 1, 52, 4, 2)) ctron_router_exp = mib_identifier((1, 3, 6, 1, 4, 1, 52, 4, 2, 2)) ct_network = mib_identifier((1, 3, 6, 1, 4, 1, 52, 4, 1, 3)) nw_router = mib_identifier((1, 3, 6, 1, 4, 1, 52, 4, 2, 2, 2)) nw_rtr_temp = mib_identifier((1, 3, 6, 1, 4, 1, 52, 4, 2, 2, 2, 99)) nw_rtr_temp1 = mib_identifier((1, 3, 6, 1, 4, 1, 52, 4, 2, 2, 2, 99, 2)) nw_rtr_temp2 = mib_identifier((1, 3, 6, 1, 4, 1, 52, 4, 2, 2, 2, 99, 2, 2)) nw_rtr_soft_reset = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 2, 2, 99, 2, 2, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0))).clone(namedValues=named_values(('reset', 0)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: nwRtrSoftReset.setStatus('mandatory') mibBuilder.exportSymbols('CTRON-ROUTERS-INTERNAL-MIB', ctron=ctron, ctronRouterExp=ctronRouterExp, ctronExp=ctronExp, nwRtrTemp2=nwRtrTemp2, cabletron=cabletron, nwRtrTemp1=nwRtrTemp1, nwRtrTemp=nwRtrTemp, nwRtrSoftReset=nwRtrSoftReset, mibs=mibs, nwRouter=nwRouter, ctNetwork=ctNetwork)
# -*- coding: utf-8 -*- class Solution: def distributeCandies(self, candies): return min(len(candies) / 2, len(set(candies))) if __name__ == '__main__': solution = Solution() assert 3 == solution.distributeCandies([1, 1, 2, 2, 3, 3]) assert 2 == solution.distributeCandies([1, 1, 2, 3])
class Solution: def distribute_candies(self, candies): return min(len(candies) / 2, len(set(candies))) if __name__ == '__main__': solution = solution() assert 3 == solution.distributeCandies([1, 1, 2, 2, 3, 3]) assert 2 == solution.distributeCandies([1, 1, 2, 3])
#author: n01 """ Useful termcolor attributes (attrs for short) @Usage: colored("stringa", COLOR, attrs=ATTRIBUTE) These attributes are list with a single element to create longer list just add the attributes together e.g. BLINK + BOLD gives you ['blink', 'bold'] """ BLINK = ["blink"] BOLD = ["bold"] DARK = ["dark"] UNDERLINE = ["underline"] REVERSE = ["reverse"] CONCEALED = ["concealed"] NO_ATTRS = [] #Empty list when you don't want effects to be applied ATTRS = [BLINK, BOLD, DARK, UNDERLINE, REVERSE, CONCEALED, NO_ATTRS]
""" Useful termcolor attributes (attrs for short) @Usage: colored("stringa", COLOR, attrs=ATTRIBUTE) These attributes are list with a single element to create longer list just add the attributes together e.g. BLINK + BOLD gives you ['blink', 'bold'] """ blink = ['blink'] bold = ['bold'] dark = ['dark'] underline = ['underline'] reverse = ['reverse'] concealed = ['concealed'] no_attrs = [] attrs = [BLINK, BOLD, DARK, UNDERLINE, REVERSE, CONCEALED, NO_ATTRS]
''' The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ''' def can_paginate(operation_name=None): """ Check if an operation can be paginated. :type operation_name: string :param operation_name: The operation name. This is the same name\nas the method name on the client. For example, if the\nmethod name is create_foo, and you\'d normally invoke the\noperation as client.create_foo(**kwargs), if the\ncreate_foo operation can be paginated, you can use the\ncall client.get_paginator('create_foo'). """ pass def create_notification_rule(Name=None, EventTypeIds=None, Resource=None, Targets=None, DetailType=None, ClientRequestToken=None, Tags=None, Status=None): """ Creates a notification rule for a resource. The rule specifies the events you want notifications about and the targets (such as SNS topics) where you want to receive them. See also: AWS API Documentation Exceptions :example: response = client.create_notification_rule( Name='string', EventTypeIds=[ 'string', ], Resource='string', Targets=[ { 'TargetType': 'string', 'TargetAddress': 'string' }, ], DetailType='BASIC'|'FULL', ClientRequestToken='string', Tags={ 'string': 'string' }, Status='ENABLED'|'DISABLED' ) :type Name: string :param Name: [REQUIRED]\nThe name for the notification rule. Notifictaion rule names must be unique in your AWS account.\n :type EventTypeIds: list :param EventTypeIds: [REQUIRED]\nA list of event types associated with this notification rule. For a list of allowed events, see EventTypeSummary .\n\n(string) --\n\n :type Resource: string :param Resource: [REQUIRED]\nThe Amazon Resource Name (ARN) of the resource to associate with the notification rule. Supported resources include pipelines in AWS CodePipeline, repositories in AWS CodeCommit, and build projects in AWS CodeBuild.\n :type Targets: list :param Targets: [REQUIRED]\nA list of Amazon Resource Names (ARNs) of SNS topics to associate with the notification rule.\n\n(dict) --Information about the SNS topics associated with a notification rule.\n\nTargetType (string) --The target type. Can be an Amazon SNS topic.\n\nTargetAddress (string) --The Amazon Resource Name (ARN) of the SNS topic.\n\n\n\n\n :type DetailType: string :param DetailType: [REQUIRED]\nThe level of detail to include in the notifications for this resource. BASIC will include only the contents of the event as it would appear in AWS CloudWatch. FULL will include any supplemental information provided by AWS CodeStar Notifications and/or the service for the resource for which the notification is created.\n :type ClientRequestToken: string :param ClientRequestToken: A unique, client-generated idempotency token that, when provided in a request, ensures the request cannot be repeated with a changed parameter. If a request with the same parameters is received and a token is included, the request returns information about the initial request that used that token.\n\nNote\nThe AWS SDKs prepopulate client request tokens. If you are using an AWS SDK, an idempotency token is created for you.\n\nThis field is autopopulated if not provided.\n :type Tags: dict :param Tags: A list of tags to apply to this notification rule. Key names cannot start with 'aws'.\n\n(string) --\n(string) --\n\n\n\n :type Status: string :param Status: The status of the notification rule. The default value is ENABLED. If the status is set to DISABLED, notifications aren\'t sent for the notification rule. :rtype: dict ReturnsResponse Syntax { 'Arn': 'string' } Response Structure (dict) -- Arn (string) -- The Amazon Resource Name (ARN) of the notification rule. Exceptions CodeStarNotifications.Client.exceptions.ResourceAlreadyExistsException CodeStarNotifications.Client.exceptions.ValidationException CodeStarNotifications.Client.exceptions.LimitExceededException CodeStarNotifications.Client.exceptions.ConfigurationException CodeStarNotifications.Client.exceptions.ConcurrentModificationException CodeStarNotifications.Client.exceptions.AccessDeniedException :return: { 'Arn': 'string' } :returns: CodeStarNotifications.Client.exceptions.ResourceAlreadyExistsException CodeStarNotifications.Client.exceptions.ValidationException CodeStarNotifications.Client.exceptions.LimitExceededException CodeStarNotifications.Client.exceptions.ConfigurationException CodeStarNotifications.Client.exceptions.ConcurrentModificationException CodeStarNotifications.Client.exceptions.AccessDeniedException """ pass def delete_notification_rule(Arn=None): """ Deletes a notification rule for a resource. See also: AWS API Documentation Exceptions :example: response = client.delete_notification_rule( Arn='string' ) :type Arn: string :param Arn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the notification rule you want to delete.\n :rtype: dict ReturnsResponse Syntax{ 'Arn': 'string' } Response Structure (dict) -- Arn (string) --The Amazon Resource Name (ARN) of the deleted notification rule. Exceptions CodeStarNotifications.Client.exceptions.ValidationException CodeStarNotifications.Client.exceptions.LimitExceededException CodeStarNotifications.Client.exceptions.ConcurrentModificationException :return: { 'Arn': 'string' } """ pass def delete_target(TargetAddress=None, ForceUnsubscribeAll=None): """ Deletes a specified target for notifications. See also: AWS API Documentation Exceptions :example: response = client.delete_target( TargetAddress='string', ForceUnsubscribeAll=True|False ) :type TargetAddress: string :param TargetAddress: [REQUIRED]\nThe Amazon Resource Name (ARN) of the SNS topic to delete.\n :type ForceUnsubscribeAll: boolean :param ForceUnsubscribeAll: A Boolean value that can be used to delete all associations with this SNS topic. The default value is FALSE. If set to TRUE, all associations between that target and every notification rule in your AWS account are deleted. :rtype: dict ReturnsResponse Syntax {} Response Structure (dict) -- Exceptions CodeStarNotifications.Client.exceptions.ValidationException :return: {} :returns: (dict) -- """ pass def describe_notification_rule(Arn=None): """ Returns information about a specified notification rule. See also: AWS API Documentation Exceptions :example: response = client.describe_notification_rule( Arn='string' ) :type Arn: string :param Arn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the notification rule.\n :rtype: dict ReturnsResponse Syntax{ 'Arn': 'string', 'Name': 'string', 'EventTypes': [ { 'EventTypeId': 'string', 'ServiceName': 'string', 'EventTypeName': 'string', 'ResourceType': 'string' }, ], 'Resource': 'string', 'Targets': [ { 'TargetAddress': 'string', 'TargetType': 'string', 'TargetStatus': 'PENDING'|'ACTIVE'|'UNREACHABLE'|'INACTIVE'|'DEACTIVATED' }, ], 'DetailType': 'BASIC'|'FULL', 'CreatedBy': 'string', 'Status': 'ENABLED'|'DISABLED', 'CreatedTimestamp': datetime(2015, 1, 1), 'LastModifiedTimestamp': datetime(2015, 1, 1), 'Tags': { 'string': 'string' } } Response Structure (dict) -- Arn (string) --The Amazon Resource Name (ARN) of the notification rule. Name (string) --The name of the notification rule. EventTypes (list) --A list of the event types associated with the notification rule. (dict) --Returns information about an event that has triggered a notification rule. EventTypeId (string) --The system-generated ID of the event. ServiceName (string) --The name of the service for which the event applies. EventTypeName (string) --The name of the event. ResourceType (string) --The resource type of the event. Resource (string) --The Amazon Resource Name (ARN) of the resource associated with the notification rule. Targets (list) --A list of the SNS topics associated with the notification rule. (dict) --Information about the targets specified for a notification rule. TargetAddress (string) --The Amazon Resource Name (ARN) of the SNS topic. TargetType (string) --The type of the target (for example, SNS). TargetStatus (string) --The status of the target. DetailType (string) --The level of detail included in the notifications for this resource. BASIC will include only the contents of the event as it would appear in AWS CloudWatch. FULL will include any supplemental information provided by AWS CodeStar Notifications and/or the service for the resource for which the notification is created. CreatedBy (string) --The name or email alias of the person who created the notification rule. Status (string) --The status of the notification rule. Valid statuses are on (sending notifications) or off (not sending notifications). CreatedTimestamp (datetime) --The date and time the notification rule was created, in timestamp format. LastModifiedTimestamp (datetime) --The date and time the notification rule was most recently updated, in timestamp format. Tags (dict) --The tags associated with the notification rule. (string) -- (string) -- Exceptions CodeStarNotifications.Client.exceptions.ResourceNotFoundException CodeStarNotifications.Client.exceptions.ValidationException :return: { 'Arn': 'string', 'Name': 'string', 'EventTypes': [ { 'EventTypeId': 'string', 'ServiceName': 'string', 'EventTypeName': 'string', 'ResourceType': 'string' }, ], 'Resource': 'string', 'Targets': [ { 'TargetAddress': 'string', 'TargetType': 'string', 'TargetStatus': 'PENDING'|'ACTIVE'|'UNREACHABLE'|'INACTIVE'|'DEACTIVATED' }, ], 'DetailType': 'BASIC'|'FULL', 'CreatedBy': 'string', 'Status': 'ENABLED'|'DISABLED', 'CreatedTimestamp': datetime(2015, 1, 1), 'LastModifiedTimestamp': datetime(2015, 1, 1), 'Tags': { 'string': 'string' } } :returns: CodeStarNotifications.Client.exceptions.ResourceNotFoundException CodeStarNotifications.Client.exceptions.ValidationException """ pass def generate_presigned_url(ClientMethod=None, Params=None, ExpiresIn=None, HttpMethod=None): """ Generate a presigned url given a client, its method, and arguments :type ClientMethod: string :param ClientMethod: The client method to presign for :type Params: dict :param Params: The parameters normally passed to\nClientMethod. :type ExpiresIn: int :param ExpiresIn: The number of seconds the presigned url is valid\nfor. By default it expires in an hour (3600 seconds) :type HttpMethod: string :param HttpMethod: The http method to use on the generated url. By\ndefault, the http method is whatever is used in the method\'s model. """ pass def get_paginator(operation_name=None): """ Create a paginator for an operation. :type operation_name: string :param operation_name: The operation name. This is the same name\nas the method name on the client. For example, if the\nmethod name is create_foo, and you\'d normally invoke the\noperation as client.create_foo(**kwargs), if the\ncreate_foo operation can be paginated, you can use the\ncall client.get_paginator('create_foo'). :rtype: L{botocore.paginate.Paginator} ReturnsA paginator object. """ pass def get_waiter(waiter_name=None): """ Returns an object that can wait for some condition. :type waiter_name: str :param waiter_name: The name of the waiter to get. See the waiters\nsection of the service docs for a list of available waiters. :rtype: botocore.waiter.Waiter """ pass def list_event_types(Filters=None, NextToken=None, MaxResults=None): """ Returns information about the event types available for configuring notifications. See also: AWS API Documentation Exceptions :example: response = client.list_event_types( Filters=[ { 'Name': 'RESOURCE_TYPE'|'SERVICE_NAME', 'Value': 'string' }, ], NextToken='string', MaxResults=123 ) :type Filters: list :param Filters: The filters to use to return information by service or resource type.\n\n(dict) --Information about a filter to apply to the list of returned event types. You can filter by resource type or service name.\n\nName (string) -- [REQUIRED]The system-generated name of the filter type you want to filter by.\n\nValue (string) -- [REQUIRED]The name of the resource type (for example, pipeline) or service name (for example, CodePipeline) that you want to filter by.\n\n\n\n\n :type NextToken: string :param NextToken: An enumeration token that, when provided in a request, returns the next batch of the results. :type MaxResults: integer :param MaxResults: A non-negative integer used to limit the number of returned results. The default number is 50. The maximum number of results that can be returned is 100. :rtype: dict ReturnsResponse Syntax { 'EventTypes': [ { 'EventTypeId': 'string', 'ServiceName': 'string', 'EventTypeName': 'string', 'ResourceType': 'string' }, ], 'NextToken': 'string' } Response Structure (dict) -- EventTypes (list) -- Information about each event, including service name, resource type, event ID, and event name. (dict) -- Returns information about an event that has triggered a notification rule. EventTypeId (string) -- The system-generated ID of the event. ServiceName (string) -- The name of the service for which the event applies. EventTypeName (string) -- The name of the event. ResourceType (string) -- The resource type of the event. NextToken (string) -- An enumeration token that can be used in a request to return the next batch of the results. Exceptions CodeStarNotifications.Client.exceptions.InvalidNextTokenException CodeStarNotifications.Client.exceptions.ValidationException :return: { 'EventTypes': [ { 'EventTypeId': 'string', 'ServiceName': 'string', 'EventTypeName': 'string', 'ResourceType': 'string' }, ], 'NextToken': 'string' } :returns: CodeStarNotifications.Client.exceptions.InvalidNextTokenException CodeStarNotifications.Client.exceptions.ValidationException """ pass def list_notification_rules(Filters=None, NextToken=None, MaxResults=None): """ Returns a list of the notification rules for an AWS account. See also: AWS API Documentation Exceptions :example: response = client.list_notification_rules( Filters=[ { 'Name': 'EVENT_TYPE_ID'|'CREATED_BY'|'RESOURCE'|'TARGET_ADDRESS', 'Value': 'string' }, ], NextToken='string', MaxResults=123 ) :type Filters: list :param Filters: The filters to use to return information by service or resource type. For valid values, see ListNotificationRulesFilter .\n\nNote\nA filter with the same name can appear more than once when used with OR statements. Filters with different names should be applied with AND statements.\n\n\n(dict) --Information about a filter to apply to the list of returned notification rules. You can filter by event type, owner, resource, or target.\n\nName (string) -- [REQUIRED]The name of the attribute you want to use to filter the returned notification rules.\n\nValue (string) -- [REQUIRED]The value of the attribute you want to use to filter the returned notification rules. For example, if you specify filtering by RESOURCE in Name, you might specify the ARN of a pipeline in AWS CodePipeline for the value.\n\n\n\n\n :type NextToken: string :param NextToken: An enumeration token that, when provided in a request, returns the next batch of the results. :type MaxResults: integer :param MaxResults: A non-negative integer used to limit the number of returned results. The maximum number of results that can be returned is 100. :rtype: dict ReturnsResponse Syntax { 'NextToken': 'string', 'NotificationRules': [ { 'Id': 'string', 'Arn': 'string' }, ] } Response Structure (dict) -- NextToken (string) -- An enumeration token that can be used in a request to return the next batch of the results. NotificationRules (list) -- The list of notification rules for the AWS account, by Amazon Resource Name (ARN) and ID. (dict) -- Information about a specified notification rule. Id (string) -- The unique ID of the notification rule. Arn (string) -- The Amazon Resource Name (ARN) of the notification rule. Exceptions CodeStarNotifications.Client.exceptions.InvalidNextTokenException CodeStarNotifications.Client.exceptions.ValidationException :return: { 'NextToken': 'string', 'NotificationRules': [ { 'Id': 'string', 'Arn': 'string' }, ] } :returns: CodeStarNotifications.Client.exceptions.InvalidNextTokenException CodeStarNotifications.Client.exceptions.ValidationException """ pass def list_tags_for_resource(Arn=None): """ Returns a list of the tags associated with a notification rule. See also: AWS API Documentation Exceptions :example: response = client.list_tags_for_resource( Arn='string' ) :type Arn: string :param Arn: [REQUIRED]\nThe Amazon Resource Name (ARN) for the notification rule.\n :rtype: dict ReturnsResponse Syntax{ 'Tags': { 'string': 'string' } } Response Structure (dict) -- Tags (dict) --The tags associated with the notification rule. (string) -- (string) -- Exceptions CodeStarNotifications.Client.exceptions.ResourceNotFoundException CodeStarNotifications.Client.exceptions.ValidationException :return: { 'Tags': { 'string': 'string' } } :returns: CodeStarNotifications.Client.exceptions.ResourceNotFoundException CodeStarNotifications.Client.exceptions.ValidationException """ pass def list_targets(Filters=None, NextToken=None, MaxResults=None): """ Returns a list of the notification rule targets for an AWS account. See also: AWS API Documentation Exceptions :example: response = client.list_targets( Filters=[ { 'Name': 'TARGET_TYPE'|'TARGET_ADDRESS'|'TARGET_STATUS', 'Value': 'string' }, ], NextToken='string', MaxResults=123 ) :type Filters: list :param Filters: The filters to use to return information by service or resource type. Valid filters include target type, target address, and target status.\n\nNote\nA filter with the same name can appear more than once when used with OR statements. Filters with different names should be applied with AND statements.\n\n\n(dict) --Information about a filter to apply to the list of returned targets. You can filter by target type, address, or status. For example, to filter results to notification rules that have active Amazon SNS topics as targets, you could specify a ListTargetsFilter Name as TargetType and a Value of SNS, and a Name of TARGET_STATUS and a Value of ACTIVE.\n\nName (string) -- [REQUIRED]The name of the attribute you want to use to filter the returned targets.\n\nValue (string) -- [REQUIRED]The value of the attribute you want to use to filter the returned targets. For example, if you specify SNS for the Target type, you could specify an Amazon Resource Name (ARN) for a topic as the value.\n\n\n\n\n :type NextToken: string :param NextToken: An enumeration token that, when provided in a request, returns the next batch of the results. :type MaxResults: integer :param MaxResults: A non-negative integer used to limit the number of returned results. The maximum number of results that can be returned is 100. :rtype: dict ReturnsResponse Syntax { 'Targets': [ { 'TargetAddress': 'string', 'TargetType': 'string', 'TargetStatus': 'PENDING'|'ACTIVE'|'UNREACHABLE'|'INACTIVE'|'DEACTIVATED' }, ], 'NextToken': 'string' } Response Structure (dict) -- Targets (list) -- The list of notification rule targets. (dict) -- Information about the targets specified for a notification rule. TargetAddress (string) -- The Amazon Resource Name (ARN) of the SNS topic. TargetType (string) -- The type of the target (for example, SNS). TargetStatus (string) -- The status of the target. NextToken (string) -- An enumeration token that can be used in a request to return the next batch of results. Exceptions CodeStarNotifications.Client.exceptions.InvalidNextTokenException CodeStarNotifications.Client.exceptions.ValidationException :return: { 'Targets': [ { 'TargetAddress': 'string', 'TargetType': 'string', 'TargetStatus': 'PENDING'|'ACTIVE'|'UNREACHABLE'|'INACTIVE'|'DEACTIVATED' }, ], 'NextToken': 'string' } :returns: CodeStarNotifications.Client.exceptions.InvalidNextTokenException CodeStarNotifications.Client.exceptions.ValidationException """ pass def subscribe(Arn=None, Target=None, ClientRequestToken=None): """ Creates an association between a notification rule and an SNS topic so that the associated target can receive notifications when the events described in the rule are triggered. See also: AWS API Documentation Exceptions :example: response = client.subscribe( Arn='string', Target={ 'TargetType': 'string', 'TargetAddress': 'string' }, ClientRequestToken='string' ) :type Arn: string :param Arn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the notification rule for which you want to create the association.\n :type Target: dict :param Target: [REQUIRED]\nInformation about the SNS topics associated with a notification rule.\n\nTargetType (string) --The target type. Can be an Amazon SNS topic.\n\nTargetAddress (string) --The Amazon Resource Name (ARN) of the SNS topic.\n\n\n :type ClientRequestToken: string :param ClientRequestToken: An enumeration token that, when provided in a request, returns the next batch of the results. :rtype: dict ReturnsResponse Syntax { 'Arn': 'string' } Response Structure (dict) -- Arn (string) -- The Amazon Resource Name (ARN) of the notification rule for which you have created assocations. Exceptions CodeStarNotifications.Client.exceptions.ValidationException CodeStarNotifications.Client.exceptions.ResourceNotFoundException :return: { 'Arn': 'string' } :returns: CodeStarNotifications.Client.exceptions.ValidationException CodeStarNotifications.Client.exceptions.ResourceNotFoundException """ pass def tag_resource(Arn=None, Tags=None): """ Associates a set of provided tags with a notification rule. See also: AWS API Documentation Exceptions :example: response = client.tag_resource( Arn='string', Tags={ 'string': 'string' } ) :type Arn: string :param Arn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the notification rule to tag.\n :type Tags: dict :param Tags: [REQUIRED]\nThe list of tags to associate with the resource. Tag key names cannot start with 'aws'.\n\n(string) --\n(string) --\n\n\n\n :rtype: dict ReturnsResponse Syntax { 'Tags': { 'string': 'string' } } Response Structure (dict) -- Tags (dict) -- The list of tags associated with the resource. (string) -- (string) -- Exceptions CodeStarNotifications.Client.exceptions.ResourceNotFoundException CodeStarNotifications.Client.exceptions.ValidationException CodeStarNotifications.Client.exceptions.ConcurrentModificationException :return: { 'Tags': { 'string': 'string' } } :returns: (string) -- (string) -- """ pass def unsubscribe(Arn=None, TargetAddress=None): """ Removes an association between a notification rule and an Amazon SNS topic so that subscribers to that topic stop receiving notifications when the events described in the rule are triggered. See also: AWS API Documentation Exceptions :example: response = client.unsubscribe( Arn='string', TargetAddress='string' ) :type Arn: string :param Arn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the notification rule.\n :type TargetAddress: string :param TargetAddress: [REQUIRED]\nThe ARN of the SNS topic to unsubscribe from the notification rule.\n :rtype: dict ReturnsResponse Syntax { 'Arn': 'string' } Response Structure (dict) -- Arn (string) -- The Amazon Resource Name (ARN) of the the notification rule from which you have removed a subscription. Exceptions CodeStarNotifications.Client.exceptions.ValidationException :return: { 'Arn': 'string' } :returns: CodeStarNotifications.Client.exceptions.ValidationException """ pass def untag_resource(Arn=None, TagKeys=None): """ Removes the association between one or more provided tags and a notification rule. See also: AWS API Documentation Exceptions :example: response = client.untag_resource( Arn='string', TagKeys=[ 'string', ] ) :type Arn: string :param Arn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the notification rule from which to remove the tags.\n :type TagKeys: list :param TagKeys: [REQUIRED]\nThe key names of the tags to remove.\n\n(string) --\n\n :rtype: dict ReturnsResponse Syntax {} Response Structure (dict) -- Exceptions CodeStarNotifications.Client.exceptions.ResourceNotFoundException CodeStarNotifications.Client.exceptions.ValidationException CodeStarNotifications.Client.exceptions.ConcurrentModificationException :return: {} :returns: (dict) -- """ pass def update_notification_rule(Arn=None, Name=None, Status=None, EventTypeIds=None, Targets=None, DetailType=None): """ Updates a notification rule for a resource. You can change the events that trigger the notification rule, the status of the rule, and the targets that receive the notifications. See also: AWS API Documentation Exceptions :example: response = client.update_notification_rule( Arn='string', Name='string', Status='ENABLED'|'DISABLED', EventTypeIds=[ 'string', ], Targets=[ { 'TargetType': 'string', 'TargetAddress': 'string' }, ], DetailType='BASIC'|'FULL' ) :type Arn: string :param Arn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the notification rule.\n :type Name: string :param Name: The name of the notification rule. :type Status: string :param Status: The status of the notification rule. Valid statuses include enabled (sending notifications) or disabled (not sending notifications). :type EventTypeIds: list :param EventTypeIds: A list of event types associated with this notification rule.\n\n(string) --\n\n :type Targets: list :param Targets: The address and type of the targets to receive notifications from this notification rule.\n\n(dict) --Information about the SNS topics associated with a notification rule.\n\nTargetType (string) --The target type. Can be an Amazon SNS topic.\n\nTargetAddress (string) --The Amazon Resource Name (ARN) of the SNS topic.\n\n\n\n\n :type DetailType: string :param DetailType: The level of detail to include in the notifications for this resource. BASIC will include only the contents of the event as it would appear in AWS CloudWatch. FULL will include any supplemental information provided by AWS CodeStar Notifications and/or the service for the resource for which the notification is created. :rtype: dict ReturnsResponse Syntax {} Response Structure (dict) -- Exceptions CodeStarNotifications.Client.exceptions.ValidationException CodeStarNotifications.Client.exceptions.ResourceNotFoundException :return: {} :returns: (dict) -- """ pass
""" The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ def can_paginate(operation_name=None): """ Check if an operation can be paginated. :type operation_name: string :param operation_name: The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator('create_foo'). """ pass def create_notification_rule(Name=None, EventTypeIds=None, Resource=None, Targets=None, DetailType=None, ClientRequestToken=None, Tags=None, Status=None): """ Creates a notification rule for a resource. The rule specifies the events you want notifications about and the targets (such as SNS topics) where you want to receive them. See also: AWS API Documentation Exceptions :example: response = client.create_notification_rule( Name='string', EventTypeIds=[ 'string', ], Resource='string', Targets=[ { 'TargetType': 'string', 'TargetAddress': 'string' }, ], DetailType='BASIC'|'FULL', ClientRequestToken='string', Tags={ 'string': 'string' }, Status='ENABLED'|'DISABLED' ) :type Name: string :param Name: [REQUIRED] The name for the notification rule. Notifictaion rule names must be unique in your AWS account. :type EventTypeIds: list :param EventTypeIds: [REQUIRED] A list of event types associated with this notification rule. For a list of allowed events, see EventTypeSummary . (string) -- :type Resource: string :param Resource: [REQUIRED] The Amazon Resource Name (ARN) of the resource to associate with the notification rule. Supported resources include pipelines in AWS CodePipeline, repositories in AWS CodeCommit, and build projects in AWS CodeBuild. :type Targets: list :param Targets: [REQUIRED] A list of Amazon Resource Names (ARNs) of SNS topics to associate with the notification rule. (dict) --Information about the SNS topics associated with a notification rule. TargetType (string) --The target type. Can be an Amazon SNS topic. TargetAddress (string) --The Amazon Resource Name (ARN) of the SNS topic. :type DetailType: string :param DetailType: [REQUIRED] The level of detail to include in the notifications for this resource. BASIC will include only the contents of the event as it would appear in AWS CloudWatch. FULL will include any supplemental information provided by AWS CodeStar Notifications and/or the service for the resource for which the notification is created. :type ClientRequestToken: string :param ClientRequestToken: A unique, client-generated idempotency token that, when provided in a request, ensures the request cannot be repeated with a changed parameter. If a request with the same parameters is received and a token is included, the request returns information about the initial request that used that token. Note The AWS SDKs prepopulate client request tokens. If you are using an AWS SDK, an idempotency token is created for you. This field is autopopulated if not provided. :type Tags: dict :param Tags: A list of tags to apply to this notification rule. Key names cannot start with 'aws'. (string) -- (string) -- :type Status: string :param Status: The status of the notification rule. The default value is ENABLED. If the status is set to DISABLED, notifications aren't sent for the notification rule. :rtype: dict ReturnsResponse Syntax { 'Arn': 'string' } Response Structure (dict) -- Arn (string) -- The Amazon Resource Name (ARN) of the notification rule. Exceptions CodeStarNotifications.Client.exceptions.ResourceAlreadyExistsException CodeStarNotifications.Client.exceptions.ValidationException CodeStarNotifications.Client.exceptions.LimitExceededException CodeStarNotifications.Client.exceptions.ConfigurationException CodeStarNotifications.Client.exceptions.ConcurrentModificationException CodeStarNotifications.Client.exceptions.AccessDeniedException :return: { 'Arn': 'string' } :returns: CodeStarNotifications.Client.exceptions.ResourceAlreadyExistsException CodeStarNotifications.Client.exceptions.ValidationException CodeStarNotifications.Client.exceptions.LimitExceededException CodeStarNotifications.Client.exceptions.ConfigurationException CodeStarNotifications.Client.exceptions.ConcurrentModificationException CodeStarNotifications.Client.exceptions.AccessDeniedException """ pass def delete_notification_rule(Arn=None): """ Deletes a notification rule for a resource. See also: AWS API Documentation Exceptions :example: response = client.delete_notification_rule( Arn='string' ) :type Arn: string :param Arn: [REQUIRED] The Amazon Resource Name (ARN) of the notification rule you want to delete. :rtype: dict ReturnsResponse Syntax{ 'Arn': 'string' } Response Structure (dict) -- Arn (string) --The Amazon Resource Name (ARN) of the deleted notification rule. Exceptions CodeStarNotifications.Client.exceptions.ValidationException CodeStarNotifications.Client.exceptions.LimitExceededException CodeStarNotifications.Client.exceptions.ConcurrentModificationException :return: { 'Arn': 'string' } """ pass def delete_target(TargetAddress=None, ForceUnsubscribeAll=None): """ Deletes a specified target for notifications. See also: AWS API Documentation Exceptions :example: response = client.delete_target( TargetAddress='string', ForceUnsubscribeAll=True|False ) :type TargetAddress: string :param TargetAddress: [REQUIRED] The Amazon Resource Name (ARN) of the SNS topic to delete. :type ForceUnsubscribeAll: boolean :param ForceUnsubscribeAll: A Boolean value that can be used to delete all associations with this SNS topic. The default value is FALSE. If set to TRUE, all associations between that target and every notification rule in your AWS account are deleted. :rtype: dict ReturnsResponse Syntax {} Response Structure (dict) -- Exceptions CodeStarNotifications.Client.exceptions.ValidationException :return: {} :returns: (dict) -- """ pass def describe_notification_rule(Arn=None): """ Returns information about a specified notification rule. See also: AWS API Documentation Exceptions :example: response = client.describe_notification_rule( Arn='string' ) :type Arn: string :param Arn: [REQUIRED] The Amazon Resource Name (ARN) of the notification rule. :rtype: dict ReturnsResponse Syntax{ 'Arn': 'string', 'Name': 'string', 'EventTypes': [ { 'EventTypeId': 'string', 'ServiceName': 'string', 'EventTypeName': 'string', 'ResourceType': 'string' }, ], 'Resource': 'string', 'Targets': [ { 'TargetAddress': 'string', 'TargetType': 'string', 'TargetStatus': 'PENDING'|'ACTIVE'|'UNREACHABLE'|'INACTIVE'|'DEACTIVATED' }, ], 'DetailType': 'BASIC'|'FULL', 'CreatedBy': 'string', 'Status': 'ENABLED'|'DISABLED', 'CreatedTimestamp': datetime(2015, 1, 1), 'LastModifiedTimestamp': datetime(2015, 1, 1), 'Tags': { 'string': 'string' } } Response Structure (dict) -- Arn (string) --The Amazon Resource Name (ARN) of the notification rule. Name (string) --The name of the notification rule. EventTypes (list) --A list of the event types associated with the notification rule. (dict) --Returns information about an event that has triggered a notification rule. EventTypeId (string) --The system-generated ID of the event. ServiceName (string) --The name of the service for which the event applies. EventTypeName (string) --The name of the event. ResourceType (string) --The resource type of the event. Resource (string) --The Amazon Resource Name (ARN) of the resource associated with the notification rule. Targets (list) --A list of the SNS topics associated with the notification rule. (dict) --Information about the targets specified for a notification rule. TargetAddress (string) --The Amazon Resource Name (ARN) of the SNS topic. TargetType (string) --The type of the target (for example, SNS). TargetStatus (string) --The status of the target. DetailType (string) --The level of detail included in the notifications for this resource. BASIC will include only the contents of the event as it would appear in AWS CloudWatch. FULL will include any supplemental information provided by AWS CodeStar Notifications and/or the service for the resource for which the notification is created. CreatedBy (string) --The name or email alias of the person who created the notification rule. Status (string) --The status of the notification rule. Valid statuses are on (sending notifications) or off (not sending notifications). CreatedTimestamp (datetime) --The date and time the notification rule was created, in timestamp format. LastModifiedTimestamp (datetime) --The date and time the notification rule was most recently updated, in timestamp format. Tags (dict) --The tags associated with the notification rule. (string) -- (string) -- Exceptions CodeStarNotifications.Client.exceptions.ResourceNotFoundException CodeStarNotifications.Client.exceptions.ValidationException :return: { 'Arn': 'string', 'Name': 'string', 'EventTypes': [ { 'EventTypeId': 'string', 'ServiceName': 'string', 'EventTypeName': 'string', 'ResourceType': 'string' }, ], 'Resource': 'string', 'Targets': [ { 'TargetAddress': 'string', 'TargetType': 'string', 'TargetStatus': 'PENDING'|'ACTIVE'|'UNREACHABLE'|'INACTIVE'|'DEACTIVATED' }, ], 'DetailType': 'BASIC'|'FULL', 'CreatedBy': 'string', 'Status': 'ENABLED'|'DISABLED', 'CreatedTimestamp': datetime(2015, 1, 1), 'LastModifiedTimestamp': datetime(2015, 1, 1), 'Tags': { 'string': 'string' } } :returns: CodeStarNotifications.Client.exceptions.ResourceNotFoundException CodeStarNotifications.Client.exceptions.ValidationException """ pass def generate_presigned_url(ClientMethod=None, Params=None, ExpiresIn=None, HttpMethod=None): """ Generate a presigned url given a client, its method, and arguments :type ClientMethod: string :param ClientMethod: The client method to presign for :type Params: dict :param Params: The parameters normally passed to ClientMethod. :type ExpiresIn: int :param ExpiresIn: The number of seconds the presigned url is valid for. By default it expires in an hour (3600 seconds) :type HttpMethod: string :param HttpMethod: The http method to use on the generated url. By default, the http method is whatever is used in the method's model. """ pass def get_paginator(operation_name=None): """ Create a paginator for an operation. :type operation_name: string :param operation_name: The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator('create_foo'). :rtype: L{botocore.paginate.Paginator} ReturnsA paginator object. """ pass def get_waiter(waiter_name=None): """ Returns an object that can wait for some condition. :type waiter_name: str :param waiter_name: The name of the waiter to get. See the waiters section of the service docs for a list of available waiters. :rtype: botocore.waiter.Waiter """ pass def list_event_types(Filters=None, NextToken=None, MaxResults=None): """ Returns information about the event types available for configuring notifications. See also: AWS API Documentation Exceptions :example: response = client.list_event_types( Filters=[ { 'Name': 'RESOURCE_TYPE'|'SERVICE_NAME', 'Value': 'string' }, ], NextToken='string', MaxResults=123 ) :type Filters: list :param Filters: The filters to use to return information by service or resource type. (dict) --Information about a filter to apply to the list of returned event types. You can filter by resource type or service name. Name (string) -- [REQUIRED]The system-generated name of the filter type you want to filter by. Value (string) -- [REQUIRED]The name of the resource type (for example, pipeline) or service name (for example, CodePipeline) that you want to filter by. :type NextToken: string :param NextToken: An enumeration token that, when provided in a request, returns the next batch of the results. :type MaxResults: integer :param MaxResults: A non-negative integer used to limit the number of returned results. The default number is 50. The maximum number of results that can be returned is 100. :rtype: dict ReturnsResponse Syntax { 'EventTypes': [ { 'EventTypeId': 'string', 'ServiceName': 'string', 'EventTypeName': 'string', 'ResourceType': 'string' }, ], 'NextToken': 'string' } Response Structure (dict) -- EventTypes (list) -- Information about each event, including service name, resource type, event ID, and event name. (dict) -- Returns information about an event that has triggered a notification rule. EventTypeId (string) -- The system-generated ID of the event. ServiceName (string) -- The name of the service for which the event applies. EventTypeName (string) -- The name of the event. ResourceType (string) -- The resource type of the event. NextToken (string) -- An enumeration token that can be used in a request to return the next batch of the results. Exceptions CodeStarNotifications.Client.exceptions.InvalidNextTokenException CodeStarNotifications.Client.exceptions.ValidationException :return: { 'EventTypes': [ { 'EventTypeId': 'string', 'ServiceName': 'string', 'EventTypeName': 'string', 'ResourceType': 'string' }, ], 'NextToken': 'string' } :returns: CodeStarNotifications.Client.exceptions.InvalidNextTokenException CodeStarNotifications.Client.exceptions.ValidationException """ pass def list_notification_rules(Filters=None, NextToken=None, MaxResults=None): """ Returns a list of the notification rules for an AWS account. See also: AWS API Documentation Exceptions :example: response = client.list_notification_rules( Filters=[ { 'Name': 'EVENT_TYPE_ID'|'CREATED_BY'|'RESOURCE'|'TARGET_ADDRESS', 'Value': 'string' }, ], NextToken='string', MaxResults=123 ) :type Filters: list :param Filters: The filters to use to return information by service or resource type. For valid values, see ListNotificationRulesFilter . Note A filter with the same name can appear more than once when used with OR statements. Filters with different names should be applied with AND statements. (dict) --Information about a filter to apply to the list of returned notification rules. You can filter by event type, owner, resource, or target. Name (string) -- [REQUIRED]The name of the attribute you want to use to filter the returned notification rules. Value (string) -- [REQUIRED]The value of the attribute you want to use to filter the returned notification rules. For example, if you specify filtering by RESOURCE in Name, you might specify the ARN of a pipeline in AWS CodePipeline for the value. :type NextToken: string :param NextToken: An enumeration token that, when provided in a request, returns the next batch of the results. :type MaxResults: integer :param MaxResults: A non-negative integer used to limit the number of returned results. The maximum number of results that can be returned is 100. :rtype: dict ReturnsResponse Syntax { 'NextToken': 'string', 'NotificationRules': [ { 'Id': 'string', 'Arn': 'string' }, ] } Response Structure (dict) -- NextToken (string) -- An enumeration token that can be used in a request to return the next batch of the results. NotificationRules (list) -- The list of notification rules for the AWS account, by Amazon Resource Name (ARN) and ID. (dict) -- Information about a specified notification rule. Id (string) -- The unique ID of the notification rule. Arn (string) -- The Amazon Resource Name (ARN) of the notification rule. Exceptions CodeStarNotifications.Client.exceptions.InvalidNextTokenException CodeStarNotifications.Client.exceptions.ValidationException :return: { 'NextToken': 'string', 'NotificationRules': [ { 'Id': 'string', 'Arn': 'string' }, ] } :returns: CodeStarNotifications.Client.exceptions.InvalidNextTokenException CodeStarNotifications.Client.exceptions.ValidationException """ pass def list_tags_for_resource(Arn=None): """ Returns a list of the tags associated with a notification rule. See also: AWS API Documentation Exceptions :example: response = client.list_tags_for_resource( Arn='string' ) :type Arn: string :param Arn: [REQUIRED] The Amazon Resource Name (ARN) for the notification rule. :rtype: dict ReturnsResponse Syntax{ 'Tags': { 'string': 'string' } } Response Structure (dict) -- Tags (dict) --The tags associated with the notification rule. (string) -- (string) -- Exceptions CodeStarNotifications.Client.exceptions.ResourceNotFoundException CodeStarNotifications.Client.exceptions.ValidationException :return: { 'Tags': { 'string': 'string' } } :returns: CodeStarNotifications.Client.exceptions.ResourceNotFoundException CodeStarNotifications.Client.exceptions.ValidationException """ pass def list_targets(Filters=None, NextToken=None, MaxResults=None): """ Returns a list of the notification rule targets for an AWS account. See also: AWS API Documentation Exceptions :example: response = client.list_targets( Filters=[ { 'Name': 'TARGET_TYPE'|'TARGET_ADDRESS'|'TARGET_STATUS', 'Value': 'string' }, ], NextToken='string', MaxResults=123 ) :type Filters: list :param Filters: The filters to use to return information by service or resource type. Valid filters include target type, target address, and target status. Note A filter with the same name can appear more than once when used with OR statements. Filters with different names should be applied with AND statements. (dict) --Information about a filter to apply to the list of returned targets. You can filter by target type, address, or status. For example, to filter results to notification rules that have active Amazon SNS topics as targets, you could specify a ListTargetsFilter Name as TargetType and a Value of SNS, and a Name of TARGET_STATUS and a Value of ACTIVE. Name (string) -- [REQUIRED]The name of the attribute you want to use to filter the returned targets. Value (string) -- [REQUIRED]The value of the attribute you want to use to filter the returned targets. For example, if you specify SNS for the Target type, you could specify an Amazon Resource Name (ARN) for a topic as the value. :type NextToken: string :param NextToken: An enumeration token that, when provided in a request, returns the next batch of the results. :type MaxResults: integer :param MaxResults: A non-negative integer used to limit the number of returned results. The maximum number of results that can be returned is 100. :rtype: dict ReturnsResponse Syntax { 'Targets': [ { 'TargetAddress': 'string', 'TargetType': 'string', 'TargetStatus': 'PENDING'|'ACTIVE'|'UNREACHABLE'|'INACTIVE'|'DEACTIVATED' }, ], 'NextToken': 'string' } Response Structure (dict) -- Targets (list) -- The list of notification rule targets. (dict) -- Information about the targets specified for a notification rule. TargetAddress (string) -- The Amazon Resource Name (ARN) of the SNS topic. TargetType (string) -- The type of the target (for example, SNS). TargetStatus (string) -- The status of the target. NextToken (string) -- An enumeration token that can be used in a request to return the next batch of results. Exceptions CodeStarNotifications.Client.exceptions.InvalidNextTokenException CodeStarNotifications.Client.exceptions.ValidationException :return: { 'Targets': [ { 'TargetAddress': 'string', 'TargetType': 'string', 'TargetStatus': 'PENDING'|'ACTIVE'|'UNREACHABLE'|'INACTIVE'|'DEACTIVATED' }, ], 'NextToken': 'string' } :returns: CodeStarNotifications.Client.exceptions.InvalidNextTokenException CodeStarNotifications.Client.exceptions.ValidationException """ pass def subscribe(Arn=None, Target=None, ClientRequestToken=None): """ Creates an association between a notification rule and an SNS topic so that the associated target can receive notifications when the events described in the rule are triggered. See also: AWS API Documentation Exceptions :example: response = client.subscribe( Arn='string', Target={ 'TargetType': 'string', 'TargetAddress': 'string' }, ClientRequestToken='string' ) :type Arn: string :param Arn: [REQUIRED] The Amazon Resource Name (ARN) of the notification rule for which you want to create the association. :type Target: dict :param Target: [REQUIRED] Information about the SNS topics associated with a notification rule. TargetType (string) --The target type. Can be an Amazon SNS topic. TargetAddress (string) --The Amazon Resource Name (ARN) of the SNS topic. :type ClientRequestToken: string :param ClientRequestToken: An enumeration token that, when provided in a request, returns the next batch of the results. :rtype: dict ReturnsResponse Syntax { 'Arn': 'string' } Response Structure (dict) -- Arn (string) -- The Amazon Resource Name (ARN) of the notification rule for which you have created assocations. Exceptions CodeStarNotifications.Client.exceptions.ValidationException CodeStarNotifications.Client.exceptions.ResourceNotFoundException :return: { 'Arn': 'string' } :returns: CodeStarNotifications.Client.exceptions.ValidationException CodeStarNotifications.Client.exceptions.ResourceNotFoundException """ pass def tag_resource(Arn=None, Tags=None): """ Associates a set of provided tags with a notification rule. See also: AWS API Documentation Exceptions :example: response = client.tag_resource( Arn='string', Tags={ 'string': 'string' } ) :type Arn: string :param Arn: [REQUIRED] The Amazon Resource Name (ARN) of the notification rule to tag. :type Tags: dict :param Tags: [REQUIRED] The list of tags to associate with the resource. Tag key names cannot start with 'aws'. (string) -- (string) -- :rtype: dict ReturnsResponse Syntax { 'Tags': { 'string': 'string' } } Response Structure (dict) -- Tags (dict) -- The list of tags associated with the resource. (string) -- (string) -- Exceptions CodeStarNotifications.Client.exceptions.ResourceNotFoundException CodeStarNotifications.Client.exceptions.ValidationException CodeStarNotifications.Client.exceptions.ConcurrentModificationException :return: { 'Tags': { 'string': 'string' } } :returns: (string) -- (string) -- """ pass def unsubscribe(Arn=None, TargetAddress=None): """ Removes an association between a notification rule and an Amazon SNS topic so that subscribers to that topic stop receiving notifications when the events described in the rule are triggered. See also: AWS API Documentation Exceptions :example: response = client.unsubscribe( Arn='string', TargetAddress='string' ) :type Arn: string :param Arn: [REQUIRED] The Amazon Resource Name (ARN) of the notification rule. :type TargetAddress: string :param TargetAddress: [REQUIRED] The ARN of the SNS topic to unsubscribe from the notification rule. :rtype: dict ReturnsResponse Syntax { 'Arn': 'string' } Response Structure (dict) -- Arn (string) -- The Amazon Resource Name (ARN) of the the notification rule from which you have removed a subscription. Exceptions CodeStarNotifications.Client.exceptions.ValidationException :return: { 'Arn': 'string' } :returns: CodeStarNotifications.Client.exceptions.ValidationException """ pass def untag_resource(Arn=None, TagKeys=None): """ Removes the association between one or more provided tags and a notification rule. See also: AWS API Documentation Exceptions :example: response = client.untag_resource( Arn='string', TagKeys=[ 'string', ] ) :type Arn: string :param Arn: [REQUIRED] The Amazon Resource Name (ARN) of the notification rule from which to remove the tags. :type TagKeys: list :param TagKeys: [REQUIRED] The key names of the tags to remove. (string) -- :rtype: dict ReturnsResponse Syntax {} Response Structure (dict) -- Exceptions CodeStarNotifications.Client.exceptions.ResourceNotFoundException CodeStarNotifications.Client.exceptions.ValidationException CodeStarNotifications.Client.exceptions.ConcurrentModificationException :return: {} :returns: (dict) -- """ pass def update_notification_rule(Arn=None, Name=None, Status=None, EventTypeIds=None, Targets=None, DetailType=None): """ Updates a notification rule for a resource. You can change the events that trigger the notification rule, the status of the rule, and the targets that receive the notifications. See also: AWS API Documentation Exceptions :example: response = client.update_notification_rule( Arn='string', Name='string', Status='ENABLED'|'DISABLED', EventTypeIds=[ 'string', ], Targets=[ { 'TargetType': 'string', 'TargetAddress': 'string' }, ], DetailType='BASIC'|'FULL' ) :type Arn: string :param Arn: [REQUIRED] The Amazon Resource Name (ARN) of the notification rule. :type Name: string :param Name: The name of the notification rule. :type Status: string :param Status: The status of the notification rule. Valid statuses include enabled (sending notifications) or disabled (not sending notifications). :type EventTypeIds: list :param EventTypeIds: A list of event types associated with this notification rule. (string) -- :type Targets: list :param Targets: The address and type of the targets to receive notifications from this notification rule. (dict) --Information about the SNS topics associated with a notification rule. TargetType (string) --The target type. Can be an Amazon SNS topic. TargetAddress (string) --The Amazon Resource Name (ARN) of the SNS topic. :type DetailType: string :param DetailType: The level of detail to include in the notifications for this resource. BASIC will include only the contents of the event as it would appear in AWS CloudWatch. FULL will include any supplemental information provided by AWS CodeStar Notifications and/or the service for the resource for which the notification is created. :rtype: dict ReturnsResponse Syntax {} Response Structure (dict) -- Exceptions CodeStarNotifications.Client.exceptions.ValidationException CodeStarNotifications.Client.exceptions.ResourceNotFoundException :return: {} :returns: (dict) -- """ pass
""" Write a function that will return the count of distinct case-insensitive alphabetic characters and numeric digits that occur more than once in the input string. The input string can be assumed to contain only alphabets (both uppercase and lowercase) and numeric digits. Example "abcde" -> 0 # no characters repeats more than once "aabbcde" -> 2 # 'a' and 'b' "aabBcde" -> 2 # 'a' occurs twice and 'b' twice (`b` and `B`) "indivisibility" -> 1 # 'i' occurs six times "Indivisibilities" -> 2 # 'i' occurs seven times and 's' occurs twice "aA11" -> 2 # 'a' and '1' "ABBA" -> 2 # 'A' and 'B' each occur twice """ def duplicate_count(text: str) -> int: """Counts amount of duplicates in a text. Examples: >>> assert duplicate_count("abcde") == 0 >>> assert duplicate_count("abcdea") == 1 >>> assert duplicate_count("indivisibility") == 1 """ return len( set(item for item in text.lower() if text.lower().count(item) > 1) ) if __name__ == "__main__": print(duplicate_count("abcde"))
""" Write a function that will return the count of distinct case-insensitive alphabetic characters and numeric digits that occur more than once in the input string. The input string can be assumed to contain only alphabets (both uppercase and lowercase) and numeric digits. Example "abcde" -> 0 # no characters repeats more than once "aabbcde" -> 2 # 'a' and 'b' "aabBcde" -> 2 # 'a' occurs twice and 'b' twice (`b` and `B`) "indivisibility" -> 1 # 'i' occurs six times "Indivisibilities" -> 2 # 'i' occurs seven times and 's' occurs twice "aA11" -> 2 # 'a' and '1' "ABBA" -> 2 # 'A' and 'B' each occur twice """ def duplicate_count(text: str) -> int: """Counts amount of duplicates in a text. Examples: >>> assert duplicate_count("abcde") == 0 >>> assert duplicate_count("abcdea") == 1 >>> assert duplicate_count("indivisibility") == 1 """ return len(set((item for item in text.lower() if text.lower().count(item) > 1))) if __name__ == '__main__': print(duplicate_count('abcde'))
# # PySNMP MIB module ELTEX-MES-IP (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELTEX-MES-IP # Produced by pysmi-0.3.4 at Wed May 1 13:00:06 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") ValueRangeConstraint, ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsIntersection") eltMes, = mibBuilder.importSymbols("ELTEX-MES", "eltMes") ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Bits, Counter64, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, iso, NotificationType, MibIdentifier, Gauge32, IpAddress, Counter32, TimeTicks, Unsigned32, ObjectIdentity, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "Counter64", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "NotificationType", "MibIdentifier", "Gauge32", "IpAddress", "Counter32", "TimeTicks", "Unsigned32", "ObjectIdentity", "Integer32") TextualConvention, TruthValue, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "TruthValue", "DisplayString") eltMesIpSpec = ModuleIdentity((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91)) eltMesIpSpec.setRevisions(('2006-06-22 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: eltMesIpSpec.setRevisionsDescriptions(('Initial version of this MIB.',)) if mibBuilder.loadTexts: eltMesIpSpec.setLastUpdated('201402120000Z') if mibBuilder.loadTexts: eltMesIpSpec.setOrganization('Eltex Enterprise Co, Ltd.') if mibBuilder.loadTexts: eltMesIpSpec.setContactInfo('www.eltex.nsk.ru') if mibBuilder.loadTexts: eltMesIpSpec.setDescription('The private MIB module definition for IP MIB.') eltMesOspf = MibIdentifier((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91, 1)) eltMesIcmpSpec = MibIdentifier((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91, 2)) eltIpIcmpPacketTable = MibTable((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91, 2, 1), ).setMaxAccess("readwrite") if mibBuilder.loadTexts: eltIpIcmpPacketTable.setStatus('current') if mibBuilder.loadTexts: eltIpIcmpPacketTable.setDescription('This table controls the ability to send ICMP packets.') eltIpIcmpPacketEntry = MibTableRow((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91, 2, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: eltIpIcmpPacketEntry.setStatus('current') if mibBuilder.loadTexts: eltIpIcmpPacketEntry.setDescription('This entry controls the ability of interface to send ICMP packets.') eltIpIcmpPacketUnreachableSendEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91, 2, 1, 1, 2), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: eltIpIcmpPacketUnreachableSendEnable.setStatus('current') if mibBuilder.loadTexts: eltIpIcmpPacketUnreachableSendEnable.setDescription('ICMP Destination Unreachable packets sending is enabled or not on this interface.') eltMesArpSpec = MibIdentifier((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91, 3)) mibBuilder.exportSymbols("ELTEX-MES-IP", eltIpIcmpPacketEntry=eltIpIcmpPacketEntry, PYSNMP_MODULE_ID=eltMesIpSpec, eltMesOspf=eltMesOspf, eltIpIcmpPacketUnreachableSendEnable=eltIpIcmpPacketUnreachableSendEnable, eltMesIcmpSpec=eltMesIcmpSpec, eltMesArpSpec=eltMesArpSpec, eltMesIpSpec=eltMesIpSpec, eltIpIcmpPacketTable=eltIpIcmpPacketTable)
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, single_value_constraint, value_size_constraint, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ConstraintsUnion', 'SingleValueConstraint', 'ValueSizeConstraint', 'ConstraintsIntersection') (elt_mes,) = mibBuilder.importSymbols('ELTEX-MES', 'eltMes') (if_index,) = mibBuilder.importSymbols('IF-MIB', 'ifIndex') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (bits, counter64, module_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, iso, notification_type, mib_identifier, gauge32, ip_address, counter32, time_ticks, unsigned32, object_identity, integer32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Bits', 'Counter64', 'ModuleIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'iso', 'NotificationType', 'MibIdentifier', 'Gauge32', 'IpAddress', 'Counter32', 'TimeTicks', 'Unsigned32', 'ObjectIdentity', 'Integer32') (textual_convention, truth_value, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'TruthValue', 'DisplayString') elt_mes_ip_spec = module_identity((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91)) eltMesIpSpec.setRevisions(('2006-06-22 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: eltMesIpSpec.setRevisionsDescriptions(('Initial version of this MIB.',)) if mibBuilder.loadTexts: eltMesIpSpec.setLastUpdated('201402120000Z') if mibBuilder.loadTexts: eltMesIpSpec.setOrganization('Eltex Enterprise Co, Ltd.') if mibBuilder.loadTexts: eltMesIpSpec.setContactInfo('www.eltex.nsk.ru') if mibBuilder.loadTexts: eltMesIpSpec.setDescription('The private MIB module definition for IP MIB.') elt_mes_ospf = mib_identifier((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91, 1)) elt_mes_icmp_spec = mib_identifier((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91, 2)) elt_ip_icmp_packet_table = mib_table((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91, 2, 1)).setMaxAccess('readwrite') if mibBuilder.loadTexts: eltIpIcmpPacketTable.setStatus('current') if mibBuilder.loadTexts: eltIpIcmpPacketTable.setDescription('This table controls the ability to send ICMP packets.') elt_ip_icmp_packet_entry = mib_table_row((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91, 2, 1, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex')) if mibBuilder.loadTexts: eltIpIcmpPacketEntry.setStatus('current') if mibBuilder.loadTexts: eltIpIcmpPacketEntry.setDescription('This entry controls the ability of interface to send ICMP packets.') elt_ip_icmp_packet_unreachable_send_enable = mib_table_column((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91, 2, 1, 1, 2), truth_value()).setMaxAccess('readwrite') if mibBuilder.loadTexts: eltIpIcmpPacketUnreachableSendEnable.setStatus('current') if mibBuilder.loadTexts: eltIpIcmpPacketUnreachableSendEnable.setDescription('ICMP Destination Unreachable packets sending is enabled or not on this interface.') elt_mes_arp_spec = mib_identifier((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91, 3)) mibBuilder.exportSymbols('ELTEX-MES-IP', eltIpIcmpPacketEntry=eltIpIcmpPacketEntry, PYSNMP_MODULE_ID=eltMesIpSpec, eltMesOspf=eltMesOspf, eltIpIcmpPacketUnreachableSendEnable=eltIpIcmpPacketUnreachableSendEnable, eltMesIcmpSpec=eltMesIcmpSpec, eltMesArpSpec=eltMesArpSpec, eltMesIpSpec=eltMesIpSpec, eltIpIcmpPacketTable=eltIpIcmpPacketTable)
def print_full_name(a, b): first_name = a last_name = b print("Hello", first_name, last_name + "!", "You just delved into python.")
def print_full_name(a, b): first_name = a last_name = b print('Hello', first_name, last_name + '!', 'You just delved into python.')
opt = { # LRC1000.0 'a9a.LRC1000.0': 1.05049605396498e+07, # from TRON 'a9a.bias.LRC1000.0': 1.05049602719930e+07, # from TRON 'covtype.libsvm.binary.LRC1000.0': 2.98341912891832e+08, # from nheavy 'covtype.libsvm.binary.bias.LRC1000.0': 2.98341823726758e+08, # from nheavy 'epsilon_normalized.LRC1000.0': 1.00427474936523e+08, # from TRON 'epsilon_normalized.bias.LRC1000.0': 1.00427449600054e+08, # from TRON 'kddb.LRC1000.0': 4.08148700057166e+08, # from TRON 'news20.binary.LRC1000.0': 1.67512789306119e+05, # from TRON 'news20.binary.bias.LRC1000.0': 1.59090734028768e+05, # from lbfgs30 'rcv1_test.binary.LRC1000.0': 2.48883056430015e+07, # from TRON 'rcv1_test.binary.bias.LRC1000.0': 2.35068023749895e+07, # from TRON 'url_combined.LRC1000.0': 7.05526203844106e+05, # from TRON 'url_combined.bias.LRC1000.0': 7.06395486688979e+05, # from NEWTON 'webspam_wc_normalized_trigram.svm.LRC1000.0': 1.56134897696324e+06, # from TRON 'webspam_wc_normalized_trigram.svm.bias.LRC1000.0': 1.56017686789724e+06, # from NEWTON # LRC0.001 'a9a.LRC0.001': 1.34375185890165e+01, # from nheavy 'a9a.bias.LRC0.001': 1.34061168927057e+01, # from bfgs 'covtype.libsvm.binary.LRC0.001': 3.19108125442130e+02, # from TRON 'covtype.libsvm.binary.bias.LRC0.001': 3.19103481880759e+02, # from TRON 'epsilon_normalized.LRC0.001': 2.64083003605455e+02, # from lbfgs10 'epsilon_normalized.bias.LRC0.001': 2.64082952640341e+02, # from NEWTON 'kddb.LRC0.001': 6.31433624618391e+03, # from TRON 'kddb.bias.LRC0.001': 6.27837629997689e+03, # from TRON 'news20.binary.LRC0.001': 1.37832503340415e+01, # from nheavy 'news20.binary.bias.LRC0.001': 1.37831635992529e+01, # from nheavy 'rcv1_test.binary.LRC0.001': 3.54711979510507e+02, # from nheavy 'rcv1_test.binary.bias.LRC0.001': 3.54663725022122e+02, # from TRON 'url_combined.LRC0.001': 2.07075452491185e+02, # from NEWTON 'url_combined.bias.LRC0.001': 2.07044274842050e+02, # from NEWTON 'webspam_wc_normalized_trigram.svm.LRC0.001': 1.41690797007256e+02, # from NEWTON 'webspam_wc_normalized_trigram.svm.bias.LRC0.001': 1.37953204389683e+02, # from NEWTON # LRC1 'a9a.LRC1': 1.05295625846396e+04, # from TRON 'a9a.bias.LRC1': 1.05293114042444e+04, # from NEWTON 'covtype.libsvm.binary.LRC1': 2.98569903150000e+05, # from other dimension... 'covtype.libsvm.binary.bias.LRC1': 2.98487492095578e+05, # from nheavy 'epsilon_normalized.LRC1': 1.12870956626209e+05, # from TRON 'epsilon_normalized.bias.LRC1': 1.12870944904513e+05, # from TRON 'kddb.LRC1': 3.52829643487702e+06, # from TRON 'kddb.bias.LRC1': 3.52823063256860e+06, # from TRON 'news20.binary.LRC1': 6.05311970010801e+03, # from lbfgs10 'news20.binary.bias.LRC1': 6.05244975637293e+03, # from lbfgs30 'rcv1_test.binary.LRC1': 5.73962101619040e+04, # from TRON 'rcv1_test.binary.bias.LRC1': 5.63926363201933e+04, # from TRON 'url_combined.LRC1': 4.50240351279866e+04, # from TRON 'url_combined.bias.LRC1': 4.50238895961963e+04, # from TRON 'webspam_wc_normalized_trigram.svm.LRC1': 2.29750597760998e+04, # from NEWTON 'webspam_wc_normalized_trigram.svm.bias.LRC1': 2.28160330908175e+04, # from lbfgs30 }
opt = {'a9a.LRC1000.0': 10504960.5396498, 'a9a.bias.LRC1000.0': 10504960.271993, 'covtype.libsvm.binary.LRC1000.0': 298341912.891832, 'covtype.libsvm.binary.bias.LRC1000.0': 298341823.726758, 'epsilon_normalized.LRC1000.0': 100427474.936523, 'epsilon_normalized.bias.LRC1000.0': 100427449.600054, 'kddb.LRC1000.0': 408148700.057166, 'news20.binary.LRC1000.0': 167512.789306119, 'news20.binary.bias.LRC1000.0': 159090.734028768, 'rcv1_test.binary.LRC1000.0': 24888305.6430015, 'rcv1_test.binary.bias.LRC1000.0': 23506802.3749895, 'url_combined.LRC1000.0': 705526.203844106, 'url_combined.bias.LRC1000.0': 706395.486688979, 'webspam_wc_normalized_trigram.svm.LRC1000.0': 1561348.97696324, 'webspam_wc_normalized_trigram.svm.bias.LRC1000.0': 1560176.86789724, 'a9a.LRC0.001': 13.4375185890165, 'a9a.bias.LRC0.001': 13.4061168927057, 'covtype.libsvm.binary.LRC0.001': 319.10812544213, 'covtype.libsvm.binary.bias.LRC0.001': 319.103481880759, 'epsilon_normalized.LRC0.001': 264.083003605455, 'epsilon_normalized.bias.LRC0.001': 264.082952640341, 'kddb.LRC0.001': 6314.33624618391, 'kddb.bias.LRC0.001': 6278.37629997689, 'news20.binary.LRC0.001': 13.7832503340415, 'news20.binary.bias.LRC0.001': 13.7831635992529, 'rcv1_test.binary.LRC0.001': 354.711979510507, 'rcv1_test.binary.bias.LRC0.001': 354.663725022122, 'url_combined.LRC0.001': 207.075452491185, 'url_combined.bias.LRC0.001': 207.04427484205, 'webspam_wc_normalized_trigram.svm.LRC0.001': 141.690797007256, 'webspam_wc_normalized_trigram.svm.bias.LRC0.001': 137.953204389683, 'a9a.LRC1': 10529.5625846396, 'a9a.bias.LRC1': 10529.3114042444, 'covtype.libsvm.binary.LRC1': 298569.90315, 'covtype.libsvm.binary.bias.LRC1': 298487.492095578, 'epsilon_normalized.LRC1': 112870.956626209, 'epsilon_normalized.bias.LRC1': 112870.944904513, 'kddb.LRC1': 3528296.43487702, 'kddb.bias.LRC1': 3528230.6325686, 'news20.binary.LRC1': 6053.11970010801, 'news20.binary.bias.LRC1': 6052.44975637293, 'rcv1_test.binary.LRC1': 57396.210161904, 'rcv1_test.binary.bias.LRC1': 56392.6363201933, 'url_combined.LRC1': 45024.0351279866, 'url_combined.bias.LRC1': 45023.8895961963, 'webspam_wc_normalized_trigram.svm.LRC1': 22975.0597760998, 'webspam_wc_normalized_trigram.svm.bias.LRC1': 22816.0330908175}
# encoding=utf-8 def my_coroutine(): while True: received = yield print('Received:',received) it = my_coroutine() next(it) it.send('First') it.send('Second') def minimize(): current = yield while True: value = yield current current = min(value,current) it = minimize() next(it) print(it.send(10)) print(it.send(4)) print(it.send(22)) print(it.send(-1))
def my_coroutine(): while True: received = (yield) print('Received:', received) it = my_coroutine() next(it) it.send('First') it.send('Second') def minimize(): current = (yield) while True: value = (yield current) current = min(value, current) it = minimize() next(it) print(it.send(10)) print(it.send(4)) print(it.send(22)) print(it.send(-1))
class Solution(object): def groupAnagrams(self, strs): """ :type strs: List[str] :rtype: List[List[str]] """ anagram = {} for i in strs: count = [0]*26 for c in i: count[ord(c) - ord('a')] += 1 count = tuple(count) if count in anagram: anagram[count].append(i) else: anagram[count] = [i] return list(anagram.values())
class Solution(object): def group_anagrams(self, strs): """ :type strs: List[str] :rtype: List[List[str]] """ anagram = {} for i in strs: count = [0] * 26 for c in i: count[ord(c) - ord('a')] += 1 count = tuple(count) if count in anagram: anagram[count].append(i) else: anagram[count] = [i] return list(anagram.values())
''' File name: p1_utils.py Author: Date: '''
""" File name: p1_utils.py Author: Date: """
""" Implementation of Merge Sort algorithm """ def merge(data): """ MergeSort is a Divide and Conquer algorithm. It divides input array in two halves, calls itself for the two halves and then merges the two sorted halves. :param array: list of elements that needs to be sorted :type array: list """ if len(data) > 1: mid = len(data) // 2 lefthalf = data[:mid] righthalf = data[mid:] merge(lefthalf) merge(righthalf) i = j = k = 0 while i < len(lefthalf) and j < len(righthalf): if lefthalf[i] < righthalf[j]: data[k] = lefthalf[i] i = i + 1 else: data[k] = righthalf[j] j = j + 1 k = k + 1 while i < len(lefthalf): data[k] = lefthalf[i] i = i + 1 k = k + 1 while j < len(righthalf): data[k] = righthalf[j] j = j + 1 k = k + 1 def main(): """ operational function """ arr = [34, 56, 23, 67, 3, 68] print(f"unsorted array: {arr}") merge(arr) print(f" sorted array: {arr}") if __name__ == "__main__": main()
""" Implementation of Merge Sort algorithm """ def merge(data): """ MergeSort is a Divide and Conquer algorithm. It divides input array in two halves, calls itself for the two halves and then merges the two sorted halves. :param array: list of elements that needs to be sorted :type array: list """ if len(data) > 1: mid = len(data) // 2 lefthalf = data[:mid] righthalf = data[mid:] merge(lefthalf) merge(righthalf) i = j = k = 0 while i < len(lefthalf) and j < len(righthalf): if lefthalf[i] < righthalf[j]: data[k] = lefthalf[i] i = i + 1 else: data[k] = righthalf[j] j = j + 1 k = k + 1 while i < len(lefthalf): data[k] = lefthalf[i] i = i + 1 k = k + 1 while j < len(righthalf): data[k] = righthalf[j] j = j + 1 k = k + 1 def main(): """ operational function """ arr = [34, 56, 23, 67, 3, 68] print(f'unsorted array: {arr}') merge(arr) print(f' sorted array: {arr}') if __name__ == '__main__': main()
DAILY='DAILY' WEEKLY='WEEKLY' MONTHLY='MONTHLY' ANNUALLY='ANNUALLY' MONTHLY_MEAN='MONTHLY_MEAN' ANNUAL_MEAN='ANNUAL_MEAN' MONTHLY_SUM='MONTHLY_SUM' ANNUAL_SUM='ANNUAL_SUM' MONTHLY_SNAPSHOT='MONTHLY_SNAPSHOT' ANNUAL_SNAPSHOT='ANNUAL_SNAPSHOT'
daily = 'DAILY' weekly = 'WEEKLY' monthly = 'MONTHLY' annually = 'ANNUALLY' monthly_mean = 'MONTHLY_MEAN' annual_mean = 'ANNUAL_MEAN' monthly_sum = 'MONTHLY_SUM' annual_sum = 'ANNUAL_SUM' monthly_snapshot = 'MONTHLY_SNAPSHOT' annual_snapshot = 'ANNUAL_SNAPSHOT'
"""Top-level package for Ansible Events.""" __author__ = """Ben Thomasson""" __email__ = '[email protected]' __version__ = '0.4.0'
"""Top-level package for Ansible Events.""" __author__ = 'Ben Thomasson' __email__ = '[email protected]' __version__ = '0.4.0'
# # PySNMP MIB module RFC1406Ext-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RFC1406Ext-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:56:59 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsIntersection, ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsUnion") cxDSX1Ext, = mibBuilder.importSymbols("CXProduct-SMI", "cxDSX1Ext") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Gauge32, ModuleIdentity, Unsigned32, NotificationType, iso, MibIdentifier, Integer32, IpAddress, Counter32, ObjectIdentity, Counter64, TimeTicks, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "ModuleIdentity", "Unsigned32", "NotificationType", "iso", "MibIdentifier", "Integer32", "IpAddress", "Counter32", "ObjectIdentity", "Counter64", "TimeTicks", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") dsx1ExtMibLevel = MibScalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dsx1ExtMibLevel.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtMibLevel.setDescription('Used to determine current MIB module release supported by the agent. Object is in decimal.') dsx1ExtCfgTable = MibTable((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10), ) if mibBuilder.loadTexts: dsx1ExtCfgTable.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgTable.setDescription('The T1/E1 extensions configuration table.') dsx1ExtCfgEntry = MibTableRow((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1), ).setIndexNames((0, "RFC1406Ext-MIB", "dsx1ExtCfgLinkIndex")) if mibBuilder.loadTexts: dsx1ExtCfgEntry.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgEntry.setDescription('An entry in the T1/E1 extensions configuration table.') dsx1ExtCfgLinkIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2))).setMaxAccess("readonly") if mibBuilder.loadTexts: dsx1ExtCfgLinkIndex.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgLinkIndex.setDescription('Identifies the physical port with the T1/E1 (dsx1Ext) interface. Range of Values: 1 - 2 Default Value: None Configuration Changed: administrative') dsx1ExtCfgPortStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('disabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: dsx1ExtCfgPortStatus.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgPortStatus.setDescription('Indicates whether this T1/E1 (dsx1Ext) port is enabled or disabled. Options: disabled (1): The port is physically present but will be disabled (deactivated) after the next reset. enabled (2): The port will become enabled (functional) after the next reset. Default Value: disabled (1) Configuration Changed: administrative') dsx1ExtCfgTraps = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('disabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: dsx1ExtCfgTraps.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgTraps.setDescription('Determines whether the software will produce a T1/E1 (dsx1...) trap. Options: disabled (1): The trap will not be produced. enabled (2): The trap will be generated. Default Value: disabled (1) Configuration Changed: administrative') dsx1ExtCfgLineBuildOut = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 8)).clone(3)).setMaxAccess("readwrite") if mibBuilder.loadTexts: dsx1ExtCfgLineBuildOut.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgLineBuildOut.setDescription('Specifies the attenuation or Line Build Out to be used on the transmitter side of the line. Options: For T1 1: 0 to 133 feet / 0 dB 2: 133 to 266 feet 3: 266 to 399 feet 4: 399 to 533 feet 5: 533 to 655 feet 6: -7.5 dB 7: -15 dB 8: -22.5 dB For E1 1: 75 Ohm (coax. cable) 2: 120 Ohm (RJ45 shilded twisted pair) 3: 75 Ohm ( with protection resistor) 4: 120 Ohm ( with protection resistor) 5: 75 Ohm (with high return loss 1:1.15) 6: 120 Ohm (with high return loss 1:1.36) 7: 75 Ohm (with high return loss 1:1.36) 8: N/A Default Value: 1 Configuration Changed: administrative') dsx1ExtCfgCardType = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 50), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("dsx1ExtNoCard", 1), ("dsx1ExtT1Card", 2), ("dsx1ExtE1Card", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: dsx1ExtCfgCardType.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgCardType.setDescription('Indicates the type of card connected to this CPU board. Options: dsx1ExtNoCard (1): Indicates that there is not a T1 or E1 card connected to the line interface or the value indicates that if there is a T1 or E1 card connected then the card is not functional. dsx1ExtT1Card (2): Indicates that a functional T1 card is connected to the line interface. dsx1ExtE1Card (3): Indicates that a functional E1 card is connected to the line interface.') dsx1ExtCfgLossTxClock = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 51), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: dsx1ExtCfgLossTxClock.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgLossTxClock.setDescription('Indicates the total time at which the transmit clock was lost on this line interface. If no such event has occurred since system startup, then the value will be zero.') dsx1ExtCfgLossSync = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 52), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: dsx1ExtCfgLossSync.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgLossSync.setDescription('Indicates the total time at which the synchronization was lost on this line interface. If no such event has occurred since system startup, then the value will be zero.') dsx1ExtCfgLossCarrier = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 53), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: dsx1ExtCfgLossCarrier.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgLossCarrier.setDescription('Indicates the total time at which the carrier was lost on this line interface. If no such event has occurred since system startup, then the value will be zero.') dsx1ExtCfgT18ZeroDetect = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 54), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: dsx1ExtCfgT18ZeroDetect.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgT18ZeroDetect.setDescription('Indicates the total time that 8 consecutive zeros were received on this line interface. If no such event has occurred since system startup, then the value will be zero.') dsx1ExtCfgT116ZeroDetect = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 55), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: dsx1ExtCfgT116ZeroDetect.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgT116ZeroDetect.setDescription('Indicates the total time that 16 consecutive zeros were received on this line interface. If no such event has occurred since system startup, then the value will be zero.') dsx1ExtCfgT1RxB8ZSCode = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 56), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: dsx1ExtCfgT1RxB8ZSCode.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgT1RxB8ZSCode.setDescription('Indicates the total time that a B8ZS code word was detected during reception on this line interface. If no such event has occurred since system startup, then the value will be zero. Note: B8ZS code work detection occurs whether or not the B8ZS mode is selected.') dsx1ExtCfgT1RxBlueAlarm = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 57), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: dsx1ExtCfgT1RxBlueAlarm.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgT1RxBlueAlarm.setDescription("Indicates the total time that a 'blue alarm' was received on this line interface. A blue alarm is an unframed signal comprised of all ones (1s). If no such event has occurred since system startup, then the value will be zero.") dsx1ExtCfgT1RxYellowAlarm = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 58), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: dsx1ExtCfgT1RxYellowAlarm.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgT1RxYellowAlarm.setDescription("Indicates the total time that a 'yellow alarm' was received on this line interface. A yellow alarm occurs when bit 2 of 256 consecutive channels is set to zero for at least 254 occurrences in D4 format mode or when 16 consecutive patterns of 00FF hex appear in FDL format mode. If no such event has occurred since system startup, then the value will be zero.") dsx1ExtCfgIoRegTest = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 59), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("failed", 1), ("passed", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: dsx1ExtCfgIoRegTest.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgIoRegTest.setDescription('Indicates the test results for the T1/E1 I/O card registers.') dsx1ExtCfgSctRegTest = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 60), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("failed", 1), ("passed", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: dsx1ExtCfgSctRegTest.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgSctRegTest.setDescription('Indicates the test results for the T1 transceiver registers, specifically the 12 Transmit Signaling Registers.') dsx1ExtCfgSctLatchRegTest = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 61), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("failed", 1), ("passed", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: dsx1ExtCfgSctLatchRegTest.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgSctLatchRegTest.setDescription('Indicates the test results for the T1 transceiver latch register, specifically the second Status Register.') dsx1ExtCfgReinit = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 81), Integer32()).setMaxAccess("writeonly") if mibBuilder.loadTexts: dsx1ExtCfgReinit.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgReinit.setDescription('When this object is set to any value, it reinitializes the corresponding port.') mibBuilder.exportSymbols("RFC1406Ext-MIB", dsx1ExtCfgLineBuildOut=dsx1ExtCfgLineBuildOut, dsx1ExtCfgT116ZeroDetect=dsx1ExtCfgT116ZeroDetect, dsx1ExtCfgReinit=dsx1ExtCfgReinit, dsx1ExtCfgT1RxBlueAlarm=dsx1ExtCfgT1RxBlueAlarm, dsx1ExtCfgTraps=dsx1ExtCfgTraps, dsx1ExtCfgLossSync=dsx1ExtCfgLossSync, dsx1ExtMibLevel=dsx1ExtMibLevel, dsx1ExtCfgEntry=dsx1ExtCfgEntry, dsx1ExtCfgPortStatus=dsx1ExtCfgPortStatus, dsx1ExtCfgT18ZeroDetect=dsx1ExtCfgT18ZeroDetect, dsx1ExtCfgSctLatchRegTest=dsx1ExtCfgSctLatchRegTest, dsx1ExtCfgLinkIndex=dsx1ExtCfgLinkIndex, dsx1ExtCfgSctRegTest=dsx1ExtCfgSctRegTest, dsx1ExtCfgLossTxClock=dsx1ExtCfgLossTxClock, dsx1ExtCfgTable=dsx1ExtCfgTable, dsx1ExtCfgCardType=dsx1ExtCfgCardType, dsx1ExtCfgT1RxB8ZSCode=dsx1ExtCfgT1RxB8ZSCode, dsx1ExtCfgIoRegTest=dsx1ExtCfgIoRegTest, dsx1ExtCfgT1RxYellowAlarm=dsx1ExtCfgT1RxYellowAlarm, dsx1ExtCfgLossCarrier=dsx1ExtCfgLossCarrier)
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, value_size_constraint, single_value_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'ValueRangeConstraint', 'ValueSizeConstraint', 'SingleValueConstraint', 'ConstraintsUnion') (cx_dsx1_ext,) = mibBuilder.importSymbols('CXProduct-SMI', 'cxDSX1Ext') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (gauge32, module_identity, unsigned32, notification_type, iso, mib_identifier, integer32, ip_address, counter32, object_identity, counter64, time_ticks, bits, mib_scalar, mib_table, mib_table_row, mib_table_column) = mibBuilder.importSymbols('SNMPv2-SMI', 'Gauge32', 'ModuleIdentity', 'Unsigned32', 'NotificationType', 'iso', 'MibIdentifier', 'Integer32', 'IpAddress', 'Counter32', 'ObjectIdentity', 'Counter64', 'TimeTicks', 'Bits', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') dsx1_ext_mib_level = mib_scalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: dsx1ExtMibLevel.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtMibLevel.setDescription('Used to determine current MIB module release supported by the agent. Object is in decimal.') dsx1_ext_cfg_table = mib_table((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10)) if mibBuilder.loadTexts: dsx1ExtCfgTable.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgTable.setDescription('The T1/E1 extensions configuration table.') dsx1_ext_cfg_entry = mib_table_row((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1)).setIndexNames((0, 'RFC1406Ext-MIB', 'dsx1ExtCfgLinkIndex')) if mibBuilder.loadTexts: dsx1ExtCfgEntry.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgEntry.setDescription('An entry in the T1/E1 extensions configuration table.') dsx1_ext_cfg_link_index = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 2))).setMaxAccess('readonly') if mibBuilder.loadTexts: dsx1ExtCfgLinkIndex.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgLinkIndex.setDescription('Identifies the physical port with the T1/E1 (dsx1Ext) interface. Range of Values: 1 - 2 Default Value: None Configuration Changed: administrative') dsx1_ext_cfg_port_status = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('disabled', 1), ('enabled', 2))).clone('disabled')).setMaxAccess('readwrite') if mibBuilder.loadTexts: dsx1ExtCfgPortStatus.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgPortStatus.setDescription('Indicates whether this T1/E1 (dsx1Ext) port is enabled or disabled. Options: disabled (1): The port is physically present but will be disabled (deactivated) after the next reset. enabled (2): The port will become enabled (functional) after the next reset. Default Value: disabled (1) Configuration Changed: administrative') dsx1_ext_cfg_traps = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('disabled', 1), ('enabled', 2))).clone('disabled')).setMaxAccess('readwrite') if mibBuilder.loadTexts: dsx1ExtCfgTraps.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgTraps.setDescription('Determines whether the software will produce a T1/E1 (dsx1...) trap. Options: disabled (1): The trap will not be produced. enabled (2): The trap will be generated. Default Value: disabled (1) Configuration Changed: administrative') dsx1_ext_cfg_line_build_out = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 12), integer32().subtype(subtypeSpec=value_range_constraint(1, 8)).clone(3)).setMaxAccess('readwrite') if mibBuilder.loadTexts: dsx1ExtCfgLineBuildOut.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgLineBuildOut.setDescription('Specifies the attenuation or Line Build Out to be used on the transmitter side of the line. Options: For T1 1: 0 to 133 feet / 0 dB 2: 133 to 266 feet 3: 266 to 399 feet 4: 399 to 533 feet 5: 533 to 655 feet 6: -7.5 dB 7: -15 dB 8: -22.5 dB For E1 1: 75 Ohm (coax. cable) 2: 120 Ohm (RJ45 shilded twisted pair) 3: 75 Ohm ( with protection resistor) 4: 120 Ohm ( with protection resistor) 5: 75 Ohm (with high return loss 1:1.15) 6: 120 Ohm (with high return loss 1:1.36) 7: 75 Ohm (with high return loss 1:1.36) 8: N/A Default Value: 1 Configuration Changed: administrative') dsx1_ext_cfg_card_type = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 50), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('dsx1ExtNoCard', 1), ('dsx1ExtT1Card', 2), ('dsx1ExtE1Card', 3)))).setMaxAccess('readonly') if mibBuilder.loadTexts: dsx1ExtCfgCardType.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgCardType.setDescription('Indicates the type of card connected to this CPU board. Options: dsx1ExtNoCard (1): Indicates that there is not a T1 or E1 card connected to the line interface or the value indicates that if there is a T1 or E1 card connected then the card is not functional. dsx1ExtT1Card (2): Indicates that a functional T1 card is connected to the line interface. dsx1ExtE1Card (3): Indicates that a functional E1 card is connected to the line interface.') dsx1_ext_cfg_loss_tx_clock = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 51), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: dsx1ExtCfgLossTxClock.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgLossTxClock.setDescription('Indicates the total time at which the transmit clock was lost on this line interface. If no such event has occurred since system startup, then the value will be zero.') dsx1_ext_cfg_loss_sync = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 52), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: dsx1ExtCfgLossSync.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgLossSync.setDescription('Indicates the total time at which the synchronization was lost on this line interface. If no such event has occurred since system startup, then the value will be zero.') dsx1_ext_cfg_loss_carrier = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 53), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: dsx1ExtCfgLossCarrier.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgLossCarrier.setDescription('Indicates the total time at which the carrier was lost on this line interface. If no such event has occurred since system startup, then the value will be zero.') dsx1_ext_cfg_t18_zero_detect = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 54), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: dsx1ExtCfgT18ZeroDetect.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgT18ZeroDetect.setDescription('Indicates the total time that 8 consecutive zeros were received on this line interface. If no such event has occurred since system startup, then the value will be zero.') dsx1_ext_cfg_t116_zero_detect = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 55), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: dsx1ExtCfgT116ZeroDetect.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgT116ZeroDetect.setDescription('Indicates the total time that 16 consecutive zeros were received on this line interface. If no such event has occurred since system startup, then the value will be zero.') dsx1_ext_cfg_t1_rx_b8_zs_code = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 56), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: dsx1ExtCfgT1RxB8ZSCode.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgT1RxB8ZSCode.setDescription('Indicates the total time that a B8ZS code word was detected during reception on this line interface. If no such event has occurred since system startup, then the value will be zero. Note: B8ZS code work detection occurs whether or not the B8ZS mode is selected.') dsx1_ext_cfg_t1_rx_blue_alarm = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 57), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: dsx1ExtCfgT1RxBlueAlarm.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgT1RxBlueAlarm.setDescription("Indicates the total time that a 'blue alarm' was received on this line interface. A blue alarm is an unframed signal comprised of all ones (1s). If no such event has occurred since system startup, then the value will be zero.") dsx1_ext_cfg_t1_rx_yellow_alarm = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 58), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: dsx1ExtCfgT1RxYellowAlarm.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgT1RxYellowAlarm.setDescription("Indicates the total time that a 'yellow alarm' was received on this line interface. A yellow alarm occurs when bit 2 of 256 consecutive channels is set to zero for at least 254 occurrences in D4 format mode or when 16 consecutive patterns of 00FF hex appear in FDL format mode. If no such event has occurred since system startup, then the value will be zero.") dsx1_ext_cfg_io_reg_test = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 59), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('failed', 1), ('passed', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: dsx1ExtCfgIoRegTest.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgIoRegTest.setDescription('Indicates the test results for the T1/E1 I/O card registers.') dsx1_ext_cfg_sct_reg_test = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 60), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('failed', 1), ('passed', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: dsx1ExtCfgSctRegTest.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgSctRegTest.setDescription('Indicates the test results for the T1 transceiver registers, specifically the 12 Transmit Signaling Registers.') dsx1_ext_cfg_sct_latch_reg_test = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 61), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('failed', 1), ('passed', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: dsx1ExtCfgSctLatchRegTest.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgSctLatchRegTest.setDescription('Indicates the test results for the T1 transceiver latch register, specifically the second Status Register.') dsx1_ext_cfg_reinit = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 81), integer32()).setMaxAccess('writeonly') if mibBuilder.loadTexts: dsx1ExtCfgReinit.setStatus('mandatory') if mibBuilder.loadTexts: dsx1ExtCfgReinit.setDescription('When this object is set to any value, it reinitializes the corresponding port.') mibBuilder.exportSymbols('RFC1406Ext-MIB', dsx1ExtCfgLineBuildOut=dsx1ExtCfgLineBuildOut, dsx1ExtCfgT116ZeroDetect=dsx1ExtCfgT116ZeroDetect, dsx1ExtCfgReinit=dsx1ExtCfgReinit, dsx1ExtCfgT1RxBlueAlarm=dsx1ExtCfgT1RxBlueAlarm, dsx1ExtCfgTraps=dsx1ExtCfgTraps, dsx1ExtCfgLossSync=dsx1ExtCfgLossSync, dsx1ExtMibLevel=dsx1ExtMibLevel, dsx1ExtCfgEntry=dsx1ExtCfgEntry, dsx1ExtCfgPortStatus=dsx1ExtCfgPortStatus, dsx1ExtCfgT18ZeroDetect=dsx1ExtCfgT18ZeroDetect, dsx1ExtCfgSctLatchRegTest=dsx1ExtCfgSctLatchRegTest, dsx1ExtCfgLinkIndex=dsx1ExtCfgLinkIndex, dsx1ExtCfgSctRegTest=dsx1ExtCfgSctRegTest, dsx1ExtCfgLossTxClock=dsx1ExtCfgLossTxClock, dsx1ExtCfgTable=dsx1ExtCfgTable, dsx1ExtCfgCardType=dsx1ExtCfgCardType, dsx1ExtCfgT1RxB8ZSCode=dsx1ExtCfgT1RxB8ZSCode, dsx1ExtCfgIoRegTest=dsx1ExtCfgIoRegTest, dsx1ExtCfgT1RxYellowAlarm=dsx1ExtCfgT1RxYellowAlarm, dsx1ExtCfgLossCarrier=dsx1ExtCfgLossCarrier)
MAPPING = [ { 'sid': 'Adult age binary (yes)', 'symptom': 'age', 'module': 'adult', 'gen_5_4a': 55, 'endorsed': True, }, { 'sid': 'Adult age binary (no)', 'symptom': 'age', 'module': 'adult', 'gen_5_4a': 45, 'endorsed': False, }, { 'sid': 'Adult age binary (no-lower bound)', 'symptom': 'age', 'module': 'adult', 'gen_5_4a': 12, 'endorsed': False, }, { 'sid': 'Adult age binary (threshold)', 'symptom': 'age', 'module': 'adult', 'gen_5_4a': 49, 'endorsed': True, }, { 'sid': 'Adult age binary (just age group)', 'symptom': 'age', 'module': 'adult', 'gen_5_4d': 3, 'endorsed': False, }, { 'sid': 'Adult-first age quartile (yes)', 'symptom': 's88881', 'module': 'adult', 'gen_5_4a': 20, 'endorsed': True, }, { 'sid': 'Adult-first age quartile (yes-upper threshold)', 'symptom': 's88881', 'module': 'adult', 'gen_5_4a': 32, 'endorsed': True, }, { 'sid': 'Adult-first age quartile (yes-lower threshold)', 'symptom': 's88881', 'module': 'adult', 'gen_5_4a': 12, 'endorsed': True, }, { 'sid': 'Adult-first age quartile (no)', 'symptom': 's88881', 'module': 'adult', 'gen_5_4a': 35, 'endorsed': False, }, { 'sid': 'Adult-first age quartile (no-upper threshold)', 'symptom': 's88881', 'module': 'adult', 'gen_5_4a': 33, 'endorsed': False, }, { 'sid': 'Adult-first age quartile (just age group)', 'symptom': 's88881', 'module': 'adult', 'gen_5_4d': 3, 'endorsed': False, }, { 'sid': 'Adult-second age quartile (yes)', 'symptom': 's88882', 'module': 'adult', 'gen_5_4a': 40, 'endorsed': True, }, { 'sid': 'Adult-second age quartile (yes-upper threshold)', 'symptom': 's88882', 'module': 'adult', 'gen_5_4a': 49, 'endorsed': True, }, { 'sid': 'Adult-second age quartile (yes-lower threshold)', 'symptom': 's88882', 'module': 'adult', 'gen_5_4a': 33, 'endorsed': True, }, { 'sid': 'Adult-second age quartile (no-upper)', 'symptom': 's88882', 'module': 'adult', 'gen_5_4a': 60, 'endorsed': False, }, { 'sid': 'Adult-second age quartile (no-lower)', 'symptom': 's88882', 'module': 'adult', 'gen_5_4a': 30, 'endorsed': False, }, { 'sid': 'Adult-second age quartile (no-lower threshold)', 'symptom': 's88882', 'module': 'adult', 'gen_5_4a': 32, 'endorsed': False, }, { 'sid': 'Adult-second age quartile (no-upper threshold)', 'symptom': 's88882', 'module': 'adult', 'gen_5_4a': 50, 'endorsed': False, }, { 'sid': 'Adult-second age quartile (just age group)', 'symptom': 's88882', 'module': 'adult', 'gen_5_4d': 3, 'endorsed': False, }, { 'sid': 'Adult-third age quartile (yes)', 'symptom': 's88883', 'module': 'adult', 'gen_5_4a': 50, 'endorsed': True, }, { 'sid': 'Adult-third age quartile (yes-upper threshold)', 'symptom': 's88883', 'module': 'adult', 'gen_5_4a': 65, 'endorsed': True, }, { 'sid': 'Adult-third age quartile (yes-lower threshold)', 'symptom': 's88883', 'module': 'adult', 'gen_5_4a': 50, 'endorsed': True, }, { 'sid': 'Adult-third age quartile (no-lower)', 'symptom': 's88883', 'module': 'adult', 'gen_5_4a': 40, 'endorsed': False, }, { 'sid': 'Adult-third age quartile (no-upper)', 'symptom': 's88883', 'module': 'adult', 'gen_5_4a': 70, 'endorsed': False, }, { 'sid': 'Adult-third age quartile (no-lower threshold)', 'symptom': 's88883', 'module': 'adult', 'gen_5_4a': 49, 'endorsed': False, }, { 'sid': 'Adult-third age quartile (no-upper threshold)', 'symptom': 's88883', 'module': 'adult', 'gen_5_4a': 66, 'endorsed': False, }, { 'sid': 'Adult-third age quartile (just age group)', 'symptom': 's88883', 'module': 'adult', 'gen_5_4d': 3, 'endorsed': False, }, { 'sid': 'Adult-fourth age quartile (yes)', 'symptom': 's88884', 'module': 'adult', 'gen_5_4a': 70, 'endorsed': True, }, { 'sid': 'Adult-fourth age quartile (yes-lower threshold)', 'symptom': 's88884', 'module': 'adult', 'gen_5_4a': 66, 'endorsed': True, }, { 'sid': 'Adult-fourth age quartile (no-lower)', 'symptom': 's88884', 'module': 'adult', 'gen_5_4a': 60, 'endorsed': False, }, { 'sid': 'Adult-fourth age quartile (no-lower threshold)', 'symptom': 's88884', 'module': 'adult', 'gen_5_4a': 65, 'endorsed': False, }, { 'sid': 'Adult-fourth age quartile (just age group)', 'symptom': 's88884', 'module': 'adult', 'gen_5_4d': 3, 'endorsed': False, }, { 'sid': 'Child age binary (years-yes)', 'symptom': 'age', 'module': 'child', 'gen_5_4a': 7, 'endorsed': True, }, { 'sid': 'Child age binary (years-upper bound)', 'symptom': 'age', 'module': 'child', 'gen_5_4a': 11, 'endorsed': True, }, { 'sid': 'Child age binary (years-no)', 'symptom': 'age', 'module': 'child', 'gen_5_4a': 1, 'endorsed': False, }, { 'sid': 'Child age binary (years-threshold)', 'symptom': 'age', 'module': 'child', 'gen_5_4a': 2, 'endorsed': True, }, { 'sid': 'Child age binary (months-yes)', 'symptom': 'age', 'module': 'child', 'gen_5_4b': 30, 'endorsed': True, }, { 'sid': 'Child age binary (months-no)', 'symptom': 'age', 'module': 'child', 'gen_5_4b': 11, 'endorsed': False, }, { 'sid': 'Child age binary (months-threshold)', 'symptom': 'age', 'module': 'child', 'gen_5_4b': 24, 'endorsed': True, }, { 'sid': 'Child age binary (days-yes)', 'symptom': 'age', 'module': 'child', 'gen_5_4c': 365 * 3, 'endorsed': True, }, { 'sid': 'Child age binary (days-lower bound)', 'symptom': 'age', 'module': 'child', 'gen_5_4c': 29, 'endorsed': False, }, { 'sid': 'Child age binary (days-threshold)', 'symptom': 'age', 'module': 'child', 'gen_5_4c': 365 * 2, 'endorsed': True, }, { 'sid': 'Child age binary (just age group)', 'symptom': 'age', 'module': 'child', 'gen_5_4d': 2, 'endorsed': False, }, { 'sid': 'Child-first age quintile (no-years)', 'symptom': 's2991', 'module': 'child', 'gen_5_4a': 1, 'endorsed': False, }, { 'sid': 'Child-first age quintile (yes-months)', 'symptom': 's2991', 'module': 'child', 'gen_5_4b': 3, 'endorsed': True, }, { 'sid': 'Child-first age quintile (yes-months lower threshold)', 'symptom': 's2991', 'module': 'child', 'gen_5_4b': 1, 'endorsed': True, }, { 'sid': 'Child-first age quintile (yes-months upper threshold)', 'symptom': 's2991', 'module': 'child', 'gen_5_4b': 5, 'endorsed': True, }, { 'sid': 'Child-first age quintile (no-months)', 'symptom': 's2991', 'module': 'child', 'gen_5_4b': 11, 'endorsed': False, }, { 'sid': 'Child-first age quintile (no-months upper threshold)', 'symptom': 's2991', 'module': 'child', 'gen_5_4b': 6, 'endorsed': False, }, { 'sid': 'Child-first age quintile (yes-days)', 'symptom': 's2991', 'module': 'child', 'gen_5_4c': 100, 'endorsed': True, }, { 'sid': 'Child-first age quintile (yes-days lower threshold)', 'symptom': 's2991', 'module': 'child', 'gen_5_4c': 29, 'endorsed': True, }, { 'sid': 'Child-first age quintile (yes-days upper threshold)', 'symptom': 's2991', 'module': 'child', 'gen_5_4c': 152, # FIXME: rounding error converting days 'endorsed': True, }, { 'sid': 'Child-first age quintile (no-days)', 'symptom': 's2991', 'module': 'child', 'gen_5_4c': 300, 'endorsed': False, }, { 'sid': 'Child-first age quintile (no-days upper threshold)', 'symptom': 's2991', 'module': 'child', 'gen_5_4c': 153, # FIXME: rounding error converting days 'endorsed': False, }, { 'sid': 'Child-first age quintile (just age group)', 'symptom': 's2991', 'module': 'child', 'gen_5_4d': 2, 'endorsed': False, }, { 'sid': 'Child-second age quintile (yes-years upper threshold)', 'symptom': 's2992', 'module': 'child', 'gen_5_4a': 1, 'endorsed': True, }, { 'sid': 'Child-second age quintile (no-years)', 'symptom': 's2992', 'module': 'child', 'gen_5_4a': 2, 'endorsed': False, }, { 'sid': 'Child-second age quintile (yes-months)', 'symptom': 's2992', 'module': 'child', 'gen_5_4b': 9, 'endorsed': True, }, { 'sid': 'Child-second age quintile (yes-months upper threshold)', 'symptom': 's2992', 'module': 'child', 'gen_5_4b': 12, 'endorsed': True, }, { 'sid': 'Child-second age quintile (yes-months lower threshold)', 'symptom': 's2992', 'module': 'child', 'gen_5_4b': 6, 'endorsed': True, }, { 'sid': 'Child-second age quintile (no-months upper)', 'symptom': 's2992', 'module': 'child', 'gen_5_4b': 15, 'endorsed': False, }, { 'sid': 'Child-second age quintile (no-months lower)', 'symptom': 's2992', 'module': 'child', 'gen_5_4b': 3, 'endorsed': False, }, { 'sid': 'Child-second age quintile (no-months upper threshold)', 'symptom': 's2992', 'module': 'child', 'gen_5_4b': 13, 'endorsed': False, }, { 'sid': 'Child-second age quintile (no-months lower threshold)', 'symptom': 's2992', 'module': 'child', 'gen_5_4b': 5, 'endorsed': False, }, { 'sid': 'Child-second age quintile (yes-days)', 'symptom': 's2992', 'module': 'child', 'gen_5_4c': 300, 'endorsed': True, }, { 'sid': 'Child-second age quintile (yes-days upper threshold)', 'symptom': 's2992', 'module': 'child', 'gen_5_4c': 365, 'endorsed': True, }, { 'sid': 'Child-second age quintile (yes-days lower threshold)', 'symptom': 's2992', 'module': 'child', 'gen_5_4c': 153, # FIXME: rounding error converting days 'endorsed': True, }, { 'sid': 'Child-second age quintile (no-days upper)', 'symptom': 's2992', 'module': 'child', 'gen_5_4c': 500, 'endorsed': False, }, { 'sid': 'Child-second age quintile (no-days lower)', 'symptom': 's2992', 'module': 'child', 'gen_5_4c': 60, 'endorsed': False, }, { 'sid': 'Child-second age quintile (no-days upper threshold)', 'symptom': 's2992', 'module': 'child', 'gen_5_4c': 366, 'endorsed': False, }, { 'sid': 'Child-second age quintile (no-days lower threshold)', 'symptom': 's2992', 'module': 'child', 'gen_5_4c': 152, # FIXME: rounding error converting days 'endorsed': False, }, { 'sid': 'Child-second age quintile (just age group)', 'symptom': 's2992', 'module': 'child', 'gen_5_4d': 2, 'endorsed': False, }, { 'sid': 'Child-third age quintile (yes-years lower threshold)', 'symptom': 's2993', 'module': 'child', 'gen_5_4a': 2, 'endorsed': True, }, { 'sid': 'Child-third age quintile (yes-years upper threshold)', 'symptom': 's2993', 'module': 'child', 'gen_5_4a': 3, 'endorsed': True, }, { 'sid': 'Child-third age quintile (no-years upper)', 'symptom': 's2993', 'module': 'child', 'gen_5_4a': 5, 'endorsed': False, }, { 'sid': 'Child-third age quintile (no-years lower threshold)', 'symptom': 's2993', 'module': 'child', 'gen_5_4a': 1, 'endorsed': False, }, { 'sid': 'Child-third age quintile (no-years upper threshold)', 'symptom': 's2993', 'module': 'child', 'gen_5_4a': 4, 'endorsed': False, }, { 'sid': 'Child-third age quintile (yes-months)', 'symptom': 's2993', 'module': 'child', 'gen_5_4b': 30, 'endorsed': True, }, { 'sid': 'Child-third age quintile (yes-months upper threshold)', 'symptom': 's2993', 'module': 'child', 'gen_5_4b': 36, 'endorsed': True, }, { 'sid': 'Child-third age quintile (yes-months lower threshold)', 'symptom': 's2993', 'module': 'child', 'gen_5_4b': 13, 'endorsed': True, }, { 'sid': 'Child-third age quintile (no-months lower)', 'symptom': 's2993', 'module': 'child', 'gen_5_4b': 10, 'endorsed': False, }, { 'sid': 'Child-third age quintile (no-months upper)', 'symptom': 's2993', 'module': 'child', 'gen_5_4b': 60, 'endorsed': False, }, { 'sid': 'Child-third age quintile (no-months lower threshold)', 'symptom': 's2993', 'module': 'child', 'gen_5_4b': 12, 'endorsed': False, }, { 'sid': 'Child-third age quintile (no-months upper threshold)', 'symptom': 's2993', 'module': 'child', 'gen_5_4b': 37, 'endorsed': False, }, { 'sid': 'Child-third age quintile (just age group)', 'symptom': 's2993', 'module': 'child', 'gen_5_4d': 2, 'endorsed': False, }, { 'sid': 'Child-fourth age quintile (yes-years)', 'symptom': 's2994', 'module': 'child', 'gen_5_4a': 5, 'endorsed': True, }, { 'sid': 'Child-fourth age quintile (yes-years upper threshold)', 'symptom': 's2994', 'module': 'child', 'gen_5_4a': 7, 'endorsed': True, }, { 'sid': 'Child-fourth age quintile (yes-years lower threshold)', 'symptom': 's2994', 'module': 'child', 'gen_5_4a': 4, 'endorsed': True, }, { 'sid': 'Child-fourth age quintile (no-years lower)', 'symptom': 's2994', 'module': 'child', 'gen_5_4a': 2, 'endorsed': False, }, { 'sid': 'Child-fourth age quintile (no-years upper)', 'symptom': 's2994', 'module': 'child', 'gen_5_4a': 10, 'endorsed': False, }, { 'sid': 'Child-fourth age quintile (no-years lower threshold)', 'symptom': 's2994', 'module': 'child', 'gen_5_4a': 3, 'endorsed': False, }, { 'sid': 'Child-fourth age quintile (no-years upper threshold)', 'symptom': 's2994', 'module': 'child', 'gen_5_4a': 8, 'endorsed': False, }, { 'sid': 'Child-fourth age quintile (yes-months)', 'symptom': 's2994', 'module': 'child', 'gen_5_4b': 60, 'endorsed': True, }, { 'sid': 'Child-fourth age quintile (yes-months upper threshold)', 'symptom': 's2994', 'module': 'child', 'gen_5_4b': 84, 'endorsed': True, }, { 'sid': 'Child-fourth age quintile (yes-months lower threshold)', 'symptom': 's2994', 'module': 'child', 'gen_5_4b': 48, 'endorsed': True, }, { 'sid': 'Child-fourth age quintile (no-months lower)', 'symptom': 's2994', 'module': 'child', 'gen_5_4b': 30, 'endorsed': False, }, { 'sid': 'Child-fourth age quintile (no-months upper)', 'symptom': 's2994', 'module': 'child', 'gen_5_4b': 120, 'endorsed': False, }, { 'sid': 'Child-fourth age quintile (no-months lower threshold)', 'symptom': 's2994', 'module': 'child', 'gen_5_4b': 36, 'endorsed': False, }, { 'sid': 'Child-fourth age quintile (no-months upper threshold)', 'symptom': 's2994', 'module': 'child', 'gen_5_4b': 96, 'endorsed': False, }, { 'sid': 'Child-fourth age quintile (just age group)', 'symptom': 's2994', 'module': 'child', 'gen_5_4d': 2, 'endorsed': False, }, { 'sid': 'Child-fifth age quintile (yes)', 'symptom': 's2995', 'module': 'child', 'gen_5_4a': 9, 'endorsed': True, }, { 'sid': 'Child-fifth age quintile (yes-upper)', 'symptom': 's2995', 'module': 'child', 'gen_5_4a': 11, 'endorsed': True, }, { 'sid': 'Child-fifth age quintile (yes-lower)', 'symptom': 's2995', 'module': 'child', 'gen_5_4a': 8, 'endorsed': True, }, { 'sid': 'Child-fifth age quintile (no-years)', 'symptom': 's2995', 'module': 'child', 'gen_5_4a': 5, 'endorsed': False, }, { 'sid': 'Child-fifth age quintile (no-lower threshold)', 'symptom': 's2995', 'module': 'child', 'gen_5_4a': 7, 'endorsed': False, }, { 'sid': 'Child-fifth age quintile (just age group)', 'symptom': 's2995', 'module': 'child', 'gen_5_4d': 2, 'endorsed': False, }, { 'sid': 'Neonate age binary (yes)', 'symptom': 'age', 'module': 'neonate', 'gen_5_4c': 5, 'endorsed': True, }, { 'sid': 'Neonate age binary (yes-upper bound)', 'symptom': 'age', 'module': 'neonate', 'gen_5_4c': 28, 'endorsed': True, }, { 'sid': 'Neonate age binary (no)', 'symptom': 'age', 'module': 'neonate', 'gen_5_4c': 2, 'endorsed': False, }, { 'sid': 'Neonate age binary (zero)', 'symptom': 'age', 'module': 'neonate', 'gen_5_4c': 0, 'endorsed': False, }, { 'sid': 'Neonate age binary (threshold)', 'symptom': 'age', 'module': 'neonate', 'gen_5_4c': 3, 'endorsed': True, }, { 'sid': 'Neonate age binary (just age group)', 'symptom': 'age', 'module': 'neonate', 'gen_5_4d': 1, 'endorsed': False, }, { 'sid': 'Neonate-first age quartile (yes)', 'symptom': 's4991', 'module': 'neonate', 'gen_5_4c': 0, 'endorsed': True, }, { 'sid': 'Neonate-first age quartile (no)', 'symptom': 's4991', 'module': 'neonate', 'gen_5_4c': 1, 'endorsed': False, }, { 'sid': 'Neonate-first age quartile (just age group)', 'symptom': 's4991', 'module': 'neonate', 'gen_5_4d': 1, 'endorsed': True, # FIXME: neonate age defaults to zero }, # There is a s4992 { 'sid': 'Neonate-third age quartile (yes-lower)', 'symptom': 's4993', 'module': 'neonate', 'gen_5_4c': 1, 'endorsed': True, }, { 'sid': 'Neonate-third age quartile (yes-upper)', 'symptom': 's4993', 'module': 'neonate', 'gen_5_4c': 2, 'endorsed': True, }, { 'sid': 'Neonate-third age quartile (no-lower)', 'symptom': 's4993', 'module': 'neonate', 'gen_5_4c': 0, 'endorsed': False, }, { 'sid': 'Neonate-third age quartile (no-upper)', 'symptom': 's4993', 'module': 'neonate', 'gen_5_4c': 3, 'endorsed': False, }, { 'sid': 'Neonate-third age quartile (just age group)', 'symptom': 's4993', 'module': 'neonate', 'gen_5_4d': 1, 'endorsed': False, }, { 'sid': 'Neonate-fourth age quartile (yes)', 'symptom': 's4994', 'module': 'neonate', 'gen_5_4c': 12, 'endorsed': True, }, { 'sid': 'Neonate-fourth age quartile (yes-lower)', 'symptom': 's4994', 'module': 'neonate', 'gen_5_4c': 3, 'endorsed': True, }, { 'sid': 'Neonate-fourth age quartile (yes-upper)', 'symptom': 's4994', 'module': 'neonate', 'gen_5_4c': 28, 'endorsed': True, }, { 'sid': 'Neonate-fourth age quartile (no)', 'symptom': 's4994', 'module': 'neonate', 'gen_5_4c': 1, 'endorsed': False, }, { 'sid': 'Neonate-fourth age quartile (no-lower)', 'symptom': 's4994', 'module': 'neonate', 'gen_5_4c': 2, 'endorsed': False, }, { 'sid': 'Neonate-fourth age quartile (just age group)', 'symptom': 's4994', 'module': 'neonate', 'gen_5_4d': 1, 'endorsed': False, }, ]
mapping = [{'sid': 'Adult age binary (yes)', 'symptom': 'age', 'module': 'adult', 'gen_5_4a': 55, 'endorsed': True}, {'sid': 'Adult age binary (no)', 'symptom': 'age', 'module': 'adult', 'gen_5_4a': 45, 'endorsed': False}, {'sid': 'Adult age binary (no-lower bound)', 'symptom': 'age', 'module': 'adult', 'gen_5_4a': 12, 'endorsed': False}, {'sid': 'Adult age binary (threshold)', 'symptom': 'age', 'module': 'adult', 'gen_5_4a': 49, 'endorsed': True}, {'sid': 'Adult age binary (just age group)', 'symptom': 'age', 'module': 'adult', 'gen_5_4d': 3, 'endorsed': False}, {'sid': 'Adult-first age quartile (yes)', 'symptom': 's88881', 'module': 'adult', 'gen_5_4a': 20, 'endorsed': True}, {'sid': 'Adult-first age quartile (yes-upper threshold)', 'symptom': 's88881', 'module': 'adult', 'gen_5_4a': 32, 'endorsed': True}, {'sid': 'Adult-first age quartile (yes-lower threshold)', 'symptom': 's88881', 'module': 'adult', 'gen_5_4a': 12, 'endorsed': True}, {'sid': 'Adult-first age quartile (no)', 'symptom': 's88881', 'module': 'adult', 'gen_5_4a': 35, 'endorsed': False}, {'sid': 'Adult-first age quartile (no-upper threshold)', 'symptom': 's88881', 'module': 'adult', 'gen_5_4a': 33, 'endorsed': False}, {'sid': 'Adult-first age quartile (just age group)', 'symptom': 's88881', 'module': 'adult', 'gen_5_4d': 3, 'endorsed': False}, {'sid': 'Adult-second age quartile (yes)', 'symptom': 's88882', 'module': 'adult', 'gen_5_4a': 40, 'endorsed': True}, {'sid': 'Adult-second age quartile (yes-upper threshold)', 'symptom': 's88882', 'module': 'adult', 'gen_5_4a': 49, 'endorsed': True}, {'sid': 'Adult-second age quartile (yes-lower threshold)', 'symptom': 's88882', 'module': 'adult', 'gen_5_4a': 33, 'endorsed': True}, {'sid': 'Adult-second age quartile (no-upper)', 'symptom': 's88882', 'module': 'adult', 'gen_5_4a': 60, 'endorsed': False}, {'sid': 'Adult-second age quartile (no-lower)', 'symptom': 's88882', 'module': 'adult', 'gen_5_4a': 30, 'endorsed': False}, {'sid': 'Adult-second age quartile (no-lower threshold)', 'symptom': 's88882', 'module': 'adult', 'gen_5_4a': 32, 'endorsed': False}, {'sid': 'Adult-second age quartile (no-upper threshold)', 'symptom': 's88882', 'module': 'adult', 'gen_5_4a': 50, 'endorsed': False}, {'sid': 'Adult-second age quartile (just age group)', 'symptom': 's88882', 'module': 'adult', 'gen_5_4d': 3, 'endorsed': False}, {'sid': 'Adult-third age quartile (yes)', 'symptom': 's88883', 'module': 'adult', 'gen_5_4a': 50, 'endorsed': True}, {'sid': 'Adult-third age quartile (yes-upper threshold)', 'symptom': 's88883', 'module': 'adult', 'gen_5_4a': 65, 'endorsed': True}, {'sid': 'Adult-third age quartile (yes-lower threshold)', 'symptom': 's88883', 'module': 'adult', 'gen_5_4a': 50, 'endorsed': True}, {'sid': 'Adult-third age quartile (no-lower)', 'symptom': 's88883', 'module': 'adult', 'gen_5_4a': 40, 'endorsed': False}, {'sid': 'Adult-third age quartile (no-upper)', 'symptom': 's88883', 'module': 'adult', 'gen_5_4a': 70, 'endorsed': False}, {'sid': 'Adult-third age quartile (no-lower threshold)', 'symptom': 's88883', 'module': 'adult', 'gen_5_4a': 49, 'endorsed': False}, {'sid': 'Adult-third age quartile (no-upper threshold)', 'symptom': 's88883', 'module': 'adult', 'gen_5_4a': 66, 'endorsed': False}, {'sid': 'Adult-third age quartile (just age group)', 'symptom': 's88883', 'module': 'adult', 'gen_5_4d': 3, 'endorsed': False}, {'sid': 'Adult-fourth age quartile (yes)', 'symptom': 's88884', 'module': 'adult', 'gen_5_4a': 70, 'endorsed': True}, {'sid': 'Adult-fourth age quartile (yes-lower threshold)', 'symptom': 's88884', 'module': 'adult', 'gen_5_4a': 66, 'endorsed': True}, {'sid': 'Adult-fourth age quartile (no-lower)', 'symptom': 's88884', 'module': 'adult', 'gen_5_4a': 60, 'endorsed': False}, {'sid': 'Adult-fourth age quartile (no-lower threshold)', 'symptom': 's88884', 'module': 'adult', 'gen_5_4a': 65, 'endorsed': False}, {'sid': 'Adult-fourth age quartile (just age group)', 'symptom': 's88884', 'module': 'adult', 'gen_5_4d': 3, 'endorsed': False}, {'sid': 'Child age binary (years-yes)', 'symptom': 'age', 'module': 'child', 'gen_5_4a': 7, 'endorsed': True}, {'sid': 'Child age binary (years-upper bound)', 'symptom': 'age', 'module': 'child', 'gen_5_4a': 11, 'endorsed': True}, {'sid': 'Child age binary (years-no)', 'symptom': 'age', 'module': 'child', 'gen_5_4a': 1, 'endorsed': False}, {'sid': 'Child age binary (years-threshold)', 'symptom': 'age', 'module': 'child', 'gen_5_4a': 2, 'endorsed': True}, {'sid': 'Child age binary (months-yes)', 'symptom': 'age', 'module': 'child', 'gen_5_4b': 30, 'endorsed': True}, {'sid': 'Child age binary (months-no)', 'symptom': 'age', 'module': 'child', 'gen_5_4b': 11, 'endorsed': False}, {'sid': 'Child age binary (months-threshold)', 'symptom': 'age', 'module': 'child', 'gen_5_4b': 24, 'endorsed': True}, {'sid': 'Child age binary (days-yes)', 'symptom': 'age', 'module': 'child', 'gen_5_4c': 365 * 3, 'endorsed': True}, {'sid': 'Child age binary (days-lower bound)', 'symptom': 'age', 'module': 'child', 'gen_5_4c': 29, 'endorsed': False}, {'sid': 'Child age binary (days-threshold)', 'symptom': 'age', 'module': 'child', 'gen_5_4c': 365 * 2, 'endorsed': True}, {'sid': 'Child age binary (just age group)', 'symptom': 'age', 'module': 'child', 'gen_5_4d': 2, 'endorsed': False}, {'sid': 'Child-first age quintile (no-years)', 'symptom': 's2991', 'module': 'child', 'gen_5_4a': 1, 'endorsed': False}, {'sid': 'Child-first age quintile (yes-months)', 'symptom': 's2991', 'module': 'child', 'gen_5_4b': 3, 'endorsed': True}, {'sid': 'Child-first age quintile (yes-months lower threshold)', 'symptom': 's2991', 'module': 'child', 'gen_5_4b': 1, 'endorsed': True}, {'sid': 'Child-first age quintile (yes-months upper threshold)', 'symptom': 's2991', 'module': 'child', 'gen_5_4b': 5, 'endorsed': True}, {'sid': 'Child-first age quintile (no-months)', 'symptom': 's2991', 'module': 'child', 'gen_5_4b': 11, 'endorsed': False}, {'sid': 'Child-first age quintile (no-months upper threshold)', 'symptom': 's2991', 'module': 'child', 'gen_5_4b': 6, 'endorsed': False}, {'sid': 'Child-first age quintile (yes-days)', 'symptom': 's2991', 'module': 'child', 'gen_5_4c': 100, 'endorsed': True}, {'sid': 'Child-first age quintile (yes-days lower threshold)', 'symptom': 's2991', 'module': 'child', 'gen_5_4c': 29, 'endorsed': True}, {'sid': 'Child-first age quintile (yes-days upper threshold)', 'symptom': 's2991', 'module': 'child', 'gen_5_4c': 152, 'endorsed': True}, {'sid': 'Child-first age quintile (no-days)', 'symptom': 's2991', 'module': 'child', 'gen_5_4c': 300, 'endorsed': False}, {'sid': 'Child-first age quintile (no-days upper threshold)', 'symptom': 's2991', 'module': 'child', 'gen_5_4c': 153, 'endorsed': False}, {'sid': 'Child-first age quintile (just age group)', 'symptom': 's2991', 'module': 'child', 'gen_5_4d': 2, 'endorsed': False}, {'sid': 'Child-second age quintile (yes-years upper threshold)', 'symptom': 's2992', 'module': 'child', 'gen_5_4a': 1, 'endorsed': True}, {'sid': 'Child-second age quintile (no-years)', 'symptom': 's2992', 'module': 'child', 'gen_5_4a': 2, 'endorsed': False}, {'sid': 'Child-second age quintile (yes-months)', 'symptom': 's2992', 'module': 'child', 'gen_5_4b': 9, 'endorsed': True}, {'sid': 'Child-second age quintile (yes-months upper threshold)', 'symptom': 's2992', 'module': 'child', 'gen_5_4b': 12, 'endorsed': True}, {'sid': 'Child-second age quintile (yes-months lower threshold)', 'symptom': 's2992', 'module': 'child', 'gen_5_4b': 6, 'endorsed': True}, {'sid': 'Child-second age quintile (no-months upper)', 'symptom': 's2992', 'module': 'child', 'gen_5_4b': 15, 'endorsed': False}, {'sid': 'Child-second age quintile (no-months lower)', 'symptom': 's2992', 'module': 'child', 'gen_5_4b': 3, 'endorsed': False}, {'sid': 'Child-second age quintile (no-months upper threshold)', 'symptom': 's2992', 'module': 'child', 'gen_5_4b': 13, 'endorsed': False}, {'sid': 'Child-second age quintile (no-months lower threshold)', 'symptom': 's2992', 'module': 'child', 'gen_5_4b': 5, 'endorsed': False}, {'sid': 'Child-second age quintile (yes-days)', 'symptom': 's2992', 'module': 'child', 'gen_5_4c': 300, 'endorsed': True}, {'sid': 'Child-second age quintile (yes-days upper threshold)', 'symptom': 's2992', 'module': 'child', 'gen_5_4c': 365, 'endorsed': True}, {'sid': 'Child-second age quintile (yes-days lower threshold)', 'symptom': 's2992', 'module': 'child', 'gen_5_4c': 153, 'endorsed': True}, {'sid': 'Child-second age quintile (no-days upper)', 'symptom': 's2992', 'module': 'child', 'gen_5_4c': 500, 'endorsed': False}, {'sid': 'Child-second age quintile (no-days lower)', 'symptom': 's2992', 'module': 'child', 'gen_5_4c': 60, 'endorsed': False}, {'sid': 'Child-second age quintile (no-days upper threshold)', 'symptom': 's2992', 'module': 'child', 'gen_5_4c': 366, 'endorsed': False}, {'sid': 'Child-second age quintile (no-days lower threshold)', 'symptom': 's2992', 'module': 'child', 'gen_5_4c': 152, 'endorsed': False}, {'sid': 'Child-second age quintile (just age group)', 'symptom': 's2992', 'module': 'child', 'gen_5_4d': 2, 'endorsed': False}, {'sid': 'Child-third age quintile (yes-years lower threshold)', 'symptom': 's2993', 'module': 'child', 'gen_5_4a': 2, 'endorsed': True}, {'sid': 'Child-third age quintile (yes-years upper threshold)', 'symptom': 's2993', 'module': 'child', 'gen_5_4a': 3, 'endorsed': True}, {'sid': 'Child-third age quintile (no-years upper)', 'symptom': 's2993', 'module': 'child', 'gen_5_4a': 5, 'endorsed': False}, {'sid': 'Child-third age quintile (no-years lower threshold)', 'symptom': 's2993', 'module': 'child', 'gen_5_4a': 1, 'endorsed': False}, {'sid': 'Child-third age quintile (no-years upper threshold)', 'symptom': 's2993', 'module': 'child', 'gen_5_4a': 4, 'endorsed': False}, {'sid': 'Child-third age quintile (yes-months)', 'symptom': 's2993', 'module': 'child', 'gen_5_4b': 30, 'endorsed': True}, {'sid': 'Child-third age quintile (yes-months upper threshold)', 'symptom': 's2993', 'module': 'child', 'gen_5_4b': 36, 'endorsed': True}, {'sid': 'Child-third age quintile (yes-months lower threshold)', 'symptom': 's2993', 'module': 'child', 'gen_5_4b': 13, 'endorsed': True}, {'sid': 'Child-third age quintile (no-months lower)', 'symptom': 's2993', 'module': 'child', 'gen_5_4b': 10, 'endorsed': False}, {'sid': 'Child-third age quintile (no-months upper)', 'symptom': 's2993', 'module': 'child', 'gen_5_4b': 60, 'endorsed': False}, {'sid': 'Child-third age quintile (no-months lower threshold)', 'symptom': 's2993', 'module': 'child', 'gen_5_4b': 12, 'endorsed': False}, {'sid': 'Child-third age quintile (no-months upper threshold)', 'symptom': 's2993', 'module': 'child', 'gen_5_4b': 37, 'endorsed': False}, {'sid': 'Child-third age quintile (just age group)', 'symptom': 's2993', 'module': 'child', 'gen_5_4d': 2, 'endorsed': False}, {'sid': 'Child-fourth age quintile (yes-years)', 'symptom': 's2994', 'module': 'child', 'gen_5_4a': 5, 'endorsed': True}, {'sid': 'Child-fourth age quintile (yes-years upper threshold)', 'symptom': 's2994', 'module': 'child', 'gen_5_4a': 7, 'endorsed': True}, {'sid': 'Child-fourth age quintile (yes-years lower threshold)', 'symptom': 's2994', 'module': 'child', 'gen_5_4a': 4, 'endorsed': True}, {'sid': 'Child-fourth age quintile (no-years lower)', 'symptom': 's2994', 'module': 'child', 'gen_5_4a': 2, 'endorsed': False}, {'sid': 'Child-fourth age quintile (no-years upper)', 'symptom': 's2994', 'module': 'child', 'gen_5_4a': 10, 'endorsed': False}, {'sid': 'Child-fourth age quintile (no-years lower threshold)', 'symptom': 's2994', 'module': 'child', 'gen_5_4a': 3, 'endorsed': False}, {'sid': 'Child-fourth age quintile (no-years upper threshold)', 'symptom': 's2994', 'module': 'child', 'gen_5_4a': 8, 'endorsed': False}, {'sid': 'Child-fourth age quintile (yes-months)', 'symptom': 's2994', 'module': 'child', 'gen_5_4b': 60, 'endorsed': True}, {'sid': 'Child-fourth age quintile (yes-months upper threshold)', 'symptom': 's2994', 'module': 'child', 'gen_5_4b': 84, 'endorsed': True}, {'sid': 'Child-fourth age quintile (yes-months lower threshold)', 'symptom': 's2994', 'module': 'child', 'gen_5_4b': 48, 'endorsed': True}, {'sid': 'Child-fourth age quintile (no-months lower)', 'symptom': 's2994', 'module': 'child', 'gen_5_4b': 30, 'endorsed': False}, {'sid': 'Child-fourth age quintile (no-months upper)', 'symptom': 's2994', 'module': 'child', 'gen_5_4b': 120, 'endorsed': False}, {'sid': 'Child-fourth age quintile (no-months lower threshold)', 'symptom': 's2994', 'module': 'child', 'gen_5_4b': 36, 'endorsed': False}, {'sid': 'Child-fourth age quintile (no-months upper threshold)', 'symptom': 's2994', 'module': 'child', 'gen_5_4b': 96, 'endorsed': False}, {'sid': 'Child-fourth age quintile (just age group)', 'symptom': 's2994', 'module': 'child', 'gen_5_4d': 2, 'endorsed': False}, {'sid': 'Child-fifth age quintile (yes)', 'symptom': 's2995', 'module': 'child', 'gen_5_4a': 9, 'endorsed': True}, {'sid': 'Child-fifth age quintile (yes-upper)', 'symptom': 's2995', 'module': 'child', 'gen_5_4a': 11, 'endorsed': True}, {'sid': 'Child-fifth age quintile (yes-lower)', 'symptom': 's2995', 'module': 'child', 'gen_5_4a': 8, 'endorsed': True}, {'sid': 'Child-fifth age quintile (no-years)', 'symptom': 's2995', 'module': 'child', 'gen_5_4a': 5, 'endorsed': False}, {'sid': 'Child-fifth age quintile (no-lower threshold)', 'symptom': 's2995', 'module': 'child', 'gen_5_4a': 7, 'endorsed': False}, {'sid': 'Child-fifth age quintile (just age group)', 'symptom': 's2995', 'module': 'child', 'gen_5_4d': 2, 'endorsed': False}, {'sid': 'Neonate age binary (yes)', 'symptom': 'age', 'module': 'neonate', 'gen_5_4c': 5, 'endorsed': True}, {'sid': 'Neonate age binary (yes-upper bound)', 'symptom': 'age', 'module': 'neonate', 'gen_5_4c': 28, 'endorsed': True}, {'sid': 'Neonate age binary (no)', 'symptom': 'age', 'module': 'neonate', 'gen_5_4c': 2, 'endorsed': False}, {'sid': 'Neonate age binary (zero)', 'symptom': 'age', 'module': 'neonate', 'gen_5_4c': 0, 'endorsed': False}, {'sid': 'Neonate age binary (threshold)', 'symptom': 'age', 'module': 'neonate', 'gen_5_4c': 3, 'endorsed': True}, {'sid': 'Neonate age binary (just age group)', 'symptom': 'age', 'module': 'neonate', 'gen_5_4d': 1, 'endorsed': False}, {'sid': 'Neonate-first age quartile (yes)', 'symptom': 's4991', 'module': 'neonate', 'gen_5_4c': 0, 'endorsed': True}, {'sid': 'Neonate-first age quartile (no)', 'symptom': 's4991', 'module': 'neonate', 'gen_5_4c': 1, 'endorsed': False}, {'sid': 'Neonate-first age quartile (just age group)', 'symptom': 's4991', 'module': 'neonate', 'gen_5_4d': 1, 'endorsed': True}, {'sid': 'Neonate-third age quartile (yes-lower)', 'symptom': 's4993', 'module': 'neonate', 'gen_5_4c': 1, 'endorsed': True}, {'sid': 'Neonate-third age quartile (yes-upper)', 'symptom': 's4993', 'module': 'neonate', 'gen_5_4c': 2, 'endorsed': True}, {'sid': 'Neonate-third age quartile (no-lower)', 'symptom': 's4993', 'module': 'neonate', 'gen_5_4c': 0, 'endorsed': False}, {'sid': 'Neonate-third age quartile (no-upper)', 'symptom': 's4993', 'module': 'neonate', 'gen_5_4c': 3, 'endorsed': False}, {'sid': 'Neonate-third age quartile (just age group)', 'symptom': 's4993', 'module': 'neonate', 'gen_5_4d': 1, 'endorsed': False}, {'sid': 'Neonate-fourth age quartile (yes)', 'symptom': 's4994', 'module': 'neonate', 'gen_5_4c': 12, 'endorsed': True}, {'sid': 'Neonate-fourth age quartile (yes-lower)', 'symptom': 's4994', 'module': 'neonate', 'gen_5_4c': 3, 'endorsed': True}, {'sid': 'Neonate-fourth age quartile (yes-upper)', 'symptom': 's4994', 'module': 'neonate', 'gen_5_4c': 28, 'endorsed': True}, {'sid': 'Neonate-fourth age quartile (no)', 'symptom': 's4994', 'module': 'neonate', 'gen_5_4c': 1, 'endorsed': False}, {'sid': 'Neonate-fourth age quartile (no-lower)', 'symptom': 's4994', 'module': 'neonate', 'gen_5_4c': 2, 'endorsed': False}, {'sid': 'Neonate-fourth age quartile (just age group)', 'symptom': 's4994', 'module': 'neonate', 'gen_5_4d': 1, 'endorsed': False}]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # let's create several lists alist1 = [1, 2, 3, 4, 5] alist2 = ['a', 'b', 'c', 'd', 'e'] alist3 = [] # empty list alist4 = list() # Also creates an empty list. As an argument, anything iterable can be used and a list is created from it. print(len(alist1)) # The builtin len() function returns the number of elements in a list print(alist1[0]) # Prints out 0-th element of a list # A negative index is relative to the end of sequence (-0 is still 0) print(alist1[-1]) # Prints out the last element of a list print(alist1) # Prints out a whole list alist1[0] = 100 # Lists are mutable print(alist1) alist1[1:3] = [101, 102, 103] # We can replace several elements print(alist1) alist1[len(alist1):] = [6] # We can append new elements print(alist1) alist1.append(7) # But easier for appending is to call the append() method print(alist1) alist1[5:] = [] # We can remove elements from the list. The 5: means from the 5th element till end (and :5 would mean from beginning till 5th element print(alist1) copy_list = alist1[:] # Copy of a list (a new list object but with same elements). del alist1[4] # The del operator can be used for removing elements too print(alist1) alist5 = alist1 + alist2 # + creates a new list print(alist5) # The above concatenation creates a "heterogeneous" list (contains ints and strings). It is possible but not advisable. # The for cycle in Python iterates over iterable entities, e.g., lists, etc for a in alist2: print(f' iterating over a list: {a}') # Lists have many methods. Let's examine them. fruits = ['orange', 'apple', 'pear', 'banana', 'kiwi', 'apple', 'banana'] print('List of fruits: {}'.format(fruits)) print('How many apples are in the list: {}'.format(fruits.count('apple'))) print('How many tangerines are in the list: {}'.format(fruits.count('tangerine'))) print('Position of banana: {}'.format(fruits.index('banana'))) print('Position of banana starting a position 4: {}'.format(fruits.index('banana', 4))) fruits.reverse() print('Reversed list: {}'.format(fruits)) fruits.sort() print('Sorted list: {}'.format(fruits)) # List can be used as stacks fruits.append('grape') print('Appended grape: {}'.format(fruits)) print('Pop removes and returns the last element "{}", resulting list {}'.format(fruits.pop(), fruits)) # Tuples are similar to list but immutable atuple1 = (1, 2, 3, 4) atuple2 = ('a', 'b', 'c', 'd') nested_tuple = (atuple1, atuple2) print(nested_tuple) empty_tuple = () # We unpack tuples a1, a2, a3, a4 = atuple1 print('{} {} {} {}'.format(a1, a2, a3, a4)) # We can iterate over tuples for i in atuple1: print(f' element of the tuple: {i}') # We can access individual elements in tuples print(atuple1[0]) # But we cannot modify them # Uncomment the following line to get an exception # atuple1[0] = 1
alist1 = [1, 2, 3, 4, 5] alist2 = ['a', 'b', 'c', 'd', 'e'] alist3 = [] alist4 = list() print(len(alist1)) print(alist1[0]) print(alist1[-1]) print(alist1) alist1[0] = 100 print(alist1) alist1[1:3] = [101, 102, 103] print(alist1) alist1[len(alist1):] = [6] print(alist1) alist1.append(7) print(alist1) alist1[5:] = [] print(alist1) copy_list = alist1[:] del alist1[4] print(alist1) alist5 = alist1 + alist2 print(alist5) for a in alist2: print(f' iterating over a list: {a}') fruits = ['orange', 'apple', 'pear', 'banana', 'kiwi', 'apple', 'banana'] print('List of fruits: {}'.format(fruits)) print('How many apples are in the list: {}'.format(fruits.count('apple'))) print('How many tangerines are in the list: {}'.format(fruits.count('tangerine'))) print('Position of banana: {}'.format(fruits.index('banana'))) print('Position of banana starting a position 4: {}'.format(fruits.index('banana', 4))) fruits.reverse() print('Reversed list: {}'.format(fruits)) fruits.sort() print('Sorted list: {}'.format(fruits)) fruits.append('grape') print('Appended grape: {}'.format(fruits)) print('Pop removes and returns the last element "{}", resulting list {}'.format(fruits.pop(), fruits)) atuple1 = (1, 2, 3, 4) atuple2 = ('a', 'b', 'c', 'd') nested_tuple = (atuple1, atuple2) print(nested_tuple) empty_tuple = () (a1, a2, a3, a4) = atuple1 print('{} {} {} {}'.format(a1, a2, a3, a4)) for i in atuple1: print(f' element of the tuple: {i}') print(atuple1[0])
__all__ = [ 'feature_audio_adpcm', \ 'feature_audio_adpcm_sync', \ 'bv_audio_sync_manager' ]
__all__ = ['feature_audio_adpcm', 'feature_audio_adpcm_sync', 'bv_audio_sync_manager']
x = int(input()) a = list(map(int,input().split())) y = int(input()) b = list(map(int,input().split())) f=[] for i in b: for j in a: if i%j==0: f.append(i/j) print(f.count(max(f)))
x = int(input()) a = list(map(int, input().split())) y = int(input()) b = list(map(int, input().split())) f = [] for i in b: for j in a: if i % j == 0: f.append(i / j) print(f.count(max(f)))
class mystery(object): def __init__(this, length, values): this.values = [0]*length for value in values: this.values[value] += 1 def __str__(this): return "length {:d}: {}".format(len(this.values), this.values) def __add__(this, value): myst = mystery(len(this.values), []) myst.values = this.values.copy() myst.values[value] += 1 return myst
class Mystery(object): def __init__(this, length, values): this.values = [0] * length for value in values: this.values[value] += 1 def __str__(this): return 'length {:d}: {}'.format(len(this.values), this.values) def __add__(this, value): myst = mystery(len(this.values), []) myst.values = this.values.copy() myst.values[value] += 1 return myst
# coding: utf-8 # file generated by setuptools_scm # don't change, don't track in version control class Version: def __init__(self, version): self._p = version.split('.') self._v = version def __getitem__(self, key): return self._p[key] def __str__(self): return self._v def __repr__(self): return self._v __version__ = Version('0.1.dev5+ge0d057d.d20210625')
class Version: def __init__(self, version): self._p = version.split('.') self._v = version def __getitem__(self, key): return self._p[key] def __str__(self): return self._v def __repr__(self): return self._v __version__ = version('0.1.dev5+ge0d057d.d20210625')
def get_pair_number(list_pairs, item_left, item_right): # Retrieve pair number found = False ct_pair = 0 iter_pair = 0 while not found: if list_pairs[iter_pair, 0] == item_left and list_pairs[iter_pair, 1] == item_right: ct_pair = iter_pair found = True else: iter_pair += 1 return ct_pair
def get_pair_number(list_pairs, item_left, item_right): found = False ct_pair = 0 iter_pair = 0 while not found: if list_pairs[iter_pair, 0] == item_left and list_pairs[iter_pair, 1] == item_right: ct_pair = iter_pair found = True else: iter_pair += 1 return ct_pair