content
stringlengths
7
1.05M
""" SeparateChainingMap Implement a Map with a hash table, using separate chaining. """ class SeparateChaining: def __init__(self, length=10): self.table = [[] for _ in range(length)] self.size = 0 def __len__(self): return self.size def __setitem__(self, key, value): print('inserting:', key, value) index = self._hash(key) for key_val in self.table[index]: if key == key_val[0]: key_val[1] = value return self.table[index].append([key, value]) self.size += 1 if self.size > len(self.table): self._resize(2*len(self.table)) def __getitem__(self, key): index = self._hash(key) for k, v in self.table[index]: if key == k: return v raise KeyError def __delitem__(self, key): index = self._hash(key) for i in range(len(self.table[index])): if key is self.table[index][i][0]: self.table[index].pop(i) self.size -= 1 return raise KeyError def __iter__(self): for bucket in self.table: for key, _ in bucket: yield key def __contains__(self, key): index = self._hash(key) for k, _ in self.table[index]: if key == k: return True return False def _hash(self, key): return hash(key) % len(self.table) def _resize(self, newsize): print('resizing') old_table = self.table self.table = [[] for _ in range(newsize)] for bucket in old_table: for key_value in bucket: #self[key] = value index = self._hash(key_value[0]) self.table[index].append(key_value) def print_map(map): for key in map: print(key, map[key]) if __name__ == '__main__': sc = SeparateChaining(3) print_map(sc) print(17 in sc) print('========') sc[17] = 'john' print_map(sc) print(17 in sc) print(sc[17]) print('========') sc[42] = 'paul' print_map(sc) print(sc.table) print('========') sc[17] = 'george' print_map(sc) print(sc.table) print('========') del sc[17] print(sc.table) print_map(sc) print('========') sc[13] = 'ringo' print_map(sc) sc[25] = 'moe' sc[26] = 'larry' sc[27] = 'curly' sc[28] = 'groucho' print_map(sc) print(sc.table)
""" Define a procedure, `deep_reverse`, that takes as input a list, and returns a new list that is the deep reverse of the input list. This means it reverses all the elements in the list, and if any of those elements are lists themselves, reverses all the elements in the inner list, all the way down. >Note: The procedure must not change the input list itself. Example Input: `[1, 2, [3, 4, 5], 4, 5]` Output: `[5, 4, [5, 4, 3], 2, 1]` """ def deep_reverse(arr): output = [] for _ in list(reversed(arr)): if type(_) == list: output.append(deep_reverse(_)) elif type(_) != list: output.append(_) return output # cleaner solution, feels more pythonic? def _deep_reverse(arr): if type(arr) is not list: return arr else: results = [] arr = arr[::-1] # more pythonic way to reverse for element in arr: results.append(deep_reverse(element)) return results def test_function(test_case): arr = test_case[0] solution = test_case[1] output = deep_reverse(arr) if output == solution: return True else: return False arr = [1, 2, 3, 4, 5] solution = [5, 4, 3, 2, 1] test_case = [arr, solution] assert test_function(test_case) == True arr = [1, 2, [3, 4, 5], 4, 5] solution = [5, 4, [5, 4, 3], 2, 1] test_case = [arr, solution] assert test_function(test_case) == True arr = [1, [2, 3, [4, [5, 6]]]] solution = [[[[6, 5], 4], 3, 2], 1] test_case = [arr, solution] assert test_function(test_case) == True arr = [1, [2, 3], 4, [5, 6]] solution = [[6, 5], 4, [3, 2], 1] test_case = [arr, solution] assert test_function(test_case) == True
def build_graph(projects, deps): g = {} for p in projects: g[p] = (set(), set()) for d in deps: g[d[0]][0].add(d[1]) g[d[1]][1].add(d[0]) return g def build_order(projects, deps): g = build_graph(projects, deps) result = [] while g: buff = [] for p in g: if len(g[p][1]) == 0: buff.append(p) for p in buff: for out in g[p][0]: g[out][1].remove(p) del g[p] if len(buff) == 0: return None # cycle detected result.extend(buff) return result def build_order2(projects, deps): g = build_graph(projects, deps) result = [] for p in g: visited = set() if dsf(g, p, result, visited, p): return None # detected cycle return reversed(result) def dsf(graph, n, path, visited, start): for node in graph[n][0]: if node not in visited: if node == start: return True visited.add(node) if dsf(graph, node, path, visited, start): return True if n not in path: path.append(n) return False projects = ['a', 'b', 'c', 'd', 'e', 'f', 'g'] deps = [('a', 'd'), ('f', 'b'), ('b', 'd'), ('f', 'a'), ('d', 'c')] deps2 = [('f', 'c'), ('f', 'b'), ('f', 'a'), ('b', 'a'), ('b', 'e'), ('d', 'g'), ('a', 'e')] deps3 = [('a', 'b'), ('b', 'c'), ('c', 'd'), ('d', 'a')] print(build_order(projects, deps)) print(build_order(projects, deps2)) print(build_order(projects, deps3)) print(build_order2(projects, deps)) print(build_order2(projects, deps2)) print(build_order2(projects, deps3))
class Solution: # @param {integer[]} nums # @return {boolean} def containsDuplicate(self, nums): tb = set() for n in nums: if n in tb: return True tb.add(n) return False
#!/usr/bin/env python # MIT License # # Copyright (c) 2019 iAchieved.it # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. ChessPieces = { 'BB':'Black Bishop', 'BK':'Black King', 'BN':'Black Knight', 'BP':'Black Pawn', 'BQ':'Black Queen', 'BR':'Black Rook', 'WB':'White Bishop', 'WK':'White King', 'WN':'White Knight', 'WP':'White Pawn', 'WQ':'White Queen', 'WR':'White Rook', }
html_tags = ['<!--...-->', '<!DOCTYPE>', '<a>', '<abbr>', '<acronym>', '<address>', '<applet>', '<area>', '<article>', '<aside>', '<audio>', '<b>', '<base>', '<basefont>', '<bdi>', '<bdo>', '<big>', '<blockquote>', '<body>', '<br>', '<button>', '<canvas>', '<caption>', '<center>', '<cite>', '<code>', '<col>', '<colgroup>', '<data>', '<datalist>', '<dd>', '<del>', '<details>', '<dfn>', '<dialog>', '<dir>', '<div>', '<dl>', '<dt>', '<em>', '<embed>', '<fieldset>', '<figcaption>', '<figure>', '<font>', '<footer>', '<form>', '<frame>', '<frameset>', '<h1> to <h6>', '<head>', '<header>', '<hr>', '<html>', '<i>', '<iframe>', '<img>', '<input>', '<ins>', '<kbd>', '<label>', '<legend>', '<li>', '<link>', '<main>', '<map>', '<mark>', '<meta>', '<meter>', '<nav>', '<noframes>', '<noscript>', '<object>', '<ol>', '<optgroup>', '<option>', '<output>', '<p>', '<param>', '<picture>', '<pre>', '<progress>', '<q>', '<rp>', '<rt>', '<ruby>', '<s>', '<samp>', '<script>', '<section>', '<select>', '<small>', '<source>', '<span>', '<strike>', '<strong>', '<style>', '<sub>', '<summary>', '<sup>', '<svg>', '<table>', '<tbody>', '<td>', '<template>', '<textarea>', '<tfoot>', '<th>', '<thead>', '<time>', '<title>', '<tr>', '<track>', '<tt>', '<u>', '<ul>', '<var>', '<video>', '<wbr>'] html_tags_stripped = ['!--...--', '!DOCTYPE', 'a', 'abbr', 'acronym', 'address', 'applet', 'area', 'article', 'aside', 'audio', 'b', 'base', 'basefont', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'frame', 'frameset', 'h1 to h6', 'head', 'header', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'meta', 'meter', 'nav', 'noframes', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'svg', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr'] all_attributes_list = ['accept', 'accept-charset', 'accesskey', 'action', 'alt', 'async', 'autocomplete', 'autofocus', 'autoplay', 'charset', 'checked', 'cite', 'class', 'cols', 'colspan', 'contenteditable', 'controls', 'coords', 'data', 'data-*', 'datetime', 'default', 'defer', 'dir', 'dirname', 'disabled', 'download', 'draggable', 'enctype', 'for', 'form', 'formaction', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'http-equiv', 'id', 'ismap', 'kind', 'label', 'lang', 'list', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'multiple', 'muted', 'name', 'novalidate', 'onabort', 'onafterprint', 'onbeforeprint', 'onbeforeunload', 'onblur', 'oncanplay', 'oncanplaythrough', 'onchange', 'onclick', 'oncontextmenu', 'oncopy', 'oncuechange', 'oncut', 'ondblclick', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'ondurationchange', 'onemptied', 'onended', 'onerror', 'onfocus', 'onhashchange', 'oninput', 'oninvalid', 'onkeydown', 'onkeypress', 'onkeyup', 'onload', 'onloadeddata', 'onloadedmetadata', 'onloadstart', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onoffline', 'ononline', 'onpagehide', 'onpageshow', 'onpaste', 'onpause', 'onplay', 'onplaying', 'onpopstate', 'onprogress', 'onratechange', 'onreset', 'onresize', 'onscroll', 'onsearch', 'onseeked', 'onseeking', 'onselect', 'onstalled', 'onstorage', 'onsubmit', 'onsuspend', 'ontimeupdate', 'ontoggle', 'onunload', 'onvolumechange', 'onwaiting', 'onwheel', 'open', 'optimum', 'pattern', 'placeholder', 'poster', 'preload', 'readonly', 'rel', 'required', 'reversed', 'rows', 'rowspan', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'spellcheck', 'src', 'srcdoc', 'srclang', 'srcset', 'start', 'step', 'style', 'tabindex', 'target', 'title', 'translate', 'type', 'usemap', 'value', 'width', 'wrap'] attributes = {'accept': ['<input />'], 'accept-charset': ['<form>'], 'accesskey': ['global attribute'], 'action': ['<form>'], 'alt': ['<area />', '<img />', '<input />'], 'async': ['<script>'], 'autocomplete': ['<form>', '<input />'], 'autofocus': ['<button>', '<input />', '<select>', '<textarea>'], 'autoplay': ['<audio>', '<video>'], 'charset': ['<meta />', '<script>'], 'checked': ['<input />'], 'cite': ['<blockquote>', '<del>', '<ins>', '<q>'], 'class': ['global attribute'], 'cols': ['<textarea>'], 'colspan': ['<td>', '<th>'], 'contenteditable': ['global attribute'], 'controls': ['<audio>', '<video>'], 'coords': ['<area />'], 'data': ['<object>'], 'data-*': ['global attribute'], 'datetime': ['<del>', '<ins>', '<time>'], 'default': ['<track />'], 'defer': ['<script>'], 'dir': ['global attribute'], 'dirname': ['<input />', '<textarea>'], 'disabled': ['<button>', '<fieldset>', '<input />', '<optgroup>', '<option>', '<select>', '<textarea>'], 'download': ['<a>', '<area />'], 'draggable': ['global attribute'], 'enctype': ['<form>'], 'for': ['<label>', '<output>'], 'form': ['<button>', '<fieldset>', '<input />', '<label>', '<meter>', '<object>', '<output>', '<select>', '<textarea>'], 'formaction': ['<button>', '<input />'], 'headers': ['<td>', '<th>'], 'height': ['<canvas>', '<embed />', '<iframe>', '<img />', '<input />', '<object>', '<video>'], 'hidden': ['global attribute'], 'high': ['<meter>'], 'href': ['<a>', '<area />', '<base />', '<link />'], 'hreflang': ['<a>', '<area />', '<link />'], 'http-equiv': ['<meta />'], 'id': ['global attribute'], 'ismap': ['<img />'], 'kind': ['<track />'], 'label': ['<track />', '<option>', '<optgroup>'], 'lang': ['global attribute'], 'list': ['<input />'], 'loop': ['<audio>', '<video>'], 'low': ['<meter>'], 'max': ['<input />', '<meter>', '<progress>'], 'maxlength': ['<input />', '<textarea>'], 'media': ['<a>', '<area />', '<link />', '<source />', '<style>'], 'method': ['<form>'], 'min': ['<input />', '<meter>'], 'multiple': ['<input />', '<select>'], 'muted': ['<video>', '<audio>'], 'name': ['<button>', '<fieldset>', '<form>', '<iframe>', '<input />', '<map>', '<meta />', '<object>', '<output>', '<param />', '<select>', '<textarea>'], 'novalidate': ['<form>'], 'onabort': ['<audio>', '<embed />', '<img />', '<object>', '<video>'], 'onafterprint': ['<body>'], 'onbeforeprint': ['<body>'], 'onbeforeunload': ['<body>'], 'onblur': ['All visible'], 'oncanplay': ['<audio>', '<embed />', '<object>', '<video>'], 'oncanplaythrough': ['<audio>', '<video>'], 'onchange': ['All visible'], 'onclick': ['All visible'], 'oncontextmenu': ['All visible'], 'oncopy': ['All visible'], 'oncuechange': ['<track />'], 'oncut': ['All visible'], 'ondblclick': ['All visible'], 'ondrag': ['All visible'], 'ondragend': ['All visible'], 'ondragenter': ['All visible'], 'ondragleave': ['All visible'], 'ondragover': ['All visible'], 'ondragstart': ['All visible'], 'ondrop': ['All visible'], 'ondurationchange': ['<audio>', '<video>'], 'onemptied': ['<audio>', '<video>'], 'onended': ['<audio>', '<video>'], 'onerror': ['<audio>', '<body>', '<embed />', '<img />', '<object>', '<script>', '<style>', '<video>'], 'onfocus': ['All visible'], 'onhashchange': ['<body>'], 'oninput': ['All visible'], 'oninvalid': ['All visible'], 'onkeydown': ['All visible'], 'onkeypress': ['All visible'], 'onkeyup': ['All visible'], 'onload': ['<body>', '<iframe>', '<img />', '<input />', '<link />', '<script>', '<style>'], 'onloadeddata': ['<audio>', '<video>'], 'onloadedmetadata': ['<audio>', '<video>'], 'onloadstart': ['<audio>', '<video>'], 'onmousedown': ['All visible'], 'onmousemove': ['All visible'], 'onmouseout': ['All visible'], 'onmouseover': ['All visible'], 'onmouseup': ['All visible'], 'onmousewheel': ['All visible'], 'onoffline': ['<body>'], 'ononline': ['<body>'], 'onpagehide': ['<body>'], 'onpageshow': ['<body>'], 'onpaste': ['All visible'], 'onpause': ['<audio>', '<video>'], 'onplay': ['<audio>', '<video>'], 'onplaying': ['<audio>', '<video>'], 'onpopstate': ['<body>'], 'onprogress': ['<audio>', '<video>'], 'onratechange': ['<audio>', '<video>'], 'onreset': ['<form>'], 'onresize': ['<body>'], 'onscroll': ['All visible'], 'onsearch': ['<input />'], 'onseeked': ['<audio>', '<video>'], 'onseeking': ['<audio>', '<video>'], 'onselect': ['All visible'], 'onstalled': ['<audio>', '<video>'], 'onstorage': ['<body>'], 'onsubmit': ['<form>'], 'onsuspend': ['<audio>', '<video>'], 'ontimeupdate': ['<audio>', '<video>'], 'ontoggle': ['<details>'], 'onunload': ['<body>'], 'onvolumechange': ['<audio>', '<video>'], 'onwaiting': ['<audio>', '<video>'], 'onwheel': ['All visible'], 'open': ['<details>'], 'optimum': ['<meter>'], 'pattern': ['<input />'], 'placeholder': ['<input />', '<textarea>'], 'poster': ['<video>'], 'preload': ['<audio>', '<video>'], 'readonly': ['<input />', '<textarea>'], 'rel': ['<a>', '<area />', '<form>', '<link />'], 'required': ['<input />', '<select>', '<textarea>'], 'reversed': ['<ol>'], 'rows': ['<textarea>'], 'rowspan': ['<td>', '<th>'], 'scope': ['<th>'], 'selected': ['<option>'], 'shape': ['<area />'], 'size': ['<input />', '<select>'], 'sizes': ['<img />', '<link />', '<source />'], 'span': ['<col />', '<colgroup>'], 'spellcheck': ['global attribute'], 'src': ['<audio>', '<embed />', '<iframe>', '<img />', '<input />', '<script>', '<source />', '<track />', '<video>'], 'srcdoc': ['<iframe>'], 'srclang': ['<track />'], 'srcset': ['<img />', '<source />'], 'start': ['<ol>'], 'step': ['<input />'], 'style': ['global attribute'], 'tabindex': ['global attribute'], 'target': ['<a>', '<area />', '<base />', '<form>'], 'title': ['global attribute'], 'translate': ['global attribute'], 'type': ['<a>', '<button>', '<embed />', '<input />', '<link />', '<menu>', '<object>', '<script>', '<source />', '<style>'], 'usemap': ['<img />', '<object>'], 'value': ['<button>', '<input />', '<li>', '<option>', '<meter>', '<progress>', '<param />'], 'width': ['<canvas>', '<embed />', '<iframe>', '<img />', '<input />', '<object>', '<video>'], 'wrap': ['<textarea>']} html_tags_incl_attributes = {'<!--...-->': [], '<!DOCTYPE>': [], '<a>': ['download', 'href', 'hreflang', 'media', 'rel', 'target', 'type'], '<abbr>': [], '<acronym>': [], '<address>': [], '<applet>': [], '<article>': [], '<aside>': [], '<audio>': ['autoplay', 'controls', 'loop', 'muted', 'onabort', 'oncanplay', 'oncanplaythrough', 'ondurationchange', 'onemptied', 'onended', 'onerror', 'onloadeddata', 'onloadedmetadata', 'onloadstart', 'onpause', 'onplay', 'onplaying', 'onprogress', 'onratechange', 'onseeked', 'onseeking', 'onstalled', 'onsuspend', 'ontimeupdate', 'onvolumechange', 'onwaiting', 'preload', 'src'], '<b>': [], '<basefont>': [], '<bdi>': [], '<bdo>': [], '<big>': [], '<blockquote>': ['cite'], '<body>': ['onafterprint', 'onbeforeprint', 'onbeforeunload', 'onerror', 'onhashchange', 'onload', 'onoffline', 'ononline', 'onpagehide', 'onpageshow', 'onpopstate', 'onresize', 'onstorage', 'onunload'], '<button>': ['autofocus', 'disabled', 'form', 'formaction', 'name', 'type', 'value'], '<canvas>': ['height', 'width'], '<caption>': [], '<center>': [], '<cite>': [], '<code>': [], '<colgroup>': ['span'], '<data>': [], '<datalist>': [], '<dd>': [], '<del>': ['cite', 'datetime'], '<details>': ['ontoggle', 'open'], '<dfn>': [], '<dialog>': [], '<dir>': [], '<div>': [], '<dl>': [], '<dt>': [], '<em>': [], '<fieldset>': ['disabled', 'form', 'name'], '<figcaption>': [], '<figure>': [], '<font>': [], '<footer>': [], '<form>': ['accept-charset', 'action', 'autocomplete', 'enctype', 'method', 'name', 'novalidate', 'onreset', 'onsubmit', 'rel', 'target'], '<frame>': [], '<frameset>': [], '<h1> to <h6>': [], '<head>': [], '<header>': [], '<html>': [], '<i>': [], '<iframe>': ['height', 'name', 'onload', 'src', 'srcdoc', 'width'], '<ins>': ['cite', 'datetime'], '<kbd>': [], '<label>': ['for', 'form'], '<legend>': [], '<li>': ['value'], '<main>': [], '<map>': ['name'], '<mark>': [], '<meter>': ['form', 'high', 'low', 'max', 'min', 'optimum', 'value'], '<nav>': [], '<noframes>': [], '<noscript>': [], '<object>': ['data', 'form', 'height', 'name', 'onabort', 'oncanplay', 'onerror', 'type', 'usemap', 'width'], '<ol>': ['reversed', 'start'], '<optgroup>': ['disabled', 'label'], '<option>': ['disabled', 'label', 'selected', 'value'], '<output>': ['for', 'form', 'name'], '<p>': [], '<picture>': [], '<pre>': [], '<progress>': ['max', 'value'], '<q>': ['cite'], '<rp>': [], '<rt>': [], '<ruby>': [], '<s>': [], '<samp>': [], '<script>': ['async', 'charset', 'defer', 'onerror', 'onload', 'src', 'type'], '<section>': [], '<select>': ['autofocus', 'disabled', 'form', 'multiple', 'name', 'required', 'size'], '<small>': [], '<span>': [], '<strike>': [], '<strong>': [], '<style>': ['media', 'onerror', 'onload', 'type'], '<sub>': [], '<summary>': [], '<sup>': [], '<svg>': [], '<table>': [], '<tbody>': [], '<td>': ['colspan', 'headers', 'rowspan'], '<template>': [], '<textarea>': ['autofocus', 'cols', 'dirname', 'disabled', 'form', 'maxlength', 'name', 'placeholder', 'readonly', 'required', 'rows', 'wrap'], '<tfoot>': [], '<th>': ['colspan', 'headers', 'rowspan', 'scope'], '<thead>': [], '<time>': ['datetime'], '<title>': [], '<tr>': [], '<tt>': [], '<u>': [], '<ul>': [], '<var>': [], '<video>': ['autoplay', 'controls', 'height', 'loop', 'muted', 'onabort', 'oncanplay', 'oncanplaythrough', 'ondurationchange', 'onemptied', 'onended', 'onerror', 'onloadeddata', 'onloadedmetadata', 'onloadstart', 'onpause', 'onplay', 'onplaying', 'onprogress', 'onratechange', 'onseeked', 'onseeking', 'onstalled', 'onsuspend', 'ontimeupdate', 'onvolumechange', 'onwaiting', 'poster', 'preload', 'src', 'width'], '<area />': ['alt', 'coords', 'download', 'href', 'hreflang', 'media', 'rel', 'shape', 'target'], '<base />': ['href', 'target'], '<br />': [], '<col />': ['span'], '<embed />': ['height', 'onabort', 'oncanplay', 'onerror', 'src', 'type', 'width'], '<hr />': [], '<img />': ['alt', 'height', 'ismap', 'onabort', 'onerror', 'onload', 'sizes', 'src', 'srcset', 'usemap', 'width'], '<input />': ['accept', 'alt', 'autocomplete', 'autofocus', 'checked', 'dirname', 'disabled', 'form', 'formaction', 'height', 'list', 'max', 'maxlength', 'min', 'multiple', 'name', 'onload', 'onsearch', 'pattern', 'placeholder', 'readonly', 'required', 'size', 'src', 'step', 'type', 'value', 'width'], '<link />': ['href', 'hreflang', 'media', 'onload', 'rel', 'sizes', 'type'], '<meta />': ['charset', 'http-equiv', 'name'], '<param />': ['name', 'value'], '<source />': ['media', 'sizes', 'src', 'srcset', 'type'], '<track />': ['default', 'kind', 'label', 'oncuechange', 'src', 'srclang'], '<wbr />': []} global_attributes = ['accesskey', 'class', 'contenteditable', 'data-*', 'dir', 'draggable', 'hidden', 'id', 'lang', 'onblur', 'onchange', 'onclick', 'oncontextmenu', 'oncopy', 'oncut', 'ondblclick', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onfocus', 'oninput', 'oninvalid', 'onkeydown', 'onkeypress', 'onkeyup', 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onpaste', 'onscroll', 'onselect', 'onwheel', 'spellcheck', 'style', 'tabindex', 'title', 'translate'] self_closing_tags = ['<area />', '<base />', '<br />', '<col />', '<embed />', '<hr />', '<img />', '<input />', '<link />', '<meta />', '<param />', '<source />', '<track />', '<wbr />'] self_closer = [['<area />', '<area>'], ['<base />', '<base>'], ['<br />', '<br>'], ['<col />', '<col>'], ['<embed />', '<embed>'], ['<hr />', '<hr>'], ['<img />', '<img>'], ['<input />', '<input>'], ['<link />', '<link>'], ['<meta />', '<meta>'], ['<param />', '<param>'], ['<source />', '<source>'], ['<track />', '<track>'], ['<wbr />', '<wbr>']] css_properties = ['align-content', 'align-items', 'align-self', 'animation', 'animation-delay', 'animation-direction', 'animation-duration', 'animation-fill-mode', 'animation-iteration-count', 'animation-name', '@keyframes', 'animation-play-state', 'animation-timing-function', 'backface-visibility', 'background', 'background-attachment', 'background-clip', 'background-color', 'background-image', 'background-origin', 'background-position', 'background-repeat', 'background-size', 'border', 'border-bottom', 'border-bottom-color', 'border-bottom-left-radius', 'border-bottom-right-radius', 'border-bottom-style', 'border-bottom-width', 'border-collapse', 'border-color', 'border-image', 'border-image-outset', 'border-image-repeat', 'border-image-slice', 'border-image-source', 'border-image-width', 'border-left', 'border-left-color', 'border-left-style', 'border-left-width', 'border-radius', 'border-right', 'border-right-color', 'border-right-style', 'border-right-width', 'border-spacing', 'border-style', 'border-top', 'border-top-color', 'border-top-left-radius', 'border-top-right-radius', 'border-top-style', 'border-top-width', 'border-width', 'bottom', 'box-shadow', 'box-sizing', 'caption-side', 'clear', 'clip', 'color', 'column-count', 'column-fill', 'column-gap', 'column-rule', 'column-rule-color', 'column-rule-style', 'column-rule-width', 'column-span', 'column-width', 'columns', 'column-width', 'column-count', 'content', 'counter-increment', 'counter-reset', 'cursor', 'direction', 'display', 'empty-cells', 'flex', 'flex-basis', 'flex-direction', 'flex-flow', 'flex-direction', 'flex-wrap', 'flex-grow', 'flex-shrink', 'flex-wrap', 'float', 'font', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'height', 'justify-content', 'left', 'letter-spacing', 'line-height', 'list-style', 'list-style-image', 'list-style-position', 'list-style-type', 'margin', 'margin-bottom', 'margin-left', 'margin-right', 'margin-top', 'max-height', 'max-width', 'min-height', 'min-width', 'opacity', 'order', 'outline', 'outline-color', 'outline-offset', 'outline-style', 'outline-width', 'overflow', 'overflow-x', 'overflow-y', 'padding', 'padding-bottom', 'padding-left', 'padding-right', 'padding-top', 'page-break-after', 'page-break-before', 'page-break-inside', 'perspective', 'perspective-origin', 'position', 'quotes', 'resize', 'right', 'tab-size', 'table-layout', 'text-align', 'text-align-last', 'text-align', 'justify', 'text-decoration', 'text-decoration-color', 'text-decoration-line', 'text-decoration-line', 'text-decoration-style', 'text-decoration-line', 'text-indent', 'text-justify', 'text-align', 'justify', 'text-overflow', 'text-shadow', 'text-transform', 'top', 'transform', 'transform-origin', 'transform-style', 'transition', 'transition-delay', 'transition-duration', 'transition-property', 'transition-timing-function', 'vertical-align', 'visibility', 'white-space', 'width', 'word-break', 'word-spacing', 'word-wrap', 'z-index', 'animation', 'animation-delay', 'animation-direction', 'animation-duration', 'animation-fill-mode', 'animation-iteration-count', 'animation-name', '@keyframes', 'animation-play-state', 'animation-timing-function', 'background', 'background-attachment', 'background-clip', 'background-color', 'background-image', 'background-origin', 'background-position', 'background-repeat', 'background-size', 'border', 'border-bottom', 'border-bottom-color', 'border-bottom-left-radius', 'border-bottom-right-radius', 'border-bottom-style', 'border-bottom-width', 'border-color', 'border-image', 'border-image-outset', 'border-image-repeat', 'border-image-slice', 'border-image-source', 'border-image-width', 'border-left', 'border-left-color', 'border-left-style', 'border-left-width', 'border-radius', 'border-right', 'border-right-color', 'border-right-style', 'border-right-width', 'border-style', 'border-top', 'border-top-color', 'border-top-left-radius', 'border-top-right-radius', 'border-top-style', 'border-top-width', 'border-width', 'color', 'opacity', 'height', 'max-height', 'max-width', 'min-height', 'min-width', 'width', 'content', 'quotes', 'counter-reset', 'counter-increment', 'align-content', 'align-items', 'align-self', 'flex', 'flex-basis', 'flex-direction', 'flex-flow', 'flex-direction', 'flex-wrap', 'flex-grow', 'flex-shrink', 'flex-wrap', 'justify-content', 'order', 'font', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'list-style', 'list-style-image', 'list-style-position', 'list-style-type', 'margin', 'margin-bottom', 'margin-left', 'margin-right', 'margin-top', 'column-count', 'column-fill', 'column-gap', 'column-rule', 'column-rule-color', 'column-rule-style', 'column-rule-width', 'column-span', 'column-width', 'columns', 'column-width', 'column-count', 'outline', 'outline-color', 'outline-offset', 'outline-style', 'outline-width', 'padding', 'padding-bottom', 'padding-left', 'padding-right', 'padding-top', 'page-break-after', 'page-break-before', 'page-break-inside', 'border-collapse', 'border-spacing', 'caption-side', 'empty-cells', 'table-layout', 'direction', 'tab-size', 'text-align', 'text-align-last', 'text-align', 'justify', 'text-decoration', 'text-decoration-color', 'text-decoration-line', 'text-decoration-line', 'text-decoration-style', 'text-decoration-line', 'text-indent', 'text-justify', 'text-align', 'justify', 'text-overflow', 'text-shadow', 'text-transform', 'line-height', 'vertical-align', 'letter-spacing', 'word-spacing', 'white-space', 'word-break', 'word-wrap', 'backface-visibility', 'perspective', 'perspective-origin', 'transform', 'transform-origin', 'transform-style', 'transition', 'transition-delay', 'transition-duration', 'transition-property', 'transition-timing-function', 'display', 'position', 'top', 'right', 'bottom', 'left', 'float', 'clear', 'z-index', 'overflow', 'overflow-x', 'overflow-y', 'resize', 'clip', 'visibility', 'cursor', 'box-shadow', 'box-sizing']
class cacheFilesManager: configFile = False cacheRootPath = '' cacheFileExtension = '.dat' resourcesRootPath = '' def createCacheFiles (self, fileInfo): raise NotImplementedError def deleteCacheFiles (self, fileInfo): raise NotImplementedError def getCacheFile (self, fileUID, chunkNumber): raise NotImplementedError def setChunkContent (self, fileUID, chunkNumber, content): raise NotImplementedError def restoreFileFromCache (self, fileInfo): raise NotImplementedError def copyFileIntoChunks (self, cachedFileInfo): raise NotImplementedError def writeChunkContent (self, content, fileName): raise NotImplementedError
# Python - 3.4.3 def circleArea(r): return (type(r) in [int, float]) and (r > 0) and round(r * r * 3.141592653589793, 2)
response = 'yes','no' print(response) ('yes', 'no') if input('control!') == response: print('DESIST!')
# Description: Unpack into I(+) and I(-) for a specified Miller array. # Source: NA """ Iobs = miller_arrays[${1:0}] i_plus, i_minus = Iobs.hemispheres_acentrics() ipd = i_plus.data() ip=list(ipd) imd = i_minus.data() im = list(imd) len(im) Iobs.show_summary() print(Iobs.info()) print(Iobs.observation_type()) """ Iobs = miller_arrays[0] i_plus, i_minus = Iobs.hemispheres_acentrics() ipd = i_plus.data() ip=list(ipd) imd = i_minus.data() im = list(imd) len(im) Iobs.show_summary() print(Iobs.info()) print(Iobs.observation_type())
def main(): char = ['zero','one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten'] num = list(input()) sum =0 for i in range(0,len(num)): sum=sum+int(num[i]) sum = str(sum) for i in range(0,len(sum)): print(char[int(sum[i])],end='') if i!= len(sum)-1: print(' ',end='') main()
# -*- coding: utf-8 -*- nome = input() salario = input() vendas = input() salario, vendas = float(salario), float(vendas) print("TOTAL = R$ %.2f" % float(salario + (vendas*0.15)))
#coding=utf-8 def evaluate(): print('eval') return 1 maxEvalScore = 0 a1, a2, a3, a, b = 1.0, 1.0, 1.0, 1.0, 1.0 for index, var in enumerate([a1, a2, a3, a, b]): for k in range(10, 0, -1): # m = var var = k / 10 m = [a1, a2, a3, a, b][index] [a1, a2, a3, a, b][index] = k / 10 print([a1, a2, a3, a, b]) evalScore = evaluate() if maxEvalScore < evalScore: maxEvalScore = evalScore [a1, a2, a3, a, b][index] = m initval = 1.0 # a[5] = [initval for i in range(5)] a = [1.0, 1.0, 1.0, 1.0, 1.0] for index in range(5): for k in range(10, 0, -1): var = k/10 m = a[index] a[index] = k / 10 print(a) evalScore = evaluate() if maxEvalScore < evalScore: maxEvalScore = evalScore a[index] = m
playerage = 9 if playerage>10: print("You are too old to play this game") if playerage<8: print("You are too young to play this game")
""" The MIT License (MIT) Copyright (c) 2017 Johan Kanflo (github.com/kanflo) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ _SOF = 0x7e _DLE = 0x7d _XOR = 0x20 _EOF = 0x7f # Errors returned by uframe_unescape(...) E_LEN = 1 # Received frame is too short to be a uframe E_FRM = 2 # Received data has no framing E_CRC = 3 # CRC mismatch def crc16_ccitt(crc, data): """ https://stackoverflow.com/a/30357446 """ msb = crc >> 8 lsb = crc & 255 x = data ^ msb x ^= (x >> 4) msb = (lsb ^ (x >> 3) ^ (x << 4)) & 255 lsb = (x ^ (x << 5)) & 255 return (msb << 8) + lsb class uFrame(object): """ Describes a class for simple serial protocols """ _valid = False _crc = 0 _frame = None _unpack_pos = 0 def __init__(self): self._frame = bytearray() self._frame.append(_SOF) self._crc = 0 def pack8(self, byte, update_crc=True): """ Pack a byte into the frame, update CRC """ byte &= 0xff if update_crc: self._crc = crc16_ccitt(self._crc, byte) if byte in [_SOF, _DLE, _EOF]: self._frame.append(_DLE) self._frame.append(byte ^ _XOR) else: self._frame.append(byte) def pack_cstr(self, str): for ch in str: self.pack8(ord(ch)) self.pack8(0) def pack16(self, halfword): halfword &= 0xffff h1 = (halfword >> 8) & 0xff h2 = halfword & 0xff self.pack8(h1) self.pack8(h2) def pack32(self, word): word &= 0xffffffff self.pack8((word >> 24) & 0xff) self.pack8((word >> 16) & 0xff) self.pack8((word >> 8) & 0xff) self.pack8((word >> 0) & 0xff) def end(self): """ End packing """ crc1 = (self._crc >> 8) & 0xff crc2 = self._crc & 0xff self.pack8(crc1, False) self.pack8(crc2, False) self._frame.append(_EOF) self._valid = True def get_frame(self): """ Return frame binary data """ return self._frame def set_frame(self, escaped_frame): """ Set frame to given (escaped) frame, unescape, check crc and extract payload Return -E_* if error or 0 if frame is valid. """ self._frame = escaped_frame res = self._unescape() if res == 0: res = self._calc_crc() return res def frame_str(self): """ Return a string describing the data in the frame """ return ' '.join(format(x, '02x') for x in self._frame) def _unescape(self): """ Unescape frame data (internal function) """ length = len(self._frame) if length < 4: return -E_LEN if self._frame[0] != _SOF or self._frame[length - 1] != _EOF: return -E_FRM f = bytearray() seen_dle = False for b in self._frame: if b == _DLE: seen_dle = True elif seen_dle: f.append(b ^ _XOR) seen_dle = False else: f.append(b) self._frame = f[1:-1] return 0 def _calc_crc(self): """ Check crc of frame data and chop crc off payload if valid (internal function) """ self._crc = 0 for b in self._frame[:-2]: self._crc = crc16_ccitt(self._crc, b) self._crc &= 0xffff crc = (self._frame[-2] << 8) | self._frame[-1] self._valid = crc == self._crc if not self._valid: return -E_CRC else: self._frame = self._frame[:-2] # Chop of crc return 0 def unpack8(self): b = self._frame[self._unpack_pos] self._unpack_pos += 1 return b def unpacks8(self): """ Unpack signed 8 bit """ b = self._frame[self._unpack_pos] self._unpack_pos += 1 if b == 0: return 0 return b - 256 def unpack16(self): h = self.unpack8() << 8 | self.unpack8() return h def unpack32(self): h = self.unpack8() << 24 | self.unpack8() << 16 | self.unpack8() << 8 | self.unpack8() return h def unpack_cstr(self): string = "" if self._unpack_pos < len(self._frame): b = self._frame[self._unpack_pos] self._unpack_pos += 1 while self._unpack_pos < len(self._frame) and b != 0: string += '{:c}'.format(b) b = self._frame[self._unpack_pos] self._unpack_pos += 1 return string def eof(self): return self._unpack_pos >= len(self._frame)
class Token: def __init__(self, token_type, text_position, byte_position, value=None): self.type = token_type self.text_position = text_position self.byte_position = byte_position self.value = value
""" Crie um programa que tenha uma tupla totalmente preenchida com uma contagem por extenso, de zero até vinte. Seu programa deverá ler um número pelo teclado (entre 0 e 20) e mostrá-lo por extenso.""" #Tuplas por extensão de 0 a 20 extenso = ('Zero', 'Um', 'Dois', 'Três', 'Quatro', 'Cinco', 'Seis', 'Sete', 'Oito', 'Nove', 'Dez', 'Onze', 'Doze', 'Treze', 'Quatorze', 'Quinze', 'Dezesseis', 'Dezessete', 'Dezoito', 'Dezenove', 'Vincy') #Ler numero de 0 a 20 while True: res = ' ' n = int(input('Digite de 0 a 20:')) while n < 0 or n > 20: n = int(input('Digite novamente:')) #Mostrar por extenso print(f'O número digitado foi: {extenso[n]}') while res not in 'SN': res = str(input('Deseja continuar:[S/N]')).strip().upper() if res == 'N': break print('Até a próxima!') #Outro jeito de fazer #while True: # n = int(input('Digite um número entre 0 e 20: ')) # if 0 <= n <= 20: # break # print('Tente novamente', end='')
""" You are given an array arr having n integers. You have to find the maximum sum of contiguous subarray among all the possible subarrays. This problem is commonly called as Maximum Subarray Problem. Solve this problem in O(n logn) time, using Divide and Conquer approach. """ def maxCrossingSum(arr, start, mid, stop): # O(n) max_left = arr[mid] max_right = arr[mid + 1] left_idx = mid - 1 right_idx = mid + 2 left_sum = max_left right_sum = max_right while left_idx >= start: left_sum += arr[left_idx] if left_sum > max_left: max_left = left_sum left_idx -= 1 while right_idx <= stop: right_sum += arr[right_idx] if right_sum > max_right: max_right = right_sum right_idx += 1 return max_left + max_right def maxSubArrayRecurs(arr, start, stop): # T(n) if start == stop: return arr[start] mid_idx = (start + stop) // 2 l = maxSubArrayRecurs(arr, start, mid_idx) # T(n/2) r = maxSubArrayRecurs(arr, mid_idx + 1, stop) # T(n/2) c = maxCrossingSum(arr, start, mid_idx, stop) return max(l, r, c) def maxSubArray(arr): """ param: An array `arr` return: The maximum sum of the contiguous subarray. No need to return the subarray itself. T(n) = 2 * T(n/2) + O(n) = O(n log(n)) """ return maxSubArrayRecurs(arr, 0, len(arr) - 1) # Test your code arr = [-2, 7, -6, 3, 1, -4, 5, 7] print("Maximum Sum = ", maxSubArray(arr)) # Outputs 13 # Test your code arr = [-2, 1, -3, 4, -1, 2, 1, -5, 4] print("Maximum Sum = ", maxSubArray(arr)) # Outputs 6 # Test your code arr = [-4, 14, -6, 7] print("Maximum Sum = ", maxSubArray(arr)) # Outputs 15 # Test your code arr = [-2, 1, -3, 5, 0, 3, 2, -5, 4] print("Maximum Sum = ", maxSubArray(arr)) # Outputs 10 # Test your code arr = [-2, -5, 6, -2, -3, 1, 5, -6] print("Maximum Sum = ", maxSubArray(arr)) # Outputs 7
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __all__ = ["api_url"] api_url = lambda e: "https://api.foursquare.com/v2/{0}".format(e)
p_types = { "AD": "North West", "AC": "North East", "BD": "South West", "BC": "South East" } p_type_descr = { "AD": "\nAssertive, Decisive, Flexible, Creative, Adventurous.", "AC": "\nAssertive, Decisive, Structured, Detailed, Organized.", "BD": "\nFriendly, Caring, Flexible, Creative, Adventurous.", "BC": "\nFriendly, Caring, Structured, Detailed, Organized." }
#!/usr/bin/env python3 # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 def _better_aspect(row1,row2,aspect): if aspect[0] == '>': return float(row1[aspect[1:]]) >= float(row2[aspect[1:]]) else: return float(row1[aspect[1:]]) <= float(row2[aspect[1:]]) def paretoOptimize(data,aspects): """ Calculate the pareto frontier from data @param data: The data to process as a list of dicts. All elements of the list need to have the columns refered to by the aspects. @aspects: A list of strings that denote a sign (> or < for maximize or minimize) immediately followed by the dict key that this optimization should be applied for @return: A list of dicts containing only those list entries from data that lie on the pareto frontier @rtype: list(dict()) """ if (len(aspects) < 2): print("Need at least two fields to build paretofront!"); sys.exit(-1) if any([x[0] not in ['>','<'] for x in aspects]): print("Aspects must indicate minimization (<) or maximization (>) before name") sys.exit(-2) better = lambda row1,row2 : all([_better_aspect(row1,row2,aspect) for aspect in aspects]) pareto = list() for r in data: for d in data: if d != r and better(d,r): break else: pareto.append(r) return pareto
def waitToTomorrow(): """Wait to tommorow 00:00 am""" tomorrow = datetime.datetime.replace(datetime.datetime.now() + datetime.timedelta(days=1), hour=0, minute=0, second=0) delta = tomorrow - datetime.datetime.now() time.sleep(delta.seconds)
class Solution: def findTargetSumWays(self, nums: List[int], target: int) -> int: """ 1 2 3 2 [1,1,1,1,1] 2 2 2 2 -1 + 1 + 1 + 1 + 1 = 3 +1 - 1 + 1 + 1 + 1 = 3 +1 + 1 - 1 + 1 + 1 = 3 +1 + 1 + 1 - 1 + 1 = 3 +1 + 1 + 1 - 1 + 1 = 3 +1 + 1 + 1 - 1 - 1 = 2 +1 + 1 + 1 + 1 - 1 = 3 +1 + 1 + 1 + 1 + 1 = 4 @lru_cache(maxsize=None) sum_ways(i, target-nums[i]) sum_ways(i, target+nums[i]) sum_ways(i+1, target-nums[i+1]) sum_ways(i+1, target+nums[i+1]) sum_ways(n-1, target-nums[n-1]) sum_ways(n-1, target+nums[n-1]) O(N^2) [1,1,1] -> 3 sum_ways(-1, 3) sum_ways(0, 2) sum_ways(1, 1) sum_ways(2, 0) sum_ways(3, -1) sum_ways(3, 1) sum_ways(2, 2) sum_ways(1, 3) sum_ways(0, 4) """ @lru_cache(maxsize=None) def sum_ways(i, target): if i >= len(nums): return target == 0 return sum_ways(i+1, target-nums[i]) + sum_ways(i+1, target+nums[i]) if not nums: return 0 return sum_ways(0, target)
#!/usr/bin/env python # encoding: utf-8 """ sqrt.py Created by Shengwei on 2014-07-15. """ # https://oj.leetcode.com/problems/sqrtx/ # tags: easy / medium, numbers, search """ Implement int sqrt(int x). Compute and return the square root of x. """ class Solution: # @param x, an integer # @return an integer def sqrt(self, x): if x < 0: raise ValueError('x must be a positive value.') if x == 0: return 0 m = x / 2.0 # note: using `while abs(m * m - x) > 0.0001` is # not good enough for very small and very large # numbers, say 1e-10 and 1e50 while abs(m * m - x) / x > 0.0001: m = (m + x / m) / 2 return int(m)
# Complex prepositions of three words etc. в зависимости от PREP_POSTAGS = ('ADP',) def get_children(word_num, syntax_dep_tree): return [child_number for child_number, child_syntax in enumerate(syntax_dep_tree) if child_syntax.parent == word_num] class IsComplexPreposition: COMPLEX_PREPS = [ ('в', 'течение', {'Acc'}), ('в', 'продолжение', {'Acc'}), ('в', 'заключение', {'Acc'}), ('в', 'отсутствие', {'Acc'}), ('в', 'отличие', {'Acc'}), ('в', 'преддверие', {'Loc'}), ('в', 'избежание', {'Acc'}), ('в', 'цель', {'Loc'}), ('в', 'ход', {'Loc'}), ('в', 'качество', {'Loc'}), ('в', 'период', {}), ('в', 'случай', {'Loc'}), ('в', 'отношение', {'Loc'}), ('в', 'направление', {'Loc'}), ('в', 'процесс', {'Loc'}), ('в', 'результат', {'Loc', 'Abl'}), ('в', 'интерес', {'Loc'}), ('в', 'сила', {'Acc'}), ('в', 'сторона', {}), ('в', 'условие', {}), ('во', 'имя', {}), ('во', 'время', {}), ('по', 'повод', {'Loc'}), ('вместе', 'c', {}), ('неподалеку', 'от', {}), ('совместно', 'с', {}), ('за', 'счет', {}), ('под', 'предлог', {'Ins'}), ('под', 'действие', {'Ins'}), ('под', 'влияние', {'Ins'}), ('по', 'отношение', {'Dat'}), ('по', 'мера', {'Loc'}), ('по', 'причина', {'Dat'}), ('при', 'условие', {'Loc'}), ('при', 'помощь', {'Abl', 'Loc'}), ('независимо', 'от', {}), ('несмотря', 'на', {}), ('смотря', 'по', {}), ('исходя', 'из', {}), ('судя', 'по', {}), ('на', 'основа', {'Loc'}), ('на', 'протяжение', {}), ('с', 'помощь', {'Ins'}), ('с', 'цель', {}), ('со', 'сторона', {'Gen'}), ('недалеко', 'от', {}), ('справа', 'от', {}), ('слева', 'от', {}), ('на', 'основание', {}), ('рядом', 'с', {}), ('в', 'честь', {}) ] COMPLEX_PREPS_START = set(e[0] for e in COMPLEX_PREPS) COMPLEX_PREPS_MIDDLE = {e[1] : e[2] for e in COMPLEX_PREPS} @classmethod def __call__(cls, head_number, morph, lemma, syntax_dep_tree): head_lemma = lemma[head_number] if head_lemma not in cls.COMPLEX_PREPS_START: return False next_number = head_number + 1 if next_number >= len(lemma): return False next_lemma = lemma[next_number] prep_case = cls.COMPLEX_PREPS_MIDDLE.get(next_lemma, None) if prep_case is None: return False next_morph = morph[next_number] if prep_case: if next_morph.get('Case', None) not in prep_case: return False return (head_number, next_number) is_complex_preposition = IsComplexPreposition.__call__ def in_complex_preposition(word_num, postag, morph, lemma, syntax_dep_tree): word_postag = postag[word_num] if word_postag in PREP_POSTAGS: return is_complex_preposition(word_num, morph, lemma, syntax_dep_tree) elif word_num > 0: return is_complex_preposition(word_num - 1, morph, lemma, syntax_dep_tree) else: return False def extract_preposition(arg_number, postags, morph, lemmas, syntax_dep_tree): """ Returns preposition for a word in the sentence """ #TODO: fix duplication #TODO: there was a list of words for complex preposition, as we use the whole preposition as a feature children = get_children(arg_number, syntax_dep_tree) for child_number in children: lemma_child, postag_child = lemmas[child_number], postags[child_number] if postag_child in PREP_POSTAGS: complex_prep = in_complex_preposition(child_number, postags, morph, lemmas, syntax_dep_tree) if complex_prep: return complex_prep else: return child_number siblings = get_children(syntax_dep_tree[arg_number].parent, syntax_dep_tree) for child_number in siblings: lemma_child, postag_child = lemmas[child_number], postags[child_number] if postag_child in PREP_POSTAGS: complex_prep = is_complex_preposition(child_number, morph, lemmas, syntax_dep_tree) if complex_prep: return complex_prep else: return child_number return None def complex_preposition_child(complex_prep, syntax_dep_tree): """ Returns sibling of complex preposition """ children = (e for e in get_children(complex_prep[1], syntax_dep_tree) if (e not in complex_prep)) try: return next(children) except: return None
class ExtrusionObject(RhinoObject): # no doc def DuplicateExtrusionGeometry(self): """ DuplicateExtrusionGeometry(self: ExtrusionObject) -> Extrusion """ pass ExtrusionGeometry = property( lambda self: object(), lambda self, v: None, lambda self: None ) """Get: ExtrusionGeometry(self: ExtrusionObject) -> Extrusion """
""" Given the root of a binary tree, return the postorder traversal of its nodes' values. Example 1: Input: root = [1,null,2,3] Output: [3,2,1] Example 2: Input: root = [] Output: [] Example 3: Input: root = [1] Output: [1] Constraints: The number of the nodes in the tree is in the range [0, 100]. -100 <= Node.val <= 100 """ # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def postorderTraversal(self, root: Optional[TreeNode]) -> List[int]: ans = [] self.traverse(root, ans) return ans def traverse(self, node, ans): if node is not None: self.traverse(node.left, ans) self.traverse(node.right, ans) ans.append(node.val)
""" The more input features the more parameter saving 4: 28 less params 64: 448 less params """;
class GeorgeStrategyLevel3: def __init__(self, player_num): self.player_index = player_num self.name = 'delayed_flank' self.delayed_count = 0 self.flank_count = 0 self.flank_turn = None self.flank_started = False self.turn_count = 1 self.movement = 1 self.flank_route_index = 0 self.behind_direction = {(3,0): (-1,0), (3,6): (1,0)} self.flank_route = {(3,0): [(0,1), (0,1), (0,1), (0,1), (0,1), (0,1), (1,0), (0,0)], (3,6): [(0,-1), (0,-1), (0,-1), (0,-1), (0,-1), (0,-1), (-1,0), (0,0)]} def decide_purchases(self, game_state): myself = game_state['players'][self.player_index] home_coords= game_state['players'][self.player_index]['home_coords'] units = myself['units'] scouts = [unit for unit in units if unit['type'] == 'Scout'] num_units = len(scouts) attack_level = myself['technology']['attack'] game_turn = game_state['turn'] purchases = {'units': [], 'technology': []} if myself['cp'] >= game_state['technology_data']['attack'][attack_level]: purchases['technology'].append('attack') myself['cp'] -= game_state['technology_data']['attack'][attack_level] while myself['cp'] >= 6: purchases['units'].append({'type': 'Scout', 'coords': home_coords}) myself['cp'] -= 6 return purchases def decide_ship_movement(self, unit_index, hidden_game_state): myself = hidden_game_state['players'][self.player_index] home_coords= tuple(hidden_game_state['players'][self.player_index]['home_coords']) units = myself['units'] scouts = [unit for unit in units if unit['type'] == 'Scout' and tuple(unit['coords']) != home_coords] num_units = len(scouts) game_turn = hidden_game_state['turn'] game_round = hidden_game_state['round'] if game_turn != self.turn_count or self.movement != game_round: if self.flank_started and self.flank_route_index < 7: self.flank_route_index +=1 self.turn_count = game_turn self.movement = game_round self.delayed_count = 0 if self.flank_started and num_units == 0: self.flank_route_index = 0 self.flank_started= False self.flank_count = 0 opponent_index = 1 - self.player_index opponent = hidden_game_state['players'][opponent_index] unit = myself['units'][unit_index] #turn_created = unit['turn_created'] x_unit, y_unit = unit['coords'] x_opp, y_opp = opponent['home_coords'] # print(unit['type'], unit['coords'], home_coords, self.flank_count, len(scouts)) if unit['type'] == 'Scout' and self.delayed_count < 6 and tuple(unit['coords']) == home_coords: self.delayed_count += 1 return (0,0) elif self.delayed_count >= 6 or self.flank_started: if tuple(unit['coords']) == home_coords: if self.flank_started: return (0,0) self.flank_count += 1 return self.behind_direction[home_coords] if self.flank_count >= 6: self.flank_turn = game_turn self.flank_started = True return self.flank_route[home_coords][self.flank_route_index] else: return (0,0) else: return (0,0) def decide_which_unit_to_attack(self, hidden_game_state_for_combat, combat_state, coords, attacker_index): # attack opponent's first ship in combat order combat_order = combat_state[coords] player_indices = [unit['player'] for unit in combat_order] opponent_index = 1 - self.player_index for combat_index, unit in enumerate(combat_order): if unit['player'] == opponent_index: return combat_index
mapping = { "settings": { "index": { "max_result_window": 15000, "number_of_replicas": 1, "number_of_shards": 1, "max_ngram_diff": 10 }, "analysis": { "analyzer": { "default": { "type": "custom", "tokenizer": "whitespace", "filter": [ "english_stemmer", "lowercase" ] }, "autocomplete": { "tokenizer": "autocomplete_index", "filter": [ "lowercase" ] }, "autocomplete_search": { "tokenizer": "autosuggest_search", "filter": [ "lowercase" ] }, "partial_search": { "tokenizer": "regular_partial_search", "filter": ["lowercase"] }, "symbols": { "type": "custom", "tokenizer": "whitespace", "filter": [ "lowercase" ] } }, "filter": { "english_stemmer": { "type": "stemmer", "language": "english" } }, "tokenizer": { "autocomplete_index": { "type": "edge_ngram", "min_gram": "2", "max_gram": "5" }, "autosuggest_search": { "type": "edge_ngram", "min_gram": "2", "max_gram": "5" }, "regular_partial_search": { "type": "ngram", "min_gram": "2", "max_gram": "5", "token_chars": [ "letter", "digit" ] } }, "char_filter": { "replace_underscore": { "type": "pattern_replace", "pattern": "(_)", "replacement": " " } } } }, "mappings": { "properties": { "sgdid": { "type": "text", "fielddata": True, "analyzer": "symbols" }, "name": { "type": "text", "fielddata": True, "analyzer": "symbols" }, "href": { "type": "text", "fielddata": True, "analyzer": "symbols" }, "category": { "type": "text", "fielddata": True, "analyzer": "symbols" }, "absolute_genetic_start": { "type": "keyword" }, "format_name": { "type": "text", "fielddata": True, "analyzer": "symbols" }, "dna_scores": { "type": "keyword" }, "protein_scores": { "type": "keyword" }, "snp_seqs": { "type": "nested" } } } }
""" Make a list of the numbers from one to one million, and then use a for loop to print the numbers """ million = list(range(1000001)) for number in million: print(number)
# Inplace operator tests # This originally from byterun was adapted from test_base.py """This program is self-checking!""" x, y = 2, 3 x **= y assert x == 8 and y == 3 x *= y assert x == 24 and y == 3 x //= y assert x == 8 and y == 3 x %= y assert x == 2 and y == 3 x += y assert x == 5 and y == 3 x -= y assert x == 2 and y == 3 x <<= y assert x == 16 and y == 3 x >>= y assert x == 2 and y == 3 x = 0x8F x &= 0xA5 assert x == 0x85 x |= 0x10 assert x == 0x95 x ^= 0x33 assert x == 0xA6
''' You are given coins of different denominations and a total amount of money. Write a function to compute the number of combinations that make up that amount. You may assume that you have infinite number of each kind of coin. Example 1: Input: amount = 5, coins = [1, 2, 5] Output: 4 Explanation: there are four ways to make up the amount: 5=5 5=2+2+1 5=2+1+1+1 5=1+1+1+1+1 Example 2: Input: amount = 3, coins = [2] Output: 0 Explanation: the amount of 3 cannot be made up just with coins of 2. Example 3: Input: amount = 10, coins = [10] Output: 1 Note: You can assume that 0 <= amount <= 5000 1 <= coin <= 5000 the number of coins is less than 500 the answer is guaranteed to fit into signed 32-bit integer ''' # def change(amount, coins): # if amount == 0: return 1 # if len(coins) == 0: return 0 # result = change(amount, coins[:-1]) # if amount-coins[-1] >= 0: # result += change(amount-coins[-1], coins) # return result # class Solution: # def change(self, amount: int, coins) -> int: # return change(amount, coins) # 回傳用 coins 裡面提供的硬幣面額可有多少種不同的方法可以湊出 amount # def change(amount, coins, cache): # # amount : 5 # # coins : [1, 2, 5] # # change(5, [1]) == 1 # # 不用新來的2 # 用新來的2 # # change(5, [1, 2]) == change(5, [1]) + change(5-2, [1, 2]) # # change(5, [1, 2, 5]) == change(5, [1]) + change(5-2, [1, 2]) + change(5-5, [1, 2, 5]) # # change(5, [1, 2, 5]) == change(5, [1,2]) + change(5-5, [1, 2, 5]) # # change(amount, coins) == change(amount, coins[:-1]) + change(amount-coins[-1], coins) # if amount == 0: return 1 # if len(coins) == 0: return 0 # # 遞迴中會有重複運算 降低效率 # # 把曾經有算過的答案回傳 增加效率 # # return 之前算的答案 # key = amount, tuple(coins) # 也可以寫 key = amount, *coins # if key in cache: # return cache[key] # result = change(amount, coins[:-1], cache) # if amount-coins[-1] >= 0: # result += change(amount-coins[-1], coins, cache) # # 把這次的答案記起來 # cache[key] = result # return result # 回傳用 coins 裡面前 length 種硬幣面額有多少種不同的方法可以湊出 amount # def change(amount, length, coins, cache): # if amount == 0: return 1 # if length == 0: return 0 # if cache[amount][length] != None: # return cache[amount][length] # result = change(amount, length-1, coins, cache) # if amount-coins[length-1] >= 0: # result += change(amount-coins[length-1], length, coins, cache) # cache[amount][length] = result # return result # class Solution: # def change(self, finalAmount, coins): # return change(finalAmount, coins, {}) # (amount+1)*(length+1) 都是None # cache = [[None]*(len(coins)+1) for i in range(amount+1)] # return change(finalAmount, len(coins), coins, cache) # 由小到大算 不用檢查是否算過了 # cache = [[None]*(len(coins)+1) for i in range(finalAmount+1)] # for amount in range(0, finalAmount+1): # for length in range(0, len(coins)+1): # if amount == 0: # cache[amount][length] = 1 # continue # if length == 0: # cache[amount][length] = 0 # continue # result = cache[amount][length-1] # if amount-coins[length-1] >= 0: # result += cache[amount-coins[length-1]][length] # cache[amount][length] = result # return cache[finalAmount][len(coins)] # 發現不需這麼多維度 # length : # amount : 0, 1, 2, 3, 4 5 # cache : 1 0 0 0 0 0 <- length: 0 # cache : 1 ? 0 <- length: 1 # # ? <- length: 3 # cache = [[0]*(finalAmount+1)] # cache[0] = 1 # for length in range(0, len(coins)+1): # for amount in range(0, finalAmount+1): # if amount == 0: # cache[amount] = 1 # continue # if length == 0: # cache[amount] = 0 # continue # result = cache[amount] # if amount-coins[length-1] >= 0: # result += cache[amount-coins[length-1]] # cache[amount] = result # return cache[finalAmount] class Solution: def change(self, finalAmount: int, coins) -> int: #cache = [0 for i in range(finalAmount+1)] #cache[0] = 1 #for length in range(1, len(coins)+1): #for amount in range(coins[length-1], finalAmount+1): #cache[amount] += cache[amount-coins[length-1]] #return cache[finalAmount] # 優化陣列 cache = [0]*(finalAmount+1) cache[0] = 1 for coin in coins: for amount in range(coin, finalAmount+1): cache[amount] += cache[amount-coin] return cache[finalAmount] if __name__=='__main__': amount = 5 coins = [1, 2, 5] print(Solution().change(amount, coins)) #--------------------------- def change(amount, coins, l): if amount == 0: print(l) return 1 if amount < 0: return 0 if len(coins) == 0: return 0 no = change(amount, coins[:-1], l) # 可以先複製一份 或者新增之後再刪除 #l = l[:] #l.append(coins[-1]) l.append(coins[-1]) yes = change(amount-coins[-1], coins, l) l.pop() return yes + no class Solution: def change(self, amount: int, coins: List[int]) -> int: return change(amount, coins, [])
#!/usr/bin/env python # -*- coding: UTF-8 -*- class UserInfo(object): name = '两点水' class UserInfo(object): def __init__(self, name): self.name = name class UserInfo(object): def __init__(self, name, age, account): self.name = name self._age = age self.__account = account
variable_list = [ {"value": {"value": "var1_new_val"}, "context": "DefaultProfile", "name": "var1"}, {"value": {"value": "var2_new_val"}, "context": "DefaultProfile", "name": "var2"}, ]
class Page: def __init__(self, start: int, end: int, step: int): self.last_start = start self.start = start self.end = end self.step = step def next(self): self.start += self.step if self.start < self.start + self.step > self.end: self.start = self.end - self.step old_start = self.last_start self.last_start = self.start return self.start, old_start def last(self): self.start -= self.step if self.start < self.start + self.step < self.step: self.start = 0 old_start = self.last_start self.last_start = self.start return self.start, old_start
# SPDX-License-Identifier: MIT # This module exists to solve circular dependencies between xbstrap.vcs_util # and xbstrap.base; however, moving all exceptions here casues a new circular # dependency: ExecutionFailureError needs Action.strings, defined in # xbstrap.base, but xbstrap.base needs xbstrap.exceptions (this module). # For this reason, further extraction has been halted, and the minimum (plus # some more) was done to break the circular dependency. # TODO(arsen): further disentangle exceptions from xbstrap.base class GenericError(Exception): pass class RollingIdUnavailableError(Exception): def __init__(self, name): super().__init__("No rolling_id specified for source {}".format(name))
class Node(object): def __init__(self, val): self.val = val self.children = [] def f(root, deletions): if not root: return q = [root] ans = [] if root.val not in deletions: ans.append(root.val) while q: node = q.pop() children = node.children if node.val in deletions: for child in children: if child.val not in deletions: ans.append(child.val) q.extend(children) return ans # a # / / \ \ # b d c f # / \ \ # h z i node_a = Node('a') node_b = Node('b') node_c = Node('c') node_d = Node('d') node_e = Node('e') node_f = Node('f') node_h = Node('h') node_z = Node('z') node_i = Node('i') node_b.children.append(node_h) node_b.children.append(node_z) node_b.children.append(node_i) node_a.children.append(node_b) node_a.children.append(node_d) node_a.children.append(node_c) node_a.children.append(node_f) deletions_list = [['b', 'f'], ['a', 'b'], ['b', 'h']] for deletions in deletions_list: print(f(node_a, deletions))
__docformat__ = 'epytext en' __doc__=''' European river Information System messages @see: NMEA strings at U{http://gpsd.berlios.de/NMEA.txt} @see: Wikipedia at U{http://en.wikipedia.org/wiki/Automatic_Identification_System} @license: Apache 2.0 @copyright: (C) 2006 '''
def min_distance(polygon, point): """ Return the minimum distance between a point and a polygon edge """ dist = polygon.exterior.distance(point) for interior in polygon.interiors: dist = min(dist, interior.distance(point)) return dist
# https://leetcode.com/problems/longest-substring-without-repeating-characters/ # # Given a string, find the length of the longest substring without repeating characters. # For example, the longest substring without repeating letters for "abcabcbb" is "abc", # which the length is 3. For "bbbbb" the longest substring is "b", with the length of 1. class Solution(object): def lengthOfLongestSubstring(self, s): """ :type s: str :rtype: int """ longest = [] max_len = 0 i = 0 j = 0 while j < len(s): if s[j] not in longest: longest.append(s[j]) j = j + 1 else: if max_len < len(longest): max_len = len(longest) idx = longest.index(s[j]) + 1 longest = longest[idx:] longest.append(s[j]) i = i + idx j = j + 1 continue if max_len < len(longest): max_len = len(longest) return max_len
''' Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... Note: n is positive and will fit within the range of a 32-bit signed integer (n < 231). Example 1: Input: 3 Output: 3 Example 2: Input: 11 Output: 0 Explanation: The 11th digit of the sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... is a 0, which is part of the number 10. ''' class Solution(object): def findNthDigit(self, n): """ :type n: int :rtype: int """ ''' len(1): 0-9 = 10 * 1 = 10 len(2): 10-99 = 90 * 2 = 180 len(3): 100-999 = 900 * 3 = 2700 ''' if n < 10: return n n -= 10 w = 2 while n > 9 * 10 ** (w-1) * w: n -= 9 * 10 ** (w-1) * w w += 1 num = 10 ** (w-1) + n // w step = n % w return int(str(num)[step])
# -*- coding: utf-8 -*- { 'name': "Lycée", 'version': '1.0.0', 'depends': ['base'], 'author': "Lucas Ramos Paiva", 'website': "https://github.com/lucrp/lycee/", 'category': 'Inventory', 'description': "Ce module sert à gérer les classes, les étudiants et les professeurs d'un Lycée", 'license': 'LGPL-3', # data files always loaded at installation 'data': [ 'views/res_partner_view.xml', 'views/iut_student_view.xml', 'views/iut_class_view.xml', 'views/iut_schedule_view.xml', 'views/iut_course_view.xml', 'lycee_menu.xml', ], 'auto_install': False, 'installable': True }
def merge_sorted(arr_1, arr_2): merged_array = list() ind_1, ind_2 = 0, 0 while ind_1 < len(arr_1) and ind_2 < len(arr_2): if arr_1[ind_1] <= arr_2[ind_2]: merged_array.append(arr_1[ind_1]) ind_1 += 1 else: merged_array.append(arr_2[ind_2]) ind_2 += 1 while ind_1 < len(arr_1): merged_array.append(arr_1[ind_1]) ind_1 += 1 while ind_2 < len(arr_2): merged_array.append(arr_2[ind_2]) ind_2 += 1 return merged_array def reverse(lst, i, j): return list(reversed(lst[i:j+1])) def custom_sort(lst): # create segments of sorted sub-arrays start, end = None, None last_end = -1 sorted_segments = list() for i in range(1, len(lst)): if lst[i] < lst[i-1]: if not start: segment = lst[last_end+1: i-1] if segment: sorted_segments.append(segment) start = i - 1 elif start: end = i - 1 if end > start: sorted_segments.append(reverse(lst, start, end)) last_end = end start, end = None, None if start: end = len(lst) - 1 if end > start: sorted_segments.append(reverse(lst, start, end)) else: segment = lst[last_end+1:] if segment: sorted_segments.append(segment) # merge the sorted sub-arrays final_sorted = list() for segment in sorted_segments: final_sorted = merge_sorted(final_sorted, segment) return final_sorted # Tests assert custom_sort([0, 6, 4, 2, 5, 3, 1]) == [ 0, 1, 2, 3, 4, 5, 6] assert custom_sort([0, 6, 4, 2, 5, 3, 1, 10, 9]) == [ 0, 1, 2, 3, 4, 5, 6, 9, 10] assert custom_sort([0, 6, 4, 2, 5, 3, 1, 2, 3]) == [ 0, 1, 2, 2, 3, 3, 4, 5, 6] assert custom_sort([0, 6, 4, 2, 5, 3, 1, 11]) == [ 0, 1, 2, 3, 4, 5, 6, 11]
# # PySNMP MIB module APDD-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/APDD-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:23:10 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) # acmepacketMgmt, = mibBuilder.importSymbols("ACMEPACKET-SMI", "acmepacketMgmt") ApTransportType, = mibBuilder.importSymbols("ACMEPACKET-TC", "ApTransportType") OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, SingleValueConstraint, ValueRangeConstraint, ConstraintsIntersection, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsIntersection", "ValueSizeConstraint") ObjectGroup, NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "NotificationGroup", "ModuleCompliance") Counter64, Unsigned32, Bits, NotificationType, iso, IpAddress, TimeTicks, ObjectIdentity, Gauge32, ModuleIdentity, MibIdentifier, Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "Unsigned32", "Bits", "NotificationType", "iso", "IpAddress", "TimeTicks", "ObjectIdentity", "Gauge32", "ModuleIdentity", "MibIdentifier", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter32") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") apDDModule = ModuleIdentity((1, 3, 6, 1, 4, 1, 9148, 3, 12)) if mibBuilder.loadTexts: apDDModule.setLastUpdated('201106080000Z') if mibBuilder.loadTexts: apDDModule.setOrganization('Acme Packet, Inc') if mibBuilder.loadTexts: apDDModule.setContactInfo(' Customer Service Postal: Acme Packet, Inc 100 Crosby Drive Bedford, MA 01730 US Tel: 1-781-328-4400 E-mail: support@acmepacket.com') if mibBuilder.loadTexts: apDDModule.setDescription('The Policy Director MIB for Acme Packet.') apDDMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1)) apDDMIBGeneralObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1)) apDDMIBTabularObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2)) apDDNotificationObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9148, 3, 12, 2)) apDDNotifObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9148, 3, 12, 2, 1)) apDDNotifPrefix = MibIdentifier((1, 3, 6, 1, 4, 1, 9148, 3, 12, 2, 2)) apDDNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 9148, 3, 12, 2, 2, 0)) apDDConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 9148, 3, 12, 3)) apDDObjectGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9148, 3, 12, 3, 1)) apDDNotificationGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9148, 3, 12, 3, 2)) apDdInterfaceNumber = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdInterfaceNumber.setStatus('current') if mibBuilder.loadTexts: apDdInterfaceNumber.setDescription('Number of the DD interfaces in the system.') apDdCurrentTransRate = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 2), Gauge32()).setUnits('per10Seconds').setMaxAccess("readonly") if mibBuilder.loadTexts: apDdCurrentTransRate.setStatus('current') if mibBuilder.loadTexts: apDdCurrentTransRate.setDescription('The number of transactions over a 10s period.') apDdHighTransRate = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 3), Gauge32()).setUnits('per10Seconds').setMaxAccess("readonly") if mibBuilder.loadTexts: apDdHighTransRate.setStatus('current') if mibBuilder.loadTexts: apDdHighTransRate.setDescription('Maximum value of apDdCurrentTransRate across all 10s periods.') apDdLowTransRate = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 4), Gauge32()).setUnits('per10Seconds').setMaxAccess("readonly") if mibBuilder.loadTexts: apDdLowTransRate.setStatus('current') if mibBuilder.loadTexts: apDdLowTransRate.setDescription('Mimimum value of apDdCurrentTransRate across all 10s periods.') apDdAgentNumber = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentNumber.setStatus('current') if mibBuilder.loadTexts: apDdAgentNumber.setDescription('Number of the DD Agents in the system.') apDdSessionPeriodActive = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessionPeriodActive.setStatus('current') if mibBuilder.loadTexts: apDdSessionPeriodActive.setDescription('Number of the DD session is Active in this period') apDdSessionPeriodHigh = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 7), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessionPeriodHigh.setStatus('current') if mibBuilder.loadTexts: apDdSessionPeriodHigh.setDescription('Highest number of the DD session in this period') apDdSessionPeriodTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 8), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessionPeriodTotal.setStatus('current') if mibBuilder.loadTexts: apDdSessionPeriodTotal.setDescription('Total Number of the DD session in this period') apDdSessionLifeTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 9), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessionLifeTotal.setStatus('current') if mibBuilder.loadTexts: apDdSessionLifeTotal.setDescription('Total Number of the DD session in life') apDdSessionLifePerMax = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 10), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessionLifePerMax.setStatus('current') if mibBuilder.loadTexts: apDdSessionLifePerMax.setDescription('PerMax number of the DD session in life') apDdSessionLifeHigh = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 11), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessionLifeHigh.setStatus('current') if mibBuilder.loadTexts: apDdSessionLifeHigh.setDescription('Highest number of the DD session in life') apDdSessInitPeriodActive = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 12), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessInitPeriodActive.setStatus('current') if mibBuilder.loadTexts: apDdSessInitPeriodActive.setDescription('Number of the DD session is Active in Initial state in this period') apDdSessInitPeriodHigh = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 13), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessInitPeriodHigh.setStatus('current') if mibBuilder.loadTexts: apDdSessInitPeriodHigh.setDescription('Highest number of the DD session in Initial state in this period') apDdSessInitPeriodTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 14), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessInitPeriodTotal.setStatus('current') if mibBuilder.loadTexts: apDdSessInitPeriodTotal.setDescription('Total Number of the DD session in Initial state in this period') apDdSessInitLifeTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 15), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessInitLifeTotal.setStatus('current') if mibBuilder.loadTexts: apDdSessInitLifeTotal.setDescription('Total Number of the DD session in Initial state in life') apDdSessInitLifePerMax = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 16), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessInitLifePerMax.setStatus('current') if mibBuilder.loadTexts: apDdSessInitLifePerMax.setDescription('PerMax number of the DD session in Initial state in life') apDdSessInitLifeHigh = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 17), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessInitLifeHigh.setStatus('current') if mibBuilder.loadTexts: apDdSessInitLifeHigh.setDescription('Highest number of the DD session in Initial state in life') apDdSessEstablishedPeriodActive = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 18), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessEstablishedPeriodActive.setStatus('current') if mibBuilder.loadTexts: apDdSessEstablishedPeriodActive.setDescription('Number of the DD session is Active in Established state in this period') apDdSessEstablishedPeriodHigh = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 19), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessEstablishedPeriodHigh.setStatus('current') if mibBuilder.loadTexts: apDdSessEstablishedPeriodHigh.setDescription('Highest number of the DD session in Established state in this period') apDdSessEstablishedPeriodTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 20), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessEstablishedPeriodTotal.setStatus('current') if mibBuilder.loadTexts: apDdSessEstablishedPeriodTotal.setDescription('Total Number of the DD session in Established state in this period') apDdSessEstablishedLifeTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 21), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessEstablishedLifeTotal.setStatus('current') if mibBuilder.loadTexts: apDdSessEstablishedLifeTotal.setDescription('Total Number of the DD session in Established state in life') apDdSessEstablishedLifePerMax = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 22), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessEstablishedLifePerMax.setStatus('current') if mibBuilder.loadTexts: apDdSessEstablishedLifePerMax.setDescription('PerMax number of the DD session in Established state in life') apDdSessEstablishedLifeHigh = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 23), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessEstablishedLifeHigh.setStatus('current') if mibBuilder.loadTexts: apDdSessEstablishedLifeHigh.setDescription('Highest number of the DD session in Established state in life') apDdSessTerminatedPeriodActive = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 24), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessTerminatedPeriodActive.setStatus('current') if mibBuilder.loadTexts: apDdSessTerminatedPeriodActive.setDescription('Number of the DD session is Active in Terminated state in this period') apDdSessTerminatedPeriodHigh = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 25), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessTerminatedPeriodHigh.setStatus('current') if mibBuilder.loadTexts: apDdSessTerminatedPeriodHigh.setDescription('Highest number of the DD session in Terminated state in this period') apDdSessTerminatedPeriodTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 26), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessTerminatedPeriodTotal.setStatus('current') if mibBuilder.loadTexts: apDdSessTerminatedPeriodTotal.setDescription('Total Number of the DD session in Terminated state in this period') apDdSessTerminatedLifeTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 27), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessTerminatedLifeTotal.setStatus('current') if mibBuilder.loadTexts: apDdSessTerminatedLifeTotal.setDescription('Total Number of the DD session in Terminated state in life') apDdSessTerminatedLifePerMax = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 28), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessTerminatedLifePerMax.setStatus('current') if mibBuilder.loadTexts: apDdSessTerminatedLifePerMax.setDescription('PerMax number of the DD session in Terminated state in life') apDdSessTerminatedLifeHigh = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 29), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessTerminatedLifeHigh.setStatus('current') if mibBuilder.loadTexts: apDdSessTerminatedLifeHigh.setDescription('Highest number of the DD session in Terminated state in life') apDdSessTimeoutPeriodTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 30), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessTimeoutPeriodTotal.setStatus('current') if mibBuilder.loadTexts: apDdSessTimeoutPeriodTotal.setDescription('Total Number of the DD session in Timeout state in this period') apDdSessTimeoutLifeTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 31), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessTimeoutLifeTotal.setStatus('current') if mibBuilder.loadTexts: apDdSessTimeoutLifeTotal.setDescription('Total Number of the DD session in Timeout state in life') apDdSessTimeoutLifePerMax = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 32), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessTimeoutLifePerMax.setStatus('current') if mibBuilder.loadTexts: apDdSessTimeoutLifePerMax.setDescription('PerMax number of the DD session in Timeout state in life') apDdSessErrorsPeriodTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 33), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessErrorsPeriodTotal.setStatus('current') if mibBuilder.loadTexts: apDdSessErrorsPeriodTotal.setDescription('Total Number of the DD session in Errors state in this period') apDdSessErrorsLifeTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 34), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessErrorsLifeTotal.setStatus('current') if mibBuilder.loadTexts: apDdSessErrorsLifeTotal.setDescription('Total Number of the DD session in Errors state in life') apDdSessErrorsLifePerMax = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 35), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessErrorsLifePerMax.setStatus('current') if mibBuilder.loadTexts: apDdSessErrorsLifePerMax.setDescription('PerMax number of the DD session in Errors state in life') apDdSessMissPeriodTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 36), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessMissPeriodTotal.setStatus('current') if mibBuilder.loadTexts: apDdSessMissPeriodTotal.setDescription('Total Number of the DD session in Miss state in this period') apDdSessMissLifeTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 37), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessMissLifeTotal.setStatus('current') if mibBuilder.loadTexts: apDdSessMissLifeTotal.setDescription('Total Number of the DD session in Miss state in life') apDdSessMissLifePerMax = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 38), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSessMissLifePerMax.setStatus('current') if mibBuilder.loadTexts: apDdSessMissLifePerMax.setDescription('PerMax number of the DD session in Miss state in life') apDdSubscriberPeriodActive = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 100), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSubscriberPeriodActive.setStatus('current') if mibBuilder.loadTexts: apDdSubscriberPeriodActive.setDescription('Number of the DD subscriber is Active in this period') apDdSubscriberPeriodHigh = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 101), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSubscriberPeriodHigh.setStatus('current') if mibBuilder.loadTexts: apDdSubscriberPeriodHigh.setDescription('Highest number of the DD subscriber in this period') apDdSubscriberPeriodTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 102), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSubscriberPeriodTotal.setStatus('current') if mibBuilder.loadTexts: apDdSubscriberPeriodTotal.setDescription('Total Number of the DD subscriber in this period') apDdSubscriberLifeTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 103), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSubscriberLifeTotal.setStatus('current') if mibBuilder.loadTexts: apDdSubscriberLifeTotal.setDescription('Total Number of the DD subscriber in life') apDdSubscriberLifePerMax = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 104), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSubscriberLifePerMax.setStatus('current') if mibBuilder.loadTexts: apDdSubscriberLifePerMax.setDescription('PerMax number of the DD subscriber in life') apDdSubscriberLifeHigh = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 105), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSubscriberLifeHigh.setStatus('current') if mibBuilder.loadTexts: apDdSubscriberLifeHigh.setDescription('Highest number of the DD subscriber in life') apDdSubscribePeriodActive = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 106), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSubscribePeriodActive.setStatus('current') if mibBuilder.loadTexts: apDdSubscribePeriodActive.setDescription('Number of the DD subscriber is Active in Initial state in this period') apDdSubscribePeriodHigh = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 107), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSubscribePeriodHigh.setStatus('current') if mibBuilder.loadTexts: apDdSubscribePeriodHigh.setDescription('Highest number of the DD subscriber in Initial state in this period') apDdSubscribePeriodTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 108), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSubscribePeriodTotal.setStatus('current') if mibBuilder.loadTexts: apDdSubscribePeriodTotal.setDescription('Total Number of the DD subscriber in Initial state in this period') apDdSubscribeLifeTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 109), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSubscribeLifeTotal.setStatus('current') if mibBuilder.loadTexts: apDdSubscribeLifeTotal.setDescription('Total Number of the DD subscriber in Initial state in life') apDdSubscribeLifePerMax = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 110), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSubscribeLifePerMax.setStatus('current') if mibBuilder.loadTexts: apDdSubscribeLifePerMax.setDescription('PerMax number of the DD subscriber in Initial state in life') apDdSubscribeLifeHigh = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 111), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSubscribeLifeHigh.setStatus('current') if mibBuilder.loadTexts: apDdSubscribeLifeHigh.setDescription('Highest number of the DD subscriber in Initial state in life') apDdUnsubscribePeriodActive = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 112), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdUnsubscribePeriodActive.setStatus('current') if mibBuilder.loadTexts: apDdUnsubscribePeriodActive.setDescription('Number of the DD subscriber is Active in Established state in this period') apDdUnsubscribePeriodHigh = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 113), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdUnsubscribePeriodHigh.setStatus('current') if mibBuilder.loadTexts: apDdUnsubscribePeriodHigh.setDescription('Highest number of the DD subscriber in Established state in this period') apDdUnsubscribePeriodTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 114), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdUnsubscribePeriodTotal.setStatus('current') if mibBuilder.loadTexts: apDdUnsubscribePeriodTotal.setDescription('Total Number of the DD subscriber in Established state in this period') apDdUnsubscribeLifeTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 115), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdUnsubscribeLifeTotal.setStatus('current') if mibBuilder.loadTexts: apDdUnsubscribeLifeTotal.setDescription('Total Number of the DD subscriber in Established state in life') apDdUnsubscribeLifePerMax = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 116), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdUnsubscribeLifePerMax.setStatus('current') if mibBuilder.loadTexts: apDdUnsubscribeLifePerMax.setDescription('PerMax number of the DD subscriber in Established state in life') apDdUnsubscribeLifeHigh = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 117), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdUnsubscribeLifeHigh.setStatus('current') if mibBuilder.loadTexts: apDdUnsubscribeLifeHigh.setDescription('Highest number of the DD subscriber in Established state in life') apDdPolicyHitPeriodActive = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 118), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdPolicyHitPeriodActive.setStatus('current') if mibBuilder.loadTexts: apDdPolicyHitPeriodActive.setDescription('Number of the DD subscriber is Active in Terminated state in this period') apDdPolicyHitPeriodHigh = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 119), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdPolicyHitPeriodHigh.setStatus('current') if mibBuilder.loadTexts: apDdPolicyHitPeriodHigh.setDescription('Highest number of the DD subscriber in Terminated state in this period') apDdPolicyHitPeriodTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 120), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdPolicyHitPeriodTotal.setStatus('current') if mibBuilder.loadTexts: apDdPolicyHitPeriodTotal.setDescription('Total Number of the DD subscriber in Terminated state in this period') apDdPolicyHitLifeTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 121), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdPolicyHitLifeTotal.setStatus('current') if mibBuilder.loadTexts: apDdPolicyHitLifeTotal.setDescription('Total Number of the DD subscriber in Terminated state in life') apDdPolicyHitLifePerMax = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 122), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdPolicyHitLifePerMax.setStatus('current') if mibBuilder.loadTexts: apDdPolicyHitLifePerMax.setDescription('PerMax number of the DD subscriber in Terminated state in life') apDdPolicyHitLifeHigh = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 123), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdPolicyHitLifeHigh.setStatus('current') if mibBuilder.loadTexts: apDdPolicyHitLifeHigh.setDescription('Highest number of the DD subscriber in Terminated state in life') apDdPolicyMissPeriodActive = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 124), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdPolicyMissPeriodActive.setStatus('current') if mibBuilder.loadTexts: apDdPolicyMissPeriodActive.setDescription('Number of the DD subscriber is Active in Timeout state in this period') apDdPolicyMissPeriodHigh = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 125), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdPolicyMissPeriodHigh.setStatus('current') if mibBuilder.loadTexts: apDdPolicyMissPeriodHigh.setDescription('Highest number of the DD subscriber in Timeout state in this period') apDdPolicyMissPeriodTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 126), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdPolicyMissPeriodTotal.setStatus('current') if mibBuilder.loadTexts: apDdPolicyMissPeriodTotal.setDescription('Total Number of the DD subscriber in Timeout state in this period') apDdPolicyMissLifeTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 127), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdPolicyMissLifeTotal.setStatus('current') if mibBuilder.loadTexts: apDdPolicyMissLifeTotal.setDescription('Total Number of the DD subscriber in Timeout state in life') apDdPolicyMissLifePerMax = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 128), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdPolicyMissLifePerMax.setStatus('current') if mibBuilder.loadTexts: apDdPolicyMissLifePerMax.setDescription('PerMax number of the DD subscriber in Timeout state in life') apDdPolicyMissLifeHigh = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 129), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdPolicyMissLifeHigh.setStatus('current') if mibBuilder.loadTexts: apDdPolicyMissLifeHigh.setDescription('Highest number of the DD subscriber in Timeout state in life') apDdSubscriberMissPeriodTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 130), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSubscriberMissPeriodTotal.setStatus('current') if mibBuilder.loadTexts: apDdSubscriberMissPeriodTotal.setDescription('Total Number of the DD subscriber in Errors state in this period') apDdSubscriberMissLifeTotal = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 131), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSubscriberMissLifeTotal.setStatus('current') if mibBuilder.loadTexts: apDdSubscriberMissLifeTotal.setDescription('Total Number of the DD subscriber in Errors state in life') apDdSubscriberMissLifePerMax = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 1, 132), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdSubscriberMissLifePerMax.setStatus('current') if mibBuilder.loadTexts: apDdSubscriberMissLifePerMax.setDescription('PerMax number of the DD subscriber in Errors state in life') apDdInterfaceStatsTable = MibTable((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1), ) if mibBuilder.loadTexts: apDdInterfaceStatsTable.setStatus('current') if mibBuilder.loadTexts: apDdInterfaceStatsTable.setDescription('DD interface statistics.') apDdInterfaceStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1), ).setIndexNames((0, "APDD-MIB", "apDdInterfaceIndex")) if mibBuilder.loadTexts: apDdInterfaceStatsEntry.setStatus('current') if mibBuilder.loadTexts: apDdInterfaceStatsEntry.setDescription('A table entry designed to hold per DD interface statistics.') apDdInterfaceIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: apDdInterfaceIndex.setStatus('current') if mibBuilder.loadTexts: apDdInterfaceIndex.setDescription('An integer for the sole purpose of indexing the DD interface.') apDdInterfaceRealmName = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdInterfaceRealmName.setStatus('current') if mibBuilder.loadTexts: apDdInterfaceRealmName.setDescription('Realm name of the DD interface if the row is for per interface stats. Otherwise, it is an empty string.') apDdClientTransCPActive = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 3), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdClientTransCPActive.setStatus('current') if mibBuilder.loadTexts: apDdClientTransCPActive.setDescription('Number of active client transactions in the current period.') apDdClientTransCPHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdClientTransCPHigh.setStatus('current') if mibBuilder.loadTexts: apDdClientTransCPHigh.setDescription('Maximum value of apDdClientTransCPActive in the current period (high water mark). ') apDdClientTransCPTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdClientTransCPTotal.setStatus('current') if mibBuilder.loadTexts: apDdClientTransCPTotal.setDescription('Total number of client transactions in the current period.') apDdClientTransLTTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdClientTransLTTotal.setStatus('current') if mibBuilder.loadTexts: apDdClientTransLTTotal.setDescription('Total number of transactions in client side in life time.') apDdClientTransLTPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdClientTransLTPerMax.setStatus('current') if mibBuilder.loadTexts: apDdClientTransLTPerMax.setDescription('Maximum value of apDdClientTransCPTotal across all periods (high water mark).') apDdClientTransLTHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdClientTransLTHigh.setStatus('current') if mibBuilder.loadTexts: apDdClientTransLTHigh.setDescription('Maximum value of apDdClientTransCPHigh across all periods (high water mark).') apDdServerTransCPActive = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 9), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdServerTransCPActive.setStatus('current') if mibBuilder.loadTexts: apDdServerTransCPActive.setDescription('Number of active transactions in server side in current period.') apDdServerTransCPHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdServerTransCPHigh.setStatus('current') if mibBuilder.loadTexts: apDdServerTransCPHigh.setDescription('Highest number of active transactions in server side in current period.') apDdServerTransCPTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdServerTransCPTotal.setStatus('current') if mibBuilder.loadTexts: apDdServerTransCPTotal.setDescription('Total number of transactions in server side in current period.') apDdServerTransLTTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdServerTransLTTotal.setStatus('current') if mibBuilder.loadTexts: apDdServerTransLTTotal.setDescription('Total number of transactions in server side in life time.') apDdServerTransLTPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdServerTransLTPerMax.setStatus('current') if mibBuilder.loadTexts: apDdServerTransLTPerMax.setDescription('Maximum value of apDdServerTransCPTotal across all periods (high water mark).') apDdServerTransLTHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdServerTransLTHigh.setStatus('current') if mibBuilder.loadTexts: apDdServerTransLTHigh.setDescription('Maximum value of apDdServerTransCPHigh across all periods (high water mark).') apDdGenSocketsCPActive = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 15), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdGenSocketsCPActive.setStatus('current') if mibBuilder.loadTexts: apDdGenSocketsCPActive.setDescription('Number of active sockets in current period.') apDdGenSocketsCPHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdGenSocketsCPHigh.setStatus('current') if mibBuilder.loadTexts: apDdGenSocketsCPHigh.setDescription('Highest number of active sockets in current period.') apDdGenSocketsCPTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdGenSocketsCPTotal.setStatus('current') if mibBuilder.loadTexts: apDdGenSocketsCPTotal.setDescription('Total number of sockets in current period.') apDdGenSocketsLTTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 18), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdGenSocketsLTTotal.setStatus('current') if mibBuilder.loadTexts: apDdGenSocketsLTTotal.setDescription('Total number of sockets in life time.') apDdGenSocketsLTPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 19), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdGenSocketsLTPerMax.setStatus('current') if mibBuilder.loadTexts: apDdGenSocketsLTPerMax.setDescription('Maximum value of apDdSocketsCPTotal across all periods (high water mark).') apDdGenSocketsLTHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 20), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdGenSocketsLTHigh.setStatus('current') if mibBuilder.loadTexts: apDdGenSocketsLTHigh.setDescription('Maximum value of apDdSocketsCPHigh across all periods (high water mark).') apDdGenConnectsCPActive = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 21), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdGenConnectsCPActive.setStatus('current') if mibBuilder.loadTexts: apDdGenConnectsCPActive.setDescription('Number of active connections in current period.') apDdGenConnectsCPHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 22), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdGenConnectsCPHigh.setStatus('current') if mibBuilder.loadTexts: apDdGenConnectsCPHigh.setDescription('high number of connections in current period.') apDdGenConnectsCPTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 23), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdGenConnectsCPTotal.setStatus('current') if mibBuilder.loadTexts: apDdGenConnectsCPTotal.setDescription('Total number of connections in current period.') apDdGenConnectsLTTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 24), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdGenConnectsLTTotal.setStatus('current') if mibBuilder.loadTexts: apDdGenConnectsLTTotal.setDescription('Total number of connections in life time.') apDdGenConnectsLTPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 25), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdGenConnectsLTPerMax.setStatus('current') if mibBuilder.loadTexts: apDdGenConnectsLTPerMax.setDescription('Maximum value of apDdConnectsCPTotal across all periods (high water mark).') apDdGenConnectsLTHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 1, 1, 26), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdGenConnectsLTHigh.setStatus('current') if mibBuilder.loadTexts: apDdGenConnectsLTHigh.setDescription('Maximum value of apDdConnectsCPHigh across all periods (high water mark).') apDdErrorStatusTable = MibTable((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 2), ) if mibBuilder.loadTexts: apDdErrorStatusTable.setStatus('current') if mibBuilder.loadTexts: apDdErrorStatusTable.setDescription('per DD interface error stats.') apDdErrorStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 2, 1), ).setIndexNames((0, "APDD-MIB", "apDdInterfaceIndex")) if mibBuilder.loadTexts: apDdErrorStatusEntry.setStatus('current') if mibBuilder.loadTexts: apDdErrorStatusEntry.setDescription('A table entry designed to hold error status data') apDdNoRouteFoundRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 2, 1, 1), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdNoRouteFoundRecent.setStatus('current') if mibBuilder.loadTexts: apDdNoRouteFoundRecent.setDescription("Number of 'no route found' error in recent period.") apDdNoRouteFoundTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 2, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdNoRouteFoundTotal.setStatus('current') if mibBuilder.loadTexts: apDdNoRouteFoundTotal.setDescription("Total number of 'no route found' error in life time.") apDdNoRouteFoundPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 2, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdNoRouteFoundPerMax.setStatus('current') if mibBuilder.loadTexts: apDdNoRouteFoundPerMax.setDescription('Maximum value of apDdNoRouteFoundRecent across all periods (high water mark).') apDdMalformedMsgRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 2, 1, 4), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMalformedMsgRecent.setStatus('current') if mibBuilder.loadTexts: apDdMalformedMsgRecent.setDescription("Number of 'mal-formed message' error in recent period.") apDdMalformedMsgTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 2, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMalformedMsgTotal.setStatus('current') if mibBuilder.loadTexts: apDdMalformedMsgTotal.setDescription("Total number of 'mal-formed message' error in life time.") apDdMalformedMsgPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 2, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMalformedMsgPerMax.setStatus('current') if mibBuilder.loadTexts: apDdMalformedMsgPerMax.setDescription('Maximum value of apDdMalformedMsgRecent across all periods (high water mark).') apDdRejectedMsgRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 2, 1, 7), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdRejectedMsgRecent.setStatus('current') if mibBuilder.loadTexts: apDdRejectedMsgRecent.setDescription("Number of 'rejected msg'' error in recent period.") apDdRejectedMsgTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 2, 1, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdRejectedMsgTotal.setStatus('current') if mibBuilder.loadTexts: apDdRejectedMsgTotal.setDescription("Total number of 'rejected msg' error in life time.") apDdRejectedMsgPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 2, 1, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdRejectedMsgPerMax.setStatus('current') if mibBuilder.loadTexts: apDdRejectedMsgPerMax.setDescription('Maximum value of apDdRejectedMsgRecent across all periods (high water mark).') apDdDroppedMsgRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 2, 1, 10), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdDroppedMsgRecent.setStatus('current') if mibBuilder.loadTexts: apDdDroppedMsgRecent.setDescription("Number of 'dropped msg'' error in recent period.") apDdDroppedMsgTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 2, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdDroppedMsgTotal.setStatus('current') if mibBuilder.loadTexts: apDdDroppedMsgTotal.setDescription("Total number of 'dropped msg' error in life time.") apDdDroppedMsgPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 2, 1, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdDroppedMsgPerMax.setStatus('current') if mibBuilder.loadTexts: apDdDroppedMsgPerMax.setDescription('Maximum value of apDdDroppedMsgRecent across all periods (high water mark).') apDdInboundConstraintsRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 2, 1, 13), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdInboundConstraintsRecent.setStatus('current') if mibBuilder.loadTexts: apDdInboundConstraintsRecent.setDescription("Number of 'inbound constraints'' error in recent period.") apDdInboundConstraintsTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 2, 1, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdInboundConstraintsTotal.setStatus('current') if mibBuilder.loadTexts: apDdInboundConstraintsTotal.setDescription("Total number of 'inbound constraints' error in life time.") apDdInboundConstraintsPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 2, 1, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdInboundConstraintsPerMax.setStatus('current') if mibBuilder.loadTexts: apDdInboundConstraintsPerMax.setDescription('Maximum value of apDdInboundConstraintsRecent across all periods (high water mark).') apDdOutboundConstraintsRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 2, 1, 16), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdOutboundConstraintsRecent.setStatus('current') if mibBuilder.loadTexts: apDdOutboundConstraintsRecent.setDescription("Number of 'outbound constraints'' error in recent period.") apDdOutboundConstraintsTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 2, 1, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdOutboundConstraintsTotal.setStatus('current') if mibBuilder.loadTexts: apDdOutboundConstraintsTotal.setDescription("Total number of 'outbound constraints' error in life time.") apDdOutboundConstraintsPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 2, 1, 18), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdOutboundConstraintsPerMax.setStatus('current') if mibBuilder.loadTexts: apDdOutboundConstraintsPerMax.setDescription('Maximum value of apDdOutboundConstraintsRecent across all periods (high water mark).') apDdMsgTypeInfoTable = MibTable((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 3), ) if mibBuilder.loadTexts: apDdMsgTypeInfoTable.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeInfoTable.setDescription('static system message type information.') apDdMsgTypeInfoEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 3, 1), ).setIndexNames((0, "APDD-MIB", "apDdMsgTypeIndex")) if mibBuilder.loadTexts: apDdMsgTypeInfoEntry.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeInfoEntry.setDescription('A table entry designed for message type inf.') apDdMsgTypeIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))) if mibBuilder.loadTexts: apDdMsgTypeIndex.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeIndex.setDescription('An integer for the sole purpose of indexing DD message types.') apDdMsgTypeMsgName = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 3, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeMsgName.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeMsgName.setDescription('The identification string of the message type.') apDdMsgTypeStatsTable = MibTable((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4), ) if mibBuilder.loadTexts: apDdMsgTypeStatsTable.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeStatsTable.setDescription('table for holding message type stats.') apDdMsgTypeStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1), ).setIndexNames((0, "APDD-MIB", "apDdInterfaceIndex"), (0, "APDD-MIB", "apDdMsgTypeIndex")) if mibBuilder.loadTexts: apDdMsgTypeStatsEntry.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeStatsEntry.setDescription('A table entry designed for message type statistics.') apDdMsgTypeServerReqRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 3), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeServerReqRecent.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeServerReqRecent.setDescription('Number of server requests in recent period.') apDdMsgTypeServerReqTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeServerReqTotal.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeServerReqTotal.setDescription('Total number of server requests in life time.') apDdMsgTypeServerReqPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeServerReqPerMax.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeServerReqPerMax.setDescription('Maximum value of apDdMsgTypeServerReqRecent across all periods (high water mark)') apDdMsgTypeClientReqRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 6), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeClientReqRecent.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeClientReqRecent.setDescription('Number of client requests in recent period.') apDdMsgTypeClientReqTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeClientReqTotal.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeClientReqTotal.setDescription('Total number of client requests in life time.') apDdMsgTypeClientReqPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeClientReqPerMax.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeClientReqPerMax.setDescription('Maximum value of apDdMsgTypeClientReqRecent across all periods (high water mark).') apDdMsgTypeServerRetransRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 9), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeServerRetransRecent.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeServerRetransRecent.setDescription('Number of server retransmissions in recent period.') apDdMsgTypeServerRetransTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeServerRetransTotal.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeServerRetransTotal.setDescription('Total number of server retransmissions in life time.') apDdMsgTypeServerRetransPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeServerRetransPerMax.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeServerRetransPerMax.setDescription('Maximum value of apDdMsgTypeServerRetransRecent across all periods (high water mark)') apDdMsgTypeClientRetransRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 12), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeClientRetransRecent.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeClientRetransRecent.setDescription('Number of client retransmissions in recent period.') apDdMsgTypeClientRetransTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeClientRetransTotal.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeClientRetransTotal.setDescription('Total number of client retransmissions in life time.') apDdMsgTypeClientRetransPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeClientRetransPerMax.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeClientRetransPerMax.setDescription('Maximum value of apDdMsgTypeClientRetransRecent across all periods (high water mark).') apDdMsgTypeServerRespRetransRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 15), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeServerRespRetransRecent.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeServerRespRetransRecent.setDescription('Number of server response retransactions in recent period.') apDdMsgTypeServerRespRetransTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeServerRespRetransTotal.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeServerRespRetransTotal.setDescription('Total number of server response retransactions in life time.') apDdMsgTypeServerRespRetransPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeServerRespRetransPerMax.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeServerRespRetransPerMax.setDescription('Maximum value of apDdMsgTypeServerRespRetransRecent across all periods (high water mark).') apDdMsgTypeClientRespRetransRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 21), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeClientRespRetransRecent.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeClientRespRetransRecent.setDescription('Number of client response retransactions in recent period.') apDdMsgTypeClientRespRetransTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 22), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeClientRespRetransTotal.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeClientRespRetransTotal.setDescription('Total number of client response retransactions in life time.') apDdMsgTypeClientRespRetransPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 23), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeClientRespRetransPerMax.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeClientRespRetransPerMax.setDescription('Maximum value of apDdMsgTypeClientRespRetransRecent across all periods (high water mark).') apDdMsgTypeClientTimeoutRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 27), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeClientTimeoutRecent.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeClientTimeoutRecent.setDescription('Number of client transaction timeout in recent period.') apDdMsgTypeClientTimeoutTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 28), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeClientTimeoutTotal.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeClientTimeoutTotal.setDescription('Total number of client transaction timeout in life time.') apDdMsgTypeClientTimeoutPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 29), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeClientTimeoutPerMax.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeClientTimeoutPerMax.setDescription('Maximum value of apDdMsgTypeClientTimeoutRecent across all periods (high water mark).') apDdMsgTypeClientThrottledRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 33), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeClientThrottledRecent.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeClientThrottledRecent.setDescription('Number of locally throttled client count in recent period.') apDdMsgTypeClientThrottledTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 34), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeClientThrottledTotal.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeClientThrottledTotal.setDescription('Total number of locally throttled client count in life time.') apDdMsgTypeClientThrottledPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 35), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeClientThrottledPerMax.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeClientThrottledPerMax.setDescription('Maximum value of apDdMsgTypeClientThrottledRecent across all periods (high water mark).') apDdMsgTypeAverageLatency = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 36), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeAverageLatency.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeAverageLatency.setDescription('Average Latency.') apDdMsgTypeMaximumLatency = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 37), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeMaximumLatency.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeMaximumLatency.setDescription('Maximum Latency.') apDdMsgTypeLatencyWindow = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 4, 1, 38), Integer32()).setUnits('second').setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgTypeLatencyWindow.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeLatencyWindow.setDescription('Latency window length.') apDdMsgReturnCodeInfoTable = MibTable((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 5), ) if mibBuilder.loadTexts: apDdMsgReturnCodeInfoTable.setStatus('current') if mibBuilder.loadTexts: apDdMsgReturnCodeInfoTable.setDescription('DD return message code stats table.') apDdMsgReturnCodeInfoEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 5, 1), ).setIndexNames((0, "APDD-MIB", "apDdMsgReturnCodeIndex")) if mibBuilder.loadTexts: apDdMsgReturnCodeInfoEntry.setStatus('current') if mibBuilder.loadTexts: apDdMsgReturnCodeInfoEntry.setDescription('A table entry designed to hold return code stats.') apDdMsgReturnCodeIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 5, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))) if mibBuilder.loadTexts: apDdMsgReturnCodeIndex.setStatus('current') if mibBuilder.loadTexts: apDdMsgReturnCodeIndex.setDescription('An integer for the sole purpose of indexing message return code.') apDdMsgReturnCodeName = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 5, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgReturnCodeName.setStatus('current') if mibBuilder.loadTexts: apDdMsgReturnCodeName.setDescription('The name string of the message return code.') apDdMsgStatsReturnCodeTable = MibTable((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 6), ) if mibBuilder.loadTexts: apDdMsgStatsReturnCodeTable.setStatus('current') if mibBuilder.loadTexts: apDdMsgStatsReturnCodeTable.setDescription('DD return message code stats table.') apDdMsgStatsReturnCodeEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 6, 1), ).setIndexNames((0, "APDD-MIB", "apDdInterfaceIndex"), (0, "APDD-MIB", "apDdMsgTypeIndex"), (0, "APDD-MIB", "apDdMsgReturnCodeIndex")) if mibBuilder.loadTexts: apDdMsgStatsReturnCodeEntry.setStatus('current') if mibBuilder.loadTexts: apDdMsgStatsReturnCodeEntry.setDescription('A table entry designed to hold return code stats.') apDdMsgReturnCodeServerRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 6, 1, 3), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgReturnCodeServerRecent.setStatus('current') if mibBuilder.loadTexts: apDdMsgReturnCodeServerRecent.setDescription('Number of server requests in recent period.') apDdMsgReturnCodeServerTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 6, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgReturnCodeServerTotal.setStatus('current') if mibBuilder.loadTexts: apDdMsgReturnCodeServerTotal.setDescription('Total number of server requests in life time.') apDdMsgReturnCodeServerPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 6, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgReturnCodeServerPerMax.setStatus('current') if mibBuilder.loadTexts: apDdMsgReturnCodeServerPerMax.setDescription('Maximum value of apDdMsgReturnCodeServerRecent across all periods (high water mark).') apDdMsgReturnCodeClientRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 6, 1, 6), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgReturnCodeClientRecent.setStatus('current') if mibBuilder.loadTexts: apDdMsgReturnCodeClientRecent.setDescription('Number of server requests in recent period.') apDdMsgReturnCodeClientTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 6, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgReturnCodeClientTotal.setStatus('current') if mibBuilder.loadTexts: apDdMsgReturnCodeClientTotal.setDescription('Total number of server requests in life time.') apDdMsgReturnCodeClientPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 6, 1, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdMsgReturnCodeClientPerMax.setStatus('current') if mibBuilder.loadTexts: apDdMsgReturnCodeClientPerMax.setDescription('Maximum value of apDdMsgReturnCodeClientRecent across all periods (high water mark).') apDdAgentStatsTable = MibTable((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7), ) if mibBuilder.loadTexts: apDdAgentStatsTable.setStatus('current') if mibBuilder.loadTexts: apDdAgentStatsTable.setDescription('DD agent statistics.') apDdAgentStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1), ).setIndexNames((0, "APDD-MIB", "apDdAgentIndex")) if mibBuilder.loadTexts: apDdAgentStatsEntry.setStatus('current') if mibBuilder.loadTexts: apDdAgentStatsEntry.setDescription('A table entry designed to hold per DD agent statistics.') apDdAgentIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: apDdAgentIndex.setStatus('current') if mibBuilder.loadTexts: apDdAgentIndex.setDescription('An integer for the sole purpose of indexing the DD agent.') apDdAgentRealmName = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentRealmName.setStatus('current') if mibBuilder.loadTexts: apDdAgentRealmName.setDescription('Realm name of the DD agent if the row is for per agent stats. Otherwise, it is an empty string.') apDdAgentClientTransCPActive = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 3), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentClientTransCPActive.setStatus('current') if mibBuilder.loadTexts: apDdAgentClientTransCPActive.setDescription('Number of active client transactions in the current period.') apDdAgentClientTransCPHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentClientTransCPHigh.setStatus('current') if mibBuilder.loadTexts: apDdAgentClientTransCPHigh.setDescription('Maximum value of apDdAgentClientTransCPActive in the current period (high water mark). ') apDdAgentClientTransCPTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentClientTransCPTotal.setStatus('current') if mibBuilder.loadTexts: apDdAgentClientTransCPTotal.setDescription('Total number of client transactions in the current period.') apDdAgentClientTransLTTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentClientTransLTTotal.setStatus('current') if mibBuilder.loadTexts: apDdAgentClientTransLTTotal.setDescription('Total number of transactions in client side in life time.') apDdAgentClientTransLTPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentClientTransLTPerMax.setStatus('current') if mibBuilder.loadTexts: apDdAgentClientTransLTPerMax.setDescription('Maximum value of apDdAgentClientTransCPTotal across all periods (high water mark).') apDdAgentClientTransLTHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentClientTransLTHigh.setStatus('current') if mibBuilder.loadTexts: apDdAgentClientTransLTHigh.setDescription('Maximum value of apDdAgentClientTransCPHigh across all periods (high water mark).') apDdAgentServerTransCPActive = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 9), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentServerTransCPActive.setStatus('current') if mibBuilder.loadTexts: apDdAgentServerTransCPActive.setDescription('Number of active transactions in server side in current period.') apDdAgentServerTransCPHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentServerTransCPHigh.setStatus('current') if mibBuilder.loadTexts: apDdAgentServerTransCPHigh.setDescription('Highest number of active transactions in server side in current period.') apDdAgentServerTransCPTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentServerTransCPTotal.setStatus('current') if mibBuilder.loadTexts: apDdAgentServerTransCPTotal.setDescription('Total number of transactions in server side in current period.') apDdAgentServerTransLTTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentServerTransLTTotal.setStatus('current') if mibBuilder.loadTexts: apDdAgentServerTransLTTotal.setDescription('Total number of transactions in server side in life time.') apDdAgentServerTransLTPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentServerTransLTPerMax.setStatus('current') if mibBuilder.loadTexts: apDdAgentServerTransLTPerMax.setDescription('Maximum value of apDdAgentServerTransCPTotal across all periods (high water mark).') apDdAgentServerTransLTHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentServerTransLTHigh.setStatus('current') if mibBuilder.loadTexts: apDdAgentServerTransLTHigh.setDescription('Maximum value of apDdAgentServerTransCPHigh across all periods (high water mark).') apDdAgentGenSocketsCPActive = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 15), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentGenSocketsCPActive.setStatus('current') if mibBuilder.loadTexts: apDdAgentGenSocketsCPActive.setDescription('Number of active sockets in current period.') apDdAgentGenSocketsCPHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentGenSocketsCPHigh.setStatus('current') if mibBuilder.loadTexts: apDdAgentGenSocketsCPHigh.setDescription('Highest number of active sockets in current period.') apDdAgentGenSocketsCPTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentGenSocketsCPTotal.setStatus('current') if mibBuilder.loadTexts: apDdAgentGenSocketsCPTotal.setDescription('Total number of sockets in current period.') apDdAgentGenSocketsLTTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 18), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentGenSocketsLTTotal.setStatus('current') if mibBuilder.loadTexts: apDdAgentGenSocketsLTTotal.setDescription('Total number of sockets in life time.') apDdAgentGenSocketsLTPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 19), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentGenSocketsLTPerMax.setStatus('current') if mibBuilder.loadTexts: apDdAgentGenSocketsLTPerMax.setDescription('Maximum value of apDdAgentSocketsCPTotal across all periods (high water mark).') apDdAgentGenSocketsLTHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 20), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentGenSocketsLTHigh.setStatus('current') if mibBuilder.loadTexts: apDdAgentGenSocketsLTHigh.setDescription('Maximum value of apDdAgentSocketsCPHigh across all periods (high water mark).') apDdAgentGenConnectsCPActive = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 21), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentGenConnectsCPActive.setStatus('current') if mibBuilder.loadTexts: apDdAgentGenConnectsCPActive.setDescription('Number of active connections in current period.') apDdAgentGenConnectsCPHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 22), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentGenConnectsCPHigh.setStatus('current') if mibBuilder.loadTexts: apDdAgentGenConnectsCPHigh.setDescription('high number of connections in current period.') apDdAgentGenConnectsCPTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 23), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentGenConnectsCPTotal.setStatus('current') if mibBuilder.loadTexts: apDdAgentGenConnectsCPTotal.setDescription('Total number of connections in current period.') apDdAgentGenConnectsLTTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 24), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentGenConnectsLTTotal.setStatus('current') if mibBuilder.loadTexts: apDdAgentGenConnectsLTTotal.setDescription('Total number of connections in life time.') apDdAgentGenConnectsLTPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 25), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentGenConnectsLTPerMax.setStatus('current') if mibBuilder.loadTexts: apDdAgentGenConnectsLTPerMax.setDescription('Maximum value of apDdConnectsCPTotal across all periods (high water mark).') apDdAgentGenConnectsLTHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 7, 1, 26), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentGenConnectsLTHigh.setStatus('current') if mibBuilder.loadTexts: apDdAgentGenConnectsLTHigh.setDescription('Maximum value of apDdAgentConnectsCPHigh across all periods (high water mark).') apDdAgentErrorStatusTable = MibTable((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 8), ) if mibBuilder.loadTexts: apDdAgentErrorStatusTable.setStatus('current') if mibBuilder.loadTexts: apDdAgentErrorStatusTable.setDescription('per DD agent error stats.') apDdAgentErrorStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 8, 1), ).setIndexNames((0, "APDD-MIB", "apDdAgentIndex")) if mibBuilder.loadTexts: apDdAgentErrorStatusEntry.setStatus('current') if mibBuilder.loadTexts: apDdAgentErrorStatusEntry.setDescription('A table entry designed to hold error status data') apDdAgentNoRouteFoundRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 8, 1, 1), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentNoRouteFoundRecent.setStatus('current') if mibBuilder.loadTexts: apDdAgentNoRouteFoundRecent.setDescription("Number of 'no route found' error in recent period.") apDdAgentNoRouteFoundTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 8, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentNoRouteFoundTotal.setStatus('current') if mibBuilder.loadTexts: apDdAgentNoRouteFoundTotal.setDescription("Total number of 'no route found' error in life time.") apDdAgentNoRouteFoundPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 8, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentNoRouteFoundPerMax.setStatus('current') if mibBuilder.loadTexts: apDdAgentNoRouteFoundPerMax.setDescription('Maximum value of apDdAgentNoRouteFoundRecent across all periods (high water mark).') apDdAgentMalformedMsgRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 8, 1, 4), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMalformedMsgRecent.setStatus('current') if mibBuilder.loadTexts: apDdAgentMalformedMsgRecent.setDescription("Number of 'mal-formed message' error in recent period.") apDdAgentMalformedMsgTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 8, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMalformedMsgTotal.setStatus('current') if mibBuilder.loadTexts: apDdAgentMalformedMsgTotal.setDescription("Total number of 'mal-formed message' error in life time.") apDdAgentMalformedMsgPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 8, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMalformedMsgPerMax.setStatus('current') if mibBuilder.loadTexts: apDdAgentMalformedMsgPerMax.setDescription('Maximum value of apDdAgentMalformedMsgRecent across all periods (high water mark).') apDdAgentRejectedMsgRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 8, 1, 7), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentRejectedMsgRecent.setStatus('current') if mibBuilder.loadTexts: apDdAgentRejectedMsgRecent.setDescription("Number of 'rejected msg'' error in recent period.") apDdAgentRejectedMsgTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 8, 1, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentRejectedMsgTotal.setStatus('current') if mibBuilder.loadTexts: apDdAgentRejectedMsgTotal.setDescription("Total number of 'rejected msg' error in life time.") apDdAgentRejectedMsgPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 8, 1, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentRejectedMsgPerMax.setStatus('current') if mibBuilder.loadTexts: apDdAgentRejectedMsgPerMax.setDescription('Maximum value of apDdAgentRejectedMsgRecent across all periods (high water mark).') apDdAgentDroppedMsgRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 8, 1, 10), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentDroppedMsgRecent.setStatus('current') if mibBuilder.loadTexts: apDdAgentDroppedMsgRecent.setDescription("Number of 'dropped msg'' error in recent period.") apDdAgentDroppedMsgTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 8, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentDroppedMsgTotal.setStatus('current') if mibBuilder.loadTexts: apDdAgentDroppedMsgTotal.setDescription("Total number of 'dropped msg' error in life time.") apDdAgentDroppedMsgPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 8, 1, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentDroppedMsgPerMax.setStatus('current') if mibBuilder.loadTexts: apDdAgentDroppedMsgPerMax.setDescription('Maximum value of apDdAgentDroppedMsgRecent across all periods (high water mark).') apDdAgentInboundConstraintsRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 8, 1, 13), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentInboundConstraintsRecent.setStatus('current') if mibBuilder.loadTexts: apDdAgentInboundConstraintsRecent.setDescription("Number of 'inbound constraints'' error in recent period.") apDdAgentInboundConstraintsTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 8, 1, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentInboundConstraintsTotal.setStatus('current') if mibBuilder.loadTexts: apDdAgentInboundConstraintsTotal.setDescription("Total number of 'inbound constraints' error in life time.") apDdAgentInboundConstraintsPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 8, 1, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentInboundConstraintsPerMax.setStatus('current') if mibBuilder.loadTexts: apDdAgentInboundConstraintsPerMax.setDescription('Maximum value of apDdAgentInboundConstraintsRecent across all periods (high water mark).') apDdAgentOutboundConstraintsRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 8, 1, 16), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentOutboundConstraintsRecent.setStatus('current') if mibBuilder.loadTexts: apDdAgentOutboundConstraintsRecent.setDescription("Number of 'outbound constraints'' error in recent period.") apDdAgentOutboundConstraintsTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 8, 1, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentOutboundConstraintsTotal.setStatus('current') if mibBuilder.loadTexts: apDdAgentOutboundConstraintsTotal.setDescription("Total number of 'outbound constraints' error in life time.") apDdAgentOutboundConstraintsPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 8, 1, 18), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentOutboundConstraintsPerMax.setStatus('current') if mibBuilder.loadTexts: apDdAgentOutboundConstraintsPerMax.setDescription('Maximum value of apDdAgentOutboundConstraintsRecent across all periods (high water mark).') apDdAgentMsgTypeStatsTable = MibTable((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9), ) if mibBuilder.loadTexts: apDdAgentMsgTypeStatsTable.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeStatsTable.setDescription('table for holding message type stats.') apDdAgentMsgTypeStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1), ).setIndexNames((0, "APDD-MIB", "apDdAgentIndex"), (0, "APDD-MIB", "apDdMsgTypeIndex")) if mibBuilder.loadTexts: apDdAgentMsgTypeStatsEntry.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeStatsEntry.setDescription('A table entry designed for message type statistics.') apDdAgentMsgTypeServerReqRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 3), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeServerReqRecent.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeServerReqRecent.setDescription('Number of server requests in recent period.') apDdAgentMsgTypeServerReqTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeServerReqTotal.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeServerReqTotal.setDescription('Total number of server requests in life time.') apDdAgentMsgTypeServerReqPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeServerReqPerMax.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeServerReqPerMax.setDescription('Maximum value of apDdAgentMsgTypeServerReqRecent across all periods (high water mark)') apDdAgentMsgTypeClientReqRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 6), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeClientReqRecent.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeClientReqRecent.setDescription('Number of client requests in recent period.') apDdAgentMsgTypeClientReqTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeClientReqTotal.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeClientReqTotal.setDescription('Total number of client requests in life time.') apDdAgentMsgTypeClientReqPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeClientReqPerMax.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeClientReqPerMax.setDescription('Maximum value of apDdAgentMsgTypeClientReqRecent across all periods (high water mark).') apDdAgentMsgTypeServerRetransRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 9), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeServerRetransRecent.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeServerRetransRecent.setDescription('Number of server retransmissions in recent period.') apDdAgentMsgTypeServerRetransTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeServerRetransTotal.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeServerRetransTotal.setDescription('Total number of server retransmissions in life time.') apDdAgentMsgTypeServerRetransPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeServerRetransPerMax.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeServerRetransPerMax.setDescription('Maximum value of apDdAgentMsgTypeServerRetransRecent across all periods (high water mark)') apDdAgentMsgTypeClientRetransRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 12), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeClientRetransRecent.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeClientRetransRecent.setDescription('Number of client retransmissions in recent period.') apDdAgentMsgTypeClientRetransTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeClientRetransTotal.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeClientRetransTotal.setDescription('Total number of client retransmissions in life time.') apDdAgentMsgTypeClientRetransPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeClientRetransPerMax.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeClientRetransPerMax.setDescription('Maximum value of apDdAgentMsgTypeClientRetransRecent across all periods (high water mark).') apDdAgentMsgTypeServerRespRetransRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 15), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeServerRespRetransRecent.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeServerRespRetransRecent.setDescription('Number of server response retransactions in recent period.') apDdAgentMsgTypeServerRespRetransTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeServerRespRetransTotal.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeServerRespRetransTotal.setDescription('Total number of server response retransactions in life time.') apDdAgentMsgTypeServerRespRetransPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeServerRespRetransPerMax.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeServerRespRetransPerMax.setDescription('Maximum value of apDdAgentMsgTypeServerRespRetransRecent across all periods (high water mark).') apDdAgentMsgTypeClientRespRetransRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 21), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeClientRespRetransRecent.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeClientRespRetransRecent.setDescription('Number of client response retransactions in recent period.') apDdAgentMsgTypeClientRespRetransTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 22), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeClientRespRetransTotal.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeClientRespRetransTotal.setDescription('Total number of client response retransactions in life time.') apDdAgentMsgTypeClientRespRetransPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 23), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeClientRespRetransPerMax.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeClientRespRetransPerMax.setDescription('Maximum value of apDdAgentMsgTypeClientRespRetransRecent across all periods (high water mark).') apDdAgentMsgTypeClientTimeoutRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 27), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeClientTimeoutRecent.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeClientTimeoutRecent.setDescription('Number of client transaction timeout in recent period.') apDdAgentMsgTypeClientTimeoutTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 28), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeClientTimeoutTotal.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeClientTimeoutTotal.setDescription('Total number of client transaction timeout in life time.') apDdAgentMsgTypeClientTimeoutPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 29), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeClientTimeoutPerMax.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeClientTimeoutPerMax.setDescription('Maximum value of apDdAgentMsgTypeClientTimeoutRecent across all periods (high water mark).') apDdAgentMsgTypeClientThrottledRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 33), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeClientThrottledRecent.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeClientThrottledRecent.setDescription('Number of locally throttled client count in recent period.') apDdAgentMsgTypeClientThrottledTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 34), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeClientThrottledTotal.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeClientThrottledTotal.setDescription('Total number of locally throttled client count in life time.') apDdAgentMsgTypeClientThrottledPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 35), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeClientThrottledPerMax.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeClientThrottledPerMax.setDescription('Maximum value of apDdAgentMsgTypeClientThrottledRecent across all periods (high water mark).') apDdAgentMsgTypeAverageLatency = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 36), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeAverageLatency.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeAverageLatency.setDescription('Average Latency.') apDdAgentMsgTypeMaximumLatency = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 37), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeMaximumLatency.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeMaximumLatency.setDescription('Maximum Latency.') apDdAgentMsgTypeLatencyWindow = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 9, 1, 38), Integer32()).setUnits('second').setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgTypeLatencyWindow.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeLatencyWindow.setDescription('Latency window length.') apDdAgentMsgStatsReturnCodeTable = MibTable((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 10), ) if mibBuilder.loadTexts: apDdAgentMsgStatsReturnCodeTable.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgStatsReturnCodeTable.setDescription('DD return message code stats table.') apDdAgentMsgStatsReturnCodeEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 10, 1), ).setIndexNames((0, "APDD-MIB", "apDdAgentIndex"), (0, "APDD-MIB", "apDdMsgTypeIndex"), (0, "APDD-MIB", "apDdMsgReturnCodeIndex")) if mibBuilder.loadTexts: apDdAgentMsgStatsReturnCodeEntry.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgStatsReturnCodeEntry.setDescription('A table entry designed to hold return code stats.') apDdAgentMsgReturnCodeServerRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 10, 1, 3), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgReturnCodeServerRecent.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgReturnCodeServerRecent.setDescription('Number of server requests in recent period.') apDdAgentMsgReturnCodeServerTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 10, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgReturnCodeServerTotal.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgReturnCodeServerTotal.setDescription('Total number of server requests in life time.') apDdAgentMsgReturnCodeServerPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 10, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgReturnCodeServerPerMax.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgReturnCodeServerPerMax.setDescription('Maximum value of apDdAgentMsgReturnCodeServerRecent across all periods (high water mark).') apDdAgentMsgReturnCodeClientRecent = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 10, 1, 6), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgReturnCodeClientRecent.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgReturnCodeClientRecent.setDescription('Number of server requests in recent period.') apDdAgentMsgReturnCodeClientTotal = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 10, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgReturnCodeClientTotal.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgReturnCodeClientTotal.setDescription('Total number of server requests in life time.') apDdAgentMsgReturnCodeClientPerMax = MibTableColumn((1, 3, 6, 1, 4, 1, 9148, 3, 12, 1, 2, 10, 1, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: apDdAgentMsgReturnCodeClientPerMax.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgReturnCodeClientPerMax.setDescription('Maximum value of apDdAgentMsgReturnCodeClientRecent across all periods (high water mark).') apDdDiameterAgentHostName = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 2, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 255))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: apDdDiameterAgentHostName.setStatus('current') if mibBuilder.loadTexts: apDdDiameterAgentHostName.setDescription('The hostname of the Diameter Agent where it is hosted.') apDdDiameterIPPort = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 2, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 255))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: apDdDiameterIPPort.setStatus('current') if mibBuilder.loadTexts: apDdDiameterIPPort.setDescription('The IP port of the Diameter Agent where it is hosted.') apDdDiameterAgentOriginHostName = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 2, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 255))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: apDdDiameterAgentOriginHostName.setStatus('current') if mibBuilder.loadTexts: apDdDiameterAgentOriginHostName.setDescription('The origin hostname of the Diameter Agent where it is hosted.') apDdDiameterAgentOriginRealmName = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 2, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 255))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: apDdDiameterAgentOriginRealmName.setStatus('current') if mibBuilder.loadTexts: apDdDiameterAgentOriginRealmName.setDescription('The origin realm name of the Diameter Agent where it is hosted.') apDdTransportType = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 2, 1, 5), ApTransportType()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: apDdTransportType.setStatus('current') if mibBuilder.loadTexts: apDdTransportType.setDescription('The transport type of the DD interface.') apDdInterfaceStatusReason = MibScalar((1, 3, 6, 1, 4, 1, 9148, 3, 12, 2, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("disconnectByRequest", 0), ("diameterAgentUnreachable", 1), ("transportFailure", 2)))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: apDdInterfaceStatusReason.setStatus('current') if mibBuilder.loadTexts: apDdInterfaceStatusReason.setDescription('The reason for the status change on a DD interface') apDdConnectionFailureTrap = NotificationType((1, 3, 6, 1, 4, 1, 9148, 3, 12, 2, 2, 0, 1)).setObjects(("APDD-MIB", "apDdInterfaceRealmName"), ("APDD-MIB", "apDdDiameterAgentHostName"), ("APDD-MIB", "apDdDiameterIPPort"), ("APDD-MIB", "apDdDiameterAgentOriginHostName"), ("APDD-MIB", "apDdDiameterAgentOriginRealmName"), ("APDD-MIB", "apDdTransportType"), ("APDD-MIB", "apDdInterfaceStatusReason")) if mibBuilder.loadTexts: apDdConnectionFailureTrap.setStatus('current') if mibBuilder.loadTexts: apDdConnectionFailureTrap.setDescription('A notification when a diameter connection is disconnected via a disconnect request.') apDdConnectionFailureClearTrap = NotificationType((1, 3, 6, 1, 4, 1, 9148, 3, 12, 2, 2, 0, 2)).setObjects(("APDD-MIB", "apDdInterfaceRealmName"), ("APDD-MIB", "apDdDiameterAgentHostName"), ("APDD-MIB", "apDdDiameterIPPort"), ("APDD-MIB", "apDdDiameterAgentOriginHostName"), ("APDD-MIB", "apDdDiameterAgentOriginRealmName"), ("APDD-MIB", "apDdTransportType"), ("APDD-MIB", "apDdInterfaceStatusReason")) if mibBuilder.loadTexts: apDdConnectionFailureClearTrap.setStatus('current') if mibBuilder.loadTexts: apDdConnectionFailureClearTrap.setDescription('A notification when a transport failure has been recovered.') apDdGeneralGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9148, 3, 12, 3, 1, 1)).setObjects(("APDD-MIB", "apDdInterfaceNumber"), ("APDD-MIB", "apDdCurrentTransRate"), ("APDD-MIB", "apDdHighTransRate"), ("APDD-MIB", "apDdLowTransRate")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): apDdGeneralGroup = apDdGeneralGroup.setStatus('current') if mibBuilder.loadTexts: apDdGeneralGroup.setDescription('A collection of objects generic to DD system.') apDdInterfaceStatsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9148, 3, 12, 3, 1, 2)).setObjects(("APDD-MIB", "apDdInterfaceRealmName"), ("APDD-MIB", "apDdClientTransCPActive"), ("APDD-MIB", "apDdClientTransCPHigh"), ("APDD-MIB", "apDdClientTransCPTotal"), ("APDD-MIB", "apDdClientTransLTTotal"), ("APDD-MIB", "apDdClientTransLTPerMax"), ("APDD-MIB", "apDdClientTransLTHigh"), ("APDD-MIB", "apDdServerTransCPActive"), ("APDD-MIB", "apDdServerTransCPHigh"), ("APDD-MIB", "apDdServerTransCPTotal"), ("APDD-MIB", "apDdServerTransLTTotal"), ("APDD-MIB", "apDdServerTransLTPerMax"), ("APDD-MIB", "apDdServerTransLTHigh"), ("APDD-MIB", "apDdGenSocketsCPActive"), ("APDD-MIB", "apDdGenSocketsCPHigh"), ("APDD-MIB", "apDdGenSocketsCPTotal"), ("APDD-MIB", "apDdGenSocketsLTTotal"), ("APDD-MIB", "apDdGenSocketsLTPerMax"), ("APDD-MIB", "apDdGenSocketsLTHigh"), ("APDD-MIB", "apDdGenConnectsCPActive"), ("APDD-MIB", "apDdGenConnectsCPHigh"), ("APDD-MIB", "apDdGenConnectsCPTotal"), ("APDD-MIB", "apDdGenConnectsLTTotal"), ("APDD-MIB", "apDdGenConnectsLTPerMax"), ("APDD-MIB", "apDdGenConnectsLTHigh")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): apDdInterfaceStatsGroup = apDdInterfaceStatsGroup.setStatus('current') if mibBuilder.loadTexts: apDdInterfaceStatsGroup.setDescription('A collection of statistics for DD interfaces or system.') apDdErrorStatusGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9148, 3, 12, 3, 1, 3)).setObjects(("APDD-MIB", "apDdNoRouteFoundRecent"), ("APDD-MIB", "apDdNoRouteFoundTotal"), ("APDD-MIB", "apDdNoRouteFoundPerMax"), ("APDD-MIB", "apDdMalformedMsgRecent"), ("APDD-MIB", "apDdMalformedMsgTotal"), ("APDD-MIB", "apDdMalformedMsgPerMax")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): apDdErrorStatusGroup = apDdErrorStatusGroup.setStatus('current') if mibBuilder.loadTexts: apDdErrorStatusGroup.setDescription('A collection of statistics for DD errors.') apDdMsgTypeStatsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9148, 3, 12, 3, 1, 4)).setObjects(("APDD-MIB", "apDdMsgTypeMsgName"), ("APDD-MIB", "apDdMsgTypeServerReqRecent"), ("APDD-MIB", "apDdMsgTypeServerReqTotal"), ("APDD-MIB", "apDdMsgTypeServerReqPerMax"), ("APDD-MIB", "apDdMsgTypeClientReqRecent"), ("APDD-MIB", "apDdMsgTypeClientReqTotal"), ("APDD-MIB", "apDdMsgTypeClientReqPerMax"), ("APDD-MIB", "apDdMsgTypeServerRetransRecent"), ("APDD-MIB", "apDdMsgTypeServerRetransTotal"), ("APDD-MIB", "apDdMsgTypeServerRetransPerMax"), ("APDD-MIB", "apDdMsgTypeClientRetransRecent"), ("APDD-MIB", "apDdMsgTypeClientRetransTotal"), ("APDD-MIB", "apDdMsgTypeClientRetransPerMax"), ("APDD-MIB", "apDdMsgTypeServerRespRetransRecent"), ("APDD-MIB", "apDdMsgTypeServerRespRetransTotal"), ("APDD-MIB", "apDdMsgTypeServerRespRetransPerMax"), ("APDD-MIB", "apDdMsgTypeClientRespRetransRecent"), ("APDD-MIB", "apDdMsgTypeClientRespRetransTotal"), ("APDD-MIB", "apDdMsgTypeClientRespRetransPerMax"), ("APDD-MIB", "apDdMsgTypeClientTimeoutRecent"), ("APDD-MIB", "apDdMsgTypeClientTimeoutTotal"), ("APDD-MIB", "apDdMsgTypeClientTimeoutPerMax"), ("APDD-MIB", "apDdMsgTypeClientThrottledRecent"), ("APDD-MIB", "apDdMsgTypeClientThrottledTotal"), ("APDD-MIB", "apDdMsgTypeClientThrottledPerMax"), ("APDD-MIB", "apDdMsgTypeAverageLatency"), ("APDD-MIB", "apDdMsgTypeMaximumLatency"), ("APDD-MIB", "apDdMsgTypeLatencyWindow")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): apDdMsgTypeStatsGroup = apDdMsgTypeStatsGroup.setStatus('current') if mibBuilder.loadTexts: apDdMsgTypeStatsGroup.setDescription('A collection of statistics for DD message types.') apDdMsgStatsReturnCodeGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9148, 3, 12, 3, 1, 5)).setObjects(("APDD-MIB", "apDdMsgReturnCodeName"), ("APDD-MIB", "apDdMsgReturnCodeServerRecent"), ("APDD-MIB", "apDdMsgReturnCodeServerTotal"), ("APDD-MIB", "apDdMsgReturnCodeServerPerMax"), ("APDD-MIB", "apDdMsgReturnCodeClientRecent"), ("APDD-MIB", "apDdMsgReturnCodeClientTotal"), ("APDD-MIB", "apDdMsgReturnCodeClientPerMax")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): apDdMsgStatsReturnCodeGroup = apDdMsgStatsReturnCodeGroup.setStatus('current') if mibBuilder.loadTexts: apDdMsgStatsReturnCodeGroup.setDescription('A collection of statistics for DD message type return codes.') apDdIntfErrorStatusGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9148, 3, 12, 3, 1, 6)).setObjects(("APDD-MIB", "apDdRejectedMsgRecent"), ("APDD-MIB", "apDdRejectedMsgTotal"), ("APDD-MIB", "apDdRejectedMsgPerMax"), ("APDD-MIB", "apDdDroppedMsgRecent"), ("APDD-MIB", "apDdDroppedMsgTotal"), ("APDD-MIB", "apDdDroppedMsgPerMax"), ("APDD-MIB", "apDdInboundConstraintsRecent"), ("APDD-MIB", "apDdInboundConstraintsTotal"), ("APDD-MIB", "apDdInboundConstraintsPerMax"), ("APDD-MIB", "apDdOutboundConstraintsRecent"), ("APDD-MIB", "apDdOutboundConstraintsTotal"), ("APDD-MIB", "apDdOutboundConstraintsPerMax")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): apDdIntfErrorStatusGroup = apDdIntfErrorStatusGroup.setStatus('current') if mibBuilder.loadTexts: apDdIntfErrorStatusGroup.setDescription('A collection of statistics for DD errors.') apDdAgentGeneralGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9148, 3, 12, 3, 1, 7)).setObjects(("APDD-MIB", "apDdAgentNumber")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): apDdAgentGeneralGroup = apDdAgentGeneralGroup.setStatus('current') if mibBuilder.loadTexts: apDdAgentGeneralGroup.setDescription('A collection of Agent objects generic to DD system.') apDdAgentStatsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9148, 3, 12, 3, 1, 8)).setObjects(("APDD-MIB", "apDdAgentRealmName"), ("APDD-MIB", "apDdAgentClientTransCPActive"), ("APDD-MIB", "apDdAgentClientTransCPHigh"), ("APDD-MIB", "apDdAgentClientTransCPTotal"), ("APDD-MIB", "apDdAgentClientTransLTTotal"), ("APDD-MIB", "apDdAgentClientTransLTPerMax"), ("APDD-MIB", "apDdAgentClientTransLTHigh"), ("APDD-MIB", "apDdAgentServerTransCPActive"), ("APDD-MIB", "apDdAgentServerTransCPHigh"), ("APDD-MIB", "apDdAgentServerTransCPTotal"), ("APDD-MIB", "apDdAgentServerTransLTTotal"), ("APDD-MIB", "apDdAgentServerTransLTPerMax"), ("APDD-MIB", "apDdAgentServerTransLTHigh"), ("APDD-MIB", "apDdAgentGenSocketsCPActive"), ("APDD-MIB", "apDdAgentGenSocketsCPHigh"), ("APDD-MIB", "apDdAgentGenSocketsCPTotal"), ("APDD-MIB", "apDdAgentGenSocketsLTTotal"), ("APDD-MIB", "apDdAgentGenSocketsLTPerMax"), ("APDD-MIB", "apDdAgentGenSocketsLTHigh"), ("APDD-MIB", "apDdAgentGenConnectsCPActive"), ("APDD-MIB", "apDdAgentGenConnectsCPHigh"), ("APDD-MIB", "apDdAgentGenConnectsCPTotal"), ("APDD-MIB", "apDdAgentGenConnectsLTTotal"), ("APDD-MIB", "apDdAgentGenConnectsLTPerMax"), ("APDD-MIB", "apDdAgentGenConnectsLTHigh")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): apDdAgentStatsGroup = apDdAgentStatsGroup.setStatus('current') if mibBuilder.loadTexts: apDdAgentStatsGroup.setDescription('A collection of statistics for DD agents') apDdAgentErrorStatusGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9148, 3, 12, 3, 1, 9)).setObjects(("APDD-MIB", "apDdAgentNoRouteFoundRecent"), ("APDD-MIB", "apDdAgentNoRouteFoundTotal"), ("APDD-MIB", "apDdAgentNoRouteFoundPerMax"), ("APDD-MIB", "apDdAgentMalformedMsgRecent"), ("APDD-MIB", "apDdAgentMalformedMsgTotal"), ("APDD-MIB", "apDdAgentMalformedMsgPerMax"), ("APDD-MIB", "apDdAgentRejectedMsgRecent"), ("APDD-MIB", "apDdAgentRejectedMsgTotal"), ("APDD-MIB", "apDdAgentRejectedMsgPerMax"), ("APDD-MIB", "apDdAgentDroppedMsgRecent"), ("APDD-MIB", "apDdAgentDroppedMsgTotal"), ("APDD-MIB", "apDdAgentDroppedMsgPerMax"), ("APDD-MIB", "apDdAgentInboundConstraintsRecent"), ("APDD-MIB", "apDdAgentInboundConstraintsTotal"), ("APDD-MIB", "apDdAgentInboundConstraintsPerMax"), ("APDD-MIB", "apDdAgentOutboundConstraintsRecent"), ("APDD-MIB", "apDdAgentOutboundConstraintsTotal"), ("APDD-MIB", "apDdAgentOutboundConstraintsPerMax")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): apDdAgentErrorStatusGroup = apDdAgentErrorStatusGroup.setStatus('current') if mibBuilder.loadTexts: apDdAgentErrorStatusGroup.setDescription('A collection of statistics for DD Agent errors.') apDdAgentMsgTypeStatsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9148, 3, 12, 3, 1, 10)).setObjects(("APDD-MIB", "apDdMsgTypeMsgName"), ("APDD-MIB", "apDdAgentMsgTypeServerReqRecent"), ("APDD-MIB", "apDdAgentMsgTypeServerReqTotal"), ("APDD-MIB", "apDdAgentMsgTypeServerReqPerMax"), ("APDD-MIB", "apDdAgentMsgTypeClientReqRecent"), ("APDD-MIB", "apDdAgentMsgTypeClientReqTotal"), ("APDD-MIB", "apDdAgentMsgTypeClientReqPerMax"), ("APDD-MIB", "apDdAgentMsgTypeServerRetransRecent"), ("APDD-MIB", "apDdAgentMsgTypeServerRetransTotal"), ("APDD-MIB", "apDdAgentMsgTypeServerRetransPerMax"), ("APDD-MIB", "apDdAgentMsgTypeClientRetransRecent"), ("APDD-MIB", "apDdAgentMsgTypeClientRetransTotal"), ("APDD-MIB", "apDdAgentMsgTypeClientRetransPerMax"), ("APDD-MIB", "apDdAgentMsgTypeServerRespRetransRecent"), ("APDD-MIB", "apDdAgentMsgTypeServerRespRetransTotal"), ("APDD-MIB", "apDdAgentMsgTypeServerRespRetransPerMax"), ("APDD-MIB", "apDdAgentMsgTypeClientRespRetransRecent"), ("APDD-MIB", "apDdAgentMsgTypeClientRespRetransTotal"), ("APDD-MIB", "apDdAgentMsgTypeClientRespRetransPerMax"), ("APDD-MIB", "apDdAgentMsgTypeClientTimeoutRecent"), ("APDD-MIB", "apDdAgentMsgTypeClientTimeoutTotal"), ("APDD-MIB", "apDdAgentMsgTypeClientTimeoutPerMax"), ("APDD-MIB", "apDdAgentMsgTypeClientThrottledRecent"), ("APDD-MIB", "apDdAgentMsgTypeClientThrottledTotal"), ("APDD-MIB", "apDdAgentMsgTypeClientThrottledPerMax"), ("APDD-MIB", "apDdAgentMsgTypeAverageLatency"), ("APDD-MIB", "apDdAgentMsgTypeMaximumLatency"), ("APDD-MIB", "apDdAgentMsgTypeLatencyWindow")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): apDdAgentMsgTypeStatsGroup = apDdAgentMsgTypeStatsGroup.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgTypeStatsGroup.setDescription('A collection of statistics for DD Agent message types.') apDdAgentMsgStatsReturnCodeGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9148, 3, 12, 3, 1, 11)).setObjects(("APDD-MIB", "apDdMsgReturnCodeName"), ("APDD-MIB", "apDdAgentMsgReturnCodeServerRecent"), ("APDD-MIB", "apDdAgentMsgReturnCodeServerTotal"), ("APDD-MIB", "apDdAgentMsgReturnCodeServerPerMax"), ("APDD-MIB", "apDdAgentMsgReturnCodeClientRecent"), ("APDD-MIB", "apDdAgentMsgReturnCodeClientTotal"), ("APDD-MIB", "apDdAgentMsgReturnCodeClientPerMax")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): apDdAgentMsgStatsReturnCodeGroup = apDdAgentMsgStatsReturnCodeGroup.setStatus('current') if mibBuilder.loadTexts: apDdAgentMsgStatsReturnCodeGroup.setDescription('A collection of statistics for DD Agent message type return codes.') apDdSessionSubscriberGeneralGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9148, 3, 12, 3, 1, 12)).setObjects(("APDD-MIB", "apDdSessionPeriodActive"), ("APDD-MIB", "apDdSessionPeriodHigh"), ("APDD-MIB", "apDdSessionPeriodTotal"), ("APDD-MIB", "apDdSessionLifeTotal"), ("APDD-MIB", "apDdSessionLifePerMax"), ("APDD-MIB", "apDdSessionLifeHigh"), ("APDD-MIB", "apDdSessInitPeriodActive"), ("APDD-MIB", "apDdSessInitPeriodHigh"), ("APDD-MIB", "apDdSessInitPeriodTotal"), ("APDD-MIB", "apDdSessInitLifeTotal"), ("APDD-MIB", "apDdSessInitLifePerMax"), ("APDD-MIB", "apDdSessInitLifeHigh"), ("APDD-MIB", "apDdSessEstablishedPeriodActive"), ("APDD-MIB", "apDdSessEstablishedPeriodHigh"), ("APDD-MIB", "apDdSessEstablishedPeriodTotal"), ("APDD-MIB", "apDdSessEstablishedLifeTotal"), ("APDD-MIB", "apDdSessEstablishedLifePerMax"), ("APDD-MIB", "apDdSessEstablishedLifeHigh"), ("APDD-MIB", "apDdSessTerminatedPeriodActive"), ("APDD-MIB", "apDdSessTerminatedPeriodHigh"), ("APDD-MIB", "apDdSessTerminatedPeriodTotal"), ("APDD-MIB", "apDdSessTerminatedLifeTotal"), ("APDD-MIB", "apDdSessTerminatedLifePerMax"), ("APDD-MIB", "apDdSessTerminatedLifeHigh"), ("APDD-MIB", "apDdSessTimeoutPeriodTotal"), ("APDD-MIB", "apDdSessTimeoutLifeTotal"), ("APDD-MIB", "apDdSessTimeoutLifePerMax"), ("APDD-MIB", "apDdSessErrorsPeriodTotal"), ("APDD-MIB", "apDdSessErrorsLifeTotal"), ("APDD-MIB", "apDdSessErrorsLifePerMax"), ("APDD-MIB", "apDdSessMissPeriodTotal"), ("APDD-MIB", "apDdSessMissLifeTotal"), ("APDD-MIB", "apDdSessMissLifePerMax"), ("APDD-MIB", "apDdSubscriberPeriodActive"), ("APDD-MIB", "apDdSubscriberPeriodHigh"), ("APDD-MIB", "apDdSubscriberPeriodTotal"), ("APDD-MIB", "apDdSubscriberLifeTotal"), ("APDD-MIB", "apDdSubscriberLifePerMax"), ("APDD-MIB", "apDdSubscriberLifeHigh"), ("APDD-MIB", "apDdSubscribePeriodActive"), ("APDD-MIB", "apDdSubscribePeriodHigh"), ("APDD-MIB", "apDdSubscribePeriodTotal"), ("APDD-MIB", "apDdSubscribeLifeTotal"), ("APDD-MIB", "apDdSubscribeLifePerMax"), ("APDD-MIB", "apDdSubscribeLifeHigh"), ("APDD-MIB", "apDdUnsubscribePeriodActive"), ("APDD-MIB", "apDdUnsubscribePeriodHigh"), ("APDD-MIB", "apDdUnsubscribePeriodTotal"), ("APDD-MIB", "apDdUnsubscribeLifeTotal"), ("APDD-MIB", "apDdUnsubscribeLifePerMax"), ("APDD-MIB", "apDdUnsubscribeLifeHigh"), ("APDD-MIB", "apDdPolicyHitPeriodActive"), ("APDD-MIB", "apDdPolicyHitPeriodHigh"), ("APDD-MIB", "apDdPolicyHitPeriodTotal"), ("APDD-MIB", "apDdPolicyHitLifeTotal"), ("APDD-MIB", "apDdPolicyHitLifePerMax"), ("APDD-MIB", "apDdPolicyHitLifeHigh"), ("APDD-MIB", "apDdPolicyMissPeriodActive"), ("APDD-MIB", "apDdPolicyMissPeriodHigh"), ("APDD-MIB", "apDdPolicyMissPeriodTotal"), ("APDD-MIB", "apDdPolicyMissLifeTotal"), ("APDD-MIB", "apDdPolicyMissLifePerMax"), ("APDD-MIB", "apDdPolicyMissLifeHigh"), ("APDD-MIB", "apDdSubscriberMissPeriodTotal"), ("APDD-MIB", "apDdSubscriberMissLifeTotal"), ("APDD-MIB", "apDdSubscriberMissLifePerMax")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): apDdSessionSubscriberGeneralGroup = apDdSessionSubscriberGeneralGroup.setStatus('current') if mibBuilder.loadTexts: apDdSessionSubscriberGeneralGroup.setDescription('A collection of Session objects generic to DD system.') apDDNotifObjectsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9148, 3, 12, 3, 2, 1)).setObjects(("APDD-MIB", "apDdDiameterAgentHostName"), ("APDD-MIB", "apDdDiameterIPPort"), ("APDD-MIB", "apDdDiameterAgentOriginHostName"), ("APDD-MIB", "apDdDiameterAgentOriginRealmName"), ("APDD-MIB", "apDdTransportType"), ("APDD-MIB", "apDdInterfaceStatusReason")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): apDDNotifObjectsGroup = apDDNotifObjectsGroup.setStatus('current') if mibBuilder.loadTexts: apDDNotifObjectsGroup.setDescription('A collection of mib objects accessible only to traps.') apDDNotificationsGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 9148, 3, 12, 3, 2, 2)).setObjects(("APDD-MIB", "apDdConnectionFailureTrap"), ("APDD-MIB", "apDdConnectionFailureClearTrap")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): apDDNotificationsGroup = apDDNotificationsGroup.setStatus('current') if mibBuilder.loadTexts: apDDNotificationsGroup.setDescription('A collection of traps defined for DD.') mibBuilder.exportSymbols("APDD-MIB", apDdSessionPeriodActive=apDdSessionPeriodActive, apDdClientTransLTHigh=apDdClientTransLTHigh, apDdAgentNoRouteFoundTotal=apDdAgentNoRouteFoundTotal, apDdAgentMsgReturnCodeClientRecent=apDdAgentMsgReturnCodeClientRecent, apDdSessMissLifeTotal=apDdSessMissLifeTotal, apDDMIBTabularObjects=apDDMIBTabularObjects, apDdHighTransRate=apDdHighTransRate, apDdMsgTypeServerReqRecent=apDdMsgTypeServerReqRecent, apDdUnsubscribePeriodTotal=apDdUnsubscribePeriodTotal, apDDNotifObjects=apDDNotifObjects, apDdLowTransRate=apDdLowTransRate, apDdMsgStatsReturnCodeEntry=apDdMsgStatsReturnCodeEntry, apDdAgentGenSocketsCPHigh=apDdAgentGenSocketsCPHigh, apDdMsgReturnCodeServerTotal=apDdMsgReturnCodeServerTotal, apDdMsgTypeInfoEntry=apDdMsgTypeInfoEntry, apDdAgentMsgTypeClientRespRetransPerMax=apDdAgentMsgTypeClientRespRetransPerMax, apDdAgentMsgReturnCodeServerRecent=apDdAgentMsgReturnCodeServerRecent, apDdSessTerminatedPeriodTotal=apDdSessTerminatedPeriodTotal, apDdAgentMsgStatsReturnCodeTable=apDdAgentMsgStatsReturnCodeTable, apDDMIBGeneralObjects=apDDMIBGeneralObjects, apDdPolicyMissLifeTotal=apDdPolicyMissLifeTotal, apDdMsgTypeServerReqTotal=apDdMsgTypeServerReqTotal, apDDConformance=apDDConformance, apDdAgentInboundConstraintsTotal=apDdAgentInboundConstraintsTotal, apDdAgentMsgTypeLatencyWindow=apDdAgentMsgTypeLatencyWindow, apDdAgentMsgTypeServerRetransTotal=apDdAgentMsgTypeServerRetransTotal, apDdAgentIndex=apDdAgentIndex, apDdSessInitPeriodActive=apDdSessInitPeriodActive, apDdAgentErrorStatusGroup=apDdAgentErrorStatusGroup, apDdPolicyHitPeriodTotal=apDdPolicyHitPeriodTotal, apDdSubscribeLifeHigh=apDdSubscribeLifeHigh, apDdGenConnectsCPTotal=apDdGenConnectsCPTotal, apDdSessInitPeriodTotal=apDdSessInitPeriodTotal, apDdMsgTypeIndex=apDdMsgTypeIndex, apDdAgentMsgTypeServerReqTotal=apDdAgentMsgTypeServerReqTotal, apDdDroppedMsgTotal=apDdDroppedMsgTotal, apDdMsgReturnCodeServerPerMax=apDdMsgReturnCodeServerPerMax, apDdRejectedMsgPerMax=apDdRejectedMsgPerMax, apDdAgentStatsEntry=apDdAgentStatsEntry, apDdAgentGenSocketsCPTotal=apDdAgentGenSocketsCPTotal, apDdAgentStatsGroup=apDdAgentStatsGroup, apDdSessTerminatedLifePerMax=apDdSessTerminatedLifePerMax, apDdMalformedMsgRecent=apDdMalformedMsgRecent, apDdPolicyMissPeriodHigh=apDdPolicyMissPeriodHigh, apDdAgentMsgTypeServerReqPerMax=apDdAgentMsgTypeServerReqPerMax, apDdSessMissPeriodTotal=apDdSessMissPeriodTotal, apDDNotificationObjects=apDDNotificationObjects, apDdGenConnectsCPHigh=apDdGenConnectsCPHigh, apDdGenSocketsLTTotal=apDdGenSocketsLTTotal, apDdAgentMsgTypeClientTimeoutPerMax=apDdAgentMsgTypeClientTimeoutPerMax, apDdAgentMsgTypeClientReqTotal=apDdAgentMsgTypeClientReqTotal, apDdOutboundConstraintsPerMax=apDdOutboundConstraintsPerMax, apDdSessEstablishedLifeHigh=apDdSessEstablishedLifeHigh, apDDModule=apDDModule, apDdSessionLifePerMax=apDdSessionLifePerMax, apDdAgentClientTransCPTotal=apDdAgentClientTransCPTotal, apDdSubscribePeriodTotal=apDdSubscribePeriodTotal, apDdMsgReturnCodeClientTotal=apDdMsgReturnCodeClientTotal, apDdClientTransLTTotal=apDdClientTransLTTotal, apDdMsgTypeServerRespRetransRecent=apDdMsgTypeServerRespRetransRecent, apDdTransportType=apDdTransportType, apDdMsgTypeServerRespRetransTotal=apDdMsgTypeServerRespRetransTotal, apDdAgentGenConnectsLTPerMax=apDdAgentGenConnectsLTPerMax, apDdMsgTypeStatsTable=apDdMsgTypeStatsTable, apDdInterfaceStatsGroup=apDdInterfaceStatsGroup, apDdIntfErrorStatusGroup=apDdIntfErrorStatusGroup, apDdMsgReturnCodeServerRecent=apDdMsgReturnCodeServerRecent, apDdSubscriberLifeTotal=apDdSubscriberLifeTotal, apDdSessTimeoutPeriodTotal=apDdSessTimeoutPeriodTotal, apDdSessInitLifeHigh=apDdSessInitLifeHigh, apDdMsgTypeClientRetransPerMax=apDdMsgTypeClientRetransPerMax, apDdAgentServerTransCPHigh=apDdAgentServerTransCPHigh, apDdMsgTypeServerRetransPerMax=apDdMsgTypeServerRetransPerMax, apDdSessionLifeHigh=apDdSessionLifeHigh, apDdNoRouteFoundRecent=apDdNoRouteFoundRecent, apDdAgentMsgTypeClientRespRetransTotal=apDdAgentMsgTypeClientRespRetransTotal, apDdAgentOutboundConstraintsTotal=apDdAgentOutboundConstraintsTotal, apDDNotifObjectsGroup=apDDNotifObjectsGroup, apDdInboundConstraintsTotal=apDdInboundConstraintsTotal, apDdSessInitPeriodHigh=apDdSessInitPeriodHigh, apDdClientTransCPHigh=apDdClientTransCPHigh, apDdMsgTypeClientThrottledRecent=apDdMsgTypeClientThrottledRecent, apDdMsgTypeClientThrottledPerMax=apDdMsgTypeClientThrottledPerMax, apDdClientTransCPTotal=apDdClientTransCPTotal, apDdGenConnectsLTPerMax=apDdGenConnectsLTPerMax, apDdSessionPeriodTotal=apDdSessionPeriodTotal, apDdSessErrorsLifeTotal=apDdSessErrorsLifeTotal, apDdAgentGenConnectsCPHigh=apDdAgentGenConnectsCPHigh, apDdAgentMsgStatsReturnCodeEntry=apDdAgentMsgStatsReturnCodeEntry, apDdDiameterAgentOriginRealmName=apDdDiameterAgentOriginRealmName, apDdSubscriberMissPeriodTotal=apDdSubscriberMissPeriodTotal, apDdMsgTypeServerRetransTotal=apDdMsgTypeServerRetransTotal, apDdSessTerminatedLifeTotal=apDdSessTerminatedLifeTotal, apDdAgentNoRouteFoundPerMax=apDdAgentNoRouteFoundPerMax, apDdAgentMsgTypeStatsTable=apDdAgentMsgTypeStatsTable, apDdConnectionFailureClearTrap=apDdConnectionFailureClearTrap, apDdDroppedMsgRecent=apDdDroppedMsgRecent, apDdPolicyHitLifeHigh=apDdPolicyHitLifeHigh, apDdServerTransLTHigh=apDdServerTransLTHigh, apDdMsgTypeStatsEntry=apDdMsgTypeStatsEntry, apDdMsgTypeLatencyWindow=apDdMsgTypeLatencyWindow, apDdMsgStatsReturnCodeTable=apDdMsgStatsReturnCodeTable, apDdSessTerminatedPeriodActive=apDdSessTerminatedPeriodActive, apDdGenSocketsCPTotal=apDdGenSocketsCPTotal, apDdSessionPeriodHigh=apDdSessionPeriodHigh, apDdAgentServerTransCPActive=apDdAgentServerTransCPActive, apDdMsgReturnCodeClientRecent=apDdMsgReturnCodeClientRecent, apDdGenConnectsLTTotal=apDdGenConnectsLTTotal, apDdAgentMsgTypeStatsEntry=apDdAgentMsgTypeStatsEntry, apDdInterfaceIndex=apDdInterfaceIndex, apDdMsgTypeClientRetransTotal=apDdMsgTypeClientRetransTotal, apDdAgentGenConnectsLTTotal=apDdAgentGenConnectsLTTotal, apDdSessEstablishedPeriodActive=apDdSessEstablishedPeriodActive, apDdAgentMsgTypeServerRespRetransTotal=apDdAgentMsgTypeServerRespRetransTotal, apDdAgentClientTransLTTotal=apDdAgentClientTransLTTotal, apDdAgentErrorStatusTable=apDdAgentErrorStatusTable, apDdGeneralGroup=apDdGeneralGroup, apDdPolicyHitLifeTotal=apDdPolicyHitLifeTotal, apDdAgentNoRouteFoundRecent=apDdAgentNoRouteFoundRecent, apDdDiameterIPPort=apDdDiameterIPPort, apDdAgentClientTransCPHigh=apDdAgentClientTransCPHigh, apDdMsgTypeInfoTable=apDdMsgTypeInfoTable, apDdServerTransCPTotal=apDdServerTransCPTotal, apDDMIBObjects=apDDMIBObjects, apDDNotificationsGroup=apDDNotificationsGroup, apDdAgentMsgTypeServerRespRetransRecent=apDdAgentMsgTypeServerRespRetransRecent, apDdServerTransLTTotal=apDdServerTransLTTotal, apDdGenSocketsCPActive=apDdGenSocketsCPActive, apDdPolicyMissLifePerMax=apDdPolicyMissLifePerMax, apDdAgentGenSocketsLTPerMax=apDdAgentGenSocketsLTPerMax, apDdRejectedMsgTotal=apDdRejectedMsgTotal, apDdConnectionFailureTrap=apDdConnectionFailureTrap, apDdMsgTypeServerRespRetransPerMax=apDdMsgTypeServerRespRetransPerMax, apDdAgentMalformedMsgTotal=apDdAgentMalformedMsgTotal, apDdMsgTypeClientTimeoutRecent=apDdMsgTypeClientTimeoutRecent, apDdSessEstablishedPeriodTotal=apDdSessEstablishedPeriodTotal, apDdAgentGenSocketsCPActive=apDdAgentGenSocketsCPActive, apDdSubscribePeriodHigh=apDdSubscribePeriodHigh, apDdMsgTypeClientRespRetransTotal=apDdMsgTypeClientRespRetransTotal, apDdPolicyHitLifePerMax=apDdPolicyHitLifePerMax, apDdSubscribeLifeTotal=apDdSubscribeLifeTotal, apDdSessInitLifeTotal=apDdSessInitLifeTotal, apDdMsgTypeClientThrottledTotal=apDdMsgTypeClientThrottledTotal, apDdSubscribeLifePerMax=apDdSubscribeLifePerMax, apDdAgentServerTransCPTotal=apDdAgentServerTransCPTotal, apDdAgentMsgTypeClientRetransPerMax=apDdAgentMsgTypeClientRetransPerMax, apDdAgentMsgTypeStatsGroup=apDdAgentMsgTypeStatsGroup, apDdGenConnectsCPActive=apDdGenConnectsCPActive, apDdSessInitLifePerMax=apDdSessInitLifePerMax, apDdInboundConstraintsPerMax=apDdInboundConstraintsPerMax, apDdDiameterAgentHostName=apDdDiameterAgentHostName, apDdInterfaceStatusReason=apDdInterfaceStatusReason, apDdUnsubscribeLifeTotal=apDdUnsubscribeLifeTotal, apDdMsgStatsReturnCodeGroup=apDdMsgStatsReturnCodeGroup, apDdAgentGenConnectsLTHigh=apDdAgentGenConnectsLTHigh, apDdAgentMsgTypeClientRetransTotal=apDdAgentMsgTypeClientRetransTotal, apDdAgentMsgTypeMaximumLatency=apDdAgentMsgTypeMaximumLatency, apDdAgentMsgStatsReturnCodeGroup=apDdAgentMsgStatsReturnCodeGroup, apDdAgentClientTransLTPerMax=apDdAgentClientTransLTPerMax, apDdMsgTypeStatsGroup=apDdMsgTypeStatsGroup, apDdMsgTypeMaximumLatency=apDdMsgTypeMaximumLatency, apDdAgentDroppedMsgTotal=apDdAgentDroppedMsgTotal, apDdAgentMsgTypeClientThrottledRecent=apDdAgentMsgTypeClientThrottledRecent, apDdAgentMsgTypeClientThrottledPerMax=apDdAgentMsgTypeClientThrottledPerMax, apDdAgentGeneralGroup=apDdAgentGeneralGroup, apDdMsgTypeClientRetransRecent=apDdMsgTypeClientRetransRecent, apDdPolicyMissLifeHigh=apDdPolicyMissLifeHigh, apDDNotificationGroups=apDDNotificationGroups, apDdAgentMsgTypeClientTimeoutTotal=apDdAgentMsgTypeClientTimeoutTotal, apDdAgentMalformedMsgPerMax=apDdAgentMalformedMsgPerMax, apDdSessEstablishedLifeTotal=apDdSessEstablishedLifeTotal, apDdNoRouteFoundPerMax=apDdNoRouteFoundPerMax, apDdInterfaceStatsTable=apDdInterfaceStatsTable, apDdMsgTypeClientReqRecent=apDdMsgTypeClientReqRecent, apDdMalformedMsgTotal=apDdMalformedMsgTotal, apDdUnsubscribePeriodActive=apDdUnsubscribePeriodActive, apDdMsgTypeClientReqPerMax=apDdMsgTypeClientReqPerMax, apDdAgentStatsTable=apDdAgentStatsTable, apDdMsgTypeClientRespRetransPerMax=apDdMsgTypeClientRespRetransPerMax, apDdAgentServerTransLTHigh=apDdAgentServerTransLTHigh, apDdAgentServerTransLTPerMax=apDdAgentServerTransLTPerMax, apDdAgentMsgReturnCodeServerPerMax=apDdAgentMsgReturnCodeServerPerMax, apDdAgentMsgReturnCodeClientTotal=apDdAgentMsgReturnCodeClientTotal, apDdAgentRealmName=apDdAgentRealmName, apDdMsgReturnCodeInfoTable=apDdMsgReturnCodeInfoTable, apDdAgentMsgTypeServerRetransRecent=apDdAgentMsgTypeServerRetransRecent, apDdInterfaceNumber=apDdInterfaceNumber, apDdSessTerminatedPeriodHigh=apDdSessTerminatedPeriodHigh, apDdSessMissLifePerMax=apDdSessMissLifePerMax, apDdPolicyMissPeriodTotal=apDdPolicyMissPeriodTotal, apDdMsgTypeClientRespRetransRecent=apDdMsgTypeClientRespRetransRecent, apDdAgentGenSocketsLTTotal=apDdAgentGenSocketsLTTotal, apDDNotifPrefix=apDDNotifPrefix, apDdErrorStatusGroup=apDdErrorStatusGroup, apDdAgentInboundConstraintsRecent=apDdAgentInboundConstraintsRecent, apDdInterfaceRealmName=apDdInterfaceRealmName, apDdSessionSubscriberGeneralGroup=apDdSessionSubscriberGeneralGroup, apDdSubscriberPeriodHigh=apDdSubscriberPeriodHigh, apDdMsgReturnCodeInfoEntry=apDdMsgReturnCodeInfoEntry, apDdMsgTypeClientTimeoutTotal=apDdMsgTypeClientTimeoutTotal, apDDObjectGroups=apDDObjectGroups, apDdAgentMsgTypeServerReqRecent=apDdAgentMsgTypeServerReqRecent, apDdPolicyMissPeriodActive=apDdPolicyMissPeriodActive, apDdMsgTypeClientReqTotal=apDdMsgTypeClientReqTotal, apDdErrorStatusEntry=apDdErrorStatusEntry, apDdAgentDroppedMsgRecent=apDdAgentDroppedMsgRecent, apDdAgentMsgTypeServerRespRetransPerMax=apDdAgentMsgTypeServerRespRetransPerMax, apDdSubscriberMissLifeTotal=apDdSubscriberMissLifeTotal, apDdErrorStatusTable=apDdErrorStatusTable, apDdMsgReturnCodeClientPerMax=apDdMsgReturnCodeClientPerMax, apDdAgentDroppedMsgPerMax=apDdAgentDroppedMsgPerMax, apDdGenSocketsCPHigh=apDdGenSocketsCPHigh, apDdOutboundConstraintsRecent=apDdOutboundConstraintsRecent, apDdSubscriberLifePerMax=apDdSubscriberLifePerMax, apDdMsgTypeServerReqPerMax=apDdMsgTypeServerReqPerMax, apDdAgentNumber=apDdAgentNumber, apDdAgentServerTransLTTotal=apDdAgentServerTransLTTotal, apDdAgentRejectedMsgPerMax=apDdAgentRejectedMsgPerMax, apDdSessEstablishedLifePerMax=apDdSessEstablishedLifePerMax, apDdAgentMalformedMsgRecent=apDdAgentMalformedMsgRecent, apDdAgentOutboundConstraintsRecent=apDdAgentOutboundConstraintsRecent, apDdAgentMsgTypeClientTimeoutRecent=apDdAgentMsgTypeClientTimeoutRecent, apDdClientTransLTPerMax=apDdClientTransLTPerMax, apDdAgentMsgTypeClientThrottledTotal=apDdAgentMsgTypeClientThrottledTotal, apDdSubscriberLifeHigh=apDdSubscriberLifeHigh, apDdPolicyHitPeriodHigh=apDdPolicyHitPeriodHigh, apDdClientTransCPActive=apDdClientTransCPActive, apDdSessTimeoutLifePerMax=apDdSessTimeoutLifePerMax, apDdMsgTypeMsgName=apDdMsgTypeMsgName, apDdAgentRejectedMsgRecent=apDdAgentRejectedMsgRecent, apDdAgentGenConnectsCPTotal=apDdAgentGenConnectsCPTotal, apDdSessTimeoutLifeTotal=apDdSessTimeoutLifeTotal, apDdAgentInboundConstraintsPerMax=apDdAgentInboundConstraintsPerMax, apDdCurrentTransRate=apDdCurrentTransRate, apDdAgentClientTransCPActive=apDdAgentClientTransCPActive, apDdServerTransLTPerMax=apDdServerTransLTPerMax, apDdMsgTypeClientTimeoutPerMax=apDdMsgTypeClientTimeoutPerMax, apDdMalformedMsgPerMax=apDdMalformedMsgPerMax, apDdSessErrorsPeriodTotal=apDdSessErrorsPeriodTotal, apDdAgentErrorStatusEntry=apDdAgentErrorStatusEntry, apDdSessionLifeTotal=apDdSessionLifeTotal, apDdMsgReturnCodeIndex=apDdMsgReturnCodeIndex, apDdAgentRejectedMsgTotal=apDdAgentRejectedMsgTotal, apDdNoRouteFoundTotal=apDdNoRouteFoundTotal, apDdAgentMsgTypeClientReqPerMax=apDdAgentMsgTypeClientReqPerMax, apDdInboundConstraintsRecent=apDdInboundConstraintsRecent, apDdMsgTypeAverageLatency=apDdMsgTypeAverageLatency, apDdMsgReturnCodeName=apDdMsgReturnCodeName, apDdAgentMsgTypeServerRetransPerMax=apDdAgentMsgTypeServerRetransPerMax, apDDNotifications=apDDNotifications, apDdServerTransCPActive=apDdServerTransCPActive, apDdSessTerminatedLifeHigh=apDdSessTerminatedLifeHigh, apDdSessEstablishedPeriodHigh=apDdSessEstablishedPeriodHigh, apDdDroppedMsgPerMax=apDdDroppedMsgPerMax) mibBuilder.exportSymbols("APDD-MIB", apDdAgentMsgReturnCodeServerTotal=apDdAgentMsgReturnCodeServerTotal, apDdGenSocketsLTPerMax=apDdGenSocketsLTPerMax, apDdAgentMsgReturnCodeClientPerMax=apDdAgentMsgReturnCodeClientPerMax, apDdAgentGenSocketsLTHigh=apDdAgentGenSocketsLTHigh, apDdAgentMsgTypeAverageLatency=apDdAgentMsgTypeAverageLatency, apDdGenConnectsLTHigh=apDdGenConnectsLTHigh, apDdUnsubscribeLifePerMax=apDdUnsubscribeLifePerMax, apDdServerTransCPHigh=apDdServerTransCPHigh, apDdInterfaceStatsEntry=apDdInterfaceStatsEntry, apDdAgentGenConnectsCPActive=apDdAgentGenConnectsCPActive, apDdAgentMsgTypeClientRetransRecent=apDdAgentMsgTypeClientRetransRecent, apDdAgentMsgTypeClientRespRetransRecent=apDdAgentMsgTypeClientRespRetransRecent, apDdDiameterAgentOriginHostName=apDdDiameterAgentOriginHostName, apDdAgentOutboundConstraintsPerMax=apDdAgentOutboundConstraintsPerMax, PYSNMP_MODULE_ID=apDDModule, apDdAgentClientTransLTHigh=apDdAgentClientTransLTHigh, apDdSubscriberMissLifePerMax=apDdSubscriberMissLifePerMax, apDdSubscribePeriodActive=apDdSubscribePeriodActive, apDdSubscriberPeriodActive=apDdSubscriberPeriodActive, apDdRejectedMsgRecent=apDdRejectedMsgRecent, apDdSessErrorsLifePerMax=apDdSessErrorsLifePerMax, apDdUnsubscribeLifeHigh=apDdUnsubscribeLifeHigh, apDdMsgTypeServerRetransRecent=apDdMsgTypeServerRetransRecent, apDdUnsubscribePeriodHigh=apDdUnsubscribePeriodHigh, apDdAgentMsgTypeClientReqRecent=apDdAgentMsgTypeClientReqRecent, apDdSubscriberPeriodTotal=apDdSubscriberPeriodTotal, apDdGenSocketsLTHigh=apDdGenSocketsLTHigh, apDdOutboundConstraintsTotal=apDdOutboundConstraintsTotal, apDdPolicyHitPeriodActive=apDdPolicyHitPeriodActive)
class FpolicyServerStatus(basestring): """ Status Possible values: <ul> <li> "connected" - Server Connected, <li> "disconnected" - Server Disconnected, <li> "connecting" - Connecting Server, <li> "disconnecting" - Disconnecting Server </ul> """ @staticmethod def get_api_name(): return "fpolicy-server-status"
class RemoveAmountController: def __init__(self, remove_amount_use_case): self.remove_amount_use_case = remove_amount_use_case def route(self, body): if body is not None: product_id = body["id"] if "id" in body else None amount_to_remove = body["amount_to_remove"] if "amount_to_remove" in body else None response = self.remove_amount_use_case.remove_amount(product_id=product_id, amount_to_remove=amount_to_remove) return response return {"data": None, "status": 400, "errors": ["Requisição inválida"]}
# Common configuration options # Annotation categories for COCO output (TODO: move to different file) COCO_CATEGORIES = [ { "id": 0, "name": "Paragraph", "supercategory": None }, { "id": 1, "name": "Title", "supercategory": None }, { "id": 2, "name": "ListItem", "supercategory": None }, { "id": 3, "name": "Table", "supercategory": None }, { "id": 4, "name": "Figure", "supercategory": None }, { "id": 5, "name": "Meta", "supercategory": None }, { "id": 6, "name": "Reference", "supercategory": None }, { "id": 7, "name": "Footnote", "supercategory": None }, { "id": 8, "name": "TableOfContents", "supercategory": None }, { "id": 9, "name": "Caption", "supercategory": None }, { "id": 10, "name": "Formula", "supercategory": None }, { "id": 11, "name": "Code", "supercategory": None }, { "id": 12, "name": "Other", "supercategory": None }, ] # Mapping from structure types to annotation labels STRUCT_TYPE_TO_LABEL_MAP = { 'P': 'Paragraph', 'LI': 'ListItem', 'H1': 'Title', 'H2': 'Title', 'H3': 'Title', 'H4': 'Title', 'H5': 'Title', 'H6': 'Title', 'TOC': 'TableOfContents', 'TOCI': 'TableOfContents', # TocItem 'Table': 'Table', 'Figure': 'Figure', 'Footnote': 'Footnote', 'Note': 'Footnote', } # Colors for annotations LABEL_TO_HEX_COLOR_MAP = { 'Paragraph': '#24DD24', 'Title': '#6FDECD', 'ListItem': '#D0EC37', 'Table' : '#EC3737', 'TableOfContents': '#DDBD24', 'TocItem': '#CCAD14', 'Figure': '#375BEC', 'Reference': '#EC9937', 'Footnote': '#777777', 'Note': '#777777', 'Caption': '#E186C0', } LABEL_TO_COLOR_MAP = { k: (int(v[1:3],16)/255, int(v[3:5],16)/255, int(v[5:7],16)/255) for k, v in LABEL_TO_HEX_COLOR_MAP.items() } LABEL_FONT_NAME = 'Courier' LABEL_FONT_SIZE = 6
''' Example-related classes. @author: anze.vavpetic@ijs.si ''' class Example: ''' Represents an example with its score, label, id and annotations. ''' ClassLabeled = 'class' Ranked = 'ranked' def __init__(self, id, label, score, annotations=[], weights={}): self.id = id self.label = label self.score = score if not type(score) in [str]: self.target_type = Example.Ranked else: self.target_type = Example.ClassLabeled self.annotations = annotations self.weights = weights def __str__(self): if self.target_type == Example.Ranked: return '<id=%d, score=%.5f, label=%s>' % (self.id, self.score, self.label) else: return '<id=%d, class=%s, label=%s>' % (self.id, self.score, self.label)
#!/usr/local/bin/python3 """Task A DNA sequence can be represented as a string consisting of the letters A, C, G and T, which correspond to the types of successive nucleotides in the sequence. Each nucleotide has an impact factor, which is an integer. Nucleotides of types A, C, G and T have impact factors of 1, 2, 3 and 4, respectively. You are going to answer several queries of the form: What is the minimal impact factor of nucleotides contained in a particular part of the given DNA sequence? The DNA sequence is given as a non-empty string S = S[0]S[1]...S[N-1] consisting of N characters. There are M queries, which are given in non-empty arrays P and Q, each consisting of M integers. The K-th query (0 ≤ K < M) requires you to find the minimal impact factor of nucleotides contained in the DNA sequence between positions P[K] and Q[K] (inclusive). For example, consider string S = CAGCCTA and arrays P, Q such that: P[0] = 2 Q[0] = 4 P[1] = 5 Q[1] = 5 P[2] = 0 Q[2] = 6 The answers to these M = 3 queries are as follows: The part of the DNA between positions 2 and 4 contains nucleotides G and C (twice), whose impact factors are 3 and 2 respectively, so the answer is 2. The part between positions 5 and 5 contains a single nucleotide T, whose impact factor is 4, so the answer is 4. The part between positions 0 and 6 (the whole string) contains all nucleotides, in particular nucleotide A whose impact factor is 1, so the answer is 1. Write a function: def solution(S, P, Q) that, given a non-empty string S consisting of N characters and two non-empty arrays P and Q consisting of M integers, returns an array consisting of M integers specifying the consecutive answers to all queries.""" def prefix_dna(S): arr = [0] * (len(S) + 1) for index, value in enumerate(arr): arr[index] = {} if index == 0: arr[index]['A'] = arr[index]['C'] = arr[index]['G'] = arr[index]['T'] = 0 continue arr[index]['A'] = arr[index-1]['A'] + (1 if S[index-1] == 'A' else 0) arr[index]['C'] = arr[index-1]['C'] + (1 if S[index-1] == 'C' else 0) arr[index]['G'] = arr[index-1]['G'] + (1 if S[index-1] == 'G' else 0) arr[index]['T'] = arr[index-1]['T'] + (1 if S[index-1] == 'T' else 0) return arr def solution(S, P, Q): nucleotides = {'A': 1, 'C': 2, 'G': 3, 'T': 4} arr = prefix_dna(S) M = len(P) result = [] for index in range(M): value_Q = arr[Q[index]+1] value_P = arr[P[index]] if value_Q['A'] - value_P['A'] > 0: result.append(nucleotides['A']) elif value_Q['C'] - value_P['C'] > 0: result.append(nucleotides['C']) elif value_Q['G'] - value_P['G'] > 0: result.append(nucleotides['G']) elif value_Q['T'] - value_P['T'] > 0: result.append(nucleotides['T']) return result
""" Reach a Number You are standing at position 0 on an infinite number line. There is a goal at position target. On each move, you can either go left or right. During the n-th move (starting from 1), you take n steps. Return the minimum number of steps required to reach the destination. Example 1: Input: target = 3 Output: 2 Explanation: On the first move we step from 0 to 1. On the second step we step from 1 to 3. Example 2: Input: target = 2 Output: 3 Explanation: On the first move we step from 0 to 1. On the second move we step from 1 to -1. On the third move we step from -1 to 2. Note: target will be a non-zero integer in the range [-10^9, 10^9]. """ # approach: formula: (n^2 + n) / 2 # runtime: O(n^1/2) # memory: O(1) class Solution: def reachNumber(self, target: int) -> int: # initialize values steps = 0 target = abs(target) total = 0 # increment step size and total until total >= target while total < target: steps += 1 total += steps # if difference is even or non-existent: target can be reached in steps if (total - target) % 2 == 0: return steps # difference is odd, but steps are even: 1 extra step to adjust if steps % 2 == 0: return steps + 1 # difference is odd, and steps are odd: 2 extra steps to adjust return steps + 2
class SparseVector: def __init__(self, nums: List[int]): # self.data = {} # for idx, val in enumerate(nums): # if val > 0: # self.data[idx]=val self.data = [] for idx, val in enumerate(nums): if val > 0: self.data.append((idx,val)) # Return the dotProduct of two sparse vectors def dotProduct(self, vec: 'SparseVector') -> int: # ans = 0 # for idx, val in self.data: # if idx in vec.data: # ans += self.data[idx]*vec.data[idx] # return ans ans = 0 i1,i2=0,0 while i1<len(self.data) and i2<len(vec.data): if self.data[i1][0]==vec.data[i2][0]: ans += self.data[i1][1] * vec.data[i2][1] i1+=1 i2+=1 elif self.data[i1][0]<vec.data[i2][0]: i1+=1 else: i2+=1 return ans # Your SparseVector object will be instantiated and called as such: # v1 = SparseVector(nums1) # v2 = SparseVector(nums2) # ans = v1.dotProduct(v2)
class FirstHundredGenerator(): def __init__(self): self.number = 0 def __next__(self): #Permite hacer next(object) if self.number < 100: current = self.number self.number += 1 # Incrementa pero devuelve el anterior return current else: raise StopIteration() # Para especificar que ya se acabó el generador my_gen = FirstHundredGenerator() print(next(my_gen)) print(next(my_gen))
class Colors(): """ Colors which boil down to RGB tuples """ Black = (0, 0, 0) Medium_Purple = (106, 90, 205) Neon_Cyan = (8, 247, 254) Neon_Green = (57, 255, 20) Neon_Magenta = (255, 29, 206) Neon_Orange = (252, 76, 2) Neon_Yellow = (255, 239, 0) Red = (255, 0, 0) White = (255, 255, 255)
__author__ = 'kemi' # Plugin globals SERVICE_COMMANDS = 'service.commands.' PACKAGE_COMMANDS = 'package.commands' INSTALL = 'install ' REMOVE = 'remove ' # Install commands APT_GET = 'sudo apt-get -y ' APT_GET_UPDATE = 'sudo apt-get update' DPKG = 'sudo dpkg -i ' YUM = 'sudo yum -y ' APT_SOURCELIST_DIR = '/etc/apt/sources.list.d/' YUM_REPOS_DIR = '/etc/yum.repos.d/' # Services START_SERVICE_COMMAND = 'sudo service {0} start ' STOP_SERVICE_COMMAND = 'sudo service {0} stop ' RESTART_SERVICE_COMMAND = 'sudo service {0} restart '
def is_palindrome(text) : """ Takes in a string and determines if palindrome. Returns true or false. """ if len(text) == 1 : return True elif len(text) == 2 and text[0] == text[-1] : return True elif text[0] != text[-1] : return False elif text[0] == text[-1] : is_palindrome(text[1:-1]) return True # Main Program: message = input("Give me a message: ") if is_palindrome(message) == True: print('"{}" is a palindrome.'.format(message)) elif is_palindrome(message) == False: print('"{}" is not a palindrome.'.format(message))
''' Parse curry (lisp) code. ''' def remove_comment(line): if ';' not in line: return line else: return line[:line.find(';')] def typify(item): ''' Error-free conversion of an abitrary AST element into typed versions i.e. ['X', '1'] becomes ['X', 1] where the second element is converted str->int ''' try: return int(item) except ValueError: try: return float(item) except ValueError: return item except TypeError: return [typify(subitem) for subitem in item] def parse(item): ''' item is the raw text of a q-lisp file Comments are removed, and then the parentheses are parsed, i.e. (if (= c0 1) (X 0) (X 1)) becomes the python list: ['if', ['=', 'c0', '1'], ['X', '0'], ['X', '1']] ''' cleaned = (remove_comment(line) for line in item.split('\n')) item = '\n'.join(line for line in cleaned if line != '') # Strip comments stack = [] depth = 0 inner = '' def add(item): current = stack for _ in range(depth): current = current[-1] if isinstance(item, str): for subitem in item.split(): current.append(subitem) else: current.append(item) for character in item.strip(): if character == '(': if inner.strip() != '': add(inner.strip()) inner = '' add([]) depth += 1 elif character == ')': add(inner.strip()) depth -= 1 inner = '' else: inner += character return stack
#!/usr/local/bin/python class ParsingExpression(object): def __repr__(self): return self.__str__() def __or__(self,right): return Ore(self, pe(right)) def __and__(self,right): return seq(self,pe(right)) def __xor__(self,right): return seq(self,lfold("", pe(right))) def __rand__(self,left): return seq(pe(left), self) def __add__(self,right): return seq(Many1(self),pe(right)) def __mul__(self,right): return seq(Many(self),pe(right)) def __truediv__ (self, right): return Ore(self, pe(right)) def __invert__(self): return Not(self) def __neq__(self): return Not(self) def __pos__(self): return And(self) def setg(self, peg): if hasattr(self, 'inner'): self.inner.setg(peg) if hasattr(self, 'left'): self.left.setg(peg) self.right.setg(peg) class Empty(ParsingExpression): def __str__(self): return "''" EMPTY = Empty() class Char(ParsingExpression): __slots__ = ['a'] def __init__(self, a): self.a = a def __str__(self): return "'" + quote_str(self.a) + "'" class Range(ParsingExpression): __slots__ = ['chars', 'ranges'] def __init__(self, *ss): chars = [] ranges = [] for s in ss : if len(s) == 3 and s[1] is '-': ranges.append((s[0], s[2])) else: for c in s: chars.append(c) self.chars = tuple(chars) self.ranges = tuple(ranges) def __str__(self): l = tuple(map(lambda x: quote_str(x[0], ']')+'-'+quote_str(x[1], ']'), self.ranges)) return "[" + ''.join(l) + quote_str(self.chars, ']') + "]" class Any(ParsingExpression): def __str__(self): return '.' ANY = Any() class Ref(ParsingExpression): __slots__ = ['peg', 'name'] def __init__(self, name, peg = None): self.name = name self.peg = peg def __str__(self): return str(self.name) def setg(self, peg): self.peg = peg def isNonTerminal(self): return hasattr(self.peg, self.name) def deref(self): return getattr(self.peg, self.name).inner def prop(self): return getattr(self.peg, self.name) def getmemo(self,prefix): return self.peg.getmemo(prefix+self.name) def setmemo(self,prefix,value): return self.peg.setmemo(prefix+self.name,value) class Seq(ParsingExpression): __slots__ = ['left', 'right'] def __init__(self, left, right): self.left = pe(left) self.right = pe(right) def __str__(self): return quote_pe(self.left, inSeq) + ' ' + quote_pe(self.right, inSeq) def flatten(self, ls): if isinstance(self.left, Seq): self.left.flatten(ls) else: ls.append(self.left) if isinstance(self.right, Seq): self.right.flatten(ls) else: ls.append(self.right) return ls class Ore(ParsingExpression): __slots__ = ['left', 'right'] def __init__(self, left, right): self.left = pe(left) self.right = pe(right) def __str__(self): if self.right == EMPTY: return quote_pe(self.left, inUnary) + '?' return str(self.left) + ' / ' + str(self.right) def flatten(self, ls): if isinstance(self.left, Ore): self.left.flatten(ls) else: ls.append(self.left) if isinstance(self.right, Ore): self.right.flatten(ls) else: ls.append(self.right) return ls class Alt(ParsingExpression): __slots__ = ['left', 'right'] def __init__(self, left, right): self.left = pe(left) self.right = pe(right) def __str__(self): return str(self.left) + ' | ' + str(self.right) def flatten(self, ls): if isinstance(self.left, Alt): self.left.flatten(ls) else: ls.append(self.left) if isinstance(self.right, Alt): self.right.flatten(ls) else: ls.append(self.right) return ls class And(ParsingExpression): __slots__ = ['inner'] def __init__(self, inner): self.inner = pe(inner) def __str__(self): return '&' + quote_pe(self.inner, inUnary) class Not(ParsingExpression): __slots__ = ['inner'] def __init__(self, inner): self.inner = pe(inner) def __str__(self): return '!' + quote_pe(self.inner, inUnary) class Many(ParsingExpression): __slots__ = ['inner'] def __init__(self, inner): self.inner = pe(inner) def __str__(self): return quote_pe(self.inner, inUnary) + '*' class Many1(ParsingExpression): __slots__ = ['inner'] def __init__(self, inner): self.inner = pe(inner) def __str__(self): return quote_pe(self.inner, inUnary) + '+' def quote_pe(e, f): return '(' + str(e) + ')' if f(e) else str(e) def inSeq(e): return isinstance(e, Ore) or isinstance(e, Alt) def inUnary(e): return (isinstance(e, Ore) and e.right != EMPTY) or isinstance(e, Seq) or isinstance(e, Alt) def quote_str(e, esc = "'"): sb = [] for c in e: if c == '\n' : sb.append(r'\n') elif c == '\t' : sb.append(r'\t') elif c == '\\' : sb.append(r'\\') elif c == '\r' : sb.append(r'\r') elif c in esc : sb.append('\\' + c) else: sb.append(c) return "".join(sb) def pe(x): if x == 0 : return EMPTY if isinstance(x, str): if len(x) == 0: return EMPTY return Char(x) return x def ref(name): if name.find('/') != -1: return lor(list(map(ref, name.split('/')))) if name.find(' ') != -1: return lseq(list(map(ref, name.split(' ')))) if name.startswith('$'): return LinkAs("", Ref(name[1:])) return Ref(name) def seq(x,y): if isinstance(y, Empty): return x return Seq(x, y) def lseq(ls): if len(ls) > 1: return seq(ls[0], lseq(ls[1:])) if len(ls) == 1: return ls[0] return EMPTY def lor(ls): if len(ls) > 1: return Ore(ls[0], lor(ls[1:])) if len(ls) == 1: return ls[0] return EMPTY def lfold(ltag,e): if isinstance(e, Many) and isinstance(e.inner, TreeAs): return Many(lfold(ltag, e.inner)) if isinstance(e, Many1) and isinstance(e.inner, TreeAs): return Many1(lfold(ltag, e.inner)) if isinstance(e, Ore): return Ore(lfold(ltag, e.left), lfold(ltag, e.right)) if isinstance(e, TreeAs): return FoldAs(ltag, e.tag, pe(e.inner)) return e ## Tree Construction class TreeAs(ParsingExpression): __slots__ = ['tag', 'inner'] def __init__(self, tag, inner): self.tag = tag self.inner = pe(inner) def __str__(self): return self.tag + '{ ' + str(self.inner) + ' }' class LinkAs(ParsingExpression): __slots__ = ['tag', 'inner'] def __init__(self, tag, inner=None): self.tag = tag self.inner = pe(inner) def __str__(self): if self.tag == '': return '$' + quote_pe(self.inner, inUnary) return '(' + self.tag + '=>' + str(self.inner) + ')' def __le__(self, right): return LinkAs(self.tag, right) def __ge__(self, right): return LinkAs(self.tag, right) def __mod__(self, right): return ref(right) def __xor__(self,right): return lfold(self.tag, pe(right)) N = LinkAs("") class FoldAs(ParsingExpression): __slots__ = ['ltag', 'tag', 'inner'] def __init__(self, ltag, tag, inner): self.inner = pe(inner) self.ltag = ltag self.tag = tag def __str__(self): return self.ltag + '^' + self.tag +'{ ' + str(self.inner) + ' }' class Detree(ParsingExpression): __slots__ = ['inner'] def __init__(self, inner): self.inner = pe(inner) def __str__(self): return '@unit(' + str(self.inner) + ')' ''' @if(Bool) @symbol(Indent) @match(Indent) @exists(Indent, 'hoge') ''' class Meta(ParsingExpression): __slots__ = ['tag', 'inner', 'opt'] def __init__(self, tag, inner, opt = None): self.tag = tag self.inner = pe(inner) self.opt = opt def __str__(self): arg = ', ' + repr(self.opt) if self.opt != None else '' return self.tag + '(' + str(self.inner) + arg + ')' ''' class ParserContext: __slots__ = ['inputs', 'pos', 'headpos', 'ast'] def __init__(self, inputs, pos = 0): self.inputs = inputs self.pos = pos self.headpos = pos self.ast = None ''' # Rule class Rule(object): def __init__(self, name, inner): self.name = name self.inner = pe(inner) self.checked = False def __str__(self): return str(self.inner) def isConsumed(self): if not hasattr(self, 'nonnull'): self.nonnull = isAlwaysConsumed(self.inner) return self.nonnull def treeState(self): if not hasattr(self, 'ts'): self.ts = treeState(self.inner) return self.ts def checkRule(self): if not self.checked: s0 = str(self.inner) if isRec(self.inner, self.name, {}): checkRec(self.inner, self.name, {}) ts = treeState(self.inner) ts = treeCheck(self.inner, ts) s1 = str(self.inner) if s0 != s1: print(self.name, s0, s1) ## Grammar class PEG(object): def __init__(self, ns = None): self.ns77 = ns self.memo77 = {} self.example77 = [] def __getitem__(self, item): return getattr(self, item, None) def __setattr__(self, key, value): if isinstance(value, ParsingExpression): value.setg(self) if not isinstance(value, Rule): value = Rule(key, value) super().__setattr__(key, value) print(key, '=', value) if not hasattr(self, "start"): setattr(self, "start", value) else: super().__setattr__(key, value) def ns(self): return self.ns77 def hasmemo(self, key): return key in self.memo77 def getmemo(self, key): return self.memo77[key] if key in self.memo77 else None def setmemo(self, key, value): self.memo77[key] = value def example(self, prod, input, output = None): for name in prod.split(','): self.example77.append((name, input, output)) def testAll(self, combinator): p = {} test = 0 ok = 0 for testcase in self.example77: name, input, output = testcase if not name in p: p[name] = combinator(self, name) res = p[name](input) t = str(res).replace(" b'", " '") if output == None: print(name, input, '=>', t) else: test += 1 if t == output: print('OK', name, input) ok += 1 else: print('NG', name, input, output, '!=', t) if test > 0: print('OK', ok, 'FAIL', test - ok, ok / test * 100.0, '%') ## Properties def match(*ctags): def _match(func): name = ctags[-1] for ctag in ctags[:-1]: setattr(ctag, name, func) return func return _match def isRec(pe: ParsingExpression, name: str, visited : dict) -> bool: if isinstance(pe, Ref): if pe.name == name: return True if not pe.name in visited: visited[pe.name] = True return isRec(pe.deref(), name, visited) if hasattr(pe, 'inner'): return isRec(pe.inner, name, visited) if hasattr(pe, 'left'): res = isRec(pe.left, name, visited) return res if res else isRec(pe.right, name, visited) return False def checkRec(pe: ParsingExpression, name: str, visited : dict) -> bool: if hasattr(pe, 'left'): if isinstance(pe, Seq): return checkRec(pe.left, name, visited) and checkRec(pe.right, name, visited) else: #Ore, Alt c0 = checkRec(pe.left, name, visited) c1 = checkRec(pe.right, name, visited) return c0 or c1 if hasattr(pe, 'inner'): rec = checkRec(pe.inner, name, visited) return True if isinstance(pe, Not) or isinstance(pe, Many) or isinstance(pe, And) else rec if isinstance(pe, Ref): if pe.name == name: print("left recursion") if not pe.name in visited: visited[pe.name] = True checkRec(pe.deref(), name, visited) return not pe.prop().isConsumed() return isinstance(pe, Empty) # False if (Char,Range,Any) def isAlwaysConsumed(pe: ParsingExpression): if not hasattr(pe, 'cc'): @match(Char, Any, Range, 'cc') def consumed(pe): return True @match(Many, Not, And, Empty, 'cc') def consumed(pe): return False @match(Many1, LinkAs, TreeAs, FoldAs, Detree, Meta, 'cc') def unary(pe): return isAlwaysConsumed(pe.inner) @match(Seq, 'cc') def seq(pe): if not isAlwaysConsumed(pe.left): return False return isAlwaysConsumed(pe.right) @match(Ore, Alt, 'cc') def ore(pe): return isAlwaysConsumed(pe.left) and isAlwaysConsumed(pe.right) @match(Ref, 'cc') def memo(pe: Ref): if not pe.isNonTerminal(): return True key = 'null' + pe.name memoed = pe.getmemo('null') if memoed == None: pe.setmemo('null', True) memoed = isAlwaysConsumed(pe.deref()) pe.setmemo('null', memoed) return memoed return pe.cc() ## TreeState TUnit = 0 TTree = 1 TMut = 2 TFold = 3 def treeState(pe): if not hasattr(pe, 'ts'): @match(Char, Any, Range, Not, Detree, 'ts') def stateUnit(pe): return TUnit @match(TreeAs, 'ts') def stateTree(pe): return TTree @match(LinkAs, 'ts') def stateMut(pe): return TMut @match(FoldAs, 'ts') def stateFold(pe): return TFold @match(Seq, 'ts') def stateSeq(pe): ts0 = treeState(pe.left) return ts0 if ts0 != TUnit else treeState(pe.right) @match(Ore, Alt, 'ts') def stateAlt(pe): ts0 = treeState(pe.left) if ts0 != TUnit: return ts0 ts1 = treeState(pe.right) return TMut if ts1 == TTree else ts1 @match(Many, Many1, And, 'ts') def stateAlt(pe): ts0 = treeState(pe.inner) return TMut if ts0 == TTree else ts0 @match(Ref, 'ts') def memo(pe: Ref): if not pe.isNonTerminal(): return TUnit memoed = pe.getmemo('ts') if memoed == None: pe.setmemo('ts', TUnit) memoed = treeState(pe.deref()) pe.setmemo('ts', memoed) return memoed return pe.ts() def treeCheck(pe, ts): if not hasattr(pe, 'tc'): @match(ParsingExpression, 'tc') def checkEmpty(pe, ts): return pe @match(TreeAs, 'tc') def checkTree(pe, ts): if ts == TUnit: return treeCheck(pe.inner, TUnit) if ts == TTree: pe.inner = treeCheck(pe.inner, TMut) return pe if ts == TMut: pe.inner = treeCheck(pe.inner, TMut) return LinkAs('', pe) if ts == TFold: pe.inner = treeCheck(pe.inner, TMut) return FoldAs('', pe.tag, pe.inner) @match(LinkAs, 'tc') def checkLink(pe, ts): if ts == TUnit or ts == TFold: return treeCheck(pe.inner, TUnit) if ts == TTree: return treeCheck(pe.inner, TTree) if ts == TMut: ts0 = treeState(pe.inner) if ts0 == TUnit or ts0 == TFold: pe.inner = TreeAs('', treeCheck(pe.inner, TUnit)) if ts0 == TTree: pe.inner = treeCheck(pe.inner, TTree) if ts0 == TMut: pe.inner = TreeAs('', treeCheck(pe.inner, TMut)) return pe @match(FoldAs, 'tc') def checkFold(pe, ts): if ts == TUnit: return treeCheck(pe.inner, TUnit) if ts == TTree: pe.inner = treeCheck(pe.inner, TMut) return TreeAs(pe.tag, pe.inner) if ts == TMut: pe.inner = treeCheck(pe.inner, TMut) return LinkAs(pe.ltag, pe.inner) if ts == TFold: pe.inner = treeCheck(pe.inner, TMut) return pe @match(Seq, 'tc') def checkSeq(pe, ts): if ts == TUnit or ts == TMut or ts == TFold: pe.left = treeCheck(pe.left, ts) pe.right = treeCheck(pe.right, ts) return pe ts0 = treeState(pe.left) if ts0 == TUnit: pe.left = treeCheck(pe.left, TUnit) pe.right = treeCheck(pe.right, ts) return pe if ts0 == TTree: pe.left = treeCheck(pe.left, TTree) pe.right = treeCheck(pe.right, TFold) return pe @match(Ore, Alt, 'tc') def checkAlt(pe, ts): pe.left = treeCheck(pe.left, ts) pe.right = treeCheck(pe.right, ts) return pe @match(Many, Many1, 'tc') def checkMany(pe, ts): if ts == TUnit: pe.inner = treeCheck(pe.inner, TUnit) return pe if ts == TTree: pe.inner = treeCheck(pe.inner, TUnit) return TreeAs('', pe) if ts == TMut: ts0 = treeState(pe.inner) if ts0 == TUnit or ts0 == TFold: pe.inner = treeCheck(pe.inner, TUnit) if ts0 == TTree or ts0 == TMut: pe.inner = treeCheck(pe.inner, TMut) return pe if ts == TFold: pe.inner = treeCheck(pe.inner, TFold) return pe @match(Ref, 'tc') def checkRef(pe: Ref, ts): if not pe.isNonTerminal(): return pe ts0 = treeState(pe) if ts == ts0: return pe if ts == TUnit: Detree(pe) if ts == TTree: if ts0 == TUnit or ts0 == TMut: return TreeAs('', pe) if ts0 == TFold: return seq(TreeAs('', EMPTY), pe) if ts == TMut: if ts0 == TUnit: return pe if ts0 == TTree: return LinkAs('', pe) if ts0 == TFold: return LinkAs('', seq(TreeAs('', EMPTY), pe)) if ts == TFold: if ts0 == TUnit: return pe if ts0 == TTree: return FoldAs('', '', pe) if ts0 == TMut: return FoldAs('', '', TreeAs('', pe)) return pe.tc(ts) def testRules(g: PEG): for name in dir(g): if not name[0].isupper(): continue p = getattr(g, name) p.checkRule() ## TPEG def TPEGGrammar(g = None): if g == None: g = PEG('tpeg') # Preliminary __ = N % '__' _ = N % '_' EOS = N % 'EOS' g.Start = N%'__ Source EOF' g.EOF = ~ANY g.EOL = pe('\n') | pe('\r\n') | N%'EOF' g.COMMENT = '/*' & (~pe('*/') & ANY)* 0 & '*/' | '//' & (~(N%'EOL') & ANY)* 0 g._ = (Range(' \t') | N%'COMMENT')* 0 g.__ = (Range(' \t\r\n') | N%'COMMENT')* 0 g.S = Range(' \t') g.Source = TreeAs('Source', (N%'$Statement')*0) "EOS = _ (';' _ / EOL (S/COMMENT) _ / EOL )*" g.EOS = N%'_' & (';' & N%'_' | N%'EOL' & (N%'S' | N%'COMMENT') & N%'_' | N%'EOL')* 0 g.Statement = N%'Example/Production' g.Production = TreeAs('Production', N%'$Identifier __' & '=' & __ & (Range('/|') & __ |0) & N%'$Expression') & EOS g.Name = TreeAs('Name', N%'NAME') g.NAME = '"' & (pe(r'\"') | ~Range('\\"\n') & ANY)*0 & '"' | (~Range(' \t\r\n(,){};<>[|/*+?=^\'`') & ANY)+0 g.Example = TreeAs('Example', 'example' & N%'S _ $Names $Doc') & EOS g.Names = TreeAs('', N%'$Identifier _' & (Range(',&') & N%'_ $Identifier _')*0) Doc1 = TreeAs("Doc", (~(N%'DELIM EOL') & ANY)* 0) Doc2 = TreeAs("Doc", (~Range('\r\n') & ANY)*0) g.Doc = N%'DELIM' & (N%'S'*0) & N%'EOL' & Doc1 & N % 'DELIM' | Doc2 g.DELIM = pe("'''") g.Expression = N%'Choice' ^ (TreeAs('Alt', __ & '|' & _ & N%'$Expression')|0) g.Choice = N%'Sequence' ^ (TreeAs('Or', __ & '/' & _ & N%'$Choice')|0) g.SS = N%'S _' & ~(N%'EOL') | (N%'_ EOL')+0 & N%'S _' g.Sequence = N%'Predicate' ^ (TreeAs('Seq', N%'SS $Sequence')|0) g.Predicate = TreeAs('Not', '!' & N%'$Predicate') | TreeAs('And', '&' & N%'$Predicate') | TreeAs('Append', '$' & N%'_ $Predicate') | N%'Suffix' g.Suffix = N%'Term' ^ (TreeAs('Many', '*') | TreeAs('OneMore', '+') | TreeAs('Option', '?') | 0) g.Term = N%'Group/Char/Class/Any/Tree/Fold/BindFold/Bind/Func/Ref' g.Group = '(' & __ & N%'Expression/Empty' & __ & ')' g.Empty = TreeAs('Empty', EMPTY) g.Any = TreeAs('Any', '.') g.Char = "'" & TreeAs('Char', (r'\\' & ANY | ~Range("'\n") & ANY)*0) & "'" g.Class = '[' & TreeAs('Class', (r'\\' & ANY | ~Range("]") & ANY)*0) & ']' g.Tree = TreeAs('Tree', N%'Tag __' & (N%'$Expression __' | N%'$Empty') & '}' ) g.Fold = '^' & _ & TreeAs('Fold', N%'Tag __' & (N%'$Expression __' | N%'$Empty') & '}' ) g.Tag = (N%'$Identifier'|0) & '{' g.Identifier = TreeAs('Name', Range('A-Z', 'a-z', '@') & Range('A-Z', 'a-z', '0-9', '_.')*0) g.Bind = TreeAs('Bind', N%'$Var _' & '=>' & N%'_ $Expression') g.BindFold = TreeAs('Fold', N%'$Var _' & '^' & _ & N%'Tag __' & (N%'$Expression __' | N%'$Empty') & '}') g.Var = TreeAs('Name', Range('a-z', '$') & Range('A-Z', 'a-z', '0-9', '_')*0) g.Func = TreeAs('Func', N%'$Identifier' & '(' & (N%'$Expression _' & ',' & __)* 0 & N%'$Expression _' & ')') g.Ref = N%'Name' # Example g.example("Name", "abc") g.example("Name", '"abc"') g.example("COMMENT", "/*hoge*/hoge", "[# '/*hoge*/']") g.example("COMMENT", "//hoge\nhoge", "[# '//hoge']") g.example("Ref,Term,Expression", "a", "[#Name 'a']") g.example("Char,Expression", "''", "[#Char '']") g.example("Char,Expression", "'a'", "[#Char 'a']") g.example("Name,Expression", "\"a\"", "[#Name '\"a\"']") g.example("Class,Expression", "[a]", "[#Class 'a']") g.example("Func", "f(a)", "[#Func [#Name 'a'] [#Name 'f']]") g.example("Func", "f(a,b)", "[#Func [#Name 'b'] [#Name 'a'] [#Name 'f']]") g.example("Predicate,Expression", "&a", "[#And [#Name 'a']]") g.example("Predicate,Expression", "!a", "[#Not [#Name 'a']]") g.example("Suffix,Expression", "a?", "[#Option [#Name 'a']]") g.example("Suffix,Expression", "a*", "[#Many [#Name 'a']]") g.example("Suffix,Expression", "a+", "[#OneMore [#Name 'a']]") g.example("Expression", "{}", "[#Tree [#Empty '']]") g.example("Expression", "{ a }", "[#Tree [#Name 'a']]") g.example("Expression", "{ }", "[#Tree [#Empty '']]") g.example("Expression", "()", "[#Empty '']") g.example("Expression", "&'a'", "[#And [#Char 'a']]") g.example("Expression", "{a}", "[#Tree [#Name 'a']]") g.example("Expression", "Int{a}", "[#Tree [#Name 'a'] [#Name 'Int']]") g.example("Expression", "^{a}", "[#Fold [#Name 'a']]") g.example("Expression", "^Int{a}", "[#Fold [#Name 'a'] [#Name 'Int']]") g.example("Expression", "name^{a}", "[#Fold [#Name 'a'] [#Name 'name']]") g.example("Expression", "name^Int{a}", "[#Fold [#Name 'a'] [#Name 'Int'] [#Name 'name']]") g.example("Expression", "$a", "[#Append [#Name 'a']]") g.example("Expression", "name=>a", "[#Bind [#Name 'a'] [#Name 'name']]") g.example("Expression", "name => a", "[#Bind [#Name 'a'] [#Name 'name']]") g.example("Expression", "a a", "[#Seq [#Name 'a'] [#Name 'a']]") g.example("Expression", "a b c", "[#Seq [#Seq [#Name 'c'] [#Name 'b']] [#Name 'a']]") g.example("Expression", "a/b / c", "[#Or [#Or [#Name 'c'] [#Name 'b']] [#Name 'a']]") g.example("Statement", "A=a", "[#Production [#Name 'a'] [#Name 'A']]") g.example("Statement", "example A,B abc \n", "[#Example [#Doc 'abc '] [# [#Name 'B'] [#Name 'A']]]") g.example("Statement", "A = a\n b", "[#Production [#Seq [#Name 'b'] [#Name 'a']] [#Name 'A']]") g.example("Start", "A = a; B = b;;", "[#Source [#Production [#Name 'b'] [#Name 'B']] [#Production [#Name 'a'] [#Name 'A']]]") g.example("Start", "A = a\nB = b", "[#Source [#Production [#Name 'b'] [#Name 'B']] [#Production [#Name 'a'] [#Name 'A']]]") g.example("Start", "A = a //hoge\nB = b", "[#Source [#Production [#Name 'b'] [#Name 'B']] [#Production [#Name 'a'] [#Name 'A']]]") return g ''' class TreeConv(object): def parse(self, t:ParseTree): f = getattr(self, t.tag) return f(t) class TPEGConv(TreeConv): def __init__(self, peg:PEG): self.peg = peg def load(self, path): self.peg = PEG(path) f = open(path, 'r') data = f.read() f.close() return self.peg def Source(self,t:ParseTree): for stmt in t.asArray(): self.parse(stmt) def Example(self, t:ParseTree): names, input = t.asArray() for name in names: self.peg.example(name.asString(), input.asString()) def Production(self, t:ParseTree): name, expr = t.asArray() setattr(self.peg, name.asString(), self.parse(expr)) def Name(self, t:ParseTree): return Ref(t.asString()) def Char(self, t:ParseTree): return pe(t.asString()) def Class(self, t:ParseTree): return pe(t.asString()) def Any(self, t:ParseTree): return ANY def Or(self,t:ParseTree): return lor(list(map(lambda x: self.parse(x), t.asArray()))) def Seq(self,t:ParseTree): return lseq(list(map(lambda x: self.parse(x), t.asArray()))) def Many(self,t:ParseTree): return Many(self.parse(t[0])) def Many1(self,t:ParseTree): return Many1(self.parse(t[0])) def Option(self,t:ParseTree): return Ore(self.parse(t[0]), EMPTY) def And(self,t:ParseTree): return And(self.parse(t[0])) def Not(self,t:ParseTree): return Not(self.parse(t[0])) def Append(self,t:ParseTree): return LinkAs('', self.parse(t[0])) def Tree(self,t:ParseTree): if len(t) == 2: return TreeAs(t[0].asString(), self.parse(t[1])) return TreeAs('', self.parse(t[0])) def Link(self,t:ParseTree): if len(t) == 2: return LinkAs(t[0].asString(), self.parse(t[1])) return LinkAs('', self.parse(t[0])) def Fold(self,t:ParseTree): if len(t) == 3: return FoldAs(t[0].asString(), t[1].asString(), self.parse(t[3])) if len(t) == 2: return FoldAs('', t[0].asString(), self.parse(t[1])) return FoldAs('', '', self.parse(t[0])) def unquote(self, s): sb = [] while len(s) > 0: if s.startswith('\\') and len(s) > 1: s = self.unesc(s, sb) else: sb.append(s[0]) s = s[1:] return ''.join(sb) '''
# last bit in the foreground map is 2**6 LMC_VAL = 2**7 HYPERLEDA_VAL = 2**9 GAIA_VAL = 2**10 DES_STARS_VAL = 2**11 NSIDE_COVERAGE = 32 NSIDE = 16384 FOOTPRINT_VAL = 2**0 # Hyperleda HYPERLEDA_RADIUS_FAC = 1 # HYPERLEDA_RADIUS_FAC = 2 HYPERLEDA_MINRAD_ARCSEC = 0.0 # HYPERLEDA_MINRAD_ARCSEC = 10 # Gaia GAIA_RADIUS_FAC = 1 # GAIA_RADIUS_FAC = 2 GAIA_MINRAD_ARCSEC = 5 # GAIA_MINRAD_ARCSEC = 10 GAIA_MAX_GMAG = 1000 # coefficients for log10(radius_arcsec) vs mag. GAIA_POLY_COEFFS = [0.00443223, -0.22569131, 2.99642999] # foreground FOREGROUND_RADIUS_FAC = 1 # FOREGROUND_RADIUS_FAC = 2 # FOREGROUND_MINRAD_ARCSEC = 0 FOREGROUND_MINRAD_ARCSEC = 5 # DES Stars DES_STARS_RADIUS_ARCSEC = 5
class Action: def __init__(self, number, values): self.number = number self.values = values
class Solution: def countComponents(self, n: int, edges: List[List[int]]) -> int: visited, count, graph = [False for _ in range(n)], 0, defaultdict(set) def dfs(i): for j in graph[i]: if not visited[j]: visited[j] = True dfs(j) for start, end in edges: graph[start].add(end) graph[end].add(start) for i in range(n): if not visited[i]: dfs(i) count += 1 return count
#========================= # Weapon List #========================= stick = {'name':'Stick','damage':1, 'description':'A wooden stick.... Maybe it will help'} club = {'name':'Club', 'damage':2, 'description': 'It is a wooden club to swing around'} woodenSword = {'name':'Wooden Sword', 'damage':3, 'description':'It is a wooden sword with a reasonably sharp blade for being made out of wood.'} shortSword = {'name':'Short Sword','damage':5, 'description':'A short sword of reasonable quality'} smallAxe = {'name':'Small Axe', 'damage':7, 'description':'It is a small handheld ax with a suprising amount of weight behind it.'} shineySword = {'name':'Shiney Steel Sword', 'damage':10, 'description':'It is a nice steel sword that looks fairly new and very strong.'} heavyAxe = {'atk': 12, 'name':'Heavy Axe', 'damage':12, 'description':'It is a very large and heavy ax, it takes all your might to swing it.'} greatSword = {'name':'Great Sword', 'damage':15, 'description':'It is a long broad sword, you can almost feel the power flowing through it as if enchanted by some great magic.'} weaponList = [stick, club, woodenSword, shortSword, smallAxe, shineySword, heavyAxe, greatSword]
{ "targets": [ { "variables": { "cpp_base": "./src/cpp/" }, "target_name": "uTicTacToe", "sources": [ "<(cpp_base)node-driver.cpp", "<(cpp_base)UltimateTicTacToe.cpp", "<(cpp_base)UltimateTicTacToe-minimax.cpp", "<(cpp_base)uTicTacToeWrapper.cpp", "<(cpp_base)MoveWrapper.cpp" ], "include_dirs": [ "<!@(node -p \"require('node-addon-api').include\")", "./src/include" ], "dependencies": [ "<!(node -p \"require('node-addon-api').gyp\")" ], "defines": [ "NAPI_CPP_EXCEPTIONS" ], 'conditions': [ ["OS=='mac'", { "OTHER_LDFLAGS": ["-stdlib=libc++"], "xcode_settings": { "GCC_ENABLE_CPP_EXCEPTIONS": "YES", "GCC_ENABLE_CPP_RTTI": "YES" } }], ["OS=='linux'", { "OTHER_CFLAGS": [ "-fexceptions" ], "cflags": [ "-fexceptions" ], "cflags_cc": [ "-fexceptions" ] }], ["OS=='windows'", { "msvs_settings": { "VCCLCompilerTool": { "ExceptionHandling": 1, "Optimization": 2 } } }] ] } ] }
# coding=utf-8 # Copyright 2020 Heewon Jeon. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. def sent_to_spacing_chars(sent): # 공백은 ^ chars = sent.strip().replace(' ', '^') # char_list = [li.strip().replace(' ', '^') for li in sents] # 문장의 시작 포인트 « # 문장의 끌 포인트 » tagged_chars = "«" + chars + "»" # char_list = [ "«" + li + "»" for li in char_list] # 문장 -> 문자열 char_list = ' '.join(list(tagged_chars)) # char_list = [ ' '.join(list(li)) for li in char_list] return(char_list)
#AUTHOR: Farrah Akram #Python3 Concept: Simple ATM in Python #GITHUB: https://github.com/krosskid12 while True: balance=10000; print(" <<-- Welcome to Github ATM -->> ") print(""" 1) Balance Check 2) Withdraw Balance 3) Deposit 4) Quit """) try: Option=int(input("Enter Option :")) except Exception as e: print("Error:",e) print("Enter 1,2,3 or 4 only") continue if Option==1: print("Balance $ ",balance) if Option==2: print("Balance $ ",balance) Withdraw=float(input("Enter Withdraw ammount $ :")) if Withdraw>0: forwardbalance=(balance-Withdraw) print("Forward balance is $ ",forwardbalance) elif Withdraw>balance: print("No Balance in account !!!") else: print("None withdraw made ") if Option==3: print("Balance $ ",balance) Deposit=float(input("Enter deposit ammount $ :")) if Deposit>0: forwardbalance=(balance+Deposit) print("forwardbalance $",forwardbalance) else: print("No deposit made !!!") if Option==4: exit()
class Restaurante(): """Uma classe para descrever restauranes.""" def __init__(self, nome, cozinha): self.nome = nome self.cozinha = cozinha self.num_atendimento = 0 def descricao(self): print(f'\nNome do restaurante: {self.nome}') print(f'Tipo de cozinha: {self.cozinha}') def aberto(self): print(f'\nO Restaurante, {self.nome}, está aberto.') def set_num_atendimento(self, num_atendimento): self.num_atendimento = num_atendimento def incr_num_atendimento(self, num_atendimento): self.num_atendimento += num_atendimento class CarrinhoSorvete(Restaurante): """Classe que representa um carrinho de sorvete.""" def __init__(self, nome, cozinha): super().__init__(nome, cozinha) self.sabores = ["Chocolate", "Limão", "Morango", "Kiwi", "Umbu"] def exibe_sabores(self): print("\nOs sabores disponiveis são: ") [print(f'\t{sabor}') for sabor in self.sabores]
#!/usr/bin/python """Const values""" CONFIG_PATH_NAME = 'configs' VERSIONS_FILENAME = 'app_version' VERSIONS_FILENAME_EXT = ".json" APPS_METADATE_FILENAME = 'meta_' TMP_IGNORE_DIR = 'ignore_tmp' APP_MANIFEST_HEADERS = ['commitid', 'application', 'whitelist', 'blacklist', 'method'] LOGPATH = '/var/appetite' META_DIR = 'appetite' DEPLOYMENT_METHODS_FILENAME = "deploymentmethods.conf" # Default version given to applications with no version # This is supplemented with the commit id before storing to file DEFAULT_VERSION = "1.0" # Status Change values META_APP_CHANGED = 'changed' META_APP_DELETED = 'deleted' META_APP_ADDED = 'added' META_APP_UNCHANGED = 'unchanged' # Lists to check app statuses META_CURRENT = [META_APP_CHANGED, META_APP_ADDED, META_APP_UNCHANGED] META_UPDATED = [META_APP_CHANGED, META_APP_ADDED, META_APP_DELETED] META_CHANGED = [META_APP_CHANGED, META_APP_ADDED] # Extensions to use with templating JSON_EXTS = ['json'] YMAL_EXTS = ['ymal', 'yml'] TEMPLATING_EXTS = JSON_EXTS + YMAL_EXTS HOST_LOGS_FOLDER_NAME = "logs" # Name formatting for host names NAME_FORMATTING = [] NAME_FORMATTING_SPLIT_TOKEN = 11110000100001111 DM_COMMANDS_SEQUENCE = ['run_first_script', 'commands', 'run_last_script'] DEFAULT_THREAD_POOL_SIZE = 10 DEFAULT_LOG_RETENTION = 30 # days REMOTE_CMD_RUN_SLEEP_TIMER = 30 # seconds REMOTE_AUTH_RUN_SLEEP_TIMER = 5 # seconds # Pulling commit logs have standard names, this helps format the correctly RENAME_COMMIT_LOG_KEYS = { 'commit_id': "app_commit_id", 'abbrv_commit_id': "app_abbrev_commit_id" } # Default (needed) columns in the manifest DEFAULT_COLUMN_HEADER = [ 'commitid', 'application', 'deploymentmethod', 'whitelist', 'blacklist' ] # Location within an application to look for version number LOCATION_DEFAULT = 'default/app.conf' LOCATION_LOCAL = 'local/app.conf' # Var used to set up version stanza im a file LAUNCHER_STANZA = 'launcher' VERSION_KEY = 'version'
class Node: def __init__(self, data): self.data = data self.nxt = None def add(self, data): nxt = self while nxt.nxt is not None: nxt = nxt.nxt nxt.nxt = Node(data) return nxt.nxt def join(self, node): self.nxt = node def get_size(n): count = 1 while n.nxt is not None: count += 1 n = n.nxt return count def print_nodes(node, msg='--', separator='->'): r = '' while node is not None: r += str(node.data) + separator node = node.nxt if len(separator) > 0: print(msg, r[0:-1 * len(separator)]) else: print(msg, r) def print_node_mem(node, msg='--'): while node is not None: print(node, end='-') node = node.nxt if __name__ == "__main__": head = Node(1) n2 = head.add(2) head.add(3) print_nodes(head) print_nodes(n2)
# -*- coding: utf-8 -*- """ 二叉树:填充每个节点的下一个右侧节点指针 https://leetcode-cn.com/problems/populating-next-right-pointers-in-each-node/ """ class Node: def __init__(self, val: int = 0, left: 'Node' = None, right: 'Node' = None, next: 'Node' = None): self.val = val self.left = left self.right = right self.next = next class Solution: def connect(self, root: 'Node') -> 'Node': """ 思路:采用BFS广度优先搜索(层序遍历),逐层填充next指针. 使用根节点初始化栈,然后计算每层节点数length,使用length做range遍历,针对遍历出的每个节点,进行指针填充.并将此节点的右子节点和左子节点 添加到栈中. 关键点: 避免下一层节点影响上一层节点的填充工作 1.出栈从队首出 2.入栈先入右子节点,然后入左子节点 时间复杂度: O(n),遍历树的所有节点 空间复杂度: O(n),完美二叉树,最后一个层级包含节点数为n/2个.广度优先遍历的空间复杂度取决于一个层级上的最大元素数量.丢弃常数,复杂度为O(n) :param root: 原二叉树 :return: 填充后二叉树 """ # 二叉树为空,直接返回空 if not root: return None # 使用根节点初始化迭代辅助栈 stack = [root, ] # 栈非空时进行循环迭代 while stack: # 计算栈大小,用于下面的迭代 length = len(stack) # 后一节点引用,非空时用于前一节点的连接工作 pre = None # 迭代栈 for _ in range(length): # 每次迭代则将首元素拿出来(其实是后面的节点) node = stack.pop(0) # 后一节点存在,则加入到当前结点next指针后 if pre: node.next = pre # 将当前节点赋予pre pre = node # 先将右子节点入栈 if node.right: stack.append(node.right) # 再将左子节点入栈 if node.left: stack.append(node.left) return root def connect2(self, root: 'Node') -> 'Node': """ 思路: 使用已建立的next指针,对树的下层节点进行next连接. 时间复杂度:O(n),每个节点只访问一次 空间复杂度:O(1),不涉及到辅助栈的使用 :param root: 原二叉树 :return: 填充next指针后的二叉树 """ # 根节点为空,则直接返回None if not root: return root # 初始最左节点为根节点 leftmost = root # 最左节点无左孩子时即代表已填充完整棵树(完美二叉树) while leftmost.left: # 针对树的每层处理相当于遍历链表,每层链表头部指向当前最左节点 head = leftmost # 遍历当前层链表 while head: # 同一父节点下的两个子节点直接进行next连接 head.left.next = head.right # 获取当前节点next节点,针对不同父节点,则左侧父节点右孩子与右侧父节点左孩子进行next连接 if head.next: head.right.next = head.next.left # 移动head头到下一节点(next指针) head = head.next # 移动最左节点到下一层 leftmost = leftmost.left # 遍历完成后返回根节点 return root def connect3(self, root: 'Node') -> 'Node': """ 思路:采用递归解法(DFS). 从根节点开始,左右节点不断向下深入,left节点不断往右走,right节点不断往左走,当两个节点走到底后 整个纵深即完成串联. 终止条件:当前节点为空 函数内:以当前节点为起始,完成从上往下的纵深串联,再递归的对当前节点的left和right进行调用 时间复杂度: O(n),访问了二叉树的每一个节点 空间复杂度: O(h),h为二叉树高度 :param root: 二叉树 :return: 完成连接的二叉树 """ def dfs(root): if not root: return left = root.left right = root.right while left: left.next = right left = left.right right = right.left dfs(root.left) dfs(root.right) dfs(root) return root def connect4(self, root: 'Node') -> 'Node': def dfs(node: 'Node'): if not node or not node.left: return node.left.next = node.right if node.next: node.right.next = node.next.left dfs(node.left) dfs(node.right) dfs(root) return root
''' Tuple - An ordered set of data 1. They are immutable, not changeable*. 2. Parenthesis are not necessary, it is there only for avoiding syntactic ambiguity(i.e x=1,2 is the same as x=(1,2s)) 3. t = 'a', 'b', 'c' 3-ary tuple print(t) We need to make the things good. 4. We can access them like lists using []. But don't try to change em 5. We can mix different data types. 6. We can update tuples by just reassigning them to the tuple with data changed 7. We have equality associativity from Right to Left 8. Tuples are immutable in order to avoid errors(be robust) - philosophy. 9. Tuples are useful for records, not for actively changing data. 10. We can extract values of the tuple(This is called tuple unpacking) a. a, b, c = tuple_name # Number of values SHOULD be the same as len(tuple) b. We can assign the same values to multiple things c. Don't use together on the same line e.g a = b, c = 1, 3 a = (1, 3) b = 1 c = 3 Not intuitive 11. Tuples can contain anything inside, tuples lists etc, Changing these 'inside' lists is allowed. a = (1, [1, 2]) a[1].append(3) # -> (1 , [1,2,3]) this is allowed - the tuple stores the data structures's reference only. It is useful in many ways. 12. It is useful to make a tuple so that relationships between variables is intuitive. 13. We can print any tuple, so they can be passed as it is to .format() ------------------------- Binary Number Systems: We can specify the number system and the decimal at last(but not together) 1. Use x for hex, o for oct and b for binary - small letters strictly 2. For representing in decimal 0b101001, 0xAF24, 0o137 3. For converting from decimal to other systems do int(str(hex(i))), or bin(i) or oct(i) - All are strings. '''
""" In this exercise you are helping your younger sister edit her paper for school. The teacher is looking for correct punctuation, grammar, and excellent word choice. You have four tasks to clean up and modify strings. """ def capitalize_title(title: str) -> str: """ :param title: str title string that needs title casing :return: str title string in title case (first letters capitalized) """ return title.title() def check_sentence_ending(sentence: str) -> bool: """ :param sentence: str a sentence to check. :return: bool True if punctuated correctly with period, False otherwise. """ return sentence.endswith('.') def clean_up_spacing(sentence: str) -> str: """ :param sentence: str a sentence to clean of leading and trailing space characters. :return: str a sentence that has been cleaned of leading and trailing space characters. """ return sentence.strip() def replace_word_choice(sentence: str, old_word: str, new_word: str) -> str: """ :param sentence: str a sentence to replace words in. :param new_word: str replacement word :param old_word: str word to replace :return: str input sentence with new words in place of old words """ return sentence.replace(old_word, new_word)
with open('./Gonduls/13/input.txt', 'r') as inputf: lista= list(inputf.read().split('\n')) lista[1] = lista[1].split(',') buses =[] for i, elem in enumerate(lista[1]): if (elem != 'x'): buses.append([int(elem), i, True]) times = 0 step = 1 i = 0 notfound= True while(notfound): # checks if i is final number: inside map returns result of i+minutes_offset % ele in buses, # outside map returns list of Trues if inside map is all zeros ([0, 0, 0, 0, ...]), all finishes the job if all(map(lambda el: el==0, map(lambda ele: (i+ele[1])%ele[0], buses))): break # works because if i+minutes_offset % bus == 0 => (step*bus + i+minutes_offset)% bus == 0, # where step can be set so this works for any number of buses, then step = step*bus for bus in buses: if (bus[2] and (i+bus[1])%bus[0]==0): bus[2] = False step *= bus[0] i += step print(i)
exit_list= [3602, 1174, 1194, 818, 878, 4296] total_example = 0 for number in exit_list: total_example += number for index, number in enumerate(exit_list): print("layer:", index+1, "exit %:", number/total_example*100)
def multiply1(x,y): n = len(x) if (n==1): return x[0]*y[0] s = int(n/2) xl = x[0:s] xh = x[s:] yl = y[0:s] yh = y[s:] p1 = multiply(xl,yl) p2 = multiply(xh,yh) xz = [x1 + x2 for x1, x2 in zip(xl, xh)] yz = [y1 + y2 for y1, y2 in zip(yl, yh)] p3 = multiply(xz,yz) if isinstance(p2, list): t2 = [p3t -p2t - p1t for p1t, p2t, p3t in zip(p1,p2,p3 )] else: t2 = p3-p2-p1 return [p1,t2,p2] def multiply(X,Y): if ((len(X)==1) or (len(X)==2)): return (multiply1(X,Y)) elif (len(X)==4): p1,p2,p3 = multiply1(X,Y) return ([p1[0],p1[1],(p1[2]+p2[0]),p2[1],(p2[2]+p3[0]),p3[1],p3[2]]) else: print("polnomial order must be 1, 2, or 4") return -1 x=[4,7,2,5] y=[1,3,9,2] print(multiply(x,y))
b = "this is file 'b'" def b_func(): inside_b_func = 'inside b_func()' print("b")
# Copyright 2021 Edoardo Riggio # # 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. class Queue: """Class for the fixed-size Queue data structure. It contains the data and metadata of the Queue. """ queue: list length: int tail: int head: int empty: bool full: bool def __init__(self, length): self.queue = [None] * length self.length = length self.head = self.tail = 0 self.empty = True self.full = False def enqueue(self, value): """Insert the given value at the tail pointer of the Queue, return error if overflow occurs. Args: value (void): a value to be inserted into the Queue """ if not self.full: self.queue[self.tail] = value self.tail = (self.tail + 1) % self.length self.empty = False elif self.full: print("OVERFLOW") return self.full = self.tail == self.head def dequeue(self): """Remove the item to which 'head' is pointing from the Queue. Returns: void: the removed element """ if not self.empty: value = self.queue[self.head] self.queue[self.head] = None self.head = (self.head + 1) % self.length self.full = False elif self.empty: print("UNDERFLOW") return self.empty = self.head == self.tail return value
''' MIT License Copyright (c) 2019 Keith Christopher Cronin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ''' _parseddictionary = {} _hasreadxdf = False debug = False def readxdf(filepath, data=None, markercharacter='@', listseparatormarker=','): global _hasreadxdf isonproperty = False isonpropertyvalue = False isonequal = False isonmarker = True position = 0 propertyvaluebuffer = [] propertybuffer = [] global _parseddictionary propertystartindex = 0 propertyendindex = 0 propertyvaluestartindex = 0 propertyvalueendindex = 0 propwasmarked = False propvaluewasmarked = False propertyname = '' lastlistsepposition = 0 haslist = False propertyvaluelistbuffer = [] if filepath is not None: try: file = open(filepath, 'r') data = file.read() file.close() except PermissionError: return False except OSError: return False if len(data) == 0: return False if data[0] != markercharacter or _hasreadxdf or len(markercharacter) != 1: return False else: for character in data: if isonproperty: if propwasmarked == False: propertystartindex = position propwasmarked = True elif character == listseparatormarker: return False else: pass if character == '=': isonpropertyvalue = True isonproperty = False propertyendindex = position propertyname = data[propertystartindex:propertyendindex].strip('\n') propertyvaluestartindex = position + 1 if isonpropertyvalue: if character == markercharacter or position == len(data)-1 and not haslist: isonmarker = True propertyvalueendindex = position _parseddictionary[propertyname] = data[propertyvaluestartindex:propertyvalueendindex].strip('\n') propwasmarked = False if position == len(data)-1 and not haslist: _parseddictionary[propertyname] = data[propertyvaluestartindex:propertyvalueendindex+1].strip('\n') elif character == listseparatormarker and not haslist: haslist = True propertyvaluelistbuffer.append(data[propertyendindex+1:position].strip(F"{listseparatormarker}\n")) lastlistsepposition = position elif character == listseparatormarker and haslist: propertyvaluelistbuffer.append(data[lastlistsepposition+1:position].strip(F"{listseparatormarker}\n")) lastlistsepposition = position if haslist and position == len(data)-1: propertyvaluelistbuffer.append(data[lastlistsepposition+1:position+1].strip(F"{listseparatormarker}\n")) _parseddictionary[propertyname] = propertyvaluelistbuffer propertyvaluelistbuffer = [] lastlistsepposition = 0 haslist = False if character == markercharacter and haslist: propertyvaluelistbuffer.append(data[lastlistsepposition+1:position].strip(F"{listseparatormarker}\n")) _parseddictionary[propertyname] = propertyvaluelistbuffer propertyvaluelistbuffer = [] lastlistsepposition = 0 haslist = False else: pass if isonmarker: isonproperty = True isonmarker = False position += 1 _hasreadxdf = True return True def reset(): global debug _hasreadxdf = False _parseddictionary.clear() if debug: _tellcurrentparserdictionary() return True def getproperty(propertystring): if propertystring in _parseddictionary: return _parseddictionary[propertystring] else: return False def setproperty(propertystring, propertyvalue): _parseddictionary[propertystring] = propertyvalue return True def appendtoproperty(propertystring, propertyvalue): if propertystring in _parseddictionary: _parseddictionary[propertystring] += F",{propertyvalue}" return True else: return False def writexdf(filepath, propertydictionary, markercharacter='@', listseparatormarker=','): if markercharacter == listseparatormarker: return False listelementcounter = 0 try: file = open(filepath,'w') for key in propertydictionary: if isinstance(propertydictionary[key], list): file.write(markercharacter+key+'=') for element in propertydictionary[key]: if listelementcounter != len(propertydictionary[key]) - 1: file.write(element+listseparatormarker) else: file.write(element+'\n') listelementcounter += 1 listelementcounter = 0 else: file.write(markercharacter+key+'='+str(propertydictionary[key])+'\n') file.close() return True except PermissionError: return False except OSError: return False def getcurrentdata(): if len(_parseddictionary) < 1: return False else: return _parseddictionary def _tellcurrentparserdictionary(): print(F"Listing {len(_parseddictionary)} properties and values in memory: \n{_parseddictionary}")
"""Dosya İşlemleri - Dosya Güncellemek""" """ with open('asd.txt', 'r+') as f: # eski veri değişkeninde saklansın eski_veri = f.read() # Dosyanın imleci en başına gitsin # Amacım yukarıya eklemek olduğu için en başa gönderdim. f.seek(0) # Şimdi verileri tekrardan yazma işlemi yapıyorum. # Yeni veri ile eski verileri birleştirmek içinde şu şekilde yazıyorum. # Bunun sebebi eğer eski veriyi eklemezsem dosya kaybolacaktır. f.write('Merhaba 1234\n' + eski_veri) """ # En sonuna güncelleme yapmak için yazacağım kod şu şekilde olacaktır. with open('asd.txt', 'a') as f: f.write('\nSon Veri Ekleme...') # Dosyanın en sonunda ekleme yapmak içinse şu şekilde yazmamız gerekebilir. with open('asd.txt', 'r+') as f: # eski veri değişkeninde saklansın # readlines yazmamın sebebi ise bütün verileri okuyor # ve her bir satırı liste türünde döndürüyordu. eski_veri = f.readlines() # ikinci satırda ekleme yapmak istiyorsak # format liste olduğu için insert fonks kullancağım. eski_veri.insert(1, 'Örnek veri\n') # Bunu tekrardan dosyaya yazdırmam için dosya imleci en başa alıyorum. f.seek(0) # Bu dosyaya liste eklememize yarıyor bu formatta f.writelines(eski_veri) print(eski_veri)
msg1 = 'Digite um número inteiro: ' n1 = int(input(msg1)) msg2 = 'Digite outro número inteiro: ' n2 = int(input(msg2)) s = n1 + n2 print('A soma entre \033[1:34m{0}\033[m e \033[1:31m{1}\033[m vale \033[1:32m{2}\033[m.'.format(n1, n2, s))
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def sumOfLeftLeaves(self, root: Optional[TreeNode]) -> int: stack=[(root, 1)] output=0 while(stack): node, where = stack.pop(0) if where==0 and not node.left and not node.right: output+=node.val if node.left: stack.append((node.left, 0)) if node.right: stack.append((node.right, 1)) return output
class Solution(object): def minSubArrayLen(self, s, nums): """ :type s: int :type nums: List[int] :rtype: int """ i=0 t=0 if not nums: return 0 res=None for j,x in enumerate(nums): t+=x while t>=s: res=min(res,j-i+1) if res else j-i+1 t-=nums[i] i+=1 return res if res else 0
class DataTypeTemplate(object): """Defines a DataType template. The template defines a name and all the paths to the "data" folders in a KiProject. """ _templates = [] def __init__(self, name, description, paths, is_default=False): """Instantiates a new instance. Args: name: The friendly name of the template. description: A description of the template. paths: The paths contained in the template. is_default: True if this is the default template otherwise False. """ self.name = name self.description = description self.paths = paths self.is_default = is_default @classmethod def all(cls): """Gets all the templates.""" return cls._templates @classmethod def default(cls): """Gets the default template.""" return next(d for d in cls._templates if d.is_default) @classmethod def register(cls, template): """Registers a template so it can be used. Args: template: The template to register. Returns: None """ cls._templates.append(template) @classmethod def get(cls, name): """Gets a template by name. Args: name: The name of the template top get. Returns: The template or None. """ return next((t for t in cls._templates if t.name == name), None) class DataTypeTemplatePath(object): """Defines a name and path in a DataTypeTemplate""" def __init__(self, name, rel_path): """Instantiates a new instance. Args: name: The friendly name of the path. rel_path: The relative path to the directory for the path. """ self.name = name self.rel_path = rel_path
config = {} def set_config(conf): global config config = conf def get_config(): global config return config def get_full_url(relative_url): return '%s/api/%s/%s' % (config['HOST'], config['API_VERSION'], relative_url) def get_headers(): return { 'Accept': 'application/json', # 'Authorization': 'JWT %s' % (config['TOKEN']), 'X-BC-AUTH': config['TOKEN'], 'Content-Type': 'application/json', }
class UsiError(Exception): def __init__(self, message, error_code): self.message = message self.error_code = error_code
# -*- coding: UTF-8 -*- # Copyright 2017 Luc Saffre # License: BSD (see file COPYING for details) """Extended and specific plugins for Lino Noi. .. autosummary:: :toctree: contacts amici """
### # range() ### # 1. create a list of integers from 0 to n # l = list(range(10)) # print(l) # # 2. create a list of integers from 3 to 10 # l2 = list(range(3,10)) # print(l2) # # 3. create a list of integers from 0, 10 with step size of 2 # # 0, 2, 4, ... # l3 = list(range(0,10,2)) # print(l3) # # 4. create a list of integers from 10 to 1 # l4 = list(range(10,0,-1)) # print(l4) # create a list of integers from 0, n with step size of k # l = list(range(0, n, k)) # create a list of integers from 10 to 0 # l5 = list(range(10,-1,-1)) # range(start_position=0, end_position, step_size=1) # by default ############################# ############################## l = list(range(10)) # print(l) # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] # # [0, 1, 2, 3, 4] # # [5, 6, 7, 8, 9] # print(l[:5]) # print(l[5:]) # # reverse the list [4,3,2,1,0] -> [4,3,2,1] # print(l[-1:-11:-1]) # print [0,1,8,9] # l = [1,2,3] # l2 = [5,4,7] # print(l+l2) # l.extend(l2) # print(l) # # print(l[:2]+l[9:]) # l.append(10) # l.pop(6) # l.insert(0,50) # https://developers.google.com/edu/python
class ZenHttpException(Exception): """Exception with HTTP status code.""" def __init__(self, status): """Creates an instance. Args: status (int): HTTP status code. """ self.status = status
# Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right # 1. Linear Time class Solution: def countNodes(self, root: TreeNode) -> int: return 1 + self.countNodes(root.right) + self.countNodes(root.left) if root else 0 # 2. Better Solution class Solution: def countNodes(self, root: TreeNode) -> int: if not root: return 0 self.last_level_count = 0 self.level = 0 # Stop flag to end searching self.stop = 0 # Start with -1 since the searching ends on the children of leafs (None) # Make -1 offset then self.level can be the real value self.dfs(root, -1) return 2 ** self.level - 1 + self.last_level_count // 2 def dfs(self, node, level): if self.stop: return if not node: self.level = max(self.level, level) # If the reaches the final level, then count 1 # Note this is actually counting for # of children (None) of final level nodes if self.level == level: self.last_level_count += 1 else: self.stop = 1 return self.dfs(node.left, level + 1) self.dfs(node.right, level + 1) # 3. Binary Search class Solution: def countNodes(self, root: TreeNode) -> int: if not root: return 0 # Find tree final level (Tree Height) self.root = root node = root self.level = -1 while node: node = node.left self.level += 1 # Start Binary Search left = 0 right = 2 ** self.level - 1 # If it's full binary tree then directly return # nodes if self.check_node(right): return 2 ** self.level + right while left < right - 1: mid = (left + right) // 2 if self.check_node(mid): left = mid else: right = mid return 2 ** self.level + left def check_node(self, idx): node = self.root # The order if search path could be regarded as binary value converted from index # Make sure the len(order) = self.level order = format(idx, '0{}b'.format(self.level)) for num in order: if num == '0': node = node.left else: node = node.right return True if node else False
class FeatureImportance(object): def __init__(self, importance=0, importance_2=0, main_type='split'): self.legal_type = ['split', 'gain'] assert main_type in self.legal_type, 'illegal importance type {}'.format(main_type) self.importance = importance self.importance_2 = importance_2 self.main_type = main_type def add_gain(self, val): if self.main_type == 'gain': self.importance += val else: self.importance_2 += val def add_split(self, val): if self.main_type == 'split': self.importance += val else: self.importance_2 += val def __cmp__(self, other): if self.importance > other.importance: return 1 elif self.importance < other.importance: return -1 else: return 0 def __eq__(self, other): return self.importance == other.importance def __lt__(self, other): return self.importance < other.importance def __repr__(self): return 'importance type: {}, importance: {}, importance2 {}'.format(self.main_type, self.importance, self.importance_2) def __add__(self, other): new_importance = FeatureImportance(main_type=self.main_type, importance=self.importance+other.importance, importance_2=self.importance_2+other.importance_2) return new_importance
""" pygments.lexers._scheme_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Scheme builtins. :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ # Autogenerated by external/scheme-builtins-generator.scm # using Guile 3.0.5.130-5a1e7. scheme_keywords = { "*unspecified*", "...", "=>", "@", "@@", "_", "add-to-load-path", "and", "begin", "begin-deprecated", "case", "case-lambda", "case-lambda*", "cond", "cond-expand", "current-filename", "current-source-location", "debug-set!", "define", "define*", "define-inlinable", "define-library", "define-macro", "define-module", "define-once", "define-option-interface", "define-private", "define-public", "define-record-type", "define-syntax", "define-syntax-parameter", "define-syntax-rule", "define-values", "defmacro", "defmacro-public", "delay", "do", "else", "eval-when", "export", "export!", "export-syntax", "false-if-exception", "identifier-syntax", "if", "import", "include", "include-ci", "include-from-path", "include-library-declarations", "lambda", "lambda*", "let", "let*", "let*-values", "let-syntax", "let-values", "letrec", "letrec*", "letrec-syntax", "library", "load", "match", "match-lambda", "match-lambda*", "match-let", "match-let*", "match-letrec", "or", "parameterize", "print-set!", "quasiquote", "quasisyntax", "quote", "quote-syntax", "re-export", "re-export-syntax", "read-set!", "require-extension", "set!", "start-stack", "syntax", "syntax-case", "syntax-error", "syntax-parameterize", "syntax-rules", "unless", "unquote", "unquote-splicing", "unsyntax", "unsyntax-splicing", "use-modules", "when", "while", "with-ellipsis", "with-fluids", "with-syntax", "λ", } scheme_builtins = { "$sc-dispatch", "%char-set-dump", "%get-pre-modules-obarray", "%get-stack-size", "%global-site-dir", "%init-rdelim-builtins", "%init-rw-builtins", "%library-dir", "%load-announce", "%load-hook", "%make-void-port", "%package-data-dir", "%port-property", "%print-module", "%resolve-variable", "%search-load-path", "%set-port-property!", "%site-ccache-dir", "%site-dir", "%start-stack", "%string-dump", "%symbol-dump", "%warn-auto-compilation-enabled", "*", "+", "-", "->bool", "->char-set", "/", "1+", "1-", "<", "<=", "=", ">", ">=", "abort-to-prompt", "abort-to-prompt*", "abs", "absolute-file-name?", "accept", "access?", "acons", "acos", "acosh", "add-hook!", "addrinfo:addr", "addrinfo:canonname", "addrinfo:fam", "addrinfo:flags", "addrinfo:protocol", "addrinfo:socktype", "adjust-port-revealed!", "alarm", "alist-cons", "alist-copy", "alist-delete", "alist-delete!", "allocate-struct", "and-map", "and=>", "angle", "any", "append", "append!", "append-map", "append-map!", "append-reverse", "append-reverse!", "apply", "array->list", "array-cell-ref", "array-cell-set!", "array-contents", "array-copy!", "array-copy-in-order!", "array-dimensions", "array-equal?", "array-fill!", "array-for-each", "array-in-bounds?", "array-index-map!", "array-length", "array-map!", "array-map-in-order!", "array-rank", "array-ref", "array-set!", "array-shape", "array-slice", "array-slice-for-each", "array-slice-for-each-in-order", "array-type", "array-type-code", "array?", "ash", "asin", "asinh", "assert-load-verbosity", "assoc", "assoc-ref", "assoc-remove!", "assoc-set!", "assq", "assq-ref", "assq-remove!", "assq-set!", "assv", "assv-ref", "assv-remove!", "assv-set!", "atan", "atanh", "autoload-done!", "autoload-done-or-in-progress?", "autoload-in-progress!", "backtrace", "basename", "batch-mode?", "beautify-user-module!", "bind", "bind-textdomain-codeset", "bindtextdomain", "bit-count", "bit-count*", "bit-extract", "bit-invert!", "bit-position", "bit-set*!", "bitvector", "bitvector->list", "bitvector-bit-clear?", "bitvector-bit-set?", "bitvector-clear-all-bits!", "bitvector-clear-bit!", "bitvector-clear-bits!", "bitvector-count", "bitvector-count-bits", "bitvector-fill!", "bitvector-flip-all-bits!", "bitvector-length", "bitvector-position", "bitvector-ref", "bitvector-set!", "bitvector-set-all-bits!", "bitvector-set-bit!", "bitvector-set-bits!", "bitvector?", "boolean?", "bound-identifier=?", "break", "break!", "caaaar", "caaadr", "caaar", "caadar", "caaddr", "caadr", "caar", "cadaar", "cadadr", "cadar", "caddar", "cadddr", "caddr", "cadr", "call-with-blocked-asyncs", "call-with-current-continuation", "call-with-deferred-observers", "call-with-include-port", "call-with-input-file", "call-with-input-string", "call-with-module-autoload-lock", "call-with-output-file", "call-with-output-string", "call-with-port", "call-with-prompt", "call-with-unblocked-asyncs", "call-with-values", "call/cc", "canonicalize-path", "car", "car+cdr", "catch", "cdaaar", "cdaadr", "cdaar", "cdadar", "cdaddr", "cdadr", "cdar", "cddaar", "cddadr", "cddar", "cdddar", "cddddr", "cdddr", "cddr", "cdr", "ceiling", "ceiling-quotient", "ceiling-remainder", "ceiling/", "centered-quotient", "centered-remainder", "centered/", "char->integer", "char-alphabetic?", "char-ci<=?", "char-ci<?", "char-ci=?", "char-ci>=?", "char-ci>?", "char-downcase", "char-general-category", "char-is-both?", "char-lower-case?", "char-numeric?", "char-ready?", "char-set", "char-set->list", "char-set->string", "char-set-adjoin", "char-set-adjoin!", "char-set-any", "char-set-complement", "char-set-complement!", "char-set-contains?", "char-set-copy", "char-set-count", "char-set-cursor", "char-set-cursor-next", "char-set-delete", "char-set-delete!", "char-set-diff+intersection", "char-set-diff+intersection!", "char-set-difference", "char-set-difference!", "char-set-every", "char-set-filter", "char-set-filter!", "char-set-fold", "char-set-for-each", "char-set-hash", "char-set-intersection", "char-set-intersection!", "char-set-map", "char-set-ref", "char-set-size", "char-set-unfold", "char-set-unfold!", "char-set-union", "char-set-union!", "char-set-xor", "char-set-xor!", "char-set<=", "char-set=", "char-set?", "char-titlecase", "char-upcase", "char-upper-case?", "char-whitespace?", "char<=?", "char<?", "char=?", "char>=?", "char>?", "char?", "chdir", "chmod", "chown", "chroot", "circular-list", "circular-list?", "close", "close-fdes", "close-input-port", "close-output-port", "close-port", "closedir", "command-line", "complex?", "compose", "concatenate", "concatenate!", "cond-expand-provide", "connect", "cons", "cons*", "cons-source", "const", "convert-assignment", "copy-file", "copy-random-state", "copy-tree", "cos", "cosh", "count", "crypt", "ctermid", "current-dynamic-state", "current-error-port", "current-input-port", "current-language", "current-load-port", "current-module", "current-output-port", "current-time", "current-warning-port", "datum->random-state", "datum->syntax", "debug-disable", "debug-enable", "debug-options", "debug-options-interface", "default-duplicate-binding-handler", "default-duplicate-binding-procedures", "default-prompt-tag", "define!", "define-module*", "defined?", "delete", "delete!", "delete-duplicates", "delete-duplicates!", "delete-file", "delete1!", "delq", "delq!", "delq1!", "delv", "delv!", "delv1!", "denominator", "directory-stream?", "dirname", "display", "display-application", "display-backtrace", "display-error", "dotted-list?", "doubly-weak-hash-table?", "drain-input", "drop", "drop-right", "drop-right!", "drop-while", "dup", "dup->fdes", "dup->inport", "dup->outport", "dup->port", "dup2", "duplicate-port", "dynamic-call", "dynamic-func", "dynamic-link", "dynamic-object?", "dynamic-pointer", "dynamic-state?", "dynamic-unlink", "dynamic-wind", "effective-version", "eighth", "end-of-char-set?", "endgrent", "endhostent", "endnetent", "endprotoent", "endpwent", "endservent", "ensure-batch-mode!", "environ", "eof-object?", "eq?", "equal?", "eqv?", "error", "euclidean-quotient", "euclidean-remainder", "euclidean/", "eval", "eval-string", "even?", "every", "exact->inexact", "exact-integer-sqrt", "exact-integer?", "exact?", "exception-accessor", "exception-args", "exception-kind", "exception-predicate", "exception-type?", "exception?", "execl", "execle", "execlp", "exit", "exp", "expt", "f32vector", "f32vector->list", "f32vector-length", "f32vector-ref", "f32vector-set!", "f32vector?", "f64vector", "f64vector->list", "f64vector-length", "f64vector-ref", "f64vector-set!", "f64vector?", "fcntl", "fdes->inport", "fdes->outport", "fdes->ports", "fdopen", "fifth", "file-encoding", "file-exists?", "file-is-directory?", "file-name-separator?", "file-port?", "file-position", "file-set-position", "fileno", "filter", "filter!", "filter-map", "find", "find-tail", "finite?", "first", "flock", "floor", "floor-quotient", "floor-remainder", "floor/", "fluid->parameter", "fluid-bound?", "fluid-ref", "fluid-ref*", "fluid-set!", "fluid-thread-local?", "fluid-unset!", "fluid?", "flush-all-ports", "fold", "fold-right", "for-each", "force", "force-output", "format", "fourth", "frame-address", "frame-arguments", "frame-dynamic-link", "frame-instruction-pointer", "frame-previous", "frame-procedure-name", "frame-return-address", "frame-source", "frame-stack-pointer", "frame?", "free-identifier=?", "fsync", "ftell", "gai-strerror", "gc", "gc-disable", "gc-dump", "gc-enable", "gc-run-time", "gc-stats", "gcd", "generate-temporaries", "gensym", "get-internal-real-time", "get-internal-run-time", "get-output-string", "get-print-state", "getaddrinfo", "getaffinity", "getcwd", "getegid", "getenv", "geteuid", "getgid", "getgr", "getgrent", "getgrgid", "getgrnam", "getgroups", "gethost", "gethostbyaddr", "gethostbyname", "gethostent", "gethostname", "getitimer", "getlogin", "getnet", "getnetbyaddr", "getnetbyname", "getnetent", "getpass", "getpeername", "getpgrp", "getpid", "getppid", "getpriority", "getproto", "getprotobyname", "getprotobynumber", "getprotoent", "getpw", "getpwent", "getpwnam", "getpwuid", "getrlimit", "getserv", "getservbyname", "getservbyport", "getservent", "getsid", "getsockname", "getsockopt", "gettext", "gettimeofday", "getuid", "gmtime", "group:gid", "group:mem", "group:name", "group:passwd", "hash", "hash-clear!", "hash-count", "hash-create-handle!", "hash-fold", "hash-for-each", "hash-for-each-handle", "hash-get-handle", "hash-map->list", "hash-ref", "hash-remove!", "hash-set!", "hash-table?", "hashq", "hashq-create-handle!", "hashq-get-handle", "hashq-ref", "hashq-remove!", "hashq-set!", "hashv", "hashv-create-handle!", "hashv-get-handle", "hashv-ref", "hashv-remove!", "hashv-set!", "hashx-create-handle!", "hashx-get-handle", "hashx-ref", "hashx-remove!", "hashx-set!", "hook->list", "hook-empty?", "hook?", "hostent:addr-list", "hostent:addrtype", "hostent:aliases", "hostent:length", "hostent:name", "identifier?", "identity", "imag-part", "in-vicinity", "include-deprecated-features", "inet-lnaof", "inet-makeaddr", "inet-netof", "inet-ntop", "inet-pton", "inexact->exact", "inexact?", "inf", "inf?", "inherit-print-state", "input-port?", "install-r6rs!", "install-r7rs!", "integer->char", "integer-expt", "integer-length", "integer?", "interaction-environment", "iota", "isatty?", "issue-deprecation-warning", "keyword->symbol", "keyword-like-symbol->keyword", "keyword?", "kill", "kw-arg-ref", "last", "last-pair", "lcm", "length", "length+", "link", "list", "list->array", "list->bitvector", "list->char-set", "list->char-set!", "list->f32vector", "list->f64vector", "list->s16vector", "list->s32vector", "list->s64vector", "list->s8vector", "list->string", "list->symbol", "list->typed-array", "list->u16vector", "list->u32vector", "list->u64vector", "list->u8vector", "list->vector", "list-cdr-ref", "list-cdr-set!", "list-copy", "list-head", "list-index", "list-ref", "list-set!", "list-tabulate", "list-tail", "list=", "list?", "listen", "load-compiled", "load-extension", "load-from-path", "load-in-vicinity", "load-user-init", "local-define", "local-define-module", "local-ref", "local-ref-module", "local-remove", "local-set!", "localtime", "log", "log10", "logand", "logbit?", "logcount", "logior", "lognot", "logtest", "logxor", "lookup-duplicates-handlers", "lset-adjoin", "lset-diff+intersection", "lset-diff+intersection!", "lset-difference", "lset-difference!", "lset-intersection", "lset-intersection!", "lset-union", "lset-union!", "lset-xor", "lset-xor!", "lset<=", "lset=", "lstat", "macro-binding", "macro-name", "macro-transformer", "macro-type", "macro?", "macroexpand", "macroexpanded?", "magnitude", "major-version", "make-array", "make-autoload-interface", "make-bitvector", "make-doubly-weak-hash-table", "make-exception", "make-exception-from-throw", "make-exception-type", "make-f32vector", "make-f64vector", "make-fluid", "make-fresh-user-module", "make-generalized-vector", "make-guardian", "make-hash-table", "make-hook", "make-list", "make-module", "make-modules-in", "make-mutable-parameter", "make-object-property", "make-parameter", "make-polar", "make-procedure-with-setter", "make-promise", "make-prompt-tag", "make-record-type", "make-rectangular", "make-regexp", "make-s16vector", "make-s32vector", "make-s64vector", "make-s8vector", "make-shared-array", "make-socket-address", "make-soft-port", "make-srfi-4-vector", "make-stack", "make-string", "make-struct-layout", "make-struct/no-tail", "make-struct/simple", "make-symbol", "make-syntax-transformer", "make-thread-local-fluid", "make-typed-array", "make-u16vector", "make-u32vector", "make-u64vector", "make-u8vector", "make-unbound-fluid", "make-undefined-variable", "make-variable", "make-variable-transformer", "make-vector", "make-vtable", "make-weak-key-hash-table", "make-weak-value-hash-table", "map", "map!", "map-in-order", "max", "member", "memoize-expression", "memoized-typecode", "memq", "memv", "merge", "merge!", "micro-version", "min", "minor-version", "mkdir", "mkdtemp", "mknod", "mkstemp", "mkstemp!", "mktime", "module-add!", "module-autoload!", "module-binder", "module-bound?", "module-call-observers", "module-clear!", "module-constructor", "module-declarative?", "module-defer-observers", "module-define!", "module-define-submodule!", "module-defined?", "module-duplicates-handlers", "module-ensure-local-variable!", "module-export!", "module-export-all!", "module-filename", "module-for-each", "module-generate-unique-id!", "module-gensym", "module-import-interface", "module-import-obarray", "module-kind", "module-local-variable", "module-locally-bound?", "module-make-local-var!", "module-map", "module-modified", "module-name", "module-next-unique-id", "module-obarray", "module-obarray-get-handle", "module-obarray-ref", "module-obarray-remove!", "module-obarray-set!", "module-observe", "module-observe-weak", "module-observers", "module-public-interface", "module-re-export!", "module-ref", "module-ref-submodule", "module-remove!", "module-replace!", "module-replacements", "module-reverse-lookup", "module-search", "module-set!", "module-submodule-binder", "module-submodules", "module-symbol-binding", "module-symbol-interned?", "module-symbol-local-binding", "module-symbol-locally-interned?", "module-transformer", "module-unobserve", "module-use!", "module-use-interfaces!", "module-uses", "module-variable", "module-version", "module-weak-observers", "module?", "modulo", "modulo-expt", "move->fdes", "nan", "nan?", "negate", "negative?", "nested-define!", "nested-define-module!", "nested-ref", "nested-ref-module", "nested-remove!", "nested-set!", "netent:addrtype", "netent:aliases", "netent:name", "netent:net", "newline", "ngettext", "nice", "nil?", "ninth", "noop", "not", "not-pair?", "null-environment", "null-list?", "null?", "number->string", "number?", "numerator", "object->string", "object-address", "object-properties", "object-property", "odd?", "open", "open-fdes", "open-file", "open-input-file", "open-input-string", "open-io-file", "open-output-file", "open-output-string", "opendir", "or-map", "output-port?", "pair-fold", "pair-fold-right", "pair-for-each", "pair?", "parameter-converter", "parameter-fluid", "parameter?", "parse-path", "parse-path-with-ellipsis", "partition", "partition!", "passwd:dir", "passwd:gecos", "passwd:gid", "passwd:name", "passwd:passwd", "passwd:shell", "passwd:uid", "pause", "peek", "peek-char", "pipe", "pk", "port->fdes", "port-closed?", "port-column", "port-conversion-strategy", "port-encoding", "port-filename", "port-for-each", "port-line", "port-mode", "port-revealed", "port-with-print-state", "port?", "positive?", "primitive-_exit", "primitive-eval", "primitive-exit", "primitive-fork", "primitive-load", "primitive-load-path", "primitive-move->fdes", "primitive-read", "print-disable", "print-enable", "print-exception", "print-options", "print-options-interface", "procedure", "procedure-documentation", "procedure-minimum-arity", "procedure-name", "procedure-properties", "procedure-property", "procedure-source", "procedure-with-setter?", "procedure?", "process-use-modules", "program-arguments", "promise?", "proper-list?", "protoent:aliases", "protoent:name", "protoent:proto", "provide", "provided?", "purify-module!", "putenv", "quit", "quotient", "raise", "raise-exception", "random", "random-state->datum", "random-state-from-platform", "random:exp", "random:hollow-sphere!", "random:normal", "random:normal-vector!", "random:solid-sphere!", "random:uniform", "rational?", "rationalize", "read", "read-char", "read-disable", "read-enable", "read-hash-extend", "read-hash-procedure", "read-hash-procedures", "read-options", "read-options-interface", "read-syntax", "readdir", "readlink", "real-part", "real?", "record-accessor", "record-constructor", "record-modifier", "record-predicate", "record-type-constructor", "record-type-descriptor", "record-type-extensible?", "record-type-fields", "record-type-has-parent?", "record-type-mutable-fields", "record-type-name", "record-type-opaque?", "record-type-parent", "record-type-parents", "record-type-properties", "record-type-uid", "record-type?", "record?", "recv!", "recvfrom!", "redirect-port", "reduce", "reduce-right", "regexp-exec", "regexp?", "release-port-handle", "reload-module", "remainder", "remove", "remove!", "remove-hook!", "rename-file", "repl-reader", "reset-hook!", "resolve-interface", "resolve-module", "resolve-r6rs-interface", "restore-signals", "restricted-vector-sort!", "reverse", "reverse!", "reverse-list->string", "rewinddir", "rmdir", "round", "round-ash", "round-quotient", "round-remainder", "round/", "run-hook", "s16vector", "s16vector->list", "s16vector-length", "s16vector-ref", "s16vector-set!", "s16vector?", "s32vector", "s32vector->list", "s32vector-length", "s32vector-ref", "s32vector-set!", "s32vector?", "s64vector", "s64vector->list", "s64vector-length", "s64vector-ref", "s64vector-set!", "s64vector?", "s8vector", "s8vector->list", "s8vector-length", "s8vector-ref", "s8vector-set!", "s8vector?", "save-module-excursion", "scheme-report-environment", "scm-error", "search-path", "second", "seed->random-state", "seek", "select", "self-evaluating?", "send", "sendfile", "sendto", "servent:aliases", "servent:name", "servent:port", "servent:proto", "set-autoloaded!", "set-car!", "set-cdr!", "set-current-dynamic-state", "set-current-error-port", "set-current-input-port", "set-current-module", "set-current-output-port", "set-exception-printer!", "set-module-binder!", "set-module-declarative?!", "set-module-duplicates-handlers!", "set-module-filename!", "set-module-kind!", "set-module-name!", "set-module-next-unique-id!", "set-module-obarray!", "set-module-observers!", "set-module-public-interface!", "set-module-submodule-binder!", "set-module-submodules!", "set-module-transformer!", "set-module-uses!", "set-module-version!", "set-object-properties!", "set-object-property!", "set-port-column!", "set-port-conversion-strategy!", "set-port-encoding!", "set-port-filename!", "set-port-line!", "set-port-revealed!", "set-procedure-minimum-arity!", "set-procedure-properties!", "set-procedure-property!", "set-program-arguments", "set-source-properties!", "set-source-property!", "set-struct-vtable-name!", "set-symbol-property!", "set-tm:gmtoff", "set-tm:hour", "set-tm:isdst", "set-tm:mday", "set-tm:min", "set-tm:mon", "set-tm:sec", "set-tm:wday", "set-tm:yday", "set-tm:year", "set-tm:zone", "setaffinity", "setegid", "setenv", "seteuid", "setgid", "setgr", "setgrent", "setgroups", "sethost", "sethostent", "sethostname", "setitimer", "setlocale", "setnet", "setnetent", "setpgid", "setpriority", "setproto", "setprotoent", "setpw", "setpwent", "setrlimit", "setserv", "setservent", "setsid", "setsockopt", "setter", "setuid", "setvbuf", "seventh", "shared-array-increments", "shared-array-offset", "shared-array-root", "shutdown", "sigaction", "simple-exceptions", "simple-format", "sin", "sinh", "sixth", "sleep", "sloppy-assoc", "sloppy-assq", "sloppy-assv", "sockaddr:addr", "sockaddr:fam", "sockaddr:flowinfo", "sockaddr:path", "sockaddr:port", "sockaddr:scopeid", "socket", "socketpair", "sort", "sort!", "sort-list", "sort-list!", "sorted?", "source-properties", "source-property", "span", "span!", "split-at", "split-at!", "sqrt", "stable-sort", "stable-sort!", "stack-id", "stack-length", "stack-ref", "stack?", "stat", "stat:atime", "stat:atimensec", "stat:blksize", "stat:blocks", "stat:ctime", "stat:ctimensec", "stat:dev", "stat:gid", "stat:ino", "stat:mode", "stat:mtime", "stat:mtimensec", "stat:nlink", "stat:perms", "stat:rdev", "stat:size", "stat:type", "stat:uid", "status:exit-val", "status:stop-sig", "status:term-sig", "strerror", "strftime", "string", "string->char-set", "string->char-set!", "string->list", "string->number", "string->symbol", "string-any", "string-any-c-code", "string-append", "string-append/shared", "string-bytes-per-char", "string-capitalize", "string-capitalize!", "string-ci->symbol", "string-ci<", "string-ci<=", "string-ci<=?", "string-ci<>", "string-ci<?", "string-ci=", "string-ci=?", "string-ci>", "string-ci>=", "string-ci>=?", "string-ci>?", "string-compare", "string-compare-ci", "string-concatenate", "string-concatenate-reverse", "string-concatenate-reverse/shared", "string-concatenate/shared", "string-contains", "string-contains-ci", "string-copy", "string-copy!", "string-count", "string-delete", "string-downcase", "string-downcase!", "string-drop", "string-drop-right", "string-every", "string-every-c-code", "string-fill!", "string-filter", "string-fold", "string-fold-right", "string-for-each", "string-for-each-index", "string-hash", "string-hash-ci", "string-index", "string-index-right", "string-join", "string-length", "string-map", "string-map!", "string-normalize-nfc", "string-normalize-nfd", "string-normalize-nfkc", "string-normalize-nfkd", "string-null?", "string-pad", "string-pad-right", "string-prefix-ci?", "string-prefix-length", "string-prefix-length-ci", "string-prefix?", "string-ref", "string-replace", "string-reverse", "string-reverse!", "string-rindex", "string-set!", "string-skip", "string-skip-right", "string-split", "string-suffix-ci?", "string-suffix-length", "string-suffix-length-ci", "string-suffix?", "string-tabulate", "string-take", "string-take-right", "string-titlecase", "string-titlecase!", "string-tokenize", "string-trim", "string-trim-both", "string-trim-right", "string-unfold", "string-unfold-right", "string-upcase", "string-upcase!", "string-utf8-length", "string-xcopy!", "string<", "string<=", "string<=?", "string<>", "string<?", "string=", "string=?", "string>", "string>=", "string>=?", "string>?", "string?", "strptime", "struct-layout", "struct-ref", "struct-ref/unboxed", "struct-set!", "struct-set!/unboxed", "struct-vtable", "struct-vtable-name", "struct-vtable?", "struct?", "substring", "substring-fill!", "substring-move!", "substring/copy", "substring/read-only", "substring/shared", "supports-source-properties?", "symbol", "symbol->keyword", "symbol->string", "symbol-append", "symbol-fref", "symbol-fset!", "symbol-hash", "symbol-interned?", "symbol-pref", "symbol-prefix-proc", "symbol-property", "symbol-property-remove!", "symbol-pset!", "symbol?", "symlink", "sync", "syntax->datum", "syntax-source", "syntax-violation", "system", "system*", "system-async-mark", "system-error-errno", "system-file-name-convention", "take", "take!", "take-right", "take-while", "take-while!", "tan", "tanh", "tcgetpgrp", "tcsetpgrp", "tenth", "textdomain", "third", "throw", "thunk?", "times", "tm:gmtoff", "tm:hour", "tm:isdst", "tm:mday", "tm:min", "tm:mon", "tm:sec", "tm:wday", "tm:yday", "tm:year", "tm:zone", "tmpfile", "tmpnam", "tms:clock", "tms:cstime", "tms:cutime", "tms:stime", "tms:utime", "transpose-array", "truncate", "truncate-file", "truncate-quotient", "truncate-remainder", "truncate/", "try-load-module", "try-module-autoload", "ttyname", "typed-array?", "tzset", "u16vector", "u16vector->list", "u16vector-length", "u16vector-ref", "u16vector-set!", "u16vector?", "u32vector", "u32vector->list", "u32vector-length", "u32vector-ref", "u32vector-set!", "u32vector?", "u64vector", "u64vector->list", "u64vector-length", "u64vector-ref", "u64vector-set!", "u64vector?", "u8vector", "u8vector->list", "u8vector-length", "u8vector-ref", "u8vector-set!", "u8vector?", "ucs-range->char-set", "ucs-range->char-set!", "umask", "uname", "unfold", "unfold-right", "unmemoize-expression", "unread-char", "unread-string", "unsetenv", "unspecified?", "unzip1", "unzip2", "unzip3", "unzip4", "unzip5", "use-srfis", "user-modules-declarative?", "using-readline?", "usleep", "utime", "utsname:machine", "utsname:nodename", "utsname:release", "utsname:sysname", "utsname:version", "values", "variable-bound?", "variable-ref", "variable-set!", "variable-unset!", "variable?", "vector", "vector->list", "vector-copy", "vector-fill!", "vector-length", "vector-move-left!", "vector-move-right!", "vector-ref", "vector-set!", "vector?", "version", "version-matches?", "waitpid", "warn", "weak-key-hash-table?", "weak-value-hash-table?", "with-continuation-barrier", "with-dynamic-state", "with-error-to-file", "with-error-to-port", "with-error-to-string", "with-exception-handler", "with-fluid*", "with-fluids*", "with-input-from-file", "with-input-from-port", "with-input-from-string", "with-output-to-file", "with-output-to-port", "with-output-to-string", "with-throw-handler", "write", "write-char", "xcons", "xsubstring", "zero?", "zip", }
# By default the LibriSpeech corpus is set. path_to_corpus = '../audio_data/LibriSpeech/' # By default librispeech file-name has been set. Please modify if you are using some other corpus speaker_meta_info_file_name='SPEAKERS.TXT' # Each of the subset will have deifferent output sub-folder identified by subset-type output_folder='./output/' #Word Meta_info_file path path_to_word_meta_info='./word_meta_info/' #Utterance_Level_meta_info path path_to_utt_meta_info='./utt_meta_info/' # log-file path path_to_log_file = './log/' #Google-API-KEY file is required to run Google Cloud ASR path_to_google_api_key='../Google_API_Key/api-key.json'
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def getDecimalValue(self, head: ListNode) -> int: ans = 0 while head: ans = 2*ans + head.val head = head.next return ans
def MySort(UnsortedArray): n=len(UnsortedArray) if n==1: SortedArray=UnsortedArray else: midpoint=n//2 Array1=MySort(UnsortedArray[0:midpoint]) Array2=MySort(UnsortedArray[midpoint:n]) i=0; j=0; SortedArray=[] while i<midpoint and j<n-midpoint: if Array1[i]<Array2[j]: SortedArray.append(Array1[i]) i+=1 else: SortedArray.append(Array2[j]) j+=1 if i==midpoint: SortedArray+=Array2[j:(n-midpoint)] else: SortedArray+=Array1[i:midpoint] return SortedArray MyInput=[95,33,7,87,665,4,2,5,4,8,56,5,13,45,6,87,34,345,1,6,7,67,434,53,24,64] print(MySort(MyInput))
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def reverseList1(self, head: Optional[ListNode]) -> Optional[ListNode]: new_head = None node = head while node: # 3 -> 4 -> 5 next_node = node.next # 3 node.next = new_head # 2-> 1-> 0 new_head = node # 2-> 1-> 0 node = next_node return new_head def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]: new_head, node = self.reverse(head) return new_head def reverse(self, head: Optional[ListNode]) -> Optional[ListNode]: # 5 -> 4 -> 3 -> 2 -> 1 if not head: return head, head if head.next: new_head, node = self.reverse(head.next) node.next = head head.next = None return new_head, node.next return head, head
class Var(object) : def __init__(self, name) : self.name = name def __str__(self) : return str(self.name) class Data(object) : def __init__(self, x) : self.x = x def __str__(self) : return str(self.x) class Fun(object) : def __init__(self, var, body) : self.var = var self.body = body def __str__(self) : return "function(" + str(self.var) + ")" + str(self.body) class Prim(object) : def __init__(self, op, args) : self.op = op self.args = args self.ops = {'ADD':'+', 'SUB':'-', 'MUL':'*', 'DIV':'/', 'EQ':'==', 'NOTEQ':'!=', 'LT':'<', 'LTE':'<=', 'GT':'>', 'GTE':'>=', 'AND':'&&', 'OR':'||', 'NOT':'!'} def __str__(self) : if (self.op == "SEQ") : return " ; ".join(map(str, self.args)) else : return "(" + str(self.args[0]) + " " + self.ops[self.op] + " " + str(self.args[1]) + ")" class Prop(object) : def __init__(self, base, field) : self.base = base self.field = field def __str__(self) : return str(self.base) + "." + self.field class Assign(object) : def __init__(self, op, target, source) : self.op = op self.target = target self.source = source def __str__(self) : return str(self.target) + " " + str(self.op) + "=" + str(self.source) class Let(object) : def __init__(self, var, expression, body) : self.var = var self.expression = expression self.body = body def __str__(self) : return "var " + str(self.var) + "=" + str(self.expression) + "; " + str(self.body) class If(object) : def __init__(self, condition, thenExp, elseExp) : self.condition = condition self.thenExp = thenExp self.elseExp = elseExp def __str__(self) : return "if (" + str(self.condition) + ") {" + str(thenExp) + "} else {" + str(self.elseExp) + "}" class Loop(object) : def __init__(self, var, collection, body) : self.var = var self.collection = collection self.body = body def __str__(self) : #if (type(self.collection) == Out) : # Assume it is an output # var = self.collection.location # collection = self.collection.expression #else : # var = self.var # collection = self.collection #return "for (" + str(var) + " in " + str(collection) + ") {" + str(self.body) + "}" return "for (" + str(self.var) + " in " + str(self.collection) + ") {" + str(self.body) + "}" class Call(object) : def __init__(self, target, method, args) : self.target = target self.method = method self.args = args def __str__(self) : return str(self.target) + "." + str(self.method) + "(" + ",".join(map(str, self.args)) + ")" class Out(object) : def __init__(self, location, expression) : self.location = location self.expression = expression def __str__(self) : return "OUTPUT(" + '"' + str(self.location) + '",' + str(self.expression) + ")" class In(object) : def __init__(self, location) : self.location = location def __str__(self) : return "INPUT(" + '"' + self.location + '")' class Skip(object) : def __init__(self) : pass def __str__(self) : return "skip"
class Url: """ This module implements useful methods that manipulate urls, used in the project. """ _github_main_page_url = 'https://github.com' _googlecache_urlprefix = 'http://webcache.googleusercontent.com/search?q=' @staticmethod def github_url(relative_url): """ Get the absolute url from the repository relative url hosted on Github """ if type(relative_url) is str: return f'{Url._github_main_page_url}/{relative_url}' else: raise ValueError('relative_url must be a string.') @staticmethod def cached(url): """ Get the google cached version of url """ if type(url) is str: return f'{Url._googlecache_urlprefix}{url}' else: raise ValueError('url must be a string.')
op = input() ops = {} for i in range(len(op)): if op[i + 1] == ':': ops[op[i]] = True elif op[i + 1] != ':' and op != ':': ops[op[i]] = False n = int(input()) for idx in range(1, n + 1): ans = '' print("Case {0}: {1}".format(idx, ans))
class Solution: def minReorder(self, n: int, connections: List[List[int]]) -> int: tree = [[] for _ in range(n)] # a --> b for a, b in connections: tree[a].append((b, 1)) tree[b].append((a, 0)) self.ans = 0 def dfs(u, parent): for v, d in tree[u]: if v != parent: if d == 1: self.ans += 1 dfs(v, u) dfs(0, -1) return self.ans
# Examples to see class inheritance class Car: """ A class that models a real life car in a oversimplified way.""" def __init__(self, make, model, year): """Function to store key attributes of the car.""" self.make = make self.model = model self.year = year self.odometer = 0 def describe_car(self): """Function to print the name of the car in a clear fashion.""" car_description = f"{self.year} {self.make} {self.model}" return car_description.title() def read_odometer(self): """Function to print the car's mileage""" print(f"The {self.model} has {self.odometer} miles on it.") def update_odometer(self, value): """Function to update the value of odometer and avoid rollback.""" if value >= self.odometer: self.odometer = value else: print("odometer can't be rolled back!") def increment_odometer(self, miles): """Function to increment odometer for every road trip.""" self.odometer += miles def fill_gas_tank(self): """Function to simulate filling glass tanks.""" print("Thanks for filling the gas!") # Working with an inherited class. class Electric(Car): """Special child class of regular cars. """ def __init__(self, make, model, year): """All attributes inherited from parent class.""" super().__init__(make, model, year) self.battery_size = 100 def describe_battery(self): """Method to print the battery size of the electric vehicle.""" print(f"The battery size of the vehicle is {self.battery_size} kWh.") def fill_gas_tank(self): """Method to override the gas tank.""" print("Electric cars don't have a glass tank.") # Working with an instance of inherited class. my_tesla = Electric('tesla', 'model s', 2019) print(my_tesla.describe_car()) my_tesla.describe_battery()
""" Given an array of positive and negative numbers, arrange them in an alternate fashion such that every positive number is followed by negative and vice-versa maintaining the order of appearance. """ def find_first_positive(lst): j = 0 pivot = 0 for i in range(len(lst)): if lst[i] < pivot: temp = lst[i] lst[i] = lst[j] lst[j] = temp j = j+1 return j # it is holding first index of positive number # now let's arrange the list such that it contains 1 +ve and 1 -ve def re_arrange_numbers(lst): p = find_first_positive(lst) num = 0 while len(lst) > p >num: temp = lst[num] lst[num] = lst[p] lst[p] = temp p += 1 num += 2 lst = [9, -3, 5, -2, -8, -6, 1, 3, 1, 12, 43, 56] re_arrange_numbers(lst) print(lst)