content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class APIError(Exception): """Error raised for non-200 API return codes Args: status_code(int): HTTP status code returned by the API message(str): Potential error message returned by the API Attributes: status_code(int): HTTP status code returned by the API message(str): Potential error message returned by the API """ def __init__(self, status_code, message): self.status_code = status_code self.message = message def __str__(self): return 'API error, {code}: {message}'.format(code=self.status_code, message=self.message) class ConnectionError(ConnectionError): """Error raised for connection level failures, such as a lost internet connection. Args: message(str): Potential error message returned by the requests library Attributes: message(str): Potential error message returned by the requests library """ def __init__(self, message): self.message = message def __str__(self): return 'Connection error: {}'.format(self.message) class AuthenticationError(Exception): """Error raised for nonrecoverable authentication failures. Args: message(str): Human readable error description Attributes: message(str): Human readable error description """ def __init__(self, message): self.message = message def __str__(self): return 'Authentication error: {}'.format(self.message)
class Apierror(Exception): """Error raised for non-200 API return codes Args: status_code(int): HTTP status code returned by the API message(str): Potential error message returned by the API Attributes: status_code(int): HTTP status code returned by the API message(str): Potential error message returned by the API """ def __init__(self, status_code, message): self.status_code = status_code self.message = message def __str__(self): return 'API error, {code}: {message}'.format(code=self.status_code, message=self.message) class Connectionerror(ConnectionError): """Error raised for connection level failures, such as a lost internet connection. Args: message(str): Potential error message returned by the requests library Attributes: message(str): Potential error message returned by the requests library """ def __init__(self, message): self.message = message def __str__(self): return 'Connection error: {}'.format(self.message) class Authenticationerror(Exception): """Error raised for nonrecoverable authentication failures. Args: message(str): Human readable error description Attributes: message(str): Human readable error description """ def __init__(self, message): self.message = message def __str__(self): return 'Authentication error: {}'.format(self.message)
size=int(input("enter size=")) numbers=[] for i in range(1,size+1): a=int(input("enter a=")) numbers.append(a) count=numbers.count(4) print(numbers) print("numbers of 4s in list=",count)
size = int(input('enter size=')) numbers = [] for i in range(1, size + 1): a = int(input('enter a=')) numbers.append(a) count = numbers.count(4) print(numbers) print('numbers of 4s in list=', count)
"""Constants for the Kuler Sky integration.""" DOMAIN = "kulersky" DATA_ADDRESSES = "addresses" DATA_DISCOVERY_SUBSCRIPTION = "discovery_subscription"
"""Constants for the Kuler Sky integration.""" domain = 'kulersky' data_addresses = 'addresses' data_discovery_subscription = 'discovery_subscription'
#!/usr/local/bin/python # -*- coding: utf-8 -*- # Author: illuz <iilluzen[at]gmail.com> # File: AC_mod_1.py # Create Date: 2015-08-17 00:44:30 # Usage: AC_mod_1.py # Descripton: class Solution: # @param {integer} num # @return {integer} def addDigits(self, num): return num % 9 or num and 9
class Solution: def add_digits(self, num): return num % 9 or (num and 9)
""" Set of Nagios probes for testing LFC grid service. Contains the following Nagios probe: LFC-probe. - The probes can run in active and/or passives modes (in Nagios sense). Publication of passive test results from inside of probes can be done via Nagios command file or NSCA. - On worker nodes Nagios is used as probes scheduler and executer. Metrics results from WNs are sent to Message Broker. .. packagetree:: :style: UML """ __docformat__ = 'restructuredtext en'
""" Set of Nagios probes for testing LFC grid service. Contains the following Nagios probe: LFC-probe. - The probes can run in active and/or passives modes (in Nagios sense). Publication of passive test results from inside of probes can be done via Nagios command file or NSCA. - On worker nodes Nagios is used as probes scheduler and executer. Metrics results from WNs are sent to Message Broker. .. packagetree:: :style: UML """ __docformat__ = 'restructuredtext en'
class Obj: def __init__(self, filename, swapyz=True, flipy=True): """Loads a Wavefront OBJ file. """ self.vertices = [] self.normals = [] self.texcoords = [] self.faces = [] self.plain_vertecies = [] self.plain_normals = [] self.plain_texcoords = [] material = None with open(filename, "r") as file: for line in file: if line.startswith('#'): continue values = line.split() if not values: continue if values[0] == 'v': v = list(map(float, values[1:4])) if swapyz: v = [v[0], v[2], v[1]] if flipy: v[1] *= -1 self.vertices.append(v) elif values[0] == 'vn': v = list(map(float, values[1:4])) if swapyz: v = [v[0], v[2], v[1]] if flipy: v[1] *= -1 self.normals.append(list(v)) elif values[0] == 'vt': t = list(map(float, values[1:3])) if flipy: t[1] = 1 - t[1] self.texcoords.append(t) elif values[0] in ('usemtl', 'usemat'): material = values[1] elif values[0] == 'mtllib': # self.mtl = MTL(values[1]) pass elif values[0] == 'f': vert = [] texcoords = [] norms = [] for v in values[1:]: w = v.split('/') vert.append(int(w[0]) - 1) if len(w) >= 2 and len(w[1]) > 0: texcoords.append(int(w[1]) - 1) else: texcoords.append(0) if len(w) >= 3 and len(w[2]) > 0: norms.append(int(w[2]) - 1) else: norms.append(0) self.faces.append((vert, norms, texcoords, material)) for f in self.faces: face_indices = f[0] vert = (self.vertices[face_indices[0]], self.vertices[face_indices[1]], self.vertices[face_indices[2]]) self.plain_vertecies.extend(vert) norm_indices = f[1] norms = (self.normals[norm_indices[0]], self.normals[norm_indices[1]], self.normals[norm_indices[2]]) self.plain_normals.extend(vert) tex_indices = f[2] tex = (self.texcoords[tex_indices[0]], self.texcoords[tex_indices[1]], self.texcoords[tex_indices[2]]) self.plain_texcoords.extend(tex) def get_pymunk_vertecies(self): result = list() for f in self.faces: for v_index in f[0]: result.append(list(self.vertices[v_index][:2])) return result
class Obj: def __init__(self, filename, swapyz=True, flipy=True): """Loads a Wavefront OBJ file. """ self.vertices = [] self.normals = [] self.texcoords = [] self.faces = [] self.plain_vertecies = [] self.plain_normals = [] self.plain_texcoords = [] material = None with open(filename, 'r') as file: for line in file: if line.startswith('#'): continue values = line.split() if not values: continue if values[0] == 'v': v = list(map(float, values[1:4])) if swapyz: v = [v[0], v[2], v[1]] if flipy: v[1] *= -1 self.vertices.append(v) elif values[0] == 'vn': v = list(map(float, values[1:4])) if swapyz: v = [v[0], v[2], v[1]] if flipy: v[1] *= -1 self.normals.append(list(v)) elif values[0] == 'vt': t = list(map(float, values[1:3])) if flipy: t[1] = 1 - t[1] self.texcoords.append(t) elif values[0] in ('usemtl', 'usemat'): material = values[1] elif values[0] == 'mtllib': pass elif values[0] == 'f': vert = [] texcoords = [] norms = [] for v in values[1:]: w = v.split('/') vert.append(int(w[0]) - 1) if len(w) >= 2 and len(w[1]) > 0: texcoords.append(int(w[1]) - 1) else: texcoords.append(0) if len(w) >= 3 and len(w[2]) > 0: norms.append(int(w[2]) - 1) else: norms.append(0) self.faces.append((vert, norms, texcoords, material)) for f in self.faces: face_indices = f[0] vert = (self.vertices[face_indices[0]], self.vertices[face_indices[1]], self.vertices[face_indices[2]]) self.plain_vertecies.extend(vert) norm_indices = f[1] norms = (self.normals[norm_indices[0]], self.normals[norm_indices[1]], self.normals[norm_indices[2]]) self.plain_normals.extend(vert) tex_indices = f[2] tex = (self.texcoords[tex_indices[0]], self.texcoords[tex_indices[1]], self.texcoords[tex_indices[2]]) self.plain_texcoords.extend(tex) def get_pymunk_vertecies(self): result = list() for f in self.faces: for v_index in f[0]: result.append(list(self.vertices[v_index][:2])) return result
# An object that will hold the type of current input with its respective value class Token: # type_ -> a type of token (from the list in constants) # value -> the actual value # pos_start -> Position of start of token (optional) # pos_end -> Position of end of token (optional) def __init__(self, type_, value=None, pos_start=None, pos_end=None): self.type = type_ self.value = value if pos_start: self.pos_start = pos_start.copy() # Position end would be one ahead of start self.pos_end = pos_start.copy() self.pos_end.advance() if pos_end: self.pos_end = pos_end def matches(self, type_, value): return self.type == type_ and self.value == value def __repr__(self): if self.value: return f'{self.type}: {self.value}' return f'{self.type}'
class Token: def __init__(self, type_, value=None, pos_start=None, pos_end=None): self.type = type_ self.value = value if pos_start: self.pos_start = pos_start.copy() self.pos_end = pos_start.copy() self.pos_end.advance() if pos_end: self.pos_end = pos_end def matches(self, type_, value): return self.type == type_ and self.value == value def __repr__(self): if self.value: return f'{self.type}: {self.value}' return f'{self.type}'
class Student: # class initialization method def __init__(self, name, birthday, courses): # class public attributes self.full_name = name self.first_name = name.split(' ')[0] self.birthday = birthday self.courses = courses self.attendance = [] # class public methods def is_colleague(self, other): course_intersection = self.courses.intersection(other.courses) return len(course_intersection) != 0 # A line starting with '@' is a decorator, it indicates that the following # function has a special behaviour, or is used for a different purpose. @staticmethod def from_csv(input_text): # csv: comma separated values # a static method that creates an object is also called 'Factory' csv = input_text.split(',') return Student(csv[0], csv[1], set(csv[2:])) # Objects john = Student('John Schneider', '2010-04-05', {'German', 'Arts', 'History'}) mary = Student('Mary von Neumann', '2010-05-06', {'German', 'Math', 'Geography', 'Science'}) # Creating a object with the from_csv function lucy = Student.from_csv('Lucy Schwarz,2010-07-08,English,Math,Dance') print(lucy.first_name, lucy.birthday, lucy.courses) # Lucy 2010-07-08 {'Dance', 'Math', 'English'} # Both objects have the same type. print(type(mary)) # <class '__main__.Student'> print(type(lucy)) # <class '__main__.Student'> # type() returns the name of the module and the class. # The name of the module changes when the module is loaded directly and when it # is imported. # If we import this file, the same code will print something like: # <class 'lesson_6.l607_class_method.Student'>
class Student: def __init__(self, name, birthday, courses): self.full_name = name self.first_name = name.split(' ')[0] self.birthday = birthday self.courses = courses self.attendance = [] def is_colleague(self, other): course_intersection = self.courses.intersection(other.courses) return len(course_intersection) != 0 @staticmethod def from_csv(input_text): csv = input_text.split(',') return student(csv[0], csv[1], set(csv[2:])) john = student('John Schneider', '2010-04-05', {'German', 'Arts', 'History'}) mary = student('Mary von Neumann', '2010-05-06', {'German', 'Math', 'Geography', 'Science'}) lucy = Student.from_csv('Lucy Schwarz,2010-07-08,English,Math,Dance') print(lucy.first_name, lucy.birthday, lucy.courses) print(type(mary)) print(type(lucy))
class Schedule(): r"""Base class for all schedules. Your schedules should also subclass this class. """ def __init__(self): pass def reset(self): r"""Resets the schedule.""" raise NotImplementedError def update(self): r"""Updates the schedule.""" raise NotImplementedError def value(self): r"""Get the value.""" raise NotImplementedError class LinearSchedule(Schedule): r"""Linearly updating schedule :param initial: the initial value :type initial: float :param delta: the additive delta :type delta: float """ def __init__(self, initial, delta): super(LinearSchedule, self).__init__() self.initial = initial self.current = initial self.delta = delta def reset(self): r"""Resets the schedule.""" self.current = self.initial def update(self): r"""Updates the schedule.""" self.current += self.delta def value(self): r"""Get the value.""" return self.current class ExponentialSchedule(Schedule): r"""Exponentially updating schedule :param initial: the initial value :type initial: float :param delta: the additive delta :type delta: float """ def __init__(self, initial, decay): super(ExponentialSchedule, self).__init__() self.initial = initial self.current = initial self.decay = decay def reset(self): r"""Resets the schedule.""" self.current = self.initial def update(self): r"""Updates the schedule.""" self.current *= self.decay def value(self): r"""Get the value.""" return self.current class BoundedSchedule(Schedule): r"""Bounded schedule :param schedule: the delegate scheule :type schedule: :class:`rlcc.schedule.Schedule` :param min: the additive delta :type min: float, optional :param max: the additive delta :type max: float, optional """ def __init__(self, schedule, min=None, max=None): super(BoundedSchedule, self).__init__() self.schedule = schedule self.min = min self.max = max def update(self): r"""Updates the schedule.""" self.schedule.update() def value(self): r"""Get the value.""" v = self.schedule.value() if self.min: v = max(v, self.min) if self.max: v = min(v, self.max) return v
class Schedule: """Base class for all schedules. Your schedules should also subclass this class. """ def __init__(self): pass def reset(self): """Resets the schedule.""" raise NotImplementedError def update(self): """Updates the schedule.""" raise NotImplementedError def value(self): """Get the value.""" raise NotImplementedError class Linearschedule(Schedule): """Linearly updating schedule :param initial: the initial value :type initial: float :param delta: the additive delta :type delta: float """ def __init__(self, initial, delta): super(LinearSchedule, self).__init__() self.initial = initial self.current = initial self.delta = delta def reset(self): """Resets the schedule.""" self.current = self.initial def update(self): """Updates the schedule.""" self.current += self.delta def value(self): """Get the value.""" return self.current class Exponentialschedule(Schedule): """Exponentially updating schedule :param initial: the initial value :type initial: float :param delta: the additive delta :type delta: float """ def __init__(self, initial, decay): super(ExponentialSchedule, self).__init__() self.initial = initial self.current = initial self.decay = decay def reset(self): """Resets the schedule.""" self.current = self.initial def update(self): """Updates the schedule.""" self.current *= self.decay def value(self): """Get the value.""" return self.current class Boundedschedule(Schedule): """Bounded schedule :param schedule: the delegate scheule :type schedule: :class:`rlcc.schedule.Schedule` :param min: the additive delta :type min: float, optional :param max: the additive delta :type max: float, optional """ def __init__(self, schedule, min=None, max=None): super(BoundedSchedule, self).__init__() self.schedule = schedule self.min = min self.max = max def update(self): """Updates the schedule.""" self.schedule.update() def value(self): """Get the value.""" v = self.schedule.value() if self.min: v = max(v, self.min) if self.max: v = min(v, self.max) return v
PV = int(input('Primeiro valor:')) SV = int(input('Segundo valor:')) TV = int(input('Terceiro valor:')) menor = PV if SV < PV and SV < TV: menor = SV if TV < PV and TV < SV: menor = TV maior = PV if SV > PV and SV > TV: maior = SV if TV > PV and TV > SV: maior = TV print(f'O menor valor digitado foi {menor}') print(f'O maior valor digitado foi {maior}')
pv = int(input('Primeiro valor:')) sv = int(input('Segundo valor:')) tv = int(input('Terceiro valor:')) menor = PV if SV < PV and SV < TV: menor = SV if TV < PV and TV < SV: menor = TV maior = PV if SV > PV and SV > TV: maior = SV if TV > PV and TV > SV: maior = TV print(f'O menor valor digitado foi {menor}') print(f'O maior valor digitado foi {maior}')
a=int(input("Enter a number ")) while(a>0): print(a) a=a-1
a = int(input('Enter a number ')) while a > 0: print(a) a = a - 1
conf_file = open("./online_exam_bot.config","r") lines = conf_file.readlines() data = [] conf = {} i = 0 for line in lines: if i <= 10: extracted = line.split("'") data.append(extracted) if i != 5: conf[data[i][1]] = data[i][3] else: pass i += 1
conf_file = open('./online_exam_bot.config', 'r') lines = conf_file.readlines() data = [] conf = {} i = 0 for line in lines: if i <= 10: extracted = line.split("'") data.append(extracted) if i != 5: conf[data[i][1]] = data[i][3] else: pass i += 1
def CloseGump(serial: int): """ Close a specified gump serial :param serial: An entity serial such as 0xf00ff00f. """ pass def ConfirmPrompt(str9: str, bool4: bool): """ Displays an ingame prompt with the specified message, returns True if Okay was pressed, False if not. :param str9: not documented :param bool4: not documented """ pass def GumpExists(int4: int): """ Checks if a gump id exists or not. :param int4: not documented """ pass def InGump(gumpid: int, text: str): """ Check for a text in gump. :param gumpid: An entity serial in integer or hex format, or an alias string such as "self". :param text: String value - See description for usage. """ pass def MessagePrompt(message: str, initialtext: str, closable: bool): """ Displays an ingame gump prompting for a message :param message: String value - See description for usage. :param initialtext: String value - See description for usage. (Optional) :param closable: True/False value, see description for usage. (Optional) """ pass def OpenGuildGump(): """ Opens the Guild gump """ pass def OpenQuestsGump(): """ Opens the Quests gump """ pass def OpenVirtueGump(obj): """ Opens the Virtue gump of the given serial/alias (defaults to current player) :param obj: An entity serial in integer or hex format, or an alias string such as "self". (Optional) """ pass def ReplyGump(gumpid: int, buttonid: int, switches: int, textentries: int, str6: str): """ Sends a button reply to server gump, parameters are gumpID and buttonID. :param gumpid: ItemID / Graphic such as 0x3db. :param buttonid: Gump button ID. :param switches: Integer value - See description for usage. (Optional) :param textentries: Not specified - See description for usage. (Optional) :param str6: not documented """ pass def SelectionPrompt(options: str, message: str, closable: bool): """ **Produces an in-game gump to choose from a list of options :param options: An array of strings. :param message: String value - See description for usage. (Optional) :param closable: True/False value, see description for usage. (Optional) """ pass def WaitForGump(gumpid: int, timeout: int): """ Pauses until incoming gump packet is received, optional paramters of gump ID and timeout :param gumpid: ItemID / Graphic such as 0x3db. (Optional) :param timeout: Timeout specified in milliseconds. (Optional) """ pass
def close_gump(serial: int): """ Close a specified gump serial :param serial: An entity serial such as 0xf00ff00f. """ pass def confirm_prompt(str9: str, bool4: bool): """ Displays an ingame prompt with the specified message, returns True if Okay was pressed, False if not. :param str9: not documented :param bool4: not documented """ pass def gump_exists(int4: int): """ Checks if a gump id exists or not. :param int4: not documented """ pass def in_gump(gumpid: int, text: str): """ Check for a text in gump. :param gumpid: An entity serial in integer or hex format, or an alias string such as "self". :param text: String value - See description for usage. """ pass def message_prompt(message: str, initialtext: str, closable: bool): """ Displays an ingame gump prompting for a message :param message: String value - See description for usage. :param initialtext: String value - See description for usage. (Optional) :param closable: True/False value, see description for usage. (Optional) """ pass def open_guild_gump(): """ Opens the Guild gump """ pass def open_quests_gump(): """ Opens the Quests gump """ pass def open_virtue_gump(obj): """ Opens the Virtue gump of the given serial/alias (defaults to current player) :param obj: An entity serial in integer or hex format, or an alias string such as "self". (Optional) """ pass def reply_gump(gumpid: int, buttonid: int, switches: int, textentries: int, str6: str): """ Sends a button reply to server gump, parameters are gumpID and buttonID. :param gumpid: ItemID / Graphic such as 0x3db. :param buttonid: Gump button ID. :param switches: Integer value - See description for usage. (Optional) :param textentries: Not specified - See description for usage. (Optional) :param str6: not documented """ pass def selection_prompt(options: str, message: str, closable: bool): """ **Produces an in-game gump to choose from a list of options :param options: An array of strings. :param message: String value - See description for usage. (Optional) :param closable: True/False value, see description for usage. (Optional) """ pass def wait_for_gump(gumpid: int, timeout: int): """ Pauses until incoming gump packet is received, optional paramters of gump ID and timeout :param gumpid: ItemID / Graphic such as 0x3db. (Optional) :param timeout: Timeout specified in milliseconds. (Optional) """ pass
def encryptRailFence(text, key): rail = [['\n' for i in range(len(text))] for j in range(key)] dir_down = False row, col = 0, 0 for i in range(len(text)): if (row == 0) or (row == key - 1): dir_down = not dir_down rail[row][col] = text[i] col += 1 if dir_down: row += 1 else: row -= 1 result = [] for i in range(key): for j in range(len(text)): if rail[i][j] != '\n': result.append(rail[i][j]) return("" . join(result))
def encrypt_rail_fence(text, key): rail = [['\n' for i in range(len(text))] for j in range(key)] dir_down = False (row, col) = (0, 0) for i in range(len(text)): if row == 0 or row == key - 1: dir_down = not dir_down rail[row][col] = text[i] col += 1 if dir_down: row += 1 else: row -= 1 result = [] for i in range(key): for j in range(len(text)): if rail[i][j] != '\n': result.append(rail[i][j]) return ''.join(result)
def func(): print("Hello") def func2(): print("world") l = [1,2,3,func, lambda x: x+1] print(l) print(l[3]()) print(l[4](2)) l2 = [func, func2] for i in l2: i()
def func(): print('Hello') def func2(): print('world') l = [1, 2, 3, func, lambda x: x + 1] print(l) print(l[3]()) print(l[4](2)) l2 = [func, func2] for i in l2: i()
# see http://python4astronomers.github.com/contest/bounce.html figure(1) clf() axis([-10, 10, -10, 10]) # Define properties of the "bouncing balls" n = 10 pos = (20 * random_sample(n*2) - 10).reshape(n, 2) vel = (0.3 * normal(size=n*2)).reshape(n, 2) sizes = 100 * random_sample(n) + 100 # Colors where each row is (Red, Green, Blue, Alpha). Each can go # from 0 to 1. Alpha is the transparency. colors = random_sample([n, 4]) # Draw all the circles and return an object ``circles`` that allows # manipulation of the plotted circles. circles = scatter(pos[:,0], pos[:,1], marker='o', s=sizes, c=colors) # gravity-like force in -y direction grav = -0.1*ones(20).reshape(n,2) grav[:,0] = 0. dt = 0.2 dt2 = dt**2 ax = gca() ax.set_xlim((-11.,11.)) ax.set_ylim((-11.,11.)) for i in range(1000): # repulsive force from walls at y = +11 and -11 frep = 0.1*(-1./(pos[:,0] - 11.)**2 + 1./(11. + pos[:,0])**2) frep = array(zip(frep,zeros(n))) pos = pos + vel*dt + 0.5*(grav + frep)*dt2 vel = vel + (grav + frep)*dt bounce = abs(pos) > 10 # Find balls that are outside walls vel[bounce] = -vel[bounce] # Bounce if outside the walls circles.set_offsets(pos) # Change the positions # circles change color after bouncing cc = where(bounce)[0] if len(cc) > 0: for j in cc: colors[j,0:3] = 1. - colors[j,0:3] draw()
figure(1) clf() axis([-10, 10, -10, 10]) n = 10 pos = (20 * random_sample(n * 2) - 10).reshape(n, 2) vel = (0.3 * normal(size=n * 2)).reshape(n, 2) sizes = 100 * random_sample(n) + 100 colors = random_sample([n, 4]) circles = scatter(pos[:, 0], pos[:, 1], marker='o', s=sizes, c=colors) grav = -0.1 * ones(20).reshape(n, 2) grav[:, 0] = 0.0 dt = 0.2 dt2 = dt ** 2 ax = gca() ax.set_xlim((-11.0, 11.0)) ax.set_ylim((-11.0, 11.0)) for i in range(1000): frep = 0.1 * (-1.0 / (pos[:, 0] - 11.0) ** 2 + 1.0 / (11.0 + pos[:, 0]) ** 2) frep = array(zip(frep, zeros(n))) pos = pos + vel * dt + 0.5 * (grav + frep) * dt2 vel = vel + (grav + frep) * dt bounce = abs(pos) > 10 vel[bounce] = -vel[bounce] circles.set_offsets(pos) cc = where(bounce)[0] if len(cc) > 0: for j in cc: colors[j, 0:3] = 1.0 - colors[j, 0:3] draw()
# Employee class class Employee: """A sample employee class""" raise_amt = 1.05 def __init__(self, first, last, pay): """Initialize employee class""" self.first = first self.last = last self.pay = pay #@property def email(self): """Return employee email address""" return '{}.{}@company.com'.format(self.first.lower(), self.last.lower()) #@property def fullname(self): """Return employee full name""" return '{} {}'.format(self.first, self.last) def apply_raise(self): """Calculates the employee pay raise""" self.pay = int(self.pay * self.raise_amt) #fullname('julius', 'nyule', 20000) # testing the class emp_1 = Employee('Julius', 'Nyule', 5000) emp_2 = Employee('Tsofa', 'Maestro', 2000) print(emp_1) # <__main__.Employee instance at 0x7f9c1d9bda70> print(emp_1.fullname()) print(emp_1.email())
class Employee: """A sample employee class""" raise_amt = 1.05 def __init__(self, first, last, pay): """Initialize employee class""" self.first = first self.last = last self.pay = pay def email(self): """Return employee email address""" return '{}.{}@company.com'.format(self.first.lower(), self.last.lower()) def fullname(self): """Return employee full name""" return '{} {}'.format(self.first, self.last) def apply_raise(self): """Calculates the employee pay raise""" self.pay = int(self.pay * self.raise_amt) emp_1 = employee('Julius', 'Nyule', 5000) emp_2 = employee('Tsofa', 'Maestro', 2000) print(emp_1) print(emp_1.fullname()) print(emp_1.email())
# # PySNMP MIB module TIARA-NETWORKS-CONFIG-MGMT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TIARA-NETWORKS-CONFIG-MGMT-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:16:27 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, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, ConstraintsUnion, ConstraintsIntersection, SingleValueConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsUnion", "ConstraintsIntersection", "SingleValueConstraint", "ValueRangeConstraint") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, NotificationType, ObjectIdentity, Unsigned32, Integer32, Gauge32, Bits, IpAddress, NotificationType, iso, MibIdentifier, ModuleIdentity, Counter32, Counter64 = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "NotificationType", "ObjectIdentity", "Unsigned32", "Integer32", "Gauge32", "Bits", "IpAddress", "NotificationType", "iso", "MibIdentifier", "ModuleIdentity", "Counter32", "Counter64") TextualConvention, DisplayString, TruthValue = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString", "TruthValue") tiaraMgmt, = mibBuilder.importSymbols("TIARA-NETWORKS-SMI", "tiaraMgmt") tiaraConfigMgmtMib = ModuleIdentity((1, 3, 6, 1, 4, 1, 3174, 2, 4)) tiaraConfigMgmtMib.setRevisions(('1900-08-16 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: tiaraConfigMgmtMib.setRevisionsDescriptions(('Initial version of this MIB module.',)) if mibBuilder.loadTexts: tiaraConfigMgmtMib.setLastUpdated('0008160000Z') if mibBuilder.loadTexts: tiaraConfigMgmtMib.setOrganization('Tiara Networks') if mibBuilder.loadTexts: tiaraConfigMgmtMib.setContactInfo(' Tiara Networks Customer Service 525 Race Street, Suite 100, San Jose, CA 95126 USA Tel: +1 408-216-4700 Fax: +1 408-216-4701 Email: support@tiaranetworks.com') if mibBuilder.loadTexts: tiaraConfigMgmtMib.setDescription('Configuration management MIB. This MIB represents a model of configuration data that exists in various locations: current In use by the running system. local Saved locally in NVRAM or flash. remote Saved to some server on the network. The purpose of this MIB is to track changes and saves of the current configuration.') cfgOperations = MibIdentifier((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1)) cfgMgmtEvents = MibIdentifier((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2)) cfgNotificationEnables = MibIdentifier((1, 3, 6, 1, 4, 1, 3174, 2, 4, 3)) cfgMgmtNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 3174, 2, 4, 4)) cfgNetOperTable = MibTable((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 1), ) if mibBuilder.loadTexts: cfgNetOperTable.setStatus('current') if mibBuilder.loadTexts: cfgNetOperTable.setDescription('A table of configuration from network operation entries. Each entry represents a separate operation to configure the system from a file located on a server on the network. The management station should create an entry with a random number as an index to perform the operation. The management station should then retrieve the entry with the same random number as an index and examine the value of the cfgNetOperStatus variable to get the status of the operation. ') cfgNetOperEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 1, 1), ).setIndexNames((0, "TIARA-NETWORKS-CONFIG-MGMT-MIB", "cfgNetOperRandomNumber")) if mibBuilder.loadTexts: cfgNetOperEntry.setStatus('current') if mibBuilder.loadTexts: cfgNetOperEntry.setDescription('Entry to initiate an operation. Each entry consists of a command and required parameters. Once the operation completes, the management station should retrieve the value of the status object and delete the entry from the table.') cfgNetOperRandomNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 1, 1, 1), Integer32()) if mibBuilder.loadTexts: cfgNetOperRandomNumber.setStatus('current') if mibBuilder.loadTexts: cfgNetOperRandomNumber.setDescription('Object specifying a unique entry in the table. A management station wishing to initiate a configuration operation should use a pseudo-random value for this object when creating a cfgNetOperEntry. ') cfgNetOperCommand = MibTableColumn((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("config", 1), ("save", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cfgNetOperCommand.setStatus('current') if mibBuilder.loadTexts: cfgNetOperCommand.setDescription('The commands to be executed configure from the network or save the configuration to the network. Command Remarks. config Configure from network. save Save configuration to network. ') cfgNetOperAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 1, 1, 3), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cfgNetOperAddress.setStatus('current') if mibBuilder.loadTexts: cfgNetOperAddress.setDescription('The Internet address of the server.') cfgNetOperFileName = MibTableColumn((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 1, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 64))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cfgNetOperFileName.setStatus('current') if mibBuilder.loadTexts: cfgNetOperFileName.setDescription('The destination or source file name on the network server. ') cfgNetOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("idle", 0), ("inProgress", 1), ("operationSuccess", 2), ("networkError", 3), ("fileAccessError", 4), ("serverAccessError", 5), ("fileOpenError", 6), ("notEnoughMemory", 7), ("unknownFailure", 8)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cfgNetOperStatus.setStatus('current') if mibBuilder.loadTexts: cfgNetOperStatus.setDescription('Represents the status of the operation. If the operation has not started or an operation is not being performed, then the value of this object would be idle(0).') cfgFlashOperTable = MibTable((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 2), ) if mibBuilder.loadTexts: cfgFlashOperTable.setStatus('current') if mibBuilder.loadTexts: cfgFlashOperTable.setDescription('A table of config/save from/to flash operation entries. Each entry represents a separate operation to configure the system from a file located on a local flash-file system. The management station should create an entry with a random number as an index to perform the operation. The management station should then retrive the entry with the same random number as an index and examine the value of the cfgFlashOperStatus variable to get the status of the operation. ') cfgFlashOperEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 2, 1), ).setIndexNames((0, "TIARA-NETWORKS-CONFIG-MGMT-MIB", "cfgFlashOperRandomNumber")) if mibBuilder.loadTexts: cfgFlashOperEntry.setStatus('current') if mibBuilder.loadTexts: cfgFlashOperEntry.setDescription('Entry to initiate an operation. Each entry consists of a command and required parameters. Once the operation completes, the management station should retrieve the value of the status object and delete the entry from the table. ') cfgFlashOperRandomNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 2, 1, 1), Integer32()) if mibBuilder.loadTexts: cfgFlashOperRandomNumber.setStatus('current') if mibBuilder.loadTexts: cfgFlashOperRandomNumber.setDescription('Object specifying a unique entry in the table. A management station wishing to initiate a configuration operation should use a pseudo-random value for this object when creating a cfgFlashOperEntry. ') cfgFlashOperCommand = MibTableColumn((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("save", 1), ("erase", 2), ("config", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cfgFlashOperCommand.setStatus('current') if mibBuilder.loadTexts: cfgFlashOperCommand.setDescription('The commands to be executed configure from the network or save the configuration to the network. Command Remarks. config Config from network. save Save the configuration to the network. ') cfgFlashOperFileName = MibTableColumn((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 2, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 64))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cfgFlashOperFileName.setStatus('current') if mibBuilder.loadTexts: cfgFlashOperFileName.setDescription('The destination or source file name on the network server. ') cfgFlashOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("idle", 0), ("inProgress", 1), ("operationSuccess", 2), ("networkError", 3), ("fileAccessError", 4), ("serverAccessError", 5), ("fileOpenError", 6), ("notEnoughMemory", 7), ("unknownFailure", 8)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cfgFlashOperStatus.setStatus('current') if mibBuilder.loadTexts: cfgFlashOperStatus.setDescription('The status of the operation. If the operation has not started or an operation is not being performed, then the value of this object would be idle(0). ') class CfgMedium(TextualConvention, Integer32): description = 'The source or destination of a configuration change, save, or copy. commandSource The source of the command. current Live operational data from RAM. flash Local flash. network Network host. ' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5)) namedValues = NamedValues(("commandSource", 1), ("current", 2), ("flash", 3), ("erase-flash", 4), ("network", 5)) cfgCurrentLastChanged = MibScalar((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 1), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfgCurrentLastChanged.setStatus('current') if mibBuilder.loadTexts: cfgCurrentLastChanged.setDescription('The last time the current configuration was changed.') cfgCurrentLastSaved = MibScalar((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 2), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfgCurrentLastSaved.setStatus('current') if mibBuilder.loadTexts: cfgCurrentLastSaved.setDescription('The last time the current configuration was saved.') cfgMaxEvents = MibScalar((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 20))).setMaxAccess("readonly") if mibBuilder.loadTexts: cfgMaxEvents.setStatus('current') if mibBuilder.loadTexts: cfgMaxEvents.setDescription('The maximum number of entries that can be held in the cfgEventTable. The system stores the 20 most recent history events in a circular style. These events are also saved to flash. Up to the last 10 entries can be saved if space is available in flash.') cfgEventTable = MibTable((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 4), ) if mibBuilder.loadTexts: cfgEventTable.setStatus('current') if mibBuilder.loadTexts: cfgEventTable.setDescription('A table of configuration history events.') cfgEventEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 4, 1), ).setIndexNames((0, "TIARA-NETWORKS-CONFIG-MGMT-MIB", "cfgEventIndex")) if mibBuilder.loadTexts: cfgEventEntry.setStatus('current') if mibBuilder.loadTexts: cfgEventEntry.setDescription('Entry holding information about a configuration event.') cfgEventIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 4, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 19))) if mibBuilder.loadTexts: cfgEventIndex.setStatus('current') if mibBuilder.loadTexts: cfgEventIndex.setDescription('Index in the history event table.') cfgEventTime = MibTableColumn((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 4, 1, 2), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfgEventTime.setStatus('current') if mibBuilder.loadTexts: cfgEventTime.setDescription('The time when the configuration occurred.') cfgEventConfigProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 4, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("commandLine", 1), ("snmp", 2), ("http", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cfgEventConfigProtocol.setStatus('current') if mibBuilder.loadTexts: cfgEventConfigProtocol.setDescription('The source of the command that resulted in the event.') cfgEventConfigSrc = MibTableColumn((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 4, 1, 4), CfgMedium()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfgEventConfigSrc.setStatus('current') if mibBuilder.loadTexts: cfgEventConfigSrc.setDescription('The configuration data source for the event.') cfgEventConfigDst = MibTableColumn((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 4, 1, 5), CfgMedium()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfgEventConfigDst.setStatus('current') if mibBuilder.loadTexts: cfgEventConfigDst.setDescription('The configuration data destination for the event.') cfgEventLoginType = MibTableColumn((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 4, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("unknown", 1), ("console", 2), ("telnet", 3), ("rlogin", 4), ("dial", 5), ("other", 6)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cfgEventLoginType.setStatus('current') if mibBuilder.loadTexts: cfgEventLoginType.setDescription('Configuration via telnet or rlogin, etc. ') cfgEventTerminalUser = MibTableColumn((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 4, 1, 7), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 15))).setMaxAccess("readonly") if mibBuilder.loadTexts: cfgEventTerminalUser.setStatus('current') if mibBuilder.loadTexts: cfgEventTerminalUser.setDescription('This object represents the logged in user name if configuration is via the CLI. It represents the community name if configuration is via SNMP. Otherwise, the object string length is zero if not available or not applicable.') cfgEventConfigSrcAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 4, 1, 8), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfgEventConfigSrcAddress.setStatus('current') if mibBuilder.loadTexts: cfgEventConfigSrcAddress.setDescription('The Internet address of the connected system. The value is 0.0.0.0 if not available or not applicable.') cfgEventFileName = MibTableColumn((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 4, 1, 9), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: cfgEventFileName.setStatus('current') if mibBuilder.loadTexts: cfgEventFileName.setDescription('If the system is set for configuration via a network, then this object represents the file name on some server.') cfgEnableChangeNotification = MibScalar((1, 3, 6, 1, 4, 1, 3174, 2, 4, 3, 1), TruthValue().clone('true')).setMaxAccess("readwrite") if mibBuilder.loadTexts: cfgEnableChangeNotification.setStatus('current') if mibBuilder.loadTexts: cfgEnableChangeNotification.setDescription('Indicates whether the system produces the cfgChangeNotification. The default is yes. ') cfgEnableSaveNotification = MibScalar((1, 3, 6, 1, 4, 1, 3174, 2, 4, 3, 2), TruthValue().clone('true')).setMaxAccess("readwrite") if mibBuilder.loadTexts: cfgEnableSaveNotification.setStatus('current') if mibBuilder.loadTexts: cfgEnableSaveNotification.setDescription('Indicates whether the system produces the cfgSaveNotification. The default is yes. ') cfgEventChangeNotification = NotificationType((1, 3, 6, 1, 4, 1, 3174, 2, 4, 4) + (0,1)).setObjects(("TIARA-NETWORKS-CONFIG-MGMT-MIB", "cfgEventConfigProtocol"), ("TIARA-NETWORKS-CONFIG-MGMT-MIB", "cfgEventConfigSrc"), ("TIARA-NETWORKS-CONFIG-MGMT-MIB", "cfgEventConfigDst")) if mibBuilder.loadTexts: cfgEventChangeNotification.setDescription('Send the configuration change event via either trap or info request PDU') cfgEventSaveNotification = NotificationType((1, 3, 6, 1, 4, 1, 3174, 2, 4, 4) + (0,2)).setObjects(("TIARA-NETWORKS-CONFIG-MGMT-MIB", "cfgEventConfigProtocol"), ("TIARA-NETWORKS-CONFIG-MGMT-MIB", "cfgEventConfigSrc"), ("TIARA-NETWORKS-CONFIG-MGMT-MIB", "cfgEventConfigDst")) if mibBuilder.loadTexts: cfgEventSaveNotification.setDescription('Send the configuration save event via either trap or info request PDU') mibBuilder.exportSymbols("TIARA-NETWORKS-CONFIG-MGMT-MIB", cfgNetOperStatus=cfgNetOperStatus, cfgEventTerminalUser=cfgEventTerminalUser, cfgEnableSaveNotification=cfgEnableSaveNotification, cfgFlashOperFileName=cfgFlashOperFileName, cfgEnableChangeNotification=cfgEnableChangeNotification, cfgEventConfigSrcAddress=cfgEventConfigSrcAddress, cfgNetOperAddress=cfgNetOperAddress, cfgNetOperEntry=cfgNetOperEntry, cfgFlashOperCommand=cfgFlashOperCommand, cfgNetOperTable=cfgNetOperTable, PYSNMP_MODULE_ID=tiaraConfigMgmtMib, cfgOperations=cfgOperations, cfgFlashOperEntry=cfgFlashOperEntry, cfgEventIndex=cfgEventIndex, cfgMaxEvents=cfgMaxEvents, cfgEventConfigDst=cfgEventConfigDst, cfgNetOperCommand=cfgNetOperCommand, cfgFlashOperTable=cfgFlashOperTable, cfgFlashOperStatus=cfgFlashOperStatus, cfgNetOperFileName=cfgNetOperFileName, cfgEventChangeNotification=cfgEventChangeNotification, cfgMgmtEvents=cfgMgmtEvents, cfgCurrentLastChanged=cfgCurrentLastChanged, cfgEventEntry=cfgEventEntry, cfgEventFileName=cfgEventFileName, cfgNotificationEnables=cfgNotificationEnables, tiaraConfigMgmtMib=tiaraConfigMgmtMib, cfgEventConfigSrc=cfgEventConfigSrc, cfgMgmtNotifications=cfgMgmtNotifications, CfgMedium=CfgMedium, cfgEventTable=cfgEventTable, cfgNetOperRandomNumber=cfgNetOperRandomNumber, cfgEventConfigProtocol=cfgEventConfigProtocol, cfgEventSaveNotification=cfgEventSaveNotification, cfgEventTime=cfgEventTime, cfgEventLoginType=cfgEventLoginType, cfgFlashOperRandomNumber=cfgFlashOperRandomNumber, cfgCurrentLastSaved=cfgCurrentLastSaved)
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_union, constraints_intersection, single_value_constraint, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ConstraintsUnion', 'ConstraintsIntersection', 'SingleValueConstraint', 'ValueRangeConstraint') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (mib_scalar, mib_table, mib_table_row, mib_table_column, time_ticks, notification_type, object_identity, unsigned32, integer32, gauge32, bits, ip_address, notification_type, iso, mib_identifier, module_identity, counter32, counter64) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'TimeTicks', 'NotificationType', 'ObjectIdentity', 'Unsigned32', 'Integer32', 'Gauge32', 'Bits', 'IpAddress', 'NotificationType', 'iso', 'MibIdentifier', 'ModuleIdentity', 'Counter32', 'Counter64') (textual_convention, display_string, truth_value) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString', 'TruthValue') (tiara_mgmt,) = mibBuilder.importSymbols('TIARA-NETWORKS-SMI', 'tiaraMgmt') tiara_config_mgmt_mib = module_identity((1, 3, 6, 1, 4, 1, 3174, 2, 4)) tiaraConfigMgmtMib.setRevisions(('1900-08-16 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: tiaraConfigMgmtMib.setRevisionsDescriptions(('Initial version of this MIB module.',)) if mibBuilder.loadTexts: tiaraConfigMgmtMib.setLastUpdated('0008160000Z') if mibBuilder.loadTexts: tiaraConfigMgmtMib.setOrganization('Tiara Networks') if mibBuilder.loadTexts: tiaraConfigMgmtMib.setContactInfo(' Tiara Networks Customer Service 525 Race Street, Suite 100, San Jose, CA 95126 USA Tel: +1 408-216-4700 Fax: +1 408-216-4701 Email: support@tiaranetworks.com') if mibBuilder.loadTexts: tiaraConfigMgmtMib.setDescription('Configuration management MIB. This MIB represents a model of configuration data that exists in various locations: current In use by the running system. local Saved locally in NVRAM or flash. remote Saved to some server on the network. The purpose of this MIB is to track changes and saves of the current configuration.') cfg_operations = mib_identifier((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1)) cfg_mgmt_events = mib_identifier((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2)) cfg_notification_enables = mib_identifier((1, 3, 6, 1, 4, 1, 3174, 2, 4, 3)) cfg_mgmt_notifications = mib_identifier((1, 3, 6, 1, 4, 1, 3174, 2, 4, 4)) cfg_net_oper_table = mib_table((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 1)) if mibBuilder.loadTexts: cfgNetOperTable.setStatus('current') if mibBuilder.loadTexts: cfgNetOperTable.setDescription('A table of configuration from network operation entries. Each entry represents a separate operation to configure the system from a file located on a server on the network. The management station should create an entry with a random number as an index to perform the operation. The management station should then retrieve the entry with the same random number as an index and examine the value of the cfgNetOperStatus variable to get the status of the operation. ') cfg_net_oper_entry = mib_table_row((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 1, 1)).setIndexNames((0, 'TIARA-NETWORKS-CONFIG-MGMT-MIB', 'cfgNetOperRandomNumber')) if mibBuilder.loadTexts: cfgNetOperEntry.setStatus('current') if mibBuilder.loadTexts: cfgNetOperEntry.setDescription('Entry to initiate an operation. Each entry consists of a command and required parameters. Once the operation completes, the management station should retrieve the value of the status object and delete the entry from the table.') cfg_net_oper_random_number = mib_table_column((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 1, 1, 1), integer32()) if mibBuilder.loadTexts: cfgNetOperRandomNumber.setStatus('current') if mibBuilder.loadTexts: cfgNetOperRandomNumber.setDescription('Object specifying a unique entry in the table. A management station wishing to initiate a configuration operation should use a pseudo-random value for this object when creating a cfgNetOperEntry. ') cfg_net_oper_command = mib_table_column((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('config', 1), ('save', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cfgNetOperCommand.setStatus('current') if mibBuilder.loadTexts: cfgNetOperCommand.setDescription('The commands to be executed configure from the network or save the configuration to the network. Command Remarks. config Configure from network. save Save configuration to network. ') cfg_net_oper_address = mib_table_column((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 1, 1, 3), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cfgNetOperAddress.setStatus('current') if mibBuilder.loadTexts: cfgNetOperAddress.setDescription('The Internet address of the server.') cfg_net_oper_file_name = mib_table_column((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 1, 1, 4), display_string().subtype(subtypeSpec=value_size_constraint(1, 64))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cfgNetOperFileName.setStatus('current') if mibBuilder.loadTexts: cfgNetOperFileName.setDescription('The destination or source file name on the network server. ') cfg_net_oper_status = mib_table_column((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 1, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=named_values(('idle', 0), ('inProgress', 1), ('operationSuccess', 2), ('networkError', 3), ('fileAccessError', 4), ('serverAccessError', 5), ('fileOpenError', 6), ('notEnoughMemory', 7), ('unknownFailure', 8)))).setMaxAccess('readonly') if mibBuilder.loadTexts: cfgNetOperStatus.setStatus('current') if mibBuilder.loadTexts: cfgNetOperStatus.setDescription('Represents the status of the operation. If the operation has not started or an operation is not being performed, then the value of this object would be idle(0).') cfg_flash_oper_table = mib_table((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 2)) if mibBuilder.loadTexts: cfgFlashOperTable.setStatus('current') if mibBuilder.loadTexts: cfgFlashOperTable.setDescription('A table of config/save from/to flash operation entries. Each entry represents a separate operation to configure the system from a file located on a local flash-file system. The management station should create an entry with a random number as an index to perform the operation. The management station should then retrive the entry with the same random number as an index and examine the value of the cfgFlashOperStatus variable to get the status of the operation. ') cfg_flash_oper_entry = mib_table_row((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 2, 1)).setIndexNames((0, 'TIARA-NETWORKS-CONFIG-MGMT-MIB', 'cfgFlashOperRandomNumber')) if mibBuilder.loadTexts: cfgFlashOperEntry.setStatus('current') if mibBuilder.loadTexts: cfgFlashOperEntry.setDescription('Entry to initiate an operation. Each entry consists of a command and required parameters. Once the operation completes, the management station should retrieve the value of the status object and delete the entry from the table. ') cfg_flash_oper_random_number = mib_table_column((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 2, 1, 1), integer32()) if mibBuilder.loadTexts: cfgFlashOperRandomNumber.setStatus('current') if mibBuilder.loadTexts: cfgFlashOperRandomNumber.setDescription('Object specifying a unique entry in the table. A management station wishing to initiate a configuration operation should use a pseudo-random value for this object when creating a cfgFlashOperEntry. ') cfg_flash_oper_command = mib_table_column((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 2, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('save', 1), ('erase', 2), ('config', 3)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cfgFlashOperCommand.setStatus('current') if mibBuilder.loadTexts: cfgFlashOperCommand.setDescription('The commands to be executed configure from the network or save the configuration to the network. Command Remarks. config Config from network. save Save the configuration to the network. ') cfg_flash_oper_file_name = mib_table_column((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 2, 1, 3), display_string().subtype(subtypeSpec=value_size_constraint(1, 64))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cfgFlashOperFileName.setStatus('current') if mibBuilder.loadTexts: cfgFlashOperFileName.setDescription('The destination or source file name on the network server. ') cfg_flash_oper_status = mib_table_column((1, 3, 6, 1, 4, 1, 3174, 2, 4, 1, 2, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=named_values(('idle', 0), ('inProgress', 1), ('operationSuccess', 2), ('networkError', 3), ('fileAccessError', 4), ('serverAccessError', 5), ('fileOpenError', 6), ('notEnoughMemory', 7), ('unknownFailure', 8)))).setMaxAccess('readonly') if mibBuilder.loadTexts: cfgFlashOperStatus.setStatus('current') if mibBuilder.loadTexts: cfgFlashOperStatus.setDescription('The status of the operation. If the operation has not started or an operation is not being performed, then the value of this object would be idle(0). ') class Cfgmedium(TextualConvention, Integer32): description = 'The source or destination of a configuration change, save, or copy. commandSource The source of the command. current Live operational data from RAM. flash Local flash. network Network host. ' status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4, 5)) named_values = named_values(('commandSource', 1), ('current', 2), ('flash', 3), ('erase-flash', 4), ('network', 5)) cfg_current_last_changed = mib_scalar((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 1), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfgCurrentLastChanged.setStatus('current') if mibBuilder.loadTexts: cfgCurrentLastChanged.setDescription('The last time the current configuration was changed.') cfg_current_last_saved = mib_scalar((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 2), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfgCurrentLastSaved.setStatus('current') if mibBuilder.loadTexts: cfgCurrentLastSaved.setDescription('The last time the current configuration was saved.') cfg_max_events = mib_scalar((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 3), integer32().subtype(subtypeSpec=value_range_constraint(0, 20))).setMaxAccess('readonly') if mibBuilder.loadTexts: cfgMaxEvents.setStatus('current') if mibBuilder.loadTexts: cfgMaxEvents.setDescription('The maximum number of entries that can be held in the cfgEventTable. The system stores the 20 most recent history events in a circular style. These events are also saved to flash. Up to the last 10 entries can be saved if space is available in flash.') cfg_event_table = mib_table((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 4)) if mibBuilder.loadTexts: cfgEventTable.setStatus('current') if mibBuilder.loadTexts: cfgEventTable.setDescription('A table of configuration history events.') cfg_event_entry = mib_table_row((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 4, 1)).setIndexNames((0, 'TIARA-NETWORKS-CONFIG-MGMT-MIB', 'cfgEventIndex')) if mibBuilder.loadTexts: cfgEventEntry.setStatus('current') if mibBuilder.loadTexts: cfgEventEntry.setDescription('Entry holding information about a configuration event.') cfg_event_index = mib_table_column((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 4, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 19))) if mibBuilder.loadTexts: cfgEventIndex.setStatus('current') if mibBuilder.loadTexts: cfgEventIndex.setDescription('Index in the history event table.') cfg_event_time = mib_table_column((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 4, 1, 2), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfgEventTime.setStatus('current') if mibBuilder.loadTexts: cfgEventTime.setDescription('The time when the configuration occurred.') cfg_event_config_protocol = mib_table_column((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 4, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('commandLine', 1), ('snmp', 2), ('http', 3)))).setMaxAccess('readonly') if mibBuilder.loadTexts: cfgEventConfigProtocol.setStatus('current') if mibBuilder.loadTexts: cfgEventConfigProtocol.setDescription('The source of the command that resulted in the event.') cfg_event_config_src = mib_table_column((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 4, 1, 4), cfg_medium()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfgEventConfigSrc.setStatus('current') if mibBuilder.loadTexts: cfgEventConfigSrc.setDescription('The configuration data source for the event.') cfg_event_config_dst = mib_table_column((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 4, 1, 5), cfg_medium()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfgEventConfigDst.setStatus('current') if mibBuilder.loadTexts: cfgEventConfigDst.setDescription('The configuration data destination for the event.') cfg_event_login_type = mib_table_column((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 4, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('unknown', 1), ('console', 2), ('telnet', 3), ('rlogin', 4), ('dial', 5), ('other', 6)))).setMaxAccess('readonly') if mibBuilder.loadTexts: cfgEventLoginType.setStatus('current') if mibBuilder.loadTexts: cfgEventLoginType.setDescription('Configuration via telnet or rlogin, etc. ') cfg_event_terminal_user = mib_table_column((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 4, 1, 7), display_string().subtype(subtypeSpec=value_size_constraint(0, 15))).setMaxAccess('readonly') if mibBuilder.loadTexts: cfgEventTerminalUser.setStatus('current') if mibBuilder.loadTexts: cfgEventTerminalUser.setDescription('This object represents the logged in user name if configuration is via the CLI. It represents the community name if configuration is via SNMP. Otherwise, the object string length is zero if not available or not applicable.') cfg_event_config_src_address = mib_table_column((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 4, 1, 8), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfgEventConfigSrcAddress.setStatus('current') if mibBuilder.loadTexts: cfgEventConfigSrcAddress.setDescription('The Internet address of the connected system. The value is 0.0.0.0 if not available or not applicable.') cfg_event_file_name = mib_table_column((1, 3, 6, 1, 4, 1, 3174, 2, 4, 2, 4, 1, 9), display_string().subtype(subtypeSpec=value_size_constraint(0, 64))).setMaxAccess('readonly') if mibBuilder.loadTexts: cfgEventFileName.setStatus('current') if mibBuilder.loadTexts: cfgEventFileName.setDescription('If the system is set for configuration via a network, then this object represents the file name on some server.') cfg_enable_change_notification = mib_scalar((1, 3, 6, 1, 4, 1, 3174, 2, 4, 3, 1), truth_value().clone('true')).setMaxAccess('readwrite') if mibBuilder.loadTexts: cfgEnableChangeNotification.setStatus('current') if mibBuilder.loadTexts: cfgEnableChangeNotification.setDescription('Indicates whether the system produces the cfgChangeNotification. The default is yes. ') cfg_enable_save_notification = mib_scalar((1, 3, 6, 1, 4, 1, 3174, 2, 4, 3, 2), truth_value().clone('true')).setMaxAccess('readwrite') if mibBuilder.loadTexts: cfgEnableSaveNotification.setStatus('current') if mibBuilder.loadTexts: cfgEnableSaveNotification.setDescription('Indicates whether the system produces the cfgSaveNotification. The default is yes. ') cfg_event_change_notification = notification_type((1, 3, 6, 1, 4, 1, 3174, 2, 4, 4) + (0, 1)).setObjects(('TIARA-NETWORKS-CONFIG-MGMT-MIB', 'cfgEventConfigProtocol'), ('TIARA-NETWORKS-CONFIG-MGMT-MIB', 'cfgEventConfigSrc'), ('TIARA-NETWORKS-CONFIG-MGMT-MIB', 'cfgEventConfigDst')) if mibBuilder.loadTexts: cfgEventChangeNotification.setDescription('Send the configuration change event via either trap or info request PDU') cfg_event_save_notification = notification_type((1, 3, 6, 1, 4, 1, 3174, 2, 4, 4) + (0, 2)).setObjects(('TIARA-NETWORKS-CONFIG-MGMT-MIB', 'cfgEventConfigProtocol'), ('TIARA-NETWORKS-CONFIG-MGMT-MIB', 'cfgEventConfigSrc'), ('TIARA-NETWORKS-CONFIG-MGMT-MIB', 'cfgEventConfigDst')) if mibBuilder.loadTexts: cfgEventSaveNotification.setDescription('Send the configuration save event via either trap or info request PDU') mibBuilder.exportSymbols('TIARA-NETWORKS-CONFIG-MGMT-MIB', cfgNetOperStatus=cfgNetOperStatus, cfgEventTerminalUser=cfgEventTerminalUser, cfgEnableSaveNotification=cfgEnableSaveNotification, cfgFlashOperFileName=cfgFlashOperFileName, cfgEnableChangeNotification=cfgEnableChangeNotification, cfgEventConfigSrcAddress=cfgEventConfigSrcAddress, cfgNetOperAddress=cfgNetOperAddress, cfgNetOperEntry=cfgNetOperEntry, cfgFlashOperCommand=cfgFlashOperCommand, cfgNetOperTable=cfgNetOperTable, PYSNMP_MODULE_ID=tiaraConfigMgmtMib, cfgOperations=cfgOperations, cfgFlashOperEntry=cfgFlashOperEntry, cfgEventIndex=cfgEventIndex, cfgMaxEvents=cfgMaxEvents, cfgEventConfigDst=cfgEventConfigDst, cfgNetOperCommand=cfgNetOperCommand, cfgFlashOperTable=cfgFlashOperTable, cfgFlashOperStatus=cfgFlashOperStatus, cfgNetOperFileName=cfgNetOperFileName, cfgEventChangeNotification=cfgEventChangeNotification, cfgMgmtEvents=cfgMgmtEvents, cfgCurrentLastChanged=cfgCurrentLastChanged, cfgEventEntry=cfgEventEntry, cfgEventFileName=cfgEventFileName, cfgNotificationEnables=cfgNotificationEnables, tiaraConfigMgmtMib=tiaraConfigMgmtMib, cfgEventConfigSrc=cfgEventConfigSrc, cfgMgmtNotifications=cfgMgmtNotifications, CfgMedium=CfgMedium, cfgEventTable=cfgEventTable, cfgNetOperRandomNumber=cfgNetOperRandomNumber, cfgEventConfigProtocol=cfgEventConfigProtocol, cfgEventSaveNotification=cfgEventSaveNotification, cfgEventTime=cfgEventTime, cfgEventLoginType=cfgEventLoginType, cfgFlashOperRandomNumber=cfgFlashOperRandomNumber, cfgCurrentLastSaved=cfgCurrentLastSaved)
# -*- coding: utf-8 -*- # 16/12/15 # create by: snower FORMATER = "watoee.formaters.formater.Formater" SERIALIZE = "watoee.serializes.jsonserialize.JsonSerialize"
formater = 'watoee.formaters.formater.Formater' serialize = 'watoee.serializes.jsonserialize.JsonSerialize'
""" Good morning! Here's your coding interview problem for today. This problem was asked by Uber. Given a binary tree and an integer k, return whether there exists a root-to-leaf path that sums up to k. For example, given k = 18 and the following binary tree: 8 / \ 4 13 / \ \ 2 6 19 Return True since the path 8 -> 4 -> 6 sums to 18. """ class BinaryTree: def __init__(self): self.root = None def add_value(self, value): """Takes in a value and adds it to the binary tree""" if not self.root: self.root = Node(value) else: previous = self.root current = self.root.right if value >= self.root.value else self.root.left while current: previous = current current = current.right if value >= current.value else current.left if value >= previous.value: previous.right = Node(value) else: previous.left = Node(value) def find_if_sum_exists(self, total): """Checks if the sume of a total exists in the tree paths and returns True or False otherwise""" tracker = [(self.root, self.root.value)] while len(tracker) > 0: current = tracker.pop() right_node = current[0].right left_node = current[0].left if right_node: right_value = right_node.value new_total = current[1] + right_value if new_total == total: return True else: tracker.append((right_node, new_total)) if left_node: left_value = left_node.value new_total = current[1] + left_value if new_total == total: return True else: tracker.append((left_node, new_total)) return False class Node: def __init__(self, value): self.value = value self.left = None self.right = None
""" Good morning! Here's your coding interview problem for today. This problem was asked by Uber. Given a binary tree and an integer k, return whether there exists a root-to-leaf path that sums up to k. For example, given k = 18 and the following binary tree: 8 / 4 13 / \\ 2 6 19 Return True since the path 8 -> 4 -> 6 sums to 18. """ class Binarytree: def __init__(self): self.root = None def add_value(self, value): """Takes in a value and adds it to the binary tree""" if not self.root: self.root = node(value) else: previous = self.root current = self.root.right if value >= self.root.value else self.root.left while current: previous = current current = current.right if value >= current.value else current.left if value >= previous.value: previous.right = node(value) else: previous.left = node(value) def find_if_sum_exists(self, total): """Checks if the sume of a total exists in the tree paths and returns True or False otherwise""" tracker = [(self.root, self.root.value)] while len(tracker) > 0: current = tracker.pop() right_node = current[0].right left_node = current[0].left if right_node: right_value = right_node.value new_total = current[1] + right_value if new_total == total: return True else: tracker.append((right_node, new_total)) if left_node: left_value = left_node.value new_total = current[1] + left_value if new_total == total: return True else: tracker.append((left_node, new_total)) return False class Node: def __init__(self, value): self.value = value self.left = None self.right = None
def deci_func_logger(_func=None, *, name: str = 'abstract_decorator'): """ This decorator is used to wrap our functions with logs. It will log every enter and exit of the functon with the equivalent parameters as extras. It will also log exceptions that raises in the function. It will also log the exception time of the function. How it works:` First it will check if the decorator called with name keyword. If so it will return a new decorator that its logger is the name parameter. If not it will return a new decorator that its logger is the wrapped function name. Then the return decorator will return a new function that warps the original function with the new logs. For further understanding advise real-python "fancy decorators documentation" Args: _func (): used when called without name specify. dont pass it directly name (): The name of the logger to save logs by. Returns: a decorator that wraps function with logs logic. """ # TODO: Not Working - Breaks the code, tests does not pass (s3 connector, platform...) # TODO: Fix problem with ExplicitParamValidation error (arguments not passed) # TODO: Run ALL test suite of deci2 (NOT circieCI test suite, but ALL the tests under tests folders) # TODO: Delete/Update all failing tests. # def deci_logger_decorator(fn): # # @functools.wraps(fn) # def wrapper_func(*args, **kwargs): # try: # # try: # logger.debug(f"Start: {fn.__name__}", extra={"args": args, "kwargs": kwargs}) # time1 = time.perf_counter() # except Exception: # # failed to write log - continue. # pass # # result = fn(*args, **kwargs) # # try: # time2 = time.perf_counter() # logger.debug(f"End: {fn.__name__}", # extra={'duration': (time2 - time1) * 1000.0, 'return_value': result}) # except Exception: # # failed to write log - continue. # pass # # return result # # except Exception as ex: # # This exception was raised from inside the function call # logger.error(f"Exception: {ex}", exc_info=ex) # raise ex # # return wrapper_func # if _func is None: # logger = get_logger(name) # return deci_logger_decorator # else: # logger = get_logger(_func.__name__) # return deci_logger_decorator(_func) return _func def deci_class_logger(): """ This decorator wraps every class method with deci_func_logger decorator. It works by checking if class method is callable and if so it will set a new decorated method as the same method name. """ def wrapper(cls): # TODO: Not Working - Breaks the code, tests does not pass (s3 connector, platform...) # TODO: Fix problem with ExplicitParamValidation error (arguments not passed) # TODO: Run ALL test suite of deci2 (NOT circieCI test suite, but ALL the tests under tests folders) # TODO: Delete/Update all failing tests. # for attr in cls.__dict__: # if callable(getattr(cls, attr)) and attr != '__init__': # decorated_function = deci_func_logger(name=cls.__name__)(getattr(cls, attr)) # if type(cls.__dict__[attr]) is staticmethod: # decorated_function = staticmethod(decorated_function) # setattr(cls, attr, decorated_function) return cls return wrapper
def deci_func_logger(_func=None, *, name: str='abstract_decorator'): """ This decorator is used to wrap our functions with logs. It will log every enter and exit of the functon with the equivalent parameters as extras. It will also log exceptions that raises in the function. It will also log the exception time of the function. How it works:` First it will check if the decorator called with name keyword. If so it will return a new decorator that its logger is the name parameter. If not it will return a new decorator that its logger is the wrapped function name. Then the return decorator will return a new function that warps the original function with the new logs. For further understanding advise real-python "fancy decorators documentation" Args: _func (): used when called without name specify. dont pass it directly name (): The name of the logger to save logs by. Returns: a decorator that wraps function with logs logic. """ return _func def deci_class_logger(): """ This decorator wraps every class method with deci_func_logger decorator. It works by checking if class method is callable and if so it will set a new decorated method as the same method name. """ def wrapper(cls): return cls return wrapper
#----------------------------------------------------------------------------- # Copyright (c) 2005-2017, PyInstaller Development Team. # # Distributed under the terms of the GNU General Public License with exception # for distributing bootloader. # # The full license is in the file COPYING.txt, distributed with this software. #----------------------------------------------------------------------------- def pre_safe_import_module(api): # PyGObject modules loaded through the gi repository are marked as # MissingModules by modulegraph so we convert them to # RuntimeModules so their hooks are loaded and run. api.add_runtime_module(api.module_name)
def pre_safe_import_module(api): api.add_runtime_module(api.module_name)
#Get the number at a specified row and column in Pascal's triangle def getNumber(row, column): if (column == 0) or (row == 0) or (column == row): return 1 else: return getNumber(row - 1, column - 1) + getNumber(row - 1, column) if __name__ == "__main__": row = int(input()) col = int(input()) print(getNumber(row, col))
def get_number(row, column): if column == 0 or row == 0 or column == row: return 1 else: return get_number(row - 1, column - 1) + get_number(row - 1, column) if __name__ == '__main__': row = int(input()) col = int(input()) print(get_number(row, col))
class Today: def __init__(self, cases, deaths, recoveries): self.cases = cases self.deaths = deaths self.recoveries = recoveries class PerMillion: def __init__(self, cases, deaths, tests, active, recoveries, critical): self.cases = cases self.deaths = deaths self.tests = tests self.active = active self.recoveries = recoveries self.critical = critical class PerPeople: def __init__(self, case, death, test): self.case = case self.death = death self.test = test class Global: def __init__(self, cases, deaths, recoveries, today, total_critical, active, tests, per_million, per_people, population, affected_countries, updated): self.cases = cases self.deaths = deaths self.recoveries = recoveries self.today = today self.critical = total_critical self.active = active self.tests = tests self.per_million = per_million self.per_people = per_people self.population = population self.affected_countries = affected_countries self.updated = updated class CountryInfo: def __init__(self, _id, iso2, iso3, _lat, _long, flag): self.id = _id self.iso2 = iso2 self.iso3 = iso3 self.latitude = _lat self.longitude = _long self.flag = flag class Country: def __init__(self, info, name, cases, deaths, recoveries, today, critical, active, tests, per_million, per_people, continent, population, updated): self.info = info self.name = name self.cases = cases self.deaths = deaths self.recoveries = recoveries self.today = today self.critical = critical self.active = active self.tests = tests self.per_million = per_million self.per_people = per_people self.continent = continent self.population = population self.updated = updated class StateToday: def __init__(self, cases, deaths): self.cases = cases self.deaths = deaths class StatePerMillion: def __init__(self, cases, deaths, tests): self.cases = cases self.deaths = deaths self.tests = tests class State: def __init__(self, name, cases, deaths, today, active, tests, per_million): self.name = name self.cases = cases self.deaths = deaths self.today = today self.active = active self.tests = tests self.per_million = per_million class HistoryEntry: def __init__(self, date, value): self.date = date self.value = value class History: def __init__(self, cases, deaths, recoveries): self.cases = cases self.deaths = deaths self.recoveries = recoveries class Historical: def __init__(self, name, province, history): self.name = name self.province = province or None self.history = history class JhuCsse: def __init__(self, country, province, county, updated, confirmed_cases, deaths, recoveries, _lat, _long): self.country_name = country self.province_name = province self.county_name = county self.updated = updated self.confirmed_cases = confirmed_cases self.deaths = deaths self.recoveries = recoveries self.latitude = _lat self.longitude = _long class Continent: def __init__(self, name, countries, cases, deaths, recoveries, critical, active, tests, today, per_million, population, updated): self.name = name self.countries = countries self.cases = cases self.deaths = deaths self.recoveries = recoveries self.critical = critical self.active = active self.tests = tests self.today = today self.per_million = per_million self.population = population self.updated = updated class NewYorkTimesUsa: def __init__(self, date, cases, deaths): self.date = date self.cases = cases self.deaths = deaths class NewYorkTimesState: def __init__(self, date, state, fips, cases, deaths): self.date = date self.state = state self.fips = int(fips) if fips else None self.cases = cases self.deaths = deaths class NewYorkTimesCounty: def __init__(self, date, county, state, fips, cases, deaths): self.date = date self.county = county self.state = state self.fips = int(fips) if fips else None self.cases = cases self.deaths = deaths class AppleSubregions: def __init__(self, country, subregions): self.country = country self.subregions = subregions class AppleSubregion: def __init__(self, subregion, statistics): self.subregion = subregion self.statistics = statistics class Mobility: def __init__(self, name, _type, date, driving, transit, walking): self.name = name self.type = _type self.date = date self.driving = driving self.transit = transit self.walking = walking class Vaccine: def __init__(self, candidate, sponsors, details, phase, institutions, funding): self.candidate = candidate self.sponsors = sponsors self.details = details self.phase = phase self.institutions = institutions self.funding = funding class Vaccines: def __init__(self, source, vaccines): self.source = source self.vaccines = vaccines class VaccineTimeline: def __init__(self, date, value): self.date = date self.value = value class VaccineCountry: def __init__(self, country, timeline): self.country = country self.timeline = timeline
class Today: def __init__(self, cases, deaths, recoveries): self.cases = cases self.deaths = deaths self.recoveries = recoveries class Permillion: def __init__(self, cases, deaths, tests, active, recoveries, critical): self.cases = cases self.deaths = deaths self.tests = tests self.active = active self.recoveries = recoveries self.critical = critical class Perpeople: def __init__(self, case, death, test): self.case = case self.death = death self.test = test class Global: def __init__(self, cases, deaths, recoveries, today, total_critical, active, tests, per_million, per_people, population, affected_countries, updated): self.cases = cases self.deaths = deaths self.recoveries = recoveries self.today = today self.critical = total_critical self.active = active self.tests = tests self.per_million = per_million self.per_people = per_people self.population = population self.affected_countries = affected_countries self.updated = updated class Countryinfo: def __init__(self, _id, iso2, iso3, _lat, _long, flag): self.id = _id self.iso2 = iso2 self.iso3 = iso3 self.latitude = _lat self.longitude = _long self.flag = flag class Country: def __init__(self, info, name, cases, deaths, recoveries, today, critical, active, tests, per_million, per_people, continent, population, updated): self.info = info self.name = name self.cases = cases self.deaths = deaths self.recoveries = recoveries self.today = today self.critical = critical self.active = active self.tests = tests self.per_million = per_million self.per_people = per_people self.continent = continent self.population = population self.updated = updated class Statetoday: def __init__(self, cases, deaths): self.cases = cases self.deaths = deaths class Statepermillion: def __init__(self, cases, deaths, tests): self.cases = cases self.deaths = deaths self.tests = tests class State: def __init__(self, name, cases, deaths, today, active, tests, per_million): self.name = name self.cases = cases self.deaths = deaths self.today = today self.active = active self.tests = tests self.per_million = per_million class Historyentry: def __init__(self, date, value): self.date = date self.value = value class History: def __init__(self, cases, deaths, recoveries): self.cases = cases self.deaths = deaths self.recoveries = recoveries class Historical: def __init__(self, name, province, history): self.name = name self.province = province or None self.history = history class Jhucsse: def __init__(self, country, province, county, updated, confirmed_cases, deaths, recoveries, _lat, _long): self.country_name = country self.province_name = province self.county_name = county self.updated = updated self.confirmed_cases = confirmed_cases self.deaths = deaths self.recoveries = recoveries self.latitude = _lat self.longitude = _long class Continent: def __init__(self, name, countries, cases, deaths, recoveries, critical, active, tests, today, per_million, population, updated): self.name = name self.countries = countries self.cases = cases self.deaths = deaths self.recoveries = recoveries self.critical = critical self.active = active self.tests = tests self.today = today self.per_million = per_million self.population = population self.updated = updated class Newyorktimesusa: def __init__(self, date, cases, deaths): self.date = date self.cases = cases self.deaths = deaths class Newyorktimesstate: def __init__(self, date, state, fips, cases, deaths): self.date = date self.state = state self.fips = int(fips) if fips else None self.cases = cases self.deaths = deaths class Newyorktimescounty: def __init__(self, date, county, state, fips, cases, deaths): self.date = date self.county = county self.state = state self.fips = int(fips) if fips else None self.cases = cases self.deaths = deaths class Applesubregions: def __init__(self, country, subregions): self.country = country self.subregions = subregions class Applesubregion: def __init__(self, subregion, statistics): self.subregion = subregion self.statistics = statistics class Mobility: def __init__(self, name, _type, date, driving, transit, walking): self.name = name self.type = _type self.date = date self.driving = driving self.transit = transit self.walking = walking class Vaccine: def __init__(self, candidate, sponsors, details, phase, institutions, funding): self.candidate = candidate self.sponsors = sponsors self.details = details self.phase = phase self.institutions = institutions self.funding = funding class Vaccines: def __init__(self, source, vaccines): self.source = source self.vaccines = vaccines class Vaccinetimeline: def __init__(self, date, value): self.date = date self.value = value class Vaccinecountry: def __init__(self, country, timeline): self.country = country self.timeline = timeline
CHARMAP = [bytes([x]) for x in b'BCDFGHJKMPQRTVWXY2346789'] def b24encode(data): enc = b'' for c in data: enc += CHARMAP[c >> 4] enc += CHARMAP[-(c & 0x0f) - 1] return enc def b24decode(data): dec = b'' hi = -1 for c in data: if hi < 0: hi = CHARMAP.index(bytes([c])) << 4 else: dec += bytes([hi | (23 - CHARMAP.index(bytes([c])))]) hi = -1 return dec def b24Keygen(data): ''' The actual algorithm used in Windows product key generation. ''' assert len(data) * 8 >= 114, 'data must be at least 144 bits in length' num = int.from_bytes(data, byteorder = 'little') enc = b'' for i in range(29): if i % 6 == 5: enc += b'-' else: enc += CHARMAP[num % 24] num //= 24 return enc
charmap = [bytes([x]) for x in b'BCDFGHJKMPQRTVWXY2346789'] def b24encode(data): enc = b'' for c in data: enc += CHARMAP[c >> 4] enc += CHARMAP[-(c & 15) - 1] return enc def b24decode(data): dec = b'' hi = -1 for c in data: if hi < 0: hi = CHARMAP.index(bytes([c])) << 4 else: dec += bytes([hi | 23 - CHARMAP.index(bytes([c]))]) hi = -1 return dec def b24_keygen(data): """ The actual algorithm used in Windows product key generation. """ assert len(data) * 8 >= 114, 'data must be at least 144 bits in length' num = int.from_bytes(data, byteorder='little') enc = b'' for i in range(29): if i % 6 == 5: enc += b'-' else: enc += CHARMAP[num % 24] num //= 24 return enc
amd = [ { "Codename": "Tahiti", "IDs": [ { "Vendor": "0x1002", "Device": "0x6780" }, { "Vendor": "0x1002", "Device": "0x6784" }, { "Vendor": "0x1002", "Device": "0x6788" }, { "Vendor": "0x1002", "Device": "0x678a" }, { "Vendor": "0x1002", "Device": "0x6790" }, { "Vendor": "0x1002", "Device": "0x6791" }, { "Vendor": "0x1002", "Device": "0x6792" }, { "Vendor": "0x1002", "Device": "0x6798" }, { "Vendor": "0x1002", "Device": "0x6799" }, { "Vendor": "0x1002", "Device": "0x679a" }, { "Vendor": "0x1002", "Device": "0x679b" }, { "Vendor": "0x1002", "Device": "0x679e" }, { "Vendor": "0x1002", "Device": "0x679f" } ] }, { "Codename": "Pitcairn", "IDs": [ { "Vendor": "0x1002", "Device": "0x6800" }, { "Vendor": "0x1002", "Device": "0x6801" }, { "Vendor": "0x1002", "Device": "0x6802" }, { "Vendor": "0x1002", "Device": "0x6806" }, { "Vendor": "0x1002", "Device": "0x6808" }, { "Vendor": "0x1002", "Device": "0x6809" }, { "Vendor": "0x1002", "Device": "0x6810" }, { "Vendor": "0x1002", "Device": "0x6811" }, { "Vendor": "0x1002", "Device": "0x6816" }, { "Vendor": "0x1002", "Device": "0x6817" }, { "Vendor": "0x1002", "Device": "0x6818" }, { "Vendor": "0x1002", "Device": "0x6819" } ] }, { "Codename": "Oland", "IDs": [ { "Vendor": "0x1002", "Device": "0x6600" }, { "Vendor": "0x1002", "Device": "0x6601" }, { "Vendor": "0x1002", "Device": "0x6602" }, { "Vendor": "0x1002", "Device": "0x6603" }, { "Vendor": "0x1002", "Device": "0x6604" }, { "Vendor": "0x1002", "Device": "0x6605" }, { "Vendor": "0x1002", "Device": "0x6606" }, { "Vendor": "0x1002", "Device": "0x6607" }, { "Vendor": "0x1002", "Device": "0x6608" }, { "Vendor": "0x1002", "Device": "0x6610" }, { "Vendor": "0x1002", "Device": "0x6611" }, { "Vendor": "0x1002", "Device": "0x6613" }, { "Vendor": "0x1002", "Device": "0x6617" }, { "Vendor": "0x1002", "Device": "0x6620" }, { "Vendor": "0x1002", "Device": "0x6621" }, { "Vendor": "0x1002", "Device": "0x6623" }, { "Vendor": "0x1002", "Device": "0x6631" } ] }, { "Codename": "Verde", "IDs": [ { "Vendor": "0x1002", "Device": "0x6820" }, { "Vendor": "0x1002", "Device": "0x6821" }, { "Vendor": "0x1002", "Device": "0x6822" }, { "Vendor": "0x1002", "Device": "0x6823" }, { "Vendor": "0x1002", "Device": "0x6824" }, { "Vendor": "0x1002", "Device": "0x6825" }, { "Vendor": "0x1002", "Device": "0x6826" }, { "Vendor": "0x1002", "Device": "0x6827" }, { "Vendor": "0x1002", "Device": "0x6828" }, { "Vendor": "0x1002", "Device": "0x6829" }, { "Vendor": "0x1002", "Device": "0x682a" }, { "Vendor": "0x1002", "Device": "0x682b" }, { "Vendor": "0x1002", "Device": "0x682c" }, { "Vendor": "0x1002", "Device": "0x682d" }, { "Vendor": "0x1002", "Device": "0x682f" }, { "Vendor": "0x1002", "Device": "0x6830" }, { "Vendor": "0x1002", "Device": "0x6831" }, { "Vendor": "0x1002", "Device": "0x6835" }, { "Vendor": "0x1002", "Device": "0x6837" }, { "Vendor": "0x1002", "Device": "0x6838" }, { "Vendor": "0x1002", "Device": "0x6839" }, { "Vendor": "0x1002", "Device": "0x683b" }, { "Vendor": "0x1002", "Device": "0x683d" }, { "Vendor": "0x1002", "Device": "0x683f" } ] }, { "Codename": "Hainan", "IDs": [ { "Vendor": "0x1002", "Device": "0x6660" }, { "Vendor": "0x1002", "Device": "0x6663" }, { "Vendor": "0x1002", "Device": "0x6664" }, { "Vendor": "0x1002", "Device": "0x6665" }, { "Vendor": "0x1002", "Device": "0x6667" }, { "Vendor": "0x1002", "Device": "0x666f" } ] }, { "Codename": "Kaveri", "IDs": [ { "Vendor": "0x1002", "Device": "0x1304" }, { "Vendor": "0x1002", "Device": "0x1305" }, { "Vendor": "0x1002", "Device": "0x1306" }, { "Vendor": "0x1002", "Device": "0x1307" }, { "Vendor": "0x1002", "Device": "0x1309" }, { "Vendor": "0x1002", "Device": "0x130a" }, { "Vendor": "0x1002", "Device": "0x130b" }, { "Vendor": "0x1002", "Device": "0x130c" }, { "Vendor": "0x1002", "Device": "0x130d" }, { "Vendor": "0x1002", "Device": "0x130e" }, { "Vendor": "0x1002", "Device": "0x130f" }, { "Vendor": "0x1002", "Device": "0x1310" }, { "Vendor": "0x1002", "Device": "0x1311" }, { "Vendor": "0x1002", "Device": "0x1312" }, { "Vendor": "0x1002", "Device": "0x1313" }, { "Vendor": "0x1002", "Device": "0x1315" }, { "Vendor": "0x1002", "Device": "0x1316" }, { "Vendor": "0x1002", "Device": "0x1317" }, { "Vendor": "0x1002", "Device": "0x1318" }, { "Vendor": "0x1002", "Device": "0x131b" }, { "Vendor": "0x1002", "Device": "0x131c" }, { "Vendor": "0x1002", "Device": "0x131d" } ] }, { "Codename": "Bonaire", "IDs": [ { "Vendor": "0x1002", "Device": "0x6640" }, { "Vendor": "0x1002", "Device": "0x6641" }, { "Vendor": "0x1002", "Device": "0x6646" }, { "Vendor": "0x1002", "Device": "0x6647" }, { "Vendor": "0x1002", "Device": "0x6649" }, { "Vendor": "0x1002", "Device": "0x6650" }, { "Vendor": "0x1002", "Device": "0x6651" }, { "Vendor": "0x1002", "Device": "0x6658" }, { "Vendor": "0x1002", "Device": "0x665c" }, { "Vendor": "0x1002", "Device": "0x665d" }, { "Vendor": "0x1002", "Device": "0x665f" } ] }, { "Codename": "Hawaii", "IDs": [ { "Vendor": "0x1002", "Device": "0x67a0" }, { "Vendor": "0x1002", "Device": "0x67a1" }, { "Vendor": "0x1002", "Device": "0x67a2" }, { "Vendor": "0x1002", "Device": "0x67a8" }, { "Vendor": "0x1002", "Device": "0x67a9" }, { "Vendor": "0x1002", "Device": "0x67aa" }, { "Vendor": "0x1002", "Device": "0x67b0" }, { "Vendor": "0x1002", "Device": "0x67b1" }, { "Vendor": "0x1002", "Device": "0x67b8" }, { "Vendor": "0x1002", "Device": "0x67b9" }, { "Vendor": "0x1002", "Device": "0x67ba" }, { "Vendor": "0x1002", "Device": "0x67be" } ] }, { "Codename": "Kabini", "IDs": [ { "Vendor": "0x1002", "Device": "0x9830" }, { "Vendor": "0x1002", "Device": "0x9831" }, { "Vendor": "0x1002", "Device": "0x9832" }, { "Vendor": "0x1002", "Device": "0x9833" }, { "Vendor": "0x1002", "Device": "0x9834" }, { "Vendor": "0x1002", "Device": "0x9835" }, { "Vendor": "0x1002", "Device": "0x9836" }, { "Vendor": "0x1002", "Device": "0x9837" }, { "Vendor": "0x1002", "Device": "0x9838" }, { "Vendor": "0x1002", "Device": "0x9839" }, { "Vendor": "0x1002", "Device": "0x983a" }, { "Vendor": "0x1002", "Device": "0x983b" }, { "Vendor": "0x1002", "Device": "0x983c" }, { "Vendor": "0x1002", "Device": "0x983d" }, { "Vendor": "0x1002", "Device": "0x983e" }, { "Vendor": "0x1002", "Device": "0x983f" } ] }, { "Codename": "Mullins", "IDs": [ { "Vendor": "0x1002", "Device": "0x9850" }, { "Vendor": "0x1002", "Device": "0x9851" }, { "Vendor": "0x1002", "Device": "0x9852" }, { "Vendor": "0x1002", "Device": "0x9853" }, { "Vendor": "0x1002", "Device": "0x9854" }, { "Vendor": "0x1002", "Device": "0x9855" }, { "Vendor": "0x1002", "Device": "0x9856" }, { "Vendor": "0x1002", "Device": "0x9857" }, { "Vendor": "0x1002", "Device": "0x9858" }, { "Vendor": "0x1002", "Device": "0x9859" }, { "Vendor": "0x1002", "Device": "0x985a" }, { "Vendor": "0x1002", "Device": "0x985b" }, { "Vendor": "0x1002", "Device": "0x985c" }, { "Vendor": "0x1002", "Device": "0x985d" }, { "Vendor": "0x1002", "Device": "0x985e" }, { "Vendor": "0x1002", "Device": "0x985f" } ] }, { "Codename": "Topaz", "IDs": [ { "Vendor": "0x1002", "Device": "0x6900" }, { "Vendor": "0x1002", "Device": "0x6901" }, { "Vendor": "0x1002", "Device": "0x6902" }, { "Vendor": "0x1002", "Device": "0x6903" }, { "Vendor": "0x1002", "Device": "0x6907" } ] }, { "Codename": "Tonga", "IDs": [ { "Vendor": "0x1002", "Device": "0x6920" }, { "Vendor": "0x1002", "Device": "0x6921" }, { "Vendor": "0x1002", "Device": "0x6928" }, { "Vendor": "0x1002", "Device": "0x6929" }, { "Vendor": "0x1002", "Device": "0x692b" }, { "Vendor": "0x1002", "Device": "0x692f" }, { "Vendor": "0x1002", "Device": "0x6930" }, { "Vendor": "0x1002", "Device": "0x6938" }, { "Vendor": "0x1002", "Device": "0x6939" } ] }, { "Codename": "Fiji", "IDs": [ { "Vendor": "0x1002", "Device": "0x7300" }, { "Vendor": "0x1002", "Device": "0x730f" } ] }, { "Codename": "Carrizo", "IDs": [ { "Vendor": "0x1002", "Device": "0x9870" }, { "Vendor": "0x1002", "Device": "0x9874" }, { "Vendor": "0x1002", "Device": "0x9875" }, { "Vendor": "0x1002", "Device": "0x9876" }, { "Vendor": "0x1002", "Device": "0x9877" } ] }, { "Codename": "Stoney", "IDs": [{ "Vendor": "0x1002", "Device": "0x98e4" }] }, { "Codename": "Polaris 11", "IDs": [ { "Vendor": "0x1002", "Device": "0x67e0" }, { "Vendor": "0x1002", "Device": "0x67e3" }, { "Vendor": "0x1002", "Device": "0x67e8" }, { "Vendor": "0x1002", "Device": "0x67eb" }, { "Vendor": "0x1002", "Device": "0x67ef" }, { "Vendor": "0x1002", "Device": "0x67ff" }, { "Vendor": "0x1002", "Device": "0x67e1" }, { "Vendor": "0x1002", "Device": "0x67e7" }, { "Vendor": "0x1002", "Device": "0x67e9" } ] }, { "Codename": "Polaris 10", "IDs": [ { "Vendor": "0x1002", "Device": "0x67c0" }, { "Vendor": "0x1002", "Device": "0x67c1" }, { "Vendor": "0x1002", "Device": "0x67c2" }, { "Vendor": "0x1002", "Device": "0x67c4" }, { "Vendor": "0x1002", "Device": "0x67c7" }, { "Vendor": "0x1002", "Device": "0x67d0" }, { "Vendor": "0x1002", "Device": "0x67df" }, { "Vendor": "0x1002", "Device": "0x67c8" }, { "Vendor": "0x1002", "Device": "0x67c9" }, { "Vendor": "0x1002", "Device": "0x67ca" }, { "Vendor": "0x1002", "Device": "0x67cc" }, { "Vendor": "0x1002", "Device": "0x67cf" }, { "Vendor": "0x1002", "Device": "0x6fdf" } ] }, { "Codename": "Polaris 12", "IDs": [ { "Vendor": "0x1002", "Device": "0x6980" }, { "Vendor": "0x1002", "Device": "0x6981" }, { "Vendor": "0x1002", "Device": "0x6985" }, { "Vendor": "0x1002", "Device": "0x6986" }, { "Vendor": "0x1002", "Device": "0x6987" }, { "Vendor": "0x1002", "Device": "0x6995" }, { "Vendor": "0x1002", "Device": "0x6997" }, { "Vendor": "0x1002", "Device": "0x699f" } ] }, { "Codename": "Vegam", "IDs": [ { "Vendor": "0x1002", "Device": "0x694c" }, { "Vendor": "0x1002", "Device": "0x694e" }, { "Vendor": "0x1002", "Device": "0x694f" } ] }, { "Codename": "Vega 10", "IDs": [ { "Vendor": "0x1002", "Device": "0x6860" }, { "Vendor": "0x1002", "Device": "0x6861" }, { "Vendor": "0x1002", "Device": "0x6862" }, { "Vendor": "0x1002", "Device": "0x6863" }, { "Vendor": "0x1002", "Device": "0x6864" }, { "Vendor": "0x1002", "Device": "0x6867" }, { "Vendor": "0x1002", "Device": "0x6868" }, { "Vendor": "0x1002", "Device": "0x6869" }, { "Vendor": "0x1002", "Device": "0x686a" }, { "Vendor": "0x1002", "Device": "0x686b" }, { "Vendor": "0x1002", "Device": "0x686c" }, { "Vendor": "0x1002", "Device": "0x686d" }, { "Vendor": "0x1002", "Device": "0x686e" }, { "Vendor": "0x1002", "Device": "0x686f" }, { "Vendor": "0x1002", "Device": "0x687f" } ] }, { "Codename": "Vega 12", "IDs": [ { "Vendor": "0x1002", "Device": "0x69a0" }, { "Vendor": "0x1002", "Device": "0x69a1" }, { "Vendor": "0x1002", "Device": "0x69a2" }, { "Vendor": "0x1002", "Device": "0x69a3" }, { "Vendor": "0x1002", "Device": "0x69af" } ] }, { "Codename": "Vega 20", "IDs": [ { "Vendor": "0x1002", "Device": "0x66a0" }, { "Vendor": "0x1002", "Device": "0x66a1" }, { "Vendor": "0x1002", "Device": "0x66a2" }, { "Vendor": "0x1002", "Device": "0x66a3" }, { "Vendor": "0x1002", "Device": "0x66a4" }, { "Vendor": "0x1002", "Device": "0x66a7" }, { "Vendor": "0x1002", "Device": "0x66af" } ] }, { "Codename": "Raven", "IDs": [ { "Vendor": "0x1002", "Device": "0x15dd" }, { "Vendor": "0x1002", "Device": "0x15d8" } ] }, { "Codename": "Arcturus", "IDs": [ { "Vendor": "0x1002", "Device": "0x738c" }, { "Vendor": "0x1002", "Device": "0x7388" }, { "Vendor": "0x1002", "Device": "0x738e" }, { "Vendor": "0x1002", "Device": "0x7390" } ] }, { "Codename": "Navi 10", "IDs": [ { "Vendor": "0x1002", "Device": "0x7310" }, { "Vendor": "0x1002", "Device": "0x7312" }, { "Vendor": "0x1002", "Device": "0x7318" }, { "Vendor": "0x1002", "Device": "0x7319" }, { "Vendor": "0x1002", "Device": "0x731a" }, { "Vendor": "0x1002", "Device": "0x731b" }, { "Vendor": "0x1002", "Device": "0x731e" }, { "Vendor": "0x1002", "Device": "0x731f" } ] }, { "Codename": "Navi 14", "IDs": [ { "Vendor": "0x1002", "Device": "0x7340" }, { "Vendor": "0x1002", "Device": "0x7341" }, { "Vendor": "0x1002", "Device": "0x7347" }, { "Vendor": "0x1002", "Device": "0x734f" } ] }, { "Codename": "Renoir", "IDs": [ { "Vendor": "0x1002", "Device": "0x15e7" }, { "Vendor": "0x1002", "Device": "0x1636" }, { "Vendor": "0x1002", "Device": "0x1638" }, { "Vendor": "0x1002", "Device": "0x164c" } ] }, { "Codename": "Navi 12", "IDs": [ { "Vendor": "0x1002", "Device": "0x7360" }, { "Vendor": "0x1002", "Device": "0x7362" } ] }, { "Codename": "Sienna Cichlid", "IDs": [ { "Vendor": "0x1002", "Device": "0x73a0" }, { "Vendor": "0x1002", "Device": "0x73a1" }, { "Vendor": "0x1002", "Device": "0x73a2" }, { "Vendor": "0x1002", "Device": "0x73a3" }, { "Vendor": "0x1002", "Device": "0x73a5" }, { "Vendor": "0x1002", "Device": "0x73a8" }, { "Vendor": "0x1002", "Device": "0x73a9" }, { "Vendor": "0x1002", "Device": "0x73ab" }, { "Vendor": "0x1002", "Device": "0x73ac" }, { "Vendor": "0x1002", "Device": "0x73ad" }, { "Vendor": "0x1002", "Device": "0x73ae" }, { "Vendor": "0x1002", "Device": "0x73af" }, { "Vendor": "0x1002", "Device": "0x73bf" } ] }, { "Codename": "Vangogh", "IDs": [{ "Vendor": "0x1002", "Device": "0x163f" }] }, { "Codename": "Yellow Carp", "IDs": [ { "Vendor": "0x1002", "Device": "0x164d" }, { "Vendor": "0x1002", "Device": "0x1681" } ] }, { "Codename": "Navy Flounder", "IDs": [ { "Vendor": "0x1002", "Device": "0x73c0" }, { "Vendor": "0x1002", "Device": "0x73c1" }, { "Vendor": "0x1002", "Device": "0x73c3" }, { "Vendor": "0x1002", "Device": "0x73da" }, { "Vendor": "0x1002", "Device": "0x73db" }, { "Vendor": "0x1002", "Device": "0x73dc" }, { "Vendor": "0x1002", "Device": "0x73dd" }, { "Vendor": "0x1002", "Device": "0x73de" }, { "Vendor": "0x1002", "Device": "0x73df" } ] }, { "Codename": "Dimgrey Cavefish", "IDs": [ { "Vendor": "0x1002", "Device": "0x73e0" }, { "Vendor": "0x1002", "Device": "0x73e1" }, { "Vendor": "0x1002", "Device": "0x73e2" }, { "Vendor": "0x1002", "Device": "0x73e3" }, { "Vendor": "0x1002", "Device": "0x73e8" }, { "Vendor": "0x1002", "Device": "0x73e9" }, { "Vendor": "0x1002", "Device": "0x73ea" }, { "Vendor": "0x1002", "Device": "0x73eb" }, { "Vendor": "0x1002", "Device": "0x73ec" }, { "Vendor": "0x1002", "Device": "0x73ed" }, { "Vendor": "0x1002", "Device": "0x73ef" }, { "Vendor": "0x1002", "Device": "0x73ff" } ] }, { "Codename": "Aldebaran", "IDs": [ { "Vendor": "0x1002", "Device": "0x7408" }, { "Vendor": "0x1002", "Device": "0x740c" }, { "Vendor": "0x1002", "Device": "0x740f" }, { "Vendor": "0x1002", "Device": "0x7410" } ] }, { "Codename": "Cyan Skillfish", "IDs": [{ "Vendor": "0x1002", "Device": "0x13fe" }] }, { "Codename": "Beige Goby", "IDs": [ { "Vendor": "0x1002", "Device": "0x7420" }, { "Vendor": "0x1002", "Device": "0x7421" }, { "Vendor": "0x1002", "Device": "0x7422" }, { "Vendor": "0x1002", "Device": "0x7423" }, { "Vendor": "0x1002", "Device": "0x743f" } ] } ]
amd = [{'Codename': 'Tahiti', 'IDs': [{'Vendor': '0x1002', 'Device': '0x6780'}, {'Vendor': '0x1002', 'Device': '0x6784'}, {'Vendor': '0x1002', 'Device': '0x6788'}, {'Vendor': '0x1002', 'Device': '0x678a'}, {'Vendor': '0x1002', 'Device': '0x6790'}, {'Vendor': '0x1002', 'Device': '0x6791'}, {'Vendor': '0x1002', 'Device': '0x6792'}, {'Vendor': '0x1002', 'Device': '0x6798'}, {'Vendor': '0x1002', 'Device': '0x6799'}, {'Vendor': '0x1002', 'Device': '0x679a'}, {'Vendor': '0x1002', 'Device': '0x679b'}, {'Vendor': '0x1002', 'Device': '0x679e'}, {'Vendor': '0x1002', 'Device': '0x679f'}]}, {'Codename': 'Pitcairn', 'IDs': [{'Vendor': '0x1002', 'Device': '0x6800'}, {'Vendor': '0x1002', 'Device': '0x6801'}, {'Vendor': '0x1002', 'Device': '0x6802'}, {'Vendor': '0x1002', 'Device': '0x6806'}, {'Vendor': '0x1002', 'Device': '0x6808'}, {'Vendor': '0x1002', 'Device': '0x6809'}, {'Vendor': '0x1002', 'Device': '0x6810'}, {'Vendor': '0x1002', 'Device': '0x6811'}, {'Vendor': '0x1002', 'Device': '0x6816'}, {'Vendor': '0x1002', 'Device': '0x6817'}, {'Vendor': '0x1002', 'Device': '0x6818'}, {'Vendor': '0x1002', 'Device': '0x6819'}]}, {'Codename': 'Oland', 'IDs': [{'Vendor': '0x1002', 'Device': '0x6600'}, {'Vendor': '0x1002', 'Device': '0x6601'}, {'Vendor': '0x1002', 'Device': '0x6602'}, {'Vendor': '0x1002', 'Device': '0x6603'}, {'Vendor': '0x1002', 'Device': '0x6604'}, {'Vendor': '0x1002', 'Device': '0x6605'}, {'Vendor': '0x1002', 'Device': '0x6606'}, {'Vendor': '0x1002', 'Device': '0x6607'}, {'Vendor': '0x1002', 'Device': '0x6608'}, {'Vendor': '0x1002', 'Device': '0x6610'}, {'Vendor': '0x1002', 'Device': '0x6611'}, {'Vendor': '0x1002', 'Device': '0x6613'}, {'Vendor': '0x1002', 'Device': '0x6617'}, {'Vendor': '0x1002', 'Device': '0x6620'}, {'Vendor': '0x1002', 'Device': '0x6621'}, {'Vendor': '0x1002', 'Device': '0x6623'}, {'Vendor': '0x1002', 'Device': '0x6631'}]}, {'Codename': 'Verde', 'IDs': [{'Vendor': '0x1002', 'Device': '0x6820'}, {'Vendor': '0x1002', 'Device': '0x6821'}, {'Vendor': '0x1002', 'Device': '0x6822'}, {'Vendor': '0x1002', 'Device': '0x6823'}, {'Vendor': '0x1002', 'Device': '0x6824'}, {'Vendor': '0x1002', 'Device': '0x6825'}, {'Vendor': '0x1002', 'Device': '0x6826'}, {'Vendor': '0x1002', 'Device': '0x6827'}, {'Vendor': '0x1002', 'Device': '0x6828'}, {'Vendor': '0x1002', 'Device': '0x6829'}, {'Vendor': '0x1002', 'Device': '0x682a'}, {'Vendor': '0x1002', 'Device': '0x682b'}, {'Vendor': '0x1002', 'Device': '0x682c'}, {'Vendor': '0x1002', 'Device': '0x682d'}, {'Vendor': '0x1002', 'Device': '0x682f'}, {'Vendor': '0x1002', 'Device': '0x6830'}, {'Vendor': '0x1002', 'Device': '0x6831'}, {'Vendor': '0x1002', 'Device': '0x6835'}, {'Vendor': '0x1002', 'Device': '0x6837'}, {'Vendor': '0x1002', 'Device': '0x6838'}, {'Vendor': '0x1002', 'Device': '0x6839'}, {'Vendor': '0x1002', 'Device': '0x683b'}, {'Vendor': '0x1002', 'Device': '0x683d'}, {'Vendor': '0x1002', 'Device': '0x683f'}]}, {'Codename': 'Hainan', 'IDs': [{'Vendor': '0x1002', 'Device': '0x6660'}, {'Vendor': '0x1002', 'Device': '0x6663'}, {'Vendor': '0x1002', 'Device': '0x6664'}, {'Vendor': '0x1002', 'Device': '0x6665'}, {'Vendor': '0x1002', 'Device': '0x6667'}, {'Vendor': '0x1002', 'Device': '0x666f'}]}, {'Codename': 'Kaveri', 'IDs': [{'Vendor': '0x1002', 'Device': '0x1304'}, {'Vendor': '0x1002', 'Device': '0x1305'}, {'Vendor': '0x1002', 'Device': '0x1306'}, {'Vendor': '0x1002', 'Device': '0x1307'}, {'Vendor': '0x1002', 'Device': '0x1309'}, {'Vendor': '0x1002', 'Device': '0x130a'}, {'Vendor': '0x1002', 'Device': '0x130b'}, {'Vendor': '0x1002', 'Device': '0x130c'}, {'Vendor': '0x1002', 'Device': '0x130d'}, {'Vendor': '0x1002', 'Device': '0x130e'}, {'Vendor': '0x1002', 'Device': '0x130f'}, {'Vendor': '0x1002', 'Device': '0x1310'}, {'Vendor': '0x1002', 'Device': '0x1311'}, {'Vendor': '0x1002', 'Device': '0x1312'}, {'Vendor': '0x1002', 'Device': '0x1313'}, {'Vendor': '0x1002', 'Device': '0x1315'}, {'Vendor': '0x1002', 'Device': '0x1316'}, {'Vendor': '0x1002', 'Device': '0x1317'}, {'Vendor': '0x1002', 'Device': '0x1318'}, {'Vendor': '0x1002', 'Device': '0x131b'}, {'Vendor': '0x1002', 'Device': '0x131c'}, {'Vendor': '0x1002', 'Device': '0x131d'}]}, {'Codename': 'Bonaire', 'IDs': [{'Vendor': '0x1002', 'Device': '0x6640'}, {'Vendor': '0x1002', 'Device': '0x6641'}, {'Vendor': '0x1002', 'Device': '0x6646'}, {'Vendor': '0x1002', 'Device': '0x6647'}, {'Vendor': '0x1002', 'Device': '0x6649'}, {'Vendor': '0x1002', 'Device': '0x6650'}, {'Vendor': '0x1002', 'Device': '0x6651'}, {'Vendor': '0x1002', 'Device': '0x6658'}, {'Vendor': '0x1002', 'Device': '0x665c'}, {'Vendor': '0x1002', 'Device': '0x665d'}, {'Vendor': '0x1002', 'Device': '0x665f'}]}, {'Codename': 'Hawaii', 'IDs': [{'Vendor': '0x1002', 'Device': '0x67a0'}, {'Vendor': '0x1002', 'Device': '0x67a1'}, {'Vendor': '0x1002', 'Device': '0x67a2'}, {'Vendor': '0x1002', 'Device': '0x67a8'}, {'Vendor': '0x1002', 'Device': '0x67a9'}, {'Vendor': '0x1002', 'Device': '0x67aa'}, {'Vendor': '0x1002', 'Device': '0x67b0'}, {'Vendor': '0x1002', 'Device': '0x67b1'}, {'Vendor': '0x1002', 'Device': '0x67b8'}, {'Vendor': '0x1002', 'Device': '0x67b9'}, {'Vendor': '0x1002', 'Device': '0x67ba'}, {'Vendor': '0x1002', 'Device': '0x67be'}]}, {'Codename': 'Kabini', 'IDs': [{'Vendor': '0x1002', 'Device': '0x9830'}, {'Vendor': '0x1002', 'Device': '0x9831'}, {'Vendor': '0x1002', 'Device': '0x9832'}, {'Vendor': '0x1002', 'Device': '0x9833'}, {'Vendor': '0x1002', 'Device': '0x9834'}, {'Vendor': '0x1002', 'Device': '0x9835'}, {'Vendor': '0x1002', 'Device': '0x9836'}, {'Vendor': '0x1002', 'Device': '0x9837'}, {'Vendor': '0x1002', 'Device': '0x9838'}, {'Vendor': '0x1002', 'Device': '0x9839'}, {'Vendor': '0x1002', 'Device': '0x983a'}, {'Vendor': '0x1002', 'Device': '0x983b'}, {'Vendor': '0x1002', 'Device': '0x983c'}, {'Vendor': '0x1002', 'Device': '0x983d'}, {'Vendor': '0x1002', 'Device': '0x983e'}, {'Vendor': '0x1002', 'Device': '0x983f'}]}, {'Codename': 'Mullins', 'IDs': [{'Vendor': '0x1002', 'Device': '0x9850'}, {'Vendor': '0x1002', 'Device': '0x9851'}, {'Vendor': '0x1002', 'Device': '0x9852'}, {'Vendor': '0x1002', 'Device': '0x9853'}, {'Vendor': '0x1002', 'Device': '0x9854'}, {'Vendor': '0x1002', 'Device': '0x9855'}, {'Vendor': '0x1002', 'Device': '0x9856'}, {'Vendor': '0x1002', 'Device': '0x9857'}, {'Vendor': '0x1002', 'Device': '0x9858'}, {'Vendor': '0x1002', 'Device': '0x9859'}, {'Vendor': '0x1002', 'Device': '0x985a'}, {'Vendor': '0x1002', 'Device': '0x985b'}, {'Vendor': '0x1002', 'Device': '0x985c'}, {'Vendor': '0x1002', 'Device': '0x985d'}, {'Vendor': '0x1002', 'Device': '0x985e'}, {'Vendor': '0x1002', 'Device': '0x985f'}]}, {'Codename': 'Topaz', 'IDs': [{'Vendor': '0x1002', 'Device': '0x6900'}, {'Vendor': '0x1002', 'Device': '0x6901'}, {'Vendor': '0x1002', 'Device': '0x6902'}, {'Vendor': '0x1002', 'Device': '0x6903'}, {'Vendor': '0x1002', 'Device': '0x6907'}]}, {'Codename': 'Tonga', 'IDs': [{'Vendor': '0x1002', 'Device': '0x6920'}, {'Vendor': '0x1002', 'Device': '0x6921'}, {'Vendor': '0x1002', 'Device': '0x6928'}, {'Vendor': '0x1002', 'Device': '0x6929'}, {'Vendor': '0x1002', 'Device': '0x692b'}, {'Vendor': '0x1002', 'Device': '0x692f'}, {'Vendor': '0x1002', 'Device': '0x6930'}, {'Vendor': '0x1002', 'Device': '0x6938'}, {'Vendor': '0x1002', 'Device': '0x6939'}]}, {'Codename': 'Fiji', 'IDs': [{'Vendor': '0x1002', 'Device': '0x7300'}, {'Vendor': '0x1002', 'Device': '0x730f'}]}, {'Codename': 'Carrizo', 'IDs': [{'Vendor': '0x1002', 'Device': '0x9870'}, {'Vendor': '0x1002', 'Device': '0x9874'}, {'Vendor': '0x1002', 'Device': '0x9875'}, {'Vendor': '0x1002', 'Device': '0x9876'}, {'Vendor': '0x1002', 'Device': '0x9877'}]}, {'Codename': 'Stoney', 'IDs': [{'Vendor': '0x1002', 'Device': '0x98e4'}]}, {'Codename': 'Polaris 11', 'IDs': [{'Vendor': '0x1002', 'Device': '0x67e0'}, {'Vendor': '0x1002', 'Device': '0x67e3'}, {'Vendor': '0x1002', 'Device': '0x67e8'}, {'Vendor': '0x1002', 'Device': '0x67eb'}, {'Vendor': '0x1002', 'Device': '0x67ef'}, {'Vendor': '0x1002', 'Device': '0x67ff'}, {'Vendor': '0x1002', 'Device': '0x67e1'}, {'Vendor': '0x1002', 'Device': '0x67e7'}, {'Vendor': '0x1002', 'Device': '0x67e9'}]}, {'Codename': 'Polaris 10', 'IDs': [{'Vendor': '0x1002', 'Device': '0x67c0'}, {'Vendor': '0x1002', 'Device': '0x67c1'}, {'Vendor': '0x1002', 'Device': '0x67c2'}, {'Vendor': '0x1002', 'Device': '0x67c4'}, {'Vendor': '0x1002', 'Device': '0x67c7'}, {'Vendor': '0x1002', 'Device': '0x67d0'}, {'Vendor': '0x1002', 'Device': '0x67df'}, {'Vendor': '0x1002', 'Device': '0x67c8'}, {'Vendor': '0x1002', 'Device': '0x67c9'}, {'Vendor': '0x1002', 'Device': '0x67ca'}, {'Vendor': '0x1002', 'Device': '0x67cc'}, {'Vendor': '0x1002', 'Device': '0x67cf'}, {'Vendor': '0x1002', 'Device': '0x6fdf'}]}, {'Codename': 'Polaris 12', 'IDs': [{'Vendor': '0x1002', 'Device': '0x6980'}, {'Vendor': '0x1002', 'Device': '0x6981'}, {'Vendor': '0x1002', 'Device': '0x6985'}, {'Vendor': '0x1002', 'Device': '0x6986'}, {'Vendor': '0x1002', 'Device': '0x6987'}, {'Vendor': '0x1002', 'Device': '0x6995'}, {'Vendor': '0x1002', 'Device': '0x6997'}, {'Vendor': '0x1002', 'Device': '0x699f'}]}, {'Codename': 'Vegam', 'IDs': [{'Vendor': '0x1002', 'Device': '0x694c'}, {'Vendor': '0x1002', 'Device': '0x694e'}, {'Vendor': '0x1002', 'Device': '0x694f'}]}, {'Codename': 'Vega 10', 'IDs': [{'Vendor': '0x1002', 'Device': '0x6860'}, {'Vendor': '0x1002', 'Device': '0x6861'}, {'Vendor': '0x1002', 'Device': '0x6862'}, {'Vendor': '0x1002', 'Device': '0x6863'}, {'Vendor': '0x1002', 'Device': '0x6864'}, {'Vendor': '0x1002', 'Device': '0x6867'}, {'Vendor': '0x1002', 'Device': '0x6868'}, {'Vendor': '0x1002', 'Device': '0x6869'}, {'Vendor': '0x1002', 'Device': '0x686a'}, {'Vendor': '0x1002', 'Device': '0x686b'}, {'Vendor': '0x1002', 'Device': '0x686c'}, {'Vendor': '0x1002', 'Device': '0x686d'}, {'Vendor': '0x1002', 'Device': '0x686e'}, {'Vendor': '0x1002', 'Device': '0x686f'}, {'Vendor': '0x1002', 'Device': '0x687f'}]}, {'Codename': 'Vega 12', 'IDs': [{'Vendor': '0x1002', 'Device': '0x69a0'}, {'Vendor': '0x1002', 'Device': '0x69a1'}, {'Vendor': '0x1002', 'Device': '0x69a2'}, {'Vendor': '0x1002', 'Device': '0x69a3'}, {'Vendor': '0x1002', 'Device': '0x69af'}]}, {'Codename': 'Vega 20', 'IDs': [{'Vendor': '0x1002', 'Device': '0x66a0'}, {'Vendor': '0x1002', 'Device': '0x66a1'}, {'Vendor': '0x1002', 'Device': '0x66a2'}, {'Vendor': '0x1002', 'Device': '0x66a3'}, {'Vendor': '0x1002', 'Device': '0x66a4'}, {'Vendor': '0x1002', 'Device': '0x66a7'}, {'Vendor': '0x1002', 'Device': '0x66af'}]}, {'Codename': 'Raven', 'IDs': [{'Vendor': '0x1002', 'Device': '0x15dd'}, {'Vendor': '0x1002', 'Device': '0x15d8'}]}, {'Codename': 'Arcturus', 'IDs': [{'Vendor': '0x1002', 'Device': '0x738c'}, {'Vendor': '0x1002', 'Device': '0x7388'}, {'Vendor': '0x1002', 'Device': '0x738e'}, {'Vendor': '0x1002', 'Device': '0x7390'}]}, {'Codename': 'Navi 10', 'IDs': [{'Vendor': '0x1002', 'Device': '0x7310'}, {'Vendor': '0x1002', 'Device': '0x7312'}, {'Vendor': '0x1002', 'Device': '0x7318'}, {'Vendor': '0x1002', 'Device': '0x7319'}, {'Vendor': '0x1002', 'Device': '0x731a'}, {'Vendor': '0x1002', 'Device': '0x731b'}, {'Vendor': '0x1002', 'Device': '0x731e'}, {'Vendor': '0x1002', 'Device': '0x731f'}]}, {'Codename': 'Navi 14', 'IDs': [{'Vendor': '0x1002', 'Device': '0x7340'}, {'Vendor': '0x1002', 'Device': '0x7341'}, {'Vendor': '0x1002', 'Device': '0x7347'}, {'Vendor': '0x1002', 'Device': '0x734f'}]}, {'Codename': 'Renoir', 'IDs': [{'Vendor': '0x1002', 'Device': '0x15e7'}, {'Vendor': '0x1002', 'Device': '0x1636'}, {'Vendor': '0x1002', 'Device': '0x1638'}, {'Vendor': '0x1002', 'Device': '0x164c'}]}, {'Codename': 'Navi 12', 'IDs': [{'Vendor': '0x1002', 'Device': '0x7360'}, {'Vendor': '0x1002', 'Device': '0x7362'}]}, {'Codename': 'Sienna Cichlid', 'IDs': [{'Vendor': '0x1002', 'Device': '0x73a0'}, {'Vendor': '0x1002', 'Device': '0x73a1'}, {'Vendor': '0x1002', 'Device': '0x73a2'}, {'Vendor': '0x1002', 'Device': '0x73a3'}, {'Vendor': '0x1002', 'Device': '0x73a5'}, {'Vendor': '0x1002', 'Device': '0x73a8'}, {'Vendor': '0x1002', 'Device': '0x73a9'}, {'Vendor': '0x1002', 'Device': '0x73ab'}, {'Vendor': '0x1002', 'Device': '0x73ac'}, {'Vendor': '0x1002', 'Device': '0x73ad'}, {'Vendor': '0x1002', 'Device': '0x73ae'}, {'Vendor': '0x1002', 'Device': '0x73af'}, {'Vendor': '0x1002', 'Device': '0x73bf'}]}, {'Codename': 'Vangogh', 'IDs': [{'Vendor': '0x1002', 'Device': '0x163f'}]}, {'Codename': 'Yellow Carp', 'IDs': [{'Vendor': '0x1002', 'Device': '0x164d'}, {'Vendor': '0x1002', 'Device': '0x1681'}]}, {'Codename': 'Navy Flounder', 'IDs': [{'Vendor': '0x1002', 'Device': '0x73c0'}, {'Vendor': '0x1002', 'Device': '0x73c1'}, {'Vendor': '0x1002', 'Device': '0x73c3'}, {'Vendor': '0x1002', 'Device': '0x73da'}, {'Vendor': '0x1002', 'Device': '0x73db'}, {'Vendor': '0x1002', 'Device': '0x73dc'}, {'Vendor': '0x1002', 'Device': '0x73dd'}, {'Vendor': '0x1002', 'Device': '0x73de'}, {'Vendor': '0x1002', 'Device': '0x73df'}]}, {'Codename': 'Dimgrey Cavefish', 'IDs': [{'Vendor': '0x1002', 'Device': '0x73e0'}, {'Vendor': '0x1002', 'Device': '0x73e1'}, {'Vendor': '0x1002', 'Device': '0x73e2'}, {'Vendor': '0x1002', 'Device': '0x73e3'}, {'Vendor': '0x1002', 'Device': '0x73e8'}, {'Vendor': '0x1002', 'Device': '0x73e9'}, {'Vendor': '0x1002', 'Device': '0x73ea'}, {'Vendor': '0x1002', 'Device': '0x73eb'}, {'Vendor': '0x1002', 'Device': '0x73ec'}, {'Vendor': '0x1002', 'Device': '0x73ed'}, {'Vendor': '0x1002', 'Device': '0x73ef'}, {'Vendor': '0x1002', 'Device': '0x73ff'}]}, {'Codename': 'Aldebaran', 'IDs': [{'Vendor': '0x1002', 'Device': '0x7408'}, {'Vendor': '0x1002', 'Device': '0x740c'}, {'Vendor': '0x1002', 'Device': '0x740f'}, {'Vendor': '0x1002', 'Device': '0x7410'}]}, {'Codename': 'Cyan Skillfish', 'IDs': [{'Vendor': '0x1002', 'Device': '0x13fe'}]}, {'Codename': 'Beige Goby', 'IDs': [{'Vendor': '0x1002', 'Device': '0x7420'}, {'Vendor': '0x1002', 'Device': '0x7421'}, {'Vendor': '0x1002', 'Device': '0x7422'}, {'Vendor': '0x1002', 'Device': '0x7423'}, {'Vendor': '0x1002', 'Device': '0x743f'}]}]
# %% ####################################### def scapypayload_joinall(packet_list: scapy.plist.PacketList): allpayloads_onestring = b''.join([ p.load for p in packet_list if p.haslayer(Raw) ]) return allpayloads_onestring
def scapypayload_joinall(packet_list: scapy.plist.PacketList): allpayloads_onestring = b''.join([p.load for p in packet_list if p.haslayer(Raw)]) return allpayloads_onestring
class tile: def __init__(self) -> None: self.owner = None self.population = None class board: def __init__(self,size) -> None: self.size = size class game: def __init__(self,players) -> None: self.players = players self.playercount = len(players) def newGame(self) -> None: self.board = board(10) def makeMove(self,owner,tileStart,tileEnd): pass def main(): players = ["Garth","Courtney"] g = game(players) if __name__ == "__main__": main()
class Tile: def __init__(self) -> None: self.owner = None self.population = None class Board: def __init__(self, size) -> None: self.size = size class Game: def __init__(self, players) -> None: self.players = players self.playercount = len(players) def new_game(self) -> None: self.board = board(10) def make_move(self, owner, tileStart, tileEnd): pass def main(): players = ['Garth', 'Courtney'] g = game(players) if __name__ == '__main__': main()
arr1 = [-12, 11, -13, -5, 6, -7, 5, -3, -6] arr2 = [1, 2, -4, -5, 2, -7, 3, 2, -6, -8, -9, 3, 2, 1] def moveNegativeInt(arr): for i in arr: if i < 0: temp = i arr.remove(i) arr.insert(0, temp) return arr print(moveNegativeInt(arr1)) print(moveNegativeInt(arr2))
arr1 = [-12, 11, -13, -5, 6, -7, 5, -3, -6] arr2 = [1, 2, -4, -5, 2, -7, 3, 2, -6, -8, -9, 3, 2, 1] def move_negative_int(arr): for i in arr: if i < 0: temp = i arr.remove(i) arr.insert(0, temp) return arr print(move_negative_int(arr1)) print(move_negative_int(arr2))
s = input() l = len(s) r = 'AWH' # just repeat Os bc valid, ignore other rules print(r + 'O' * l)
s = input() l = len(s) r = 'AWH' print(r + 'O' * l)
WOQL_CONCAT_JSON = { "@type": "Concatenate", "list": {"@type" : "DataValue", "list" : [ {"@type": "DataValue", "variable": "Duration"}, { "@type": "DataValue", "data": {"@type": "xsd:string", "@value": " yo "}, }, {"@type": "DataValue", "variable": "Duration_Cast"}, ]}, "result": {"@type": "DataValue", "variable": "x"}, }
woql_concat_json = {'@type': 'Concatenate', 'list': {'@type': 'DataValue', 'list': [{'@type': 'DataValue', 'variable': 'Duration'}, {'@type': 'DataValue', 'data': {'@type': 'xsd:string', '@value': ' yo '}}, {'@type': 'DataValue', 'variable': 'Duration_Cast'}]}, 'result': {'@type': 'DataValue', 'variable': 'x'}}
class GeneralizationSet: name = "" id = "" attributes = [] def __init__(self, name, gs_id, attributes): self.name = name self.id = gs_id self.attributes = attributes def __str__(self): return f'id:{self.id} name: {self.name} attributes: {self.attributes}'
class Generalizationset: name = '' id = '' attributes = [] def __init__(self, name, gs_id, attributes): self.name = name self.id = gs_id self.attributes = attributes def __str__(self): return f'id:{self.id} name: {self.name} attributes: {self.attributes}'
"""igcommit - The main module Copyright (c) 2021 InnoGames GmbH Portions Copyright (c) 2021 Emre Hasegeli """ VERSION = (3, 1)
"""igcommit - The main module Copyright (c) 2021 InnoGames GmbH Portions Copyright (c) 2021 Emre Hasegeli """ version = (3, 1)
# # @lc app=leetcode id=32 lang=python3 # # [32] Longest Valid Parentheses # # @lc code=start class Solution: def longestValidParentheses(self, s: str) -> int: max_length = 0 left_count = right_count = 0 for i in range(len(s)): # left to right scan if s[i] == '(': left_count += 1 elif s[i] == ')': right_count += 1 if left_count == right_count: max_length = max(max_length, right_count * 2) elif left_count < right_count: left_count = right_count = 0 left_count = right_count = 0 for i in range(len(s))[::-1]: # right to left scan if s[i] == '(': left_count += 1 elif s[i] == ')': right_count += 1 if left_count == right_count: max_length = max(max_length, left_count * 2) elif left_count > right_count: left_count = right_count = 0 return max_length # @lc code=end # Accepted # 230/230 cases passed(48 ms) # Your runtime beats 90.94 % of python3 submissions # Your memory usage beats 44.44 % of python3 submissions(13.8 MB)
class Solution: def longest_valid_parentheses(self, s: str) -> int: max_length = 0 left_count = right_count = 0 for i in range(len(s)): if s[i] == '(': left_count += 1 elif s[i] == ')': right_count += 1 if left_count == right_count: max_length = max(max_length, right_count * 2) elif left_count < right_count: left_count = right_count = 0 left_count = right_count = 0 for i in range(len(s))[::-1]: if s[i] == '(': left_count += 1 elif s[i] == ')': right_count += 1 if left_count == right_count: max_length = max(max_length, left_count * 2) elif left_count > right_count: left_count = right_count = 0 return max_length
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def sumNumbers(self, root: TreeNode) -> int: if root == None: return 0 else: return sum([ int(i) for i in self.travelTree(root) ]) def travelTree(self, root): if root.left == None and root.right == None: return [ str(root.val) ] else: if root.right == None: numList = self.travelTree( root.left ) elif root.left == None: numList = self.travelTree( root.right ) else: lNumList = self.travelTree( root.left ) rNumList = self.travelTree( root.right ) numList = lNumList + rNumList outList = [] for num in numList: newNum = str(root.val) + num outList.append( newNum ) return outList
class Solution: def sum_numbers(self, root: TreeNode) -> int: if root == None: return 0 else: return sum([int(i) for i in self.travelTree(root)]) def travel_tree(self, root): if root.left == None and root.right == None: return [str(root.val)] else: if root.right == None: num_list = self.travelTree(root.left) elif root.left == None: num_list = self.travelTree(root.right) else: l_num_list = self.travelTree(root.left) r_num_list = self.travelTree(root.right) num_list = lNumList + rNumList out_list = [] for num in numList: new_num = str(root.val) + num outList.append(newNum) return outList
########################################################################### # # Copyright 2017 Google Inc. # # 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 # # https://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. # ########################################################################### DCM_Field_Lookup = { "Video_Unmutes":"INTEGER", "Zip_Postal_Code":"INTEGER", "Path_Length":"INTEGER", "Billable_Impressions":"FLOAT", "Active_View_Of_Completed_Impressions_Audible_And_Visible":"FLOAT", "Measurable_Impressions_For_Audio":"INTEGER", "Average_Interaction_Time":"FLOAT", "Invalid_Impressions":"FLOAT", "Floodlight_Variable_40":"STRING", "Floodlight_Variable_41":"STRING", "Floodlight_Variable_42":"STRING", "Floodlight_Variable_43":"STRING", "Floodlight_Variable_44":"STRING", "Floodlight_Variable_45":"STRING", "Floodlight_Variable_46":"STRING", "Floodlight_Variable_47":"STRING", "Floodlight_Variable_48":"STRING", "Floodlight_Variable_49":"STRING", "Clicks":"INTEGER", "Active_View_In_Background":"FLOAT", "Active_View_Of_First_Quartile_Impressions_Audible_And_Visible":"FLOAT", "Paid_Search_Advertiser_Id":"INTEGER", "Video_Third_Quartile_Completions":"INTEGER", "Video_Progress_Events":"INTEGER", "Cost_Per_Revenue":"FLOAT", "Total_Interaction_Time":"INTEGER", "Roadblock_Impressions":"INTEGER", "Active_View_Of_Completed_Impressions_Visible":"FLOAT", "Video_Replays":"INTEGER", "Keyword":"STRING", "Full_Screen_Video_Plays":"INTEGER", "Active_View_Impression_Distribution_Not_Measurable":"FLOAT", "Unique_Reach_Total_Reach":"INTEGER", "Has_Exits":"BOOLEAN", "Paid_Search_Engine_Account":"STRING", "Operating_System_Version":"STRING", "Campaign":"STRING", "Active_View_Not_Viewable_Impressions":"INTEGER", "Twitter_Offers_Accepted":"INTEGER", "Interaction_Type":"STRING", "Activity_Delivery_Status":"FLOAT", "Video_Companion_Clicks":"INTEGER", "Floodlight_Paid_Search_Average_Cost_Per_Transaction":"FLOAT", "Paid_Search_Agency_Id":"INTEGER", "Asset":"STRING", "Active_View_Audible_Amp_Fully_On_Screen_For_Half_Of_Duration_15_Sec_Cap_Impressions":"INTEGER", "User_List_Current_Size":"STRING", "Exit_Url":"STRING", "Natural_Search_Revenue":"FLOAT", "Retweets":"INTEGER", "Full_Screen_Impressions":"INTEGER", "Audio_Unmutes":"INTEGER", "Dynamic_Element_4_Field_Value_2":"STRING", "Dynamic_Element_4_Field_Value_3":"STRING", "Dynamic_Element_4_Field_Value_1":"STRING", "Creative_Start_Date":"STRING", "Small_Video_Player_Size_Impressions":"INTEGER", "Audio_Replays":"INTEGER", "Video_Player_Size_Avg_Width":"INTEGER", "Rich_Media_Standard_Event_Count":"INTEGER", "Publisher_Problems":"INTEGER", "Paid_Search_Advertiser":"STRING", "Has_Video_Completions":"BOOLEAN", "Cookie_Reach_Duplicate_Impression_Reach":"FLOAT", "Audio_Third_Quartile_Completions":"INTEGER", "Package_Roadblock_Strategy":"STRING", "Video_Midpoints":"INTEGER", "Click_Through_Conversion_Events_Cross_Environment":"INTEGER", "Video_Pauses":"INTEGER", "Trueview_Views":"INTEGER", "Interaction_Count_Mobile_Static_Image":"INTEGER", "Dynamic_Element_Click_Rate":"FLOAT", "Active_View_Play_Time_Visible":"FLOAT", "Dynamic_Element_1_Field_6_Value":"STRING", "Dynamic_Element_4_Value":"STRING", "Creative_End_Date":"STRING", "Dynamic_Element_4_Field_3_Value":"STRING", "Dynamic_Field_Value_3":"STRING", "Mobile_Carrier":"STRING", "Warnings":"INTEGER", "U_Value":"STRING", "Average_Display_Time":"FLOAT", "Custom_Variable":"STRING", "Video_Interactions":"INTEGER", "Average_Expansion_Time":"FLOAT", "Email_Shares":"INTEGER", "Flight_Booked_Rate":"STRING", "Impression_Count":"INTEGER", "Site_Id_Dcm":"INTEGER", "Dynamic_Element_3_Value_Id":"STRING", "Paid_Search_Legacy_Keyword_Id":"INTEGER", "View_Through_Conversion_Events_Cross_Environment":"INTEGER", "Active_View_Visible_At_Midpoint":"FLOAT", "Counters":"INTEGER", "Floodlight_Paid_Search_Average_Cost_Per_Action":"FLOAT", "Activity_Group_Id":"INTEGER", "Active_View_Of_First_Quartile_Impressions_Visible":"FLOAT", "Click_Count":"INTEGER", "Video_4A_39_S_Ad_Id":"STRING", "Total_Interactions":"INTEGER", "Active_View_Viewable_Impressions":"INTEGER", "Natural_Search_Engine_Property":"STRING", "Video_Views":"INTEGER", "Active_View_Of_Third_Quartile_Impressions_Visible":"FLOAT", "Domain":"STRING", "Total_Conversion_Events_Cross_Environment":"INTEGER", "Dbm_Advertiser":"STRING", "Companion_Impressions":"INTEGER", "View_Through_Conversions_Cross_Environment":"INTEGER", "Dynamic_Element_5_Field_Value_3":"STRING", "Dynamic_Element_5_Field_Value_2":"STRING", "Dynamic_Element_5_Field_Value_1":"STRING", "Active_View_Visible_10_Seconds":"FLOAT", "Active_View_Impression_Distribution_Viewable":"FLOAT", "Creative_Field_2":"STRING", "Twitter_Leads_Generated":"INTEGER", "Paid_Search_External_Campaign_Id":"INTEGER", "Creative_Field_8":"STRING", "Interaction_Count_Paid_Search":"INTEGER", "Activity_Group":"STRING", "Video_Player_Location_Avg_Pixels_From_Top":"INTEGER", "Interaction_Number":"INTEGER", "Dynamic_Element_3_Value":"STRING", "Cookie_Reach_Total_Reach":"INTEGER", "Cookie_Reach_Exclusive_Click_Reach":"FLOAT", "Creative_Field_5":"STRING", "Cookie_Reach_Overlap_Impression_Reach":"FLOAT", "Paid_Search_Ad_Group":"STRING", "Interaction_Count_Rich_Media":"INTEGER", "Dynamic_Element_Total_Conversions":"INTEGER", "Transaction_Count":"INTEGER", "Num_Value":"STRING", "Cookie_Reach_Overlap_Total_Reach":"FLOAT", "Floodlight_Attribution_Type":"STRING", "Html5_Impressions":"INTEGER", "Served_Pixel_Density":"STRING", "Has_Full_Screen_Video_Plays":"BOOLEAN", "Interaction_Count_Static_Image":"INTEGER", "Has_Video_Companion_Clicks":"BOOLEAN", "Paid_Search_Ad":"STRING", "Paid_Search_Visits":"INTEGER", "Audio_Pauses":"INTEGER", "Creative_Pixel_Size":"STRING", "Flight_Start_Date":"STRING", "Natural_Search_Transactions":"FLOAT", "Cookie_Reach_Impression_Reach":"INTEGER", "Dynamic_Field_Value_4":"STRING", "Twitter_Line_Item_Id":"INTEGER", "Has_Video_Stops":"BOOLEAN", "Paid_Search_Labels":"STRING", "Twitter_Creative_Type":"STRING", "Operating_System":"STRING", "Dynamic_Element_3_Field_4_Value":"STRING", "Hours_Since_First_Interaction":"INTEGER", "Asset_Category":"STRING", "Active_View_Measurable_Impressions":"FLOAT", "Package_Roadblock":"STRING", "Large_Video_Player_Size_Impressions":"INTEGER", "Paid_Search_Actions":"FLOAT", "Has_Full_Screen_Views":"BOOLEAN", "Backup_Image":"INTEGER", "Likes":"INTEGER", "Serving_Problems":"INTEGER", "Audio_Midpoints":"INTEGER", "Flight_Booked_Cost":"STRING", "Other_Twitter_Engagements":"INTEGER", "Audio_Completions":"INTEGER", "Click_Rate":"FLOAT", "Cost_Per_Activity":"FLOAT", "Dynamic_Element_2_Value":"STRING", "Cookie_Reach_Exclusive_Impression_Reach":"FLOAT", "Content_Category":"STRING", "Total_Revenue_Cross_Environment":"FLOAT", "Unique_Reach_Click_Reach":"INTEGER", "Has_Video_Replays":"BOOLEAN", "Twitter_Creative_Id":"INTEGER", "Has_Counters":"BOOLEAN", "Dynamic_Element_4_Value_Id":"STRING", "Twitter_Video_50_In_View_For_2_Seconds":"INTEGER", "Dynamic_Element_4_Field_1_Value":"STRING", "Has_Video_Interactions":"BOOLEAN", "Video_Player_Size":"STRING", "Active_View_Audible_Amp_Fully_On_Screen_For_Half_Of_Duration_Trueview_Impressions":"INTEGER", "Advertiser_Id":"INTEGER", "Rich_Media_Clicks":"INTEGER", "Floodlight_Variable_59":"STRING", "Floodlight_Variable_58":"STRING", "Floodlight_Variable_57":"STRING", "Floodlight_Variable_56":"STRING", "Floodlight_Variable_55":"STRING", "Floodlight_Variable_54":"STRING", "Floodlight_Variable_53":"STRING", "Floodlight_Variable_52":"STRING", "Floodlight_Variable_51":"STRING", "Floodlight_Variable_50":"STRING", "Cookie_Reach_Incremental_Total_Reach":"INTEGER", "Playback_Method":"STRING", "Has_Interactive_Impressions":"BOOLEAN", "Paid_Search_Average_Position":"FLOAT", "Floodlight_Variable_96":"STRING", "Package_Roadblock_Id":"INTEGER", "Recalculated_Attribution_Type":"STRING", "Dbm_Advertiser_Id":"INTEGER", "Floodlight_Variable_100":"STRING", "Active_View_Impression_Distribution_Not_Viewable":"FLOAT", "Floodlight_Variable_3":"STRING", "Floodlight_Variable_2":"STRING", "Floodlight_Variable_1":"STRING", "Floodlight_Variable_7":"STRING", "Floodlight_Variable_6":"STRING", "Floodlight_Variable_5":"STRING", "Floodlight_Variable_4":"STRING", "Rendering_Id":"INTEGER", "Floodlight_Variable_9":"STRING", "Floodlight_Variable_8":"STRING", "Cookie_Reach_Incremental_Impression_Reach":"INTEGER", "Active_View_Play_Time_Audible_And_Visible":"FLOAT", "Reporting_Problems":"INTEGER", "Package_Roadblock_Total_Booked_Units":"STRING", "Has_Video_Midpoints":"BOOLEAN", "Dynamic_Element_4_Field_4_Value":"STRING", "Percentage_Of_Measurable_Impressions_For_Video_Player_Location":"FLOAT", "Campaign_End_Date":"STRING", "Placement_External_Id":"STRING", "Cost_Per_Click":"FLOAT", "Hour":"STRING", "Click_Through_Revenue":"FLOAT", "Video_Skips":"INTEGER", "Active_View_Of_Third_Quartile_Impressions_Audible_And_Visible":"FLOAT", "Paid_Search_Click_Rate":"FLOAT", "Has_Video_Views":"BOOLEAN", "Dbm_Cost_Account_Currency":"FLOAT", "Flight_End_Date":"STRING", "Has_Video_Plays":"BOOLEAN", "Paid_Search_Clicks":"INTEGER", "Creative_Field_9":"STRING", "Manual_Closes":"INTEGER", "Creative_Field_7":"STRING", "Creative_Field_6":"STRING", "App":"STRING", "Creative_Field_4":"STRING", "Creative_Field_3":"STRING", "Campaign_Start_Date":"STRING", "Creative_Field_1":"STRING", "Content_Classifier":"STRING", "Cookie_Reach_Duplicate_Click_Reach":"FLOAT", "Site_Dcm":"STRING", "Digital_Content_Label":"STRING", "Has_Manual_Closes":"BOOLEAN", "Has_Timers":"BOOLEAN", "Active_View_Audible_Impressions":"FLOAT", "Impressions":"INTEGER", "Classified_Impressions":"INTEGER", "Dbm_Site_Id":"INTEGER", "Dynamic_Element_2_Field_1_Value":"STRING", "Floodlight_Variable_72":"STRING", "Creative":"STRING", "Asset_Orientation":"STRING", "Custom_Variable_Count_1":"INTEGER", "Revenue_Adv_Currency":"FLOAT", "Video_Stops":"INTEGER", "Paid_Search_Ad_Id":"INTEGER", "Dbm_Line_Item":"STRING", "Click_Delivery_Status":"FLOAT", "Dynamic_Element_Impressions":"INTEGER", "Interaction_Count_Click_Tracker":"INTEGER", "Active_View_Audible_And_Visible_At_Midpoint":"FLOAT", "Placement_Total_Booked_Units":"STRING", "Date":"STRING", "Twitter_Placement_Type":"STRING", "Total_Revenue":"FLOAT", "Recalculated_Attributed_Interaction":"STRING", "Ad_Type":"STRING", "Social_Engagement_Rate":"FLOAT", "Dynamic_Element_5_Field_1_Value":"STRING", "Dynamic_Profile_Id":"INTEGER", "Active_View_Impressions_Visible_10_Seconds":"INTEGER", "Interaction_Count_Video":"INTEGER", "Dynamic_Element_5_Value":"STRING", "Active_View_Visible_At_Completion":"FLOAT", "Video_Player_Size_Avg_Height":"INTEGER", "Creative_Type":"STRING", "Campaign_External_Id":"STRING", "Dynamic_Element_Click_Through_Conversions":"INTEGER", "Conversion_Url":"STRING", "Floodlight_Variable_89":"STRING", "Floodlight_Variable_84":"STRING", "Floodlight_Variable_85":"STRING", "Floodlight_Variable_86":"STRING", "Floodlight_Variable_87":"STRING", "Floodlight_Variable_80":"STRING", "Floodlight_Variable_81":"STRING", "Floodlight_Variable_82":"STRING", "Floodlight_Variable_83":"STRING", "Active_View_Audible_Amp_Fully_On_Screen_For_Half_Of_Duration_Trueview_Measurable_Impressions":"INTEGER", "Floodlight_Variable_66":"STRING", "Floodlight_Variable_67":"STRING", "Floodlight_Variable_64":"STRING", "Floodlight_Variable_65":"STRING", "Floodlight_Variable_62":"STRING", "Floodlight_Variable_63":"STRING", "Floodlight_Variable_60":"STRING", "Active_View_Eligible_Impressions":"INTEGER", "Dynamic_Element_3_Field_Value_1":"STRING", "Dynamic_Element_3_Field_Value_3":"STRING", "Dynamic_Element_3_Field_Value_2":"STRING", "Active_View_Of_Midpoint_Impressions_Visible":"FLOAT", "Floodlight_Variable_68":"STRING", "Floodlight_Variable_69":"STRING", "Floodlight_Variable_13":"STRING", "Floodlight_Variable_12":"STRING", "Floodlight_Variable_11":"STRING", "Floodlight_Variable_10":"STRING", "Floodlight_Variable_17":"STRING", "Floodlight_Variable_16":"STRING", "Floodlight_Variable_15":"STRING", "Floodlight_Variable_14":"STRING", "Floodlight_Variable_19":"STRING", "Floodlight_Variable_18":"STRING", "Audience_Targeted":"STRING", "Total_Conversions_Cross_Environment":"INTEGER", "Twitter_Url_Clicks":"INTEGER", "Dynamic_Element_1_Field_1_Value":"STRING", "Active_View_Audible_Amp_Fully_On_Screen_For_Half_Of_Duration_Trueview_Rate":"FLOAT", "Active_View_Audible_And_Visible_At_First_Quartile":"FLOAT", "Has_Video_Skips":"BOOLEAN", "Dynamic_Element_5_Field_2_Value":"STRING", "Twitter_Buy_Now_Clicks":"INTEGER", "Creative_Groups_2":"STRING", "Creative_Groups_1":"STRING", "Campaign_Id":"INTEGER", "Twitter_Campaign_Id":"INTEGER", "Active_View_Audible_Amp_Fully_On_Screen_For_Half_Of_Duration_15_Sec_Cap_Rate":"FLOAT", "Dynamic_Element_1_Field_5_Value":"STRING", "Paid_Search_Match_Type":"STRING", "Activity_Per_Thousand_Impressions":"FLOAT", "Has_Expansions":"BOOLEAN", "Dbm_Creative_Id":"INTEGER", "Booked_Viewable_Impressions":"FLOAT", "Dynamic_Element_1_Field_2_Value":"STRING", "Paid_Search_Cost":"FLOAT", "Dynamic_Element_5_Field_5_Value":"STRING", "Floodlight_Paid_Search_Spend_Per_Transaction_Revenue":"FLOAT", "Dynamic_Element_4":"STRING", "Dynamic_Element_5":"STRING", "Dynamic_Element_2":"STRING", "Click_Through_Conversions":"FLOAT", "Dynamic_Element_1":"STRING", "Dynamic_Element_4_Field_6_Value":"STRING", "Attributed_Event_Platform_Type":"STRING", "Attributed_Event_Connection_Type":"STRING", "Dynamic_Element_1_Value":"STRING", "Measurable_Impressions_For_Video_Player_Location":"INTEGER", "Audio_Companion_Impressions":"INTEGER", "Video_Full_Screen":"INTEGER", "Companion_Creative":"STRING", "Cookie_Reach_Exclusive_Total_Reach":"FLOAT", "Audio_Mutes":"INTEGER", "Placement_Rate":"STRING", "Companion_Clicks":"INTEGER", "Cookie_Reach_Overlap_Click_Reach":"FLOAT", "Site_Keyname":"STRING", "Placement_Cost_Structure":"STRING", "Percentage_Of_Measurable_Impressions_For_Audio":"FLOAT", "Rich_Media_Custom_Event_Count":"INTEGER", "Dbm_Cost_Usd":"FLOAT", "Dynamic_Element_1_Field_3_Value":"STRING", "Paid_Search_Landing_Page_Url":"STRING", "Verifiable_Impressions":"INTEGER", "Average_Time":"FLOAT", "Creative_Field_12":"STRING", "Creative_Field_11":"STRING", "Creative_Field_10":"STRING", "Channel_Mix":"STRING", "Paid_Search_Campaign":"STRING", "Active_View_Audible_And_Visible_At_Start":"FLOAT", "Natural_Search_Landing_Page":"STRING", "Dynamic_Element_1_Field_4_Value":"STRING", "Payment_Source":"STRING", "Planned_Media_Cost":"FLOAT", "Conversion_Referrer":"STRING", "Companion_Creative_Id":"INTEGER", "Dynamic_Element_4_Field_2_Value":"STRING", "Total_Conversions":"FLOAT", "Custom_Variable_Count_2":"INTEGER", "Paid_Search_External_Ad_Group_Id":"INTEGER", "Hd_Video_Player_Size_Impressions":"INTEGER", "Click_Through_Transaction_Count":"FLOAT", "Floodlight_Attributed_Interaction":"STRING", "Dynamic_Profile":"STRING", "Floodlight_Variable_28":"STRING", "Floodlight_Variable_29":"STRING", "Dynamic_Element_2_Field_2_Value":"STRING", "Floodlight_Variable_22":"STRING", "Floodlight_Variable_23":"STRING", "Floodlight_Variable_20":"STRING", "Floodlight_Variable_21":"STRING", "Floodlight_Variable_26":"STRING", "Floodlight_Variable_27":"STRING", "Floodlight_Variable_24":"STRING", "Floodlight_Variable_25":"STRING", "Dynamic_Element_4_Field_5_Value":"STRING", "Creative_Id":"STRING", "View_Through_Conversions":"FLOAT", "Active_View_Full_Screen":"FLOAT", "Activity_Per_Click":"FLOAT", "Floodlight_Variable_88":"STRING", "Active_View_Audible_And_Visible_At_Third_Quartile":"FLOAT", "Placement":"STRING", "Dynamic_Element_2_Field_Value_1":"STRING", "Dynamic_Element_2_Field_Value_2":"STRING", "Dynamic_Element_2_Field_Value_3":"STRING", "Interaction_Count_Mobile_Video":"INTEGER", "Has_Full_Screen_Video_Completions":"BOOLEAN", "Placement_Total_Planned_Media_Cost":"STRING", "Video_First_Quartile_Completions":"INTEGER", "Twitter_Creative_Media_Id":"INTEGER", "Cookie_Reach_Duplicate_Total_Reach":"FLOAT", "Rich_Media_Impressions":"INTEGER", "Video_Completions":"INTEGER", "Month":"STRING", "Paid_Search_Keyword_Id":"INTEGER", "Replies":"INTEGER", "Dynamic_Element_5_Field_6_Value":"STRING", "Video_Mutes":"INTEGER", "Flight_Booked_Units":"STRING", "Dynamic_Element_Value_Id":"STRING", "Expansion_Time":"INTEGER", "Invalid_Clicks":"FLOAT", "Has_Video_Progress_Events":"BOOLEAN", "Dynamic_Element_2_Field_3_Value":"STRING", "Rich_Media_Standard_Event_Path_Summary":"STRING", "Video_Muted_At_Start":"INTEGER", "Audio_Companion_Clicks":"INTEGER", "Active_View_Audible_Amp_Fully_On_Screen_For_Half_Of_Duration_15_Sec_Cap_Measurable_Impressions":"INTEGER", "Interaction_Date_Time":"STRING", "User_List":"STRING", "Paid_Search_External_Keyword_Id":"INTEGER", "Timers":"INTEGER", "Floodlight_Paid_Search_Action_Conversion_Percentage":"FLOAT", "View_Through_Revenue_Cross_Environment":"FLOAT", "Advertiser":"STRING", "Has_Video_Unmutes":"BOOLEAN", "Natural_Search_Query":"STRING", "Audio_Plays":"INTEGER", "Unique_Reach_Average_Impression_Frequency":"FLOAT", "Path_Type":"STRING", "Dynamic_Field_Value_2":"STRING", "Interaction_Channel":"STRING", "Blocked_Impressions":"INTEGER", "Dynamic_Field_Value_5":"STRING", "Dynamic_Field_Value_6":"STRING", "Placement_Compatibility":"STRING", "City":"STRING", "Dbm_Line_Item_Id":"INTEGER", "Cookie_Reach_Incremental_Click_Reach":"INTEGER", "Floodlight_Variable_61":"STRING", "Natural_Search_Processed_Landing_Page_Query_String":"STRING", "Report_Day":"INTEGER", "Dbm_Site":"STRING", "Connection_Type":"STRING", "Video_Average_View_Time":"FLOAT", "Click_Through_Revenue_Cross_Environment":"FLOAT", "Dbm_Creative":"STRING", "Attributed_Event_Environment":"STRING", "Floodlight_Variable_99":"STRING", "Floodlight_Variable_98":"STRING", "Measurable_Impressions_For_Video_Player_Size":"INTEGER", "Dynamic_Element_1_Value_Id":"STRING", "Paid_Search_Engine_Account_Id":"INTEGER", "Floodlight_Variable_93":"STRING", "Floodlight_Variable_92":"STRING", "Floodlight_Variable_91":"STRING", "Floodlight_Variable_90":"STRING", "Floodlight_Variable_97":"STRING", "Placement_Strategy":"STRING", "Floodlight_Variable_95":"STRING", "Floodlight_Variable_94":"STRING", "Floodlight_Variable_75":"STRING", "Floodlight_Variable_74":"STRING", "Floodlight_Variable_77":"STRING", "Floodlight_Variable_76":"STRING", "Floodlight_Variable_71":"STRING", "Floodlight_Variable_70":"STRING", "Floodlight_Variable_73":"STRING", "Activity":"STRING", "Natural_Search_Engine_Url":"STRING", "Total_Display_Time":"INTEGER", "User_List_Description":"STRING", "Active_View_Impressions_Audible_And_Visible_At_Completion":"INTEGER", "Floodlight_Variable_79":"STRING", "Floodlight_Variable_78":"STRING", "Twitter_Impression_Type":"STRING", "Active_View_Average_Viewable_Time_Seconds":"FLOAT", "Active_View_Visible_At_Start":"FLOAT", "Natural_Search_Landing_Page_Query_String":"STRING", "Percentage_Of_Measurable_Impressions_For_Video_Player_Size":"FLOAT", "Has_Full_Screen_Impressions":"BOOLEAN", "Conversion_Id":"INTEGER", "Creative_Version":"STRING", "Dynamic_Element_2_Value_Id":"STRING", "Active_View_Audible_And_Visible_At_Completion":"FLOAT", "Hours_Since_Attributed_Interaction":"INTEGER", "Dynamic_Element_3_Field_5_Value":"STRING", "Has_Video_First_Quartile_Completions":"BOOLEAN", "Dynamic_Element":"STRING", "Booked_Clicks":"FLOAT", "Booked_Impressions":"FLOAT", "Tran_Value":"STRING", "Dynamic_Element_Clicks":"INTEGER", "Has_Dynamic_Impressions":"BOOLEAN", "Site_Id_Site_Directory":"INTEGER", "Event_Timers":"FLOAT", "Twitter_Video_100_In_View_For_3_Seconds":"INTEGER", "Dynamic_Element_2_Field_6_Value":"STRING", "Has_Backup_Image":"BOOLEAN", "Dynamic_Element_2_Field_5_Value":"STRING", "Rich_Media_Custom_Event_Path_Summary":"STRING", "Advertiser_Group":"STRING", "General_Invalid_Traffic_Givt_Clicks":"INTEGER", "Follows":"INTEGER", "Has_Html5_Impressions":"BOOLEAN", "Active_View_Of_Midpoint_Impressions_Audible_And_Visible":"FLOAT", "Activity_Date_Time":"STRING", "Site_Site_Directory":"STRING", "Placement_Pixel_Size":"STRING", "Within_Floodlight_Lookback_Window":"STRING", "Dbm_Partner":"STRING", "Dynamic_Element_3_Field_3_Value":"STRING", "Ord_Value":"STRING", "Floodlight_Configuration":"INTEGER", "Ad_Id":"INTEGER", "Dynamic_Field_Value_1":"STRING", "Video_Plays":"INTEGER", "Days_Since_First_Interaction":"INTEGER", "Event_Counters":"INTEGER", "Active_View_Not_Measurable_Impressions":"INTEGER", "Landing_Page_Url":"STRING", "Ad_Status":"STRING", "Unique_Reach_Impression_Reach":"INTEGER", "Dynamic_Element_2_Field_4_Value":"STRING", "Dbm_Partner_Id":"INTEGER", "Asset_Id":"INTEGER", "Video_View_Rate":"FLOAT", "Active_View_Visible_At_Third_Quartile":"FLOAT", "Twitter_App_Install_Clicks":"INTEGER", "Total_Social_Engagements":"INTEGER", "Media_Cost":"FLOAT", "Placement_Tag_Type":"STRING", "Dbm_Insertion_Order":"STRING", "Floodlight_Variable_39":"STRING", "Floodlight_Variable_38":"STRING", "Paid_Search_External_Ad_Id":"INTEGER", "Browser_Platform":"STRING", "Floodlight_Variable_31":"STRING", "Floodlight_Variable_30":"STRING", "Floodlight_Variable_33":"STRING", "Floodlight_Variable_32":"STRING", "Floodlight_Variable_35":"STRING", "Floodlight_Variable_34":"STRING", "Floodlight_Variable_37":"STRING", "Floodlight_Variable_36":"STRING", "Dynamic_Element_View_Through_Conversions":"INTEGER", "Active_View_Viewable_Impression_Cookie_Reach":"INTEGER", "Video_Interaction_Rate":"FLOAT", "Active_View_Visible_At_First_Quartile":"FLOAT", "Dynamic_Element_3_Field_1_Value":"STRING", "Booked_Activities":"FLOAT", "Has_Video_Full_Screen":"BOOLEAN", "User_List_Membership_Life_Span":"STRING", "Video_Length":"STRING", "Paid_Search_Keyword":"STRING", "Revenue_Per_Click":"FLOAT", "Downloaded_Impressions":"INTEGER", "Days_Since_Attributed_Interaction":"INTEGER", "Code_Serves":"INTEGER", "Effective_Cpm":"FLOAT", "Environment":"STRING", "Paid_Search_Agency":"STRING", "Dynamic_Element_5_Field_3_Value":"STRING", "Paid_Search_Engine_Account_Category":"STRING", "Week":"STRING", "Designated_Market_Area_Dma":"STRING", "Cookie_Reach_Click_Reach":"INTEGER", "Twitter_Buy_Now_Purchases":"INTEGER", "Floodlight_Paid_Search_Average_Dcm_Transaction_Amount":"FLOAT", "Placement_Start_Date":"STRING", "View_Through_Revenue":"FLOAT", "Impression_Delivery_Status":"FLOAT", "Floodlight_Paid_Search_Transaction_Conversion_Percentage":"FLOAT", "Click_Through_Conversions_Cross_Environment":"INTEGER", "Activity_Id":"INTEGER", "Has_Video_Mutes":"BOOLEAN", "Exits":"INTEGER", "Paid_Search_Bid_Strategy":"STRING", "Interaction_Count_Mobile_Rich_Media":"INTEGER", "Dbm_Insertion_Order_Id":"INTEGER", "Placement_Id":"INTEGER", "App_Id":"STRING", "View_Through_Transaction_Count":"FLOAT", "Floodlight_Paid_Search_Transaction_Revenue_Per_Spend":"FLOAT", "Active_View_Play_Time_Audible":"FLOAT", "Dynamic_Element_5_Field_4_Value":"STRING", "Companion_Creative_Pixel_Size":"STRING", "Revenue_Per_Thousand_Impressions":"FLOAT", "Natural_Search_Clicks":"INTEGER", "Dynamic_Element_3_Field_2_Value":"STRING", "Audio_First_Quartile_Completions":"INTEGER", "Dynamic_Element_1_Field_Value_3":"STRING", "Dynamic_Element_1_Field_Value_2":"STRING", "Dynamic_Element_1_Field_Value_1":"STRING", "Full_Screen_Average_View_Time":"FLOAT", "Dynamic_Element_5_Value_Id":"STRING", "Rich_Media_Click_Rate":"FLOAT", "User_List_Id":"INTEGER", "Click_Through_Url":"STRING", "Has_Video_Pauses":"BOOLEAN", "Video_Prominence_Score":"STRING", "Has_Video_Third_Quartile_Completions":"BOOLEAN", "Natural_Search_Actions":"FLOAT", "Platform_Type":"STRING", "General_Invalid_Traffic_Givt_Impressions":"INTEGER", "Dynamic_Element_3":"STRING", "Video_Player_Location_Avg_Pixels_From_Left":"INTEGER", "Paid_Search_Transactions":"FLOAT", "Rich_Media_Event":"STRING", "Country":"STRING", "Dynamic_Element_3_Field_6_Value":"STRING", "Expansions":"INTEGER", "Interaction_Rate":"FLOAT", "Natural_Search_Processed_Landing_Page":"STRING", "Floodlight_Impressions":"INTEGER", "Paid_Search_Bid_Strategy_Id":"INTEGER", "Interactive_Impressions":"INTEGER", "Interaction_Count_Natural_Search":"INTEGER", "Twitter_Impression_Id":"INTEGER", "Ad":"STRING", "Paid_Search_Ad_Group_Id":"INTEGER", "Paid_Search_Campaign_Id":"INTEGER", "Full_Screen_Video_Completions":"INTEGER", "Dynamic_Element_Value":"STRING", "State_Region":"STRING", "Placement_End_Date":"STRING", "Paid_Search_Impressions":"INTEGER", "Cookie_Reach_Average_Impression_Frequency":"FLOAT", "Natural_Search_Engine_Country":"STRING", "Paid_Search_Revenue":"FLOAT" }
dcm__field__lookup = {'Video_Unmutes': 'INTEGER', 'Zip_Postal_Code': 'INTEGER', 'Path_Length': 'INTEGER', 'Billable_Impressions': 'FLOAT', 'Active_View_Of_Completed_Impressions_Audible_And_Visible': 'FLOAT', 'Measurable_Impressions_For_Audio': 'INTEGER', 'Average_Interaction_Time': 'FLOAT', 'Invalid_Impressions': 'FLOAT', 'Floodlight_Variable_40': 'STRING', 'Floodlight_Variable_41': 'STRING', 'Floodlight_Variable_42': 'STRING', 'Floodlight_Variable_43': 'STRING', 'Floodlight_Variable_44': 'STRING', 'Floodlight_Variable_45': 'STRING', 'Floodlight_Variable_46': 'STRING', 'Floodlight_Variable_47': 'STRING', 'Floodlight_Variable_48': 'STRING', 'Floodlight_Variable_49': 'STRING', 'Clicks': 'INTEGER', 'Active_View_In_Background': 'FLOAT', 'Active_View_Of_First_Quartile_Impressions_Audible_And_Visible': 'FLOAT', 'Paid_Search_Advertiser_Id': 'INTEGER', 'Video_Third_Quartile_Completions': 'INTEGER', 'Video_Progress_Events': 'INTEGER', 'Cost_Per_Revenue': 'FLOAT', 'Total_Interaction_Time': 'INTEGER', 'Roadblock_Impressions': 'INTEGER', 'Active_View_Of_Completed_Impressions_Visible': 'FLOAT', 'Video_Replays': 'INTEGER', 'Keyword': 'STRING', 'Full_Screen_Video_Plays': 'INTEGER', 'Active_View_Impression_Distribution_Not_Measurable': 'FLOAT', 'Unique_Reach_Total_Reach': 'INTEGER', 'Has_Exits': 'BOOLEAN', 'Paid_Search_Engine_Account': 'STRING', 'Operating_System_Version': 'STRING', 'Campaign': 'STRING', 'Active_View_Not_Viewable_Impressions': 'INTEGER', 'Twitter_Offers_Accepted': 'INTEGER', 'Interaction_Type': 'STRING', 'Activity_Delivery_Status': 'FLOAT', 'Video_Companion_Clicks': 'INTEGER', 'Floodlight_Paid_Search_Average_Cost_Per_Transaction': 'FLOAT', 'Paid_Search_Agency_Id': 'INTEGER', 'Asset': 'STRING', 'Active_View_Audible_Amp_Fully_On_Screen_For_Half_Of_Duration_15_Sec_Cap_Impressions': 'INTEGER', 'User_List_Current_Size': 'STRING', 'Exit_Url': 'STRING', 'Natural_Search_Revenue': 'FLOAT', 'Retweets': 'INTEGER', 'Full_Screen_Impressions': 'INTEGER', 'Audio_Unmutes': 'INTEGER', 'Dynamic_Element_4_Field_Value_2': 'STRING', 'Dynamic_Element_4_Field_Value_3': 'STRING', 'Dynamic_Element_4_Field_Value_1': 'STRING', 'Creative_Start_Date': 'STRING', 'Small_Video_Player_Size_Impressions': 'INTEGER', 'Audio_Replays': 'INTEGER', 'Video_Player_Size_Avg_Width': 'INTEGER', 'Rich_Media_Standard_Event_Count': 'INTEGER', 'Publisher_Problems': 'INTEGER', 'Paid_Search_Advertiser': 'STRING', 'Has_Video_Completions': 'BOOLEAN', 'Cookie_Reach_Duplicate_Impression_Reach': 'FLOAT', 'Audio_Third_Quartile_Completions': 'INTEGER', 'Package_Roadblock_Strategy': 'STRING', 'Video_Midpoints': 'INTEGER', 'Click_Through_Conversion_Events_Cross_Environment': 'INTEGER', 'Video_Pauses': 'INTEGER', 'Trueview_Views': 'INTEGER', 'Interaction_Count_Mobile_Static_Image': 'INTEGER', 'Dynamic_Element_Click_Rate': 'FLOAT', 'Active_View_Play_Time_Visible': 'FLOAT', 'Dynamic_Element_1_Field_6_Value': 'STRING', 'Dynamic_Element_4_Value': 'STRING', 'Creative_End_Date': 'STRING', 'Dynamic_Element_4_Field_3_Value': 'STRING', 'Dynamic_Field_Value_3': 'STRING', 'Mobile_Carrier': 'STRING', 'Warnings': 'INTEGER', 'U_Value': 'STRING', 'Average_Display_Time': 'FLOAT', 'Custom_Variable': 'STRING', 'Video_Interactions': 'INTEGER', 'Average_Expansion_Time': 'FLOAT', 'Email_Shares': 'INTEGER', 'Flight_Booked_Rate': 'STRING', 'Impression_Count': 'INTEGER', 'Site_Id_Dcm': 'INTEGER', 'Dynamic_Element_3_Value_Id': 'STRING', 'Paid_Search_Legacy_Keyword_Id': 'INTEGER', 'View_Through_Conversion_Events_Cross_Environment': 'INTEGER', 'Active_View_Visible_At_Midpoint': 'FLOAT', 'Counters': 'INTEGER', 'Floodlight_Paid_Search_Average_Cost_Per_Action': 'FLOAT', 'Activity_Group_Id': 'INTEGER', 'Active_View_Of_First_Quartile_Impressions_Visible': 'FLOAT', 'Click_Count': 'INTEGER', 'Video_4A_39_S_Ad_Id': 'STRING', 'Total_Interactions': 'INTEGER', 'Active_View_Viewable_Impressions': 'INTEGER', 'Natural_Search_Engine_Property': 'STRING', 'Video_Views': 'INTEGER', 'Active_View_Of_Third_Quartile_Impressions_Visible': 'FLOAT', 'Domain': 'STRING', 'Total_Conversion_Events_Cross_Environment': 'INTEGER', 'Dbm_Advertiser': 'STRING', 'Companion_Impressions': 'INTEGER', 'View_Through_Conversions_Cross_Environment': 'INTEGER', 'Dynamic_Element_5_Field_Value_3': 'STRING', 'Dynamic_Element_5_Field_Value_2': 'STRING', 'Dynamic_Element_5_Field_Value_1': 'STRING', 'Active_View_Visible_10_Seconds': 'FLOAT', 'Active_View_Impression_Distribution_Viewable': 'FLOAT', 'Creative_Field_2': 'STRING', 'Twitter_Leads_Generated': 'INTEGER', 'Paid_Search_External_Campaign_Id': 'INTEGER', 'Creative_Field_8': 'STRING', 'Interaction_Count_Paid_Search': 'INTEGER', 'Activity_Group': 'STRING', 'Video_Player_Location_Avg_Pixels_From_Top': 'INTEGER', 'Interaction_Number': 'INTEGER', 'Dynamic_Element_3_Value': 'STRING', 'Cookie_Reach_Total_Reach': 'INTEGER', 'Cookie_Reach_Exclusive_Click_Reach': 'FLOAT', 'Creative_Field_5': 'STRING', 'Cookie_Reach_Overlap_Impression_Reach': 'FLOAT', 'Paid_Search_Ad_Group': 'STRING', 'Interaction_Count_Rich_Media': 'INTEGER', 'Dynamic_Element_Total_Conversions': 'INTEGER', 'Transaction_Count': 'INTEGER', 'Num_Value': 'STRING', 'Cookie_Reach_Overlap_Total_Reach': 'FLOAT', 'Floodlight_Attribution_Type': 'STRING', 'Html5_Impressions': 'INTEGER', 'Served_Pixel_Density': 'STRING', 'Has_Full_Screen_Video_Plays': 'BOOLEAN', 'Interaction_Count_Static_Image': 'INTEGER', 'Has_Video_Companion_Clicks': 'BOOLEAN', 'Paid_Search_Ad': 'STRING', 'Paid_Search_Visits': 'INTEGER', 'Audio_Pauses': 'INTEGER', 'Creative_Pixel_Size': 'STRING', 'Flight_Start_Date': 'STRING', 'Natural_Search_Transactions': 'FLOAT', 'Cookie_Reach_Impression_Reach': 'INTEGER', 'Dynamic_Field_Value_4': 'STRING', 'Twitter_Line_Item_Id': 'INTEGER', 'Has_Video_Stops': 'BOOLEAN', 'Paid_Search_Labels': 'STRING', 'Twitter_Creative_Type': 'STRING', 'Operating_System': 'STRING', 'Dynamic_Element_3_Field_4_Value': 'STRING', 'Hours_Since_First_Interaction': 'INTEGER', 'Asset_Category': 'STRING', 'Active_View_Measurable_Impressions': 'FLOAT', 'Package_Roadblock': 'STRING', 'Large_Video_Player_Size_Impressions': 'INTEGER', 'Paid_Search_Actions': 'FLOAT', 'Has_Full_Screen_Views': 'BOOLEAN', 'Backup_Image': 'INTEGER', 'Likes': 'INTEGER', 'Serving_Problems': 'INTEGER', 'Audio_Midpoints': 'INTEGER', 'Flight_Booked_Cost': 'STRING', 'Other_Twitter_Engagements': 'INTEGER', 'Audio_Completions': 'INTEGER', 'Click_Rate': 'FLOAT', 'Cost_Per_Activity': 'FLOAT', 'Dynamic_Element_2_Value': 'STRING', 'Cookie_Reach_Exclusive_Impression_Reach': 'FLOAT', 'Content_Category': 'STRING', 'Total_Revenue_Cross_Environment': 'FLOAT', 'Unique_Reach_Click_Reach': 'INTEGER', 'Has_Video_Replays': 'BOOLEAN', 'Twitter_Creative_Id': 'INTEGER', 'Has_Counters': 'BOOLEAN', 'Dynamic_Element_4_Value_Id': 'STRING', 'Twitter_Video_50_In_View_For_2_Seconds': 'INTEGER', 'Dynamic_Element_4_Field_1_Value': 'STRING', 'Has_Video_Interactions': 'BOOLEAN', 'Video_Player_Size': 'STRING', 'Active_View_Audible_Amp_Fully_On_Screen_For_Half_Of_Duration_Trueview_Impressions': 'INTEGER', 'Advertiser_Id': 'INTEGER', 'Rich_Media_Clicks': 'INTEGER', 'Floodlight_Variable_59': 'STRING', 'Floodlight_Variable_58': 'STRING', 'Floodlight_Variable_57': 'STRING', 'Floodlight_Variable_56': 'STRING', 'Floodlight_Variable_55': 'STRING', 'Floodlight_Variable_54': 'STRING', 'Floodlight_Variable_53': 'STRING', 'Floodlight_Variable_52': 'STRING', 'Floodlight_Variable_51': 'STRING', 'Floodlight_Variable_50': 'STRING', 'Cookie_Reach_Incremental_Total_Reach': 'INTEGER', 'Playback_Method': 'STRING', 'Has_Interactive_Impressions': 'BOOLEAN', 'Paid_Search_Average_Position': 'FLOAT', 'Floodlight_Variable_96': 'STRING', 'Package_Roadblock_Id': 'INTEGER', 'Recalculated_Attribution_Type': 'STRING', 'Dbm_Advertiser_Id': 'INTEGER', 'Floodlight_Variable_100': 'STRING', 'Active_View_Impression_Distribution_Not_Viewable': 'FLOAT', 'Floodlight_Variable_3': 'STRING', 'Floodlight_Variable_2': 'STRING', 'Floodlight_Variable_1': 'STRING', 'Floodlight_Variable_7': 'STRING', 'Floodlight_Variable_6': 'STRING', 'Floodlight_Variable_5': 'STRING', 'Floodlight_Variable_4': 'STRING', 'Rendering_Id': 'INTEGER', 'Floodlight_Variable_9': 'STRING', 'Floodlight_Variable_8': 'STRING', 'Cookie_Reach_Incremental_Impression_Reach': 'INTEGER', 'Active_View_Play_Time_Audible_And_Visible': 'FLOAT', 'Reporting_Problems': 'INTEGER', 'Package_Roadblock_Total_Booked_Units': 'STRING', 'Has_Video_Midpoints': 'BOOLEAN', 'Dynamic_Element_4_Field_4_Value': 'STRING', 'Percentage_Of_Measurable_Impressions_For_Video_Player_Location': 'FLOAT', 'Campaign_End_Date': 'STRING', 'Placement_External_Id': 'STRING', 'Cost_Per_Click': 'FLOAT', 'Hour': 'STRING', 'Click_Through_Revenue': 'FLOAT', 'Video_Skips': 'INTEGER', 'Active_View_Of_Third_Quartile_Impressions_Audible_And_Visible': 'FLOAT', 'Paid_Search_Click_Rate': 'FLOAT', 'Has_Video_Views': 'BOOLEAN', 'Dbm_Cost_Account_Currency': 'FLOAT', 'Flight_End_Date': 'STRING', 'Has_Video_Plays': 'BOOLEAN', 'Paid_Search_Clicks': 'INTEGER', 'Creative_Field_9': 'STRING', 'Manual_Closes': 'INTEGER', 'Creative_Field_7': 'STRING', 'Creative_Field_6': 'STRING', 'App': 'STRING', 'Creative_Field_4': 'STRING', 'Creative_Field_3': 'STRING', 'Campaign_Start_Date': 'STRING', 'Creative_Field_1': 'STRING', 'Content_Classifier': 'STRING', 'Cookie_Reach_Duplicate_Click_Reach': 'FLOAT', 'Site_Dcm': 'STRING', 'Digital_Content_Label': 'STRING', 'Has_Manual_Closes': 'BOOLEAN', 'Has_Timers': 'BOOLEAN', 'Active_View_Audible_Impressions': 'FLOAT', 'Impressions': 'INTEGER', 'Classified_Impressions': 'INTEGER', 'Dbm_Site_Id': 'INTEGER', 'Dynamic_Element_2_Field_1_Value': 'STRING', 'Floodlight_Variable_72': 'STRING', 'Creative': 'STRING', 'Asset_Orientation': 'STRING', 'Custom_Variable_Count_1': 'INTEGER', 'Revenue_Adv_Currency': 'FLOAT', 'Video_Stops': 'INTEGER', 'Paid_Search_Ad_Id': 'INTEGER', 'Dbm_Line_Item': 'STRING', 'Click_Delivery_Status': 'FLOAT', 'Dynamic_Element_Impressions': 'INTEGER', 'Interaction_Count_Click_Tracker': 'INTEGER', 'Active_View_Audible_And_Visible_At_Midpoint': 'FLOAT', 'Placement_Total_Booked_Units': 'STRING', 'Date': 'STRING', 'Twitter_Placement_Type': 'STRING', 'Total_Revenue': 'FLOAT', 'Recalculated_Attributed_Interaction': 'STRING', 'Ad_Type': 'STRING', 'Social_Engagement_Rate': 'FLOAT', 'Dynamic_Element_5_Field_1_Value': 'STRING', 'Dynamic_Profile_Id': 'INTEGER', 'Active_View_Impressions_Visible_10_Seconds': 'INTEGER', 'Interaction_Count_Video': 'INTEGER', 'Dynamic_Element_5_Value': 'STRING', 'Active_View_Visible_At_Completion': 'FLOAT', 'Video_Player_Size_Avg_Height': 'INTEGER', 'Creative_Type': 'STRING', 'Campaign_External_Id': 'STRING', 'Dynamic_Element_Click_Through_Conversions': 'INTEGER', 'Conversion_Url': 'STRING', 'Floodlight_Variable_89': 'STRING', 'Floodlight_Variable_84': 'STRING', 'Floodlight_Variable_85': 'STRING', 'Floodlight_Variable_86': 'STRING', 'Floodlight_Variable_87': 'STRING', 'Floodlight_Variable_80': 'STRING', 'Floodlight_Variable_81': 'STRING', 'Floodlight_Variable_82': 'STRING', 'Floodlight_Variable_83': 'STRING', 'Active_View_Audible_Amp_Fully_On_Screen_For_Half_Of_Duration_Trueview_Measurable_Impressions': 'INTEGER', 'Floodlight_Variable_66': 'STRING', 'Floodlight_Variable_67': 'STRING', 'Floodlight_Variable_64': 'STRING', 'Floodlight_Variable_65': 'STRING', 'Floodlight_Variable_62': 'STRING', 'Floodlight_Variable_63': 'STRING', 'Floodlight_Variable_60': 'STRING', 'Active_View_Eligible_Impressions': 'INTEGER', 'Dynamic_Element_3_Field_Value_1': 'STRING', 'Dynamic_Element_3_Field_Value_3': 'STRING', 'Dynamic_Element_3_Field_Value_2': 'STRING', 'Active_View_Of_Midpoint_Impressions_Visible': 'FLOAT', 'Floodlight_Variable_68': 'STRING', 'Floodlight_Variable_69': 'STRING', 'Floodlight_Variable_13': 'STRING', 'Floodlight_Variable_12': 'STRING', 'Floodlight_Variable_11': 'STRING', 'Floodlight_Variable_10': 'STRING', 'Floodlight_Variable_17': 'STRING', 'Floodlight_Variable_16': 'STRING', 'Floodlight_Variable_15': 'STRING', 'Floodlight_Variable_14': 'STRING', 'Floodlight_Variable_19': 'STRING', 'Floodlight_Variable_18': 'STRING', 'Audience_Targeted': 'STRING', 'Total_Conversions_Cross_Environment': 'INTEGER', 'Twitter_Url_Clicks': 'INTEGER', 'Dynamic_Element_1_Field_1_Value': 'STRING', 'Active_View_Audible_Amp_Fully_On_Screen_For_Half_Of_Duration_Trueview_Rate': 'FLOAT', 'Active_View_Audible_And_Visible_At_First_Quartile': 'FLOAT', 'Has_Video_Skips': 'BOOLEAN', 'Dynamic_Element_5_Field_2_Value': 'STRING', 'Twitter_Buy_Now_Clicks': 'INTEGER', 'Creative_Groups_2': 'STRING', 'Creative_Groups_1': 'STRING', 'Campaign_Id': 'INTEGER', 'Twitter_Campaign_Id': 'INTEGER', 'Active_View_Audible_Amp_Fully_On_Screen_For_Half_Of_Duration_15_Sec_Cap_Rate': 'FLOAT', 'Dynamic_Element_1_Field_5_Value': 'STRING', 'Paid_Search_Match_Type': 'STRING', 'Activity_Per_Thousand_Impressions': 'FLOAT', 'Has_Expansions': 'BOOLEAN', 'Dbm_Creative_Id': 'INTEGER', 'Booked_Viewable_Impressions': 'FLOAT', 'Dynamic_Element_1_Field_2_Value': 'STRING', 'Paid_Search_Cost': 'FLOAT', 'Dynamic_Element_5_Field_5_Value': 'STRING', 'Floodlight_Paid_Search_Spend_Per_Transaction_Revenue': 'FLOAT', 'Dynamic_Element_4': 'STRING', 'Dynamic_Element_5': 'STRING', 'Dynamic_Element_2': 'STRING', 'Click_Through_Conversions': 'FLOAT', 'Dynamic_Element_1': 'STRING', 'Dynamic_Element_4_Field_6_Value': 'STRING', 'Attributed_Event_Platform_Type': 'STRING', 'Attributed_Event_Connection_Type': 'STRING', 'Dynamic_Element_1_Value': 'STRING', 'Measurable_Impressions_For_Video_Player_Location': 'INTEGER', 'Audio_Companion_Impressions': 'INTEGER', 'Video_Full_Screen': 'INTEGER', 'Companion_Creative': 'STRING', 'Cookie_Reach_Exclusive_Total_Reach': 'FLOAT', 'Audio_Mutes': 'INTEGER', 'Placement_Rate': 'STRING', 'Companion_Clicks': 'INTEGER', 'Cookie_Reach_Overlap_Click_Reach': 'FLOAT', 'Site_Keyname': 'STRING', 'Placement_Cost_Structure': 'STRING', 'Percentage_Of_Measurable_Impressions_For_Audio': 'FLOAT', 'Rich_Media_Custom_Event_Count': 'INTEGER', 'Dbm_Cost_Usd': 'FLOAT', 'Dynamic_Element_1_Field_3_Value': 'STRING', 'Paid_Search_Landing_Page_Url': 'STRING', 'Verifiable_Impressions': 'INTEGER', 'Average_Time': 'FLOAT', 'Creative_Field_12': 'STRING', 'Creative_Field_11': 'STRING', 'Creative_Field_10': 'STRING', 'Channel_Mix': 'STRING', 'Paid_Search_Campaign': 'STRING', 'Active_View_Audible_And_Visible_At_Start': 'FLOAT', 'Natural_Search_Landing_Page': 'STRING', 'Dynamic_Element_1_Field_4_Value': 'STRING', 'Payment_Source': 'STRING', 'Planned_Media_Cost': 'FLOAT', 'Conversion_Referrer': 'STRING', 'Companion_Creative_Id': 'INTEGER', 'Dynamic_Element_4_Field_2_Value': 'STRING', 'Total_Conversions': 'FLOAT', 'Custom_Variable_Count_2': 'INTEGER', 'Paid_Search_External_Ad_Group_Id': 'INTEGER', 'Hd_Video_Player_Size_Impressions': 'INTEGER', 'Click_Through_Transaction_Count': 'FLOAT', 'Floodlight_Attributed_Interaction': 'STRING', 'Dynamic_Profile': 'STRING', 'Floodlight_Variable_28': 'STRING', 'Floodlight_Variable_29': 'STRING', 'Dynamic_Element_2_Field_2_Value': 'STRING', 'Floodlight_Variable_22': 'STRING', 'Floodlight_Variable_23': 'STRING', 'Floodlight_Variable_20': 'STRING', 'Floodlight_Variable_21': 'STRING', 'Floodlight_Variable_26': 'STRING', 'Floodlight_Variable_27': 'STRING', 'Floodlight_Variable_24': 'STRING', 'Floodlight_Variable_25': 'STRING', 'Dynamic_Element_4_Field_5_Value': 'STRING', 'Creative_Id': 'STRING', 'View_Through_Conversions': 'FLOAT', 'Active_View_Full_Screen': 'FLOAT', 'Activity_Per_Click': 'FLOAT', 'Floodlight_Variable_88': 'STRING', 'Active_View_Audible_And_Visible_At_Third_Quartile': 'FLOAT', 'Placement': 'STRING', 'Dynamic_Element_2_Field_Value_1': 'STRING', 'Dynamic_Element_2_Field_Value_2': 'STRING', 'Dynamic_Element_2_Field_Value_3': 'STRING', 'Interaction_Count_Mobile_Video': 'INTEGER', 'Has_Full_Screen_Video_Completions': 'BOOLEAN', 'Placement_Total_Planned_Media_Cost': 'STRING', 'Video_First_Quartile_Completions': 'INTEGER', 'Twitter_Creative_Media_Id': 'INTEGER', 'Cookie_Reach_Duplicate_Total_Reach': 'FLOAT', 'Rich_Media_Impressions': 'INTEGER', 'Video_Completions': 'INTEGER', 'Month': 'STRING', 'Paid_Search_Keyword_Id': 'INTEGER', 'Replies': 'INTEGER', 'Dynamic_Element_5_Field_6_Value': 'STRING', 'Video_Mutes': 'INTEGER', 'Flight_Booked_Units': 'STRING', 'Dynamic_Element_Value_Id': 'STRING', 'Expansion_Time': 'INTEGER', 'Invalid_Clicks': 'FLOAT', 'Has_Video_Progress_Events': 'BOOLEAN', 'Dynamic_Element_2_Field_3_Value': 'STRING', 'Rich_Media_Standard_Event_Path_Summary': 'STRING', 'Video_Muted_At_Start': 'INTEGER', 'Audio_Companion_Clicks': 'INTEGER', 'Active_View_Audible_Amp_Fully_On_Screen_For_Half_Of_Duration_15_Sec_Cap_Measurable_Impressions': 'INTEGER', 'Interaction_Date_Time': 'STRING', 'User_List': 'STRING', 'Paid_Search_External_Keyword_Id': 'INTEGER', 'Timers': 'INTEGER', 'Floodlight_Paid_Search_Action_Conversion_Percentage': 'FLOAT', 'View_Through_Revenue_Cross_Environment': 'FLOAT', 'Advertiser': 'STRING', 'Has_Video_Unmutes': 'BOOLEAN', 'Natural_Search_Query': 'STRING', 'Audio_Plays': 'INTEGER', 'Unique_Reach_Average_Impression_Frequency': 'FLOAT', 'Path_Type': 'STRING', 'Dynamic_Field_Value_2': 'STRING', 'Interaction_Channel': 'STRING', 'Blocked_Impressions': 'INTEGER', 'Dynamic_Field_Value_5': 'STRING', 'Dynamic_Field_Value_6': 'STRING', 'Placement_Compatibility': 'STRING', 'City': 'STRING', 'Dbm_Line_Item_Id': 'INTEGER', 'Cookie_Reach_Incremental_Click_Reach': 'INTEGER', 'Floodlight_Variable_61': 'STRING', 'Natural_Search_Processed_Landing_Page_Query_String': 'STRING', 'Report_Day': 'INTEGER', 'Dbm_Site': 'STRING', 'Connection_Type': 'STRING', 'Video_Average_View_Time': 'FLOAT', 'Click_Through_Revenue_Cross_Environment': 'FLOAT', 'Dbm_Creative': 'STRING', 'Attributed_Event_Environment': 'STRING', 'Floodlight_Variable_99': 'STRING', 'Floodlight_Variable_98': 'STRING', 'Measurable_Impressions_For_Video_Player_Size': 'INTEGER', 'Dynamic_Element_1_Value_Id': 'STRING', 'Paid_Search_Engine_Account_Id': 'INTEGER', 'Floodlight_Variable_93': 'STRING', 'Floodlight_Variable_92': 'STRING', 'Floodlight_Variable_91': 'STRING', 'Floodlight_Variable_90': 'STRING', 'Floodlight_Variable_97': 'STRING', 'Placement_Strategy': 'STRING', 'Floodlight_Variable_95': 'STRING', 'Floodlight_Variable_94': 'STRING', 'Floodlight_Variable_75': 'STRING', 'Floodlight_Variable_74': 'STRING', 'Floodlight_Variable_77': 'STRING', 'Floodlight_Variable_76': 'STRING', 'Floodlight_Variable_71': 'STRING', 'Floodlight_Variable_70': 'STRING', 'Floodlight_Variable_73': 'STRING', 'Activity': 'STRING', 'Natural_Search_Engine_Url': 'STRING', 'Total_Display_Time': 'INTEGER', 'User_List_Description': 'STRING', 'Active_View_Impressions_Audible_And_Visible_At_Completion': 'INTEGER', 'Floodlight_Variable_79': 'STRING', 'Floodlight_Variable_78': 'STRING', 'Twitter_Impression_Type': 'STRING', 'Active_View_Average_Viewable_Time_Seconds': 'FLOAT', 'Active_View_Visible_At_Start': 'FLOAT', 'Natural_Search_Landing_Page_Query_String': 'STRING', 'Percentage_Of_Measurable_Impressions_For_Video_Player_Size': 'FLOAT', 'Has_Full_Screen_Impressions': 'BOOLEAN', 'Conversion_Id': 'INTEGER', 'Creative_Version': 'STRING', 'Dynamic_Element_2_Value_Id': 'STRING', 'Active_View_Audible_And_Visible_At_Completion': 'FLOAT', 'Hours_Since_Attributed_Interaction': 'INTEGER', 'Dynamic_Element_3_Field_5_Value': 'STRING', 'Has_Video_First_Quartile_Completions': 'BOOLEAN', 'Dynamic_Element': 'STRING', 'Booked_Clicks': 'FLOAT', 'Booked_Impressions': 'FLOAT', 'Tran_Value': 'STRING', 'Dynamic_Element_Clicks': 'INTEGER', 'Has_Dynamic_Impressions': 'BOOLEAN', 'Site_Id_Site_Directory': 'INTEGER', 'Event_Timers': 'FLOAT', 'Twitter_Video_100_In_View_For_3_Seconds': 'INTEGER', 'Dynamic_Element_2_Field_6_Value': 'STRING', 'Has_Backup_Image': 'BOOLEAN', 'Dynamic_Element_2_Field_5_Value': 'STRING', 'Rich_Media_Custom_Event_Path_Summary': 'STRING', 'Advertiser_Group': 'STRING', 'General_Invalid_Traffic_Givt_Clicks': 'INTEGER', 'Follows': 'INTEGER', 'Has_Html5_Impressions': 'BOOLEAN', 'Active_View_Of_Midpoint_Impressions_Audible_And_Visible': 'FLOAT', 'Activity_Date_Time': 'STRING', 'Site_Site_Directory': 'STRING', 'Placement_Pixel_Size': 'STRING', 'Within_Floodlight_Lookback_Window': 'STRING', 'Dbm_Partner': 'STRING', 'Dynamic_Element_3_Field_3_Value': 'STRING', 'Ord_Value': 'STRING', 'Floodlight_Configuration': 'INTEGER', 'Ad_Id': 'INTEGER', 'Dynamic_Field_Value_1': 'STRING', 'Video_Plays': 'INTEGER', 'Days_Since_First_Interaction': 'INTEGER', 'Event_Counters': 'INTEGER', 'Active_View_Not_Measurable_Impressions': 'INTEGER', 'Landing_Page_Url': 'STRING', 'Ad_Status': 'STRING', 'Unique_Reach_Impression_Reach': 'INTEGER', 'Dynamic_Element_2_Field_4_Value': 'STRING', 'Dbm_Partner_Id': 'INTEGER', 'Asset_Id': 'INTEGER', 'Video_View_Rate': 'FLOAT', 'Active_View_Visible_At_Third_Quartile': 'FLOAT', 'Twitter_App_Install_Clicks': 'INTEGER', 'Total_Social_Engagements': 'INTEGER', 'Media_Cost': 'FLOAT', 'Placement_Tag_Type': 'STRING', 'Dbm_Insertion_Order': 'STRING', 'Floodlight_Variable_39': 'STRING', 'Floodlight_Variable_38': 'STRING', 'Paid_Search_External_Ad_Id': 'INTEGER', 'Browser_Platform': 'STRING', 'Floodlight_Variable_31': 'STRING', 'Floodlight_Variable_30': 'STRING', 'Floodlight_Variable_33': 'STRING', 'Floodlight_Variable_32': 'STRING', 'Floodlight_Variable_35': 'STRING', 'Floodlight_Variable_34': 'STRING', 'Floodlight_Variable_37': 'STRING', 'Floodlight_Variable_36': 'STRING', 'Dynamic_Element_View_Through_Conversions': 'INTEGER', 'Active_View_Viewable_Impression_Cookie_Reach': 'INTEGER', 'Video_Interaction_Rate': 'FLOAT', 'Active_View_Visible_At_First_Quartile': 'FLOAT', 'Dynamic_Element_3_Field_1_Value': 'STRING', 'Booked_Activities': 'FLOAT', 'Has_Video_Full_Screen': 'BOOLEAN', 'User_List_Membership_Life_Span': 'STRING', 'Video_Length': 'STRING', 'Paid_Search_Keyword': 'STRING', 'Revenue_Per_Click': 'FLOAT', 'Downloaded_Impressions': 'INTEGER', 'Days_Since_Attributed_Interaction': 'INTEGER', 'Code_Serves': 'INTEGER', 'Effective_Cpm': 'FLOAT', 'Environment': 'STRING', 'Paid_Search_Agency': 'STRING', 'Dynamic_Element_5_Field_3_Value': 'STRING', 'Paid_Search_Engine_Account_Category': 'STRING', 'Week': 'STRING', 'Designated_Market_Area_Dma': 'STRING', 'Cookie_Reach_Click_Reach': 'INTEGER', 'Twitter_Buy_Now_Purchases': 'INTEGER', 'Floodlight_Paid_Search_Average_Dcm_Transaction_Amount': 'FLOAT', 'Placement_Start_Date': 'STRING', 'View_Through_Revenue': 'FLOAT', 'Impression_Delivery_Status': 'FLOAT', 'Floodlight_Paid_Search_Transaction_Conversion_Percentage': 'FLOAT', 'Click_Through_Conversions_Cross_Environment': 'INTEGER', 'Activity_Id': 'INTEGER', 'Has_Video_Mutes': 'BOOLEAN', 'Exits': 'INTEGER', 'Paid_Search_Bid_Strategy': 'STRING', 'Interaction_Count_Mobile_Rich_Media': 'INTEGER', 'Dbm_Insertion_Order_Id': 'INTEGER', 'Placement_Id': 'INTEGER', 'App_Id': 'STRING', 'View_Through_Transaction_Count': 'FLOAT', 'Floodlight_Paid_Search_Transaction_Revenue_Per_Spend': 'FLOAT', 'Active_View_Play_Time_Audible': 'FLOAT', 'Dynamic_Element_5_Field_4_Value': 'STRING', 'Companion_Creative_Pixel_Size': 'STRING', 'Revenue_Per_Thousand_Impressions': 'FLOAT', 'Natural_Search_Clicks': 'INTEGER', 'Dynamic_Element_3_Field_2_Value': 'STRING', 'Audio_First_Quartile_Completions': 'INTEGER', 'Dynamic_Element_1_Field_Value_3': 'STRING', 'Dynamic_Element_1_Field_Value_2': 'STRING', 'Dynamic_Element_1_Field_Value_1': 'STRING', 'Full_Screen_Average_View_Time': 'FLOAT', 'Dynamic_Element_5_Value_Id': 'STRING', 'Rich_Media_Click_Rate': 'FLOAT', 'User_List_Id': 'INTEGER', 'Click_Through_Url': 'STRING', 'Has_Video_Pauses': 'BOOLEAN', 'Video_Prominence_Score': 'STRING', 'Has_Video_Third_Quartile_Completions': 'BOOLEAN', 'Natural_Search_Actions': 'FLOAT', 'Platform_Type': 'STRING', 'General_Invalid_Traffic_Givt_Impressions': 'INTEGER', 'Dynamic_Element_3': 'STRING', 'Video_Player_Location_Avg_Pixels_From_Left': 'INTEGER', 'Paid_Search_Transactions': 'FLOAT', 'Rich_Media_Event': 'STRING', 'Country': 'STRING', 'Dynamic_Element_3_Field_6_Value': 'STRING', 'Expansions': 'INTEGER', 'Interaction_Rate': 'FLOAT', 'Natural_Search_Processed_Landing_Page': 'STRING', 'Floodlight_Impressions': 'INTEGER', 'Paid_Search_Bid_Strategy_Id': 'INTEGER', 'Interactive_Impressions': 'INTEGER', 'Interaction_Count_Natural_Search': 'INTEGER', 'Twitter_Impression_Id': 'INTEGER', 'Ad': 'STRING', 'Paid_Search_Ad_Group_Id': 'INTEGER', 'Paid_Search_Campaign_Id': 'INTEGER', 'Full_Screen_Video_Completions': 'INTEGER', 'Dynamic_Element_Value': 'STRING', 'State_Region': 'STRING', 'Placement_End_Date': 'STRING', 'Paid_Search_Impressions': 'INTEGER', 'Cookie_Reach_Average_Impression_Frequency': 'FLOAT', 'Natural_Search_Engine_Country': 'STRING', 'Paid_Search_Revenue': 'FLOAT'}
# Problem 1: Two Sum class Solution(object): def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ # Given an array of integers, return indices of the two numbers such that they add up to a specific target. # You may assume that each input would have exactly one solution, and you may not use the same element twice. # total = 0 # for key, value in nums # total = total + value # for key1, value1 in nums # if key != key1 # total = total + value1 # if total == target # return [key, key1] total = 0 for x in range(0, len(nums)): total = 0 for y in range(0, len(nums)): if x != y: total = nums[x] + nums[y] if total == target: return [x, y] # Problem 2: Implement a Queue Using Stacks class MyQueue(object): # Implement the following operations of a queue (FIFO) using stacks (LIFO). # Depending on your language, stack may not be supported natively. You may simulate a stack by using a list or deque(double-ended queue), as long as you use only standard operations of a stack. # You may assume that all operations are valid (for example, no pop or peek operations will be called on an empty queue). # You must use only standard operations of a stack -- which means only: # peek from top # pop from top # push to bottom # size # is empty def __init__(self): """ Initialize your data structure here. """ self.stack1 = [] self.stack2 = [] def push(self, x): """ Push element x to the back of queue. :type x: int :rtype: None """ # while self.stack1 not empty, append its last element to stack2 while self.stack1: popped1 = self.stack1.pop() self.stack2.append(popped1) # then append x to stack1, which is empty self.stack1.append(x) # then put all the other elements, now on stack2, back on stack1 while self.stack2: popped2 = self.stack2.pop() self.stack1.append(popped2) def pop(self): """ Removes the element from in front of queue and returns that element. :rtype: int """ # remove last element of stack, which is front element of queue, and return it popped = self.stack1.pop() return popped def peek(self): """ Get the front element. :rtype: int """ # return last element of stack, which is front element of queue (no removal) front_element = self.stack1[-1] return front_element def empty(self): """ Returns whether the queue is empty. :rtype: bool """ # if both stacks are empty, return true; else return false if not self.stack1 and not self.stack2: is_empty = True else: is_empty = False return is_empty # Your MyQueue object will be instantiated and called as such: # obj = MyQueue() # obj.push(x) # param_2 = obj.pop() # param_3 = obj.peek() # param_4 = obj.empty()
class Solution(object): def two_sum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ total = 0 for x in range(0, len(nums)): total = 0 for y in range(0, len(nums)): if x != y: total = nums[x] + nums[y] if total == target: return [x, y] class Myqueue(object): def __init__(self): """ Initialize your data structure here. """ self.stack1 = [] self.stack2 = [] def push(self, x): """ Push element x to the back of queue. :type x: int :rtype: None """ while self.stack1: popped1 = self.stack1.pop() self.stack2.append(popped1) self.stack1.append(x) while self.stack2: popped2 = self.stack2.pop() self.stack1.append(popped2) def pop(self): """ Removes the element from in front of queue and returns that element. :rtype: int """ popped = self.stack1.pop() return popped def peek(self): """ Get the front element. :rtype: int """ front_element = self.stack1[-1] return front_element def empty(self): """ Returns whether the queue is empty. :rtype: bool """ if not self.stack1 and (not self.stack2): is_empty = True else: is_empty = False return is_empty
a = 1.123456 b = 10 c = -30 d = 34 e = 123.456 f = 19892122 # form 0 s = "b=%i" % b print(s) # form 1 s = "b,c,d=%i+%i+%i" % (b,c,d) print(s) # form 2 s = "b=%(b)i and c=%(c)i and d=%(d)i" % { 'b':b,'c':c,'d':d } print(s) # width,flags s = "e=%020i e=%+i e=%20i e=%-20i (e=%- 20i)" % (e,e,e,e,e) print(s)
a = 1.123456 b = 10 c = -30 d = 34 e = 123.456 f = 19892122 s = 'b=%i' % b print(s) s = 'b,c,d=%i+%i+%i' % (b, c, d) print(s) s = 'b=%(b)i and c=%(c)i and d=%(d)i' % {'b': b, 'c': c, 'd': d} print(s) s = 'e=%020i e=%+i e=%20i e=%-20i (e=%- 20i)' % (e, e, e, e, e) print(s)
registry = [] def register(cls, bench_type=None, bench_params=None): registry.append((cls, bench_type, bench_params)) return cls
registry = [] def register(cls, bench_type=None, bench_params=None): registry.append((cls, bench_type, bench_params)) return cls
__author__ = "Bilal El Uneis and Jieshu Wang" __since__ = "Nov 2018" __email__ = "bilaleluneis@gmail.com" """ Meta Classes are the blue print for classes just like classes are blue print for types instantiated from them. they allow to set class capabilities. bellow is example: Meta Class To prevent inheritance of Class when used. """ class CantInheritFrom(type): def __new__(mcs, name, bases, attr): type_list: [] = [type(x) for x in bases] for _type in type_list: if _type is CantInheritFrom: raise RuntimeError("You cannot subclass a Final class") return super(CantInheritFrom, mcs).__new__(mcs, name, bases, attr) """ Actual Classes that will use Meta Classes to adjust class capabilities """ class FinalClass(metaclass=CantInheritFrom): def __init__(self): print("__init__ FinalClass") # uncomment class bellow to see error # class A(FinalClass): # def __init__(self): # super().__init__() # print("__init__ A") def main(): FinalClass() # A() # start of running code if __name__ == "__main__": main()
__author__ = 'Bilal El Uneis and Jieshu Wang' __since__ = 'Nov 2018' __email__ = 'bilaleluneis@gmail.com' '\nMeta Classes are the blue print for classes just like classes are blue print for types instantiated from them.\nthey allow to set class capabilities.\nbellow is example:\nMeta Class To prevent inheritance of Class when used.\n' class Cantinheritfrom(type): def __new__(mcs, name, bases, attr): type_list: [] = [type(x) for x in bases] for _type in type_list: if _type is CantInheritFrom: raise runtime_error('You cannot subclass a Final class') return super(CantInheritFrom, mcs).__new__(mcs, name, bases, attr) '\nActual Classes that will use Meta Classes to adjust class capabilities\n' class Finalclass(metaclass=CantInheritFrom): def __init__(self): print('__init__ FinalClass') def main(): final_class() if __name__ == '__main__': main()
# # PySNMP MIB module ASCEND-MIBUDS3NET-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASCEND-MIBUDS3NET-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:12:47 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) # configuration, = mibBuilder.importSymbols("ASCEND-MIB", "configuration") ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint", "ConstraintsIntersection", "SingleValueConstraint") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") Counter32, TimeTicks, IpAddress, ModuleIdentity, Bits, Integer32, Unsigned32, Counter64, ObjectIdentity, NotificationType, Gauge32, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, iso = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "TimeTicks", "IpAddress", "ModuleIdentity", "Bits", "Integer32", "Unsigned32", "Counter64", "ObjectIdentity", "NotificationType", "Gauge32", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") class DisplayString(OctetString): pass mibuds3NetworkProfile = MibIdentifier((1, 3, 6, 1, 4, 1, 529, 23, 5)) mibuds3NetworkProfileTable = MibTable((1, 3, 6, 1, 4, 1, 529, 23, 5, 1), ) if mibBuilder.loadTexts: mibuds3NetworkProfileTable.setStatus('mandatory') mibuds3NetworkProfileEntry = MibTableRow((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1), ).setIndexNames((0, "ASCEND-MIBUDS3NET-MIB", "uds3NetworkProfile-Shelf-o"), (0, "ASCEND-MIBUDS3NET-MIB", "uds3NetworkProfile-Slot-o"), (0, "ASCEND-MIBUDS3NET-MIB", "uds3NetworkProfile-Item-o")) if mibBuilder.loadTexts: mibuds3NetworkProfileEntry.setStatus('mandatory') uds3NetworkProfile_Shelf_o = MibScalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 1), Integer32()).setLabel("uds3NetworkProfile-Shelf-o").setMaxAccess("readonly") if mibBuilder.loadTexts: uds3NetworkProfile_Shelf_o.setStatus('mandatory') uds3NetworkProfile_Slot_o = MibScalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 2), Integer32()).setLabel("uds3NetworkProfile-Slot-o").setMaxAccess("readonly") if mibBuilder.loadTexts: uds3NetworkProfile_Slot_o.setStatus('mandatory') uds3NetworkProfile_Item_o = MibScalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 3), Integer32()).setLabel("uds3NetworkProfile-Item-o").setMaxAccess("readonly") if mibBuilder.loadTexts: uds3NetworkProfile_Item_o.setStatus('mandatory') uds3NetworkProfile_Name = MibScalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 4), DisplayString()).setLabel("uds3NetworkProfile-Name").setMaxAccess("readwrite") if mibBuilder.loadTexts: uds3NetworkProfile_Name.setStatus('mandatory') uds3NetworkProfile_PhysicalAddress_Shelf = MibScalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))).clone(namedValues=NamedValues(("anyShelf", 1), ("shelf1", 2), ("shelf2", 3), ("shelf3", 4), ("shelf4", 5), ("shelf5", 6), ("shelf6", 7), ("shelf7", 8), ("shelf8", 9), ("shelf9", 10)))).setLabel("uds3NetworkProfile-PhysicalAddress-Shelf").setMaxAccess("readwrite") if mibBuilder.loadTexts: uds3NetworkProfile_PhysicalAddress_Shelf.setStatus('mandatory') uds3NetworkProfile_PhysicalAddress_Slot = MibScalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 55, 56, 57, 58, 49, 50, 42, 53, 54, 45, 46, 51, 59))).clone(namedValues=NamedValues(("anySlot", 1), ("slot1", 2), ("slot2", 3), ("slot3", 4), ("slot4", 5), ("slot5", 6), ("slot6", 7), ("slot7", 8), ("slot8", 9), ("slot9", 10), ("slot10", 11), ("slot11", 12), ("slot12", 13), ("slot13", 14), ("slot14", 15), ("slot15", 16), ("slot16", 17), ("slot17", 18), ("slot18", 19), ("slot19", 20), ("slot20", 21), ("slot21", 22), ("slot22", 23), ("slot23", 24), ("slot24", 25), ("slot25", 26), ("slot26", 27), ("slot27", 28), ("slot28", 29), ("slot29", 30), ("slot30", 31), ("slot31", 32), ("slot32", 33), ("slot33", 34), ("slot34", 35), ("slot35", 36), ("slot36", 37), ("slot37", 38), ("slot38", 39), ("slot39", 40), ("slot40", 41), ("aLim", 55), ("bLim", 56), ("cLim", 57), ("dLim", 58), ("leftController", 49), ("rightController", 50), ("controller", 42), ("firstControlModule", 53), ("secondControlModule", 54), ("trunkModule1", 45), ("trunkModule2", 46), ("controlModule", 51), ("slotPrimary", 59)))).setLabel("uds3NetworkProfile-PhysicalAddress-Slot").setMaxAccess("readwrite") if mibBuilder.loadTexts: uds3NetworkProfile_PhysicalAddress_Slot.setStatus('mandatory') uds3NetworkProfile_PhysicalAddress_ItemNumber = MibScalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 7), Integer32()).setLabel("uds3NetworkProfile-PhysicalAddress-ItemNumber").setMaxAccess("readwrite") if mibBuilder.loadTexts: uds3NetworkProfile_PhysicalAddress_ItemNumber.setStatus('mandatory') uds3NetworkProfile_Enabled = MibScalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setLabel("uds3NetworkProfile-Enabled").setMaxAccess("readwrite") if mibBuilder.loadTexts: uds3NetworkProfile_Enabled.setStatus('mandatory') uds3NetworkProfile_ProfileNumber = MibScalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 9), Integer32()).setLabel("uds3NetworkProfile-ProfileNumber").setMaxAccess("readwrite") if mibBuilder.loadTexts: uds3NetworkProfile_ProfileNumber.setStatus('mandatory') uds3NetworkProfile_LineConfig_TrunkGroup = MibScalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 10), Integer32()).setLabel("uds3NetworkProfile-LineConfig-TrunkGroup").setMaxAccess("readwrite") if mibBuilder.loadTexts: uds3NetworkProfile_LineConfig_TrunkGroup.setStatus('mandatory') uds3NetworkProfile_LineConfig_NailedGroup = MibScalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 11), Integer32()).setLabel("uds3NetworkProfile-LineConfig-NailedGroup").setMaxAccess("readwrite") if mibBuilder.loadTexts: uds3NetworkProfile_LineConfig_NailedGroup.setStatus('mandatory') uds3NetworkProfile_LineConfig_RoutePort_SlotNumber_SlotNumber = MibScalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 12), Integer32()).setLabel("uds3NetworkProfile-LineConfig-RoutePort-SlotNumber-SlotNumber").setMaxAccess("readwrite") if mibBuilder.loadTexts: uds3NetworkProfile_LineConfig_RoutePort_SlotNumber_SlotNumber.setStatus('mandatory') uds3NetworkProfile_LineConfig_RoutePort_SlotNumber_ShelfNumber = MibScalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 13), Integer32()).setLabel("uds3NetworkProfile-LineConfig-RoutePort-SlotNumber-ShelfNumber").setMaxAccess("readwrite") if mibBuilder.loadTexts: uds3NetworkProfile_LineConfig_RoutePort_SlotNumber_ShelfNumber.setStatus('mandatory') uds3NetworkProfile_LineConfig_RoutePort_RelativePortNumber_RelativePortNumber = MibScalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 14), Integer32()).setLabel("uds3NetworkProfile-LineConfig-RoutePort-RelativePortNumber-RelativePortNumber").setMaxAccess("readwrite") if mibBuilder.loadTexts: uds3NetworkProfile_LineConfig_RoutePort_RelativePortNumber_RelativePortNumber.setStatus('mandatory') uds3NetworkProfile_LineConfig_Activation = MibScalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("static", 1), ("dsrActive", 2), ("dcdDsrActive", 3)))).setLabel("uds3NetworkProfile-LineConfig-Activation").setMaxAccess("readwrite") if mibBuilder.loadTexts: uds3NetworkProfile_LineConfig_Activation.setStatus('mandatory') uds3NetworkProfile_LineConfig_LineType = MibScalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 19), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1))).clone(namedValues=NamedValues(("cBitParity", 1)))).setLabel("uds3NetworkProfile-LineConfig-LineType").setMaxAccess("readwrite") if mibBuilder.loadTexts: uds3NetworkProfile_LineConfig_LineType.setStatus('mandatory') uds3NetworkProfile_LineConfig_LineCoding = MibScalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1))).clone(namedValues=NamedValues(("b3zs", 1)))).setLabel("uds3NetworkProfile-LineConfig-LineCoding").setMaxAccess("readwrite") if mibBuilder.loadTexts: uds3NetworkProfile_LineConfig_LineCoding.setStatus('mandatory') uds3NetworkProfile_LineConfig_Loopback = MibScalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 21), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("noLoopback", 1), ("facilityLoopback", 2), ("localLoopback", 3)))).setLabel("uds3NetworkProfile-LineConfig-Loopback").setMaxAccess("readwrite") if mibBuilder.loadTexts: uds3NetworkProfile_LineConfig_Loopback.setStatus('mandatory') uds3NetworkProfile_LineConfig_ClockSource = MibScalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 23), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("eligible", 1), ("notEligible", 2)))).setLabel("uds3NetworkProfile-LineConfig-ClockSource").setMaxAccess("readwrite") if mibBuilder.loadTexts: uds3NetworkProfile_LineConfig_ClockSource.setStatus('mandatory') uds3NetworkProfile_LineConfig_ClockPriority = MibScalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 24), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 3, 4))).clone(namedValues=NamedValues(("highPriority", 2), ("middlePriority", 3), ("lowPriority", 4)))).setLabel("uds3NetworkProfile-LineConfig-ClockPriority").setMaxAccess("readwrite") if mibBuilder.loadTexts: uds3NetworkProfile_LineConfig_ClockPriority.setStatus('mandatory') uds3NetworkProfile_LineConfig_StatusChangeTrapEnable = MibScalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 25), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setLabel("uds3NetworkProfile-LineConfig-StatusChangeTrapEnable").setMaxAccess("readwrite") if mibBuilder.loadTexts: uds3NetworkProfile_LineConfig_StatusChangeTrapEnable.setStatus('mandatory') uds3NetworkProfile_Action_o = MibScalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 22), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("noAction", 1), ("createProfile", 2), ("deleteProfile", 3)))).setLabel("uds3NetworkProfile-Action-o").setMaxAccess("readwrite") if mibBuilder.loadTexts: uds3NetworkProfile_Action_o.setStatus('mandatory') mibBuilder.exportSymbols("ASCEND-MIBUDS3NET-MIB", uds3NetworkProfile_LineConfig_TrunkGroup=uds3NetworkProfile_LineConfig_TrunkGroup, uds3NetworkProfile_LineConfig_RoutePort_RelativePortNumber_RelativePortNumber=uds3NetworkProfile_LineConfig_RoutePort_RelativePortNumber_RelativePortNumber, uds3NetworkProfile_LineConfig_LineCoding=uds3NetworkProfile_LineConfig_LineCoding, uds3NetworkProfile_Shelf_o=uds3NetworkProfile_Shelf_o, uds3NetworkProfile_Action_o=uds3NetworkProfile_Action_o, uds3NetworkProfile_ProfileNumber=uds3NetworkProfile_ProfileNumber, mibuds3NetworkProfileTable=mibuds3NetworkProfileTable, uds3NetworkProfile_LineConfig_RoutePort_SlotNumber_ShelfNumber=uds3NetworkProfile_LineConfig_RoutePort_SlotNumber_ShelfNumber, uds3NetworkProfile_LineConfig_ClockSource=uds3NetworkProfile_LineConfig_ClockSource, uds3NetworkProfile_Name=uds3NetworkProfile_Name, uds3NetworkProfile_LineConfig_RoutePort_SlotNumber_SlotNumber=uds3NetworkProfile_LineConfig_RoutePort_SlotNumber_SlotNumber, uds3NetworkProfile_Slot_o=uds3NetworkProfile_Slot_o, uds3NetworkProfile_PhysicalAddress_ItemNumber=uds3NetworkProfile_PhysicalAddress_ItemNumber, uds3NetworkProfile_LineConfig_NailedGroup=uds3NetworkProfile_LineConfig_NailedGroup, uds3NetworkProfile_LineConfig_Activation=uds3NetworkProfile_LineConfig_Activation, mibuds3NetworkProfileEntry=mibuds3NetworkProfileEntry, uds3NetworkProfile_Item_o=uds3NetworkProfile_Item_o, mibuds3NetworkProfile=mibuds3NetworkProfile, uds3NetworkProfile_PhysicalAddress_Shelf=uds3NetworkProfile_PhysicalAddress_Shelf, uds3NetworkProfile_LineConfig_ClockPriority=uds3NetworkProfile_LineConfig_ClockPriority, DisplayString=DisplayString, uds3NetworkProfile_LineConfig_StatusChangeTrapEnable=uds3NetworkProfile_LineConfig_StatusChangeTrapEnable, uds3NetworkProfile_LineConfig_LineType=uds3NetworkProfile_LineConfig_LineType, uds3NetworkProfile_LineConfig_Loopback=uds3NetworkProfile_LineConfig_Loopback, uds3NetworkProfile_Enabled=uds3NetworkProfile_Enabled, uds3NetworkProfile_PhysicalAddress_Slot=uds3NetworkProfile_PhysicalAddress_Slot)
(configuration,) = mibBuilder.importSymbols('ASCEND-MIB', 'configuration') (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, value_size_constraint, constraints_intersection, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ConstraintsUnion', 'ValueSizeConstraint', 'ConstraintsIntersection', 'SingleValueConstraint') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (counter32, time_ticks, ip_address, module_identity, bits, integer32, unsigned32, counter64, object_identity, notification_type, gauge32, mib_identifier, mib_scalar, mib_table, mib_table_row, mib_table_column, iso) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter32', 'TimeTicks', 'IpAddress', 'ModuleIdentity', 'Bits', 'Integer32', 'Unsigned32', 'Counter64', 'ObjectIdentity', 'NotificationType', 'Gauge32', 'MibIdentifier', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'iso') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') class Displaystring(OctetString): pass mibuds3_network_profile = mib_identifier((1, 3, 6, 1, 4, 1, 529, 23, 5)) mibuds3_network_profile_table = mib_table((1, 3, 6, 1, 4, 1, 529, 23, 5, 1)) if mibBuilder.loadTexts: mibuds3NetworkProfileTable.setStatus('mandatory') mibuds3_network_profile_entry = mib_table_row((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1)).setIndexNames((0, 'ASCEND-MIBUDS3NET-MIB', 'uds3NetworkProfile-Shelf-o'), (0, 'ASCEND-MIBUDS3NET-MIB', 'uds3NetworkProfile-Slot-o'), (0, 'ASCEND-MIBUDS3NET-MIB', 'uds3NetworkProfile-Item-o')) if mibBuilder.loadTexts: mibuds3NetworkProfileEntry.setStatus('mandatory') uds3_network_profile__shelf_o = mib_scalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 1), integer32()).setLabel('uds3NetworkProfile-Shelf-o').setMaxAccess('readonly') if mibBuilder.loadTexts: uds3NetworkProfile_Shelf_o.setStatus('mandatory') uds3_network_profile__slot_o = mib_scalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 2), integer32()).setLabel('uds3NetworkProfile-Slot-o').setMaxAccess('readonly') if mibBuilder.loadTexts: uds3NetworkProfile_Slot_o.setStatus('mandatory') uds3_network_profile__item_o = mib_scalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 3), integer32()).setLabel('uds3NetworkProfile-Item-o').setMaxAccess('readonly') if mibBuilder.loadTexts: uds3NetworkProfile_Item_o.setStatus('mandatory') uds3_network_profile__name = mib_scalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 4), display_string()).setLabel('uds3NetworkProfile-Name').setMaxAccess('readwrite') if mibBuilder.loadTexts: uds3NetworkProfile_Name.setStatus('mandatory') uds3_network_profile__physical_address__shelf = mib_scalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))).clone(namedValues=named_values(('anyShelf', 1), ('shelf1', 2), ('shelf2', 3), ('shelf3', 4), ('shelf4', 5), ('shelf5', 6), ('shelf6', 7), ('shelf7', 8), ('shelf8', 9), ('shelf9', 10)))).setLabel('uds3NetworkProfile-PhysicalAddress-Shelf').setMaxAccess('readwrite') if mibBuilder.loadTexts: uds3NetworkProfile_PhysicalAddress_Shelf.setStatus('mandatory') uds3_network_profile__physical_address__slot = mib_scalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 55, 56, 57, 58, 49, 50, 42, 53, 54, 45, 46, 51, 59))).clone(namedValues=named_values(('anySlot', 1), ('slot1', 2), ('slot2', 3), ('slot3', 4), ('slot4', 5), ('slot5', 6), ('slot6', 7), ('slot7', 8), ('slot8', 9), ('slot9', 10), ('slot10', 11), ('slot11', 12), ('slot12', 13), ('slot13', 14), ('slot14', 15), ('slot15', 16), ('slot16', 17), ('slot17', 18), ('slot18', 19), ('slot19', 20), ('slot20', 21), ('slot21', 22), ('slot22', 23), ('slot23', 24), ('slot24', 25), ('slot25', 26), ('slot26', 27), ('slot27', 28), ('slot28', 29), ('slot29', 30), ('slot30', 31), ('slot31', 32), ('slot32', 33), ('slot33', 34), ('slot34', 35), ('slot35', 36), ('slot36', 37), ('slot37', 38), ('slot38', 39), ('slot39', 40), ('slot40', 41), ('aLim', 55), ('bLim', 56), ('cLim', 57), ('dLim', 58), ('leftController', 49), ('rightController', 50), ('controller', 42), ('firstControlModule', 53), ('secondControlModule', 54), ('trunkModule1', 45), ('trunkModule2', 46), ('controlModule', 51), ('slotPrimary', 59)))).setLabel('uds3NetworkProfile-PhysicalAddress-Slot').setMaxAccess('readwrite') if mibBuilder.loadTexts: uds3NetworkProfile_PhysicalAddress_Slot.setStatus('mandatory') uds3_network_profile__physical_address__item_number = mib_scalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 7), integer32()).setLabel('uds3NetworkProfile-PhysicalAddress-ItemNumber').setMaxAccess('readwrite') if mibBuilder.loadTexts: uds3NetworkProfile_PhysicalAddress_ItemNumber.setStatus('mandatory') uds3_network_profile__enabled = mib_scalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 8), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('no', 1), ('yes', 2)))).setLabel('uds3NetworkProfile-Enabled').setMaxAccess('readwrite') if mibBuilder.loadTexts: uds3NetworkProfile_Enabled.setStatus('mandatory') uds3_network_profile__profile_number = mib_scalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 9), integer32()).setLabel('uds3NetworkProfile-ProfileNumber').setMaxAccess('readwrite') if mibBuilder.loadTexts: uds3NetworkProfile_ProfileNumber.setStatus('mandatory') uds3_network_profile__line_config__trunk_group = mib_scalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 10), integer32()).setLabel('uds3NetworkProfile-LineConfig-TrunkGroup').setMaxAccess('readwrite') if mibBuilder.loadTexts: uds3NetworkProfile_LineConfig_TrunkGroup.setStatus('mandatory') uds3_network_profile__line_config__nailed_group = mib_scalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 11), integer32()).setLabel('uds3NetworkProfile-LineConfig-NailedGroup').setMaxAccess('readwrite') if mibBuilder.loadTexts: uds3NetworkProfile_LineConfig_NailedGroup.setStatus('mandatory') uds3_network_profile__line_config__route_port__slot_number__slot_number = mib_scalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 12), integer32()).setLabel('uds3NetworkProfile-LineConfig-RoutePort-SlotNumber-SlotNumber').setMaxAccess('readwrite') if mibBuilder.loadTexts: uds3NetworkProfile_LineConfig_RoutePort_SlotNumber_SlotNumber.setStatus('mandatory') uds3_network_profile__line_config__route_port__slot_number__shelf_number = mib_scalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 13), integer32()).setLabel('uds3NetworkProfile-LineConfig-RoutePort-SlotNumber-ShelfNumber').setMaxAccess('readwrite') if mibBuilder.loadTexts: uds3NetworkProfile_LineConfig_RoutePort_SlotNumber_ShelfNumber.setStatus('mandatory') uds3_network_profile__line_config__route_port__relative_port_number__relative_port_number = mib_scalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 14), integer32()).setLabel('uds3NetworkProfile-LineConfig-RoutePort-RelativePortNumber-RelativePortNumber').setMaxAccess('readwrite') if mibBuilder.loadTexts: uds3NetworkProfile_LineConfig_RoutePort_RelativePortNumber_RelativePortNumber.setStatus('mandatory') uds3_network_profile__line_config__activation = mib_scalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 15), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('static', 1), ('dsrActive', 2), ('dcdDsrActive', 3)))).setLabel('uds3NetworkProfile-LineConfig-Activation').setMaxAccess('readwrite') if mibBuilder.loadTexts: uds3NetworkProfile_LineConfig_Activation.setStatus('mandatory') uds3_network_profile__line_config__line_type = mib_scalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 19), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1))).clone(namedValues=named_values(('cBitParity', 1)))).setLabel('uds3NetworkProfile-LineConfig-LineType').setMaxAccess('readwrite') if mibBuilder.loadTexts: uds3NetworkProfile_LineConfig_LineType.setStatus('mandatory') uds3_network_profile__line_config__line_coding = mib_scalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 20), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1))).clone(namedValues=named_values(('b3zs', 1)))).setLabel('uds3NetworkProfile-LineConfig-LineCoding').setMaxAccess('readwrite') if mibBuilder.loadTexts: uds3NetworkProfile_LineConfig_LineCoding.setStatus('mandatory') uds3_network_profile__line_config__loopback = mib_scalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 21), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('noLoopback', 1), ('facilityLoopback', 2), ('localLoopback', 3)))).setLabel('uds3NetworkProfile-LineConfig-Loopback').setMaxAccess('readwrite') if mibBuilder.loadTexts: uds3NetworkProfile_LineConfig_Loopback.setStatus('mandatory') uds3_network_profile__line_config__clock_source = mib_scalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 23), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('eligible', 1), ('notEligible', 2)))).setLabel('uds3NetworkProfile-LineConfig-ClockSource').setMaxAccess('readwrite') if mibBuilder.loadTexts: uds3NetworkProfile_LineConfig_ClockSource.setStatus('mandatory') uds3_network_profile__line_config__clock_priority = mib_scalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 24), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(2, 3, 4))).clone(namedValues=named_values(('highPriority', 2), ('middlePriority', 3), ('lowPriority', 4)))).setLabel('uds3NetworkProfile-LineConfig-ClockPriority').setMaxAccess('readwrite') if mibBuilder.loadTexts: uds3NetworkProfile_LineConfig_ClockPriority.setStatus('mandatory') uds3_network_profile__line_config__status_change_trap_enable = mib_scalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 25), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('no', 1), ('yes', 2)))).setLabel('uds3NetworkProfile-LineConfig-StatusChangeTrapEnable').setMaxAccess('readwrite') if mibBuilder.loadTexts: uds3NetworkProfile_LineConfig_StatusChangeTrapEnable.setStatus('mandatory') uds3_network_profile__action_o = mib_scalar((1, 3, 6, 1, 4, 1, 529, 23, 5, 1, 1, 22), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('noAction', 1), ('createProfile', 2), ('deleteProfile', 3)))).setLabel('uds3NetworkProfile-Action-o').setMaxAccess('readwrite') if mibBuilder.loadTexts: uds3NetworkProfile_Action_o.setStatus('mandatory') mibBuilder.exportSymbols('ASCEND-MIBUDS3NET-MIB', uds3NetworkProfile_LineConfig_TrunkGroup=uds3NetworkProfile_LineConfig_TrunkGroup, uds3NetworkProfile_LineConfig_RoutePort_RelativePortNumber_RelativePortNumber=uds3NetworkProfile_LineConfig_RoutePort_RelativePortNumber_RelativePortNumber, uds3NetworkProfile_LineConfig_LineCoding=uds3NetworkProfile_LineConfig_LineCoding, uds3NetworkProfile_Shelf_o=uds3NetworkProfile_Shelf_o, uds3NetworkProfile_Action_o=uds3NetworkProfile_Action_o, uds3NetworkProfile_ProfileNumber=uds3NetworkProfile_ProfileNumber, mibuds3NetworkProfileTable=mibuds3NetworkProfileTable, uds3NetworkProfile_LineConfig_RoutePort_SlotNumber_ShelfNumber=uds3NetworkProfile_LineConfig_RoutePort_SlotNumber_ShelfNumber, uds3NetworkProfile_LineConfig_ClockSource=uds3NetworkProfile_LineConfig_ClockSource, uds3NetworkProfile_Name=uds3NetworkProfile_Name, uds3NetworkProfile_LineConfig_RoutePort_SlotNumber_SlotNumber=uds3NetworkProfile_LineConfig_RoutePort_SlotNumber_SlotNumber, uds3NetworkProfile_Slot_o=uds3NetworkProfile_Slot_o, uds3NetworkProfile_PhysicalAddress_ItemNumber=uds3NetworkProfile_PhysicalAddress_ItemNumber, uds3NetworkProfile_LineConfig_NailedGroup=uds3NetworkProfile_LineConfig_NailedGroup, uds3NetworkProfile_LineConfig_Activation=uds3NetworkProfile_LineConfig_Activation, mibuds3NetworkProfileEntry=mibuds3NetworkProfileEntry, uds3NetworkProfile_Item_o=uds3NetworkProfile_Item_o, mibuds3NetworkProfile=mibuds3NetworkProfile, uds3NetworkProfile_PhysicalAddress_Shelf=uds3NetworkProfile_PhysicalAddress_Shelf, uds3NetworkProfile_LineConfig_ClockPriority=uds3NetworkProfile_LineConfig_ClockPriority, DisplayString=DisplayString, uds3NetworkProfile_LineConfig_StatusChangeTrapEnable=uds3NetworkProfile_LineConfig_StatusChangeTrapEnable, uds3NetworkProfile_LineConfig_LineType=uds3NetworkProfile_LineConfig_LineType, uds3NetworkProfile_LineConfig_Loopback=uds3NetworkProfile_LineConfig_Loopback, uds3NetworkProfile_Enabled=uds3NetworkProfile_Enabled, uds3NetworkProfile_PhysicalAddress_Slot=uds3NetworkProfile_PhysicalAddress_Slot)
vermelho = '\033[31m' verde = '\033[32m' azul = '\033[34m' #----------------------------- ciano = '\033[36m' magenta = '\033[35m' amarelo = '\033[33m' preto = '\033[30m' branco = '\033[37m' #----------------------------- original = '\033[0;0m' negrito = '\033[1m' reverso = '\033[2m' #----------------------------- fundo_preto = '\033[40m' fundo_vermelho = '\033[41m' fundo_verde = '\033[42m' fundo_amarelo = '\033[43m' fundo_azul = '\033[44m' fundo_magenta = '\033[45m' fundo_ciano = '\033[46m' fundo_branco = '\033[47m'
vermelho = '\x1b[31m' verde = '\x1b[32m' azul = '\x1b[34m' ciano = '\x1b[36m' magenta = '\x1b[35m' amarelo = '\x1b[33m' preto = '\x1b[30m' branco = '\x1b[37m' original = '\x1b[0;0m' negrito = '\x1b[1m' reverso = '\x1b[2m' fundo_preto = '\x1b[40m' fundo_vermelho = '\x1b[41m' fundo_verde = '\x1b[42m' fundo_amarelo = '\x1b[43m' fundo_azul = '\x1b[44m' fundo_magenta = '\x1b[45m' fundo_ciano = '\x1b[46m' fundo_branco = '\x1b[47m'
class AppCredentials(object): def __init__(self, client_id, client_secret, redirect_uri): self.client_id = client_id self.client_secret = client_secret self.redirect_uri = redirect_uri
class Appcredentials(object): def __init__(self, client_id, client_secret, redirect_uri): self.client_id = client_id self.client_secret = client_secret self.redirect_uri = redirect_uri
s=str(input()) n1,n2=[int(e) for e in input().split()] count=0 count2=1 for i in range(n1): print(s[i],end="") for i in range(n2-n1+1): print(s[n2-count],end="") count+=1 for i in range(len(s)-n2-1): print(s[n2+count2],end="") count2+=1
s = str(input()) (n1, n2) = [int(e) for e in input().split()] count = 0 count2 = 1 for i in range(n1): print(s[i], end='') for i in range(n2 - n1 + 1): print(s[n2 - count], end='') count += 1 for i in range(len(s) - n2 - 1): print(s[n2 + count2], end='') count2 += 1
# 28. Implement strStr() class Solution(object): # brute-force 1 def strStr(self, haystack, needle): """ :type haystack: str :type needle: str :rtype: int """ lh , ln = len(haystack), len(needle) if ln == 0: return 0 for i in range(lh - ln + 1): j = 0 while j < ln: if haystack[i + j] != needle[j]: break j += 1 if j == ln: return i return -1 # brute-force 2 def strStr1(self, haystack, needle): """ :type haystack: str :type needle: str :rtype: int """ lh, ln = len(haystack), len(needle) for i in range(lh - ln + 1): if haystack[i : (i+ln)] == needle: return i return -1 # KMP def strStr2(self, haystack, needle): """ :type haystack: str :type needle: str :rtype: int """ N, M = len(haystack), len(needle) if not N and not M: return 0 if not N: return -1 if not M: return 0 # longest prefix suffix lps = [0] * M self.calculateLPS(needle, M, lps) i, j, matches = 0, 0, [] while i < N: if needle[j] == haystack[i]: i += 1 j += 1 if j == M: matches.append(i - j) j = lps[j - 1] elif i < N and needle[j] != haystack[i]: if j != 0: j = lps[j - 1] else: i += 1 return matches[0] if matches else -1 def calculateLPS(self, needle, M, lps): len = 0 # length of the previous longest refix suffix lps[0] = 0 i = 1 while i < M: if needle[i] == needle[len]: len += 1 lps[i] = len i += 1 else: if len != 0: len = lps[len - 1] else: lps[i] = 0 i += 1 # Z-algorithm def strStr3(self, haystack, needle): N, M = len(haystack), len(needle) if not N and not M: return 0 if not N: return -1 if not M: return 0 s = needle + "$" + haystack z = self.calculateZ(s) res = [] for i in range(len(z)): if z[i] == len(needle): res.append(i - len(needle) - 1) return res[0] if res else -1 def calculateZ(self, s): z = [0 for ch in s] left = right = 0 for k in range(len(s)): if k > right: left = right = k while right < len(s) and s[right] == s[right - left]: right += 1 z[k] = right - left right -= 1 else: k1 = k - left if z[k1] < right - k + 1: z[k] = z[k1] else: left = k while right < len(s) and s[right] == s[right-left]: right += 1 z[k] = right - left right -= 1 return z
class Solution(object): def str_str(self, haystack, needle): """ :type haystack: str :type needle: str :rtype: int """ (lh, ln) = (len(haystack), len(needle)) if ln == 0: return 0 for i in range(lh - ln + 1): j = 0 while j < ln: if haystack[i + j] != needle[j]: break j += 1 if j == ln: return i return -1 def str_str1(self, haystack, needle): """ :type haystack: str :type needle: str :rtype: int """ (lh, ln) = (len(haystack), len(needle)) for i in range(lh - ln + 1): if haystack[i:i + ln] == needle: return i return -1 def str_str2(self, haystack, needle): """ :type haystack: str :type needle: str :rtype: int """ (n, m) = (len(haystack), len(needle)) if not N and (not M): return 0 if not N: return -1 if not M: return 0 lps = [0] * M self.calculateLPS(needle, M, lps) (i, j, matches) = (0, 0, []) while i < N: if needle[j] == haystack[i]: i += 1 j += 1 if j == M: matches.append(i - j) j = lps[j - 1] elif i < N and needle[j] != haystack[i]: if j != 0: j = lps[j - 1] else: i += 1 return matches[0] if matches else -1 def calculate_lps(self, needle, M, lps): len = 0 lps[0] = 0 i = 1 while i < M: if needle[i] == needle[len]: len += 1 lps[i] = len i += 1 elif len != 0: len = lps[len - 1] else: lps[i] = 0 i += 1 def str_str3(self, haystack, needle): (n, m) = (len(haystack), len(needle)) if not N and (not M): return 0 if not N: return -1 if not M: return 0 s = needle + '$' + haystack z = self.calculateZ(s) res = [] for i in range(len(z)): if z[i] == len(needle): res.append(i - len(needle) - 1) return res[0] if res else -1 def calculate_z(self, s): z = [0 for ch in s] left = right = 0 for k in range(len(s)): if k > right: left = right = k while right < len(s) and s[right] == s[right - left]: right += 1 z[k] = right - left right -= 1 else: k1 = k - left if z[k1] < right - k + 1: z[k] = z[k1] else: left = k while right < len(s) and s[right] == s[right - left]: right += 1 z[k] = right - left right -= 1 return z
# # PySNMP MIB module DLGHWINF-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DLGHWINF-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:47:46 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, ValueRangeConstraint, ConstraintsIntersection, SingleValueConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsIntersection", "SingleValueConstraint", "ConstraintsUnion") dlgHardwareInfo, dialogic = mibBuilder.importSymbols("DLGC-GLOBAL-REG", "dlgHardwareInfo", "dialogic") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") sysName, = mibBuilder.importSymbols("SNMPv2-MIB", "sysName") Integer32, NotificationType, iso, Counter64, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, Gauge32, Counter32, Unsigned32, IpAddress, ModuleIdentity, Bits, ObjectIdentity, NotificationType, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "NotificationType", "iso", "Counter64", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "Gauge32", "Counter32", "Unsigned32", "IpAddress", "ModuleIdentity", "Bits", "ObjectIdentity", "NotificationType", "MibIdentifier") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") dlgHiMibRev = MibIdentifier((1, 3, 6, 1, 4, 1, 3028, 1, 1, 1)) dlgHiComponent = MibIdentifier((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2)) dlgHiInterface = MibIdentifier((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1)) dlgHiIdent = MibIdentifier((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2)) dlgHiOsCommon = MibIdentifier((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1)) dlgHiMibRevMajor = MibScalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiMibRevMajor.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiMibRevMajor.setDescription('The Major Revision level. A change in the major revision level represents a major change in the architecture of the MIB. A change in the major revision level may indicate a significant change in the information supported and/or the meaning of the supported information, correct interpretation of data may require a MIB document with the same major revision level.') dlgHiMibRevMinor = MibScalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiMibRevMinor.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiMibRevMinor.setDescription('The Minor Revision level. A change in the minor revision level may represent some minor additional support. no changes to any pre-existing information has occurred.') dlgHiMibCondition = MibScalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("ok", 2), ("degraded", 3), ("failed", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiMibCondition.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiMibCondition.setDescription('The overall condition. This object represents the overall status of the Dialogic Hardware Information system represented by this MIB. Other - The status of the MIB is Unknown OK - The status of the MIB is OK Degraded - Some statuses in the MIB are not OK Failed - Most statuses in the MIB are not OK') dlgHiOsCommonPollFreq = MibScalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: dlgHiOsCommonPollFreq.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiOsCommonPollFreq.setDescription("The Agent's polling frequency in seconds. The frequency, in seconds, at which the Agent updates the operational status of the individual devices within the device table. A value of zero indicates that the Agent will not check the status of the indivdual devices. The default value is 60 (60 seconds). In this case the Agent checks each individual device every 60 seconds to make sure it is still operational. Should a device fail, it's status will set to failed and a trap is sent to the management application. Setting the poll frequency to a value too low can impact system performance.") dlgHiOsCommonNumberOfModules = MibScalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiOsCommonNumberOfModules.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiOsCommonNumberOfModules.setDescription('The number of modules in the OS Common Module table.') dlgHiOsLogEnable = MibScalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setMaxAccess("readwrite") if mibBuilder.loadTexts: dlgHiOsLogEnable.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiOsLogEnable.setDescription("The Agent's log enable bit 0 - disabled Setting this variable to this value will disable the trap logging 1 - enabled Setting this variable to this value will enable the trap logging ") dlgHiOsTestTrapEnable = MibScalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1))).clone(namedValues=NamedValues(("enabled", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: dlgHiOsTestTrapEnable.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiOsTestTrapEnable.setDescription(' Every time this bit is set, test trap is sent from the agent ') dlgHiIdentSystemServicesNameForTrap = MibScalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 6), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 256))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentSystemServicesNameForTrap.setStatus('mandatory') dlgHiIdentSystemServicesStatusForTrap = MibScalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("other", 1), ("started", 2), ("stop-pending", 3), ("stopped", 4), ("start-pending", 5)))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentSystemServicesStatusForTrap.setStatus('mandatory') dlgHiIdentIndexForTrap = MibScalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentIndexForTrap.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentIndexForTrap.setDescription('An index that uniquely specifies each device. This value is not necessarily contiguous') dlgHiIdentModelForTrap = MibScalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 9), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentModelForTrap.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentModelForTrap.setDescription("Dialogic board Model. This is the Dialogic board's model name and can be used for identification purposes.") dlgHiIdentOperStatusForTrap = MibScalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("ok", 2), ("degraded", 3), ("failed", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentOperStatusForTrap.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentOperStatusForTrap.setDescription('Dialogic board Operational Status. This is the overall condition of the Dialogic board. The following values are defined other(1) The board does not support board condition monitoring. ok(2) The board is operating normally. No user action is required. degraded(3) The board is partially failed. The board may need to be reset. failed(4) The board has failed. The board should be reset NOTE: In the implmentation of this version of the MIB (Major 1, Minor 2), SpanCards do not support the degraded state. ') dlgHiIdentAdminStatusForTrap = MibScalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("other", 1), ("started", 2), ("stopped", 3), ("disabled", 4), ("diagnose", 5), ("start-pending", 6), ("stop-pending", 7)))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentAdminStatusForTrap.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentAdminStatusForTrap.setDescription("Dialogic board Admin Status. This is the Administrative Status of the Dialogic board. The following values are defined other(1) The board's admin status in unavailable. started(2) The board has been started. stopped(3) The board is stopped. disabled(4) The board is disabled. diagnose(5) The board is being diagnosed. start-pending(6) The board is in the process of starting. stop-pending(7) The board is in the process of stopping. ") dlgHiIdentSerNumForTrap = MibScalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 12), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 12))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentSerNumForTrap.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentSerNumForTrap.setDescription('Dialogic board Serial Number. This is the Dialogic board serial number and can be used for identification purposes. On many boards the serial number appears on the back of the board.') dlgHiIdentErrorMessageForTrap = MibScalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 13), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 96))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentErrorMessageForTrap.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentErrorMessageForTrap.setDescription('Dialogic board Error Message. This value represents the error message associated with a failing Dialogic board.') dlgHiOsCommonModuleTable = MibTable((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 3), ) if mibBuilder.loadTexts: dlgHiOsCommonModuleTable.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiOsCommonModuleTable.setDescription('A table of software modules that provide an interface to the devicethis MIB describes.') dlgHiOsCommonModuleEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 3, 1), ).setIndexNames((0, "DLGHWINF-MIB", "dlgHiOsCommonModuleIndex")) if mibBuilder.loadTexts: dlgHiOsCommonModuleEntry.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiOsCommonModuleEntry.setDescription('A description of a software module that provides an interface to the device this MIB describes.') dlgHiOsCommonModuleIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiOsCommonModuleIndex.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiOsCommonModuleIndex.setDescription('A unique index for this module description.') dlgHiOsCommonModuleName = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 3, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiOsCommonModuleName.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiOsCommonModuleName.setDescription('The module name.') dlgHiOsCommonModuleVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 3, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 5))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiOsCommonModuleVersion.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiOsCommonModuleVersion.setDescription('Version of the module.') dlgHiOsCommonModuleDate = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 3, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(7, 7)).setFixedLength(7)).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiOsCommonModuleDate.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiOsCommonModuleDate.setDescription('The module date. field octets contents range ===== ====== ======= ===== 1 1-2 year 0..65536 2 3 month 1..12 3 4 day 1..31 4 5 hour 0..23 5 6 minute 0..59 6 7 second 0..60 (use 60 for leap-second) This field will be set to year = 0 if the agent cannot provide the module date. The hour, minute, and second field will be set to zero (0) if they are not relevant.') dlgHiOsCommonModulePurpose = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 3, 1, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiOsCommonModulePurpose.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiOsCommonModulePurpose.setDescription('The purpose of the module described in this entry.') dlgHiIdentNumberOfDevices = MibScalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentNumberOfDevices.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentNumberOfDevices.setDescription('Number of Dialogic device in the system. A device may be a physical board, a channel on a board or an embedded component on a board') dlgHiIdentServiceStatus = MibScalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("other", 1), ("started", 2), ("stop-pending", 3), ("stopped", 4), ("start-pending", 5)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: dlgHiIdentServiceStatus.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentServiceStatus.setDescription('Dialogic Service Status This is the overall status of the Dialogic system service. The following values are defined: other(1) The service status is unknown. started(2) The service status is running - boards are started. Setting the variable to this value will fail. stop-pending(3) The service is in the act of stopping. Setting the variable to this value when the current condition is started(2) will cause the service to begin stopping, otherwise it will fail. stopped(4) The service status is stopped - boards are stopped. Setting the variable to this value will fail. start-pending(5) The service is in the act of starting. Setting the variable to this value when the current condition is stopped(4) will cause the service to begin starting, othewise it will fail.') dlgHiIdentServiceChangeDate = MibScalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(7, 7)).setFixedLength(7)).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentServiceChangeDate.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentServiceChangeDate.setDescription('The date and time the service was last started or stopped. field octets contents range ===== ====== ======= ===== 1 1-2 year 0..65536 2 3 month 1..12 3 4 day 1..31 4 5 hour 0..23 5 6 minute 0..59 6 7 second 0..60 (use 60 for leap-second) This field will be set to year = 0 if the agent cannot provide the module date. The hour, minute, and second field will be set to zero (0) if they are not relevant.') dlgHiIdentTrapMask = MibScalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 5), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: dlgHiIdentTrapMask.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentTrapMask.setDescription("Trap Enable mask. This variable is a bit mask which can be used to enable or disable certain enterprise specific traps. A '1' is used to enable the trap, a '0' disables it. Bit 0 - (1) enables Traps upon Dialogic Service Status transitions to the Stopped or Started State. Bit 1 - (1) enables Traps when a specific board Condition transitions to the Failed State. Bit 2 - (1) enables the dlgDsx1Alarm trap from the DS1 MIB. This trap indicates the beginning and end of a new alarm condition. Bit 3 - (1) enables the dlgDsx1SwEvtMskTrap trap from the DS1 MIB. This trap indicates that the DS1 Event Mask has been changed. Bit 4 - (1) enables the dlgIsdnDChanged trap from the ISDN MIB. This trap indicates the current operational status of LAPD of a particular D channel has changed Bit 5 - (1) enables the dlgIsdnBChanged trap from the DS1 MIB. This trap indicates the current operational status of LAPD of a particular B channel has changed ") dlgHiIdentSystemServicesTable = MibTable((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 6), ) if mibBuilder.loadTexts: dlgHiIdentSystemServicesTable.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentSystemServicesTable.setDescription('Dialogic-Related system services table.') dlgHiIdentSystemServicesEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 6, 1), ).setIndexNames((0, "DLGHWINF-MIB", "dlgHiIdentSystemServicesIndex")) if mibBuilder.loadTexts: dlgHiIdentSystemServicesEntry.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentSystemServicesEntry.setDescription('Dialogic-Related system services table entry.') dlgHiIdentSystemServicesIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 6, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentSystemServicesIndex.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentSystemServicesIndex.setDescription('An index that uniquely specifies each system service. This value is not necessarily contiguous') dlgHiIdentSystemServicesName = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 6, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 256))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentSystemServicesName.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentSystemServicesName.setDescription('System Service Name. This is the name of the system service used for Identification Purposes.') dlgHiIdentSystemServicesScmName = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 6, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 256))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentSystemServicesScmName.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentSystemServicesScmName.setDescription('SCM System Service Name. This is the name of the system service that is given to SCM (Service Control Manager) and is used by SCM to identify the service.') dlgHiIdentSystemServicesStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 6, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("other", 1), ("started", 2), ("stop-pending", 3), ("stopped", 4), ("start-pending", 5)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: dlgHiIdentSystemServicesStatus.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentSystemServicesStatus.setDescription('Service Status This is the overall status of the Dialogic system service. The following values are defined: other(1) The service status is unknown. started(2) The service status is running - boards are started. Setting the variable to this value will fail. stop-pending(3) The service is in the act of stopping. Setting the variable to this value when the current condition is started(2) will cause the service to begin stopping, otherwise it will fail. stopped(4) The service status is stopped - boards are stopped. Setting the variable to this value will fail. start-pending(5) The service is in the act of starting. Setting the variable to this value when the current condition is stopped(4) will cause the service to begin starting, othewise it will fail.') dlgHiIdentSystemServicesChangeDate = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 6, 1, 5), OctetString().subtype(subtypeSpec=ValueSizeConstraint(7, 7)).setFixedLength(7)).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentSystemServicesChangeDate.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentSystemServicesChangeDate.setDescription('The date and time the service was last started or stopped. field octets contents range ===== ====== ======= ===== 1 1-2 year 0..65536 2 3 month 1..12 3 4 day 1..31 4 5 hour 0..23 5 6 minute 0..59 6 7 second 0..60 (use 60 for leap-second) This field will be set to year = 0 if the agent cannot provide the module date. The hour, minute, and second field will be set to zero (0) if they are not relevant.') dlgHiIdentTable = MibTable((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1), ) if mibBuilder.loadTexts: dlgHiIdentTable.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentTable.setDescription('Dialogic board Identification Table.') dlgHiIdentEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1), ).setIndexNames((0, "DLGHWINF-MIB", "dlgHiIdentIndex")) if mibBuilder.loadTexts: dlgHiIdentEntry.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentEntry.setDescription('Dialogic board Identification Table Entry.') dlgHiIdentIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentIndex.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentIndex.setDescription('An index that uniquely specifies each device. This value is not necessarily contiguous') dlgHiIdentModel = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentModel.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentModel.setDescription("Dialogic board Model. This is the Dialogic board's model name and can be used for identification purposes.") dlgHiIdentType = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("release4span", 2), ("dm3", 3), ("gammaCP", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentType.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentType.setDescription('Dialogic board type. This indicates which family of boards this device belongs to. other(1) -- none of the following release4span(2) -- Proline/2V up to D/600SC-2E1 boards dm3(3) -- DM3 based board gammaCP(4) -- Gamma CP/x series antares(5) -- Antares based board') dlgHiIdentFuncDescr = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentFuncDescr.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentFuncDescr.setDescription('Dialogic board Function Description. This provides a description of the functionality provided by the Dialogic board. If the functional description of the board is unavailable, then this string will be of length zero (0).') dlgHiIdentSerNum = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 12))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentSerNum.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentSerNum.setDescription('Dialogic board Serial Number. This is the Dialogic board serial number and can be used for identification purposes. On many boards the serial number appears on the back of the board.') dlgHiIdentFWName = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 6), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentFWName.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentFWName.setDescription("Dialogic Firmware Name. This is the name of the firmware downloaded to this Dialogic board. If multiple different firmwares are loaded the filenames will be separated by a '\\'. If the firmware name is unavailable, then this strng will be of length zero (0).") dlgHiIdentFWVers = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 7), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentFWVers.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentFWVers.setDescription("Dialogic Firmware Version. This is the version of the firmware downloaded to this Dialogic board. If multiple different firmwares are loaded then each firmware version will be separated by a '\\'. If the Dialogic firmware version is unavailable, then this string will be of length zero (0).") dlgHiIdentMemBaseAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 8), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentMemBaseAddr.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentMemBaseAddr.setDescription('Dialogic board Base Memory Address. This is the Memory address where the Dialogic board has been installed on the system. If the Dialogic board does not use system memory then a value of zero (0) is returned') dlgHiIdentIOBaseAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 9), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentIOBaseAddr.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentIOBaseAddr.setDescription('Dialogic board Base I/O Port Address. This is the I/O Port address where the Dialogic board has been installed on the system. If the Dialogic board does not use a system I/O Port then a value of zero (0) is returned') dlgHiIdentIrq = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 10), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentIrq.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentIrq.setDescription('Dialogic board IRQ (Interrupt) Level. This is the Interrupt Level used by the Dialogic board installed on the system. If the Dialogic board does not use an Interrupt then a value of zero (0) is returned') dlgHiIdentBoardID = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 11), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentBoardID.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentBoardID.setDescription('Dialogic board Board Locator ID. This is the Unique Board Locator ID set by the thumbwheel on certain Dialogic boards. This may be used for identification purposes. If the Dialogic board does not have a Unique Board Locator ID setting then a value of negative one (-1) is returned') dlgHiIdentPCISlotID = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 12), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentPCISlotID.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentPCISlotID.setDescription('Dialogic board PCI Slot ID. This is a PCI slot identifier where the Dialogic board is installed. This may be used for identification purposes. If the Dialogic board is not a PCI board or if this info is not available then a value of zero (0) is returned') dlgHiIdentOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("ok", 2), ("degraded", 3), ("failed", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentOperStatus.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentOperStatus.setDescription('Dialogic board Operational Status. This is the overall condition of the Dialogic board. The following values are defined other(1) The board does not support board condition monitoring. ok(2) The board is operating normally. No user action is required. degraded(3) The board is partially failed. The board may need to be reset. failed(4) The board has failed. The board should be reset NOTE: In the implmentation of this version of the MIB (Major 1, Minor 2), SpanCards do not support the degraded state. ') dlgHiIdentAdminStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("other", 1), ("started", 2), ("stopped", 3), ("disabled", 4), ("diagnose", 5), ("start-pending", 6), ("stop-pending", 7)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: dlgHiIdentAdminStatus.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentAdminStatus.setDescription("Dialogic board Admin Status. This is the Administrative Status of the Dialogic board. The following values are defined other(1) The board's admin status in unavailable. started(2) The board has been started. stopped(3) The board is stopped. disabled(4) The board is disabled. diagnose(5) The board is being diagnosed. start-pending(6) The board is in the process of starting. stop-pending(7) The board is in the process of stopping. ") dlgHiIdentErrorMessage = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 15), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 96))).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentErrorMessage.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentErrorMessage.setDescription('Dialogic board Error Message. This value represents the error message associated with a failing Dialogic board.') dlgHiIdentDeviceChangeDate = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 16), OctetString().subtype(subtypeSpec=ValueSizeConstraint(7, 7)).setFixedLength(7)).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentDeviceChangeDate.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentDeviceChangeDate.setDescription('The date and time the boards operational status last changed. field octets contents range ===== ====== ======= ===== 1 1-2 year 0..65536 2 3 month 1..12 3 4 day 1..31 4 5 hour 0..23 5 6 minute 0..59 6 7 second 0..60 (use 60 for leap-second) This field will be set to year = 0 if the agent cannot provide the module date. The hour, minute, and second field will be set to zero (0) if they are not relevant.') dlgHiIdentSpecific = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 17), ObjectIdentifier()).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentSpecific.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentSpecific.setDescription('A reference to MIB definitions specific to the particular board type specified in the row of the table If this information is not present, its value should be set to the OBJECT IDENTIFIER { 0 0 }, which is a syntatically valid object identifier, and any conformant implementation of ASN.1 and BER must be able to generate and recognize this value.') dlgHiIdentPCIBusID = MibTableColumn((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 18), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dlgHiIdentPCIBusID.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentPCIBusID.setDescription('Dialogic board PCI Bus ID. This is a PCI Bus identifier where the Dialogic board is installed. This may be used for identification purposes. If the Dialogic board is not a PCI board or if this info is not available then a value of zero (0) is returned') dlgHiServiceChanged = NotificationType((1, 3, 6, 1, 4, 1, 3028) + (0,1001)).setObjects(("SNMPv2-MIB", "sysName"), ("DLGHWINF-MIB", "dlgHiIdentServiceStatus")) if mibBuilder.loadTexts: dlgHiServiceChanged.setDescription('The Dialogic service condition has been changed Description: The dlgHiIdentServiceChanged trap indicates that the Dialogic service has transitioned to either the started or stopped state. This may occur by performing a set on the dlgHiIdentServiceStatus variable or by controlling the service directly on the machine which generated the trap. Action: This trap is informational. A management console may want to update any current device table views since attributes of the device may change when the Dialogic service is started or stopped') dlgHiboardStatusChanged = NotificationType((1, 3, 6, 1, 4, 1, 3028) + (0,1002)).setObjects(("SNMPv2-MIB", "sysName"), ("DLGHWINF-MIB", "dlgHiIdentIndexForTrap"), ("DLGHWINF-MIB", "dlgHiIdentOperStatusForTrap"), ("DLGHWINF-MIB", "dlgHiIdentAdminStatusForTrap"), ("DLGHWINF-MIB", "dlgHiIdentModelForTrap"), ("DLGHWINF-MIB", "dlgHiIdentSerNumForTrap"), ("DLGHWINF-MIB", "dlgHiIdentErrorMessageForTrap")) if mibBuilder.loadTexts: dlgHiboardStatusChanged.setDescription('The condition of a Dialogic board has changed to failed or ok Description: The dlgHiIdentboardStatusChanged trap indicates that a device in the device table has transitioned from the ok state to the failed state or vice versa. In general this indicates that on-board firmware has crashed and is no longer responding or that the board has gone bad. Should the board recover from the failed state, the state will be transitioned back to the ok state and a trap will be generated to indicate the board is okay again. Action: If the state has transitioned to the failed then shutdown any active applications and reset the Dialogic service. This will cause the on-board firmware to be re-downloaded. If the problem persists you should run the device diagnostics on the board to make sure it is okay.') dlgHiNonDlgcServiceChanged = NotificationType((1, 3, 6, 1, 4, 1, 3028) + (0,1003)).setObjects(("SNMPv2-MIB", "sysName"), ("DLGHWINF-MIB", "dlgHiIdentSystemServicesNameForTrap"), ("DLGHWINF-MIB", "dlgHiIdentSystemServicesStatusForTrap")) if mibBuilder.loadTexts: dlgHiNonDlgcServiceChanged.setDescription('A Dialogic-Related service condition has been changed Description: The dlgHiNonDlgcServiceChanged trap indicates that a Dialogic-Related service (any UNIX Service other than the Dialogic System Service that has dependencies on Dialogic products) has transitioned to either the started or stopped state. This may occur by performing a set on the dlgHiIdentSystemServicesStatus variable or by controlling the service directly on the machine which generated the trap. Action: This trap is informational. A management console may want to update any current device table views since attributes of the device may change when the Dialogic-Related service is started or stopped') dlgHiTestTrap = NotificationType((1, 3, 6, 1, 4, 1, 3028) + (0,1004)).setObjects(("SNMPv2-MIB", "sysName")) if mibBuilder.loadTexts: dlgHiTestTrap.setDescription('This trap is to test if the trap sending mechanism is acting properly Description: A managed node will request from the hardware agent to send this trap with the name of the node the agent resides on to the manager. Action: This trap is informational to indicate that the hardware agent is capable of sending traps to the manager.') mibBuilder.exportSymbols("DLGHWINF-MIB", dlgHiOsLogEnable=dlgHiOsLogEnable, dlgHiIdentServiceChangeDate=dlgHiIdentServiceChangeDate, dlgHiIdentSpecific=dlgHiIdentSpecific, dlgHiIdentType=dlgHiIdentType, dlgHiOsCommonModuleName=dlgHiOsCommonModuleName, dlgHiOsCommonModuleDate=dlgHiOsCommonModuleDate, dlgHiIdentModel=dlgHiIdentModel, dlgHiOsCommon=dlgHiOsCommon, dlgHiIdentFuncDescr=dlgHiIdentFuncDescr, dlgHiIdentPCISlotID=dlgHiIdentPCISlotID, dlgHiIdentFWVers=dlgHiIdentFWVers, dlgHiIdentMemBaseAddr=dlgHiIdentMemBaseAddr, dlgHiNonDlgcServiceChanged=dlgHiNonDlgcServiceChanged, dlgHiOsTestTrapEnable=dlgHiOsTestTrapEnable, dlgHiIdentSystemServicesTable=dlgHiIdentSystemServicesTable, dlgHiIdentFWName=dlgHiIdentFWName, dlgHiMibRevMajor=dlgHiMibRevMajor, dlgHiMibRevMinor=dlgHiMibRevMinor, dlgHiOsCommonModuleIndex=dlgHiOsCommonModuleIndex, dlgHiIdentBoardID=dlgHiIdentBoardID, dlgHiIdentErrorMessageForTrap=dlgHiIdentErrorMessageForTrap, dlgHiOsCommonModuleEntry=dlgHiOsCommonModuleEntry, dlgHiIdentOperStatusForTrap=dlgHiIdentOperStatusForTrap, dlgHiInterface=dlgHiInterface, dlgHiOsCommonNumberOfModules=dlgHiOsCommonNumberOfModules, dlgHiIdentSystemServicesScmName=dlgHiIdentSystemServicesScmName, dlgHiComponent=dlgHiComponent, dlgHiIdentTable=dlgHiIdentTable, dlgHiIdentSystemServicesStatus=dlgHiIdentSystemServicesStatus, dlgHiIdentSystemServicesStatusForTrap=dlgHiIdentSystemServicesStatusForTrap, dlgHiIdentIndex=dlgHiIdentIndex, dlgHiIdentSystemServicesChangeDate=dlgHiIdentSystemServicesChangeDate, dlgHiIdentSystemServicesEntry=dlgHiIdentSystemServicesEntry, dlgHiTestTrap=dlgHiTestTrap, dlgHiIdentSystemServicesNameForTrap=dlgHiIdentSystemServicesNameForTrap, dlgHiIdentErrorMessage=dlgHiIdentErrorMessage, dlgHiIdentNumberOfDevices=dlgHiIdentNumberOfDevices, dlgHiIdentIrq=dlgHiIdentIrq, dlgHiIdentEntry=dlgHiIdentEntry, dlgHiOsCommonModuleTable=dlgHiOsCommonModuleTable, dlgHiIdentIOBaseAddr=dlgHiIdentIOBaseAddr, dlgHiIdentOperStatus=dlgHiIdentOperStatus, dlgHiServiceChanged=dlgHiServiceChanged, dlgHiMibCondition=dlgHiMibCondition, dlgHiIdentAdminStatusForTrap=dlgHiIdentAdminStatusForTrap, dlgHiIdentSerNum=dlgHiIdentSerNum, dlgHiIdentSystemServicesIndex=dlgHiIdentSystemServicesIndex, dlgHiOsCommonModuleVersion=dlgHiOsCommonModuleVersion, dlgHiOsCommonModulePurpose=dlgHiOsCommonModulePurpose, dlgHiboardStatusChanged=dlgHiboardStatusChanged, dlgHiIdentTrapMask=dlgHiIdentTrapMask, dlgHiIdentModelForTrap=dlgHiIdentModelForTrap, dlgHiIdentSerNumForTrap=dlgHiIdentSerNumForTrap, dlgHiIdentPCIBusID=dlgHiIdentPCIBusID, dlgHiIdentSystemServicesName=dlgHiIdentSystemServicesName, dlgHiIdentServiceStatus=dlgHiIdentServiceStatus, dlgHiMibRev=dlgHiMibRev, dlgHiIdentIndexForTrap=dlgHiIdentIndexForTrap, dlgHiIdent=dlgHiIdent, dlgHiOsCommonPollFreq=dlgHiOsCommonPollFreq, dlgHiIdentAdminStatus=dlgHiIdentAdminStatus, dlgHiIdentDeviceChangeDate=dlgHiIdentDeviceChangeDate)
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constraint, constraints_intersection, single_value_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ValueRangeConstraint', 'ConstraintsIntersection', 'SingleValueConstraint', 'ConstraintsUnion') (dlg_hardware_info, dialogic) = mibBuilder.importSymbols('DLGC-GLOBAL-REG', 'dlgHardwareInfo', 'dialogic') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (sys_name,) = mibBuilder.importSymbols('SNMPv2-MIB', 'sysName') (integer32, notification_type, iso, counter64, mib_scalar, mib_table, mib_table_row, mib_table_column, time_ticks, gauge32, counter32, unsigned32, ip_address, module_identity, bits, object_identity, notification_type, mib_identifier) = mibBuilder.importSymbols('SNMPv2-SMI', 'Integer32', 'NotificationType', 'iso', 'Counter64', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'TimeTicks', 'Gauge32', 'Counter32', 'Unsigned32', 'IpAddress', 'ModuleIdentity', 'Bits', 'ObjectIdentity', 'NotificationType', 'MibIdentifier') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') dlg_hi_mib_rev = mib_identifier((1, 3, 6, 1, 4, 1, 3028, 1, 1, 1)) dlg_hi_component = mib_identifier((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2)) dlg_hi_interface = mib_identifier((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1)) dlg_hi_ident = mib_identifier((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2)) dlg_hi_os_common = mib_identifier((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1)) dlg_hi_mib_rev_major = mib_scalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiMibRevMajor.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiMibRevMajor.setDescription('The Major Revision level. A change in the major revision level represents a major change in the architecture of the MIB. A change in the major revision level may indicate a significant change in the information supported and/or the meaning of the supported information, correct interpretation of data may require a MIB document with the same major revision level.') dlg_hi_mib_rev_minor = mib_scalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiMibRevMinor.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiMibRevMinor.setDescription('The Minor Revision level. A change in the minor revision level may represent some minor additional support. no changes to any pre-existing information has occurred.') dlg_hi_mib_condition = mib_scalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('other', 1), ('ok', 2), ('degraded', 3), ('failed', 4)))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiMibCondition.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiMibCondition.setDescription('The overall condition. This object represents the overall status of the Dialogic Hardware Information system represented by this MIB. Other - The status of the MIB is Unknown OK - The status of the MIB is OK Degraded - Some statuses in the MIB are not OK Failed - Most statuses in the MIB are not OK') dlg_hi_os_common_poll_freq = mib_scalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readwrite') if mibBuilder.loadTexts: dlgHiOsCommonPollFreq.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiOsCommonPollFreq.setDescription("The Agent's polling frequency in seconds. The frequency, in seconds, at which the Agent updates the operational status of the individual devices within the device table. A value of zero indicates that the Agent will not check the status of the indivdual devices. The default value is 60 (60 seconds). In this case the Agent checks each individual device every 60 seconds to make sure it is still operational. Should a device fail, it's status will set to failed and a trap is sent to the management application. Setting the poll frequency to a value too low can impact system performance.") dlg_hi_os_common_number_of_modules = mib_scalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 2), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiOsCommonNumberOfModules.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiOsCommonNumberOfModules.setDescription('The number of modules in the OS Common Module table.') dlg_hi_os_log_enable = mib_scalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(0, 1))).setMaxAccess('readwrite') if mibBuilder.loadTexts: dlgHiOsLogEnable.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiOsLogEnable.setDescription("The Agent's log enable bit 0 - disabled Setting this variable to this value will disable the trap logging 1 - enabled Setting this variable to this value will enable the trap logging ") dlg_hi_os_test_trap_enable = mib_scalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1))).clone(namedValues=named_values(('enabled', 1)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: dlgHiOsTestTrapEnable.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiOsTestTrapEnable.setDescription(' Every time this bit is set, test trap is sent from the agent ') dlg_hi_ident_system_services_name_for_trap = mib_scalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 6), display_string().subtype(subtypeSpec=value_size_constraint(0, 256))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentSystemServicesNameForTrap.setStatus('mandatory') dlg_hi_ident_system_services_status_for_trap = mib_scalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('other', 1), ('started', 2), ('stop-pending', 3), ('stopped', 4), ('start-pending', 5)))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentSystemServicesStatusForTrap.setStatus('mandatory') dlg_hi_ident_index_for_trap = mib_scalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 8), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentIndexForTrap.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentIndexForTrap.setDescription('An index that uniquely specifies each device. This value is not necessarily contiguous') dlg_hi_ident_model_for_trap = mib_scalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 9), display_string().subtype(subtypeSpec=value_size_constraint(0, 32))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentModelForTrap.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentModelForTrap.setDescription("Dialogic board Model. This is the Dialogic board's model name and can be used for identification purposes.") dlg_hi_ident_oper_status_for_trap = mib_scalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('other', 1), ('ok', 2), ('degraded', 3), ('failed', 4)))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentOperStatusForTrap.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentOperStatusForTrap.setDescription('Dialogic board Operational Status. This is the overall condition of the Dialogic board. The following values are defined other(1) The board does not support board condition monitoring. ok(2) The board is operating normally. No user action is required. degraded(3) The board is partially failed. The board may need to be reset. failed(4) The board has failed. The board should be reset NOTE: In the implmentation of this version of the MIB (Major 1, Minor 2), SpanCards do not support the degraded state. ') dlg_hi_ident_admin_status_for_trap = mib_scalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('other', 1), ('started', 2), ('stopped', 3), ('disabled', 4), ('diagnose', 5), ('start-pending', 6), ('stop-pending', 7)))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentAdminStatusForTrap.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentAdminStatusForTrap.setDescription("Dialogic board Admin Status. This is the Administrative Status of the Dialogic board. The following values are defined other(1) The board's admin status in unavailable. started(2) The board has been started. stopped(3) The board is stopped. disabled(4) The board is disabled. diagnose(5) The board is being diagnosed. start-pending(6) The board is in the process of starting. stop-pending(7) The board is in the process of stopping. ") dlg_hi_ident_ser_num_for_trap = mib_scalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 12), display_string().subtype(subtypeSpec=value_size_constraint(0, 12))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentSerNumForTrap.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentSerNumForTrap.setDescription('Dialogic board Serial Number. This is the Dialogic board serial number and can be used for identification purposes. On many boards the serial number appears on the back of the board.') dlg_hi_ident_error_message_for_trap = mib_scalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 13), display_string().subtype(subtypeSpec=value_size_constraint(0, 96))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentErrorMessageForTrap.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentErrorMessageForTrap.setDescription('Dialogic board Error Message. This value represents the error message associated with a failing Dialogic board.') dlg_hi_os_common_module_table = mib_table((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 3)) if mibBuilder.loadTexts: dlgHiOsCommonModuleTable.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiOsCommonModuleTable.setDescription('A table of software modules that provide an interface to the devicethis MIB describes.') dlg_hi_os_common_module_entry = mib_table_row((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 3, 1)).setIndexNames((0, 'DLGHWINF-MIB', 'dlgHiOsCommonModuleIndex')) if mibBuilder.loadTexts: dlgHiOsCommonModuleEntry.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiOsCommonModuleEntry.setDescription('A description of a software module that provides an interface to the device this MIB describes.') dlg_hi_os_common_module_index = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 3, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiOsCommonModuleIndex.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiOsCommonModuleIndex.setDescription('A unique index for this module description.') dlg_hi_os_common_module_name = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 3, 1, 2), display_string().subtype(subtypeSpec=value_size_constraint(0, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiOsCommonModuleName.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiOsCommonModuleName.setDescription('The module name.') dlg_hi_os_common_module_version = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 3, 1, 3), display_string().subtype(subtypeSpec=value_size_constraint(0, 5))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiOsCommonModuleVersion.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiOsCommonModuleVersion.setDescription('Version of the module.') dlg_hi_os_common_module_date = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 3, 1, 4), octet_string().subtype(subtypeSpec=value_size_constraint(7, 7)).setFixedLength(7)).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiOsCommonModuleDate.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiOsCommonModuleDate.setDescription('The module date. field octets contents range ===== ====== ======= ===== 1 1-2 year 0..65536 2 3 month 1..12 3 4 day 1..31 4 5 hour 0..23 5 6 minute 0..59 6 7 second 0..60 (use 60 for leap-second) This field will be set to year = 0 if the agent cannot provide the module date. The hour, minute, and second field will be set to zero (0) if they are not relevant.') dlg_hi_os_common_module_purpose = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 1, 1, 3, 1, 5), display_string().subtype(subtypeSpec=value_size_constraint(0, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiOsCommonModulePurpose.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiOsCommonModulePurpose.setDescription('The purpose of the module described in this entry.') dlg_hi_ident_number_of_devices = mib_scalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 2), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentNumberOfDevices.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentNumberOfDevices.setDescription('Number of Dialogic device in the system. A device may be a physical board, a channel on a board or an embedded component on a board') dlg_hi_ident_service_status = mib_scalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('other', 1), ('started', 2), ('stop-pending', 3), ('stopped', 4), ('start-pending', 5)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: dlgHiIdentServiceStatus.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentServiceStatus.setDescription('Dialogic Service Status This is the overall status of the Dialogic system service. The following values are defined: other(1) The service status is unknown. started(2) The service status is running - boards are started. Setting the variable to this value will fail. stop-pending(3) The service is in the act of stopping. Setting the variable to this value when the current condition is started(2) will cause the service to begin stopping, otherwise it will fail. stopped(4) The service status is stopped - boards are stopped. Setting the variable to this value will fail. start-pending(5) The service is in the act of starting. Setting the variable to this value when the current condition is stopped(4) will cause the service to begin starting, othewise it will fail.') dlg_hi_ident_service_change_date = mib_scalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 4), octet_string().subtype(subtypeSpec=value_size_constraint(7, 7)).setFixedLength(7)).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentServiceChangeDate.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentServiceChangeDate.setDescription('The date and time the service was last started or stopped. field octets contents range ===== ====== ======= ===== 1 1-2 year 0..65536 2 3 month 1..12 3 4 day 1..31 4 5 hour 0..23 5 6 minute 0..59 6 7 second 0..60 (use 60 for leap-second) This field will be set to year = 0 if the agent cannot provide the module date. The hour, minute, and second field will be set to zero (0) if they are not relevant.') dlg_hi_ident_trap_mask = mib_scalar((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 5), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: dlgHiIdentTrapMask.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentTrapMask.setDescription("Trap Enable mask. This variable is a bit mask which can be used to enable or disable certain enterprise specific traps. A '1' is used to enable the trap, a '0' disables it. Bit 0 - (1) enables Traps upon Dialogic Service Status transitions to the Stopped or Started State. Bit 1 - (1) enables Traps when a specific board Condition transitions to the Failed State. Bit 2 - (1) enables the dlgDsx1Alarm trap from the DS1 MIB. This trap indicates the beginning and end of a new alarm condition. Bit 3 - (1) enables the dlgDsx1SwEvtMskTrap trap from the DS1 MIB. This trap indicates that the DS1 Event Mask has been changed. Bit 4 - (1) enables the dlgIsdnDChanged trap from the ISDN MIB. This trap indicates the current operational status of LAPD of a particular D channel has changed Bit 5 - (1) enables the dlgIsdnBChanged trap from the DS1 MIB. This trap indicates the current operational status of LAPD of a particular B channel has changed ") dlg_hi_ident_system_services_table = mib_table((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 6)) if mibBuilder.loadTexts: dlgHiIdentSystemServicesTable.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentSystemServicesTable.setDescription('Dialogic-Related system services table.') dlg_hi_ident_system_services_entry = mib_table_row((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 6, 1)).setIndexNames((0, 'DLGHWINF-MIB', 'dlgHiIdentSystemServicesIndex')) if mibBuilder.loadTexts: dlgHiIdentSystemServicesEntry.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentSystemServicesEntry.setDescription('Dialogic-Related system services table entry.') dlg_hi_ident_system_services_index = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 6, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentSystemServicesIndex.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentSystemServicesIndex.setDescription('An index that uniquely specifies each system service. This value is not necessarily contiguous') dlg_hi_ident_system_services_name = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 6, 1, 2), display_string().subtype(subtypeSpec=value_size_constraint(0, 256))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentSystemServicesName.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentSystemServicesName.setDescription('System Service Name. This is the name of the system service used for Identification Purposes.') dlg_hi_ident_system_services_scm_name = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 6, 1, 3), display_string().subtype(subtypeSpec=value_size_constraint(0, 256))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentSystemServicesScmName.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentSystemServicesScmName.setDescription('SCM System Service Name. This is the name of the system service that is given to SCM (Service Control Manager) and is used by SCM to identify the service.') dlg_hi_ident_system_services_status = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 6, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('other', 1), ('started', 2), ('stop-pending', 3), ('stopped', 4), ('start-pending', 5)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: dlgHiIdentSystemServicesStatus.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentSystemServicesStatus.setDescription('Service Status This is the overall status of the Dialogic system service. The following values are defined: other(1) The service status is unknown. started(2) The service status is running - boards are started. Setting the variable to this value will fail. stop-pending(3) The service is in the act of stopping. Setting the variable to this value when the current condition is started(2) will cause the service to begin stopping, otherwise it will fail. stopped(4) The service status is stopped - boards are stopped. Setting the variable to this value will fail. start-pending(5) The service is in the act of starting. Setting the variable to this value when the current condition is stopped(4) will cause the service to begin starting, othewise it will fail.') dlg_hi_ident_system_services_change_date = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 6, 1, 5), octet_string().subtype(subtypeSpec=value_size_constraint(7, 7)).setFixedLength(7)).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentSystemServicesChangeDate.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentSystemServicesChangeDate.setDescription('The date and time the service was last started or stopped. field octets contents range ===== ====== ======= ===== 1 1-2 year 0..65536 2 3 month 1..12 3 4 day 1..31 4 5 hour 0..23 5 6 minute 0..59 6 7 second 0..60 (use 60 for leap-second) This field will be set to year = 0 if the agent cannot provide the module date. The hour, minute, and second field will be set to zero (0) if they are not relevant.') dlg_hi_ident_table = mib_table((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1)) if mibBuilder.loadTexts: dlgHiIdentTable.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentTable.setDescription('Dialogic board Identification Table.') dlg_hi_ident_entry = mib_table_row((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1)).setIndexNames((0, 'DLGHWINF-MIB', 'dlgHiIdentIndex')) if mibBuilder.loadTexts: dlgHiIdentEntry.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentEntry.setDescription('Dialogic board Identification Table Entry.') dlg_hi_ident_index = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentIndex.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentIndex.setDescription('An index that uniquely specifies each device. This value is not necessarily contiguous') dlg_hi_ident_model = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 2), display_string().subtype(subtypeSpec=value_size_constraint(0, 32))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentModel.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentModel.setDescription("Dialogic board Model. This is the Dialogic board's model name and can be used for identification purposes.") dlg_hi_ident_type = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('other', 1), ('release4span', 2), ('dm3', 3), ('gammaCP', 4)))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentType.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentType.setDescription('Dialogic board type. This indicates which family of boards this device belongs to. other(1) -- none of the following release4span(2) -- Proline/2V up to D/600SC-2E1 boards dm3(3) -- DM3 based board gammaCP(4) -- Gamma CP/x series antares(5) -- Antares based board') dlg_hi_ident_func_descr = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 4), display_string().subtype(subtypeSpec=value_size_constraint(0, 128))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentFuncDescr.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentFuncDescr.setDescription('Dialogic board Function Description. This provides a description of the functionality provided by the Dialogic board. If the functional description of the board is unavailable, then this string will be of length zero (0).') dlg_hi_ident_ser_num = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 5), display_string().subtype(subtypeSpec=value_size_constraint(0, 12))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentSerNum.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentSerNum.setDescription('Dialogic board Serial Number. This is the Dialogic board serial number and can be used for identification purposes. On many boards the serial number appears on the back of the board.') dlg_hi_ident_fw_name = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 6), display_string().subtype(subtypeSpec=value_size_constraint(0, 128))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentFWName.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentFWName.setDescription("Dialogic Firmware Name. This is the name of the firmware downloaded to this Dialogic board. If multiple different firmwares are loaded the filenames will be separated by a '\\'. If the firmware name is unavailable, then this strng will be of length zero (0).") dlg_hi_ident_fw_vers = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 7), display_string().subtype(subtypeSpec=value_size_constraint(0, 64))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentFWVers.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentFWVers.setDescription("Dialogic Firmware Version. This is the version of the firmware downloaded to this Dialogic board. If multiple different firmwares are loaded then each firmware version will be separated by a '\\'. If the Dialogic firmware version is unavailable, then this string will be of length zero (0).") dlg_hi_ident_mem_base_addr = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 8), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentMemBaseAddr.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentMemBaseAddr.setDescription('Dialogic board Base Memory Address. This is the Memory address where the Dialogic board has been installed on the system. If the Dialogic board does not use system memory then a value of zero (0) is returned') dlg_hi_ident_io_base_addr = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 9), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentIOBaseAddr.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentIOBaseAddr.setDescription('Dialogic board Base I/O Port Address. This is the I/O Port address where the Dialogic board has been installed on the system. If the Dialogic board does not use a system I/O Port then a value of zero (0) is returned') dlg_hi_ident_irq = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 10), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentIrq.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentIrq.setDescription('Dialogic board IRQ (Interrupt) Level. This is the Interrupt Level used by the Dialogic board installed on the system. If the Dialogic board does not use an Interrupt then a value of zero (0) is returned') dlg_hi_ident_board_id = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 11), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentBoardID.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentBoardID.setDescription('Dialogic board Board Locator ID. This is the Unique Board Locator ID set by the thumbwheel on certain Dialogic boards. This may be used for identification purposes. If the Dialogic board does not have a Unique Board Locator ID setting then a value of negative one (-1) is returned') dlg_hi_ident_pci_slot_id = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 12), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentPCISlotID.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentPCISlotID.setDescription('Dialogic board PCI Slot ID. This is a PCI slot identifier where the Dialogic board is installed. This may be used for identification purposes. If the Dialogic board is not a PCI board or if this info is not available then a value of zero (0) is returned') dlg_hi_ident_oper_status = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 13), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('other', 1), ('ok', 2), ('degraded', 3), ('failed', 4)))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentOperStatus.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentOperStatus.setDescription('Dialogic board Operational Status. This is the overall condition of the Dialogic board. The following values are defined other(1) The board does not support board condition monitoring. ok(2) The board is operating normally. No user action is required. degraded(3) The board is partially failed. The board may need to be reset. failed(4) The board has failed. The board should be reset NOTE: In the implmentation of this version of the MIB (Major 1, Minor 2), SpanCards do not support the degraded state. ') dlg_hi_ident_admin_status = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 14), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('other', 1), ('started', 2), ('stopped', 3), ('disabled', 4), ('diagnose', 5), ('start-pending', 6), ('stop-pending', 7)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: dlgHiIdentAdminStatus.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentAdminStatus.setDescription("Dialogic board Admin Status. This is the Administrative Status of the Dialogic board. The following values are defined other(1) The board's admin status in unavailable. started(2) The board has been started. stopped(3) The board is stopped. disabled(4) The board is disabled. diagnose(5) The board is being diagnosed. start-pending(6) The board is in the process of starting. stop-pending(7) The board is in the process of stopping. ") dlg_hi_ident_error_message = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 15), display_string().subtype(subtypeSpec=value_size_constraint(0, 96))).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentErrorMessage.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentErrorMessage.setDescription('Dialogic board Error Message. This value represents the error message associated with a failing Dialogic board.') dlg_hi_ident_device_change_date = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 16), octet_string().subtype(subtypeSpec=value_size_constraint(7, 7)).setFixedLength(7)).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentDeviceChangeDate.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentDeviceChangeDate.setDescription('The date and time the boards operational status last changed. field octets contents range ===== ====== ======= ===== 1 1-2 year 0..65536 2 3 month 1..12 3 4 day 1..31 4 5 hour 0..23 5 6 minute 0..59 6 7 second 0..60 (use 60 for leap-second) This field will be set to year = 0 if the agent cannot provide the module date. The hour, minute, and second field will be set to zero (0) if they are not relevant.') dlg_hi_ident_specific = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 17), object_identifier()).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentSpecific.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentSpecific.setDescription('A reference to MIB definitions specific to the particular board type specified in the row of the table If this information is not present, its value should be set to the OBJECT IDENTIFIER { 0 0 }, which is a syntatically valid object identifier, and any conformant implementation of ASN.1 and BER must be able to generate and recognize this value.') dlg_hi_ident_pci_bus_id = mib_table_column((1, 3, 6, 1, 4, 1, 3028, 1, 1, 2, 2, 1, 1, 18), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: dlgHiIdentPCIBusID.setStatus('mandatory') if mibBuilder.loadTexts: dlgHiIdentPCIBusID.setDescription('Dialogic board PCI Bus ID. This is a PCI Bus identifier where the Dialogic board is installed. This may be used for identification purposes. If the Dialogic board is not a PCI board or if this info is not available then a value of zero (0) is returned') dlg_hi_service_changed = notification_type((1, 3, 6, 1, 4, 1, 3028) + (0, 1001)).setObjects(('SNMPv2-MIB', 'sysName'), ('DLGHWINF-MIB', 'dlgHiIdentServiceStatus')) if mibBuilder.loadTexts: dlgHiServiceChanged.setDescription('The Dialogic service condition has been changed Description: The dlgHiIdentServiceChanged trap indicates that the Dialogic service has transitioned to either the started or stopped state. This may occur by performing a set on the dlgHiIdentServiceStatus variable or by controlling the service directly on the machine which generated the trap. Action: This trap is informational. A management console may want to update any current device table views since attributes of the device may change when the Dialogic service is started or stopped') dlg_hiboard_status_changed = notification_type((1, 3, 6, 1, 4, 1, 3028) + (0, 1002)).setObjects(('SNMPv2-MIB', 'sysName'), ('DLGHWINF-MIB', 'dlgHiIdentIndexForTrap'), ('DLGHWINF-MIB', 'dlgHiIdentOperStatusForTrap'), ('DLGHWINF-MIB', 'dlgHiIdentAdminStatusForTrap'), ('DLGHWINF-MIB', 'dlgHiIdentModelForTrap'), ('DLGHWINF-MIB', 'dlgHiIdentSerNumForTrap'), ('DLGHWINF-MIB', 'dlgHiIdentErrorMessageForTrap')) if mibBuilder.loadTexts: dlgHiboardStatusChanged.setDescription('The condition of a Dialogic board has changed to failed or ok Description: The dlgHiIdentboardStatusChanged trap indicates that a device in the device table has transitioned from the ok state to the failed state or vice versa. In general this indicates that on-board firmware has crashed and is no longer responding or that the board has gone bad. Should the board recover from the failed state, the state will be transitioned back to the ok state and a trap will be generated to indicate the board is okay again. Action: If the state has transitioned to the failed then shutdown any active applications and reset the Dialogic service. This will cause the on-board firmware to be re-downloaded. If the problem persists you should run the device diagnostics on the board to make sure it is okay.') dlg_hi_non_dlgc_service_changed = notification_type((1, 3, 6, 1, 4, 1, 3028) + (0, 1003)).setObjects(('SNMPv2-MIB', 'sysName'), ('DLGHWINF-MIB', 'dlgHiIdentSystemServicesNameForTrap'), ('DLGHWINF-MIB', 'dlgHiIdentSystemServicesStatusForTrap')) if mibBuilder.loadTexts: dlgHiNonDlgcServiceChanged.setDescription('A Dialogic-Related service condition has been changed Description: The dlgHiNonDlgcServiceChanged trap indicates that a Dialogic-Related service (any UNIX Service other than the Dialogic System Service that has dependencies on Dialogic products) has transitioned to either the started or stopped state. This may occur by performing a set on the dlgHiIdentSystemServicesStatus variable or by controlling the service directly on the machine which generated the trap. Action: This trap is informational. A management console may want to update any current device table views since attributes of the device may change when the Dialogic-Related service is started or stopped') dlg_hi_test_trap = notification_type((1, 3, 6, 1, 4, 1, 3028) + (0, 1004)).setObjects(('SNMPv2-MIB', 'sysName')) if mibBuilder.loadTexts: dlgHiTestTrap.setDescription('This trap is to test if the trap sending mechanism is acting properly Description: A managed node will request from the hardware agent to send this trap with the name of the node the agent resides on to the manager. Action: This trap is informational to indicate that the hardware agent is capable of sending traps to the manager.') mibBuilder.exportSymbols('DLGHWINF-MIB', dlgHiOsLogEnable=dlgHiOsLogEnable, dlgHiIdentServiceChangeDate=dlgHiIdentServiceChangeDate, dlgHiIdentSpecific=dlgHiIdentSpecific, dlgHiIdentType=dlgHiIdentType, dlgHiOsCommonModuleName=dlgHiOsCommonModuleName, dlgHiOsCommonModuleDate=dlgHiOsCommonModuleDate, dlgHiIdentModel=dlgHiIdentModel, dlgHiOsCommon=dlgHiOsCommon, dlgHiIdentFuncDescr=dlgHiIdentFuncDescr, dlgHiIdentPCISlotID=dlgHiIdentPCISlotID, dlgHiIdentFWVers=dlgHiIdentFWVers, dlgHiIdentMemBaseAddr=dlgHiIdentMemBaseAddr, dlgHiNonDlgcServiceChanged=dlgHiNonDlgcServiceChanged, dlgHiOsTestTrapEnable=dlgHiOsTestTrapEnable, dlgHiIdentSystemServicesTable=dlgHiIdentSystemServicesTable, dlgHiIdentFWName=dlgHiIdentFWName, dlgHiMibRevMajor=dlgHiMibRevMajor, dlgHiMibRevMinor=dlgHiMibRevMinor, dlgHiOsCommonModuleIndex=dlgHiOsCommonModuleIndex, dlgHiIdentBoardID=dlgHiIdentBoardID, dlgHiIdentErrorMessageForTrap=dlgHiIdentErrorMessageForTrap, dlgHiOsCommonModuleEntry=dlgHiOsCommonModuleEntry, dlgHiIdentOperStatusForTrap=dlgHiIdentOperStatusForTrap, dlgHiInterface=dlgHiInterface, dlgHiOsCommonNumberOfModules=dlgHiOsCommonNumberOfModules, dlgHiIdentSystemServicesScmName=dlgHiIdentSystemServicesScmName, dlgHiComponent=dlgHiComponent, dlgHiIdentTable=dlgHiIdentTable, dlgHiIdentSystemServicesStatus=dlgHiIdentSystemServicesStatus, dlgHiIdentSystemServicesStatusForTrap=dlgHiIdentSystemServicesStatusForTrap, dlgHiIdentIndex=dlgHiIdentIndex, dlgHiIdentSystemServicesChangeDate=dlgHiIdentSystemServicesChangeDate, dlgHiIdentSystemServicesEntry=dlgHiIdentSystemServicesEntry, dlgHiTestTrap=dlgHiTestTrap, dlgHiIdentSystemServicesNameForTrap=dlgHiIdentSystemServicesNameForTrap, dlgHiIdentErrorMessage=dlgHiIdentErrorMessage, dlgHiIdentNumberOfDevices=dlgHiIdentNumberOfDevices, dlgHiIdentIrq=dlgHiIdentIrq, dlgHiIdentEntry=dlgHiIdentEntry, dlgHiOsCommonModuleTable=dlgHiOsCommonModuleTable, dlgHiIdentIOBaseAddr=dlgHiIdentIOBaseAddr, dlgHiIdentOperStatus=dlgHiIdentOperStatus, dlgHiServiceChanged=dlgHiServiceChanged, dlgHiMibCondition=dlgHiMibCondition, dlgHiIdentAdminStatusForTrap=dlgHiIdentAdminStatusForTrap, dlgHiIdentSerNum=dlgHiIdentSerNum, dlgHiIdentSystemServicesIndex=dlgHiIdentSystemServicesIndex, dlgHiOsCommonModuleVersion=dlgHiOsCommonModuleVersion, dlgHiOsCommonModulePurpose=dlgHiOsCommonModulePurpose, dlgHiboardStatusChanged=dlgHiboardStatusChanged, dlgHiIdentTrapMask=dlgHiIdentTrapMask, dlgHiIdentModelForTrap=dlgHiIdentModelForTrap, dlgHiIdentSerNumForTrap=dlgHiIdentSerNumForTrap, dlgHiIdentPCIBusID=dlgHiIdentPCIBusID, dlgHiIdentSystemServicesName=dlgHiIdentSystemServicesName, dlgHiIdentServiceStatus=dlgHiIdentServiceStatus, dlgHiMibRev=dlgHiMibRev, dlgHiIdentIndexForTrap=dlgHiIdentIndexForTrap, dlgHiIdent=dlgHiIdent, dlgHiOsCommonPollFreq=dlgHiOsCommonPollFreq, dlgHiIdentAdminStatus=dlgHiIdentAdminStatus, dlgHiIdentDeviceChangeDate=dlgHiIdentDeviceChangeDate)
class Pricing(object): def __init__(self, location, event): self.location = location self.event = event def setlocation(self, location): self.location = location def getprice(self): return self.location.getprice() def getquantity(self): return self.location.getquantity() def getdiscount(self): return self.event.getdiscount() ## and many more such methods
class Pricing(object): def __init__(self, location, event): self.location = location self.event = event def setlocation(self, location): self.location = location def getprice(self): return self.location.getprice() def getquantity(self): return self.location.getquantity() def getdiscount(self): return self.event.getdiscount()
class Solution(object): def sub_two(self, a, b): if a is None or b is None: raise TypeError('a or b cannot be None') result = a ^ b borrow = (~a & b) << 1 if borrow != 0: return self.sub_two(result, borrow) return result
class Solution(object): def sub_two(self, a, b): if a is None or b is None: raise type_error('a or b cannot be None') result = a ^ b borrow = (~a & b) << 1 if borrow != 0: return self.sub_two(result, borrow) return result
class Plan(): """ This is a class for the plans. """ def __init__(self, name, price, limit): """ The constructor for the Subscription class. Parameters: name (str): The plan name. price (int): The plan price. limit (int): Allowed nuber of websites. """ self.name = name self.price = price self.limit = limit def __repr__(self): return f'< Plan {self.limit}>'
class Plan: """ This is a class for the plans. """ def __init__(self, name, price, limit): """ The constructor for the Subscription class. Parameters: name (str): The plan name. price (int): The plan price. limit (int): Allowed nuber of websites. """ self.name = name self.price = price self.limit = limit def __repr__(self): return f'< Plan {self.limit}>'
# write a function that accepts a name as input and # prints out "Hello {name}!" def greeting(name): print("Hello " + name + "!") greeting("Alfred")
def greeting(name): print('Hello ' + name + '!') greeting('Alfred')
class MetaGetter: def __init__(self, context): self.__context = context def render_width_px(self): original_width = self.__context.scene.render.resolution_x return int(original_width * self.__render_size_fraction()) def render_height_px(self): original_height = self.__context.scene.render.resolution_y return int(original_height * self.__render_size_fraction()) def spp(self): return self.__context.scene.ph_render_num_spp def sample_filter_name(self): filter_type = self.__context.scene.ph_render_sample_filter_type if filter_type == "BOX": return "box" elif filter_type == "GAUSSIAN": return "gaussian" elif filter_type == "MN": return "mn" elif filter_type == "BH": return "bh" else: print("warning: unsupported filter type %s, using box BH instead" % filter_type) return "bh" def render_method(self): return self.__context.scene.ph_render_integrator_type def integrator_type_name(self): integrator_type = self.__context.scene.ph_render_integrator_type if integrator_type == "BVPT": return "bvpt" elif integrator_type == "BNEEPT": return "bneept" else: print("warning: unsupported integrator type %s, using BVPT instead" % integrator_type) return "bvpt" def __render_size_fraction(self): return self.__context.scene.render.resolution_percentage / 100.0
class Metagetter: def __init__(self, context): self.__context = context def render_width_px(self): original_width = self.__context.scene.render.resolution_x return int(original_width * self.__render_size_fraction()) def render_height_px(self): original_height = self.__context.scene.render.resolution_y return int(original_height * self.__render_size_fraction()) def spp(self): return self.__context.scene.ph_render_num_spp def sample_filter_name(self): filter_type = self.__context.scene.ph_render_sample_filter_type if filter_type == 'BOX': return 'box' elif filter_type == 'GAUSSIAN': return 'gaussian' elif filter_type == 'MN': return 'mn' elif filter_type == 'BH': return 'bh' else: print('warning: unsupported filter type %s, using box BH instead' % filter_type) return 'bh' def render_method(self): return self.__context.scene.ph_render_integrator_type def integrator_type_name(self): integrator_type = self.__context.scene.ph_render_integrator_type if integrator_type == 'BVPT': return 'bvpt' elif integrator_type == 'BNEEPT': return 'bneept' else: print('warning: unsupported integrator type %s, using BVPT instead' % integrator_type) return 'bvpt' def __render_size_fraction(self): return self.__context.scene.render.resolution_percentage / 100.0
# 024 - Write a Python program to test whether a passed letter is a vowel or not. def vowelLetter(pLetter): return pLetter.upper() in 'AEIOU' print(vowelLetter('A')) print(vowelLetter('B'))
def vowel_letter(pLetter): return pLetter.upper() in 'AEIOU' print(vowel_letter('A')) print(vowel_letter('B'))
class IntervalStats: def __init__(self) -> None: self.interval_duration = 0.0 self.rtt_ratio = 0.0 self.marked_lost_bytes = 0 self.loss_rate = 0 self.actual_sending_rate_mbps = 0 self.ack_rate_mbps = 0 self.avg_rtt = 0.0 self.rtt_dev = 0.0 self.min_rtt = -1.0 self.max_rtt = -1.0 self.approx_rtt_gradient = 0 self.rtt_gradient = 0 self.rtt_gradient_cut = 0 self.rtt_gradient_error = 0 self.trending_gradient = 0 self.trending_gradient_cut = 0 self.trending_gradient_error = 0 self.trending_deviation = 0 class UtilityManager: # Exponent of sending rate contribution term in Vivace utility function. kSendingRateExponent = 0.9 # Coefficient of loss penalty term in Vivace utility function. kVivaceLossCoefficient = 11.35 # Coefficient of latency penalty term in Vivace utility function. kLatencyCoefficient = 900.0 def __init__(self, utility_tag: str = "vivace") -> None: self.utility_tag = utility_tag self.interval_stats = IntervalStats() def calculate_utility(self, mi, event_time: float) -> float: # TODO: compute interval stats utility = 0.0 if self.utility_tag == "Vivace": utility = self.calculate_utility_vivace(mi) else: raise RuntimeError return utility def calculate_utility_vivace(self, mi) -> float: return self.calculate_utility_proportional( mi, self.kLatencyCoefficient, self.kVivaceLossCoefficient) def calculate_utility_proportional(self, mi, latency_coefficient: float, loss_coefficient: float) -> float: sending_rate_contribution = pow(self.interval_stats.actual_sending_rate_mbps, self.kSendingRateExponent) rtt_gradient = 0.0 if is_rtt_inflation_tolerable_ else self.interval_stats.rtt_gradient if (mi.rtt_fluctuation_tolerance_ratio > 50.0 and abs(rtt_gradient) < 1000.0 / self.interval_stats.interval_duration): rtt_gradient = 0.0 if rtt_gradient < 0: rtt_gradient = 0.0 latency_penalty = latency_coefficient * rtt_gradient * self.interval_stats.actual_sending_rate_mbps loss_penalty = loss_coefficient * self.interval_stats.loss_rate * self.interval_stats.actual_sending_rate_mbps return sending_rate_contribution - latency_penalty - loss_penalty
class Intervalstats: def __init__(self) -> None: self.interval_duration = 0.0 self.rtt_ratio = 0.0 self.marked_lost_bytes = 0 self.loss_rate = 0 self.actual_sending_rate_mbps = 0 self.ack_rate_mbps = 0 self.avg_rtt = 0.0 self.rtt_dev = 0.0 self.min_rtt = -1.0 self.max_rtt = -1.0 self.approx_rtt_gradient = 0 self.rtt_gradient = 0 self.rtt_gradient_cut = 0 self.rtt_gradient_error = 0 self.trending_gradient = 0 self.trending_gradient_cut = 0 self.trending_gradient_error = 0 self.trending_deviation = 0 class Utilitymanager: k_sending_rate_exponent = 0.9 k_vivace_loss_coefficient = 11.35 k_latency_coefficient = 900.0 def __init__(self, utility_tag: str='vivace') -> None: self.utility_tag = utility_tag self.interval_stats = interval_stats() def calculate_utility(self, mi, event_time: float) -> float: utility = 0.0 if self.utility_tag == 'Vivace': utility = self.calculate_utility_vivace(mi) else: raise RuntimeError return utility def calculate_utility_vivace(self, mi) -> float: return self.calculate_utility_proportional(mi, self.kLatencyCoefficient, self.kVivaceLossCoefficient) def calculate_utility_proportional(self, mi, latency_coefficient: float, loss_coefficient: float) -> float: sending_rate_contribution = pow(self.interval_stats.actual_sending_rate_mbps, self.kSendingRateExponent) rtt_gradient = 0.0 if is_rtt_inflation_tolerable_ else self.interval_stats.rtt_gradient if mi.rtt_fluctuation_tolerance_ratio > 50.0 and abs(rtt_gradient) < 1000.0 / self.interval_stats.interval_duration: rtt_gradient = 0.0 if rtt_gradient < 0: rtt_gradient = 0.0 latency_penalty = latency_coefficient * rtt_gradient * self.interval_stats.actual_sending_rate_mbps loss_penalty = loss_coefficient * self.interval_stats.loss_rate * self.interval_stats.actual_sending_rate_mbps return sending_rate_contribution - latency_penalty - loss_penalty
# Python3 Total Ways to arrange coins {1, 3, 5} to Sum Upto N # Using Recursion def Arrangement(N): if N < 0: return 0 if N == 0: return 1 return Arrangement(N-1) + Arrangement(N-3) + Arrangement(N-5) # Using DP dp = [None for _ in range(10001)] def Arrangement_DP(n): if n < 0: return 0 if n == 0: return 1 if dp[n]: return dp[n] dp[n] = Arrangement_DP(n-1) + Arrangement_DP(n-3) + Arrangement_DP(n-5) return dp[n] print(Arrangement(10)) print(Arrangement_DP(500))
def arrangement(N): if N < 0: return 0 if N == 0: return 1 return arrangement(N - 1) + arrangement(N - 3) + arrangement(N - 5) dp = [None for _ in range(10001)] def arrangement_dp(n): if n < 0: return 0 if n == 0: return 1 if dp[n]: return dp[n] dp[n] = arrangement_dp(n - 1) + arrangement_dp(n - 3) + arrangement_dp(n - 5) return dp[n] print(arrangement(10)) print(arrangement_dp(500))
def ex2(): rs = np.random.RandomState(112) x=np.linspace(0,10,11) y=np.linspace(0,10,11) X,Y = np.meshgrid(x,y) X=X.flatten() Y=Y.flatten() weights=np.random.random(len(X)) plt.hist2d(X,Y,weights=weights); #The semicolon here avoids that Jupyter shows the resulting arrays
def ex2(): rs = np.random.RandomState(112) x = np.linspace(0, 10, 11) y = np.linspace(0, 10, 11) (x, y) = np.meshgrid(x, y) x = X.flatten() y = Y.flatten() weights = np.random.random(len(X)) plt.hist2d(X, Y, weights=weights)
"""Module with util funcs for testing.""" def assert_raises(exception, func, *args, **kwargs) -> None: """Check whether calling func(*args, **kwargs) raises exeption. Parameters ---------- exception : Exception Exception type. func : callable Method to be run. """ try: func(*args, **kwargs) except exception: pass
"""Module with util funcs for testing.""" def assert_raises(exception, func, *args, **kwargs) -> None: """Check whether calling func(*args, **kwargs) raises exeption. Parameters ---------- exception : Exception Exception type. func : callable Method to be run. """ try: func(*args, **kwargs) except exception: pass
def change_data(x): if x < 0 or x >255: return None elif 200 <= x <=255: return int(round((x - 200) * 3 / 11.0 + 85, 0)) elif 0 <= x <=130: return int(round(x * 6 / 13.0, 0)) else: return int(round((x - 131) * 23 / 68.0 + 61, 0)) if __name__ == '__main__': print('-1 => ' + str(change_data(-1))) print('0 => ' + str(change_data(0))) print('55 => ' + str(change_data(55))) print('131 => ' + str(change_data(131))) print('255 => ' + str(change_data(255))) ''' -1 => None 0 => 0 55 => 25 131 => 61 255 => 100 '''
def change_data(x): if x < 0 or x > 255: return None elif 200 <= x <= 255: return int(round((x - 200) * 3 / 11.0 + 85, 0)) elif 0 <= x <= 130: return int(round(x * 6 / 13.0, 0)) else: return int(round((x - 131) * 23 / 68.0 + 61, 0)) if __name__ == '__main__': print('-1 => ' + str(change_data(-1))) print('0 => ' + str(change_data(0))) print('55 => ' + str(change_data(55))) print('131 => ' + str(change_data(131))) print('255 => ' + str(change_data(255))) '\n\n-1 => None\n0 => 0\n55 => 25\n131 => 61\n255 => 100\n\n'
n, x = map(int, input().split()) s = str(input()) for e in s: if e == "o": x += 1 else: x -= 1 if x < 0: x = 0 print(x)
(n, x) = map(int, input().split()) s = str(input()) for e in s: if e == 'o': x += 1 else: x -= 1 if x < 0: x = 0 print(x)
cont = soma = 0 while True: nota = float(input()) if nota < 0 or nota > 10: print('nota invalida') else: soma += nota cont += 1 if cont == 2: break print('media = {}'.format(soma / cont))
cont = soma = 0 while True: nota = float(input()) if nota < 0 or nota > 10: print('nota invalida') else: soma += nota cont += 1 if cont == 2: break print('media = {}'.format(soma / cont))
template = """ /**************************************************************************** * ${name}.sv ****************************************************************************/ module ${name}( ${ports} ); ${wires} ${port_wire_assignments} ${interconnects} endmodule """
template = '\n/****************************************************************************\n * ${name}.sv\n ****************************************************************************/\nmodule ${name}(\n${ports}\n);\n\n${wires}\n\n${port_wire_assignments}\n\n${interconnects}\n\nendmodule\n'
src = Split(''' awss.c enrollee.c sha256.c zconfig_utils.c zconfig_ieee80211.c wifimgr.c ywss_utils.c zconfig_ut_test.c registrar.c zconfig_protocol.c zconfig_vendor_common.c ''') component = aos_component('ywss', src) component.add_macros('DEBUG') component.add_global_macros('CONFIG_YWSS')
src = split('\n awss.c \n enrollee.c \n sha256.c \n zconfig_utils.c \n zconfig_ieee80211.c \n wifimgr.c \n ywss_utils.c\n zconfig_ut_test.c \n registrar.c \n zconfig_protocol.c \n zconfig_vendor_common.c\n') component = aos_component('ywss', src) component.add_macros('DEBUG') component.add_global_macros('CONFIG_YWSS')
class Settings: base_url = "https://compass.scouts.org.uk" date_format = "%d %B %Y" # dd Month YYYY org_number = 10000001 total_requests = 0 wcf_json_endpoint = "/JSon.svc" # Windows communication foundation JSON service endpoint web_service_path = base_url + wcf_json_endpoint
class Settings: base_url = 'https://compass.scouts.org.uk' date_format = '%d %B %Y' org_number = 10000001 total_requests = 0 wcf_json_endpoint = '/JSon.svc' web_service_path = base_url + wcf_json_endpoint
def say_hello(): return "hello"
def say_hello(): return 'hello'
def searchRange(nums, target): start, end = -1, -1 lo, hi = 0, len(nums)-1 while lo <= hi: mid = (lo+hi)//2 if nums[mid] == target and (mid == 0 or nums[mid-1] != target): start = mid break elif nums[mid] < target: lo = mid+1 elif nums[mid] >= target: hi = mid-1 if start == -1: return [-1, -1] lo, hi = 0, len(nums)-1 while lo <= hi: mid = (lo+hi)//2 if nums[mid] == target and (mid == len(nums)-1 or nums[mid+1] != target): end = mid break elif nums[mid] <= target: lo = mid+1 elif nums[mid] > target: hi = mid-1 if end == -1: return [-1, -1] return [start, end] print(searchRange([5, 7, 7, 8, 8, 10], 8)) print(searchRange([5, 7, 7, 8, 8, 10], 6)) print(searchRange([5, 5, 5, 5, 6, 7], 5)) print(searchRange([0, 1, 5, 5, 5, 5], 5))
def search_range(nums, target): (start, end) = (-1, -1) (lo, hi) = (0, len(nums) - 1) while lo <= hi: mid = (lo + hi) // 2 if nums[mid] == target and (mid == 0 or nums[mid - 1] != target): start = mid break elif nums[mid] < target: lo = mid + 1 elif nums[mid] >= target: hi = mid - 1 if start == -1: return [-1, -1] (lo, hi) = (0, len(nums) - 1) while lo <= hi: mid = (lo + hi) // 2 if nums[mid] == target and (mid == len(nums) - 1 or nums[mid + 1] != target): end = mid break elif nums[mid] <= target: lo = mid + 1 elif nums[mid] > target: hi = mid - 1 if end == -1: return [-1, -1] return [start, end] print(search_range([5, 7, 7, 8, 8, 10], 8)) print(search_range([5, 7, 7, 8, 8, 10], 6)) print(search_range([5, 5, 5, 5, 6, 7], 5)) print(search_range([0, 1, 5, 5, 5, 5], 5))
start,end=input().split() edges=[("ab",1),("ac",1),("be",3),("cd",1),("de",1),("df",2),("eg",1),("fg",1),("ba",1),("ca",1),("eb",3),("dc",1),("ed",1),("fd",2),("ge",1),("gf",1)] paths=[(start,0)] while True: new_paths=paths for (path,T) in paths: for (edge,t) in edges: if path[-1]==edge[0] and edge[1] not in path: if (path+edge[1],T+t) not in new_paths: new_paths.append((path+edge[1],T+t)) if len(new_paths)!=len(paths): paths=new_paths else: break best_time=100 for (path,T) in paths: if path[-1]==end: if T<best_time: best_time=T best_path=path print(best_path)
(start, end) = input().split() edges = [('ab', 1), ('ac', 1), ('be', 3), ('cd', 1), ('de', 1), ('df', 2), ('eg', 1), ('fg', 1), ('ba', 1), ('ca', 1), ('eb', 3), ('dc', 1), ('ed', 1), ('fd', 2), ('ge', 1), ('gf', 1)] paths = [(start, 0)] while True: new_paths = paths for (path, t) in paths: for (edge, t) in edges: if path[-1] == edge[0] and edge[1] not in path: if (path + edge[1], T + t) not in new_paths: new_paths.append((path + edge[1], T + t)) if len(new_paths) != len(paths): paths = new_paths else: break best_time = 100 for (path, t) in paths: if path[-1] == end: if T < best_time: best_time = T best_path = path print(best_path)
# OpenWeatherMap API Key weather_api_key = "972fc242a771ca44611f48d634a9e967" # Google API Key g_key = "AIzaSyCWD-Z7WINc53d-5orJ46Zg3qVZN1UK0ho"
weather_api_key = '972fc242a771ca44611f48d634a9e967' g_key = 'AIzaSyCWD-Z7WINc53d-5orJ46Zg3qVZN1UK0ho'
class ListNode: def __init__(self,x): self.val = x self.next = None class Solution: def hasCycle(self,head): # type head: ListNode # rtype: bool fast, slow = head, head while fast and fast.next: fast = fast.next.next slow = slow.next if fast == slow: return True return False def buildLinkedList(self,s): # type s: integer array # rtype: ListNode if len(s) == 0: return None i = 1 head = ListNode(s[0]) run = head while i < len(s): node = ListNode(s[i]) run.next = node run = node i += 1 return head def printLinkedList(self,head): # type head: ListNode # rtype: None run = head while run != None: print(run.val) run = run.next s= [1,2] solution = Solution() s = solution.buildLinkedList(s) print(solution.hasCycle(s))
class Listnode: def __init__(self, x): self.val = x self.next = None class Solution: def has_cycle(self, head): (fast, slow) = (head, head) while fast and fast.next: fast = fast.next.next slow = slow.next if fast == slow: return True return False def build_linked_list(self, s): if len(s) == 0: return None i = 1 head = list_node(s[0]) run = head while i < len(s): node = list_node(s[i]) run.next = node run = node i += 1 return head def print_linked_list(self, head): run = head while run != None: print(run.val) run = run.next s = [1, 2] solution = solution() s = solution.buildLinkedList(s) print(solution.hasCycle(s))
class Solution: # @param A, a list of integer # @return an integer def singleNumber(self, A): num = A[0] for number in A[ 1 : ]: num = num ^ number return num
class Solution: def single_number(self, A): num = A[0] for number in A[1:]: num = num ^ number return num
def count_3_in_time(n): # 00:00:00 ~ n:59:59 count = 0 for hrs in range(0, n + 1): for min in range(0, 60): for sec in range(0, 60): if -1 != str(hrs).find('3') or -1 != str(min).find('3') or -1 != str(sec).find('3'): count += 1 return count def main(): n = int(input()) count = count_3_in_time(n) print(count) if __name__ == '__main__': main()
def count_3_in_time(n): count = 0 for hrs in range(0, n + 1): for min in range(0, 60): for sec in range(0, 60): if -1 != str(hrs).find('3') or -1 != str(min).find('3') or -1 != str(sec).find('3'): count += 1 return count def main(): n = int(input()) count = count_3_in_time(n) print(count) if __name__ == '__main__': main()
# Given a binary tree, return all root-to-leaf paths. # Note: A leaf is a node with no children. # Example: # Input: # 1 # / \ # 2 3 # \ # 5 # Output: ["1->2->5", "1->3"] # Explanation: All root-to-leaf paths are: 1->2->5, 1->3 # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def binaryTreePaths(self, root): """ :type root: TreeNode :rtype: List[str] """ # bfs if not root: return [] res, stack = [],[(root,"")] while stack: node, ans = stack.pop() if not node.left and not node.right: res.append(ans + str(node.val)) if node.left: stack.append((node.left, ans + str(node.val) + "->")) if node.right: stack.append((node.right, ans + str(node.val) + "->")) return res def binaryTreePaths2(self, root): """ :type root: TreeNode :rtype: List[str] """ # dfs if not root: return [] anslist = [] def dfs(root, ans = ""): ans += str(root.val) if not root.left and not root.right: anslist.append(ans) return ans += "->" if root.left: dfs(root.left, ans) if root.right: dfs(root.right, ans) dfs(root) return anslist # Time: O(m+n) # Space: O(m+n) # Difficulty: easy
class Solution(object): def binary_tree_paths(self, root): """ :type root: TreeNode :rtype: List[str] """ if not root: return [] (res, stack) = ([], [(root, '')]) while stack: (node, ans) = stack.pop() if not node.left and (not node.right): res.append(ans + str(node.val)) if node.left: stack.append((node.left, ans + str(node.val) + '->')) if node.right: stack.append((node.right, ans + str(node.val) + '->')) return res def binary_tree_paths2(self, root): """ :type root: TreeNode :rtype: List[str] """ if not root: return [] anslist = [] def dfs(root, ans=''): ans += str(root.val) if not root.left and (not root.right): anslist.append(ans) return ans += '->' if root.left: dfs(root.left, ans) if root.right: dfs(root.right, ans) dfs(root) return anslist
def last_index(pattern): wave_list = pattern.wave_list number_of_elements = len(wave_list) return number_of_elements
def last_index(pattern): wave_list = pattern.wave_list number_of_elements = len(wave_list) return number_of_elements
def code(st, syntax = ""): return f"```{syntax}\n{st}```" def md(st): return code(st, "md") def diff(st): return code(st, "diff")
def code(st, syntax=''): return f'```{syntax}\n{st}```' def md(st): return code(st, 'md') def diff(st): return code(st, 'diff')
class AuthStatusError(Exception): """ Auth status error """ pass
class Authstatuserror(Exception): """ Auth status error """ pass
def IDW(Z, b): """ Inverse distance weighted interpolation. Input Z: a list of lists where each element list contains four values: X, Y, Value, and Distance to target point. Z can also be a NumPy 2-D array. b: power of distance Output Estimated value at the target location. """ zw = 0.0 # sum of weighted z sw = 0.0 # sum of weights N = len(Z) # number of points in the data for i in range(N): d = Z[i][3] if d == 0: return Z[i][2] w = 1.0/d**b sw += w zw += w*Z[i][2] return zw/sw
def idw(Z, b): """ Inverse distance weighted interpolation. Input Z: a list of lists where each element list contains four values: X, Y, Value, and Distance to target point. Z can also be a NumPy 2-D array. b: power of distance Output Estimated value at the target location. """ zw = 0.0 sw = 0.0 n = len(Z) for i in range(N): d = Z[i][3] if d == 0: return Z[i][2] w = 1.0 / d ** b sw += w zw += w * Z[i][2] return zw / sw
""" Query ===== This is the query package. """
""" Query ===== This is the query package. """
def maxSum(a, b, k, n): a.sort() b.sort() i = 0 j = n - 1 while i < k: if (a[i] < b[j]): a[i], b[j] = b[j], a[i] else: break i += 1 j -= 1 sum = 0 for i in range (n): sum += a[i] return(sum) tc = int(input()) for i in range(tc): kn = input() l = list(kn.split(' ')) l = list(map(int,l)) #print(tc,kn,l) k = l[1] n = l[0] a1 = input() b1 = input() a = list(a1.split(' ')) b = list(b1.split(' ')) a = list(map(int,a)) b = list(map(int,b)) print(maxSum(a, b, k, n))
def max_sum(a, b, k, n): a.sort() b.sort() i = 0 j = n - 1 while i < k: if a[i] < b[j]: (a[i], b[j]) = (b[j], a[i]) else: break i += 1 j -= 1 sum = 0 for i in range(n): sum += a[i] return sum tc = int(input()) for i in range(tc): kn = input() l = list(kn.split(' ')) l = list(map(int, l)) k = l[1] n = l[0] a1 = input() b1 = input() a = list(a1.split(' ')) b = list(b1.split(' ')) a = list(map(int, a)) b = list(map(int, b)) print(max_sum(a, b, k, n))
def fib(n): first=0 second=1 overall=0 if n==0: return 0 elif n==1: return 1 else: for i in range(1,n): overall=second+first first=second second=overall return overall def productFib(num): n=1 append_array=[] while True: if fib(n)*fib(n-1)==num: append_array=[fib(n-1),fib(n),bool(True)] break; elif fib(n)*fib(n-1)>num: append_array=[fib(n-1),fib(n),bool(False)] break; n+=1 return(append_array)
def fib(n): first = 0 second = 1 overall = 0 if n == 0: return 0 elif n == 1: return 1 else: for i in range(1, n): overall = second + first first = second second = overall return overall def product_fib(num): n = 1 append_array = [] while True: if fib(n) * fib(n - 1) == num: append_array = [fib(n - 1), fib(n), bool(True)] break elif fib(n) * fib(n - 1) > num: append_array = [fib(n - 1), fib(n), bool(False)] break n += 1 return append_array
number = 600851475143 def isPrime(n): for i in range(2, n): if n % i == 0 and i != n: return False return True def LargestPrimeFactor(n): _n, lpf = n, 0 for i in range(2, n): if isPrime(i) and n % i == 0: _n, lpf = _n/i, i print(i, end=', ') if _n == 1: break print(lpf) return LargestPrimeFactor(number)
number = 600851475143 def is_prime(n): for i in range(2, n): if n % i == 0 and i != n: return False return True def largest_prime_factor(n): (_n, lpf) = (n, 0) for i in range(2, n): if is_prime(i) and n % i == 0: (_n, lpf) = (_n / i, i) print(i, end=', ') if _n == 1: break print(lpf) return largest_prime_factor(number)
""" This file provides all error codes for the program. """ ERR_OK = 0 WARN_OK = 0 ERR_MISSING_ARGUMENT = 100 ERR_MISMATCHED_FORMAT = 101 ERR_MISMATCHED_PLATFORM = 102 ERR_UNKNOWN_PLATFORM = 103 ERR_MISMATCHED_ARGUMENT = 104 ERR_UNKNOWN_ARGUMENT = 105 WARN_IMPLICIT_FORMAT = 200 WARN_MODULE_NOT_FOUND = 201 WARN_MOD_NOT_FOUND = 202 WARN_KEY_NOT_FOUND = 203 WARN_MAPPING_NOT_FOUND = 204 WARN_CORRUPTED_MAPPING = 205 WARN_DUPLICATED_FILE = 206 WARN_UNKNOWN_MOD_FILE = 207 WARN_BROKEN_MODULE = 250 WARN_UNKNOWN_MODULE = 251 WARN_LOOP_COLLECTION = 252 WARN_DEPRECATED_MODULE_CONTENT = 253 WARN_MISSING_CLASSIFIER = 254
""" This file provides all error codes for the program. """ err_ok = 0 warn_ok = 0 err_missing_argument = 100 err_mismatched_format = 101 err_mismatched_platform = 102 err_unknown_platform = 103 err_mismatched_argument = 104 err_unknown_argument = 105 warn_implicit_format = 200 warn_module_not_found = 201 warn_mod_not_found = 202 warn_key_not_found = 203 warn_mapping_not_found = 204 warn_corrupted_mapping = 205 warn_duplicated_file = 206 warn_unknown_mod_file = 207 warn_broken_module = 250 warn_unknown_module = 251 warn_loop_collection = 252 warn_deprecated_module_content = 253 warn_missing_classifier = 254
# Title : TODO # Objective : TODO # Created by: Wenzurk # Created on: 2018/2/5 # for value in range(1,5): # print(value) # for value in range(1,6): # print(value) numbers = list(range(1,6)) print(numbers)
numbers = list(range(1, 6)) print(numbers)
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : Jinyuan Sun # @Time : 2022/3/31 6:17 PM # @File : aa_index.py # @annotation : define properties of amino acids ALPHABET = "QWERTYIPASDFGHKLCVNM" hydrophobic_index = { 'R': -0.9, 'K': -0.889, 'D': -0.767, 'E': -0.696, 'N': -0.674, 'Q': -0.464, 'S': -0.364, 'G': -0.342, 'H': -0.271, 'T': -0.199, 'A': -0.171, 'P': 0.055, 'Y': 0.188, 'V': 0.331, 'M': 0.337, 'C': 0.508, 'L': 0.596, 'F': 0.646, 'I': 0.652, 'W': 0.9 } volume_index = { 'G': -0.9, 'A': -0.677, 'S': -0.544, 'C': -0.359, 'T': -0.321, 'P': -0.294, 'D': -0.281, 'N': -0.243, 'V': -0.232, 'E': -0.058, 'Q': -0.02, 'L': -0.009, 'I': -0.009, 'M': 0.087, 'H': 0.138, 'K': 0.163, 'F': 0.412, 'R': 0.466, 'Y': 0.541, 'W': 0.9 } helix_tendency = { 'P': -0.9, 'G': -0.9, 'C': -0.652, 'S': -0.466, 'T': -0.403, 'N': -0.403, 'Y': -0.155, 'D': -0.155, 'V': -0.031, 'H': -0.031, 'I': 0.155, 'F': 0.155, 'W': 0.279, 'K': 0.279, 'Q': 0.528, 'R': 0.528, 'M': 0.652, 'L': 0.714, 'E': 0.9, 'A': 0.9 } sheet_tendency = { 'G': -0.9, 'D': -0.635, 'E': -0.582, 'N': -0.529, 'A': -0.476, 'R': -0.371, 'Q': -0.371, 'K': -0.265, 'S': -0.212, 'H': -0.106, 'L': -0.053, 'M': -0.001, 'P': 0.106, 'T': 0.212, 'F': 0.318, 'C': 0.476, 'Y': 0.476, 'W': 0.529, 'I': 0.688, 'V': 0.9 } class_type_dict = { '_small': 'GAVSTC', '_large': 'FYWKRHQE', '_neg': 'DE', '_pos': 'RK', '_polar': 'YTSHKREDQN', '_non_charged_polar': 'YTSNQH', '_hydrophobic': 'FILVAGMW', '_cys': "C", '_pro': 'P', '_scan': 'ARNDCQEGHILKMFPSTWYV' }
alphabet = 'QWERTYIPASDFGHKLCVNM' hydrophobic_index = {'R': -0.9, 'K': -0.889, 'D': -0.767, 'E': -0.696, 'N': -0.674, 'Q': -0.464, 'S': -0.364, 'G': -0.342, 'H': -0.271, 'T': -0.199, 'A': -0.171, 'P': 0.055, 'Y': 0.188, 'V': 0.331, 'M': 0.337, 'C': 0.508, 'L': 0.596, 'F': 0.646, 'I': 0.652, 'W': 0.9} volume_index = {'G': -0.9, 'A': -0.677, 'S': -0.544, 'C': -0.359, 'T': -0.321, 'P': -0.294, 'D': -0.281, 'N': -0.243, 'V': -0.232, 'E': -0.058, 'Q': -0.02, 'L': -0.009, 'I': -0.009, 'M': 0.087, 'H': 0.138, 'K': 0.163, 'F': 0.412, 'R': 0.466, 'Y': 0.541, 'W': 0.9} helix_tendency = {'P': -0.9, 'G': -0.9, 'C': -0.652, 'S': -0.466, 'T': -0.403, 'N': -0.403, 'Y': -0.155, 'D': -0.155, 'V': -0.031, 'H': -0.031, 'I': 0.155, 'F': 0.155, 'W': 0.279, 'K': 0.279, 'Q': 0.528, 'R': 0.528, 'M': 0.652, 'L': 0.714, 'E': 0.9, 'A': 0.9} sheet_tendency = {'G': -0.9, 'D': -0.635, 'E': -0.582, 'N': -0.529, 'A': -0.476, 'R': -0.371, 'Q': -0.371, 'K': -0.265, 'S': -0.212, 'H': -0.106, 'L': -0.053, 'M': -0.001, 'P': 0.106, 'T': 0.212, 'F': 0.318, 'C': 0.476, 'Y': 0.476, 'W': 0.529, 'I': 0.688, 'V': 0.9} class_type_dict = {'_small': 'GAVSTC', '_large': 'FYWKRHQE', '_neg': 'DE', '_pos': 'RK', '_polar': 'YTSHKREDQN', '_non_charged_polar': 'YTSNQH', '_hydrophobic': 'FILVAGMW', '_cys': 'C', '_pro': 'P', '_scan': 'ARNDCQEGHILKMFPSTWYV'}
class DefaultTokenizer: def __init__(self, prefixes, suffixes, infixes, exceptions): self.prefixes = prefixes self.suffixes = suffixes self.infixes = infixes self.exceptions = exceptions def __call__(self, text: str): return text.split(" ")
class Defaulttokenizer: def __init__(self, prefixes, suffixes, infixes, exceptions): self.prefixes = prefixes self.suffixes = suffixes self.infixes = infixes self.exceptions = exceptions def __call__(self, text: str): return text.split(' ')
for i in range(1, 21): if i % 3 == 0: print("Fizz") else: print(i)
for i in range(1, 21): if i % 3 == 0: print('Fizz') else: print(i)
cutoff = 20 decision_cutoff = .25 model_path = 'ml/overwatch_messages.model' vectorizer_path = 'ml/overwatch_messages.vectorizer'
cutoff = 20 decision_cutoff = 0.25 model_path = 'ml/overwatch_messages.model' vectorizer_path = 'ml/overwatch_messages.vectorizer'
#!/usr/bin/env python # __author__ = "Ronie Martinez" # __copyright__ = "Copyright 2019-2020, Ronie Martinez" # __credits__ = ["Ronie Martinez"] # __maintainer__ = "Ronie Martinez" # __email__ = "ronmarti18@gmail.com" def calculate_amortization_amount(principal, interest_rate, period): """ Calculates Amortization Amount per period :param principal: Principal amount :param interest_rate: Interest rate per period :param period: Total number of periods :return: Amortization amount per period """ x = (1 + interest_rate) ** period return principal * (interest_rate * x) / (x - 1)
def calculate_amortization_amount(principal, interest_rate, period): """ Calculates Amortization Amount per period :param principal: Principal amount :param interest_rate: Interest rate per period :param period: Total number of periods :return: Amortization amount per period """ x = (1 + interest_rate) ** period return principal * (interest_rate * x) / (x - 1)
def clean_xml_indentation(element, level=0, spaces_per_level=2): """ copy and paste from http://effbot.org/zone/elementent-lib.htm#prettyprint it basically walks your tree and adds spaces and newlines so the tree is printed in a nice way """ i = "\n" + level*spaces_per_level*" " if len(element): if not element.text or not element.text.strip(): element.text = i + spaces_per_level*" " if not element.tail or not element.tail.strip(): element.tail = i for sub_element in element: clean_xml_indentation(sub_element, level+1, spaces_per_level) if not sub_element.tail or not sub_element.tail.strip(): sub_element.tail = i else: if level and (not element.tail or not element.tail.strip()): element.tail = i
def clean_xml_indentation(element, level=0, spaces_per_level=2): """ copy and paste from http://effbot.org/zone/elementent-lib.htm#prettyprint it basically walks your tree and adds spaces and newlines so the tree is printed in a nice way """ i = '\n' + level * spaces_per_level * ' ' if len(element): if not element.text or not element.text.strip(): element.text = i + spaces_per_level * ' ' if not element.tail or not element.tail.strip(): element.tail = i for sub_element in element: clean_xml_indentation(sub_element, level + 1, spaces_per_level) if not sub_element.tail or not sub_element.tail.strip(): sub_element.tail = i elif level and (not element.tail or not element.tail.strip()): element.tail = i
# -*- coding: utf-8 -*- """Top-level package for dsn_3000.""" __author__ = """Shannon-li""" __email__ = 'lishengchen@mingvale.com' __version__ = '0.1.0'
"""Top-level package for dsn_3000.""" __author__ = 'Shannon-li' __email__ = 'lishengchen@mingvale.com' __version__ = '0.1.0'
# # PySNMP MIB module Juniper-SUBSCRIBER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/JUNIPER-SUBSCRIBER-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:01:13 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsIntersection, SingleValueConstraint, ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint") InterfaceIndex, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex") juniMibs, = mibBuilder.importSymbols("Juniper-MIBs", "juniMibs") JuniEnable, = mibBuilder.importSymbols("Juniper-TC", "JuniEnable") NotificationGroup, ModuleCompliance, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance", "ObjectGroup") Counter64, NotificationType, Gauge32, IpAddress, iso, MibScalar, MibTable, MibTableRow, MibTableColumn, ModuleIdentity, TimeTicks, ObjectIdentity, Counter32, MibIdentifier, Integer32, Unsigned32, Bits = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "NotificationType", "Gauge32", "IpAddress", "iso", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ModuleIdentity", "TimeTicks", "ObjectIdentity", "Counter32", "MibIdentifier", "Integer32", "Unsigned32", "Bits") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") juniSubscriberMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49)) juniSubscriberMIB.setRevisions(('2002-09-16 21:44', '2002-05-10 19:53', '2000-11-16 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: juniSubscriberMIB.setRevisionsDescriptions(('Replaced Unisphere names with Juniper names.', 'Added local authentication support.', 'Initial version of this MIB module.',)) if mibBuilder.loadTexts: juniSubscriberMIB.setLastUpdated('200209162144Z') if mibBuilder.loadTexts: juniSubscriberMIB.setOrganization('Juniper Networks, Inc.') if mibBuilder.loadTexts: juniSubscriberMIB.setContactInfo(' Juniper Networks, Inc. Postal: 10 Technology Park Drive Westford, MA 01886-3146 USA Tel: +1 978 589 5800 Email: mib@Juniper.net') if mibBuilder.loadTexts: juniSubscriberMIB.setDescription('The Subscriber MIB for the Juniper Networks enterprise.') class JuniSubscrEncaps(TextualConvention, Integer32): description = 'Encapsulated protocol type.' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 19)) namedValues = NamedValues(("ip", 0), ("bridgedEthernet", 19)) juniSubscrObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1)) juniSubscrLocal = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1, 1)) juniSubscrLocalTable = MibTable((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1, 1, 1), ) if mibBuilder.loadTexts: juniSubscrLocalTable.setStatus('current') if mibBuilder.loadTexts: juniSubscrLocalTable.setDescription("Permits local configuration associating a remote subscriber's identity with a local interface, for use in circumstances where the remote subscriber's identity cannot be queried directly (e.g. dynamic IPoA operation).") juniSubscrLocalEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1, 1, 1, 1), ).setIndexNames((0, "Juniper-SUBSCRIBER-MIB", "juniSubscrLocalIfIndex"), (0, "Juniper-SUBSCRIBER-MIB", "juniSubscrLocalEncaps")) if mibBuilder.loadTexts: juniSubscrLocalEntry.setStatus('current') if mibBuilder.loadTexts: juniSubscrLocalEntry.setDescription("Local configuration associating a remote subscriber's identity with a local interface.") juniSubscrLocalIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1, 1, 1, 1, 1), InterfaceIndex()) if mibBuilder.loadTexts: juniSubscrLocalIfIndex.setStatus('current') if mibBuilder.loadTexts: juniSubscrLocalIfIndex.setDescription('The ifIndex of the interface to which this subscriber information applies.') juniSubscrLocalEncaps = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1, 1, 1, 1, 2), JuniSubscrEncaps()) if mibBuilder.loadTexts: juniSubscrLocalEncaps.setStatus('current') if mibBuilder.loadTexts: juniSubscrLocalEncaps.setDescription('The incoming data encapsulation to which this subscriber information applies. An interface may have a unique subscriber identity configured for each incoming data encapsulation it supports.') juniSubscrLocalControl = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("ok", 0), ("clear", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: juniSubscrLocalControl.setStatus('current') if mibBuilder.loadTexts: juniSubscrLocalControl.setDescription('When set to clear(1), causes the subscriber information in this entry to be cleared. When set to ok(0), there is no effect and subscriber information is unchanged. When read, always returns a value of ok(0). No other object in this entry can be set simultaneously, otherwise an InconsistentValue error is reported.') juniSubscrLocalNamePrefix = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1, 1, 1, 1, 4), JuniEnable()).setMaxAccess("readwrite") if mibBuilder.loadTexts: juniSubscrLocalNamePrefix.setStatus('current') if mibBuilder.loadTexts: juniSubscrLocalNamePrefix.setDescription('If enabled, indicates whether the value of juniSubscrLocalName is a prefix rather than a full name.') juniSubscrLocalName = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1, 1, 1, 1, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 31))).setMaxAccess("readwrite") if mibBuilder.loadTexts: juniSubscrLocalName.setStatus('current') if mibBuilder.loadTexts: juniSubscrLocalName.setDescription("The subscriber's name. If juniSubscrLocalNamePrefix has the value 'enabled', the value of this object serves as the prefix of a full subscriber name. The full name is constructed by appending local geographic information (slot, port, etc.) that uniquely distinguishes the subscriber.") juniSubscrLocalPasswordPrefix = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1, 1, 1, 1, 6), JuniEnable()).setMaxAccess("readwrite") if mibBuilder.loadTexts: juniSubscrLocalPasswordPrefix.setStatus('current') if mibBuilder.loadTexts: juniSubscrLocalPasswordPrefix.setDescription('If enabled, indicates whether the value of juniSubscrLocalPassword prefix rather than a full password.') juniSubscrLocalPassword = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1, 1, 1, 1, 7), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 31))).setMaxAccess("readwrite") if mibBuilder.loadTexts: juniSubscrLocalPassword.setStatus('current') if mibBuilder.loadTexts: juniSubscrLocalPassword.setDescription("The subscriber's password. If juniSubscrLocalPasswordPrefix has the value 'enabled', the value of this object serves as the prefix of a full subscriber password. The full password is constructed by appending local geographic information (slot, port, etc.) that uniquely distinguishes the subscriber.") juniSubscrLocalDomain = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1, 1, 1, 1, 8), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 31))).setMaxAccess("readwrite") if mibBuilder.loadTexts: juniSubscrLocalDomain.setStatus('current') if mibBuilder.loadTexts: juniSubscrLocalDomain.setDescription("The subscriber's domain.") juniSubscrLocalAuthentication = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1, 1, 1, 1, 9), JuniEnable().clone('enable')).setMaxAccess("readwrite") if mibBuilder.loadTexts: juniSubscrLocalAuthentication.setStatus('current') if mibBuilder.loadTexts: juniSubscrLocalAuthentication.setDescription('When enabled, the interface performs authentication with RADIUS server using the configured subscriber information and associated with the incoming data encapsulation (juniSubscriberLocalEncaps).') juniSubscriberMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 4)) juniSubscriberMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 4, 1)) juniSubscriberMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 4, 2)) juniSubscriberCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 4, 1, 1)).setObjects(("Juniper-SUBSCRIBER-MIB", "juniSubscriberLocalGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juniSubscriberCompliance = juniSubscriberCompliance.setStatus('obsolete') if mibBuilder.loadTexts: juniSubscriberCompliance.setDescription('Obsolete compliance statement for systems supporting subscriber operation. This statement became obsolete when local authentication support was added.') juniSubscriberCompliance2 = ModuleCompliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 4, 1, 2)).setObjects(("Juniper-SUBSCRIBER-MIB", "juniSubscriberLocalGroup2")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juniSubscriberCompliance2 = juniSubscriberCompliance2.setStatus('current') if mibBuilder.loadTexts: juniSubscriberCompliance2.setDescription('The compliance statement for systems supporting subscriber operation.') juniSubscriberLocalGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 4, 2, 1)).setObjects(("Juniper-SUBSCRIBER-MIB", "juniSubscrLocalControl"), ("Juniper-SUBSCRIBER-MIB", "juniSubscrLocalNamePrefix"), ("Juniper-SUBSCRIBER-MIB", "juniSubscrLocalName"), ("Juniper-SUBSCRIBER-MIB", "juniSubscrLocalPasswordPrefix"), ("Juniper-SUBSCRIBER-MIB", "juniSubscrLocalPassword"), ("Juniper-SUBSCRIBER-MIB", "juniSubscrLocalDomain")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juniSubscriberLocalGroup = juniSubscriberLocalGroup.setStatus('obsolete') if mibBuilder.loadTexts: juniSubscriberLocalGroup.setDescription('Obsolete basic collection of objects providing management of locally-configured subscriber identities in a Juniper product. This group became obsolete when local authentication support was added.') juniSubscriberLocalGroup2 = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 4, 2, 2)).setObjects(("Juniper-SUBSCRIBER-MIB", "juniSubscrLocalControl"), ("Juniper-SUBSCRIBER-MIB", "juniSubscrLocalNamePrefix"), ("Juniper-SUBSCRIBER-MIB", "juniSubscrLocalName"), ("Juniper-SUBSCRIBER-MIB", "juniSubscrLocalPasswordPrefix"), ("Juniper-SUBSCRIBER-MIB", "juniSubscrLocalPassword"), ("Juniper-SUBSCRIBER-MIB", "juniSubscrLocalDomain"), ("Juniper-SUBSCRIBER-MIB", "juniSubscrLocalAuthentication")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juniSubscriberLocalGroup2 = juniSubscriberLocalGroup2.setStatus('current') if mibBuilder.loadTexts: juniSubscriberLocalGroup2.setDescription('The basic collection of objects providing management of locally-configured subscriber identities in a Juniper product.') mibBuilder.exportSymbols("Juniper-SUBSCRIBER-MIB", juniSubscrLocalDomain=juniSubscrLocalDomain, juniSubscriberCompliance2=juniSubscriberCompliance2, juniSubscrLocalControl=juniSubscrLocalControl, PYSNMP_MODULE_ID=juniSubscriberMIB, juniSubscrLocalAuthentication=juniSubscrLocalAuthentication, juniSubscriberMIBCompliances=juniSubscriberMIBCompliances, JuniSubscrEncaps=JuniSubscrEncaps, juniSubscrLocalPasswordPrefix=juniSubscrLocalPasswordPrefix, juniSubscriberMIBConformance=juniSubscriberMIBConformance, juniSubscrLocal=juniSubscrLocal, juniSubscrObjects=juniSubscrObjects, juniSubscrLocalEntry=juniSubscrLocalEntry, juniSubscriberMIB=juniSubscriberMIB, juniSubscrLocalIfIndex=juniSubscrLocalIfIndex, juniSubscrLocalTable=juniSubscrLocalTable, juniSubscriberCompliance=juniSubscriberCompliance, juniSubscriberLocalGroup2=juniSubscriberLocalGroup2, juniSubscrLocalPassword=juniSubscrLocalPassword, juniSubscrLocalNamePrefix=juniSubscrLocalNamePrefix, juniSubscriberLocalGroup=juniSubscriberLocalGroup, juniSubscrLocalName=juniSubscrLocalName, juniSubscriberMIBGroups=juniSubscriberMIBGroups, juniSubscrLocalEncaps=juniSubscrLocalEncaps)
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, single_value_constraint, value_size_constraint, constraints_union, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'SingleValueConstraint', 'ValueSizeConstraint', 'ConstraintsUnion', 'ValueRangeConstraint') (interface_index,) = mibBuilder.importSymbols('IF-MIB', 'InterfaceIndex') (juni_mibs,) = mibBuilder.importSymbols('Juniper-MIBs', 'juniMibs') (juni_enable,) = mibBuilder.importSymbols('Juniper-TC', 'JuniEnable') (notification_group, module_compliance, object_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance', 'ObjectGroup') (counter64, notification_type, gauge32, ip_address, iso, mib_scalar, mib_table, mib_table_row, mib_table_column, module_identity, time_ticks, object_identity, counter32, mib_identifier, integer32, unsigned32, bits) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter64', 'NotificationType', 'Gauge32', 'IpAddress', 'iso', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ModuleIdentity', 'TimeTicks', 'ObjectIdentity', 'Counter32', 'MibIdentifier', 'Integer32', 'Unsigned32', 'Bits') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') juni_subscriber_mib = module_identity((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49)) juniSubscriberMIB.setRevisions(('2002-09-16 21:44', '2002-05-10 19:53', '2000-11-16 00:00')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: juniSubscriberMIB.setRevisionsDescriptions(('Replaced Unisphere names with Juniper names.', 'Added local authentication support.', 'Initial version of this MIB module.')) if mibBuilder.loadTexts: juniSubscriberMIB.setLastUpdated('200209162144Z') if mibBuilder.loadTexts: juniSubscriberMIB.setOrganization('Juniper Networks, Inc.') if mibBuilder.loadTexts: juniSubscriberMIB.setContactInfo(' Juniper Networks, Inc. Postal: 10 Technology Park Drive Westford, MA 01886-3146 USA Tel: +1 978 589 5800 Email: mib@Juniper.net') if mibBuilder.loadTexts: juniSubscriberMIB.setDescription('The Subscriber MIB for the Juniper Networks enterprise.') class Junisubscrencaps(TextualConvention, Integer32): description = 'Encapsulated protocol type.' status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 19)) named_values = named_values(('ip', 0), ('bridgedEthernet', 19)) juni_subscr_objects = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1)) juni_subscr_local = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1, 1)) juni_subscr_local_table = mib_table((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1, 1, 1)) if mibBuilder.loadTexts: juniSubscrLocalTable.setStatus('current') if mibBuilder.loadTexts: juniSubscrLocalTable.setDescription("Permits local configuration associating a remote subscriber's identity with a local interface, for use in circumstances where the remote subscriber's identity cannot be queried directly (e.g. dynamic IPoA operation).") juni_subscr_local_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1, 1, 1, 1)).setIndexNames((0, 'Juniper-SUBSCRIBER-MIB', 'juniSubscrLocalIfIndex'), (0, 'Juniper-SUBSCRIBER-MIB', 'juniSubscrLocalEncaps')) if mibBuilder.loadTexts: juniSubscrLocalEntry.setStatus('current') if mibBuilder.loadTexts: juniSubscrLocalEntry.setDescription("Local configuration associating a remote subscriber's identity with a local interface.") juni_subscr_local_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1, 1, 1, 1, 1), interface_index()) if mibBuilder.loadTexts: juniSubscrLocalIfIndex.setStatus('current') if mibBuilder.loadTexts: juniSubscrLocalIfIndex.setDescription('The ifIndex of the interface to which this subscriber information applies.') juni_subscr_local_encaps = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1, 1, 1, 1, 2), juni_subscr_encaps()) if mibBuilder.loadTexts: juniSubscrLocalEncaps.setStatus('current') if mibBuilder.loadTexts: juniSubscrLocalEncaps.setDescription('The incoming data encapsulation to which this subscriber information applies. An interface may have a unique subscriber identity configured for each incoming data encapsulation it supports.') juni_subscr_local_control = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1, 1, 1, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('ok', 0), ('clear', 1)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: juniSubscrLocalControl.setStatus('current') if mibBuilder.loadTexts: juniSubscrLocalControl.setDescription('When set to clear(1), causes the subscriber information in this entry to be cleared. When set to ok(0), there is no effect and subscriber information is unchanged. When read, always returns a value of ok(0). No other object in this entry can be set simultaneously, otherwise an InconsistentValue error is reported.') juni_subscr_local_name_prefix = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1, 1, 1, 1, 4), juni_enable()).setMaxAccess('readwrite') if mibBuilder.loadTexts: juniSubscrLocalNamePrefix.setStatus('current') if mibBuilder.loadTexts: juniSubscrLocalNamePrefix.setDescription('If enabled, indicates whether the value of juniSubscrLocalName is a prefix rather than a full name.') juni_subscr_local_name = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1, 1, 1, 1, 5), display_string().subtype(subtypeSpec=value_size_constraint(0, 31))).setMaxAccess('readwrite') if mibBuilder.loadTexts: juniSubscrLocalName.setStatus('current') if mibBuilder.loadTexts: juniSubscrLocalName.setDescription("The subscriber's name. If juniSubscrLocalNamePrefix has the value 'enabled', the value of this object serves as the prefix of a full subscriber name. The full name is constructed by appending local geographic information (slot, port, etc.) that uniquely distinguishes the subscriber.") juni_subscr_local_password_prefix = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1, 1, 1, 1, 6), juni_enable()).setMaxAccess('readwrite') if mibBuilder.loadTexts: juniSubscrLocalPasswordPrefix.setStatus('current') if mibBuilder.loadTexts: juniSubscrLocalPasswordPrefix.setDescription('If enabled, indicates whether the value of juniSubscrLocalPassword prefix rather than a full password.') juni_subscr_local_password = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1, 1, 1, 1, 7), display_string().subtype(subtypeSpec=value_size_constraint(0, 31))).setMaxAccess('readwrite') if mibBuilder.loadTexts: juniSubscrLocalPassword.setStatus('current') if mibBuilder.loadTexts: juniSubscrLocalPassword.setDescription("The subscriber's password. If juniSubscrLocalPasswordPrefix has the value 'enabled', the value of this object serves as the prefix of a full subscriber password. The full password is constructed by appending local geographic information (slot, port, etc.) that uniquely distinguishes the subscriber.") juni_subscr_local_domain = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1, 1, 1, 1, 8), display_string().subtype(subtypeSpec=value_size_constraint(0, 31))).setMaxAccess('readwrite') if mibBuilder.loadTexts: juniSubscrLocalDomain.setStatus('current') if mibBuilder.loadTexts: juniSubscrLocalDomain.setDescription("The subscriber's domain.") juni_subscr_local_authentication = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 1, 1, 1, 1, 9), juni_enable().clone('enable')).setMaxAccess('readwrite') if mibBuilder.loadTexts: juniSubscrLocalAuthentication.setStatus('current') if mibBuilder.loadTexts: juniSubscrLocalAuthentication.setDescription('When enabled, the interface performs authentication with RADIUS server using the configured subscriber information and associated with the incoming data encapsulation (juniSubscriberLocalEncaps).') juni_subscriber_mib_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 4)) juni_subscriber_mib_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 4, 1)) juni_subscriber_mib_groups = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 4, 2)) juni_subscriber_compliance = module_compliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 4, 1, 1)).setObjects(('Juniper-SUBSCRIBER-MIB', 'juniSubscriberLocalGroup')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juni_subscriber_compliance = juniSubscriberCompliance.setStatus('obsolete') if mibBuilder.loadTexts: juniSubscriberCompliance.setDescription('Obsolete compliance statement for systems supporting subscriber operation. This statement became obsolete when local authentication support was added.') juni_subscriber_compliance2 = module_compliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 4, 1, 2)).setObjects(('Juniper-SUBSCRIBER-MIB', 'juniSubscriberLocalGroup2')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juni_subscriber_compliance2 = juniSubscriberCompliance2.setStatus('current') if mibBuilder.loadTexts: juniSubscriberCompliance2.setDescription('The compliance statement for systems supporting subscriber operation.') juni_subscriber_local_group = object_group((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 4, 2, 1)).setObjects(('Juniper-SUBSCRIBER-MIB', 'juniSubscrLocalControl'), ('Juniper-SUBSCRIBER-MIB', 'juniSubscrLocalNamePrefix'), ('Juniper-SUBSCRIBER-MIB', 'juniSubscrLocalName'), ('Juniper-SUBSCRIBER-MIB', 'juniSubscrLocalPasswordPrefix'), ('Juniper-SUBSCRIBER-MIB', 'juniSubscrLocalPassword'), ('Juniper-SUBSCRIBER-MIB', 'juniSubscrLocalDomain')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juni_subscriber_local_group = juniSubscriberLocalGroup.setStatus('obsolete') if mibBuilder.loadTexts: juniSubscriberLocalGroup.setDescription('Obsolete basic collection of objects providing management of locally-configured subscriber identities in a Juniper product. This group became obsolete when local authentication support was added.') juni_subscriber_local_group2 = object_group((1, 3, 6, 1, 4, 1, 4874, 2, 2, 49, 4, 2, 2)).setObjects(('Juniper-SUBSCRIBER-MIB', 'juniSubscrLocalControl'), ('Juniper-SUBSCRIBER-MIB', 'juniSubscrLocalNamePrefix'), ('Juniper-SUBSCRIBER-MIB', 'juniSubscrLocalName'), ('Juniper-SUBSCRIBER-MIB', 'juniSubscrLocalPasswordPrefix'), ('Juniper-SUBSCRIBER-MIB', 'juniSubscrLocalPassword'), ('Juniper-SUBSCRIBER-MIB', 'juniSubscrLocalDomain'), ('Juniper-SUBSCRIBER-MIB', 'juniSubscrLocalAuthentication')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juni_subscriber_local_group2 = juniSubscriberLocalGroup2.setStatus('current') if mibBuilder.loadTexts: juniSubscriberLocalGroup2.setDescription('The basic collection of objects providing management of locally-configured subscriber identities in a Juniper product.') mibBuilder.exportSymbols('Juniper-SUBSCRIBER-MIB', juniSubscrLocalDomain=juniSubscrLocalDomain, juniSubscriberCompliance2=juniSubscriberCompliance2, juniSubscrLocalControl=juniSubscrLocalControl, PYSNMP_MODULE_ID=juniSubscriberMIB, juniSubscrLocalAuthentication=juniSubscrLocalAuthentication, juniSubscriberMIBCompliances=juniSubscriberMIBCompliances, JuniSubscrEncaps=JuniSubscrEncaps, juniSubscrLocalPasswordPrefix=juniSubscrLocalPasswordPrefix, juniSubscriberMIBConformance=juniSubscriberMIBConformance, juniSubscrLocal=juniSubscrLocal, juniSubscrObjects=juniSubscrObjects, juniSubscrLocalEntry=juniSubscrLocalEntry, juniSubscriberMIB=juniSubscriberMIB, juniSubscrLocalIfIndex=juniSubscrLocalIfIndex, juniSubscrLocalTable=juniSubscrLocalTable, juniSubscriberCompliance=juniSubscriberCompliance, juniSubscriberLocalGroup2=juniSubscriberLocalGroup2, juniSubscrLocalPassword=juniSubscrLocalPassword, juniSubscrLocalNamePrefix=juniSubscrLocalNamePrefix, juniSubscriberLocalGroup=juniSubscriberLocalGroup, juniSubscrLocalName=juniSubscrLocalName, juniSubscriberMIBGroups=juniSubscriberMIBGroups, juniSubscrLocalEncaps=juniSubscrLocalEncaps)
#input # 69 237 245 22 97 105 68 243 232 209 177 72 161 199 237 218 206 122 209 100 79 226 195 202 160 238 106 99 118 57 68 68 53 65 240 230 160 99 208 64 118 210 232 244 119 178 69 224 146 87 104 237 232 204 227 75 65 162 90 75 64 133 75 225 238 160 204 54 14 196 121 78 72 240 89 237 145 108 244 179 102 54 32 160 53 82 160 248 238 180 72 66 253 113 103 78 121 237 116 160 46 def decode(seq): if len(seq) == 8: seq = '0b' + seq[1:] char = chr(int(seq,2)) return char encoded_sequence = [int(x) for x in input().split()] for c in encoded_sequence: binc = (bin(c))[2:] num_of_bits = binc.count('1') if num_of_bits % 2 == 0: decoded_character = decode(binc) print(decoded_character, end="")
def decode(seq): if len(seq) == 8: seq = '0b' + seq[1:] char = chr(int(seq, 2)) return char encoded_sequence = [int(x) for x in input().split()] for c in encoded_sequence: binc = bin(c)[2:] num_of_bits = binc.count('1') if num_of_bits % 2 == 0: decoded_character = decode(binc) print(decoded_character, end='')
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def mergeTwoLists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -> Optional[ListNode]: # root and current node cur = root = ListNode(0) # merge process while list1 and list2: if list1.val <= list2.val: item = list1.val list1 = list1.next elif list1.val > list2.val: item = list2.val list2 = list2.next cur.next = ListNode(item) cur = cur.next cur.next = list1 or list2 return root.next
class Solution: def merge_two_lists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -> Optional[ListNode]: cur = root = list_node(0) while list1 and list2: if list1.val <= list2.val: item = list1.val list1 = list1.next elif list1.val > list2.val: item = list2.val list2 = list2.next cur.next = list_node(item) cur = cur.next cur.next = list1 or list2 return root.next
def proc(command, message): return { "data": { "text": "Your command was not recognised. Type 'help' to read the list of all available commands." }, "response_required": True }
def proc(command, message): return {'data': {'text': "Your command was not recognised. Type 'help' to read the list of all available commands."}, 'response_required': True}
A, B, C = input().split() A = int(A) B = int(B) C = int(C) if(A < B and A < C and B < C): a = C b = B c = A elif(A < B and A < C and C < B): a = B b = C c = A elif(B < A and B < C and A < C): a = C b = A c = B elif(B < A and B < C and C < A): a = A b = C c = B elif(C < A and C < B and A < B): a = B b = A c = C elif(C < A and C < B and B < A): a = A b = B c = C elif(A == B and A < C): a = C b = A c = A elif(A == B and C < A): a = A b = A c = C elif(A == C and A < B): a = B b = A c = A elif(A == C and B < A): a = A b = B c = A elif(B == C and B < A): a = A b = B c = B elif(B == C and A < B): a = B b = A c = B else: a = A b = B c = C if(a >= b + c): print("Invalido") exit() elif(a == b and b == c): print("Valido-Equilatero") elif(a == b or a == c or b == c): print("Valido-Isoceles") else: print("Valido-Escaleno") if(((a * a) == b * b + c * c) == True): print("Retangulo: S") else: print("Retangulo: N")
(a, b, c) = input().split() a = int(A) b = int(B) c = int(C) if A < B and A < C and (B < C): a = C b = B c = A elif A < B and A < C and (C < B): a = B b = C c = A elif B < A and B < C and (A < C): a = C b = A c = B elif B < A and B < C and (C < A): a = A b = C c = B elif C < A and C < B and (A < B): a = B b = A c = C elif C < A and C < B and (B < A): a = A b = B c = C elif A == B and A < C: a = C b = A c = A elif A == B and C < A: a = A b = A c = C elif A == C and A < B: a = B b = A c = A elif A == C and B < A: a = A b = B c = A elif B == C and B < A: a = A b = B c = B elif B == C and A < B: a = B b = A c = B else: a = A b = B c = C if a >= b + c: print('Invalido') exit() elif a == b and b == c: print('Valido-Equilatero') elif a == b or a == c or b == c: print('Valido-Isoceles') else: print('Valido-Escaleno') if (a * a == b * b + c * c) == True: print('Retangulo: S') else: print('Retangulo: N')
"""Ordered List impelementation.""" class Node(object): """Node class.""" def __init__(self, initdata=None): """Initialization.""" self.data = initdata self.next = None def getData(self): """Get node's data.""" return self.data def setData(self, data): """Set node's data.""" self.data = data def getNext(self): """Get next node.""" return self.next def setNext(self, node): """Set next node.""" self.next = node class OrderedList(object): """Ordered List.""" def __init__(self): self.head = None def add(self, item): """Adds new item to list ensuring order is preserved.""" """ :type item: Node() :rtype None """ node = Node(item) if self.head == None or self.head.getData() > node.getData(): node.setNext(self.head) self.head = node return prev = self.head curr = self.head while curr: if curr.getData() > node.getData(): prev.setNext(node) node.setNext(curr) return prev = curr curr = curr.getNext() # Add to the end prev.setNext(node) def remove(self, item): """Removes the item from the list. Assumes item is present.""" """ :type item: Node() :rtype None """ if self.head.getData() == item: self.head = self.head.getNext() return prev = curr = self.head while curr: if curr.getData() == item: prev.setNext(curr.getNext()) break prev = curr curr = curr.getNext() def search(self, item): """Searches for the item in the list.""" """ :type item: Node() :rtype Boolean """ curr = self.head while curr: if curr.getData() == item: return True curr = curr.getNext() return False def isEmpty(self): """Tests to see if the list is empty.""" """ :type None :rtype Boolean """ return self.head == None def size(self): """Returns the number of items in the list.""" """ :type None :rtype int """ curr = self.head count = 0 while curr: count += 1 curr = curr.getNext() return count def index(self, item): """Returns the position of the item in the list.""" """ :type item: Node :rtype int """ curr = self.head idx = 0 while curr: if item == curr.getData(): break idx += 1 curr = curr.getNext() return idx def pop(self, pos=None): """Removes and returns the item. Position is optional and returns the last item if undefined.""" """ :type pos: int (optional) :rtype item: Node() """ if pos == None: pos = self.size() - 1 if pos == 0: temp = self.head self.head = self.head.getNext() return temp.getData() prev = curr = self.head for idx in range(self.size()): if idx == pos: prev.setNext(curr.getNext()) return curr.getData() prev = curr curr = curr.getNext() def print(self): curr = self.head while curr: print("%d" % curr.getData(), end=" ") curr = curr.getNext() print('\n--------------------------------') if __name__ == "__main__": orderedList = OrderedList() assert(orderedList.isEmpty()) assert(orderedList.size() == 0) orderedList.add(5) orderedList.add(1) orderedList.add(10) orderedList.add(-10) assert(orderedList.index(-10) == 0) orderedList.add(7) orderedList.add(70) assert(orderedList.index(70) == 5) assert(orderedList.size() == 6) orderedList.print() orderedList.remove(-10) orderedList.remove(70) orderedList.remove(7) assert(orderedList.size() == 3) orderedList.print() assert(not orderedList.search(-10)) assert(not orderedList.search(70)) assert(not orderedList.search(7)) assert(orderedList.search(1)) assert(orderedList.search(5)) orderedList.add(70) assert(orderedList.search(70)) orderedList.remove(70) assert(not orderedList.search(70)) assert(not orderedList.isEmpty()) assert(orderedList.size() == 3) assert(orderedList.index(1) == 0) assert(orderedList.index(5) == 1) assert(orderedList.index(10) == 2) assert(orderedList.pop(0) == 1) assert(orderedList.size() == 2) assert(orderedList.pop() == 10) assert(orderedList.size() == 1) assert(orderedList.pop() == 5) assert(orderedList.isEmpty()) orderedList.add(1) orderedList.add(100) orderedList.add(1000) assert(orderedList.pop() == 1000) assert(orderedList.pop() == 100) assert(orderedList.pop() == 1)
"""Ordered List impelementation.""" class Node(object): """Node class.""" def __init__(self, initdata=None): """Initialization.""" self.data = initdata self.next = None def get_data(self): """Get node's data.""" return self.data def set_data(self, data): """Set node's data.""" self.data = data def get_next(self): """Get next node.""" return self.next def set_next(self, node): """Set next node.""" self.next = node class Orderedlist(object): """Ordered List.""" def __init__(self): self.head = None def add(self, item): """Adds new item to list ensuring order is preserved.""" '\n :type item: Node()\n :rtype None\n ' node = node(item) if self.head == None or self.head.getData() > node.getData(): node.setNext(self.head) self.head = node return prev = self.head curr = self.head while curr: if curr.getData() > node.getData(): prev.setNext(node) node.setNext(curr) return prev = curr curr = curr.getNext() prev.setNext(node) def remove(self, item): """Removes the item from the list. Assumes item is present.""" '\n :type item: Node()\n :rtype None\n ' if self.head.getData() == item: self.head = self.head.getNext() return prev = curr = self.head while curr: if curr.getData() == item: prev.setNext(curr.getNext()) break prev = curr curr = curr.getNext() def search(self, item): """Searches for the item in the list.""" '\n :type item: Node()\n :rtype Boolean\n ' curr = self.head while curr: if curr.getData() == item: return True curr = curr.getNext() return False def is_empty(self): """Tests to see if the list is empty.""" '\n :type None\n :rtype Boolean\n ' return self.head == None def size(self): """Returns the number of items in the list.""" '\n :type None\n :rtype int\n ' curr = self.head count = 0 while curr: count += 1 curr = curr.getNext() return count def index(self, item): """Returns the position of the item in the list.""" '\n :type item: Node\n :rtype int\n ' curr = self.head idx = 0 while curr: if item == curr.getData(): break idx += 1 curr = curr.getNext() return idx def pop(self, pos=None): """Removes and returns the item. Position is optional and returns the last item if undefined.""" '\n :type pos: int (optional) \n :rtype item: Node()\n ' if pos == None: pos = self.size() - 1 if pos == 0: temp = self.head self.head = self.head.getNext() return temp.getData() prev = curr = self.head for idx in range(self.size()): if idx == pos: prev.setNext(curr.getNext()) return curr.getData() prev = curr curr = curr.getNext() def print(self): curr = self.head while curr: print('%d' % curr.getData(), end=' ') curr = curr.getNext() print('\n--------------------------------') if __name__ == '__main__': ordered_list = ordered_list() assert orderedList.isEmpty() assert orderedList.size() == 0 orderedList.add(5) orderedList.add(1) orderedList.add(10) orderedList.add(-10) assert orderedList.index(-10) == 0 orderedList.add(7) orderedList.add(70) assert orderedList.index(70) == 5 assert orderedList.size() == 6 orderedList.print() orderedList.remove(-10) orderedList.remove(70) orderedList.remove(7) assert orderedList.size() == 3 orderedList.print() assert not orderedList.search(-10) assert not orderedList.search(70) assert not orderedList.search(7) assert orderedList.search(1) assert orderedList.search(5) orderedList.add(70) assert orderedList.search(70) orderedList.remove(70) assert not orderedList.search(70) assert not orderedList.isEmpty() assert orderedList.size() == 3 assert orderedList.index(1) == 0 assert orderedList.index(5) == 1 assert orderedList.index(10) == 2 assert orderedList.pop(0) == 1 assert orderedList.size() == 2 assert orderedList.pop() == 10 assert orderedList.size() == 1 assert orderedList.pop() == 5 assert orderedList.isEmpty() orderedList.add(1) orderedList.add(100) orderedList.add(1000) assert orderedList.pop() == 1000 assert orderedList.pop() == 100 assert orderedList.pop() == 1
for _ in range(int(input())): s = input() f,l,r = 0,0,0 for i in range(len(s) - 1): if(s[i] == s[i + 1]): f = 1 l = i break for i in range(len(s) - 1,0,-1): if(s[i] == s[i - 1]): # print(i) f = 1 r = i break if s[0] == s[len(s) - 1]: f = 1 if f == 0:print('yes') elif(len(s) % 2 != 0): print('no') else: r,g = 0,0 for i in range(len(s) - 1): if(s[i] == s[i + 1] and s[i] == 'R'): r += 1 if(s[i] == s[i + 1] and s[i] == "G"): g += 1 if(s[0] == s[len(s) - 1] and s[0] == "R"): # print('R') r += 1 if(s[0] == s[len(s) - 1] and s[0] == 'G'): # print(s[0],s[len(s) - 1]) # print('G') g += 1 # print(r,g) if(r < 2 and g < 2 ):print('yes') else :print('no') # # print(l,r) # temp1 = s[:l + 1:] # temp2 = s[l+1:r:] # temp3 = s[r::] # print(temp1, temp2, temp3) # temp = s[:l + 1:] + temp2[::-1] + s[r::] # # print(temp) # f1,f2 = 0,0 # for i in range(len(temp) - 1): # if(temp[i] == temp[i + 1]): f1 = 1 # if(temp[0] == temp[len(temp) - 1]):f1 = 1 # temp = temp3[::-1] + temp2 + temp1[::-1] # # print(temp) # for i in range(len(temp) - 1): # if(temp[i] == temp[i + 1]): f2 = 1 # if(temp[0] == temp[len(temp) - 1]):f2 = 1 # print('yes') if f1 == 0 or f2 == 0 else print('no')
for _ in range(int(input())): s = input() (f, l, r) = (0, 0, 0) for i in range(len(s) - 1): if s[i] == s[i + 1]: f = 1 l = i break for i in range(len(s) - 1, 0, -1): if s[i] == s[i - 1]: f = 1 r = i break if s[0] == s[len(s) - 1]: f = 1 if f == 0: print('yes') elif len(s) % 2 != 0: print('no') else: (r, g) = (0, 0) for i in range(len(s) - 1): if s[i] == s[i + 1] and s[i] == 'R': r += 1 if s[i] == s[i + 1] and s[i] == 'G': g += 1 if s[0] == s[len(s) - 1] and s[0] == 'R': r += 1 if s[0] == s[len(s) - 1] and s[0] == 'G': g += 1 if r < 2 and g < 2: print('yes') else: print('no')
""" tells the bot to join the [params] channel """ class Command: owner_command = True def run(self): self.response = f"attempting to join {self.params}" self.raw_send = "JOIN " + self.params
""" tells the bot to join the [params] channel """ class Command: owner_command = True def run(self): self.response = f'attempting to join {self.params}' self.raw_send = 'JOIN ' + self.params
def solution(n, delivery): answer = '' ans_list = [] for i in range(n): ans_list.append('?') for de in delivery: if(de[2] == 1): ans_list[de[0] -1] = 'O' ans_list[de[1] -1] = 'O' for de in delivery: if(de[2] == 0): if(ans_list[de[0] -1 ] == 'O'): ans_list[de[1] - 1] = 'X' elif(ans_list[de[1] -1] == 'O'): ans_list[de[0] - 1] = 'X' for i in range(n): answer += ans_list[i] return answer a = solution(7,[[5,6,0],[1,3,1],[1,5,0],[7,6,0],[3,7,1],[2,5,0]]) print (a)
def solution(n, delivery): answer = '' ans_list = [] for i in range(n): ans_list.append('?') for de in delivery: if de[2] == 1: ans_list[de[0] - 1] = 'O' ans_list[de[1] - 1] = 'O' for de in delivery: if de[2] == 0: if ans_list[de[0] - 1] == 'O': ans_list[de[1] - 1] = 'X' elif ans_list[de[1] - 1] == 'O': ans_list[de[0] - 1] = 'X' for i in range(n): answer += ans_list[i] return answer a = solution(7, [[5, 6, 0], [1, 3, 1], [1, 5, 0], [7, 6, 0], [3, 7, 1], [2, 5, 0]]) print(a)
# def summation(num): # pos = 0 # while (num > 0): # pos += num # print(pos) # num -= 1 # print(num) # return pos # # Code here def summation(num): pos = 0 for num in range(1,num + 1): pos += num print(num) return pos # Code here num = int(input("Write number = ")) print(summation(num))
def summation(num): pos = 0 for num in range(1, num + 1): pos += num print(num) return pos num = int(input('Write number = ')) print(summation(num))
def somar(a=0,b=0,c=0): s=a+b+c return s def main(): #print(somar(3,4,5)) r1 = somar(3,4,5) r2 = somar(1,7) r3 = somar(4) print('RESULTADOS: ',r1,r2,r3) main()
def somar(a=0, b=0, c=0): s = a + b + c return s def main(): r1 = somar(3, 4, 5) r2 = somar(1, 7) r3 = somar(4) print('RESULTADOS: ', r1, r2, r3) main()
def tf_io_copts(): return ( [ "-std=c++11", "-DNDEBUG", ] + select({ "@bazel_tools//src/conditions:darwin": [], "//conditions:default": ["-pthread"] }) )
def tf_io_copts(): return ['-std=c++11', '-DNDEBUG'] + select({'@bazel_tools//src/conditions:darwin': [], '//conditions:default': ['-pthread']})
def nb_post_fix(rtl_log_f,rtl_log,nb_log): ''' Replaces non-blocking load results in rd of trace log. Sees time/CycleCnt at which non-block load is written back to gpr, checks from that time/CycleCnt backwards, where this gpr was written in trace log, replaces the result in rd (also load) at that instruction''' nb_file = open(nb_log,"r") load_lines = nb_file.readlines() #read whole file trace_file = open(rtl_log,"r") trace_lines = trace_file.readlines() list1 = [] list2 = [] x = 1 for i in range(len(load_lines)): l= load_lines[i].split() list1.append(l) for i in range(len(trace_lines)): l2 = trace_lines[i].split() list2.append(l2) #flow with trace log read as whole # find and replace the non-block load instruction reg i = 1 while (x < len(load_lines)): try: t = list1[x][0] except IndexError: break if(int(list1[x][0])<=int(list2[i][0])): for a in range(i,i-20,-1): try: t = list2[a][5].split(',') except IndexError: continue try: t = list2[a][10].split(':') except IndexError: continue if(list1[x][2]==list2[a][5].split(',')[0] and (list2[a][10].split(':')[0]=="load") ): list2[a][7]=("%s=0x%s" %(list1[x][2],list1[x][3])) list2[a][10]=("load:0x%s" %(list1[x][3])) #print(str('\t'.join(list2[a]))) i=a+1 break x+=1 i+=1 #update trace lines for i in range(len(trace_lines)): list2[i]='\t'.join(list2[i]) trace_lines[i]=str(list2[i]+'\n') #writing back lines nb_file = open(rtl_log_f,"w") nb_file.writelines(trace_lines) def main(): parser = argparse.ArgumentParser() parser.add_argument("--rtl_log_f", help="Output core simulation log post-fixed (default: stdout)", type=argparse.FileType('w'), default=sys.stdout) parser.add_argument("--nb_log", help="Input core simulation log (default: stdin)", type=argparse.FileType('r'), default=sys.stdin) parser.add_argument("--rtl_log", help="Input core simulation log (default: stdin)", type=argparse.FileType('r'), default=sys.stdin) args = parser.parse_args() print("Post-fix log for nonblock load values\n") nb_post_fix(args.rtl_log_f, args.rtl_log, args.nb_log) if __name__ == "__main__": main()
def nb_post_fix(rtl_log_f, rtl_log, nb_log): """ Replaces non-blocking load results in rd of trace log. Sees time/CycleCnt at which non-block load is written back to gpr, checks from that time/CycleCnt backwards, where this gpr was written in trace log, replaces the result in rd (also load) at that instruction""" nb_file = open(nb_log, 'r') load_lines = nb_file.readlines() trace_file = open(rtl_log, 'r') trace_lines = trace_file.readlines() list1 = [] list2 = [] x = 1 for i in range(len(load_lines)): l = load_lines[i].split() list1.append(l) for i in range(len(trace_lines)): l2 = trace_lines[i].split() list2.append(l2) i = 1 while x < len(load_lines): try: t = list1[x][0] except IndexError: break if int(list1[x][0]) <= int(list2[i][0]): for a in range(i, i - 20, -1): try: t = list2[a][5].split(',') except IndexError: continue try: t = list2[a][10].split(':') except IndexError: continue if list1[x][2] == list2[a][5].split(',')[0] and list2[a][10].split(':')[0] == 'load': list2[a][7] = '%s=0x%s' % (list1[x][2], list1[x][3]) list2[a][10] = 'load:0x%s' % list1[x][3] i = a + 1 break x += 1 i += 1 for i in range(len(trace_lines)): list2[i] = '\t'.join(list2[i]) trace_lines[i] = str(list2[i] + '\n') nb_file = open(rtl_log_f, 'w') nb_file.writelines(trace_lines) def main(): parser = argparse.ArgumentParser() parser.add_argument('--rtl_log_f', help='Output core simulation log post-fixed (default: stdout)', type=argparse.FileType('w'), default=sys.stdout) parser.add_argument('--nb_log', help='Input core simulation log (default: stdin)', type=argparse.FileType('r'), default=sys.stdin) parser.add_argument('--rtl_log', help='Input core simulation log (default: stdin)', type=argparse.FileType('r'), default=sys.stdin) args = parser.parse_args() print('Post-fix log for nonblock load values\n') nb_post_fix(args.rtl_log_f, args.rtl_log, args.nb_log) if __name__ == '__main__': main()