content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
students = [] class Student: school_name = "Springfied Elementary" def __init__(self, name, student_id=332): self.name = name self.student_id = student_id students.append(self) def __str__(self): return "Student " + self.name def get_name_capitalize(self): return self.name.capitalize() def get_school_name(self): return self.school_name class HighSchoolStudent(Student): school_name = "Springfirld High School" def get_school_name(self): return "This is a high school student" def get_name_capitalize(self): original_value = super().get_name_capitalize() return original_value + "-HS" james = HighSchoolStudent("james") print(james.get_name_capitalize())
students = [] class Student: school_name = 'Springfied Elementary' def __init__(self, name, student_id=332): self.name = name self.student_id = student_id students.append(self) def __str__(self): return 'Student ' + self.name def get_name_capitalize(self): return self.name.capitalize() def get_school_name(self): return self.school_name class Highschoolstudent(Student): school_name = 'Springfirld High School' def get_school_name(self): return 'This is a high school student' def get_name_capitalize(self): original_value = super().get_name_capitalize() return original_value + '-HS' james = high_school_student('james') print(james.get_name_capitalize())
data_A = [1,2,3,6,7,8,9] data_B = [1,2,7,8] count = 0 for number1 in data_A: for number2 in data_B: if number1 == number2: print('{} is also appeared in {}'.format(number1,number2)) count += 1 else: pass print('There are only {} matching numbers between Data A and Data B.'.format(count))
data_a = [1, 2, 3, 6, 7, 8, 9] data_b = [1, 2, 7, 8] count = 0 for number1 in data_A: for number2 in data_B: if number1 == number2: print('{} is also appeared in {}'.format(number1, number2)) count += 1 else: pass print('There are only {} matching numbers between Data A and Data B.'.format(count))
class Node: def __init__(self, value): self.value = value self.l = None self.r = None class BinaryTree: def __init__(self): self.root = None def draw(self): '''Prints a preorder traversal of the tree''' self._draw(self.root) print() def _draw(self, node): print("(", end="") if node != None: print(str(node.value) + ", ", end="") self._draw(node.l) print(", ", end="") self._draw(node.r) print(")", end="") def invert(self): self.root = self._invert(self.root) def _invert(self, node): # find lowest point where nodes can be swapped # swap nodes if node: node.l = self._invert(node.l) node.r = self._invert(node.r) temp = node.l node.l = node.r node.r = temp return node def add(self, vals): for val in vals: if self.root == None: self.root = Node(val) else: self._add(self.root, val) def _add(self, node, val): if val < node.value: if node.l == None: node.l = Node(val) else: self._add(node.l, val) else: if node.r == None: node.r = Node(val) else: self._add(node.r, val) def main(): t = BinaryTree() t.add([4, 2, 7, 1, 3, 6, 9, 11]) t.draw() t.invert() t.draw() if __name__ == "__main__": main()
class Node: def __init__(self, value): self.value = value self.l = None self.r = None class Binarytree: def __init__(self): self.root = None def draw(self): """Prints a preorder traversal of the tree""" self._draw(self.root) print() def _draw(self, node): print('(', end='') if node != None: print(str(node.value) + ', ', end='') self._draw(node.l) print(', ', end='') self._draw(node.r) print(')', end='') def invert(self): self.root = self._invert(self.root) def _invert(self, node): if node: node.l = self._invert(node.l) node.r = self._invert(node.r) temp = node.l node.l = node.r node.r = temp return node def add(self, vals): for val in vals: if self.root == None: self.root = node(val) else: self._add(self.root, val) def _add(self, node, val): if val < node.value: if node.l == None: node.l = node(val) else: self._add(node.l, val) elif node.r == None: node.r = node(val) else: self._add(node.r, val) def main(): t = binary_tree() t.add([4, 2, 7, 1, 3, 6, 9, 11]) t.draw() t.invert() t.draw() if __name__ == '__main__': main()
# 1, 2, 3, 4, 5, 6, 7, 8, 9 # 0, 1, 1, -1, -1, 2, 2, -2, -2 # 0, 0, 1, 1, -1, -1, 2, 2, -2, -2 def seq(n): a = (n - 1) // 2 b = (n + 1) // 4 if a % 2 == 0: return -b else: return b n = int(input()) x = seq(n + 1) y = seq(n) print(x, y)
def seq(n): a = (n - 1) // 2 b = (n + 1) // 4 if a % 2 == 0: return -b else: return b n = int(input()) x = seq(n + 1) y = seq(n) print(x, y)
W = [] S = str(input('')) for i in S: if i not in W: W.append(i) if len(W) % 2 == 0: print('CHAT WITH HER!') else: print('IGNORE HIM!')
w = [] s = str(input('')) for i in S: if i not in W: W.append(i) if len(W) % 2 == 0: print('CHAT WITH HER!') else: print('IGNORE HIM!')
worldLists = { "desk": { "sets": ["desk"], "assume": ["des", "de"], }, "laptop": { "sets": ["laptop"], "assume": ["lapto", "lapt", "lap", "la"], }, "wall": { "sets": ["wall"], "assume": ["wal", "wa"] }, "sign": { "sets": ["sign"], "assume": ["sig", "si"], }, "door": { "sets": ["door"], "assume": ["doo", "do"], }, "chair": { "sets": ["chair"], "assume": ["chai", "cha", "ch",] }, "window": { "sets": ["window"], "assume": ["windo", "wind", "win", "wi"] }, "floor": { "sets": ["floor"], "assume": ["floo", "flo", "fl"] }, }
world_lists = {'desk': {'sets': ['desk'], 'assume': ['des', 'de']}, 'laptop': {'sets': ['laptop'], 'assume': ['lapto', 'lapt', 'lap', 'la']}, 'wall': {'sets': ['wall'], 'assume': ['wal', 'wa']}, 'sign': {'sets': ['sign'], 'assume': ['sig', 'si']}, 'door': {'sets': ['door'], 'assume': ['doo', 'do']}, 'chair': {'sets': ['chair'], 'assume': ['chai', 'cha', 'ch']}, 'window': {'sets': ['window'], 'assume': ['windo', 'wind', 'win', 'wi']}, 'floor': {'sets': ['floor'], 'assume': ['floo', 'flo', 'fl']}}
# Prova Mundo 02 # Rascunhos da Prova do Mundo 2 #Nota: 90% n = ' nilseia'.upper().strip()[0] print(n) for c in range(0, 10): print(c)
n = ' nilseia'.upper().strip()[0] print(n) for c in range(0, 10): print(c)
dnas = [ ['hY?9', 56, 25, 8.21, 47, 21, -2.56, {'ott_len': 43, 'ott_percent': 196, 'ott_bw': 124, 'tps_qty_index': 215}], ['st7M', 67, 43, 17.72, 55, 29, 5.52, {'ott_len': 49, 'ott_percent': 299, 'ott_bw': 84, 'tps_qty_index': 468}], ]
dnas = [['hY?9', 56, 25, 8.21, 47, 21, -2.56, {'ott_len': 43, 'ott_percent': 196, 'ott_bw': 124, 'tps_qty_index': 215}], ['st7M', 67, 43, 17.72, 55, 29, 5.52, {'ott_len': 49, 'ott_percent': 299, 'ott_bw': 84, 'tps_qty_index': 468}]]
# This program contains a tuple stores the months of the year and # another tuple from it with just summer months # and prints out the summer months ine at a time. month = ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December") summer = month[4:7] for month in summer: print(month)
month = ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December') summer = month[4:7] for month in summer: print(month)
default_players = { 'hungergames': [ ("Marvel", True), ("Glimmer", False), ("Cato", True), ("Clove", False), ("Foxface", False), ("Jason", True), ("Rue", False), ("Thresh", True), ("Peeta", True), ("Katniss", False) ], 'melee': [ ("Dr. Mario", True), ("Mario", True), ("Luigi", True), ("Bowser", True), ("Peach", False), ("Yoshi", True), ("Donkey Kong", True), ("Captain Falcon", True), ("Ganondorf", True), ("Falco", True), ("Fox", True), ("Ness", True), ("Nana", False), ("Popo", True), ("Kirby", True), ("Samus", False), ("Zelda", False), ("Link", True), ("Young Link", True), ("Pichu", None), ("Pikachu", None), ("Jigglypuff", None), ("Mewtwo", True), ("Mr. Game & Watch", True), ("Marth", True), ("Roy", True) ] }
default_players = {'hungergames': [('Marvel', True), ('Glimmer', False), ('Cato', True), ('Clove', False), ('Foxface', False), ('Jason', True), ('Rue', False), ('Thresh', True), ('Peeta', True), ('Katniss', False)], 'melee': [('Dr. Mario', True), ('Mario', True), ('Luigi', True), ('Bowser', True), ('Peach', False), ('Yoshi', True), ('Donkey Kong', True), ('Captain Falcon', True), ('Ganondorf', True), ('Falco', True), ('Fox', True), ('Ness', True), ('Nana', False), ('Popo', True), ('Kirby', True), ('Samus', False), ('Zelda', False), ('Link', True), ('Young Link', True), ('Pichu', None), ('Pikachu', None), ('Jigglypuff', None), ('Mewtwo', True), ('Mr. Game & Watch', True), ('Marth', True), ('Roy', True)]}
def main(): N, M = map(int,input().split()) for i in range(1,N,2): print(("." + "|.."*int((i-1)/2) + "|" + "..|"*int((i-1)/2) + ".").center(M,'-')) print("WELCOME".center(M,"-")) for i in range(N-2,-1,-2): print(("." + "|.."*int((i-1)/2) + "|" + "..|"*int((i-1)/2) + ".").center(M,'-')) if __name__=='__main__': main()
def main(): (n, m) = map(int, input().split()) for i in range(1, N, 2): print(('.' + '|..' * int((i - 1) / 2) + '|' + '..|' * int((i - 1) / 2) + '.').center(M, '-')) print('WELCOME'.center(M, '-')) for i in range(N - 2, -1, -2): print(('.' + '|..' * int((i - 1) / 2) + '|' + '..|' * int((i - 1) / 2) + '.').center(M, '-')) if __name__ == '__main__': main()
#!/usr/bin/env python3 tls_cnt = 0 ssl_cnt = 0 with open("input.txt",'r') as f: for line in f: bracket = 0 tls_flag = 0 ABAs = [[],[]] for i in range(len(line)-2): if line[i] == '[': bracket = 1 elif line[i] == ']': bracket = 0 else: if line[i] == line[i+2] and line[i+1] not in "]": ABAs[bracket].append(line[i:i+3]) if i < len(line)-3 and line[i:i+2] == line[i+3:i+1:-1] and line[i] != line[i+1]: if not bracket and tls_flag != 2: tls_flag = 1 else: tls_flag = 2 else: # for exited normally if tls_flag == 1: tls_cnt += 1 ABAs[0] = map(lambda s: s[1:]+s[1], ABAs[0]) if len(set(ABAs[0]).intersection(ABAs[1])) > 0: ssl_cnt += 1 print("TLS: {}".format(tls_cnt)) print("SSL: {}".format(ssl_cnt))
tls_cnt = 0 ssl_cnt = 0 with open('input.txt', 'r') as f: for line in f: bracket = 0 tls_flag = 0 ab_as = [[], []] for i in range(len(line) - 2): if line[i] == '[': bracket = 1 elif line[i] == ']': bracket = 0 else: if line[i] == line[i + 2] and line[i + 1] not in ']': ABAs[bracket].append(line[i:i + 3]) if i < len(line) - 3 and line[i:i + 2] == line[i + 3:i + 1:-1] and (line[i] != line[i + 1]): if not bracket and tls_flag != 2: tls_flag = 1 else: tls_flag = 2 else: if tls_flag == 1: tls_cnt += 1 ABAs[0] = map(lambda s: s[1:] + s[1], ABAs[0]) if len(set(ABAs[0]).intersection(ABAs[1])) > 0: ssl_cnt += 1 print('TLS: {}'.format(tls_cnt)) print('SSL: {}'.format(ssl_cnt))
# Configuration file for the Sphinx documentation builder. project = 'wwt_api_client' author = 'Peter K. G. Williams' copyright = '2019 ' + author release = '0.1.0dev0' extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.mathjax', 'sphinx.ext.viewcode', 'sphinx_automodapi.automodapi', 'sphinx_automodapi.smart_resolver', 'numpydoc', ] master_doc = 'index' templates_path = ['_templates'] exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] numpydoc_class_members_toctree = False html_theme = 'alabaster' html_static_path = ['_static'] html_logo = 'images/logo.png'
project = 'wwt_api_client' author = 'Peter K. G. Williams' copyright = '2019 ' + author release = '0.1.0dev0' extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.mathjax', 'sphinx.ext.viewcode', 'sphinx_automodapi.automodapi', 'sphinx_automodapi.smart_resolver', 'numpydoc'] master_doc = 'index' templates_path = ['_templates'] exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] numpydoc_class_members_toctree = False html_theme = 'alabaster' html_static_path = ['_static'] html_logo = 'images/logo.png'
class ConfigException(Exception): pass class AuthException(Exception): pass class AuthEngineFailedException(AuthException): pass class UnauthorizedAccountException(AuthException): pass class LockedUserException(UnauthorizedAccountException): pass class InvalidAuthEngineException(AuthException): pass class UserNotFoundException(AuthException): pass class NeedsOTPException(AuthException): pass class InvalidCredentialsException(AuthException): pass
class Configexception(Exception): pass class Authexception(Exception): pass class Authenginefailedexception(AuthException): pass class Unauthorizedaccountexception(AuthException): pass class Lockeduserexception(UnauthorizedAccountException): pass class Invalidauthengineexception(AuthException): pass class Usernotfoundexception(AuthException): pass class Needsotpexception(AuthException): pass class Invalidcredentialsexception(AuthException): pass
class Metadata: name: str def __init__(self, name: str): self.name = name def to_dict(self) -> dict: return { 'name': self.name, } class ConfigMap: metadata: Metadata data: dict apiVersion: str = 'v1' kind: str = 'ConfigMap' def __init__( self, metadata: Metadata, data: dict, apiVersion: str = 'v1', kind: str = 'ConfigMap', ): self.metadata = metadata self.data = data self.apiVersion = apiVersion self.kind = kind def to_dict(self) -> dict: return { 'metadata': self.metadata.to_dict(), 'data': self.data, 'apiVersion': self.apiVersion, 'kind': self.kind, } configMap = ConfigMap( metadata=Metadata(name='the-map'), data={'altGreeting': 'Good Morning!', 'enableRisky': 'false'}, )
class Metadata: name: str def __init__(self, name: str): self.name = name def to_dict(self) -> dict: return {'name': self.name} class Configmap: metadata: Metadata data: dict api_version: str = 'v1' kind: str = 'ConfigMap' def __init__(self, metadata: Metadata, data: dict, apiVersion: str='v1', kind: str='ConfigMap'): self.metadata = metadata self.data = data self.apiVersion = apiVersion self.kind = kind def to_dict(self) -> dict: return {'metadata': self.metadata.to_dict(), 'data': self.data, 'apiVersion': self.apiVersion, 'kind': self.kind} config_map = config_map(metadata=metadata(name='the-map'), data={'altGreeting': 'Good Morning!', 'enableRisky': 'false'})
# Creating a class # Method 1 # class teddy: # quantity = 200 # print(teddy.quantity) # Method 2 class teddy: quantity = 200 quality = 90 obteddy = teddy() print(obteddy.quality) print(obteddy.quantity)
class Teddy: quantity = 200 quality = 90 obteddy = teddy() print(obteddy.quality) print(obteddy.quantity)
num = 10 num = 20 num = 30 num = 40 num = 50 num = 66 num = 60 num = 70
num = 10 num = 20 num = 30 num = 40 num = 50 num = 66 num = 60 num = 70
val = open('val.txt', encoding='UTF-8') out = open('out.txt', encoding='UTF-8') t = val.readline() a = out.readline() sum = 0 right = 0 while t and a: error = [] t = t.strip() a = a.strip() for i in range(len(t)): sum += 1 if t[i] == a[i]: right += 1 else: error.append(a[i]) print(t) print(a) print("wrong with {}", format(error)) t = val.readline() a = out.readline() print("right={}".format(right)) print("sum={}".format(sum)) print(right / sum)
val = open('val.txt', encoding='UTF-8') out = open('out.txt', encoding='UTF-8') t = val.readline() a = out.readline() sum = 0 right = 0 while t and a: error = [] t = t.strip() a = a.strip() for i in range(len(t)): sum += 1 if t[i] == a[i]: right += 1 else: error.append(a[i]) print(t) print(a) print('wrong with {}', format(error)) t = val.readline() a = out.readline() print('right={}'.format(right)) print('sum={}'.format(sum)) print(right / sum)
URL_FANTOIR = ( "https://www.collectivites-locales.gouv.fr/competences/la-mise-disposition-gratuite-du-fichier-des-" "voies-et-des-lieux-dits-fantoir" ) URL_DOCUMENTATION = "https://docs.3liz.org/QgisCadastrePlugin/"
url_fantoir = 'https://www.collectivites-locales.gouv.fr/competences/la-mise-disposition-gratuite-du-fichier-des-voies-et-des-lieux-dits-fantoir' url_documentation = 'https://docs.3liz.org/QgisCadastrePlugin/'
n = int(input('digite um numero: ')) if n%2 == 0: print('PAR') else: print('IMPAR')
n = int(input('digite um numero: ')) if n % 2 == 0: print('PAR') else: print('IMPAR')
ir_licenses = { 'names': { 'P': 'Pro', 'A': 'Class A', 'B': 'Class B', 'C': 'Class C', 'D': 'Class D', 'R': 'Rookie' }, 'bg_colors': { 'P': '#000000', 'A': '#0153DB', 'B': '#00C702', 'C': '#FEEC04', 'D': '#FC8A27', 'R': '#FC0706' }, 'colors': { 'P': '#FFFFFF', 'A': '#FFFFFF', 'B': '#FFFFFF', 'C': '#000000', 'D': '#000000', 'R': '#FFFFFF' } } content = { 'bg_colors': { 'owned': '#1E9E1E', 'missing': '#40474C', 'twitter': '#1DA1F2', 'github': '#333000', 'paypal': '#003087' }, 'colors': { 'normal': 'black', 'alt': '#DDDDDD', 'owned': 'black', 'missing': '#DDDDDD', 'twitter': '#FFFFFF', 'github': '#FAFAFA', 'paypal': '#009CDE' } }
ir_licenses = {'names': {'P': 'Pro', 'A': 'Class A', 'B': 'Class B', 'C': 'Class C', 'D': 'Class D', 'R': 'Rookie'}, 'bg_colors': {'P': '#000000', 'A': '#0153DB', 'B': '#00C702', 'C': '#FEEC04', 'D': '#FC8A27', 'R': '#FC0706'}, 'colors': {'P': '#FFFFFF', 'A': '#FFFFFF', 'B': '#FFFFFF', 'C': '#000000', 'D': '#000000', 'R': '#FFFFFF'}} content = {'bg_colors': {'owned': '#1E9E1E', 'missing': '#40474C', 'twitter': '#1DA1F2', 'github': '#333000', 'paypal': '#003087'}, 'colors': {'normal': 'black', 'alt': '#DDDDDD', 'owned': 'black', 'missing': '#DDDDDD', 'twitter': '#FFFFFF', 'github': '#FAFAFA', 'paypal': '#009CDE'}}
pkg_dnf = { 'nfs-utils': {}, 'libnfsidmap': {}, } svc_systemd = { 'nfs-server': { 'needs': ['pkg_dnf:nfs-utils'], }, 'rpcbind': { 'needs': ['pkg_dnf:nfs-utils'], }, 'rpc-statd': { 'needs': ['pkg_dnf:nfs-utils'], }, 'nfs-idmapd': { 'needs': ['pkg_dnf:nfs-utils'], }, } files = {} actions = { 'nfs_export': { 'command': 'exportfs -a', 'triggered': True, 'needs': ['pkg_dnf:nfs-utils'], }, } for export in node.metadata['nfs-server']['exports']: files['/etc/exports.d/{}'.format(export['alias'])] = { 'source': 'template', 'mode': '0644', 'content_type': 'mako', 'context': { 'export': export, }, 'needs': ['pkg_dnf:nfs-utils'], 'triggers': ['action:nfs_export', 'svc_systemd:nfs-server:restart', 'svc_systemd:rpcbind:restart'], } if node.has_bundle('firewalld'): if node.metadata.get('nfs-server', {}).get('firewalld_permitted_zones'): for zone in node.metadata.get('nfs-server', {}).get('firewalld_permitted_zones'): actions['firewalld_add_nfs_zone_{}'.format(zone)] = { 'command': 'firewall-cmd --permanent --zone={} --add-service=nfs'.format(zone), 'unless': 'firewall-cmd --zone={} --list-services | grep nfs'.format(zone), 'cascade_skip': False, 'needs': ['pkg_dnf:firewalld'], 'triggers': ['action:firewalld_reload'], } actions['firewalld_add_mountd_zone_{}'.format(zone)] = { 'command': 'firewall-cmd --permanent --zone={} --add-service=mountd'.format(zone), 'unless': 'firewall-cmd --zone={} --list-services | grep mountd'.format(zone), 'cascade_skip': False, 'needs': ['pkg_dnf:firewalld'], 'triggers': ['action:firewalld_reload'], } actions['firewalld_add_rpc-bind_zone_{}'.format(zone)] = { 'command': 'firewall-cmd --permanent --zone={} --add-service=rpc-bind'.format(zone), 'unless': 'firewall-cmd --zone={} --list-services | grep rpc-bind'.format(zone), 'cascade_skip': False, 'needs': ['pkg_dnf:firewalld'], 'triggers': ['action:firewalld_reload'], } elif node.metadata.get('firewalld', {}).get('default_zone'): default_zone = node.metadata.get('firewalld', {}).get('default_zone') actions['firewalld_add_nfs_zone_{}'.format(default_zone)] = { 'command': 'firewall-cmd --permanent --zone={} --add-service=nfs'.format(default_zone), 'unless': 'firewall-cmd --zone={} --list-services | grep nfs'.format(default_zone), 'cascade_skip': False, 'needs': ['pkg_dnf:firewalld'], 'triggers': ['action:firewalld_reload'], } actions['firewalld_add_mountd_zone_{}'.format(default_zone)] = { 'command': 'firewall-cmd --permanent --zone={} --add-service=mountd'.format(default_zone), 'unless': 'firewall-cmd --zone={} --list-services | grep mountd'.format(default_zone), 'cascade_skip': False, 'needs': ['pkg_dnf:firewalld'], 'triggers': ['action:firewalld_reload'], } actions['firewalld_add_rpc-bind_zone_{}'.format(default_zone)] = { 'command': 'firewall-cmd --permanent --zone={} --add-service=rpc-bind'.format(default_zone), 'unless': 'firewall-cmd --zone={} --list-services | grep rpc-bind'.format(default_zone), 'cascade_skip': False, 'needs': ['pkg_dnf:firewalld'], 'triggers': ['action:firewalld_reload'], } elif node.metadata.get('firewalld', {}).get('custom_zones', False): for interface in node.metadata['interfaces']: custom_zone = node.metadata.get('interfaces', {}).get(interface).get('firewalld_zone') actions['firewalld_add_nfs_zone_{}'.format(custom_zone)] = { 'command': 'firewall-cmd --permanent --zone={} --add-service=nfs'.format(custom_zone), 'unless': 'firewall-cmd --zone={} --list-services | grep nfs'.format(custom_zone), 'cascade_skip': False, 'needs': ['pkg_dnf:firewalld'], 'triggers': ['action:firewalld_reload'], } actions['firewalld_add_mountd_zone_{}'.format(custom_zone)] = { 'command': 'firewall-cmd --permanent --zone={} --add-service=mountd'.format(custom_zone), 'unless': 'firewall-cmd --zone={} --list-services | grep mountd'.format(custom_zone), 'cascade_skip': False, 'needs': ['pkg_dnf:firewalld'], 'triggers': ['action:firewalld_reload'], } actions['firewalld_add_rpc-bind_zone_{}'.format(custom_zone)] = { 'command': 'firewall-cmd --permanent --zone={} --add-service=rpc-bind'.format(custom_zone), 'unless': 'firewall-cmd --zone={} --list-services | grep rpc-bind'.format(custom_zone), 'cascade_skip': False, 'needs': ['pkg_dnf:firewalld'], 'triggers': ['action:firewalld_reload'], } else: actions['firewalld_add_nfs'] = { 'command': 'firewall-cmd --permanent --add-service=nfs', 'unless': 'firewall-cmd --list-services | grep nfs', 'cascade_skip': False, 'needs': ['pkg_dnf:firewalld'], 'triggers': ['action:firewalld_reload'], } actions['firewalld_add_mountd'] = { 'command': 'firewall-cmd --permanent --add-service=mountd', 'unless': 'firewall-cmd --list-services | grep mountd', 'cascade_skip': False, 'needs': ['pkg_dnf:firewalld'], 'triggers': ['action:firewalld_reload'], } actions['firewalld_add_rpc-bind'] = { 'command': 'firewall-cmd --permanent --add-service=rpc-bind', 'unless': 'firewall-cmd --list-services | grep rpc-bind', 'cascade_skip': False, 'needs': ['pkg_dnf:firewalld'], 'triggers': ['action:firewalld_reload'], }
pkg_dnf = {'nfs-utils': {}, 'libnfsidmap': {}} svc_systemd = {'nfs-server': {'needs': ['pkg_dnf:nfs-utils']}, 'rpcbind': {'needs': ['pkg_dnf:nfs-utils']}, 'rpc-statd': {'needs': ['pkg_dnf:nfs-utils']}, 'nfs-idmapd': {'needs': ['pkg_dnf:nfs-utils']}} files = {} actions = {'nfs_export': {'command': 'exportfs -a', 'triggered': True, 'needs': ['pkg_dnf:nfs-utils']}} for export in node.metadata['nfs-server']['exports']: files['/etc/exports.d/{}'.format(export['alias'])] = {'source': 'template', 'mode': '0644', 'content_type': 'mako', 'context': {'export': export}, 'needs': ['pkg_dnf:nfs-utils'], 'triggers': ['action:nfs_export', 'svc_systemd:nfs-server:restart', 'svc_systemd:rpcbind:restart']} if node.has_bundle('firewalld'): if node.metadata.get('nfs-server', {}).get('firewalld_permitted_zones'): for zone in node.metadata.get('nfs-server', {}).get('firewalld_permitted_zones'): actions['firewalld_add_nfs_zone_{}'.format(zone)] = {'command': 'firewall-cmd --permanent --zone={} --add-service=nfs'.format(zone), 'unless': 'firewall-cmd --zone={} --list-services | grep nfs'.format(zone), 'cascade_skip': False, 'needs': ['pkg_dnf:firewalld'], 'triggers': ['action:firewalld_reload']} actions['firewalld_add_mountd_zone_{}'.format(zone)] = {'command': 'firewall-cmd --permanent --zone={} --add-service=mountd'.format(zone), 'unless': 'firewall-cmd --zone={} --list-services | grep mountd'.format(zone), 'cascade_skip': False, 'needs': ['pkg_dnf:firewalld'], 'triggers': ['action:firewalld_reload']} actions['firewalld_add_rpc-bind_zone_{}'.format(zone)] = {'command': 'firewall-cmd --permanent --zone={} --add-service=rpc-bind'.format(zone), 'unless': 'firewall-cmd --zone={} --list-services | grep rpc-bind'.format(zone), 'cascade_skip': False, 'needs': ['pkg_dnf:firewalld'], 'triggers': ['action:firewalld_reload']} elif node.metadata.get('firewalld', {}).get('default_zone'): default_zone = node.metadata.get('firewalld', {}).get('default_zone') actions['firewalld_add_nfs_zone_{}'.format(default_zone)] = {'command': 'firewall-cmd --permanent --zone={} --add-service=nfs'.format(default_zone), 'unless': 'firewall-cmd --zone={} --list-services | grep nfs'.format(default_zone), 'cascade_skip': False, 'needs': ['pkg_dnf:firewalld'], 'triggers': ['action:firewalld_reload']} actions['firewalld_add_mountd_zone_{}'.format(default_zone)] = {'command': 'firewall-cmd --permanent --zone={} --add-service=mountd'.format(default_zone), 'unless': 'firewall-cmd --zone={} --list-services | grep mountd'.format(default_zone), 'cascade_skip': False, 'needs': ['pkg_dnf:firewalld'], 'triggers': ['action:firewalld_reload']} actions['firewalld_add_rpc-bind_zone_{}'.format(default_zone)] = {'command': 'firewall-cmd --permanent --zone={} --add-service=rpc-bind'.format(default_zone), 'unless': 'firewall-cmd --zone={} --list-services | grep rpc-bind'.format(default_zone), 'cascade_skip': False, 'needs': ['pkg_dnf:firewalld'], 'triggers': ['action:firewalld_reload']} elif node.metadata.get('firewalld', {}).get('custom_zones', False): for interface in node.metadata['interfaces']: custom_zone = node.metadata.get('interfaces', {}).get(interface).get('firewalld_zone') actions['firewalld_add_nfs_zone_{}'.format(custom_zone)] = {'command': 'firewall-cmd --permanent --zone={} --add-service=nfs'.format(custom_zone), 'unless': 'firewall-cmd --zone={} --list-services | grep nfs'.format(custom_zone), 'cascade_skip': False, 'needs': ['pkg_dnf:firewalld'], 'triggers': ['action:firewalld_reload']} actions['firewalld_add_mountd_zone_{}'.format(custom_zone)] = {'command': 'firewall-cmd --permanent --zone={} --add-service=mountd'.format(custom_zone), 'unless': 'firewall-cmd --zone={} --list-services | grep mountd'.format(custom_zone), 'cascade_skip': False, 'needs': ['pkg_dnf:firewalld'], 'triggers': ['action:firewalld_reload']} actions['firewalld_add_rpc-bind_zone_{}'.format(custom_zone)] = {'command': 'firewall-cmd --permanent --zone={} --add-service=rpc-bind'.format(custom_zone), 'unless': 'firewall-cmd --zone={} --list-services | grep rpc-bind'.format(custom_zone), 'cascade_skip': False, 'needs': ['pkg_dnf:firewalld'], 'triggers': ['action:firewalld_reload']} else: actions['firewalld_add_nfs'] = {'command': 'firewall-cmd --permanent --add-service=nfs', 'unless': 'firewall-cmd --list-services | grep nfs', 'cascade_skip': False, 'needs': ['pkg_dnf:firewalld'], 'triggers': ['action:firewalld_reload']} actions['firewalld_add_mountd'] = {'command': 'firewall-cmd --permanent --add-service=mountd', 'unless': 'firewall-cmd --list-services | grep mountd', 'cascade_skip': False, 'needs': ['pkg_dnf:firewalld'], 'triggers': ['action:firewalld_reload']} actions['firewalld_add_rpc-bind'] = {'command': 'firewall-cmd --permanent --add-service=rpc-bind', 'unless': 'firewall-cmd --list-services | grep rpc-bind', 'cascade_skip': False, 'needs': ['pkg_dnf:firewalld'], 'triggers': ['action:firewalld_reload']}
# FIXME need to figure generation of bytecode class Scenario: STAGES = [ {"name": "install", "path": "build/{version}/cast_to_short-{version}.cap",}, { "name": "send", "comment": "READMEM APDU", "payload": "0xA0 0xB0 0x01 0x00 0x00", "optional": False, }, ]
class Scenario: stages = [{'name': 'install', 'path': 'build/{version}/cast_to_short-{version}.cap'}, {'name': 'send', 'comment': 'READMEM APDU', 'payload': '0xA0 0xB0 0x01 0x00\t0x00', 'optional': False}]
class Solution: def calPoints(self, ops: List[str]) -> int: arr = [] for op in ops: #print(arr) if op.isdigit() or op[0] == '-': arr.append(int(op)) elif op == 'C' and arr: arr.pop() elif op == 'D' and arr: arr.append(arr[-1] * 2) elif len(arr) >= 2: arr.append(arr[-1] + arr[-2]) #print(arr) return sum(arr)
class Solution: def cal_points(self, ops: List[str]) -> int: arr = [] for op in ops: if op.isdigit() or op[0] == '-': arr.append(int(op)) elif op == 'C' and arr: arr.pop() elif op == 'D' and arr: arr.append(arr[-1] * 2) elif len(arr) >= 2: arr.append(arr[-1] + arr[-2]) return sum(arr)
# 153. Find Minimum in Rotated Sorted Array class Solution(object): global find_min_helper def find_min_helper(nums,left,right): # base case: if left >= right, return the first element if left >= right: return nums[0] # get middle element mid = (left+right)/2 # check if mid < right and mid element > mid+1 if mid < right and nums[mid] > nums[mid+1]: # return mid+1 element return nums[mid+1] # check if mid > left and mid element < mid-1 element if mid > left and nums[mid] < nums[mid-1]: return nums[mid] # check if mid < right and mid element < mid+1 if nums[mid] < nums[right]: # return function(nums,mid+1,right) return find_min_helper(nums,left,mid-1) # return function(nums,left, mid) return find_min_helper(nums,mid+1,right) def findMin(self, nums): # if nums length is 1, return first element if len(nums) == 1: return nums[0] if len(nums) == 2: return min(nums) # return the helper function (log n) binary search return find_min_helper(nums,0,len(nums)-1)
class Solution(object): global find_min_helper def find_min_helper(nums, left, right): if left >= right: return nums[0] mid = (left + right) / 2 if mid < right and nums[mid] > nums[mid + 1]: return nums[mid + 1] if mid > left and nums[mid] < nums[mid - 1]: return nums[mid] if nums[mid] < nums[right]: return find_min_helper(nums, left, mid - 1) return find_min_helper(nums, mid + 1, right) def find_min(self, nums): if len(nums) == 1: return nums[0] if len(nums) == 2: return min(nums) return find_min_helper(nums, 0, len(nums) - 1)
# Configuration file for ipython. #------------------------------------------------------------------------------ # InteractiveShellApp(Configurable) configuration #------------------------------------------------------------------------------ ## lines of code to run at IPython startup. c.InteractiveShellApp.exec_lines = ['%load_ext autoreload', '%autoreload 2'] ## A list of dotted module names of IPython extensions to load. c.InteractiveShellApp.extensions = ['autoreload']
c.InteractiveShellApp.exec_lines = ['%load_ext autoreload', '%autoreload 2'] c.InteractiveShellApp.extensions = ['autoreload']
#!/usr/bin/env python3 size_of_grp = 5 inp_list = "1 2 3 6 5 4 4 2 5 3 6 1 6 5 3 2 4 1 2 5 1 4 3 6 8 4 3 1 5 6 2".split() set_l = set(inp_list) cap_room = "" for element in set_l: inp_list.remove(element) if not element in inp_list: cap_room = element break print(int(cap_room))
size_of_grp = 5 inp_list = '1 2 3 6 5 4 4 2 5 3 6 1 6 5 3 2 4 1 2 5 1 4 3 6 8 4 3 1 5 6 2'.split() set_l = set(inp_list) cap_room = '' for element in set_l: inp_list.remove(element) if not element in inp_list: cap_room = element break print(int(cap_room))
class InferErr(Exception): def __init__(self, e): self.code = 1 self.message = "Inference Error" super().__init__(self.message, str(e)) def MiB(val): return val * 1 << 20 def GiB(val): return val * 1 << 30 class HostDeviceMem(object): def __init__(self, host_mem, device_mem): self.host = host_mem self.device = device_mem def __str__(self): return "Host:\n" + str(self.host) + "\nDevice:\n" + str(self.device) def __repr__(self): return self.__str__()
class Infererr(Exception): def __init__(self, e): self.code = 1 self.message = 'Inference Error' super().__init__(self.message, str(e)) def mi_b(val): return val * 1 << 20 def gi_b(val): return val * 1 << 30 class Hostdevicemem(object): def __init__(self, host_mem, device_mem): self.host = host_mem self.device = device_mem def __str__(self): return 'Host:\n' + str(self.host) + '\nDevice:\n' + str(self.device) def __repr__(self): return self.__str__()
GPU_ID = 0 BATCH_SIZE = 64 VAL_BATCH_SIZE = 100 NUM_OUTPUT_UNITS = 3000 # This is the answer vocabulary size MAX_WORDS_IN_QUESTION = 15 MAX_WORDS_IN_EXP = 36 MAX_ITERATIONS = 50000 PRINT_INTERVAL = 100 # what data to use for training TRAIN_DATA_SPLITS = 'train' # what data to use for the vocabulary QUESTION_VOCAB_SPACE = 'train' ANSWER_VOCAB_SPACE = 'train' EXP_VOCAB_SPACE = 'train' # VQA pretrained model VQA_PRETRAINED = 'PATH_TO_PRETRAINED_VQA_MODEL.caffemodel' # location of the data VQA_PREFIX = './VQA-X' DATA_PATHS = { 'train': { 'ques_file': VQA_PREFIX + '/Questions/v2_OpenEnded_mscoco_train2014_questions.json', 'ans_file': VQA_PREFIX + '/Annotations/v2_mscoco_train2014_annotations.json', 'exp_file': VQA_PREFIX + '/Annotations/train_exp_anno.json', 'features_prefix': VQA_PREFIX + '/Features/resnet_res5c_bgrms_large/train2014/COCO_train2014_' }, 'val': { 'ques_file': VQA_PREFIX + '/Questions/v2_OpenEnded_mscoco_val2014_questions.json', 'ans_file': VQA_PREFIX + '/Annotations/v2_mscoco_val2014_annotations.json', 'exp_file': VQA_PREFIX + '/Annotations/val_exp_anno.json', 'features_prefix': VQA_PREFIX + '/Features/resnet_res5c_bgrms_large/val2014/COCO_val2014_' }, 'test-dev': { 'ques_file': VQA_PREFIX + '/Questions/OpenEnded_mscoco_test-dev2015_questions.json', 'features_prefix': VQA_PREFIX + '/Features/resnet_res5c_bgrms_large/test2015/COCO_test2015_' }, 'test': { 'ques_file': VQA_PREFIX + '/Questions/OpenEnded_mscoco_test2015_questions.json', 'features_prefix': VQA_PREFIX + '/Features/resnet_res5c_bgrms_large/test2015/COCO_test2015_' } }
gpu_id = 0 batch_size = 64 val_batch_size = 100 num_output_units = 3000 max_words_in_question = 15 max_words_in_exp = 36 max_iterations = 50000 print_interval = 100 train_data_splits = 'train' question_vocab_space = 'train' answer_vocab_space = 'train' exp_vocab_space = 'train' vqa_pretrained = 'PATH_TO_PRETRAINED_VQA_MODEL.caffemodel' vqa_prefix = './VQA-X' data_paths = {'train': {'ques_file': VQA_PREFIX + '/Questions/v2_OpenEnded_mscoco_train2014_questions.json', 'ans_file': VQA_PREFIX + '/Annotations/v2_mscoco_train2014_annotations.json', 'exp_file': VQA_PREFIX + '/Annotations/train_exp_anno.json', 'features_prefix': VQA_PREFIX + '/Features/resnet_res5c_bgrms_large/train2014/COCO_train2014_'}, 'val': {'ques_file': VQA_PREFIX + '/Questions/v2_OpenEnded_mscoco_val2014_questions.json', 'ans_file': VQA_PREFIX + '/Annotations/v2_mscoco_val2014_annotations.json', 'exp_file': VQA_PREFIX + '/Annotations/val_exp_anno.json', 'features_prefix': VQA_PREFIX + '/Features/resnet_res5c_bgrms_large/val2014/COCO_val2014_'}, 'test-dev': {'ques_file': VQA_PREFIX + '/Questions/OpenEnded_mscoco_test-dev2015_questions.json', 'features_prefix': VQA_PREFIX + '/Features/resnet_res5c_bgrms_large/test2015/COCO_test2015_'}, 'test': {'ques_file': VQA_PREFIX + '/Questions/OpenEnded_mscoco_test2015_questions.json', 'features_prefix': VQA_PREFIX + '/Features/resnet_res5c_bgrms_large/test2015/COCO_test2015_'}}
state_dict = {} aug_dict = {} oneof_dict = {} def clear_dict(state): skey = 'session' if skey not in list(state_dict.keys()) or state != state_dict[skey]: state_dict.clear() state_dict.update({'session': state}) aug_dict.clear()
state_dict = {} aug_dict = {} oneof_dict = {} def clear_dict(state): skey = 'session' if skey not in list(state_dict.keys()) or state != state_dict[skey]: state_dict.clear() state_dict.update({'session': state}) aug_dict.clear()
# Given an array, cyclically rotate the array clockwise by one. def rotateCyclic(a): start = 0 end = 1 while(end != len(a)): temp = a[start] a[start] = a[end] a[end] = temp end += 1 a = [1,2,3,4,5,6] rotateCyclic(a) print(a)
def rotate_cyclic(a): start = 0 end = 1 while end != len(a): temp = a[start] a[start] = a[end] a[end] = temp end += 1 a = [1, 2, 3, 4, 5, 6] rotate_cyclic(a) print(a)
s = 'hello world' y =[] for i in s.split(' '): x=i[0].upper() + i[1:] y.append(x) z= ' '.join(y) print(z)
s = 'hello world' y = [] for i in s.split(' '): x = i[0].upper() + i[1:] y.append(x) z = ' '.join(y) print(z)
def removeTheLoop(head): ##Your code here if detectloop(head)==0: return one=head two=head while(one and two and two.next): one=one.next two=two.next.next #print(one.data,two.data) if one==two: f=one break #print(f.data) temp=head while(temp!=f): if temp.next==f.next: #print(temp.next.data,f.next.data) f.next=None break else: temp=temp.next f=f.next return True
def remove_the_loop(head): if detectloop(head) == 0: return one = head two = head while one and two and two.next: one = one.next two = two.next.next if one == two: f = one break temp = head while temp != f: if temp.next == f.next: f.next = None break else: temp = temp.next f = f.next return True
#!usr/bin/env python3 def main(): print('Reading text files') f = open('lines.txt') # open returns a file object, that's an iterator. by default it opens in read & text mode for line in f: print(line.rstrip()) # Return a copy of the string with trailing whitespace removed print('\nWriting text files') infile = open('lines.txt', 'rt') # open in read mode and text mode outfile = open('lines-copy.txt', 'wt') # open in write mode and text mode for line in infile: print(line.rstrip(), file=outfile) print('.', end='', flush=True) # flushes the output buffer so we ensure we print the "." properly outfile.close() # to prevent any data loss when exiting the main function print('\ndone.') print('\nWriting binary files') infile = open('berlin.jpg', 'rb') # open in read mode and binary mode outfile = open('berlin-copy.jpg', 'wb') # open in write mode and binary mode while True: buffer = infile.read(10240) # 10k bytes if buffer: # is going to be false when is empty outfile.write(buffer) print('.', end='', flush=True) # each "." represents 10k bytes read and written else: break outfile.close() print('\ndone.') if __name__ == '__main__': main() # CONSOLE OUTPUT: # Reading text files # 01 The first line. # 02 The second line. # 03 The third line. # 04 The fourth line. # 05 The fifth line. # 06 The sixth line. # 07 The seventh line. # 08 The eight line. # 09 The ninth line. # 10 The tenth line. # # Writing text files # .......... # done. # # Writing binary files # ..................................................... # done.
def main(): print('Reading text files') f = open('lines.txt') for line in f: print(line.rstrip()) print('\nWriting text files') infile = open('lines.txt', 'rt') outfile = open('lines-copy.txt', 'wt') for line in infile: print(line.rstrip(), file=outfile) print('.', end='', flush=True) outfile.close() print('\ndone.') print('\nWriting binary files') infile = open('berlin.jpg', 'rb') outfile = open('berlin-copy.jpg', 'wb') while True: buffer = infile.read(10240) if buffer: outfile.write(buffer) print('.', end='', flush=True) else: break outfile.close() print('\ndone.') if __name__ == '__main__': main()
def mcd(a, b): if a > b: small = b else: small = a for i in range(1, small+1): if((a % i == 0) and (b % i == 0)): mcd1 = i return mcd1 a = int(input("intrduzca un numero:")) b = int(input("intrduzca un segundo numero:")) print ("The mcd is : ",end="") print (mcd(a,b)) #lo que hacemos es asignar cual de los dos es el menor de los valores y por cada numero contenido entre el # 1 y el menor de los valores, dividimos ambos numeros entre todos aquellos hasta que damos un valor para # el que ambos son divisores exactos ( el mayor de estos ya que varios daran de resto 0 pero el # mayor el que nos interesa) y ese seria el mcd.
def mcd(a, b): if a > b: small = b else: small = a for i in range(1, small + 1): if a % i == 0 and b % i == 0: mcd1 = i return mcd1 a = int(input('intrduzca un numero:')) b = int(input('intrduzca un segundo numero:')) print('The mcd is : ', end='') print(mcd(a, b))
# Link: https://oj.leetcode.com/problems/longest-substring-without-repeating-characters/ class Solution: # @return an integer def lengthOfLongestSubstring(self, s): d = {} start = 0 maxlen = 0 for i, c in enumerate(s): if c not in d.keys(): if (i - start + 1) > maxlen: maxlen = i - start + 1 d[c] = i else: for _ in range(start, d[c]): d.pop(s[_]) start = d[c] + 1 d[c] = i return maxlen
class Solution: def length_of_longest_substring(self, s): d = {} start = 0 maxlen = 0 for (i, c) in enumerate(s): if c not in d.keys(): if i - start + 1 > maxlen: maxlen = i - start + 1 d[c] = i else: for _ in range(start, d[c]): d.pop(s[_]) start = d[c] + 1 d[c] = i return maxlen
class Number_Pad_To_Words(): let_to_num = { 'a': '2', 'b': '2', 'c': '2', 'd': '3', 'e': '3', 'f': '3', 'g': '4', 'h': '4', 'i': '4', 'j': '5', 'k': '5', 'l': '5', 'm': '6', 'n': '6', 'o': '6', 'p': '7', 'q': '7', 'r': '7', 's': '7', 't': '8', 'u': '8', 'v': '8', 'w': '9', 'x': '9', 'y': '9', 'z': '9' } # O(ns) n -> number of words, s -> num of letters def __init__(self, words): self.num_to_words = {} for word in words: ans = '' for let in word: ans+= self.let_to_num[let] if ans not in self.num_to_words: self.num_to_words[ans] = [word] else: self.num_to_words[ans].append(word) # O(1) lookup time def get_num_to_words(self, num): if str(num) not in self.num_to_words: return [] return self.num_to_words[str(num)]
class Number_Pad_To_Words: let_to_num = {'a': '2', 'b': '2', 'c': '2', 'd': '3', 'e': '3', 'f': '3', 'g': '4', 'h': '4', 'i': '4', 'j': '5', 'k': '5', 'l': '5', 'm': '6', 'n': '6', 'o': '6', 'p': '7', 'q': '7', 'r': '7', 's': '7', 't': '8', 'u': '8', 'v': '8', 'w': '9', 'x': '9', 'y': '9', 'z': '9'} def __init__(self, words): self.num_to_words = {} for word in words: ans = '' for let in word: ans += self.let_to_num[let] if ans not in self.num_to_words: self.num_to_words[ans] = [word] else: self.num_to_words[ans].append(word) def get_num_to_words(self, num): if str(num) not in self.num_to_words: return [] return self.num_to_words[str(num)]
JOB_TYPES = [ ('Delivery driver'), ('Web developer'), ('Lecturer'), ]
job_types = ['Delivery driver', 'Web developer', 'Lecturer']
''' mymod.py - counts the number of lines and chars in the file. ''' def countLines(name): ''' countLines(name) - counts the number of lines in the file "name". Example: countLines("/home/test_user1/test_dir1/test.txt") ''' file = open(name) return len(file.readlines()) def countChars(name): ''' countChars(name) - counts the number of chars in the file "name". Example: countChars("/home/test_user1/test_dir1/test.txt") ''' file = open(name) return sum(len(x) for x in file.read()) def countLines1(file): file.seek(0) return len(file.readlines()) def countChars1(file): file.seek(0) return sum(len(x) for x in file.read()) def test(name): if type(name) == str: return "File {0} contains: {1} lines; {2} chars.".format(name, countLines(name), countChars(name)) else: return "File {0} contains: {1} lines; {2} chars.".format(name.name, countLines1(name), countChars1(name)) if __name__ == '__main__': print(test('mymod.py'))
""" mymod.py - counts the number of lines and chars in the file. """ def count_lines(name): """ countLines(name) - counts the number of lines in the file "name". Example: countLines("/home/test_user1/test_dir1/test.txt") """ file = open(name) return len(file.readlines()) def count_chars(name): """ countChars(name) - counts the number of chars in the file "name". Example: countChars("/home/test_user1/test_dir1/test.txt") """ file = open(name) return sum((len(x) for x in file.read())) def count_lines1(file): file.seek(0) return len(file.readlines()) def count_chars1(file): file.seek(0) return sum((len(x) for x in file.read())) def test(name): if type(name) == str: return 'File {0} contains: {1} lines; {2} chars.'.format(name, count_lines(name), count_chars(name)) else: return 'File {0} contains: {1} lines; {2} chars.'.format(name.name, count_lines1(name), count_chars1(name)) if __name__ == '__main__': print(test('mymod.py'))
#!/usr/bin/env python3 # Parse input with open("14/input.txt", "r") as fd: seq = list(fd.readline().rstrip()) fd.readline() line = fd.readline().rstrip() instr = dict() while line: i = tuple([x for x in line.split(" -> ")]) instr[i[0]] = i[1] line = fd.readline().rstrip() # Simulate Polymer # Count initial pairs counts = dict() for i, k in zip(seq, seq[1:]): pair = "".join([i, k]) counts[pair] = counts.get(pair, 0) + 1 # Simulate pairwise counts for i in range(40): copy = dict() for k, v in counts.items(): if k in instr.keys(): r = instr[k] copy[f"{k[0]}{r}"] = copy.get(f"{k[0]}{r}", 0) + v copy[f"{r}{k[1]}"] = copy.get(f"{r}{k[1]}", 0) + v counts = copy # Count occurences of characters element_count = dict() for k, v in counts.items(): for c in k: element_count[c] = element_count.get(c, 0) + v element_count[seq[0]] += 1 element_count[seq[-1]] += 1 max_e = int(max(element_count.values()) / 2) min_e = int(min(element_count.values()) / 2) print(max_e - min_e)
with open('14/input.txt', 'r') as fd: seq = list(fd.readline().rstrip()) fd.readline() line = fd.readline().rstrip() instr = dict() while line: i = tuple([x for x in line.split(' -> ')]) instr[i[0]] = i[1] line = fd.readline().rstrip() counts = dict() for (i, k) in zip(seq, seq[1:]): pair = ''.join([i, k]) counts[pair] = counts.get(pair, 0) + 1 for i in range(40): copy = dict() for (k, v) in counts.items(): if k in instr.keys(): r = instr[k] copy[f'{k[0]}{r}'] = copy.get(f'{k[0]}{r}', 0) + v copy[f'{r}{k[1]}'] = copy.get(f'{r}{k[1]}', 0) + v counts = copy element_count = dict() for (k, v) in counts.items(): for c in k: element_count[c] = element_count.get(c, 0) + v element_count[seq[0]] += 1 element_count[seq[-1]] += 1 max_e = int(max(element_count.values()) / 2) min_e = int(min(element_count.values()) / 2) print(max_e - min_e)
x=5 while x < 10: print(x) x += 1
x = 5 while x < 10: print(x) x += 1
src = Split(''' prov_app.c ''') if aos_global_config.get("ERASE") == 1: component.add_macros(CONFIG_ERASE_KEY); component = aos_component('prov_app', src) component.add_comp_deps('kernel/yloop', 'tools/cli', 'security/prov', 'security/prov/test') component.add_global_macros('AOS_NO_WIFI')
src = split('\n prov_app.c\n') if aos_global_config.get('ERASE') == 1: component.add_macros(CONFIG_ERASE_KEY) component = aos_component('prov_app', src) component.add_comp_deps('kernel/yloop', 'tools/cli', 'security/prov', 'security/prov/test') component.add_global_macros('AOS_NO_WIFI')
#!/usr/bin/env python3 # https://agc001.contest.atcoder.jp/tasks/agc001_a n = int(input()) l = [int(x) for x in input().split()] l.sort() print(sum(l[::2]))
n = int(input()) l = [int(x) for x in input().split()] l.sort() print(sum(l[::2]))
N,*H = [int(x) for x in open(0).read().split()] def solve(l, r): if l>r: return 0 min_=min(H[l:r+1]) for i in range(l,r+1): H[i]-=min_ count=min_ i=l while i<r: while i<=r and H[i]==0: i+=1 s=i while i<=r and H[i]>0: i+=1 count+=solve(s,i-1) return count print(solve(0, len(H)-1))
(n, *h) = [int(x) for x in open(0).read().split()] def solve(l, r): if l > r: return 0 min_ = min(H[l:r + 1]) for i in range(l, r + 1): H[i] -= min_ count = min_ i = l while i < r: while i <= r and H[i] == 0: i += 1 s = i while i <= r and H[i] > 0: i += 1 count += solve(s, i - 1) return count print(solve(0, len(H) - 1))
# FizzBuzz # Getting input from users for the max number to go to for FizzBuzz ip = input("Enter the max number to go for FizzBuzz: \n") # If user inputs a number this is executed if (ip != ""): for i in range(1, int(ip) + 1): if (i % 3 == 0 and i%5 == 0): print("FizzBuzz") elif (i % 3 == 0): print("Fizz") elif (i % 5 == 0): print("Buzz") else: print(i) # If the input is empty, the value is taken as 100 else: for i in range(1, 101): if (i % 3 == 0 and i%5 == 0): print("FizzBuzz") elif (i % 3 == 0): print("Fizz") elif (i % 5 == 0): print("Buzz") else: print(i)
ip = input('Enter the max number to go for FizzBuzz: \n') if ip != '': for i in range(1, int(ip) + 1): if i % 3 == 0 and i % 5 == 0: print('FizzBuzz') elif i % 3 == 0: print('Fizz') elif i % 5 == 0: print('Buzz') else: print(i) else: for i in range(1, 101): if i % 3 == 0 and i % 5 == 0: print('FizzBuzz') elif i % 3 == 0: print('Fizz') elif i % 5 == 0: print('Buzz') else: print(i)
town = input().lower() sell_count = float(input()) if 0<=sell_count<=500: if town == "sofia": comission = sell_count*0.05 print(f'{comission:.2f}') elif town=="varna": comission = sell_count * 0.045 print(f'{comission:.2f}') elif town == "plovdiv": comission = sell_count * 0.055 print(f'{comission:.2f}') else: print('error') elif 500<sell_count<=1000: if town == "sofia": comission = sell_count*0.07 print(f'{comission:.2f}') elif town=="varna": comission = sell_count * 0.075 print(f'{comission:.2f}') elif town == "plovdiv": comission = sell_count * 0.08 print(f'{comission:.2f}') else: print('error') elif 1000<sell_count<=10000: if town == "sofia": comission = sell_count*0.08 print(f'{comission:.2f}') elif town=="varna": comission = sell_count * 0.10 print(f'{comission:.2f}') elif town == "plovdiv": comission = sell_count * 0.12 print(f'{comission:.2f}') else: print('error') elif 10000 < sell_count: if town == "sofia": comission = sell_count*0.12 print(f'{comission:.2f}') elif town=="varna": comission = sell_count * 0.13 print(f'{comission:.2f}') elif town == "plovdiv": comission = sell_count * 0.145 print(f'{comission:.2f}') else: print('error') else: print('error')
town = input().lower() sell_count = float(input()) if 0 <= sell_count <= 500: if town == 'sofia': comission = sell_count * 0.05 print(f'{comission:.2f}') elif town == 'varna': comission = sell_count * 0.045 print(f'{comission:.2f}') elif town == 'plovdiv': comission = sell_count * 0.055 print(f'{comission:.2f}') else: print('error') elif 500 < sell_count <= 1000: if town == 'sofia': comission = sell_count * 0.07 print(f'{comission:.2f}') elif town == 'varna': comission = sell_count * 0.075 print(f'{comission:.2f}') elif town == 'plovdiv': comission = sell_count * 0.08 print(f'{comission:.2f}') else: print('error') elif 1000 < sell_count <= 10000: if town == 'sofia': comission = sell_count * 0.08 print(f'{comission:.2f}') elif town == 'varna': comission = sell_count * 0.1 print(f'{comission:.2f}') elif town == 'plovdiv': comission = sell_count * 0.12 print(f'{comission:.2f}') else: print('error') elif 10000 < sell_count: if town == 'sofia': comission = sell_count * 0.12 print(f'{comission:.2f}') elif town == 'varna': comission = sell_count * 0.13 print(f'{comission:.2f}') elif town == 'plovdiv': comission = sell_count * 0.145 print(f'{comission:.2f}') else: print('error') else: print('error')
class Compass(object): def __init__(self, spacedomains): self.categories = tuple(spacedomains) self.spacedomains = spacedomains # check time compatibility between components self._check_spacedomain_compatibilities(spacedomains) def _check_spacedomain_compatibilities(self, spacedomains): for category in spacedomains: # check that components' spacedomains are equal # (to stay until spatial supermesh supported) if not spacedomains[category].spans_same_region_as( spacedomains[self.categories[0]]): raise NotImplementedError( "components' spacedomains are not identical")
class Compass(object): def __init__(self, spacedomains): self.categories = tuple(spacedomains) self.spacedomains = spacedomains self._check_spacedomain_compatibilities(spacedomains) def _check_spacedomain_compatibilities(self, spacedomains): for category in spacedomains: if not spacedomains[category].spans_same_region_as(spacedomains[self.categories[0]]): raise not_implemented_error("components' spacedomains are not identical")
time1 = int(input()) time2 = int(input()) time3 = int(input()) sum = time1 + time2 + time3 minutes = int(sum / 60) seconds = sum % 60 if seconds <= 9: print('{0}:0{1}'.format(minutes, seconds)) else: print('{0}:{1}'.format(minutes, seconds))
time1 = int(input()) time2 = int(input()) time3 = int(input()) sum = time1 + time2 + time3 minutes = int(sum / 60) seconds = sum % 60 if seconds <= 9: print('{0}:0{1}'.format(minutes, seconds)) else: print('{0}:{1}'.format(minutes, seconds))
# # @lc app=leetcode id=908 lang=python3 # # [908] Smallest Range I # # @lc code=start class Solution: def smallestRangeI(self, A: List[int], K: int) -> int: mi, ma = min(A), max(A) return 0 if ma - mi - 2*K <= 0 else ma - mi - 2*K # @lc code=end
class Solution: def smallest_range_i(self, A: List[int], K: int) -> int: (mi, ma) = (min(A), max(A)) return 0 if ma - mi - 2 * K <= 0 else ma - mi - 2 * K
a = [[10,0],[10,0],[10,0],[10,0],[10,0],[10,0],[10,0],[10,0],[10,0],[10,0]] step=30 def setup(): size(500,500) smooth() noStroke() myInit() def myInit(): for i in range(len(a)): a[i]=[random(0,10)] for j in range(len(a[i])): a[i][j]=random(0,30) def draw(): global step fill(180,50) background(10) for i in range(len(a)): for j in range(len(a[i])): stroke(100) strokeWeight(1) fill(50) rect(i*step+100,j*step+100,step,step) noStroke() fill(250,90) ellipse (i*step +115 , j*step +115 , a[i][j], a[i][j]) def mouseClicked(): myInit()
a = [[10, 0], [10, 0], [10, 0], [10, 0], [10, 0], [10, 0], [10, 0], [10, 0], [10, 0], [10, 0]] step = 30 def setup(): size(500, 500) smooth() no_stroke() my_init() def my_init(): for i in range(len(a)): a[i] = [random(0, 10)] for j in range(len(a[i])): a[i][j] = random(0, 30) def draw(): global step fill(180, 50) background(10) for i in range(len(a)): for j in range(len(a[i])): stroke(100) stroke_weight(1) fill(50) rect(i * step + 100, j * step + 100, step, step) no_stroke() fill(250, 90) ellipse(i * step + 115, j * step + 115, a[i][j], a[i][j]) def mouse_clicked(): my_init()
# porownania print('----------') print((1, 2, 3) < (1, 2, 4)) print([1, 2, 3] < [1, 2, 4]) print('ABC' < 'C' < 'Pascal' < 'Python') print((1, 2, 3, 4) < (1, 2, 4)) print((1, 2) < (1, 2, -1)) print((1, 2, 3) == (1.0, 2.0, 3.0)) print((1, 2, ('aa', 'ab')) < (1, 2, ('abc', 'a'), 4)) print('--- inne ---') print(list((1, 2, 3)) < [1, 2, 3]) print((1, 2, 3) > tuple([1, 2, 3])) print(0 == 0 == 0.0 == 0j)
print('----------') print((1, 2, 3) < (1, 2, 4)) print([1, 2, 3] < [1, 2, 4]) print('ABC' < 'C' < 'Pascal' < 'Python') print((1, 2, 3, 4) < (1, 2, 4)) print((1, 2) < (1, 2, -1)) print((1, 2, 3) == (1.0, 2.0, 3.0)) print((1, 2, ('aa', 'ab')) < (1, 2, ('abc', 'a'), 4)) print('--- inne ---') print(list((1, 2, 3)) < [1, 2, 3]) print((1, 2, 3) > tuple([1, 2, 3])) print(0 == 0 == 0.0 == 0j)
################################### SERVER'S SIDE ################################### #const mask = 0xffffffff #bitwise operations have the least priority #Note 1: all variables are unsigned 32-bit quantities and wrap modulo 2**32 when calculating, except for #ml, message length: 64-bit quantity, and #hh, message digest: 160-bit quantity #Note 2: big endian key = b'SuPeR_sEcReT_kEy,_NoT_tO_bE_gUeSsEd_So_EaSiLy' def big_endian_64_bit( num ): num = hex(num).replace('0x','').rjust(16,'0') return bytes([int(num[i:i+2], 16) for i in range(0, len(num), 2)]) def leftrot( num ): return ((num << 1) & mask) + (num >> 31) def bytes2int( block ): return sum([block[len(block)-1-i] * (256**i) for i in range(len(block))]) def leftrotate(num, offset): num_type = type(num) if num_type == bytes: num = bytes2int(num) for i in range(offset): num = leftrot(num) if num_type == bytes: num = big_endian_64_bit( num )[4:] return num def XOR( block1, block2, block3, block4 ): return bytes([x^y^z^t for x,y,z,t in zip(block1, block2, block3, block4)]) def SHA1( message ): #the inner mechanism only #Initialize variable: h0 = 0x67452301 h1 = 0xEFCDAB89 h2 = 0x98BADCFE h3 = 0x10325476 h4 = 0xC3D2E1F0 ml = len(message) * 8 #Pre-processing message += b'\x80' while (len(message) * 8) % 512 != 448: message += b'\x00' message += big_endian_64_bit( ml % (2**64)) #Process the message in successive 512-bit chunks: chunks = [message[i:i+64] for i in range(0, len(message), 64)] for chunk in chunks: w = [chunk[i:i+4] for i in range(0, 64, 4)] #Message schedule: extend the sixteen 32-bit words into eighty 32-bit words: for i in range(16, 80): #Note 3: SHA-0 differs by not having this leftrotate. w += [leftrotate( XOR(w[i-3], w[i-8], w[i-14], w[i-16]), 1 )] #Initialize hash value for this chunk: a = h0 b = h1 c = h2 d = h3 e = h4 #Main loop: for i in range(80): f = 0 k = 0 if i in range(20): f = (b & c) | ((b ^ mask) & d) k = 0x5A827999 elif i in range(20,40): f = b ^ c ^ d k = 0x6ED9EBA1 elif i in range(40,60): f = (b & c) | (b & d) | (c & d) k = 0x8F1BBCDC elif i in range(60,80): f = b ^ c ^ d k = 0xCA62C1D6 temp = (leftrotate(a, 5) + f + e + k + bytes2int(w[i])) % (2**32) e = d d = c c = leftrotate(b, 30) b = a a = temp #Add this chunk's hash to result so far: h0 = (h0 + a) % (2**32) h1 = (h1 + b) % (2**32) h2 = (h2 + c) % (2**32) h3 = (h3 + d) % (2**32) h4 = (h4 + e) % (2**32) #Produce the final hash value (big-endian) as a 160-bit number: hh = (h0 << 128) | (h1 << 96) | (h2 << 64) | (h3 << 32) | h4 return hh def isValid( message, hh ): res = False if SHA1(key + message) == hh: res = True return res ################################### ATTACKER'S SIDE ################################### def pad( bytelength ): #MD_padding ml = bytelength * 8 #Pre-processing padding = b'\x80' while ((bytelength + len(padding)) * 8) % 512 != 448: padding += b'\x00' padding += big_endian_64_bit( ml ) return padding def SHA1_LE(old_hh, wanna_be, length): if (len(wanna_be + pad(length)) * 8) % 512 != 0: hh = -1 else: #Initialize variable: h0 = (old_hh & (mask << 128)) >> 128 h1 = (old_hh & (mask << 96)) >> 96 h2 = (old_hh & (mask << 64)) >> 64 h3 = (old_hh & (mask << 32)) >> 32 h4 = old_hh & mask ml = length * 8 #Pre-processing message = wanna_be + pad(length) #Process the message in successive 512-bit chunks: chunks = [message[i:i+64] for i in range(0, len(message), 64)] for chunk in chunks: w = [chunk[i:i+4] for i in range(0, 64, 4)] #Message schedule: extend the sixteen 32-bit words into eighty 32-bit words: for i in range(16, 80): #Note 3: SHA-0 differs by not having this leftrotate. w += [leftrotate( XOR(w[i-3], w[i-8], w[i-14], w[i-16]), 1 )] #Initialize hash value for this chunk: a = h0 b = h1 c = h2 d = h3 e = h4 #Main loop: for i in range(80): f = 0 k = 0 if i in range(20): f = (b & c) | ((b ^ mask) & d) k = 0x5A827999 elif i in range(20,40): f = b ^ c ^ d k = 0x6ED9EBA1 elif i in range(40,60): f = (b & c) | (b & d) | (c & d) k = 0x8F1BBCDC elif i in range(60,80): f = b ^ c ^ d k = 0xCA62C1D6 temp = (leftrotate(a, 5) + f + e + k + bytes2int(w[i])) % (2**32) e = d d = c c = leftrotate(b, 30) b = a a = temp #Add this chunk's hash to result so far: h0 = (h0 + a) % (2**32) h1 = (h1 + b) % (2**32) h2 = (h2 + c) % (2**32) h3 = (h3 + d) % (2**32) h4 = (h4 + e) % (2**32) #Produce the final hash value (big-endian) as a 160-bit number: hh = (h0 << 128) | (h1 << 96) | (h2 << 64) | (h3 << 32) | h4 return hh def main(): print('========= A user is granting access to the server =========') #user has this message mes = b'comment1=cooking%20MCs;userdata=foo;comment2=%20like%20a%20pound%20of%20bacon' #user sign it with a common key shared with the server old_hh = SHA1(key + mes) #user use the message and its signature to the server valid = isValid(mes, old_hh) if valid: print('Welcome back!') else: print('Invalid signature, please check your information again.') print('\n========= And an attack has retrieve the user\'s message and corresponding hash =========') print(mes) print(hex(old_hh).replace('0x','').rjust(40,'0')) print('\nNow he will implement the length extension attack on SHA-1 to make a new valid message') print('with signature without any knowledge of the secret key itself...') wanna_be = b';admin=true' keyl = -1 message = b'' hh = -1 while not isValid(message, hh): keyl += 1 message = mes + pad(keyl + len(mes)) + wanna_be hh = SHA1_LE(old_hh, wanna_be, keyl + len(message)) print('\nFINALLY!!!!!!!!!!!') print('Keyl = ' + str(keyl)) print(message) print(hex(SHA1(key + message)).replace('0x','').rjust(40,'0')) #for demonstration purpose only print(hex(hh).replace('0x','').rjust(40,'0')) if __name__ == '__main__': main()
mask = 4294967295 key = b'SuPeR_sEcReT_kEy,_NoT_tO_bE_gUeSsEd_So_EaSiLy' def big_endian_64_bit(num): num = hex(num).replace('0x', '').rjust(16, '0') return bytes([int(num[i:i + 2], 16) for i in range(0, len(num), 2)]) def leftrot(num): return (num << 1 & mask) + (num >> 31) def bytes2int(block): return sum([block[len(block) - 1 - i] * 256 ** i for i in range(len(block))]) def leftrotate(num, offset): num_type = type(num) if num_type == bytes: num = bytes2int(num) for i in range(offset): num = leftrot(num) if num_type == bytes: num = big_endian_64_bit(num)[4:] return num def xor(block1, block2, block3, block4): return bytes([x ^ y ^ z ^ t for (x, y, z, t) in zip(block1, block2, block3, block4)]) def sha1(message): h0 = 1732584193 h1 = 4023233417 h2 = 2562383102 h3 = 271733878 h4 = 3285377520 ml = len(message) * 8 message += b'\x80' while len(message) * 8 % 512 != 448: message += b'\x00' message += big_endian_64_bit(ml % 2 ** 64) chunks = [message[i:i + 64] for i in range(0, len(message), 64)] for chunk in chunks: w = [chunk[i:i + 4] for i in range(0, 64, 4)] for i in range(16, 80): w += [leftrotate(xor(w[i - 3], w[i - 8], w[i - 14], w[i - 16]), 1)] a = h0 b = h1 c = h2 d = h3 e = h4 for i in range(80): f = 0 k = 0 if i in range(20): f = b & c | (b ^ mask) & d k = 1518500249 elif i in range(20, 40): f = b ^ c ^ d k = 1859775393 elif i in range(40, 60): f = b & c | b & d | c & d k = 2400959708 elif i in range(60, 80): f = b ^ c ^ d k = 3395469782 temp = (leftrotate(a, 5) + f + e + k + bytes2int(w[i])) % 2 ** 32 e = d d = c c = leftrotate(b, 30) b = a a = temp h0 = (h0 + a) % 2 ** 32 h1 = (h1 + b) % 2 ** 32 h2 = (h2 + c) % 2 ** 32 h3 = (h3 + d) % 2 ** 32 h4 = (h4 + e) % 2 ** 32 hh = h0 << 128 | h1 << 96 | h2 << 64 | h3 << 32 | h4 return hh def is_valid(message, hh): res = False if sha1(key + message) == hh: res = True return res def pad(bytelength): ml = bytelength * 8 padding = b'\x80' while (bytelength + len(padding)) * 8 % 512 != 448: padding += b'\x00' padding += big_endian_64_bit(ml) return padding def sha1_le(old_hh, wanna_be, length): if len(wanna_be + pad(length)) * 8 % 512 != 0: hh = -1 else: h0 = (old_hh & mask << 128) >> 128 h1 = (old_hh & mask << 96) >> 96 h2 = (old_hh & mask << 64) >> 64 h3 = (old_hh & mask << 32) >> 32 h4 = old_hh & mask ml = length * 8 message = wanna_be + pad(length) chunks = [message[i:i + 64] for i in range(0, len(message), 64)] for chunk in chunks: w = [chunk[i:i + 4] for i in range(0, 64, 4)] for i in range(16, 80): w += [leftrotate(xor(w[i - 3], w[i - 8], w[i - 14], w[i - 16]), 1)] a = h0 b = h1 c = h2 d = h3 e = h4 for i in range(80): f = 0 k = 0 if i in range(20): f = b & c | (b ^ mask) & d k = 1518500249 elif i in range(20, 40): f = b ^ c ^ d k = 1859775393 elif i in range(40, 60): f = b & c | b & d | c & d k = 2400959708 elif i in range(60, 80): f = b ^ c ^ d k = 3395469782 temp = (leftrotate(a, 5) + f + e + k + bytes2int(w[i])) % 2 ** 32 e = d d = c c = leftrotate(b, 30) b = a a = temp h0 = (h0 + a) % 2 ** 32 h1 = (h1 + b) % 2 ** 32 h2 = (h2 + c) % 2 ** 32 h3 = (h3 + d) % 2 ** 32 h4 = (h4 + e) % 2 ** 32 hh = h0 << 128 | h1 << 96 | h2 << 64 | h3 << 32 | h4 return hh def main(): print('========= A user is granting access to the server =========') mes = b'comment1=cooking%20MCs;userdata=foo;comment2=%20like%20a%20pound%20of%20bacon' old_hh = sha1(key + mes) valid = is_valid(mes, old_hh) if valid: print('Welcome back!') else: print('Invalid signature, please check your information again.') print("\n========= And an attack has retrieve the user's message and corresponding hash =========") print(mes) print(hex(old_hh).replace('0x', '').rjust(40, '0')) print('\nNow he will implement the length extension attack on SHA-1 to make a new valid message') print('with signature without any knowledge of the secret key itself...') wanna_be = b';admin=true' keyl = -1 message = b'' hh = -1 while not is_valid(message, hh): keyl += 1 message = mes + pad(keyl + len(mes)) + wanna_be hh = sha1_le(old_hh, wanna_be, keyl + len(message)) print('\nFINALLY!!!!!!!!!!!') print('Keyl = ' + str(keyl)) print(message) print(hex(sha1(key + message)).replace('0x', '').rjust(40, '0')) print(hex(hh).replace('0x', '').rjust(40, '0')) if __name__ == '__main__': main()
# DOCUMENTATION # main def main(): canadian = {"red", "white"} british = {"red", "blue", "white"} italian = {"red", "white", "green"} if canadian.issubset(british): print("canadian flag colours occur in british") if not italian.issubset(british): print("not all italian flag colors occur in british") french = {"red", "white", "blue"} if french == british: print("all colors in french occur in british") french.add("transparent") print(french) french.discard("transparent") print(french) print(canadian.union(italian)) print(british.intersection(italian)) print(british.difference(italian)) try: french.remove("waldo") except Exception: print("waldo not found") print(french.clear()) # PROGRAM RUN if __name__ == "__main__": main()
def main(): canadian = {'red', 'white'} british = {'red', 'blue', 'white'} italian = {'red', 'white', 'green'} if canadian.issubset(british): print('canadian flag colours occur in british') if not italian.issubset(british): print('not all italian flag colors occur in british') french = {'red', 'white', 'blue'} if french == british: print('all colors in french occur in british') french.add('transparent') print(french) french.discard('transparent') print(french) print(canadian.union(italian)) print(british.intersection(italian)) print(british.difference(italian)) try: french.remove('waldo') except Exception: print('waldo not found') print(french.clear()) if __name__ == '__main__': main()
# @desc Predict the returned value # @desc by Savonnah '23 def calc(num): if num <= 10: result = num * 2 else: result = num * 10 return result def main(): print(calc(1)) print(calc(41)) print(calc(-5)) print(calc(3)) print(calc(10)) if __name__ == '__main__': main()
def calc(num): if num <= 10: result = num * 2 else: result = num * 10 return result def main(): print(calc(1)) print(calc(41)) print(calc(-5)) print(calc(3)) print(calc(10)) if __name__ == '__main__': main()
### PROBLEM 3 degF = 40.5 degC = (5/9) * (degF - 32) print(degC) #when degF is -40.0, degC is -40.0 ##when degF is 40.5, degC is 4.72
deg_f = 40.5 deg_c = 5 / 9 * (degF - 32) print(degC)
# # @lc app=leetcode id=1290 lang=python3 # # [1290] Convert Binary Number in a Linked List to Integer # # @lc code=start # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def getDecimalValue(self, head: ListNode) -> int: decimal = 0 while head: decimal <<= 1 decimal |= head.val head = head.next return decimal # @lc code=end
class Solution: def get_decimal_value(self, head: ListNode) -> int: decimal = 0 while head: decimal <<= 1 decimal |= head.val head = head.next return decimal
#!/usr/bin/python3 def palindrome(num): if num == num[::-1]: return True return False def addOne(num): num = int(num) + 1 return str(num) def isPalindrome(num): num = str(num) num = num.zfill(6) value = palindrome(num[2:]) if value: num = num.zfill(6) value2 = palindrome(num[1:]) if value2: num = num.zfill(6) value3 = palindrome(num[1:-2]) if value3: num = num.zfill(6) value4 = palindrome(num) if value4: return True return False resultList = [] for i in range(1, 999996): result = isPalindrome(i) if result: resultList.append(i) print(resultList)
def palindrome(num): if num == num[::-1]: return True return False def add_one(num): num = int(num) + 1 return str(num) def is_palindrome(num): num = str(num) num = num.zfill(6) value = palindrome(num[2:]) if value: num = num.zfill(6) value2 = palindrome(num[1:]) if value2: num = num.zfill(6) value3 = palindrome(num[1:-2]) if value3: num = num.zfill(6) value4 = palindrome(num) if value4: return True return False result_list = [] for i in range(1, 999996): result = is_palindrome(i) if result: resultList.append(i) print(resultList)
a = int(input()) b = int(a/5) if (a%5 == 0): print(b) else: print(b+1)
a = int(input()) b = int(a / 5) if a % 5 == 0: print(b) else: print(b + 1)
# Day8 of my 100DaysOfCode Challenge # Program to open a file in append mode file = open('Day8/new.txt', 'a') file.write("This is a really great experience") file.close()
file = open('Day8/new.txt', 'a') file.write('This is a really great experience') file.close()
#!/usr/bin/python def max_in_list(list_of_numbers): ''' Finds the largest number in a list ''' biggest_num = 0 for i in list_of_numbers: if i > biggest_num: biggest_num = i return(biggest_num)
def max_in_list(list_of_numbers): """ Finds the largest number in a list """ biggest_num = 0 for i in list_of_numbers: if i > biggest_num: biggest_num = i return biggest_num
{ "targets":[ { "target_name": "accessor", "sources": ["accessor.cpp"] } ] }
{'targets': [{'target_name': 'accessor', 'sources': ['accessor.cpp']}]}
# terrascript/data/Trois-Six/sendgrid.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:26:45 UTC) __all__ = []
__all__ = []
__author__ = 'arobres, jfernandez' # PUPPET WRAPPER CONFIGURATION PUPPET_MASTER_PROTOCOL = 'https' PUPPET_WRAPPER_IP = 'puppet-master.dev-havana.fi-ware.org' PUPPET_WRAPPER_PORT = 8443 PUPPET_MASTER_USERNAME = 'root' PUPPET_MASTER_PWD = '**********' PUPPET_WRAPPER_MONGODB_PORT = 27017 PUPPET_WRAPPER_MONGODB_DB_NAME = 'puppetWrapper' PUPPET_WRAPPER_MONGODB_COLLECTION = 'nodes' #AUTHENTICATION CONFIG_KEYSTONE_URL = 'http://130.206.80.57:4731/v2.0/tokens' CONFIG_KEYSTONE_TENANT_NAME_VALUE = '**********' CONFIG_KEYSTONE_USERNAME_VALUE = '**********' CONFIG_KEYSTONE_PWD_VALUE = '**********'
__author__ = 'arobres, jfernandez' puppet_master_protocol = 'https' puppet_wrapper_ip = 'puppet-master.dev-havana.fi-ware.org' puppet_wrapper_port = 8443 puppet_master_username = 'root' puppet_master_pwd = '**********' puppet_wrapper_mongodb_port = 27017 puppet_wrapper_mongodb_db_name = 'puppetWrapper' puppet_wrapper_mongodb_collection = 'nodes' config_keystone_url = 'http://130.206.80.57:4731/v2.0/tokens' config_keystone_tenant_name_value = '**********' config_keystone_username_value = '**********' config_keystone_pwd_value = '**********'
''' A simple programme to print hex grid on terminal screen. Tip: I have used `raw` strings. Author: Sunil Dhaka ''' GRID_WIDTH=20 GRID_HEIGHT=16 def main(): for _ in range(GRID_HEIGHT): for _ in range(GRID_WIDTH): print(r'/ \_',end='') print() for _ in range(GRID_WIDTH): print(r'\_/ ',end='') print() if __name__=='__main__': main()
""" A simple programme to print hex grid on terminal screen. Tip: I have used `raw` strings. Author: Sunil Dhaka """ grid_width = 20 grid_height = 16 def main(): for _ in range(GRID_HEIGHT): for _ in range(GRID_WIDTH): print('/ \\_', end='') print() for _ in range(GRID_WIDTH): print('\\_/ ', end='') print() if __name__ == '__main__': main()
''' Order the following functions by asymptotic growth rate. 4nlog n+2n 210 2log n 3n+100log n 4n 2n n2 +10n n3 nlog n ''' ''' 2^10 O(1) 3n+100log(n) O(log(n)) 4n O(n) 4nlog(n)+2n and O(nlog(n)) n^2+10n and O(n^2) n^3 O(n^3) 2^(log(n)) O(2^(log(n))) 2^n O(2^n) '''
""" Order the following functions by asymptotic growth rate. 4nlog n+2n 210 2log n 3n+100log n 4n 2n n2 +10n n3 nlog n """ '\n2^10 O(1)\n3n+100log(n) O(log(n))\n4n O(n)\n4nlog(n)+2n and O(nlog(n))\nn^2+10n and O(n^2)\nn^3 O(n^3)\n2^(log(n)) O(2^(log(n)))\n2^n O(2^n)\n'
# encoding = utf-8 class GreekGetter: def get(self, msgid): return msgid[::-1] class EnglishGetter: def get(self, msgid): return msgid[:] def get_localizer(language="English"): languages = dict(English=EnglishGetter, Greek=GreekGetter) return languages[language]() # Create our localizers e, g = get_localizer("English"), get_localizer("Greek") # Localize some text print([(e.get(msgid), g.get(msgid)) for msgid in "dog parrot cat bear".split()])
class Greekgetter: def get(self, msgid): return msgid[::-1] class Englishgetter: def get(self, msgid): return msgid[:] def get_localizer(language='English'): languages = dict(English=EnglishGetter, Greek=GreekGetter) return languages[language]() (e, g) = (get_localizer('English'), get_localizer('Greek')) print([(e.get(msgid), g.get(msgid)) for msgid in 'dog parrot cat bear'.split()])
print("Enter the number of terms:") n=int(input()) a=0 b=1 for i in range(n+1): c=a+b a=b b=c print(c,end=" ")
print('Enter the number of terms:') n = int(input()) a = 0 b = 1 for i in range(n + 1): c = a + b a = b b = c print(c, end=' ')
class Foo: def __init__(self): self.tmp = False def extract_method(self, condition1, condition2, condition3, condition4): list = (1, 2, 3) a = 6 b = False if a in list or self.tmp: if condition1: print(condition1) if b is not condition2: print(b) else: self.bar(condition3, condition4) def bar(self, condition3_new, condition4_new): self.tmp2 = True if condition3_new: print(condition3_new) if condition4_new: print(condition4_new) print("misterious extract method test") f = Foo() f.extract_method(True, True, True, True)
class Foo: def __init__(self): self.tmp = False def extract_method(self, condition1, condition2, condition3, condition4): list = (1, 2, 3) a = 6 b = False if a in list or self.tmp: if condition1: print(condition1) if b is not condition2: print(b) else: self.bar(condition3, condition4) def bar(self, condition3_new, condition4_new): self.tmp2 = True if condition3_new: print(condition3_new) if condition4_new: print(condition4_new) print('misterious extract method test') f = foo() f.extract_method(True, True, True, True)
# Escape Sequences # \\ # \' # \" # \n course_name = "Pyton Mastery \n with Mosh" print(course_name)
course_name = 'Pyton Mastery \n with Mosh' print(course_name)
class VolumeRaidLevels(object): def read_get(self, name, idx_name, unity_client): return unity_client.get_lun_raid_type(idx_name) class VolumeRaidLevelsColumn(object): def get_idx(self, name, idx, unity_client): return unity_client.get_luns()
class Volumeraidlevels(object): def read_get(self, name, idx_name, unity_client): return unity_client.get_lun_raid_type(idx_name) class Volumeraidlevelscolumn(object): def get_idx(self, name, idx, unity_client): return unity_client.get_luns()
NORTH = 0 EAST = 1 SOUTH = 2 WEST = 3 X_MOD = [0,1,0,-1] Y_MOD = [1,0,-1,0] num_states = 0 state_trans = [] infected_state = 0 class Node: def __init__(self, state, x, y): self.x = x self.y = y self.state = state def updateDir(self, dir): ''' Directions can be anything from 0 to 3 trans state tells us where to jump to based on the current state ''' dir = (dir + state_trans[self.state]) % 4 return dir def updateState(self): ''' states always increment and are bounded by max # states ''' self.state = ((self.state) + 1) % num_states return self.state def getNextNode(self, dir, nodes): ''' based on direction an current position, find the next node if we've never seen it before, create it ''' x = self.x + X_MOD[dir] y = self.y + Y_MOD[dir] name = 'x%dy%d' % (x,y) if not name in nodes: nodes[name] = Node(0,x,y) return nodes[name] def update(self, dir, nodes): ''' determine new direction, state and node return 1) if we infected the node 2) the next node to process 3) the direction we are facing on the next node ''' dir = self.updateDir(dir) self.updateState() return (self.state == infected_state), self.getNextNode(dir, nodes), dir def solveInfected(lines, iterations): ''' cretes the base list of nodes based on input then determine how many infections occur ''' nodes = {} startx = (len(lines[0].strip()) // 2) starty = (len(lines) // 2) * -1 startname = 'x%dy%d' % (startx, starty) y = 0 for line in lines: x = 0 for c in line.strip(): name = 'x%dy%d' % (x,y) if c == '#': nodes[name] = Node(infected_state,x,y) else: nodes[name] = Node(0,x,y) x += 1 y -= 1 node = nodes[startname] infect_count = 0 dir = NORTH for i in range(iterations): infected, node, dir = node.update(dir, nodes) if infected: infect_count += 1 print(infect_count) with open("input") as f: lines = f.readlines() # for part 1, two states # state 0, CLEAN, causes a right turn # state 1, INFECTED, causes a left turn (or 3 right turns) num_states = 2 state_trans = [3, 1] infected_state = 1 solveInfected(lines, 10000) # for part 2, fpir states # state 0, CLEAN, causes a right turn # state 1, WEAKENED, does not turn # state 2, INFECTED, causes a left turn (or 3 right turns) # state 3, FLAGGED, causes a turn around (or 2 right turns) num_states = 4 state_trans = [3, 0, 1, 2] infected_state = 2 solveInfected(lines, 10000000)
north = 0 east = 1 south = 2 west = 3 x_mod = [0, 1, 0, -1] y_mod = [1, 0, -1, 0] num_states = 0 state_trans = [] infected_state = 0 class Node: def __init__(self, state, x, y): self.x = x self.y = y self.state = state def update_dir(self, dir): """ Directions can be anything from 0 to 3 trans state tells us where to jump to based on the current state """ dir = (dir + state_trans[self.state]) % 4 return dir def update_state(self): """ states always increment and are bounded by max # states """ self.state = (self.state + 1) % num_states return self.state def get_next_node(self, dir, nodes): """ based on direction an current position, find the next node if we've never seen it before, create it """ x = self.x + X_MOD[dir] y = self.y + Y_MOD[dir] name = 'x%dy%d' % (x, y) if not name in nodes: nodes[name] = node(0, x, y) return nodes[name] def update(self, dir, nodes): """ determine new direction, state and node return 1) if we infected the node 2) the next node to process 3) the direction we are facing on the next node """ dir = self.updateDir(dir) self.updateState() return (self.state == infected_state, self.getNextNode(dir, nodes), dir) def solve_infected(lines, iterations): """ cretes the base list of nodes based on input then determine how many infections occur """ nodes = {} startx = len(lines[0].strip()) // 2 starty = len(lines) // 2 * -1 startname = 'x%dy%d' % (startx, starty) y = 0 for line in lines: x = 0 for c in line.strip(): name = 'x%dy%d' % (x, y) if c == '#': nodes[name] = node(infected_state, x, y) else: nodes[name] = node(0, x, y) x += 1 y -= 1 node = nodes[startname] infect_count = 0 dir = NORTH for i in range(iterations): (infected, node, dir) = node.update(dir, nodes) if infected: infect_count += 1 print(infect_count) with open('input') as f: lines = f.readlines() num_states = 2 state_trans = [3, 1] infected_state = 1 solve_infected(lines, 10000) num_states = 4 state_trans = [3, 0, 1, 2] infected_state = 2 solve_infected(lines, 10000000)
# uncompyle6 version 3.2.0 # Python bytecode 2.4 (62061) # Decompiled from: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] # Embedded file name: pirates.makeapirate.MakeAPirateGlobals BODYSHOP = 0 HEADSHOP = 1 MOUTHSHOP = 2 EYESSHOP = 3 NOSESHOP = 4 EARSHOP = 5 HAIRSHOP = 6 CLOTHESSHOP = 7 NAMESHOP = 8 TATTOOSHOP = 9 JEWELRYSHOP = 10 AVATAR_PIRATE = 0 AVATAR_SKELETON = 1 AVATAR_NAVY = 2 AVATAR_CAST = 3 ShopNames = [ 'BodyShop', 'HeadShop', 'MouthShop', 'EyesShop', 'NoseShop', 'EarShop', 'HairShop', 'ClothesShop', 'NameShop', 'TattooShop', 'JewelryShop'] LODList = [ 2000, 1000, 500] AnimList = [ 'idle', 'attention', 'axe_chop_idle', 'axe_chop_look_idle', 'bar_talk01_idle', 'bar_talk01_into_look', 'bar_talk01_look_idle', 'bar_talk01_outof_look', 'bar_talk02_idle', 'bar_talk02_into_look', 'bar_talk02_look_idle', 'bar_talk02_outof_look', 'bar_wipe', 'bar_wipe_into_look', 'bar_wipe_look_idle', 'bar_wipe_outof_look', 'bar_write_idle', 'bar_write_into_look', 'bar_write_look_idle', 'bar_write_outof_look', 'barrel_hide_idle', 'barrel_hide_into_look', 'barrel_hide_look_idle', 'barrel_hide_outof_look', 'bayonet_attackA', 'bayonet_attackB', 'bayonet_attackC', 'bayonet_attack_idle', 'bayonet_attack_walk', 'bayonet_drill', 'bayonet_fall_ground', 'bayonet_idle', 'bayonet_idle_to_fight_idle', 'bayonet_jump', 'bayonet_run', 'bayonet_turn_left', 'bayonet_turn_right', 'bayonet_walk', 'bigbomb_charge', 'bigbomb_charge_loop', 'bigbomb_charge_throw', 'bigbomb_draw', 'bigbomb_idle', 'bigbomb_throw', 'bigbomb_walk', 'bigbomb_walk_left', 'bigbomb_walk_left_diagonal', 'bigbomb_walk_right', 'bigbomb_walk_right_diagonal', 'bindPose', 'blacksmith_work_idle', 'blacksmith_work_into_look', 'blacksmith_work_look_idle', 'blacksmith_work_outof_look', 'blunderbuss_reload', 'board', 'bomb_charge', 'bomb_charge_loop', 'bomb_charge_throw', 'bomb_draw', 'bomb_hurt', 'bomb_idle', 'bomb_receive', 'bomb_throw', 'boxing_fromidle', 'boxing_haymaker', 'boxing_hit_head_right', 'boxing_idle', 'boxing_idle_alt', 'boxing_kick', 'boxing_punch', 'broadsword_combo', 'cards_bad_tell', 'cards_bet', 'cards_blackjack_hit', 'cards_blackjack_stay', 'cards_cheat', 'cards_check', 'cards_good_tell', 'cards_hide', 'cards_hide_hit', 'cards_hide_idle', 'cards_pick_up', 'cards_pick_up_idle', 'cards_set_down', 'cards_set_down_lose', 'cards_set_down_win', 'cards_set_down_win_show', 'cargomaster_work_idle', 'cargomaster_work_into_look', 'cargomaster_work_look_idle', 'cargomaster_work_outof_look', 'chant_a_idle', 'chant_b_idle', 'chest_idle', 'chest_kneel_to_steal', 'chest_putdown', 'chest_steal', 'chest_strafe_left', 'chest_strafe_right', 'chest_walk', 'coin_flip_idle', 'coin_flip_look_idle', 'coin_flip_old_idle', 'cower_idle', 'cower_into', 'cower_outof', 'crazy_idle', 'crazy_look_idle', 'cutlass_attention', 'cutlass_bladestorm', 'cutlass_combo', 'cutlass_headbutt', 'cutlass_hurt', 'cutlass_kick', 'cutlass_multihit', 'cutlass_sweep', 'cutlass_taunt', 'cutlass_walk_navy', 'dagger_asp', 'dagger_backstab', 'dagger_combo', 'dagger_coup', 'dagger_hurt', 'dagger_receive', 'dagger_throw_combo', 'dagger_throw_sand', 'dagger_vipers_nest', 'deal', 'deal_idle', 'deal_left', 'deal_right', 'death', 'death2', 'death3', 'death4', 'doctor_work_idle', 'doctor_work_into_look', 'doctor_work_look_idle', 'doctor_work_outof_look', 'drink_potion', 'dualcutlass_combo', 'dualcutlass_draw', 'dualcutlass_idle', 'emote_anger', 'emote_blow_kiss', 'emote_celebrate', 'emote_clap', 'emote_coin_toss', 'emote_crazy', 'emote_cut_throat', 'emote_dance_jig', 'emote_duhhh', 'emote_embarrassed', 'emote_face_smack', 'emote_fear', 'emote_flex', 'emote_flirt', 'emote_hand_it_over', 'emote_head_scratch', 'emote_laugh', 'emote_navy_scared', 'emote_navy_wants_fight', 'emote_nervous', 'emote_newyears', 'emote_no', 'emote_sad', 'emote_sassy', 'emote_scared', 'emote_show_me_the_money', 'emote_shrug', 'emote_sincere_thanks', 'emote_smile', 'emote_snarl', 'emote_talk_to_the_hand', 'emote_thriller', 'emote_wave', 'emote_wink', 'emote_yawn', 'emote_yes', 'fall_ground', 'flute_idle', 'flute_look_idle', 'foil_coup', 'foil_hack', 'foil_idle', 'foil_kick', 'foil_slash', 'foil_thrust', 'friend_pose', 'gun_aim_idle', 'gun_draw', 'gun_fire', 'gun_hurt', 'gun_pointedup_idle', 'gun_putaway', 'gun_reload', 'gun_strafe_left', 'hand_curse_check', 'hand_curse_get_sword', 'hand_curse_reaction', 'idle_B_shiftWeight', 'idle_butt_scratch', 'idle_flex', 'idle_handhip', 'idle_handhip_from_idle', 'idle_head_scratch', 'idle_head_scratch_side', 'idle_hit', 'idle_sit', 'idle_sit_alt', 'idle_yawn', 'injured_fall', 'injured_healing_into', 'injured_healing_loop', 'injured_healing_outof', 'injured_idle', 'injured_idle_shakehead', 'injured_standup', 'into_deal', 'jail_dropinto', 'jail_idle', 'jail_standup', 'jump', 'jump_idle', 'kick_door', 'kick_door_loop', 'kneel', 'kneel_fromidle', 'knife_throw', 'kraken_fight_idle', 'kraken_struggle_idle', 'left_face', 'loom_idle', 'loom_into_look', 'loom_look_idle', 'loom_outof_look', 'lute_idle', 'lute_into_look', 'lute_look_idle', 'lute_outof_look', 'map_head_into_look_left', 'map_head_look_left_idle', 'map_head_outof_look_left', 'map_look_arm_left', 'map_look_arm_right', 'map_look_boot_left', 'map_look_boot_right', 'map_look_pant_right', 'march', 'patient_work_idle', 'primp_idle', 'primp_into_look', 'primp_look_idle', 'primp_outof_look', 'repair_bench', 'repairfloor_idle', 'repairfloor_into', 'repairfloor_outof', 'rifle_fight_forward_diagonal_left', 'rifle_fight_forward_diagonal_right', 'rifle_fight_idle', 'rifle_fight_run_strafe_left', 'rifle_fight_run_strafe_right', 'rifle_fight_shoot_high', 'rifle_fight_shoot_high_idle', 'rifle_fight_shoot_hip', 'rifle_fight_walk', 'rifle_fight_walk_back_diagonal_left', 'rifle_fight_walk_back_diagonal_right', 'rifle_fight_walk_strafe_left', 'rifle_fight_walk_strafe_right', 'rifle_idle_to_fight_idle', 'rifle_reload_hip', 'rigging_climb', 'rigTest', 'rope_board', 'rope_dismount', 'rope_grab', 'rope_grab_from_idle', 'run', 'run_diagonal_left', 'run_diagonal_right', 'run_with_weapon', 'sabre_combo', 'sabre_comboA', 'sabre_comboB', 'sand_in_eyes', 'sand_in_eyes_holdweapon_noswing', 'screenshot_pose', 'search_low', 'search_med', 'semi_conscious_loop', 'semi_conscious_standup', 'shovel', 'shovel_idle', 'shovel_idle_into_dig', 'sit', 'sit_cower_idle', 'sit_cower_into_sleep', 'sit_hanginglegs_idle', 'sit_hanginglegs_into_look', 'sit_hanginglegs_look_idle', 'sit_hanginglegs_outof_look', 'sit_idle', 'sit_sleep_idle', 'sit_sleep_into_cower', 'sit_sleep_into_look', 'sit_sleep_look_idle', 'sit_sleep_outof_look', 'sleep_idle', 'sleep_into_look', 'sleep_outof_look', 'sleep_sick_idle', 'sleep_sick_into_look', 'sleep_sick_look_idle', 'sleep_sick_outof_look', 'sow_idle', 'sow_into_look', 'sow_look_idle', 'sow_outof_look', 'spin_left', 'spin_right', 'stir_idle', 'stir_into_look', 'stir_look_idle', 'stir_outof_look', 'stock_idle', 'stock_sleep', 'stock_sleep_to_idle', 'stowaway_get_in_crate', 'strafe_left', 'strafe_right', 'summon_idle', 'sweep', 'sweep_idle', 'sweep_into_look', 'sweep_look_idle', 'sweep_outof_look', 'swim', 'swim_back', 'swim_back_diagonal_left', 'swim_back_diagonal_right', 'swim_into_tread_water', 'swim_left', 'swim_left_diagonal', 'swim_right', 'swim_right_diagonal', 'swing_aboard', 'sword_cleave', 'sword_comboA', 'sword_draw', 'sword_hit', 'sword_idle', 'sword_lunge', 'sword_putaway', 'sword_roll_thrust', 'sword_slash', 'sword_thrust', 'tatoo_idle', 'tatoo_into_look', 'tatoo_look_idle', 'tatoo_outof_look', 'tatoo_receive_idle', 'tatoo_receive_into_look', 'tatoo_receive_look_idle', 'tatoo_receive_outof_look', 'teleport', 'tentacle_idle', 'tentacle_squeeze', 'tread_water', 'tread_water_into_teleport', 'turn_left', 'turn_right', 'voodoo_doll_hurt', 'voodoo_doll_poke', 'voodoo_draw', 'voodoo_idle', 'voodoo_swarm', 'voodoo_tune', 'voodoo_walk', 'walk', 'walk_back_diagonal_left', 'walk_back_diagonal_right', 'wand_cast_fire', 'wand_cast_idle', 'wand_cast_start', 'wand_hurt', 'wand_idle', 'wheel_idle', 'barf', 'burp', 'fart', 'fsh_idle', 'fsh_smallCast', 'fsh_bigCast', 'fsh_smallSuccess', 'fsh_bigSuccess', 'kneel_dizzy', 'mixing_idle'] SkeletonBodyTypes = [ '1', '2', '4', '8', 'djcr', 'djjm', 'djko', 'djpa', 'djtw', 'sp1', 'sp2', 'sp3', 'sp4', 'fr1', 'fr2', 'fr3', 'fr4'] CastBodyTypes = [ 'js', 'wt', 'es', 'cb', 'td', 'dj', 'jg', 'jr', 'fl', 'sl'] COMPLECTIONTYPES = {0: [[9, 14, 15, 16, 17, 19], [6]], 1: [[4, 10, 11, 12, 13], [1, 6]], 2: [[5, 6, 7, 8], [0, 1, 3, 5, 6]], 3: [[0, 1, 2, 3], [0, 1, 2, 3, 4, 6]]} MALE_BODYTYPE_SELECTIONS = [ 0, 1, 1, 2, 2, 2, 3, 3, 4, 4] FEMALE_BODYTYPE_SELECTIONS = [0, 1, 1, 2, 2, 2, 3, 3, 3, 4] PREFERRED_MALE_HAIR_SELECTIONS = [ 1, 2, 5, 6] PREFERRED_FEMALE_HAIR_SELECTIONS = [] PREFERRED_MALE_BEARD_SELECTIONS = [ 1, 2, 3, 4] MALE_NOSE_RANGES = [ ( -1.0, 1.0), (-1.0, 1.0), (-0.8, 0.5), (-0.5, 0.5), (-1.0, 1.0), (-1.0, 0.7), (-0.7, 0.7), (-0.7, 0.7)] FEMALE_NOSE_RANGES = [ ( -1.0, 1.0), (-0.7, 0.6), (-0.7, 1.0), (-0.3, 0.3), (-0.5, 0.75), (-1.0, 1.0), (-0.5, 0.5), (-0.5, 0.5)]
bodyshop = 0 headshop = 1 mouthshop = 2 eyesshop = 3 noseshop = 4 earshop = 5 hairshop = 6 clothesshop = 7 nameshop = 8 tattooshop = 9 jewelryshop = 10 avatar_pirate = 0 avatar_skeleton = 1 avatar_navy = 2 avatar_cast = 3 shop_names = ['BodyShop', 'HeadShop', 'MouthShop', 'EyesShop', 'NoseShop', 'EarShop', 'HairShop', 'ClothesShop', 'NameShop', 'TattooShop', 'JewelryShop'] lod_list = [2000, 1000, 500] anim_list = ['idle', 'attention', 'axe_chop_idle', 'axe_chop_look_idle', 'bar_talk01_idle', 'bar_talk01_into_look', 'bar_talk01_look_idle', 'bar_talk01_outof_look', 'bar_talk02_idle', 'bar_talk02_into_look', 'bar_talk02_look_idle', 'bar_talk02_outof_look', 'bar_wipe', 'bar_wipe_into_look', 'bar_wipe_look_idle', 'bar_wipe_outof_look', 'bar_write_idle', 'bar_write_into_look', 'bar_write_look_idle', 'bar_write_outof_look', 'barrel_hide_idle', 'barrel_hide_into_look', 'barrel_hide_look_idle', 'barrel_hide_outof_look', 'bayonet_attackA', 'bayonet_attackB', 'bayonet_attackC', 'bayonet_attack_idle', 'bayonet_attack_walk', 'bayonet_drill', 'bayonet_fall_ground', 'bayonet_idle', 'bayonet_idle_to_fight_idle', 'bayonet_jump', 'bayonet_run', 'bayonet_turn_left', 'bayonet_turn_right', 'bayonet_walk', 'bigbomb_charge', 'bigbomb_charge_loop', 'bigbomb_charge_throw', 'bigbomb_draw', 'bigbomb_idle', 'bigbomb_throw', 'bigbomb_walk', 'bigbomb_walk_left', 'bigbomb_walk_left_diagonal', 'bigbomb_walk_right', 'bigbomb_walk_right_diagonal', 'bindPose', 'blacksmith_work_idle', 'blacksmith_work_into_look', 'blacksmith_work_look_idle', 'blacksmith_work_outof_look', 'blunderbuss_reload', 'board', 'bomb_charge', 'bomb_charge_loop', 'bomb_charge_throw', 'bomb_draw', 'bomb_hurt', 'bomb_idle', 'bomb_receive', 'bomb_throw', 'boxing_fromidle', 'boxing_haymaker', 'boxing_hit_head_right', 'boxing_idle', 'boxing_idle_alt', 'boxing_kick', 'boxing_punch', 'broadsword_combo', 'cards_bad_tell', 'cards_bet', 'cards_blackjack_hit', 'cards_blackjack_stay', 'cards_cheat', 'cards_check', 'cards_good_tell', 'cards_hide', 'cards_hide_hit', 'cards_hide_idle', 'cards_pick_up', 'cards_pick_up_idle', 'cards_set_down', 'cards_set_down_lose', 'cards_set_down_win', 'cards_set_down_win_show', 'cargomaster_work_idle', 'cargomaster_work_into_look', 'cargomaster_work_look_idle', 'cargomaster_work_outof_look', 'chant_a_idle', 'chant_b_idle', 'chest_idle', 'chest_kneel_to_steal', 'chest_putdown', 'chest_steal', 'chest_strafe_left', 'chest_strafe_right', 'chest_walk', 'coin_flip_idle', 'coin_flip_look_idle', 'coin_flip_old_idle', 'cower_idle', 'cower_into', 'cower_outof', 'crazy_idle', 'crazy_look_idle', 'cutlass_attention', 'cutlass_bladestorm', 'cutlass_combo', 'cutlass_headbutt', 'cutlass_hurt', 'cutlass_kick', 'cutlass_multihit', 'cutlass_sweep', 'cutlass_taunt', 'cutlass_walk_navy', 'dagger_asp', 'dagger_backstab', 'dagger_combo', 'dagger_coup', 'dagger_hurt', 'dagger_receive', 'dagger_throw_combo', 'dagger_throw_sand', 'dagger_vipers_nest', 'deal', 'deal_idle', 'deal_left', 'deal_right', 'death', 'death2', 'death3', 'death4', 'doctor_work_idle', 'doctor_work_into_look', 'doctor_work_look_idle', 'doctor_work_outof_look', 'drink_potion', 'dualcutlass_combo', 'dualcutlass_draw', 'dualcutlass_idle', 'emote_anger', 'emote_blow_kiss', 'emote_celebrate', 'emote_clap', 'emote_coin_toss', 'emote_crazy', 'emote_cut_throat', 'emote_dance_jig', 'emote_duhhh', 'emote_embarrassed', 'emote_face_smack', 'emote_fear', 'emote_flex', 'emote_flirt', 'emote_hand_it_over', 'emote_head_scratch', 'emote_laugh', 'emote_navy_scared', 'emote_navy_wants_fight', 'emote_nervous', 'emote_newyears', 'emote_no', 'emote_sad', 'emote_sassy', 'emote_scared', 'emote_show_me_the_money', 'emote_shrug', 'emote_sincere_thanks', 'emote_smile', 'emote_snarl', 'emote_talk_to_the_hand', 'emote_thriller', 'emote_wave', 'emote_wink', 'emote_yawn', 'emote_yes', 'fall_ground', 'flute_idle', 'flute_look_idle', 'foil_coup', 'foil_hack', 'foil_idle', 'foil_kick', 'foil_slash', 'foil_thrust', 'friend_pose', 'gun_aim_idle', 'gun_draw', 'gun_fire', 'gun_hurt', 'gun_pointedup_idle', 'gun_putaway', 'gun_reload', 'gun_strafe_left', 'hand_curse_check', 'hand_curse_get_sword', 'hand_curse_reaction', 'idle_B_shiftWeight', 'idle_butt_scratch', 'idle_flex', 'idle_handhip', 'idle_handhip_from_idle', 'idle_head_scratch', 'idle_head_scratch_side', 'idle_hit', 'idle_sit', 'idle_sit_alt', 'idle_yawn', 'injured_fall', 'injured_healing_into', 'injured_healing_loop', 'injured_healing_outof', 'injured_idle', 'injured_idle_shakehead', 'injured_standup', 'into_deal', 'jail_dropinto', 'jail_idle', 'jail_standup', 'jump', 'jump_idle', 'kick_door', 'kick_door_loop', 'kneel', 'kneel_fromidle', 'knife_throw', 'kraken_fight_idle', 'kraken_struggle_idle', 'left_face', 'loom_idle', 'loom_into_look', 'loom_look_idle', 'loom_outof_look', 'lute_idle', 'lute_into_look', 'lute_look_idle', 'lute_outof_look', 'map_head_into_look_left', 'map_head_look_left_idle', 'map_head_outof_look_left', 'map_look_arm_left', 'map_look_arm_right', 'map_look_boot_left', 'map_look_boot_right', 'map_look_pant_right', 'march', 'patient_work_idle', 'primp_idle', 'primp_into_look', 'primp_look_idle', 'primp_outof_look', 'repair_bench', 'repairfloor_idle', 'repairfloor_into', 'repairfloor_outof', 'rifle_fight_forward_diagonal_left', 'rifle_fight_forward_diagonal_right', 'rifle_fight_idle', 'rifle_fight_run_strafe_left', 'rifle_fight_run_strafe_right', 'rifle_fight_shoot_high', 'rifle_fight_shoot_high_idle', 'rifle_fight_shoot_hip', 'rifle_fight_walk', 'rifle_fight_walk_back_diagonal_left', 'rifle_fight_walk_back_diagonal_right', 'rifle_fight_walk_strafe_left', 'rifle_fight_walk_strafe_right', 'rifle_idle_to_fight_idle', 'rifle_reload_hip', 'rigging_climb', 'rigTest', 'rope_board', 'rope_dismount', 'rope_grab', 'rope_grab_from_idle', 'run', 'run_diagonal_left', 'run_diagonal_right', 'run_with_weapon', 'sabre_combo', 'sabre_comboA', 'sabre_comboB', 'sand_in_eyes', 'sand_in_eyes_holdweapon_noswing', 'screenshot_pose', 'search_low', 'search_med', 'semi_conscious_loop', 'semi_conscious_standup', 'shovel', 'shovel_idle', 'shovel_idle_into_dig', 'sit', 'sit_cower_idle', 'sit_cower_into_sleep', 'sit_hanginglegs_idle', 'sit_hanginglegs_into_look', 'sit_hanginglegs_look_idle', 'sit_hanginglegs_outof_look', 'sit_idle', 'sit_sleep_idle', 'sit_sleep_into_cower', 'sit_sleep_into_look', 'sit_sleep_look_idle', 'sit_sleep_outof_look', 'sleep_idle', 'sleep_into_look', 'sleep_outof_look', 'sleep_sick_idle', 'sleep_sick_into_look', 'sleep_sick_look_idle', 'sleep_sick_outof_look', 'sow_idle', 'sow_into_look', 'sow_look_idle', 'sow_outof_look', 'spin_left', 'spin_right', 'stir_idle', 'stir_into_look', 'stir_look_idle', 'stir_outof_look', 'stock_idle', 'stock_sleep', 'stock_sleep_to_idle', 'stowaway_get_in_crate', 'strafe_left', 'strafe_right', 'summon_idle', 'sweep', 'sweep_idle', 'sweep_into_look', 'sweep_look_idle', 'sweep_outof_look', 'swim', 'swim_back', 'swim_back_diagonal_left', 'swim_back_diagonal_right', 'swim_into_tread_water', 'swim_left', 'swim_left_diagonal', 'swim_right', 'swim_right_diagonal', 'swing_aboard', 'sword_cleave', 'sword_comboA', 'sword_draw', 'sword_hit', 'sword_idle', 'sword_lunge', 'sword_putaway', 'sword_roll_thrust', 'sword_slash', 'sword_thrust', 'tatoo_idle', 'tatoo_into_look', 'tatoo_look_idle', 'tatoo_outof_look', 'tatoo_receive_idle', 'tatoo_receive_into_look', 'tatoo_receive_look_idle', 'tatoo_receive_outof_look', 'teleport', 'tentacle_idle', 'tentacle_squeeze', 'tread_water', 'tread_water_into_teleport', 'turn_left', 'turn_right', 'voodoo_doll_hurt', 'voodoo_doll_poke', 'voodoo_draw', 'voodoo_idle', 'voodoo_swarm', 'voodoo_tune', 'voodoo_walk', 'walk', 'walk_back_diagonal_left', 'walk_back_diagonal_right', 'wand_cast_fire', 'wand_cast_idle', 'wand_cast_start', 'wand_hurt', 'wand_idle', 'wheel_idle', 'barf', 'burp', 'fart', 'fsh_idle', 'fsh_smallCast', 'fsh_bigCast', 'fsh_smallSuccess', 'fsh_bigSuccess', 'kneel_dizzy', 'mixing_idle'] skeleton_body_types = ['1', '2', '4', '8', 'djcr', 'djjm', 'djko', 'djpa', 'djtw', 'sp1', 'sp2', 'sp3', 'sp4', 'fr1', 'fr2', 'fr3', 'fr4'] cast_body_types = ['js', 'wt', 'es', 'cb', 'td', 'dj', 'jg', 'jr', 'fl', 'sl'] complectiontypes = {0: [[9, 14, 15, 16, 17, 19], [6]], 1: [[4, 10, 11, 12, 13], [1, 6]], 2: [[5, 6, 7, 8], [0, 1, 3, 5, 6]], 3: [[0, 1, 2, 3], [0, 1, 2, 3, 4, 6]]} male_bodytype_selections = [0, 1, 1, 2, 2, 2, 3, 3, 4, 4] female_bodytype_selections = [0, 1, 1, 2, 2, 2, 3, 3, 3, 4] preferred_male_hair_selections = [1, 2, 5, 6] preferred_female_hair_selections = [] preferred_male_beard_selections = [1, 2, 3, 4] male_nose_ranges = [(-1.0, 1.0), (-1.0, 1.0), (-0.8, 0.5), (-0.5, 0.5), (-1.0, 1.0), (-1.0, 0.7), (-0.7, 0.7), (-0.7, 0.7)] female_nose_ranges = [(-1.0, 1.0), (-0.7, 0.6), (-0.7, 1.0), (-0.3, 0.3), (-0.5, 0.75), (-1.0, 1.0), (-0.5, 0.5), (-0.5, 0.5)]
def bubble_sort(nums: list[float]) -> list[float]: is_sorted = True for loop in range(len(nums) - 1): for indx in range(len(nums) - loop - 1): if nums[indx] > nums[indx + 1]: is_sorted = False nums[indx], nums[indx + 1] = nums[indx + 1], nums[indx] if is_sorted: break return nums algorithm = bubble_sort name = 'optimized'
def bubble_sort(nums: list[float]) -> list[float]: is_sorted = True for loop in range(len(nums) - 1): for indx in range(len(nums) - loop - 1): if nums[indx] > nums[indx + 1]: is_sorted = False (nums[indx], nums[indx + 1]) = (nums[indx + 1], nums[indx]) if is_sorted: break return nums algorithm = bubble_sort name = 'optimized'
# # PySNMP MIB module MPLS-LSR-STD-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MPLS-LSR-STD-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:43:25 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") ValueRangeConstraint, ConstraintsIntersection, SingleValueConstraint, ValueSizeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsIntersection", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsUnion") AddressFamilyNumbers, = mibBuilder.importSymbols("IANA-ADDRESS-FAMILY-NUMBERS-MIB", "AddressFamilyNumbers") ifCounterDiscontinuityGroup, InterfaceIndexOrZero, ifGeneralInformationGroup = mibBuilder.importSymbols("IF-MIB", "ifCounterDiscontinuityGroup", "InterfaceIndexOrZero", "ifGeneralInformationGroup") InetAddressType, InetAddress = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddressType", "InetAddress") MplsLabel, MplsBitRate, MplsOwner, mplsStdMIB, MplsLSPID = mibBuilder.importSymbols("MPLS-TC-STD-MIB", "MplsLabel", "MplsBitRate", "MplsOwner", "mplsStdMIB", "MplsLSPID") ObjectGroup, NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "NotificationGroup", "ModuleCompliance") NotificationType, zeroDotZero, MibIdentifier, iso, Bits, ObjectIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, Integer32, ModuleIdentity, Unsigned32, Counter64, TimeTicks, IpAddress, Counter32, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "NotificationType", "zeroDotZero", "MibIdentifier", "iso", "Bits", "ObjectIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Integer32", "ModuleIdentity", "Unsigned32", "Counter64", "TimeTicks", "IpAddress", "Counter32", "Gauge32") TextualConvention, RowStatus, StorageType, RowPointer, TruthValue, DisplayString, TimeStamp = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "RowStatus", "StorageType", "RowPointer", "TruthValue", "DisplayString", "TimeStamp") mplsLsrStdMIB = ModuleIdentity((1, 3, 6, 1, 2, 1, 10, 166, 2)) mplsLsrStdMIB.setRevisions(('2004-06-03 00:00',)) if mibBuilder.loadTexts: mplsLsrStdMIB.setLastUpdated('200406030000Z') if mibBuilder.loadTexts: mplsLsrStdMIB.setOrganization('Multiprotocol Label Switching (MPLS) Working Group') class MplsIndexType(TextualConvention, OctetString): status = 'current' subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(1, 24) class MplsIndexNextType(TextualConvention, OctetString): status = 'current' subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(1, 24) mplsLsrNotifications = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 166, 2, 0)) mplsLsrObjects = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 166, 2, 1)) mplsLsrConformance = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 166, 2, 2)) mplsInterfaceTable = MibTable((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1), ) if mibBuilder.loadTexts: mplsInterfaceTable.setStatus('current') mplsInterfaceEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1), ).setIndexNames((0, "MPLS-LSR-STD-MIB", "mplsInterfaceIndex")) if mibBuilder.loadTexts: mplsInterfaceEntry.setStatus('current') mplsInterfaceIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 1), InterfaceIndexOrZero()) if mibBuilder.loadTexts: mplsInterfaceIndex.setStatus('current') mplsInterfaceLabelMinIn = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 2), MplsLabel()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsInterfaceLabelMinIn.setStatus('current') mplsInterfaceLabelMaxIn = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 3), MplsLabel()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsInterfaceLabelMaxIn.setStatus('current') mplsInterfaceLabelMinOut = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 4), MplsLabel()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsInterfaceLabelMinOut.setStatus('current') mplsInterfaceLabelMaxOut = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 5), MplsLabel()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsInterfaceLabelMaxOut.setStatus('current') mplsInterfaceTotalBandwidth = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 6), MplsBitRate()).setUnits('kilobits per second').setMaxAccess("readonly") if mibBuilder.loadTexts: mplsInterfaceTotalBandwidth.setStatus('current') mplsInterfaceAvailableBandwidth = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 7), MplsBitRate()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsInterfaceAvailableBandwidth.setStatus('current') mplsInterfaceLabelParticipationType = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 8), Bits().clone(namedValues=NamedValues(("perPlatform", 0), ("perInterface", 1)))).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsInterfaceLabelParticipationType.setStatus('current') mplsInterfacePerfTable = MibTable((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 2), ) if mibBuilder.loadTexts: mplsInterfacePerfTable.setStatus('current') mplsInterfacePerfEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 2, 1), ) mplsInterfaceEntry.registerAugmentions(("MPLS-LSR-STD-MIB", "mplsInterfacePerfEntry")) mplsInterfacePerfEntry.setIndexNames(*mplsInterfaceEntry.getIndexNames()) if mibBuilder.loadTexts: mplsInterfacePerfEntry.setStatus('current') mplsInterfacePerfInLabelsInUse = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 2, 1, 1), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsInterfacePerfInLabelsInUse.setStatus('current') mplsInterfacePerfInLabelLookupFailures = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 2, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsInterfacePerfInLabelLookupFailures.setStatus('current') mplsInterfacePerfOutLabelsInUse = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 2, 1, 3), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsInterfacePerfOutLabelsInUse.setStatus('current') mplsInterfacePerfOutFragmentedPkts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 2, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsInterfacePerfOutFragmentedPkts.setStatus('current') mplsInSegmentIndexNext = MibScalar((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 3), MplsIndexNextType()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsInSegmentIndexNext.setStatus('current') mplsInSegmentTable = MibTable((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4), ) if mibBuilder.loadTexts: mplsInSegmentTable.setStatus('current') mplsInSegmentEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1), ).setIndexNames((0, "MPLS-LSR-STD-MIB", "mplsInSegmentIndex")) if mibBuilder.loadTexts: mplsInSegmentEntry.setStatus('current') mplsInSegmentIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 1), MplsIndexType()) if mibBuilder.loadTexts: mplsInSegmentIndex.setStatus('current') mplsInSegmentInterface = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 2), InterfaceIndexOrZero()).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsInSegmentInterface.setStatus('current') mplsInSegmentLabel = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 3), MplsLabel()).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsInSegmentLabel.setStatus('current') mplsInSegmentLabelPtr = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 4), RowPointer().clone((0, 0))).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsInSegmentLabelPtr.setStatus('current') mplsInSegmentNPop = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647)).clone(1)).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsInSegmentNPop.setStatus('current') mplsInSegmentAddrFamily = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 6), AddressFamilyNumbers().clone('other')).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsInSegmentAddrFamily.setStatus('current') mplsInSegmentXCIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 7), MplsIndexType()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsInSegmentXCIndex.setStatus('current') mplsInSegmentOwner = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 8), MplsOwner()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsInSegmentOwner.setStatus('current') mplsInSegmentTrafficParamPtr = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 9), RowPointer().clone((0, 0))).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsInSegmentTrafficParamPtr.setStatus('current') mplsInSegmentRowStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 10), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsInSegmentRowStatus.setStatus('current') mplsInSegmentStorageType = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 11), StorageType().clone('volatile')).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsInSegmentStorageType.setStatus('current') mplsInSegmentPerfTable = MibTable((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5), ) if mibBuilder.loadTexts: mplsInSegmentPerfTable.setStatus('current') mplsInSegmentPerfEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1), ) mplsInSegmentEntry.registerAugmentions(("MPLS-LSR-STD-MIB", "mplsInSegmentPerfEntry")) mplsInSegmentPerfEntry.setIndexNames(*mplsInSegmentEntry.getIndexNames()) if mibBuilder.loadTexts: mplsInSegmentPerfEntry.setStatus('current') mplsInSegmentPerfOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsInSegmentPerfOctets.setStatus('current') mplsInSegmentPerfPackets = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsInSegmentPerfPackets.setStatus('current') mplsInSegmentPerfErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsInSegmentPerfErrors.setStatus('current') mplsInSegmentPerfDiscards = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsInSegmentPerfDiscards.setStatus('current') mplsInSegmentPerfHCOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1, 5), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsInSegmentPerfHCOctets.setStatus('current') mplsInSegmentPerfDiscontinuityTime = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1, 6), TimeStamp()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsInSegmentPerfDiscontinuityTime.setStatus('current') mplsOutSegmentIndexNext = MibScalar((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 6), MplsIndexNextType()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsOutSegmentIndexNext.setStatus('current') mplsOutSegmentTable = MibTable((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7), ) if mibBuilder.loadTexts: mplsOutSegmentTable.setStatus('current') mplsOutSegmentEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1), ).setIndexNames((0, "MPLS-LSR-STD-MIB", "mplsOutSegmentIndex")) if mibBuilder.loadTexts: mplsOutSegmentEntry.setStatus('current') mplsOutSegmentIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 1), MplsIndexType()) if mibBuilder.loadTexts: mplsOutSegmentIndex.setStatus('current') mplsOutSegmentInterface = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 2), InterfaceIndexOrZero()).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsOutSegmentInterface.setStatus('current') mplsOutSegmentPushTopLabel = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 3), TruthValue().clone('true')).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsOutSegmentPushTopLabel.setStatus('current') mplsOutSegmentTopLabel = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 4), MplsLabel()).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsOutSegmentTopLabel.setStatus('current') mplsOutSegmentTopLabelPtr = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 5), RowPointer().clone((0, 0))).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsOutSegmentTopLabelPtr.setStatus('current') mplsOutSegmentNextHopAddrType = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 6), InetAddressType()).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsOutSegmentNextHopAddrType.setStatus('current') mplsOutSegmentNextHopAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 7), InetAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsOutSegmentNextHopAddr.setStatus('current') mplsOutSegmentXCIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 8), MplsIndexType()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsOutSegmentXCIndex.setStatus('current') mplsOutSegmentOwner = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 9), MplsOwner()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsOutSegmentOwner.setStatus('current') mplsOutSegmentTrafficParamPtr = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 10), RowPointer().clone((0, 0))).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsOutSegmentTrafficParamPtr.setStatus('current') mplsOutSegmentRowStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 11), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsOutSegmentRowStatus.setStatus('current') mplsOutSegmentStorageType = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 12), StorageType().clone('volatile')).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsOutSegmentStorageType.setStatus('current') mplsOutSegmentPerfTable = MibTable((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8), ) if mibBuilder.loadTexts: mplsOutSegmentPerfTable.setStatus('current') mplsOutSegmentPerfEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1), ) mplsOutSegmentEntry.registerAugmentions(("MPLS-LSR-STD-MIB", "mplsOutSegmentPerfEntry")) mplsOutSegmentPerfEntry.setIndexNames(*mplsOutSegmentEntry.getIndexNames()) if mibBuilder.loadTexts: mplsOutSegmentPerfEntry.setStatus('current') mplsOutSegmentPerfOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsOutSegmentPerfOctets.setStatus('current') mplsOutSegmentPerfPackets = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsOutSegmentPerfPackets.setStatus('current') mplsOutSegmentPerfErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsOutSegmentPerfErrors.setStatus('current') mplsOutSegmentPerfDiscards = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsOutSegmentPerfDiscards.setStatus('current') mplsOutSegmentPerfHCOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1, 5), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsOutSegmentPerfHCOctets.setStatus('current') mplsOutSegmentPerfDiscontinuityTime = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1, 6), TimeStamp()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsOutSegmentPerfDiscontinuityTime.setStatus('current') mplsXCIndexNext = MibScalar((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 9), MplsIndexNextType()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsXCIndexNext.setStatus('current') mplsXCTable = MibTable((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10), ) if mibBuilder.loadTexts: mplsXCTable.setStatus('current') mplsXCEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1), ).setIndexNames((0, "MPLS-LSR-STD-MIB", "mplsXCIndex"), (0, "MPLS-LSR-STD-MIB", "mplsXCInSegmentIndex"), (0, "MPLS-LSR-STD-MIB", "mplsXCOutSegmentIndex")) if mibBuilder.loadTexts: mplsXCEntry.setStatus('current') mplsXCIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 1), MplsIndexType()) if mibBuilder.loadTexts: mplsXCIndex.setStatus('current') mplsXCInSegmentIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 2), MplsIndexType()) if mibBuilder.loadTexts: mplsXCInSegmentIndex.setStatus('current') mplsXCOutSegmentIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 3), MplsIndexType()) if mibBuilder.loadTexts: mplsXCOutSegmentIndex.setStatus('current') mplsXCLspId = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 4), MplsLSPID()).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsXCLspId.setStatus('current') mplsXCLabelStackIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 5), MplsIndexType()).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsXCLabelStackIndex.setStatus('current') mplsXCOwner = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 6), MplsOwner()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsXCOwner.setStatus('current') mplsXCRowStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 7), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsXCRowStatus.setStatus('current') mplsXCStorageType = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 8), StorageType().clone('volatile')).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsXCStorageType.setStatus('current') mplsXCAdminStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("testing", 3))).clone('up')).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsXCAdminStatus.setStatus('current') mplsXCOperStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("testing", 3), ("unknown", 4), ("dormant", 5), ("notPresent", 6), ("lowerLayerDown", 7)))).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsXCOperStatus.setStatus('current') mplsMaxLabelStackDepth = MibScalar((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 11), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsMaxLabelStackDepth.setStatus('current') mplsLabelStackIndexNext = MibScalar((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 12), MplsIndexNextType()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsLabelStackIndexNext.setStatus('current') mplsLabelStackTable = MibTable((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13), ) if mibBuilder.loadTexts: mplsLabelStackTable.setStatus('current') mplsLabelStackEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1), ).setIndexNames((0, "MPLS-LSR-STD-MIB", "mplsLabelStackIndex"), (0, "MPLS-LSR-STD-MIB", "mplsLabelStackLabelIndex")) if mibBuilder.loadTexts: mplsLabelStackEntry.setStatus('current') mplsLabelStackIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1, 1), MplsIndexType()) if mibBuilder.loadTexts: mplsLabelStackIndex.setStatus('current') mplsLabelStackLabelIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))) if mibBuilder.loadTexts: mplsLabelStackLabelIndex.setStatus('current') mplsLabelStackLabel = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1, 3), MplsLabel()).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsLabelStackLabel.setStatus('current') mplsLabelStackLabelPtr = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1, 4), RowPointer().clone((0, 0))).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsLabelStackLabelPtr.setStatus('current') mplsLabelStackRowStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1, 5), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsLabelStackRowStatus.setStatus('current') mplsLabelStackStorageType = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1, 6), StorageType().clone('volatile')).setMaxAccess("readcreate") if mibBuilder.loadTexts: mplsLabelStackStorageType.setStatus('current') mplsInSegmentMapTable = MibTable((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 14), ) if mibBuilder.loadTexts: mplsInSegmentMapTable.setStatus('current') mplsInSegmentMapEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 14, 1), ).setIndexNames((0, "MPLS-LSR-STD-MIB", "mplsInSegmentMapInterface"), (0, "MPLS-LSR-STD-MIB", "mplsInSegmentMapLabel"), (0, "MPLS-LSR-STD-MIB", "mplsInSegmentMapLabelPtrIndex")) if mibBuilder.loadTexts: mplsInSegmentMapEntry.setStatus('current') mplsInSegmentMapInterface = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 14, 1, 1), InterfaceIndexOrZero()) if mibBuilder.loadTexts: mplsInSegmentMapInterface.setStatus('current') mplsInSegmentMapLabel = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 14, 1, 2), MplsLabel()) if mibBuilder.loadTexts: mplsInSegmentMapLabel.setStatus('current') mplsInSegmentMapLabelPtrIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 14, 1, 3), RowPointer()) if mibBuilder.loadTexts: mplsInSegmentMapLabelPtrIndex.setStatus('current') mplsInSegmentMapIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 14, 1, 4), MplsIndexType()).setMaxAccess("readonly") if mibBuilder.loadTexts: mplsInSegmentMapIndex.setStatus('current') mplsXCNotificationsEnable = MibScalar((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 15), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mplsXCNotificationsEnable.setStatus('current') mplsXCUp = NotificationType((1, 3, 6, 1, 2, 1, 10, 166, 2, 0, 1)).setObjects(("MPLS-LSR-STD-MIB", "mplsXCOperStatus"), ("MPLS-LSR-STD-MIB", "mplsXCOperStatus")) if mibBuilder.loadTexts: mplsXCUp.setStatus('current') mplsXCDown = NotificationType((1, 3, 6, 1, 2, 1, 10, 166, 2, 0, 2)).setObjects(("MPLS-LSR-STD-MIB", "mplsXCOperStatus"), ("MPLS-LSR-STD-MIB", "mplsXCOperStatus")) if mibBuilder.loadTexts: mplsXCDown.setStatus('current') mplsLsrGroups = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1)) mplsLsrCompliances = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 2)) mplsLsrModuleFullCompliance = ModuleCompliance((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 2, 1)).setObjects(("IF-MIB", "ifGeneralInformationGroup"), ("IF-MIB", "ifCounterDiscontinuityGroup"), ("MPLS-LSR-STD-MIB", "mplsInterfaceGroup"), ("MPLS-LSR-STD-MIB", "mplsInSegmentGroup"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentGroup"), ("MPLS-LSR-STD-MIB", "mplsXCGroup"), ("MPLS-LSR-STD-MIB", "mplsPerfGroup"), ("MPLS-LSR-STD-MIB", "mplsLabelStackGroup"), ("MPLS-LSR-STD-MIB", "mplsHCInSegmentPerfGroup"), ("MPLS-LSR-STD-MIB", "mplsHCOutSegmentPerfGroup"), ("MPLS-LSR-STD-MIB", "mplsLsrNotificationGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): mplsLsrModuleFullCompliance = mplsLsrModuleFullCompliance.setStatus('current') mplsLsrModuleReadOnlyCompliance = ModuleCompliance((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 2, 2)).setObjects(("IF-MIB", "ifGeneralInformationGroup"), ("IF-MIB", "ifCounterDiscontinuityGroup"), ("MPLS-LSR-STD-MIB", "mplsInterfaceGroup"), ("MPLS-LSR-STD-MIB", "mplsInSegmentGroup"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentGroup"), ("MPLS-LSR-STD-MIB", "mplsXCGroup"), ("MPLS-LSR-STD-MIB", "mplsPerfGroup"), ("MPLS-LSR-STD-MIB", "mplsLabelStackGroup"), ("MPLS-LSR-STD-MIB", "mplsHCInSegmentPerfGroup"), ("MPLS-LSR-STD-MIB", "mplsHCOutSegmentPerfGroup"), ("MPLS-LSR-STD-MIB", "mplsLsrNotificationGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): mplsLsrModuleReadOnlyCompliance = mplsLsrModuleReadOnlyCompliance.setStatus('current') mplsInterfaceGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 1)).setObjects(("MPLS-LSR-STD-MIB", "mplsInterfaceLabelMinIn"), ("MPLS-LSR-STD-MIB", "mplsInterfaceLabelMaxIn"), ("MPLS-LSR-STD-MIB", "mplsInterfaceLabelMinOut"), ("MPLS-LSR-STD-MIB", "mplsInterfaceLabelMaxOut"), ("MPLS-LSR-STD-MIB", "mplsInterfaceTotalBandwidth"), ("MPLS-LSR-STD-MIB", "mplsInterfaceAvailableBandwidth"), ("MPLS-LSR-STD-MIB", "mplsInterfaceLabelParticipationType")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): mplsInterfaceGroup = mplsInterfaceGroup.setStatus('current') mplsInSegmentGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 2)).setObjects(("MPLS-LSR-STD-MIB", "mplsInSegmentIndexNext"), ("MPLS-LSR-STD-MIB", "mplsInSegmentInterface"), ("MPLS-LSR-STD-MIB", "mplsInSegmentLabel"), ("MPLS-LSR-STD-MIB", "mplsInSegmentLabelPtr"), ("MPLS-LSR-STD-MIB", "mplsInSegmentNPop"), ("MPLS-LSR-STD-MIB", "mplsInSegmentAddrFamily"), ("MPLS-LSR-STD-MIB", "mplsInSegmentXCIndex"), ("MPLS-LSR-STD-MIB", "mplsInSegmentOwner"), ("MPLS-LSR-STD-MIB", "mplsInSegmentRowStatus"), ("MPLS-LSR-STD-MIB", "mplsInSegmentStorageType"), ("MPLS-LSR-STD-MIB", "mplsInSegmentTrafficParamPtr"), ("MPLS-LSR-STD-MIB", "mplsInSegmentMapIndex")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): mplsInSegmentGroup = mplsInSegmentGroup.setStatus('current') mplsOutSegmentGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 3)).setObjects(("MPLS-LSR-STD-MIB", "mplsOutSegmentIndexNext"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentInterface"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentPushTopLabel"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentTopLabel"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentTopLabelPtr"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentNextHopAddrType"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentNextHopAddr"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentXCIndex"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentOwner"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentPerfOctets"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentPerfDiscards"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentPerfErrors"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentRowStatus"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentStorageType"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentTrafficParamPtr")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): mplsOutSegmentGroup = mplsOutSegmentGroup.setStatus('current') mplsXCGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 4)).setObjects(("MPLS-LSR-STD-MIB", "mplsXCIndexNext"), ("MPLS-LSR-STD-MIB", "mplsXCLspId"), ("MPLS-LSR-STD-MIB", "mplsXCLabelStackIndex"), ("MPLS-LSR-STD-MIB", "mplsXCOwner"), ("MPLS-LSR-STD-MIB", "mplsXCStorageType"), ("MPLS-LSR-STD-MIB", "mplsXCAdminStatus"), ("MPLS-LSR-STD-MIB", "mplsXCOperStatus"), ("MPLS-LSR-STD-MIB", "mplsXCRowStatus"), ("MPLS-LSR-STD-MIB", "mplsXCNotificationsEnable")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): mplsXCGroup = mplsXCGroup.setStatus('current') mplsPerfGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 5)).setObjects(("MPLS-LSR-STD-MIB", "mplsInSegmentPerfOctets"), ("MPLS-LSR-STD-MIB", "mplsInSegmentPerfPackets"), ("MPLS-LSR-STD-MIB", "mplsInSegmentPerfErrors"), ("MPLS-LSR-STD-MIB", "mplsInSegmentPerfDiscards"), ("MPLS-LSR-STD-MIB", "mplsInSegmentPerfDiscontinuityTime"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentPerfOctets"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentPerfPackets"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentPerfDiscards"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentPerfDiscontinuityTime"), ("MPLS-LSR-STD-MIB", "mplsInterfacePerfInLabelsInUse"), ("MPLS-LSR-STD-MIB", "mplsInterfacePerfInLabelLookupFailures"), ("MPLS-LSR-STD-MIB", "mplsInterfacePerfOutFragmentedPkts"), ("MPLS-LSR-STD-MIB", "mplsInterfacePerfOutLabelsInUse")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): mplsPerfGroup = mplsPerfGroup.setStatus('current') mplsHCInSegmentPerfGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 6)).setObjects(("MPLS-LSR-STD-MIB", "mplsInSegmentPerfHCOctets")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): mplsHCInSegmentPerfGroup = mplsHCInSegmentPerfGroup.setStatus('current') mplsHCOutSegmentPerfGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 7)).setObjects(("MPLS-LSR-STD-MIB", "mplsOutSegmentPerfHCOctets")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): mplsHCOutSegmentPerfGroup = mplsHCOutSegmentPerfGroup.setStatus('current') mplsLabelStackGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 8)).setObjects(("MPLS-LSR-STD-MIB", "mplsLabelStackLabel"), ("MPLS-LSR-STD-MIB", "mplsLabelStackLabelPtr"), ("MPLS-LSR-STD-MIB", "mplsLabelStackRowStatus"), ("MPLS-LSR-STD-MIB", "mplsLabelStackStorageType"), ("MPLS-LSR-STD-MIB", "mplsMaxLabelStackDepth"), ("MPLS-LSR-STD-MIB", "mplsLabelStackIndexNext")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): mplsLabelStackGroup = mplsLabelStackGroup.setStatus('current') mplsLsrNotificationGroup = NotificationGroup((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 9)).setObjects(("MPLS-LSR-STD-MIB", "mplsXCUp"), ("MPLS-LSR-STD-MIB", "mplsXCDown")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): mplsLsrNotificationGroup = mplsLsrNotificationGroup.setStatus('current') mibBuilder.exportSymbols("MPLS-LSR-STD-MIB", mplsInterfaceAvailableBandwidth=mplsInterfaceAvailableBandwidth, mplsLabelStackGroup=mplsLabelStackGroup, mplsInterfaceLabelMaxOut=mplsInterfaceLabelMaxOut, mplsXCTable=mplsXCTable, mplsInSegmentPerfDiscards=mplsInSegmentPerfDiscards, mplsLsrGroups=mplsLsrGroups, mplsXCEntry=mplsXCEntry, mplsInterfaceTotalBandwidth=mplsInterfaceTotalBandwidth, mplsLsrConformance=mplsLsrConformance, mplsOutSegmentPerfHCOctets=mplsOutSegmentPerfHCOctets, mplsInSegmentMapIndex=mplsInSegmentMapIndex, mplsInterfaceEntry=mplsInterfaceEntry, mplsOutSegmentOwner=mplsOutSegmentOwner, mplsLsrStdMIB=mplsLsrStdMIB, mplsXCLspId=mplsXCLspId, mplsLabelStackRowStatus=mplsLabelStackRowStatus, mplsInSegmentPerfPackets=mplsInSegmentPerfPackets, mplsInterfacePerfOutFragmentedPkts=mplsInterfacePerfOutFragmentedPkts, mplsLsrNotifications=mplsLsrNotifications, mplsOutSegmentTrafficParamPtr=mplsOutSegmentTrafficParamPtr, mplsXCDown=mplsXCDown, mplsInSegmentEntry=mplsInSegmentEntry, mplsOutSegmentStorageType=mplsOutSegmentStorageType, mplsInterfacePerfInLabelLookupFailures=mplsInterfacePerfInLabelLookupFailures, mplsInSegmentPerfErrors=mplsInSegmentPerfErrors, mplsLsrObjects=mplsLsrObjects, mplsInSegmentXCIndex=mplsInSegmentXCIndex, mplsInSegmentMapLabel=mplsInSegmentMapLabel, mplsInterfaceGroup=mplsInterfaceGroup, mplsXCIndex=mplsXCIndex, mplsInSegmentIndexNext=mplsInSegmentIndexNext, mplsInSegmentMapEntry=mplsInSegmentMapEntry, mplsOutSegmentPerfErrors=mplsOutSegmentPerfErrors, mplsLabelStackIndex=mplsLabelStackIndex, mplsLsrModuleReadOnlyCompliance=mplsLsrModuleReadOnlyCompliance, mplsInSegmentStorageType=mplsInSegmentStorageType, mplsLabelStackLabelPtr=mplsLabelStackLabelPtr, mplsLabelStackTable=mplsLabelStackTable, mplsInSegmentTrafficParamPtr=mplsInSegmentTrafficParamPtr, mplsPerfGroup=mplsPerfGroup, mplsHCInSegmentPerfGroup=mplsHCInSegmentPerfGroup, mplsInterfacePerfTable=mplsInterfacePerfTable, mplsOutSegmentNextHopAddrType=mplsOutSegmentNextHopAddrType, mplsXCIndexNext=mplsXCIndexNext, mplsXCOwner=mplsXCOwner, mplsInterfacePerfOutLabelsInUse=mplsInterfacePerfOutLabelsInUse, mplsOutSegmentPerfTable=mplsOutSegmentPerfTable, mplsInterfaceLabelMinIn=mplsInterfaceLabelMinIn, mplsOutSegmentGroup=mplsOutSegmentGroup, mplsOutSegmentTopLabelPtr=mplsOutSegmentTopLabelPtr, mplsInSegmentMapTable=mplsInSegmentMapTable, mplsInSegmentIndex=mplsInSegmentIndex, mplsXCOutSegmentIndex=mplsXCOutSegmentIndex, mplsInSegmentPerfTable=mplsInSegmentPerfTable, mplsInSegmentLabel=mplsInSegmentLabel, mplsOutSegmentPerfDiscontinuityTime=mplsOutSegmentPerfDiscontinuityTime, mplsXCGroup=mplsXCGroup, mplsOutSegmentIndex=mplsOutSegmentIndex, mplsLabelStackLabelIndex=mplsLabelStackLabelIndex, mplsInterfaceTable=mplsInterfaceTable, mplsOutSegmentPerfEntry=mplsOutSegmentPerfEntry, MplsIndexType=MplsIndexType, mplsXCInSegmentIndex=mplsXCInSegmentIndex, mplsOutSegmentEntry=mplsOutSegmentEntry, mplsInterfacePerfEntry=mplsInterfacePerfEntry, mplsXCStorageType=mplsXCStorageType, mplsLabelStackLabel=mplsLabelStackLabel, mplsOutSegmentPerfDiscards=mplsOutSegmentPerfDiscards, mplsInSegmentPerfDiscontinuityTime=mplsInSegmentPerfDiscontinuityTime, mplsXCAdminStatus=mplsXCAdminStatus, mplsInterfaceLabelMinOut=mplsInterfaceLabelMinOut, mplsLabelStackStorageType=mplsLabelStackStorageType, mplsInterfacePerfInLabelsInUse=mplsInterfacePerfInLabelsInUse, mplsXCRowStatus=mplsXCRowStatus, mplsOutSegmentIndexNext=mplsOutSegmentIndexNext, mplsOutSegmentTable=mplsOutSegmentTable, mplsLsrNotificationGroup=mplsLsrNotificationGroup, mplsOutSegmentPerfOctets=mplsOutSegmentPerfOctets, mplsLabelStackEntry=mplsLabelStackEntry, mplsMaxLabelStackDepth=mplsMaxLabelStackDepth, mplsInSegmentAddrFamily=mplsInSegmentAddrFamily, mplsInSegmentInterface=mplsInSegmentInterface, mplsInterfaceLabelMaxIn=mplsInterfaceLabelMaxIn, mplsInterfaceIndex=mplsInterfaceIndex, mplsInSegmentPerfHCOctets=mplsInSegmentPerfHCOctets, mplsXCOperStatus=mplsXCOperStatus, mplsOutSegmentNextHopAddr=mplsOutSegmentNextHopAddr, mplsLsrCompliances=mplsLsrCompliances, mplsInSegmentTable=mplsInSegmentTable, mplsOutSegmentRowStatus=mplsOutSegmentRowStatus, mplsXCUp=mplsXCUp, mplsInSegmentLabelPtr=mplsInSegmentLabelPtr, mplsXCNotificationsEnable=mplsXCNotificationsEnable, mplsInSegmentMapInterface=mplsInSegmentMapInterface, mplsOutSegmentTopLabel=mplsOutSegmentTopLabel, MplsIndexNextType=MplsIndexNextType, mplsInterfaceLabelParticipationType=mplsInterfaceLabelParticipationType, mplsInSegmentMapLabelPtrIndex=mplsInSegmentMapLabelPtrIndex, mplsInSegmentRowStatus=mplsInSegmentRowStatus, mplsInSegmentOwner=mplsInSegmentOwner, mplsInSegmentNPop=mplsInSegmentNPop, mplsInSegmentPerfEntry=mplsInSegmentPerfEntry, mplsHCOutSegmentPerfGroup=mplsHCOutSegmentPerfGroup, mplsLabelStackIndexNext=mplsLabelStackIndexNext, mplsOutSegmentPerfPackets=mplsOutSegmentPerfPackets, mplsInSegmentGroup=mplsInSegmentGroup, mplsInSegmentPerfOctets=mplsInSegmentPerfOctets, mplsOutSegmentPushTopLabel=mplsOutSegmentPushTopLabel, PYSNMP_MODULE_ID=mplsLsrStdMIB, mplsOutSegmentXCIndex=mplsOutSegmentXCIndex, mplsOutSegmentInterface=mplsOutSegmentInterface, mplsLsrModuleFullCompliance=mplsLsrModuleFullCompliance, mplsXCLabelStackIndex=mplsXCLabelStackIndex)
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, single_value_constraint, value_size_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ConstraintsIntersection', 'SingleValueConstraint', 'ValueSizeConstraint', 'ConstraintsUnion') (address_family_numbers,) = mibBuilder.importSymbols('IANA-ADDRESS-FAMILY-NUMBERS-MIB', 'AddressFamilyNumbers') (if_counter_discontinuity_group, interface_index_or_zero, if_general_information_group) = mibBuilder.importSymbols('IF-MIB', 'ifCounterDiscontinuityGroup', 'InterfaceIndexOrZero', 'ifGeneralInformationGroup') (inet_address_type, inet_address) = mibBuilder.importSymbols('INET-ADDRESS-MIB', 'InetAddressType', 'InetAddress') (mpls_label, mpls_bit_rate, mpls_owner, mpls_std_mib, mpls_lspid) = mibBuilder.importSymbols('MPLS-TC-STD-MIB', 'MplsLabel', 'MplsBitRate', 'MplsOwner', 'mplsStdMIB', 'MplsLSPID') (object_group, notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'ObjectGroup', 'NotificationGroup', 'ModuleCompliance') (notification_type, zero_dot_zero, mib_identifier, iso, bits, object_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, integer32, module_identity, unsigned32, counter64, time_ticks, ip_address, counter32, gauge32) = mibBuilder.importSymbols('SNMPv2-SMI', 'NotificationType', 'zeroDotZero', 'MibIdentifier', 'iso', 'Bits', 'ObjectIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Integer32', 'ModuleIdentity', 'Unsigned32', 'Counter64', 'TimeTicks', 'IpAddress', 'Counter32', 'Gauge32') (textual_convention, row_status, storage_type, row_pointer, truth_value, display_string, time_stamp) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'RowStatus', 'StorageType', 'RowPointer', 'TruthValue', 'DisplayString', 'TimeStamp') mpls_lsr_std_mib = module_identity((1, 3, 6, 1, 2, 1, 10, 166, 2)) mplsLsrStdMIB.setRevisions(('2004-06-03 00:00',)) if mibBuilder.loadTexts: mplsLsrStdMIB.setLastUpdated('200406030000Z') if mibBuilder.loadTexts: mplsLsrStdMIB.setOrganization('Multiprotocol Label Switching (MPLS) Working Group') class Mplsindextype(TextualConvention, OctetString): status = 'current' subtype_spec = OctetString.subtypeSpec + value_size_constraint(1, 24) class Mplsindexnexttype(TextualConvention, OctetString): status = 'current' subtype_spec = OctetString.subtypeSpec + value_size_constraint(1, 24) mpls_lsr_notifications = mib_identifier((1, 3, 6, 1, 2, 1, 10, 166, 2, 0)) mpls_lsr_objects = mib_identifier((1, 3, 6, 1, 2, 1, 10, 166, 2, 1)) mpls_lsr_conformance = mib_identifier((1, 3, 6, 1, 2, 1, 10, 166, 2, 2)) mpls_interface_table = mib_table((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1)) if mibBuilder.loadTexts: mplsInterfaceTable.setStatus('current') mpls_interface_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1)).setIndexNames((0, 'MPLS-LSR-STD-MIB', 'mplsInterfaceIndex')) if mibBuilder.loadTexts: mplsInterfaceEntry.setStatus('current') mpls_interface_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 1), interface_index_or_zero()) if mibBuilder.loadTexts: mplsInterfaceIndex.setStatus('current') mpls_interface_label_min_in = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 2), mpls_label()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsInterfaceLabelMinIn.setStatus('current') mpls_interface_label_max_in = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 3), mpls_label()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsInterfaceLabelMaxIn.setStatus('current') mpls_interface_label_min_out = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 4), mpls_label()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsInterfaceLabelMinOut.setStatus('current') mpls_interface_label_max_out = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 5), mpls_label()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsInterfaceLabelMaxOut.setStatus('current') mpls_interface_total_bandwidth = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 6), mpls_bit_rate()).setUnits('kilobits per second').setMaxAccess('readonly') if mibBuilder.loadTexts: mplsInterfaceTotalBandwidth.setStatus('current') mpls_interface_available_bandwidth = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 7), mpls_bit_rate()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsInterfaceAvailableBandwidth.setStatus('current') mpls_interface_label_participation_type = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 8), bits().clone(namedValues=named_values(('perPlatform', 0), ('perInterface', 1)))).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsInterfaceLabelParticipationType.setStatus('current') mpls_interface_perf_table = mib_table((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 2)) if mibBuilder.loadTexts: mplsInterfacePerfTable.setStatus('current') mpls_interface_perf_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 2, 1)) mplsInterfaceEntry.registerAugmentions(('MPLS-LSR-STD-MIB', 'mplsInterfacePerfEntry')) mplsInterfacePerfEntry.setIndexNames(*mplsInterfaceEntry.getIndexNames()) if mibBuilder.loadTexts: mplsInterfacePerfEntry.setStatus('current') mpls_interface_perf_in_labels_in_use = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 2, 1, 1), gauge32()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsInterfacePerfInLabelsInUse.setStatus('current') mpls_interface_perf_in_label_lookup_failures = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 2, 1, 2), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsInterfacePerfInLabelLookupFailures.setStatus('current') mpls_interface_perf_out_labels_in_use = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 2, 1, 3), gauge32()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsInterfacePerfOutLabelsInUse.setStatus('current') mpls_interface_perf_out_fragmented_pkts = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 2, 1, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsInterfacePerfOutFragmentedPkts.setStatus('current') mpls_in_segment_index_next = mib_scalar((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 3), mpls_index_next_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsInSegmentIndexNext.setStatus('current') mpls_in_segment_table = mib_table((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4)) if mibBuilder.loadTexts: mplsInSegmentTable.setStatus('current') mpls_in_segment_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1)).setIndexNames((0, 'MPLS-LSR-STD-MIB', 'mplsInSegmentIndex')) if mibBuilder.loadTexts: mplsInSegmentEntry.setStatus('current') mpls_in_segment_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 1), mpls_index_type()) if mibBuilder.loadTexts: mplsInSegmentIndex.setStatus('current') mpls_in_segment_interface = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 2), interface_index_or_zero()).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsInSegmentInterface.setStatus('current') mpls_in_segment_label = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 3), mpls_label()).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsInSegmentLabel.setStatus('current') mpls_in_segment_label_ptr = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 4), row_pointer().clone((0, 0))).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsInSegmentLabelPtr.setStatus('current') mpls_in_segment_n_pop = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647)).clone(1)).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsInSegmentNPop.setStatus('current') mpls_in_segment_addr_family = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 6), address_family_numbers().clone('other')).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsInSegmentAddrFamily.setStatus('current') mpls_in_segment_xc_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 7), mpls_index_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsInSegmentXCIndex.setStatus('current') mpls_in_segment_owner = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 8), mpls_owner()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsInSegmentOwner.setStatus('current') mpls_in_segment_traffic_param_ptr = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 9), row_pointer().clone((0, 0))).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsInSegmentTrafficParamPtr.setStatus('current') mpls_in_segment_row_status = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 10), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsInSegmentRowStatus.setStatus('current') mpls_in_segment_storage_type = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 11), storage_type().clone('volatile')).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsInSegmentStorageType.setStatus('current') mpls_in_segment_perf_table = mib_table((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5)) if mibBuilder.loadTexts: mplsInSegmentPerfTable.setStatus('current') mpls_in_segment_perf_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1)) mplsInSegmentEntry.registerAugmentions(('MPLS-LSR-STD-MIB', 'mplsInSegmentPerfEntry')) mplsInSegmentPerfEntry.setIndexNames(*mplsInSegmentEntry.getIndexNames()) if mibBuilder.loadTexts: mplsInSegmentPerfEntry.setStatus('current') mpls_in_segment_perf_octets = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1, 1), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsInSegmentPerfOctets.setStatus('current') mpls_in_segment_perf_packets = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1, 2), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsInSegmentPerfPackets.setStatus('current') mpls_in_segment_perf_errors = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsInSegmentPerfErrors.setStatus('current') mpls_in_segment_perf_discards = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsInSegmentPerfDiscards.setStatus('current') mpls_in_segment_perf_hc_octets = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1, 5), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsInSegmentPerfHCOctets.setStatus('current') mpls_in_segment_perf_discontinuity_time = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1, 6), time_stamp()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsInSegmentPerfDiscontinuityTime.setStatus('current') mpls_out_segment_index_next = mib_scalar((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 6), mpls_index_next_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsOutSegmentIndexNext.setStatus('current') mpls_out_segment_table = mib_table((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7)) if mibBuilder.loadTexts: mplsOutSegmentTable.setStatus('current') mpls_out_segment_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1)).setIndexNames((0, 'MPLS-LSR-STD-MIB', 'mplsOutSegmentIndex')) if mibBuilder.loadTexts: mplsOutSegmentEntry.setStatus('current') mpls_out_segment_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 1), mpls_index_type()) if mibBuilder.loadTexts: mplsOutSegmentIndex.setStatus('current') mpls_out_segment_interface = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 2), interface_index_or_zero()).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsOutSegmentInterface.setStatus('current') mpls_out_segment_push_top_label = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 3), truth_value().clone('true')).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsOutSegmentPushTopLabel.setStatus('current') mpls_out_segment_top_label = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 4), mpls_label()).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsOutSegmentTopLabel.setStatus('current') mpls_out_segment_top_label_ptr = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 5), row_pointer().clone((0, 0))).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsOutSegmentTopLabelPtr.setStatus('current') mpls_out_segment_next_hop_addr_type = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 6), inet_address_type()).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsOutSegmentNextHopAddrType.setStatus('current') mpls_out_segment_next_hop_addr = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 7), inet_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsOutSegmentNextHopAddr.setStatus('current') mpls_out_segment_xc_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 8), mpls_index_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsOutSegmentXCIndex.setStatus('current') mpls_out_segment_owner = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 9), mpls_owner()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsOutSegmentOwner.setStatus('current') mpls_out_segment_traffic_param_ptr = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 10), row_pointer().clone((0, 0))).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsOutSegmentTrafficParamPtr.setStatus('current') mpls_out_segment_row_status = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 11), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsOutSegmentRowStatus.setStatus('current') mpls_out_segment_storage_type = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 12), storage_type().clone('volatile')).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsOutSegmentStorageType.setStatus('current') mpls_out_segment_perf_table = mib_table((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8)) if mibBuilder.loadTexts: mplsOutSegmentPerfTable.setStatus('current') mpls_out_segment_perf_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1)) mplsOutSegmentEntry.registerAugmentions(('MPLS-LSR-STD-MIB', 'mplsOutSegmentPerfEntry')) mplsOutSegmentPerfEntry.setIndexNames(*mplsOutSegmentEntry.getIndexNames()) if mibBuilder.loadTexts: mplsOutSegmentPerfEntry.setStatus('current') mpls_out_segment_perf_octets = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1, 1), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsOutSegmentPerfOctets.setStatus('current') mpls_out_segment_perf_packets = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1, 2), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsOutSegmentPerfPackets.setStatus('current') mpls_out_segment_perf_errors = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsOutSegmentPerfErrors.setStatus('current') mpls_out_segment_perf_discards = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsOutSegmentPerfDiscards.setStatus('current') mpls_out_segment_perf_hc_octets = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1, 5), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsOutSegmentPerfHCOctets.setStatus('current') mpls_out_segment_perf_discontinuity_time = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1, 6), time_stamp()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsOutSegmentPerfDiscontinuityTime.setStatus('current') mpls_xc_index_next = mib_scalar((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 9), mpls_index_next_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsXCIndexNext.setStatus('current') mpls_xc_table = mib_table((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10)) if mibBuilder.loadTexts: mplsXCTable.setStatus('current') mpls_xc_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1)).setIndexNames((0, 'MPLS-LSR-STD-MIB', 'mplsXCIndex'), (0, 'MPLS-LSR-STD-MIB', 'mplsXCInSegmentIndex'), (0, 'MPLS-LSR-STD-MIB', 'mplsXCOutSegmentIndex')) if mibBuilder.loadTexts: mplsXCEntry.setStatus('current') mpls_xc_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 1), mpls_index_type()) if mibBuilder.loadTexts: mplsXCIndex.setStatus('current') mpls_xc_in_segment_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 2), mpls_index_type()) if mibBuilder.loadTexts: mplsXCInSegmentIndex.setStatus('current') mpls_xc_out_segment_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 3), mpls_index_type()) if mibBuilder.loadTexts: mplsXCOutSegmentIndex.setStatus('current') mpls_xc_lsp_id = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 4), mpls_lspid()).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsXCLspId.setStatus('current') mpls_xc_label_stack_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 5), mpls_index_type()).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsXCLabelStackIndex.setStatus('current') mpls_xc_owner = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 6), mpls_owner()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsXCOwner.setStatus('current') mpls_xc_row_status = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 7), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsXCRowStatus.setStatus('current') mpls_xc_storage_type = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 8), storage_type().clone('volatile')).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsXCStorageType.setStatus('current') mpls_xc_admin_status = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('up', 1), ('down', 2), ('testing', 3))).clone('up')).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsXCAdminStatus.setStatus('current') mpls_xc_oper_status = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('up', 1), ('down', 2), ('testing', 3), ('unknown', 4), ('dormant', 5), ('notPresent', 6), ('lowerLayerDown', 7)))).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsXCOperStatus.setStatus('current') mpls_max_label_stack_depth = mib_scalar((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 11), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsMaxLabelStackDepth.setStatus('current') mpls_label_stack_index_next = mib_scalar((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 12), mpls_index_next_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsLabelStackIndexNext.setStatus('current') mpls_label_stack_table = mib_table((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13)) if mibBuilder.loadTexts: mplsLabelStackTable.setStatus('current') mpls_label_stack_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1)).setIndexNames((0, 'MPLS-LSR-STD-MIB', 'mplsLabelStackIndex'), (0, 'MPLS-LSR-STD-MIB', 'mplsLabelStackLabelIndex')) if mibBuilder.loadTexts: mplsLabelStackEntry.setStatus('current') mpls_label_stack_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1, 1), mpls_index_type()) if mibBuilder.loadTexts: mplsLabelStackIndex.setStatus('current') mpls_label_stack_label_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1, 2), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))) if mibBuilder.loadTexts: mplsLabelStackLabelIndex.setStatus('current') mpls_label_stack_label = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1, 3), mpls_label()).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsLabelStackLabel.setStatus('current') mpls_label_stack_label_ptr = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1, 4), row_pointer().clone((0, 0))).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsLabelStackLabelPtr.setStatus('current') mpls_label_stack_row_status = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1, 5), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsLabelStackRowStatus.setStatus('current') mpls_label_stack_storage_type = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1, 6), storage_type().clone('volatile')).setMaxAccess('readcreate') if mibBuilder.loadTexts: mplsLabelStackStorageType.setStatus('current') mpls_in_segment_map_table = mib_table((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 14)) if mibBuilder.loadTexts: mplsInSegmentMapTable.setStatus('current') mpls_in_segment_map_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 14, 1)).setIndexNames((0, 'MPLS-LSR-STD-MIB', 'mplsInSegmentMapInterface'), (0, 'MPLS-LSR-STD-MIB', 'mplsInSegmentMapLabel'), (0, 'MPLS-LSR-STD-MIB', 'mplsInSegmentMapLabelPtrIndex')) if mibBuilder.loadTexts: mplsInSegmentMapEntry.setStatus('current') mpls_in_segment_map_interface = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 14, 1, 1), interface_index_or_zero()) if mibBuilder.loadTexts: mplsInSegmentMapInterface.setStatus('current') mpls_in_segment_map_label = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 14, 1, 2), mpls_label()) if mibBuilder.loadTexts: mplsInSegmentMapLabel.setStatus('current') mpls_in_segment_map_label_ptr_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 14, 1, 3), row_pointer()) if mibBuilder.loadTexts: mplsInSegmentMapLabelPtrIndex.setStatus('current') mpls_in_segment_map_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 14, 1, 4), mpls_index_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: mplsInSegmentMapIndex.setStatus('current') mpls_xc_notifications_enable = mib_scalar((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 15), truth_value().clone('false')).setMaxAccess('readwrite') if mibBuilder.loadTexts: mplsXCNotificationsEnable.setStatus('current') mpls_xc_up = notification_type((1, 3, 6, 1, 2, 1, 10, 166, 2, 0, 1)).setObjects(('MPLS-LSR-STD-MIB', 'mplsXCOperStatus'), ('MPLS-LSR-STD-MIB', 'mplsXCOperStatus')) if mibBuilder.loadTexts: mplsXCUp.setStatus('current') mpls_xc_down = notification_type((1, 3, 6, 1, 2, 1, 10, 166, 2, 0, 2)).setObjects(('MPLS-LSR-STD-MIB', 'mplsXCOperStatus'), ('MPLS-LSR-STD-MIB', 'mplsXCOperStatus')) if mibBuilder.loadTexts: mplsXCDown.setStatus('current') mpls_lsr_groups = mib_identifier((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1)) mpls_lsr_compliances = mib_identifier((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 2)) mpls_lsr_module_full_compliance = module_compliance((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 2, 1)).setObjects(('IF-MIB', 'ifGeneralInformationGroup'), ('IF-MIB', 'ifCounterDiscontinuityGroup'), ('MPLS-LSR-STD-MIB', 'mplsInterfaceGroup'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentGroup'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentGroup'), ('MPLS-LSR-STD-MIB', 'mplsXCGroup'), ('MPLS-LSR-STD-MIB', 'mplsPerfGroup'), ('MPLS-LSR-STD-MIB', 'mplsLabelStackGroup'), ('MPLS-LSR-STD-MIB', 'mplsHCInSegmentPerfGroup'), ('MPLS-LSR-STD-MIB', 'mplsHCOutSegmentPerfGroup'), ('MPLS-LSR-STD-MIB', 'mplsLsrNotificationGroup')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): mpls_lsr_module_full_compliance = mplsLsrModuleFullCompliance.setStatus('current') mpls_lsr_module_read_only_compliance = module_compliance((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 2, 2)).setObjects(('IF-MIB', 'ifGeneralInformationGroup'), ('IF-MIB', 'ifCounterDiscontinuityGroup'), ('MPLS-LSR-STD-MIB', 'mplsInterfaceGroup'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentGroup'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentGroup'), ('MPLS-LSR-STD-MIB', 'mplsXCGroup'), ('MPLS-LSR-STD-MIB', 'mplsPerfGroup'), ('MPLS-LSR-STD-MIB', 'mplsLabelStackGroup'), ('MPLS-LSR-STD-MIB', 'mplsHCInSegmentPerfGroup'), ('MPLS-LSR-STD-MIB', 'mplsHCOutSegmentPerfGroup'), ('MPLS-LSR-STD-MIB', 'mplsLsrNotificationGroup')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): mpls_lsr_module_read_only_compliance = mplsLsrModuleReadOnlyCompliance.setStatus('current') mpls_interface_group = object_group((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 1)).setObjects(('MPLS-LSR-STD-MIB', 'mplsInterfaceLabelMinIn'), ('MPLS-LSR-STD-MIB', 'mplsInterfaceLabelMaxIn'), ('MPLS-LSR-STD-MIB', 'mplsInterfaceLabelMinOut'), ('MPLS-LSR-STD-MIB', 'mplsInterfaceLabelMaxOut'), ('MPLS-LSR-STD-MIB', 'mplsInterfaceTotalBandwidth'), ('MPLS-LSR-STD-MIB', 'mplsInterfaceAvailableBandwidth'), ('MPLS-LSR-STD-MIB', 'mplsInterfaceLabelParticipationType')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): mpls_interface_group = mplsInterfaceGroup.setStatus('current') mpls_in_segment_group = object_group((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 2)).setObjects(('MPLS-LSR-STD-MIB', 'mplsInSegmentIndexNext'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentInterface'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentLabel'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentLabelPtr'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentNPop'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentAddrFamily'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentXCIndex'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentOwner'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentRowStatus'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentStorageType'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentTrafficParamPtr'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentMapIndex')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): mpls_in_segment_group = mplsInSegmentGroup.setStatus('current') mpls_out_segment_group = object_group((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 3)).setObjects(('MPLS-LSR-STD-MIB', 'mplsOutSegmentIndexNext'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentInterface'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentPushTopLabel'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentTopLabel'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentTopLabelPtr'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentNextHopAddrType'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentNextHopAddr'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentXCIndex'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentOwner'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentPerfOctets'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentPerfDiscards'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentPerfErrors'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentRowStatus'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentStorageType'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentTrafficParamPtr')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): mpls_out_segment_group = mplsOutSegmentGroup.setStatus('current') mpls_xc_group = object_group((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 4)).setObjects(('MPLS-LSR-STD-MIB', 'mplsXCIndexNext'), ('MPLS-LSR-STD-MIB', 'mplsXCLspId'), ('MPLS-LSR-STD-MIB', 'mplsXCLabelStackIndex'), ('MPLS-LSR-STD-MIB', 'mplsXCOwner'), ('MPLS-LSR-STD-MIB', 'mplsXCStorageType'), ('MPLS-LSR-STD-MIB', 'mplsXCAdminStatus'), ('MPLS-LSR-STD-MIB', 'mplsXCOperStatus'), ('MPLS-LSR-STD-MIB', 'mplsXCRowStatus'), ('MPLS-LSR-STD-MIB', 'mplsXCNotificationsEnable')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): mpls_xc_group = mplsXCGroup.setStatus('current') mpls_perf_group = object_group((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 5)).setObjects(('MPLS-LSR-STD-MIB', 'mplsInSegmentPerfOctets'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentPerfPackets'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentPerfErrors'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentPerfDiscards'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentPerfDiscontinuityTime'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentPerfOctets'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentPerfPackets'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentPerfDiscards'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentPerfDiscontinuityTime'), ('MPLS-LSR-STD-MIB', 'mplsInterfacePerfInLabelsInUse'), ('MPLS-LSR-STD-MIB', 'mplsInterfacePerfInLabelLookupFailures'), ('MPLS-LSR-STD-MIB', 'mplsInterfacePerfOutFragmentedPkts'), ('MPLS-LSR-STD-MIB', 'mplsInterfacePerfOutLabelsInUse')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): mpls_perf_group = mplsPerfGroup.setStatus('current') mpls_hc_in_segment_perf_group = object_group((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 6)).setObjects(('MPLS-LSR-STD-MIB', 'mplsInSegmentPerfHCOctets')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): mpls_hc_in_segment_perf_group = mplsHCInSegmentPerfGroup.setStatus('current') mpls_hc_out_segment_perf_group = object_group((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 7)).setObjects(('MPLS-LSR-STD-MIB', 'mplsOutSegmentPerfHCOctets')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): mpls_hc_out_segment_perf_group = mplsHCOutSegmentPerfGroup.setStatus('current') mpls_label_stack_group = object_group((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 8)).setObjects(('MPLS-LSR-STD-MIB', 'mplsLabelStackLabel'), ('MPLS-LSR-STD-MIB', 'mplsLabelStackLabelPtr'), ('MPLS-LSR-STD-MIB', 'mplsLabelStackRowStatus'), ('MPLS-LSR-STD-MIB', 'mplsLabelStackStorageType'), ('MPLS-LSR-STD-MIB', 'mplsMaxLabelStackDepth'), ('MPLS-LSR-STD-MIB', 'mplsLabelStackIndexNext')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): mpls_label_stack_group = mplsLabelStackGroup.setStatus('current') mpls_lsr_notification_group = notification_group((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 9)).setObjects(('MPLS-LSR-STD-MIB', 'mplsXCUp'), ('MPLS-LSR-STD-MIB', 'mplsXCDown')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): mpls_lsr_notification_group = mplsLsrNotificationGroup.setStatus('current') mibBuilder.exportSymbols('MPLS-LSR-STD-MIB', mplsInterfaceAvailableBandwidth=mplsInterfaceAvailableBandwidth, mplsLabelStackGroup=mplsLabelStackGroup, mplsInterfaceLabelMaxOut=mplsInterfaceLabelMaxOut, mplsXCTable=mplsXCTable, mplsInSegmentPerfDiscards=mplsInSegmentPerfDiscards, mplsLsrGroups=mplsLsrGroups, mplsXCEntry=mplsXCEntry, mplsInterfaceTotalBandwidth=mplsInterfaceTotalBandwidth, mplsLsrConformance=mplsLsrConformance, mplsOutSegmentPerfHCOctets=mplsOutSegmentPerfHCOctets, mplsInSegmentMapIndex=mplsInSegmentMapIndex, mplsInterfaceEntry=mplsInterfaceEntry, mplsOutSegmentOwner=mplsOutSegmentOwner, mplsLsrStdMIB=mplsLsrStdMIB, mplsXCLspId=mplsXCLspId, mplsLabelStackRowStatus=mplsLabelStackRowStatus, mplsInSegmentPerfPackets=mplsInSegmentPerfPackets, mplsInterfacePerfOutFragmentedPkts=mplsInterfacePerfOutFragmentedPkts, mplsLsrNotifications=mplsLsrNotifications, mplsOutSegmentTrafficParamPtr=mplsOutSegmentTrafficParamPtr, mplsXCDown=mplsXCDown, mplsInSegmentEntry=mplsInSegmentEntry, mplsOutSegmentStorageType=mplsOutSegmentStorageType, mplsInterfacePerfInLabelLookupFailures=mplsInterfacePerfInLabelLookupFailures, mplsInSegmentPerfErrors=mplsInSegmentPerfErrors, mplsLsrObjects=mplsLsrObjects, mplsInSegmentXCIndex=mplsInSegmentXCIndex, mplsInSegmentMapLabel=mplsInSegmentMapLabel, mplsInterfaceGroup=mplsInterfaceGroup, mplsXCIndex=mplsXCIndex, mplsInSegmentIndexNext=mplsInSegmentIndexNext, mplsInSegmentMapEntry=mplsInSegmentMapEntry, mplsOutSegmentPerfErrors=mplsOutSegmentPerfErrors, mplsLabelStackIndex=mplsLabelStackIndex, mplsLsrModuleReadOnlyCompliance=mplsLsrModuleReadOnlyCompliance, mplsInSegmentStorageType=mplsInSegmentStorageType, mplsLabelStackLabelPtr=mplsLabelStackLabelPtr, mplsLabelStackTable=mplsLabelStackTable, mplsInSegmentTrafficParamPtr=mplsInSegmentTrafficParamPtr, mplsPerfGroup=mplsPerfGroup, mplsHCInSegmentPerfGroup=mplsHCInSegmentPerfGroup, mplsInterfacePerfTable=mplsInterfacePerfTable, mplsOutSegmentNextHopAddrType=mplsOutSegmentNextHopAddrType, mplsXCIndexNext=mplsXCIndexNext, mplsXCOwner=mplsXCOwner, mplsInterfacePerfOutLabelsInUse=mplsInterfacePerfOutLabelsInUse, mplsOutSegmentPerfTable=mplsOutSegmentPerfTable, mplsInterfaceLabelMinIn=mplsInterfaceLabelMinIn, mplsOutSegmentGroup=mplsOutSegmentGroup, mplsOutSegmentTopLabelPtr=mplsOutSegmentTopLabelPtr, mplsInSegmentMapTable=mplsInSegmentMapTable, mplsInSegmentIndex=mplsInSegmentIndex, mplsXCOutSegmentIndex=mplsXCOutSegmentIndex, mplsInSegmentPerfTable=mplsInSegmentPerfTable, mplsInSegmentLabel=mplsInSegmentLabel, mplsOutSegmentPerfDiscontinuityTime=mplsOutSegmentPerfDiscontinuityTime, mplsXCGroup=mplsXCGroup, mplsOutSegmentIndex=mplsOutSegmentIndex, mplsLabelStackLabelIndex=mplsLabelStackLabelIndex, mplsInterfaceTable=mplsInterfaceTable, mplsOutSegmentPerfEntry=mplsOutSegmentPerfEntry, MplsIndexType=MplsIndexType, mplsXCInSegmentIndex=mplsXCInSegmentIndex, mplsOutSegmentEntry=mplsOutSegmentEntry, mplsInterfacePerfEntry=mplsInterfacePerfEntry, mplsXCStorageType=mplsXCStorageType, mplsLabelStackLabel=mplsLabelStackLabel, mplsOutSegmentPerfDiscards=mplsOutSegmentPerfDiscards, mplsInSegmentPerfDiscontinuityTime=mplsInSegmentPerfDiscontinuityTime, mplsXCAdminStatus=mplsXCAdminStatus, mplsInterfaceLabelMinOut=mplsInterfaceLabelMinOut, mplsLabelStackStorageType=mplsLabelStackStorageType, mplsInterfacePerfInLabelsInUse=mplsInterfacePerfInLabelsInUse, mplsXCRowStatus=mplsXCRowStatus, mplsOutSegmentIndexNext=mplsOutSegmentIndexNext, mplsOutSegmentTable=mplsOutSegmentTable, mplsLsrNotificationGroup=mplsLsrNotificationGroup, mplsOutSegmentPerfOctets=mplsOutSegmentPerfOctets, mplsLabelStackEntry=mplsLabelStackEntry, mplsMaxLabelStackDepth=mplsMaxLabelStackDepth, mplsInSegmentAddrFamily=mplsInSegmentAddrFamily, mplsInSegmentInterface=mplsInSegmentInterface, mplsInterfaceLabelMaxIn=mplsInterfaceLabelMaxIn, mplsInterfaceIndex=mplsInterfaceIndex, mplsInSegmentPerfHCOctets=mplsInSegmentPerfHCOctets, mplsXCOperStatus=mplsXCOperStatus, mplsOutSegmentNextHopAddr=mplsOutSegmentNextHopAddr, mplsLsrCompliances=mplsLsrCompliances, mplsInSegmentTable=mplsInSegmentTable, mplsOutSegmentRowStatus=mplsOutSegmentRowStatus, mplsXCUp=mplsXCUp, mplsInSegmentLabelPtr=mplsInSegmentLabelPtr, mplsXCNotificationsEnable=mplsXCNotificationsEnable, mplsInSegmentMapInterface=mplsInSegmentMapInterface, mplsOutSegmentTopLabel=mplsOutSegmentTopLabel, MplsIndexNextType=MplsIndexNextType, mplsInterfaceLabelParticipationType=mplsInterfaceLabelParticipationType, mplsInSegmentMapLabelPtrIndex=mplsInSegmentMapLabelPtrIndex, mplsInSegmentRowStatus=mplsInSegmentRowStatus, mplsInSegmentOwner=mplsInSegmentOwner, mplsInSegmentNPop=mplsInSegmentNPop, mplsInSegmentPerfEntry=mplsInSegmentPerfEntry, mplsHCOutSegmentPerfGroup=mplsHCOutSegmentPerfGroup, mplsLabelStackIndexNext=mplsLabelStackIndexNext, mplsOutSegmentPerfPackets=mplsOutSegmentPerfPackets, mplsInSegmentGroup=mplsInSegmentGroup, mplsInSegmentPerfOctets=mplsInSegmentPerfOctets, mplsOutSegmentPushTopLabel=mplsOutSegmentPushTopLabel, PYSNMP_MODULE_ID=mplsLsrStdMIB, mplsOutSegmentXCIndex=mplsOutSegmentXCIndex, mplsOutSegmentInterface=mplsOutSegmentInterface, mplsLsrModuleFullCompliance=mplsLsrModuleFullCompliance, mplsXCLabelStackIndex=mplsXCLabelStackIndex)
n = int(input('How many sides the convex polygon have: ')) nd = (n * (n - 3)) / 2 print(f'The convex polygon have {nd} sides.')
n = int(input('How many sides the convex polygon have: ')) nd = n * (n - 3) / 2 print(f'The convex polygon have {nd} sides.')
# Minimal django settings to run tests DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = () MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': './sqlite3.db', } } SECRET_KEY = 'alksjdf93jqpijsdaklfjq;3lejqklejlakefjas' TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', ) MIDDLEWARE_CLASSES = ( 'django_seo_js.middleware.HashBangMiddleware', 'django_seo_js.middleware.UserAgentMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', ) INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ) INSTALLED_APPS += ('django_seo_js',) CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'LOCATION': 'django_seo_js' } } SEO_JS_PRERENDER_TOKEN = "123456789"
debug = True template_debug = DEBUG admins = () managers = ADMINS databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': './sqlite3.db'}} secret_key = 'alksjdf93jqpijsdaklfjq;3lejqklejlakefjas' template_loaders = ('django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader') middleware_classes = ('django_seo_js.middleware.HashBangMiddleware', 'django_seo_js.middleware.UserAgentMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware') installed_apps = ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles') installed_apps += ('django_seo_js',) caches = {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'LOCATION': 'django_seo_js'}} seo_js_prerender_token = '123456789'
#!/usr/bin/env python TOOL = "tool" PRECISION = "precision" RECALL = "recall" AVG_PRECISION = "avg_precision" STD_DEV_PRECISION = "std_dev_precision" SEM_PRECISION = "sem_precision" AVG_RECALL = "avg_recall" STD_DEV_RECALL = "std_dev_recall" SEM_RECALL = "sem_recall" RI_BY_BP = "rand_index_by_bp" RI_BY_SEQ = "rand_index_by_seq" ARI_BY_BP = "a_rand_index_by_bp" ARI_BY_SEQ = "a_rand_index_by_seq" PERCENTAGE_ASSIGNED_BPS = "percent_assigned_bps" abbreviations = {'avg_precision': 'precision averaged over genome bins', 'std_dev_precision': 'standard deviation of precision averaged over genome bins', 'sem_precision': 'standard error of the mean of precision averaged over genome bins', 'avg_recall': 'recall averaged over genome bins', 'std_dev_recall': 'standard deviation of recall averaged over genome bins', 'sem_recall': 'standard error of the mean of recall averaged over genome bins', 'precision': 'precision weighed by base pairs', 'recall': 'recall weighed by base pairs', 'rand_index_by_bp': 'Rand index weighed by base pairs', 'rand_index_by_seq': 'Rand index weighed by sequence counts', 'a_rand_index_by_bp': 'adjusted Rand index weighed by base pairs', 'a_rand_index_by_seq': 'adjusted Rand index weighed by sequence counts', 'percent_assigned_bps': 'percentage of base pairs that were assigned to bins', '>0.5compl<0.1cont': 'number of genomes with more than 50% completeness and less than 10% contamination', '>0.7compl<0.1cont': 'number of genomes with more than 70% completeness and less than 10% contamination', '>0.9compl<0.1cont': 'number of genomes with more than 90% completeness and less than 10% contamination', '>0.5compl<0.05cont': 'number of genomes with more than 50% completeness and less than 5% contamination', '>0.7compl<0.05cont': 'number of genomes with more than 70% completeness and less than 5% contamination', '>0.9compl<0.05cont': 'number of genomes with more than 90% completeness and less than 5% contamination'}
tool = 'tool' precision = 'precision' recall = 'recall' avg_precision = 'avg_precision' std_dev_precision = 'std_dev_precision' sem_precision = 'sem_precision' avg_recall = 'avg_recall' std_dev_recall = 'std_dev_recall' sem_recall = 'sem_recall' ri_by_bp = 'rand_index_by_bp' ri_by_seq = 'rand_index_by_seq' ari_by_bp = 'a_rand_index_by_bp' ari_by_seq = 'a_rand_index_by_seq' percentage_assigned_bps = 'percent_assigned_bps' abbreviations = {'avg_precision': 'precision averaged over genome bins', 'std_dev_precision': 'standard deviation of precision averaged over genome bins', 'sem_precision': 'standard error of the mean of precision averaged over genome bins', 'avg_recall': 'recall averaged over genome bins', 'std_dev_recall': 'standard deviation of recall averaged over genome bins', 'sem_recall': 'standard error of the mean of recall averaged over genome bins', 'precision': 'precision weighed by base pairs', 'recall': 'recall weighed by base pairs', 'rand_index_by_bp': 'Rand index weighed by base pairs', 'rand_index_by_seq': 'Rand index weighed by sequence counts', 'a_rand_index_by_bp': 'adjusted Rand index weighed by base pairs', 'a_rand_index_by_seq': 'adjusted Rand index weighed by sequence counts', 'percent_assigned_bps': 'percentage of base pairs that were assigned to bins', '>0.5compl<0.1cont': 'number of genomes with more than 50% completeness and less than 10% contamination', '>0.7compl<0.1cont': 'number of genomes with more than 70% completeness and less than 10% contamination', '>0.9compl<0.1cont': 'number of genomes with more than 90% completeness and less than 10% contamination', '>0.5compl<0.05cont': 'number of genomes with more than 50% completeness and less than 5% contamination', '>0.7compl<0.05cont': 'number of genomes with more than 70% completeness and less than 5% contamination', '>0.9compl<0.05cont': 'number of genomes with more than 90% completeness and less than 5% contamination'}
# parameters used in experiment # ============================================================================== # optitrack communication ip (win10 is the server, the ubuntu receiving data is client) # ============================================================================== ip_win10 = '192.168.1.5' ip_ubuntu_pc = '192.168.1.3' # ============================================================================== # Local lidar ports # ============================================================================== LIDAR_PORT1 = '/dev/ttyUSB0' LIDAR_PORT2 = '/dev/ttyUSB1' LIDAR_PORT3 = '/dev/ttyUSB2' LIDAR_PORT4 = '/dev/ttyUSB3' LIDAR_PORTs = [LIDAR_PORT1, LIDAR_PORT2, LIDAR_PORT3] # ============================================================================== # Parameters used in calibration # ============================================================================== # [t1, t2], rmax: car is in the lidar field of view [t1,t2] within range of rmax # where the lidar measurements is in [0, 360 deg] CarToLidar1FoV = dict(FoVs=[[0,40], [320, 360]], rmax=1400) CarToLidar2FoV = dict(FoVs=[[0,40], [320, 360]], rmax=1400) CarToLidar3FoV = dict(FoVs=[[0,40], [320, 360]], rmax=1400) CarToLidarFoVs = [CarToLidar1FoV, CarToLidar2FoV, CarToLidar3FoV] DistanceThreshold = [[0.2, 0.22], [0.11,0.14], [0.0, 0.06]] #range of l2 error between lidar and optitrack estimation in [meter] HardErrBound = [0.1, 10] # hard max error bound
ip_win10 = '192.168.1.5' ip_ubuntu_pc = '192.168.1.3' lidar_port1 = '/dev/ttyUSB0' lidar_port2 = '/dev/ttyUSB1' lidar_port3 = '/dev/ttyUSB2' lidar_port4 = '/dev/ttyUSB3' lidar_por_ts = [LIDAR_PORT1, LIDAR_PORT2, LIDAR_PORT3] car_to_lidar1_fo_v = dict(FoVs=[[0, 40], [320, 360]], rmax=1400) car_to_lidar2_fo_v = dict(FoVs=[[0, 40], [320, 360]], rmax=1400) car_to_lidar3_fo_v = dict(FoVs=[[0, 40], [320, 360]], rmax=1400) car_to_lidar_fo_vs = [CarToLidar1FoV, CarToLidar2FoV, CarToLidar3FoV] distance_threshold = [[0.2, 0.22], [0.11, 0.14], [0.0, 0.06]] hard_err_bound = [0.1, 10]
Vocales = ("a","e","i","o","u", " ") texto = input("Ingresar el texto: ") texto_nuevo = 0 for letters in texto: if letters not in Vocales: texto_nuevo = texto_nuevo + 1 print("El numero de consonantes es: ", texto_nuevo)
vocales = ('a', 'e', 'i', 'o', 'u', ' ') texto = input('Ingresar el texto: ') texto_nuevo = 0 for letters in texto: if letters not in Vocales: texto_nuevo = texto_nuevo + 1 print('El numero de consonantes es: ', texto_nuevo)
FILE_PATH = "data/cows.mp4" MODEL_PATH = "model/mobilenet_v2_ssd_coco_frozen_graph.pb" CONFIG_PATH = "model/mobilenet_v2_ssd_coco_config.pbtxt" LABEL_PATH = "model/coco_class_labels.txt" WINDOW_NAME = "detection" MIN_CONF = 0.4 MAX_IOU = 0.5
file_path = 'data/cows.mp4' model_path = 'model/mobilenet_v2_ssd_coco_frozen_graph.pb' config_path = 'model/mobilenet_v2_ssd_coco_config.pbtxt' label_path = 'model/coco_class_labels.txt' window_name = 'detection' min_conf = 0.4 max_iou = 0.5
''' data structures that used executive architecture ''' class Command(object): def __init__(self, Name, Payload): self.Name = Name self.Payload = Payload class Gesture(object): def __init__(self, ID, NAME, LastTimeSync, IterableGesture, NumberOfGestureRepetitions, NumberOfMotions, ListActions): self.ID = ID self.NAME = NAME self.LastTimeSync = LastTimeSync self.IterableGesture = IterableGesture self.NumberOfGestureRepetitions = NumberOfGestureRepetitions self.NumberOfMotions = NumberOfMotions self.ListActions = ListActions class GestureAction(object): def __init__(self, PointerFingerPosition, MiddleFingerPosition, RingFinderPosition, LittleFingerPosition, ThumbFingerPosition, Delay): self.PointerFingerPosition = PointerFingerPosition self.MiddleFingerPosition = MiddleFingerPosition self.RingFinderPosition = RingFinderPosition self.LittleFingerPosition = LittleFingerPosition self.ThumbFingerPosition = ThumbFingerPosition self.Delay = Delay
""" data structures that used executive architecture """ class Command(object): def __init__(self, Name, Payload): self.Name = Name self.Payload = Payload class Gesture(object): def __init__(self, ID, NAME, LastTimeSync, IterableGesture, NumberOfGestureRepetitions, NumberOfMotions, ListActions): self.ID = ID self.NAME = NAME self.LastTimeSync = LastTimeSync self.IterableGesture = IterableGesture self.NumberOfGestureRepetitions = NumberOfGestureRepetitions self.NumberOfMotions = NumberOfMotions self.ListActions = ListActions class Gestureaction(object): def __init__(self, PointerFingerPosition, MiddleFingerPosition, RingFinderPosition, LittleFingerPosition, ThumbFingerPosition, Delay): self.PointerFingerPosition = PointerFingerPosition self.MiddleFingerPosition = MiddleFingerPosition self.RingFinderPosition = RingFinderPosition self.LittleFingerPosition = LittleFingerPosition self.ThumbFingerPosition = ThumbFingerPosition self.Delay = Delay
'''FreeProxy exceptions module''' class FreeProxyException(Exception): '''Exception class with message as a required parameter''' def __init__(self, message) -> None: self.message = message super().__init__(self.message)
"""FreeProxy exceptions module""" class Freeproxyexception(Exception): """Exception class with message as a required parameter""" def __init__(self, message) -> None: self.message = message super().__init__(self.message)
__all__ = ["SENTINEL1_COLLECTION_ID", "VV", "VH", "IW", "ASCENDING", "DESCENDING"] SENTINEL1_COLLECTION_ID = "COPERNICUS/S1_GRD_FLOAT" VV = "VV" VH = "VH" IW = "IW" ASCENDING = "ASCENDING" DESCENDING = "DESCENDING" GEE_PROPERTIES = [ "system:id", "sliceNumber", "system:time_start", "relativeOrbitNumber_start", "relativeOrbitNumber_stop", "orbitNumber_start", "orbitNumber_stop", "instrumentConfigurationID", "system:asset_size", "cycleNumber", ]
__all__ = ['SENTINEL1_COLLECTION_ID', 'VV', 'VH', 'IW', 'ASCENDING', 'DESCENDING'] sentinel1_collection_id = 'COPERNICUS/S1_GRD_FLOAT' vv = 'VV' vh = 'VH' iw = 'IW' ascending = 'ASCENDING' descending = 'DESCENDING' gee_properties = ['system:id', 'sliceNumber', 'system:time_start', 'relativeOrbitNumber_start', 'relativeOrbitNumber_stop', 'orbitNumber_start', 'orbitNumber_stop', 'instrumentConfigurationID', 'system:asset_size', 'cycleNumber']
start = 1 end = 100 for x in range(start,end): if (x % 2 == 0): continue print(x)
start = 1 end = 100 for x in range(start, end): if x % 2 == 0: continue print(x)
class AggResult: def __init__(self, agg_key, result=None, return_counts=True): self.return_counts = return_counts if result is None: self.total = 0 self._hits = [] else: self.total = result['hits']['total']['value'] self._hits = result['aggregations'][agg_key]['buckets'] def __repr__(self): return "hits {}, total: {}".format(self._hits, self.total) def __iter__(self): for hit in self._hits: row = hit['key'] if self.return_counts: count = hit['doc_count'] yield {row: count} else: yield row def dict(self): return { "total": self.total, "result": list(self) }
class Aggresult: def __init__(self, agg_key, result=None, return_counts=True): self.return_counts = return_counts if result is None: self.total = 0 self._hits = [] else: self.total = result['hits']['total']['value'] self._hits = result['aggregations'][agg_key]['buckets'] def __repr__(self): return 'hits {}, total: {}'.format(self._hits, self.total) def __iter__(self): for hit in self._hits: row = hit['key'] if self.return_counts: count = hit['doc_count'] yield {row: count} else: yield row def dict(self): return {'total': self.total, 'result': list(self)}
class Solution: def destCity(self, paths: List[List[str]]) -> str: s = set() for path in paths: s.add(path[0]) s.add(path[1]) for path in paths: s.remove(path[0]) return list(s).pop()
class Solution: def dest_city(self, paths: List[List[str]]) -> str: s = set() for path in paths: s.add(path[0]) s.add(path[1]) for path in paths: s.remove(path[0]) return list(s).pop()
class Solution: def checkString(self, s: str) -> bool: flag = 0 for ch in s: if flag == 0 and ch == 'b': flag = 1 elif flag == 1 and ch == 'a': return False return True
class Solution: def check_string(self, s: str) -> bool: flag = 0 for ch in s: if flag == 0 and ch == 'b': flag = 1 elif flag == 1 and ch == 'a': return False return True
class Node: def __init__(self, data=None) -> None: self.data = data self.next = None self.prev = None class DoublyList: def __init__(self) -> None: self.front = None self.back = None self.size = 0 def add_back(self, data: int) -> None: node = Node(data) if self.is_empty(): self.front = node self.back = node else: self.back.next = node node.prev = self.back self.back = node self.size += 1 def add_front(self, data: int) -> None: node = Node(data) if self.is_empty(): self.front = node self.back = node else: node.next = self.front self.front.prev = node self.front = node self.size += 1 def remove(self, data: int) -> None: if self.is_empty(): raise Exception("Error: list is aleady empty.") else: ptr = self.front while ptr.next is not None: if (ptr.data == data): ptr.prev = ptr.prev.prev ptr.next = ptr.next.next self.size -= 1 return ptr = ptr.next raise Exception("Error: element is not found on the list") def remove_front(self)->None: if self.is_empty(): return else: self.front = self.front.next self.size -= 1 def remove_back(self)->None: if self.is_empty(): return else: self.back = self.back.prev self.size -= 1 def display(self) -> None: ptr = self.front while ptr.next is not None: print(ptr.data) ptr = ptr.next def is_empty(self) -> bool: return self.front is None and self.back is None def display_reverse(self) -> None: pass
class Node: def __init__(self, data=None) -> None: self.data = data self.next = None self.prev = None class Doublylist: def __init__(self) -> None: self.front = None self.back = None self.size = 0 def add_back(self, data: int) -> None: node = node(data) if self.is_empty(): self.front = node self.back = node else: self.back.next = node node.prev = self.back self.back = node self.size += 1 def add_front(self, data: int) -> None: node = node(data) if self.is_empty(): self.front = node self.back = node else: node.next = self.front self.front.prev = node self.front = node self.size += 1 def remove(self, data: int) -> None: if self.is_empty(): raise exception('Error: list is aleady empty.') else: ptr = self.front while ptr.next is not None: if ptr.data == data: ptr.prev = ptr.prev.prev ptr.next = ptr.next.next self.size -= 1 return ptr = ptr.next raise exception('Error: element is not found on the list') def remove_front(self) -> None: if self.is_empty(): return else: self.front = self.front.next self.size -= 1 def remove_back(self) -> None: if self.is_empty(): return else: self.back = self.back.prev self.size -= 1 def display(self) -> None: ptr = self.front while ptr.next is not None: print(ptr.data) ptr = ptr.next def is_empty(self) -> bool: return self.front is None and self.back is None def display_reverse(self) -> None: pass
class AlmostPrimeNumbers: def getNext(self, m): sieve = [True]*(10**6+2) for i in xrange(2, 10**6+2): if sieve[i]: for j in xrange(2*i, 10**6+2, i): sieve[j] = False def is_almost(n): return not sieve[n] and not any(n%i == 0 for i in xrange(2, 11)) i = m+1 while not is_almost(i): i += 1 return i
class Almostprimenumbers: def get_next(self, m): sieve = [True] * (10 ** 6 + 2) for i in xrange(2, 10 ** 6 + 2): if sieve[i]: for j in xrange(2 * i, 10 ** 6 + 2, i): sieve[j] = False def is_almost(n): return not sieve[n] and (not any((n % i == 0 for i in xrange(2, 11)))) i = m + 1 while not is_almost(i): i += 1 return i
class LandingType(object): # For choosing what the main landing page displays KICKOFF = 1 BUILDSEASON = 2 COMPETITIONSEASON = 3 OFFSEASON = 4 INSIGHTS = 5 CHAMPS = 6 NAMES = { KICKOFF: 'Kickoff', BUILDSEASON: 'Build Season', COMPETITIONSEASON: 'Competition Season', OFFSEASON: 'Offseason', INSIGHTS: 'Insights', CHAMPS: 'Championship', }
class Landingtype(object): kickoff = 1 buildseason = 2 competitionseason = 3 offseason = 4 insights = 5 champs = 6 names = {KICKOFF: 'Kickoff', BUILDSEASON: 'Build Season', COMPETITIONSEASON: 'Competition Season', OFFSEASON: 'Offseason', INSIGHTS: 'Insights', CHAMPS: 'Championship'}
#!/usr/bin/env python polymer = input() letters = [ord(c) for c in set(polymer.upper())] polymer = [ord(c) for c in polymer] def react(polymer, forbidden=set()): stack = [] for unit in polymer: if unit not in forbidden: if stack and abs(unit - stack[-1]) == 32: stack.pop() else: stack.append(unit) return len(stack) assert react(polymer) == 9172 lowest = min([react(polymer, {c, c + 32}) for c in letters]) assert lowest == 6550
polymer = input() letters = [ord(c) for c in set(polymer.upper())] polymer = [ord(c) for c in polymer] def react(polymer, forbidden=set()): stack = [] for unit in polymer: if unit not in forbidden: if stack and abs(unit - stack[-1]) == 32: stack.pop() else: stack.append(unit) return len(stack) assert react(polymer) == 9172 lowest = min([react(polymer, {c, c + 32}) for c in letters]) assert lowest == 6550
#!/usr/bin/env python3 class colors: GREEN = '\033[92m' YELLOW = '\033[93m' BLUE = '\033[94m' RED = '\033[91m' BOLD = '\033[1m' RESET = '\033[0m'
class Colors: green = '\x1b[92m' yellow = '\x1b[93m' blue = '\x1b[94m' red = '\x1b[91m' bold = '\x1b[1m' reset = '\x1b[0m'
nombre_usuario = input("Introduce tu nombre de usuario: ") print("El nombre es:", nombre_usuario) print("El nombre es:", nombre_usuario.upper()) print("El nombre es:", nombre_usuario.lower()) print("El nombre es:", nombre_usuario.capitalize())
nombre_usuario = input('Introduce tu nombre de usuario: ') print('El nombre es:', nombre_usuario) print('El nombre es:', nombre_usuario.upper()) print('El nombre es:', nombre_usuario.lower()) print('El nombre es:', nombre_usuario.capitalize())
class Node: def __init__(self, value=None): self.value = value self.next = None def __str__(self): return str(self.value) class LinkedList: def __init__(self): self.head = None self.tail = None def __iter__(self): node = self.head while node != None: yield node node = node.next class Queue: def __init__(self): self.linkedList = LinkedList() def __str__(self): values = [str(x) for x in self.linkedList] return ' '.join(values) def enqueue(self, value): newNode = Node(value) if self.linkedList.head == None: self.linkedList.head = newNode self.linkedList.tail = newNode else: self.linkedList.tail.next = newNode self.linkedList.tail = newNode def isEmpty(self): if self.linkedList.head == None: return True else: return False def dequeue(self): if self.isEmpty() == True: return "There is not any node in the Queue" else: tempNode = self.linkedList.head if self.linkedList.head == self.linkedList.tail: self.linkedList.head = None self.linkedList.tail = None else: self.linkedList.head = self.linkedList.head.next return tempNode def peek(self): if self.isEmpty() == True: return "There is not any node in the Queue" else: return self.linkedList.head.value def delete(self): if self.isEmpty() == True: return "There is not any node in the Queue" else: self.linkedList.head = None self.linkedList.tail = None
class Node: def __init__(self, value=None): self.value = value self.next = None def __str__(self): return str(self.value) class Linkedlist: def __init__(self): self.head = None self.tail = None def __iter__(self): node = self.head while node != None: yield node node = node.next class Queue: def __init__(self): self.linkedList = linked_list() def __str__(self): values = [str(x) for x in self.linkedList] return ' '.join(values) def enqueue(self, value): new_node = node(value) if self.linkedList.head == None: self.linkedList.head = newNode self.linkedList.tail = newNode else: self.linkedList.tail.next = newNode self.linkedList.tail = newNode def is_empty(self): if self.linkedList.head == None: return True else: return False def dequeue(self): if self.isEmpty() == True: return 'There is not any node in the Queue' else: temp_node = self.linkedList.head if self.linkedList.head == self.linkedList.tail: self.linkedList.head = None self.linkedList.tail = None else: self.linkedList.head = self.linkedList.head.next return tempNode def peek(self): if self.isEmpty() == True: return 'There is not any node in the Queue' else: return self.linkedList.head.value def delete(self): if self.isEmpty() == True: return 'There is not any node in the Queue' else: self.linkedList.head = None self.linkedList.tail = None
RELEVANT_COLUMNS = [ "HONG KONG", "JAPAN", "CANADA", "FINLAND", "DENMARK", "ESTONIA", "POLAND", "CZECH REPUBLIC", "SLOVENIA and BALKANs", "ITALY", "SPAIN", "SWITZERLAND", "BENELUX", "UK", "ISLAND", "USA Wholesale", "Germany/ Austria", "Sweden/ Norway", "Store", "Marketplaces (AZ+ ZA)", "Webshop (INK US, CAN, FIN)", ] def forecasts_handler(iterator): for row in iterator: if row["Article number "] == "": continue else: for col in RELEVANT_COLUMNS: try: row[col] = int(row[col].replace(" ", "")) except: row[col] = 0 yield { "Article_number": row["Article number "], "Distribution_ID": col, "Quantity": row[col], }
relevant_columns = ['HONG KONG', 'JAPAN', 'CANADA', 'FINLAND', 'DENMARK', 'ESTONIA', 'POLAND', 'CZECH REPUBLIC', 'SLOVENIA and BALKANs', 'ITALY', 'SPAIN', 'SWITZERLAND', 'BENELUX', 'UK', 'ISLAND', 'USA Wholesale', 'Germany/ Austria', 'Sweden/ Norway', 'Store', 'Marketplaces (AZ+ ZA)', 'Webshop (INK US, CAN, FIN)'] def forecasts_handler(iterator): for row in iterator: if row['Article number '] == '': continue else: for col in RELEVANT_COLUMNS: try: row[col] = int(row[col].replace(' ', '')) except: row[col] = 0 yield {'Article_number': row['Article number '], 'Distribution_ID': col, 'Quantity': row[col]}
API = "api" API_DEFAULT_DESCRIPTOR = "default" API_ERROR_MESSAGES = "errorMessages" API_QUERY_STRING = "query_string" API_RESOURCE = "resource_name" API_RETURN = "on_return" COLUMN_FORMATING = "column_formating" COLUMN_CLEANING = "column_cleaning" COLUMN_EXPANDING = "column_expending" DEFAULT_COLUMNS_TO_EXPAND = ["changelog", "fields", "renderedFields", "names", "schema", "operations", "editmeta", "versionedRepresentations"] ENDPOINTS = "endpoints" ITEM_VALUE = "{item_value}" JIRA_BOARD_ID_404 = "Board {item_value} does not exists or the user does not have permission to view it." JIRA_CORE_PAGINATION = { "skip_key": "startAt", "limit_key": "maxResults", "total_key": "total" } JIRA_CORE_URL = "{site_url}rest/api/3/{resource_name}" JIRA_IS_LAST_PAGE = "isLastPage" JIRA_LICENSE_403 = "The user does not a have valid license" JIRA_NEXT = "next" JIRA_OPSGENIE_402 = "The account cannot do this action because of subscription plan" JIRA_OPSGENIE_PAGING = "paging" JIRA_OPSGENIE_URL = "api.opsgenie.com/{resource_name}" JIRA_PAGING = "_links" JIRA_SERVICE_DESK_ID_404 = "Service Desk ID {item_value} does not exists" JIRA_SERVICE_DESK_PAGINATION = { "next_page_key": ["_links", "next"] } JIRA_SERVICE_DESK_URL = "{site_url}rest/servicedeskapi/{resource_name}" JIRA_SOFTWARE_URL = "{site_url}rest/agile/1.0/{resource_name}" PAGINATION = "pagination" endpoint_descriptors = { API_DEFAULT_DESCRIPTOR: { API_RESOURCE: "{endpoint_name}/{item_value}", API: JIRA_CORE_URL, API_RETURN: { 200: None, 401: "The user is not logged in", 403: "The user does not have permission to complete this request", 404: "Item {item_value} not found", 500: "Jira Internal Server Error" }, COLUMN_EXPANDING: DEFAULT_COLUMNS_TO_EXPAND, PAGINATION: JIRA_CORE_PAGINATION }, ENDPOINTS: { "dashboard": {API_RETURN: {200: ["dashboards", None]}}, "dashboard/search": {API_RETURN: {200: "values"}}, "field": { API_RESOURCE: "{endpoint_name}", }, "group": { API_RESOURCE: "{endpoint_name}/member", API_QUERY_STRING: {"groupname": ITEM_VALUE}, API_RETURN: {200: "values"} }, "issue": { API_QUERY_STRING: {"expand": "{expand}"} }, "issue/createmeta": { API_RESOURCE: "{endpoint_name}", API_RETURN: { 200: "projects" } }, "issue(Filter)": { API_RESOURCE: "search", API_QUERY_STRING: {"jql": "filter={}".format(ITEM_VALUE), "expand": "{expand}"}, API_RETURN: { 200: "issues" } }, "issue(JQL)": { API_RESOURCE: "search", API_QUERY_STRING: {"jql": ITEM_VALUE, "expand": "{expand}"}, API_RETURN: { 200: "issues" } }, "project/components": { API_RESOURCE: "project/{item_value}/components" }, "project/search": { API_RESOURCE: "{endpoint_name}", API_QUERY_STRING: {"expand": "{expand}"}, # expand: description, projectKeyrs, lead, issueTypes, url, insight API_RETURN: { 200: "values", 404: "Item not found" } }, "project/versions": { API_RESOURCE: "project/{item_value}/versions", API_QUERY_STRING: {"expand": "{expand}"} # expand: issuesstatus, operations }, "search": { API_RESOURCE: "search", API_QUERY_STRING: {"jql": ITEM_VALUE, "expand": "{expand}"}, API_RETURN: { 200: "issues" } }, "worklog/deleted": {}, "worklog/list": { API_RESOURCE: "issue/{item_value}/worklog", }, "organization": { API: JIRA_SERVICE_DESK_URL, API_RESOURCE: "organization/{item_value}", API_RETURN: { 200: ["values", None], 404: "Organization ID {item_value} does not exists" }, PAGINATION: JIRA_SERVICE_DESK_PAGINATION }, "organization/user": { API: JIRA_SERVICE_DESK_URL, API_RESOURCE: "organization/{item_value}/user", API_RETURN: { 200: "values", 404: "Organization ID {item_value} does not exists" }, PAGINATION: JIRA_SERVICE_DESK_PAGINATION }, "request": { API: JIRA_SERVICE_DESK_URL, API_RETURN: { 200: ["values", None] }, PAGINATION: JIRA_SERVICE_DESK_PAGINATION }, "servicedesk": { API: JIRA_SERVICE_DESK_URL, API_RESOURCE: "{endpoint_name}/{item_value}", API_RETURN: { 200: ["values", None], 404: JIRA_SERVICE_DESK_ID_404 }, PAGINATION: JIRA_SERVICE_DESK_PAGINATION }, "servicedesk/customer": { API: JIRA_SERVICE_DESK_URL, API_RESOURCE: "servicedesk/{item_value}/customer", API_RETURN: { 200: "values", 404: JIRA_SERVICE_DESK_ID_404 }, PAGINATION: JIRA_SERVICE_DESK_PAGINATION }, "servicedesk/organization": { API: JIRA_SERVICE_DESK_URL, API_RESOURCE: "servicedesk/{item_value}/organization", API_RETURN: { 200: "values", 404: JIRA_SERVICE_DESK_ID_404 }, PAGINATION: JIRA_SERVICE_DESK_PAGINATION }, "servicedesk/queue": { API: JIRA_SERVICE_DESK_URL, API_RESOURCE: "servicedesk/{item_value}/queue", API_RETURN: { 200: "values", 404: JIRA_SERVICE_DESK_ID_404 }, PAGINATION: JIRA_SERVICE_DESK_PAGINATION }, "servicedesk/queue/issue": { API: JIRA_SERVICE_DESK_URL, API_RESOURCE: "servicedesk/{item_value}/queue/{queue_id}/issue", API_RETURN: { 200: "values", 404: "Service Desk ID {item_value} or queue ID {queue_id} do not exist" }, PAGINATION: JIRA_SERVICE_DESK_PAGINATION }, "board": { API: JIRA_SOFTWARE_URL, API_RESOURCE: "board", API_RETURN: { 200: "values", 404: JIRA_BOARD_ID_404 } }, "board/backlog": { API: JIRA_SOFTWARE_URL, API_RESOURCE: "board/{item_value}/backlog", API_RETURN: { 200: "issues", 404: JIRA_BOARD_ID_404 } }, "board/epic": { API: JIRA_SOFTWARE_URL, API_RESOURCE: "board/{item_value}/epic", API_RETURN: { 200: "values", 404: JIRA_BOARD_ID_404 } }, "board/epic/none/issue": { API: JIRA_SOFTWARE_URL, API_RESOURCE: "board/{item_value}/epic/none/issue", API_RETURN: { 200: "issues", 404: JIRA_BOARD_ID_404 } }, "board/issue": { API: JIRA_SOFTWARE_URL, API_RESOURCE: "board/{item_value}/issue", API_RETURN: { 200: "issues", 404: JIRA_BOARD_ID_404 } }, "board/project": { API: JIRA_SOFTWARE_URL, API_RESOURCE: "board/{item_value}/project", API_RETURN: { 200: "values" } }, "board/project/full": { API: JIRA_SOFTWARE_URL, API_RESOURCE: "board/{item_value}/project/full", API_RETURN: { 200: "values", 403: JIRA_LICENSE_403 } }, "board/sprint": { API: JIRA_SOFTWARE_URL, API_RESOURCE: "board/{item_value}/sprint", API_RETURN: { 200: "values", 403: JIRA_LICENSE_403 } }, "board/version": { API: JIRA_SOFTWARE_URL, API_RESOURCE: "board/{item_value}/version", API_RETURN: { 200: "values", 403: JIRA_LICENSE_403 } }, "epic/none/issue": { API: JIRA_SOFTWARE_URL, API_RESOURCE: "epic/none/issue", API_RETURN: { 200: "issues" } }, "alerts": { API: JIRA_OPSGENIE_URL, API_RESOURCE: "v2/alerts", API_QUERY_STRING: { "query": ITEM_VALUE }, API_RETURN: { 200: "data", 402: JIRA_OPSGENIE_402 }, COLUMN_FORMATING: { "integration_type": ["integration", "type"], "integration_id": ["integration", "id"], "integration_name": ["integration", "name"] }, COLUMN_CLEANING: ["integration"] }, "incidents": { API: JIRA_OPSGENIE_URL, API_RESOURCE: "v1/incidents", API_QUERY_STRING: { "query": ITEM_VALUE }, API_RETURN: { 200: "data", 402: JIRA_OPSGENIE_402 } }, "users": { API: JIRA_OPSGENIE_URL, API_RESOURCE: "v2/users", API_QUERY_STRING: { "query": ITEM_VALUE }, API_RETURN: { 200: "data", 402: JIRA_OPSGENIE_402 }, COLUMN_FORMATING: { "country": ["userAddress", "country"], "state": ["userAddress", "state"], "line": ["userAddress", "line"], "zip_code": ["userAddress", "zipCode"], "city": ["userAddress", "city"], "role": ["role", "id"] }, COLUMN_CLEANING: ["userAddress"] }, "teams": { API: JIRA_OPSGENIE_URL, API_RESOURCE: "v2/teams", API_QUERY_STRING: { "query": ITEM_VALUE }, API_RETURN: { 200: "data", 402: JIRA_OPSGENIE_402 }, COLUMN_EXPANDING: DEFAULT_COLUMNS_TO_EXPAND.append("links") }, "schedules": { API: JIRA_OPSGENIE_URL, API_RESOURCE: "v2/schedules", API_QUERY_STRING: { "query": ITEM_VALUE }, API_RETURN: { 200: "data", 402: JIRA_OPSGENIE_402 } }, "escalations": { API: JIRA_OPSGENIE_URL, API_RESOURCE: "v2/escalations", API_RETURN: { 200: "data", 402: JIRA_OPSGENIE_402 } }, "services": { API: JIRA_OPSGENIE_URL, API_RESOURCE: "v1/services", API_QUERY_STRING: {"query": ITEM_VALUE}, API_RETURN: { 200: "data", 402: JIRA_OPSGENIE_402 } } } }
api = 'api' api_default_descriptor = 'default' api_error_messages = 'errorMessages' api_query_string = 'query_string' api_resource = 'resource_name' api_return = 'on_return' column_formating = 'column_formating' column_cleaning = 'column_cleaning' column_expanding = 'column_expending' default_columns_to_expand = ['changelog', 'fields', 'renderedFields', 'names', 'schema', 'operations', 'editmeta', 'versionedRepresentations'] endpoints = 'endpoints' item_value = '{item_value}' jira_board_id_404 = 'Board {item_value} does not exists or the user does not have permission to view it.' jira_core_pagination = {'skip_key': 'startAt', 'limit_key': 'maxResults', 'total_key': 'total'} jira_core_url = '{site_url}rest/api/3/{resource_name}' jira_is_last_page = 'isLastPage' jira_license_403 = 'The user does not a have valid license' jira_next = 'next' jira_opsgenie_402 = 'The account cannot do this action because of subscription plan' jira_opsgenie_paging = 'paging' jira_opsgenie_url = 'api.opsgenie.com/{resource_name}' jira_paging = '_links' jira_service_desk_id_404 = 'Service Desk ID {item_value} does not exists' jira_service_desk_pagination = {'next_page_key': ['_links', 'next']} jira_service_desk_url = '{site_url}rest/servicedeskapi/{resource_name}' jira_software_url = '{site_url}rest/agile/1.0/{resource_name}' pagination = 'pagination' endpoint_descriptors = {API_DEFAULT_DESCRIPTOR: {API_RESOURCE: '{endpoint_name}/{item_value}', API: JIRA_CORE_URL, API_RETURN: {200: None, 401: 'The user is not logged in', 403: 'The user does not have permission to complete this request', 404: 'Item {item_value} not found', 500: 'Jira Internal Server Error'}, COLUMN_EXPANDING: DEFAULT_COLUMNS_TO_EXPAND, PAGINATION: JIRA_CORE_PAGINATION}, ENDPOINTS: {'dashboard': {API_RETURN: {200: ['dashboards', None]}}, 'dashboard/search': {API_RETURN: {200: 'values'}}, 'field': {API_RESOURCE: '{endpoint_name}'}, 'group': {API_RESOURCE: '{endpoint_name}/member', API_QUERY_STRING: {'groupname': ITEM_VALUE}, API_RETURN: {200: 'values'}}, 'issue': {API_QUERY_STRING: {'expand': '{expand}'}}, 'issue/createmeta': {API_RESOURCE: '{endpoint_name}', API_RETURN: {200: 'projects'}}, 'issue(Filter)': {API_RESOURCE: 'search', API_QUERY_STRING: {'jql': 'filter={}'.format(ITEM_VALUE), 'expand': '{expand}'}, API_RETURN: {200: 'issues'}}, 'issue(JQL)': {API_RESOURCE: 'search', API_QUERY_STRING: {'jql': ITEM_VALUE, 'expand': '{expand}'}, API_RETURN: {200: 'issues'}}, 'project/components': {API_RESOURCE: 'project/{item_value}/components'}, 'project/search': {API_RESOURCE: '{endpoint_name}', API_QUERY_STRING: {'expand': '{expand}'}, API_RETURN: {200: 'values', 404: 'Item not found'}}, 'project/versions': {API_RESOURCE: 'project/{item_value}/versions', API_QUERY_STRING: {'expand': '{expand}'}}, 'search': {API_RESOURCE: 'search', API_QUERY_STRING: {'jql': ITEM_VALUE, 'expand': '{expand}'}, API_RETURN: {200: 'issues'}}, 'worklog/deleted': {}, 'worklog/list': {API_RESOURCE: 'issue/{item_value}/worklog'}, 'organization': {API: JIRA_SERVICE_DESK_URL, API_RESOURCE: 'organization/{item_value}', API_RETURN: {200: ['values', None], 404: 'Organization ID {item_value} does not exists'}, PAGINATION: JIRA_SERVICE_DESK_PAGINATION}, 'organization/user': {API: JIRA_SERVICE_DESK_URL, API_RESOURCE: 'organization/{item_value}/user', API_RETURN: {200: 'values', 404: 'Organization ID {item_value} does not exists'}, PAGINATION: JIRA_SERVICE_DESK_PAGINATION}, 'request': {API: JIRA_SERVICE_DESK_URL, API_RETURN: {200: ['values', None]}, PAGINATION: JIRA_SERVICE_DESK_PAGINATION}, 'servicedesk': {API: JIRA_SERVICE_DESK_URL, API_RESOURCE: '{endpoint_name}/{item_value}', API_RETURN: {200: ['values', None], 404: JIRA_SERVICE_DESK_ID_404}, PAGINATION: JIRA_SERVICE_DESK_PAGINATION}, 'servicedesk/customer': {API: JIRA_SERVICE_DESK_URL, API_RESOURCE: 'servicedesk/{item_value}/customer', API_RETURN: {200: 'values', 404: JIRA_SERVICE_DESK_ID_404}, PAGINATION: JIRA_SERVICE_DESK_PAGINATION}, 'servicedesk/organization': {API: JIRA_SERVICE_DESK_URL, API_RESOURCE: 'servicedesk/{item_value}/organization', API_RETURN: {200: 'values', 404: JIRA_SERVICE_DESK_ID_404}, PAGINATION: JIRA_SERVICE_DESK_PAGINATION}, 'servicedesk/queue': {API: JIRA_SERVICE_DESK_URL, API_RESOURCE: 'servicedesk/{item_value}/queue', API_RETURN: {200: 'values', 404: JIRA_SERVICE_DESK_ID_404}, PAGINATION: JIRA_SERVICE_DESK_PAGINATION}, 'servicedesk/queue/issue': {API: JIRA_SERVICE_DESK_URL, API_RESOURCE: 'servicedesk/{item_value}/queue/{queue_id}/issue', API_RETURN: {200: 'values', 404: 'Service Desk ID {item_value} or queue ID {queue_id} do not exist'}, PAGINATION: JIRA_SERVICE_DESK_PAGINATION}, 'board': {API: JIRA_SOFTWARE_URL, API_RESOURCE: 'board', API_RETURN: {200: 'values', 404: JIRA_BOARD_ID_404}}, 'board/backlog': {API: JIRA_SOFTWARE_URL, API_RESOURCE: 'board/{item_value}/backlog', API_RETURN: {200: 'issues', 404: JIRA_BOARD_ID_404}}, 'board/epic': {API: JIRA_SOFTWARE_URL, API_RESOURCE: 'board/{item_value}/epic', API_RETURN: {200: 'values', 404: JIRA_BOARD_ID_404}}, 'board/epic/none/issue': {API: JIRA_SOFTWARE_URL, API_RESOURCE: 'board/{item_value}/epic/none/issue', API_RETURN: {200: 'issues', 404: JIRA_BOARD_ID_404}}, 'board/issue': {API: JIRA_SOFTWARE_URL, API_RESOURCE: 'board/{item_value}/issue', API_RETURN: {200: 'issues', 404: JIRA_BOARD_ID_404}}, 'board/project': {API: JIRA_SOFTWARE_URL, API_RESOURCE: 'board/{item_value}/project', API_RETURN: {200: 'values'}}, 'board/project/full': {API: JIRA_SOFTWARE_URL, API_RESOURCE: 'board/{item_value}/project/full', API_RETURN: {200: 'values', 403: JIRA_LICENSE_403}}, 'board/sprint': {API: JIRA_SOFTWARE_URL, API_RESOURCE: 'board/{item_value}/sprint', API_RETURN: {200: 'values', 403: JIRA_LICENSE_403}}, 'board/version': {API: JIRA_SOFTWARE_URL, API_RESOURCE: 'board/{item_value}/version', API_RETURN: {200: 'values', 403: JIRA_LICENSE_403}}, 'epic/none/issue': {API: JIRA_SOFTWARE_URL, API_RESOURCE: 'epic/none/issue', API_RETURN: {200: 'issues'}}, 'alerts': {API: JIRA_OPSGENIE_URL, API_RESOURCE: 'v2/alerts', API_QUERY_STRING: {'query': ITEM_VALUE}, API_RETURN: {200: 'data', 402: JIRA_OPSGENIE_402}, COLUMN_FORMATING: {'integration_type': ['integration', 'type'], 'integration_id': ['integration', 'id'], 'integration_name': ['integration', 'name']}, COLUMN_CLEANING: ['integration']}, 'incidents': {API: JIRA_OPSGENIE_URL, API_RESOURCE: 'v1/incidents', API_QUERY_STRING: {'query': ITEM_VALUE}, API_RETURN: {200: 'data', 402: JIRA_OPSGENIE_402}}, 'users': {API: JIRA_OPSGENIE_URL, API_RESOURCE: 'v2/users', API_QUERY_STRING: {'query': ITEM_VALUE}, API_RETURN: {200: 'data', 402: JIRA_OPSGENIE_402}, COLUMN_FORMATING: {'country': ['userAddress', 'country'], 'state': ['userAddress', 'state'], 'line': ['userAddress', 'line'], 'zip_code': ['userAddress', 'zipCode'], 'city': ['userAddress', 'city'], 'role': ['role', 'id']}, COLUMN_CLEANING: ['userAddress']}, 'teams': {API: JIRA_OPSGENIE_URL, API_RESOURCE: 'v2/teams', API_QUERY_STRING: {'query': ITEM_VALUE}, API_RETURN: {200: 'data', 402: JIRA_OPSGENIE_402}, COLUMN_EXPANDING: DEFAULT_COLUMNS_TO_EXPAND.append('links')}, 'schedules': {API: JIRA_OPSGENIE_URL, API_RESOURCE: 'v2/schedules', API_QUERY_STRING: {'query': ITEM_VALUE}, API_RETURN: {200: 'data', 402: JIRA_OPSGENIE_402}}, 'escalations': {API: JIRA_OPSGENIE_URL, API_RESOURCE: 'v2/escalations', API_RETURN: {200: 'data', 402: JIRA_OPSGENIE_402}}, 'services': {API: JIRA_OPSGENIE_URL, API_RESOURCE: 'v1/services', API_QUERY_STRING: {'query': ITEM_VALUE}, API_RETURN: {200: 'data', 402: JIRA_OPSGENIE_402}}}}
region = 'us-west-2' default_vpc = dict( enable_dns_hostnames=True, cidr_block='10.0.0.0/16', tags={'Name': 'default'}, ) default_gateway = dict(vpc_id='${aws_vpc.default.id}') internet_access_route = dict( route_table_id='${aws_vpc.default.main_route_table_id}', destination_cidr_block='0.0.0.0/0', gateway_id='${aws_internet_gateway.default.id}' ) config = dict( provider=dict( aws=dict(region=region) ), resource=dict( aws_vpc=dict(default=default_vpc), aws_internet_gateway=dict(default=default_gateway), aws_route=dict(internet_access=internet_access_route), ) )
region = 'us-west-2' default_vpc = dict(enable_dns_hostnames=True, cidr_block='10.0.0.0/16', tags={'Name': 'default'}) default_gateway = dict(vpc_id='${aws_vpc.default.id}') internet_access_route = dict(route_table_id='${aws_vpc.default.main_route_table_id}', destination_cidr_block='0.0.0.0/0', gateway_id='${aws_internet_gateway.default.id}') config = dict(provider=dict(aws=dict(region=region)), resource=dict(aws_vpc=dict(default=default_vpc), aws_internet_gateway=dict(default=default_gateway), aws_route=dict(internet_access=internet_access_route)))
class BlackjackWinner: def winnings(self, bet, dealer, dealerBlackjack, player, blackjack): if player > 21 or (player < dealer and dealer <= 21): return -bet if dealerBlackjack and blackjack: return 0 if dealerBlackjack and not blackjack: return -bet if not dealerBlackjack and blackjack: return 1.5 * bet if dealer > 21 or player > dealer: return bet return 0
class Blackjackwinner: def winnings(self, bet, dealer, dealerBlackjack, player, blackjack): if player > 21 or (player < dealer and dealer <= 21): return -bet if dealerBlackjack and blackjack: return 0 if dealerBlackjack and (not blackjack): return -bet if not dealerBlackjack and blackjack: return 1.5 * bet if dealer > 21 or player > dealer: return bet return 0
# -------------------------------------- #! /usr/bin/python # File: 977. Squared of a Sorted Array.py # Author: Kimberly Gao # My solution: (Run time: 132ms) (from website) # Memory Usage: 15.6 MB class Solution: def _init_(self,name): self.name = name # Only for python. Using function sort() # Will overwritting the inputs def sortedSquares1(self, nums): for i in range(nums): nums[i] *= nums[i] nums.sort() return nums # Making a new array, not in place, O(n) auxiliary space def sortedSquares2(self, nums): return sorted([v**2 for v in nums]) # Making a new array, not in place, O(1) auxiliary space def sortedSquares3(self, nums): newlist = [v**2 for v in nums] newlist.sort() # This is in place! return newlist # Two pointers: def sortedSquares4(self, nums): # list comprehension: return a list with all None elements (its length=length of nums): # result = [None for _ in nums] result = [None] * len(nums) # 10x faster than above one left, right = 0, len(nums) - 1 for index in range(len(nums)-1, -1, -1): if abs(nums[left]) > abs(nums[right]): result[index] = nums[left] ** 2 left += 1 else: result[index] = nums[right] ** 2 right -= 1 return result if __name__ == '__main__': nums = [-4,-1,0,3,10] solution = Solution().sortedSquares4(nums) print(solution)
class Solution: def _init_(self, name): self.name = name def sorted_squares1(self, nums): for i in range(nums): nums[i] *= nums[i] nums.sort() return nums def sorted_squares2(self, nums): return sorted([v ** 2 for v in nums]) def sorted_squares3(self, nums): newlist = [v ** 2 for v in nums] newlist.sort() return newlist def sorted_squares4(self, nums): result = [None] * len(nums) (left, right) = (0, len(nums) - 1) for index in range(len(nums) - 1, -1, -1): if abs(nums[left]) > abs(nums[right]): result[index] = nums[left] ** 2 left += 1 else: result[index] = nums[right] ** 2 right -= 1 return result if __name__ == '__main__': nums = [-4, -1, 0, 3, 10] solution = solution().sortedSquares4(nums) print(solution)
class GameStatus: OPEN = 'OPEN' CLOSED = 'CLOSED' READY = 'READY' IN_PLAY = 'IN_PLAY' ENDED = 'ENDED' class Action: MOVE_UP = 'MOVE_UP' MOVE_LEFT = 'MOVE_LEFT' MOVE_DOWN = 'MOVE_DOWN' MOVE_RIGHT = 'MOVE_RIGHT' ATTACK_UP = 'ATTACK_UP' ATTACK_LEFT = 'ATTACK_LEFT' ATTACK_DOWN = 'ATTACK_DOWN' ATTACK_RIGHT = 'ATTACK_RIGHT' TRANSFORM_NORMAL = 'TRANSFORM_NORMAL' TRANSFORM_FIRE = 'TRANSFORM_FIRE' TRANSFORM_WATER = 'TRANSFORM_WATER' TRANSFORM_GRASS = 'TRANSFORM_GRASS' class ActionType: MOVE = 'MOVE' COLLECT = 'COLLECT' TRANSFORM = 'TRANSFORM' ATTACK = 'ATTACK' RESTORE_HP = 'RESTORE_HP' WAIT = 'WAIT' class TileType: NORMAL = 'NORMAL' FIRE = 'FIRE' WATER = 'WATER' GRASS = 'GRASS' class ItemType: OBSTACLE = 'OBSTACLE' FIRE = 'FIRE' WATER = 'WATER' GRASS = 'GRASS' class Morph: NEUTRAL = 'NEUTRAL' FIRE = 'FIRE' WATER = 'WATER' GRASS = 'GRASS'
class Gamestatus: open = 'OPEN' closed = 'CLOSED' ready = 'READY' in_play = 'IN_PLAY' ended = 'ENDED' class Action: move_up = 'MOVE_UP' move_left = 'MOVE_LEFT' move_down = 'MOVE_DOWN' move_right = 'MOVE_RIGHT' attack_up = 'ATTACK_UP' attack_left = 'ATTACK_LEFT' attack_down = 'ATTACK_DOWN' attack_right = 'ATTACK_RIGHT' transform_normal = 'TRANSFORM_NORMAL' transform_fire = 'TRANSFORM_FIRE' transform_water = 'TRANSFORM_WATER' transform_grass = 'TRANSFORM_GRASS' class Actiontype: move = 'MOVE' collect = 'COLLECT' transform = 'TRANSFORM' attack = 'ATTACK' restore_hp = 'RESTORE_HP' wait = 'WAIT' class Tiletype: normal = 'NORMAL' fire = 'FIRE' water = 'WATER' grass = 'GRASS' class Itemtype: obstacle = 'OBSTACLE' fire = 'FIRE' water = 'WATER' grass = 'GRASS' class Morph: neutral = 'NEUTRAL' fire = 'FIRE' water = 'WATER' grass = 'GRASS'