content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class SmokeTestFail(Exception): pass class SmokeTestRegistry(object): def __init__(self): self.tests = {} def register(self, sequence, name): def decorator(fn): self.tests[name] = { 'sequence': sequence, 'test': fn } return fn return decorator def __iter__(self): seq = lambda key: self.tests[key]['sequence'] for name in sorted(self.tests, key=seq): yield name, self.tests[name]['test'] def execute(self): for name, test in iter(self): status = True message = '' try: test() except SmokeTestFail as fail: status = False message = str(fail) yield { 'name': name, 'status': status, 'message': message } smoketests = SmokeTestRegistry()
class Smoketestfail(Exception): pass class Smoketestregistry(object): def __init__(self): self.tests = {} def register(self, sequence, name): def decorator(fn): self.tests[name] = {'sequence': sequence, 'test': fn} return fn return decorator def __iter__(self): seq = lambda key: self.tests[key]['sequence'] for name in sorted(self.tests, key=seq): yield (name, self.tests[name]['test']) def execute(self): for (name, test) in iter(self): status = True message = '' try: test() except SmokeTestFail as fail: status = False message = str(fail) yield {'name': name, 'status': status, 'message': message} smoketests = smoke_test_registry()
# Stores JSON schema version, incrementing major/minor number = incompatible CDOT_JSON_VERSION_KEY = "cdot_version" # Keys used in dictionary (serialized to JSON) CONTIG = "contig" CHROM = "chrom" START = "start" END = "stop" STRAND = "strand" BEST_REGION_TYPE_ORDER = ["coding", "5PUTR", "3PUTR", "non coding", "intron"]
cdot_json_version_key = 'cdot_version' contig = 'contig' chrom = 'chrom' start = 'start' end = 'stop' strand = 'strand' best_region_type_order = ['coding', '5PUTR', '3PUTR', 'non coding', 'intron']
def int_from_rgb(r, g, b): return (r << 16) + (g << 8) + b def rgb_from_int(color): return ((color >> 16) & 255), ((color >> 8) & 255), (color & 255)
def int_from_rgb(r, g, b): return (r << 16) + (g << 8) + b def rgb_from_int(color): return (color >> 16 & 255, color >> 8 & 255, color & 255)
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Misc.py: Just a sample file with a function. This material is part of this post: http://raccoon.ninja/pt/dev-pt/python-importando-todos-os-arquivos-de-um-diretorio/ """ def hey_ho(): return "Let's go!"
""" Misc.py: Just a sample file with a function. This material is part of this post: http://raccoon.ninja/pt/dev-pt/python-importando-todos-os-arquivos-de-um-diretorio/ """ def hey_ho(): return "Let's go!"
# Runtime: 68 ms, faster than 87.39% of Python3 online submissions for Design Circular Queue. # Memory Usage: 14.5 MB, less than 5.26% of Python3 online submissions for Design Circular Queue. class MyCircularQueue: class Node: def __init__(self, val, prev=None, next=None): self.val = val self.prev = prev self.next = next def __init__(self, k: int): """ Initialize your data structure here. Set the size of the queue to be k. """ self.capacity = k self.count = 0 self.front = self.Node(-1) self.rear = self.Node(-1) self.front.next = self.rear self.rear.prev = self.front def enQueue(self, value: int) -> bool: """ Insert an element into the circular queue. Return true if the operation is successful. """ if self.capacity == self.count: return False self.count += 1 node = self.Node(value) self.rear.prev.next = node node.prev = self.rear.prev node.next = self.rear self.rear.prev = node return True def deQueue(self) -> bool: """ Delete an element from the circular queue. Return true if the operation is successful. """ if self.count == 0: return False self.count -= 1 node = self.front.next self.front.next = node.next node.next.prev = self.front del node return True def Front(self) -> int: """ Get the front item from the queue. """ if self.count == 0: return -1 return self.front.next.val def Rear(self) -> int: """ Get the last item from the queue. """ if self.count == 0: return -1 return self.rear.prev.val def isEmpty(self) -> bool: """ Checks whether the circular queue is empty or not. """ return True if self.count == 0 else False def isFull(self) -> bool: """ Checks whether the circular queue is full or not. """ return True if self.count == self.capacity else False # Your MyCircularQueue object will be instantiated and called as such: # obj = MyCircularQueue(k) # param_1 = obj.enQueue(value) # param_2 = obj.deQueue() # param_3 = obj.Front() # param_4 = obj.Rear() # param_5 = obj.isEmpty() # param_6 = obj.isFull()
class Mycircularqueue: class Node: def __init__(self, val, prev=None, next=None): self.val = val self.prev = prev self.next = next def __init__(self, k: int): """ Initialize your data structure here. Set the size of the queue to be k. """ self.capacity = k self.count = 0 self.front = self.Node(-1) self.rear = self.Node(-1) self.front.next = self.rear self.rear.prev = self.front def en_queue(self, value: int) -> bool: """ Insert an element into the circular queue. Return true if the operation is successful. """ if self.capacity == self.count: return False self.count += 1 node = self.Node(value) self.rear.prev.next = node node.prev = self.rear.prev node.next = self.rear self.rear.prev = node return True def de_queue(self) -> bool: """ Delete an element from the circular queue. Return true if the operation is successful. """ if self.count == 0: return False self.count -= 1 node = self.front.next self.front.next = node.next node.next.prev = self.front del node return True def front(self) -> int: """ Get the front item from the queue. """ if self.count == 0: return -1 return self.front.next.val def rear(self) -> int: """ Get the last item from the queue. """ if self.count == 0: return -1 return self.rear.prev.val def is_empty(self) -> bool: """ Checks whether the circular queue is empty or not. """ return True if self.count == 0 else False def is_full(self) -> bool: """ Checks whether the circular queue is full or not. """ return True if self.count == self.capacity else False
questions = ['''A 2m long stick, when it is at rest, moves past an observer on the ground with a speed of 0.5c. (a) What is the length measured by the observer ? (b) If the same stick moves with the velocity of 0.05c what would be its length measured by the observer ''',''' A small lantern of mass 100 gm is hanged from the pole of a bullock cart using a massless string. What is the tension in the string, (Assume that cart moves smoothly). (a) when the bullock cart is at rest, (b) moves with uniform velocity of 3 m/s (c) moves with an acceleration of 2 m/s2 ''',''' X-ray of wavelength 0.5Ao are scattered by the electron in a block of carbon through 90o . (i) Find the wavelength of scattered Photon (ii) the maximum wavelength present in scattered radiation and (iii) the maximum kinetic energy of recoil electron.''','''According to the India Meteorological Department (IMD), fairly widespread to widespread rains with isolated heavy falls are very likely to continue over Northeast India until Tuesday, August 24. Thereafter, the intensity of the rainfall is set to increase, with isolated very heavy falls expected to lash Arunachal Pradesh, Assam and Meghalaya between Tuesday to Friday, August 24-27. Furthermore, isolated extremely heavy falls may also bombard Assam and Meghalaya on Wednesday, August 25. ''','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'] answers = ["","answer 2","","asnwer 4"] time_of_exam = "23:15:00" student_name = "Ishaan Dwivedi" en_no = "191b130" number_of_questions=len(questions) max_col = 10 max_row = number_of_questions // max_col if (number_of_questions % max_col) > 0 : max_row = max_row + 1 list_of_done = [1,3] revisit= [4] current_question = 0 # timer data month = 'Aug' day = '28' year = '2021' time = '20:40:00'
questions = ['A 2m long stick, when it is at rest, moves past an observer on the ground with a speed of 0.5c.\n(a) What is the length measured by the observer ?\n(b) If the same stick moves with the velocity of 0.05c what would be its length measured by the observer ', ' A small lantern of mass 100 gm is hanged from the pole of a bullock cart using a massless string. What is the tension in the string, (Assume that cart moves smoothly).\n\n(a) when the bullock cart is at rest,\n(b) moves with uniform velocity of 3 m/s\n(c) moves with an acceleration of 2 m/s2 ', ' X-ray of wavelength 0.5Ao are scattered by the electron in a block of carbon through 90o . (i) Find the wavelength of scattered Photon (ii) the maximum wavelength present in scattered radiation and (iii) the maximum kinetic energy of recoil electron.', 'According to the India Meteorological Department (IMD), fairly widespread to widespread rains with isolated heavy falls are very likely to continue over Northeast India until Tuesday, August 24.\n\nThereafter, the intensity of the rainfall is set to increase, with isolated very heavy falls expected to lash Arunachal Pradesh, Assam and Meghalaya between Tuesday to Friday, August 24-27.\n\nFurthermore, isolated extremely heavy falls may also bombard Assam and Meghalaya on Wednesday, August 25.\n\n', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1'] answers = ['', 'answer 2', '', 'asnwer 4'] time_of_exam = '23:15:00' student_name = 'Ishaan Dwivedi' en_no = '191b130' number_of_questions = len(questions) max_col = 10 max_row = number_of_questions // max_col if number_of_questions % max_col > 0: max_row = max_row + 1 list_of_done = [1, 3] revisit = [4] current_question = 0 month = 'Aug' day = '28' year = '2021' time = '20:40:00'
# Copyright 2014-2017 Insight Software Consortium. # Copyright 2004-2009 Roman Yakovenko. # Distributed under the Boost Software License, Version 1.0. # See http://www.boost.org/LICENSE_1_0.txt class byte_info(object): """ This class stores information about the byte size and byte align values from a declaration/type. """ def __init__(self): self._byte_size = 0 self._byte_align = 0 @property def byte_size(self): """ Size of this declaration/type in bytes Returns: int: Size of this declaration/type in bytes """ return self._byte_size @byte_size.setter def byte_size(self, new_byte_size): """ Set size of this declaration/type in bytes Args: new_byte_size (int): Size of this declaration/type in bytes """ self._byte_size = new_byte_size @property def byte_align(self): """ Alignment of this declaration/type in bytes Returns: int: Alignment of this declaration/type in bytes """ return self._byte_align @byte_align.setter def byte_align(self, new_byte_align): """ Set size of alignment of this declaration/type in bytes Args: new_byte_align (int): Alignment of this declaration/type in bytes """ self._byte_align = new_byte_align
class Byte_Info(object): """ This class stores information about the byte size and byte align values from a declaration/type. """ def __init__(self): self._byte_size = 0 self._byte_align = 0 @property def byte_size(self): """ Size of this declaration/type in bytes Returns: int: Size of this declaration/type in bytes """ return self._byte_size @byte_size.setter def byte_size(self, new_byte_size): """ Set size of this declaration/type in bytes Args: new_byte_size (int): Size of this declaration/type in bytes """ self._byte_size = new_byte_size @property def byte_align(self): """ Alignment of this declaration/type in bytes Returns: int: Alignment of this declaration/type in bytes """ return self._byte_align @byte_align.setter def byte_align(self, new_byte_align): """ Set size of alignment of this declaration/type in bytes Args: new_byte_align (int): Alignment of this declaration/type in bytes """ self._byte_align = new_byte_align
pkg_dnf = {} actions = { 'dnf_makecache': { 'command': 'dnf makecache', 'triggered': True, }, } files = { '/etc/dnf/dnf.conf': { 'source': 'dnf.conf', 'mode': '0644', }, } if node.metadata.get('dnf', {}).get('auto_downloads', False): pkg_dnf['yum-cron'] = {} svc_systemd = { 'yum-cron': { 'needs': ['pkg_dnf:yum-cron'], }, } files['/etc/yum/yum-cron.conf'] = { 'source': 'yum-cron.conf', 'mode': '0644', 'content_type': 'mako', 'needs': ['pkg_dnf:yum-cron'], } files['/etc/yum/yum-cron-hourly.conf'] = { 'source': 'yum-cron-hourly.conf', 'mode': '0644', 'content_type': 'mako', 'needs': ['pkg_dnf:yum-cron'], } for package in node.metadata.get('dnf', {}).get('extra_packages', {}): pkg_dnf['{}'.format(package)] = {} for package in node.metadata.get('dnf', {}).get('remove_extra_packages', {}): pkg_dnf['{}'.format(package)] = { 'installed': False, } for repo_id, repo in sorted(node.metadata.get('dnf', {}).get('repositories', {}).items()): files['/etc/yum.repos.d/{}.repo'.format(repo_id)] = { 'content_type': 'mako', 'source': 'repo_template', 'mode': '0644', 'context': { 'repo_items': repo, 'repo_id': repo_id, }, 'triggers': ['action:dnf_makecache'], }
pkg_dnf = {} actions = {'dnf_makecache': {'command': 'dnf makecache', 'triggered': True}} files = {'/etc/dnf/dnf.conf': {'source': 'dnf.conf', 'mode': '0644'}} if node.metadata.get('dnf', {}).get('auto_downloads', False): pkg_dnf['yum-cron'] = {} svc_systemd = {'yum-cron': {'needs': ['pkg_dnf:yum-cron']}} files['/etc/yum/yum-cron.conf'] = {'source': 'yum-cron.conf', 'mode': '0644', 'content_type': 'mako', 'needs': ['pkg_dnf:yum-cron']} files['/etc/yum/yum-cron-hourly.conf'] = {'source': 'yum-cron-hourly.conf', 'mode': '0644', 'content_type': 'mako', 'needs': ['pkg_dnf:yum-cron']} for package in node.metadata.get('dnf', {}).get('extra_packages', {}): pkg_dnf['{}'.format(package)] = {} for package in node.metadata.get('dnf', {}).get('remove_extra_packages', {}): pkg_dnf['{}'.format(package)] = {'installed': False} for (repo_id, repo) in sorted(node.metadata.get('dnf', {}).get('repositories', {}).items()): files['/etc/yum.repos.d/{}.repo'.format(repo_id)] = {'content_type': 'mako', 'source': 'repo_template', 'mode': '0644', 'context': {'repo_items': repo, 'repo_id': repo_id}, 'triggers': ['action:dnf_makecache']}
#https://stackabuse.com/parallel-processing-in-python/ def load_deck(deck_loc): deck_list = open('vintage_cube.txt', 'r') deck = Queue() for card in deck_list: deck.put(card) deck_list.close() return deck
def load_deck(deck_loc): deck_list = open('vintage_cube.txt', 'r') deck = queue() for card in deck_list: deck.put(card) deck_list.close() return deck
n=[int(x) for x in input("Enter the numbers with space: ").split()] x=[ ] s=0 for i in range(len(n)): for j in range(i+1,len(n)): x.append((n[i],n[j])) for i in range(int(len(x))): a = min(x[i])+min(x[len(x)-i-1]) if(a>s): s=a print("OUTPUT: ",s)
n = [int(x) for x in input('Enter the numbers with space: ').split()] x = [] s = 0 for i in range(len(n)): for j in range(i + 1, len(n)): x.append((n[i], n[j])) for i in range(int(len(x))): a = min(x[i]) + min(x[len(x) - i - 1]) if a > s: s = a print('OUTPUT: ', s)
class Params (): def __init__(self): print('HotpotQA') self.name = "HotpotQA" ################################ # dataset ################################ data_path = '' DATA_TRAIN = 'train.pkl' DATA_DEV = 'dev.pkl' DATA_TEST = 'dev.pkl' DATA_DEBUG = 'debug.pkl' DIC = 'vocab-elmo.txt' ELMO_TOKEN = 'ELMO_token_embeddings.hdf5' ELMO_OPTIONS = 'ELMO_options.json' ELMO_WEIGHTS = 'ELMO_weights.hdf5' ################################ # training ################################ batch_size = 128 lr = 0.001 dr = 1.0 dr_rnn = 1.0 hop = 1 num_train_steps = 10000 is_save = 0 graph_prefix = "default" pre_model = "default" EMBEDDING_TRAIN = True # True == (fine-tuning) CAL_ACCURACY_FROM = 0 # run iteration without excuting validation MAX_EARLY_STOP_COUNT = 4 EPOCH_PER_VALID_FREQ = 0.2 QUICK_SAVE_THRESHOLD = 0.70 ################################ # model ################################ # train wordQ/wordS/Sent max 108/394/144 avg 17.9/22.3/40.9 std 9.5/10.9/11.2 # dev wordQ/wordS/Sent max 46/318/147 avg 15.8/22.4/41.3 std 5.5/10.9/11.2 MAX_LENGTH_Q = 66 # 110 MAX_LENGTH_S = 76 # 250 MAX_SENTENCES= 95 # 150 PAD_INDEX = 0 DIM_WORD_EMBEDDING = 1024 DIM_SENTENCE_EMBEDDING = 1024 IS_RNN_EMBEDDING = True USE_PRE_NODE_INFO = True PRJ_MLP = False USE_CHAR_ELMO = False LOSS_ATTN_RATIO = 1e+0 L2_LOSS_RATIO = 2e-4 ################################ # topology ################################ EDGE_PASSAGE_PASSAGE = True EDGE_SENTENCE_QUESTION = True EDGE_SELF = True EDGE_WITHIN_PASSAGE = 1 # 0: neighbor, 1:fully-connected ################################ # MEASRE ################################ USE_WANG_MAP = True # calculate MAP from wang's implementation ################################ # ETC ################################ IS_DEBUG = False # load sample data for debugging IS_SAVE_RESULTS_TO_FILE = False class Params_small (Params): def __init__(self): print('HotpotQA_small') self.name = "HotpotQA_small" ################################ # model ################################ # train wordQ/wordS/Sent max 108/394/144 avg 17.9/22.3/40.9 std 9.5/10.9/11.2 # dev wordQ/wordS/Sent max 46/318/147 avg 15.8/22.4/41.3 std 5.5/10.9/11.2 MAX_LENGTH_Q = 66 # 110 MAX_LENGTH_S = 76 # 250 MAX_SENTENCES= 95 # 150 PAD_INDEX = 0 DIM_WORD_EMBEDDING = 256 DIM_SENTENCE_EMBEDDING = 512 IS_RNN_EMBEDDING = True USE_PRE_NODE_INFO = True PRJ_MLP = False USE_CHAR_ELMO = False LOSS_ATTN_RATIO = 1e+0 L2_LOSS_RATIO = 2e-4 ################################ # topology ################################ EDGE_PASSAGE_PASSAGE = True EDGE_SENTENCE_QUESTION = True EDGE_SELF = True EDGE_WITHIN_PASSAGE = 1 # 0: neighbor, 1:fully-connected ################################ # ETC ################################ IS_DEBUG = False # load sample data for debugging IS_SAVE_RESULTS_TO_FILE = False
class Params: def __init__(self): print('HotpotQA') self.name = 'HotpotQA' data_path = '' data_train = 'train.pkl' data_dev = 'dev.pkl' data_test = 'dev.pkl' data_debug = 'debug.pkl' dic = 'vocab-elmo.txt' elmo_token = 'ELMO_token_embeddings.hdf5' elmo_options = 'ELMO_options.json' elmo_weights = 'ELMO_weights.hdf5' batch_size = 128 lr = 0.001 dr = 1.0 dr_rnn = 1.0 hop = 1 num_train_steps = 10000 is_save = 0 graph_prefix = 'default' pre_model = 'default' embedding_train = True cal_accuracy_from = 0 max_early_stop_count = 4 epoch_per_valid_freq = 0.2 quick_save_threshold = 0.7 max_length_q = 66 max_length_s = 76 max_sentences = 95 pad_index = 0 dim_word_embedding = 1024 dim_sentence_embedding = 1024 is_rnn_embedding = True use_pre_node_info = True prj_mlp = False use_char_elmo = False loss_attn_ratio = 1.0 l2_loss_ratio = 0.0002 edge_passage_passage = True edge_sentence_question = True edge_self = True edge_within_passage = 1 use_wang_map = True is_debug = False is_save_results_to_file = False class Params_Small(Params): def __init__(self): print('HotpotQA_small') self.name = 'HotpotQA_small' max_length_q = 66 max_length_s = 76 max_sentences = 95 pad_index = 0 dim_word_embedding = 256 dim_sentence_embedding = 512 is_rnn_embedding = True use_pre_node_info = True prj_mlp = False use_char_elmo = False loss_attn_ratio = 1.0 l2_loss_ratio = 0.0002 edge_passage_passage = True edge_sentence_question = True edge_self = True edge_within_passage = 1 is_debug = False is_save_results_to_file = False
""" Call ECMWF eccodes tools for manipulate grib files. https://software.ecmwf.int/wiki/display/ECC/GRIB+tools """ __author__ = "The R & D Center for Weather Forecasting Technology in NMC, CMA" __version__ = '0.1.0'
""" Call ECMWF eccodes tools for manipulate grib files. https://software.ecmwf.int/wiki/display/ECC/GRIB+tools """ __author__ = 'The R & D Center for Weather Forecasting Technology in NMC, CMA' __version__ = '0.1.0'
METHOD = "twoSum" TESTCASES = [ ([2,7,11,15],9), ([-1,-2,-3,-4,-5],-8) ] class Solution: def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ mem = {} for i in range(len(nums)): x = nums[i] y = target - x if y in mem: return [i,mem[y]] mem[x] = i
method = 'twoSum' testcases = [([2, 7, 11, 15], 9), ([-1, -2, -3, -4, -5], -8)] class Solution: def two_sum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ mem = {} for i in range(len(nums)): x = nums[i] y = target - x if y in mem: return [i, mem[y]] mem[x] = i
pkgname = "duktape" pkgver = "2.7.0" pkgrel = 0 build_style = "makefile" make_cmd = "gmake" make_build_args = ["-f", "Makefile.sharedlibrary"] make_install_args = ["-f", "Makefile.sharedlibrary", "INSTALL_PREFIX=/usr"] hostmakedepends = ["gmake", "pkgconf"] pkgdesc = "Embeddeable JavaScript engine" maintainer = "q66 <q66@chimera-linux.org>" license = "MIT" url = "https://duktape.org" source = f"https://github.com/svaarala/{pkgname}/releases/download/v{pkgver}/{pkgname}-{pkgver}.tar.xz" sha256 = "90f8d2fa8b5567c6899830ddef2c03f3c27960b11aca222fa17aa7ac613c2890" # no check target options = ["!check"] def post_install(self): self.install_license("LICENSE.txt") @subpackage("duktape-devel") def _devel(self): return self.default_devel()
pkgname = 'duktape' pkgver = '2.7.0' pkgrel = 0 build_style = 'makefile' make_cmd = 'gmake' make_build_args = ['-f', 'Makefile.sharedlibrary'] make_install_args = ['-f', 'Makefile.sharedlibrary', 'INSTALL_PREFIX=/usr'] hostmakedepends = ['gmake', 'pkgconf'] pkgdesc = 'Embeddeable JavaScript engine' maintainer = 'q66 <q66@chimera-linux.org>' license = 'MIT' url = 'https://duktape.org' source = f'https://github.com/svaarala/{pkgname}/releases/download/v{pkgver}/{pkgname}-{pkgver}.tar.xz' sha256 = '90f8d2fa8b5567c6899830ddef2c03f3c27960b11aca222fa17aa7ac613c2890' options = ['!check'] def post_install(self): self.install_license('LICENSE.txt') @subpackage('duktape-devel') def _devel(self): return self.default_devel()
class Solution: def titleToNumber(self, s): """ :type s: str :rtype: int """ n = len(s) power = n-1 result = 0 for i in range(n): value = ord(s[i])-64 result = result + (value * pow(26, power)) power = power - 1 return result
class Solution: def title_to_number(self, s): """ :type s: str :rtype: int """ n = len(s) power = n - 1 result = 0 for i in range(n): value = ord(s[i]) - 64 result = result + value * pow(26, power) power = power - 1 return result
config = { 'row_data_path': './data/rel_data.txt', 'triplet_data_path': './data/triplet_data.txt', 'kg_data_path': './output/kg_data.json', 'template_path': './output/template.xlsx', 'url': "http://localhost:7474", 'user': "neo4j", 'password': "123456" }
config = {'row_data_path': './data/rel_data.txt', 'triplet_data_path': './data/triplet_data.txt', 'kg_data_path': './output/kg_data.json', 'template_path': './output/template.xlsx', 'url': 'http://localhost:7474', 'user': 'neo4j', 'password': '123456'}
class Villager: def __init__(self, number, books): self.number = number self.books = books self.goodTrades = [] def getNumber(self): return self.number def getBooks(self): return self.books def addGoodTrade(self, book): self.goodTrades.append(book) def getGoodTrades(self): return self.goodTrades class Enchantment: def __init__(self, name, maxRank, minCost): self.name = name self.maxRank = maxRank self.minCost = minCost self.currentCost = None self.villagers = [] def reset(self): self.currentCost = None self.villagers = [] def compareCost(self, cost, rank, villager): diff = self.maxRank - rank actualCost = cost*(2**diff) if self.currentCost == None or actualCost < self.currentCost: self.currentCost = actualCost self.updateVillager(villager) elif actualCost == self.currentCost: self.addVillager(villager) elif actualCost > self.currentCost: return -1 def matchCost(self, cost, rank): diff = self.maxRank - rank actualCost = cost*(2**diff) if actualCost == self.currentCost: return 1 else: return 0 def updateCost(self, cost): self.currentCost = cost def updateVillager(self, villager): self.villagers = [] self.villagers.append(villager) def addVillager(self, villager): self.villagers.append(villager) def getName(self): return self.name def getMaxRank(self): return self.maxRank def getMinCost(self): return self.minCost def getCurrentCost(self): return self.currentCost def getVillagers(self): return self.villagers class Book(): def __init__(self, ench, rank, cost): self.ench = ench self.rank = rank self.cost = cost def getEnch(self): return self.ench def getRank(self): return self.rank def getCost(self): return self.cost
class Villager: def __init__(self, number, books): self.number = number self.books = books self.goodTrades = [] def get_number(self): return self.number def get_books(self): return self.books def add_good_trade(self, book): self.goodTrades.append(book) def get_good_trades(self): return self.goodTrades class Enchantment: def __init__(self, name, maxRank, minCost): self.name = name self.maxRank = maxRank self.minCost = minCost self.currentCost = None self.villagers = [] def reset(self): self.currentCost = None self.villagers = [] def compare_cost(self, cost, rank, villager): diff = self.maxRank - rank actual_cost = cost * 2 ** diff if self.currentCost == None or actualCost < self.currentCost: self.currentCost = actualCost self.updateVillager(villager) elif actualCost == self.currentCost: self.addVillager(villager) elif actualCost > self.currentCost: return -1 def match_cost(self, cost, rank): diff = self.maxRank - rank actual_cost = cost * 2 ** diff if actualCost == self.currentCost: return 1 else: return 0 def update_cost(self, cost): self.currentCost = cost def update_villager(self, villager): self.villagers = [] self.villagers.append(villager) def add_villager(self, villager): self.villagers.append(villager) def get_name(self): return self.name def get_max_rank(self): return self.maxRank def get_min_cost(self): return self.minCost def get_current_cost(self): return self.currentCost def get_villagers(self): return self.villagers class Book: def __init__(self, ench, rank, cost): self.ench = ench self.rank = rank self.cost = cost def get_ench(self): return self.ench def get_rank(self): return self.rank def get_cost(self): return self.cost
class Solution: def letterCombinations(self, digits): """ :type digits: str :rtype: List[str] """ if not digits: return [] result = [] self.backtrack(result, '', digits) return result def backtrack(self, result, combination, digits): if not digits: result.append(combination) else: phone = {'2': ['a', 'b', 'c'], '3': ['d', 'e', 'f'], '4': ['g', 'h', 'i'], '5': ['j', 'k', 'l'], '6': ['m', 'n', 'o'], '7': ['p', 'q', 'r', 's'], '8': ['t', 'u', 'v'], '9': ['w', 'x', 'y', 'z']} for letter in phone[digits[0]]: self.backtrack(result, combination + letter, digits[1:]) s = Solution() print(s.letterCombinations('23'))
class Solution: def letter_combinations(self, digits): """ :type digits: str :rtype: List[str] """ if not digits: return [] result = [] self.backtrack(result, '', digits) return result def backtrack(self, result, combination, digits): if not digits: result.append(combination) else: phone = {'2': ['a', 'b', 'c'], '3': ['d', 'e', 'f'], '4': ['g', 'h', 'i'], '5': ['j', 'k', 'l'], '6': ['m', 'n', 'o'], '7': ['p', 'q', 'r', 's'], '8': ['t', 'u', 'v'], '9': ['w', 'x', 'y', 'z']} for letter in phone[digits[0]]: self.backtrack(result, combination + letter, digits[1:]) s = solution() print(s.letterCombinations('23'))
#!/usr/bin/env python3 def lookandsay(n): acc = [(1,n[0])] for c in n[1:]: count, num = acc[-1] if num == c: acc[-1] = (count+1, num) else: acc += [(1, c)] return "".join(["".join((str(x),y)) for (x,y) in acc]) seed = "3113322113" for i in range(50): seed = lookandsay(seed) if i == 39: print("Answer 1:", len(seed)) print("Answer 2:", len(seed))
def lookandsay(n): acc = [(1, n[0])] for c in n[1:]: (count, num) = acc[-1] if num == c: acc[-1] = (count + 1, num) else: acc += [(1, c)] return ''.join([''.join((str(x), y)) for (x, y) in acc]) seed = '3113322113' for i in range(50): seed = lookandsay(seed) if i == 39: print('Answer 1:', len(seed)) print('Answer 2:', len(seed))
class ControllerToWorkerMessage(object): """ Class defines the message sent from the controller to the workers. It takes a task as defined by the user and then sends it. This class assumes that the generated tasks are PICKLEABLE although it does not explicitly check. """ TASK_KEY = "task" SHOULD_EXIT_KEY = "should_exit" @staticmethod def build(terminate_worker, generated_task): """ Creates a message in the format of a Python dictionary. The Python fields are: * should_exit - bool - Indicates whether the worker should terminate. * task - This is :param terminate_worker: True if the slave/worker should be terminated. :type terminate_worker: bool :param generated_task: Tasks generated by the AbstractTask() class. :return: Message to be transmitted :rtype: dict """ message = dict() message[ControllerToWorkerMessage.SHOULD_EXIT_KEY] = terminate_worker message[ControllerToWorkerMessage.TASK_KEY] = generated_task return message @staticmethod def exit_message(): return ControllerToWorkerMessage.build(True, "") @staticmethod def extract_should_exit(msg): """ Extracts whether the worker should terminate. This is extracted from the message transmitted from the master. :param msg: Message transmitted from the master. :type msg: dict :return: True if the worker should exit/terminate. :rtype: bool """ return msg[ControllerToWorkerMessage.SHOULD_EXIT_KEY] @staticmethod def extract_generated_task(msg): """ Extracts the AbstractTask() sent from the controller to a worker. :param msg: Message sent to a worker. :type msg: dict :return: Task generated. """ return msg[ControllerToWorkerMessage.TASK_KEY]
class Controllertoworkermessage(object): """ Class defines the message sent from the controller to the workers. It takes a task as defined by the user and then sends it. This class assumes that the generated tasks are PICKLEABLE although it does not explicitly check. """ task_key = 'task' should_exit_key = 'should_exit' @staticmethod def build(terminate_worker, generated_task): """ Creates a message in the format of a Python dictionary. The Python fields are: * should_exit - bool - Indicates whether the worker should terminate. * task - This is :param terminate_worker: True if the slave/worker should be terminated. :type terminate_worker: bool :param generated_task: Tasks generated by the AbstractTask() class. :return: Message to be transmitted :rtype: dict """ message = dict() message[ControllerToWorkerMessage.SHOULD_EXIT_KEY] = terminate_worker message[ControllerToWorkerMessage.TASK_KEY] = generated_task return message @staticmethod def exit_message(): return ControllerToWorkerMessage.build(True, '') @staticmethod def extract_should_exit(msg): """ Extracts whether the worker should terminate. This is extracted from the message transmitted from the master. :param msg: Message transmitted from the master. :type msg: dict :return: True if the worker should exit/terminate. :rtype: bool """ return msg[ControllerToWorkerMessage.SHOULD_EXIT_KEY] @staticmethod def extract_generated_task(msg): """ Extracts the AbstractTask() sent from the controller to a worker. :param msg: Message sent to a worker. :type msg: dict :return: Task generated. """ return msg[ControllerToWorkerMessage.TASK_KEY]
# encoding: utf-8 """ Package with various simple non-GUI utilities. The modules and objects defined in this package have no dependencies on other parts of madgui and are neither subscribers nor submitters of any events. They should also have little to no dependencies on non-standard 3rd party modules. """
""" Package with various simple non-GUI utilities. The modules and objects defined in this package have no dependencies on other parts of madgui and are neither subscribers nor submitters of any events. They should also have little to no dependencies on non-standard 3rd party modules. """
class RBI: def __init__(self, fmeca): self.fmeca = fmeca self._generate_rbi() def _generate_rbi(self): # TODO: Add rbi logic (from risk_calculator but modified to take a # fmeca argument and loop through each inspection type) if self._total_risk is None: print('Calculating total component risk.') # self.subcomponents_calculated = copy.deepcopy(self.subcomponents) self._total_risk = 0 for subcomponent in self.subcomponents: failures = subcomponent.failures for failure in failures: if failure.inspection_type == inspection_type and not failure.time_dependant: if failure.detectable == 'Lagging': self._total_risk += 0.5 * failure.risk else: self._total_risk += failure.risk return self._total_risk
class Rbi: def __init__(self, fmeca): self.fmeca = fmeca self._generate_rbi() def _generate_rbi(self): if self._total_risk is None: print('Calculating total component risk.') self._total_risk = 0 for subcomponent in self.subcomponents: failures = subcomponent.failures for failure in failures: if failure.inspection_type == inspection_type and (not failure.time_dependant): if failure.detectable == 'Lagging': self._total_risk += 0.5 * failure.risk else: self._total_risk += failure.risk return self._total_risk
def parse(it): result = [] while True: try: tk = next(it) except StopIteration: break if tk == '}': break val = next(it) if val == '{': result.append((tk,parse(it))) else: result.append((tk, val)) return result with open('C:\\scripts\\python27\\coffe_test\\cifar10_quick.prototxt') as f: s = f.read() prototxt_name = re.findall(r'^name:\s+\"(\w+)\"',s) #pprint.pprint(prototxt_name) print(prototxt_name)
def parse(it): result = [] while True: try: tk = next(it) except StopIteration: break if tk == '}': break val = next(it) if val == '{': result.append((tk, parse(it))) else: result.append((tk, val)) return result with open('C:\\scripts\\python27\\coffe_test\\cifar10_quick.prototxt') as f: s = f.read() prototxt_name = re.findall('^name:\\s+\\"(\\w+)\\"', s) print(prototxt_name)
kminicial = float(input('Insira a km inicial: ')) kmatual = float(input('insira a km atual: ')) dias = int(input('Quantos dias ficou alugado? ')) kmpercorrido = kmatual - kminicial rkm = kmpercorrido * 0.15 rdias = dias * 60 total = rkm+rdias print ('O total de km percorrido foi: {}. A quantidade de dias utilizado foi: {}, que resultou no valor de R$: {}'.format(kmpercorrido,dias,total))
kminicial = float(input('Insira a km inicial: ')) kmatual = float(input('insira a km atual: ')) dias = int(input('Quantos dias ficou alugado? ')) kmpercorrido = kmatual - kminicial rkm = kmpercorrido * 0.15 rdias = dias * 60 total = rkm + rdias print('O total de km percorrido foi: {}. A quantidade de dias utilizado foi: {}, que resultou no valor de R$: {}'.format(kmpercorrido, dias, total))
attribute_filter_parameter_schema = [ { 'name': 'search', 'in': 'query', 'required': False, 'description': 'Lucene query syntax string for use with Elasticsearch. ' 'See <a href=https://www.elastic.co/guide/en/elasticsearch/' 'reference/7.10/query-dsl-query-string-query.html#query-string-syntax>reference</a>. ' 'This search string only applies to the relevant objects, not children or ' 'parents. For media, child annotations can be searched with `annotation_search`. ' 'For localizations and states, parent media can be searched with `media_search`.', 'schema': {'type': 'string'}, 'examples': { 'no_search': { 'summary': 'No search', 'value': '', }, 'basic': { 'summary': 'Generic search', 'value': '"My search string"', }, 'user_attribute': { 'summary': 'Search on user-defined attribute', 'value': 'Species:lobster', }, 'builtin_attribute': { 'summary': 'Search built-in attribute', 'value': '_name:*.mp4', }, 'numerical_attribute': { 'summary': 'Search numerical attribute', 'value': '_width:<0.5', }, 'wildcard': { 'summary': 'Wildcard search', 'value': 'Species:*hake', }, 'boolean': { 'summary': 'Boolean search', 'value': '_name:*.mp4 AND Species:*hake', }, }, }, { 'name': 'attribute', 'in': 'query', 'required': False, 'description': 'Attribute equality filter. Format is ' 'attribute1::value1,[attribute2::value2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False, }, { 'name': 'attribute_lt', 'in': 'query', 'required': False, 'description': 'Attribute less than filter. Format is ' 'attribute1::value1,[attribute2::value2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False, }, { 'name': 'attribute_lte', 'in': 'query', 'required': False, 'description': 'Attribute less than or equal filter. Format is ' 'attribute1::value1,[attribute2::value2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False, }, { 'name': 'attribute_gt', 'in': 'query', 'required': False, 'description': 'Attribute greater than filter. Format is ' 'attribute1::value1,[attribute2::value2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False, }, { 'name': 'attribute_gte', 'in': 'query', 'required': False, 'description': 'Attribute greater than or equal filter. Format is ' 'attribute1::value1,[attribute2::value2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False, }, { 'name': 'attribute_contains', 'in': 'query', 'required': False, 'description': 'Attribute contains filter. Format is ' 'attribute1::value1,[attribute2::value2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False, }, { 'name': 'attribute_distance', 'in': 'query', 'required': False, 'description': 'Range filter for geoposition attributes. Format is ' 'attribute1::distance_km2::lat2::lon2,' '[attribute2::distancekm2::lat2::lon2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False, }, { 'name': 'attribute_null', 'in': 'query', 'required': False, 'description': 'Attribute null filter. Returns elements for which ' 'a given attribute is not defined.', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False, }, { 'name': 'start', 'in': 'query', 'required': False, 'description': 'Pagination start index. Index of the first item in a larger list to ' 'return.', 'schema': {'type': 'integer'}, }, { 'name': 'stop', 'in': 'query', 'required': False, 'description': 'Pagination start index. Non-inclusive ndex of the last item in a ' 'larger list to return.', 'schema': {'type': 'integer'}, }, { 'name': 'force_es', 'in': 'query', 'required': False, 'description': 'Set to 1 to require an Elasticsearch based query. This can be used ' 'as a consistency check or for performance comparison.', 'schema': {'type': 'integer', 'enum': [0, 1]}, }, ]
attribute_filter_parameter_schema = [{'name': 'search', 'in': 'query', 'required': False, 'description': 'Lucene query syntax string for use with Elasticsearch. See <a href=https://www.elastic.co/guide/en/elasticsearch/reference/7.10/query-dsl-query-string-query.html#query-string-syntax>reference</a>. This search string only applies to the relevant objects, not children or parents. For media, child annotations can be searched with `annotation_search`. For localizations and states, parent media can be searched with `media_search`.', 'schema': {'type': 'string'}, 'examples': {'no_search': {'summary': 'No search', 'value': ''}, 'basic': {'summary': 'Generic search', 'value': '"My search string"'}, 'user_attribute': {'summary': 'Search on user-defined attribute', 'value': 'Species:lobster'}, 'builtin_attribute': {'summary': 'Search built-in attribute', 'value': '_name:*.mp4'}, 'numerical_attribute': {'summary': 'Search numerical attribute', 'value': '_width:<0.5'}, 'wildcard': {'summary': 'Wildcard search', 'value': 'Species:*hake'}, 'boolean': {'summary': 'Boolean search', 'value': '_name:*.mp4 AND Species:*hake'}}}, {'name': 'attribute', 'in': 'query', 'required': False, 'description': 'Attribute equality filter. Format is attribute1::value1,[attribute2::value2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False}, {'name': 'attribute_lt', 'in': 'query', 'required': False, 'description': 'Attribute less than filter. Format is attribute1::value1,[attribute2::value2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False}, {'name': 'attribute_lte', 'in': 'query', 'required': False, 'description': 'Attribute less than or equal filter. Format is attribute1::value1,[attribute2::value2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False}, {'name': 'attribute_gt', 'in': 'query', 'required': False, 'description': 'Attribute greater than filter. Format is attribute1::value1,[attribute2::value2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False}, {'name': 'attribute_gte', 'in': 'query', 'required': False, 'description': 'Attribute greater than or equal filter. Format is attribute1::value1,[attribute2::value2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False}, {'name': 'attribute_contains', 'in': 'query', 'required': False, 'description': 'Attribute contains filter. Format is attribute1::value1,[attribute2::value2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False}, {'name': 'attribute_distance', 'in': 'query', 'required': False, 'description': 'Range filter for geoposition attributes. Format is attribute1::distance_km2::lat2::lon2,[attribute2::distancekm2::lat2::lon2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False}, {'name': 'attribute_null', 'in': 'query', 'required': False, 'description': 'Attribute null filter. Returns elements for which a given attribute is not defined.', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False}, {'name': 'start', 'in': 'query', 'required': False, 'description': 'Pagination start index. Index of the first item in a larger list to return.', 'schema': {'type': 'integer'}}, {'name': 'stop', 'in': 'query', 'required': False, 'description': 'Pagination start index. Non-inclusive ndex of the last item in a larger list to return.', 'schema': {'type': 'integer'}}, {'name': 'force_es', 'in': 'query', 'required': False, 'description': 'Set to 1 to require an Elasticsearch based query. This can be used as a consistency check or for performance comparison.', 'schema': {'type': 'integer', 'enum': [0, 1]}}]
def get_max_profit(prices, fee, reserve=0, buyable=True): if not prices: return reserve price_offset = -prices[0] - fee if buyable else prices[0] return max( get_max_profit(prices[1:], fee, reserve, buyable), get_max_profit(prices[1:], fee, reserve + price_offset, not buyable) ) # Tests assert get_max_profit([1, 3, 2, 8, 4, 10], 2) == 9 assert get_max_profit([1, 3, 2, 1, 4, 10], 2) == 7
def get_max_profit(prices, fee, reserve=0, buyable=True): if not prices: return reserve price_offset = -prices[0] - fee if buyable else prices[0] return max(get_max_profit(prices[1:], fee, reserve, buyable), get_max_profit(prices[1:], fee, reserve + price_offset, not buyable)) assert get_max_profit([1, 3, 2, 8, 4, 10], 2) == 9 assert get_max_profit([1, 3, 2, 1, 4, 10], 2) == 7
# ============================================================================= # Author: Teerapat Jenrungrot - https://github.com/mjenrungrot/ # FileName: 11056.py # Description: UVa Online Judge - 11056 # ============================================================================= while True: try: N = int(input()) except EOFError: break A = [] # (name, time) for i in range(N): line = input() name, time_str = line.split(" : ") time_token = time_str.split() time = 60 * 1000 * int(time_token[0]) + 1000 * int(time_token[2]) + int(time_token[4]) A.append((name, time)) A.sort(key=lambda x:(x[1], x[0].lower())) n_row = (len(A)+1)//2 for i in range(n_row): start = 2*i end = min(start+2, len(A)) print(f"Row {i+1}") for j in range(start, end): print(A[j][0]) print("") try: input() except EOFError: break
while True: try: n = int(input()) except EOFError: break a = [] for i in range(N): line = input() (name, time_str) = line.split(' : ') time_token = time_str.split() time = 60 * 1000 * int(time_token[0]) + 1000 * int(time_token[2]) + int(time_token[4]) A.append((name, time)) A.sort(key=lambda x: (x[1], x[0].lower())) n_row = (len(A) + 1) // 2 for i in range(n_row): start = 2 * i end = min(start + 2, len(A)) print(f'Row {i + 1}') for j in range(start, end): print(A[j][0]) print('') try: input() except EOFError: break
""" Ex 48 - Create a multiplication table """ # Enter the number t = int(input('Enter the number to be calculated on the multiplication table: ')) print('-=' * 8) # Loop and Calculation for c in range(1, 11): print(f'||{c} x {t:2} =\t{t * c}||') print('-=' * 8) input('Enter to exit')
""" Ex 48 - Create a multiplication table """ t = int(input('Enter the number to be calculated on the multiplication table: ')) print('-=' * 8) for c in range(1, 11): print(f'||{c} x {t:2} =\t{t * c}||') print('-=' * 8) input('Enter to exit')
class ModbusException(Exception): @staticmethod def fromExceptionCode(exception_code: int): if exception_code == 1: return IllegalFunctionError elif exception_code == 2: return IllegalDataAddressError elif exception_code == 3: return IllegalDataValueError elif exception_code == 4: return SlaveDeviceFailureError elif exception_code == 5: return AcknowledgeError elif exception_code == 6: return SlaveDeviceBusyError elif exception_code == 7: return NegativeAcknowledgeError elif exception_code == 8: return MemoryParityError elif exception_code == 10: return GatewayPathUnavailableError elif exception_code == 11: return GatewayTargetDeviceFailedToRespondError else: return Exception(f'Slave reported a unknown error, exception code: {exception_code}') class IllegalFunctionError(ModbusException): pass class IllegalDataAddressError(ModbusException): pass class IllegalDataValueError(ModbusException): pass class SlaveDeviceFailureError(ModbusException): pass class AcknowledgeError(ModbusException): pass class SlaveDeviceBusyError(ModbusException): pass class NegativeAcknowledgeError(ModbusException): pass class MemoryParityError(ModbusException): pass class GatewayPathUnavailableError(ModbusException): pass class GatewayTargetDeviceFailedToRespondError(ModbusException): pass
class Modbusexception(Exception): @staticmethod def from_exception_code(exception_code: int): if exception_code == 1: return IllegalFunctionError elif exception_code == 2: return IllegalDataAddressError elif exception_code == 3: return IllegalDataValueError elif exception_code == 4: return SlaveDeviceFailureError elif exception_code == 5: return AcknowledgeError elif exception_code == 6: return SlaveDeviceBusyError elif exception_code == 7: return NegativeAcknowledgeError elif exception_code == 8: return MemoryParityError elif exception_code == 10: return GatewayPathUnavailableError elif exception_code == 11: return GatewayTargetDeviceFailedToRespondError else: return exception(f'Slave reported a unknown error, exception code: {exception_code}') class Illegalfunctionerror(ModbusException): pass class Illegaldataaddresserror(ModbusException): pass class Illegaldatavalueerror(ModbusException): pass class Slavedevicefailureerror(ModbusException): pass class Acknowledgeerror(ModbusException): pass class Slavedevicebusyerror(ModbusException): pass class Negativeacknowledgeerror(ModbusException): pass class Memoryparityerror(ModbusException): pass class Gatewaypathunavailableerror(ModbusException): pass class Gatewaytargetdevicefailedtoresponderror(ModbusException): pass
"""Contants for Hitachi Smart App integration""" DOMAIN = "Hitachi_smart_app" #PLATFORMS = ["humidifier", "sensor", "number", "climate","fan"] PLATFORMS = ["humidifier","sensor","number","fan","climate","switch"] MANUFACTURER = "Hitachi" DEFAULT_NAME = "Hitachi Smart Application" DEVICE_TYPE_AC = 0x01 DEVICE_TYPE_DEHUMIDIFIER = 0x04 DATA_CLIENT = "client" DATA_COORDINATOR = "coordinator" UPDATE_INTERVAL = 60
"""Contants for Hitachi Smart App integration""" domain = 'Hitachi_smart_app' platforms = ['humidifier', 'sensor', 'number', 'fan', 'climate', 'switch'] manufacturer = 'Hitachi' default_name = 'Hitachi Smart Application' device_type_ac = 1 device_type_dehumidifier = 4 data_client = 'client' data_coordinator = 'coordinator' update_interval = 60
# aoc 2020 day 9 def two_sum(val, lst): for x in lst: for y in lst: if x + y == val: return True return False prelude_len = 25 with open("aoc_2020_9.in") as f: data = f.readlines() data = list(map(int, data)) part_one_answer = 0 for idx in range(prelude_len, len(data)): preceding = data[(idx - prelude_len): idx] if not two_sum(data[idx], preceding): part_one_answer = data[idx] break print("Part one answer is ", part_one_answer) pt2 = [] def part2(d): for x in range(len(d) - 1): for y in range(1, len(d)): if sum(d[x:y]) == part_one_answer and x != y: return [min(d[x:y]), max(d[x:y])] pt2 = part2(data) print("Part two answer is ", sum(pt2)) assert(part_one_answer == 85848519) assert(sum(pt2) == 13414198)
def two_sum(val, lst): for x in lst: for y in lst: if x + y == val: return True return False prelude_len = 25 with open('aoc_2020_9.in') as f: data = f.readlines() data = list(map(int, data)) part_one_answer = 0 for idx in range(prelude_len, len(data)): preceding = data[idx - prelude_len:idx] if not two_sum(data[idx], preceding): part_one_answer = data[idx] break print('Part one answer is ', part_one_answer) pt2 = [] def part2(d): for x in range(len(d) - 1): for y in range(1, len(d)): if sum(d[x:y]) == part_one_answer and x != y: return [min(d[x:y]), max(d[x:y])] pt2 = part2(data) print('Part two answer is ', sum(pt2)) assert part_one_answer == 85848519 assert sum(pt2) == 13414198
# # PySNMP MIB module A3COM-SWITCHING-SYSTEMS-FDDI-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM-SWITCHING-SYSTEMS-FDDI-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:08:20 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, ValueRangeConstraint, ConstraintsIntersection, ValueSizeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueRangeConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "SingleValueConstraint") fddimibPORTLerFlag, fddimibPORTMyType, fddimibMACCopiedCts, fddimibPORTLerEstimate, fddimibMACNotCopiedRatio, fddimibPORTLemRejectCts, fddimibMACUnaDaFlag, fddimibMACLostCts, fddimibPORTAvailablePaths, fddimibSMTCFState, fddimibSMTStationId, fddimibPORTRequestedPaths, fddimibMACOldUpstreamNbr, fddimibMACRequestedPaths, FddiTimeNano, fddimibMACCurrentPath, fddimibPORTLerAlarm, fddimibPORTConnectState, fddimibMACAvailablePaths, fddimibSMTPeerWrapFlag, fddimibMACUpstreamNbr, fddimibMACSMTAddress, fddimibPORTCurrentPath, fddimibMACNotCopiedCts, fddimibMACDownstreamNbr, fddimibPORTPCWithhold, fddimibMACFrameErrorFlag, fddimibMACOldDownstreamNbr, fddimibMACFrameCts, fddimibMACFrameErrorRatio, fddimibMACDaFlag, fddimibMACNotCopiedFlag, fddimibPORTNeighborType, fddimibMACErrorCts, fddimibPORTLerCutoff, fddimibPORTLemCts, FddiSMTStationIdType = mibBuilder.importSymbols("FDDI-SMT73-MIB", "fddimibPORTLerFlag", "fddimibPORTMyType", "fddimibMACCopiedCts", "fddimibPORTLerEstimate", "fddimibMACNotCopiedRatio", "fddimibPORTLemRejectCts", "fddimibMACUnaDaFlag", "fddimibMACLostCts", "fddimibPORTAvailablePaths", "fddimibSMTCFState", "fddimibSMTStationId", "fddimibPORTRequestedPaths", "fddimibMACOldUpstreamNbr", "fddimibMACRequestedPaths", "FddiTimeNano", "fddimibMACCurrentPath", "fddimibPORTLerAlarm", "fddimibPORTConnectState", "fddimibMACAvailablePaths", "fddimibSMTPeerWrapFlag", "fddimibMACUpstreamNbr", "fddimibMACSMTAddress", "fddimibPORTCurrentPath", "fddimibMACNotCopiedCts", "fddimibMACDownstreamNbr", "fddimibPORTPCWithhold", "fddimibMACFrameErrorFlag", "fddimibMACOldDownstreamNbr", "fddimibMACFrameCts", "fddimibMACFrameErrorRatio", "fddimibMACDaFlag", "fddimibMACNotCopiedFlag", "fddimibPORTNeighborType", "fddimibMACErrorCts", "fddimibPORTLerCutoff", "fddimibPORTLemCts", "FddiSMTStationIdType") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") MibScalar, MibTable, MibTableRow, MibTableColumn, NotificationType, Counter64, MibIdentifier, iso, Bits, Gauge32, ObjectIdentity, Unsigned32, enterprises, Counter32, TimeTicks, IpAddress, NotificationType, ModuleIdentity, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "NotificationType", "Counter64", "MibIdentifier", "iso", "Bits", "Gauge32", "ObjectIdentity", "Unsigned32", "enterprises", "Counter32", "TimeTicks", "IpAddress", "NotificationType", "ModuleIdentity", "Integer32") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") a3Com = MibIdentifier((1, 3, 6, 1, 4, 1, 43)) switchingSystemsMibs = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 29)) a3ComSwitchingSystemsFddiMib = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 29, 10)) a3ComFddiSMT = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 29, 10, 1)) a3ComFddiMAC = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 29, 10, 2)) a3ComFddiPATH = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 29, 10, 3)) a3ComFddiPORT = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 29, 10, 4)) a3ComFddiSMTTable = MibTable((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1), ) if mibBuilder.loadTexts: a3ComFddiSMTTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTTable.setDescription('A list of optional SMT entries. The number of entries shall not exceed the value of snmpFddiSMTNumber.') a3ComFddiSMTEntry = MibTableRow((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1), ).setIndexNames((0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiSMTIndex")) if mibBuilder.loadTexts: a3ComFddiSMTEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTEntry.setDescription('An optional SMT entry containing information common to a given optional SMT.') a3ComFddiSMTIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3ComFddiSMTManufacturerOUI = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(3, 3)).setFixedLength(3)).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiSMTManufacturerOUI.setReference('ANSI { fddiSMT 16 }') if mibBuilder.loadTexts: a3ComFddiSMTManufacturerOUI.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTManufacturerOUI.setDescription('The three octets of manufacturer data which make up the manufacturerOUI component.') a3ComFddiSMTManufacturerData = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(29, 29)).setFixedLength(29)).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiSMTManufacturerData.setReference('ANSI { fddiSMT 16 }') if mibBuilder.loadTexts: a3ComFddiSMTManufacturerData.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTManufacturerData.setDescription('The 29 octets of manufacturer data which make up the manufacturerData component.') a3ComFddiSMTHoldState = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("not-implemented", 1), ("not-holding", 2), ("holding-prm", 3), ("holding-sec", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiSMTHoldState.setReference('ANSI { fddiSMT 43 }') if mibBuilder.loadTexts: a3ComFddiSMTHoldState.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTHoldState.setDescription("This variable indicates the current state of the Hold function. The value 'not-holding' is the default and initial value. The value must be set to 'not-holding' as part of Active-Actions and when the conditions causing 'holding-prm' or 'holding-sec' are no longer true. The value 'holding-prm' must be set when the condition (notTR-Flag & not RE-Flag & (PC-LS=QLS | LEM-Fail TNE>NS-Max | (not LS-Flag & TPC > T-Out))) is satisfied in state PC8:ACTIVE for the A Port. The value 'holding-sec' must be set when the condition (notTR-Flag & not RE-Flag & (PC-LS=QLS | LEM-Fail TNE>NS-Max | (not LS-Flag & TPC > T-Out))) is satisfied in state PC8:ACTIVE for the B Port.") a3ComFddiSMTSetCount = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiSMTSetCount.setReference('ANSI { fddiSMT 53 }') if mibBuilder.loadTexts: a3ComFddiSMTSetCount.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTSetCount.setDescription('This variable is composed of a count incremented in response to a Set operation on the MIB, and the time of the change, however only the count is reported here (refer to ANSI SMT 8.4.1).') a3ComFddiSMTLastSetStationId = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1, 6), FddiSMTStationIdType()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiSMTLastSetStationId.setReference('ANSI { fddiSMT 54 }') if mibBuilder.loadTexts: a3ComFddiSMTLastSetStationId.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTLastSetStationId.setDescription('The Station ID of the station that effected the last change in the FDDI MIB.') a3ComFddiMACBridgeFunctionTable = MibTable((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 1), ) if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionTable.setDescription('A list of MAC bridge function entries.') a3ComFddiMACBridgeFunctionEntry = MibTableRow((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 1, 1), ).setIndexNames((0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiMACBridgeFunctionSMTIndex"), (0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiMACBridgeFunctionMACIndex")) if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionEntry.setDescription('Bridge function information for a given MAC within a given SMT.') a3ComFddiMACBridgeFunctionSMTIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3ComFddiMACBridgeFunctionMACIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionMACIndex.setReference('ANSI { fddiMAC 34 }') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionMACIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionMACIndex.setDescription('Index variable for uniquely identifying the MAC object instances.') a3ComFddiMACBridgeFunctions = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-1, 7))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctions.setReference('ANSI { fddiMAC 12 }') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctions.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctions.setDescription("Indicates the MAC's optional bridging functions. The Value -1 is used to indicate that bridging is not supported by this MAC. The value is a sum. This value initially takes the value zero, then for each function present, 2 raised to a power is added to the sum. The powers are according to the following table: Function Power tb 0 -- Transparent bridging active sr 1 -- Src routing active srt 2 -- Src routing transparent active ") a3ComFddiMACTPriTable = MibTable((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2), ) if mibBuilder.loadTexts: a3ComFddiMACTPriTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPriTable.setDescription('A list of MAC T-Pri entries.') a3ComFddiMACTPriEntry = MibTableRow((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1), ).setIndexNames((0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiMACTPriSMTIndex"), (0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiMACTPriMACIndex")) if mibBuilder.loadTexts: a3ComFddiMACTPriEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPriEntry.setDescription('A collection of T-Pri information for a given MAC within a given SMT.') a3ComFddiMACTPriSMTIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiMACTPriSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPriSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3ComFddiMACTPriMACIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiMACTPriMACIndex.setReference('ANSI { fddiMAC 34 }') if mibBuilder.loadTexts: a3ComFddiMACTPriMACIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPriMACIndex.setDescription('Index variable for uniquely identifying the MAC object instances.') a3ComFddiMACTPri0 = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 3), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiMACTPri0.setReference('ANSI { fddiMAC 56 }') if mibBuilder.loadTexts: a3ComFddiMACTPri0.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri0.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3ComFddiMACTPri1 = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 4), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiMACTPri1.setReference('ANSI { fddiMAC 57 }') if mibBuilder.loadTexts: a3ComFddiMACTPri1.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri1.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3ComFddiMACTPri2 = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 5), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiMACTPri2.setReference('ANSI { fddiMAC 58 }') if mibBuilder.loadTexts: a3ComFddiMACTPri2.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri2.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3ComFddiMACTPri3 = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 6), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiMACTPri3.setReference('ANSI { fddiMAC 59 }') if mibBuilder.loadTexts: a3ComFddiMACTPri3.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri3.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3ComFddiMACTPri4 = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 7), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiMACTPri4.setReference('ANSI { fddiMAC 60 }') if mibBuilder.loadTexts: a3ComFddiMACTPri4.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri4.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3ComFddiMACTPri5 = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 8), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiMACTPri5.setReference('ANSI { fddiMAC 61 }') if mibBuilder.loadTexts: a3ComFddiMACTPri5.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri5.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3ComFddiMACTPri6 = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 9), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiMACTPri6.setReference('ANSI { fddiMAC 62 }') if mibBuilder.loadTexts: a3ComFddiMACTPri6.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri6.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3ComFddiPATHRingTable = MibTable((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1), ) if mibBuilder.loadTexts: a3ComFddiPATHRingTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHRingTable.setDescription('A list of PATH ring entries.') a3ComFddiPATHRingEntry = MibTableRow((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1, 1), ).setIndexNames((0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiPATHRingSMTIndex"), (0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiPATHRingPATHIndex")) if mibBuilder.loadTexts: a3ComFddiPATHRingEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHRingEntry.setDescription('Ring latency, trace status, and T-Rmode information for a given PATH within a given SMT.') a3ComFddiPATHRingSMTIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiPATHRingSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHRingSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3ComFddiPATHRingPATHIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiPATHRingPATHIndex.setReference('ANSI { fddiPATH 11 }') if mibBuilder.loadTexts: a3ComFddiPATHRingPATHIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHRingPATHIndex.setDescription('Index variable for uniquely identifying the primary, secondary and local PATH object instances. Local PATH object instances are represented with integer values 3 to 255.') a3ComFddiPATHRingLatency = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1, 1, 3), FddiTimeNano()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a3ComFddiPATHRingLatency.setReference('ANSI { fddiPATH 13 }') if mibBuilder.loadTexts: a3ComFddiPATHRingLatency.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHRingLatency.setDescription('Gives the total accumulated latency of the ring associated with this path. May be measured directly by the station or calculated by a management station. Values of this object are reported in 1 ns units.') a3ComFddiPATHTraceStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 15))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiPATHTraceStatus.setReference('ANSI { fddiPATH 14 }') if mibBuilder.loadTexts: a3ComFddiPATHTraceStatus.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHTraceStatus.setDescription('This attribute indicates the current trace status of the path. The value is a sum which represents all of the trace status information which applies. This value initially takes the value zero, then for each condition which applies, 2 raised to a power is added to the sum. the powers are according to the following table: TraceStatus Power traceinitiated 0 tracepropragated 1 traceterminated 2 tracetimeout 3') a3ComFddiPATHT_Rmode = MibScalar((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1, 1, 5), FddiTimeNano()).setLabel("a3ComFddiPATHT-Rmode").setMaxAccess("readwrite") if mibBuilder.loadTexts: a3ComFddiPATHT_Rmode.setReference('ANSI { fddiPATH 19 }') if mibBuilder.loadTexts: a3ComFddiPATHT_Rmode.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHT_Rmode.setDescription('Used by RMT to limit the duration of restricted dialogs on a path. This object is reported in 1 ns units.') a3ComFddiPATHSbaTable = MibTable((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2), ) if mibBuilder.loadTexts: a3ComFddiPATHSbaTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaTable.setDescription('A list of PATH Sba entries.') a3ComFddiPATHSbaEntry = MibTableRow((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2, 1), ).setIndexNames((0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiPATHSbaSMTIndex"), (0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiPATHSbaPATHIndex")) if mibBuilder.loadTexts: a3ComFddiPATHSbaEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaEntry.setDescription('Sba information for a given PATH within a given SMT.') a3ComFddiPATHSbaSMTIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiPATHSbaSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3ComFddiPATHSbaPATHIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiPATHSbaPATHIndex.setReference('ANSI { fddiPATH 11 }') if mibBuilder.loadTexts: a3ComFddiPATHSbaPATHIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaPATHIndex.setDescription('Index variable for uniquely identifying the primary, secondary and local PATH object instances. Local PATH object instances are represented with integer values 3 to 255.') a3ComFddiPATHSbaPayload = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1562))).setMaxAccess("readwrite") if mibBuilder.loadTexts: a3ComFddiPATHSbaPayload.setReference('ANSI { fddiPATH 15 }') if mibBuilder.loadTexts: a3ComFddiPATHSbaPayload.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaPayload.setDescription('The payload portion of the Synchronous Bandwidth Allocation for thi path. This value represents the maximum number of bytes of data allocated for transmission per 125 microseconds.') a3ComFddiPATHSbaOverhead = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2, 1, 4), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a3ComFddiPATHSbaOverhead.setReference('ANSI { fddiPATH 16 }') if mibBuilder.loadTexts: a3ComFddiPATHSbaOverhead.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaOverhead.setDescription('The overhead portion of the Synchronous Bandwith Allocation for this path. This value repersents the maximum number of bytes overhead (token capture, frame header, etc.) used pre negotiated Target Token Rotation Time (T-neg).') a3ComFddiPATHSbaAvailable = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 12500000))).setMaxAccess("readwrite") if mibBuilder.loadTexts: a3ComFddiPATHSbaAvailable.setReference('ANSI { fddiPATH 20 }') if mibBuilder.loadTexts: a3ComFddiPATHSbaAvailable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaAvailable.setDescription('This value is the maximum Synchronous Bandwith available for a path in bytes per second.') a3ComFddiPORTTable = MibTable((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 1), ) if mibBuilder.loadTexts: a3ComFddiPORTTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTTable.setDescription('A list of optional PORT entries.') a3ComFddiPORTEntry = MibTableRow((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 1, 1), ).setIndexNames((0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiPORTSMTIndex"), (0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiPORTIndex")) if mibBuilder.loadTexts: a3ComFddiPORTEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTEntry.setDescription('MAC loop time and EB error count information for a given PORT within a given SMT.') a3ComFddiPORTSMTIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiPORTSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3ComFddiPORTIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiPORTIndex.setReference('ANSI { fddiPORT 29 }') if mibBuilder.loadTexts: a3ComFddiPORTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTIndex.setDescription('Index variable for uniquely identifying the PORT object instances.') a3ComFddiPORTMACLoopTime = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 1, 1, 3), FddiTimeNano()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a3ComFddiPORTMACLoopTime.setReference('ANSI { fddiPORT 21 }') if mibBuilder.loadTexts: a3ComFddiPORTMACLoopTime.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTMACLoopTime.setDescription('This attribute controls the value used for T-Next(9) (see 9.4.4.2.3). This object is reported in 1 ns units.') a3ComFddiPORTEBErrorCt = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 1, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiPORTEBErrorCt.setReference('ANSI { fddiPORT 41 }') if mibBuilder.loadTexts: a3ComFddiPORTEBErrorCt.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTEBErrorCt.setDescription('A count that should as closely as possible match the times an Elasticity Buffer Error has occurred while in active line state.') a3ComFddiPORTLSTable = MibTable((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 2), ) if mibBuilder.loadTexts: a3ComFddiPORTLSTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTLSTable.setDescription('A list of optional PORT line state entries.') a3ComFddiPORTLSEntry = MibTableRow((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 2, 1), ).setIndexNames((0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiPORTLSSMTIndex"), (0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiPORTLSPORTIndex")) if mibBuilder.loadTexts: a3ComFddiPORTLSEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTLSEntry.setDescription('Maintenance line state and PC line state information for a given PORT within a given SMT.') a3ComFddiPORTLSSMTIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiPORTLSSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTLSSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3ComFddiPORTLSPORTIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiPORTLSPORTIndex.setReference('ANSI { fddiPORT 29 }') if mibBuilder.loadTexts: a3ComFddiPORTLSPORTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTLSPORTIndex.setDescription('Index variable for uniquely identifying the PORT object instances.') a3ComFddiPORTMaintLS = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("quiet", 1), ("idle", 2), ("master", 3), ("halt", 4), ("receive-active", 5), ("receive-unknown", 6), ("receive-noise", 7)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: a3ComFddiPORTMaintLS.setReference('ANSI { fddiPORT 31 }') if mibBuilder.loadTexts: a3ComFddiPORTMaintLS.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTMaintLS.setDescription('The PORT Maintenance Line State specifies the line state (Maint-LS) to be transmitted when the PCM state machine for the port is in state PC9 Maint.') a3ComFddiPORTPCLS = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("quiet", 1), ("idle", 2), ("master", 3), ("halt", 4), ("receive-active", 5), ("receive-unknown", 6), ("receive-noise", 7)))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiPORTPCLS.setReference('ANSI { fddiPORT 34 }') if mibBuilder.loadTexts: a3ComFddiPORTPCLS.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTPCLS.setDescription('This attribute indicates the line state (PC-LS) received by the port.') a3ComFddiSMTHoldCondition = NotificationType((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0,1)).setObjects(("FDDI-SMT73-MIB", "fddimibSMTStationId"), ("A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiSMTHoldState")) if mibBuilder.loadTexts: a3ComFddiSMTHoldCondition.setDescription('Generated when fddiSMTHoldState (fddimibSMTHoldState) assumes the state holding-prm or holding-sec. This notification is a Condition in the Status Report Protocol (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiSMTHoldCondition.setReference('ANSI { fddiSMT 71 }') a3ComFddiSMTPeerWrapCondition = NotificationType((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0,2)).setObjects(("FDDI-SMT73-MIB", "fddimibSMTStationId"), ("FDDI-SMT73-MIB", "fddimibSMTCFState"), ("FDDI-SMT73-MIB", "fddimibSMTPeerWrapFlag")) if mibBuilder.loadTexts: a3ComFddiSMTPeerWrapCondition.setDescription('This condition is active when fddiSMTPeerWrapFlag (fddimibSMTPeerWrapFlag) is set. This notification is a Condition in the Status Report Protocol (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiSMTPeerWrapCondition.setReference('ANSI { fddiSMT 72 }') a3ComFddiMACDuplicateAddressCondition = NotificationType((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0,3)).setObjects(("FDDI-SMT73-MIB", "fddimibSMTStationId"), ("FDDI-SMT73-MIB", "fddimibMACSMTAddress"), ("FDDI-SMT73-MIB", "fddimibMACUpstreamNbr"), ("FDDI-SMT73-MIB", "fddimibMACDaFlag"), ("FDDI-SMT73-MIB", "fddimibMACUnaDaFlag")) if mibBuilder.loadTexts: a3ComFddiMACDuplicateAddressCondition.setDescription('This condition is active when either fddiMACDA-Flag (fddimibMACDaFlag) or fddiMACUNDA-Flag (fddimibMACUnaDaFlag) is set. This event is handled as a Condition in the Status Report Protocol (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiMACDuplicateAddressCondition.setReference('ANSI { fddiMAC 140 }') a3ComFddiMACFrameErrorCondition = NotificationType((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0,4)).setObjects(("FDDI-SMT73-MIB", "fddimibSMTStationId"), ("FDDI-SMT73-MIB", "fddimibMACFrameErrorFlag"), ("FDDI-SMT73-MIB", "fddimibMACFrameCts"), ("FDDI-SMT73-MIB", "fddimibMACErrorCts"), ("FDDI-SMT73-MIB", "fddimibMACLostCts"), ("FDDI-SMT73-MIB", "fddimibMACFrameErrorRatio")) if mibBuilder.loadTexts: a3ComFddiMACFrameErrorCondition.setDescription('Generated when the fddiMACFrameErrorRatio (fddimibMACFrameErrorRatio) is greater than or equal to fddiMACFrameErrorThreshold (fddimibMACFrameErrorThreshold). This event is handled as a Condition in the Status Report Protocol (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiMACFrameErrorCondition.setReference('ANSI { fddiMAC 141 }') a3ComFddiMACNotCopiedCondition = NotificationType((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0,5)).setObjects(("FDDI-SMT73-MIB", "fddimibSMTStationId"), ("FDDI-SMT73-MIB", "fddimibMACNotCopiedCts"), ("FDDI-SMT73-MIB", "fddimibMACCopiedCts"), ("FDDI-SMT73-MIB", "fddimibMACNotCopiedRatio"), ("FDDI-SMT73-MIB", "fddimibMACNotCopiedFlag")) if mibBuilder.loadTexts: a3ComFddiMACNotCopiedCondition.setDescription('Generated when the fddiMACNotCopiedRatio (fddimibMACNotCopiedRatio) is greater than or equal to the fddiMACNotCopiedThreshold (a3ComFddiMACNotCopiedThreshold). This event is handled as a Condition in the Status Report Protocol (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiMACNotCopiedCondition.setReference('ANSI { fddiMAC 142 }') a3ComFddiMACNeighborChangeEvent = NotificationType((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0,6)).setObjects(("FDDI-SMT73-MIB", "fddimibSMTStationId"), ("FDDI-SMT73-MIB", "fddimibMACUpstreamNbr"), ("FDDI-SMT73-MIB", "fddimibMACOldUpstreamNbr"), ("FDDI-SMT73-MIB", "fddimibMACDownstreamNbr"), ("FDDI-SMT73-MIB", "fddimibMACOldDownstreamNbr"), ("FDDI-SMT73-MIB", "fddimibMACCurrentPath"), ("FDDI-SMT73-MIB", "fddimibMACSMTAddress")) if mibBuilder.loadTexts: a3ComFddiMACNeighborChangeEvent.setDescription("Generated when a change in a MAC's upstream neighbor address or downstream neighbor address is detected. (see 7.2.7 and 8.3).") if mibBuilder.loadTexts: a3ComFddiMACNeighborChangeEvent.setReference('ANSI { fddiMAC 143 }') a3ComFddiMACPathChangeEvent = NotificationType((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0,7)).setObjects(("FDDI-SMT73-MIB", "fddimibSMTStationId"), ("FDDI-SMT73-MIB", "fddimibMACAvailablePaths"), ("FDDI-SMT73-MIB", "fddimibMACCurrentPath"), ("FDDI-SMT73-MIB", "fddimibMACRequestedPaths")) if mibBuilder.loadTexts: a3ComFddiMACPathChangeEvent.setDescription('This event is generated when the value of the fddiMACCurrentPath (fddimibMACCurrentPath) changes. This event shall be supressed if the value changes from isolated to local or local to isolated (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiMACPathChangeEvent.setReference('ANSI { fddiMAC 144 }') a3ComFddiPORTLerCondition = NotificationType((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0,8)).setObjects(("FDDI-SMT73-MIB", "fddimibSMTStationId"), ("FDDI-SMT73-MIB", "fddimibPORTLerCutoff"), ("FDDI-SMT73-MIB", "fddimibPORTLerAlarm"), ("FDDI-SMT73-MIB", "fddimibPORTLerEstimate"), ("FDDI-SMT73-MIB", "fddimibPORTLemRejectCts"), ("FDDI-SMT73-MIB", "fddimibPORTLemCts"), ("FDDI-SMT73-MIB", "fddimibPORTLerFlag")) if mibBuilder.loadTexts: a3ComFddiPORTLerCondition.setDescription('This condition becomes active when the value of fddiPORTLer-Estimate (fddimibPORTLerEstimate) is less than or equal to fddiPORTLer-Alarm (fddimibPORTLerAlarm). This will be reported with the Status Report Frames (SRF) (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiPORTLerCondition.setReference('ANSI { fddiPORT 80 }') a3ComFddiPORTUndesiredConnAttemptEvent = NotificationType((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0,9)).setObjects(("FDDI-SMT73-MIB", "fddimibSMTStationId"), ("FDDI-SMT73-MIB", "fddimibPORTMyType"), ("FDDI-SMT73-MIB", "fddimibPORTConnectState"), ("FDDI-SMT73-MIB", "fddimibPORTNeighborType"), ("FDDI-SMT73-MIB", "fddimibPORTPCWithhold")) if mibBuilder.loadTexts: a3ComFddiPORTUndesiredConnAttemptEvent.setDescription('Generated when an undesired connection attempt has been made (see 5.2.4, 7.2.7, and 8.3).') if mibBuilder.loadTexts: a3ComFddiPORTUndesiredConnAttemptEvent.setReference('ANSI { fddiPORT 81 }') a3ComFddiPORTEBErrorCondition = NotificationType((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0,10)).setObjects(("FDDI-SMT73-MIB", "fddimibSMTStationId"), ("A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiPORTEBErrorCt")) if mibBuilder.loadTexts: a3ComFddiPORTEBErrorCondition.setDescription("Generated when the Elasticity Buffer Error-Ct (a3ComFddiPORTEBErrorCt) increments. This is handled as a condition in the Status Report Protocol. It is generated when an increment occurs in the station's sampling period (see 7.2.7 and 8.3).") if mibBuilder.loadTexts: a3ComFddiPORTEBErrorCondition.setReference('ANSI { fddiPORT 82 }') a3ComFddiPORTPathChangeEvent = NotificationType((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0,11)).setObjects(("FDDI-SMT73-MIB", "fddimibSMTStationId"), ("FDDI-SMT73-MIB", "fddimibPORTAvailablePaths"), ("FDDI-SMT73-MIB", "fddimibPORTCurrentPath"), ("FDDI-SMT73-MIB", "fddimibPORTRequestedPaths"), ("FDDI-SMT73-MIB", "fddimibPORTMyType"), ("FDDI-SMT73-MIB", "fddimibPORTNeighborType")) if mibBuilder.loadTexts: a3ComFddiPORTPathChangeEvent.setDescription('This event is generated when the value of the fddiPORTCurrentPath (a3ComFddiPORTCurrentPath) changes. This event shall be surpressed if the value changes from isolated to local or local to isolated (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiPORTPathChangeEvent.setReference('ANSI { fddiPORT 83 }') mibBuilder.exportSymbols("A3COM-SWITCHING-SYSTEMS-FDDI-MIB", a3ComFddiPORT=a3ComFddiPORT, a3ComFddiPORTMaintLS=a3ComFddiPORTMaintLS, a3ComFddiPATHSbaTable=a3ComFddiPATHSbaTable, a3ComFddiSMT=a3ComFddiSMT, a3ComFddiPATHRingEntry=a3ComFddiPATHRingEntry, a3ComFddiPATHSbaPATHIndex=a3ComFddiPATHSbaPATHIndex, a3ComFddiPORTEntry=a3ComFddiPORTEntry, a3ComFddiMACDuplicateAddressCondition=a3ComFddiMACDuplicateAddressCondition, a3ComFddiMACPathChangeEvent=a3ComFddiMACPathChangeEvent, a3ComFddiPORTPCLS=a3ComFddiPORTPCLS, a3ComFddiSMTIndex=a3ComFddiSMTIndex, a3ComFddiMACTPri6=a3ComFddiMACTPri6, a3ComFddiPORTLSTable=a3ComFddiPORTLSTable, a3ComFddiMACBridgeFunctionSMTIndex=a3ComFddiMACBridgeFunctionSMTIndex, a3ComFddiPATHSbaOverhead=a3ComFddiPATHSbaOverhead, a3ComFddiPORTEBErrorCt=a3ComFddiPORTEBErrorCt, a3ComFddiSMTTable=a3ComFddiSMTTable, a3ComFddiPORTMACLoopTime=a3ComFddiPORTMACLoopTime, a3Com=a3Com, a3ComFddiSMTEntry=a3ComFddiSMTEntry, a3ComFddiSMTManufacturerOUI=a3ComFddiSMTManufacturerOUI, a3ComFddiMACTPriEntry=a3ComFddiMACTPriEntry, a3ComFddiMACTPri4=a3ComFddiMACTPri4, a3ComFddiPATHRingPATHIndex=a3ComFddiPATHRingPATHIndex, a3ComFddiPORTIndex=a3ComFddiPORTIndex, a3ComFddiPATHTraceStatus=a3ComFddiPATHTraceStatus, a3ComFddiMACNeighborChangeEvent=a3ComFddiMACNeighborChangeEvent, a3ComFddiPATHRingTable=a3ComFddiPATHRingTable, a3ComFddiSMTHoldCondition=a3ComFddiSMTHoldCondition, a3ComFddiMACNotCopiedCondition=a3ComFddiMACNotCopiedCondition, a3ComFddiSMTManufacturerData=a3ComFddiSMTManufacturerData, a3ComFddiPATHRingSMTIndex=a3ComFddiPATHRingSMTIndex, a3ComFddiPATHSbaAvailable=a3ComFddiPATHSbaAvailable, a3ComFddiMACBridgeFunctionEntry=a3ComFddiMACBridgeFunctionEntry, a3ComFddiPORTSMTIndex=a3ComFddiPORTSMTIndex, a3ComFddiMACTPri1=a3ComFddiMACTPri1, a3ComFddiPATHT_Rmode=a3ComFddiPATHT_Rmode, a3ComFddiPATHSbaSMTIndex=a3ComFddiPATHSbaSMTIndex, a3ComFddiMACBridgeFunctionMACIndex=a3ComFddiMACBridgeFunctionMACIndex, a3ComFddiPATH=a3ComFddiPATH, a3ComFddiMACTPri5=a3ComFddiMACTPri5, a3ComFddiPATHSbaPayload=a3ComFddiPATHSbaPayload, a3ComFddiSMTHoldState=a3ComFddiSMTHoldState, a3ComFddiPORTTable=a3ComFddiPORTTable, a3ComFddiSMTLastSetStationId=a3ComFddiSMTLastSetStationId, a3ComFddiMACBridgeFunctions=a3ComFddiMACBridgeFunctions, a3ComFddiMACTPriTable=a3ComFddiMACTPriTable, a3ComFddiSMTPeerWrapCondition=a3ComFddiSMTPeerWrapCondition, a3ComFddiPORTLSSMTIndex=a3ComFddiPORTLSSMTIndex, a3ComFddiPORTLSPORTIndex=a3ComFddiPORTLSPORTIndex, a3ComFddiPORTEBErrorCondition=a3ComFddiPORTEBErrorCondition, a3ComFddiMAC=a3ComFddiMAC, a3ComSwitchingSystemsFddiMib=a3ComSwitchingSystemsFddiMib, a3ComFddiMACFrameErrorCondition=a3ComFddiMACFrameErrorCondition, a3ComFddiPORTUndesiredConnAttemptEvent=a3ComFddiPORTUndesiredConnAttemptEvent, a3ComFddiMACTPri3=a3ComFddiMACTPri3, a3ComFddiSMTSetCount=a3ComFddiSMTSetCount, a3ComFddiMACTPriSMTIndex=a3ComFddiMACTPriSMTIndex, a3ComFddiMACTPri2=a3ComFddiMACTPri2, a3ComFddiPORTLSEntry=a3ComFddiPORTLSEntry, switchingSystemsMibs=switchingSystemsMibs, a3ComFddiPORTPathChangeEvent=a3ComFddiPORTPathChangeEvent, a3ComFddiPATHRingLatency=a3ComFddiPATHRingLatency, a3ComFddiMACBridgeFunctionTable=a3ComFddiMACBridgeFunctionTable, a3ComFddiPATHSbaEntry=a3ComFddiPATHSbaEntry, a3ComFddiPORTLerCondition=a3ComFddiPORTLerCondition, a3ComFddiMACTPri0=a3ComFddiMACTPri0, a3ComFddiMACTPriMACIndex=a3ComFddiMACTPriMACIndex)
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ValueRangeConstraint', 'ConstraintsIntersection', 'ValueSizeConstraint', 'SingleValueConstraint') (fddimib_port_ler_flag, fddimib_port_my_type, fddimib_mac_copied_cts, fddimib_port_ler_estimate, fddimib_mac_not_copied_ratio, fddimib_port_lem_reject_cts, fddimib_mac_una_da_flag, fddimib_mac_lost_cts, fddimib_port_available_paths, fddimib_smtcf_state, fddimib_smt_station_id, fddimib_port_requested_paths, fddimib_mac_old_upstream_nbr, fddimib_mac_requested_paths, fddi_time_nano, fddimib_mac_current_path, fddimib_port_ler_alarm, fddimib_port_connect_state, fddimib_mac_available_paths, fddimib_smt_peer_wrap_flag, fddimib_mac_upstream_nbr, fddimib_macsmt_address, fddimib_port_current_path, fddimib_mac_not_copied_cts, fddimib_mac_downstream_nbr, fddimib_portpc_withhold, fddimib_mac_frame_error_flag, fddimib_mac_old_downstream_nbr, fddimib_mac_frame_cts, fddimib_mac_frame_error_ratio, fddimib_mac_da_flag, fddimib_mac_not_copied_flag, fddimib_port_neighbor_type, fddimib_mac_error_cts, fddimib_port_ler_cutoff, fddimib_port_lem_cts, fddi_smt_station_id_type) = mibBuilder.importSymbols('FDDI-SMT73-MIB', 'fddimibPORTLerFlag', 'fddimibPORTMyType', 'fddimibMACCopiedCts', 'fddimibPORTLerEstimate', 'fddimibMACNotCopiedRatio', 'fddimibPORTLemRejectCts', 'fddimibMACUnaDaFlag', 'fddimibMACLostCts', 'fddimibPORTAvailablePaths', 'fddimibSMTCFState', 'fddimibSMTStationId', 'fddimibPORTRequestedPaths', 'fddimibMACOldUpstreamNbr', 'fddimibMACRequestedPaths', 'FddiTimeNano', 'fddimibMACCurrentPath', 'fddimibPORTLerAlarm', 'fddimibPORTConnectState', 'fddimibMACAvailablePaths', 'fddimibSMTPeerWrapFlag', 'fddimibMACUpstreamNbr', 'fddimibMACSMTAddress', 'fddimibPORTCurrentPath', 'fddimibMACNotCopiedCts', 'fddimibMACDownstreamNbr', 'fddimibPORTPCWithhold', 'fddimibMACFrameErrorFlag', 'fddimibMACOldDownstreamNbr', 'fddimibMACFrameCts', 'fddimibMACFrameErrorRatio', 'fddimibMACDaFlag', 'fddimibMACNotCopiedFlag', 'fddimibPORTNeighborType', 'fddimibMACErrorCts', 'fddimibPORTLerCutoff', 'fddimibPORTLemCts', 'FddiSMTStationIdType') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (mib_scalar, mib_table, mib_table_row, mib_table_column, notification_type, counter64, mib_identifier, iso, bits, gauge32, object_identity, unsigned32, enterprises, counter32, time_ticks, ip_address, notification_type, module_identity, integer32) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'NotificationType', 'Counter64', 'MibIdentifier', 'iso', 'Bits', 'Gauge32', 'ObjectIdentity', 'Unsigned32', 'enterprises', 'Counter32', 'TimeTicks', 'IpAddress', 'NotificationType', 'ModuleIdentity', 'Integer32') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') a3_com = mib_identifier((1, 3, 6, 1, 4, 1, 43)) switching_systems_mibs = mib_identifier((1, 3, 6, 1, 4, 1, 43, 29)) a3_com_switching_systems_fddi_mib = mib_identifier((1, 3, 6, 1, 4, 1, 43, 29, 10)) a3_com_fddi_smt = mib_identifier((1, 3, 6, 1, 4, 1, 43, 29, 10, 1)) a3_com_fddi_mac = mib_identifier((1, 3, 6, 1, 4, 1, 43, 29, 10, 2)) a3_com_fddi_path = mib_identifier((1, 3, 6, 1, 4, 1, 43, 29, 10, 3)) a3_com_fddi_port = mib_identifier((1, 3, 6, 1, 4, 1, 43, 29, 10, 4)) a3_com_fddi_smt_table = mib_table((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1)) if mibBuilder.loadTexts: a3ComFddiSMTTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTTable.setDescription('A list of optional SMT entries. The number of entries shall not exceed the value of snmpFddiSMTNumber.') a3_com_fddi_smt_entry = mib_table_row((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1)).setIndexNames((0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiSMTIndex')) if mibBuilder.loadTexts: a3ComFddiSMTEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTEntry.setDescription('An optional SMT entry containing information common to a given optional SMT.') a3_com_fddi_smt_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3_com_fddi_smt_manufacturer_oui = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1, 2), octet_string().subtype(subtypeSpec=value_size_constraint(3, 3)).setFixedLength(3)).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiSMTManufacturerOUI.setReference('ANSI { fddiSMT 16 }') if mibBuilder.loadTexts: a3ComFddiSMTManufacturerOUI.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTManufacturerOUI.setDescription('The three octets of manufacturer data which make up the manufacturerOUI component.') a3_com_fddi_smt_manufacturer_data = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1, 3), octet_string().subtype(subtypeSpec=value_size_constraint(29, 29)).setFixedLength(29)).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiSMTManufacturerData.setReference('ANSI { fddiSMT 16 }') if mibBuilder.loadTexts: a3ComFddiSMTManufacturerData.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTManufacturerData.setDescription('The 29 octets of manufacturer data which make up the manufacturerData component.') a3_com_fddi_smt_hold_state = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('not-implemented', 1), ('not-holding', 2), ('holding-prm', 3), ('holding-sec', 4)))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiSMTHoldState.setReference('ANSI { fddiSMT 43 }') if mibBuilder.loadTexts: a3ComFddiSMTHoldState.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTHoldState.setDescription("This variable indicates the current state of the Hold function. The value 'not-holding' is the default and initial value. The value must be set to 'not-holding' as part of Active-Actions and when the conditions causing 'holding-prm' or 'holding-sec' are no longer true. The value 'holding-prm' must be set when the condition (notTR-Flag & not RE-Flag & (PC-LS=QLS | LEM-Fail TNE>NS-Max | (not LS-Flag & TPC > T-Out))) is satisfied in state PC8:ACTIVE for the A Port. The value 'holding-sec' must be set when the condition (notTR-Flag & not RE-Flag & (PC-LS=QLS | LEM-Fail TNE>NS-Max | (not LS-Flag & TPC > T-Out))) is satisfied in state PC8:ACTIVE for the B Port.") a3_com_fddi_smt_set_count = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1, 5), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiSMTSetCount.setReference('ANSI { fddiSMT 53 }') if mibBuilder.loadTexts: a3ComFddiSMTSetCount.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTSetCount.setDescription('This variable is composed of a count incremented in response to a Set operation on the MIB, and the time of the change, however only the count is reported here (refer to ANSI SMT 8.4.1).') a3_com_fddi_smt_last_set_station_id = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1, 6), fddi_smt_station_id_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiSMTLastSetStationId.setReference('ANSI { fddiSMT 54 }') if mibBuilder.loadTexts: a3ComFddiSMTLastSetStationId.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTLastSetStationId.setDescription('The Station ID of the station that effected the last change in the FDDI MIB.') a3_com_fddi_mac_bridge_function_table = mib_table((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 1)) if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionTable.setDescription('A list of MAC bridge function entries.') a3_com_fddi_mac_bridge_function_entry = mib_table_row((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 1, 1)).setIndexNames((0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiMACBridgeFunctionSMTIndex'), (0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiMACBridgeFunctionMACIndex')) if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionEntry.setDescription('Bridge function information for a given MAC within a given SMT.') a3_com_fddi_mac_bridge_function_smt_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3_com_fddi_mac_bridge_function_mac_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 1, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionMACIndex.setReference('ANSI { fddiMAC 34 }') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionMACIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionMACIndex.setDescription('Index variable for uniquely identifying the MAC object instances.') a3_com_fddi_mac_bridge_functions = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 1, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(-1, 7))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctions.setReference('ANSI { fddiMAC 12 }') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctions.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctions.setDescription("Indicates the MAC's optional bridging functions. The Value -1 is used to indicate that bridging is not supported by this MAC. The value is a sum. This value initially takes the value zero, then for each function present, 2 raised to a power is added to the sum. The powers are according to the following table: Function Power tb 0 -- Transparent bridging active sr 1 -- Src routing active srt 2 -- Src routing transparent active ") a3_com_fddi_mact_pri_table = mib_table((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2)) if mibBuilder.loadTexts: a3ComFddiMACTPriTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPriTable.setDescription('A list of MAC T-Pri entries.') a3_com_fddi_mact_pri_entry = mib_table_row((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1)).setIndexNames((0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiMACTPriSMTIndex'), (0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiMACTPriMACIndex')) if mibBuilder.loadTexts: a3ComFddiMACTPriEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPriEntry.setDescription('A collection of T-Pri information for a given MAC within a given SMT.') a3_com_fddi_mact_pri_smt_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiMACTPriSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPriSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3_com_fddi_mact_pri_mac_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiMACTPriMACIndex.setReference('ANSI { fddiMAC 34 }') if mibBuilder.loadTexts: a3ComFddiMACTPriMACIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPriMACIndex.setDescription('Index variable for uniquely identifying the MAC object instances.') a3_com_fddi_mact_pri0 = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 3), fddi_time_nano()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiMACTPri0.setReference('ANSI { fddiMAC 56 }') if mibBuilder.loadTexts: a3ComFddiMACTPri0.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri0.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3_com_fddi_mact_pri1 = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 4), fddi_time_nano()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiMACTPri1.setReference('ANSI { fddiMAC 57 }') if mibBuilder.loadTexts: a3ComFddiMACTPri1.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri1.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3_com_fddi_mact_pri2 = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 5), fddi_time_nano()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiMACTPri2.setReference('ANSI { fddiMAC 58 }') if mibBuilder.loadTexts: a3ComFddiMACTPri2.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri2.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3_com_fddi_mact_pri3 = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 6), fddi_time_nano()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiMACTPri3.setReference('ANSI { fddiMAC 59 }') if mibBuilder.loadTexts: a3ComFddiMACTPri3.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri3.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3_com_fddi_mact_pri4 = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 7), fddi_time_nano()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiMACTPri4.setReference('ANSI { fddiMAC 60 }') if mibBuilder.loadTexts: a3ComFddiMACTPri4.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri4.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3_com_fddi_mact_pri5 = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 8), fddi_time_nano()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiMACTPri5.setReference('ANSI { fddiMAC 61 }') if mibBuilder.loadTexts: a3ComFddiMACTPri5.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri5.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3_com_fddi_mact_pri6 = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 9), fddi_time_nano()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiMACTPri6.setReference('ANSI { fddiMAC 62 }') if mibBuilder.loadTexts: a3ComFddiMACTPri6.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri6.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3_com_fddi_path_ring_table = mib_table((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1)) if mibBuilder.loadTexts: a3ComFddiPATHRingTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHRingTable.setDescription('A list of PATH ring entries.') a3_com_fddi_path_ring_entry = mib_table_row((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1, 1)).setIndexNames((0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiPATHRingSMTIndex'), (0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiPATHRingPATHIndex')) if mibBuilder.loadTexts: a3ComFddiPATHRingEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHRingEntry.setDescription('Ring latency, trace status, and T-Rmode information for a given PATH within a given SMT.') a3_com_fddi_path_ring_smt_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiPATHRingSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHRingSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3_com_fddi_path_ring_path_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiPATHRingPATHIndex.setReference('ANSI { fddiPATH 11 }') if mibBuilder.loadTexts: a3ComFddiPATHRingPATHIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHRingPATHIndex.setDescription('Index variable for uniquely identifying the primary, secondary and local PATH object instances. Local PATH object instances are represented with integer values 3 to 255.') a3_com_fddi_path_ring_latency = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1, 1, 3), fddi_time_nano()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a3ComFddiPATHRingLatency.setReference('ANSI { fddiPATH 13 }') if mibBuilder.loadTexts: a3ComFddiPATHRingLatency.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHRingLatency.setDescription('Gives the total accumulated latency of the ring associated with this path. May be measured directly by the station or calculated by a management station. Values of this object are reported in 1 ns units.') a3_com_fddi_path_trace_status = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(0, 15))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiPATHTraceStatus.setReference('ANSI { fddiPATH 14 }') if mibBuilder.loadTexts: a3ComFddiPATHTraceStatus.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHTraceStatus.setDescription('This attribute indicates the current trace status of the path. The value is a sum which represents all of the trace status information which applies. This value initially takes the value zero, then for each condition which applies, 2 raised to a power is added to the sum. the powers are according to the following table: TraceStatus Power traceinitiated 0 tracepropragated 1 traceterminated 2 tracetimeout 3') a3_com_fddi_patht__rmode = mib_scalar((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1, 1, 5), fddi_time_nano()).setLabel('a3ComFddiPATHT-Rmode').setMaxAccess('readwrite') if mibBuilder.loadTexts: a3ComFddiPATHT_Rmode.setReference('ANSI { fddiPATH 19 }') if mibBuilder.loadTexts: a3ComFddiPATHT_Rmode.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHT_Rmode.setDescription('Used by RMT to limit the duration of restricted dialogs on a path. This object is reported in 1 ns units.') a3_com_fddi_path_sba_table = mib_table((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2)) if mibBuilder.loadTexts: a3ComFddiPATHSbaTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaTable.setDescription('A list of PATH Sba entries.') a3_com_fddi_path_sba_entry = mib_table_row((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2, 1)).setIndexNames((0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiPATHSbaSMTIndex'), (0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiPATHSbaPATHIndex')) if mibBuilder.loadTexts: a3ComFddiPATHSbaEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaEntry.setDescription('Sba information for a given PATH within a given SMT.') a3_com_fddi_path_sba_smt_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiPATHSbaSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3_com_fddi_path_sba_path_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiPATHSbaPATHIndex.setReference('ANSI { fddiPATH 11 }') if mibBuilder.loadTexts: a3ComFddiPATHSbaPATHIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaPATHIndex.setDescription('Index variable for uniquely identifying the primary, secondary and local PATH object instances. Local PATH object instances are represented with integer values 3 to 255.') a3_com_fddi_path_sba_payload = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(0, 1562))).setMaxAccess('readwrite') if mibBuilder.loadTexts: a3ComFddiPATHSbaPayload.setReference('ANSI { fddiPATH 15 }') if mibBuilder.loadTexts: a3ComFddiPATHSbaPayload.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaPayload.setDescription('The payload portion of the Synchronous Bandwidth Allocation for thi path. This value represents the maximum number of bytes of data allocated for transmission per 125 microseconds.') a3_com_fddi_path_sba_overhead = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2, 1, 4), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a3ComFddiPATHSbaOverhead.setReference('ANSI { fddiPATH 16 }') if mibBuilder.loadTexts: a3ComFddiPATHSbaOverhead.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaOverhead.setDescription('The overhead portion of the Synchronous Bandwith Allocation for this path. This value repersents the maximum number of bytes overhead (token capture, frame header, etc.) used pre negotiated Target Token Rotation Time (T-neg).') a3_com_fddi_path_sba_available = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(0, 12500000))).setMaxAccess('readwrite') if mibBuilder.loadTexts: a3ComFddiPATHSbaAvailable.setReference('ANSI { fddiPATH 20 }') if mibBuilder.loadTexts: a3ComFddiPATHSbaAvailable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaAvailable.setDescription('This value is the maximum Synchronous Bandwith available for a path in bytes per second.') a3_com_fddi_port_table = mib_table((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 1)) if mibBuilder.loadTexts: a3ComFddiPORTTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTTable.setDescription('A list of optional PORT entries.') a3_com_fddi_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 1, 1)).setIndexNames((0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiPORTSMTIndex'), (0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiPORTIndex')) if mibBuilder.loadTexts: a3ComFddiPORTEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTEntry.setDescription('MAC loop time and EB error count information for a given PORT within a given SMT.') a3_com_fddi_portsmt_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiPORTSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3_com_fddi_port_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 1, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiPORTIndex.setReference('ANSI { fddiPORT 29 }') if mibBuilder.loadTexts: a3ComFddiPORTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTIndex.setDescription('Index variable for uniquely identifying the PORT object instances.') a3_com_fddi_portmac_loop_time = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 1, 1, 3), fddi_time_nano()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a3ComFddiPORTMACLoopTime.setReference('ANSI { fddiPORT 21 }') if mibBuilder.loadTexts: a3ComFddiPORTMACLoopTime.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTMACLoopTime.setDescription('This attribute controls the value used for T-Next(9) (see 9.4.4.2.3). This object is reported in 1 ns units.') a3_com_fddi_porteb_error_ct = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 1, 1, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiPORTEBErrorCt.setReference('ANSI { fddiPORT 41 }') if mibBuilder.loadTexts: a3ComFddiPORTEBErrorCt.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTEBErrorCt.setDescription('A count that should as closely as possible match the times an Elasticity Buffer Error has occurred while in active line state.') a3_com_fddi_portls_table = mib_table((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 2)) if mibBuilder.loadTexts: a3ComFddiPORTLSTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTLSTable.setDescription('A list of optional PORT line state entries.') a3_com_fddi_portls_entry = mib_table_row((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 2, 1)).setIndexNames((0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiPORTLSSMTIndex'), (0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiPORTLSPORTIndex')) if mibBuilder.loadTexts: a3ComFddiPORTLSEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTLSEntry.setDescription('Maintenance line state and PC line state information for a given PORT within a given SMT.') a3_com_fddi_portlssmt_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiPORTLSSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTLSSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3_com_fddi_portlsport_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 2, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiPORTLSPORTIndex.setReference('ANSI { fddiPORT 29 }') if mibBuilder.loadTexts: a3ComFddiPORTLSPORTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTLSPORTIndex.setDescription('Index variable for uniquely identifying the PORT object instances.') a3_com_fddi_port_maint_ls = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 2, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('quiet', 1), ('idle', 2), ('master', 3), ('halt', 4), ('receive-active', 5), ('receive-unknown', 6), ('receive-noise', 7)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: a3ComFddiPORTMaintLS.setReference('ANSI { fddiPORT 31 }') if mibBuilder.loadTexts: a3ComFddiPORTMaintLS.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTMaintLS.setDescription('The PORT Maintenance Line State specifies the line state (Maint-LS) to be transmitted when the PCM state machine for the port is in state PC9 Maint.') a3_com_fddi_portpcls = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 2, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('quiet', 1), ('idle', 2), ('master', 3), ('halt', 4), ('receive-active', 5), ('receive-unknown', 6), ('receive-noise', 7)))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiPORTPCLS.setReference('ANSI { fddiPORT 34 }') if mibBuilder.loadTexts: a3ComFddiPORTPCLS.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTPCLS.setDescription('This attribute indicates the line state (PC-LS) received by the port.') a3_com_fddi_smt_hold_condition = notification_type((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0, 1)).setObjects(('FDDI-SMT73-MIB', 'fddimibSMTStationId'), ('A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiSMTHoldState')) if mibBuilder.loadTexts: a3ComFddiSMTHoldCondition.setDescription('Generated when fddiSMTHoldState (fddimibSMTHoldState) assumes the state holding-prm or holding-sec. This notification is a Condition in the Status Report Protocol (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiSMTHoldCondition.setReference('ANSI { fddiSMT 71 }') a3_com_fddi_smt_peer_wrap_condition = notification_type((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0, 2)).setObjects(('FDDI-SMT73-MIB', 'fddimibSMTStationId'), ('FDDI-SMT73-MIB', 'fddimibSMTCFState'), ('FDDI-SMT73-MIB', 'fddimibSMTPeerWrapFlag')) if mibBuilder.loadTexts: a3ComFddiSMTPeerWrapCondition.setDescription('This condition is active when fddiSMTPeerWrapFlag (fddimibSMTPeerWrapFlag) is set. This notification is a Condition in the Status Report Protocol (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiSMTPeerWrapCondition.setReference('ANSI { fddiSMT 72 }') a3_com_fddi_mac_duplicate_address_condition = notification_type((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0, 3)).setObjects(('FDDI-SMT73-MIB', 'fddimibSMTStationId'), ('FDDI-SMT73-MIB', 'fddimibMACSMTAddress'), ('FDDI-SMT73-MIB', 'fddimibMACUpstreamNbr'), ('FDDI-SMT73-MIB', 'fddimibMACDaFlag'), ('FDDI-SMT73-MIB', 'fddimibMACUnaDaFlag')) if mibBuilder.loadTexts: a3ComFddiMACDuplicateAddressCondition.setDescription('This condition is active when either fddiMACDA-Flag (fddimibMACDaFlag) or fddiMACUNDA-Flag (fddimibMACUnaDaFlag) is set. This event is handled as a Condition in the Status Report Protocol (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiMACDuplicateAddressCondition.setReference('ANSI { fddiMAC 140 }') a3_com_fddi_mac_frame_error_condition = notification_type((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0, 4)).setObjects(('FDDI-SMT73-MIB', 'fddimibSMTStationId'), ('FDDI-SMT73-MIB', 'fddimibMACFrameErrorFlag'), ('FDDI-SMT73-MIB', 'fddimibMACFrameCts'), ('FDDI-SMT73-MIB', 'fddimibMACErrorCts'), ('FDDI-SMT73-MIB', 'fddimibMACLostCts'), ('FDDI-SMT73-MIB', 'fddimibMACFrameErrorRatio')) if mibBuilder.loadTexts: a3ComFddiMACFrameErrorCondition.setDescription('Generated when the fddiMACFrameErrorRatio (fddimibMACFrameErrorRatio) is greater than or equal to fddiMACFrameErrorThreshold (fddimibMACFrameErrorThreshold). This event is handled as a Condition in the Status Report Protocol (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiMACFrameErrorCondition.setReference('ANSI { fddiMAC 141 }') a3_com_fddi_mac_not_copied_condition = notification_type((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0, 5)).setObjects(('FDDI-SMT73-MIB', 'fddimibSMTStationId'), ('FDDI-SMT73-MIB', 'fddimibMACNotCopiedCts'), ('FDDI-SMT73-MIB', 'fddimibMACCopiedCts'), ('FDDI-SMT73-MIB', 'fddimibMACNotCopiedRatio'), ('FDDI-SMT73-MIB', 'fddimibMACNotCopiedFlag')) if mibBuilder.loadTexts: a3ComFddiMACNotCopiedCondition.setDescription('Generated when the fddiMACNotCopiedRatio (fddimibMACNotCopiedRatio) is greater than or equal to the fddiMACNotCopiedThreshold (a3ComFddiMACNotCopiedThreshold). This event is handled as a Condition in the Status Report Protocol (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiMACNotCopiedCondition.setReference('ANSI { fddiMAC 142 }') a3_com_fddi_mac_neighbor_change_event = notification_type((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0, 6)).setObjects(('FDDI-SMT73-MIB', 'fddimibSMTStationId'), ('FDDI-SMT73-MIB', 'fddimibMACUpstreamNbr'), ('FDDI-SMT73-MIB', 'fddimibMACOldUpstreamNbr'), ('FDDI-SMT73-MIB', 'fddimibMACDownstreamNbr'), ('FDDI-SMT73-MIB', 'fddimibMACOldDownstreamNbr'), ('FDDI-SMT73-MIB', 'fddimibMACCurrentPath'), ('FDDI-SMT73-MIB', 'fddimibMACSMTAddress')) if mibBuilder.loadTexts: a3ComFddiMACNeighborChangeEvent.setDescription("Generated when a change in a MAC's upstream neighbor address or downstream neighbor address is detected. (see 7.2.7 and 8.3).") if mibBuilder.loadTexts: a3ComFddiMACNeighborChangeEvent.setReference('ANSI { fddiMAC 143 }') a3_com_fddi_mac_path_change_event = notification_type((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0, 7)).setObjects(('FDDI-SMT73-MIB', 'fddimibSMTStationId'), ('FDDI-SMT73-MIB', 'fddimibMACAvailablePaths'), ('FDDI-SMT73-MIB', 'fddimibMACCurrentPath'), ('FDDI-SMT73-MIB', 'fddimibMACRequestedPaths')) if mibBuilder.loadTexts: a3ComFddiMACPathChangeEvent.setDescription('This event is generated when the value of the fddiMACCurrentPath (fddimibMACCurrentPath) changes. This event shall be supressed if the value changes from isolated to local or local to isolated (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiMACPathChangeEvent.setReference('ANSI { fddiMAC 144 }') a3_com_fddi_port_ler_condition = notification_type((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0, 8)).setObjects(('FDDI-SMT73-MIB', 'fddimibSMTStationId'), ('FDDI-SMT73-MIB', 'fddimibPORTLerCutoff'), ('FDDI-SMT73-MIB', 'fddimibPORTLerAlarm'), ('FDDI-SMT73-MIB', 'fddimibPORTLerEstimate'), ('FDDI-SMT73-MIB', 'fddimibPORTLemRejectCts'), ('FDDI-SMT73-MIB', 'fddimibPORTLemCts'), ('FDDI-SMT73-MIB', 'fddimibPORTLerFlag')) if mibBuilder.loadTexts: a3ComFddiPORTLerCondition.setDescription('This condition becomes active when the value of fddiPORTLer-Estimate (fddimibPORTLerEstimate) is less than or equal to fddiPORTLer-Alarm (fddimibPORTLerAlarm). This will be reported with the Status Report Frames (SRF) (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiPORTLerCondition.setReference('ANSI { fddiPORT 80 }') a3_com_fddi_port_undesired_conn_attempt_event = notification_type((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0, 9)).setObjects(('FDDI-SMT73-MIB', 'fddimibSMTStationId'), ('FDDI-SMT73-MIB', 'fddimibPORTMyType'), ('FDDI-SMT73-MIB', 'fddimibPORTConnectState'), ('FDDI-SMT73-MIB', 'fddimibPORTNeighborType'), ('FDDI-SMT73-MIB', 'fddimibPORTPCWithhold')) if mibBuilder.loadTexts: a3ComFddiPORTUndesiredConnAttemptEvent.setDescription('Generated when an undesired connection attempt has been made (see 5.2.4, 7.2.7, and 8.3).') if mibBuilder.loadTexts: a3ComFddiPORTUndesiredConnAttemptEvent.setReference('ANSI { fddiPORT 81 }') a3_com_fddi_porteb_error_condition = notification_type((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0, 10)).setObjects(('FDDI-SMT73-MIB', 'fddimibSMTStationId'), ('A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiPORTEBErrorCt')) if mibBuilder.loadTexts: a3ComFddiPORTEBErrorCondition.setDescription("Generated when the Elasticity Buffer Error-Ct (a3ComFddiPORTEBErrorCt) increments. This is handled as a condition in the Status Report Protocol. It is generated when an increment occurs in the station's sampling period (see 7.2.7 and 8.3).") if mibBuilder.loadTexts: a3ComFddiPORTEBErrorCondition.setReference('ANSI { fddiPORT 82 }') a3_com_fddi_port_path_change_event = notification_type((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0, 11)).setObjects(('FDDI-SMT73-MIB', 'fddimibSMTStationId'), ('FDDI-SMT73-MIB', 'fddimibPORTAvailablePaths'), ('FDDI-SMT73-MIB', 'fddimibPORTCurrentPath'), ('FDDI-SMT73-MIB', 'fddimibPORTRequestedPaths'), ('FDDI-SMT73-MIB', 'fddimibPORTMyType'), ('FDDI-SMT73-MIB', 'fddimibPORTNeighborType')) if mibBuilder.loadTexts: a3ComFddiPORTPathChangeEvent.setDescription('This event is generated when the value of the fddiPORTCurrentPath (a3ComFddiPORTCurrentPath) changes. This event shall be surpressed if the value changes from isolated to local or local to isolated (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiPORTPathChangeEvent.setReference('ANSI { fddiPORT 83 }') mibBuilder.exportSymbols('A3COM-SWITCHING-SYSTEMS-FDDI-MIB', a3ComFddiPORT=a3ComFddiPORT, a3ComFddiPORTMaintLS=a3ComFddiPORTMaintLS, a3ComFddiPATHSbaTable=a3ComFddiPATHSbaTable, a3ComFddiSMT=a3ComFddiSMT, a3ComFddiPATHRingEntry=a3ComFddiPATHRingEntry, a3ComFddiPATHSbaPATHIndex=a3ComFddiPATHSbaPATHIndex, a3ComFddiPORTEntry=a3ComFddiPORTEntry, a3ComFddiMACDuplicateAddressCondition=a3ComFddiMACDuplicateAddressCondition, a3ComFddiMACPathChangeEvent=a3ComFddiMACPathChangeEvent, a3ComFddiPORTPCLS=a3ComFddiPORTPCLS, a3ComFddiSMTIndex=a3ComFddiSMTIndex, a3ComFddiMACTPri6=a3ComFddiMACTPri6, a3ComFddiPORTLSTable=a3ComFddiPORTLSTable, a3ComFddiMACBridgeFunctionSMTIndex=a3ComFddiMACBridgeFunctionSMTIndex, a3ComFddiPATHSbaOverhead=a3ComFddiPATHSbaOverhead, a3ComFddiPORTEBErrorCt=a3ComFddiPORTEBErrorCt, a3ComFddiSMTTable=a3ComFddiSMTTable, a3ComFddiPORTMACLoopTime=a3ComFddiPORTMACLoopTime, a3Com=a3Com, a3ComFddiSMTEntry=a3ComFddiSMTEntry, a3ComFddiSMTManufacturerOUI=a3ComFddiSMTManufacturerOUI, a3ComFddiMACTPriEntry=a3ComFddiMACTPriEntry, a3ComFddiMACTPri4=a3ComFddiMACTPri4, a3ComFddiPATHRingPATHIndex=a3ComFddiPATHRingPATHIndex, a3ComFddiPORTIndex=a3ComFddiPORTIndex, a3ComFddiPATHTraceStatus=a3ComFddiPATHTraceStatus, a3ComFddiMACNeighborChangeEvent=a3ComFddiMACNeighborChangeEvent, a3ComFddiPATHRingTable=a3ComFddiPATHRingTable, a3ComFddiSMTHoldCondition=a3ComFddiSMTHoldCondition, a3ComFddiMACNotCopiedCondition=a3ComFddiMACNotCopiedCondition, a3ComFddiSMTManufacturerData=a3ComFddiSMTManufacturerData, a3ComFddiPATHRingSMTIndex=a3ComFddiPATHRingSMTIndex, a3ComFddiPATHSbaAvailable=a3ComFddiPATHSbaAvailable, a3ComFddiMACBridgeFunctionEntry=a3ComFddiMACBridgeFunctionEntry, a3ComFddiPORTSMTIndex=a3ComFddiPORTSMTIndex, a3ComFddiMACTPri1=a3ComFddiMACTPri1, a3ComFddiPATHT_Rmode=a3ComFddiPATHT_Rmode, a3ComFddiPATHSbaSMTIndex=a3ComFddiPATHSbaSMTIndex, a3ComFddiMACBridgeFunctionMACIndex=a3ComFddiMACBridgeFunctionMACIndex, a3ComFddiPATH=a3ComFddiPATH, a3ComFddiMACTPri5=a3ComFddiMACTPri5, a3ComFddiPATHSbaPayload=a3ComFddiPATHSbaPayload, a3ComFddiSMTHoldState=a3ComFddiSMTHoldState, a3ComFddiPORTTable=a3ComFddiPORTTable, a3ComFddiSMTLastSetStationId=a3ComFddiSMTLastSetStationId, a3ComFddiMACBridgeFunctions=a3ComFddiMACBridgeFunctions, a3ComFddiMACTPriTable=a3ComFddiMACTPriTable, a3ComFddiSMTPeerWrapCondition=a3ComFddiSMTPeerWrapCondition, a3ComFddiPORTLSSMTIndex=a3ComFddiPORTLSSMTIndex, a3ComFddiPORTLSPORTIndex=a3ComFddiPORTLSPORTIndex, a3ComFddiPORTEBErrorCondition=a3ComFddiPORTEBErrorCondition, a3ComFddiMAC=a3ComFddiMAC, a3ComSwitchingSystemsFddiMib=a3ComSwitchingSystemsFddiMib, a3ComFddiMACFrameErrorCondition=a3ComFddiMACFrameErrorCondition, a3ComFddiPORTUndesiredConnAttemptEvent=a3ComFddiPORTUndesiredConnAttemptEvent, a3ComFddiMACTPri3=a3ComFddiMACTPri3, a3ComFddiSMTSetCount=a3ComFddiSMTSetCount, a3ComFddiMACTPriSMTIndex=a3ComFddiMACTPriSMTIndex, a3ComFddiMACTPri2=a3ComFddiMACTPri2, a3ComFddiPORTLSEntry=a3ComFddiPORTLSEntry, switchingSystemsMibs=switchingSystemsMibs, a3ComFddiPORTPathChangeEvent=a3ComFddiPORTPathChangeEvent, a3ComFddiPATHRingLatency=a3ComFddiPATHRingLatency, a3ComFddiMACBridgeFunctionTable=a3ComFddiMACBridgeFunctionTable, a3ComFddiPATHSbaEntry=a3ComFddiPATHSbaEntry, a3ComFddiPORTLerCondition=a3ComFddiPORTLerCondition, a3ComFddiMACTPri0=a3ComFddiMACTPri0, a3ComFddiMACTPriMACIndex=a3ComFddiMACTPriMACIndex)
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def __init__(self): self.result = [] def rightSideView(self, root): """ :type root: TreeNode :rtype: List[int] """ self.travel(root, 1) return self.result def travel(self, tree_node, depth): if tree_node is None: return if depth > len(self.result): self.result.append(tree_node.val) self.travel(tree_node.right, depth + 1) self.travel(tree_node.left, depth + 1)
class Solution(object): def __init__(self): self.result = [] def right_side_view(self, root): """ :type root: TreeNode :rtype: List[int] """ self.travel(root, 1) return self.result def travel(self, tree_node, depth): if tree_node is None: return if depth > len(self.result): self.result.append(tree_node.val) self.travel(tree_node.right, depth + 1) self.travel(tree_node.left, depth + 1)
N = int(input()) with open('applicant_list.txt', 'r') as f: data = f.readlines() data = [d.split() for d in data] for d in data: for i in range(2, 7): d[i] = float(d[i]) def sorting(data, count_b, count_c, count_e, count_m, count_p, pref, exam): """ exam = 2 --> phy --> phy + math exam = 3 --> chem --> chem exam = 4 --> math --> math exam = 5 --> eng --> eng + math exam = 6 --> bio --> chem + phy """ if exam == 2: data.sort(key=lambda x: (min(-(x[2] + x[4]) / 2, -x[6]), x[0], x[1])) if exam == 3: data.sort(key=lambda x: (min(-x[3], -x[6]), x[0], x[1])) if exam == 4: data.sort(key=lambda x: (min(-x[4], -x[6]), x[0], x[1])) if exam == 5: data.sort(key=lambda x: (min(-(x[5] + x[4]) / 2, -x[6]), x[0], x[1])) if exam == 6: data.sort(key=lambda x: (min(-(x[2] + x[3]) / 2, -x[6]), x[0], x[1])) for d in data: if 'Bio' in d[6 + pref] and exam == 6: if count_b < N: bio.append(d) count_b = count_b + 1 elif 'Chem' in d[6 + pref] and exam == 3: if count_c < N: chem.append(d) count_c = count_c + 1 elif 'Eng' in d[6 + pref] and exam == 5: if count_e < N: eng.append(d) count_e = count_e + 1 elif 'Math' in d[6 + pref] and exam == 4: if count_m < N: math.append(d) count_m = count_m + 1 elif 'Phy' in d[6 + pref] and exam == 2: if count_p < N: phy.append(d) count_p = count_p + 1 for s in bio: if s in data: data.remove(s) for s in chem: if s in data: data.remove(s) for s in eng: if s in data: data.remove(s) for s in math: if s in data: data.remove(s) for s in phy: if s in data: data.remove(s) return data, count_b, count_c, count_e, count_m, count_p bio = [] chem = [] eng = [] math = [] phy = [] count_b, count_c, count_e, count_m, count_p = 0, 0, 0, 0, 0 pref = 1 for exam in range(2, 7): data, count_b, count_c, count_e, count_m, count_p = sorting(data, count_b, count_c, count_e, count_m, count_p, pref, exam) pref = pref + 1 for exam in range(2, 7): data, count_b, count_c, count_e, count_m, count_p = sorting(data, count_b, count_c, count_e, count_m, count_p, pref, exam) pref = pref + 1 for exam in range(2, 7): data, count_b, count_c, count_e, count_m, count_p = sorting(data, count_b, count_c, count_e, count_m, count_p, pref, exam) bio.sort(key=lambda x: (min(-(x[2] + x[3]) / 2, -x[6]), x[0], x[1])) phy.sort(key=lambda x: (min(-(x[2] + x[4]) / 2, -x[6]), x[0], x[1])) chem.sort(key=lambda x: (min(-x[3], -x[6]), x[0], x[1])) math.sort(key=lambda x: (min(-x[4], -x[6]), x[0], x[1])) eng.sort(key=lambda x: (min(-(x[5] + x[4]) / 2, -x[6]), x[0], x[1])) with open('biotech.txt', 'w') as f: for s in bio: print(f"{s[0]} {s[1]} {max((s[2] + s[3]) / 2, s[6])}", file=f) with open('chemistry.txt', 'w') as f: for s in chem: print(f"{s[0]} {s[1]} {max(s[3], s[6])}", file=f) with open('engineering.txt', 'w') as f: for s in eng: print(f"{s[0]} {s[1]} {max((s[5] + s[4]) / 2, s[6])}", file=f) with open('mathematics.txt', 'w') as f: for s in math: print(f"{s[0]} {s[1]} {max(s[4], s[6])}", file=f) with open('physics.txt', 'w') as f: for s in phy: print(f"{s[0]} {s[1]} {max((s[2] + s[4]) / 2, s[6])}", file=f)
n = int(input()) with open('applicant_list.txt', 'r') as f: data = f.readlines() data = [d.split() for d in data] for d in data: for i in range(2, 7): d[i] = float(d[i]) def sorting(data, count_b, count_c, count_e, count_m, count_p, pref, exam): """ exam = 2 --> phy --> phy + math exam = 3 --> chem --> chem exam = 4 --> math --> math exam = 5 --> eng --> eng + math exam = 6 --> bio --> chem + phy """ if exam == 2: data.sort(key=lambda x: (min(-(x[2] + x[4]) / 2, -x[6]), x[0], x[1])) if exam == 3: data.sort(key=lambda x: (min(-x[3], -x[6]), x[0], x[1])) if exam == 4: data.sort(key=lambda x: (min(-x[4], -x[6]), x[0], x[1])) if exam == 5: data.sort(key=lambda x: (min(-(x[5] + x[4]) / 2, -x[6]), x[0], x[1])) if exam == 6: data.sort(key=lambda x: (min(-(x[2] + x[3]) / 2, -x[6]), x[0], x[1])) for d in data: if 'Bio' in d[6 + pref] and exam == 6: if count_b < N: bio.append(d) count_b = count_b + 1 elif 'Chem' in d[6 + pref] and exam == 3: if count_c < N: chem.append(d) count_c = count_c + 1 elif 'Eng' in d[6 + pref] and exam == 5: if count_e < N: eng.append(d) count_e = count_e + 1 elif 'Math' in d[6 + pref] and exam == 4: if count_m < N: math.append(d) count_m = count_m + 1 elif 'Phy' in d[6 + pref] and exam == 2: if count_p < N: phy.append(d) count_p = count_p + 1 for s in bio: if s in data: data.remove(s) for s in chem: if s in data: data.remove(s) for s in eng: if s in data: data.remove(s) for s in math: if s in data: data.remove(s) for s in phy: if s in data: data.remove(s) return (data, count_b, count_c, count_e, count_m, count_p) bio = [] chem = [] eng = [] math = [] phy = [] (count_b, count_c, count_e, count_m, count_p) = (0, 0, 0, 0, 0) pref = 1 for exam in range(2, 7): (data, count_b, count_c, count_e, count_m, count_p) = sorting(data, count_b, count_c, count_e, count_m, count_p, pref, exam) pref = pref + 1 for exam in range(2, 7): (data, count_b, count_c, count_e, count_m, count_p) = sorting(data, count_b, count_c, count_e, count_m, count_p, pref, exam) pref = pref + 1 for exam in range(2, 7): (data, count_b, count_c, count_e, count_m, count_p) = sorting(data, count_b, count_c, count_e, count_m, count_p, pref, exam) bio.sort(key=lambda x: (min(-(x[2] + x[3]) / 2, -x[6]), x[0], x[1])) phy.sort(key=lambda x: (min(-(x[2] + x[4]) / 2, -x[6]), x[0], x[1])) chem.sort(key=lambda x: (min(-x[3], -x[6]), x[0], x[1])) math.sort(key=lambda x: (min(-x[4], -x[6]), x[0], x[1])) eng.sort(key=lambda x: (min(-(x[5] + x[4]) / 2, -x[6]), x[0], x[1])) with open('biotech.txt', 'w') as f: for s in bio: print(f'{s[0]} {s[1]} {max((s[2] + s[3]) / 2, s[6])}', file=f) with open('chemistry.txt', 'w') as f: for s in chem: print(f'{s[0]} {s[1]} {max(s[3], s[6])}', file=f) with open('engineering.txt', 'w') as f: for s in eng: print(f'{s[0]} {s[1]} {max((s[5] + s[4]) / 2, s[6])}', file=f) with open('mathematics.txt', 'w') as f: for s in math: print(f'{s[0]} {s[1]} {max(s[4], s[6])}', file=f) with open('physics.txt', 'w') as f: for s in phy: print(f'{s[0]} {s[1]} {max((s[2] + s[4]) / 2, s[6])}', file=f)
# Huu Hung Nguyen # 12/07/2021 # Nguyen_HuuHung_freq_distribution.py # The program takes a numbers list and creates a frequency distribution table. # It then display the frequency distribution table. def get_max(data_list): ''' Take a data list and return its maximum data. ''' # Determine the number having in the data list n = len(data_list) # Check whether the data list is empty if n == 0: max_data = 0 else: # Initialize a maximum value max_data = data_list[0] for data in data_list[1:]: if data > max_data: max_data = data return max_data def get_min(data_list): ''' Take a data list and return its minimum data. ''' # Determine the number having in the data list n = len(data_list) # Check whether the data list is empty if n == 0: min_data = 0 else: # Initialize a minimum value min_data = data_list[0] for data in data_list[1:]: if data < min_data: min_data = data return min_data def display_counts(data_list, categories, min, max): ''' Take a data list, categories, min and max values Display counts. ''' # Determine the value between ranges category_size = (max - min) // categories # Determine the sorted data sorted_data = sorted(data_list) # Initialize a positionition, a counting, and a sum counting position = 0 count = 0 sum_count = 0 print('Frequency Distribution Table:') for data in sorted_data: # Check whether the data is out of the ranges if data < min or data > max: sorted_data.remove(data) else: again = True # Keep checking the data until it is in a range while again: # Determine the start and end of each range start = min + category_size * position end = start + category_size # Check whether the next end is out of the range if end + category_size > max: end = max + 1 # Check whether the data is in the range if data in range(start, end): # Add up 1 to the counting if the data is in the range count += 1 again = False else: # Display the range and its counting print(f'{start}-{end - 1}: {count}') # Calculate the sum counting sum_count += count # Determine the next position and the next counting position += 1 count = 0 # Display the last range and its counting print(f'{start}-{end - 1}: {len(sorted_data) - sum_count}') def main(): ''' Define main function. ''' # Prompt the user for a list of numbers separated by a comma input_prompt = 'Enter numbers separated by a comma: ' data_list = [int(number) for number in input(input_prompt).split(',')] # data_list = [35, 37, 19, 45, 49, 68, 95, 7, 5, 82, 84] # sorted_data = [5, 7, 19, 35, 37, 45, 49, 68, 82, 84, 95] # Display the ranges and its counting display_counts(data_list, 5, 0, 100) print('-----------') display_counts(data_list, 4, get_min(data_list), get_max(data_list)) # Call main fucntion main()
def get_max(data_list): """ Take a data list and return its maximum data. """ n = len(data_list) if n == 0: max_data = 0 else: max_data = data_list[0] for data in data_list[1:]: if data > max_data: max_data = data return max_data def get_min(data_list): """ Take a data list and return its minimum data. """ n = len(data_list) if n == 0: min_data = 0 else: min_data = data_list[0] for data in data_list[1:]: if data < min_data: min_data = data return min_data def display_counts(data_list, categories, min, max): """ Take a data list, categories, min and max values Display counts. """ category_size = (max - min) // categories sorted_data = sorted(data_list) position = 0 count = 0 sum_count = 0 print('Frequency Distribution Table:') for data in sorted_data: if data < min or data > max: sorted_data.remove(data) else: again = True while again: start = min + category_size * position end = start + category_size if end + category_size > max: end = max + 1 if data in range(start, end): count += 1 again = False else: print(f'{start}-{end - 1}: {count}') sum_count += count position += 1 count = 0 print(f'{start}-{end - 1}: {len(sorted_data) - sum_count}') def main(): """ Define main function. """ input_prompt = 'Enter numbers separated by a comma: ' data_list = [int(number) for number in input(input_prompt).split(',')] display_counts(data_list, 5, 0, 100) print('-----------') display_counts(data_list, 4, get_min(data_list), get_max(data_list)) main()
n = int(input()) data = list(map(int,input().split())) one , two , three = [] , [] , [] for i in range(len(data)): if data[i] == 1: one.append(i+1) elif data[i] == 2: two.append(i+1) else: three.append(i+1) teams = min(len(one),len(two),len(three)) print(teams) for i in range(teams): print(*[one[i],two[i],three[i]])
n = int(input()) data = list(map(int, input().split())) (one, two, three) = ([], [], []) for i in range(len(data)): if data[i] == 1: one.append(i + 1) elif data[i] == 2: two.append(i + 1) else: three.append(i + 1) teams = min(len(one), len(two), len(three)) print(teams) for i in range(teams): print(*[one[i], two[i], three[i]])
one_char = ["!", "#", "%", "&", "\\", "'", "(", ")", "*", "+", "-", ".", "/", ":", ";", "<", "=", ">", "?", "[", "]", "^", "{", "|", "}", "~", ","] # they must be ordered by length decreasing multi_char = ["...", "::", ">>=", "<<=", ">>>", "<<<", "===", "!=", "==", "===", "<=", ">=", "*=", "&&", "-=", "+=", "||", "--", "++", "|=", "&=", "%=", "/=", "^=", "::"] # it counts the number of slash before a specific position (used to check if " or ' are escaped or not) def count_slash(ss, position): count = 0; pos = position - 1 try: while ss[pos] == "\\": count += 1 pos -= 1 except: pass return count # given a line of code, it retrieves the start end the end position for each string def get_strings(code): start = list() end = list() start_string = False for i, c in enumerate(code): if c == "\"": num_slash = count_slash(code, i) if num_slash % 2 == 0 and start_string: end.append(i) start_string = False elif num_slash % 2 == 0: start.append(i) start_string = True return start, end # given a line of code, it retrieves the start end the end position for each char (e.g. 'c') def get_chars(code): start = list() end = list() start_string = False for i, c in enumerate(code): if c == "'": num_slash = count_slash(code, i) if num_slash % 2 == 0 and start_string: end.append(i) start_string = False elif num_slash % 2 == 0: start.append(i) start_string = True return start, end # tokenizer (given a line of code, it returns the list of tokens) def tokenize(code): mask = code.replace("<z>", "") s, e = get_strings(mask) dict_string = dict() dict_chars = dict() delay = 0 # replace each string with a placeholder for i, (a, b) in enumerate(zip(s, e)): dict_string[i] = mask[a:b + 1] mask = mask[:a + delay] + " ___STRING___" + str(i) + "__ " + mask[b + 1 + delay:] delay = len(" ___STRING___" + str(i) + "__ ") - (b + 1 - a) s, e = get_chars(mask) # replace each char with a placeholder for i, (a, b) in enumerate(zip(s, e)): dict_chars[i] = mask[a:b + 1] mask = mask[:a + delay] + " ___CHARS___" + str(i) + "__ " + mask[b + 1 + delay:] delay = len(" ___CHARS___" + str(i) + "__ ") - (b + 1 - a) # replace each char with multiple chars with a placeholder for i, c in enumerate(multi_char): mask = mask.replace(c, " " + "__ID__" + str(i) + "__ ") # add a space before and after each char for c in one_char: if c == ".": # it should be a number (0.09) index_ = [i for i, ltr in enumerate(mask) if ltr == c] # print(index_) for i in index_: try: if mask[i + 1].isnumeric(): continue else: mask = mask.replace(c, " " + c + " ") except: pass else: mask = mask.replace(c, " " + c + " ") # remove all multichars' placeholders for i, c in enumerate(multi_char): mask = mask.replace("__ID__" + str(i) + "__", c) # removing double spaces while " " in mask: mask = mask.replace(" ", " ") mask = mask.strip() # retrieving the list of tokens tokens = mask.split(" ") for t in tokens: try: if "___STRING___" in t: curr = t.replace("___STRING___", "").replace("__", "") t = dict_string[int(curr)] if "___CHARS___" in t: curr = t.replace("___CHARS___", "").replace("__", "") t = dict_chars[int(curr)] except: pass # if len(mask.split(" ")) != int(real_length[key]): # print(len(mask.split(" ")), real_length[temp[0]]) # print(code, mask, mask.split(" ")) return tokens
one_char = ['!', '#', '%', '&', '\\', "'", '(', ')', '*', '+', '-', '.', '/', ':', ';', '<', '=', '>', '?', '[', ']', '^', '{', '|', '}', '~', ','] multi_char = ['...', '::', '>>=', '<<=', '>>>', '<<<', '===', '!=', '==', '===', '<=', '>=', '*=', '&&', '-=', '+=', '||', '--', '++', '|=', '&=', '%=', '/=', '^=', '::'] def count_slash(ss, position): count = 0 pos = position - 1 try: while ss[pos] == '\\': count += 1 pos -= 1 except: pass return count def get_strings(code): start = list() end = list() start_string = False for (i, c) in enumerate(code): if c == '"': num_slash = count_slash(code, i) if num_slash % 2 == 0 and start_string: end.append(i) start_string = False elif num_slash % 2 == 0: start.append(i) start_string = True return (start, end) def get_chars(code): start = list() end = list() start_string = False for (i, c) in enumerate(code): if c == "'": num_slash = count_slash(code, i) if num_slash % 2 == 0 and start_string: end.append(i) start_string = False elif num_slash % 2 == 0: start.append(i) start_string = True return (start, end) def tokenize(code): mask = code.replace('<z>', '') (s, e) = get_strings(mask) dict_string = dict() dict_chars = dict() delay = 0 for (i, (a, b)) in enumerate(zip(s, e)): dict_string[i] = mask[a:b + 1] mask = mask[:a + delay] + ' ___STRING___' + str(i) + '__ ' + mask[b + 1 + delay:] delay = len(' ___STRING___' + str(i) + '__ ') - (b + 1 - a) (s, e) = get_chars(mask) for (i, (a, b)) in enumerate(zip(s, e)): dict_chars[i] = mask[a:b + 1] mask = mask[:a + delay] + ' ___CHARS___' + str(i) + '__ ' + mask[b + 1 + delay:] delay = len(' ___CHARS___' + str(i) + '__ ') - (b + 1 - a) for (i, c) in enumerate(multi_char): mask = mask.replace(c, ' ' + '__ID__' + str(i) + '__ ') for c in one_char: if c == '.': index_ = [i for (i, ltr) in enumerate(mask) if ltr == c] for i in index_: try: if mask[i + 1].isnumeric(): continue else: mask = mask.replace(c, ' ' + c + ' ') except: pass else: mask = mask.replace(c, ' ' + c + ' ') for (i, c) in enumerate(multi_char): mask = mask.replace('__ID__' + str(i) + '__', c) while ' ' in mask: mask = mask.replace(' ', ' ') mask = mask.strip() tokens = mask.split(' ') for t in tokens: try: if '___STRING___' in t: curr = t.replace('___STRING___', '').replace('__', '') t = dict_string[int(curr)] if '___CHARS___' in t: curr = t.replace('___CHARS___', '').replace('__', '') t = dict_chars[int(curr)] except: pass return tokens
class MachopCommand(object): def shutdown(self): pass def cleanup(self): pass
class Machopcommand(object): def shutdown(self): pass def cleanup(self): pass
INPUT_SCHEMA = { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Deriva Demo Input", "description": ("Input schema for the demo DERIVA ingest Action Provider. This Action " "Provider can restore a DERIVA backup to a new or existing catalog, " "or create a new DERIVA catalog from a BDBag containing TableSchema."), "type": "object", "oneOf": [{ "properties": { "restore_url": { "type": "string", "format": "uri", "description": "The URL of the DERIVA restore data, for a restore operation." }, "restore_catalog": { "type": "string", "description": ("The DERIVA catalog to restore into. If a catalog is specified, " "the catalog must already exist for the restore to succeed.") } }, "required": [ "restore_url" ] }, { "properties": { "ingest_url": { "type": "string", "format": "uri", "description": ("The URL to the BDBag containing TableSchema to ingest " "into a new catalog.") }, "ingest_catalog_acls": { "type": "object", "description": ("The DERIVA permissions to apply to the new catalog. " "If no ACLs are provided here, default ones will be used."), "properties": { "owner": { "type": "array", "description": "Formatted UUIDs for 'owner' permissions.", "items": { "type": "string", "description": "One UUID" } }, "insert": { "type": "array", "description": "Formatted UUIDs for 'insert' permissions.", "items": { "type": "string", "description": "One UUID" } }, "update": { "type": "array", "description": "Formatted UUIDs for 'update' permissions.", "items": { "type": "string", "description": "One UUID" } }, "delete": { "type": "array", "description": "Formatted UUIDs for 'delete' permissions.", "items": { "type": "string", "description": "One UUID" } }, "select": { "type": "array", "description": "Formatted UUIDs for 'select' permissions.", "items": { "type": "string", "description": "One UUID" } }, "enumerate": { "type": "array", "description": "Formatted UUIDs for 'enumerate' permissions.", "items": { "type": "string", "description": "One UUID" } } } } }, "required": [ "ingest_url" ] }] } # TODO OUTPUT_SCHEMA = { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Deriva Demo Output", "description": "Output schema for the demo Deriva ingest Action Provider.", "type": "object", "properties": { }, "required": [ ] }
input_schema = {'$schema': 'http://json-schema.org/draft-04/schema#', 'title': 'Deriva Demo Input', 'description': 'Input schema for the demo DERIVA ingest Action Provider. This Action Provider can restore a DERIVA backup to a new or existing catalog, or create a new DERIVA catalog from a BDBag containing TableSchema.', 'type': 'object', 'oneOf': [{'properties': {'restore_url': {'type': 'string', 'format': 'uri', 'description': 'The URL of the DERIVA restore data, for a restore operation.'}, 'restore_catalog': {'type': 'string', 'description': 'The DERIVA catalog to restore into. If a catalog is specified, the catalog must already exist for the restore to succeed.'}}, 'required': ['restore_url']}, {'properties': {'ingest_url': {'type': 'string', 'format': 'uri', 'description': 'The URL to the BDBag containing TableSchema to ingest into a new catalog.'}, 'ingest_catalog_acls': {'type': 'object', 'description': 'The DERIVA permissions to apply to the new catalog. If no ACLs are provided here, default ones will be used.', 'properties': {'owner': {'type': 'array', 'description': "Formatted UUIDs for 'owner' permissions.", 'items': {'type': 'string', 'description': 'One UUID'}}, 'insert': {'type': 'array', 'description': "Formatted UUIDs for 'insert' permissions.", 'items': {'type': 'string', 'description': 'One UUID'}}, 'update': {'type': 'array', 'description': "Formatted UUIDs for 'update' permissions.", 'items': {'type': 'string', 'description': 'One UUID'}}, 'delete': {'type': 'array', 'description': "Formatted UUIDs for 'delete' permissions.", 'items': {'type': 'string', 'description': 'One UUID'}}, 'select': {'type': 'array', 'description': "Formatted UUIDs for 'select' permissions.", 'items': {'type': 'string', 'description': 'One UUID'}}, 'enumerate': {'type': 'array', 'description': "Formatted UUIDs for 'enumerate' permissions.", 'items': {'type': 'string', 'description': 'One UUID'}}}}}, 'required': ['ingest_url']}]} output_schema = {'$schema': 'http://json-schema.org/draft-04/schema#', 'title': 'Deriva Demo Output', 'description': 'Output schema for the demo Deriva ingest Action Provider.', 'type': 'object', 'properties': {}, 'required': []}
class TestClassConverter: @classmethod def setup_class(cls): print("\nsetup_class: setup any state specific to the execution of the given class\n") @classmethod def teardown_class(cls): print("\nteardown_class: teardown any state that was previously setup with a call to setup_class.\n") def setup_method(self, method): print("\nsetup_method: setup_method is invoked for every test method of a class.\n") def teardown_method(self, method): print("\nteardown_method: teardown any state that was previously setup with a setup_method call.\n") def test_sanity(self): assert 1 == 1
class Testclassconverter: @classmethod def setup_class(cls): print('\nsetup_class: setup any state specific to the execution of the given class\n') @classmethod def teardown_class(cls): print('\nteardown_class: teardown any state that was previously setup with a call to setup_class.\n') def setup_method(self, method): print('\nsetup_method: setup_method is invoked for every test method of a class.\n') def teardown_method(self, method): print('\nteardown_method: teardown any state that was previously setup with a setup_method call.\n') def test_sanity(self): assert 1 == 1
# model settings norm_cfg = dict(type='GN', num_groups=32, requires_grad=True) model = dict( type='TDN', pretrained='modelzoo://resnet50', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, style='pytorch'), neck=dict( type='FPN', in_channels=[256, 512, 1024, 2048], out_channels=256, num_outs=5), rpn_head=dict( type='RPNHead', in_channels=256, feat_channels=256, anchor_scales=[8], anchor_ratios=[0.5, 1.0, 2.0], anchor_strides=[4, 8, 16, 32, 64], target_means=[.0, .0, .0, .0], target_stds=[1.0, 1.0, 1.0, 1.0], loss_cls=dict( type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0), loss_bbox=dict(type='SmoothL1Loss', beta=1.0 / 9.0, loss_weight=1.0)), bbox_roi_extractor=dict( type='SingleRoIExtractor', roi_layer=dict(type='RoIAlign', out_size=7, sample_num=2), out_channels=256, featmap_strides=[4, 8, 16, 32]), bbox_head=dict( type='SharedFCBBoxHead', num_fcs=2, in_channels=256, fc_out_channels=1024, roi_feat_size=7, num_classes=4, target_means=[0., 0., 0., 0.], target_stds=[0.1, 0.1, 0.2, 0.2], reg_class_agnostic=True, loss_cls=dict( type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0), loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)), prop_track_roi_extractor=dict( type='SingleRoIExtractor', roi_layer=dict(type='RoIAlign', out_size=7, sample_num=2), out_channels=801, featmap_strides=[4, 8, 16, 32]), prop_track_head=dict( type='PropRegTrackHead', num_shared_convs=4, num_shared_fcs=1, in_channels=801, fc_out_channels=1024, num_classes=2, reg_class_agnostic=True, target_means=[.0, .0, .0, .0], target_stds=[0.1, 0.1, 0.2, 0.2], norm_cfg=norm_cfg, loss_cls=dict( type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0), loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)), asso_track_roi_extractor=dict( type='SingleRoIExtractor', roi_layer=dict(type='RoIAlign', out_size=7, sample_num=2), out_channels=256, featmap_strides=[4, 8, 16, 32]), asso_track_head=dict( type='AssoAppearTrackHead', num_convs=4, num_fcs=1, in_channels=256, roi_feat_size=7, fc_out_channels=1024, norm_cfg=norm_cfg, norm_similarity=False, loss_asso=dict( type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)), freeze_exclude_tracker=False, corr_params=dict( patch_size=17, kernel_size=1, padding=0, stride=1, dilation_patch=1)) # model training and testing settings train_cfg = dict( rpn=dict( assigner=dict( type='MaxIoUAssigner', pos_iou_thr=0.7, neg_iou_thr=0.3, min_pos_iou=0.3, ignore_iof_thr=-1), sampler=dict( type='RandomSampler', num=256, pos_fraction=0.5, neg_pos_ub=-1, add_gt_as_proposals=False), allowed_border=0, pos_weight=-1, debug=False), rpn_proposal=dict( nms_across_levels=False, nms_pre=2000, nms_post=2000, max_num=2000, nms_thr=0.7, min_bbox_size=0), rcnn=dict( assigner=dict( type='MaxIoUAssigner', pos_iou_thr=0.5, neg_iou_thr=0.5, min_pos_iou=0.5, ignore_iof_thr=-1), sampler=dict( type='RandomSampler', num=512, pos_fraction=0.25, neg_pos_ub=-1, add_gt_as_proposals=True), pos_weight=-1, debug=False), track=dict(asso_use_neg=False)) test_cfg = dict( rpn=dict( nms_across_levels=False, nms_pre=1000, nms_post=1000, max_num=1000, nms_thr=0.7, min_bbox_size=0), rcnn=dict( score_thr=0.05, nms=dict(type='nms', iou_thr=0.5), max_per_img=100), # soft-nms is also supported for rcnn testing # e.g., nms=dict(type='soft_nms', iou_thr=0.5, min_score=0.05) track=dict( new_obj_score_thre=0.8, clean_before_short_assign=False, clean_before_long_assign=True, prop_overlap_thre=0.6, prop_score_thre=0.6, use_reid=True, long_term_frames=15, asso_score_thre=0.6, embed_momentum=0.5, prop_fn=False, update_score=True, plot_track_results=False)) # dataset settings dataset_type = 'BDDVideo' data_root = 'data/BDD/BDD_Tracking/' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) data = dict( imgs_per_gpu=2, workers_per_gpu=2, train=dict( type=dataset_type, ann_file=data_root + 'annotations/bdd_tracking_train_0918.json', img_prefix=data_root + 'images/train/', img_scale=(1296, 720), img_norm_cfg=img_norm_cfg, size_divisor=32, flip_ratio=0.5, with_mask=False, with_track=True, with_crowd=True, with_label=True, train_sample_interval=3), val=dict( type=dataset_type, ann_file=data_root + 'annotations/mini_val_0918.json', img_prefix=data_root + 'images/val/', img_scale=(1296, 720), img_norm_cfg=img_norm_cfg, size_divisor=32, flip_ratio=0, with_mask=False, with_crowd=True, with_label=True, with_track=True), test=dict( type=dataset_type, ann_file=data_root + 'annotations/bdd_tracking_val_0918.json', img_prefix=data_root + 'images/val/', img_scale=(1296, 720), img_norm_cfg=img_norm_cfg, size_divisor=32, flip_ratio=0, with_mask=False, with_label=False, test_mode=True, with_track=True)) # optimizer optimizer = dict( type='SGD', lr=0.0004, momentum=0.9, weight_decay=0.0001, track_enhance=10) optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) # learning policy lr_config = dict( policy='step', warmup='exp', warmup_iters=2000, warmup_ratio=1.0 / 10.0, step=[5, 7]) checkpoint_config = dict(interval=1) # yapf:disable log_config = dict( interval=20, hooks=[ dict(type='TextLoggerHook'), # dict(type='TensorboardLoggerHook') ]) # yapf:enable # runtime settings total_epochs = 8 dist_params = dict(backend='nccl') log_level = 'INFO' load_from = 'data/init_models/frcnn_r50_bdd100k_cls3_1x-65034c1b.pth' # load_from = 'data/init_models/tdn_lr10-b3211c74.pth' work_dir = './work_dirs/debug/' resume_from = None workflow = [('train', 1)]
norm_cfg = dict(type='GN', num_groups=32, requires_grad=True) model = dict(type='TDN', pretrained='modelzoo://resnet50', backbone=dict(type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, style='pytorch'), neck=dict(type='FPN', in_channels=[256, 512, 1024, 2048], out_channels=256, num_outs=5), rpn_head=dict(type='RPNHead', in_channels=256, feat_channels=256, anchor_scales=[8], anchor_ratios=[0.5, 1.0, 2.0], anchor_strides=[4, 8, 16, 32, 64], target_means=[0.0, 0.0, 0.0, 0.0], target_stds=[1.0, 1.0, 1.0, 1.0], loss_cls=dict(type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0), loss_bbox=dict(type='SmoothL1Loss', beta=1.0 / 9.0, loss_weight=1.0)), bbox_roi_extractor=dict(type='SingleRoIExtractor', roi_layer=dict(type='RoIAlign', out_size=7, sample_num=2), out_channels=256, featmap_strides=[4, 8, 16, 32]), bbox_head=dict(type='SharedFCBBoxHead', num_fcs=2, in_channels=256, fc_out_channels=1024, roi_feat_size=7, num_classes=4, target_means=[0.0, 0.0, 0.0, 0.0], target_stds=[0.1, 0.1, 0.2, 0.2], reg_class_agnostic=True, loss_cls=dict(type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0), loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)), prop_track_roi_extractor=dict(type='SingleRoIExtractor', roi_layer=dict(type='RoIAlign', out_size=7, sample_num=2), out_channels=801, featmap_strides=[4, 8, 16, 32]), prop_track_head=dict(type='PropRegTrackHead', num_shared_convs=4, num_shared_fcs=1, in_channels=801, fc_out_channels=1024, num_classes=2, reg_class_agnostic=True, target_means=[0.0, 0.0, 0.0, 0.0], target_stds=[0.1, 0.1, 0.2, 0.2], norm_cfg=norm_cfg, loss_cls=dict(type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0), loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)), asso_track_roi_extractor=dict(type='SingleRoIExtractor', roi_layer=dict(type='RoIAlign', out_size=7, sample_num=2), out_channels=256, featmap_strides=[4, 8, 16, 32]), asso_track_head=dict(type='AssoAppearTrackHead', num_convs=4, num_fcs=1, in_channels=256, roi_feat_size=7, fc_out_channels=1024, norm_cfg=norm_cfg, norm_similarity=False, loss_asso=dict(type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)), freeze_exclude_tracker=False, corr_params=dict(patch_size=17, kernel_size=1, padding=0, stride=1, dilation_patch=1)) train_cfg = dict(rpn=dict(assigner=dict(type='MaxIoUAssigner', pos_iou_thr=0.7, neg_iou_thr=0.3, min_pos_iou=0.3, ignore_iof_thr=-1), sampler=dict(type='RandomSampler', num=256, pos_fraction=0.5, neg_pos_ub=-1, add_gt_as_proposals=False), allowed_border=0, pos_weight=-1, debug=False), rpn_proposal=dict(nms_across_levels=False, nms_pre=2000, nms_post=2000, max_num=2000, nms_thr=0.7, min_bbox_size=0), rcnn=dict(assigner=dict(type='MaxIoUAssigner', pos_iou_thr=0.5, neg_iou_thr=0.5, min_pos_iou=0.5, ignore_iof_thr=-1), sampler=dict(type='RandomSampler', num=512, pos_fraction=0.25, neg_pos_ub=-1, add_gt_as_proposals=True), pos_weight=-1, debug=False), track=dict(asso_use_neg=False)) test_cfg = dict(rpn=dict(nms_across_levels=False, nms_pre=1000, nms_post=1000, max_num=1000, nms_thr=0.7, min_bbox_size=0), rcnn=dict(score_thr=0.05, nms=dict(type='nms', iou_thr=0.5), max_per_img=100), track=dict(new_obj_score_thre=0.8, clean_before_short_assign=False, clean_before_long_assign=True, prop_overlap_thre=0.6, prop_score_thre=0.6, use_reid=True, long_term_frames=15, asso_score_thre=0.6, embed_momentum=0.5, prop_fn=False, update_score=True, plot_track_results=False)) dataset_type = 'BDDVideo' data_root = 'data/BDD/BDD_Tracking/' img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) data = dict(imgs_per_gpu=2, workers_per_gpu=2, train=dict(type=dataset_type, ann_file=data_root + 'annotations/bdd_tracking_train_0918.json', img_prefix=data_root + 'images/train/', img_scale=(1296, 720), img_norm_cfg=img_norm_cfg, size_divisor=32, flip_ratio=0.5, with_mask=False, with_track=True, with_crowd=True, with_label=True, train_sample_interval=3), val=dict(type=dataset_type, ann_file=data_root + 'annotations/mini_val_0918.json', img_prefix=data_root + 'images/val/', img_scale=(1296, 720), img_norm_cfg=img_norm_cfg, size_divisor=32, flip_ratio=0, with_mask=False, with_crowd=True, with_label=True, with_track=True), test=dict(type=dataset_type, ann_file=data_root + 'annotations/bdd_tracking_val_0918.json', img_prefix=data_root + 'images/val/', img_scale=(1296, 720), img_norm_cfg=img_norm_cfg, size_divisor=32, flip_ratio=0, with_mask=False, with_label=False, test_mode=True, with_track=True)) optimizer = dict(type='SGD', lr=0.0004, momentum=0.9, weight_decay=0.0001, track_enhance=10) optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) lr_config = dict(policy='step', warmup='exp', warmup_iters=2000, warmup_ratio=1.0 / 10.0, step=[5, 7]) checkpoint_config = dict(interval=1) log_config = dict(interval=20, hooks=[dict(type='TextLoggerHook')]) total_epochs = 8 dist_params = dict(backend='nccl') log_level = 'INFO' load_from = 'data/init_models/frcnn_r50_bdd100k_cls3_1x-65034c1b.pth' work_dir = './work_dirs/debug/' resume_from = None workflow = [('train', 1)]
# convert a decimal number to bukiyip. def decimal_to_bukiyip(a): bukiyip = '' quotient = 2000000 while quotient > 0: quotient = a // 3 remainder = a % 3 bukiyip += str(remainder) a = quotient return bukiyip[::-1] # convert a bukiyip number to decimal def bukiyip_to_decimal(a): decimal = 0 string_a = str(a) power = 0 for i in string_a[::-1]: decimal += int(i) * pow(3, power) power += 1 return int(decimal) # add two Bukiyip numbers. def bukiyip_add(a, b): return decimal_to_bukiyip(bukiyip_to_decimal(a) + bukiyip_to_decimal(b)) # multiply two Bukiyip numbers. def bukiyip_multiply(a, b): return decimal_to_bukiyip(bukiyip_to_decimal(a) * bukiyip_to_decimal(b))
def decimal_to_bukiyip(a): bukiyip = '' quotient = 2000000 while quotient > 0: quotient = a // 3 remainder = a % 3 bukiyip += str(remainder) a = quotient return bukiyip[::-1] def bukiyip_to_decimal(a): decimal = 0 string_a = str(a) power = 0 for i in string_a[::-1]: decimal += int(i) * pow(3, power) power += 1 return int(decimal) def bukiyip_add(a, b): return decimal_to_bukiyip(bukiyip_to_decimal(a) + bukiyip_to_decimal(b)) def bukiyip_multiply(a, b): return decimal_to_bukiyip(bukiyip_to_decimal(a) * bukiyip_to_decimal(b))
# -*- coding: utf-8 -*- # Authors: Y. Jia <ytjia.zju@gmail.com> """ Sort a linked list in O(n log n) time using constant space complexity. https://leetcode.com/problems/sort-list/description/ """ # Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def sortList(self, head): """ :type head: ListNode :rtype: ListNode """ if head is None or head.next is None: return head p = head count = 1 while p.next: count += 1 p = p.next return self.merge_sort(head, count) def merge(self, h_a, h_b): p_a = h_a p_b = h_b pre_m = ListNode(0) p_m = pre_m while p_a and p_b: if p_a.val < p_b.val: p_m.next = p_a p_m = p_m.next p_a = p_a.next else: p_m.next = p_b p_m = p_m.next p_b = p_b.next if p_a: p_m.next = p_a else: p_m.next = p_b return pre_m.next def merge_sort(self, head, length): if head.next: mid = length / 2 h_a = head t = head for i in range(mid - 1): t = t.next h_b = t.next t.next = None return self.merge(self.merge_sort(h_a, mid), self.merge_sort(h_b, length - mid)) else: return head
""" Sort a linked list in O(n log n) time using constant space complexity. https://leetcode.com/problems/sort-list/description/ """ class Listnode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def sort_list(self, head): """ :type head: ListNode :rtype: ListNode """ if head is None or head.next is None: return head p = head count = 1 while p.next: count += 1 p = p.next return self.merge_sort(head, count) def merge(self, h_a, h_b): p_a = h_a p_b = h_b pre_m = list_node(0) p_m = pre_m while p_a and p_b: if p_a.val < p_b.val: p_m.next = p_a p_m = p_m.next p_a = p_a.next else: p_m.next = p_b p_m = p_m.next p_b = p_b.next if p_a: p_m.next = p_a else: p_m.next = p_b return pre_m.next def merge_sort(self, head, length): if head.next: mid = length / 2 h_a = head t = head for i in range(mid - 1): t = t.next h_b = t.next t.next = None return self.merge(self.merge_sort(h_a, mid), self.merge_sort(h_b, length - mid)) else: return head
expected_output = { 'type': { 'IP route': { 'address': '10.21.12.0', 'mask': '255.255.255.0', 'state': 'Down', 'state_description': 'no ip route', 'delayed': { 'delayed_state': 'Up', 'secs_remaining': 1.0, 'connection_state': 'connected', }, 'change_count': 1, 'last_change': '00:00:24', } }, 'delay_up_secs': 20.0, 'delay_down_secs': 10.0, 'first_hop_interface_state': 'unknown', 'prev_first_hop_interface': 'Ethernet1/0', 'tracked_by': { 1: { 'name': 'HSRP', 'interface': 'Ethernet0/0', 'group_id': '3' }, 2: { 'name': 'HSRP', 'interface': 'Ethernet0/1', 'group_id': '3' } } }
expected_output = {'type': {'IP route': {'address': '10.21.12.0', 'mask': '255.255.255.0', 'state': 'Down', 'state_description': 'no ip route', 'delayed': {'delayed_state': 'Up', 'secs_remaining': 1.0, 'connection_state': 'connected'}, 'change_count': 1, 'last_change': '00:00:24'}}, 'delay_up_secs': 20.0, 'delay_down_secs': 10.0, 'first_hop_interface_state': 'unknown', 'prev_first_hop_interface': 'Ethernet1/0', 'tracked_by': {1: {'name': 'HSRP', 'interface': 'Ethernet0/0', 'group_id': '3'}, 2: {'name': 'HSRP', 'interface': 'Ethernet0/1', 'group_id': '3'}}}
# Open terminal > python3 condition.py # Start typing below commands and see the output x = int(input('Please enter an integer: ')) if x < 0: print(str(x) + ' is a negative number') elif x == 0: print(str(x) + ' is zero') else: print(str(x) + ' is a positive number')
x = int(input('Please enter an integer: ')) if x < 0: print(str(x) + ' is a negative number') elif x == 0: print(str(x) + ' is zero') else: print(str(x) + ' is a positive number')
""" Calculator library containing basic math operations. """ class Calculator: def add(self, first_term, second_term): return first_term + second_term def subtract(self, first_term, second_term): return first_term - second_term def divide(self, first_term, second_term): return first_term / second_term
""" Calculator library containing basic math operations. """ class Calculator: def add(self, first_term, second_term): return first_term + second_term def subtract(self, first_term, second_term): return first_term - second_term def divide(self, first_term, second_term): return first_term / second_term
class Stopwatch(object): """ Provides a set of methods and properties that you can use to accurately measure elapsed time. Stopwatch() """ @staticmethod def GetTimestamp(): """ GetTimestamp() -> Int64 Gets the current number of ticks in the timer mechanism. Returns: A long integer representing the tick counter value of the underlying timer mechanism. """ pass def Reset(self): """ Reset(self: Stopwatch) Stops time interval measurement and resets the elapsed time to zero. """ pass def Restart(self): """ Restart(self: Stopwatch) Stops time interval measurement,resets the elapsed time to zero,and starts measuring elapsed time. """ pass def Start(self): """ Start(self: Stopwatch) Starts,or resumes,measuring elapsed time for an interval. """ pass @staticmethod def StartNew(): """ StartNew() -> Stopwatch Initializes a new System.Diagnostics.Stopwatch instance,sets the elapsed time property to zero, and starts measuring elapsed time. Returns: A System.Diagnostics.Stopwatch that has just begun measuring elapsed time. """ pass def Stop(self): """ Stop(self: Stopwatch) Stops measuring elapsed time for an interval. """ pass Elapsed = property(lambda self: object(), lambda self, v: None, lambda self: None) """Gets the total elapsed time measured by the current instance. Get: Elapsed(self: Stopwatch) -> TimeSpan """ ElapsedMilliseconds = property( lambda self: object(), lambda self, v: None, lambda self: None ) """Gets the total elapsed time measured by the current instance,in milliseconds. Get: ElapsedMilliseconds(self: Stopwatch) -> Int64 """ ElapsedTicks = property( lambda self: object(), lambda self, v: None, lambda self: None ) """Gets the total elapsed time measured by the current instance,in timer ticks. Get: ElapsedTicks(self: Stopwatch) -> Int64 """ IsRunning = property(lambda self: object(), lambda self, v: None, lambda self: None) """Gets a value indicating whether the System.Diagnostics.Stopwatch timer is running. Get: IsRunning(self: Stopwatch) -> bool """ Frequency = None IsHighResolution = True
class Stopwatch(object): """ Provides a set of methods and properties that you can use to accurately measure elapsed time. Stopwatch() """ @staticmethod def get_timestamp(): """ GetTimestamp() -> Int64 Gets the current number of ticks in the timer mechanism. Returns: A long integer representing the tick counter value of the underlying timer mechanism. """ pass def reset(self): """ Reset(self: Stopwatch) Stops time interval measurement and resets the elapsed time to zero. """ pass def restart(self): """ Restart(self: Stopwatch) Stops time interval measurement,resets the elapsed time to zero,and starts measuring elapsed time. """ pass def start(self): """ Start(self: Stopwatch) Starts,or resumes,measuring elapsed time for an interval. """ pass @staticmethod def start_new(): """ StartNew() -> Stopwatch Initializes a new System.Diagnostics.Stopwatch instance,sets the elapsed time property to zero, and starts measuring elapsed time. Returns: A System.Diagnostics.Stopwatch that has just begun measuring elapsed time. """ pass def stop(self): """ Stop(self: Stopwatch) Stops measuring elapsed time for an interval. """ pass elapsed = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Gets the total elapsed time measured by the current instance.\n\n\n\nGet: Elapsed(self: Stopwatch) -> TimeSpan\n\n\n\n' elapsed_milliseconds = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Gets the total elapsed time measured by the current instance,in milliseconds.\n\n\n\nGet: ElapsedMilliseconds(self: Stopwatch) -> Int64\n\n\n\n' elapsed_ticks = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Gets the total elapsed time measured by the current instance,in timer ticks.\n\n\n\nGet: ElapsedTicks(self: Stopwatch) -> Int64\n\n\n\n' is_running = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Gets a value indicating whether the System.Diagnostics.Stopwatch timer is running.\n\n\n\nGet: IsRunning(self: Stopwatch) -> bool\n\n\n\n' frequency = None is_high_resolution = True
name0_0_1_1_0_0_0 = None name0_0_1_1_0_0_1 = None name0_0_1_1_0_0_2 = None name0_0_1_1_0_0_3 = None name0_0_1_1_0_0_4 = None
name0_0_1_1_0_0_0 = None name0_0_1_1_0_0_1 = None name0_0_1_1_0_0_2 = None name0_0_1_1_0_0_3 = None name0_0_1_1_0_0_4 = None
""" <<>> __enter__() <<>> -> Called on a context manager just before entering the with-block -> The return value is bound the as-variable. -> May return any value it wants, including None. -> Commonly returns the context manager itself. <<>> __exit__() <<>> -> Executed after the with-block terminates -> Handles exceptional exits from the with-block -> It receives the exception type, value, and traceback -> The arguments are None when there is no exception -> By default, __exit__() will propagate exceptions from the with-block to the enclosing context. -> if __exit__() returns a "falsy" value, exceptions will be propagated. -> if answers the question "Should I swallow exception?" -> By default it propagates exceptions -> This is because functions return None by default <<< Exception Response >>> -> __exit__() often needs to choose an action based on whether an exception was raised. <<< Raising Exceptions in __exit__() >>> -> __exit__() should not re-raise the exception is receives from the with-block. -> To ensure that the exception is propagated, simply return False. -> __exit__() should only raise an exception if something goes wrong in the function itself. """
""" <<>> __enter__() <<>> -> Called on a context manager just before entering the with-block -> The return value is bound the as-variable. -> May return any value it wants, including None. -> Commonly returns the context manager itself. <<>> __exit__() <<>> -> Executed after the with-block terminates -> Handles exceptional exits from the with-block -> It receives the exception type, value, and traceback -> The arguments are None when there is no exception -> By default, __exit__() will propagate exceptions from the with-block to the enclosing context. -> if __exit__() returns a "falsy" value, exceptions will be propagated. -> if answers the question "Should I swallow exception?" -> By default it propagates exceptions -> This is because functions return None by default <<< Exception Response >>> -> __exit__() often needs to choose an action based on whether an exception was raised. <<< Raising Exceptions in __exit__() >>> -> __exit__() should not re-raise the exception is receives from the with-block. -> To ensure that the exception is propagated, simply return False. -> __exit__() should only raise an exception if something goes wrong in the function itself. """
if float(input()) < 16 : print('Master' if input() == 'm' else 'Miss') else: print('Mr.' if input() == 'm' else 'Ms.')
if float(input()) < 16: print('Master' if input() == 'm' else 'Miss') else: print('Mr.' if input() == 'm' else 'Ms.')
""" Module to demonstrate how to modify a list in a for-loop. This function does not use the accumulator pattern, because we are not trying to make a new list. Instead, we wish to modify the original list. Note that you should never modify the list you are looping over (this is bad practice). So we loop over the range of positions instead. You may want to run this one in the Python Tutor for full effect. Author: Walker M. White (wmw2) Date: May 24, 2019 """ def add_one(lst): """ (Procedure) Adds 1 to every element in the list Example: If a = [1,2,3], add_one(a) changes a to [2,3,4] Parameter lst: The list to modify Precondition: lst is a list of all numbers (either floats or ints), or an empty list """ size = len(lst) for k in range(size): lst[k] = lst[k]+1 # procedure; no return # Add this if using the Python Tutor #a = [3,2,1] #add_one(a)
""" Module to demonstrate how to modify a list in a for-loop. This function does not use the accumulator pattern, because we are not trying to make a new list. Instead, we wish to modify the original list. Note that you should never modify the list you are looping over (this is bad practice). So we loop over the range of positions instead. You may want to run this one in the Python Tutor for full effect. Author: Walker M. White (wmw2) Date: May 24, 2019 """ def add_one(lst): """ (Procedure) Adds 1 to every element in the list Example: If a = [1,2,3], add_one(a) changes a to [2,3,4] Parameter lst: The list to modify Precondition: lst is a list of all numbers\x0b (either floats or ints), or an empty list """ size = len(lst) for k in range(size): lst[k] = lst[k] + 1
fruit = {"orange":"a sweet, orange, citrus fruit", "apple": " good for making cider", "lemon":"a sour, yellow citrus fruit", "grape":"a small, sweet fruit growing in bunches", "lime": "a sour, green citrus fruit", "lime":"its yellow"} print(fruit) # .items will produce a dynamic view object that looks like tuples print(fruit.items()) f_tuple = tuple(fruit.items()) print(f_tuple) for snack in f_tuple: item, description = snack print(item + "-" + description) print("-"*80) #Python allows to construct dict out of tuples print(dict(f_tuple)) # strings are actually immutable objects and concatenating two strings in a for loop # might not be efficient
fruit = {'orange': 'a sweet, orange, citrus fruit', 'apple': ' good for making cider', 'lemon': 'a sour, yellow citrus fruit', 'grape': 'a small, sweet fruit growing in bunches', 'lime': 'a sour, green citrus fruit', 'lime': 'its yellow'} print(fruit) print(fruit.items()) f_tuple = tuple(fruit.items()) print(f_tuple) for snack in f_tuple: (item, description) = snack print(item + '-' + description) print('-' * 80) print(dict(f_tuple))
def isPalindrome(s): s = s.lower() holdit = "" for charac in s: if charac.isalpha(): holdit+=charac i=0 j=len(holdit)-1 while i<=j: if holdit[i]!=holdit[j]: return False i+=1 j-=1 return True s = "0P" print(isPalindrome(s))
def is_palindrome(s): s = s.lower() holdit = '' for charac in s: if charac.isalpha(): holdit += charac i = 0 j = len(holdit) - 1 while i <= j: if holdit[i] != holdit[j]: return False i += 1 j -= 1 return True s = '0P' print(is_palindrome(s))
############################################################################## # # Copyright (c) 2003-2020 by The University of Queensland # http://www.uq.edu.au # # Primary Business: Queensland, Australia # Licensed under the Apache License, version 2.0 # http://www.apache.org/licenses/LICENSE-2.0 # # Development until 2012 by Earth Systems Science Computational Center (ESSCC) # Development 2012-2013 by School of Earth Sciences # Development from 2014 by Centre for Geoscience Computing (GeoComp) # Development from 2019 by School of Earth and Environmental Sciences # ############################################################################## # This is a template configuration file for escript on Debian/GNU Linux. # Refer to README_FIRST for usage instructions. escript_opts_version = 203 openmp = True umfpack = True umfpack_prefix = ['/usr/include/suitesparse', '/usr/lib'] umfpack_libs = ['umfpack', 'blas', 'amd'] pythoncmd="/usr/bin/python3" pythonlibname = 'python3.8' pythonlibpath = '/usr/lib/x86_64-linux-gnu/' pythonincpath = '/usr/include/python3.8' boost_python='boost_python38'
escript_opts_version = 203 openmp = True umfpack = True umfpack_prefix = ['/usr/include/suitesparse', '/usr/lib'] umfpack_libs = ['umfpack', 'blas', 'amd'] pythoncmd = '/usr/bin/python3' pythonlibname = 'python3.8' pythonlibpath = '/usr/lib/x86_64-linux-gnu/' pythonincpath = '/usr/include/python3.8' boost_python = 'boost_python38'
def trace_get_attributes(cls: type): class Wrapper: def __init__(self, *args, **kwargs): self.wrapped = cls(*args, **kwargs) def __getattr__(self, item): result = getattr(self.wrapped, item) print(f"-- getting attribute '{item}' = {result}") return result return Wrapper
def trace_get_attributes(cls: type): class Wrapper: def __init__(self, *args, **kwargs): self.wrapped = cls(*args, **kwargs) def __getattr__(self, item): result = getattr(self.wrapped, item) print(f"-- getting attribute '{item}' = {result}") return result return Wrapper
class Controller: def __init__(self, cfg): self.internal = 0 # self.update_period = cfg.policy.params.period self.last_action = None def reset(self): raise NotImplementedError("Subclass must implement this function") def get_action(self, state): raise NotImplementedError("Subclass must implement this function")
class Controller: def __init__(self, cfg): self.internal = 0 self.last_action = None def reset(self): raise not_implemented_error('Subclass must implement this function') def get_action(self, state): raise not_implemented_error('Subclass must implement this function')
""" Exception classes for subway. """ # TODO: more organized and hierachical exceptions. class SubwayException(Exception): def __init__(self, message, code=10): """ :param message: str. :param code: int. 10 general, 11 jobid unmatch, 12 only valid for general without id 13 no such atrribute in history of conf """ self.message = message self.code = code def __str__(self): return "%s %s" % (self.__class__.__name__, self.message) class CLIException(SubwayException): def __init__(self, message, code=10): super().__init__(message, code) class MatchError(CLIException): def __init__(self, message, code=11): super().__init__(message, code) class NoAttribute(CLIException): def __init__(self, message, code=13): super().__init__(message, code) class EndingBubble(SubwayException): pass class TestBubble(SubwayException): pass
""" Exception classes for subway. """ class Subwayexception(Exception): def __init__(self, message, code=10): """ :param message: str. :param code: int. 10 general, 11 jobid unmatch, 12 only valid for general without id 13 no such atrribute in history of conf """ self.message = message self.code = code def __str__(self): return '%s %s' % (self.__class__.__name__, self.message) class Cliexception(SubwayException): def __init__(self, message, code=10): super().__init__(message, code) class Matcherror(CLIException): def __init__(self, message, code=11): super().__init__(message, code) class Noattribute(CLIException): def __init__(self, message, code=13): super().__init__(message, code) class Endingbubble(SubwayException): pass class Testbubble(SubwayException): pass
#!usr/bin/python # -*- coding:utf8 -*- class Cat(object): def say(self): print("I am a cat") class Dog(object): def say(self): print("I am a dog") def __getitem__(self, item): return "bobby" class Duck(object): def say(self): print("I am a duck") # animal = Cat # animal().say() animal_list = [Cat, Dog, Duck] for animal in animal_list: animal().say() dog = Dog() a = ["bobby1", "bobby2"] b = ["bobby2", "bobby"] name_tuple = ["bobby3", "bobby4"] name_set = set() name_set.add("bobby5") name_set.add("bobby6") a.extend(dog) # extend(self, iterable) print(a)
class Cat(object): def say(self): print('I am a cat') class Dog(object): def say(self): print('I am a dog') def __getitem__(self, item): return 'bobby' class Duck(object): def say(self): print('I am a duck') animal_list = [Cat, Dog, Duck] for animal in animal_list: animal().say() dog = dog() a = ['bobby1', 'bobby2'] b = ['bobby2', 'bobby'] name_tuple = ['bobby3', 'bobby4'] name_set = set() name_set.add('bobby5') name_set.add('bobby6') a.extend(dog) print(a)
# coding=utf-8 # /usr/bin/env python ''' Author: wenqiangw Email: wenqiangw@opera.com Date: 2020-07-30 11:05 Desc: '''
""" Author: wenqiangw Email: wenqiangw@opera.com Date: 2020-07-30 11:05 Desc: """
name = 'tinymce4' authors = 'Joost Cassee, Aljosa Mohorovic' version = '3.0.2' release = version
name = 'tinymce4' authors = 'Joost Cassee, Aljosa Mohorovic' version = '3.0.2' release = version
#!/usr/bin/python3 def solution(A): if not A: return 0 max_profit = 0 min_value = A[0] for a in A: max_profit = max(max_profit, a - min_value) min_value = min(min_value, a) return max_profit
def solution(A): if not A: return 0 max_profit = 0 min_value = A[0] for a in A: max_profit = max(max_profit, a - min_value) min_value = min(min_value, a) return max_profit
#-*- coding : utf-8 -*- class Distribute(object): def __init__(self): self.__layout = 0 self.__funcs = {list:self._list, dict:self._dict} @property def funcs(self): return self.__funcs def _drowTab( self, tab, add=' |' ): add = add * tab return " {add}".format(**locals()) def _dict( self, data, tab ): for idx, (dName, dVal) in enumerate(data.items(), 1): #print(self.__layout, tab) try : if self.__layout < tab : self.__layout = tab print("{0} {1}".format(self._drowTab(tab),type(data))) print("{0} \"{dName}\"".format(self._drowTab(tab), **locals())) self.funcs[type(dVal)](dVal, tab+1) except: if self.__layout > tab : self.__layout -= 1 print("{0} | \"{dVal}\"<\'{dName} value\'>".format(self._drowTab(tab),**locals())) def _list( self, data, tab ): for item in data: #print(self.__layout, tab) try : if self.__layout < tab : self.__layout = tab print("{0} {1}".format(self._drowTab(tab),type(data))) self.funcs[type(item)](item, tab+1 ) except: if self.__layout > tab : self.__layout -= 1 print("{0} \"{item}\"".format(self._drowTab(tab), **locals())) def process( self, data ): self.funcs[type(data)](data, 1) def display(data, title=None): if title == None : title = "Display" print("< {title} >".format(**locals())) distri = Distribute() distri.process(data) if __name__ == "__main__" : display([1,2,3,4,5,6,[7],0,0,0, [8]]) display({"key":[1,2,3,4,5,6,[7,{"InKey_val_array":[9,9,9,9]}],0,{"K":"v","K2":[10,9,8,7],"K3":"v3"},0,0,[8]]})
class Distribute(object): def __init__(self): self.__layout = 0 self.__funcs = {list: self._list, dict: self._dict} @property def funcs(self): return self.__funcs def _drow_tab(self, tab, add=' |'): add = add * tab return ' {add}'.format(**locals()) def _dict(self, data, tab): for (idx, (d_name, d_val)) in enumerate(data.items(), 1): try: if self.__layout < tab: self.__layout = tab print('{0} {1}'.format(self._drowTab(tab), type(data))) print('{0} "{dName}"'.format(self._drowTab(tab), **locals())) self.funcs[type(dVal)](dVal, tab + 1) except: if self.__layout > tab: self.__layout -= 1 print('{0} | "{dVal}"<\'{dName} value\'>'.format(self._drowTab(tab), **locals())) def _list(self, data, tab): for item in data: try: if self.__layout < tab: self.__layout = tab print('{0} {1}'.format(self._drowTab(tab), type(data))) self.funcs[type(item)](item, tab + 1) except: if self.__layout > tab: self.__layout -= 1 print('{0} "{item}"'.format(self._drowTab(tab), **locals())) def process(self, data): self.funcs[type(data)](data, 1) def display(data, title=None): if title == None: title = 'Display' print('< {title} >'.format(**locals())) distri = distribute() distri.process(data) if __name__ == '__main__': display([1, 2, 3, 4, 5, 6, [7], 0, 0, 0, [8]]) display({'key': [1, 2, 3, 4, 5, 6, [7, {'InKey_val_array': [9, 9, 9, 9]}], 0, {'K': 'v', 'K2': [10, 9, 8, 7], 'K3': 'v3'}, 0, 0, [8]]})
"""TensorFlow project.""" load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def deps(prefix = ""): http_archive( name = "com_google_farmhash", build_file = prefix + "//third_party/farmhash:farmhash.BUILD", strip_prefix = "farmhash-master", # Does not have any release. urls = ["https://github.com/google/farmhash/archive/master.zip"], sha256 = "d27a245e59f5e10fba10b88cb72c5f0e03d3f2936abbaf0cb78eeec686523ec1", )
"""TensorFlow project.""" load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') def deps(prefix=''): http_archive(name='com_google_farmhash', build_file=prefix + '//third_party/farmhash:farmhash.BUILD', strip_prefix='farmhash-master', urls=['https://github.com/google/farmhash/archive/master.zip'], sha256='d27a245e59f5e10fba10b88cb72c5f0e03d3f2936abbaf0cb78eeec686523ec1')
s = input().lower() search = input().lower().strip() str_list = [] # Tokenize token = "" for c in s: if c not in [' ','\'','"','.',',']: token += c else: if len(token) > 0: str_list.append(token) token = "" if len(token) > 0: str_list.append(token) # Search print('Found' if search in str_list else 'Not Found')
s = input().lower() search = input().lower().strip() str_list = [] token = '' for c in s: if c not in [' ', "'", '"', '.', ',']: token += c elif len(token) > 0: str_list.append(token) token = '' if len(token) > 0: str_list.append(token) print('Found' if search in str_list else 'Not Found')
def multiply(a, b): return a * b result = multiply(2,3) print(result)
def multiply(a, b): return a * b result = multiply(2, 3) print(result)
'''https://leetcode.com/problems/decode-string/''' class Solution: def decodeString(self, s: str) -> str: stack = [] curNum = 0 curStr = '' for i in s: if i=='[': stack.append(curStr) stack.append(curNum) curNum = 0 curStr = '' elif i==']': num = stack.pop() prevStr = stack.pop() curStr = prevStr + num*curStr elif i.isdigit(): curNum = curNum*10 + int(i) else: curStr +=i return curStr
"""https://leetcode.com/problems/decode-string/""" class Solution: def decode_string(self, s: str) -> str: stack = [] cur_num = 0 cur_str = '' for i in s: if i == '[': stack.append(curStr) stack.append(curNum) cur_num = 0 cur_str = '' elif i == ']': num = stack.pop() prev_str = stack.pop() cur_str = prevStr + num * curStr elif i.isdigit(): cur_num = curNum * 10 + int(i) else: cur_str += i return curStr
''' Backward method to solve 1D reaction-diffusion equation: u_t = k * u_xx with Neumann boundary conditions at x=0: u_x(0,t) = 0 = sin(2*np.pi) at x=L: u_x(L,t) = 0 = sin(2*np.pi) with L = 1 and initial conditions: u(x,0) = (1.0/2.0)+ np.cos(2.0*np.pi*x) - (1.0/2.0)*np.cos(3*np.pi*x) u_x(x,t) = (-4.0*(np.pi**2))np.exp(-4.0*(np.pi**2)*t)*np.cos(2.0*np.pi*x) + (9.0/2.0)*(np.pi**2)*np.exp(-9.0*(np.pi**2)*t)*np.cos(3*np.pi*x)) ''' def BackwardEuler(M, lambd, T = 0.5, L = 1, k = 1): #Parameters needed to solve the equation within the explicit method # M = GRID POINTS on space interval N = (M**2) #GRID POINTS on time interval # ---- Length of the wire in x direction ---- x0, xL = 0, L # ----- Spatial discretization step ----- dx = (xL - x0)/(M-1) # ---- Final time ---- t0, tF = 0, T # ----- Time step ----- dt = (tF - t0)/(N-1) # k = 1.0 Diffusion coefficient #lambd = dt*k/dx**2 a = 1 + 2*lambd xspan = np.linspace(x0, xL, M) tspan = np.linspace(t0, tF, N) main_diag = (1 + 2*lambd)*np.ones((1,M)) off_diag = -lambd*np.ones((1, M-1)) a = main_diag.shape[1] diagonals = [main_diag, off_diag, off_diag] #Sparse Matrix diagonals A = sparse.diags(diagonals, [0,-1,1], shape=(a,a)).toarray() A[0,1] = -2*lambd A[M-1,M-2] = -2*lambd # --- Initializes matrix U ----- U = np.zeros((M, N)) #print(U) # --- Initial condition ----- U[:,0] = (1.0/2.0)+ np.cos(2.0*np.pi*xspan) - (1.0/2.0)*np.cos(3*np.pi*xspan) # ---- Neumann boundary conditions ----- leftBC = np.arange(1, N+1) #f = np.sin(2*leftBC*np.pi) #f = U[0,:] rightBC = np.arange(1, N+1) #g = np.sin(2*rightBC*np.pi) #g = U[-1,:] U[0,:] = (-3*U[1,:] + 4*U[2,:] - U[3,:])/(2*dx) U[-1,:] = (-3*U[1,:] + 4*U[2,:] - U[3,:])/(2*dx) f = U[0,:] g = U[-1,:] for i in range(1, N): c = np.zeros((M-2,1)).ravel() b1 = np.asarray([2*lambd*dx*f[i], 2*lambd*dx*g[i]]) b1 = np.insert(b1, 1, c) b2 = np.array(U[0:M, i-1]) b = b1 + b2 # Right hand side U[0:M, i] = np.linalg.solve(A,b) # Solve x=A\b return (U, tspan, xspan) U, tspan, xspan = BackwardEuler(M = 14, lambd = 1.0/6.0) Uexact, x, t = ExactSolution(M = 14) surfaceplot(U, Uexact, tspan, xspan, M = 14)
""" Backward method to solve 1D reaction-diffusion equation: u_t = k * u_xx with Neumann boundary conditions at x=0: u_x(0,t) = 0 = sin(2*np.pi) at x=L: u_x(L,t) = 0 = sin(2*np.pi) with L = 1 and initial conditions: u(x,0) = (1.0/2.0)+ np.cos(2.0*np.pi*x) - (1.0/2.0)*np.cos(3*np.pi*x) u_x(x,t) = (-4.0*(np.pi**2))np.exp(-4.0*(np.pi**2)*t)*np.cos(2.0*np.pi*x) + (9.0/2.0)*(np.pi**2)*np.exp(-9.0*(np.pi**2)*t)*np.cos(3*np.pi*x)) """ def backward_euler(M, lambd, T=0.5, L=1, k=1): n = M ** 2 (x0, x_l) = (0, L) dx = (xL - x0) / (M - 1) (t0, t_f) = (0, T) dt = (tF - t0) / (N - 1) a = 1 + 2 * lambd xspan = np.linspace(x0, xL, M) tspan = np.linspace(t0, tF, N) main_diag = (1 + 2 * lambd) * np.ones((1, M)) off_diag = -lambd * np.ones((1, M - 1)) a = main_diag.shape[1] diagonals = [main_diag, off_diag, off_diag] a = sparse.diags(diagonals, [0, -1, 1], shape=(a, a)).toarray() A[0, 1] = -2 * lambd A[M - 1, M - 2] = -2 * lambd u = np.zeros((M, N)) U[:, 0] = 1.0 / 2.0 + np.cos(2.0 * np.pi * xspan) - 1.0 / 2.0 * np.cos(3 * np.pi * xspan) left_bc = np.arange(1, N + 1) right_bc = np.arange(1, N + 1) U[0, :] = (-3 * U[1, :] + 4 * U[2, :] - U[3, :]) / (2 * dx) U[-1, :] = (-3 * U[1, :] + 4 * U[2, :] - U[3, :]) / (2 * dx) f = U[0, :] g = U[-1, :] for i in range(1, N): c = np.zeros((M - 2, 1)).ravel() b1 = np.asarray([2 * lambd * dx * f[i], 2 * lambd * dx * g[i]]) b1 = np.insert(b1, 1, c) b2 = np.array(U[0:M, i - 1]) b = b1 + b2 U[0:M, i] = np.linalg.solve(A, b) return (U, tspan, xspan) (u, tspan, xspan) = backward_euler(M=14, lambd=1.0 / 6.0) (uexact, x, t) = exact_solution(M=14) surfaceplot(U, Uexact, tspan, xspan, M=14)
test_input = """7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1 22 13 17 11 0 8 2 23 4 24 21 9 14 16 7 6 10 3 18 5 1 12 20 15 19 3 15 0 2 22 9 18 13 17 5 19 8 7 25 23 20 11 10 24 4 14 21 16 12 6 14 21 17 24 4 10 16 15 9 19 18 8 23 26 20 22 11 13 6 5 2 0 12 3 7 """ def parse_input(_input): _input = _input.split('\n\n') numbers, boards = _input[0], _input[1:] boards = [b.replace("\n", " ").replace(" ", " ").lstrip().rstrip().split(" ") for b in boards] boards = [list(map(int, row)) for row in boards] numbers = [int(num) for num in numbers.split(",")] return boards, numbers def is_winner(board_index: set) -> bool: WINNING_INDEX = [set([x + 5*y for x in range(5)]) for y in range(5)] \ + [set([5*x + y for x in range(5)]) for y in range(5)] for indexes in WINNING_INDEX: if indexes.issubset(board_index): return True return False def get_winner(boards, numbers): number_set = {i : set() for i in range(len(boards))} seen = [] winner = [] for num in numbers: for i, board in enumerate(boards): if num in board: number_set[i].add(board.index(num)) if is_winner(number_set[i]) and i not in seen: seen.append(i) seen_idx = number_set[i] winner.append((board, seen_idx, num)) if len(winner) == len(boards): return board, seen_idx, num return winner[-1] boards, numbers = parse_input(test_input) board, num_set, last_num = get_winner(boards, numbers) def score(board, idx, last_num): unmarked = [board[i] for i in set(range(25)) - idx] return sum(unmarked) * last_num def part1(_input): boards, numbers = parse_input(_input) board, num_set, last_num = get_winner(boards, numbers) return score(board, num_set, last_num) assert part1(test_input) == 1924#4512 with open('data/input4.txt') as f: data = f.read() print(part1(data))
test_input = '7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1\n\n22 13 17 11 0\n 8 2 23 4 24\n21 9 14 16 7\n 6 10 3 18 5\n 1 12 20 15 19\n\n 3 15 0 2 22\n 9 18 13 17 5\n19 8 7 25 23\n20 11 10 24 4\n14 21 16 12 6\n\n14 21 17 24 4\n10 16 15 9 19\n18 8 23 26 20\n22 11 13 6 5\n 2 0 12 3 7\n' def parse_input(_input): _input = _input.split('\n\n') (numbers, boards) = (_input[0], _input[1:]) boards = [b.replace('\n', ' ').replace(' ', ' ').lstrip().rstrip().split(' ') for b in boards] boards = [list(map(int, row)) for row in boards] numbers = [int(num) for num in numbers.split(',')] return (boards, numbers) def is_winner(board_index: set) -> bool: winning_index = [set([x + 5 * y for x in range(5)]) for y in range(5)] + [set([5 * x + y for x in range(5)]) for y in range(5)] for indexes in WINNING_INDEX: if indexes.issubset(board_index): return True return False def get_winner(boards, numbers): number_set = {i: set() for i in range(len(boards))} seen = [] winner = [] for num in numbers: for (i, board) in enumerate(boards): if num in board: number_set[i].add(board.index(num)) if is_winner(number_set[i]) and i not in seen: seen.append(i) seen_idx = number_set[i] winner.append((board, seen_idx, num)) if len(winner) == len(boards): return (board, seen_idx, num) return winner[-1] (boards, numbers) = parse_input(test_input) (board, num_set, last_num) = get_winner(boards, numbers) def score(board, idx, last_num): unmarked = [board[i] for i in set(range(25)) - idx] return sum(unmarked) * last_num def part1(_input): (boards, numbers) = parse_input(_input) (board, num_set, last_num) = get_winner(boards, numbers) return score(board, num_set, last_num) assert part1(test_input) == 1924 with open('data/input4.txt') as f: data = f.read() print(part1(data))
#!/usr/bin/python3 ''' Program: This is a table of environment variable of deep learning python. Usage: import DL_conf.py // in your deep learning python program editor Jacob975 20180123 ################################# update log 20180123 version alpha 1: Hello!, just a test ''' # Comment of what kinds of variables are saved here. #--------------- Setting python path ---------------- # python path is where you install python # tensorflow python can run under both python3 and python2 # please check the path by $which python python2 path_of_python = "/usr/bin/python3" #--------------- Setting source code path ------------------ # code path means where do you install these code about DL. # recommand: /home/username/bin/DL_python path_of_source_code = "/home/Jacob975/bin/deep_learning" #--------------- Setting data path --------------------- # Where you save your data. # recommand: /mazu/users/Jacob975/AI_data/ELAIS_N1_NICER_control_image path_of_data = "/mazu/users/Jacob975/AI_data"
""" Program: This is a table of environment variable of deep learning python. Usage: import DL_conf.py // in your deep learning python program editor Jacob975 20180123 ################################# update log 20180123 version alpha 1: Hello!, just a test """ path_of_python = '/usr/bin/python3' path_of_source_code = '/home/Jacob975/bin/deep_learning' path_of_data = '/mazu/users/Jacob975/AI_data'
n = int(input()) i = 2 while n != 1: if n%i == 0: n//=i;print(i) else: i+=1
n = int(input()) i = 2 while n != 1: if n % i == 0: n //= i print(i) else: i += 1
def extractAdamantineDragonintheCrystalWorld(item): """ """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol or frag) or 'preview' in item['title'].lower(): return None if 'Crystal World' in item['tags']: return buildReleaseMessageWithType(item, 'Adamantine Dragon in the Crystal World', vol, chp, frag=frag, postfix=postfix, tl_type='oel') return False
def extract_adamantine_dragoninthe_crystal_world(item): """ """ (vol, chp, frag, postfix) = extract_vol_chapter_fragment_postfix(item['title']) if not (chp or vol or frag) or 'preview' in item['title'].lower(): return None if 'Crystal World' in item['tags']: return build_release_message_with_type(item, 'Adamantine Dragon in the Crystal World', vol, chp, frag=frag, postfix=postfix, tl_type='oel') return False
class ManipulationDelta(object): """ Contains transformation data that is accumulated when manipulation events occur. ManipulationDelta(translation: Vector,rotation: float,scale: Vector,expansion: Vector) """ @staticmethod def __new__(self,translation,rotation,scale,expansion): """ __new__(cls: type,translation: Vector,rotation: float,scale: Vector,expansion: Vector) """ pass Expansion=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets the amount the manipulation has resized in device-independent units (1/96th inch per unit). Get: Expansion(self: ManipulationDelta) -> Vector """ Rotation=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets the rotation of the manipulation in degrees. Get: Rotation(self: ManipulationDelta) -> float """ Scale=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets the amount the manipulation has resized as a multiplier. Get: Scale(self: ManipulationDelta) -> Vector """ Translation=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets the linear motion of the manipulation. Get: Translation(self: ManipulationDelta) -> Vector """
class Manipulationdelta(object): """ Contains transformation data that is accumulated when manipulation events occur. ManipulationDelta(translation: Vector,rotation: float,scale: Vector,expansion: Vector) """ @staticmethod def __new__(self, translation, rotation, scale, expansion): """ __new__(cls: type,translation: Vector,rotation: float,scale: Vector,expansion: Vector) """ pass expansion = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Gets or sets the amount the manipulation has resized in device-independent units (1/96th inch per unit).\n\n\n\nGet: Expansion(self: ManipulationDelta) -> Vector\n\n\n\n' rotation = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Gets or sets the rotation of the manipulation in degrees.\n\n\n\nGet: Rotation(self: ManipulationDelta) -> float\n\n\n\n' scale = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Gets or sets the amount the manipulation has resized as a multiplier.\n\n\n\nGet: Scale(self: ManipulationDelta) -> Vector\n\n\n\n' translation = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Gets or sets the linear motion of the manipulation.\n\n\n\nGet: Translation(self: ManipulationDelta) -> Vector\n\n\n\n'
""" Meta information for this project """ __project__ = 'Croesus' __version__ = '0.1.1' __author__ = 'Brian Lusina' __email__ = 'lusinabrian@gmail.com' __url__ = 'http://croesus.com' __copyright__ = 'Brian Lusina'
""" Meta information for this project """ __project__ = 'Croesus' __version__ = '0.1.1' __author__ = 'Brian Lusina' __email__ = 'lusinabrian@gmail.com' __url__ = 'http://croesus.com' __copyright__ = 'Brian Lusina'
def best_par_in_df(search_df): ''' This function takes as input a pandas dataframe containing the inference results (saved in a file having 'search_history.csv' ending) and returns the highest-likelihood parameters set that was found during the search. Args: - search_df (pandas DataFrame object): dataframe containing the results of the inference procedure, produced by the 'parallel_tempering' class. Returns: - best_par: model parameters dictionary containing the highest-likelihood parameters set found during the inference. ''' best_idx = search_df['logl'].argmax() best_par = search_df.loc[best_idx].to_dict() return best_par
def best_par_in_df(search_df): """ This function takes as input a pandas dataframe containing the inference results (saved in a file having 'search_history.csv' ending) and returns the highest-likelihood parameters set that was found during the search. Args: - search_df (pandas DataFrame object): dataframe containing the results of the inference procedure, produced by the 'parallel_tempering' class. Returns: - best_par: model parameters dictionary containing the highest-likelihood parameters set found during the inference. """ best_idx = search_df['logl'].argmax() best_par = search_df.loc[best_idx].to_dict() return best_par
class Solution: def numFriendRequests(self, ages: List[int]) -> int: """Hash table. """ c = collections.Counter(ages) res = 0 for ka, va in c.items(): for kb, vb in c.items(): if kb > 0.5 * ka + 7 and kb <= ka: if ka == kb: res += va * (va - 1) else: res += va * vb return res
class Solution: def num_friend_requests(self, ages: List[int]) -> int: """Hash table. """ c = collections.Counter(ages) res = 0 for (ka, va) in c.items(): for (kb, vb) in c.items(): if kb > 0.5 * ka + 7 and kb <= ka: if ka == kb: res += va * (va - 1) else: res += va * vb return res
class Config(object): DEBUG = False TESTING = False SQLALCHEMY_TRACK_MODIFICATIONS = False class Production(Config): SQLALCHEMY_DATABASE_URI = '<Production DB URL>' class Development(Config): # psql postgresql://Nghi:nghi1996@localhost/postgres DEBUG = True SQLALCHEMY_DATABASE_URI = 'postgresql://Nghi:nghi1996@localhost/postgres' SQLALCHEMY_ECHO = False JWT_SECRET_KEY = 'JWT_SECRET_NGHI!123' SECRET_KEY = 'SECRET_KEY_NGHI_ABC!123' SECURITY_PASSWORD_SALT = 'SECURITY_PASSWORD_SALT_NGHI_ABC!123' MAIL_DEFAULT_SENDER = 'dev2020@localhost' MAIL_SERVER = 'smtp.gmail.com' MAIL_PORT = 465 MAIL_USERNAME = 'nghidev2020@gmail.com' MAIL_PASSWORD = 'nghi1996' MAIL_USE_TLS = False MAIL_USE_SSL = True UPLOAD_FOLDER = 'images' class Testing(Config): TESTING = True # SQLALCHEMY_DATABASE_URI = 'postgresql://Nghi:nghi1996@localhost/postgres_test' SQLALCHEMY_ECHO = False JWT_SECRET_KEY = 'JWT_SECRET_NGHI!123' SECRET_KEY = 'SECRET_KEY_NGHI_ABC!123' SECURITY_PASSWORD_SALT = 'SECURITY_PASSWORD_SALT_NGHI_ABC!123' MAIL_DEFAULT_SENDER = 'dev2020@localhost' MAIL_SERVER = 'smtp.gmail.com' MAIL_PORT = 465 MAIL_USERNAME = 'nghidev2020@gmail.com' MAIL_PASSWORD = 'nghi1996' MAIL_USE_TLS = False MAIL_USE_SSL = True UPLOAD_FOLDER = 'images'
class Config(object): debug = False testing = False sqlalchemy_track_modifications = False class Production(Config): sqlalchemy_database_uri = '<Production DB URL>' class Development(Config): debug = True sqlalchemy_database_uri = 'postgresql://Nghi:nghi1996@localhost/postgres' sqlalchemy_echo = False jwt_secret_key = 'JWT_SECRET_NGHI!123' secret_key = 'SECRET_KEY_NGHI_ABC!123' security_password_salt = 'SECURITY_PASSWORD_SALT_NGHI_ABC!123' mail_default_sender = 'dev2020@localhost' mail_server = 'smtp.gmail.com' mail_port = 465 mail_username = 'nghidev2020@gmail.com' mail_password = 'nghi1996' mail_use_tls = False mail_use_ssl = True upload_folder = 'images' class Testing(Config): testing = True sqlalchemy_echo = False jwt_secret_key = 'JWT_SECRET_NGHI!123' secret_key = 'SECRET_KEY_NGHI_ABC!123' security_password_salt = 'SECURITY_PASSWORD_SALT_NGHI_ABC!123' mail_default_sender = 'dev2020@localhost' mail_server = 'smtp.gmail.com' mail_port = 465 mail_username = 'nghidev2020@gmail.com' mail_password = 'nghi1996' mail_use_tls = False mail_use_ssl = True upload_folder = 'images'
def rotateImage(a): size = len(a) b = [] for col in range(size): temp = [] for row in reversed(range(size)): temp.append(a[row][col]) b.append(temp) return b if __name__ == '__main__': a = [ [1,2,3], [4,5,6], [7,8,9], ] print(rotateImage(a))
def rotate_image(a): size = len(a) b = [] for col in range(size): temp = [] for row in reversed(range(size)): temp.append(a[row][col]) b.append(temp) return b if __name__ == '__main__': a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] print(rotate_image(a))
class Context: def time(self): raise NotImplemented def user(self): raise NotImplemented class DefaultContext(Context): def __init__(self, current_time, current_user_id): super(DefaultContext, self).__init__() self.current_time = current_time self.current_user_id = current_user_id def time(self): return self.current_time def user(self): return self.current_user_id
class Context: def time(self): raise NotImplemented def user(self): raise NotImplemented class Defaultcontext(Context): def __init__(self, current_time, current_user_id): super(DefaultContext, self).__init__() self.current_time = current_time self.current_user_id = current_user_id def time(self): return self.current_time def user(self): return self.current_user_id
# This program knows about the schedule for a conference that runs over the # course of a day, with sessions in different tracks in different rooms. Given # a room and a time, it can tell you which session starts at that time. # # Usage: # # $ python conference_schedule.py [room] [time] # # For instance: # # $ python conference_schedule.py "Main Hall" 13:30 # schedule = { 'Main Hall': { '10:00': 'Django REST framework', '11:00': 'Lessons learned from PHP', '12:00': "Tech interviews that don't suck", '14:00': 'Taking control of your Bluetooth devices', '15:00': "Fast Python? Don't Bother!", '16:00': 'Test-Driven Data Analysis', }, 'Seminar Room': { '10:00': 'Python in my Science Classroom', '11:00': 'My journey from wxPython tp PyQt', '12:00': 'Easy solutions to hard problems', '14:00': 'Taking control of your Bluetooth devices', '15:00': "Euler's Key to Cryptography", '16:00': 'Build your Microservices with ZeroMQ', }, 'Assembly Hall': { '10:00': 'Distributed systems from scratch', '11:00': 'Python in Medicine: ventilator data', '12:00': 'Neurodiversity in Technology', '14:00': 'Chat bots: What is AI?', '15:00': 'Pygame Zero', '16:00': 'The state of PyPy', }, } print('There are talks scheduled in {} rooms'.format(len(schedule))) # TODO: # * Implement the program as described in the comments at the top of the file. # TODO (extra): # * Change the program so that that it can tell you what session is running in # a room at a given time, even if a session doesn't start at that time. # * Change the program so that if called with a single argument, the title of a # session, it displays the room and the time of the session.
schedule = {'Main Hall': {'10:00': 'Django REST framework', '11:00': 'Lessons learned from PHP', '12:00': "Tech interviews that don't suck", '14:00': 'Taking control of your Bluetooth devices', '15:00': "Fast Python? Don't Bother!", '16:00': 'Test-Driven Data Analysis'}, 'Seminar Room': {'10:00': 'Python in my Science Classroom', '11:00': 'My journey from wxPython tp PyQt', '12:00': 'Easy solutions to hard problems', '14:00': 'Taking control of your Bluetooth devices', '15:00': "Euler's Key to Cryptography", '16:00': 'Build your Microservices with ZeroMQ'}, 'Assembly Hall': {'10:00': 'Distributed systems from scratch', '11:00': 'Python in Medicine: ventilator data', '12:00': 'Neurodiversity in Technology', '14:00': 'Chat bots: What is AI?', '15:00': 'Pygame Zero', '16:00': 'The state of PyPy'}} print('There are talks scheduled in {} rooms'.format(len(schedule)))
"grpc_py_library.bzl provides a py_library for grpc files." load("@rules_python//python:defs.bzl", "py_library") def grpc_py_library(**kwargs): py_library(**kwargs)
"""grpc_py_library.bzl provides a py_library for grpc files.""" load('@rules_python//python:defs.bzl', 'py_library') def grpc_py_library(**kwargs): py_library(**kwargs)
#Conceito Mec l=int(input()) p=int(input()) r= p / l if r <= 8: print("A") elif 9 <= r <= 12: print("B") elif 13 <= r <= 18: print("C") elif r > 18: print("D")
l = int(input()) p = int(input()) r = p / l if r <= 8: print('A') elif 9 <= r <= 12: print('B') elif 13 <= r <= 18: print('C') elif r > 18: print('D')
""" Metainf block field registrations. The META_FIELDS dictionary registers allowable fields in the markdown metainf block as well as the type and default value. The dictionary structure is defined as ``` META_FIELDS = { 'camel_cased_field_name': ('python_type', default_value) } ``` """ META_FIELDS = { 'title': ('unicode', None), 'nav_name': ('unicode', None), 'description': ('unicode', None), 'author': ('unicode', None), 'date': ('date', None), 'order': ('int', 0), 'template': ('unicode', None), 'teaser': ('unicode', None), 'teaser_image': ('unicode', None), 'sitemap_priority': ('unicode', None), 'sitemap_changefreq': ('unicode', None), 'published': ('bool', True), }
""" Metainf block field registrations. The META_FIELDS dictionary registers allowable fields in the markdown metainf block as well as the type and default value. The dictionary structure is defined as ``` META_FIELDS = { 'camel_cased_field_name': ('python_type', default_value) } ``` """ meta_fields = {'title': ('unicode', None), 'nav_name': ('unicode', None), 'description': ('unicode', None), 'author': ('unicode', None), 'date': ('date', None), 'order': ('int', 0), 'template': ('unicode', None), 'teaser': ('unicode', None), 'teaser_image': ('unicode', None), 'sitemap_priority': ('unicode', None), 'sitemap_changefreq': ('unicode', None), 'published': ('bool', True)}
## inotify_init1 flags. IN_CLOEXEC = 0o2000000 IN_NONBLOCK = 0o0004000 ## Supported events suitable for MASK parameter of INOTIFY_ADD_WATCH. IN_ACCESS = 0x00000001 IN_MODIFY = 0x00000002 IN_ATTRIB = 0x00000004 IN_CLOSE_WRITE = 0x00000008 IN_CLOSE_NOWRITE = 0x00000010 IN_OPEN = 0x00000020 IN_MOVED_FROM = 0x00000040 IN_MOVED_TO = 0x00000080 IN_CREATE = 0x00000100 IN_DELETE = 0x00000200 IN_DELETE_SELF = 0x00000400 IN_MOVE_SELF = 0x00000800 ## Helper events. IN_CLOSE = (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) IN_MOVE = (IN_MOVED_FROM | IN_MOVED_TO) ## All events which a program can wait on. IN_ALL_EVENTS = (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | IN_MOVED_TO | IN_CREATE | IN_DELETE | IN_DELETE_SELF | IN_MOVE_SELF) ## Events sent by kernel. IN_UNMOUNT = 0x00002000 # Backing fs was unmounted. IN_Q_OVERFLOW = 0x00004000 # Event queued overflowed. IN_IGNORED = 0x00008000 # File was ignored. ## Special flags. IN_ONLYDIR = 0x01000000 # Only watch the path if it is a directory. IN_DONT_FOLLOW = 0x02000000 # Do not follow a sym link. IN_MASK_ADD = 0x20000000 # Add to the mask of an already existing watch. IN_ISDIR = 0x40000000 # Event occurred against dir. IN_ONESHOT = 0x80000000 # Only send event once. MASK_LOOKUP = { 0o2000000: 'IN_CLOEXEC', 0o0004000: 'IN_NONBLOCK', ## Supported events suitable for MASK parameter of INOTIFY_ADD_WATCH. 0x00000001: 'IN_ACCESS', 0x00000002: 'IN_MODIFY', 0x00000004: 'IN_ATTRIB', 0x00000008: 'IN_CLOSE_WRITE', 0x00000010: 'IN_CLOSE_NOWRITE', 0x00000020: 'IN_OPEN', 0x00000040: 'IN_MOVED_FROM', 0x00000080: 'IN_MOVED_TO', 0x00000100: 'IN_CREATE', 0x00000200: 'IN_DELETE', 0x00000400: 'IN_DELETE_SELF', 0x00000800: 'IN_MOVE_SELF', ## Events sent by kernel. 0x00002000: 'IN_UNMOUNT', 0x00004000: 'IN_Q_OVERFLOW', 0x00008000: 'IN_IGNORED', ## Special flags. 0x01000000: 'IN_ONLYDIR', 0x02000000: 'IN_DONT_FOLLOW', 0x20000000: 'IN_MASK_ADD', 0x40000000: 'IN_ISDIR', 0x80000000: 'IN_ONESHOT', }
in_cloexec = 524288 in_nonblock = 2048 in_access = 1 in_modify = 2 in_attrib = 4 in_close_write = 8 in_close_nowrite = 16 in_open = 32 in_moved_from = 64 in_moved_to = 128 in_create = 256 in_delete = 512 in_delete_self = 1024 in_move_self = 2048 in_close = IN_CLOSE_WRITE | IN_CLOSE_NOWRITE in_move = IN_MOVED_FROM | IN_MOVED_TO in_all_events = IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | IN_MOVED_TO | IN_CREATE | IN_DELETE | IN_DELETE_SELF | IN_MOVE_SELF in_unmount = 8192 in_q_overflow = 16384 in_ignored = 32768 in_onlydir = 16777216 in_dont_follow = 33554432 in_mask_add = 536870912 in_isdir = 1073741824 in_oneshot = 2147483648 mask_lookup = {524288: 'IN_CLOEXEC', 2048: 'IN_NONBLOCK', 1: 'IN_ACCESS', 2: 'IN_MODIFY', 4: 'IN_ATTRIB', 8: 'IN_CLOSE_WRITE', 16: 'IN_CLOSE_NOWRITE', 32: 'IN_OPEN', 64: 'IN_MOVED_FROM', 128: 'IN_MOVED_TO', 256: 'IN_CREATE', 512: 'IN_DELETE', 1024: 'IN_DELETE_SELF', 2048: 'IN_MOVE_SELF', 8192: 'IN_UNMOUNT', 16384: 'IN_Q_OVERFLOW', 32768: 'IN_IGNORED', 16777216: 'IN_ONLYDIR', 33554432: 'IN_DONT_FOLLOW', 536870912: 'IN_MASK_ADD', 1073741824: 'IN_ISDIR', 2147483648: 'IN_ONESHOT'}
def costodepasajes(): #definir variables y otros montoP=0 #datos de entrada cantidadX=int(input("ingrese la cantidad de estudiantes:")) #proceso if cantidadX>=100: montoP=cantidadX*20 elif cantidadX<100 and cantidadX>49: montoP=cantidadX*35 elif cantidadX<50 and cantidadX>19: montoP=cantidadX*40 elif cantidadX<20: montoP=cantidadX*70 #datos de salida print("el monto a pagar es:",montoP) costodepasajes()
def costodepasajes(): monto_p = 0 cantidad_x = int(input('ingrese la cantidad de estudiantes:')) if cantidadX >= 100: monto_p = cantidadX * 20 elif cantidadX < 100 and cantidadX > 49: monto_p = cantidadX * 35 elif cantidadX < 50 and cantidadX > 19: monto_p = cantidadX * 40 elif cantidadX < 20: monto_p = cantidadX * 70 print('el monto a pagar es:', montoP) costodepasajes()
mylist=[] #python now knows it is a 1D list mylist.append(5) #append is to add a thing to the end print(mylist) #will print only 5 mylist.append(6) print(mylist) #will print 5 AND 6 mylist[1]=7 #value 7 will overwrite the value in position 1 of mylist (which is 6) num=int(input("Enter number to append to the list")) mylist.append(num) #whatever user enters will be added to end of list print("Unsorted List is ",mylist) print(mylist[2]) #prints elemt in position 2 mylist.sort() print("Sorted list is ",mylist) looplist=[] for i in range(10): looplist.append(int(input("Enter element to append to the list in a loop:"))) print("Unsorted list is",looplist) looplist.sort() print("Sorted list is ",looplist) # for element in looplist: # element+=1 print(looplist)
mylist = [] mylist.append(5) print(mylist) mylist.append(6) print(mylist) mylist[1] = 7 num = int(input('Enter number to append to the list')) mylist.append(num) print('Unsorted List is ', mylist) print(mylist[2]) mylist.sort() print('Sorted list is ', mylist) looplist = [] for i in range(10): looplist.append(int(input('Enter element to append to the list in a loop:'))) print('Unsorted list is', looplist) looplist.sort() print('Sorted list is ', looplist) print(looplist)
# HEAD # Classes - Polymorphism # DESCRIPTION # Describes how to create polymorphism using classes # RESOURCES # # Creating Parent class class Parent(): par_cent = "parent" def p_method(self): print("Parent Method invoked with par_cent", self.par_cent) return self.par_cent # Inheriting all Parent attributes # and methods into Child # Form ONE class ChildOne(Parent): chi_one_cent = "childtwo" def c_one_method(self): print("Child Method invoked with chi_one_cent", self.chi_one_cent) # Accessing Parent methods return self.chi_one_cent, self.p_method() # Inheriting all Parent attributes # and methods into Child # Form TWO class ChildTwo(Parent): chi_two_cent = "child" def c_two_method(self): print("Child Method invoked with chi_two_cent", self.chi_two_cent) # Accessing Parent methods return self.chi_two_cent, self.p_method() obj = ChildOne() # Access/Invoke Parent and Child Attributes, Methods print("obj.par_cent ", obj.par_cent) print("obj.chi_one_cent ", obj.chi_one_cent) print("obj.p_method ", obj.p_method()) print("obj.c_one_method ", obj.c_one_method()) obj_two = ChildTwo() # Access/Invoke Parent and Child Attributes, Methods print("obj_two.par_cent ", obj_two.par_cent) print("obj_two.chi_two_cent ", obj_two.chi_two_cent) print("obj_two.p_method ", obj_two.p_method()) print("obj_two.c_two_method ", obj_two.c_two_method())
class Parent: par_cent = 'parent' def p_method(self): print('Parent Method invoked with par_cent', self.par_cent) return self.par_cent class Childone(Parent): chi_one_cent = 'childtwo' def c_one_method(self): print('Child Method invoked with chi_one_cent', self.chi_one_cent) return (self.chi_one_cent, self.p_method()) class Childtwo(Parent): chi_two_cent = 'child' def c_two_method(self): print('Child Method invoked with chi_two_cent', self.chi_two_cent) return (self.chi_two_cent, self.p_method()) obj = child_one() print('obj.par_cent ', obj.par_cent) print('obj.chi_one_cent ', obj.chi_one_cent) print('obj.p_method ', obj.p_method()) print('obj.c_one_method ', obj.c_one_method()) obj_two = child_two() print('obj_two.par_cent ', obj_two.par_cent) print('obj_two.chi_two_cent ', obj_two.chi_two_cent) print('obj_two.p_method ', obj_two.p_method()) print('obj_two.c_two_method ', obj_two.c_two_method())
# Information connected to the email account email = "email@website.com" password = "password" server = "server.website.com" port = 25 # The folder with settings (rss-links.txt and time.txt) folder = "path to folder"
email = 'email@website.com' password = 'password' server = 'server.website.com' port = 25 folder = 'path to folder'
## Copyright 2021 InferStat Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # Data for LBMA Gold price (USD PM fixing) obtained via Quandl.com from the London Bullion Market Association # https://www.quandl.com/data/LBMA-London-Bullion-Market-Association # # Author: Thomas Oliver # Creation date: 11th March 2021 """ Directory for example scripts showing usages of InferTrade. """
""" Directory for example scripts showing usages of InferTrade. """
# parsetab.py # This file is automatically generated. Do not edit. # pylint: disable=W,C,R _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'and closedBra closedParen coma comment div do doubleColon doubleEquals elif else end endline equals exit id if int integer less lessEquals minus more moreEquals mul not notEquals openBra openParen or parens plus print program rea read real string subroutine swap then\n programa : program action_37 id V F action_38 B end program\n \n V : V Tipo Dim doubleColon Rid action_addSymbols action_32\n |\n \n Rid : id\n | Rid coma id\n \n Tipo : integer\n | real\n \n Dim : openBra int action_30 closedBra\n | openBra int action_30 closedBra openBra int action_31 closedBra\n |\n \n F : F subroutine id action_39 B end subroutine action_40\n |\n \n B : B S\n |\n \n S : Dimensional equals EA action_8\n | id parens action_41\n | read RDimensional\n | print RDimOrString\n | if action_16 Relif ElseOrEmpty end if action_20\n | do id action_24 equals EA action_25 coma EA action_26 IntOrEmpty then B action_29 end do\n | do then action_21 B action_22 end do\n | swap Dimensional coma Dimensional\n | exit action_23\n | comment\n \n Dimensional : id DimensionsOrEmpty action_1\n \n DimensionsOrEmpty : openParen EA action_setDim1 ComaEAOrEmpty closedParen\n |\n \n ComaEAOrEmpty : coma EA action_setDim2\n |\n \n RDimensional : Dimensional action_36\n | RDimensional coma Dimensional action_36\n \n RDimOrString : DimOrString\n | RDimOrString coma DimOrString\n \n DimOrString : Dimensional action_33\n | string action_34\n | endline action_34\n \n Relif : openParen EL closedParen action_17 then B\n | Relif elif action_18 openParen EL closedParen action_17 then B\n \n ElseOrEmpty : else action_19 B\n |\n \n IntOrEmpty : coma int action_28\n | action_27\n \n EA : MultDiv\n | EA SumOrSub action_3 MultDiv action_4\n \n SumOrSub : plus\n | minus\n \n MultDiv : EAParens\n | MultDiv MDSymbols action_5 EAParens action_6\n \n MDSymbols : mul\n | div\n \n EAParens : EItem\n | openParen EA closedParen\n \n EL : AND\n | EL or action_10 AND action_9\n \n AND : Equality\n | AND and action_12 Equality action_11\n \n Equality : EItem EQSymbols action_13 EItem action_14\n | openParen EL closedParen\n | not EL action_15\n \n EItem : Dimensional\n | int action_2\n | rea action_2_rea\n \n EQSymbols : less\n | more\n | doubleEquals\n | notEquals\n | lessEquals\n | moreEquals\n action_addSymbols :action_1 :action_2 :action_2_rea :action_3 :action_4 :action_5 :action_6 :action_8 :action_9 :action_10 :action_11 :action_12 :action_13 :action_14 :action_15 :action_16 :action_17 :action_18 :action_19 :action_20 :action_21 :action_22 :action_23 :action_24 :action_25 :action_26 :action_27 :action_28 :action_29 :action_30 :action_31 :action_32 :action_33 :action_34 :action_36 :action_37 :action_38 :action_39 :action_40 :action_41 :action_setDim1 :action_setDim2 :' _lr_action_items = {'program':([0,19,],[2,36,]),'$end':([1,36,],[0,-1,]),'id':([2,3,4,5,6,10,11,14,15,16,20,22,23,25,26,27,28,29,30,31,33,34,35,37,38,39,40,41,42,43,44,45,48,50,51,52,53,55,56,57,59,60,61,62,63,64,65,66,67,68,69,70,71,73,75,76,78,79,83,84,85,86,87,88,89,90,91,92,93,96,97,102,103,104,105,106,108,110,111,112,113,116,119,120,121,122,123,124,125,126,127,131,133,135,136,137,138,139,142,143,144,150,151,152,154,158,159,161,168,172,174,176,179,],[-105,4,-3,-12,-106,-14,15,18,-107,31,-13,40,40,47,40,-92,-24,-14,-69,-4,-109,-70,40,40,-17,-104,-27,-18,-32,-102,-103,-103,-90,-23,18,-101,79,-16,-25,40,-43,-47,-51,-60,-71,-72,-77,40,-30,40,-34,-35,-36,40,-14,40,-2,-5,-73,-45,-46,-75,-49,-50,-61,-62,-15,-104,-33,-88,40,40,40,18,-22,-108,-52,40,40,40,-31,-14,-79,-81,-82,-63,-64,-65,-66,-67,-68,-11,-26,-74,-76,-89,40,18,40,40,40,-44,-48,-19,-14,40,-21,18,-14,18,-14,18,-20,]),'integer':([4,5,30,31,52,78,79,],[-3,8,-69,-4,-101,-2,-5,]),'real':([4,5,30,31,52,78,79,],[-3,9,-69,-4,-101,-2,-5,]),'subroutine':([4,5,6,30,31,52,77,78,79,106,131,],[-3,-12,11,-69,-4,-101,106,-2,-5,-108,-11,]),'end':([4,5,6,10,14,15,20,27,28,29,30,31,33,34,38,39,40,41,42,43,44,45,48,50,51,52,55,56,59,60,61,62,63,64,65,67,69,70,71,72,75,78,79,89,90,91,92,93,94,96,104,105,106,108,113,116,130,131,133,135,136,137,139,150,151,152,154,159,161,168,172,174,176,177,179,],[-3,-12,-106,-14,19,-107,-13,-92,-24,-14,-69,-4,-109,-70,-17,-104,-27,-18,-32,-102,-103,-103,-90,-23,77,-101,-16,-25,-43,-47,-51,-60,-71,-72,-77,-30,-34,-35,-36,-40,-14,-2,-5,-61,-62,-15,-104,-33,114,-88,-91,-22,-108,-52,-31,-14,147,-11,-26,-74,-76,-89,-39,-44,-48,-19,-14,-21,-37,-14,-38,-14,-98,178,-20,]),'read':([4,5,6,10,14,15,20,27,28,29,30,31,33,34,38,39,40,41,42,43,44,45,48,50,51,52,55,56,59,60,61,62,63,64,65,67,69,70,71,75,78,79,89,90,91,92,93,96,104,105,106,108,113,116,131,133,135,136,137,139,150,151,152,154,159,161,168,172,174,176,179,],[-3,-12,-106,-14,22,-107,-13,-92,-24,-14,-69,-4,-109,-70,-17,-104,-27,-18,-32,-102,-103,-103,-90,-23,22,-101,-16,-25,-43,-47,-51,-60,-71,-72,-77,-30,-34,-35,-36,-14,-2,-5,-61,-62,-15,-104,-33,-88,22,-22,-108,-52,-31,-14,-11,-26,-74,-76,-89,22,-44,-48,-19,-14,-21,22,-14,22,-14,22,-20,]),'print':([4,5,6,10,14,15,20,27,28,29,30,31,33,34,38,39,40,41,42,43,44,45,48,50,51,52,55,56,59,60,61,62,63,64,65,67,69,70,71,75,78,79,89,90,91,92,93,96,104,105,106,108,113,116,131,133,135,136,137,139,150,151,152,154,159,161,168,172,174,176,179,],[-3,-12,-106,-14,23,-107,-13,-92,-24,-14,-69,-4,-109,-70,-17,-104,-27,-18,-32,-102,-103,-103,-90,-23,23,-101,-16,-25,-43,-47,-51,-60,-71,-72,-77,-30,-34,-35,-36,-14,-2,-5,-61,-62,-15,-104,-33,-88,23,-22,-108,-52,-31,-14,-11,-26,-74,-76,-89,23,-44,-48,-19,-14,-21,23,-14,23,-14,23,-20,]),'if':([4,5,6,10,14,15,20,27,28,29,30,31,33,34,38,39,40,41,42,43,44,45,48,50,51,52,55,56,59,60,61,62,63,64,65,67,69,70,71,75,78,79,89,90,91,92,93,96,104,105,106,108,113,114,116,131,133,135,136,137,139,150,151,152,154,159,161,168,172,174,176,179,],[-3,-12,-106,-14,24,-107,-13,-92,-24,-14,-69,-4,-109,-70,-17,-104,-27,-18,-32,-102,-103,-103,-90,-23,24,-101,-16,-25,-43,-47,-51,-60,-71,-72,-77,-30,-34,-35,-36,-14,-2,-5,-61,-62,-15,-104,-33,-88,24,-22,-108,-52,-31,137,-14,-11,-26,-74,-76,-89,24,-44,-48,-19,-14,-21,24,-14,24,-14,24,-20,]),'do':([4,5,6,10,14,15,20,27,28,29,30,31,33,34,38,39,40,41,42,43,44,45,48,50,51,52,55,56,59,60,61,62,63,64,65,67,69,70,71,75,78,79,89,90,91,92,93,96,104,105,106,108,113,116,131,133,135,136,137,139,147,150,151,152,154,159,161,168,172,174,176,178,179,],[-3,-12,-106,-14,25,-107,-13,-92,-24,-14,-69,-4,-109,-70,-17,-104,-27,-18,-32,-102,-103,-103,-90,-23,25,-101,-16,-25,-43,-47,-51,-60,-71,-72,-77,-30,-34,-35,-36,-14,-2,-5,-61,-62,-15,-104,-33,-88,25,-22,-108,-52,-31,-14,-11,-26,-74,-76,-89,25,159,-44,-48,-19,-14,-21,25,-14,25,-14,25,179,-20,]),'swap':([4,5,6,10,14,15,20,27,28,29,30,31,33,34,38,39,40,41,42,43,44,45,48,50,51,52,55,56,59,60,61,62,63,64,65,67,69,70,71,75,78,79,89,90,91,92,93,96,104,105,106,108,113,116,131,133,135,136,137,139,150,151,152,154,159,161,168,172,174,176,179,],[-3,-12,-106,-14,26,-107,-13,-92,-24,-14,-69,-4,-109,-70,-17,-104,-27,-18,-32,-102,-103,-103,-90,-23,26,-101,-16,-25,-43,-47,-51,-60,-71,-72,-77,-30,-34,-35,-36,-14,-2,-5,-61,-62,-15,-104,-33,-88,26,-22,-108,-52,-31,-14,-11,-26,-74,-76,-89,26,-44,-48,-19,-14,-21,26,-14,26,-14,26,-20,]),'exit':([4,5,6,10,14,15,20,27,28,29,30,31,33,34,38,39,40,41,42,43,44,45,48,50,51,52,55,56,59,60,61,62,63,64,65,67,69,70,71,75,78,79,89,90,91,92,93,96,104,105,106,108,113,116,131,133,135,136,137,139,150,151,152,154,159,161,168,172,174,176,179,],[-3,-12,-106,-14,27,-107,-13,-92,-24,-14,-69,-4,-109,-70,-17,-104,-27,-18,-32,-102,-103,-103,-90,-23,27,-101,-16,-25,-43,-47,-51,-60,-71,-72,-77,-30,-34,-35,-36,-14,-2,-5,-61,-62,-15,-104,-33,-88,27,-22,-108,-52,-31,-14,-11,-26,-74,-76,-89,27,-44,-48,-19,-14,-21,27,-14,27,-14,27,-20,]),'comment':([4,5,6,10,14,15,20,27,28,29,30,31,33,34,38,39,40,41,42,43,44,45,48,50,51,52,55,56,59,60,61,62,63,64,65,67,69,70,71,75,78,79,89,90,91,92,93,96,104,105,106,108,113,116,131,133,135,136,137,139,150,151,152,154,159,161,168,172,174,176,179,],[-3,-12,-106,-14,28,-107,-13,-92,-24,-14,-69,-4,-109,-70,-17,-104,-27,-18,-32,-102,-103,-103,-90,-23,28,-101,-16,-25,-43,-47,-51,-60,-71,-72,-77,-30,-34,-35,-36,-14,-2,-5,-61,-62,-15,-104,-33,-88,28,-22,-108,-52,-31,-14,-11,-26,-74,-76,-89,28,-44,-48,-19,-14,-21,28,-14,28,-14,28,-20,]),'openBra':([7,8,9,54,],[13,-6,-7,80,]),'doubleColon':([7,8,9,12,54,148,],[-10,-6,-7,16,-8,-9,]),'int':([13,35,37,57,73,80,83,84,85,86,87,88,97,102,103,110,111,112,119,120,121,122,123,124,125,126,127,138,142,143,144,158,169,],[17,63,63,63,63,107,-73,-45,-46,-75,-49,-50,63,63,63,63,63,63,-79,-81,-82,-63,-64,-65,-66,-67,-68,63,63,63,63,63,173,]),'closedBra':([17,32,107,132,],[-99,54,-100,148,]),'parens':([18,],[33,]),'openParen':([18,24,35,37,40,46,57,73,83,84,85,86,87,88,95,97,102,103,110,111,112,115,119,120,138,142,143,158,],[35,-85,57,57,35,73,57,97,-73,-45,-46,-75,-49,-50,-87,97,97,57,57,57,57,138,-79,-81,97,97,97,57,]),'equals':([18,21,34,47,56,74,133,],[-27,37,-70,-93,-25,103,-26,]),'elif':([20,27,28,33,34,38,39,40,41,42,43,44,45,50,55,56,59,60,61,62,63,64,65,67,69,70,71,72,89,90,91,92,93,105,108,113,133,135,136,137,150,151,152,154,159,161,168,172,179,],[-13,-92,-24,-109,-70,-17,-104,-27,-18,-32,-102,-103,-103,-23,-16,-25,-43,-47,-51,-60,-71,-72,-77,-30,-34,-35,-36,95,-61,-62,-15,-104,-33,-22,-52,-31,-26,-74,-76,-89,-44,-48,-19,-14,-21,-37,-14,-38,-20,]),'else':([20,27,28,33,34,38,39,40,41,42,43,44,45,50,55,56,59,60,61,62,63,64,65,67,69,70,71,72,89,90,91,92,93,105,108,113,133,135,136,137,150,151,152,154,159,161,168,172,179,],[-13,-92,-24,-109,-70,-17,-104,-27,-18,-32,-102,-103,-103,-23,-16,-25,-43,-47,-51,-60,-71,-72,-77,-30,-34,-35,-36,96,-61,-62,-15,-104,-33,-22,-52,-31,-26,-74,-76,-89,-44,-48,-19,-14,-21,-37,-14,-38,-20,]),'string':([23,68,],[44,44,]),'endline':([23,68,],[45,45,]),'then':([25,34,40,56,59,60,61,62,63,64,89,90,108,118,133,135,136,141,150,151,160,165,166,167,170,171,173,175,],[48,-70,-27,-25,-43,-47,-51,-60,-71,-72,-61,-62,-52,-86,-26,-74,-76,154,-44,-48,-86,-95,168,-96,174,-42,-97,-41,]),'coma':([30,31,34,38,39,40,41,42,43,44,45,49,56,58,59,60,61,62,63,64,67,69,70,71,79,82,89,90,92,93,108,113,129,133,135,136,146,150,151,165,167,],[53,-4,-70,66,-104,-27,68,-32,-102,-103,-103,76,-25,-110,-43,-47,-51,-60,-71,-72,-30,-34,-35,-36,-5,110,-61,-62,-104,-33,-52,-31,-94,-26,-74,-76,158,-44,-48,-95,169,]),'mul':([34,40,56,59,60,61,62,63,64,89,90,108,133,135,136,151,],[-70,-27,-25,87,-47,-51,-60,-71,-72,-61,-62,-52,-26,87,-76,-48,]),'div':([34,40,56,59,60,61,62,63,64,89,90,108,133,135,136,151,],[-70,-27,-25,88,-47,-51,-60,-71,-72,-61,-62,-52,-26,88,-76,-48,]),'plus':([34,40,56,58,59,60,61,62,63,64,65,81,89,90,108,129,133,134,135,136,150,151,165,],[-70,-27,-25,84,-43,-47,-51,-60,-71,-72,84,84,-61,-62,-52,84,-26,84,-74,-76,-44,-48,84,]),'minus':([34,40,56,58,59,60,61,62,63,64,65,81,89,90,108,129,133,134,135,136,150,151,165,],[-70,-27,-25,85,-43,-47,-51,-60,-71,-72,85,85,-61,-62,-52,85,-26,85,-74,-76,-44,-48,85,]),'closedParen':([34,40,56,58,59,60,61,62,63,64,81,82,89,90,98,99,100,108,109,117,128,133,134,135,136,140,145,149,150,151,153,155,156,157,162,163,164,],[-70,-27,-25,-110,-43,-47,-51,-60,-71,-72,108,-29,-61,-62,118,-53,-55,-52,133,140,-84,-26,-111,-74,-76,-58,-59,-28,-44,-48,160,-78,-80,-83,-54,-56,-57,]),'less':([34,40,56,62,63,64,89,90,101,133,],[-70,-27,-25,-60,-71,-72,-61,-62,122,-26,]),'more':([34,40,56,62,63,64,89,90,101,133,],[-70,-27,-25,-60,-71,-72,-61,-62,123,-26,]),'doubleEquals':([34,40,56,62,63,64,89,90,101,133,],[-70,-27,-25,-60,-71,-72,-61,-62,124,-26,]),'notEquals':([34,40,56,62,63,64,89,90,101,133,],[-70,-27,-25,-60,-71,-72,-61,-62,125,-26,]),'lessEquals':([34,40,56,62,63,64,89,90,101,133,],[-70,-27,-25,-60,-71,-72,-61,-62,126,-26,]),'moreEquals':([34,40,56,62,63,64,89,90,101,133,],[-70,-27,-25,-60,-71,-72,-61,-62,127,-26,]),'and':([34,40,56,62,63,64,89,90,99,100,128,133,140,145,155,156,157,162,163,164,],[-70,-27,-25,-60,-71,-72,-61,-62,120,-55,-84,-26,-58,-59,120,-80,-83,-54,-56,-57,]),'or':([34,40,56,62,63,64,89,90,98,99,100,117,128,133,140,145,153,155,156,157,162,163,164,],[-70,-27,-25,-60,-71,-72,-61,-62,119,-53,-55,119,119,-26,-58,-59,119,-78,-80,-83,-54,-56,-57,]),'rea':([35,37,57,73,83,84,85,86,87,88,97,102,103,110,111,112,119,120,121,122,123,124,125,126,127,138,142,143,144,158,],[64,64,64,64,-73,-45,-46,-75,-49,-50,64,64,64,64,64,64,-79,-81,-82,-63,-64,-65,-66,-67,-68,64,64,64,64,64,]),'not':([73,97,102,119,120,138,142,143,],[102,102,102,-79,-81,102,102,102,]),} _lr_action = {} for _k, _v in _lr_action_items.items(): for _x,_y in zip(_v[0],_v[1]): if not _x in _lr_action: _lr_action[_x] = {} _lr_action[_x][_k] = _y del _lr_action_items _lr_goto_items = {'programa':([0,],[1,]),'action_37':([2,],[3,]),'V':([4,],[5,]),'F':([5,],[6,]),'Tipo':([5,],[7,]),'action_38':([6,],[10,]),'Dim':([7,],[12,]),'B':([10,29,75,116,154,168,174,],[14,51,104,139,161,172,176,]),'S':([14,51,104,139,161,172,176,],[20,20,20,20,20,20,20,]),'Dimensional':([14,22,23,26,35,37,51,57,66,68,73,76,97,102,103,104,110,111,112,138,139,142,143,144,158,161,172,176,],[21,39,43,49,62,62,21,62,92,43,62,105,62,62,62,21,62,62,62,62,21,62,62,62,62,21,21,21,]),'action_39':([15,],[29,]),'Rid':([16,],[30,]),'action_30':([17,],[32,]),'DimensionsOrEmpty':([18,40,],[34,34,]),'RDimensional':([22,],[38,]),'RDimOrString':([23,],[41,]),'DimOrString':([23,68,],[42,93,]),'action_16':([24,],[46,]),'action_23':([27,],[50,]),'action_addSymbols':([30,],[52,]),'action_41':([33,],[55,]),'action_1':([34,],[56,]),'EA':([35,37,57,103,110,158,],[58,65,81,129,134,165,]),'MultDiv':([35,37,57,103,110,111,158,],[59,59,59,59,59,135,59,]),'EAParens':([35,37,57,103,110,111,112,158,],[60,60,60,60,60,60,136,60,]),'EItem':([35,37,57,73,97,102,103,110,111,112,138,142,143,144,158,],[61,61,61,101,101,101,61,61,61,61,101,101,101,157,61,]),'action_36':([39,92,],[67,113,]),'action_33':([43,],[69,]),'action_34':([44,45,],[70,71,]),'Relif':([46,],[72,]),'action_24':([47,],[74,]),'action_21':([48,],[75,]),'action_32':([52,],[78,]),'action_setDim1':([58,],[82,]),'SumOrSub':([58,65,81,129,134,165,],[83,83,83,83,83,83,]),'MDSymbols':([59,135,],[86,86,]),'action_2':([63,],[89,]),'action_2_rea':([64,],[90,]),'action_8':([65,],[91,]),'ElseOrEmpty':([72,],[94,]),'EL':([73,97,102,138,],[98,117,128,153,]),'AND':([73,97,102,138,142,],[99,99,99,99,155,]),'Equality':([73,97,102,138,142,143,],[100,100,100,100,100,156,]),'ComaEAOrEmpty':([82,],[109,]),'action_3':([83,],[111,]),'action_5':([86,],[112,]),'action_18':([95,],[115,]),'action_19':([96,],[116,]),'EQSymbols':([101,],[121,]),'action_22':([104,],[130,]),'action_40':([106,],[131,]),'action_31':([107,],[132,]),'action_17':([118,160,],[141,166,]),'action_10':([119,],[142,]),'action_12':([120,],[143,]),'action_13':([121,],[144,]),'action_15':([128,],[145,]),'action_25':([129,],[146,]),'action_setDim2':([134,],[149,]),'action_4':([135,],[150,]),'action_6':([136,],[151,]),'action_20':([137,],[152,]),'action_9':([155,],[162,]),'action_11':([156,],[163,]),'action_14':([157,],[164,]),'action_26':([165,],[167,]),'IntOrEmpty':([167,],[170,]),'action_27':([167,],[171,]),'action_28':([173,],[175,]),'action_29':([176,],[177,]),} _lr_goto = {} for _k, _v in _lr_goto_items.items(): for _x, _y in zip(_v[0], _v[1]): if not _x in _lr_goto: _lr_goto[_x] = {} _lr_goto[_x][_k] = _y del _lr_goto_items _lr_productions = [ ("S' -> programa","S'",1,None,None,None), ('programa -> program action_37 id V F action_38 B end program','programa',9,'p_programa','fort.py',225), ('V -> V Tipo Dim doubleColon Rid action_addSymbols action_32','V',7,'p_V','fort.py',232), ('V -> <empty>','V',0,'p_V','fort.py',233), ('Rid -> id','Rid',1,'p_Rid','fort.py',239), ('Rid -> Rid coma id','Rid',3,'p_Rid','fort.py',240), ('Tipo -> integer','Tipo',1,'p_Tipo','fort.py',252), ('Tipo -> real','Tipo',1,'p_Tipo','fort.py',253), ('Dim -> openBra int action_30 closedBra','Dim',4,'p_Dim','fort.py',261), ('Dim -> openBra int action_30 closedBra openBra int action_31 closedBra','Dim',8,'p_Dim','fort.py',262), ('Dim -> <empty>','Dim',0,'p_Dim','fort.py',263), ('F -> F subroutine id action_39 B end subroutine action_40','F',8,'p_F','fort.py',269), ('F -> <empty>','F',0,'p_F','fort.py',270), ('B -> B S','B',2,'p_B','fort.py',276), ('B -> <empty>','B',0,'p_B','fort.py',277), ('S -> Dimensional equals EA action_8','S',4,'p_S','fort.py',283), ('S -> id parens action_41','S',3,'p_S','fort.py',284), ('S -> read RDimensional','S',2,'p_S','fort.py',285), ('S -> print RDimOrString','S',2,'p_S','fort.py',286), ('S -> if action_16 Relif ElseOrEmpty end if action_20','S',7,'p_S','fort.py',287), ('S -> do id action_24 equals EA action_25 coma EA action_26 IntOrEmpty then B action_29 end do','S',15,'p_S','fort.py',288), ('S -> do then action_21 B action_22 end do','S',7,'p_S','fort.py',289), ('S -> swap Dimensional coma Dimensional','S',4,'p_S','fort.py',290), ('S -> exit action_23','S',2,'p_S','fort.py',291), ('S -> comment','S',1,'p_S','fort.py',292), ('Dimensional -> id DimensionsOrEmpty action_1','Dimensional',3,'p_Dimensional','fort.py',300), ('DimensionsOrEmpty -> openParen EA action_setDim1 ComaEAOrEmpty closedParen','DimensionsOrEmpty',5,'p_DimensionsOrEmpty','fort.py',307), ('DimensionsOrEmpty -> <empty>','DimensionsOrEmpty',0,'p_DimensionsOrEmpty','fort.py',308), ('ComaEAOrEmpty -> coma EA action_setDim2','ComaEAOrEmpty',3,'p_ComaEAOrEmpty','fort.py',314), ('ComaEAOrEmpty -> <empty>','ComaEAOrEmpty',0,'p_ComaEAOrEmpty','fort.py',315), ('RDimensional -> Dimensional action_36','RDimensional',2,'p_RDimensional','fort.py',321), ('RDimensional -> RDimensional coma Dimensional action_36','RDimensional',4,'p_RDimensional','fort.py',322), ('RDimOrString -> DimOrString','RDimOrString',1,'p_RDimOrString','fort.py',328), ('RDimOrString -> RDimOrString coma DimOrString','RDimOrString',3,'p_RDimOrString','fort.py',329), ('DimOrString -> Dimensional action_33','DimOrString',2,'p_DimOrString','fort.py',335), ('DimOrString -> string action_34','DimOrString',2,'p_DimOrString','fort.py',336), ('DimOrString -> endline action_34','DimOrString',2,'p_DimOrString','fort.py',337), ('Relif -> openParen EL closedParen action_17 then B','Relif',6,'p_Relif','fort.py',343), ('Relif -> Relif elif action_18 openParen EL closedParen action_17 then B','Relif',9,'p_Relif','fort.py',344), ('ElseOrEmpty -> else action_19 B','ElseOrEmpty',3,'p_ElseOrEmpty','fort.py',350), ('ElseOrEmpty -> <empty>','ElseOrEmpty',0,'p_ElseOrEmpty','fort.py',351), ('IntOrEmpty -> coma int action_28','IntOrEmpty',3,'p_IntOrEmpty','fort.py',357), ('IntOrEmpty -> action_27','IntOrEmpty',1,'p_IntOrEmpty','fort.py',358), ('EA -> MultDiv','EA',1,'p_EA','fort.py',364), ('EA -> EA SumOrSub action_3 MultDiv action_4','EA',5,'p_EA','fort.py',365), ('SumOrSub -> plus','SumOrSub',1,'p_SumOrSub','fort.py',371), ('SumOrSub -> minus','SumOrSub',1,'p_SumOrSub','fort.py',372), ('MultDiv -> EAParens','MultDiv',1,'p_MultDiv','fort.py',379), ('MultDiv -> MultDiv MDSymbols action_5 EAParens action_6','MultDiv',5,'p_MultDiv','fort.py',380), ('MDSymbols -> mul','MDSymbols',1,'p_MDSymbols','fort.py',386), ('MDSymbols -> div','MDSymbols',1,'p_MDSymbols','fort.py',387), ('EAParens -> EItem','EAParens',1,'p_EAParens','fort.py',394), ('EAParens -> openParen EA closedParen','EAParens',3,'p_EAParens','fort.py',395), ('EL -> AND','EL',1,'p_EL','fort.py',401), ('EL -> EL or action_10 AND action_9','EL',5,'p_EL','fort.py',402), ('AND -> Equality','AND',1,'p_AND','fort.py',408), ('AND -> AND and action_12 Equality action_11','AND',5,'p_AND','fort.py',409), ('Equality -> EItem EQSymbols action_13 EItem action_14','Equality',5,'p_Equality','fort.py',415), ('Equality -> openParen EL closedParen','Equality',3,'p_Equality','fort.py',416), ('Equality -> not EL action_15','Equality',3,'p_Equality','fort.py',417), ('EItem -> Dimensional','EItem',1,'p_EItem','fort.py',423), ('EItem -> int action_2','EItem',2,'p_EItem','fort.py',424), ('EItem -> rea action_2_rea','EItem',2,'p_EItem','fort.py',425), ('EQSymbols -> less','EQSymbols',1,'p_EQSymbols','fort.py',431), ('EQSymbols -> more','EQSymbols',1,'p_EQSymbols','fort.py',432), ('EQSymbols -> doubleEquals','EQSymbols',1,'p_EQSymbols','fort.py',433), ('EQSymbols -> notEquals','EQSymbols',1,'p_EQSymbols','fort.py',434), ('EQSymbols -> lessEquals','EQSymbols',1,'p_EQSymbols','fort.py',435), ('EQSymbols -> moreEquals','EQSymbols',1,'p_EQSymbols','fort.py',436), ('action_addSymbols -> <empty>','action_addSymbols',0,'p_action_addSymbols','fort.py',446), ('action_1 -> <empty>','action_1',0,'p_action_1','fort.py',452), ('action_2 -> <empty>','action_2',0,'p_action_2','fort.py',500), ('action_2_rea -> <empty>','action_2_rea',0,'p_action_2_rea','fort.py',506), ('action_3 -> <empty>','action_3',0,'p_action_3','fort.py',512), ('action_4 -> <empty>','action_4',0,'p_action_4','fort.py',517), ('action_5 -> <empty>','action_5',0,'p_action_5','fort.py',540), ('action_6 -> <empty>','action_6',0,'p_action_6','fort.py',545), ('action_8 -> <empty>','action_8',0,'p_action_8','fort.py',568), ('action_9 -> <empty>','action_9',0,'p_action_9','fort.py',588), ('action_10 -> <empty>','action_10',0,'p_action_10','fort.py',611), ('action_11 -> <empty>','action_11',0,'p_action_11','fort.py',616), ('action_12 -> <empty>','action_12',0,'p_action_12','fort.py',639), ('action_13 -> <empty>','action_13',0,'p_action_13','fort.py',644), ('action_14 -> <empty>','action_14',0,'p_action_14','fort.py',649), ('action_15 -> <empty>','action_15',0,'p_action_15','fort.py',672), ('action_16 -> <empty>','action_16',0,'p_action_16','fort.py',687), ('action_17 -> <empty>','action_17',0,'p_action_17','fort.py',692), ('action_18 -> <empty>','action_18',0,'p_action_18','fort.py',708), ('action_19 -> <empty>','action_19',0,'p_action_19','fort.py',718), ('action_20 -> <empty>','action_20',0,'p_action_20','fort.py',728), ('action_21 -> <empty>','action_21',0,'p_action_21','fort.py',736), ('action_22 -> <empty>','action_22',0,'p_action_22','fort.py',742), ('action_23 -> <empty>','action_23',0,'p_action_23','fort.py',755), ('action_24 -> <empty>','action_24',0,'p_action_24','fort.py',764), ('action_25 -> <empty>','action_25',0,'p_action_25','fort.py',778), ('action_26 -> <empty>','action_26',0,'p_action_26','fort.py',796), ('action_27 -> <empty>','action_27',0,'p_action_27','fort.py',820), ('action_28 -> <empty>','action_28',0,'p_action_28','fort.py',826), ('action_29 -> <empty>','action_29',0,'p_action_29','fort.py',832), ('action_30 -> <empty>','action_30',0,'p_action_30','fort.py',856), ('action_31 -> <empty>','action_31',0,'p_action_31','fort.py',864), ('action_32 -> <empty>','action_32',0,'p_action_32','fort.py',872), ('action_33 -> <empty>','action_33',0,'p_action_33','fort.py',882), ('action_34 -> <empty>','action_34',0,'p_action_34','fort.py',894), ('action_36 -> <empty>','action_36',0,'p_action_36','fort.py',901), ('action_37 -> <empty>','action_37',0,'p_action_37','fort.py',910), ('action_38 -> <empty>','action_38',0,'p_action_38','fort.py',917), ('action_39 -> <empty>','action_39',0,'p_action_39','fort.py',923), ('action_40 -> <empty>','action_40',0,'p_action_40','fort.py',930), ('action_41 -> <empty>','action_41',0,'p_action_41','fort.py',937), ('action_setDim1 -> <empty>','action_setDim1',0,'p_action_setDim1','fort.py',949), ('action_setDim2 -> <empty>','action_setDim2',0,'p_action_setDim2','fort.py',960), ]
_tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'and closedBra closedParen coma comment div do doubleColon doubleEquals elif else end endline equals exit id if int integer less lessEquals minus more moreEquals mul not notEquals openBra openParen or parens plus print program rea read real string subroutine swap then\n programa : program action_37 id V F action_38 B end program\n \n V : V Tipo Dim doubleColon Rid action_addSymbols action_32\n |\n \n Rid : id\n | Rid coma id\n \n Tipo : integer\n | real\n \n Dim : openBra int action_30 closedBra\n | openBra int action_30 closedBra openBra int action_31 closedBra\n |\n \n F : F subroutine id action_39 B end subroutine action_40\n |\n \n B : B S\n |\n \n S : Dimensional equals EA action_8\n | id parens action_41\n | read RDimensional\n | print RDimOrString\n | if action_16 Relif ElseOrEmpty end if action_20\n | do id action_24 equals EA action_25 coma EA action_26 IntOrEmpty then B action_29 end do\n | do then action_21 B action_22 end do\n | swap Dimensional coma Dimensional\n | exit action_23\n | comment\n \n Dimensional : id DimensionsOrEmpty action_1\n \n DimensionsOrEmpty : openParen EA action_setDim1 ComaEAOrEmpty closedParen\n |\n \n ComaEAOrEmpty : coma EA action_setDim2\n |\n \n RDimensional : Dimensional action_36\n | RDimensional coma Dimensional action_36\n \n RDimOrString : DimOrString\n | RDimOrString coma DimOrString\n \n DimOrString : Dimensional action_33\n | string action_34\n | endline action_34\n \n Relif : openParen EL closedParen action_17 then B\n | Relif elif action_18 openParen EL closedParen action_17 then B\n \n ElseOrEmpty : else action_19 B\n |\n \n IntOrEmpty : coma int action_28\n | action_27\n \n EA : MultDiv\n | EA SumOrSub action_3 MultDiv action_4\n \n SumOrSub : plus\n | minus\n \n MultDiv : EAParens\n | MultDiv MDSymbols action_5 EAParens action_6\n \n MDSymbols : mul\n | div\n \n EAParens : EItem\n | openParen EA closedParen\n \n EL : AND\n | EL or action_10 AND action_9\n \n AND : Equality\n | AND and action_12 Equality action_11\n \n Equality : EItem EQSymbols action_13 EItem action_14\n | openParen EL closedParen\n | not EL action_15\n \n EItem : Dimensional\n | int action_2\n | rea action_2_rea\n \n EQSymbols : less\n | more\n | doubleEquals\n | notEquals\n | lessEquals\n | moreEquals\n action_addSymbols :action_1 :action_2 :action_2_rea :action_3 :action_4 :action_5 :action_6 :action_8 :action_9 :action_10 :action_11 :action_12 :action_13 :action_14 :action_15 :action_16 :action_17 :action_18 :action_19 :action_20 :action_21 :action_22 :action_23 :action_24 :action_25 :action_26 :action_27 :action_28 :action_29 :action_30 :action_31 :action_32 :action_33 :action_34 :action_36 :action_37 :action_38 :action_39 :action_40 :action_41 :action_setDim1 :action_setDim2 :' _lr_action_items = {'program': ([0, 19], [2, 36]), '$end': ([1, 36], [0, -1]), 'id': ([2, 3, 4, 5, 6, 10, 11, 14, 15, 16, 20, 22, 23, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 37, 38, 39, 40, 41, 42, 43, 44, 45, 48, 50, 51, 52, 53, 55, 56, 57, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 73, 75, 76, 78, 79, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 96, 97, 102, 103, 104, 105, 106, 108, 110, 111, 112, 113, 116, 119, 120, 121, 122, 123, 124, 125, 126, 127, 131, 133, 135, 136, 137, 138, 139, 142, 143, 144, 150, 151, 152, 154, 158, 159, 161, 168, 172, 174, 176, 179], [-105, 4, -3, -12, -106, -14, 15, 18, -107, 31, -13, 40, 40, 47, 40, -92, -24, -14, -69, -4, -109, -70, 40, 40, -17, -104, -27, -18, -32, -102, -103, -103, -90, -23, 18, -101, 79, -16, -25, 40, -43, -47, -51, -60, -71, -72, -77, 40, -30, 40, -34, -35, -36, 40, -14, 40, -2, -5, -73, -45, -46, -75, -49, -50, -61, -62, -15, -104, -33, -88, 40, 40, 40, 18, -22, -108, -52, 40, 40, 40, -31, -14, -79, -81, -82, -63, -64, -65, -66, -67, -68, -11, -26, -74, -76, -89, 40, 18, 40, 40, 40, -44, -48, -19, -14, 40, -21, 18, -14, 18, -14, 18, -20]), 'integer': ([4, 5, 30, 31, 52, 78, 79], [-3, 8, -69, -4, -101, -2, -5]), 'real': ([4, 5, 30, 31, 52, 78, 79], [-3, 9, -69, -4, -101, -2, -5]), 'subroutine': ([4, 5, 6, 30, 31, 52, 77, 78, 79, 106, 131], [-3, -12, 11, -69, -4, -101, 106, -2, -5, -108, -11]), 'end': ([4, 5, 6, 10, 14, 15, 20, 27, 28, 29, 30, 31, 33, 34, 38, 39, 40, 41, 42, 43, 44, 45, 48, 50, 51, 52, 55, 56, 59, 60, 61, 62, 63, 64, 65, 67, 69, 70, 71, 72, 75, 78, 79, 89, 90, 91, 92, 93, 94, 96, 104, 105, 106, 108, 113, 116, 130, 131, 133, 135, 136, 137, 139, 150, 151, 152, 154, 159, 161, 168, 172, 174, 176, 177, 179], [-3, -12, -106, -14, 19, -107, -13, -92, -24, -14, -69, -4, -109, -70, -17, -104, -27, -18, -32, -102, -103, -103, -90, -23, 77, -101, -16, -25, -43, -47, -51, -60, -71, -72, -77, -30, -34, -35, -36, -40, -14, -2, -5, -61, -62, -15, -104, -33, 114, -88, -91, -22, -108, -52, -31, -14, 147, -11, -26, -74, -76, -89, -39, -44, -48, -19, -14, -21, -37, -14, -38, -14, -98, 178, -20]), 'read': ([4, 5, 6, 10, 14, 15, 20, 27, 28, 29, 30, 31, 33, 34, 38, 39, 40, 41, 42, 43, 44, 45, 48, 50, 51, 52, 55, 56, 59, 60, 61, 62, 63, 64, 65, 67, 69, 70, 71, 75, 78, 79, 89, 90, 91, 92, 93, 96, 104, 105, 106, 108, 113, 116, 131, 133, 135, 136, 137, 139, 150, 151, 152, 154, 159, 161, 168, 172, 174, 176, 179], [-3, -12, -106, -14, 22, -107, -13, -92, -24, -14, -69, -4, -109, -70, -17, -104, -27, -18, -32, -102, -103, -103, -90, -23, 22, -101, -16, -25, -43, -47, -51, -60, -71, -72, -77, -30, -34, -35, -36, -14, -2, -5, -61, -62, -15, -104, -33, -88, 22, -22, -108, -52, -31, -14, -11, -26, -74, -76, -89, 22, -44, -48, -19, -14, -21, 22, -14, 22, -14, 22, -20]), 'print': ([4, 5, 6, 10, 14, 15, 20, 27, 28, 29, 30, 31, 33, 34, 38, 39, 40, 41, 42, 43, 44, 45, 48, 50, 51, 52, 55, 56, 59, 60, 61, 62, 63, 64, 65, 67, 69, 70, 71, 75, 78, 79, 89, 90, 91, 92, 93, 96, 104, 105, 106, 108, 113, 116, 131, 133, 135, 136, 137, 139, 150, 151, 152, 154, 159, 161, 168, 172, 174, 176, 179], [-3, -12, -106, -14, 23, -107, -13, -92, -24, -14, -69, -4, -109, -70, -17, -104, -27, -18, -32, -102, -103, -103, -90, -23, 23, -101, -16, -25, -43, -47, -51, -60, -71, -72, -77, -30, -34, -35, -36, -14, -2, -5, -61, -62, -15, -104, -33, -88, 23, -22, -108, -52, -31, -14, -11, -26, -74, -76, -89, 23, -44, -48, -19, -14, -21, 23, -14, 23, -14, 23, -20]), 'if': ([4, 5, 6, 10, 14, 15, 20, 27, 28, 29, 30, 31, 33, 34, 38, 39, 40, 41, 42, 43, 44, 45, 48, 50, 51, 52, 55, 56, 59, 60, 61, 62, 63, 64, 65, 67, 69, 70, 71, 75, 78, 79, 89, 90, 91, 92, 93, 96, 104, 105, 106, 108, 113, 114, 116, 131, 133, 135, 136, 137, 139, 150, 151, 152, 154, 159, 161, 168, 172, 174, 176, 179], [-3, -12, -106, -14, 24, -107, -13, -92, -24, -14, -69, -4, -109, -70, -17, -104, -27, -18, -32, -102, -103, -103, -90, -23, 24, -101, -16, -25, -43, -47, -51, -60, -71, -72, -77, -30, -34, -35, -36, -14, -2, -5, -61, -62, -15, -104, -33, -88, 24, -22, -108, -52, -31, 137, -14, -11, -26, -74, -76, -89, 24, -44, -48, -19, -14, -21, 24, -14, 24, -14, 24, -20]), 'do': ([4, 5, 6, 10, 14, 15, 20, 27, 28, 29, 30, 31, 33, 34, 38, 39, 40, 41, 42, 43, 44, 45, 48, 50, 51, 52, 55, 56, 59, 60, 61, 62, 63, 64, 65, 67, 69, 70, 71, 75, 78, 79, 89, 90, 91, 92, 93, 96, 104, 105, 106, 108, 113, 116, 131, 133, 135, 136, 137, 139, 147, 150, 151, 152, 154, 159, 161, 168, 172, 174, 176, 178, 179], [-3, -12, -106, -14, 25, -107, -13, -92, -24, -14, -69, -4, -109, -70, -17, -104, -27, -18, -32, -102, -103, -103, -90, -23, 25, -101, -16, -25, -43, -47, -51, -60, -71, -72, -77, -30, -34, -35, -36, -14, -2, -5, -61, -62, -15, -104, -33, -88, 25, -22, -108, -52, -31, -14, -11, -26, -74, -76, -89, 25, 159, -44, -48, -19, -14, -21, 25, -14, 25, -14, 25, 179, -20]), 'swap': ([4, 5, 6, 10, 14, 15, 20, 27, 28, 29, 30, 31, 33, 34, 38, 39, 40, 41, 42, 43, 44, 45, 48, 50, 51, 52, 55, 56, 59, 60, 61, 62, 63, 64, 65, 67, 69, 70, 71, 75, 78, 79, 89, 90, 91, 92, 93, 96, 104, 105, 106, 108, 113, 116, 131, 133, 135, 136, 137, 139, 150, 151, 152, 154, 159, 161, 168, 172, 174, 176, 179], [-3, -12, -106, -14, 26, -107, -13, -92, -24, -14, -69, -4, -109, -70, -17, -104, -27, -18, -32, -102, -103, -103, -90, -23, 26, -101, -16, -25, -43, -47, -51, -60, -71, -72, -77, -30, -34, -35, -36, -14, -2, -5, -61, -62, -15, -104, -33, -88, 26, -22, -108, -52, -31, -14, -11, -26, -74, -76, -89, 26, -44, -48, -19, -14, -21, 26, -14, 26, -14, 26, -20]), 'exit': ([4, 5, 6, 10, 14, 15, 20, 27, 28, 29, 30, 31, 33, 34, 38, 39, 40, 41, 42, 43, 44, 45, 48, 50, 51, 52, 55, 56, 59, 60, 61, 62, 63, 64, 65, 67, 69, 70, 71, 75, 78, 79, 89, 90, 91, 92, 93, 96, 104, 105, 106, 108, 113, 116, 131, 133, 135, 136, 137, 139, 150, 151, 152, 154, 159, 161, 168, 172, 174, 176, 179], [-3, -12, -106, -14, 27, -107, -13, -92, -24, -14, -69, -4, -109, -70, -17, -104, -27, -18, -32, -102, -103, -103, -90, -23, 27, -101, -16, -25, -43, -47, -51, -60, -71, -72, -77, -30, -34, -35, -36, -14, -2, -5, -61, -62, -15, -104, -33, -88, 27, -22, -108, -52, -31, -14, -11, -26, -74, -76, -89, 27, -44, -48, -19, -14, -21, 27, -14, 27, -14, 27, -20]), 'comment': ([4, 5, 6, 10, 14, 15, 20, 27, 28, 29, 30, 31, 33, 34, 38, 39, 40, 41, 42, 43, 44, 45, 48, 50, 51, 52, 55, 56, 59, 60, 61, 62, 63, 64, 65, 67, 69, 70, 71, 75, 78, 79, 89, 90, 91, 92, 93, 96, 104, 105, 106, 108, 113, 116, 131, 133, 135, 136, 137, 139, 150, 151, 152, 154, 159, 161, 168, 172, 174, 176, 179], [-3, -12, -106, -14, 28, -107, -13, -92, -24, -14, -69, -4, -109, -70, -17, -104, -27, -18, -32, -102, -103, -103, -90, -23, 28, -101, -16, -25, -43, -47, -51, -60, -71, -72, -77, -30, -34, -35, -36, -14, -2, -5, -61, -62, -15, -104, -33, -88, 28, -22, -108, -52, -31, -14, -11, -26, -74, -76, -89, 28, -44, -48, -19, -14, -21, 28, -14, 28, -14, 28, -20]), 'openBra': ([7, 8, 9, 54], [13, -6, -7, 80]), 'doubleColon': ([7, 8, 9, 12, 54, 148], [-10, -6, -7, 16, -8, -9]), 'int': ([13, 35, 37, 57, 73, 80, 83, 84, 85, 86, 87, 88, 97, 102, 103, 110, 111, 112, 119, 120, 121, 122, 123, 124, 125, 126, 127, 138, 142, 143, 144, 158, 169], [17, 63, 63, 63, 63, 107, -73, -45, -46, -75, -49, -50, 63, 63, 63, 63, 63, 63, -79, -81, -82, -63, -64, -65, -66, -67, -68, 63, 63, 63, 63, 63, 173]), 'closedBra': ([17, 32, 107, 132], [-99, 54, -100, 148]), 'parens': ([18], [33]), 'openParen': ([18, 24, 35, 37, 40, 46, 57, 73, 83, 84, 85, 86, 87, 88, 95, 97, 102, 103, 110, 111, 112, 115, 119, 120, 138, 142, 143, 158], [35, -85, 57, 57, 35, 73, 57, 97, -73, -45, -46, -75, -49, -50, -87, 97, 97, 57, 57, 57, 57, 138, -79, -81, 97, 97, 97, 57]), 'equals': ([18, 21, 34, 47, 56, 74, 133], [-27, 37, -70, -93, -25, 103, -26]), 'elif': ([20, 27, 28, 33, 34, 38, 39, 40, 41, 42, 43, 44, 45, 50, 55, 56, 59, 60, 61, 62, 63, 64, 65, 67, 69, 70, 71, 72, 89, 90, 91, 92, 93, 105, 108, 113, 133, 135, 136, 137, 150, 151, 152, 154, 159, 161, 168, 172, 179], [-13, -92, -24, -109, -70, -17, -104, -27, -18, -32, -102, -103, -103, -23, -16, -25, -43, -47, -51, -60, -71, -72, -77, -30, -34, -35, -36, 95, -61, -62, -15, -104, -33, -22, -52, -31, -26, -74, -76, -89, -44, -48, -19, -14, -21, -37, -14, -38, -20]), 'else': ([20, 27, 28, 33, 34, 38, 39, 40, 41, 42, 43, 44, 45, 50, 55, 56, 59, 60, 61, 62, 63, 64, 65, 67, 69, 70, 71, 72, 89, 90, 91, 92, 93, 105, 108, 113, 133, 135, 136, 137, 150, 151, 152, 154, 159, 161, 168, 172, 179], [-13, -92, -24, -109, -70, -17, -104, -27, -18, -32, -102, -103, -103, -23, -16, -25, -43, -47, -51, -60, -71, -72, -77, -30, -34, -35, -36, 96, -61, -62, -15, -104, -33, -22, -52, -31, -26, -74, -76, -89, -44, -48, -19, -14, -21, -37, -14, -38, -20]), 'string': ([23, 68], [44, 44]), 'endline': ([23, 68], [45, 45]), 'then': ([25, 34, 40, 56, 59, 60, 61, 62, 63, 64, 89, 90, 108, 118, 133, 135, 136, 141, 150, 151, 160, 165, 166, 167, 170, 171, 173, 175], [48, -70, -27, -25, -43, -47, -51, -60, -71, -72, -61, -62, -52, -86, -26, -74, -76, 154, -44, -48, -86, -95, 168, -96, 174, -42, -97, -41]), 'coma': ([30, 31, 34, 38, 39, 40, 41, 42, 43, 44, 45, 49, 56, 58, 59, 60, 61, 62, 63, 64, 67, 69, 70, 71, 79, 82, 89, 90, 92, 93, 108, 113, 129, 133, 135, 136, 146, 150, 151, 165, 167], [53, -4, -70, 66, -104, -27, 68, -32, -102, -103, -103, 76, -25, -110, -43, -47, -51, -60, -71, -72, -30, -34, -35, -36, -5, 110, -61, -62, -104, -33, -52, -31, -94, -26, -74, -76, 158, -44, -48, -95, 169]), 'mul': ([34, 40, 56, 59, 60, 61, 62, 63, 64, 89, 90, 108, 133, 135, 136, 151], [-70, -27, -25, 87, -47, -51, -60, -71, -72, -61, -62, -52, -26, 87, -76, -48]), 'div': ([34, 40, 56, 59, 60, 61, 62, 63, 64, 89, 90, 108, 133, 135, 136, 151], [-70, -27, -25, 88, -47, -51, -60, -71, -72, -61, -62, -52, -26, 88, -76, -48]), 'plus': ([34, 40, 56, 58, 59, 60, 61, 62, 63, 64, 65, 81, 89, 90, 108, 129, 133, 134, 135, 136, 150, 151, 165], [-70, -27, -25, 84, -43, -47, -51, -60, -71, -72, 84, 84, -61, -62, -52, 84, -26, 84, -74, -76, -44, -48, 84]), 'minus': ([34, 40, 56, 58, 59, 60, 61, 62, 63, 64, 65, 81, 89, 90, 108, 129, 133, 134, 135, 136, 150, 151, 165], [-70, -27, -25, 85, -43, -47, -51, -60, -71, -72, 85, 85, -61, -62, -52, 85, -26, 85, -74, -76, -44, -48, 85]), 'closedParen': ([34, 40, 56, 58, 59, 60, 61, 62, 63, 64, 81, 82, 89, 90, 98, 99, 100, 108, 109, 117, 128, 133, 134, 135, 136, 140, 145, 149, 150, 151, 153, 155, 156, 157, 162, 163, 164], [-70, -27, -25, -110, -43, -47, -51, -60, -71, -72, 108, -29, -61, -62, 118, -53, -55, -52, 133, 140, -84, -26, -111, -74, -76, -58, -59, -28, -44, -48, 160, -78, -80, -83, -54, -56, -57]), 'less': ([34, 40, 56, 62, 63, 64, 89, 90, 101, 133], [-70, -27, -25, -60, -71, -72, -61, -62, 122, -26]), 'more': ([34, 40, 56, 62, 63, 64, 89, 90, 101, 133], [-70, -27, -25, -60, -71, -72, -61, -62, 123, -26]), 'doubleEquals': ([34, 40, 56, 62, 63, 64, 89, 90, 101, 133], [-70, -27, -25, -60, -71, -72, -61, -62, 124, -26]), 'notEquals': ([34, 40, 56, 62, 63, 64, 89, 90, 101, 133], [-70, -27, -25, -60, -71, -72, -61, -62, 125, -26]), 'lessEquals': ([34, 40, 56, 62, 63, 64, 89, 90, 101, 133], [-70, -27, -25, -60, -71, -72, -61, -62, 126, -26]), 'moreEquals': ([34, 40, 56, 62, 63, 64, 89, 90, 101, 133], [-70, -27, -25, -60, -71, -72, -61, -62, 127, -26]), 'and': ([34, 40, 56, 62, 63, 64, 89, 90, 99, 100, 128, 133, 140, 145, 155, 156, 157, 162, 163, 164], [-70, -27, -25, -60, -71, -72, -61, -62, 120, -55, -84, -26, -58, -59, 120, -80, -83, -54, -56, -57]), 'or': ([34, 40, 56, 62, 63, 64, 89, 90, 98, 99, 100, 117, 128, 133, 140, 145, 153, 155, 156, 157, 162, 163, 164], [-70, -27, -25, -60, -71, -72, -61, -62, 119, -53, -55, 119, 119, -26, -58, -59, 119, -78, -80, -83, -54, -56, -57]), 'rea': ([35, 37, 57, 73, 83, 84, 85, 86, 87, 88, 97, 102, 103, 110, 111, 112, 119, 120, 121, 122, 123, 124, 125, 126, 127, 138, 142, 143, 144, 158], [64, 64, 64, 64, -73, -45, -46, -75, -49, -50, 64, 64, 64, 64, 64, 64, -79, -81, -82, -63, -64, -65, -66, -67, -68, 64, 64, 64, 64, 64]), 'not': ([73, 97, 102, 119, 120, 138, 142, 143], [102, 102, 102, -79, -81, 102, 102, 102])} _lr_action = {} for (_k, _v) in _lr_action_items.items(): for (_x, _y) in zip(_v[0], _v[1]): if not _x in _lr_action: _lr_action[_x] = {} _lr_action[_x][_k] = _y del _lr_action_items _lr_goto_items = {'programa': ([0], [1]), 'action_37': ([2], [3]), 'V': ([4], [5]), 'F': ([5], [6]), 'Tipo': ([5], [7]), 'action_38': ([6], [10]), 'Dim': ([7], [12]), 'B': ([10, 29, 75, 116, 154, 168, 174], [14, 51, 104, 139, 161, 172, 176]), 'S': ([14, 51, 104, 139, 161, 172, 176], [20, 20, 20, 20, 20, 20, 20]), 'Dimensional': ([14, 22, 23, 26, 35, 37, 51, 57, 66, 68, 73, 76, 97, 102, 103, 104, 110, 111, 112, 138, 139, 142, 143, 144, 158, 161, 172, 176], [21, 39, 43, 49, 62, 62, 21, 62, 92, 43, 62, 105, 62, 62, 62, 21, 62, 62, 62, 62, 21, 62, 62, 62, 62, 21, 21, 21]), 'action_39': ([15], [29]), 'Rid': ([16], [30]), 'action_30': ([17], [32]), 'DimensionsOrEmpty': ([18, 40], [34, 34]), 'RDimensional': ([22], [38]), 'RDimOrString': ([23], [41]), 'DimOrString': ([23, 68], [42, 93]), 'action_16': ([24], [46]), 'action_23': ([27], [50]), 'action_addSymbols': ([30], [52]), 'action_41': ([33], [55]), 'action_1': ([34], [56]), 'EA': ([35, 37, 57, 103, 110, 158], [58, 65, 81, 129, 134, 165]), 'MultDiv': ([35, 37, 57, 103, 110, 111, 158], [59, 59, 59, 59, 59, 135, 59]), 'EAParens': ([35, 37, 57, 103, 110, 111, 112, 158], [60, 60, 60, 60, 60, 60, 136, 60]), 'EItem': ([35, 37, 57, 73, 97, 102, 103, 110, 111, 112, 138, 142, 143, 144, 158], [61, 61, 61, 101, 101, 101, 61, 61, 61, 61, 101, 101, 101, 157, 61]), 'action_36': ([39, 92], [67, 113]), 'action_33': ([43], [69]), 'action_34': ([44, 45], [70, 71]), 'Relif': ([46], [72]), 'action_24': ([47], [74]), 'action_21': ([48], [75]), 'action_32': ([52], [78]), 'action_setDim1': ([58], [82]), 'SumOrSub': ([58, 65, 81, 129, 134, 165], [83, 83, 83, 83, 83, 83]), 'MDSymbols': ([59, 135], [86, 86]), 'action_2': ([63], [89]), 'action_2_rea': ([64], [90]), 'action_8': ([65], [91]), 'ElseOrEmpty': ([72], [94]), 'EL': ([73, 97, 102, 138], [98, 117, 128, 153]), 'AND': ([73, 97, 102, 138, 142], [99, 99, 99, 99, 155]), 'Equality': ([73, 97, 102, 138, 142, 143], [100, 100, 100, 100, 100, 156]), 'ComaEAOrEmpty': ([82], [109]), 'action_3': ([83], [111]), 'action_5': ([86], [112]), 'action_18': ([95], [115]), 'action_19': ([96], [116]), 'EQSymbols': ([101], [121]), 'action_22': ([104], [130]), 'action_40': ([106], [131]), 'action_31': ([107], [132]), 'action_17': ([118, 160], [141, 166]), 'action_10': ([119], [142]), 'action_12': ([120], [143]), 'action_13': ([121], [144]), 'action_15': ([128], [145]), 'action_25': ([129], [146]), 'action_setDim2': ([134], [149]), 'action_4': ([135], [150]), 'action_6': ([136], [151]), 'action_20': ([137], [152]), 'action_9': ([155], [162]), 'action_11': ([156], [163]), 'action_14': ([157], [164]), 'action_26': ([165], [167]), 'IntOrEmpty': ([167], [170]), 'action_27': ([167], [171]), 'action_28': ([173], [175]), 'action_29': ([176], [177])} _lr_goto = {} for (_k, _v) in _lr_goto_items.items(): for (_x, _y) in zip(_v[0], _v[1]): if not _x in _lr_goto: _lr_goto[_x] = {} _lr_goto[_x][_k] = _y del _lr_goto_items _lr_productions = [("S' -> programa", "S'", 1, None, None, None), ('programa -> program action_37 id V F action_38 B end program', 'programa', 9, 'p_programa', 'fort.py', 225), ('V -> V Tipo Dim doubleColon Rid action_addSymbols action_32', 'V', 7, 'p_V', 'fort.py', 232), ('V -> <empty>', 'V', 0, 'p_V', 'fort.py', 233), ('Rid -> id', 'Rid', 1, 'p_Rid', 'fort.py', 239), ('Rid -> Rid coma id', 'Rid', 3, 'p_Rid', 'fort.py', 240), ('Tipo -> integer', 'Tipo', 1, 'p_Tipo', 'fort.py', 252), ('Tipo -> real', 'Tipo', 1, 'p_Tipo', 'fort.py', 253), ('Dim -> openBra int action_30 closedBra', 'Dim', 4, 'p_Dim', 'fort.py', 261), ('Dim -> openBra int action_30 closedBra openBra int action_31 closedBra', 'Dim', 8, 'p_Dim', 'fort.py', 262), ('Dim -> <empty>', 'Dim', 0, 'p_Dim', 'fort.py', 263), ('F -> F subroutine id action_39 B end subroutine action_40', 'F', 8, 'p_F', 'fort.py', 269), ('F -> <empty>', 'F', 0, 'p_F', 'fort.py', 270), ('B -> B S', 'B', 2, 'p_B', 'fort.py', 276), ('B -> <empty>', 'B', 0, 'p_B', 'fort.py', 277), ('S -> Dimensional equals EA action_8', 'S', 4, 'p_S', 'fort.py', 283), ('S -> id parens action_41', 'S', 3, 'p_S', 'fort.py', 284), ('S -> read RDimensional', 'S', 2, 'p_S', 'fort.py', 285), ('S -> print RDimOrString', 'S', 2, 'p_S', 'fort.py', 286), ('S -> if action_16 Relif ElseOrEmpty end if action_20', 'S', 7, 'p_S', 'fort.py', 287), ('S -> do id action_24 equals EA action_25 coma EA action_26 IntOrEmpty then B action_29 end do', 'S', 15, 'p_S', 'fort.py', 288), ('S -> do then action_21 B action_22 end do', 'S', 7, 'p_S', 'fort.py', 289), ('S -> swap Dimensional coma Dimensional', 'S', 4, 'p_S', 'fort.py', 290), ('S -> exit action_23', 'S', 2, 'p_S', 'fort.py', 291), ('S -> comment', 'S', 1, 'p_S', 'fort.py', 292), ('Dimensional -> id DimensionsOrEmpty action_1', 'Dimensional', 3, 'p_Dimensional', 'fort.py', 300), ('DimensionsOrEmpty -> openParen EA action_setDim1 ComaEAOrEmpty closedParen', 'DimensionsOrEmpty', 5, 'p_DimensionsOrEmpty', 'fort.py', 307), ('DimensionsOrEmpty -> <empty>', 'DimensionsOrEmpty', 0, 'p_DimensionsOrEmpty', 'fort.py', 308), ('ComaEAOrEmpty -> coma EA action_setDim2', 'ComaEAOrEmpty', 3, 'p_ComaEAOrEmpty', 'fort.py', 314), ('ComaEAOrEmpty -> <empty>', 'ComaEAOrEmpty', 0, 'p_ComaEAOrEmpty', 'fort.py', 315), ('RDimensional -> Dimensional action_36', 'RDimensional', 2, 'p_RDimensional', 'fort.py', 321), ('RDimensional -> RDimensional coma Dimensional action_36', 'RDimensional', 4, 'p_RDimensional', 'fort.py', 322), ('RDimOrString -> DimOrString', 'RDimOrString', 1, 'p_RDimOrString', 'fort.py', 328), ('RDimOrString -> RDimOrString coma DimOrString', 'RDimOrString', 3, 'p_RDimOrString', 'fort.py', 329), ('DimOrString -> Dimensional action_33', 'DimOrString', 2, 'p_DimOrString', 'fort.py', 335), ('DimOrString -> string action_34', 'DimOrString', 2, 'p_DimOrString', 'fort.py', 336), ('DimOrString -> endline action_34', 'DimOrString', 2, 'p_DimOrString', 'fort.py', 337), ('Relif -> openParen EL closedParen action_17 then B', 'Relif', 6, 'p_Relif', 'fort.py', 343), ('Relif -> Relif elif action_18 openParen EL closedParen action_17 then B', 'Relif', 9, 'p_Relif', 'fort.py', 344), ('ElseOrEmpty -> else action_19 B', 'ElseOrEmpty', 3, 'p_ElseOrEmpty', 'fort.py', 350), ('ElseOrEmpty -> <empty>', 'ElseOrEmpty', 0, 'p_ElseOrEmpty', 'fort.py', 351), ('IntOrEmpty -> coma int action_28', 'IntOrEmpty', 3, 'p_IntOrEmpty', 'fort.py', 357), ('IntOrEmpty -> action_27', 'IntOrEmpty', 1, 'p_IntOrEmpty', 'fort.py', 358), ('EA -> MultDiv', 'EA', 1, 'p_EA', 'fort.py', 364), ('EA -> EA SumOrSub action_3 MultDiv action_4', 'EA', 5, 'p_EA', 'fort.py', 365), ('SumOrSub -> plus', 'SumOrSub', 1, 'p_SumOrSub', 'fort.py', 371), ('SumOrSub -> minus', 'SumOrSub', 1, 'p_SumOrSub', 'fort.py', 372), ('MultDiv -> EAParens', 'MultDiv', 1, 'p_MultDiv', 'fort.py', 379), ('MultDiv -> MultDiv MDSymbols action_5 EAParens action_6', 'MultDiv', 5, 'p_MultDiv', 'fort.py', 380), ('MDSymbols -> mul', 'MDSymbols', 1, 'p_MDSymbols', 'fort.py', 386), ('MDSymbols -> div', 'MDSymbols', 1, 'p_MDSymbols', 'fort.py', 387), ('EAParens -> EItem', 'EAParens', 1, 'p_EAParens', 'fort.py', 394), ('EAParens -> openParen EA closedParen', 'EAParens', 3, 'p_EAParens', 'fort.py', 395), ('EL -> AND', 'EL', 1, 'p_EL', 'fort.py', 401), ('EL -> EL or action_10 AND action_9', 'EL', 5, 'p_EL', 'fort.py', 402), ('AND -> Equality', 'AND', 1, 'p_AND', 'fort.py', 408), ('AND -> AND and action_12 Equality action_11', 'AND', 5, 'p_AND', 'fort.py', 409), ('Equality -> EItem EQSymbols action_13 EItem action_14', 'Equality', 5, 'p_Equality', 'fort.py', 415), ('Equality -> openParen EL closedParen', 'Equality', 3, 'p_Equality', 'fort.py', 416), ('Equality -> not EL action_15', 'Equality', 3, 'p_Equality', 'fort.py', 417), ('EItem -> Dimensional', 'EItem', 1, 'p_EItem', 'fort.py', 423), ('EItem -> int action_2', 'EItem', 2, 'p_EItem', 'fort.py', 424), ('EItem -> rea action_2_rea', 'EItem', 2, 'p_EItem', 'fort.py', 425), ('EQSymbols -> less', 'EQSymbols', 1, 'p_EQSymbols', 'fort.py', 431), ('EQSymbols -> more', 'EQSymbols', 1, 'p_EQSymbols', 'fort.py', 432), ('EQSymbols -> doubleEquals', 'EQSymbols', 1, 'p_EQSymbols', 'fort.py', 433), ('EQSymbols -> notEquals', 'EQSymbols', 1, 'p_EQSymbols', 'fort.py', 434), ('EQSymbols -> lessEquals', 'EQSymbols', 1, 'p_EQSymbols', 'fort.py', 435), ('EQSymbols -> moreEquals', 'EQSymbols', 1, 'p_EQSymbols', 'fort.py', 436), ('action_addSymbols -> <empty>', 'action_addSymbols', 0, 'p_action_addSymbols', 'fort.py', 446), ('action_1 -> <empty>', 'action_1', 0, 'p_action_1', 'fort.py', 452), ('action_2 -> <empty>', 'action_2', 0, 'p_action_2', 'fort.py', 500), ('action_2_rea -> <empty>', 'action_2_rea', 0, 'p_action_2_rea', 'fort.py', 506), ('action_3 -> <empty>', 'action_3', 0, 'p_action_3', 'fort.py', 512), ('action_4 -> <empty>', 'action_4', 0, 'p_action_4', 'fort.py', 517), ('action_5 -> <empty>', 'action_5', 0, 'p_action_5', 'fort.py', 540), ('action_6 -> <empty>', 'action_6', 0, 'p_action_6', 'fort.py', 545), ('action_8 -> <empty>', 'action_8', 0, 'p_action_8', 'fort.py', 568), ('action_9 -> <empty>', 'action_9', 0, 'p_action_9', 'fort.py', 588), ('action_10 -> <empty>', 'action_10', 0, 'p_action_10', 'fort.py', 611), ('action_11 -> <empty>', 'action_11', 0, 'p_action_11', 'fort.py', 616), ('action_12 -> <empty>', 'action_12', 0, 'p_action_12', 'fort.py', 639), ('action_13 -> <empty>', 'action_13', 0, 'p_action_13', 'fort.py', 644), ('action_14 -> <empty>', 'action_14', 0, 'p_action_14', 'fort.py', 649), ('action_15 -> <empty>', 'action_15', 0, 'p_action_15', 'fort.py', 672), ('action_16 -> <empty>', 'action_16', 0, 'p_action_16', 'fort.py', 687), ('action_17 -> <empty>', 'action_17', 0, 'p_action_17', 'fort.py', 692), ('action_18 -> <empty>', 'action_18', 0, 'p_action_18', 'fort.py', 708), ('action_19 -> <empty>', 'action_19', 0, 'p_action_19', 'fort.py', 718), ('action_20 -> <empty>', 'action_20', 0, 'p_action_20', 'fort.py', 728), ('action_21 -> <empty>', 'action_21', 0, 'p_action_21', 'fort.py', 736), ('action_22 -> <empty>', 'action_22', 0, 'p_action_22', 'fort.py', 742), ('action_23 -> <empty>', 'action_23', 0, 'p_action_23', 'fort.py', 755), ('action_24 -> <empty>', 'action_24', 0, 'p_action_24', 'fort.py', 764), ('action_25 -> <empty>', 'action_25', 0, 'p_action_25', 'fort.py', 778), ('action_26 -> <empty>', 'action_26', 0, 'p_action_26', 'fort.py', 796), ('action_27 -> <empty>', 'action_27', 0, 'p_action_27', 'fort.py', 820), ('action_28 -> <empty>', 'action_28', 0, 'p_action_28', 'fort.py', 826), ('action_29 -> <empty>', 'action_29', 0, 'p_action_29', 'fort.py', 832), ('action_30 -> <empty>', 'action_30', 0, 'p_action_30', 'fort.py', 856), ('action_31 -> <empty>', 'action_31', 0, 'p_action_31', 'fort.py', 864), ('action_32 -> <empty>', 'action_32', 0, 'p_action_32', 'fort.py', 872), ('action_33 -> <empty>', 'action_33', 0, 'p_action_33', 'fort.py', 882), ('action_34 -> <empty>', 'action_34', 0, 'p_action_34', 'fort.py', 894), ('action_36 -> <empty>', 'action_36', 0, 'p_action_36', 'fort.py', 901), ('action_37 -> <empty>', 'action_37', 0, 'p_action_37', 'fort.py', 910), ('action_38 -> <empty>', 'action_38', 0, 'p_action_38', 'fort.py', 917), ('action_39 -> <empty>', 'action_39', 0, 'p_action_39', 'fort.py', 923), ('action_40 -> <empty>', 'action_40', 0, 'p_action_40', 'fort.py', 930), ('action_41 -> <empty>', 'action_41', 0, 'p_action_41', 'fort.py', 937), ('action_setDim1 -> <empty>', 'action_setDim1', 0, 'p_action_setDim1', 'fort.py', 949), ('action_setDim2 -> <empty>', 'action_setDim2', 0, 'p_action_setDim2', 'fort.py', 960)]
__author__ = 'cosmin' class Validator: def __init__(self): pass
__author__ = 'cosmin' class Validator: def __init__(self): pass
catalogue = { 'iphone': { 'X': 800, 'XR': 900, '11': 1000, '12': 1200, }, 'ipad': { 'mini': 400, 'air': 500, 'pro': 800, }, 'mac': { 'macbook air': 999, 'macbook': 1299, 'macbook pro': 1799, } } for key, value in catalogue.items(): print('-' * 10) print(key) for k, v in value.items(): print(k, '', v) print(' ') print('='*64) for key, value in catalogue.items(): print(f"which {key} would you like to purchase together with quantity") for k, v in value.items(): print(k)
catalogue = {'iphone': {'X': 800, 'XR': 900, '11': 1000, '12': 1200}, 'ipad': {'mini': 400, 'air': 500, 'pro': 800}, 'mac': {'macbook air': 999, 'macbook': 1299, 'macbook pro': 1799}} for (key, value) in catalogue.items(): print('-' * 10) print(key) for (k, v) in value.items(): print(k, '', v) print(' ') print('=' * 64) for (key, value) in catalogue.items(): print(f'which {key} would you like to purchase together with quantity') for (k, v) in value.items(): print(k)
def recurse(n, s): """ Calculates n factorial recursively """ if n == 0: print(s) else: recurse(n-1, n+s) recurse(3, 0)
def recurse(n, s): """ Calculates n factorial recursively """ if n == 0: print(s) else: recurse(n - 1, n + s) recurse(3, 0)
# # PySNMP MIB module LBHUB-BRIDGE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/LBHUB-BRIDGE-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:05:57 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ConstraintsIntersection, ConstraintsUnion, ValueRangeConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ConstraintsIntersection", "ConstraintsUnion", "ValueRangeConstraint", "ValueSizeConstraint") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") mgmt, MibScalar, MibTable, MibTableRow, MibTableColumn, MibIdentifier, enterprises, Integer32, ObjectIdentity, IpAddress, Unsigned32, Counter64, NotificationType, ModuleIdentity, iso, Bits, NotificationType, Counter32, Gauge32, TimeTicks = mibBuilder.importSymbols("SNMPv2-SMI", "mgmt", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "MibIdentifier", "enterprises", "Integer32", "ObjectIdentity", "IpAddress", "Unsigned32", "Counter64", "NotificationType", "ModuleIdentity", "iso", "Bits", "NotificationType", "Counter32", "Gauge32", "TimeTicks") DisplayString, TextualConvention, PhysAddress = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention", "PhysAddress") mib_2 = MibIdentifier((1, 3, 6, 1, 2, 1)).setLabel("mib-2") class DisplayString(OctetString): pass class PhysAddress(OctetString): pass a3Com = MibIdentifier((1, 3, 6, 1, 4, 1, 43)) products = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1)) terminalServer = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 1)) dedicatedBridgeServer = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 2)) dedicatedRouteServer = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 3)) brouter = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 4)) genericMSWorkstation = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 5)) genericMSServer = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 6)) genericUnixServer = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 7)) hub = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 8)) cards = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 9)) linkBuilder3GH = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 8, 1)) linkBuilder10BTi = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 8, 2)) linkBuilderECS = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 8, 3)) linkBuilderMSH = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 8, 4)) linkBuilderFMS = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 8, 5)) linkBuilderFMSII = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 8, 7)) linkBuilderFMSLBridge = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 8, 10)) linkBuilder3GH_cards = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 1)).setLabel("linkBuilder3GH-cards") linkBuilder10BTi_cards = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 2)).setLabel("linkBuilder10BTi-cards") linkBuilderECS_cards = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 3)).setLabel("linkBuilderECS-cards") linkBuilderMSH_cards = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 4)).setLabel("linkBuilderMSH-cards") linkBuilderFMS_cards = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 5)).setLabel("linkBuilderFMS-cards") linkBuilderFMSII_cards = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 6)).setLabel("linkBuilderFMSII-cards") linkBuilder10BTi_cards_utp = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 2, 1)).setLabel("linkBuilder10BTi-cards-utp") linkBuilder10BT_cards_utp = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 2, 2)).setLabel("linkBuilder10BT-cards-utp") linkBuilderFMS_cards_utp = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 5, 1)).setLabel("linkBuilderFMS-cards-utp") linkBuilderFMS_cards_coax = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 5, 2)).setLabel("linkBuilderFMS-cards-coax") linkBuilderFMS_cards_fiber = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 5, 3)).setLabel("linkBuilderFMS-cards-fiber") linkBuilderFMS_cards_12fiber = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 5, 4)).setLabel("linkBuilderFMS-cards-12fiber") linkBuilderFMS_cards_24utp = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 5, 5)).setLabel("linkBuilderFMS-cards-24utp") linkBuilderFMSII_cards_12tp_rj45 = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 6, 1)).setLabel("linkBuilderFMSII-cards-12tp-rj45") linkBuilderFMSII_cards_10coax_bnc = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 6, 2)).setLabel("linkBuilderFMSII-cards-10coax-bnc") linkBuilderFMSII_cards_6fiber_st = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 6, 3)).setLabel("linkBuilderFMSII-cards-6fiber-st") linkBuilderFMSII_cards_12fiber_st = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 6, 4)).setLabel("linkBuilderFMSII-cards-12fiber-st") linkBuilderFMSII_cards_24tp_rj45 = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 6, 5)).setLabel("linkBuilderFMSII-cards-24tp-rj45") linkBuilderFMSII_cards_24tp_telco = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 6, 6)).setLabel("linkBuilderFMSII-cards-24tp-telco") amp_mib = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 3)).setLabel("amp-mib") genericTrap = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 4)) viewBuilderApps = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 5)) specificTrap = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 6)) linkBuilder3GH_mib = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 7)).setLabel("linkBuilder3GH-mib") linkBuilder10BTi_mib = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 8)).setLabel("linkBuilder10BTi-mib") linkBuilderECS_mib = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 9)).setLabel("linkBuilderECS-mib") generic = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10)) genExperimental = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 1)) setup = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 2)) sysLoader = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 3)) security = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 4)) gauges = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 5)) asciiAgent = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 6)) serialIf = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 7)) repeaterMgmt = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 8)) endStation = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 9)) localSnmp = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 10)) manager = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 11)) unusedGeneric12 = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 12)) chassis = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 14)) mrmResilience = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 15)) tokenRing = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 16)) multiRepeater = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 17)) bridgeMgmt = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 18)) fault = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 19)) poll = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 20)) powerSupply = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 21)) testData = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 1, 1)) ifExtensions = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 1, 2)) netBuilder_mib = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 11)).setLabel("netBuilder-mib") lBridgeECS_mib = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 12)).setLabel("lBridgeECS-mib") deskMan_mib = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 13)).setLabel("deskMan-mib") linkBuilderMSH_mib = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 14)).setLabel("linkBuilderMSH-mib") brControlPackage = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 18, 1)) brMonitorPackage = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 18, 2)) brDialoguePackage = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 18, 3)) brClearCounters = MibScalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no-action", 1), ("clear", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: brClearCounters.setStatus('mandatory') if mibBuilder.loadTexts: brClearCounters.setDescription('Clears all the counters associated with the bridgeing function for all bridge ports. A read will always return a value of no-action(1), a write of no-action(1) will have no effect, while a write of clear(2) will clear all the counters.') brSTAPMode = MibScalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("off", 1), ("on", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: brSTAPMode.setStatus('mandatory') if mibBuilder.loadTexts: brSTAPMode.setDescription('Determines whether the STAP algorithm is on or off. If STAP mode is on then brForwardingMode may not be set to transparent. Conversley if brForwardingMode is set to transparent then brSTAPMode may not be set to on.') brLearnMode = MibScalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("off", 1), ("on", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: brLearnMode.setStatus('mandatory') if mibBuilder.loadTexts: brLearnMode.setDescription('Determines whether the bridge is not learning addresses (off), or learning addresses as permanent, deleteOnReset or deleteOnTimeout.') brAgingMode = MibScalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("on", 1), ("off", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: brAgingMode.setStatus('mandatory') if mibBuilder.loadTexts: brAgingMode.setDescription('Determines whether the bridge will age out entries in its filtering database or not.') brMonPortTable = MibTable((1, 3, 6, 1, 4, 1, 43, 10, 18, 2, 1), ) if mibBuilder.loadTexts: brMonPortTable.setStatus('mandatory') if mibBuilder.loadTexts: brMonPortTable.setDescription('A table that contains generic information about every port that is associated with this bridge.') brMonPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 43, 10, 18, 2, 1, 1), ).setIndexNames((0, "LBHUB-BRIDGE-MIB", "brMonPort")) if mibBuilder.loadTexts: brMonPortEntry.setStatus('mandatory') if mibBuilder.loadTexts: brMonPortEntry.setDescription('A list of information for each port of the bridge.') brMonPort = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 10, 18, 2, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: brMonPort.setStatus('mandatory') if mibBuilder.loadTexts: brMonPort.setDescription('The port number of the port for which this entry contains bridge management information.') brMonPortIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 10, 18, 2, 1, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: brMonPortIfIndex.setStatus('mandatory') if mibBuilder.loadTexts: brMonPortIfIndex.setDescription('The value of the instance of the ifIndex object, defined in [4,6], for the interface corresponding to this port.') brMonPortPercentTrafficForwarded = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 10, 18, 2, 1, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: brMonPortPercentTrafficForwarded.setStatus('mandatory') if mibBuilder.loadTexts: brMonPortPercentTrafficForwarded.setDescription("This is a high level 'smart MIB' object. This object provides a running average of the proportion of the received frames that are forwarded. This value is calculated locally on the agent and so does not require processor bandwidth from the management station or occupy valuable network bandwidth communicating with that station. By default an agent supporting this parameter will exhibit the following characteristics:- (1) The parameter will be recalculated at approx 60 second intervals (2) Every calculation period the device will read the value of dot1dTpPortInFrames and dot1dTpPortInDiscards. (3) The calculation will be performed on the most recent 4 samples as follows: 4 Sum(dot1dTpPortInDiscards(i)/dot1dTpPortInFrames(i)) * 1000/4 i=1 Which gives the percentage * 10 filtered, and then subtracting this from 1000 to give percentage * 10 forwarded. dot1dTpPortInDiscards(i) is dot1dTpPortInDiscards(i) - dot1dTpPortInDiscards(i-1). dot1dTpPortInFrames(i) is dot1dTpPortInFrames(i) - dot1dTpPortInFrames(i-1). The value is expressed as a percentage * 10. A default threshold exists on this average so that if a calculated average exceeds 85% a trap will be sent to the management station. Further traps will not be sent until the average drops to below 50%. A particular device may provide a means of changing the number of samples, the averaging period, threshold and threshold action if it so wishes.") brMonPortBandwidthUsed = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 10, 18, 2, 1, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: brMonPortBandwidthUsed.setStatus('mandatory') if mibBuilder.loadTexts: brMonPortBandwidthUsed.setDescription("This is a high level 'smart MIB' object. This object provides a running average of the bandwidth in use. This value is calculated locally on the agent and so does not require processor bandwidth from the management station or occupy valuable network bandwidth communicating with that station. By default an agent supporting this parameter will exhibit the following characteristics: (1) The parameter will be recalculated at approx 60 second intervals (2) Every calculation period the device will read the value of ifInOctets plus ifOutOctets. (3) The calculation will be performed on the most recent 4 samples as follows: 4 Sum(sample(i)/(time(i) * K)) * 1000/4 i=1 Sample(i) is (ifInOctets(i)+ifOutOctets(i))-(ifInOctets(i-1)+ifOutOctets(i-1)) time(i) is the time between sample(i-1) and sample(i) K is the max bytes per unit time (i.e. the available bandwidth) The value is expressed as a percentage * 10. A default threshold exists on this average so that if a calculated average exceeds 50% a trap will be sent to the management station. Further traps will not be sent until the average drops to below 30%. A particular device may provide a means of changing the number of samples, the averaging period, threshold and threshold action if it so wishes.") brMonPortErrorsPer10000Packets = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 10, 18, 2, 1, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: brMonPortErrorsPer10000Packets.setStatus('mandatory') if mibBuilder.loadTexts: brMonPortErrorsPer10000Packets.setDescription("This is a high level 'smart MIB' object. This object provides a running average of the number of errors per 10000 packets. The value of this value is calculated locally on the agent and so does not require processor bandwidth from a management station or occupy valuable network bandwidth communicating with that station. By default an agent supporting this parameter will exhibit the following behaviour: (1) The parameter will be recalculated at approx 60 second intervals. (2) Every calculation period the device will read the value of portTotalErrors and dot1dTpPortInFrames. (3) The calculation will be performed on the most recent 4 samples as follows: 4 10000 * Sum(Errors(i)/Frames(i)) i=1 Errors(i) = portTotalErrors(i)-portTotalErrors(i-1) Frames(i) = dot1dTpPortInFrames(i)-dot1dTpPortInFrames(i-1) The value is an integer number of errors per 10,000 packets received by this port. A default threshold exists on this average so that if a calculated average exceeds 200 (i.e. 2% of frames are in error) a trap will be sent to the management station. Further traps will not be sent until the average drops to below 100 (i.e. 1% of frames are in error). A particular device may provide a means of changing the number of samples, the averaging period and threshold if it so wishes.") brMonPortBroadcastBandwidth = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 10, 18, 2, 1, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: brMonPortBroadcastBandwidth.setStatus('mandatory') if mibBuilder.loadTexts: brMonPortBroadcastBandwidth.setDescription("This is a high level 'smart MIB' object. This object provides a running average of the Broadcast frame bandwidth in use. This value is calculated locally on the agent and so does not require processor bandwidth from the management station or occupy valuable network bandwidth communicating with that station. By default an agent supporting this parameter will exhibit the following characteristics: (1) The parameter will be recalculated at approx 20 second intervals (2) Every calculation period the device will read the value of ifExtnsBroadcastsReceivedOks and ifExtnsBroadcastsTransmittedOks. (3) The calculation will be performed on the most recent 4 samples as follows: 4 Sum(sample(i)/(time(i) * K)) * 1000/4 i=1 Sample(i) is (ifExtnsBroadcastsReceivedOks(i)+ifExtnsBroadcastsTransmittedOks(i))- (ifExtnsBroadcastsReceivedOks(i-1)+ifExtnsBroadcastsTransmittedOks(i-1)). time(i) is the time between sample(i-1) and sample(i) K is the max frames per unit time (i.e. the available bandwidth) The value is expressed as a percentage * 10. A default threshold exists on this average so that if a calculated average exceeds 20% a trap will be sent to the management station. Further traps will not be sent until the average drops to below 10%. A particular device may provide a means of changing the number of samples, the averaging period, threshold and threshold action if it so wishes.") brDataBase = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 18, 4)) brDummyPackage = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 18, 5)) brSizeOfFilteringDataBase = MibScalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 4, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: brSizeOfFilteringDataBase.setStatus('mandatory') if mibBuilder.loadTexts: brSizeOfFilteringDataBase.setDescription('The maximum possible number of Filtering database entries.') brPercentageOfNonageingFDBEntries = MibScalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 4, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: brPercentageOfNonageingFDBEntries.setStatus('mandatory') if mibBuilder.loadTexts: brPercentageOfNonageingFDBEntries.setDescription('The number of entries currently in the filtering database that cannot be aged out, and are not in the permanent database. This is expressed as a percentage * 10 of the size of the filtering database :- ((number of non ageing entries)*1000)/(filtering db size).') brPercentageOfAgeingFDBEntries = MibScalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 4, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: brPercentageOfAgeingFDBEntries.setStatus('mandatory') if mibBuilder.loadTexts: brPercentageOfAgeingFDBEntries.setDescription('The number of entries currently in the filtering database that can be aged out, and not held in the permanent database. This is expressed as a percentage * 10 of the size of the filtering database :- ((number of ageing entries)*1000)/(filtering db size).') brPercentageOfPermanentFDBEntries = MibScalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 4, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: brPercentageOfPermanentFDBEntries.setStatus('mandatory') if mibBuilder.loadTexts: brPercentageOfPermanentFDBEntries.setDescription('The number of permanent entries currently in the filtering database. This is expressed as a percentage * 10 of the size of the filtering database :- ((number of permanent entries)*1000)/(filtering db size).') brClearFilteringDataBase = MibScalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 4, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("noAction", 1), ("clear", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: brClearFilteringDataBase.setStatus('mandatory') if mibBuilder.loadTexts: brClearFilteringDataBase.setDescription('An attribute to clear all entries in the filtering database except for those which are permanent.') brMaxNumberOfPermanentEntries = MibScalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 4, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: brMaxNumberOfPermanentEntries.setStatus('mandatory') if mibBuilder.loadTexts: brMaxNumberOfPermanentEntries.setDescription('The maximum number of entries in the filtering database that can be permanent.') brPercentageOfPermanentDatabaseUsed = MibScalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 4, 7), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: brPercentageOfPermanentDatabaseUsed.setStatus('mandatory') if mibBuilder.loadTexts: brPercentageOfPermanentDatabaseUsed.setDescription('The number of permanent entries in the filtering database. This is expressed as a percentage * 10 of the size of the permanent database :- ((number of permanent entries)*1000)/(permanent db size).') brClearPermanentEntries = MibScalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 4, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("noAction", 1), ("clear", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: brClearPermanentEntries.setStatus('mandatory') if mibBuilder.loadTexts: brClearPermanentEntries.setDescription('An attribute to clear the permanent entries from the filtering database.') brSaveLearntAddresses = MibScalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 4, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("noAction", 1), ("save", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: brSaveLearntAddresses.setStatus('mandatory') if mibBuilder.loadTexts: brSaveLearntAddresses.setDescription('An attribute to make the learnt addresses held in the filtering database become permanent entries.') brDatabaseModified = MibScalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 4, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("noChange", 1), ("modified", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: brDatabaseModified.setStatus('mandatory') if mibBuilder.loadTexts: brDatabaseModified.setDescription('This flag is used to indicate to a management application that the database (Forwarding or Static views) has altered while a manager is viewing it. The normal value of this parameter is noChange(1), it will remain at this value untill the database is modified by either:- - a manager mofifying the DB through the Static Table - the relay causing an entry to be inserted into the DB - the ageing process causing an entry to be deleted from the DB when it will be set to modified(2), where it will remain untill reset to noChange(1) by a manager.') brDatabaseType = MibScalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 5, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("filtering", 1), ("permanent", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: brDatabaseType.setStatus('mandatory') if mibBuilder.loadTexts: brDatabaseType.setDescription('This dummy object enables the database full trap to differentiate between the filtering database and the permanent database.') brDatabaseLevel = MibScalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 5, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(90, 100))).clone(namedValues=NamedValues(("ninetyPercent", 90), ("oneHundredPercent", 100)))).setMaxAccess("readonly") if mibBuilder.loadTexts: brDatabaseLevel.setStatus('mandatory') if mibBuilder.loadTexts: brDatabaseLevel.setDescription('This dummy object enables the database full trap to differentiate between the database being 90% and 100% full.') brTrafficForwarded = MibScalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 5, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: brTrafficForwarded.setStatus('mandatory') if mibBuilder.loadTexts: brTrafficForwarded.setDescription('This dummy object is used internally to calculate a running average of the percentage of traffic forwarded on a port. It should not be accessed by a management station.') brPortBandwidth = MibScalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 5, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: brPortBandwidth.setStatus('mandatory') if mibBuilder.loadTexts: brPortBandwidth.setDescription('This dummy object is used internally to calculate a running average of the port bandwidth in use. It should not be accessed by a management station.') brPortBroadcastBandwidth = MibScalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 5, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: brPortBroadcastBandwidth.setStatus('mandatory') if mibBuilder.loadTexts: brPortBroadcastBandwidth.setDescription('This dummy object is used internally to calculate a running average of the port bandwidth in use. It should not be accessed by a management station.') brPortErrors = MibScalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 5, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: brPortErrors.setStatus('mandatory') if mibBuilder.loadTexts: brPortErrors.setDescription('This dummy object is used internally to calculate a running average of the errors per 10000 frames on a port. It should not be accessed by a management station.') brDatabaseFull = NotificationType((1, 3, 6, 1, 4, 1, 43) + (0,65)).setObjects(("LBHUB-BRIDGE-MIB", "brDatabaseType"), ("LBHUB-BRIDGE-MIB", "brDatabaseLevel")) if mibBuilder.loadTexts: brDatabaseFull.setDescription('This trap indicates that either the Filtering databse or the permanent database has become full. If the database occupancy exceeds 90% this trap will be sent also. The variable bindings enable the trap to be identified as refering to the filtering or permanet database, and to differentiate between 90% or 100% full.') class BridgeId(OctetString): subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(8, 8) fixedLength = 8 class MacAddress(OctetString): subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(6, 6) fixedLength = 6 mibBuilder.exportSymbols("LBHUB-BRIDGE-MIB", brClearCounters=brClearCounters, endStation=endStation, linkBuilderFMS=linkBuilderFMS, linkBuilder10BTi_mib=linkBuilder10BTi_mib, brDatabaseModified=brDatabaseModified, linkBuilderFMSII_cards_6fiber_st=linkBuilderFMSII_cards_6fiber_st, brPercentageOfPermanentFDBEntries=brPercentageOfPermanentFDBEntries, dedicatedRouteServer=dedicatedRouteServer, linkBuilder10BT_cards_utp=linkBuilder10BT_cards_utp, multiRepeater=multiRepeater, ifExtensions=ifExtensions, brPercentageOfNonageingFDBEntries=brPercentageOfNonageingFDBEntries, linkBuilderFMSII_cards=linkBuilderFMSII_cards, genericUnixServer=genericUnixServer, security=security, linkBuilder3GH=linkBuilder3GH, linkBuilderFMSII_cards_24tp_rj45=linkBuilderFMSII_cards_24tp_rj45, brPortBroadcastBandwidth=brPortBroadcastBandwidth, linkBuilder10BTi_cards=linkBuilder10BTi_cards, MacAddress=MacAddress, linkBuilderFMS_cards_12fiber=linkBuilderFMS_cards_12fiber, brMonPort=brMonPort, generic=generic, brDatabaseType=brDatabaseType, BridgeId=BridgeId, linkBuilderFMS_cards_24utp=linkBuilderFMS_cards_24utp, sysLoader=sysLoader, deskMan_mib=deskMan_mib, linkBuilderFMSII=linkBuilderFMSII, viewBuilderApps=viewBuilderApps, bridgeMgmt=bridgeMgmt, brMonPortBroadcastBandwidth=brMonPortBroadcastBandwidth, products=products, hub=hub, fault=fault, localSnmp=localSnmp, a3Com=a3Com, setup=setup, lBridgeECS_mib=lBridgeECS_mib, linkBuilderFMS_cards_fiber=linkBuilderFMS_cards_fiber, brSTAPMode=brSTAPMode, brouter=brouter, brClearFilteringDataBase=brClearFilteringDataBase, brSaveLearntAddresses=brSaveLearntAddresses, repeaterMgmt=repeaterMgmt, genExperimental=genExperimental, linkBuilderFMSII_cards_12tp_rj45=linkBuilderFMSII_cards_12tp_rj45, brControlPackage=brControlPackage, linkBuilderFMS_cards_utp=linkBuilderFMS_cards_utp, brMaxNumberOfPermanentEntries=brMaxNumberOfPermanentEntries, dedicatedBridgeServer=dedicatedBridgeServer, genericTrap=genericTrap, brMonPortTable=brMonPortTable, brMonPortErrorsPer10000Packets=brMonPortErrorsPer10000Packets, brAgingMode=brAgingMode, brDialoguePackage=brDialoguePackage, linkBuilder3GH_cards=linkBuilder3GH_cards, linkBuilderMSH_cards=linkBuilderMSH_cards, manager=manager, brTrafficForwarded=brTrafficForwarded, linkBuilderFMSII_cards_10coax_bnc=linkBuilderFMSII_cards_10coax_bnc, netBuilder_mib=netBuilder_mib, powerSupply=powerSupply, brLearnMode=brLearnMode, brMonitorPackage=brMonitorPackage, cards=cards, linkBuilderMSH=linkBuilderMSH, linkBuilder3GH_mib=linkBuilder3GH_mib, asciiAgent=asciiAgent, brMonPortIfIndex=brMonPortIfIndex, linkBuilderFMS_cards=linkBuilderFMS_cards, PhysAddress=PhysAddress, unusedGeneric12=unusedGeneric12, linkBuilder10BTi_cards_utp=linkBuilder10BTi_cards_utp, linkBuilderFMS_cards_coax=linkBuilderFMS_cards_coax, linkBuilder10BTi=linkBuilder10BTi, poll=poll, brDatabaseLevel=brDatabaseLevel, brMonPortPercentTrafficForwarded=brMonPortPercentTrafficForwarded, DisplayString=DisplayString, amp_mib=amp_mib, linkBuilderMSH_mib=linkBuilderMSH_mib, linkBuilderFMSLBridge=linkBuilderFMSLBridge, brPortErrors=brPortErrors, brClearPermanentEntries=brClearPermanentEntries, brDummyPackage=brDummyPackage, serialIf=serialIf, brMonPortBandwidthUsed=brMonPortBandwidthUsed, specificTrap=specificTrap, linkBuilderECS_cards=linkBuilderECS_cards, testData=testData, mrmResilience=mrmResilience, linkBuilderECS=linkBuilderECS, gauges=gauges, chassis=chassis, brMonPortEntry=brMonPortEntry, brPortBandwidth=brPortBandwidth, brDataBase=brDataBase, brPercentageOfPermanentDatabaseUsed=brPercentageOfPermanentDatabaseUsed, brPercentageOfAgeingFDBEntries=brPercentageOfAgeingFDBEntries, linkBuilderFMSII_cards_12fiber_st=linkBuilderFMSII_cards_12fiber_st, linkBuilderECS_mib=linkBuilderECS_mib, terminalServer=terminalServer, brDatabaseFull=brDatabaseFull, genericMSWorkstation=genericMSWorkstation, genericMSServer=genericMSServer, tokenRing=tokenRing, brSizeOfFilteringDataBase=brSizeOfFilteringDataBase, linkBuilderFMSII_cards_24tp_telco=linkBuilderFMSII_cards_24tp_telco, mib_2=mib_2)
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, constraints_union, value_range_constraint, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ConstraintsIntersection', 'ConstraintsUnion', 'ValueRangeConstraint', 'ValueSizeConstraint') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (mgmt, mib_scalar, mib_table, mib_table_row, mib_table_column, mib_identifier, enterprises, integer32, object_identity, ip_address, unsigned32, counter64, notification_type, module_identity, iso, bits, notification_type, counter32, gauge32, time_ticks) = mibBuilder.importSymbols('SNMPv2-SMI', 'mgmt', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'MibIdentifier', 'enterprises', 'Integer32', 'ObjectIdentity', 'IpAddress', 'Unsigned32', 'Counter64', 'NotificationType', 'ModuleIdentity', 'iso', 'Bits', 'NotificationType', 'Counter32', 'Gauge32', 'TimeTicks') (display_string, textual_convention, phys_address) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention', 'PhysAddress') mib_2 = mib_identifier((1, 3, 6, 1, 2, 1)).setLabel('mib-2') class Displaystring(OctetString): pass class Physaddress(OctetString): pass a3_com = mib_identifier((1, 3, 6, 1, 4, 1, 43)) products = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1)) terminal_server = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 1)) dedicated_bridge_server = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 2)) dedicated_route_server = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 3)) brouter = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 4)) generic_ms_workstation = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 5)) generic_ms_server = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 6)) generic_unix_server = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 7)) hub = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 8)) cards = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 9)) link_builder3_gh = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 8, 1)) link_builder10_b_ti = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 8, 2)) link_builder_ecs = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 8, 3)) link_builder_msh = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 8, 4)) link_builder_fms = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 8, 5)) link_builder_fmsii = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 8, 7)) link_builder_fmsl_bridge = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 8, 10)) link_builder3_gh_cards = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 1)).setLabel('linkBuilder3GH-cards') link_builder10_b_ti_cards = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 2)).setLabel('linkBuilder10BTi-cards') link_builder_ecs_cards = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 3)).setLabel('linkBuilderECS-cards') link_builder_msh_cards = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 4)).setLabel('linkBuilderMSH-cards') link_builder_fms_cards = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 5)).setLabel('linkBuilderFMS-cards') link_builder_fmsii_cards = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 6)).setLabel('linkBuilderFMSII-cards') link_builder10_b_ti_cards_utp = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 2, 1)).setLabel('linkBuilder10BTi-cards-utp') link_builder10_bt_cards_utp = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 2, 2)).setLabel('linkBuilder10BT-cards-utp') link_builder_fms_cards_utp = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 5, 1)).setLabel('linkBuilderFMS-cards-utp') link_builder_fms_cards_coax = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 5, 2)).setLabel('linkBuilderFMS-cards-coax') link_builder_fms_cards_fiber = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 5, 3)).setLabel('linkBuilderFMS-cards-fiber') link_builder_fms_cards_12fiber = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 5, 4)).setLabel('linkBuilderFMS-cards-12fiber') link_builder_fms_cards_24utp = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 5, 5)).setLabel('linkBuilderFMS-cards-24utp') link_builder_fmsii_cards_12tp_rj45 = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 6, 1)).setLabel('linkBuilderFMSII-cards-12tp-rj45') link_builder_fmsii_cards_10coax_bnc = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 6, 2)).setLabel('linkBuilderFMSII-cards-10coax-bnc') link_builder_fmsii_cards_6fiber_st = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 6, 3)).setLabel('linkBuilderFMSII-cards-6fiber-st') link_builder_fmsii_cards_12fiber_st = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 6, 4)).setLabel('linkBuilderFMSII-cards-12fiber-st') link_builder_fmsii_cards_24tp_rj45 = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 6, 5)).setLabel('linkBuilderFMSII-cards-24tp-rj45') link_builder_fmsii_cards_24tp_telco = mib_identifier((1, 3, 6, 1, 4, 1, 43, 1, 9, 6, 6)).setLabel('linkBuilderFMSII-cards-24tp-telco') amp_mib = mib_identifier((1, 3, 6, 1, 4, 1, 43, 3)).setLabel('amp-mib') generic_trap = mib_identifier((1, 3, 6, 1, 4, 1, 43, 4)) view_builder_apps = mib_identifier((1, 3, 6, 1, 4, 1, 43, 5)) specific_trap = mib_identifier((1, 3, 6, 1, 4, 1, 43, 6)) link_builder3_gh_mib = mib_identifier((1, 3, 6, 1, 4, 1, 43, 7)).setLabel('linkBuilder3GH-mib') link_builder10_b_ti_mib = mib_identifier((1, 3, 6, 1, 4, 1, 43, 8)).setLabel('linkBuilder10BTi-mib') link_builder_ecs_mib = mib_identifier((1, 3, 6, 1, 4, 1, 43, 9)).setLabel('linkBuilderECS-mib') generic = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10)) gen_experimental = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 1)) setup = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 2)) sys_loader = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 3)) security = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 4)) gauges = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 5)) ascii_agent = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 6)) serial_if = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 7)) repeater_mgmt = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 8)) end_station = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 9)) local_snmp = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 10)) manager = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 11)) unused_generic12 = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 12)) chassis = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 14)) mrm_resilience = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 15)) token_ring = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 16)) multi_repeater = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 17)) bridge_mgmt = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 18)) fault = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 19)) poll = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 20)) power_supply = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 21)) test_data = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 1, 1)) if_extensions = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 1, 2)) net_builder_mib = mib_identifier((1, 3, 6, 1, 4, 1, 43, 11)).setLabel('netBuilder-mib') l_bridge_ecs_mib = mib_identifier((1, 3, 6, 1, 4, 1, 43, 12)).setLabel('lBridgeECS-mib') desk_man_mib = mib_identifier((1, 3, 6, 1, 4, 1, 43, 13)).setLabel('deskMan-mib') link_builder_msh_mib = mib_identifier((1, 3, 6, 1, 4, 1, 43, 14)).setLabel('linkBuilderMSH-mib') br_control_package = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 18, 1)) br_monitor_package = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 18, 2)) br_dialogue_package = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 18, 3)) br_clear_counters = mib_scalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('no-action', 1), ('clear', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: brClearCounters.setStatus('mandatory') if mibBuilder.loadTexts: brClearCounters.setDescription('Clears all the counters associated with the bridgeing function for all bridge ports. A read will always return a value of no-action(1), a write of no-action(1) will have no effect, while a write of clear(2) will clear all the counters.') br_stap_mode = mib_scalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('off', 1), ('on', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: brSTAPMode.setStatus('mandatory') if mibBuilder.loadTexts: brSTAPMode.setDescription('Determines whether the STAP algorithm is on or off. If STAP mode is on then brForwardingMode may not be set to transparent. Conversley if brForwardingMode is set to transparent then brSTAPMode may not be set to on.') br_learn_mode = mib_scalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('off', 1), ('on', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: brLearnMode.setStatus('mandatory') if mibBuilder.loadTexts: brLearnMode.setDescription('Determines whether the bridge is not learning addresses (off), or learning addresses as permanent, deleteOnReset or deleteOnTimeout.') br_aging_mode = mib_scalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('on', 1), ('off', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: brAgingMode.setStatus('mandatory') if mibBuilder.loadTexts: brAgingMode.setDescription('Determines whether the bridge will age out entries in its filtering database or not.') br_mon_port_table = mib_table((1, 3, 6, 1, 4, 1, 43, 10, 18, 2, 1)) if mibBuilder.loadTexts: brMonPortTable.setStatus('mandatory') if mibBuilder.loadTexts: brMonPortTable.setDescription('A table that contains generic information about every port that is associated with this bridge.') br_mon_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 43, 10, 18, 2, 1, 1)).setIndexNames((0, 'LBHUB-BRIDGE-MIB', 'brMonPort')) if mibBuilder.loadTexts: brMonPortEntry.setStatus('mandatory') if mibBuilder.loadTexts: brMonPortEntry.setDescription('A list of information for each port of the bridge.') br_mon_port = mib_table_column((1, 3, 6, 1, 4, 1, 43, 10, 18, 2, 1, 1, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: brMonPort.setStatus('mandatory') if mibBuilder.loadTexts: brMonPort.setDescription('The port number of the port for which this entry contains bridge management information.') br_mon_port_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 10, 18, 2, 1, 1, 2), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: brMonPortIfIndex.setStatus('mandatory') if mibBuilder.loadTexts: brMonPortIfIndex.setDescription('The value of the instance of the ifIndex object, defined in [4,6], for the interface corresponding to this port.') br_mon_port_percent_traffic_forwarded = mib_table_column((1, 3, 6, 1, 4, 1, 43, 10, 18, 2, 1, 1, 3), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: brMonPortPercentTrafficForwarded.setStatus('mandatory') if mibBuilder.loadTexts: brMonPortPercentTrafficForwarded.setDescription("This is a high level 'smart MIB' object. This object provides a running average of the proportion of the received frames that are forwarded. This value is calculated locally on the agent and so does not require processor bandwidth from the management station or occupy valuable network bandwidth communicating with that station. By default an agent supporting this parameter will exhibit the following characteristics:- (1) The parameter will be recalculated at approx 60 second intervals (2) Every calculation period the device will read the value of dot1dTpPortInFrames and dot1dTpPortInDiscards. (3) The calculation will be performed on the most recent 4 samples as follows: 4 Sum(dot1dTpPortInDiscards(i)/dot1dTpPortInFrames(i)) * 1000/4 i=1 Which gives the percentage * 10 filtered, and then subtracting this from 1000 to give percentage * 10 forwarded. dot1dTpPortInDiscards(i) is dot1dTpPortInDiscards(i) - dot1dTpPortInDiscards(i-1). dot1dTpPortInFrames(i) is dot1dTpPortInFrames(i) - dot1dTpPortInFrames(i-1). The value is expressed as a percentage * 10. A default threshold exists on this average so that if a calculated average exceeds 85% a trap will be sent to the management station. Further traps will not be sent until the average drops to below 50%. A particular device may provide a means of changing the number of samples, the averaging period, threshold and threshold action if it so wishes.") br_mon_port_bandwidth_used = mib_table_column((1, 3, 6, 1, 4, 1, 43, 10, 18, 2, 1, 1, 4), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: brMonPortBandwidthUsed.setStatus('mandatory') if mibBuilder.loadTexts: brMonPortBandwidthUsed.setDescription("This is a high level 'smart MIB' object. This object provides a running average of the bandwidth in use. This value is calculated locally on the agent and so does not require processor bandwidth from the management station or occupy valuable network bandwidth communicating with that station. By default an agent supporting this parameter will exhibit the following characteristics: (1) The parameter will be recalculated at approx 60 second intervals (2) Every calculation period the device will read the value of ifInOctets plus ifOutOctets. (3) The calculation will be performed on the most recent 4 samples as follows: 4 Sum(sample(i)/(time(i) * K)) * 1000/4 i=1 Sample(i) is (ifInOctets(i)+ifOutOctets(i))-(ifInOctets(i-1)+ifOutOctets(i-1)) time(i) is the time between sample(i-1) and sample(i) K is the max bytes per unit time (i.e. the available bandwidth) The value is expressed as a percentage * 10. A default threshold exists on this average so that if a calculated average exceeds 50% a trap will be sent to the management station. Further traps will not be sent until the average drops to below 30%. A particular device may provide a means of changing the number of samples, the averaging period, threshold and threshold action if it so wishes.") br_mon_port_errors_per10000_packets = mib_table_column((1, 3, 6, 1, 4, 1, 43, 10, 18, 2, 1, 1, 5), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: brMonPortErrorsPer10000Packets.setStatus('mandatory') if mibBuilder.loadTexts: brMonPortErrorsPer10000Packets.setDescription("This is a high level 'smart MIB' object. This object provides a running average of the number of errors per 10000 packets. The value of this value is calculated locally on the agent and so does not require processor bandwidth from a management station or occupy valuable network bandwidth communicating with that station. By default an agent supporting this parameter will exhibit the following behaviour: (1) The parameter will be recalculated at approx 60 second intervals. (2) Every calculation period the device will read the value of portTotalErrors and dot1dTpPortInFrames. (3) The calculation will be performed on the most recent 4 samples as follows: 4 10000 * Sum(Errors(i)/Frames(i)) i=1 Errors(i) = portTotalErrors(i)-portTotalErrors(i-1) Frames(i) = dot1dTpPortInFrames(i)-dot1dTpPortInFrames(i-1) The value is an integer number of errors per 10,000 packets received by this port. A default threshold exists on this average so that if a calculated average exceeds 200 (i.e. 2% of frames are in error) a trap will be sent to the management station. Further traps will not be sent until the average drops to below 100 (i.e. 1% of frames are in error). A particular device may provide a means of changing the number of samples, the averaging period and threshold if it so wishes.") br_mon_port_broadcast_bandwidth = mib_table_column((1, 3, 6, 1, 4, 1, 43, 10, 18, 2, 1, 1, 6), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: brMonPortBroadcastBandwidth.setStatus('mandatory') if mibBuilder.loadTexts: brMonPortBroadcastBandwidth.setDescription("This is a high level 'smart MIB' object. This object provides a running average of the Broadcast frame bandwidth in use. This value is calculated locally on the agent and so does not require processor bandwidth from the management station or occupy valuable network bandwidth communicating with that station. By default an agent supporting this parameter will exhibit the following characteristics: (1) The parameter will be recalculated at approx 20 second intervals (2) Every calculation period the device will read the value of ifExtnsBroadcastsReceivedOks and ifExtnsBroadcastsTransmittedOks. (3) The calculation will be performed on the most recent 4 samples as follows: 4 Sum(sample(i)/(time(i) * K)) * 1000/4 i=1 Sample(i) is (ifExtnsBroadcastsReceivedOks(i)+ifExtnsBroadcastsTransmittedOks(i))- (ifExtnsBroadcastsReceivedOks(i-1)+ifExtnsBroadcastsTransmittedOks(i-1)). time(i) is the time between sample(i-1) and sample(i) K is the max frames per unit time (i.e. the available bandwidth) The value is expressed as a percentage * 10. A default threshold exists on this average so that if a calculated average exceeds 20% a trap will be sent to the management station. Further traps will not be sent until the average drops to below 10%. A particular device may provide a means of changing the number of samples, the averaging period, threshold and threshold action if it so wishes.") br_data_base = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 18, 4)) br_dummy_package = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 18, 5)) br_size_of_filtering_data_base = mib_scalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 4, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: brSizeOfFilteringDataBase.setStatus('mandatory') if mibBuilder.loadTexts: brSizeOfFilteringDataBase.setDescription('The maximum possible number of Filtering database entries.') br_percentage_of_nonageing_fdb_entries = mib_scalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 4, 2), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: brPercentageOfNonageingFDBEntries.setStatus('mandatory') if mibBuilder.loadTexts: brPercentageOfNonageingFDBEntries.setDescription('The number of entries currently in the filtering database that cannot be aged out, and are not in the permanent database. This is expressed as a percentage * 10 of the size of the filtering database :- ((number of non ageing entries)*1000)/(filtering db size).') br_percentage_of_ageing_fdb_entries = mib_scalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 4, 3), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: brPercentageOfAgeingFDBEntries.setStatus('mandatory') if mibBuilder.loadTexts: brPercentageOfAgeingFDBEntries.setDescription('The number of entries currently in the filtering database that can be aged out, and not held in the permanent database. This is expressed as a percentage * 10 of the size of the filtering database :- ((number of ageing entries)*1000)/(filtering db size).') br_percentage_of_permanent_fdb_entries = mib_scalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 4, 4), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: brPercentageOfPermanentFDBEntries.setStatus('mandatory') if mibBuilder.loadTexts: brPercentageOfPermanentFDBEntries.setDescription('The number of permanent entries currently in the filtering database. This is expressed as a percentage * 10 of the size of the filtering database :- ((number of permanent entries)*1000)/(filtering db size).') br_clear_filtering_data_base = mib_scalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 4, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('noAction', 1), ('clear', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: brClearFilteringDataBase.setStatus('mandatory') if mibBuilder.loadTexts: brClearFilteringDataBase.setDescription('An attribute to clear all entries in the filtering database except for those which are permanent.') br_max_number_of_permanent_entries = mib_scalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 4, 6), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: brMaxNumberOfPermanentEntries.setStatus('mandatory') if mibBuilder.loadTexts: brMaxNumberOfPermanentEntries.setDescription('The maximum number of entries in the filtering database that can be permanent.') br_percentage_of_permanent_database_used = mib_scalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 4, 7), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: brPercentageOfPermanentDatabaseUsed.setStatus('mandatory') if mibBuilder.loadTexts: brPercentageOfPermanentDatabaseUsed.setDescription('The number of permanent entries in the filtering database. This is expressed as a percentage * 10 of the size of the permanent database :- ((number of permanent entries)*1000)/(permanent db size).') br_clear_permanent_entries = mib_scalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 4, 8), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('noAction', 1), ('clear', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: brClearPermanentEntries.setStatus('mandatory') if mibBuilder.loadTexts: brClearPermanentEntries.setDescription('An attribute to clear the permanent entries from the filtering database.') br_save_learnt_addresses = mib_scalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 4, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('noAction', 1), ('save', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: brSaveLearntAddresses.setStatus('mandatory') if mibBuilder.loadTexts: brSaveLearntAddresses.setDescription('An attribute to make the learnt addresses held in the filtering database become permanent entries.') br_database_modified = mib_scalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 4, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('noChange', 1), ('modified', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: brDatabaseModified.setStatus('mandatory') if mibBuilder.loadTexts: brDatabaseModified.setDescription('This flag is used to indicate to a management application that the database (Forwarding or Static views) has altered while a manager is viewing it. The normal value of this parameter is noChange(1), it will remain at this value untill the database is modified by either:- - a manager mofifying the DB through the Static Table - the relay causing an entry to be inserted into the DB - the ageing process causing an entry to be deleted from the DB when it will be set to modified(2), where it will remain untill reset to noChange(1) by a manager.') br_database_type = mib_scalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 5, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('filtering', 1), ('permanent', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: brDatabaseType.setStatus('mandatory') if mibBuilder.loadTexts: brDatabaseType.setDescription('This dummy object enables the database full trap to differentiate between the filtering database and the permanent database.') br_database_level = mib_scalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 5, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(90, 100))).clone(namedValues=named_values(('ninetyPercent', 90), ('oneHundredPercent', 100)))).setMaxAccess('readonly') if mibBuilder.loadTexts: brDatabaseLevel.setStatus('mandatory') if mibBuilder.loadTexts: brDatabaseLevel.setDescription('This dummy object enables the database full trap to differentiate between the database being 90% and 100% full.') br_traffic_forwarded = mib_scalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 5, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: brTrafficForwarded.setStatus('mandatory') if mibBuilder.loadTexts: brTrafficForwarded.setDescription('This dummy object is used internally to calculate a running average of the percentage of traffic forwarded on a port. It should not be accessed by a management station.') br_port_bandwidth = mib_scalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 5, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: brPortBandwidth.setStatus('mandatory') if mibBuilder.loadTexts: brPortBandwidth.setDescription('This dummy object is used internally to calculate a running average of the port bandwidth in use. It should not be accessed by a management station.') br_port_broadcast_bandwidth = mib_scalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 5, 5), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: brPortBroadcastBandwidth.setStatus('mandatory') if mibBuilder.loadTexts: brPortBroadcastBandwidth.setDescription('This dummy object is used internally to calculate a running average of the port bandwidth in use. It should not be accessed by a management station.') br_port_errors = mib_scalar((1, 3, 6, 1, 4, 1, 43, 10, 18, 5, 6), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: brPortErrors.setStatus('mandatory') if mibBuilder.loadTexts: brPortErrors.setDescription('This dummy object is used internally to calculate a running average of the errors per 10000 frames on a port. It should not be accessed by a management station.') br_database_full = notification_type((1, 3, 6, 1, 4, 1, 43) + (0, 65)).setObjects(('LBHUB-BRIDGE-MIB', 'brDatabaseType'), ('LBHUB-BRIDGE-MIB', 'brDatabaseLevel')) if mibBuilder.loadTexts: brDatabaseFull.setDescription('This trap indicates that either the Filtering databse or the permanent database has become full. If the database occupancy exceeds 90% this trap will be sent also. The variable bindings enable the trap to be identified as refering to the filtering or permanet database, and to differentiate between 90% or 100% full.') class Bridgeid(OctetString): subtype_spec = OctetString.subtypeSpec + value_size_constraint(8, 8) fixed_length = 8 class Macaddress(OctetString): subtype_spec = OctetString.subtypeSpec + value_size_constraint(6, 6) fixed_length = 6 mibBuilder.exportSymbols('LBHUB-BRIDGE-MIB', brClearCounters=brClearCounters, endStation=endStation, linkBuilderFMS=linkBuilderFMS, linkBuilder10BTi_mib=linkBuilder10BTi_mib, brDatabaseModified=brDatabaseModified, linkBuilderFMSII_cards_6fiber_st=linkBuilderFMSII_cards_6fiber_st, brPercentageOfPermanentFDBEntries=brPercentageOfPermanentFDBEntries, dedicatedRouteServer=dedicatedRouteServer, linkBuilder10BT_cards_utp=linkBuilder10BT_cards_utp, multiRepeater=multiRepeater, ifExtensions=ifExtensions, brPercentageOfNonageingFDBEntries=brPercentageOfNonageingFDBEntries, linkBuilderFMSII_cards=linkBuilderFMSII_cards, genericUnixServer=genericUnixServer, security=security, linkBuilder3GH=linkBuilder3GH, linkBuilderFMSII_cards_24tp_rj45=linkBuilderFMSII_cards_24tp_rj45, brPortBroadcastBandwidth=brPortBroadcastBandwidth, linkBuilder10BTi_cards=linkBuilder10BTi_cards, MacAddress=MacAddress, linkBuilderFMS_cards_12fiber=linkBuilderFMS_cards_12fiber, brMonPort=brMonPort, generic=generic, brDatabaseType=brDatabaseType, BridgeId=BridgeId, linkBuilderFMS_cards_24utp=linkBuilderFMS_cards_24utp, sysLoader=sysLoader, deskMan_mib=deskMan_mib, linkBuilderFMSII=linkBuilderFMSII, viewBuilderApps=viewBuilderApps, bridgeMgmt=bridgeMgmt, brMonPortBroadcastBandwidth=brMonPortBroadcastBandwidth, products=products, hub=hub, fault=fault, localSnmp=localSnmp, a3Com=a3Com, setup=setup, lBridgeECS_mib=lBridgeECS_mib, linkBuilderFMS_cards_fiber=linkBuilderFMS_cards_fiber, brSTAPMode=brSTAPMode, brouter=brouter, brClearFilteringDataBase=brClearFilteringDataBase, brSaveLearntAddresses=brSaveLearntAddresses, repeaterMgmt=repeaterMgmt, genExperimental=genExperimental, linkBuilderFMSII_cards_12tp_rj45=linkBuilderFMSII_cards_12tp_rj45, brControlPackage=brControlPackage, linkBuilderFMS_cards_utp=linkBuilderFMS_cards_utp, brMaxNumberOfPermanentEntries=brMaxNumberOfPermanentEntries, dedicatedBridgeServer=dedicatedBridgeServer, genericTrap=genericTrap, brMonPortTable=brMonPortTable, brMonPortErrorsPer10000Packets=brMonPortErrorsPer10000Packets, brAgingMode=brAgingMode, brDialoguePackage=brDialoguePackage, linkBuilder3GH_cards=linkBuilder3GH_cards, linkBuilderMSH_cards=linkBuilderMSH_cards, manager=manager, brTrafficForwarded=brTrafficForwarded, linkBuilderFMSII_cards_10coax_bnc=linkBuilderFMSII_cards_10coax_bnc, netBuilder_mib=netBuilder_mib, powerSupply=powerSupply, brLearnMode=brLearnMode, brMonitorPackage=brMonitorPackage, cards=cards, linkBuilderMSH=linkBuilderMSH, linkBuilder3GH_mib=linkBuilder3GH_mib, asciiAgent=asciiAgent, brMonPortIfIndex=brMonPortIfIndex, linkBuilderFMS_cards=linkBuilderFMS_cards, PhysAddress=PhysAddress, unusedGeneric12=unusedGeneric12, linkBuilder10BTi_cards_utp=linkBuilder10BTi_cards_utp, linkBuilderFMS_cards_coax=linkBuilderFMS_cards_coax, linkBuilder10BTi=linkBuilder10BTi, poll=poll, brDatabaseLevel=brDatabaseLevel, brMonPortPercentTrafficForwarded=brMonPortPercentTrafficForwarded, DisplayString=DisplayString, amp_mib=amp_mib, linkBuilderMSH_mib=linkBuilderMSH_mib, linkBuilderFMSLBridge=linkBuilderFMSLBridge, brPortErrors=brPortErrors, brClearPermanentEntries=brClearPermanentEntries, brDummyPackage=brDummyPackage, serialIf=serialIf, brMonPortBandwidthUsed=brMonPortBandwidthUsed, specificTrap=specificTrap, linkBuilderECS_cards=linkBuilderECS_cards, testData=testData, mrmResilience=mrmResilience, linkBuilderECS=linkBuilderECS, gauges=gauges, chassis=chassis, brMonPortEntry=brMonPortEntry, brPortBandwidth=brPortBandwidth, brDataBase=brDataBase, brPercentageOfPermanentDatabaseUsed=brPercentageOfPermanentDatabaseUsed, brPercentageOfAgeingFDBEntries=brPercentageOfAgeingFDBEntries, linkBuilderFMSII_cards_12fiber_st=linkBuilderFMSII_cards_12fiber_st, linkBuilderECS_mib=linkBuilderECS_mib, terminalServer=terminalServer, brDatabaseFull=brDatabaseFull, genericMSWorkstation=genericMSWorkstation, genericMSServer=genericMSServer, tokenRing=tokenRing, brSizeOfFilteringDataBase=brSizeOfFilteringDataBase, linkBuilderFMSII_cards_24tp_telco=linkBuilderFMSII_cards_24tp_telco, mib_2=mib_2)
a = int(input()) if(a>1000000): print(0) else: c = int(input()) if(c==a): print(0) else: ver = [] var = [] for i in range(a): b = float(input()) var.append(b) j=0 sumout = [] for element in var: k=j if(j+c<len(var)+1): nnd=[] for i in range(c): nnd.append(k) k+=1 prh = 0 sum = 0 for element1 in var: if(prh not in nnd): sum = sum + element1 prh += 1 sumout.append(sum) j+=1 print(min(sumout))
a = int(input()) if a > 1000000: print(0) else: c = int(input()) if c == a: print(0) else: ver = [] var = [] for i in range(a): b = float(input()) var.append(b) j = 0 sumout = [] for element in var: k = j if j + c < len(var) + 1: nnd = [] for i in range(c): nnd.append(k) k += 1 prh = 0 sum = 0 for element1 in var: if prh not in nnd: sum = sum + element1 prh += 1 sumout.append(sum) j += 1 print(min(sumout))
# python3 # coding=<UTF-8> class EmptyPageException(Exception): """Raised when empty page encountered"""
class Emptypageexception(Exception): """Raised when empty page encountered"""
def main(): total = float print("**********Think in te last five game that you buy**********") game1 = input("What's the game?: ") time1 = float(input(f"How many hours did you play {game1}?: ")) price1 = float(input(f"How many dollars did you spend in the {game1}?: ")) print("-------------------------------------------------------------------") game2 = input("What's the game?: ") time2 = float(input(f"How many hours did you play {game2}?: ")) price2 = float(input(f"How many dollars did you spend in the {game2}?: ")) print("-------------------------------------------------------------------") game3 = input("What's the game?: ") time3 = float(input(f"How many hours did you play {game3}?: ")) price3 = float(input(f"How many dollars did you spend in the {game3}?: ")) print("-------------------------------------------------------------------") game4 = input("What's the game?: ") time4 = float(input(f"How many hours did you play {game4}?: ")) price4 = float(input(f"How many dollars did you spend in the {game4}?: ")) print("-------------------------------------------------------------------") game5 = input("What's the game?: ") time5 = float(input(f"How many hours did you play {game5}?: ")) price5 = float(input(f"How many dollars did you spend in the {game5}?: ")) print("-------------------------------------------------------------------") total = (time1/price1 + time2/price2 + time3/price3 + time4/price4 + time5/price5) / 5 print(f"The games {game1}, {game2}, {game3}, {game4}, {game5} cost you {total} the hour") if __name__ == '__main__': main()
def main(): total = float print('**********Think in te last five game that you buy**********') game1 = input("What's the game?: ") time1 = float(input(f'How many hours did you play {game1}?: ')) price1 = float(input(f'How many dollars did you spend in the {game1}?: ')) print('-------------------------------------------------------------------') game2 = input("What's the game?: ") time2 = float(input(f'How many hours did you play {game2}?: ')) price2 = float(input(f'How many dollars did you spend in the {game2}?: ')) print('-------------------------------------------------------------------') game3 = input("What's the game?: ") time3 = float(input(f'How many hours did you play {game3}?: ')) price3 = float(input(f'How many dollars did you spend in the {game3}?: ')) print('-------------------------------------------------------------------') game4 = input("What's the game?: ") time4 = float(input(f'How many hours did you play {game4}?: ')) price4 = float(input(f'How many dollars did you spend in the {game4}?: ')) print('-------------------------------------------------------------------') game5 = input("What's the game?: ") time5 = float(input(f'How many hours did you play {game5}?: ')) price5 = float(input(f'How many dollars did you spend in the {game5}?: ')) print('-------------------------------------------------------------------') total = (time1 / price1 + time2 / price2 + time3 / price3 + time4 / price4 + time5 / price5) / 5 print(f'The games {game1}, {game2}, {game3}, {game4}, {game5} cost you {total} the hour') if __name__ == '__main__': main()
class Solution: def minCostToMoveChips(self, position: List[int]) -> int: even_cnt = 0 odd_cnt = 0 for i in position: if i % 2 == 0: even_cnt += 1 else: odd_cnt += 1 return min(even_cnt, odd_cnt)
class Solution: def min_cost_to_move_chips(self, position: List[int]) -> int: even_cnt = 0 odd_cnt = 0 for i in position: if i % 2 == 0: even_cnt += 1 else: odd_cnt += 1 return min(even_cnt, odd_cnt)
class Configuration(object): """ Base configuration, regardless of the environment. """ SECRET_KEY='\x96\x0f\\\x8b\x9f=t\x07(pE\xfdku\xee\t' class DevelopmentConfig(Configuration): """ Configuration for development environment only """ SQLALCHEMY_DATABASE_URI = 'sqlite:///database.db'
class Configuration(object): """ Base configuration, regardless of the environment. """ secret_key = '\x96\x0f\\\x8b\x9f=t\x07(pEýkuî\t' class Developmentconfig(Configuration): """ Configuration for development environment only """ sqlalchemy_database_uri = 'sqlite:///database.db'
n = int(input()) positives = [] negatives = [] for i in range(n): current_number = int(input()) if current_number >= 0: positives.append(current_number) else: negatives.append(current_number) #============ Comprehension =============== #numbers = [int(input()) for _ in range(n)] #positives = [i for i in numbers if i >= 0] #negatives = [i for i in numbers if i < 0] print(positives) print(negatives) print(f"Count of positives: {len(positives)}. Sum of negatives: {sum(negatives)}")
n = int(input()) positives = [] negatives = [] for i in range(n): current_number = int(input()) if current_number >= 0: positives.append(current_number) else: negatives.append(current_number) print(positives) print(negatives) print(f'Count of positives: {len(positives)}. Sum of negatives: {sum(negatives)}')
# # PySNMP MIB module JUNIPER-LSYSSP-NATSRCPOOL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/JUNIPER-LSYSSP-NATSRCPOOL-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:00:04 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsIntersection, ValueRangeConstraint, ValueSizeConstraint, ConstraintsUnion, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsUnion", "SingleValueConstraint") jnxLsysSpNATsrcpool, = mibBuilder.importSymbols("JUNIPER-LSYS-SECURITYPROFILE-MIB", "jnxLsysSpNATsrcpool") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") Counter64, Bits, MibIdentifier, iso, Counter32, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, Unsigned32, TimeTicks, Integer32, IpAddress, NotificationType, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "Bits", "MibIdentifier", "iso", "Counter32", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "Unsigned32", "TimeTicks", "Integer32", "IpAddress", "NotificationType", "Gauge32") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") jnxLsysSpNATsrcpoolMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1)) if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolMIB.setLastUpdated('201005191644Z') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolMIB.setOrganization('Juniper Networks, Inc.') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolMIB.setContactInfo('Juniper Technical Assistance Center Juniper Networks, Inc. 1194 N. Mathilda Avenue Sunnyvale, CA 94089 E-mail: support@juniper.net HTTP://www.juniper.net') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolMIB.setDescription('This module defines the NAT-src-pool-specific MIB for Juniper Enterprise Logical-System (LSYS) security profiles. Juniper documentation is recommended as the reference. The LSYS security profile provides various static and dynamic resource management by observing resource quota limits. Security NAT-src-pool resource is the focus in this MIB. ') jnxLsysSpNATsrcpoolObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 1)) jnxLsysSpNATsrcpoolSummary = MibIdentifier((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 2)) jnxLsysSpNATsrcpoolTable = MibTable((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 1, 1), ) if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolTable.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolTable.setDescription('LSYSPROFILE NAT-src-pool objects for NAT-src-pool resource consumption per LSYS.') jnxLsysSpNATsrcpoolEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 1, 1, 1), ).setIndexNames((1, "JUNIPER-LSYSSP-NATSRCPOOL-MIB", "jnxLsysSpNATsrcpoolLsysName")) if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolEntry.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolEntry.setDescription('An entry in NAT-src-pool resource table.') jnxLsysSpNATsrcpoolLsysName = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 1, 1, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 64))) if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolLsysName.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolLsysName.setDescription('The name of the logical system for which NAT-src-pool resource information is retrieved. ') jnxLsysSpNATsrcpoolProfileName = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 1, 1, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolProfileName.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolProfileName.setDescription('The security profile name string for the LSYS.') jnxLsysSpNATsrcpoolUsage = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 1, 1, 1, 3), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolUsage.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolUsage.setDescription('The current resource usage count for the LSYS.') jnxLsysSpNATsrcpoolReserved = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 1, 1, 1, 4), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolReserved.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolReserved.setDescription('The reserved resource count for the LSYS.') jnxLsysSpNATsrcpoolMaximum = MibTableColumn((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 1, 1, 1, 5), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolMaximum.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolMaximum.setDescription('The maximum allowed resource usage count for the LSYS.') jnxLsysSpNATsrcpoolUsedAmount = MibScalar((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 2, 1), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolUsedAmount.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolUsedAmount.setDescription('The NAT-src-pool resource consumption over all LSYS.') jnxLsysSpNATsrcpoolMaxQuota = MibScalar((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 2, 2), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolMaxQuota.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolMaxQuota.setDescription('The NAT-src-pool resource maximum quota for the whole device for all LSYS.') jnxLsysSpNATsrcpoolAvailableAmount = MibScalar((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 2, 3), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolAvailableAmount.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolAvailableAmount.setDescription('The NAT-src-pool resource available in the whole device.') jnxLsysSpNATsrcpoolHeaviestUsage = MibScalar((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 2, 4), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolHeaviestUsage.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolHeaviestUsage.setDescription('The most amount of NAT-src-pool resource consumed of a LSYS.') jnxLsysSpNATsrcpoolHeaviestUser = MibScalar((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 2, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolHeaviestUser.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolHeaviestUser.setDescription('The LSYS name that consume the most NAT-src-pool resource.') jnxLsysSpNATsrcpoolLightestUsage = MibScalar((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 2, 6), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolLightestUsage.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolLightestUsage.setDescription('The least amount of NAT-src-pool resource consumed of a LSYS.') jnxLsysSpNATsrcpoolLightestUser = MibScalar((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 2, 7), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolLightestUser.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolLightestUser.setDescription('The LSYS name that consume the least NAT-src-pool resource.') mibBuilder.exportSymbols("JUNIPER-LSYSSP-NATSRCPOOL-MIB", jnxLsysSpNATsrcpoolHeaviestUser=jnxLsysSpNATsrcpoolHeaviestUser, jnxLsysSpNATsrcpoolProfileName=jnxLsysSpNATsrcpoolProfileName, jnxLsysSpNATsrcpoolAvailableAmount=jnxLsysSpNATsrcpoolAvailableAmount, jnxLsysSpNATsrcpoolEntry=jnxLsysSpNATsrcpoolEntry, jnxLsysSpNATsrcpoolLsysName=jnxLsysSpNATsrcpoolLsysName, PYSNMP_MODULE_ID=jnxLsysSpNATsrcpoolMIB, jnxLsysSpNATsrcpoolReserved=jnxLsysSpNATsrcpoolReserved, jnxLsysSpNATsrcpoolLightestUsage=jnxLsysSpNATsrcpoolLightestUsage, jnxLsysSpNATsrcpoolLightestUser=jnxLsysSpNATsrcpoolLightestUser, jnxLsysSpNATsrcpoolMIB=jnxLsysSpNATsrcpoolMIB, jnxLsysSpNATsrcpoolHeaviestUsage=jnxLsysSpNATsrcpoolHeaviestUsage, jnxLsysSpNATsrcpoolTable=jnxLsysSpNATsrcpoolTable, jnxLsysSpNATsrcpoolObjects=jnxLsysSpNATsrcpoolObjects, jnxLsysSpNATsrcpoolMaximum=jnxLsysSpNATsrcpoolMaximum, jnxLsysSpNATsrcpoolMaxQuota=jnxLsysSpNATsrcpoolMaxQuota, jnxLsysSpNATsrcpoolSummary=jnxLsysSpNATsrcpoolSummary, jnxLsysSpNATsrcpoolUsedAmount=jnxLsysSpNATsrcpoolUsedAmount, jnxLsysSpNATsrcpoolUsage=jnxLsysSpNATsrcpoolUsage)
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, value_size_constraint, constraints_union, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'ValueRangeConstraint', 'ValueSizeConstraint', 'ConstraintsUnion', 'SingleValueConstraint') (jnx_lsys_sp_na_tsrcpool,) = mibBuilder.importSymbols('JUNIPER-LSYS-SECURITYPROFILE-MIB', 'jnxLsysSpNATsrcpool') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (counter64, bits, mib_identifier, iso, counter32, module_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, object_identity, unsigned32, time_ticks, integer32, ip_address, notification_type, gauge32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter64', 'Bits', 'MibIdentifier', 'iso', 'Counter32', 'ModuleIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ObjectIdentity', 'Unsigned32', 'TimeTicks', 'Integer32', 'IpAddress', 'NotificationType', 'Gauge32') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') jnx_lsys_sp_na_tsrcpool_mib = module_identity((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1)) if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolMIB.setLastUpdated('201005191644Z') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolMIB.setOrganization('Juniper Networks, Inc.') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolMIB.setContactInfo('Juniper Technical Assistance Center Juniper Networks, Inc. 1194 N. Mathilda Avenue Sunnyvale, CA 94089 E-mail: support@juniper.net HTTP://www.juniper.net') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolMIB.setDescription('This module defines the NAT-src-pool-specific MIB for Juniper Enterprise Logical-System (LSYS) security profiles. Juniper documentation is recommended as the reference. The LSYS security profile provides various static and dynamic resource management by observing resource quota limits. Security NAT-src-pool resource is the focus in this MIB. ') jnx_lsys_sp_na_tsrcpool_objects = mib_identifier((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 1)) jnx_lsys_sp_na_tsrcpool_summary = mib_identifier((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 2)) jnx_lsys_sp_na_tsrcpool_table = mib_table((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 1, 1)) if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolTable.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolTable.setDescription('LSYSPROFILE NAT-src-pool objects for NAT-src-pool resource consumption per LSYS.') jnx_lsys_sp_na_tsrcpool_entry = mib_table_row((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 1, 1, 1)).setIndexNames((1, 'JUNIPER-LSYSSP-NATSRCPOOL-MIB', 'jnxLsysSpNATsrcpoolLsysName')) if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolEntry.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolEntry.setDescription('An entry in NAT-src-pool resource table.') jnx_lsys_sp_na_tsrcpool_lsys_name = mib_table_column((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 1, 1, 1, 1), display_string().subtype(subtypeSpec=value_size_constraint(1, 64))) if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolLsysName.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolLsysName.setDescription('The name of the logical system for which NAT-src-pool resource information is retrieved. ') jnx_lsys_sp_na_tsrcpool_profile_name = mib_table_column((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 1, 1, 1, 2), display_string().subtype(subtypeSpec=value_size_constraint(1, 32))).setMaxAccess('readonly') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolProfileName.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolProfileName.setDescription('The security profile name string for the LSYS.') jnx_lsys_sp_na_tsrcpool_usage = mib_table_column((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 1, 1, 1, 3), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolUsage.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolUsage.setDescription('The current resource usage count for the LSYS.') jnx_lsys_sp_na_tsrcpool_reserved = mib_table_column((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 1, 1, 1, 4), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolReserved.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolReserved.setDescription('The reserved resource count for the LSYS.') jnx_lsys_sp_na_tsrcpool_maximum = mib_table_column((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 1, 1, 1, 5), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolMaximum.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolMaximum.setDescription('The maximum allowed resource usage count for the LSYS.') jnx_lsys_sp_na_tsrcpool_used_amount = mib_scalar((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 2, 1), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolUsedAmount.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolUsedAmount.setDescription('The NAT-src-pool resource consumption over all LSYS.') jnx_lsys_sp_na_tsrcpool_max_quota = mib_scalar((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 2, 2), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolMaxQuota.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolMaxQuota.setDescription('The NAT-src-pool resource maximum quota for the whole device for all LSYS.') jnx_lsys_sp_na_tsrcpool_available_amount = mib_scalar((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 2, 3), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolAvailableAmount.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolAvailableAmount.setDescription('The NAT-src-pool resource available in the whole device.') jnx_lsys_sp_na_tsrcpool_heaviest_usage = mib_scalar((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 2, 4), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolHeaviestUsage.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolHeaviestUsage.setDescription('The most amount of NAT-src-pool resource consumed of a LSYS.') jnx_lsys_sp_na_tsrcpool_heaviest_user = mib_scalar((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 2, 5), display_string().subtype(subtypeSpec=value_size_constraint(1, 64))).setMaxAccess('readonly') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolHeaviestUser.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolHeaviestUser.setDescription('The LSYS name that consume the most NAT-src-pool resource.') jnx_lsys_sp_na_tsrcpool_lightest_usage = mib_scalar((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 2, 6), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolLightestUsage.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolLightestUsage.setDescription('The least amount of NAT-src-pool resource consumed of a LSYS.') jnx_lsys_sp_na_tsrcpool_lightest_user = mib_scalar((1, 3, 6, 1, 4, 1, 2636, 3, 39, 1, 17, 8, 1, 2, 7), display_string().subtype(subtypeSpec=value_size_constraint(1, 64))).setMaxAccess('readonly') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolLightestUser.setStatus('current') if mibBuilder.loadTexts: jnxLsysSpNATsrcpoolLightestUser.setDescription('The LSYS name that consume the least NAT-src-pool resource.') mibBuilder.exportSymbols('JUNIPER-LSYSSP-NATSRCPOOL-MIB', jnxLsysSpNATsrcpoolHeaviestUser=jnxLsysSpNATsrcpoolHeaviestUser, jnxLsysSpNATsrcpoolProfileName=jnxLsysSpNATsrcpoolProfileName, jnxLsysSpNATsrcpoolAvailableAmount=jnxLsysSpNATsrcpoolAvailableAmount, jnxLsysSpNATsrcpoolEntry=jnxLsysSpNATsrcpoolEntry, jnxLsysSpNATsrcpoolLsysName=jnxLsysSpNATsrcpoolLsysName, PYSNMP_MODULE_ID=jnxLsysSpNATsrcpoolMIB, jnxLsysSpNATsrcpoolReserved=jnxLsysSpNATsrcpoolReserved, jnxLsysSpNATsrcpoolLightestUsage=jnxLsysSpNATsrcpoolLightestUsage, jnxLsysSpNATsrcpoolLightestUser=jnxLsysSpNATsrcpoolLightestUser, jnxLsysSpNATsrcpoolMIB=jnxLsysSpNATsrcpoolMIB, jnxLsysSpNATsrcpoolHeaviestUsage=jnxLsysSpNATsrcpoolHeaviestUsage, jnxLsysSpNATsrcpoolTable=jnxLsysSpNATsrcpoolTable, jnxLsysSpNATsrcpoolObjects=jnxLsysSpNATsrcpoolObjects, jnxLsysSpNATsrcpoolMaximum=jnxLsysSpNATsrcpoolMaximum, jnxLsysSpNATsrcpoolMaxQuota=jnxLsysSpNATsrcpoolMaxQuota, jnxLsysSpNATsrcpoolSummary=jnxLsysSpNATsrcpoolSummary, jnxLsysSpNATsrcpoolUsedAmount=jnxLsysSpNATsrcpoolUsedAmount, jnxLsysSpNATsrcpoolUsage=jnxLsysSpNATsrcpoolUsage)