content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
a = 1 b = 2 c = a + b d = '668'
a = 1 b = 2 c = a + b d = '668'
class RowSource(object): def get_rows(self, start, count): raise Exception("not implemented") class FileRowSource(RowSource): def __init__(self, fileobj): super().__init__(); self.fileobj = fileobj def next_page(self, rows): lines = [] for i in range(rows): line = self.fileobj.readline() if not line: break lines.append(line) return lines
class Rowsource(object): def get_rows(self, start, count): raise exception('not implemented') class Filerowsource(RowSource): def __init__(self, fileobj): super().__init__() self.fileobj = fileobj def next_page(self, rows): lines = [] for i in range(rows): line = self.fileobj.readline() if not line: break lines.append(line) return lines
#!/usr/bin/env python3 name = input("what is your name? ") print("hello", name)
name = input('what is your name? ') print('hello', name)
class LexStatusCodes: LA_OK = 0 LA_FAIL = 1 LA_EXPIRED = 20 LA_SUSPENDED = 21 LA_GRACE_PERIOD_OVER = 22 LA_TRIAL_EXPIRED = 25 LA_LOCAL_TRIAL_EXPIRED = 26 LA_RELEASE_UPDATE_AVAILABLE = 30 LA_RELEASE_NO_UPDATE_AVAILABLE = 31 LA_E_FILE_PATH = 40 LA_E_PRODUCT_FILE = 41 LA_E_PRODUCT_DATA = 42 LA_E_PRODUCT_ID = 43 LA_E_SYSTEM_PERMISSION = 44 LA_E_FILE_PERMISSION = 45 LA_E_WMIC = 46 LA_E_TIME = 47 LA_E_INET = 48 LA_E_NET_PROXY = 49 LA_E_HOST_URL = 50 LA_E_BUFFER_SIZE = 51 LA_E_APP_VERSION_LENGTH = 52 LA_E_REVOKED = 53 LA_E_LICENSE_KEY = 54 LA_E_LICENSE_TYPE = 55 LA_E_OFFLINE_RESPONSE_FILE = 56 LA_E_OFFLINE_RESPONSE_FILE_EXPIRED = 57 LA_E_ACTIVATION_LIMIT = 58 LA_E_ACTIVATION_NOT_FOUND = 59 LA_E_DEACTIVATION_LIMIT = 60 LA_E_TRIAL_NOT_ALLOWED = 61 LA_E_TRIAL_ACTIVATION_LIMIT = 62 LA_E_MACHINE_FINGERPRINT = 63 LA_E_METADATA_KEY_LENGTH = 64 LA_E_METADATA_VALUE_LENGTH = 65 LA_E_ACTIVATION_METADATA_LIMIT = 66 LA_E_TRIAL_ACTIVATION_METADATA_LIMIT = 67 LA_E_METADATA_KEY_NOT_FOUND = 68 LA_E_TIME_MODIFIED = 69 LA_E_RELEASE_VERSION_FORMAT = 70 LA_E_AUTHENTICATION_FAILED = 71 LA_E_METER_ATTRIBUTE_NOT_FOUND = 72 LA_E_METER_ATTRIBUTE_USES_LIMIT_REACHED = 73 LA_E_CUSTOM_FINGERPRINT_LENGTH = 74 LA_E_VM = 80 LA_E_COUNTRY = 81 LA_E_IP = 82 LA_E_RATE_LIMIT = 90 LA_E_SERVER = 91 LA_E_CLIENT = 92
class Lexstatuscodes: la_ok = 0 la_fail = 1 la_expired = 20 la_suspended = 21 la_grace_period_over = 22 la_trial_expired = 25 la_local_trial_expired = 26 la_release_update_available = 30 la_release_no_update_available = 31 la_e_file_path = 40 la_e_product_file = 41 la_e_product_data = 42 la_e_product_id = 43 la_e_system_permission = 44 la_e_file_permission = 45 la_e_wmic = 46 la_e_time = 47 la_e_inet = 48 la_e_net_proxy = 49 la_e_host_url = 50 la_e_buffer_size = 51 la_e_app_version_length = 52 la_e_revoked = 53 la_e_license_key = 54 la_e_license_type = 55 la_e_offline_response_file = 56 la_e_offline_response_file_expired = 57 la_e_activation_limit = 58 la_e_activation_not_found = 59 la_e_deactivation_limit = 60 la_e_trial_not_allowed = 61 la_e_trial_activation_limit = 62 la_e_machine_fingerprint = 63 la_e_metadata_key_length = 64 la_e_metadata_value_length = 65 la_e_activation_metadata_limit = 66 la_e_trial_activation_metadata_limit = 67 la_e_metadata_key_not_found = 68 la_e_time_modified = 69 la_e_release_version_format = 70 la_e_authentication_failed = 71 la_e_meter_attribute_not_found = 72 la_e_meter_attribute_uses_limit_reached = 73 la_e_custom_fingerprint_length = 74 la_e_vm = 80 la_e_country = 81 la_e_ip = 82 la_e_rate_limit = 90 la_e_server = 91 la_e_client = 92
DEBUG=True DEBUG_EXTRACT=True DEBUG_ROOIBOS=True DEBUG_PATCH_LOCATIONS=True DEBUG_RESOLVE_DYNLIB=True DEBUG_ADDR2LINE=True DEBUG_PATCHING=True DEBUG_LTRACE=False DEBUG_FIND=True TEST=True
debug = True debug_extract = True debug_rooibos = True debug_patch_locations = True debug_resolve_dynlib = True debug_addr2_line = True debug_patching = True debug_ltrace = False debug_find = True test = True
class GuacamoleConfiguration(object): def __init__(self, protocol=None): self.connectionID = None self.protocol = protocol self.parameters = {} @property def connectionID(self): return self._connectionID @connectionID.setter def connectionID(self, connectionID): self._connectionID = connectionID @property def protocol(self): return self._protocol @protocol.setter def protocol(self, protocol): self._protocol = protocol @property def parameters(self): return self._parameters @parameters.setter def parameters(self, parameters): self._parameters = parameters def getParameter(self, paramName): return self._parameters.get(paramName, None) def delParameter(self, paramName): del self._parameters[paramName] def setParameter(self, paramName, paramValue): self._parameters[paramName] = paramValue
class Guacamoleconfiguration(object): def __init__(self, protocol=None): self.connectionID = None self.protocol = protocol self.parameters = {} @property def connection_id(self): return self._connectionID @connectionID.setter def connection_id(self, connectionID): self._connectionID = connectionID @property def protocol(self): return self._protocol @protocol.setter def protocol(self, protocol): self._protocol = protocol @property def parameters(self): return self._parameters @parameters.setter def parameters(self, parameters): self._parameters = parameters def get_parameter(self, paramName): return self._parameters.get(paramName, None) def del_parameter(self, paramName): del self._parameters[paramName] def set_parameter(self, paramName, paramValue): self._parameters[paramName] = paramValue
a, b, c = input().split(" ") a = float(a) b = float(b) c = float(c) if a >= b and a >= c: n1 = a if b >= c: n2 = b n3 = c else: n2 = c n3 = b if b >= a and b >= c: n1 = b if a >= c: n2 = a n3 = c else: n2 = c n3 = a if c >= a and c >= b: n1 = c if a >= b: n2 = a n3 = b else: n2 = b n3 = a if a == b and b == c: n1 = a n2 = b n3 = c a = n1 b = n2 c = n3 if a >= (b + c): print('NAO FORMA TRIANGULO') else: if (a ** 2) == (b ** 2 + c ** 2): print('TRIANGULO RETANGULO') if (a ** 2) > (b ** 2 + c ** 2): print('TRIANGULO OBTUSANGULO') if (a ** 2) < (b ** 2 + c ** 2): print('TRIANGULO ACUTANGULO') if a == b == c: print('TRIANGULO EQUILATERO') if a == b != c or b == c != a or a == c != b: print('TRIANGULO ISOSCELES')
(a, b, c) = input().split(' ') a = float(a) b = float(b) c = float(c) if a >= b and a >= c: n1 = a if b >= c: n2 = b n3 = c else: n2 = c n3 = b if b >= a and b >= c: n1 = b if a >= c: n2 = a n3 = c else: n2 = c n3 = a if c >= a and c >= b: n1 = c if a >= b: n2 = a n3 = b else: n2 = b n3 = a if a == b and b == c: n1 = a n2 = b n3 = c a = n1 b = n2 c = n3 if a >= b + c: print('NAO FORMA TRIANGULO') else: if a ** 2 == b ** 2 + c ** 2: print('TRIANGULO RETANGULO') if a ** 2 > b ** 2 + c ** 2: print('TRIANGULO OBTUSANGULO') if a ** 2 < b ** 2 + c ** 2: print('TRIANGULO ACUTANGULO') if a == b == c: print('TRIANGULO EQUILATERO') if a == b != c or b == c != a or a == c != b: print('TRIANGULO ISOSCELES')
def only_numbers(input_list): integers_list = [list_entry for list_entry in input_list if type(list_entry) == int] return integers_list print(only_numbers([99, 'no data', 95, 93, 'no data'])) def only_numbers_greater_zero(input_list): integers_list = [list_entry for list_entry in input_list if list_entry > 0] return integers_list print(only_numbers_greater_zero([99, -95, 93, 0.4]))
def only_numbers(input_list): integers_list = [list_entry for list_entry in input_list if type(list_entry) == int] return integers_list print(only_numbers([99, 'no data', 95, 93, 'no data'])) def only_numbers_greater_zero(input_list): integers_list = [list_entry for list_entry in input_list if list_entry > 0] return integers_list print(only_numbers_greater_zero([99, -95, 93, 0.4]))
## https://docs.python.org/3/howto/logging-cookbook.html#an-example-dictionary-based-configuration ## https://docs.djangoproject.com/en/1.9/topics/logging/#configuring-logging logcfg = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'verbose': { 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s' }, 'simple': { # 'format': '%(levelname)s %(message)s' 'format': '[%(levelname)s]:[%(filename)s:%(lineno)d - %(funcName)20s() ]: %(message)s' # 'format': '%(asctime)s - %(name)s - %(levelname)s - %(message)s' }, 'standard': { # 'format': '%(asctime)s:[%(levelname)s]:%(lineno)d:%(name)s:: %(message)s' 'format': '%(asctime)s:[%(levelname)s]:[%(name)s]:[%(filename)s:%(lineno)d - %(funcName)20s() ]: %(message)s' }, }, 'filters': {}, 'handlers': { 'default': { 'level':'DEBUG', 'class':'logging.StreamHandler', }, 'console':{ 'level':'DEBUG', 'class':'logging.StreamHandler', 'formatter': 'standard', 'stream': 'ext://sys.stdout' }, # 'file_info': { # 'class': 'logging.handlers.RotatingFileHandler', # 'level': 'DEBUG', # 'formatter': 'standard', # 'filename': 'log/info.log', # 'maxBytes': 10485760, # 'backupCount': 20, # 'encoding': 'utf8' # }, # 'file_error': { # 'class': 'logging.handlers.RotatingFileHandler', # 'level': 'ERROR', # 'formatter': 'standard', # 'filename': 'log/errors.log', # 'maxBytes': 10485760, # 'backupCount': 20, # 'encoding': 'utf8' # } }, 'loggers':{ '': { 'handlers': ['console'], 'level': 'INFO', 'propagate': False }, '__main__': { 'handlers': ['console'], # 'level': 'CRITICAL', 'level': 'ERROR', # 'level': 'WARNING', # 'level': 'INFO', # 'level': 'DEBUG', # 'level': 'NOTSET', 'propagate': False } } }
logcfg = {'version': 1, 'disable_existing_loggers': False, 'formatters': {'verbose': {'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'}, 'simple': {'format': '[%(levelname)s]:[%(filename)s:%(lineno)d - %(funcName)20s() ]: %(message)s'}, 'standard': {'format': '%(asctime)s:[%(levelname)s]:[%(name)s]:[%(filename)s:%(lineno)d - %(funcName)20s() ]: %(message)s'}}, 'filters': {}, 'handlers': {'default': {'level': 'DEBUG', 'class': 'logging.StreamHandler'}, 'console': {'level': 'DEBUG', 'class': 'logging.StreamHandler', 'formatter': 'standard', 'stream': 'ext://sys.stdout'}}, 'loggers': {'': {'handlers': ['console'], 'level': 'INFO', 'propagate': False}, '__main__': {'handlers': ['console'], 'level': 'ERROR', 'propagate': False}}}
# Rolling hash usage of a multiply accumlate unit with multiplier from the FNV hash, but linear style like the Ghash of AES-GCM def rolling_hash_by_mac(list): hash = 0 for byte in list: hash += byte hash *= 0x01000193 hash %= 2**32 return(hash) #powers of the multiplier on each list member in the result # 6 5 4 3 2 1 list1 = [0x58, 0x76, 0x54, 0x3a, 0xbe, 0xcd] list2 = [0x58, 0x67, 0x54, 0x3a, 0xeb, 0xcd] x = rolling_hash_by_mac(list1) y = rolling_hash_by_mac(list2) print('1st hash:', x) print('2nd hash:', y) #TESTING MODIFICATION OF DATA x -= 0x76*0x01000193**5%2**32 #data has become multiplied by power of 5 in output x -= 0xbe*0x01000193**2%2**32 #data has become multiplied by power of 2 in output if x<0: x += 2**32 print('after erasing "0x76" and "0xbe" form 1st:', x) y -= 0x67*0x01000193**5%2**32 #data has become multiplied by power of 5 in output y -= 0xeb*0x01000193**2%2**32 #data has become multiplied by power of 2 in output if y<0: y += 2**32 print('after erasing "0x67" and "0xeb" form 2nd:', y) #TESTING ROLLING PROPERTY x = rolling_hash_by_mac(list1[0:5]) #queue length is 5 print('before shifting queue:', x) #manually shifting hash value x -= list1[0]*0x01000193**5%2**32 #removing first with multiplier power of 5 for the queue is 5 long here if x<0: x += 2**32 x += list1[5] #adding last x *= 0x01000193 x %= 2**32 print('shifting queue test:', x) print('expected after shifting queue:', rolling_hash_by_mac(list1[1:6])) #queue length is 5 #HASHING IN PARALLEL FOR PERFOMANCE list3 = [0x58, 0x76, 0x54, 0x3a, 0xbe, 0x58, 0x76, 0x54, 0xbe, 0xcd, 0x45, 0x66, 0x85, 0x65, 0xd3] # ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ # Par=4: bulk bulk bulk bulk bulk bulk bulk bulk rest rest rest desc desc desc desc # No.1: ignore last "par" counts of data 1 # No.2: calculate "bulk" parallelly with the multiplier to the power of number of parallel compuattion # No.3: calculate "rest" parallelly with the multiplier to the power of number of parallel compuattion # No.4: add up the last "par" count of data with descending powers of the multilier def rolling_hash_by_mac_parallel(list, par): hash = [0 for x in range(par)] #the fields of the array can be computed parallelly par_mult = 0x01000193**par bulk = (len(list)-par)//par for i in range(par): for j in range(bulk): #parallelly computable loops for the list length' whole multiple parts of "par" hash[i] += list[j*par+i] hash[i] *= par_mult hash[i] %= 2**32 rest = (len(list)-par)%par for k in range(rest): #parallelly computable loop for mostly the rest of the list, except for the last "par" pieces hash[k] += list[-par-rest+k] hash[k] *= par_mult hash[k] %= 2**32 sum = 0 for l in range(par): #multiplying the last "par" long portion with descending powers hash[(l+rest)%par] += list[-par+l] hash[(l+rest)%par] *= 0x01000193**(par-l-1) sum %= 2**32 for m in range(par): #summing up results of possibly parallel computations sum += hash[m] sum %= 2**32 sum *= 0x01000193 sum %= 2**32 return(sum) print('parallel 1st:', rolling_hash_by_mac_parallel(list3[0:-2], 4)) print('parallel 2nd:', rolling_hash_by_mac_parallel(list3[1:-1], 4)) print('expected 1st:', rolling_hash_by_mac(list3[0:-2])) print('expected 2nd:', rolling_hash_by_mac(list3[1:-1]))
def rolling_hash_by_mac(list): hash = 0 for byte in list: hash += byte hash *= 16777619 hash %= 2 ** 32 return hash list1 = [88, 118, 84, 58, 190, 205] list2 = [88, 103, 84, 58, 235, 205] x = rolling_hash_by_mac(list1) y = rolling_hash_by_mac(list2) print('1st hash:', x) print('2nd hash:', y) x -= 118 * 16777619 ** 5 % 2 ** 32 x -= 190 * 16777619 ** 2 % 2 ** 32 if x < 0: x += 2 ** 32 print('after erasing "0x76" and "0xbe" form 1st:', x) y -= 103 * 16777619 ** 5 % 2 ** 32 y -= 235 * 16777619 ** 2 % 2 ** 32 if y < 0: y += 2 ** 32 print('after erasing "0x67" and "0xeb" form 2nd:', y) x = rolling_hash_by_mac(list1[0:5]) print('before shifting queue:', x) x -= list1[0] * 16777619 ** 5 % 2 ** 32 if x < 0: x += 2 ** 32 x += list1[5] x *= 16777619 x %= 2 ** 32 print('shifting queue test:', x) print('expected after shifting queue:', rolling_hash_by_mac(list1[1:6])) list3 = [88, 118, 84, 58, 190, 88, 118, 84, 190, 205, 69, 102, 133, 101, 211] def rolling_hash_by_mac_parallel(list, par): hash = [0 for x in range(par)] par_mult = 16777619 ** par bulk = (len(list) - par) // par for i in range(par): for j in range(bulk): hash[i] += list[j * par + i] hash[i] *= par_mult hash[i] %= 2 ** 32 rest = (len(list) - par) % par for k in range(rest): hash[k] += list[-par - rest + k] hash[k] *= par_mult hash[k] %= 2 ** 32 sum = 0 for l in range(par): hash[(l + rest) % par] += list[-par + l] hash[(l + rest) % par] *= 16777619 ** (par - l - 1) sum %= 2 ** 32 for m in range(par): sum += hash[m] sum %= 2 ** 32 sum *= 16777619 sum %= 2 ** 32 return sum print('parallel 1st:', rolling_hash_by_mac_parallel(list3[0:-2], 4)) print('parallel 2nd:', rolling_hash_by_mac_parallel(list3[1:-1], 4)) print('expected 1st:', rolling_hash_by_mac(list3[0:-2])) print('expected 2nd:', rolling_hash_by_mac(list3[1:-1]))
# OpenWeatherMap API Key weather_api_key = "bfabad3eec079b77cd6e28110d3ad22f" # Google API Key g_key = "AIzaSyBKZyrmnIxatibyVFhiPyCHD87TQW0ulAA"
weather_api_key = 'bfabad3eec079b77cd6e28110d3ad22f' g_key = 'AIzaSyBKZyrmnIxatibyVFhiPyCHD87TQW0ulAA'
target = 1000000 for i in range(1,500001): if target % i != 0: continue if '0' in str(i): continue j = int(target / i) if '0' in str(j): continue print ('Factors: ' + str(i) + ' : ' + str(j)) exit
target = 1000000 for i in range(1, 500001): if target % i != 0: continue if '0' in str(i): continue j = int(target / i) if '0' in str(j): continue print('Factors: ' + str(i) + ' : ' + str(j)) exit
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __all__ = ["test_bettersis", "test_siscompleter", "test_texteditor", "test_update_checker"]
__all__ = ['test_bettersis', 'test_siscompleter', 'test_texteditor', 'test_update_checker']
''' Dataset information ''' coco_classes = [ 'person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic_light', 'fire_hydrant', 'stop_sign', 'parking_meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow', 'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee', 'skis', 'snowboard', 'sports_ball', 'kite', 'baseball_bat', 'baseball_glove', 'skateboard', 'surfboard', 'tennis_racket', 'bottle', 'wine_glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple', 'sandwich', 'orange', 'broccoli', 'carrot', 'hot_dog', 'pizza', 'donut', 'cake', 'chair', 'couch', 'potted_plant', 'bed', 'dining_table', 'toilet', 'tv', 'laptop', 'mouse', 'remote', 'keyboard', 'cell_phone', 'microwave', 'oven', 'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase', 'scissors', 'teddy_bear', 'hair_drier', 'toothbrush', ] # Argoverse-HD classes (defined as a subset of COCO classes) avhd_subset = [ 0, # person 1, # bicycle 2, # car 3, # motorcycle 5, # bus 7, # truck 9, # traffic_light 11, # stop_sign ]
""" Dataset information """ coco_classes = ['person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic_light', 'fire_hydrant', 'stop_sign', 'parking_meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow', 'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee', 'skis', 'snowboard', 'sports_ball', 'kite', 'baseball_bat', 'baseball_glove', 'skateboard', 'surfboard', 'tennis_racket', 'bottle', 'wine_glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple', 'sandwich', 'orange', 'broccoli', 'carrot', 'hot_dog', 'pizza', 'donut', 'cake', 'chair', 'couch', 'potted_plant', 'bed', 'dining_table', 'toilet', 'tv', 'laptop', 'mouse', 'remote', 'keyboard', 'cell_phone', 'microwave', 'oven', 'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase', 'scissors', 'teddy_bear', 'hair_drier', 'toothbrush'] avhd_subset = [0, 1, 2, 3, 5, 7, 9, 11]
line = input().split() n = int(line[0]) t = int(line[1]) visited = {0} line = [int(i) for i in input().split()] current = 1 while(current != t): if(current in visited or current > len(line)): print("NO") break else: visited.add(current) current += line[current - 1] if(current == t): print("YES")
line = input().split() n = int(line[0]) t = int(line[1]) visited = {0} line = [int(i) for i in input().split()] current = 1 while current != t: if current in visited or current > len(line): print('NO') break else: visited.add(current) current += line[current - 1] if current == t: print('YES')
# Create a task list. A user is presented with the text below. # Let them select an option to list all of their tasks, add a task to their list, delete a task, or quit the program. # Make each option a different function in your program. # Do NOT use Google. # Do NOT use other students. # Try to do this on your own. def main(): problem1() def problem1(): user = "" thingsToDo = ["dishes", "cut grass", "cook"] while thingsToDo != "0": thingsToDo = input(" Enter a task:") print(Task1 = "List all task", Task2 = "Add a task to the list", Task3 = "Delete a task", Task4 = "To quit the program:") # myList: # [ # # ] # user = input(thingsToDo) # def dishes(): # print(thingsToDo) # # def cut grass(): # # def cook(): # user = input("No") # if thingsToDo !=: # forEach in thingsToDo # thingsToDo.append("car wash") # print(thingsToDo) # thingsToDo.remove("dishes") # user = input("Congratulations! You're running [YOUR NAME]'s Task List program.What would you like to do next? # 1. List all tasks. # 2. Add a task to the list. # 3. Delete a task. # 0. To quit the program") # def dishes(): # # while(True): # # if("dishes" != thingsToDo): # # print("car wash") # # def cut grass(); # # while(): # # def cook(); if __name__ == '__main__': main()
def main(): problem1() def problem1(): user = '' things_to_do = ['dishes', 'cut grass', 'cook'] while thingsToDo != '0': things_to_do = input(' Enter a task:') print(Task1='List all task', Task2='Add a task to the list', Task3='Delete a task', Task4='To quit the program:') if __name__ == '__main__': main()
class StringFormat(object): def format_string(self, pattern, *args, **kwargs): return pattern.format(*args, **kwargs) # To create distributable package: # # python3 setup.py bdist_wheel --universal # # Upload the package to pypi: # # twine upload dist/*
class Stringformat(object): def format_string(self, pattern, *args, **kwargs): return pattern.format(*args, **kwargs)
# function to check string is # palindrome or not def isPalindrome(str): # Run loop from 0 to len/2 for i in xrange(0, len(str)/2): if str[i] != str[len(str)-i-1]: return False return True # main function s = "malayalam" ans = isPalindrome(s) if (ans): print("Yes") else: print("No")
def is_palindrome(str): for i in xrange(0, len(str) / 2): if str[i] != str[len(str) - i - 1]: return False return True s = 'malayalam' ans = is_palindrome(s) if ans: print('Yes') else: print('No')
n = int(input()) s = [input().split() for _ in [0] * n] c = 0 for i in s: if i[1] == "JPY": c += int(i[0]) else: c += float(i[0]) * 380000 print(c)
n = int(input()) s = [input().split() for _ in [0] * n] c = 0 for i in s: if i[1] == 'JPY': c += int(i[0]) else: c += float(i[0]) * 380000 print(c)
# PingPong_Calculator.py def convert_in2cm(inches): return inches * 2.54 def convert_lb2kg(pounds): return pounds / 2.2 height_in = int(input("Enter your height in inches: ")) weight_lb = int(input("Enter your weight in pounds: ")) height_cm = convert_in2cm(height_in) weight_kg = convert_lb2kg(weight_lb) ping_pong_tall = round(height_cm / 4) ping_pong_heavy = round(weight_kg * 1000 / 2.7) feet = height_in // 12 inch = height_in % 12 print("At", feet, "feet", inch, "inches tall, and", weight_lb, "pounds,") print("you measure", ping_pong_tall, "Ping-Pong balls tall, and ") print("you weigh the same as", ping_pong_heavy, "Ping-Pong balls!")
def convert_in2cm(inches): return inches * 2.54 def convert_lb2kg(pounds): return pounds / 2.2 height_in = int(input('Enter your height in inches: ')) weight_lb = int(input('Enter your weight in pounds: ')) height_cm = convert_in2cm(height_in) weight_kg = convert_lb2kg(weight_lb) ping_pong_tall = round(height_cm / 4) ping_pong_heavy = round(weight_kg * 1000 / 2.7) feet = height_in // 12 inch = height_in % 12 print('At', feet, 'feet', inch, 'inches tall, and', weight_lb, 'pounds,') print('you measure', ping_pong_tall, 'Ping-Pong balls tall, and ') print('you weigh the same as', ping_pong_heavy, 'Ping-Pong balls!')
n = int(input()) count = [0]*5 for _ in range(n): s = list(input()) if s[0] == "M": count[0] += 1 if s[0] == "A": count[1] += 1 if s[0] == "R": count[2] += 1 if s[0] == "C": count[3] += 1 if s[0] == "H": count[4] += 1 ans = 0 for i in range(3): for j in range(i+1, 4): for k in range(j+1, 5): ans += count[i]*count[j]*count[k] print(ans)
n = int(input()) count = [0] * 5 for _ in range(n): s = list(input()) if s[0] == 'M': count[0] += 1 if s[0] == 'A': count[1] += 1 if s[0] == 'R': count[2] += 1 if s[0] == 'C': count[3] += 1 if s[0] == 'H': count[4] += 1 ans = 0 for i in range(3): for j in range(i + 1, 4): for k in range(j + 1, 5): ans += count[i] * count[j] * count[k] print(ans)
# # PySNMP MIB module TRUNK-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TRUNK-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:27:43 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ConstraintsUnion, ValueRangeConstraint, ConstraintsIntersection, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ConstraintsUnion", "ValueRangeConstraint", "ConstraintsIntersection", "ValueSizeConstraint") MacAddress, = mibBuilder.importSymbols("BRIDGE-MIB", "MacAddress") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") MibIdentifier, Counter32, enterprises, Bits, TimeTicks, Unsigned32, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, Counter64, iso, Gauge32, NotificationType, IpAddress, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "MibIdentifier", "Counter32", "enterprises", "Bits", "TimeTicks", "Unsigned32", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "Counter64", "iso", "Gauge32", "NotificationType", "IpAddress", "Integer32") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") class PortList(OctetString): subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(4, 4) fixedLength = 4 marconi = MibIdentifier((1, 3, 6, 1, 4, 1, 326)) systems = MibIdentifier((1, 3, 6, 1, 4, 1, 326, 2)) external = MibIdentifier((1, 3, 6, 1, 4, 1, 326, 2, 20)) dlink = MibIdentifier((1, 3, 6, 1, 4, 1, 326, 2, 20, 1)) dlinkcommon = MibIdentifier((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 1)) golf = MibIdentifier((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2)) golfproducts = MibIdentifier((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 1)) golfcommon = MibIdentifier((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2)) marconi_mgmt = MibIdentifier((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2)).setLabel("marconi-mgmt") es1000Series = MibIdentifier((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24)) swPortTrunkPackage = MibIdentifier((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 6)) swSnoopPackage = MibIdentifier((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 7)) swIGMPPackage = MibIdentifier((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8)) endOfMIB = MibScalar((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 9999), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: endOfMIB.setStatus('optional') swPortTrunkTable = MibTable((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 6, 1), ) if mibBuilder.loadTexts: swPortTrunkTable.setStatus('mandatory') if mibBuilder.loadTexts: swPortTrunkTable.setDescription('This table specifys which ports group a set of ports(up to 8) into a single logical link.') swPortTrunkEntry = MibTableRow((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 6, 1, 1), ).setIndexNames((0, "TRUNK-MIB", "swPortTrunkIndex")) if mibBuilder.loadTexts: swPortTrunkEntry.setStatus('mandatory') if mibBuilder.loadTexts: swPortTrunkEntry.setDescription('A list of information specifies which ports group a set of ports(up to 8) into a single logical link.') swPortTrunkIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 6, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swPortTrunkIndex.setStatus('mandatory') if mibBuilder.loadTexts: swPortTrunkIndex.setDescription('The index of logical port trunk.The device max support 3 trunk groups. The trunk group number depend on the existence of module.') swPortTrunkName = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 6, 1, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readwrite") if mibBuilder.loadTexts: swPortTrunkName.setStatus('mandatory') if mibBuilder.loadTexts: swPortTrunkName.setDescription('The name of logical port trunk.') swPortTrunkModule = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 6, 1, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swPortTrunkModule.setStatus('mandatory') if mibBuilder.loadTexts: swPortTrunkModule.setDescription('Indicate which modules include in this Trunk. The value is up to 2.') swPortTrunkMasterPort = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 6, 1, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swPortTrunkMasterPort.setStatus('mandatory') if mibBuilder.loadTexts: swPortTrunkMasterPort.setDescription('The object indicates the master port number of the port trunk entry.The first port of the trunk is implicitly configured to be the master logical port.When using Port Trunk, you can not configure the other ports of the group except the master port. Their configuration must be same as the master port (e.g. speed, duplex, enabled/disabled, flow control, and so on).') swPortTrunkMemberNum = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 6, 1, 1, 5), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swPortTrunkMemberNum.setStatus('mandatory') if mibBuilder.loadTexts: swPortTrunkMemberNum.setDescription('Indicate how many number of ports is included in this Trunk. If the trunk is located at expansion module (i.e. es400LinkAggrIndex equals to 3) and the module is 100-TX or FX-MTRJ, the maximum number of ports in the trunk is 2. The maximum number of ports is 8 for other trunks.') swPortTrunkState = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 6, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("other", 1), ("disabled", 2), ("enabled", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swPortTrunkState.setStatus('mandatory') if mibBuilder.loadTexts: swPortTrunkState.setDescription('This object decide the port trunk enabled or disabled.') swSnoopCtrlTable = MibTable((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 7, 1), ) if mibBuilder.loadTexts: swSnoopCtrlTable.setStatus('mandatory') if mibBuilder.loadTexts: swSnoopCtrlTable.setDescription("A list of port snooping entries.Port snooping function provide an easy way to monitor traffic on any port. In this way any good packets appears on the source mirror port also shows up on the target mirror port and doesn't to reconstruct the LAN.") swSnoopCtrlEntry = MibTableRow((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 7, 1, 1), ).setIndexNames((0, "TRUNK-MIB", "swSnoopIndex")) if mibBuilder.loadTexts: swSnoopCtrlEntry.setStatus('mandatory') if mibBuilder.loadTexts: swSnoopCtrlEntry.setDescription('A list of information provide an easy way to monitor traffic on any port. The use can bring a fancy network monitor attaching to any target mirror port and set the port to be monitored as source mirror port. ') swSnoopIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 7, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swSnoopIndex.setStatus('mandatory') if mibBuilder.loadTexts: swSnoopIndex.setDescription('This object indicates the port snooping entry number.There is just only one now.') swSnoopLogicSourcePort = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 7, 1, 1, 2), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swSnoopLogicSourcePort.setStatus('mandatory') if mibBuilder.loadTexts: swSnoopLogicSourcePort.setDescription("This object indicates the number of port to be sniffed. The port number is the sequential (logical) number which is also applied to bridge MIB, etc. For instance, logical port 1~22 is mapped to module 1's 10/100Base-T TP ports, port 23~24 is mapped to module 2's 100FX/TX ports, port 25 indicates for module 3's Gigabit port, and so on.") swSnoopLogicTargetPort = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 7, 1, 1, 3), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swSnoopLogicTargetPort.setStatus('mandatory') if mibBuilder.loadTexts: swSnoopLogicTargetPort.setDescription("This object indicates switch which port will sniff another port. A trunk port member cannot be configured as a target Snooping port. The port number is the sequential (logical) number which is also applied to bridge MIB, etc. For instance, logical port 1~22 is mapped to module 1's 10/100Base-T TP ports, port 23~24 is mapped to module 2's 100FX/TX ports, port 25 indicates for module 3's Gigabit port, and so on.") swSnoopState = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 7, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("other", 1), ("disable", 2), ("enable", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swSnoopState.setStatus('mandatory') if mibBuilder.loadTexts: swSnoopState.setDescription('This object indicates the status of this entry. other(1) - this entry is currently in use but the conditions under which it will remain so are different from each of the following values. disable(2) - Snoop funtion disable. enable(3) - Snoop funtion enable and Snoop received or transmit packet by snoop source port.') swIGMPCtrlTable = MibTable((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 1), ) if mibBuilder.loadTexts: swIGMPCtrlTable.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPCtrlTable.setDescription("The table controls the Vlan's IGMP function. Its scale depends on current VLAN state (swVlanInfoStatus). If VLAN is disabled or in Mac-Base mode, there is only one entry in the table, with index 1. If VLAN is in Port-Base or 802.1q mode, the number of entries can be up to 12, with index range from 1 to 12.") swIGMPCtrlEntry = MibTableRow((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 1, 1), ).setIndexNames((0, "TRUNK-MIB", "swIGMPCtrlIndex")) if mibBuilder.loadTexts: swIGMPCtrlEntry.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPCtrlEntry.setDescription('The entry in IGMP control table (swIGMPCtrlTable). The entry is effective only when IGMP capture switch (swDevIGMPCaptureState) is enabled.') swIGMPCtrlIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 12))).setMaxAccess("readonly") if mibBuilder.loadTexts: swIGMPCtrlIndex.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPCtrlIndex.setDescription('This object indicates the IGMP control entry number.Its scale depends on current VLAN state (es400VlanInfoStatus). If VLAN is disabled or in Mac-Base mode, there is only one entry in the table, with index 1. If VLAN is in Port-Base or 802.1q mode, the number of entries is 12, with index range from 1 to 12.') swIGMPCtrlVid = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 1, 1, 2), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swIGMPCtrlVid.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPCtrlVid.setDescription("This object indicates the IGMP control entry's VLAN id. If VLAN is disabled or in Mac-Base mode, the Vid is always 0 and cannot be changed by management users. If VLAN is in Port-Base mode, the Vid is arranged from 1 to 12 , fixed form. If VLAN is in 802.1q mode, the Vid setting can vary from 1 to 4094 by management user, and the Vid in each entry must be unique in the IGMP Control Table.") swIGMPCtrlTimer = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(30, 9999)).clone(300)).setMaxAccess("readwrite") if mibBuilder.loadTexts: swIGMPCtrlTimer.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPCtrlTimer.setDescription('The timer value for sending IGMP query packet when none was sent by the multicast router in the LAN. The timer works in per-VLAN basis. Our device will be activated to send the query message if the timer is expired. Please reference RFC2236-1997. And it recommends a default of 125 seconds. The timeout value must be at least 30 seconds.') swIGMPCtrlState = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("other", 1), ("disable", 2), ("enable", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swIGMPCtrlState.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPCtrlState.setDescription('This object indicates the status of this entry. other(1) - this entry is currently in use but the conditions under which it will remain so are different from each of the following values. disable(2) - IGMP funtion is disabled for this entry. enable(3) - IGMP funtion is enabled for this entry.') swIGMPInfoTable = MibTable((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 2), ) if mibBuilder.loadTexts: swIGMPInfoTable.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPInfoTable.setDescription('The table contains the number current IGMP query packets which is captured by this device, as well as the IGMP query packets sent by the device.') swIGMPInfoEntry = MibTableRow((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 2, 1), ).setIndexNames((0, "TRUNK-MIB", "swIGMPInfoIndex")) if mibBuilder.loadTexts: swIGMPInfoEntry.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPInfoEntry.setDescription('Information about current IGMP query information, provided that swDevIGMPCaptureState and swIGMPCtrlState of associated VLAN entry are all enabled.') swIGMPInfoIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 12))).setMaxAccess("readonly") if mibBuilder.loadTexts: swIGMPInfoIndex.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPInfoIndex.setDescription('This object indicates the IGMP query information entry number. It could be up to 12 entries, depending on current number of VLAN entries.') swIGMPInfoVid = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 2, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swIGMPInfoVid.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPInfoVid.setDescription('This object indicates the Vid of associated IGMP info table entry. It follows swIGMPCtrlVid in the associated entry of IGMP control table (swIGMPCtrlTable).') swIGMPInfoQueryCount = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 2, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swIGMPInfoQueryCount.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPInfoQueryCount.setDescription('This object indicates the number of query packets received since the IGMP function enabled, in per-VLAN basis.') swIGMPInfoTxQueryCount = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 2, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swIGMPInfoTxQueryCount.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPInfoTxQueryCount.setDescription('This object indicates the send count of IGMP query messages, in per-VLAN basis. In case of IGMP timer expiration, the switch sends IGMP query packets to related VLAN member ports and increment this object by 1.') swIGMPTable = MibTable((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 3), ) if mibBuilder.loadTexts: swIGMPTable.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPTable.setDescription('The table containing current IGMP information which captured by this device, provided that swDevIGMPCaptureState and swIGMPCtrlState of associated VLAN entry are all enabled. Note that the priority of IGMP table entries is lower than Filtering Table, i.e. if there is a table hash collision between the entries of IGMP Table and Filtering Table inside the switch H/W address table, then Filtering Table entry overwrite the colliding entry of IGMP Table. See swFdbFilterTable description also.') swIGMPEntry = MibTableRow((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 3, 1), ).setIndexNames((0, "TRUNK-MIB", "swIGMPVid"), (0, "TRUNK-MIB", "swIGMPGroupIpAddr")) if mibBuilder.loadTexts: swIGMPEntry.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPEntry.setDescription('Information about current IGMP information which captured by this device , provided that swDevIGMPCaptureState and swIGMPCtrlState of associated VLAN entry are all enabled.') swIGMPVid = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 3, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swIGMPVid.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPVid.setDescription('This object indicates the Vid of individual IGMP table entry. It shows the Vid of IGMP report information captured on network.') swIGMPGroupIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 3, 1, 2), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: swIGMPGroupIpAddr.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPGroupIpAddr.setDescription('This object is identify group ip address which is captured from IGMP packet, in per-Vlan basis.') swIGMPMacAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 3, 1, 3), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: swIGMPMacAddr.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPMacAddr.setDescription('This object is identify mac address which is corresponding to swIGMPGroupIpAddr, in per-Vlan basis..') swIGMPPortMap = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 3, 1, 4), PortList()).setMaxAccess("readonly") if mibBuilder.loadTexts: swIGMPPortMap.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPPortMap.setDescription("This object indicates which ports are belong to the same multicast group, in per-Vlan basis. Each multicast group has a octect string to indicate with port map. The most significant bit represents the lowest numbered port, and the least significant bit represents the highest numbered port. In module 1 (base module), there are 22 100M twisted-pair ports (port 1..22) which is mapped to the PortMap's port 1 to 22 respectively. In module 2 (slot 1 module), there are 2 100M FX/100 TX (or a single port 100M FX) ports which is mapped to the PortMap's port 23,24 respectively (if the module is a single port 100M FX, it is just mapped to port 23 and port 24 is ignored). Module 3 (slot 2 module) is a single-port Gigabit Ethernet and it is mapped to the PortMap's port 25.") swIGMPIpGroupReportCount = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 3, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swIGMPIpGroupReportCount.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPIpGroupReportCount.setDescription('This object indicate how much report packet was receive by our device corresponding with this entry from IGMP function enabled, in per-Vlan basis. .') mibBuilder.exportSymbols("TRUNK-MIB", swPortTrunkIndex=swPortTrunkIndex, swSnoopCtrlEntry=swSnoopCtrlEntry, swIGMPPortMap=swIGMPPortMap, swIGMPVid=swIGMPVid, swPortTrunkMemberNum=swPortTrunkMemberNum, swIGMPInfoEntry=swIGMPInfoEntry, dlink=dlink, swSnoopCtrlTable=swSnoopCtrlTable, swIGMPCtrlIndex=swIGMPCtrlIndex, swIGMPCtrlState=swIGMPCtrlState, swIGMPEntry=swIGMPEntry, swIGMPTable=swIGMPTable, swPortTrunkName=swPortTrunkName, endOfMIB=endOfMIB, swSnoopIndex=swSnoopIndex, swSnoopLogicSourcePort=swSnoopLogicSourcePort, marconi=marconi, swPortTrunkTable=swPortTrunkTable, swIGMPCtrlVid=swIGMPCtrlVid, swIGMPInfoTable=swIGMPInfoTable, golfcommon=golfcommon, swIGMPPackage=swIGMPPackage, golfproducts=golfproducts, swIGMPInfoVid=swIGMPInfoVid, swIGMPGroupIpAddr=swIGMPGroupIpAddr, swIGMPInfoQueryCount=swIGMPInfoQueryCount, dlinkcommon=dlinkcommon, external=external, swPortTrunkMasterPort=swPortTrunkMasterPort, swIGMPCtrlTable=swIGMPCtrlTable, swSnoopLogicTargetPort=swSnoopLogicTargetPort, swIGMPInfoTxQueryCount=swIGMPInfoTxQueryCount, swPortTrunkEntry=swPortTrunkEntry, swIGMPCtrlTimer=swIGMPCtrlTimer, swPortTrunkModule=swPortTrunkModule, swSnoopState=swSnoopState, es1000Series=es1000Series, PortList=PortList, swIGMPIpGroupReportCount=swIGMPIpGroupReportCount, systems=systems, swPortTrunkState=swPortTrunkState, swSnoopPackage=swSnoopPackage, swPortTrunkPackage=swPortTrunkPackage, swIGMPCtrlEntry=swIGMPCtrlEntry, swIGMPMacAddr=swIGMPMacAddr, marconi_mgmt=marconi_mgmt, golf=golf, swIGMPInfoIndex=swIGMPInfoIndex)
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, value_range_constraint, constraints_intersection, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ConstraintsUnion', 'ValueRangeConstraint', 'ConstraintsIntersection', 'ValueSizeConstraint') (mac_address,) = mibBuilder.importSymbols('BRIDGE-MIB', 'MacAddress') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (mib_identifier, counter32, enterprises, bits, time_ticks, unsigned32, module_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, object_identity, counter64, iso, gauge32, notification_type, ip_address, integer32) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibIdentifier', 'Counter32', 'enterprises', 'Bits', 'TimeTicks', 'Unsigned32', 'ModuleIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ObjectIdentity', 'Counter64', 'iso', 'Gauge32', 'NotificationType', 'IpAddress', 'Integer32') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') class Portlist(OctetString): subtype_spec = OctetString.subtypeSpec + value_size_constraint(4, 4) fixed_length = 4 marconi = mib_identifier((1, 3, 6, 1, 4, 1, 326)) systems = mib_identifier((1, 3, 6, 1, 4, 1, 326, 2)) external = mib_identifier((1, 3, 6, 1, 4, 1, 326, 2, 20)) dlink = mib_identifier((1, 3, 6, 1, 4, 1, 326, 2, 20, 1)) dlinkcommon = mib_identifier((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 1)) golf = mib_identifier((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2)) golfproducts = mib_identifier((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 1)) golfcommon = mib_identifier((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2)) marconi_mgmt = mib_identifier((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2)).setLabel('marconi-mgmt') es1000_series = mib_identifier((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24)) sw_port_trunk_package = mib_identifier((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 6)) sw_snoop_package = mib_identifier((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 7)) sw_igmp_package = mib_identifier((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8)) end_of_mib = mib_scalar((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 9999), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: endOfMIB.setStatus('optional') sw_port_trunk_table = mib_table((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 6, 1)) if mibBuilder.loadTexts: swPortTrunkTable.setStatus('mandatory') if mibBuilder.loadTexts: swPortTrunkTable.setDescription('This table specifys which ports group a set of ports(up to 8) into a single logical link.') sw_port_trunk_entry = mib_table_row((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 6, 1, 1)).setIndexNames((0, 'TRUNK-MIB', 'swPortTrunkIndex')) if mibBuilder.loadTexts: swPortTrunkEntry.setStatus('mandatory') if mibBuilder.loadTexts: swPortTrunkEntry.setDescription('A list of information specifies which ports group a set of ports(up to 8) into a single logical link.') sw_port_trunk_index = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 6, 1, 1, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: swPortTrunkIndex.setStatus('mandatory') if mibBuilder.loadTexts: swPortTrunkIndex.setDescription('The index of logical port trunk.The device max support 3 trunk groups. The trunk group number depend on the existence of module.') sw_port_trunk_name = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 6, 1, 1, 2), display_string().subtype(subtypeSpec=value_size_constraint(8, 8)).setFixedLength(8)).setMaxAccess('readwrite') if mibBuilder.loadTexts: swPortTrunkName.setStatus('mandatory') if mibBuilder.loadTexts: swPortTrunkName.setDescription('The name of logical port trunk.') sw_port_trunk_module = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 6, 1, 1, 3), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: swPortTrunkModule.setStatus('mandatory') if mibBuilder.loadTexts: swPortTrunkModule.setDescription('Indicate which modules include in this Trunk. The value is up to 2.') sw_port_trunk_master_port = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 6, 1, 1, 4), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: swPortTrunkMasterPort.setStatus('mandatory') if mibBuilder.loadTexts: swPortTrunkMasterPort.setDescription('The object indicates the master port number of the port trunk entry.The first port of the trunk is implicitly configured to be the master logical port.When using Port Trunk, you can not configure the other ports of the group except the master port. Their configuration must be same as the master port (e.g. speed, duplex, enabled/disabled, flow control, and so on).') sw_port_trunk_member_num = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 6, 1, 1, 5), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: swPortTrunkMemberNum.setStatus('mandatory') if mibBuilder.loadTexts: swPortTrunkMemberNum.setDescription('Indicate how many number of ports is included in this Trunk. If the trunk is located at expansion module (i.e. es400LinkAggrIndex equals to 3) and the module is 100-TX or FX-MTRJ, the maximum number of ports in the trunk is 2. The maximum number of ports is 8 for other trunks.') sw_port_trunk_state = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 6, 1, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('other', 1), ('disabled', 2), ('enabled', 3)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: swPortTrunkState.setStatus('mandatory') if mibBuilder.loadTexts: swPortTrunkState.setDescription('This object decide the port trunk enabled or disabled.') sw_snoop_ctrl_table = mib_table((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 7, 1)) if mibBuilder.loadTexts: swSnoopCtrlTable.setStatus('mandatory') if mibBuilder.loadTexts: swSnoopCtrlTable.setDescription("A list of port snooping entries.Port snooping function provide an easy way to monitor traffic on any port. In this way any good packets appears on the source mirror port also shows up on the target mirror port and doesn't to reconstruct the LAN.") sw_snoop_ctrl_entry = mib_table_row((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 7, 1, 1)).setIndexNames((0, 'TRUNK-MIB', 'swSnoopIndex')) if mibBuilder.loadTexts: swSnoopCtrlEntry.setStatus('mandatory') if mibBuilder.loadTexts: swSnoopCtrlEntry.setDescription('A list of information provide an easy way to monitor traffic on any port. The use can bring a fancy network monitor attaching to any target mirror port and set the port to be monitored as source mirror port. ') sw_snoop_index = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 7, 1, 1, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: swSnoopIndex.setStatus('mandatory') if mibBuilder.loadTexts: swSnoopIndex.setDescription('This object indicates the port snooping entry number.There is just only one now.') sw_snoop_logic_source_port = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 7, 1, 1, 2), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: swSnoopLogicSourcePort.setStatus('mandatory') if mibBuilder.loadTexts: swSnoopLogicSourcePort.setDescription("This object indicates the number of port to be sniffed. The port number is the sequential (logical) number which is also applied to bridge MIB, etc. For instance, logical port 1~22 is mapped to module 1's 10/100Base-T TP ports, port 23~24 is mapped to module 2's 100FX/TX ports, port 25 indicates for module 3's Gigabit port, and so on.") sw_snoop_logic_target_port = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 7, 1, 1, 3), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: swSnoopLogicTargetPort.setStatus('mandatory') if mibBuilder.loadTexts: swSnoopLogicTargetPort.setDescription("This object indicates switch which port will sniff another port. A trunk port member cannot be configured as a target Snooping port. The port number is the sequential (logical) number which is also applied to bridge MIB, etc. For instance, logical port 1~22 is mapped to module 1's 10/100Base-T TP ports, port 23~24 is mapped to module 2's 100FX/TX ports, port 25 indicates for module 3's Gigabit port, and so on.") sw_snoop_state = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 7, 1, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('other', 1), ('disable', 2), ('enable', 3)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: swSnoopState.setStatus('mandatory') if mibBuilder.loadTexts: swSnoopState.setDescription('This object indicates the status of this entry. other(1) - this entry is currently in use but the conditions under which it will remain so are different from each of the following values. disable(2) - Snoop funtion disable. enable(3) - Snoop funtion enable and Snoop received or transmit packet by snoop source port.') sw_igmp_ctrl_table = mib_table((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 1)) if mibBuilder.loadTexts: swIGMPCtrlTable.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPCtrlTable.setDescription("The table controls the Vlan's IGMP function. Its scale depends on current VLAN state (swVlanInfoStatus). If VLAN is disabled or in Mac-Base mode, there is only one entry in the table, with index 1. If VLAN is in Port-Base or 802.1q mode, the number of entries can be up to 12, with index range from 1 to 12.") sw_igmp_ctrl_entry = mib_table_row((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 1, 1)).setIndexNames((0, 'TRUNK-MIB', 'swIGMPCtrlIndex')) if mibBuilder.loadTexts: swIGMPCtrlEntry.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPCtrlEntry.setDescription('The entry in IGMP control table (swIGMPCtrlTable). The entry is effective only when IGMP capture switch (swDevIGMPCaptureState) is enabled.') sw_igmp_ctrl_index = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 12))).setMaxAccess('readonly') if mibBuilder.loadTexts: swIGMPCtrlIndex.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPCtrlIndex.setDescription('This object indicates the IGMP control entry number.Its scale depends on current VLAN state (es400VlanInfoStatus). If VLAN is disabled or in Mac-Base mode, there is only one entry in the table, with index 1. If VLAN is in Port-Base or 802.1q mode, the number of entries is 12, with index range from 1 to 12.') sw_igmp_ctrl_vid = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 1, 1, 2), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: swIGMPCtrlVid.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPCtrlVid.setDescription("This object indicates the IGMP control entry's VLAN id. If VLAN is disabled or in Mac-Base mode, the Vid is always 0 and cannot be changed by management users. If VLAN is in Port-Base mode, the Vid is arranged from 1 to 12 , fixed form. If VLAN is in 802.1q mode, the Vid setting can vary from 1 to 4094 by management user, and the Vid in each entry must be unique in the IGMP Control Table.") sw_igmp_ctrl_timer = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 1, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(30, 9999)).clone(300)).setMaxAccess('readwrite') if mibBuilder.loadTexts: swIGMPCtrlTimer.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPCtrlTimer.setDescription('The timer value for sending IGMP query packet when none was sent by the multicast router in the LAN. The timer works in per-VLAN basis. Our device will be activated to send the query message if the timer is expired. Please reference RFC2236-1997. And it recommends a default of 125 seconds. The timeout value must be at least 30 seconds.') sw_igmp_ctrl_state = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 1, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('other', 1), ('disable', 2), ('enable', 3)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: swIGMPCtrlState.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPCtrlState.setDescription('This object indicates the status of this entry. other(1) - this entry is currently in use but the conditions under which it will remain so are different from each of the following values. disable(2) - IGMP funtion is disabled for this entry. enable(3) - IGMP funtion is enabled for this entry.') sw_igmp_info_table = mib_table((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 2)) if mibBuilder.loadTexts: swIGMPInfoTable.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPInfoTable.setDescription('The table contains the number current IGMP query packets which is captured by this device, as well as the IGMP query packets sent by the device.') sw_igmp_info_entry = mib_table_row((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 2, 1)).setIndexNames((0, 'TRUNK-MIB', 'swIGMPInfoIndex')) if mibBuilder.loadTexts: swIGMPInfoEntry.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPInfoEntry.setDescription('Information about current IGMP query information, provided that swDevIGMPCaptureState and swIGMPCtrlState of associated VLAN entry are all enabled.') sw_igmp_info_index = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 12))).setMaxAccess('readonly') if mibBuilder.loadTexts: swIGMPInfoIndex.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPInfoIndex.setDescription('This object indicates the IGMP query information entry number. It could be up to 12 entries, depending on current number of VLAN entries.') sw_igmp_info_vid = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 2, 1, 2), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: swIGMPInfoVid.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPInfoVid.setDescription('This object indicates the Vid of associated IGMP info table entry. It follows swIGMPCtrlVid in the associated entry of IGMP control table (swIGMPCtrlTable).') sw_igmp_info_query_count = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 2, 1, 3), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: swIGMPInfoQueryCount.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPInfoQueryCount.setDescription('This object indicates the number of query packets received since the IGMP function enabled, in per-VLAN basis.') sw_igmp_info_tx_query_count = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 2, 1, 4), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: swIGMPInfoTxQueryCount.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPInfoTxQueryCount.setDescription('This object indicates the send count of IGMP query messages, in per-VLAN basis. In case of IGMP timer expiration, the switch sends IGMP query packets to related VLAN member ports and increment this object by 1.') sw_igmp_table = mib_table((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 3)) if mibBuilder.loadTexts: swIGMPTable.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPTable.setDescription('The table containing current IGMP information which captured by this device, provided that swDevIGMPCaptureState and swIGMPCtrlState of associated VLAN entry are all enabled. Note that the priority of IGMP table entries is lower than Filtering Table, i.e. if there is a table hash collision between the entries of IGMP Table and Filtering Table inside the switch H/W address table, then Filtering Table entry overwrite the colliding entry of IGMP Table. See swFdbFilterTable description also.') sw_igmp_entry = mib_table_row((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 3, 1)).setIndexNames((0, 'TRUNK-MIB', 'swIGMPVid'), (0, 'TRUNK-MIB', 'swIGMPGroupIpAddr')) if mibBuilder.loadTexts: swIGMPEntry.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPEntry.setDescription('Information about current IGMP information which captured by this device , provided that swDevIGMPCaptureState and swIGMPCtrlState of associated VLAN entry are all enabled.') sw_igmp_vid = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 3, 1, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: swIGMPVid.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPVid.setDescription('This object indicates the Vid of individual IGMP table entry. It shows the Vid of IGMP report information captured on network.') sw_igmp_group_ip_addr = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 3, 1, 2), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: swIGMPGroupIpAddr.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPGroupIpAddr.setDescription('This object is identify group ip address which is captured from IGMP packet, in per-Vlan basis.') sw_igmp_mac_addr = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 3, 1, 3), mac_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: swIGMPMacAddr.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPMacAddr.setDescription('This object is identify mac address which is corresponding to swIGMPGroupIpAddr, in per-Vlan basis..') sw_igmp_port_map = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 3, 1, 4), port_list()).setMaxAccess('readonly') if mibBuilder.loadTexts: swIGMPPortMap.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPPortMap.setDescription("This object indicates which ports are belong to the same multicast group, in per-Vlan basis. Each multicast group has a octect string to indicate with port map. The most significant bit represents the lowest numbered port, and the least significant bit represents the highest numbered port. In module 1 (base module), there are 22 100M twisted-pair ports (port 1..22) which is mapped to the PortMap's port 1 to 22 respectively. In module 2 (slot 1 module), there are 2 100M FX/100 TX (or a single port 100M FX) ports which is mapped to the PortMap's port 23,24 respectively (if the module is a single port 100M FX, it is just mapped to port 23 and port 24 is ignored). Module 3 (slot 2 module) is a single-port Gigabit Ethernet and it is mapped to the PortMap's port 25.") sw_igmp_ip_group_report_count = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 20, 1, 2, 2, 2, 24, 8, 3, 1, 5), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: swIGMPIpGroupReportCount.setStatus('mandatory') if mibBuilder.loadTexts: swIGMPIpGroupReportCount.setDescription('This object indicate how much report packet was receive by our device corresponding with this entry from IGMP function enabled, in per-Vlan basis. .') mibBuilder.exportSymbols('TRUNK-MIB', swPortTrunkIndex=swPortTrunkIndex, swSnoopCtrlEntry=swSnoopCtrlEntry, swIGMPPortMap=swIGMPPortMap, swIGMPVid=swIGMPVid, swPortTrunkMemberNum=swPortTrunkMemberNum, swIGMPInfoEntry=swIGMPInfoEntry, dlink=dlink, swSnoopCtrlTable=swSnoopCtrlTable, swIGMPCtrlIndex=swIGMPCtrlIndex, swIGMPCtrlState=swIGMPCtrlState, swIGMPEntry=swIGMPEntry, swIGMPTable=swIGMPTable, swPortTrunkName=swPortTrunkName, endOfMIB=endOfMIB, swSnoopIndex=swSnoopIndex, swSnoopLogicSourcePort=swSnoopLogicSourcePort, marconi=marconi, swPortTrunkTable=swPortTrunkTable, swIGMPCtrlVid=swIGMPCtrlVid, swIGMPInfoTable=swIGMPInfoTable, golfcommon=golfcommon, swIGMPPackage=swIGMPPackage, golfproducts=golfproducts, swIGMPInfoVid=swIGMPInfoVid, swIGMPGroupIpAddr=swIGMPGroupIpAddr, swIGMPInfoQueryCount=swIGMPInfoQueryCount, dlinkcommon=dlinkcommon, external=external, swPortTrunkMasterPort=swPortTrunkMasterPort, swIGMPCtrlTable=swIGMPCtrlTable, swSnoopLogicTargetPort=swSnoopLogicTargetPort, swIGMPInfoTxQueryCount=swIGMPInfoTxQueryCount, swPortTrunkEntry=swPortTrunkEntry, swIGMPCtrlTimer=swIGMPCtrlTimer, swPortTrunkModule=swPortTrunkModule, swSnoopState=swSnoopState, es1000Series=es1000Series, PortList=PortList, swIGMPIpGroupReportCount=swIGMPIpGroupReportCount, systems=systems, swPortTrunkState=swPortTrunkState, swSnoopPackage=swSnoopPackage, swPortTrunkPackage=swPortTrunkPackage, swIGMPCtrlEntry=swIGMPCtrlEntry, swIGMPMacAddr=swIGMPMacAddr, marconi_mgmt=marconi_mgmt, golf=golf, swIGMPInfoIndex=swIGMPInfoIndex)
problem_string = '73167176531330624919225119674426574742355349194934'\ '96983520312774506326239578318016984801869478851843'\ '85861560789112949495459501737958331952853208805511'\ '12540698747158523863050715693290963295227443043557'\ '66896648950445244523161731856403098711121722383113'\ '62229893423380308135336276614282806444486645238749'\ '30358907296290491560440772390713810515859307960866'\ '70172427121883998797908792274921901699720888093776'\ '65727333001053367881220235421809751254540594752243'\ '52584907711670556013604839586446706324415722155397'\ '53697817977846174064955149290862569321978468622482'\ '83972241375657056057490261407972968652414535100474'\ '82166370484403199890008895243450658541227588666881'\ '16427171479924442928230863465674813919123162824586'\ '17866458359124566529476545682848912883142607690042'\ '24219022671055626321111109370544217506941658960408'\ '07198403850962455444362981230987879927244284909188'\ '84580156166097919133875499200524063689912560717606'\ '05886116467109405077541002256983155200055935729725'\ '71636269561882670428252483600823257530420752963450' def solve(string: str=problem_string, amount: int=13) -> int: highest = 0 for i in range(len(string) + 1 - amount): product = 1 for digit in string[i: i + amount]: product *= int(digit) if product >= highest: highest = product return highest
problem_string = '7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450' def solve(string: str=problem_string, amount: int=13) -> int: highest = 0 for i in range(len(string) + 1 - amount): product = 1 for digit in string[i:i + amount]: product *= int(digit) if product >= highest: highest = product return highest
def genesis_block_generation(): print("\nGenesis Block is generated. The Blockchain system is up...!") print("Miners will now collect transactions from memPool and start building blocks...\n\n") def block_info(block, consensus_algorithm): print("The following block has been proposed by " + block['generator_id'] + " and is generated into the Blockchain network") print("**************************") print("transactions:") print(block['transactions']) print("hash:") print(block['hash']) print("timestamp:") print(block['timestamp']) if consensus_algorithm == 1: print("nonce:") print(block['nonce']) print("previous_hash:") print(block['previous_hash']) print("**************************") def block_success_addition(self_address, generator_id): print("*******************************************") print("the block is now added to the local chain of " + self_address) if generator_id != self_address: print("this block was received from " + generator_id) print("##############################\n") def simulation_progress(current_chain_length, expected_chain_length): print("The simulation have passed " + str(100*((current_chain_length+1)/expected_chain_length)) + "% of TXs to miners") print("Miners will mint new valid blocks and generate them to The BC network") def fork_analysis(number_of_forks): if number_of_forks == 1: print("\n##############################\nThere were no forks during this run\n#############################\n") else: print("\n##############################\nAs the simulation is finished, " + str(number_of_forks) + " different versions of chains were found\n#############################\n") def mempool_info(mempool): print('mempool contains the following TXs:') txs = [] for i in range(mempool.qsize()): txs.append(mempool.get()) for tx in txs: print(tx) mempool.put(tx) def authorization_trigger(blockchain_placement, no_fogs, no_miners): print("please input the address of authorized:") if blockchain_placement == 1: print("Fog Nodes") else: print("End-users") print("to generate new blocks in the exact following format:") print(">>>> 1 OR 3 OR 50 ... (up to: ") if blockchain_placement == 1: print(str(no_fogs) + " fog nodes available") else: print(str(no_miners) + " miners available in the EU layer") print("Once done, kindly input: done") def choose_functionality(): print("Please choose the function of the Blockchain network:\n" "(1) Data Management\n" "(2) Computational services\n" "(3) Payment\n" "(4) Identity Management\n") def choose_placement(): print("Please choose the placement of the Blockchain network:\n" "(1) Fog Layer\n" "(2) End-User layer\n") def choose_consensus(): print("Please choose the Consensus algorithm to be used in the simulation:\n" "(1) Proof of Work: PoW\n" "(2) Proof of Stake: PoS\n" "(3) Proof of Authority: PoA\n") def txs_success(txs_per_user, parent_add, self_add): print(str(txs_per_user) + " data records had been generated by End-User no. " + str(parent_add) + "." + str(self_add)) def GDPR_warning(): print("###########################################" "\nWARNING: Each end-user's address and the address of the fog component it is connected with,\n " "will be immutably saved on the chain. This is not a GDPR-compliant practice.\n" "if you need to have your application GDPR-compliant, you need to change the configuration,\n" " so that other types of identities be saved on the immutable chain, and re-run the simulation." "\n###########################################\n") def miners_are_up(): print("*****************\nMiner nodes are up, connected to their neighbors, and waiting for the genesis block...!\n") def illegal_tx(tx, wallet_content): print("the following transaction is illegal:") print(tx) print("the end_user_wallet contains only " + str(wallet_content) + " digital coins..!") print("the transaction is withdrawn from the block") def illegal_block(): print("The proposed block is not valid." "\nTransactions will be sent back to the mempool and mined again..!") def unauthorized_miner_msg(miner_address): print("Miner: " + miner_address + " is not authorized to generate a new block..!") def block_discarded(): print("The received block was ignored because it is already in the local chain") def users_and_fogs_are_up(): print("*****************\nEnd_users are up\nFog nodes are up\nEnd-Users are connected to their Fog nodes...\n") def user_identity_addition_reminder(Num_endusers): print("The network has " + str(Num_endusers) + " end_users.\n For each of them, you need to input the value of newly added identity " "attributes(if any)\n") def local_chain_is_updated(miner_address, length_of_local_chain): print("Using the Gossip protocol of FoBSim, the local chain of the following miner was updated:") print("Miner: " + str(miner_address)) print("The length of the new local chain: " + str(length_of_local_chain)) def mempool_is_empty(): print("mempool is empty") def finish(): print("simulation is done.") print("To check/analyze the experiment, please refer to the temporary folder.") print("There, you can find:") print("- miners' local chains") print("- miners' local records of users' wallets") print("- log of blocks confirmed by the majority of miners") print("- log of final amounts in miners' wallets (initial values - staked values + awards)") print("- log of values which were staked by miners") print("thank YOU..!")
def genesis_block_generation(): print('\nGenesis Block is generated. The Blockchain system is up...!') print('Miners will now collect transactions from memPool and start building blocks...\n\n') def block_info(block, consensus_algorithm): print('The following block has been proposed by ' + block['generator_id'] + ' and is generated into the Blockchain network') print('**************************') print('transactions:') print(block['transactions']) print('hash:') print(block['hash']) print('timestamp:') print(block['timestamp']) if consensus_algorithm == 1: print('nonce:') print(block['nonce']) print('previous_hash:') print(block['previous_hash']) print('**************************') def block_success_addition(self_address, generator_id): print('*******************************************') print('the block is now added to the local chain of ' + self_address) if generator_id != self_address: print('this block was received from ' + generator_id) print('##############################\n') def simulation_progress(current_chain_length, expected_chain_length): print('The simulation have passed ' + str(100 * ((current_chain_length + 1) / expected_chain_length)) + '% of TXs to miners') print('Miners will mint new valid blocks and generate them to The BC network') def fork_analysis(number_of_forks): if number_of_forks == 1: print('\n##############################\nThere were no forks during this run\n#############################\n') else: print('\n##############################\nAs the simulation is finished, ' + str(number_of_forks) + ' different versions of chains were found\n#############################\n') def mempool_info(mempool): print('mempool contains the following TXs:') txs = [] for i in range(mempool.qsize()): txs.append(mempool.get()) for tx in txs: print(tx) mempool.put(tx) def authorization_trigger(blockchain_placement, no_fogs, no_miners): print('please input the address of authorized:') if blockchain_placement == 1: print('Fog Nodes') else: print('End-users') print('to generate new blocks in the exact following format:') print('>>>> 1 OR 3 OR 50 ... (up to: ') if blockchain_placement == 1: print(str(no_fogs) + ' fog nodes available') else: print(str(no_miners) + ' miners available in the EU layer') print('Once done, kindly input: done') def choose_functionality(): print('Please choose the function of the Blockchain network:\n(1) Data Management\n(2) Computational services\n(3) Payment\n(4) Identity Management\n') def choose_placement(): print('Please choose the placement of the Blockchain network:\n(1) Fog Layer\n(2) End-User layer\n') def choose_consensus(): print('Please choose the Consensus algorithm to be used in the simulation:\n(1) Proof of Work: PoW\n(2) Proof of Stake: PoS\n(3) Proof of Authority: PoA\n') def txs_success(txs_per_user, parent_add, self_add): print(str(txs_per_user) + ' data records had been generated by End-User no. ' + str(parent_add) + '.' + str(self_add)) def gdpr_warning(): print("###########################################\nWARNING: Each end-user's address and the address of the fog component it is connected with,\n will be immutably saved on the chain. This is not a GDPR-compliant practice.\nif you need to have your application GDPR-compliant, you need to change the configuration,\n so that other types of identities be saved on the immutable chain, and re-run the simulation.\n###########################################\n") def miners_are_up(): print('*****************\nMiner nodes are up, connected to their neighbors, and waiting for the genesis block...!\n') def illegal_tx(tx, wallet_content): print('the following transaction is illegal:') print(tx) print('the end_user_wallet contains only ' + str(wallet_content) + ' digital coins..!') print('the transaction is withdrawn from the block') def illegal_block(): print('The proposed block is not valid.\nTransactions will be sent back to the mempool and mined again..!') def unauthorized_miner_msg(miner_address): print('Miner: ' + miner_address + ' is not authorized to generate a new block..!') def block_discarded(): print('The received block was ignored because it is already in the local chain') def users_and_fogs_are_up(): print('*****************\nEnd_users are up\nFog nodes are up\nEnd-Users are connected to their Fog nodes...\n') def user_identity_addition_reminder(Num_endusers): print('The network has ' + str(Num_endusers) + ' end_users.\n For each of them, you need to input the value of newly added identity attributes(if any)\n') def local_chain_is_updated(miner_address, length_of_local_chain): print('Using the Gossip protocol of FoBSim, the local chain of the following miner was updated:') print('Miner: ' + str(miner_address)) print('The length of the new local chain: ' + str(length_of_local_chain)) def mempool_is_empty(): print('mempool is empty') def finish(): print('simulation is done.') print('To check/analyze the experiment, please refer to the temporary folder.') print('There, you can find:') print("- miners' local chains") print("- miners' local records of users' wallets") print('- log of blocks confirmed by the majority of miners') print("- log of final amounts in miners' wallets (initial values - staked values + awards)") print('- log of values which were staked by miners') print('thank YOU..!')
# encoding: utf-8 # Versioning convention # https://www.python.org/dev/peps/pep-0440/ __version__ = "0.4.0"
__version__ = '0.4.0'
def get_price(auction_id): return 0 def make_bid(bid, auction_id): auction_price = get_price(auction_id) if bid <= auction_price: return False auction_price = bid return True
def get_price(auction_id): return 0 def make_bid(bid, auction_id): auction_price = get_price(auction_id) if bid <= auction_price: return False auction_price = bid return True
add_location_schema = { "type": "object", "properties": { "state": {"type": "string"}, "capital": {"type": "string"} }, "required": ["state", "capital"] } update_capital_schema = { "type": "object", "properties": { "capital": {"type": "string"} }, "required": ["capital"] }
add_location_schema = {'type': 'object', 'properties': {'state': {'type': 'string'}, 'capital': {'type': 'string'}}, 'required': ['state', 'capital']} update_capital_schema = {'type': 'object', 'properties': {'capital': {'type': 'string'}}, 'required': ['capital']}
class Parentheses(object): def find_pair(self, num_pairs): if num_pairs is None: raise TypeError('num_pairs cannot be None') if num_pairs < 0: raise ValueError('num_pairs cannot be < 0') if not num_pairs: return [] results = [] curr_results = [] self._find_pair(num_pairs, num_pairs, curr_results, results) return results def _find_pair(self, nleft, nright, curr_results, results): if nleft == 0 and nright == 0: results.append(''.join(curr_results)) else: if nleft >= 0: self._find_pair(nleft-1, nright, curr_results+['('], results) if nright > nleft: self._find_pair(nleft, nright-1, curr_results+[')'], results)
class Parentheses(object): def find_pair(self, num_pairs): if num_pairs is None: raise type_error('num_pairs cannot be None') if num_pairs < 0: raise value_error('num_pairs cannot be < 0') if not num_pairs: return [] results = [] curr_results = [] self._find_pair(num_pairs, num_pairs, curr_results, results) return results def _find_pair(self, nleft, nright, curr_results, results): if nleft == 0 and nright == 0: results.append(''.join(curr_results)) else: if nleft >= 0: self._find_pair(nleft - 1, nright, curr_results + ['('], results) if nright > nleft: self._find_pair(nleft, nright - 1, curr_results + [')'], results)
''' * @Author: csy * @Date: 2019-04-28 13:48:03 * @Last Modified by: csy * @Last Modified time: 2019-04-28 13:48:03 ''' age = 12 if age < 4: print("Your admission cost is $0.") elif age < 18: print("Your admission cost is $5.") else: print("Your admission cost is $10.") age = 12 if age < 4: price = 0 elif age < 18: price = 5 else: price = 10 print("Your admission cost is $"+str(price))
""" * @Author: csy * @Date: 2019-04-28 13:48:03 * @Last Modified by: csy * @Last Modified time: 2019-04-28 13:48:03 """ age = 12 if age < 4: print('Your admission cost is $0.') elif age < 18: print('Your admission cost is $5.') else: print('Your admission cost is $10.') age = 12 if age < 4: price = 0 elif age < 18: price = 5 else: price = 10 print('Your admission cost is $' + str(price))
def test_task_names_endpoint(client): tasks_json = client.get(f'api/meta/tasks').json tasks = [task['task_name'] for task in tasks_json] assert {'classification', 'regression', 'ts_forecasting', 'clustering'} == set(tasks) def test_metric_names_classification_endpoint(client): classification_metrics_json = \ client.get('api/meta/metrics/classification').json classification_metrics_names = [metric['metric_name'] for metric in classification_metrics_json] assert 'ROCAUC' in classification_metrics_names assert 'RMSE' not in classification_metrics_names def test_metric_names_regression_endpoint(client): regression_metrics_json = \ client.get('api/meta/metrics/regression').json regression_metrics = [metric['metric_name'] for metric in regression_metrics_json] assert 'RMSE' in regression_metrics assert 'MAE' in regression_metrics assert 'ROCAUC' not in regression_metrics def test_model_names_classification_endpoint(client): classification_models_json = \ client.get('api/meta/models/classification').json classification_models_names = [model['model_name'] for model in classification_models_json] assert 'logit' in classification_models_names assert 'linear' not in classification_models_names def test_model_names_regression_endpoint(client): regression_models_json = \ client.get('api/meta/models/regression').json regression_models = [model['model_name'] for model in regression_models_json] assert 'linear' in regression_models assert 'logit' not in regression_models
def test_task_names_endpoint(client): tasks_json = client.get(f'api/meta/tasks').json tasks = [task['task_name'] for task in tasks_json] assert {'classification', 'regression', 'ts_forecasting', 'clustering'} == set(tasks) def test_metric_names_classification_endpoint(client): classification_metrics_json = client.get('api/meta/metrics/classification').json classification_metrics_names = [metric['metric_name'] for metric in classification_metrics_json] assert 'ROCAUC' in classification_metrics_names assert 'RMSE' not in classification_metrics_names def test_metric_names_regression_endpoint(client): regression_metrics_json = client.get('api/meta/metrics/regression').json regression_metrics = [metric['metric_name'] for metric in regression_metrics_json] assert 'RMSE' in regression_metrics assert 'MAE' in regression_metrics assert 'ROCAUC' not in regression_metrics def test_model_names_classification_endpoint(client): classification_models_json = client.get('api/meta/models/classification').json classification_models_names = [model['model_name'] for model in classification_models_json] assert 'logit' in classification_models_names assert 'linear' not in classification_models_names def test_model_names_regression_endpoint(client): regression_models_json = client.get('api/meta/models/regression').json regression_models = [model['model_name'] for model in regression_models_json] assert 'linear' in regression_models assert 'logit' not in regression_models
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def closestValue(self, root: TreeNode, target: float) -> int: result = root.val while root: if abs(root.val - target) < abs(result - target): result = root.val if abs(result - target) <= 0.5: break root = root.right if root.val < target else root.left return result
class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def closest_value(self, root: TreeNode, target: float) -> int: result = root.val while root: if abs(root.val - target) < abs(result - target): result = root.val if abs(result - target) <= 0.5: break root = root.right if root.val < target else root.left return result
cooling_type_limits = { 'PASSIVE_COOLING': {'low': 0, 'high':35 }, 'HI_ACTIVE_COOLING': {'low': 0, 'high':45 }, 'MED_ACTIVE_COOLING': {'low': 0, 'high':40 } } boundary_constants_text = {'TOO_LOW':'too low', 'TOO_HIGH':'too high', 'NORMAL': 'normal'} boundary_constants = {'low':'TOO_LOW', 'high': 'TOO_HIGH', 'normal' : 'NORMAL'} def infer_breach(value, lowerLimit, upperLimit): if value < lowerLimit: return boundary_constants['low'] if value > upperLimit: return boundary_constants['high'] return boundary_constants['normal'] def classify_temperature_breach(coolingType, temperatureInC): lowerLimit = cooling_type_limits[coolingType]['low'] upperLimit = cooling_type_limits[coolingType]['high'] return infer_breach(temperatureInC, lowerLimit, upperLimit) def send_to_controller(breachType): send_status_to_controller(breachType) def send_to_console(breachType): send_status_to_console(breachType) def send_to_email(breachType): send_status_email(breachType) def send_status_to_controller(breachType): header = 0xfeed print(f'{header}, {breachType}') return breachType def send_status_email(breachType): recepient = "a.b@c.com" print(f'To: {recepient}') print('Hi, the temperature is {}'.format(boundary_constants_text[breachType])) return breachType def send_status_to_console(breachType): print(breachType) return breachType receiver = { "TO_CONTROLLER": send_to_controller, "TO_EMAIL" : send_to_email, "TO_CONSOLE" : send_to_console } def check_and_alert(alertTarget, coolingType, temperatureInC): breachType =\ classify_temperature_breach(coolingType, temperatureInC) receiver[alertTarget](breachType) return breachType
cooling_type_limits = {'PASSIVE_COOLING': {'low': 0, 'high': 35}, 'HI_ACTIVE_COOLING': {'low': 0, 'high': 45}, 'MED_ACTIVE_COOLING': {'low': 0, 'high': 40}} boundary_constants_text = {'TOO_LOW': 'too low', 'TOO_HIGH': 'too high', 'NORMAL': 'normal'} boundary_constants = {'low': 'TOO_LOW', 'high': 'TOO_HIGH', 'normal': 'NORMAL'} def infer_breach(value, lowerLimit, upperLimit): if value < lowerLimit: return boundary_constants['low'] if value > upperLimit: return boundary_constants['high'] return boundary_constants['normal'] def classify_temperature_breach(coolingType, temperatureInC): lower_limit = cooling_type_limits[coolingType]['low'] upper_limit = cooling_type_limits[coolingType]['high'] return infer_breach(temperatureInC, lowerLimit, upperLimit) def send_to_controller(breachType): send_status_to_controller(breachType) def send_to_console(breachType): send_status_to_console(breachType) def send_to_email(breachType): send_status_email(breachType) def send_status_to_controller(breachType): header = 65261 print(f'{header}, {breachType}') return breachType def send_status_email(breachType): recepient = 'a.b@c.com' print(f'To: {recepient}') print('Hi, the temperature is {}'.format(boundary_constants_text[breachType])) return breachType def send_status_to_console(breachType): print(breachType) return breachType receiver = {'TO_CONTROLLER': send_to_controller, 'TO_EMAIL': send_to_email, 'TO_CONSOLE': send_to_console} def check_and_alert(alertTarget, coolingType, temperatureInC): breach_type = classify_temperature_breach(coolingType, temperatureInC) receiver[alertTarget](breachType) return breachType
class SilverbachConjecture: def solve(self, n): ls = [True] * 2001 for i in xrange(2, 2001): if ls[i]: for j in xrange(2 * i, 2001, i): ls[j] = False for i in xrange(2, n - 1): if not ls[i] and not ls[n - i]: return (i, n - i)
class Silverbachconjecture: def solve(self, n): ls = [True] * 2001 for i in xrange(2, 2001): if ls[i]: for j in xrange(2 * i, 2001, i): ls[j] = False for i in xrange(2, n - 1): if not ls[i] and (not ls[n - i]): return (i, n - i)
# Advent of Code - Davertical 2 - Part One def result(data): horizontal, vertical = 0, 0 for line in data: direction, i = line.split(' ') i = int(i) if direction == 'forward': horizontal += i if direction == 'up': vertical -= i if direction == 'down': vertical += i return horizontal*vertical
def result(data): (horizontal, vertical) = (0, 0) for line in data: (direction, i) = line.split(' ') i = int(i) if direction == 'forward': horizontal += i if direction == 'up': vertical -= i if direction == 'down': vertical += i return horizontal * vertical
# # @lc app=leetcode.cn id=277 lang=python3 # # [277] find-the-celebrity # None # @lc code=end
None
# # PySNMP MIB module E7-Notifications-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/E7-Notifications-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:58:58 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint, ValueRangeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsIntersection") e7Modules, e7 = mibBuilder.importSymbols("CALIX-PRODUCT-MIB", "e7Modules", "e7") E7AlarmType, E7ObjectClass, E7TcaType, E7SecurityType, E7EventType = mibBuilder.importSymbols("E7-TC", "E7AlarmType", "E7ObjectClass", "E7TcaType", "E7SecurityType", "E7EventType") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") IpAddress, Integer32, Counter64, ModuleIdentity, ObjectIdentity, Gauge32, iso, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, Counter32, MibIdentifier, NotificationType, Unsigned32 = mibBuilder.importSymbols("SNMPv2-SMI", "IpAddress", "Integer32", "Counter64", "ModuleIdentity", "ObjectIdentity", "Gauge32", "iso", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "Counter32", "MibIdentifier", "NotificationType", "Unsigned32") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") e7NotificationModule = ModuleIdentity((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 1, 3)) if mibBuilder.loadTexts: e7NotificationModule.setLastUpdated('200912100000Z') if mibBuilder.loadTexts: e7NotificationModule.setOrganization('Calix') if mibBuilder.loadTexts: e7NotificationModule.setContactInfo('Calix') if mibBuilder.loadTexts: e7NotificationModule.setDescription('Describes all the notifications related to Calix E7, E5-400, and E5-312 products.') e7Notification = MibIdentifier((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4)) e7NotificationObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1)) e7Notifications = MibIdentifier((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 2)) e7TrapSequenceNo = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 1), Integer32()) if mibBuilder.loadTexts: e7TrapSequenceNo.setStatus('current') if mibBuilder.loadTexts: e7TrapSequenceNo.setDescription('') e7TrapAlarmType = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 2), E7AlarmType()) if mibBuilder.loadTexts: e7TrapAlarmType.setStatus('current') if mibBuilder.loadTexts: e7TrapAlarmType.setDescription('Alarm type of the Alarm') e7TrapAlarmStatus = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("on", 1), ("off", 2)))) if mibBuilder.loadTexts: e7TrapAlarmStatus.setStatus('current') if mibBuilder.loadTexts: e7TrapAlarmStatus.setDescription('') e7TrapObjectClass = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 4), E7ObjectClass()) if mibBuilder.loadTexts: e7TrapObjectClass.setStatus('current') if mibBuilder.loadTexts: e7TrapObjectClass.setDescription('') e7TrapObjectInstance1 = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 5), Integer32()) if mibBuilder.loadTexts: e7TrapObjectInstance1.setStatus('current') if mibBuilder.loadTexts: e7TrapObjectInstance1.setDescription('Object instance for a notification, level 1') e7TrapObjectInstance2 = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 6), Integer32()) if mibBuilder.loadTexts: e7TrapObjectInstance2.setStatus('current') if mibBuilder.loadTexts: e7TrapObjectInstance2.setDescription('Object instance for a notification, level 2') e7TrapObjectInstance3 = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 7), Integer32()) if mibBuilder.loadTexts: e7TrapObjectInstance3.setStatus('current') if mibBuilder.loadTexts: e7TrapObjectInstance3.setDescription('Object instance for a notification, level 3') e7TrapObjectInstance4 = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 8), Integer32()) if mibBuilder.loadTexts: e7TrapObjectInstance4.setStatus('current') if mibBuilder.loadTexts: e7TrapObjectInstance4.setDescription('Object instance for a notification, level 4') e7TrapObjectInstance5 = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 9), Integer32()) if mibBuilder.loadTexts: e7TrapObjectInstance5.setStatus('current') if mibBuilder.loadTexts: e7TrapObjectInstance5.setDescription('Object instance for a notification, level 5') e7TrapObjectInstance6 = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 10), Integer32()) if mibBuilder.loadTexts: e7TrapObjectInstance6.setStatus('current') if mibBuilder.loadTexts: e7TrapObjectInstance6.setDescription('Object instance for a notification, level 6') e7TrapObjectInstance7 = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 11), Integer32()) if mibBuilder.loadTexts: e7TrapObjectInstance7.setStatus('current') if mibBuilder.loadTexts: e7TrapObjectInstance7.setDescription('Object instance for a notification, level 7') e7TrapObjectInstance8 = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 12), Integer32()) if mibBuilder.loadTexts: e7TrapObjectInstance8.setStatus('current') if mibBuilder.loadTexts: e7TrapObjectInstance8.setDescription('Object instance for a notification, level 8') e7TrapAlarmSeverityLevel = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("critical", 1), ("major", 2), ("minor", 3), ("warning", 4), ("unknown", 5), ("clear", 6)))) if mibBuilder.loadTexts: e7TrapAlarmSeverityLevel.setStatus('current') if mibBuilder.loadTexts: e7TrapAlarmSeverityLevel.setDescription('') e7TrapTimeStamp = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 14), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 50))) if mibBuilder.loadTexts: e7TrapTimeStamp.setStatus('current') if mibBuilder.loadTexts: e7TrapTimeStamp.setDescription('local time string') e7TrapServiceAffecting = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("yes", 1), ("no", 2)))) if mibBuilder.loadTexts: e7TrapServiceAffecting.setStatus('current') if mibBuilder.loadTexts: e7TrapServiceAffecting.setDescription('This value indicated wether this alarm is service affecting or not') e7TrapAlarmLocationInfo = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 16), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1))).clone(namedValues=NamedValues(("nearEnd", 1)))) if mibBuilder.loadTexts: e7TrapAlarmLocationInfo.setStatus('current') if mibBuilder.loadTexts: e7TrapAlarmLocationInfo.setDescription('Location info') e7TrapText = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 17), OctetString()) if mibBuilder.loadTexts: e7TrapText.setStatus('current') if mibBuilder.loadTexts: e7TrapText.setDescription('This object contains the brief description about the notification') e7TrapEventType = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 18), E7EventType()) if mibBuilder.loadTexts: e7TrapEventType.setStatus('current') if mibBuilder.loadTexts: e7TrapEventType.setDescription('Event type of the Event') e7TrapDbChangeType = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 19), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 3, 4))).clone(namedValues=NamedValues(("add", 2), ("modify", 3), ("delete", 4)))) if mibBuilder.loadTexts: e7TrapDbChangeType.setStatus('current') if mibBuilder.loadTexts: e7TrapDbChangeType.setDescription('Db change type') e7TrapSessionNumber = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 20), Integer32()) if mibBuilder.loadTexts: e7TrapSessionNumber.setStatus('current') if mibBuilder.loadTexts: e7TrapSessionNumber.setDescription('User session number') e7TrapUserName = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 21), OctetString()) if mibBuilder.loadTexts: e7TrapUserName.setStatus('current') if mibBuilder.loadTexts: e7TrapUserName.setDescription('User name') e7TrapIpAddr = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 22), IpAddress()) if mibBuilder.loadTexts: e7TrapIpAddr.setStatus('current') if mibBuilder.loadTexts: e7TrapIpAddr.setDescription('User name') e7TrapSecurityType = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 23), E7SecurityType()) if mibBuilder.loadTexts: e7TrapSecurityType.setStatus('current') if mibBuilder.loadTexts: e7TrapSecurityType.setDescription('Security event type') e7TrapMgmtIfType = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 24), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("debug", 1), ("system", 2), ("cli", 3), ("snmp", 4), ("netconf", 5)))) if mibBuilder.loadTexts: e7TrapMgmtIfType.setStatus('current') if mibBuilder.loadTexts: e7TrapMgmtIfType.setDescription('Management interface type') e7TrapTcaType = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 25), E7TcaType()) if mibBuilder.loadTexts: e7TrapTcaType.setStatus('current') if mibBuilder.loadTexts: e7TrapTcaType.setDescription('TCA element type') e7TrapTcaBinType = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 26), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("min15", 1), ("day1", 2), ("total", 3)))) if mibBuilder.loadTexts: e7TrapTcaBinType.setStatus('current') if mibBuilder.loadTexts: e7TrapTcaBinType.setDescription('TCA bin type -- only min15 and day1 used at this time') e7TrapTime = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 27), Integer32()) if mibBuilder.loadTexts: e7TrapTime.setStatus('current') if mibBuilder.loadTexts: e7TrapTime.setDescription('UTC time integer') e7TrapTcaValueType = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 28), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("count", 1), ("floor", 2), ("ceiling", 3)))) if mibBuilder.loadTexts: e7TrapTcaValueType.setStatus('current') if mibBuilder.loadTexts: e7TrapTcaValueType.setDescription('TCA value type -- exceeded count, below min (floor), or above max (ceiling)') e7TrapCliObject = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 29), OctetString()) if mibBuilder.loadTexts: e7TrapCliObject.setStatus('current') if mibBuilder.loadTexts: e7TrapCliObject.setDescription('The short CLI name for the object class and instance') e7TrapRepeatCount = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 30), Integer32()) if mibBuilder.loadTexts: e7TrapRepeatCount.setStatus('current') if mibBuilder.loadTexts: e7TrapRepeatCount.setDescription('The number of identical events of this type (1 for non-repeating events, > 1 for repeating events).') e7TrapSecObjectClass = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 31), E7ObjectClass()) if mibBuilder.loadTexts: e7TrapSecObjectClass.setStatus('current') if mibBuilder.loadTexts: e7TrapSecObjectClass.setDescription('Secondary object class') e7TrapSecObjectInstance1 = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 32), Integer32()) if mibBuilder.loadTexts: e7TrapSecObjectInstance1.setStatus('current') if mibBuilder.loadTexts: e7TrapSecObjectInstance1.setDescription('Secondary object instance for a notification, level 1') e7TrapSecObjectInstance2 = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 33), Integer32()) if mibBuilder.loadTexts: e7TrapSecObjectInstance2.setStatus('current') if mibBuilder.loadTexts: e7TrapSecObjectInstance2.setDescription('Secondary object instance for a notification, level 2') e7TrapSecObjectInstance3 = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 34), Integer32()) if mibBuilder.loadTexts: e7TrapSecObjectInstance3.setStatus('current') if mibBuilder.loadTexts: e7TrapSecObjectInstance3.setDescription('Secondary object instance for a notification, level 3') e7TrapSecObjectInstance4 = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 35), Integer32()) if mibBuilder.loadTexts: e7TrapSecObjectInstance4.setStatus('current') if mibBuilder.loadTexts: e7TrapSecObjectInstance4.setDescription('Secondary object instance for a notification, level 4') e7TrapSecObjectInstance5 = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 36), Integer32()) if mibBuilder.loadTexts: e7TrapSecObjectInstance5.setStatus('current') if mibBuilder.loadTexts: e7TrapSecObjectInstance5.setDescription('Secondary object instance for a notification, level 5') e7TrapSecObjectInstance6 = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 37), Integer32()) if mibBuilder.loadTexts: e7TrapSecObjectInstance6.setStatus('current') if mibBuilder.loadTexts: e7TrapSecObjectInstance6.setDescription('Secondary object instance for a notification, level 6') e7TrapSecObjectInstance7 = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 38), Integer32()) if mibBuilder.loadTexts: e7TrapSecObjectInstance7.setStatus('current') if mibBuilder.loadTexts: e7TrapSecObjectInstance7.setDescription('Secondary object instance for a notification, level 7') e7TrapSecObjectInstance8 = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 39), Integer32()) if mibBuilder.loadTexts: e7TrapSecObjectInstance8.setStatus('current') if mibBuilder.loadTexts: e7TrapSecObjectInstance8.setDescription('Secondary object instance for a notification, level 8') e7TrapObjectLabel1 = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 40), OctetString()) if mibBuilder.loadTexts: e7TrapObjectLabel1.setStatus('current') if mibBuilder.loadTexts: e7TrapObjectLabel1.setDescription("1st label for primary Object Instance, in 'pos,label' format") e7TrapObjectLabel2 = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 41), OctetString()) if mibBuilder.loadTexts: e7TrapObjectLabel2.setStatus('current') if mibBuilder.loadTexts: e7TrapObjectLabel2.setDescription("2nd label for primary Object Instance, in 'pos,label' format") e7TrapSecObjectLabel1 = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 42), OctetString()) if mibBuilder.loadTexts: e7TrapSecObjectLabel1.setStatus('current') if mibBuilder.loadTexts: e7TrapSecObjectLabel1.setDescription("1st label for secondary Object Instance, in 'pos,label' format") e7TrapSecObjectLabel2 = MibScalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 43), OctetString()) if mibBuilder.loadTexts: e7TrapSecObjectLabel2.setStatus('current') if mibBuilder.loadTexts: e7TrapSecObjectLabel2.setDescription("2nd label for secondary Object Instance, in 'pos,label' format") e7TrapAlarm = NotificationType((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 2, 1)).setObjects(("E7-Notifications-MIB", "e7TrapSequenceNo"), ("E7-Notifications-MIB", "e7TrapAlarmType"), ("E7-Notifications-MIB", "e7TrapAlarmStatus"), ("E7-Notifications-MIB", "e7TrapObjectClass"), ("E7-Notifications-MIB", "e7TrapObjectInstance1"), ("E7-Notifications-MIB", "e7TrapObjectInstance2"), ("E7-Notifications-MIB", "e7TrapObjectInstance3"), ("E7-Notifications-MIB", "e7TrapObjectInstance4"), ("E7-Notifications-MIB", "e7TrapObjectInstance5"), ("E7-Notifications-MIB", "e7TrapObjectInstance6"), ("E7-Notifications-MIB", "e7TrapObjectInstance7"), ("E7-Notifications-MIB", "e7TrapObjectInstance8"), ("E7-Notifications-MIB", "e7TrapCliObject"), ("E7-Notifications-MIB", "e7TrapAlarmSeverityLevel"), ("E7-Notifications-MIB", "e7TrapTimeStamp"), ("E7-Notifications-MIB", "e7TrapTime"), ("E7-Notifications-MIB", "e7TrapServiceAffecting"), ("E7-Notifications-MIB", "e7TrapAlarmLocationInfo"), ("E7-Notifications-MIB", "e7TrapText"), ("E7-Notifications-MIB", "e7TrapSecObjectClass"), ("E7-Notifications-MIB", "e7TrapSecObjectInstance1"), ("E7-Notifications-MIB", "e7TrapSecObjectInstance2"), ("E7-Notifications-MIB", "e7TrapSecObjectInstance3"), ("E7-Notifications-MIB", "e7TrapSecObjectInstance4"), ("E7-Notifications-MIB", "e7TrapSecObjectInstance5"), ("E7-Notifications-MIB", "e7TrapSecObjectInstance6"), ("E7-Notifications-MIB", "e7TrapSecObjectInstance7"), ("E7-Notifications-MIB", "e7TrapSecObjectInstance8"), ("E7-Notifications-MIB", "e7TrapObjectLabel1"), ("E7-Notifications-MIB", "e7TrapObjectLabel2"), ("E7-Notifications-MIB", "e7TrapSecObjectLabel1"), ("E7-Notifications-MIB", "e7TrapSecObjectLabel2")) if mibBuilder.loadTexts: e7TrapAlarm.setStatus('current') if mibBuilder.loadTexts: e7TrapAlarm.setDescription('e7TrapAlarm is generated whenever an alarm is raised or cleared.') e7TrapEvent = NotificationType((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 2, 2)).setObjects(("E7-Notifications-MIB", "e7TrapSequenceNo"), ("E7-Notifications-MIB", "e7TrapEventType"), ("E7-Notifications-MIB", "e7TrapObjectClass"), ("E7-Notifications-MIB", "e7TrapObjectInstance1"), ("E7-Notifications-MIB", "e7TrapObjectInstance2"), ("E7-Notifications-MIB", "e7TrapObjectInstance3"), ("E7-Notifications-MIB", "e7TrapObjectInstance4"), ("E7-Notifications-MIB", "e7TrapObjectInstance5"), ("E7-Notifications-MIB", "e7TrapObjectInstance6"), ("E7-Notifications-MIB", "e7TrapObjectInstance7"), ("E7-Notifications-MIB", "e7TrapObjectInstance8"), ("E7-Notifications-MIB", "e7TrapCliObject"), ("E7-Notifications-MIB", "e7TrapTimeStamp"), ("E7-Notifications-MIB", "e7TrapTime"), ("E7-Notifications-MIB", "e7TrapText"), ("E7-Notifications-MIB", "e7TrapRepeatCount"), ("E7-Notifications-MIB", "e7TrapObjectLabel1"), ("E7-Notifications-MIB", "e7TrapObjectLabel2")) if mibBuilder.loadTexts: e7TrapEvent.setStatus('current') if mibBuilder.loadTexts: e7TrapEvent.setDescription('e7TrapEvent is generated whenever general event is generated.') e7TrapDbChange = NotificationType((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 2, 3)).setObjects(("E7-Notifications-MIB", "e7TrapSequenceNo"), ("E7-Notifications-MIB", "e7TrapDbChangeType"), ("E7-Notifications-MIB", "e7TrapObjectClass"), ("E7-Notifications-MIB", "e7TrapObjectInstance1"), ("E7-Notifications-MIB", "e7TrapObjectInstance2"), ("E7-Notifications-MIB", "e7TrapObjectInstance3"), ("E7-Notifications-MIB", "e7TrapObjectInstance4"), ("E7-Notifications-MIB", "e7TrapObjectInstance5"), ("E7-Notifications-MIB", "e7TrapObjectInstance6"), ("E7-Notifications-MIB", "e7TrapObjectInstance7"), ("E7-Notifications-MIB", "e7TrapObjectInstance8"), ("E7-Notifications-MIB", "e7TrapCliObject"), ("E7-Notifications-MIB", "e7TrapMgmtIfType"), ("E7-Notifications-MIB", "e7TrapSessionNumber"), ("E7-Notifications-MIB", "e7TrapUserName"), ("E7-Notifications-MIB", "e7TrapIpAddr"), ("E7-Notifications-MIB", "e7TrapTimeStamp"), ("E7-Notifications-MIB", "e7TrapTime"), ("E7-Notifications-MIB", "e7TrapText"), ("E7-Notifications-MIB", "e7TrapObjectLabel1"), ("E7-Notifications-MIB", "e7TrapObjectLabel2")) if mibBuilder.loadTexts: e7TrapDbChange.setStatus('current') if mibBuilder.loadTexts: e7TrapDbChange.setDescription('e7TrapDbChange is generated whenever a database change occurs.') e7TrapSecurity = NotificationType((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 2, 4)).setObjects(("E7-Notifications-MIB", "e7TrapSequenceNo"), ("E7-Notifications-MIB", "e7TrapSecurityType"), ("E7-Notifications-MIB", "e7TrapMgmtIfType"), ("E7-Notifications-MIB", "e7TrapSessionNumber"), ("E7-Notifications-MIB", "e7TrapUserName"), ("E7-Notifications-MIB", "e7TrapIpAddr"), ("E7-Notifications-MIB", "e7TrapTimeStamp"), ("E7-Notifications-MIB", "e7TrapTime"), ("E7-Notifications-MIB", "e7TrapText")) if mibBuilder.loadTexts: e7TrapSecurity.setStatus('current') if mibBuilder.loadTexts: e7TrapSecurity.setDescription('e7TrapSecurity is generated whenever a security event occurs.') e7TrapTca = NotificationType((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 2, 5)).setObjects(("E7-Notifications-MIB", "e7TrapSequenceNo"), ("E7-Notifications-MIB", "e7TrapTcaType"), ("E7-Notifications-MIB", "e7TrapTcaBinType"), ("E7-Notifications-MIB", "e7TrapTcaValueType"), ("E7-Notifications-MIB", "e7TrapObjectClass"), ("E7-Notifications-MIB", "e7TrapObjectInstance1"), ("E7-Notifications-MIB", "e7TrapObjectInstance2"), ("E7-Notifications-MIB", "e7TrapObjectInstance3"), ("E7-Notifications-MIB", "e7TrapObjectInstance4"), ("E7-Notifications-MIB", "e7TrapObjectInstance5"), ("E7-Notifications-MIB", "e7TrapObjectInstance6"), ("E7-Notifications-MIB", "e7TrapObjectInstance7"), ("E7-Notifications-MIB", "e7TrapObjectInstance8"), ("E7-Notifications-MIB", "e7TrapCliObject"), ("E7-Notifications-MIB", "e7TrapTimeStamp"), ("E7-Notifications-MIB", "e7TrapTime"), ("E7-Notifications-MIB", "e7TrapText"), ("E7-Notifications-MIB", "e7TrapObjectLabel1"), ("E7-Notifications-MIB", "e7TrapObjectLabel2")) if mibBuilder.loadTexts: e7TrapTca.setStatus('current') if mibBuilder.loadTexts: e7TrapTca.setDescription('e7TrapTca is generated whenever a threshold crossing occurs.') mibBuilder.exportSymbols("E7-Notifications-MIB", e7TrapSecObjectInstance5=e7TrapSecObjectInstance5, e7NotificationModule=e7NotificationModule, e7TrapAlarmType=e7TrapAlarmType, e7TrapSecObjectInstance7=e7TrapSecObjectInstance7, e7TrapSecObjectLabel2=e7TrapSecObjectLabel2, e7TrapText=e7TrapText, e7NotificationObjects=e7NotificationObjects, e7TrapSequenceNo=e7TrapSequenceNo, e7TrapObjectInstance5=e7TrapObjectInstance5, e7TrapObjectInstance3=e7TrapObjectInstance3, e7TrapObjectInstance6=e7TrapObjectInstance6, e7TrapTimeStamp=e7TrapTimeStamp, e7TrapObjectLabel1=e7TrapObjectLabel1, e7TrapSecObjectInstance2=e7TrapSecObjectInstance2, e7TrapSecObjectInstance8=e7TrapSecObjectInstance8, e7TrapDbChangeType=e7TrapDbChangeType, e7TrapTime=e7TrapTime, e7TrapServiceAffecting=e7TrapServiceAffecting, e7TrapEventType=e7TrapEventType, e7TrapIpAddr=e7TrapIpAddr, e7TrapAlarmLocationInfo=e7TrapAlarmLocationInfo, e7TrapUserName=e7TrapUserName, e7TrapTcaValueType=e7TrapTcaValueType, e7TrapSecObjectLabel1=e7TrapSecObjectLabel1, e7TrapAlarmSeverityLevel=e7TrapAlarmSeverityLevel, e7TrapSecObjectInstance3=e7TrapSecObjectInstance3, e7TrapObjectInstance2=e7TrapObjectInstance2, e7Notification=e7Notification, e7TrapSessionNumber=e7TrapSessionNumber, e7Notifications=e7Notifications, e7TrapTcaBinType=e7TrapTcaBinType, e7TrapSecObjectClass=e7TrapSecObjectClass, e7TrapSecObjectInstance6=e7TrapSecObjectInstance6, e7TrapCliObject=e7TrapCliObject, e7TrapDbChange=e7TrapDbChange, e7TrapSecurity=e7TrapSecurity, e7TrapObjectInstance4=e7TrapObjectInstance4, e7TrapTcaType=e7TrapTcaType, e7TrapRepeatCount=e7TrapRepeatCount, e7TrapMgmtIfType=e7TrapMgmtIfType, e7TrapObjectInstance8=e7TrapObjectInstance8, e7TrapSecObjectInstance4=e7TrapSecObjectInstance4, PYSNMP_MODULE_ID=e7NotificationModule, e7TrapTca=e7TrapTca, e7TrapAlarm=e7TrapAlarm, e7TrapObjectInstance1=e7TrapObjectInstance1, e7TrapObjectInstance7=e7TrapObjectInstance7, e7TrapSecurityType=e7TrapSecurityType, e7TrapEvent=e7TrapEvent, e7TrapSecObjectInstance1=e7TrapSecObjectInstance1, e7TrapAlarmStatus=e7TrapAlarmStatus, e7TrapObjectClass=e7TrapObjectClass, e7TrapObjectLabel2=e7TrapObjectLabel2)
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'SingleValueConstraint', 'ValueSizeConstraint', 'ValueRangeConstraint', 'ConstraintsIntersection') (e7_modules, e7) = mibBuilder.importSymbols('CALIX-PRODUCT-MIB', 'e7Modules', 'e7') (e7_alarm_type, e7_object_class, e7_tca_type, e7_security_type, e7_event_type) = mibBuilder.importSymbols('E7-TC', 'E7AlarmType', 'E7ObjectClass', 'E7TcaType', 'E7SecurityType', 'E7EventType') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (ip_address, integer32, counter64, module_identity, object_identity, gauge32, iso, bits, mib_scalar, mib_table, mib_table_row, mib_table_column, time_ticks, counter32, mib_identifier, notification_type, unsigned32) = mibBuilder.importSymbols('SNMPv2-SMI', 'IpAddress', 'Integer32', 'Counter64', 'ModuleIdentity', 'ObjectIdentity', 'Gauge32', 'iso', 'Bits', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'TimeTicks', 'Counter32', 'MibIdentifier', 'NotificationType', 'Unsigned32') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') e7_notification_module = module_identity((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 1, 3)) if mibBuilder.loadTexts: e7NotificationModule.setLastUpdated('200912100000Z') if mibBuilder.loadTexts: e7NotificationModule.setOrganization('Calix') if mibBuilder.loadTexts: e7NotificationModule.setContactInfo('Calix') if mibBuilder.loadTexts: e7NotificationModule.setDescription('Describes all the notifications related to Calix E7, E5-400, and E5-312 products.') e7_notification = mib_identifier((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4)) e7_notification_objects = mib_identifier((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1)) e7_notifications = mib_identifier((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 2)) e7_trap_sequence_no = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 1), integer32()) if mibBuilder.loadTexts: e7TrapSequenceNo.setStatus('current') if mibBuilder.loadTexts: e7TrapSequenceNo.setDescription('') e7_trap_alarm_type = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 2), e7_alarm_type()) if mibBuilder.loadTexts: e7TrapAlarmType.setStatus('current') if mibBuilder.loadTexts: e7TrapAlarmType.setDescription('Alarm type of the Alarm') e7_trap_alarm_status = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('on', 1), ('off', 2)))) if mibBuilder.loadTexts: e7TrapAlarmStatus.setStatus('current') if mibBuilder.loadTexts: e7TrapAlarmStatus.setDescription('') e7_trap_object_class = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 4), e7_object_class()) if mibBuilder.loadTexts: e7TrapObjectClass.setStatus('current') if mibBuilder.loadTexts: e7TrapObjectClass.setDescription('') e7_trap_object_instance1 = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 5), integer32()) if mibBuilder.loadTexts: e7TrapObjectInstance1.setStatus('current') if mibBuilder.loadTexts: e7TrapObjectInstance1.setDescription('Object instance for a notification, level 1') e7_trap_object_instance2 = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 6), integer32()) if mibBuilder.loadTexts: e7TrapObjectInstance2.setStatus('current') if mibBuilder.loadTexts: e7TrapObjectInstance2.setDescription('Object instance for a notification, level 2') e7_trap_object_instance3 = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 7), integer32()) if mibBuilder.loadTexts: e7TrapObjectInstance3.setStatus('current') if mibBuilder.loadTexts: e7TrapObjectInstance3.setDescription('Object instance for a notification, level 3') e7_trap_object_instance4 = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 8), integer32()) if mibBuilder.loadTexts: e7TrapObjectInstance4.setStatus('current') if mibBuilder.loadTexts: e7TrapObjectInstance4.setDescription('Object instance for a notification, level 4') e7_trap_object_instance5 = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 9), integer32()) if mibBuilder.loadTexts: e7TrapObjectInstance5.setStatus('current') if mibBuilder.loadTexts: e7TrapObjectInstance5.setDescription('Object instance for a notification, level 5') e7_trap_object_instance6 = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 10), integer32()) if mibBuilder.loadTexts: e7TrapObjectInstance6.setStatus('current') if mibBuilder.loadTexts: e7TrapObjectInstance6.setDescription('Object instance for a notification, level 6') e7_trap_object_instance7 = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 11), integer32()) if mibBuilder.loadTexts: e7TrapObjectInstance7.setStatus('current') if mibBuilder.loadTexts: e7TrapObjectInstance7.setDescription('Object instance for a notification, level 7') e7_trap_object_instance8 = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 12), integer32()) if mibBuilder.loadTexts: e7TrapObjectInstance8.setStatus('current') if mibBuilder.loadTexts: e7TrapObjectInstance8.setDescription('Object instance for a notification, level 8') e7_trap_alarm_severity_level = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 13), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('critical', 1), ('major', 2), ('minor', 3), ('warning', 4), ('unknown', 5), ('clear', 6)))) if mibBuilder.loadTexts: e7TrapAlarmSeverityLevel.setStatus('current') if mibBuilder.loadTexts: e7TrapAlarmSeverityLevel.setDescription('') e7_trap_time_stamp = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 14), octet_string().subtype(subtypeSpec=value_size_constraint(1, 50))) if mibBuilder.loadTexts: e7TrapTimeStamp.setStatus('current') if mibBuilder.loadTexts: e7TrapTimeStamp.setDescription('local time string') e7_trap_service_affecting = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 15), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('yes', 1), ('no', 2)))) if mibBuilder.loadTexts: e7TrapServiceAffecting.setStatus('current') if mibBuilder.loadTexts: e7TrapServiceAffecting.setDescription('This value indicated wether this alarm is service affecting or not') e7_trap_alarm_location_info = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 16), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1))).clone(namedValues=named_values(('nearEnd', 1)))) if mibBuilder.loadTexts: e7TrapAlarmLocationInfo.setStatus('current') if mibBuilder.loadTexts: e7TrapAlarmLocationInfo.setDescription('Location info') e7_trap_text = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 17), octet_string()) if mibBuilder.loadTexts: e7TrapText.setStatus('current') if mibBuilder.loadTexts: e7TrapText.setDescription('This object contains the brief description about the notification') e7_trap_event_type = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 18), e7_event_type()) if mibBuilder.loadTexts: e7TrapEventType.setStatus('current') if mibBuilder.loadTexts: e7TrapEventType.setDescription('Event type of the Event') e7_trap_db_change_type = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 19), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(2, 3, 4))).clone(namedValues=named_values(('add', 2), ('modify', 3), ('delete', 4)))) if mibBuilder.loadTexts: e7TrapDbChangeType.setStatus('current') if mibBuilder.loadTexts: e7TrapDbChangeType.setDescription('Db change type') e7_trap_session_number = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 20), integer32()) if mibBuilder.loadTexts: e7TrapSessionNumber.setStatus('current') if mibBuilder.loadTexts: e7TrapSessionNumber.setDescription('User session number') e7_trap_user_name = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 21), octet_string()) if mibBuilder.loadTexts: e7TrapUserName.setStatus('current') if mibBuilder.loadTexts: e7TrapUserName.setDescription('User name') e7_trap_ip_addr = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 22), ip_address()) if mibBuilder.loadTexts: e7TrapIpAddr.setStatus('current') if mibBuilder.loadTexts: e7TrapIpAddr.setDescription('User name') e7_trap_security_type = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 23), e7_security_type()) if mibBuilder.loadTexts: e7TrapSecurityType.setStatus('current') if mibBuilder.loadTexts: e7TrapSecurityType.setDescription('Security event type') e7_trap_mgmt_if_type = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 24), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('debug', 1), ('system', 2), ('cli', 3), ('snmp', 4), ('netconf', 5)))) if mibBuilder.loadTexts: e7TrapMgmtIfType.setStatus('current') if mibBuilder.loadTexts: e7TrapMgmtIfType.setDescription('Management interface type') e7_trap_tca_type = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 25), e7_tca_type()) if mibBuilder.loadTexts: e7TrapTcaType.setStatus('current') if mibBuilder.loadTexts: e7TrapTcaType.setDescription('TCA element type') e7_trap_tca_bin_type = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 26), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('min15', 1), ('day1', 2), ('total', 3)))) if mibBuilder.loadTexts: e7TrapTcaBinType.setStatus('current') if mibBuilder.loadTexts: e7TrapTcaBinType.setDescription('TCA bin type -- only min15 and day1 used at this time') e7_trap_time = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 27), integer32()) if mibBuilder.loadTexts: e7TrapTime.setStatus('current') if mibBuilder.loadTexts: e7TrapTime.setDescription('UTC time integer') e7_trap_tca_value_type = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 28), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('count', 1), ('floor', 2), ('ceiling', 3)))) if mibBuilder.loadTexts: e7TrapTcaValueType.setStatus('current') if mibBuilder.loadTexts: e7TrapTcaValueType.setDescription('TCA value type -- exceeded count, below min (floor), or above max (ceiling)') e7_trap_cli_object = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 29), octet_string()) if mibBuilder.loadTexts: e7TrapCliObject.setStatus('current') if mibBuilder.loadTexts: e7TrapCliObject.setDescription('The short CLI name for the object class and instance') e7_trap_repeat_count = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 30), integer32()) if mibBuilder.loadTexts: e7TrapRepeatCount.setStatus('current') if mibBuilder.loadTexts: e7TrapRepeatCount.setDescription('The number of identical events of this type (1 for non-repeating events, > 1 for repeating events).') e7_trap_sec_object_class = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 31), e7_object_class()) if mibBuilder.loadTexts: e7TrapSecObjectClass.setStatus('current') if mibBuilder.loadTexts: e7TrapSecObjectClass.setDescription('Secondary object class') e7_trap_sec_object_instance1 = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 32), integer32()) if mibBuilder.loadTexts: e7TrapSecObjectInstance1.setStatus('current') if mibBuilder.loadTexts: e7TrapSecObjectInstance1.setDescription('Secondary object instance for a notification, level 1') e7_trap_sec_object_instance2 = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 33), integer32()) if mibBuilder.loadTexts: e7TrapSecObjectInstance2.setStatus('current') if mibBuilder.loadTexts: e7TrapSecObjectInstance2.setDescription('Secondary object instance for a notification, level 2') e7_trap_sec_object_instance3 = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 34), integer32()) if mibBuilder.loadTexts: e7TrapSecObjectInstance3.setStatus('current') if mibBuilder.loadTexts: e7TrapSecObjectInstance3.setDescription('Secondary object instance for a notification, level 3') e7_trap_sec_object_instance4 = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 35), integer32()) if mibBuilder.loadTexts: e7TrapSecObjectInstance4.setStatus('current') if mibBuilder.loadTexts: e7TrapSecObjectInstance4.setDescription('Secondary object instance for a notification, level 4') e7_trap_sec_object_instance5 = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 36), integer32()) if mibBuilder.loadTexts: e7TrapSecObjectInstance5.setStatus('current') if mibBuilder.loadTexts: e7TrapSecObjectInstance5.setDescription('Secondary object instance for a notification, level 5') e7_trap_sec_object_instance6 = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 37), integer32()) if mibBuilder.loadTexts: e7TrapSecObjectInstance6.setStatus('current') if mibBuilder.loadTexts: e7TrapSecObjectInstance6.setDescription('Secondary object instance for a notification, level 6') e7_trap_sec_object_instance7 = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 38), integer32()) if mibBuilder.loadTexts: e7TrapSecObjectInstance7.setStatus('current') if mibBuilder.loadTexts: e7TrapSecObjectInstance7.setDescription('Secondary object instance for a notification, level 7') e7_trap_sec_object_instance8 = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 39), integer32()) if mibBuilder.loadTexts: e7TrapSecObjectInstance8.setStatus('current') if mibBuilder.loadTexts: e7TrapSecObjectInstance8.setDescription('Secondary object instance for a notification, level 8') e7_trap_object_label1 = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 40), octet_string()) if mibBuilder.loadTexts: e7TrapObjectLabel1.setStatus('current') if mibBuilder.loadTexts: e7TrapObjectLabel1.setDescription("1st label for primary Object Instance, in 'pos,label' format") e7_trap_object_label2 = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 41), octet_string()) if mibBuilder.loadTexts: e7TrapObjectLabel2.setStatus('current') if mibBuilder.loadTexts: e7TrapObjectLabel2.setDescription("2nd label for primary Object Instance, in 'pos,label' format") e7_trap_sec_object_label1 = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 42), octet_string()) if mibBuilder.loadTexts: e7TrapSecObjectLabel1.setStatus('current') if mibBuilder.loadTexts: e7TrapSecObjectLabel1.setDescription("1st label for secondary Object Instance, in 'pos,label' format") e7_trap_sec_object_label2 = mib_scalar((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 1, 43), octet_string()) if mibBuilder.loadTexts: e7TrapSecObjectLabel2.setStatus('current') if mibBuilder.loadTexts: e7TrapSecObjectLabel2.setDescription("2nd label for secondary Object Instance, in 'pos,label' format") e7_trap_alarm = notification_type((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 2, 1)).setObjects(('E7-Notifications-MIB', 'e7TrapSequenceNo'), ('E7-Notifications-MIB', 'e7TrapAlarmType'), ('E7-Notifications-MIB', 'e7TrapAlarmStatus'), ('E7-Notifications-MIB', 'e7TrapObjectClass'), ('E7-Notifications-MIB', 'e7TrapObjectInstance1'), ('E7-Notifications-MIB', 'e7TrapObjectInstance2'), ('E7-Notifications-MIB', 'e7TrapObjectInstance3'), ('E7-Notifications-MIB', 'e7TrapObjectInstance4'), ('E7-Notifications-MIB', 'e7TrapObjectInstance5'), ('E7-Notifications-MIB', 'e7TrapObjectInstance6'), ('E7-Notifications-MIB', 'e7TrapObjectInstance7'), ('E7-Notifications-MIB', 'e7TrapObjectInstance8'), ('E7-Notifications-MIB', 'e7TrapCliObject'), ('E7-Notifications-MIB', 'e7TrapAlarmSeverityLevel'), ('E7-Notifications-MIB', 'e7TrapTimeStamp'), ('E7-Notifications-MIB', 'e7TrapTime'), ('E7-Notifications-MIB', 'e7TrapServiceAffecting'), ('E7-Notifications-MIB', 'e7TrapAlarmLocationInfo'), ('E7-Notifications-MIB', 'e7TrapText'), ('E7-Notifications-MIB', 'e7TrapSecObjectClass'), ('E7-Notifications-MIB', 'e7TrapSecObjectInstance1'), ('E7-Notifications-MIB', 'e7TrapSecObjectInstance2'), ('E7-Notifications-MIB', 'e7TrapSecObjectInstance3'), ('E7-Notifications-MIB', 'e7TrapSecObjectInstance4'), ('E7-Notifications-MIB', 'e7TrapSecObjectInstance5'), ('E7-Notifications-MIB', 'e7TrapSecObjectInstance6'), ('E7-Notifications-MIB', 'e7TrapSecObjectInstance7'), ('E7-Notifications-MIB', 'e7TrapSecObjectInstance8'), ('E7-Notifications-MIB', 'e7TrapObjectLabel1'), ('E7-Notifications-MIB', 'e7TrapObjectLabel2'), ('E7-Notifications-MIB', 'e7TrapSecObjectLabel1'), ('E7-Notifications-MIB', 'e7TrapSecObjectLabel2')) if mibBuilder.loadTexts: e7TrapAlarm.setStatus('current') if mibBuilder.loadTexts: e7TrapAlarm.setDescription('e7TrapAlarm is generated whenever an alarm is raised or cleared.') e7_trap_event = notification_type((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 2, 2)).setObjects(('E7-Notifications-MIB', 'e7TrapSequenceNo'), ('E7-Notifications-MIB', 'e7TrapEventType'), ('E7-Notifications-MIB', 'e7TrapObjectClass'), ('E7-Notifications-MIB', 'e7TrapObjectInstance1'), ('E7-Notifications-MIB', 'e7TrapObjectInstance2'), ('E7-Notifications-MIB', 'e7TrapObjectInstance3'), ('E7-Notifications-MIB', 'e7TrapObjectInstance4'), ('E7-Notifications-MIB', 'e7TrapObjectInstance5'), ('E7-Notifications-MIB', 'e7TrapObjectInstance6'), ('E7-Notifications-MIB', 'e7TrapObjectInstance7'), ('E7-Notifications-MIB', 'e7TrapObjectInstance8'), ('E7-Notifications-MIB', 'e7TrapCliObject'), ('E7-Notifications-MIB', 'e7TrapTimeStamp'), ('E7-Notifications-MIB', 'e7TrapTime'), ('E7-Notifications-MIB', 'e7TrapText'), ('E7-Notifications-MIB', 'e7TrapRepeatCount'), ('E7-Notifications-MIB', 'e7TrapObjectLabel1'), ('E7-Notifications-MIB', 'e7TrapObjectLabel2')) if mibBuilder.loadTexts: e7TrapEvent.setStatus('current') if mibBuilder.loadTexts: e7TrapEvent.setDescription('e7TrapEvent is generated whenever general event is generated.') e7_trap_db_change = notification_type((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 2, 3)).setObjects(('E7-Notifications-MIB', 'e7TrapSequenceNo'), ('E7-Notifications-MIB', 'e7TrapDbChangeType'), ('E7-Notifications-MIB', 'e7TrapObjectClass'), ('E7-Notifications-MIB', 'e7TrapObjectInstance1'), ('E7-Notifications-MIB', 'e7TrapObjectInstance2'), ('E7-Notifications-MIB', 'e7TrapObjectInstance3'), ('E7-Notifications-MIB', 'e7TrapObjectInstance4'), ('E7-Notifications-MIB', 'e7TrapObjectInstance5'), ('E7-Notifications-MIB', 'e7TrapObjectInstance6'), ('E7-Notifications-MIB', 'e7TrapObjectInstance7'), ('E7-Notifications-MIB', 'e7TrapObjectInstance8'), ('E7-Notifications-MIB', 'e7TrapCliObject'), ('E7-Notifications-MIB', 'e7TrapMgmtIfType'), ('E7-Notifications-MIB', 'e7TrapSessionNumber'), ('E7-Notifications-MIB', 'e7TrapUserName'), ('E7-Notifications-MIB', 'e7TrapIpAddr'), ('E7-Notifications-MIB', 'e7TrapTimeStamp'), ('E7-Notifications-MIB', 'e7TrapTime'), ('E7-Notifications-MIB', 'e7TrapText'), ('E7-Notifications-MIB', 'e7TrapObjectLabel1'), ('E7-Notifications-MIB', 'e7TrapObjectLabel2')) if mibBuilder.loadTexts: e7TrapDbChange.setStatus('current') if mibBuilder.loadTexts: e7TrapDbChange.setDescription('e7TrapDbChange is generated whenever a database change occurs.') e7_trap_security = notification_type((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 2, 4)).setObjects(('E7-Notifications-MIB', 'e7TrapSequenceNo'), ('E7-Notifications-MIB', 'e7TrapSecurityType'), ('E7-Notifications-MIB', 'e7TrapMgmtIfType'), ('E7-Notifications-MIB', 'e7TrapSessionNumber'), ('E7-Notifications-MIB', 'e7TrapUserName'), ('E7-Notifications-MIB', 'e7TrapIpAddr'), ('E7-Notifications-MIB', 'e7TrapTimeStamp'), ('E7-Notifications-MIB', 'e7TrapTime'), ('E7-Notifications-MIB', 'e7TrapText')) if mibBuilder.loadTexts: e7TrapSecurity.setStatus('current') if mibBuilder.loadTexts: e7TrapSecurity.setDescription('e7TrapSecurity is generated whenever a security event occurs.') e7_trap_tca = notification_type((1, 3, 6, 1, 4, 1, 6321, 1, 2, 2, 4, 2, 5)).setObjects(('E7-Notifications-MIB', 'e7TrapSequenceNo'), ('E7-Notifications-MIB', 'e7TrapTcaType'), ('E7-Notifications-MIB', 'e7TrapTcaBinType'), ('E7-Notifications-MIB', 'e7TrapTcaValueType'), ('E7-Notifications-MIB', 'e7TrapObjectClass'), ('E7-Notifications-MIB', 'e7TrapObjectInstance1'), ('E7-Notifications-MIB', 'e7TrapObjectInstance2'), ('E7-Notifications-MIB', 'e7TrapObjectInstance3'), ('E7-Notifications-MIB', 'e7TrapObjectInstance4'), ('E7-Notifications-MIB', 'e7TrapObjectInstance5'), ('E7-Notifications-MIB', 'e7TrapObjectInstance6'), ('E7-Notifications-MIB', 'e7TrapObjectInstance7'), ('E7-Notifications-MIB', 'e7TrapObjectInstance8'), ('E7-Notifications-MIB', 'e7TrapCliObject'), ('E7-Notifications-MIB', 'e7TrapTimeStamp'), ('E7-Notifications-MIB', 'e7TrapTime'), ('E7-Notifications-MIB', 'e7TrapText'), ('E7-Notifications-MIB', 'e7TrapObjectLabel1'), ('E7-Notifications-MIB', 'e7TrapObjectLabel2')) if mibBuilder.loadTexts: e7TrapTca.setStatus('current') if mibBuilder.loadTexts: e7TrapTca.setDescription('e7TrapTca is generated whenever a threshold crossing occurs.') mibBuilder.exportSymbols('E7-Notifications-MIB', e7TrapSecObjectInstance5=e7TrapSecObjectInstance5, e7NotificationModule=e7NotificationModule, e7TrapAlarmType=e7TrapAlarmType, e7TrapSecObjectInstance7=e7TrapSecObjectInstance7, e7TrapSecObjectLabel2=e7TrapSecObjectLabel2, e7TrapText=e7TrapText, e7NotificationObjects=e7NotificationObjects, e7TrapSequenceNo=e7TrapSequenceNo, e7TrapObjectInstance5=e7TrapObjectInstance5, e7TrapObjectInstance3=e7TrapObjectInstance3, e7TrapObjectInstance6=e7TrapObjectInstance6, e7TrapTimeStamp=e7TrapTimeStamp, e7TrapObjectLabel1=e7TrapObjectLabel1, e7TrapSecObjectInstance2=e7TrapSecObjectInstance2, e7TrapSecObjectInstance8=e7TrapSecObjectInstance8, e7TrapDbChangeType=e7TrapDbChangeType, e7TrapTime=e7TrapTime, e7TrapServiceAffecting=e7TrapServiceAffecting, e7TrapEventType=e7TrapEventType, e7TrapIpAddr=e7TrapIpAddr, e7TrapAlarmLocationInfo=e7TrapAlarmLocationInfo, e7TrapUserName=e7TrapUserName, e7TrapTcaValueType=e7TrapTcaValueType, e7TrapSecObjectLabel1=e7TrapSecObjectLabel1, e7TrapAlarmSeverityLevel=e7TrapAlarmSeverityLevel, e7TrapSecObjectInstance3=e7TrapSecObjectInstance3, e7TrapObjectInstance2=e7TrapObjectInstance2, e7Notification=e7Notification, e7TrapSessionNumber=e7TrapSessionNumber, e7Notifications=e7Notifications, e7TrapTcaBinType=e7TrapTcaBinType, e7TrapSecObjectClass=e7TrapSecObjectClass, e7TrapSecObjectInstance6=e7TrapSecObjectInstance6, e7TrapCliObject=e7TrapCliObject, e7TrapDbChange=e7TrapDbChange, e7TrapSecurity=e7TrapSecurity, e7TrapObjectInstance4=e7TrapObjectInstance4, e7TrapTcaType=e7TrapTcaType, e7TrapRepeatCount=e7TrapRepeatCount, e7TrapMgmtIfType=e7TrapMgmtIfType, e7TrapObjectInstance8=e7TrapObjectInstance8, e7TrapSecObjectInstance4=e7TrapSecObjectInstance4, PYSNMP_MODULE_ID=e7NotificationModule, e7TrapTca=e7TrapTca, e7TrapAlarm=e7TrapAlarm, e7TrapObjectInstance1=e7TrapObjectInstance1, e7TrapObjectInstance7=e7TrapObjectInstance7, e7TrapSecurityType=e7TrapSecurityType, e7TrapEvent=e7TrapEvent, e7TrapSecObjectInstance1=e7TrapSecObjectInstance1, e7TrapAlarmStatus=e7TrapAlarmStatus, e7TrapObjectClass=e7TrapObjectClass, e7TrapObjectLabel2=e7TrapObjectLabel2)
config = { "domain": "example.com", "ruleset": "autoses", "s3bucket": "autoses-incoming", "sidprefix": "sid-autoses", "awsaccountid": "<FILL ME>", "region": "us-east-1", "sqs": { "message_retention_period": 14 * 24 * 3600, "visibility_timeout": 60, }, "lambda": { "file_name": "lambda_function.py", # Relative to current directory of the running script "handler": "lambda_handler", # Name of the entrypoint function }, "log_retention_days": 90, "s3_retention_days": 90, }
config = {'domain': 'example.com', 'ruleset': 'autoses', 's3bucket': 'autoses-incoming', 'sidprefix': 'sid-autoses', 'awsaccountid': '<FILL ME>', 'region': 'us-east-1', 'sqs': {'message_retention_period': 14 * 24 * 3600, 'visibility_timeout': 60}, 'lambda': {'file_name': 'lambda_function.py', 'handler': 'lambda_handler'}, 'log_retention_days': 90, 's3_retention_days': 90}
# Lab 01 - Exercise 01 # First Number print("Please insert a first number: ", end='') try: a = int(input()) except ValueError: print("That didn't seem a number!") quit() # Second Number print("Please now insert a second number: ", end='') try: b = int(input()) except ValueError: print("That didn't seem a number!") quit() # Printing print("\nTheir sum is: " + str(a + b))
print('Please insert a first number: ', end='') try: a = int(input()) except ValueError: print("That didn't seem a number!") quit() print('Please now insert a second number: ', end='') try: b = int(input()) except ValueError: print("That didn't seem a number!") quit() print('\nTheir sum is: ' + str(a + b))
class Router(object): def db_for_read(self, model, **hints): if model._meta.model_name == 'articleotherdb': return 'other' return None def db_for_write(self, model, **hints): if model._meta.model_name == 'articleotherdb': return 'other' return None def allow_migrate(self, db, app_label, model=None, **hints): if model: if model._meta.model_name == 'articleotherdb': return db == 'other' else: return db == 'default' return None
class Router(object): def db_for_read(self, model, **hints): if model._meta.model_name == 'articleotherdb': return 'other' return None def db_for_write(self, model, **hints): if model._meta.model_name == 'articleotherdb': return 'other' return None def allow_migrate(self, db, app_label, model=None, **hints): if model: if model._meta.model_name == 'articleotherdb': return db == 'other' else: return db == 'default' return None
{ 'targets': [ { 'target_name': 'DTraceProviderBindings', 'conditions': [ ['OS=="mac" or OS=="solaris" or OS=="freebsd"', { 'sources': [ 'dtrace_provider.cc', 'dtrace_probe.cc', ], 'include_dirs': [ 'libusdt' ], 'dependencies': [ 'libusdt' ], 'libraries': [ '-L<(module_root_dir)/libusdt -l usdt' ] }] ] }, { 'target_name': 'libusdt', 'type': 'none', 'conditions': [ ['OS=="mac" or OS=="solaris" or OS=="freebsd"', { 'actions': [{ 'inputs': [''], 'outputs': [''], 'action_name': 'build_libusdt', 'action': [ 'sh', 'libusdt-build.sh' ] }] }] ] } ] }
{'targets': [{'target_name': 'DTraceProviderBindings', 'conditions': [['OS=="mac" or OS=="solaris" or OS=="freebsd"', {'sources': ['dtrace_provider.cc', 'dtrace_probe.cc'], 'include_dirs': ['libusdt'], 'dependencies': ['libusdt'], 'libraries': ['-L<(module_root_dir)/libusdt -l usdt']}]]}, {'target_name': 'libusdt', 'type': 'none', 'conditions': [['OS=="mac" or OS=="solaris" or OS=="freebsd"', {'actions': [{'inputs': [''], 'outputs': [''], 'action_name': 'build_libusdt', 'action': ['sh', 'libusdt-build.sh']}]}]]}]}
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"GaborLayer": "00_core.ipynb", "GaborLayer.create_xy_grid": "00_core.ipynb", "GaborLayer.build": "00_core.ipynb", "GaborLayer.create_kernel": "00_core.ipynb", "GaborLayer.call": "00_core.ipynb", "GaborLayer.get_config": "00_core.ipynb", "SigmaRegularizer": "00_core.ipynb", "GaborBlock": "01_alexnet.ipynb", "AlexNet": "01_alexnet.ipynb", "LeNet": "02_lenet.ipynb"} modules = ["core.py", "alexnet.py", "lenet.py"] doc_url = "https://SRSteinkamp.github.io/PWC_Perez2020_Gabor/" git_url = "https://github.com/SRSteinkamp/pwc_gabor_layer/tree/main/" def custom_doc_links(name): return None
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'GaborLayer': '00_core.ipynb', 'GaborLayer.create_xy_grid': '00_core.ipynb', 'GaborLayer.build': '00_core.ipynb', 'GaborLayer.create_kernel': '00_core.ipynb', 'GaborLayer.call': '00_core.ipynb', 'GaborLayer.get_config': '00_core.ipynb', 'SigmaRegularizer': '00_core.ipynb', 'GaborBlock': '01_alexnet.ipynb', 'AlexNet': '01_alexnet.ipynb', 'LeNet': '02_lenet.ipynb'} modules = ['core.py', 'alexnet.py', 'lenet.py'] doc_url = 'https://SRSteinkamp.github.io/PWC_Perez2020_Gabor/' git_url = 'https://github.com/SRSteinkamp/pwc_gabor_layer/tree/main/' def custom_doc_links(name): return None
def word_lengths( file_path: str ) -> set: return { len(token) for line in open(file_path) for token in line.split() } def main(): file_path = 'comprehensions/file.txt' result = word_lengths(file_path) print(result) if __name__ == '__main__': main()
def word_lengths(file_path: str) -> set: return {len(token) for line in open(file_path) for token in line.split()} def main(): file_path = 'comprehensions/file.txt' result = word_lengths(file_path) print(result) if __name__ == '__main__': main()
# This file is executed on every boot (including wake-boot from deepsleep) # notify print('RUN: boot.py')
print('RUN: boot.py')
class EndnoteObject: supported_cff_versions = ['1.0.3', '1.1.0'] supported_endnote_props = ['author', 'year', 'keyword', 'doi', 'name', 'url'] def __init__(self, cff_object, initialize_empty=False): self.cff_object = cff_object self.author = None self.doi = None self.keyword = None self.name = None self.url = None self.year = None if initialize_empty: # clause for testing purposes pass else: self.check_cff_object().add_all() def __str__(self): items = [item for item in [self.author, self.year, self.keyword, self.doi, self.name, self.url] if item is not None] return '%0 Generic\n' + ''.join(items) + '%9 source code\n' def add_all(self): self.add_author() \ .add_doi() \ .add_keyword() \ .add_name() \ .add_url() \ .add_year() return self def add_author(self): if 'authors' in self.cff_object.keys(): authors = list() for author in self.cff_object['authors']: keys = author.keys() nameparts = [ author['name-particle'] if 'name-particle' in keys else None, author['family-names'] if 'family-names' in keys else None, author['name-suffix'] if 'name-suffix' in keys else None ] tmp = ' '.join([namepart for namepart in nameparts if namepart is not None]) fullname = tmp + ', ' + author['given-names'] if 'given-names' in keys else tmp alias = author['alias'] if 'alias' in keys and author['alias'] is not None and author['alias'] != '' else None if fullname: authors.append('%A {}\n'.format(fullname)) elif alias: authors.append('%A {}\n'.format(alias)) else: continue self.author = ''.join(authors) return self def add_doi(self): version = self.cff_object['cff-version'] if version in ['1.0.3', '1.1.0']: if 'doi' in self.cff_object.keys(): self.doi = '%R {}\n'.format(self.cff_object['doi']) if version in ['1.1.0']: if 'identifiers' in self.cff_object.keys(): identifiers = self.cff_object['identifiers'] for identifier in identifiers: if identifier['type'] == 'doi': self.doi = '%R {}\n'.format(identifier['value']) break return self def add_keyword(self): if 'keywords' in self.cff_object.keys(): keywords = ['%K {}\n'.format(keyword) for keyword in self.cff_object['keywords']] self.keyword = ''.join(keywords) return self def add_name(self): if 'title' in self.cff_object.keys(): self.name = '%T {}\n'.format(self.cff_object['title']) return self def add_url(self): if 'repository-code' in self.cff_object.keys(): self.url = '%U {}\n'.format(self.cff_object['repository-code']) return self def add_year(self): if 'date-released' in self.cff_object.keys(): self.year = '%D {}\n'.format(self.cff_object['date-released'].year) return self def check_cff_object(self): if not isinstance(self.cff_object, dict): raise ValueError('Expected cff_object to be of type \'dict\'.') elif 'cff-version' not in self.cff_object.keys(): raise ValueError('Missing key "cff-version" in CITATION.cff file.') elif self.cff_object['cff-version'] not in EndnoteObject.supported_cff_versions: raise ValueError('\'cff-version\': \'{}\' isn\'t a supported version.' .format(self.cff_object['cff-version'])) else: return self def print(self): return self.__str__()
class Endnoteobject: supported_cff_versions = ['1.0.3', '1.1.0'] supported_endnote_props = ['author', 'year', 'keyword', 'doi', 'name', 'url'] def __init__(self, cff_object, initialize_empty=False): self.cff_object = cff_object self.author = None self.doi = None self.keyword = None self.name = None self.url = None self.year = None if initialize_empty: pass else: self.check_cff_object().add_all() def __str__(self): items = [item for item in [self.author, self.year, self.keyword, self.doi, self.name, self.url] if item is not None] return '%0 Generic\n' + ''.join(items) + '%9 source code\n' def add_all(self): self.add_author().add_doi().add_keyword().add_name().add_url().add_year() return self def add_author(self): if 'authors' in self.cff_object.keys(): authors = list() for author in self.cff_object['authors']: keys = author.keys() nameparts = [author['name-particle'] if 'name-particle' in keys else None, author['family-names'] if 'family-names' in keys else None, author['name-suffix'] if 'name-suffix' in keys else None] tmp = ' '.join([namepart for namepart in nameparts if namepart is not None]) fullname = tmp + ', ' + author['given-names'] if 'given-names' in keys else tmp alias = author['alias'] if 'alias' in keys and author['alias'] is not None and (author['alias'] != '') else None if fullname: authors.append('%A {}\n'.format(fullname)) elif alias: authors.append('%A {}\n'.format(alias)) else: continue self.author = ''.join(authors) return self def add_doi(self): version = self.cff_object['cff-version'] if version in ['1.0.3', '1.1.0']: if 'doi' in self.cff_object.keys(): self.doi = '%R {}\n'.format(self.cff_object['doi']) if version in ['1.1.0']: if 'identifiers' in self.cff_object.keys(): identifiers = self.cff_object['identifiers'] for identifier in identifiers: if identifier['type'] == 'doi': self.doi = '%R {}\n'.format(identifier['value']) break return self def add_keyword(self): if 'keywords' in self.cff_object.keys(): keywords = ['%K {}\n'.format(keyword) for keyword in self.cff_object['keywords']] self.keyword = ''.join(keywords) return self def add_name(self): if 'title' in self.cff_object.keys(): self.name = '%T {}\n'.format(self.cff_object['title']) return self def add_url(self): if 'repository-code' in self.cff_object.keys(): self.url = '%U {}\n'.format(self.cff_object['repository-code']) return self def add_year(self): if 'date-released' in self.cff_object.keys(): self.year = '%D {}\n'.format(self.cff_object['date-released'].year) return self def check_cff_object(self): if not isinstance(self.cff_object, dict): raise value_error("Expected cff_object to be of type 'dict'.") elif 'cff-version' not in self.cff_object.keys(): raise value_error('Missing key "cff-version" in CITATION.cff file.') elif self.cff_object['cff-version'] not in EndnoteObject.supported_cff_versions: raise value_error("'cff-version': '{}' isn't a supported version.".format(self.cff_object['cff-version'])) else: return self def print(self): return self.__str__()
class CoordinatesAreNotGiven(Exception): def __init__(self, lon=1, lat=1, alt=1) -> None: self.message = "" if not lon: self.message += "Lon can't be None\n" if not lat: self.message += "Lat can't be None\n" if not alt: self.message += "Alt can't be None" def __str__(self) -> str: print("Station coordinates are not given.") return "\n" + self.message class InvalidMirrorParameters(Exception): def __init__(self, mirrorFocus=1, mirrorRadius=1, mirrorHorizon=1, minApogee=1) -> None: if not mirrorFocus: self.message += "MirrorFocus can't be < 0\n" if not mirrorRadius: self.message += "MirrorRadius can't be < 0\n" if not mirrorHorizon: self.message += "MirrorHorizon can't be < 0\n" if not minApogee: self.message += "MinApogee can't be < 0" def __str__(self) -> str: print("Invalid mirror parameters") return "\n" + self.message class InvalidTimeCorrection(Exception): def __init__(self) -> None: pass def __str__(self) -> str: return "Correction of the time zone for more than 12 hours.\nThere is no such time zone." class InvalidCoordinates(Exception): def __init__(self, *args) -> None: pass def __str__(self) -> str: return "The coordinates of the station are not specified correctly."
class Coordinatesarenotgiven(Exception): def __init__(self, lon=1, lat=1, alt=1) -> None: self.message = '' if not lon: self.message += "Lon can't be None\n" if not lat: self.message += "Lat can't be None\n" if not alt: self.message += "Alt can't be None" def __str__(self) -> str: print('Station coordinates are not given.') return '\n' + self.message class Invalidmirrorparameters(Exception): def __init__(self, mirrorFocus=1, mirrorRadius=1, mirrorHorizon=1, minApogee=1) -> None: if not mirrorFocus: self.message += "MirrorFocus can't be < 0\n" if not mirrorRadius: self.message += "MirrorRadius can't be < 0\n" if not mirrorHorizon: self.message += "MirrorHorizon can't be < 0\n" if not minApogee: self.message += "MinApogee can't be < 0" def __str__(self) -> str: print('Invalid mirror parameters') return '\n' + self.message class Invalidtimecorrection(Exception): def __init__(self) -> None: pass def __str__(self) -> str: return 'Correction of the time zone for more than 12 hours.\nThere is no such time zone.' class Invalidcoordinates(Exception): def __init__(self, *args) -> None: pass def __str__(self) -> str: return 'The coordinates of the station are not specified correctly.'
def minRemoveToMakeValid(s): # O(n) time and space # doesn't use stack s = list(s) open_count = 0 for ind, c in enumerate(s): if c == "(": open_count += 1 elif c == ")": if not open_count: # if open_count is 0 s[ind] = "" else: open_count -= 1 for i in range(len(s) - 1, -1, -1): if not open_count: break if s[i] == "(": s[i] = "" open_count -= 1 return "".join(s) print(minRemoveToMakeValid("(a(b(c)d))"))
def min_remove_to_make_valid(s): s = list(s) open_count = 0 for (ind, c) in enumerate(s): if c == '(': open_count += 1 elif c == ')': if not open_count: s[ind] = '' else: open_count -= 1 for i in range(len(s) - 1, -1, -1): if not open_count: break if s[i] == '(': s[i] = '' open_count -= 1 return ''.join(s) print(min_remove_to_make_valid('(a(b(c)d))'))
def nonify(func): def newAnB(*args, **arg): res = func(*args, **arg) return None if not res else res return newAnB
def nonify(func): def new_an_b(*args, **arg): res = func(*args, **arg) return None if not res else res return newAnB
# [Required] Hero's Succession (22300) echo = 20011005 successor = 1142158 mir = 1013000 sm.setSpeakerID(mir) sm.sendNext("Master, master, look at this. There's something wrong with one of my scales!") sm.setPlayerAsSpeaker() sm.sendSay("That's...?! \r\n\r\n" "Mir, one of your scales is showing the #bOnyx Dragon's Symbol#k!") sm.setSpeakerID(mir) sm.sendSay("Really? That's weird... \r\n\r\n" "Oh, I know! Then that means it's time.") sm.setPlayerAsSpeaker() sm.sendSay("It's time?") sm.setSpeakerID(mir) sm.sendSay("It's time for us to inherit Freud and Afrien's powers. " "We've gotten very strong lately. And master's spirit is growing too...") sm.setPlayerAsSpeaker() sm.sendSay("Huh? Really?") sm.setSpeakerID(mir) sm.sendSay("You didn't know that? An Onyx Dragon responds to a strong spirit, " "so I've been feeling that every day. It's not particularly strong unlike with the previous Dragon Masters, " "but we'll be able to match them someday. \r\n\r\n" "Ah, the scale fell off.") sm.setPlayerAsSpeaker() sm.sendSay("Really? But it's still shining.") sm.setSpeakerID(mir) response = sm.sendAskYesNo("Master, take this scale. It feels like I've shed something to take another step forward.") if response: if sm.canHold(successor): sm.giveSkill(echo) sm.giveItem(successor) sm.startQuest(parentID) sm.completeQuest(parentID) sm.setPlayerAsSpeaker() sm.sendNext("(You received #p" + str(mir) + "#'s dragon scale. " "As you place your hand on the scale, it magically transforms into #i" + str(successor) + "#.)") sm.sendSay("(You have learned #b#q" + str(echo) + "##k.)") sm.sendSay("Yay, a new skill! Now I really look like Freud's true successor!") sm.setSpeakerID(mir) sm.sendPrev("Hehe. Congratulations, master. Let's keep on growing to surpass our predecessors!") else: sm.sendSayOkay("Master, make some space in your Equip inventory first.")
echo = 20011005 successor = 1142158 mir = 1013000 sm.setSpeakerID(mir) sm.sendNext("Master, master, look at this. There's something wrong with one of my scales!") sm.setPlayerAsSpeaker() sm.sendSay("That's...?! \r\n\r\nMir, one of your scales is showing the #bOnyx Dragon's Symbol#k!") sm.setSpeakerID(mir) sm.sendSay("Really? That's weird... \r\n\r\nOh, I know! Then that means it's time.") sm.setPlayerAsSpeaker() sm.sendSay("It's time?") sm.setSpeakerID(mir) sm.sendSay("It's time for us to inherit Freud and Afrien's powers. We've gotten very strong lately. And master's spirit is growing too...") sm.setPlayerAsSpeaker() sm.sendSay('Huh? Really?') sm.setSpeakerID(mir) sm.sendSay("You didn't know that? An Onyx Dragon responds to a strong spirit, so I've been feeling that every day. It's not particularly strong unlike with the previous Dragon Masters, but we'll be able to match them someday. \r\n\r\nAh, the scale fell off.") sm.setPlayerAsSpeaker() sm.sendSay("Really? But it's still shining.") sm.setSpeakerID(mir) response = sm.sendAskYesNo("Master, take this scale. It feels like I've shed something to take another step forward.") if response: if sm.canHold(successor): sm.giveSkill(echo) sm.giveItem(successor) sm.startQuest(parentID) sm.completeQuest(parentID) sm.setPlayerAsSpeaker() sm.sendNext('(You received #p' + str(mir) + "#'s dragon scale. As you place your hand on the scale, it magically transforms into #i" + str(successor) + '#.)') sm.sendSay('(You have learned #b#q' + str(echo) + '##k.)') sm.sendSay("Yay, a new skill! Now I really look like Freud's true successor!") sm.setSpeakerID(mir) sm.sendPrev("Hehe. Congratulations, master. Let's keep on growing to surpass our predecessors!") else: sm.sendSayOkay('Master, make some space in your Equip inventory first.')
#from coustmer import formate_coustmer def formate_coustmer(first, last ,location): full_name = '%s' '%s' %(first,last) if location: return '%s (%s)' %(full_name,location) else: return full_name if __name__ == '__main__': print(formate_coustmer('Lilly ', 'jokowich',location = 'california')) #print(formate_coustmer('shree','chahal'))
def formate_coustmer(first, last, location): full_name = '%s%s' % (first, last) if location: return '%s (%s)' % (full_name, location) else: return full_name if __name__ == '__main__': print(formate_coustmer('Lilly ', 'jokowich', location='california'))
# dashboard_generator.py print("-----------------------") print("MONTH: March 2018") print("-----------------------") print("CRUNCHING THE DATA...") print("-----------------------") print("TOTAL MONTHLY SALES: $12,000.71") print("-----------------------") print("TOP SELLING PRODUCTS:") print(" 1) Button-Down Shirt: $6,960.35") print(" 2) Super Soft Hoodie: $1,875.00") print(" 3) etc.") print("-----------------------") print("VISUALIZING THE DATA...")
print('-----------------------') print('MONTH: March 2018') print('-----------------------') print('CRUNCHING THE DATA...') print('-----------------------') print('TOTAL MONTHLY SALES: $12,000.71') print('-----------------------') print('TOP SELLING PRODUCTS:') print(' 1) Button-Down Shirt: $6,960.35') print(' 2) Super Soft Hoodie: $1,875.00') print(' 3) etc.') print('-----------------------') print('VISUALIZING THE DATA...')
class MulticastDelegate(object): def __init__(self): self.delegates = [] def __iadd__(self, delegate): self.add(delegate) return self def add(self, delegate): self.delegates.append(delegate) def __isub__(self, delegate): self.delegates.remove(delegate) return self def __call__(self, *args, **kwargs): for d in self.delegates: d(*args, **kwargs)
class Multicastdelegate(object): def __init__(self): self.delegates = [] def __iadd__(self, delegate): self.add(delegate) return self def add(self, delegate): self.delegates.append(delegate) def __isub__(self, delegate): self.delegates.remove(delegate) return self def __call__(self, *args, **kwargs): for d in self.delegates: d(*args, **kwargs)
class Exceptions: class NetworkError(Exception): def __str__(self): return "Network Error" class FileSystemError(Exception): def __str__(self): return "File System Error"
class Exceptions: class Networkerror(Exception): def __str__(self): return 'Network Error' class Filesystemerror(Exception): def __str__(self): return 'File System Error'
#!/usr/bin/env python3 l = '' with open('input') as f: l = [int(x) for x in f.read().split(',')] s = sorted(l)[len(l)//2] d = 0 for i in l: d += abs(s - i) print(d)
l = '' with open('input') as f: l = [int(x) for x in f.read().split(',')] s = sorted(l)[len(l) // 2] d = 0 for i in l: d += abs(s - i) print(d)
class UserDomain: def is_active(self, user): return user.email_confirmed user_domain = UserDomain()
class Userdomain: def is_active(self, user): return user.email_confirmed user_domain = user_domain()
FILTERS = [] ENDP_COUNT = 0 class Filter(object): def __init__(self): self.urls = [] self.filter_all = False self.order = 0 def filter(self, request, response): pass def _continue(self, request, response): return {"request": request, "response": response}
filters = [] endp_count = 0 class Filter(object): def __init__(self): self.urls = [] self.filter_all = False self.order = 0 def filter(self, request, response): pass def _continue(self, request, response): return {'request': request, 'response': response}
class LaneFitter(): def __init__(self, camera): if camera is None: raise Exception("Lane fitter needs a camera to undistort and warp") self.camera = camera def getfit(self, img, prev_left_fit=None, prev_right_fit=None): undistorted = self.camera.undistort(img) binary_img = to_binary_img(undistorted) warped_binary = self.camera.warp(binary_img) if prev_left_fit is not None: lf, rf, lx, ly, rx, ry = search_around_poly(warped_binary, prev_left_fit, prev_right_fit) if prev_left_fit is None: lf, rf, lx, ly, rx, ry, left_rectangles, right_rectangles = fit_polynomial(warped_binary) fit_info = (lf, rf, lx, ly, rx, ry) debug_info = (binary_img, warped_binary) return fit_info, debug_info
class Lanefitter: def __init__(self, camera): if camera is None: raise exception('Lane fitter needs a camera to undistort and warp') self.camera = camera def getfit(self, img, prev_left_fit=None, prev_right_fit=None): undistorted = self.camera.undistort(img) binary_img = to_binary_img(undistorted) warped_binary = self.camera.warp(binary_img) if prev_left_fit is not None: (lf, rf, lx, ly, rx, ry) = search_around_poly(warped_binary, prev_left_fit, prev_right_fit) if prev_left_fit is None: (lf, rf, lx, ly, rx, ry, left_rectangles, right_rectangles) = fit_polynomial(warped_binary) fit_info = (lf, rf, lx, ly, rx, ry) debug_info = (binary_img, warped_binary) return (fit_info, debug_info)
#raspberry pi GPIO pin definitions #using physical pin #'s, not GPIO #'s class GpioPins: LEFT_MOTOR_FORWARD = 31 LEFT_MOTOR_BACKWARD = 33 RIGHT_MOTOR_FORWARD = 35 RIGHT_MOTOR_BACKWARD = 37 ULTRASONIC_SENSOR_TRIG = 7 ULTRASONIC_SENSOR_ECHO = 12 IR_SENSOR_LEFT = 24 IR_SENSOR_RIGHT = 26 SERVO_ULTRASONIC_SENSOR = 19 SERVO_HORIZONTAL_CAMERA = 00 SERVO_VERTICAL_CAMERA = 00
class Gpiopins: left_motor_forward = 31 left_motor_backward = 33 right_motor_forward = 35 right_motor_backward = 37 ultrasonic_sensor_trig = 7 ultrasonic_sensor_echo = 12 ir_sensor_left = 24 ir_sensor_right = 26 servo_ultrasonic_sensor = 19 servo_horizontal_camera = 0 servo_vertical_camera = 0
n=int(input()) ans=0 fac=1 for i in range(1,n+1): fac*=i ans+=fac print(ans)
n = int(input()) ans = 0 fac = 1 for i in range(1, n + 1): fac *= i ans += fac print(ans)
# Copyright 2014-2018 The PySCF Developers. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ''' NIST physical constants https://physics.nist.gov/cuu/Constants/ https://physics.nist.gov/cuu/Constants/Table/allascii.txt ''' LIGHT_SPEED = 137.03599967994 #http://physics.nist.gov/cgi-bin/cuu/Value?alph # BOHR = .529 177 210 92(17) e-10m #http://physics.nist.gov/cgi-bin/cuu/Value?bohrrada0 BOHR = 0.52917721092 # Angstroms ALPHA = 7.2973525664e-3 #http://physics.nist.gov/cgi-bin/cuu/Value?alph G_ELECTRON = 2.00231930436182 # http://physics.nist.gov/cgi-bin/cuu/Value?gem E_MASS = 9.10938356e-31 # kg https://physics.nist.gov/cgi-bin/cuu/Value?me PROTON_MASS = 1.672621898e-27 # kg https://physics.nist.gov/cgi-bin/cuu/Value?mp BOHR_MAGNETON = 927.4009994e-26 # J/T http://physics.nist.gov/cgi-bin/cuu/Value?mub NUC_MAGNETON = BOHR_MAGNETON * E_MASS / PROTON_MASS PLANCK = 6.626070040e-34 # J*s http://physics.nist.gov/cgi-bin/cuu/Value?h HARTREE2J = 4.359744650e-18 # J https://physics.nist.gov/cgi-bin/cuu/Value?hrj HARTREE2EV = 27.21138602 # eV https://physics.nist.gov/cgi-bin/cuu/Value?threv HARTREE2WAVENUMBER = 2.194746313702e9 E_CHARGE = 1.6021766208e-19 # C https://physics.nist.gov/cgi-bin/cuu/Value?e LIGHT_SPEED_SI = 299792458 # https://physics.nist.gov/cgi-bin/cuu/Value?c AVOGADRO = 6.022140857e23 # https://physics.nist.gov/cgi-bin/cuu/Value?na DEBYE = 3.335641e-30 # C*m = 1e-18/LIGHT_SPEED_SI https://cccbdb.nist.gov/debye.asp AU2DEBYE = E_CHARGE * BOHR*1e-10 / DEBYE # 2.541746
""" NIST physical constants https://physics.nist.gov/cuu/Constants/ https://physics.nist.gov/cuu/Constants/Table/allascii.txt """ light_speed = 137.03599967994 bohr = 0.52917721092 alpha = 0.0072973525664 g_electron = 2.00231930436182 e_mass = 9.10938356e-31 proton_mass = 1.672621898e-27 bohr_magneton = 9.274009994e-24 nuc_magneton = BOHR_MAGNETON * E_MASS / PROTON_MASS planck = 6.62607004e-34 hartree2_j = 4.35974465e-18 hartree2_ev = 27.21138602 hartree2_wavenumber = 2194746313.702 e_charge = 1.6021766208e-19 light_speed_si = 299792458 avogadro = 6.022140857e+23 debye = 3.335641e-30 au2_debye = E_CHARGE * BOHR * 1e-10 / DEBYE
des = 'Desafio-025 strings-004' print ('{}'.format(des)) #Crie um programa que leia o nome de uma pessoa e diga se ela tem "silva" no seu nome. nome = str(input('Digite um nome: ')).strip() print ('Seu nome tem Silva? {}'.format('silva' in nome.lower()))
des = 'Desafio-025 strings-004' print('{}'.format(des)) nome = str(input('Digite um nome: ')).strip() print('Seu nome tem Silva? {}'.format('silva' in nome.lower()))
def is_armstrong_number(number): number_string = str(number) digits = len(number_string) if digits == 1: return True else: armstrong = sum([int(digit) ** digits for digit in number_string]) return number == armstrong
def is_armstrong_number(number): number_string = str(number) digits = len(number_string) if digits == 1: return True else: armstrong = sum([int(digit) ** digits for digit in number_string]) return number == armstrong
REPORT_CASE_INDEX="report_cases_czei39du507m9mmpqk3y01x72a3ux4p0" REPORT_CASE_MAPPING={'_meta': {'comment': '2013-11-05 dmyung', 'created': None}, 'date_detection': False, 'date_formats': ['yyyy-MM-dd', "yyyy-MM-dd'T'HH:mm:ssZZ", "yyyy-MM-dd'T'HH:mm:ss.SSSSSS", "yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'", "yyyy-MM-dd'T'HH:mm:ss'Z'", "yyyy-MM-dd'T'HH:mm:ssZ", "yyyy-MM-dd'T'HH:mm:ssZZ'Z'", "yyyy-MM-dd'T'HH:mm:ss.SSSZZ", "yyyy-MM-dd'T'HH:mm:ss", "yyyy-MM-dd' 'HH:mm:ss", "yyyy-MM-dd' 'HH:mm:ss.SSSSSS", "mm/dd/yy' 'HH:mm:ss"], 'dynamic': True, 'dynamic_templates': [{'everything_else': {'mapping': {'{name}': {'index': 'not_analyzed', 'type': 'string'}}, 'match': '*', 'match_mapping_type': 'string'}}], 'ignore_malformed': True, 'properties': {'actions': {'dynamic': True, 'properties': {'action_type': {'type': 'string'}, 'attachments': {'dynamic': False, 'properties': {'attachment_from': {'type': 'string'}, 'attachment_name': {'type': 'string'}, 'attachment_properties': {'dynamic': False, 'type': 'object'}, 'attachment_size': {'type': 'long'}, 'attachment_src': {'type': 'string'}, 'doc_type': {'index': 'not_analyzed', 'type': 'string'}, 'identifier': {'type': 'string'}, 'server_md5': {'type': 'string'}, 'server_mime': {'type': 'string'}}, 'type': 'object'}, 'date': {'format': "yyyy-MM-dd||yyyy-MM-dd'T'HH:mm:ssZZ||yyyy-MM-dd'T'HH:mm:ss.SSSSSS||yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'||yyyy-MM-dd'T'HH:mm:ss'Z'||yyyy-MM-dd'T'HH:mm:ssZ||yyyy-MM-dd'T'HH:mm:ssZZ'Z'||yyyy-MM-dd'T'HH:mm:ss.SSSZZ||yyyy-MM-dd'T'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss.SSSSSS||mm/dd/yy' 'HH:mm:ss", 'type': 'date'}, 'doc_type': {'index': 'not_analyzed', 'type': 'string'}, 'indices': {'dynamic': False, 'properties': {'doc_type': {'index': 'not_analyzed', 'type': 'string'}, 'identifier': {'type': 'string'}, 'referenced_id': {'type': 'string'}, 'referenced_type': {'type': 'string'}}, 'type': 'object'}, 'server_date': {'format': "yyyy-MM-dd||yyyy-MM-dd'T'HH:mm:ssZZ||yyyy-MM-dd'T'HH:mm:ss.SSSSSS||yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'||yyyy-MM-dd'T'HH:mm:ss'Z'||yyyy-MM-dd'T'HH:mm:ssZ||yyyy-MM-dd'T'HH:mm:ssZZ'Z'||yyyy-MM-dd'T'HH:mm:ss.SSSZZ||yyyy-MM-dd'T'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss.SSSSSS||mm/dd/yy' 'HH:mm:ss", 'type': 'date'}, 'sync_log_id': {'type': 'string'}, 'updated_known_properties': {'dynamic': False, 'type': 'object'}, 'updated_unknown_properties': {'dynamic': False, 'type': 'object'}, 'user_id': {'type': 'string'}, 'xform_id': {'type': 'string'}, 'xform_name': {'type': 'string'}, 'xform_xmlns': {'type': 'string'}}, 'type': 'nested'}, 'case_attachments': {'dynamic': True, 'properties': {'attachment_from': {'type': 'string'}, 'attachment_name': {'type': 'string'}, 'attachment_properties': {'dynamic': False, 'type': 'object'}, 'attachment_size': {'type': 'long'}, 'attachment_src': {'type': 'string'}, 'doc_type': {'index': 'not_analyzed', 'type': 'string'}, 'identifier': {'type': 'string'}, 'server_md5': {'type': 'string'}, 'server_mime': {'type': 'string'}}, 'type': 'object'}, 'closed': {'type': 'boolean'}, 'closed_by': {'type': 'string'}, 'closed_on': {'format': "yyyy-MM-dd||yyyy-MM-dd'T'HH:mm:ssZZ||yyyy-MM-dd'T'HH:mm:ss.SSSSSS||yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'||yyyy-MM-dd'T'HH:mm:ss'Z'||yyyy-MM-dd'T'HH:mm:ssZ||yyyy-MM-dd'T'HH:mm:ssZZ'Z'||yyyy-MM-dd'T'HH:mm:ss.SSSZZ||yyyy-MM-dd'T'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss.SSSSSS||mm/dd/yy' 'HH:mm:ss", 'type': 'date'}, 'computed_': {'enabled': False, 'type': 'object'}, 'computed_modified_on_': {'format': "yyyy-MM-dd||yyyy-MM-dd'T'HH:mm:ssZZ||yyyy-MM-dd'T'HH:mm:ss.SSSSSS||yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'||yyyy-MM-dd'T'HH:mm:ss'Z'||yyyy-MM-dd'T'HH:mm:ssZ||yyyy-MM-dd'T'HH:mm:ssZZ'Z'||yyyy-MM-dd'T'HH:mm:ss.SSSZZ||yyyy-MM-dd'T'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss.SSSSSS||mm/dd/yy' 'HH:mm:ss", 'type': 'date'}, 'doc_type': {'index': 'not_analyzed', 'type': 'string'}, 'domain': {'fields': {'domain': {'index': 'analyzed', 'type': 'string'}, 'exact': {'index': 'not_analyzed', 'type': 'string'}}, 'type': 'multi_field'}, 'export_tag': {'type': 'string'}, 'external_id': {'fields': {'exact': {'index': 'not_analyzed', 'type': 'string'}, 'external_id': {'index': 'analyzed', 'type': 'string'}}, 'type': 'multi_field'}, 'indices': {'dynamic': True, 'properties': {'doc_type': {'index': 'not_analyzed', 'type': 'string'}, 'identifier': {'type': 'string'}, 'referenced_id': {'type': 'string'}, 'referenced_type': {'type': 'string'}}, 'type': 'object'}, 'initial_processing_complete': {'type': 'boolean'}, 'location_id': {'type': 'string'}, 'modified_on': {'format': "yyyy-MM-dd||yyyy-MM-dd'T'HH:mm:ssZZ||yyyy-MM-dd'T'HH:mm:ss.SSSSSS||yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'||yyyy-MM-dd'T'HH:mm:ss'Z'||yyyy-MM-dd'T'HH:mm:ssZ||yyyy-MM-dd'T'HH:mm:ssZZ'Z'||yyyy-MM-dd'T'HH:mm:ss.SSSZZ||yyyy-MM-dd'T'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss.SSSSSS||mm/dd/yy' 'HH:mm:ss", 'type': 'date'}, 'name': {'fields': {'exact': {'index': 'not_analyzed', 'type': 'string'}, 'name': {'index': 'analyzed', 'type': 'string'}}, 'type': 'multi_field'}, 'opened_by': {'type': 'string'}, 'opened_on': {'format': "yyyy-MM-dd||yyyy-MM-dd'T'HH:mm:ssZZ||yyyy-MM-dd'T'HH:mm:ss.SSSSSS||yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'||yyyy-MM-dd'T'HH:mm:ss'Z'||yyyy-MM-dd'T'HH:mm:ssZ||yyyy-MM-dd'T'HH:mm:ssZZ'Z'||yyyy-MM-dd'T'HH:mm:ss.SSSZZ||yyyy-MM-dd'T'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss.SSSSSS||mm/dd/yy' 'HH:mm:ss", 'type': 'date'}, 'owner_id': {'type': 'string'}, 'referrals': {'enabled': False, 'type': 'object'}, 'server_modified_on': {'format': "yyyy-MM-dd||yyyy-MM-dd'T'HH:mm:ssZZ||yyyy-MM-dd'T'HH:mm:ss.SSSSSS||yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'||yyyy-MM-dd'T'HH:mm:ss'Z'||yyyy-MM-dd'T'HH:mm:ssZ||yyyy-MM-dd'T'HH:mm:ssZZ'Z'||yyyy-MM-dd'T'HH:mm:ss.SSSZZ||yyyy-MM-dd'T'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss.SSSSSS||mm/dd/yy' 'HH:mm:ss", 'type': 'date'}, 'type': {'fields': {'exact': {'index': 'not_analyzed', 'type': 'string'}, 'type': {'index': 'analyzed', 'type': 'string'}}, 'type': 'multi_field'}, 'user_id': {'type': 'string'}, 'version': {'type': 'string'}, 'xform_ids': {'index': 'not_analyzed', 'type': 'string'}}}
report_case_index = 'report_cases_czei39du507m9mmpqk3y01x72a3ux4p0' report_case_mapping = {'_meta': {'comment': '2013-11-05 dmyung', 'created': None}, 'date_detection': False, 'date_formats': ['yyyy-MM-dd', "yyyy-MM-dd'T'HH:mm:ssZZ", "yyyy-MM-dd'T'HH:mm:ss.SSSSSS", "yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'", "yyyy-MM-dd'T'HH:mm:ss'Z'", "yyyy-MM-dd'T'HH:mm:ssZ", "yyyy-MM-dd'T'HH:mm:ssZZ'Z'", "yyyy-MM-dd'T'HH:mm:ss.SSSZZ", "yyyy-MM-dd'T'HH:mm:ss", "yyyy-MM-dd' 'HH:mm:ss", "yyyy-MM-dd' 'HH:mm:ss.SSSSSS", "mm/dd/yy' 'HH:mm:ss"], 'dynamic': True, 'dynamic_templates': [{'everything_else': {'mapping': {'{name}': {'index': 'not_analyzed', 'type': 'string'}}, 'match': '*', 'match_mapping_type': 'string'}}], 'ignore_malformed': True, 'properties': {'actions': {'dynamic': True, 'properties': {'action_type': {'type': 'string'}, 'attachments': {'dynamic': False, 'properties': {'attachment_from': {'type': 'string'}, 'attachment_name': {'type': 'string'}, 'attachment_properties': {'dynamic': False, 'type': 'object'}, 'attachment_size': {'type': 'long'}, 'attachment_src': {'type': 'string'}, 'doc_type': {'index': 'not_analyzed', 'type': 'string'}, 'identifier': {'type': 'string'}, 'server_md5': {'type': 'string'}, 'server_mime': {'type': 'string'}}, 'type': 'object'}, 'date': {'format': "yyyy-MM-dd||yyyy-MM-dd'T'HH:mm:ssZZ||yyyy-MM-dd'T'HH:mm:ss.SSSSSS||yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'||yyyy-MM-dd'T'HH:mm:ss'Z'||yyyy-MM-dd'T'HH:mm:ssZ||yyyy-MM-dd'T'HH:mm:ssZZ'Z'||yyyy-MM-dd'T'HH:mm:ss.SSSZZ||yyyy-MM-dd'T'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss.SSSSSS||mm/dd/yy' 'HH:mm:ss", 'type': 'date'}, 'doc_type': {'index': 'not_analyzed', 'type': 'string'}, 'indices': {'dynamic': False, 'properties': {'doc_type': {'index': 'not_analyzed', 'type': 'string'}, 'identifier': {'type': 'string'}, 'referenced_id': {'type': 'string'}, 'referenced_type': {'type': 'string'}}, 'type': 'object'}, 'server_date': {'format': "yyyy-MM-dd||yyyy-MM-dd'T'HH:mm:ssZZ||yyyy-MM-dd'T'HH:mm:ss.SSSSSS||yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'||yyyy-MM-dd'T'HH:mm:ss'Z'||yyyy-MM-dd'T'HH:mm:ssZ||yyyy-MM-dd'T'HH:mm:ssZZ'Z'||yyyy-MM-dd'T'HH:mm:ss.SSSZZ||yyyy-MM-dd'T'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss.SSSSSS||mm/dd/yy' 'HH:mm:ss", 'type': 'date'}, 'sync_log_id': {'type': 'string'}, 'updated_known_properties': {'dynamic': False, 'type': 'object'}, 'updated_unknown_properties': {'dynamic': False, 'type': 'object'}, 'user_id': {'type': 'string'}, 'xform_id': {'type': 'string'}, 'xform_name': {'type': 'string'}, 'xform_xmlns': {'type': 'string'}}, 'type': 'nested'}, 'case_attachments': {'dynamic': True, 'properties': {'attachment_from': {'type': 'string'}, 'attachment_name': {'type': 'string'}, 'attachment_properties': {'dynamic': False, 'type': 'object'}, 'attachment_size': {'type': 'long'}, 'attachment_src': {'type': 'string'}, 'doc_type': {'index': 'not_analyzed', 'type': 'string'}, 'identifier': {'type': 'string'}, 'server_md5': {'type': 'string'}, 'server_mime': {'type': 'string'}}, 'type': 'object'}, 'closed': {'type': 'boolean'}, 'closed_by': {'type': 'string'}, 'closed_on': {'format': "yyyy-MM-dd||yyyy-MM-dd'T'HH:mm:ssZZ||yyyy-MM-dd'T'HH:mm:ss.SSSSSS||yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'||yyyy-MM-dd'T'HH:mm:ss'Z'||yyyy-MM-dd'T'HH:mm:ssZ||yyyy-MM-dd'T'HH:mm:ssZZ'Z'||yyyy-MM-dd'T'HH:mm:ss.SSSZZ||yyyy-MM-dd'T'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss.SSSSSS||mm/dd/yy' 'HH:mm:ss", 'type': 'date'}, 'computed_': {'enabled': False, 'type': 'object'}, 'computed_modified_on_': {'format': "yyyy-MM-dd||yyyy-MM-dd'T'HH:mm:ssZZ||yyyy-MM-dd'T'HH:mm:ss.SSSSSS||yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'||yyyy-MM-dd'T'HH:mm:ss'Z'||yyyy-MM-dd'T'HH:mm:ssZ||yyyy-MM-dd'T'HH:mm:ssZZ'Z'||yyyy-MM-dd'T'HH:mm:ss.SSSZZ||yyyy-MM-dd'T'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss.SSSSSS||mm/dd/yy' 'HH:mm:ss", 'type': 'date'}, 'doc_type': {'index': 'not_analyzed', 'type': 'string'}, 'domain': {'fields': {'domain': {'index': 'analyzed', 'type': 'string'}, 'exact': {'index': 'not_analyzed', 'type': 'string'}}, 'type': 'multi_field'}, 'export_tag': {'type': 'string'}, 'external_id': {'fields': {'exact': {'index': 'not_analyzed', 'type': 'string'}, 'external_id': {'index': 'analyzed', 'type': 'string'}}, 'type': 'multi_field'}, 'indices': {'dynamic': True, 'properties': {'doc_type': {'index': 'not_analyzed', 'type': 'string'}, 'identifier': {'type': 'string'}, 'referenced_id': {'type': 'string'}, 'referenced_type': {'type': 'string'}}, 'type': 'object'}, 'initial_processing_complete': {'type': 'boolean'}, 'location_id': {'type': 'string'}, 'modified_on': {'format': "yyyy-MM-dd||yyyy-MM-dd'T'HH:mm:ssZZ||yyyy-MM-dd'T'HH:mm:ss.SSSSSS||yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'||yyyy-MM-dd'T'HH:mm:ss'Z'||yyyy-MM-dd'T'HH:mm:ssZ||yyyy-MM-dd'T'HH:mm:ssZZ'Z'||yyyy-MM-dd'T'HH:mm:ss.SSSZZ||yyyy-MM-dd'T'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss.SSSSSS||mm/dd/yy' 'HH:mm:ss", 'type': 'date'}, 'name': {'fields': {'exact': {'index': 'not_analyzed', 'type': 'string'}, 'name': {'index': 'analyzed', 'type': 'string'}}, 'type': 'multi_field'}, 'opened_by': {'type': 'string'}, 'opened_on': {'format': "yyyy-MM-dd||yyyy-MM-dd'T'HH:mm:ssZZ||yyyy-MM-dd'T'HH:mm:ss.SSSSSS||yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'||yyyy-MM-dd'T'HH:mm:ss'Z'||yyyy-MM-dd'T'HH:mm:ssZ||yyyy-MM-dd'T'HH:mm:ssZZ'Z'||yyyy-MM-dd'T'HH:mm:ss.SSSZZ||yyyy-MM-dd'T'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss.SSSSSS||mm/dd/yy' 'HH:mm:ss", 'type': 'date'}, 'owner_id': {'type': 'string'}, 'referrals': {'enabled': False, 'type': 'object'}, 'server_modified_on': {'format': "yyyy-MM-dd||yyyy-MM-dd'T'HH:mm:ssZZ||yyyy-MM-dd'T'HH:mm:ss.SSSSSS||yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'||yyyy-MM-dd'T'HH:mm:ss'Z'||yyyy-MM-dd'T'HH:mm:ssZ||yyyy-MM-dd'T'HH:mm:ssZZ'Z'||yyyy-MM-dd'T'HH:mm:ss.SSSZZ||yyyy-MM-dd'T'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss||yyyy-MM-dd' 'HH:mm:ss.SSSSSS||mm/dd/yy' 'HH:mm:ss", 'type': 'date'}, 'type': {'fields': {'exact': {'index': 'not_analyzed', 'type': 'string'}, 'type': {'index': 'analyzed', 'type': 'string'}}, 'type': 'multi_field'}, 'user_id': {'type': 'string'}, 'version': {'type': 'string'}, 'xform_ids': {'index': 'not_analyzed', 'type': 'string'}}}
class Result: pass class CombingResult(Result): def __init__(self, elapsed_time_preprocess: int, elapsed_time_algo: int, hash: int, size_a: int, size_b: int, name_a, name_b): self.hash = hash self.elapsed_time_algo = elapsed_time_algo self.elapsed_time_preprocess = elapsed_time_preprocess self.size_a = size_a self.size_b = size_b self.name_a = name_a self.name_b = name_b class BraidResult(Result): def __init__(self, elapsed_time_preprocess, elapsed_time_algo, hash, n, seed): self.hash = hash self.elapsed_time_algo = elapsed_time_algo self.elapsed_time_preprocess = elapsed_time_preprocess self.n = n self.seed = seed class LCSResult(Result): def __init__(self, elapsed_time_preprocess: int, elapsed_time_algo: int, score: int, size_a: int, size_b: int, name_a, name_b): self.score = score self.elapsed_time_algo = elapsed_time_algo self.elapsed_time_preprocess = elapsed_time_preprocess self.size_a = size_a self.size_b = size_b self.name_a = name_a self.name_b = name_b
class Result: pass class Combingresult(Result): def __init__(self, elapsed_time_preprocess: int, elapsed_time_algo: int, hash: int, size_a: int, size_b: int, name_a, name_b): self.hash = hash self.elapsed_time_algo = elapsed_time_algo self.elapsed_time_preprocess = elapsed_time_preprocess self.size_a = size_a self.size_b = size_b self.name_a = name_a self.name_b = name_b class Braidresult(Result): def __init__(self, elapsed_time_preprocess, elapsed_time_algo, hash, n, seed): self.hash = hash self.elapsed_time_algo = elapsed_time_algo self.elapsed_time_preprocess = elapsed_time_preprocess self.n = n self.seed = seed class Lcsresult(Result): def __init__(self, elapsed_time_preprocess: int, elapsed_time_algo: int, score: int, size_a: int, size_b: int, name_a, name_b): self.score = score self.elapsed_time_algo = elapsed_time_algo self.elapsed_time_preprocess = elapsed_time_preprocess self.size_a = size_a self.size_b = size_b self.name_a = name_a self.name_b = name_b
# Defining constants # TODO: add all species and experiments # TODO mapping RNA_SEQ_LIST = ['files/Caenorhabditis_elegans_RNA-Seq_read_counts_TPM_FPKM_GSE16552.tsv'] AFF_LIST = ['files/Caenorhabditis_elegans_probesets_GSE19972_A-AFFY-60_gcRMA.tsv'] exp_dict = {} for file in RNA_SEQ_LIST: # Opening the library file with open(file) as lib_file: lib_file.readline() for line in lib_file: line = line.strip().split('\t') if line[3] not in exp_dict: exp_dict[line[3]] = {'tissue_name': [], 'stage': [], 'FPKM': [], 'presence': []} else: if line[5].replace('"', '') not in exp_dict[line[3]]['tissue_name'] \ and line[7].replace('"','') not in exp_dict[line[3]]['stage'] \ and line[12] not in exp_dict[line[3]]['FPKM'] \ and line[13] not in exp_dict[line[3]]['presence']: exp_dict[line[3]]['tissue_name'].append(line[5].replace('"','')) exp_dict[line[3]]['stage'].append(line[7].replace('"', '')) exp_dict[line[3]]['FPKM'].append(line[12]) exp_dict[line[3]]['presence'].append(line[13]) chip_dict = {} for file in AFF_LIST: with open(file) as chipfile: chipfile.readline() for line in chipfile: line = line.strip().split('\t') if line[3] not in chip_dict: chip_dict[line[3]] = {'tissue_name': [], 'stage': [], 'MAS5': [], 'presence': []} else: if line[5].replace('"', '') not in chip_dict[line[3]]['tissue_name'] \ and line[7].replace('"','') not in chip_dict[line[3]]['stage'] \ and line[10] not in chip_dict[line[3]]['MAS5'] \ and line[11] not in chip_dict[line[3]]['presence']: chip_dict[line[3]]['tissue_name'].append(line[5].replace('"','')) chip_dict[line[3]]['stage'].append(line[7].replace('"', '')) chip_dict[line[3]]['MAS5'].append(line[10]) chip_dict[line[3]]['presence'].append(line[11]) print(exp_dict['WBGene00173312']) print(chip_dict['WBGene00000027'])
rna_seq_list = ['files/Caenorhabditis_elegans_RNA-Seq_read_counts_TPM_FPKM_GSE16552.tsv'] aff_list = ['files/Caenorhabditis_elegans_probesets_GSE19972_A-AFFY-60_gcRMA.tsv'] exp_dict = {} for file in RNA_SEQ_LIST: with open(file) as lib_file: lib_file.readline() for line in lib_file: line = line.strip().split('\t') if line[3] not in exp_dict: exp_dict[line[3]] = {'tissue_name': [], 'stage': [], 'FPKM': [], 'presence': []} elif line[5].replace('"', '') not in exp_dict[line[3]]['tissue_name'] and line[7].replace('"', '') not in exp_dict[line[3]]['stage'] and (line[12] not in exp_dict[line[3]]['FPKM']) and (line[13] not in exp_dict[line[3]]['presence']): exp_dict[line[3]]['tissue_name'].append(line[5].replace('"', '')) exp_dict[line[3]]['stage'].append(line[7].replace('"', '')) exp_dict[line[3]]['FPKM'].append(line[12]) exp_dict[line[3]]['presence'].append(line[13]) chip_dict = {} for file in AFF_LIST: with open(file) as chipfile: chipfile.readline() for line in chipfile: line = line.strip().split('\t') if line[3] not in chip_dict: chip_dict[line[3]] = {'tissue_name': [], 'stage': [], 'MAS5': [], 'presence': []} elif line[5].replace('"', '') not in chip_dict[line[3]]['tissue_name'] and line[7].replace('"', '') not in chip_dict[line[3]]['stage'] and (line[10] not in chip_dict[line[3]]['MAS5']) and (line[11] not in chip_dict[line[3]]['presence']): chip_dict[line[3]]['tissue_name'].append(line[5].replace('"', '')) chip_dict[line[3]]['stage'].append(line[7].replace('"', '')) chip_dict[line[3]]['MAS5'].append(line[10]) chip_dict[line[3]]['presence'].append(line[11]) print(exp_dict['WBGene00173312']) print(chip_dict['WBGene00000027'])
s= raw_input() if s=="yes" or s=="YES" or s=="Yes": print ("Yes") else: print ("No")
s = raw_input() if s == 'yes' or s == 'YES' or s == 'Yes': print('Yes') else: print('No')
# automatically generated by the FlatBuffers compiler, do not modify # namespace: io class DriverType(object): UNDEFINED = 0 LIBHDFS = 1 LIBHDFS3 = 2
class Drivertype(object): undefined = 0 libhdfs = 1 libhdfs3 = 2
''' Created on 1.11.2016 @author: Samuli Rahkonen ''' def kbinterrupt_decorate(func): ''' Decorator. Adds KeyboardInterrupt handling to ControllerBase methods. ''' def func_wrapper(*args, **kwargs): try: return func(*args, **kwargs) except KeyboardInterrupt: this = args[0] this._abort() raise return func_wrapper def wait_decorate(func): ''' Decorator. Adds waiting ''' def func_wrapper(*args, **kwargs): this = args[0] wait = kwargs['wait'] func(*args, **kwargs) if wait: this.x.wait_to_finish() return func_wrapper
""" Created on 1.11.2016 @author: Samuli Rahkonen """ def kbinterrupt_decorate(func): """ Decorator. Adds KeyboardInterrupt handling to ControllerBase methods. """ def func_wrapper(*args, **kwargs): try: return func(*args, **kwargs) except KeyboardInterrupt: this = args[0] this._abort() raise return func_wrapper def wait_decorate(func): """ Decorator. Adds waiting """ def func_wrapper(*args, **kwargs): this = args[0] wait = kwargs['wait'] func(*args, **kwargs) if wait: this.x.wait_to_finish() return func_wrapper
class BaseLayout(object): @classmethod def render(cls, items): raise NotImplementedError
class Baselayout(object): @classmethod def render(cls, items): raise NotImplementedError
# THIS FILE IS GENERATED FROM THEANO SETUP.PY short_version = '0.9.0beta1' version = '0.9.0beta1' git_revision = 'RELEASE' full_version = '0.9.0beta1.dev-%(git_revision)s' % { 'git_revision': git_revision} release = False if not release: version = full_version
short_version = '0.9.0beta1' version = '0.9.0beta1' git_revision = 'RELEASE' full_version = '0.9.0beta1.dev-%(git_revision)s' % {'git_revision': git_revision} release = False if not release: version = full_version
#!/usr/bin/env python3 # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 BUCKET_NAME_BKT = "aws-saas-s3" BUCKET_NAME_PFX = "aws-saas-s3-prefix" BUCKET_NAME_TAG = "aws-saas-s3-tag" BUCKET_NAME_AP = "aws-saas-s3-ap" BUCKET_NAME_NSDB = "aws-saas-s3-dbns"
bucket_name_bkt = 'aws-saas-s3' bucket_name_pfx = 'aws-saas-s3-prefix' bucket_name_tag = 'aws-saas-s3-tag' bucket_name_ap = 'aws-saas-s3-ap' bucket_name_nsdb = 'aws-saas-s3-dbns'
''' The provided code stub reads and integer, n, from STDIN. For all non-negative integers i<n, print i^2. ''' if __name__ == '__main__': n = int(input()) for i in range(n): print(i**2)
""" The provided code stub reads and integer, n, from STDIN. For all non-negative integers i<n, print i^2. """ if __name__ == '__main__': n = int(input()) for i in range(n): print(i ** 2)
# # PySNMP MIB module CISCO-SYSLOG-CAPABILITY (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-SYSLOG-CAPABILITY # Produced by pysmi-0.3.4 at Wed May 1 12:13:49 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") ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint, ConstraintsUnion, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsUnion", "ConstraintsIntersection") ciscoAgentCapability, = mibBuilder.importSymbols("CISCO-SMI", "ciscoAgentCapability") ModuleCompliance, NotificationGroup, AgentCapabilities = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "AgentCapabilities") Counter64, Bits, Integer32, TimeTicks, IpAddress, iso, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, Unsigned32, ModuleIdentity, NotificationType, Gauge32, Counter32, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "Bits", "Integer32", "TimeTicks", "IpAddress", "iso", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "Unsigned32", "ModuleIdentity", "NotificationType", "Gauge32", "Counter32", "MibIdentifier") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") ciscoSyslogCapability = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 7, 61)) ciscoSyslogCapability.setRevisions(('2010-01-22 14:32', '2008-08-11 00:00', '2008-06-08 00:00', '2006-10-26 00:00', '2006-05-25 00:00', '2004-02-03 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: ciscoSyslogCapability.setRevisionsDescriptions(('Added capability for Visual Quality Experience Server (VQE-S) and Visual Quality Experience Tools (VQE-TOOLS) platforms.', 'Adding newlines at the end of the MIB file.', 'Added Agent capability for ACE 4710 Application Control Engine Appliance.', 'Added capability for Cisco TelePresence System (CTS) and Cisco TelePresence Manager (CTM) platforms.', 'Added Agent capability ciscoSyslogCapACSWV03R000 for Application Control Engine (ACE).', 'Initial version of this MIB module.',)) if mibBuilder.loadTexts: ciscoSyslogCapability.setLastUpdated('201001221432Z') if mibBuilder.loadTexts: ciscoSyslogCapability.setOrganization('Cisco Systems, Inc.') if mibBuilder.loadTexts: ciscoSyslogCapability.setContactInfo('Cisco Systems Customer Service Postal: 170 West Tasman Drive San Jose, CA 95134 USA Tel: +1 800 553-NETS E-mail: cs-lan-switch-snmp@cisco.com cs-snmp@cisco.com') if mibBuilder.loadTexts: ciscoSyslogCapability.setDescription('The capabilities description of CISCO-SYSLOG-MIB.') ciscoSyslogCapCatOSV08R0101 = AgentCapabilities((1, 3, 6, 1, 4, 1, 9, 7, 61, 1)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoSyslogCapCatOSV08R0101 = ciscoSyslogCapCatOSV08R0101.setProductRelease('Cisco CatOS 8.1(1).') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoSyslogCapCatOSV08R0101 = ciscoSyslogCapCatOSV08R0101.setStatus('current') if mibBuilder.loadTexts: ciscoSyslogCapCatOSV08R0101.setDescription('CISCO-SYSLOG-MIB capabilities.') ciscoSyslogCapACSWV03R000 = AgentCapabilities((1, 3, 6, 1, 4, 1, 9, 7, 61, 2)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoSyslogCapACSWV03R000 = ciscoSyslogCapACSWV03R000.setProductRelease('ACSW (Application Control Software) 3.0\n \n for Application Control Engine(ACE)\n\n Service Module.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoSyslogCapACSWV03R000 = ciscoSyslogCapACSWV03R000.setStatus('current') if mibBuilder.loadTexts: ciscoSyslogCapACSWV03R000.setDescription('CISCO-SYSLOG-MIB capabilities.') ciscoSyslogCapCTSV100 = AgentCapabilities((1, 3, 6, 1, 4, 1, 9, 7, 61, 3)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoSyslogCapCTSV100 = ciscoSyslogCapCTSV100.setProductRelease('Cisco TelePresence System (CTS) 1.0.0.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoSyslogCapCTSV100 = ciscoSyslogCapCTSV100.setStatus('current') if mibBuilder.loadTexts: ciscoSyslogCapCTSV100.setDescription('CISCO-SYSLOG-MIB capabilities.') ciscoSyslogCapCTMV1000 = AgentCapabilities((1, 3, 6, 1, 4, 1, 9, 7, 61, 4)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoSyslogCapCTMV1000 = ciscoSyslogCapCTMV1000.setProductRelease('Cisco TelePresence Manager (CTM) 1.0.0.0.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoSyslogCapCTMV1000 = ciscoSyslogCapCTMV1000.setStatus('current') if mibBuilder.loadTexts: ciscoSyslogCapCTMV1000.setDescription('CISCO-SYSLOG-MIB capabilities.') ciscoSyslogCapc4710aceVA1R70 = AgentCapabilities((1, 3, 6, 1, 4, 1, 9, 7, 61, 5)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoSyslogCapc4710aceVA1R70 = ciscoSyslogCapc4710aceVA1R70.setProductRelease('ACSW (Application Control Software) A1(7)\n for ACE 4710 Application Control Engine \n Appliance.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoSyslogCapc4710aceVA1R70 = ciscoSyslogCapc4710aceVA1R70.setStatus('current') if mibBuilder.loadTexts: ciscoSyslogCapc4710aceVA1R70.setDescription('CISCO-SYSLOG-MIB capabilities.') ciscoSyslogCapVqe = AgentCapabilities((1, 3, 6, 1, 4, 1, 9, 7, 61, 6)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoSyslogCapVqe = ciscoSyslogCapVqe.setProductRelease('VQE 3.5 release.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoSyslogCapVqe = ciscoSyslogCapVqe.setStatus('current') if mibBuilder.loadTexts: ciscoSyslogCapVqe.setDescription('CISCO-SYSLOG-MIB capabilities.') mibBuilder.exportSymbols("CISCO-SYSLOG-CAPABILITY", ciscoSyslogCapability=ciscoSyslogCapability, PYSNMP_MODULE_ID=ciscoSyslogCapability, ciscoSyslogCapCatOSV08R0101=ciscoSyslogCapCatOSV08R0101, ciscoSyslogCapVqe=ciscoSyslogCapVqe, ciscoSyslogCapACSWV03R000=ciscoSyslogCapACSWV03R000, ciscoSyslogCapCTMV1000=ciscoSyslogCapCTMV1000, ciscoSyslogCapc4710aceVA1R70=ciscoSyslogCapc4710aceVA1R70, ciscoSyslogCapCTSV100=ciscoSyslogCapCTSV100)
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, single_value_constraint, constraints_union, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ValueSizeConstraint', 'SingleValueConstraint', 'ConstraintsUnion', 'ConstraintsIntersection') (cisco_agent_capability,) = mibBuilder.importSymbols('CISCO-SMI', 'ciscoAgentCapability') (module_compliance, notification_group, agent_capabilities) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup', 'AgentCapabilities') (counter64, bits, integer32, time_ticks, ip_address, iso, mib_scalar, mib_table, mib_table_row, mib_table_column, object_identity, unsigned32, module_identity, notification_type, gauge32, counter32, mib_identifier) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter64', 'Bits', 'Integer32', 'TimeTicks', 'IpAddress', 'iso', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ObjectIdentity', 'Unsigned32', 'ModuleIdentity', 'NotificationType', 'Gauge32', 'Counter32', 'MibIdentifier') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') cisco_syslog_capability = module_identity((1, 3, 6, 1, 4, 1, 9, 7, 61)) ciscoSyslogCapability.setRevisions(('2010-01-22 14:32', '2008-08-11 00:00', '2008-06-08 00:00', '2006-10-26 00:00', '2006-05-25 00:00', '2004-02-03 00:00')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: ciscoSyslogCapability.setRevisionsDescriptions(('Added capability for Visual Quality Experience Server (VQE-S) and Visual Quality Experience Tools (VQE-TOOLS) platforms.', 'Adding newlines at the end of the MIB file.', 'Added Agent capability for ACE 4710 Application Control Engine Appliance.', 'Added capability for Cisco TelePresence System (CTS) and Cisco TelePresence Manager (CTM) platforms.', 'Added Agent capability ciscoSyslogCapACSWV03R000 for Application Control Engine (ACE).', 'Initial version of this MIB module.')) if mibBuilder.loadTexts: ciscoSyslogCapability.setLastUpdated('201001221432Z') if mibBuilder.loadTexts: ciscoSyslogCapability.setOrganization('Cisco Systems, Inc.') if mibBuilder.loadTexts: ciscoSyslogCapability.setContactInfo('Cisco Systems Customer Service Postal: 170 West Tasman Drive San Jose, CA 95134 USA Tel: +1 800 553-NETS E-mail: cs-lan-switch-snmp@cisco.com cs-snmp@cisco.com') if mibBuilder.loadTexts: ciscoSyslogCapability.setDescription('The capabilities description of CISCO-SYSLOG-MIB.') cisco_syslog_cap_cat_osv08_r0101 = agent_capabilities((1, 3, 6, 1, 4, 1, 9, 7, 61, 1)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_syslog_cap_cat_osv08_r0101 = ciscoSyslogCapCatOSV08R0101.setProductRelease('Cisco CatOS 8.1(1).') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_syslog_cap_cat_osv08_r0101 = ciscoSyslogCapCatOSV08R0101.setStatus('current') if mibBuilder.loadTexts: ciscoSyslogCapCatOSV08R0101.setDescription('CISCO-SYSLOG-MIB capabilities.') cisco_syslog_cap_acswv03_r000 = agent_capabilities((1, 3, 6, 1, 4, 1, 9, 7, 61, 2)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_syslog_cap_acswv03_r000 = ciscoSyslogCapACSWV03R000.setProductRelease('ACSW (Application Control Software) 3.0\n \n for Application Control Engine(ACE)\n\n Service Module.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_syslog_cap_acswv03_r000 = ciscoSyslogCapACSWV03R000.setStatus('current') if mibBuilder.loadTexts: ciscoSyslogCapACSWV03R000.setDescription('CISCO-SYSLOG-MIB capabilities.') cisco_syslog_cap_ctsv100 = agent_capabilities((1, 3, 6, 1, 4, 1, 9, 7, 61, 3)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_syslog_cap_ctsv100 = ciscoSyslogCapCTSV100.setProductRelease('Cisco TelePresence System (CTS) 1.0.0.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_syslog_cap_ctsv100 = ciscoSyslogCapCTSV100.setStatus('current') if mibBuilder.loadTexts: ciscoSyslogCapCTSV100.setDescription('CISCO-SYSLOG-MIB capabilities.') cisco_syslog_cap_ctmv1000 = agent_capabilities((1, 3, 6, 1, 4, 1, 9, 7, 61, 4)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_syslog_cap_ctmv1000 = ciscoSyslogCapCTMV1000.setProductRelease('Cisco TelePresence Manager (CTM) 1.0.0.0.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_syslog_cap_ctmv1000 = ciscoSyslogCapCTMV1000.setStatus('current') if mibBuilder.loadTexts: ciscoSyslogCapCTMV1000.setDescription('CISCO-SYSLOG-MIB capabilities.') cisco_syslog_capc4710ace_va1_r70 = agent_capabilities((1, 3, 6, 1, 4, 1, 9, 7, 61, 5)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_syslog_capc4710ace_va1_r70 = ciscoSyslogCapc4710aceVA1R70.setProductRelease('ACSW (Application Control Software) A1(7)\n for ACE 4710 Application Control Engine \n Appliance.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_syslog_capc4710ace_va1_r70 = ciscoSyslogCapc4710aceVA1R70.setStatus('current') if mibBuilder.loadTexts: ciscoSyslogCapc4710aceVA1R70.setDescription('CISCO-SYSLOG-MIB capabilities.') cisco_syslog_cap_vqe = agent_capabilities((1, 3, 6, 1, 4, 1, 9, 7, 61, 6)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_syslog_cap_vqe = ciscoSyslogCapVqe.setProductRelease('VQE 3.5 release.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_syslog_cap_vqe = ciscoSyslogCapVqe.setStatus('current') if mibBuilder.loadTexts: ciscoSyslogCapVqe.setDescription('CISCO-SYSLOG-MIB capabilities.') mibBuilder.exportSymbols('CISCO-SYSLOG-CAPABILITY', ciscoSyslogCapability=ciscoSyslogCapability, PYSNMP_MODULE_ID=ciscoSyslogCapability, ciscoSyslogCapCatOSV08R0101=ciscoSyslogCapCatOSV08R0101, ciscoSyslogCapVqe=ciscoSyslogCapVqe, ciscoSyslogCapACSWV03R000=ciscoSyslogCapACSWV03R000, ciscoSyslogCapCTMV1000=ciscoSyslogCapCTMV1000, ciscoSyslogCapc4710aceVA1R70=ciscoSyslogCapc4710aceVA1R70, ciscoSyslogCapCTSV100=ciscoSyslogCapCTSV100)
princ_amount = float(input(" Please Enter the Principal Amount : ")) rate_of_int = float(input(" Please Enter the Rate Of Interest : ")) time_period = float(input(" Please Enter Time period in Years : ")) simple_interest = (princ_amount * rate_of_int * time_period) / 100 print("\nSimple Interest for Principal Amount {0} = {1}".format(princ_amount, simple_interest))
princ_amount = float(input(' Please Enter the Principal Amount : ')) rate_of_int = float(input(' Please Enter the Rate Of Interest : ')) time_period = float(input(' Please Enter Time period in Years : ')) simple_interest = princ_amount * rate_of_int * time_period / 100 print('\nSimple Interest for Principal Amount {0} = {1}'.format(princ_amount, simple_interest))
M = int(input()) a = {int(i) for i in input().split()} N = int(input()) b = {int(i) for i in input().split()} c = sorted(a.symmetric_difference(b)) [print(i) for i in c]
m = int(input()) a = {int(i) for i in input().split()} n = int(input()) b = {int(i) for i in input().split()} c = sorted(a.symmetric_difference(b)) [print(i) for i in c]
class Solution: def totalNQueens(self, n: int) -> int: path = [-1] * n used = [False] * n cnt = 0 def backtrack(k): ''' k is the current level, 0-idexed ''' nonlocal path, used, cnt if k == n: cnt += 1 return for i in range(n): if used[i]: continue # check (k, i) with others illegal = False cur_row = k - 1 cur_col = i - 1 while cur_row >= 0 and cur_col >= 0: if path[cur_row] == cur_col: illegal = True break cur_row -= 1 cur_col -= 1 if illegal: continue cur_row = k - 1 cur_col = i + 1 while cur_row >= 0 and cur_col < n: if path[cur_row] == cur_col: illegal = True break cur_row -= 1 cur_col += 1 if illegal: continue # legal position used[i] = True path[k] = i backtrack(k+1) used[i] = False path[k] = -1 return backtrack(0) return cnt
class Solution: def total_n_queens(self, n: int) -> int: path = [-1] * n used = [False] * n cnt = 0 def backtrack(k): """ k is the current level, 0-idexed """ nonlocal path, used, cnt if k == n: cnt += 1 return for i in range(n): if used[i]: continue illegal = False cur_row = k - 1 cur_col = i - 1 while cur_row >= 0 and cur_col >= 0: if path[cur_row] == cur_col: illegal = True break cur_row -= 1 cur_col -= 1 if illegal: continue cur_row = k - 1 cur_col = i + 1 while cur_row >= 0 and cur_col < n: if path[cur_row] == cur_col: illegal = True break cur_row -= 1 cur_col += 1 if illegal: continue used[i] = True path[k] = i backtrack(k + 1) used[i] = False path[k] = -1 return backtrack(0) return cnt
# # PySNMP MIB module SIP-REGISTRAR-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SIP-REGISTRAR-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:04:26 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, ValueSizeConstraint, ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion") applIndex, = mibBuilder.importSymbols("NETWORK-SERVICES-MIB", "applIndex") sipMIB, = mibBuilder.importSymbols("SIP-MIB-SMI", "sipMIB") SipServerActions, = mibBuilder.importSymbols("SIP-TC", "SipServerActions") SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString") ObjectGroup, NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "NotificationGroup", "ModuleCompliance") Counter32, Integer32, IpAddress, MibIdentifier, iso, ObjectIdentity, Bits, Gauge32, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, TimeTicks, ModuleIdentity, NotificationType, Unsigned32 = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "Integer32", "IpAddress", "MibIdentifier", "iso", "ObjectIdentity", "Bits", "Gauge32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "TimeTicks", "ModuleIdentity", "NotificationType", "Unsigned32") TimeStamp, DateAndTime, TextualConvention, DisplayString, TruthValue, RowStatus = mibBuilder.importSymbols("SNMPv2-TC", "TimeStamp", "DateAndTime", "TextualConvention", "DisplayString", "TruthValue", "RowStatus") sipRegistrarMIB = ModuleIdentity((1, 3, 6, 1, 2, 1, 9998, 5)) if mibBuilder.loadTexts: sipRegistrarMIB.setLastUpdated('200007080000Z') if mibBuilder.loadTexts: sipRegistrarMIB.setOrganization('IETF SIP Working Group, SIP MIB Team') if mibBuilder.loadTexts: sipRegistrarMIB.setContactInfo('SIP MIB Team email: sip-mib@egroups.com Co-editor Kevin Lingle Cisco Systems, Inc. postal: 7025 Kit Creek Road P.O. Box 14987 Research Triangle Park, NC 27709 USA email: klingle@cisco.com phone: +1-919-392-2029 Co-editor Joon Maeng VTEL Corporation postal: 108 Wild Basin Rd. Austin, TX 78746 USA email: joon_maeng@vtel.com phone: +1-512-437-4567 Co-editor Dave Walker SS8 Networks, Inc. postal: 80 Hines Road Kanata, ON K2K 2T8 Canada email: drwalker@ss8networks.com phone: +1 613 592 2100') if mibBuilder.loadTexts: sipRegistrarMIB.setDescription('Initial version of Session Initiation Protocol (SIP) Registrar MIB module. SIP is an application-layer signalling protocol for creating, modifying and terminating multimedia sessions with one or more participants. These sessions include Internet multimedia conferences and Internet telephone calls. SIP is defined in RFC 2543 (March 1999). A Registrar is a server that accepts REGISTER requests. A Registrar is typically co-located with a Proxy or Redirect Server.') sipRegCfg = MibIdentifier((1, 3, 6, 1, 2, 1, 9998, 5, 1)) sipRegStats = MibIdentifier((1, 3, 6, 1, 2, 1, 9998, 5, 2)) sipRegCfgTable = MibTable((1, 3, 6, 1, 2, 1, 9998, 5, 1, 1), ) if mibBuilder.loadTexts: sipRegCfgTable.setStatus('current') if mibBuilder.loadTexts: sipRegCfgTable.setDescription('This table contains configuration objects applicable SIP registrars. Each row represents those objects for a particular SIP registrar present in this system. The instances of SIP registrars are uniquely identified by applIndex.') sipRegCfgEntry = MibTableRow((1, 3, 6, 1, 2, 1, 9998, 5, 1, 1, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex")) if mibBuilder.loadTexts: sipRegCfgEntry.setStatus('current') if mibBuilder.loadTexts: sipRegCfgEntry.setDescription('A row of common configuration.') sipRegAllowThirdParty = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 5, 1, 1, 1, 1), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: sipRegAllowThirdParty.setReference('RFC 2543, Section 4.2.6') if mibBuilder.loadTexts: sipRegAllowThirdParty.setStatus('current') if mibBuilder.loadTexts: sipRegAllowThirdParty.setDescription('This object specifies whether or not the Registrar should allows third party registrations. In third-party registration, the entity issuing the request (in the From header) is different from the entity being registered (in the To header) to whom the provided Contact information applies. If the value of this object is TRUE, the Registrar allows third party registrations. If the value is FALSE, third party registrations are rejected: a 403 Forbidden status code is returned to the requestor.') sipRegContactDfltExpiryDuration = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 5, 1, 1, 1, 2), Unsigned32().clone(3600)).setUnits('seconds').setMaxAccess("readwrite") if mibBuilder.loadTexts: sipRegContactDfltExpiryDuration.setReference('RFC 2543, Section 4.2.6') if mibBuilder.loadTexts: sipRegContactDfltExpiryDuration.setStatus('current') if mibBuilder.loadTexts: sipRegContactDfltExpiryDuration.setDescription('This object specifies the default expiration (time-to- live) of Contact information that is provided by User Agents when registering with this Registrar. This value is only used when no expiration has been specified by the user in the REGISTER request. If the value is applied to a registration and is different from the default (one hour), the server must return the value to the registered User Agent. The value contained in this object only applies if the value of the sipContactDfltExpiryDate object is NULL. If the value of this object applies, and is zero, then no default expiry is applied to registered contact information.') sipRegContactDfltExpiryDate = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 5, 1, 1, 1, 3), DateAndTime()).setMaxAccess("readwrite") if mibBuilder.loadTexts: sipRegContactDfltExpiryDate.setReference('RFC 2543, Section 4.2.6') if mibBuilder.loadTexts: sipRegContactDfltExpiryDate.setStatus('current') if mibBuilder.loadTexts: sipRegContactDfltExpiryDate.setDescription('This object specifies the default expiration date (time- to-live) of Contact information that is provided by User Agents when registering with this Registrar. This value is only used when no expiration has been specified by the user in the REGISTER request. If this value is applied to a registration, the server must return the value to the registered User Agent. The value contained in this object only applies if the value of the sipContactDfltExpiryDuration object is zero. If the value of this object applies, and is NULL, then no default expiry is applied to registered contact information.') sipRegMaxContactExpiryDate = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 5, 1, 1, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295)).clone(4294967295)).setUnits('seconds').setMaxAccess("readwrite") if mibBuilder.loadTexts: sipRegMaxContactExpiryDate.setStatus('current') if mibBuilder.loadTexts: sipRegMaxContactExpiryDate.setDescription('This object specifies the maximum expiry that may be requested by a User Agent for a particular Contact. User Agents can specify expiry using either an Expiry header in a REGISTER request, or using an Expires parameter in a Contact header in a REGISTER request. If the value requested by the User Agent is greater than the value of this object, then the contact information is given the duration specified by this object, and that duration is indicated to the User Agent in the response.') sipRegRespHasContacts = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 5, 1, 1, 1, 5), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: sipRegRespHasContacts.setStatus('current') if mibBuilder.loadTexts: sipRegRespHasContacts.setDescription('This object specifies whether or not the Registrar should return all currently reachable locations for a successfully registering party in the REGISTER response message. If the value of this object is TRUE, the Registrar returns the locations in the REGISTER response. If the value is FALSE, no location information is provided.') sipRegMaxUsers = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 5, 1, 1, 1, 6), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))).setMaxAccess("readonly") if mibBuilder.loadTexts: sipRegMaxUsers.setStatus('current') if mibBuilder.loadTexts: sipRegMaxUsers.setDescription('This object specifies the maximum number of users that the registrar supports. The current number of users is reflected by sipRegCurrentUsers.') sipRegCurrentUsers = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 5, 1, 1, 1, 7), Gauge32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly") if mibBuilder.loadTexts: sipRegCurrentUsers.setStatus('current') if mibBuilder.loadTexts: sipRegCurrentUsers.setDescription('This object specifies the number of users currently configured on the registrar.') sipRegUserTable = MibTable((1, 3, 6, 1, 2, 1, 9998, 5, 1, 2), ) if mibBuilder.loadTexts: sipRegUserTable.setStatus('current') if mibBuilder.loadTexts: sipRegUserTable.setDescription('This table contains information on all users registered to each Registrar in this system. The instances of SIP Registrar are uniquely identified by applIndex.') sipRegUserEntry = MibTableRow((1, 3, 6, 1, 2, 1, 9998, 5, 1, 2, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"), (0, "SIP-REGISTRAR-MIB", "sipUserIndex")) if mibBuilder.loadTexts: sipRegUserEntry.setStatus('current') if mibBuilder.loadTexts: sipRegUserEntry.setDescription('This entry contains information for a single user registered to this Registrar.') sipUserIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 5, 1, 2, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))) if mibBuilder.loadTexts: sipUserIndex.setStatus('current') if mibBuilder.loadTexts: sipUserIndex.setDescription('This object uniquely identifies a conceptual row in the table.') sipUserUri = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 5, 1, 2, 1, 2), SnmpAdminString()).setMaxAccess("readcreate") if mibBuilder.loadTexts: sipUserUri.setStatus('current') if mibBuilder.loadTexts: sipUserUri.setDescription("This object contains the user's address-of-record. It is the main form by which the registrar knows the user. The format is typically 'user@domain'. It is contained in the To header for all REGISTER requests.") sipUserPassword = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 5, 1, 2, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readcreate") if mibBuilder.loadTexts: sipUserPassword.setStatus('current') if mibBuilder.loadTexts: sipUserPassword.setDescription('This object specifies the password that the user must enter when being authenticated.') sipUserAuthenticationFailures = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 5, 1, 2, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: sipUserAuthenticationFailures.setStatus('current') if mibBuilder.loadTexts: sipUserAuthenticationFailures.setDescription('This object contains a count of the number of times the user has failed authentication.') sipUserTableRowStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 5, 1, 2, 1, 5), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: sipUserTableRowStatus.setStatus('current') if mibBuilder.loadTexts: sipUserTableRowStatus.setDescription('The row status of the entry. This object is required to create or delete rows remotely by a manager.') sipContactTable = MibTable((1, 3, 6, 1, 2, 1, 9998, 5, 1, 3), ) if mibBuilder.loadTexts: sipContactTable.setStatus('current') if mibBuilder.loadTexts: sipContactTable.setDescription('This table contains information on every location where a registered user (specified by sipUserIndex) wishes to be found (i.e. has provided Contact information) to each SIP Registrar in this system. The instances of SIP Registrar are uniquely identified by applIndex.') sipContactEntry = MibTableRow((1, 3, 6, 1, 2, 1, 9998, 5, 1, 3, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"), (0, "SIP-REGISTRAR-MIB", "sipUserIndex"), (0, "SIP-REGISTRAR-MIB", "sipContactIndex")) if mibBuilder.loadTexts: sipContactEntry.setStatus('current') if mibBuilder.loadTexts: sipContactEntry.setDescription('This entry contains information for a single Contact. Multiple contacts may exist for a single user.') sipContactIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 5, 1, 3, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))) if mibBuilder.loadTexts: sipContactIndex.setStatus('current') if mibBuilder.loadTexts: sipContactIndex.setDescription('Along with the sipUserIndex, this object uniquely identifies a conceptual row in the table.') sipContactDisplayName = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 5, 1, 3, 1, 2), SnmpAdminString()).setMaxAccess("readonly") if mibBuilder.loadTexts: sipContactDisplayName.setStatus('current') if mibBuilder.loadTexts: sipContactDisplayName.setDescription("This object contains the display name for the Contact. For example, 'Santa at Home', or 'Santa on his Sled', corresponding to contact URLs of sip:BigGuy@sip.northpole.ca or sip:sclaus817@sip.mobile.com, respectively.") sipContactURI = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 5, 1, 3, 1, 3), SnmpAdminString()).setMaxAccess("readonly") if mibBuilder.loadTexts: sipContactURI.setStatus('current') if mibBuilder.loadTexts: sipContactURI.setDescription('This object contains either a SIP URL or a URI where the user can be contacted. This URI is normally returned to a client from a redirect server, or is used as the RequestURI in a SIP request line for requests forwarded by a proxy.') sipContactLastUpdated = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 5, 1, 3, 1, 4), TimeStamp()).setMaxAccess("readonly") if mibBuilder.loadTexts: sipContactLastUpdated.setStatus('current') if mibBuilder.loadTexts: sipContactLastUpdated.setDescription('This object indicates the time when this contact information was accepted. If the contact information is updated via a subsequent REGISTER of the same information, this object is also updated.') sipContactExpiry = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 5, 1, 3, 1, 5), DateAndTime()).setMaxAccess("readonly") if mibBuilder.loadTexts: sipContactExpiry.setStatus('current') if mibBuilder.loadTexts: sipContactExpiry.setDescription('This object contains the date and time when the contact information will no longer be valid. Such times may be specified by the user at registration (Expires header or expiry parameter in the Contact information), or a system default can be applied.') sipContactPreference = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 5, 1, 3, 1, 6), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: sipContactPreference.setReference('RFC 2543, Section 6.13') if mibBuilder.loadTexts: sipContactPreference.setStatus('current') if mibBuilder.loadTexts: sipContactPreference.setDescription("This object specifies the preference for this contact relative to all other active contacts for same user. A registering user may provide this preference as a 'qvalue' parameter in the Contact header. The format of this item is a decimal number between 0 and 1 (for example 0.9). Higher values indicate locations preferred by the user.") sipContactAction = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 5, 1, 3, 1, 7), SipServerActions()).setMaxAccess("readonly") if mibBuilder.loadTexts: sipContactAction.setStatus('current') if mibBuilder.loadTexts: sipContactAction.setDescription("This object indicates whether the user wanted the server to act as a redirect server or as a proxy server. It is specified by the optional 'action' parameter in the Contact header.") sipContactRetryAfter = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 5, 1, 3, 1, 8), DateAndTime()).setMaxAccess("readonly") if mibBuilder.loadTexts: sipContactRetryAfter.setReference('RFC 2543, Section 6.32') if mibBuilder.loadTexts: sipContactRetryAfter.setStatus('current') if mibBuilder.loadTexts: sipContactRetryAfter.setDescription('This object indicates that the contact information is currently inactive, and that it should only be activated after the date and time specified by the object. This value is provided by a user when deleting contact information using a REGISTER request containing a Retry- After header.') sipRegStatsTable = MibTable((1, 3, 6, 1, 2, 1, 9998, 5, 2, 1), ) if mibBuilder.loadTexts: sipRegStatsTable.setStatus('current') if mibBuilder.loadTexts: sipRegStatsTable.setDescription('This table contains the summary statistics objects applicable to all SIP Registrars in this system. Each row represents those objects for a particular SIP Registrar. The instances of SIP Registrars are uniquely identified by applIndex.') sipRegStatsEntry = MibTableRow((1, 3, 6, 1, 2, 1, 9998, 5, 2, 1, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex")) if mibBuilder.loadTexts: sipRegStatsEntry.setStatus('current') if mibBuilder.loadTexts: sipRegStatsEntry.setDescription('A row of summary statistics.') sipRegAcceptedRegistrations = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 5, 2, 1, 1, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: sipRegAcceptedRegistrations.setStatus('current') if mibBuilder.loadTexts: sipRegAcceptedRegistrations.setDescription('This object contains a count of the number of REGISTER requests that have been accepted (status code 200) by the Registrar. This includes additions of new contact information, refreshing contact information, as well as requests for deletion of contact information.') sipRegRejectedRegistrations = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 5, 2, 1, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: sipRegRejectedRegistrations.setStatus('current') if mibBuilder.loadTexts: sipRegRejectedRegistrations.setDescription('This object contains a count of the number REGISTER requests that have been rejected by the Registrar.') sipRegMIBNotif = MibIdentifier((1, 3, 6, 1, 2, 1, 9998, 5, 3)) sipRegMIBConformance = MibIdentifier((1, 3, 6, 1, 2, 1, 9998, 5, 4)) sipRegMIBCompliances = MibIdentifier((1, 3, 6, 1, 2, 1, 9998, 5, 4, 1)) sipRegMIBGroups = MibIdentifier((1, 3, 6, 1, 2, 1, 9998, 5, 4, 2)) sipRegCompliance = ModuleCompliance((1, 3, 6, 1, 2, 1, 9998, 5, 4, 1, 1)).setObjects(("SIP-REGISTRAR-MIB", "sipRegistrarConfigGroup"), ("SIP-REGISTRAR-MIB", "sipRegistrarStatsGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): sipRegCompliance = sipRegCompliance.setStatus('current') if mibBuilder.loadTexts: sipRegCompliance.setDescription('The compliance statement for SIP entities.') sipRegistrarConfigGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 9998, 5, 4, 2, 1)).setObjects(("SIP-REGISTRAR-MIB", "sipRegAllowThirdParty"), ("SIP-REGISTRAR-MIB", "sipRegContactDfltExpiryDuration"), ("SIP-REGISTRAR-MIB", "sipRegContactDfltExpiryDate"), ("SIP-REGISTRAR-MIB", "sipRegMaxContactExpiryDate"), ("SIP-REGISTRAR-MIB", "sipRegRespHasContacts"), ("SIP-REGISTRAR-MIB", "sipRegMaxUsers"), ("SIP-REGISTRAR-MIB", "sipRegCurrentUsers"), ("SIP-REGISTRAR-MIB", "sipUserUri"), ("SIP-REGISTRAR-MIB", "sipUserPassword"), ("SIP-REGISTRAR-MIB", "sipUserAuthenticationFailures"), ("SIP-REGISTRAR-MIB", "sipUserTableRowStatus"), ("SIP-REGISTRAR-MIB", "sipContactDisplayName"), ("SIP-REGISTRAR-MIB", "sipContactURI"), ("SIP-REGISTRAR-MIB", "sipContactLastUpdated"), ("SIP-REGISTRAR-MIB", "sipContactExpiry"), ("SIP-REGISTRAR-MIB", "sipContactPreference"), ("SIP-REGISTRAR-MIB", "sipContactAction"), ("SIP-REGISTRAR-MIB", "sipContactRetryAfter")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): sipRegistrarConfigGroup = sipRegistrarConfigGroup.setStatus('current') if mibBuilder.loadTexts: sipRegistrarConfigGroup.setDescription('A collection of objects providing configuration for SIP Registrars.') sipRegistrarStatsGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 9998, 5, 4, 2, 2)).setObjects(("SIP-REGISTRAR-MIB", "sipRegAcceptedRegistrations"), ("SIP-REGISTRAR-MIB", "sipRegRejectedRegistrations")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): sipRegistrarStatsGroup = sipRegistrarStatsGroup.setStatus('current') if mibBuilder.loadTexts: sipRegistrarStatsGroup.setDescription('A collection of objects providing statistics for SIP Registrars.') mibBuilder.exportSymbols("SIP-REGISTRAR-MIB", sipContactEntry=sipContactEntry, sipContactLastUpdated=sipContactLastUpdated, sipRegStats=sipRegStats, sipRegRespHasContacts=sipRegRespHasContacts, sipUserAuthenticationFailures=sipUserAuthenticationFailures, sipRegCfg=sipRegCfg, sipContactExpiry=sipContactExpiry, PYSNMP_MODULE_ID=sipRegistrarMIB, sipContactAction=sipContactAction, sipRegRejectedRegistrations=sipRegRejectedRegistrations, sipRegistrarConfigGroup=sipRegistrarConfigGroup, sipRegMIBNotif=sipRegMIBNotif, sipContactIndex=sipContactIndex, sipRegMIBGroups=sipRegMIBGroups, sipRegCfgEntry=sipRegCfgEntry, sipContactPreference=sipContactPreference, sipUserPassword=sipUserPassword, sipRegistrarStatsGroup=sipRegistrarStatsGroup, sipRegCompliance=sipRegCompliance, sipRegMIBCompliances=sipRegMIBCompliances, sipRegistrarMIB=sipRegistrarMIB, sipRegUserTable=sipRegUserTable, sipRegContactDfltExpiryDate=sipRegContactDfltExpiryDate, sipContactURI=sipContactURI, sipContactRetryAfter=sipContactRetryAfter, sipRegAcceptedRegistrations=sipRegAcceptedRegistrations, sipUserTableRowStatus=sipUserTableRowStatus, sipRegCfgTable=sipRegCfgTable, sipRegStatsEntry=sipRegStatsEntry, sipRegMaxContactExpiryDate=sipRegMaxContactExpiryDate, sipRegContactDfltExpiryDuration=sipRegContactDfltExpiryDuration, sipRegMaxUsers=sipRegMaxUsers, sipRegAllowThirdParty=sipRegAllowThirdParty, sipContactTable=sipContactTable, sipContactDisplayName=sipContactDisplayName, sipRegMIBConformance=sipRegMIBConformance, sipRegUserEntry=sipRegUserEntry, sipRegStatsTable=sipRegStatsTable, sipUserIndex=sipUserIndex, sipRegCurrentUsers=sipRegCurrentUsers, sipUserUri=sipUserUri)
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, constraints_intersection, value_range_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ValueSizeConstraint', 'ConstraintsIntersection', 'ValueRangeConstraint', 'ConstraintsUnion') (appl_index,) = mibBuilder.importSymbols('NETWORK-SERVICES-MIB', 'applIndex') (sip_mib,) = mibBuilder.importSymbols('SIP-MIB-SMI', 'sipMIB') (sip_server_actions,) = mibBuilder.importSymbols('SIP-TC', 'SipServerActions') (snmp_admin_string,) = mibBuilder.importSymbols('SNMP-FRAMEWORK-MIB', 'SnmpAdminString') (object_group, notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'ObjectGroup', 'NotificationGroup', 'ModuleCompliance') (counter32, integer32, ip_address, mib_identifier, iso, object_identity, bits, gauge32, mib_scalar, mib_table, mib_table_row, mib_table_column, counter64, time_ticks, module_identity, notification_type, unsigned32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter32', 'Integer32', 'IpAddress', 'MibIdentifier', 'iso', 'ObjectIdentity', 'Bits', 'Gauge32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter64', 'TimeTicks', 'ModuleIdentity', 'NotificationType', 'Unsigned32') (time_stamp, date_and_time, textual_convention, display_string, truth_value, row_status) = mibBuilder.importSymbols('SNMPv2-TC', 'TimeStamp', 'DateAndTime', 'TextualConvention', 'DisplayString', 'TruthValue', 'RowStatus') sip_registrar_mib = module_identity((1, 3, 6, 1, 2, 1, 9998, 5)) if mibBuilder.loadTexts: sipRegistrarMIB.setLastUpdated('200007080000Z') if mibBuilder.loadTexts: sipRegistrarMIB.setOrganization('IETF SIP Working Group, SIP MIB Team') if mibBuilder.loadTexts: sipRegistrarMIB.setContactInfo('SIP MIB Team email: sip-mib@egroups.com Co-editor Kevin Lingle Cisco Systems, Inc. postal: 7025 Kit Creek Road P.O. Box 14987 Research Triangle Park, NC 27709 USA email: klingle@cisco.com phone: +1-919-392-2029 Co-editor Joon Maeng VTEL Corporation postal: 108 Wild Basin Rd. Austin, TX 78746 USA email: joon_maeng@vtel.com phone: +1-512-437-4567 Co-editor Dave Walker SS8 Networks, Inc. postal: 80 Hines Road Kanata, ON K2K 2T8 Canada email: drwalker@ss8networks.com phone: +1 613 592 2100') if mibBuilder.loadTexts: sipRegistrarMIB.setDescription('Initial version of Session Initiation Protocol (SIP) Registrar MIB module. SIP is an application-layer signalling protocol for creating, modifying and terminating multimedia sessions with one or more participants. These sessions include Internet multimedia conferences and Internet telephone calls. SIP is defined in RFC 2543 (March 1999). A Registrar is a server that accepts REGISTER requests. A Registrar is typically co-located with a Proxy or Redirect Server.') sip_reg_cfg = mib_identifier((1, 3, 6, 1, 2, 1, 9998, 5, 1)) sip_reg_stats = mib_identifier((1, 3, 6, 1, 2, 1, 9998, 5, 2)) sip_reg_cfg_table = mib_table((1, 3, 6, 1, 2, 1, 9998, 5, 1, 1)) if mibBuilder.loadTexts: sipRegCfgTable.setStatus('current') if mibBuilder.loadTexts: sipRegCfgTable.setDescription('This table contains configuration objects applicable SIP registrars. Each row represents those objects for a particular SIP registrar present in this system. The instances of SIP registrars are uniquely identified by applIndex.') sip_reg_cfg_entry = mib_table_row((1, 3, 6, 1, 2, 1, 9998, 5, 1, 1, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex')) if mibBuilder.loadTexts: sipRegCfgEntry.setStatus('current') if mibBuilder.loadTexts: sipRegCfgEntry.setDescription('A row of common configuration.') sip_reg_allow_third_party = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 5, 1, 1, 1, 1), truth_value()).setMaxAccess('readwrite') if mibBuilder.loadTexts: sipRegAllowThirdParty.setReference('RFC 2543, Section 4.2.6') if mibBuilder.loadTexts: sipRegAllowThirdParty.setStatus('current') if mibBuilder.loadTexts: sipRegAllowThirdParty.setDescription('This object specifies whether or not the Registrar should allows third party registrations. In third-party registration, the entity issuing the request (in the From header) is different from the entity being registered (in the To header) to whom the provided Contact information applies. If the value of this object is TRUE, the Registrar allows third party registrations. If the value is FALSE, third party registrations are rejected: a 403 Forbidden status code is returned to the requestor.') sip_reg_contact_dflt_expiry_duration = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 5, 1, 1, 1, 2), unsigned32().clone(3600)).setUnits('seconds').setMaxAccess('readwrite') if mibBuilder.loadTexts: sipRegContactDfltExpiryDuration.setReference('RFC 2543, Section 4.2.6') if mibBuilder.loadTexts: sipRegContactDfltExpiryDuration.setStatus('current') if mibBuilder.loadTexts: sipRegContactDfltExpiryDuration.setDescription('This object specifies the default expiration (time-to- live) of Contact information that is provided by User Agents when registering with this Registrar. This value is only used when no expiration has been specified by the user in the REGISTER request. If the value is applied to a registration and is different from the default (one hour), the server must return the value to the registered User Agent. The value contained in this object only applies if the value of the sipContactDfltExpiryDate object is NULL. If the value of this object applies, and is zero, then no default expiry is applied to registered contact information.') sip_reg_contact_dflt_expiry_date = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 5, 1, 1, 1, 3), date_and_time()).setMaxAccess('readwrite') if mibBuilder.loadTexts: sipRegContactDfltExpiryDate.setReference('RFC 2543, Section 4.2.6') if mibBuilder.loadTexts: sipRegContactDfltExpiryDate.setStatus('current') if mibBuilder.loadTexts: sipRegContactDfltExpiryDate.setDescription('This object specifies the default expiration date (time- to-live) of Contact information that is provided by User Agents when registering with this Registrar. This value is only used when no expiration has been specified by the user in the REGISTER request. If this value is applied to a registration, the server must return the value to the registered User Agent. The value contained in this object only applies if the value of the sipContactDfltExpiryDuration object is zero. If the value of this object applies, and is NULL, then no default expiry is applied to registered contact information.') sip_reg_max_contact_expiry_date = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 5, 1, 1, 1, 4), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 4294967295)).clone(4294967295)).setUnits('seconds').setMaxAccess('readwrite') if mibBuilder.loadTexts: sipRegMaxContactExpiryDate.setStatus('current') if mibBuilder.loadTexts: sipRegMaxContactExpiryDate.setDescription('This object specifies the maximum expiry that may be requested by a User Agent for a particular Contact. User Agents can specify expiry using either an Expiry header in a REGISTER request, or using an Expires parameter in a Contact header in a REGISTER request. If the value requested by the User Agent is greater than the value of this object, then the contact information is given the duration specified by this object, and that duration is indicated to the User Agent in the response.') sip_reg_resp_has_contacts = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 5, 1, 1, 1, 5), truth_value()).setMaxAccess('readwrite') if mibBuilder.loadTexts: sipRegRespHasContacts.setStatus('current') if mibBuilder.loadTexts: sipRegRespHasContacts.setDescription('This object specifies whether or not the Registrar should return all currently reachable locations for a successfully registering party in the REGISTER response message. If the value of this object is TRUE, the Registrar returns the locations in the REGISTER response. If the value is FALSE, no location information is provided.') sip_reg_max_users = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 5, 1, 1, 1, 6), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 4294967295))).setMaxAccess('readonly') if mibBuilder.loadTexts: sipRegMaxUsers.setStatus('current') if mibBuilder.loadTexts: sipRegMaxUsers.setDescription('This object specifies the maximum number of users that the registrar supports. The current number of users is reflected by sipRegCurrentUsers.') sip_reg_current_users = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 5, 1, 1, 1, 7), gauge32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readonly') if mibBuilder.loadTexts: sipRegCurrentUsers.setStatus('current') if mibBuilder.loadTexts: sipRegCurrentUsers.setDescription('This object specifies the number of users currently configured on the registrar.') sip_reg_user_table = mib_table((1, 3, 6, 1, 2, 1, 9998, 5, 1, 2)) if mibBuilder.loadTexts: sipRegUserTable.setStatus('current') if mibBuilder.loadTexts: sipRegUserTable.setDescription('This table contains information on all users registered to each Registrar in this system. The instances of SIP Registrar are uniquely identified by applIndex.') sip_reg_user_entry = mib_table_row((1, 3, 6, 1, 2, 1, 9998, 5, 1, 2, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'), (0, 'SIP-REGISTRAR-MIB', 'sipUserIndex')) if mibBuilder.loadTexts: sipRegUserEntry.setStatus('current') if mibBuilder.loadTexts: sipRegUserEntry.setDescription('This entry contains information for a single user registered to this Registrar.') sip_user_index = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 5, 1, 2, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 4294967295))) if mibBuilder.loadTexts: sipUserIndex.setStatus('current') if mibBuilder.loadTexts: sipUserIndex.setDescription('This object uniquely identifies a conceptual row in the table.') sip_user_uri = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 5, 1, 2, 1, 2), snmp_admin_string()).setMaxAccess('readcreate') if mibBuilder.loadTexts: sipUserUri.setStatus('current') if mibBuilder.loadTexts: sipUserUri.setDescription("This object contains the user's address-of-record. It is the main form by which the registrar knows the user. The format is typically 'user@domain'. It is contained in the To header for all REGISTER requests.") sip_user_password = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 5, 1, 2, 1, 3), octet_string().subtype(subtypeSpec=value_size_constraint(0, 255))).setMaxAccess('readcreate') if mibBuilder.loadTexts: sipUserPassword.setStatus('current') if mibBuilder.loadTexts: sipUserPassword.setDescription('This object specifies the password that the user must enter when being authenticated.') sip_user_authentication_failures = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 5, 1, 2, 1, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: sipUserAuthenticationFailures.setStatus('current') if mibBuilder.loadTexts: sipUserAuthenticationFailures.setDescription('This object contains a count of the number of times the user has failed authentication.') sip_user_table_row_status = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 5, 1, 2, 1, 5), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: sipUserTableRowStatus.setStatus('current') if mibBuilder.loadTexts: sipUserTableRowStatus.setDescription('The row status of the entry. This object is required to create or delete rows remotely by a manager.') sip_contact_table = mib_table((1, 3, 6, 1, 2, 1, 9998, 5, 1, 3)) if mibBuilder.loadTexts: sipContactTable.setStatus('current') if mibBuilder.loadTexts: sipContactTable.setDescription('This table contains information on every location where a registered user (specified by sipUserIndex) wishes to be found (i.e. has provided Contact information) to each SIP Registrar in this system. The instances of SIP Registrar are uniquely identified by applIndex.') sip_contact_entry = mib_table_row((1, 3, 6, 1, 2, 1, 9998, 5, 1, 3, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'), (0, 'SIP-REGISTRAR-MIB', 'sipUserIndex'), (0, 'SIP-REGISTRAR-MIB', 'sipContactIndex')) if mibBuilder.loadTexts: sipContactEntry.setStatus('current') if mibBuilder.loadTexts: sipContactEntry.setDescription('This entry contains information for a single Contact. Multiple contacts may exist for a single user.') sip_contact_index = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 5, 1, 3, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 4294967295))) if mibBuilder.loadTexts: sipContactIndex.setStatus('current') if mibBuilder.loadTexts: sipContactIndex.setDescription('Along with the sipUserIndex, this object uniquely identifies a conceptual row in the table.') sip_contact_display_name = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 5, 1, 3, 1, 2), snmp_admin_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: sipContactDisplayName.setStatus('current') if mibBuilder.loadTexts: sipContactDisplayName.setDescription("This object contains the display name for the Contact. For example, 'Santa at Home', or 'Santa on his Sled', corresponding to contact URLs of sip:BigGuy@sip.northpole.ca or sip:sclaus817@sip.mobile.com, respectively.") sip_contact_uri = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 5, 1, 3, 1, 3), snmp_admin_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: sipContactURI.setStatus('current') if mibBuilder.loadTexts: sipContactURI.setDescription('This object contains either a SIP URL or a URI where the user can be contacted. This URI is normally returned to a client from a redirect server, or is used as the RequestURI in a SIP request line for requests forwarded by a proxy.') sip_contact_last_updated = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 5, 1, 3, 1, 4), time_stamp()).setMaxAccess('readonly') if mibBuilder.loadTexts: sipContactLastUpdated.setStatus('current') if mibBuilder.loadTexts: sipContactLastUpdated.setDescription('This object indicates the time when this contact information was accepted. If the contact information is updated via a subsequent REGISTER of the same information, this object is also updated.') sip_contact_expiry = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 5, 1, 3, 1, 5), date_and_time()).setMaxAccess('readonly') if mibBuilder.loadTexts: sipContactExpiry.setStatus('current') if mibBuilder.loadTexts: sipContactExpiry.setDescription('This object contains the date and time when the contact information will no longer be valid. Such times may be specified by the user at registration (Expires header or expiry parameter in the Contact information), or a system default can be applied.') sip_contact_preference = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 5, 1, 3, 1, 6), octet_string().subtype(subtypeSpec=value_size_constraint(0, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: sipContactPreference.setReference('RFC 2543, Section 6.13') if mibBuilder.loadTexts: sipContactPreference.setStatus('current') if mibBuilder.loadTexts: sipContactPreference.setDescription("This object specifies the preference for this contact relative to all other active contacts for same user. A registering user may provide this preference as a 'qvalue' parameter in the Contact header. The format of this item is a decimal number between 0 and 1 (for example 0.9). Higher values indicate locations preferred by the user.") sip_contact_action = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 5, 1, 3, 1, 7), sip_server_actions()).setMaxAccess('readonly') if mibBuilder.loadTexts: sipContactAction.setStatus('current') if mibBuilder.loadTexts: sipContactAction.setDescription("This object indicates whether the user wanted the server to act as a redirect server or as a proxy server. It is specified by the optional 'action' parameter in the Contact header.") sip_contact_retry_after = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 5, 1, 3, 1, 8), date_and_time()).setMaxAccess('readonly') if mibBuilder.loadTexts: sipContactRetryAfter.setReference('RFC 2543, Section 6.32') if mibBuilder.loadTexts: sipContactRetryAfter.setStatus('current') if mibBuilder.loadTexts: sipContactRetryAfter.setDescription('This object indicates that the contact information is currently inactive, and that it should only be activated after the date and time specified by the object. This value is provided by a user when deleting contact information using a REGISTER request containing a Retry- After header.') sip_reg_stats_table = mib_table((1, 3, 6, 1, 2, 1, 9998, 5, 2, 1)) if mibBuilder.loadTexts: sipRegStatsTable.setStatus('current') if mibBuilder.loadTexts: sipRegStatsTable.setDescription('This table contains the summary statistics objects applicable to all SIP Registrars in this system. Each row represents those objects for a particular SIP Registrar. The instances of SIP Registrars are uniquely identified by applIndex.') sip_reg_stats_entry = mib_table_row((1, 3, 6, 1, 2, 1, 9998, 5, 2, 1, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex')) if mibBuilder.loadTexts: sipRegStatsEntry.setStatus('current') if mibBuilder.loadTexts: sipRegStatsEntry.setDescription('A row of summary statistics.') sip_reg_accepted_registrations = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 5, 2, 1, 1, 1), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: sipRegAcceptedRegistrations.setStatus('current') if mibBuilder.loadTexts: sipRegAcceptedRegistrations.setDescription('This object contains a count of the number of REGISTER requests that have been accepted (status code 200) by the Registrar. This includes additions of new contact information, refreshing contact information, as well as requests for deletion of contact information.') sip_reg_rejected_registrations = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 5, 2, 1, 1, 2), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: sipRegRejectedRegistrations.setStatus('current') if mibBuilder.loadTexts: sipRegRejectedRegistrations.setDescription('This object contains a count of the number REGISTER requests that have been rejected by the Registrar.') sip_reg_mib_notif = mib_identifier((1, 3, 6, 1, 2, 1, 9998, 5, 3)) sip_reg_mib_conformance = mib_identifier((1, 3, 6, 1, 2, 1, 9998, 5, 4)) sip_reg_mib_compliances = mib_identifier((1, 3, 6, 1, 2, 1, 9998, 5, 4, 1)) sip_reg_mib_groups = mib_identifier((1, 3, 6, 1, 2, 1, 9998, 5, 4, 2)) sip_reg_compliance = module_compliance((1, 3, 6, 1, 2, 1, 9998, 5, 4, 1, 1)).setObjects(('SIP-REGISTRAR-MIB', 'sipRegistrarConfigGroup'), ('SIP-REGISTRAR-MIB', 'sipRegistrarStatsGroup')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): sip_reg_compliance = sipRegCompliance.setStatus('current') if mibBuilder.loadTexts: sipRegCompliance.setDescription('The compliance statement for SIP entities.') sip_registrar_config_group = object_group((1, 3, 6, 1, 2, 1, 9998, 5, 4, 2, 1)).setObjects(('SIP-REGISTRAR-MIB', 'sipRegAllowThirdParty'), ('SIP-REGISTRAR-MIB', 'sipRegContactDfltExpiryDuration'), ('SIP-REGISTRAR-MIB', 'sipRegContactDfltExpiryDate'), ('SIP-REGISTRAR-MIB', 'sipRegMaxContactExpiryDate'), ('SIP-REGISTRAR-MIB', 'sipRegRespHasContacts'), ('SIP-REGISTRAR-MIB', 'sipRegMaxUsers'), ('SIP-REGISTRAR-MIB', 'sipRegCurrentUsers'), ('SIP-REGISTRAR-MIB', 'sipUserUri'), ('SIP-REGISTRAR-MIB', 'sipUserPassword'), ('SIP-REGISTRAR-MIB', 'sipUserAuthenticationFailures'), ('SIP-REGISTRAR-MIB', 'sipUserTableRowStatus'), ('SIP-REGISTRAR-MIB', 'sipContactDisplayName'), ('SIP-REGISTRAR-MIB', 'sipContactURI'), ('SIP-REGISTRAR-MIB', 'sipContactLastUpdated'), ('SIP-REGISTRAR-MIB', 'sipContactExpiry'), ('SIP-REGISTRAR-MIB', 'sipContactPreference'), ('SIP-REGISTRAR-MIB', 'sipContactAction'), ('SIP-REGISTRAR-MIB', 'sipContactRetryAfter')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): sip_registrar_config_group = sipRegistrarConfigGroup.setStatus('current') if mibBuilder.loadTexts: sipRegistrarConfigGroup.setDescription('A collection of objects providing configuration for SIP Registrars.') sip_registrar_stats_group = object_group((1, 3, 6, 1, 2, 1, 9998, 5, 4, 2, 2)).setObjects(('SIP-REGISTRAR-MIB', 'sipRegAcceptedRegistrations'), ('SIP-REGISTRAR-MIB', 'sipRegRejectedRegistrations')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): sip_registrar_stats_group = sipRegistrarStatsGroup.setStatus('current') if mibBuilder.loadTexts: sipRegistrarStatsGroup.setDescription('A collection of objects providing statistics for SIP Registrars.') mibBuilder.exportSymbols('SIP-REGISTRAR-MIB', sipContactEntry=sipContactEntry, sipContactLastUpdated=sipContactLastUpdated, sipRegStats=sipRegStats, sipRegRespHasContacts=sipRegRespHasContacts, sipUserAuthenticationFailures=sipUserAuthenticationFailures, sipRegCfg=sipRegCfg, sipContactExpiry=sipContactExpiry, PYSNMP_MODULE_ID=sipRegistrarMIB, sipContactAction=sipContactAction, sipRegRejectedRegistrations=sipRegRejectedRegistrations, sipRegistrarConfigGroup=sipRegistrarConfigGroup, sipRegMIBNotif=sipRegMIBNotif, sipContactIndex=sipContactIndex, sipRegMIBGroups=sipRegMIBGroups, sipRegCfgEntry=sipRegCfgEntry, sipContactPreference=sipContactPreference, sipUserPassword=sipUserPassword, sipRegistrarStatsGroup=sipRegistrarStatsGroup, sipRegCompliance=sipRegCompliance, sipRegMIBCompliances=sipRegMIBCompliances, sipRegistrarMIB=sipRegistrarMIB, sipRegUserTable=sipRegUserTable, sipRegContactDfltExpiryDate=sipRegContactDfltExpiryDate, sipContactURI=sipContactURI, sipContactRetryAfter=sipContactRetryAfter, sipRegAcceptedRegistrations=sipRegAcceptedRegistrations, sipUserTableRowStatus=sipUserTableRowStatus, sipRegCfgTable=sipRegCfgTable, sipRegStatsEntry=sipRegStatsEntry, sipRegMaxContactExpiryDate=sipRegMaxContactExpiryDate, sipRegContactDfltExpiryDuration=sipRegContactDfltExpiryDuration, sipRegMaxUsers=sipRegMaxUsers, sipRegAllowThirdParty=sipRegAllowThirdParty, sipContactTable=sipContactTable, sipContactDisplayName=sipContactDisplayName, sipRegMIBConformance=sipRegMIBConformance, sipRegUserEntry=sipRegUserEntry, sipRegStatsTable=sipRegStatsTable, sipUserIndex=sipUserIndex, sipRegCurrentUsers=sipRegCurrentUsers, sipUserUri=sipUserUri)
#Leia um numero inteiro e monte sua tabuada n1 = int(input('Digite um numero inteiro: ')) print('Tabuada do numero : '.format(n1)) print(' 1 x {} = {}'.format(n1, n1*1)) print(' 2 x {} = {}'.format(n1, n1*2)) print(' 3 x {} = {}'.format(n1, n1*3)) print(' 4 x {} = {}'.format(n1, n1*4)) print(' 5 x {} = {}'.format(n1, n1*5)) print(' 6 x {} = {}'.format(n1, n1*6)) print(' 7 x {} = {}'.format(n1, n1*7)) print(' 8 x {} = {}'.format(n1, n1*8)) print(' 9 x {} = {}'.format(n1, n1*9))
n1 = int(input('Digite um numero inteiro: ')) print('Tabuada do numero : '.format(n1)) print(' 1 x {} = {}'.format(n1, n1 * 1)) print(' 2 x {} = {}'.format(n1, n1 * 2)) print(' 3 x {} = {}'.format(n1, n1 * 3)) print(' 4 x {} = {}'.format(n1, n1 * 4)) print(' 5 x {} = {}'.format(n1, n1 * 5)) print(' 6 x {} = {}'.format(n1, n1 * 6)) print(' 7 x {} = {}'.format(n1, n1 * 7)) print(' 8 x {} = {}'.format(n1, n1 * 8)) print(' 9 x {} = {}'.format(n1, n1 * 9))
def calc_eval(exp): if isinstance(exp, Pair): if exp.first == "and": return eval_and(exp.rest) else: return calc_apply(calc_eval(exp, first), list(exp.rest.map(calc_eval))) elif exp in OPERATORS: return OPERATORS[exp] else: return exp def eval_and(operands): curr, val = operands, True while curr is not nil: val = calc_eval(curr.first) if val is False: return False curr = curr.rest return val
def calc_eval(exp): if isinstance(exp, Pair): if exp.first == 'and': return eval_and(exp.rest) else: return calc_apply(calc_eval(exp, first), list(exp.rest.map(calc_eval))) elif exp in OPERATORS: return OPERATORS[exp] else: return exp def eval_and(operands): (curr, val) = (operands, True) while curr is not nil: val = calc_eval(curr.first) if val is False: return False curr = curr.rest return val
class ErrorMsg: float #float64 X_One #float64 Height_Of_Cone #float64 Area_Of_View_Top #float64 Area_Of_View_Bottom #bool Stop_Now
class Errormsg: float
# # PySNMP MIB module NTWS-RF-DETECT-TC (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NTWS-RF-DETECT-TC # Produced by pysmi-0.3.4 at Wed May 1 14:25:43 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, ValueSizeConstraint, ConstraintsIntersection, ValueRangeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueSizeConstraint", "ConstraintsIntersection", "ValueRangeConstraint", "SingleValueConstraint") ntwsMibs, = mibBuilder.importSymbols("NTWS-ROOT-MIB", "ntwsMibs") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") TimeTicks, NotificationType, IpAddress, ObjectIdentity, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, Unsigned32, Counter32, Integer32, Counter64, iso, Bits, MibIdentifier, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "TimeTicks", "NotificationType", "IpAddress", "ObjectIdentity", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Unsigned32", "Counter32", "Integer32", "Counter64", "iso", "Bits", "MibIdentifier", "Gauge32") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") ntwsRFDetectTc = ModuleIdentity((1, 3, 6, 1, 4, 1, 45, 6, 1, 4, 11)) ntwsRFDetectTc.setRevisions(('2008-05-15 00:03', '2007-04-18 00:02', '2007-03-28 00:01',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: ntwsRFDetectTc.setRevisionsDescriptions(('v1.1.1, MRT v1.1: Made changes in order to comply with corporate MIB conventions.', 'v1.1.0: added two new TCs, for use in ntwsInfoRFDetectMib', 'v1.0.0: initial version',)) if mibBuilder.loadTexts: ntwsRFDetectTc.setLastUpdated('200805150003Z') if mibBuilder.loadTexts: ntwsRFDetectTc.setOrganization('Nortel Networks') if mibBuilder.loadTexts: ntwsRFDetectTc.setContactInfo('www.nortelnetworks.com') if mibBuilder.loadTexts: ntwsRFDetectTc.setDescription("Textual Conventions used by Nortel Networks wireless switches. Copyright 2008 Nortel Networks. All rights reserved. This Nortel Networks SNMP Management Information Base Specification (Specification) embodies Nortel Networks' confidential and proprietary intellectual property. This Specification is supplied 'AS IS' and Nortel Networks makes no warranty, either express or implied, as to the use, operation, condition, or performance of the Specification.") class NtwsRFDetectClassificationReason(TextualConvention, Integer32): description = 'Enumeration of the reasons why a RF device is classified the way it is.' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)) namedValues = NamedValues(("other", 1), ("default-classification", 2), ("rogue-list", 3), ("ap-in-modo", 4), ("neighbor-list", 5), ("ssid-masquerade", 6), ("seen-in-network", 7), ("ad-hoc", 8), ("ssid-list", 9), ("pass-fingerprint", 10), ("fail-fingerprint", 11)) class NtwsRFDetectClassification(TextualConvention, Integer32): description = 'The classification of an RF device.' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6)) namedValues = NamedValues(("other", 1), ("not-classified", 2), ("member", 3), ("neighbor", 4), ("suspect", 5), ("rogue", 6)) class NtwsRFDetectNetworkingMode(TextualConvention, Integer32): description = 'The way an RF device is doing wireless networking.' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2)) namedValues = NamedValues(("ad-hoc", 1), ("infrastructure", 2)) mibBuilder.exportSymbols("NTWS-RF-DETECT-TC", ntwsRFDetectTc=ntwsRFDetectTc, NtwsRFDetectClassificationReason=NtwsRFDetectClassificationReason, NtwsRFDetectClassification=NtwsRFDetectClassification, NtwsRFDetectNetworkingMode=NtwsRFDetectNetworkingMode, PYSNMP_MODULE_ID=ntwsRFDetectTc)
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, constraints_intersection, value_range_constraint, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ValueSizeConstraint', 'ConstraintsIntersection', 'ValueRangeConstraint', 'SingleValueConstraint') (ntws_mibs,) = mibBuilder.importSymbols('NTWS-ROOT-MIB', 'ntwsMibs') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (time_ticks, notification_type, ip_address, object_identity, module_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, unsigned32, counter32, integer32, counter64, iso, bits, mib_identifier, gauge32) = mibBuilder.importSymbols('SNMPv2-SMI', 'TimeTicks', 'NotificationType', 'IpAddress', 'ObjectIdentity', 'ModuleIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Unsigned32', 'Counter32', 'Integer32', 'Counter64', 'iso', 'Bits', 'MibIdentifier', 'Gauge32') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') ntws_rf_detect_tc = module_identity((1, 3, 6, 1, 4, 1, 45, 6, 1, 4, 11)) ntwsRFDetectTc.setRevisions(('2008-05-15 00:03', '2007-04-18 00:02', '2007-03-28 00:01')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: ntwsRFDetectTc.setRevisionsDescriptions(('v1.1.1, MRT v1.1: Made changes in order to comply with corporate MIB conventions.', 'v1.1.0: added two new TCs, for use in ntwsInfoRFDetectMib', 'v1.0.0: initial version')) if mibBuilder.loadTexts: ntwsRFDetectTc.setLastUpdated('200805150003Z') if mibBuilder.loadTexts: ntwsRFDetectTc.setOrganization('Nortel Networks') if mibBuilder.loadTexts: ntwsRFDetectTc.setContactInfo('www.nortelnetworks.com') if mibBuilder.loadTexts: ntwsRFDetectTc.setDescription("Textual Conventions used by Nortel Networks wireless switches. Copyright 2008 Nortel Networks. All rights reserved. This Nortel Networks SNMP Management Information Base Specification (Specification) embodies Nortel Networks' confidential and proprietary intellectual property. This Specification is supplied 'AS IS' and Nortel Networks makes no warranty, either express or implied, as to the use, operation, condition, or performance of the Specification.") class Ntwsrfdetectclassificationreason(TextualConvention, Integer32): description = 'Enumeration of the reasons why a RF device is classified the way it is.' status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)) named_values = named_values(('other', 1), ('default-classification', 2), ('rogue-list', 3), ('ap-in-modo', 4), ('neighbor-list', 5), ('ssid-masquerade', 6), ('seen-in-network', 7), ('ad-hoc', 8), ('ssid-list', 9), ('pass-fingerprint', 10), ('fail-fingerprint', 11)) class Ntwsrfdetectclassification(TextualConvention, Integer32): description = 'The classification of an RF device.' status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6)) named_values = named_values(('other', 1), ('not-classified', 2), ('member', 3), ('neighbor', 4), ('suspect', 5), ('rogue', 6)) class Ntwsrfdetectnetworkingmode(TextualConvention, Integer32): description = 'The way an RF device is doing wireless networking.' status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2)) named_values = named_values(('ad-hoc', 1), ('infrastructure', 2)) mibBuilder.exportSymbols('NTWS-RF-DETECT-TC', ntwsRFDetectTc=ntwsRFDetectTc, NtwsRFDetectClassificationReason=NtwsRFDetectClassificationReason, NtwsRFDetectClassification=NtwsRFDetectClassification, NtwsRFDetectNetworkingMode=NtwsRFDetectNetworkingMode, PYSNMP_MODULE_ID=ntwsRFDetectTc)
# -*- coding: utf-8 -*- #import ultron.sentry.api as api #import ultron.sentry.Math as Math #import ultron.sentry.Analysis as Analysis #import ultron.sentry.Utilities as Utilities __all__ = ['__version__'] __version__ = "0.0.1"
__all__ = ['__version__'] __version__ = '0.0.1'
expected_output ={ "lisp_id": { 0: { "instance_id": { 8188: { "eid_table": "Vlan 210", "entries": 1, "eid_prefix": { "0017.0100.0001/48": { "uptime": "01:13:15", "expiry_time": "22:46:44", "via": "map-reply", "map_reply_state": "complete", "prefix_location": "local-to-site", "source_type": "map-reply", "last_modified": "01:13:15,", "source_ip": "1.1.1.10", "prefix_state": "Active", "encap": "dynamic-EID traffic", "rloc_set": { "1.1.1.10": { "uptime": "01:13:15", "rloc_state": "up", "priority": 10, "weight": 10, "encap_iid": "-", "last_state_change": { "time": "01:13:15", "count": 1, }, "last_route_reach_change": { "time": "01:13:15", "count": 1, }, "last_pri_weight_change": { "priority": "never", "weight": "never", }, "rloc_probe_sent": { "time": "01:13:15", "rtt": 1, "rtt_unit": "ms", }, } }, } }, } } } } }
expected_output = {'lisp_id': {0: {'instance_id': {8188: {'eid_table': 'Vlan 210', 'entries': 1, 'eid_prefix': {'0017.0100.0001/48': {'uptime': '01:13:15', 'expiry_time': '22:46:44', 'via': 'map-reply', 'map_reply_state': 'complete', 'prefix_location': 'local-to-site', 'source_type': 'map-reply', 'last_modified': '01:13:15,', 'source_ip': '1.1.1.10', 'prefix_state': 'Active', 'encap': 'dynamic-EID traffic', 'rloc_set': {'1.1.1.10': {'uptime': '01:13:15', 'rloc_state': 'up', 'priority': 10, 'weight': 10, 'encap_iid': '-', 'last_state_change': {'time': '01:13:15', 'count': 1}, 'last_route_reach_change': {'time': '01:13:15', 'count': 1}, 'last_pri_weight_change': {'priority': 'never', 'weight': 'never'}, 'rloc_probe_sent': {'time': '01:13:15', 'rtt': 1, 'rtt_unit': 'ms'}}}}}}}}}}
a = 100 b = 3 print(a % b) print(divmod(a, b))
a = 100 b = 3 print(a % b) print(divmod(a, b))
#!/usr/bin/python3 # -*- coding: utf-8 -*- '''\ Nomad-RPi testing modules. since: 23-APR-2018 '''
"""Nomad-RPi testing modules. since: 23-APR-2018 """
ICONS = ['new_file', 'open_file', 'save', 'cut', 'copy', 'paste', 'undo', 'redo', 'find_text'] theme_color = { 'Default': '#000000.#FFFFFF', 'Greygarious': '#83406A.#D1D4D1', 'Aquamarine': '#5B8340.#D1E7E0', 'Bold Beige': '#4B4620.#FFF0E1', 'Cobalt Blue': '#ffffBB.#3333aa', 'Olive Green': '#D1E7E0.#5B8340', 'Night Mode': '#FFFFFF.#000000', }
icons = ['new_file', 'open_file', 'save', 'cut', 'copy', 'paste', 'undo', 'redo', 'find_text'] theme_color = {'Default': '#000000.#FFFFFF', 'Greygarious': '#83406A.#D1D4D1', 'Aquamarine': '#5B8340.#D1E7E0', 'Bold Beige': '#4B4620.#FFF0E1', 'Cobalt Blue': '#ffffBB.#3333aa', 'Olive Green': '#D1E7E0.#5B8340', 'Night Mode': '#FFFFFF.#000000'}
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"convert_file_to_json": "00-documentation.ipynb", "encode_file_as_utf8": "00-documentation.ipynb", "convert_nb_to_md": "00-documentation.ipynb", "junix.exporter.convert_file_to_json": "00-documentation.ipynb", "MyHTMLParser": "00-documentation.ipynb", "convert_df_to_md": "00-documentation.ipynb", "remove_empty_index_col": "00-documentation.ipynb", "extract_div_to_md_table": "00-documentation.ipynb", "extract_div_to_md_tables": "00-documentation.ipynb", "clean_md_file_tables": "00-documentation.ipynb", "get_substring_idxs": "00-documentation.ipynb", "clean_progress_bars": "00-documentation.ipynb", "correct_png_name": "00-documentation.ipynb", "specify_nb_in_img_fp": "00-documentation.ipynb", "get_nb_naive_png_names": "00-documentation.ipynb", "get_filename_correction_map": "00-documentation.ipynb", "clean_md_text_img_fps": "00-documentation.ipynb", "clean_md_files_img_fps": "00-documentation.ipynb", "convert_and_clean_nb_to_md": "00-documentation.ipynb", "construct_contributor_txt": "01-dictionary-page.ipynb", "construct_licence_txt": "01-dictionary-page.ipynb", "construct_metadata_table_str": "01-dictionary-page.ipynb", "construct_field_desc_table_str": "01-dictionary-page.ipynb", "get_dp_field_to_url_format_str": "03-page-population.ipynb", "get_dp_field_to_title": "03-page-population.ipynb", "format_id_values": "03-page-population.ipynb", "construct_linked_ids_table_str": "01-dictionary-page.ipynb", "construct_linked_idxs": "01-dictionary-page.ipynb", "populate_and_save_template": "03-page-population.ipynb", "populate_dictionary_page": "01-dictionary-page.ipynb", "get_field_name_tags": "02-attribute extraction.ipynb", "field_hierarchies_to_root": "02-attribute extraction.ipynb", "assign_idx_fields": "02-attribute extraction.ipynb", "initialise_site_data_with_ids": "02-attribute extraction.ipynb", "get_dict_head": "02-attribute extraction.ipynb", "datapackage_ref_to_ds_schema": "02-attribute extraction.ipynb", "init_datapackage_ref": "02-attribute extraction.ipynb", "extract_external_foreignkey_datapackage_refs": "02-attribute extraction.ipynb", "add_resource_locs_to_external_datapackage_refs": "02-attribute extraction.ipynb", "create_dir": "02-attribute extraction.ipynb", "download_attribute_data_to_temp_dir": "02-attribute extraction.ipynb", "load_datapackage": "02-attribute extraction.ipynb", "load_resource_attr_dfs": "02-attribute extraction.ipynb", "load_dataset_ref": "02-attribute extraction.ipynb", "get_datapackage_ref": "02-attribute extraction.ipynb", "load_full_id_map": "02-attribute extraction.ipynb", "determine_matched_ids": "02-attribute extraction.ipynb", "delete_null_attributes": "02-attribute extraction.ipynb", "delete_null_values": "02-attribute extraction.ipynb", "format_attr_value_type": "02-attribute extraction.ipynb", "format_all_attr_value_types": "02-attribute extraction.ipynb", "extract_attrs_from_resource_dfs": "02-attribute extraction.ipynb", "flatten_list": "02-attribute extraction.ipynb", "drop_duplicates_attrs": "02-attribute extraction.ipynb", "json_nan_to_none": "02-attribute extraction.ipynb", "construct_dictionary_knowledge_graph": "02-attribute extraction.ipynb", "single_site_data_to_ids_df": "03-page-population.ipynb", "single_site_data_to_ids_md_str": "03-page-population.ipynb", "get_datapackage_url_to_alt_indexes": "03-page-population.ipynb", "get_datapackage_url_to_attributes": "03-page-population.ipynb", "filter_dict": "03-page-population.ipynb", "set_multi_index_names": "03-page-population.ipynb", "create_multi_index_attrs_df": "03-page-population.ipynb", "get_attrs_df_index_cols": "03-page-population.ipynb", "create_single_index_attrs_df": "03-page-population.ipynb", "idx_to_attr_name": "03-page-population.ipynb", "get_field_class": "03-page-population.ipynb", "format_attribute_value_types": "03-page-population.ipynb", "construct_attr_to_field_schema": "03-page-population.ipynb", "extract_datapackage_url_to_ids": "03-page-population.ipynb", "extract_combined_attrs_df": "03-page-population.ipynb", "extract_datapackage_url_to_dict_id_type": "03-page-population.ipynb", "get_datapackage_url_to_attrs_md_str": "03-page-population.ipynb", "construct_dataset_md_str": "03-page-population.ipynb", "single_site_data_to_datasets_md_str": "03-page-population.ipynb", "clean_dp_name": "03-page-population.ipynb", "construct_downloads_md_str": "03-page-population.ipynb", "extract_name_from_single_site_data": "03-page-population.ipynb", "single_site_data_to_md_str": "03-page-population.ipynb", "clean_object_ids_to_names": "03-page-population.ipynb", "get_object_ids_to_names": "03-page-population.ipynb", "construct_object_docs": "03-page-population.ipynb", "resource_to_title": "07-dataset-pages.ipynb", "resource_to_description": "07-dataset-pages.ipynb", "package_to_homepage": "07-dataset-pages.ipynb", "resource_to_fields_table_str": "07-dataset-pages.ipynb", "extract_resource_elements": "07-dataset-pages.ipynb", "extract_package_elements": "07-dataset-pages.ipynb", "resource_to_download_url": "07-dataset-pages.ipynb", "identify_valid_datasets": "07-dataset-pages.ipynb", "update_mkdocs_config": "07-dataset-pages.ipynb", "populate_dataset_pages": "07-dataset-pages.ipynb", "move_attribute_source_data_to_docs": "07-dataset-pages.ipynb"} modules = ["dev/docs.py", "dictionary.py", "extraction.py", "population.py", "datasets.py"] doc_url = "https://OSUKED.github.io/Power-Station-Dictionary/" git_url = "https://github.com/OSUKED/Power-Station-Dictionary" def custom_doc_links(name): return None
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'convert_file_to_json': '00-documentation.ipynb', 'encode_file_as_utf8': '00-documentation.ipynb', 'convert_nb_to_md': '00-documentation.ipynb', 'junix.exporter.convert_file_to_json': '00-documentation.ipynb', 'MyHTMLParser': '00-documentation.ipynb', 'convert_df_to_md': '00-documentation.ipynb', 'remove_empty_index_col': '00-documentation.ipynb', 'extract_div_to_md_table': '00-documentation.ipynb', 'extract_div_to_md_tables': '00-documentation.ipynb', 'clean_md_file_tables': '00-documentation.ipynb', 'get_substring_idxs': '00-documentation.ipynb', 'clean_progress_bars': '00-documentation.ipynb', 'correct_png_name': '00-documentation.ipynb', 'specify_nb_in_img_fp': '00-documentation.ipynb', 'get_nb_naive_png_names': '00-documentation.ipynb', 'get_filename_correction_map': '00-documentation.ipynb', 'clean_md_text_img_fps': '00-documentation.ipynb', 'clean_md_files_img_fps': '00-documentation.ipynb', 'convert_and_clean_nb_to_md': '00-documentation.ipynb', 'construct_contributor_txt': '01-dictionary-page.ipynb', 'construct_licence_txt': '01-dictionary-page.ipynb', 'construct_metadata_table_str': '01-dictionary-page.ipynb', 'construct_field_desc_table_str': '01-dictionary-page.ipynb', 'get_dp_field_to_url_format_str': '03-page-population.ipynb', 'get_dp_field_to_title': '03-page-population.ipynb', 'format_id_values': '03-page-population.ipynb', 'construct_linked_ids_table_str': '01-dictionary-page.ipynb', 'construct_linked_idxs': '01-dictionary-page.ipynb', 'populate_and_save_template': '03-page-population.ipynb', 'populate_dictionary_page': '01-dictionary-page.ipynb', 'get_field_name_tags': '02-attribute extraction.ipynb', 'field_hierarchies_to_root': '02-attribute extraction.ipynb', 'assign_idx_fields': '02-attribute extraction.ipynb', 'initialise_site_data_with_ids': '02-attribute extraction.ipynb', 'get_dict_head': '02-attribute extraction.ipynb', 'datapackage_ref_to_ds_schema': '02-attribute extraction.ipynb', 'init_datapackage_ref': '02-attribute extraction.ipynb', 'extract_external_foreignkey_datapackage_refs': '02-attribute extraction.ipynb', 'add_resource_locs_to_external_datapackage_refs': '02-attribute extraction.ipynb', 'create_dir': '02-attribute extraction.ipynb', 'download_attribute_data_to_temp_dir': '02-attribute extraction.ipynb', 'load_datapackage': '02-attribute extraction.ipynb', 'load_resource_attr_dfs': '02-attribute extraction.ipynb', 'load_dataset_ref': '02-attribute extraction.ipynb', 'get_datapackage_ref': '02-attribute extraction.ipynb', 'load_full_id_map': '02-attribute extraction.ipynb', 'determine_matched_ids': '02-attribute extraction.ipynb', 'delete_null_attributes': '02-attribute extraction.ipynb', 'delete_null_values': '02-attribute extraction.ipynb', 'format_attr_value_type': '02-attribute extraction.ipynb', 'format_all_attr_value_types': '02-attribute extraction.ipynb', 'extract_attrs_from_resource_dfs': '02-attribute extraction.ipynb', 'flatten_list': '02-attribute extraction.ipynb', 'drop_duplicates_attrs': '02-attribute extraction.ipynb', 'json_nan_to_none': '02-attribute extraction.ipynb', 'construct_dictionary_knowledge_graph': '02-attribute extraction.ipynb', 'single_site_data_to_ids_df': '03-page-population.ipynb', 'single_site_data_to_ids_md_str': '03-page-population.ipynb', 'get_datapackage_url_to_alt_indexes': '03-page-population.ipynb', 'get_datapackage_url_to_attributes': '03-page-population.ipynb', 'filter_dict': '03-page-population.ipynb', 'set_multi_index_names': '03-page-population.ipynb', 'create_multi_index_attrs_df': '03-page-population.ipynb', 'get_attrs_df_index_cols': '03-page-population.ipynb', 'create_single_index_attrs_df': '03-page-population.ipynb', 'idx_to_attr_name': '03-page-population.ipynb', 'get_field_class': '03-page-population.ipynb', 'format_attribute_value_types': '03-page-population.ipynb', 'construct_attr_to_field_schema': '03-page-population.ipynb', 'extract_datapackage_url_to_ids': '03-page-population.ipynb', 'extract_combined_attrs_df': '03-page-population.ipynb', 'extract_datapackage_url_to_dict_id_type': '03-page-population.ipynb', 'get_datapackage_url_to_attrs_md_str': '03-page-population.ipynb', 'construct_dataset_md_str': '03-page-population.ipynb', 'single_site_data_to_datasets_md_str': '03-page-population.ipynb', 'clean_dp_name': '03-page-population.ipynb', 'construct_downloads_md_str': '03-page-population.ipynb', 'extract_name_from_single_site_data': '03-page-population.ipynb', 'single_site_data_to_md_str': '03-page-population.ipynb', 'clean_object_ids_to_names': '03-page-population.ipynb', 'get_object_ids_to_names': '03-page-population.ipynb', 'construct_object_docs': '03-page-population.ipynb', 'resource_to_title': '07-dataset-pages.ipynb', 'resource_to_description': '07-dataset-pages.ipynb', 'package_to_homepage': '07-dataset-pages.ipynb', 'resource_to_fields_table_str': '07-dataset-pages.ipynb', 'extract_resource_elements': '07-dataset-pages.ipynb', 'extract_package_elements': '07-dataset-pages.ipynb', 'resource_to_download_url': '07-dataset-pages.ipynb', 'identify_valid_datasets': '07-dataset-pages.ipynb', 'update_mkdocs_config': '07-dataset-pages.ipynb', 'populate_dataset_pages': '07-dataset-pages.ipynb', 'move_attribute_source_data_to_docs': '07-dataset-pages.ipynb'} modules = ['dev/docs.py', 'dictionary.py', 'extraction.py', 'population.py', 'datasets.py'] doc_url = 'https://OSUKED.github.io/Power-Station-Dictionary/' git_url = 'https://github.com/OSUKED/Power-Station-Dictionary' def custom_doc_links(name): return None
# Holds the state of the program, such as the items stored in the inventory # The State class will only store data, and will not itself perform operations on data class State: def __init__(self, targetTier): # Information about the world self.itemDependencyGraph = {} # key: name of an item, value: a list of sub-items that consitute the item self.reverseItemDependencyGraph = {} # key: name of an item, value: a list of super-items that can be formed from the item self.itemToConstituents = {} # key: name of an item, value: a list of tuples (sub-item, instances) representing the item recipe self.itemToTier = {} # key: name of an item, value: an integer representing the tier of the item self.tierToItem = {} # key: an integer representing a tier, value: a list of item names in that tier self.tierToItem[targetTier] = [] # Information about the inventory self.itemNameToNumberOwned = {} # key: name of an item, value: an integer, representing the number of instances in the inventory # Information about goals self.itemDesireSatisfaction = {} # key: name of an item, value: a list [fulfillment, desires], representing the level of satisfaction of each item
class State: def __init__(self, targetTier): self.itemDependencyGraph = {} self.reverseItemDependencyGraph = {} self.itemToConstituents = {} self.itemToTier = {} self.tierToItem = {} self.tierToItem[targetTier] = [] self.itemNameToNumberOwned = {} self.itemDesireSatisfaction = {}
class Solution: def countRoutes(self, locations: List[int], start: int, finish: int, fuel: int) -> int: dp = [[-1] * 201 for _ in range(101)] MOD = 1000000007 def helper(pos, left): if left < 0: return 0 if dp[pos][left] != -1: return dp[pos][left] ans = 1 if pos == finish else 0 for i, loc in enumerate(locations): if i != pos and left - abs(loc - locations[pos]) >= 0: ans += helper(i, left - abs(loc - locations[pos])) ans %= MOD dp[pos][left] = ans return ans return helper(start, fuel)
class Solution: def count_routes(self, locations: List[int], start: int, finish: int, fuel: int) -> int: dp = [[-1] * 201 for _ in range(101)] mod = 1000000007 def helper(pos, left): if left < 0: return 0 if dp[pos][left] != -1: return dp[pos][left] ans = 1 if pos == finish else 0 for (i, loc) in enumerate(locations): if i != pos and left - abs(loc - locations[pos]) >= 0: ans += helper(i, left - abs(loc - locations[pos])) ans %= MOD dp[pos][left] = ans return ans return helper(start, fuel)
def make_averager(): ## Scope average implementation, with nonlocal to best performance. count = 0 total = 0 def averager(new_value): nonlocal count, total count += 1 total += new_value return total / count return averager
def make_averager(): count = 0 total = 0 def averager(new_value): nonlocal count, total count += 1 total += new_value return total / count return averager
class Solution: def isMatch(self, s, p): def compare(a, b): return a == '.' or a == b s = '=' + s + '=' p = '=' + p + '=' n = len(s) m = len(p) flag = [0] * n flag[0] = 1 cur = 1 while cur < m: target = p[cur] if cur + 1 < m and p[cur + 1] == '*': cur += 1 new_flag = flag.copy() for id in range(1, n): if new_flag[id-1] and compare(target, s[id]): new_flag[id] = 1 else: new_flag = [0] * n cnt = 0 for id in range(1, n): if flag[id-1] and compare(target, s[id]): new_flag[id] = 1 cnt += 1 if not cnt: return False cur += 1 flag = new_flag return True if flag[-1] else False def test(): cases = [ ('aa', 'a*'), ('ab', '.*'), ('aab', 'c*a*b'), ('mississippi', 'mis*is*p*.') ] sol = Solution() for case in cases: print(*case) print(sol.isMatch(*case)) if __name__ == '__main__': test()
class Solution: def is_match(self, s, p): def compare(a, b): return a == '.' or a == b s = '=' + s + '=' p = '=' + p + '=' n = len(s) m = len(p) flag = [0] * n flag[0] = 1 cur = 1 while cur < m: target = p[cur] if cur + 1 < m and p[cur + 1] == '*': cur += 1 new_flag = flag.copy() for id in range(1, n): if new_flag[id - 1] and compare(target, s[id]): new_flag[id] = 1 else: new_flag = [0] * n cnt = 0 for id in range(1, n): if flag[id - 1] and compare(target, s[id]): new_flag[id] = 1 cnt += 1 if not cnt: return False cur += 1 flag = new_flag return True if flag[-1] else False def test(): cases = [('aa', 'a*'), ('ab', '.*'), ('aab', 'c*a*b'), ('mississippi', 'mis*is*p*.')] sol = solution() for case in cases: print(*case) print(sol.isMatch(*case)) if __name__ == '__main__': test()
''' 01 - Bar chart Bar charts visualize data that is organized according to categories as a series of bars, where the height of each bar represents the values of the data in this category. For example, in this exercise, you will visualize the number of gold medals won by each country in the provided medals DataFrame. The DataFrame contains the countries as the index, and a column called "Gold" that contains the number of gold medals won by each country, according to their rows. Instructions: - Call the ax.bar method to plot the "Gold" column as a function of the country. - Use the ax.set_xticklabels to set the x-axis tick labels to be the country names. - In the call to ax.set_xticklabels rotate the x-axis tick labels by 90 degrees by using the rotation key-word argument. - Set the y-axis label to "Number of medals". ''' fig, ax = plt.subplots() # Plot a bar-chart of gold medals as a function of country ax.bar(medals.index, medals['Gold']) # Set the x-axis tick labels to the country names ax.set_xticklabels(medals.index, rotation=90) # Set the y-axis label ax.set_ylabel('Number of medals') plt.show()
""" 01 - Bar chart Bar charts visualize data that is organized according to categories as a series of bars, where the height of each bar represents the values of the data in this category. For example, in this exercise, you will visualize the number of gold medals won by each country in the provided medals DataFrame. The DataFrame contains the countries as the index, and a column called "Gold" that contains the number of gold medals won by each country, according to their rows. Instructions: - Call the ax.bar method to plot the "Gold" column as a function of the country. - Use the ax.set_xticklabels to set the x-axis tick labels to be the country names. - In the call to ax.set_xticklabels rotate the x-axis tick labels by 90 degrees by using the rotation key-word argument. - Set the y-axis label to "Number of medals". """ (fig, ax) = plt.subplots() ax.bar(medals.index, medals['Gold']) ax.set_xticklabels(medals.index, rotation=90) ax.set_ylabel('Number of medals') plt.show()
SPOTIFY_SCOPE = "user-read-playback-state user-modify-playback-state" SPOTIFY_CLIENT_ID = "123123adads" SPOTIFY_CLIENT_SECRET = "76756757jgjghgjh" # don't change or don't forget to update app.py as well SPOTIFY_REDIRECT_URI = "http://localhost:8080/callback"
spotify_scope = 'user-read-playback-state user-modify-playback-state' spotify_client_id = '123123adads' spotify_client_secret = '76756757jgjghgjh' spotify_redirect_uri = 'http://localhost:8080/callback'
words = input().split(" ") dictionary = {} for current_word in words: current_word = current_word.lower() if current_word not in dictionary: dictionary[current_word] = 0 dictionary[current_word] += 1 for key, value in dictionary.items(): if value % 2 != 0: print(key, end=" ")
words = input().split(' ') dictionary = {} for current_word in words: current_word = current_word.lower() if current_word not in dictionary: dictionary[current_word] = 0 dictionary[current_word] += 1 for (key, value) in dictionary.items(): if value % 2 != 0: print(key, end=' ')
class FunctionNotAllowed(Exception): ... class TelegramBaseException(Exception): ... class TelegramAPIException(TelegramBaseException): ... class TelegramDataObjectException(TelegramBaseException): ... class HandlerException(TelegramBaseException): ... class HandlerCloseException(TelegramBaseException): ... class DispatcherException(TelegramBaseException): ...
class Functionnotallowed(Exception): ... class Telegrambaseexception(Exception): ... class Telegramapiexception(TelegramBaseException): ... class Telegramdataobjectexception(TelegramBaseException): ... class Handlerexception(TelegramBaseException): ... class Handlercloseexception(TelegramBaseException): ... class Dispatcherexception(TelegramBaseException): ...
def check_bunch_match(bunch, symbol): res = True for one in bunch: if one != symbol: res = False break return res def get_ttt_winner(board): r, c = len(board), len(board[0]) for symbol in "XO": for ri in range(r): row = board[ri] if check_bunch_match(row, symbol): return symbol for ci in range(c): column = [board[ri][ci] for ri in range(r)] if check_bunch_match(column, symbol): return symbol diagonal_1 = [board[ri][ri] for ri in range(r)] diagonal_2 = [board[ri][c-ri-1] for ri in range(r)] if check_bunch_match(diagonal_1, symbol): return symbol if check_bunch_match(diagonal_2, symbol): return symbol return "N" board = [ ["X", "X", "X"], ["O", "X", " "], ["O", " ", "O"], ] r = get_ttt_winner(board) print(r)
def check_bunch_match(bunch, symbol): res = True for one in bunch: if one != symbol: res = False break return res def get_ttt_winner(board): (r, c) = (len(board), len(board[0])) for symbol in 'XO': for ri in range(r): row = board[ri] if check_bunch_match(row, symbol): return symbol for ci in range(c): column = [board[ri][ci] for ri in range(r)] if check_bunch_match(column, symbol): return symbol diagonal_1 = [board[ri][ri] for ri in range(r)] diagonal_2 = [board[ri][c - ri - 1] for ri in range(r)] if check_bunch_match(diagonal_1, symbol): return symbol if check_bunch_match(diagonal_2, symbol): return symbol return 'N' board = [['X', 'X', 'X'], ['O', 'X', ' '], ['O', ' ', 'O']] r = get_ttt_winner(board) print(r)
def concat(*args, sep="/"): return sep.join(args) print(concat("earth", "mars", "venus")) print(*list(range(5,10)))
def concat(*args, sep='/'): return sep.join(args) print(concat('earth', 'mars', 'venus')) print(*list(range(5, 10)))
def create_dictionaries(): JupiterMoons = ('Io','Europa','Ganymede','Callisto') Radius = (1821.6,1560.8,2634.1,2410.3) Gravity = (1.796,1.314,1.438,1.235) Orbit = (1.769,3.551,7.154,16.689) MeanRadius = dict() SurfaceGravity = dict() OrbitalPeriod = dict() for index in range(len(JupiterMoons)): MeanRadius[JupiterMoons[index]] = Radius[index] SurfaceGravity[JupiterMoons[index]] = Gravity[index] OrbitalPeriod[JupiterMoons[index]] = Orbit[index] return JupiterMoons,MeanRadius, SurfaceGravity,OrbitalPeriod def main(): JupiterMoons, MeanRadius, SurfaceGravity, OrbitalPeriod = create_dictionaries() print("This program displays information about Jupiter's Moons") print() print('The Moons are: ',end ='') for moon in JupiterMoons: print(moon + ' ',end='') print() choice = input('For which moon, would you like to see more information? ') print() if choice in JupiterMoons: print('Mean Radius in KM: ', MeanRadius[choice]) print('Surface Gravity in m/sec squared: ', SurfaceGravity[choice]) print('Orbital period in days: ',OrbitalPeriod[choice]) else: print('There is no moon by this name') main()
def create_dictionaries(): jupiter_moons = ('Io', 'Europa', 'Ganymede', 'Callisto') radius = (1821.6, 1560.8, 2634.1, 2410.3) gravity = (1.796, 1.314, 1.438, 1.235) orbit = (1.769, 3.551, 7.154, 16.689) mean_radius = dict() surface_gravity = dict() orbital_period = dict() for index in range(len(JupiterMoons)): MeanRadius[JupiterMoons[index]] = Radius[index] SurfaceGravity[JupiterMoons[index]] = Gravity[index] OrbitalPeriod[JupiterMoons[index]] = Orbit[index] return (JupiterMoons, MeanRadius, SurfaceGravity, OrbitalPeriod) def main(): (jupiter_moons, mean_radius, surface_gravity, orbital_period) = create_dictionaries() print("This program displays information about Jupiter's Moons") print() print('The Moons are: ', end='') for moon in JupiterMoons: print(moon + ' ', end='') print() choice = input('For which moon, would you like to see more information? ') print() if choice in JupiterMoons: print('Mean Radius in KM: ', MeanRadius[choice]) print('Surface Gravity in m/sec squared: ', SurfaceGravity[choice]) print('Orbital period in days: ', OrbitalPeriod[choice]) else: print('There is no moon by this name') main()
# Copyright 2018 - Nokia Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. def db_row_to_dict(row): return { 'id': row.id, 'project_id': row.project_id, 'is_admin_webhook': row.is_admin_webhook, 'created_at': row.created_at, 'url': row.url, 'regex_filter': row.regex_filter, 'headers': row.headers }
def db_row_to_dict(row): return {'id': row.id, 'project_id': row.project_id, 'is_admin_webhook': row.is_admin_webhook, 'created_at': row.created_at, 'url': row.url, 'regex_filter': row.regex_filter, 'headers': row.headers}
USER_AGENT_PRODUCT: str = "uHoo" USER_AGENT_PRODUCT_VERSION: str = "10.3.1" USER_AGENT_SYSTEM_INFORMATION: str = "iPhone;13.3; iOS 14.7.1; Scale/3.00" APP_VERSION: int = 93 CLIENT_ID: str = "0000000000000000000|0000000000000000000"
user_agent_product: str = 'uHoo' user_agent_product_version: str = '10.3.1' user_agent_system_information: str = 'iPhone;13.3; iOS 14.7.1; Scale/3.00' app_version: int = 93 client_id: str = '0000000000000000000|0000000000000000000'
def decoupling_softing_prepare(graph, sigma_square,lambda_input): # get W matrix, Z(for row sum) and Z_prime(for col sum), and A_tilde # get matrix W: A = np.array(nx.adjacency_matrix(graph).todense()) d = np.sum(A, axis=1) D = np.diag(d) # Alternative way(19): set Sigma_square = sigma_square./d, where sigma_square is fixed Sigma_square = np.divide(sigma_square,d) Sigma = np.diag(Sigma_square) W = np.dot(A,inv(Sigma)) w_col_sum = np.sum(W, axis=0) w_row_sum = np.sum(W, axis=1) Z_prime = np.diag(w_col_sum) Z = np.diag(w_row_sum) A_tilde = np.dot(np.dot(W,inv(Z_prime)),np.transpose(W)) # linear combination for both A and A_tilde A_result = (1 - lambda_input)* A + lambda_input * A_tilde return (A_result)
def decoupling_softing_prepare(graph, sigma_square, lambda_input): a = np.array(nx.adjacency_matrix(graph).todense()) d = np.sum(A, axis=1) d = np.diag(d) sigma_square = np.divide(sigma_square, d) sigma = np.diag(Sigma_square) w = np.dot(A, inv(Sigma)) w_col_sum = np.sum(W, axis=0) w_row_sum = np.sum(W, axis=1) z_prime = np.diag(w_col_sum) z = np.diag(w_row_sum) a_tilde = np.dot(np.dot(W, inv(Z_prime)), np.transpose(W)) a_result = (1 - lambda_input) * A + lambda_input * A_tilde return A_result