content
stringlengths
7
1.05M
# Create by Packetsss # Personal use is allowed # Commercial use is prohibited name = input("Enter your baphoon:") age = input("Enter your chikka:") print("WTF " + name + "! You are " + age + "??") num1 = input("Number 1:") num2 = input("Number 2:") result = num1 + num2
####!/usr/bin/env python3 """ Parse data files with json output for estack bulk load """ def elk_index(elk_index_name): """ Index setup for ELK Stack bulk install """ index_tag_full = {} index_tag_inner = {} index_tag_inner['_index'] = elk_index_name index_tag_inner['_type'] = elk_index_name index_tag_full['index'] = index_tag_inner return index_tag_full if __name__ == '__main__': elk_index()
class Solution: def twoCitySchedCost(self, costs: List[List[int]]) -> int: for i in range(0,len(costs)): costs[i].append(costs[i][0]-costs[i][1]) costs.sort(key = lambda x:x[2]) result=0 for i in range(0,len(costs)//2): result+=costs[i][0] for i in range(len(costs)//2,len(costs)): result+=costs[i][1] return result
""" Constants Module for Flambda APP Version: 1.0.0 """ LIMIT = 20 OFFSET = 0 PAGINATION_LIMIT = 100
print("To print the place values of integer") a=int(input("Enter the integer value:")) n=a%10 print("The unit digit of {} is{}".format(a,n))
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution(object): def deleteNode(self, root, key): if not root: # if root doesn't exist, just return it return root if root.val > key: # if key value is less than root value, find the node in the left subtree root.left = self.deleteNode(root.left, key) elif root.val < key: # if key value is greater than root value, find the node in right subtree root.right = self.deleteNode(root.right, key) else: #if we found the node (root.value == key), start to delete it if not root.right: # if it doesn't have right children, we delete the node then new root would be root.left return root.left if not root.left: # if it has no left children, we delete the node then new root would be root.right return root.right # if the node have both left and right children, we replace its value with the minmimum value in the right subtree and then delete that minimum node in the right subtree temp = root.right mini = temp.val while temp.left: temp = temp.left mini = temp.val root.val = mini # replace value root.right = self.deleteNode(root.right,root.val) # delete the minimum node in right subtree return root
ilksayi=1 ikincisayi=1 fibo=[ilksayi,ikincisayi] for i in range(0,20): ilksayi,ikincisayi=ikincisayi,ilksayi+ikincisayi fibo.append(ikincisayi) print(fibo)
class BinaryNotFound(Exception): def __init__(self, binary_name): Exception.__init__(self) self.binary_name = binary_name class BinaryCallFailed(Exception): def __init__(self): Exception.__init__(self) class InvalidMedia(Exception): def __init__(self, media_path): Exception.__init__(self) self.media_path = media_path class StreamIndexOutOfBound(Exception): def __init__(self): Exception.__init__(self) class StreamEntryNotFound(Exception): def __init__(self): Exception.__init__(self) class StreamLoadError(Exception): def __init__(self): Exception.__init__(self)
#!/usr/bin/python2.4 # # Copyright 2009 Google Inc. # # Licensed under the Apache License, Version 2.0 (the 'License') # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # 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. """ Defines the code snippets that the JavaScript Knowledge Base tracks. """ __author__ = 'msamuel@google.com (Mike Samuel)' __all__ = ['SNIPPET_GROUPS', 'with_name', 'CODE', 'DOC', 'GOOD', 'NAME', 'SUMMARY', 'VALUES', 'ABBREV', 'SNIPPET_NAMES'] def alt(mayThrow, altValue): """Combines an expression with a fallback to use if the first expression failes with an exception.""" return '(function(){try{return(%s);}catch(e){return(%s);}})()' % ( mayThrow, altValue) # Dictionary keys CODE = 'code' # The ES source code to execute DOC = 'doc' # Detailed description of the reason this snippet is important. GOOD = 'good' # Good values NAME = 'name' # Identifier used in database SUMMARY = 'summary' # Short description. # Expected results as JSON or the keyword "throw" which indicates abnormal exit. # Should not be reordered or removed from VALUES = 'values' # Maps values to abbreviated names. For the large display, we create a set of # abbreviated values and display those as representative of a whole group of # tests. ABBREV = 'abbrev' # Common value sets # Position is important so these should not be reordered or removed from. BOOL_VALUES = ('false', 'true') T_BOO = '"boolean"' T_FUN = '"function"' T_NUM = '"number"' T_OBJ = '"object"' T_STR = '"string"' T_UND = '"undefined"' TYPEOF_VALUES = (T_BOO, T_FUN, T_NUM, T_OBJ, T_STR, T_UND, #'"array"', '"null"', '"other"', '"unknown"' ) THROWS = ('throw',) # Groups of side-effect free JS expressions that give information # about the environment in which JS runs. # This is an object whose repr() form is properly formatted JSON. # For this to work, it must not contain any non-ASCII codepoints. SNIPPET_GROUPS = ( # Get information about the browser that we can use when trying to # map a User-Agent request header to an environment file. # Some ES global definitions ( { NAME: 'CoreFeatures', DOC: 'Summary of JS features independent of browser APIs' }, { CODE: 'typeof undefined', NAME: 'Undef', VALUES: TYPEOF_VALUES, GOOD: ('"undefined"',), DOC: 'Is the global undefined really undefined', SUMMARY: 'undef OK', ABBREV: {} }, { CODE: 'Infinity === 1/0', NAME: 'Inf', VALUES: BOOL_VALUES, GOOD: ('true',), DOC: 'Is the global Infinity set properly', SUMMARY: 'Inf OK', ABBREV: {} }, { CODE: 'NaN !== NaN', NAME: 'NaN', VALUES: BOOL_VALUES, GOOD: ('true',), DOC: 'Is the global NaN set properly', SUMMARY: 'NaN OK', ABBREV: {} }, { CODE: '!!this.window && this === window', NAME: 'GlblWin', VALUES: BOOL_VALUES, SUMMARY: 'window is global', ABBREV: {}, DOC: 'Does "window" alias the global scope?', GOOD: ('true',) }, { CODE: '!(function () { return this; }.call(null))', NAME: 'Strict', VALUES: BOOL_VALUES, SUMMARY: 'Can "use strict"', DOC: 'Is EcmaScript5 strict mode supported?', GOOD: ('true',), ABBREV: { 'true': 'strict mode' } }, { CODE: 'typeof Array.slice', NAME: 'ArrSlice', VALUES: TYPEOF_VALUES, SUMMARY: 'Array.slice', GOOD: (T_FUN,), ABBREV: { T_FUN: 'Array.slice' } }, { CODE: 'typeof Function.prototype.bind', NAME: 'FnBind', VALUES: TYPEOF_VALUES, GOOD: (T_FUN,), SUMMARY: 'fn.bind', ABBREV: { T_FUN: 'fn.bind' } }, { CODE: alt('!!eval("({get x() { return true; }})").x', 'false'), NAME: 'Gtrs', VALUES: BOOL_VALUES, DOC: 'Are getters/setters supported?', SUMMARY: 'getters', GOOD: ('true',), ABBREV: { 'true' : 'getters' } }, { CODE: '(function (undefined) { return (0,eval)("undefined") === 1; })(1)', NAME: 'ES5Eval', GOOD: ('true',), SUMMARY: 'eval function', VALUES: BOOL_VALUES, DOC: ('Does eval differ when used as a function vs. as an operator?' ' See ES5 sec 15.1.2.1.1.'), ABBREV: { 'true': 'ES5 eval' } }, { CODE: 'typeof Date.now', NAME: 'DateNow', VALUES: TYPEOF_VALUES, ABBREV: {} }, ), ( { NAME: 'Serialization', DOC: 'JSON and serialization support' }, ## Check whether native implementations are available { CODE: 'typeof JSON', NAME: 'JSON', VALUES: TYPEOF_VALUES, DOC: 'Is JSON defined natively?', SUMMARY: 'native JSON', GOOD: (T_OBJ, T_FUN), ABBREV: { T_OBJ: 'JSON', T_FUN: 'JSON' } }, { CODE: 'typeof Object.prototype.toSource', NAME: 'ObjSrc', VALUES: TYPEOF_VALUES, ABBREV: { T_FUN: 'toSource' } }, { CODE: 'typeof Object.prototype.toJSON', NAME: 'Obj2JSON', VALUES: TYPEOF_VALUES, ABBREV: { T_FUN: 'toJSON' } }, { CODE: 'typeof Date.prototype.toISOString', ABBREV: {}, NAME: 'DateISO', VALUES: TYPEOF_VALUES, SUMMARY: 'date.toISOString' }, { CODE: 'typeof Date.prototype.toJSON', ABBREV: {}, NAME: 'DateJSON', VALUES: TYPEOF_VALUES, SUMMARY: 'date.toJSON' }, { CODE: ('typeof JSON !== "undefined"' ' && JSON.stringify(false,' ' function (x) { return !this[x]; }) === "true"'), NAME: 'JSONStringify', VALUES: BOOL_VALUES, ABBREV: {}, SUMMARY: 'JSON.stringify with replacer' }, { CODE: 'typeof uneval', NAME: 'Uneval', VALUES: TYPEOF_VALUES, ABBREV: { T_FUN: 'uneval' } }, { CODE: 'typeof atob', NAME: 'B64', VALUES: TYPEOF_VALUES, GOOD: (T_FUN,), SUMMARY: 'Base64 encode/decode fns', ABBREV: {} }, ), ( { NAME: 'Events', DOC: 'Event APIs available.' }, { CODE: 'typeof addEventListener', NAME: 'StdEv', VALUES: TYPEOF_VALUES, SUMMARY: 'standard events', ABBREV: { T_OBJ: 'DOM2', T_FUN: 'DOM2' } }, # IE makes a lot of its functions, objects. # Fun fact: but not ActiveXObject. { CODE: 'typeof attachEvent', NAME: 'TOIEEv', VALUES: TYPEOF_VALUES, ABBREV: { T_OBJ: 'attachEvent', T_FUN: 'attachEvent' } }, { CODE: '!!window.attachEvent', NAME: 'IEEv', VALUES: BOOL_VALUES, SUMMARY: 'IE events', ABBREV: { 'true': 'IE style' } }, { CODE: 'typeof document.createEvent', NAME: 'DocCrtEv', VALUES: TYPEOF_VALUES, SUMMARY: 'doc.createEvent', ABBREV: {} }, { CODE: 'typeof document.createEventObject', NAME: 'TODocCrtEvO', VALUES: TYPEOF_VALUES, SUMMARY: 'createEventObject', ABBREV: {} }, { CODE: '!!document.createEventObject', NAME: 'DocCrtEvO', VALUES: BOOL_VALUES, SUMMARY: 'createEventObject', ABBREV: { 'true': 'createEventObject' } }, ), ( { NAME: 'DOM', DOC: 'DOM APIs' }, { CODE: 'typeof document.getElementsByClassName', NAME: 'DocElByClass', VALUES: TYPEOF_VALUES, SUMMARY: 'native getElementsByClassName', GOOD: (T_FUN,), ABBREV: { T_FUN: 'getElsByClass' } }, { CODE: 'typeof document.documentElement.getElementsByClassName', NAME: 'ElByClass', VALUES: TYPEOF_VALUES, SUMMARY: 'native getElementsByClassName', GOOD: (T_FUN,), ABBREV: { T_FUN: 'getElsByClass' } }, { CODE: '!!document.all', NAME: 'DocAll', VALUES: BOOL_VALUES, SUMMARY: 'document.all', DOC: 'Is document.all present?', ABBREV: { 'true': 'document.all' } }, { CODE: alt( "document.createElement('<input type=\"radio\">').type === 'radio'", 'false'), NAME: 'ExtCreateEl', VALUES: BOOL_VALUES, SUMMARY: 'extended createElement syntax', ABBREV: { 'true': 'createElement+' } }, { CODE: 'typeof document.documentElement.compareDocumentPosition', NAME: 'CmpDocPos', VALUES: TYPEOF_VALUES, ABBREV: {}, SUMMARY: 'compareDocumentPosition' }, { CODE: 'typeof document.documentElement.contains', NAME: 'TOElCont', VALUES: TYPEOF_VALUES, ABBREV: {}, SUMMARY: 'Element.contains' }, { CODE: '!!document.documentElement.contains', NAME: 'ElCont', VALUES: BOOL_VALUES, SUMMARY: 'Element.contains', ABBREV: { 'true': 'contains' } }, { CODE: 'typeof document.createRange', NAME: 'DocCrtRng', VALUES: TYPEOF_VALUES, SUMMARY: 'doc.createRange', ABBREV: {} }, { CODE: 'typeof document.documentElement.doScroll', NAME: 'TODocElScroll', VALUES: TYPEOF_VALUES, SUMMARY: 'doScroll', ABBREV: { T_FUN: 'doScroll', T_OBJ: 'doScroll' } }, { CODE: '!!document.documentElement.doScroll', NAME: 'DocElScroll', VALUES: BOOL_VALUES, SUMMARY: 'doScroll', ABBREV: { 'true': 'doScroll' } }, { CODE: 'typeof document.documentElement.getBoundingClientRect', NAME: 'TODocElBoundRect', VALUES: TYPEOF_VALUES, ABBREV: {}, SUMMARY: 'getBoundingClientRect' }, { CODE: '!!document.documentElement.getBoundingClientRect', NAME: 'DocElBoundRect', VALUES: BOOL_VALUES, ABBREV: {}, SUMMARY: 'getBoundingClientRect' }, { CODE: '"sourceIndex" in document.documentElement', NAME: 'SrcIdxDocEl', VALUES: BOOL_VALUES, SUMMARY: 'html.sourceIndex', ABBREV: { 'true': 'sourceIndex' } }, { CODE: 'document.body.setAttribute.length === 2', NAME: 'SetAttr2', VALUES: BOOL_VALUES, SUMMARY: '2 param setAttribute', ABBREV: {}, DOC: 'Does setAttribute need only the two parameters?' }, { CODE: 'typeof toStaticHTML', NAME: 'stcHTML', VALUES: TYPEOF_VALUES, SUMMARY: 'toStaticHTML', GOOD: (T_FUN,), DOC: 'Does window.toStaticHTML exist?', ABBREV: { T_FUN: 'toStaticHTML' } }, ), ( { NAME: 'CSS', DOC: 'CSS' }, # Is the styleSheet member available. # http//yuiblog.com/blog/2007/06/07/style/ { CODE: "typeof document.createElement('style').styleSheet", NAME: 'DotSSheet', VALUES: TYPEOF_VALUES, SUMMARY: 'style.styleSheet', ABBREV: { T_FUN: '<style>.styleSheet', T_OBJ: '<style>.styleSheet' } }, { CODE: 'typeof document.body.style.cssText', NAME: 'DotCssText', VALUES: TYPEOF_VALUES, SUMMARY: 'cssText', ABBREV: { T_STR: 'cssText' } }, { CODE: 'typeof getComputedStyle', NAME: 'CompStyle', VALUES: TYPEOF_VALUES, SUMMARY: 'getComputedStyle', ABBREV: { T_FUN: 'getComputedStyle', T_OBJ: 'getComputedStyle' } }, { CODE: 'typeof document.body.currentStyle', NAME: 'TOCurStyle', VALUES: TYPEOF_VALUES, SUMMARY: 'currentStyle', ABBREV: { T_FUN: 'currentStyle', T_OBJ: 'currentStyle' } }, { CODE: '!!document.body.currentStyle', NAME: 'CurStyle', VALUES: BOOL_VALUES, SUMMARY: 'currentStyle', ABBREV: { 'true': 'currentStyle' } }, ), ( { NAME: 'Network', DOC: 'Network APIs' }, { CODE: 'typeof XMLHttpRequest', NAME: 'XHR', VALUES: TYPEOF_VALUES, ABBREV: {} }, { CODE: '!!window.XMLHttpRequest', NAME: 'BXHR', VALUES: BOOL_VALUES, SUMMARY: 'XMLHttpRequest', GOOD: ('true',), ABBREV: { 'true': 'XHR' } }, { CODE: 'typeof ActiveXObject', NAME: 'ActiveX', VALUES: TYPEOF_VALUES, SUMMARY: 'ActiveXObject', ABBREV: { T_FUN: 'ActiveX', T_OBJ: 'ActiveX' } }, { CODE: 'typeof postMessage', NAME: 'postMsg', VALUES: TYPEOF_VALUES, SUMMARY: 'postMessage', GOOD: (T_FUN,), ABBREV: { T_FUN: 'postMessage', T_OBJ: 'postMessage' } }, ), ( { NAME: 'Oddities', DOC: 'Bugs & Oddities' }, ## Known bugs and inconsistencies { CODE: 'void 0 === ((function(){})[-2])', NAME: 'LeakyFn', VALUES: BOOL_VALUES, GOOD: ('true',), DOC: 'Do functions not leak dangerous info in negative indices?', SUMMARY: 'Function Junk', ABBREV: { 'false': 'leaky fn' } }, { CODE: 'void 0 === ((function(){var b,a=function b(){};return b;})())', NAME: 'BadFnE', VALUES: BOOL_VALUES, DOC: 'Do function expressions not muck with the local scope?', SUMMARY: 'function exprs OK', GOOD: ('true',), ABBREV: { 'false': 'fn exprs declare' } }, { CODE: '(function () { try { throw null; } finally { return true; } })()', NAME: 'FinallyOK', VALUES: BOOL_VALUES + THROWS, DOC: 'Do finally blocks fire even if there\'s no catch on the stack.', SUMMARY: 'finally OK', GOOD: ('true',), ABBREV: { 'false': 'finally broken' } }, { CODE: ('0 === (function () {' ' var toString = 0; return (function x() { return toString; })();' '})()'), NAME: 'NReifScope', VALUES: BOOL_VALUES, DOC: ('Do function scope frames for named functions not inherit' ' from Object.prototype?' ' http://yura.thinkweb2.com/named-function-expressions/' '#spidermonkey-peculiarity'), SUMMARY: 'function scope OK', GOOD: ('true',), ABBREV: { 'false': 'broken scopes' } }, { CODE: '(function(){var e=true;try{throw false;}catch(e){}return e;})()', NAME: 'CatchScope', VALUES: BOOL_VALUES, DOC: 'Do exceptions scope properly?', SUMMARY: 'try scope OK', GOOD: ('true',), ABBREV: { 'false': 'catch leaks' } }, { CODE: "typeof new RegExp('x')", NAME: 'TORegx', VALUES: TYPEOF_VALUES, DOC: 'Are RegExps functions or objects?', ABBREV: {} }, { CODE: "'a'===('a'[0])", NAME: 'StrIdx', VALUES: BOOL_VALUES, SUMMARY: 'strings indexable', GOOD: ('true',), ABBREV: { 'false': '"x"[0] fails' } }, { CODE: '(function(){var a;if(0)function a(){}return void 0===a;})()', NAME: 'UnreachFn', VALUES: BOOL_VALUES, DOC: 'Are functions declared only if reachable?', SUMMARY: 'unreachable function', ABBREV: {} }, { CODE: 'typeof ({}).__proto__', NAME: 'ProtoMem', VALUES: TYPEOF_VALUES, DOC: 'Is __proto__ defined for objects?', SUMMARY: '__proto__', ABBREV: {} }, { CODE: 'eval("\'\u200d\'").length === 1', NAME: 'CfSig', VALUES: BOOL_VALUES, SUMMARY: '[:Cf:]', GOOD: ('true',), DOC: 'Are format control characters lexically significant?', ABBREV: { 'false': '[:Cf:]' } }, { CODE: "'a,,a'.split(',').length === 3", NAME: 'SplitOK', VALUES: BOOL_VALUES, GOOD: ('true',), DOC: 'Does string.split work properly -- no skipping blanks?', SUMMARY: 'String.split OK', ABBREV: { 'false': 'string.split broken' } }, { CODE: "[,].length === 1", NAME: 'ArrComma', VALUES: BOOL_VALUES, DOC: 'Is a trailing comma in an array ignored?', SUMMARY: 'Trailing comma', GOOD: ('true',), ABBREV: { 'false': '[,]' } }, { CODE: ('(function (a) { a.length = 0; for (var _ in a) { return false; }' ' return true; })([0])'), NAME: 'LenNoEnum', VALUES: BOOL_VALUES, DOC: ('Does the length property of an array become enumerable' ' after being set?'), SUMMARY: 'Length DontEnum', GOOD: ('true',), ABBREV: { 'false': 'enum length' } }, { CODE: '(function () { return arguments instanceof Array; })()', NAME: 'ArgsArr', VALUES: BOOL_VALUES, DOC: 'Is the arguments object an instanceof Array?', SUMMARY: 'arguments instanceof Array', GOOD: ('false',), ABBREV: { 'true': 'arguments array' } }, { CODE: ('(function () {' ' return arguments instanceof Array' ' && [].concat(arguments)[0][0] !== 1;' ' })(1, 2)'), NAME: 'CatArgsBug', VALUES: BOOL_VALUES, GOOD: ('false',), DOC: "Safari makes arguments an Array but breaks concat.", SUMMARY: 'Buggy arguments concat', ABBREV: { 'true': 'args concat' } }, { CODE: '(function () { for (var _ in {}) return false; return true; })()', NAME: 'EmptyO', VALUES: BOOL_VALUES, GOOD: ('true',), DOC: "Have enumerable keys been added to Object.prototype?", SUMMARY: '{} empty', ABBREV: { 'false': '{} not empty' } }, { CODE: '"name" in function () {}', NAME: 'FnName', VALUES: BOOL_VALUES, SUMMARY: 'fn.name', DOC: "Do functions have a <tt>name</tt> property?", ABBREV: {} }, { CODE: ('(function () {' ' function c() {}' ' c.prototype = {p:0};' ' return (new c).propertyIsEnumerable("p");' ' })()'), NAME: 'PropEnum', VALUES: BOOL_VALUES, DOC: "Are inherited properties inumerable?", SUMMARY: 'inherited enumerable', ABBREV: {} }, { CODE: ('(function (x) {' 'return eval("x",' 'function(x) {' 'return function() { return x * 0; };' '}(true));' '}(false))'), NAME: 'Eval2', VALUES: BOOL_VALUES + THROWS, DOC: "Does eval violate integrity of closures?", SUMMARY: 'eval(s,f)', ABBREV: { 'true': 'eval(s,f) bug', 'throw': 'eval(s,f) global' } }, { CODE: '"-1 2.0".replace(/\S+/g, Math.abs) === "1 2"', NAME: 'FRep', VALUES: BOOL_VALUES + THROWS, ABBREV: {}, DOC: 'Can functions be used to generate RegExp replacements?', SUMMARY: 'str.replace(re,fn)', GOOD: ('true',), }, { CODE: '(function () { for each (var k in [true]) { return k; } })()', NAME: 'ForEach', VALUES: BOOL_VALUES + THROWS, ABBREV: {}, SUMMARY: 'Are E4X style for-each loops available?' }, ), ) def init(): global __BY_NAME global SNIPPET_NAMES def dupes(items): seen = set() dupes = [] for item in items: if item in seen: dupes.append(item) else: seen.add(item) return dupes # sanity checks all_snippets = [] for group in SNIPPET_GROUPS: assert tuple is type(group) group_info = group[0] assert dict is type(group_info) assert NAME in group_info and DOC in group_info assert str is type(group_info[NAME]), repr(group_info) assert str is type(group_info[DOC]), repr(group_info) for snippet in group[1:]: all_snippets.append(snippet) values = snippet.get(VALUES) assert (tuple is type(values) and reduce(lambda a, b: a and type(b) is str, values, True) and len(set(values)) == len(values)), ( repr(snippet)) good = snippet.get(GOOD) if good is not None: assert (tuple is type(good) and reduce(lambda a, b: a and b in values, good, True) and len(set(good)) == len(good)), ( repr(snippet)) abbrev = snippet.get(ABBREV) assert (dict is type(abbrev) and reduce(lambda a, b: a and b in values and type(b) is str, abbrev.iterkeys(), True)), ( repr(snippet)) assert str is type(snippet.get(NAME)), repr(snippet) assert str is type(snippet.get(CODE)), repr(snippet) assert str is type(snippet.get(DOC, '')), repr(snippet) summary = snippet.get(SUMMARY, '') assert (str is type(summary) and len(summary) < 40 and '\n' not in summary), (repr(snippet)) names = [snippet[NAME] for snippet in all_snippets] assert len(set(names)) == len(all_snippets), repr(dupes(names)) group_names = [group[0][NAME] for group in SNIPPET_GROUPS] assert len(set(group_names)) == len(SNIPPET_GROUPS), ( repr(dupes(group_names))) # initialize derived globals __BY_NAME = dict([(snippet[NAME], snippet) for snippet in all_snippets]) SNIPPET_NAMES = set(__BY_NAME.keys()) for group in SNIPPET_GROUPS: __BY_NAME[group[0][NAME]] = group group_0_name = SNIPPET_GROUPS[0][0][NAME] # group names should not show up in SNIPPET_NAMES assert group_0_name not in SNIPPET_NAMES, group_0_name # but they should show up in with_name(...) assert group_0_name in __BY_NAME, group_0_name init() def with_name(name): """The snippet with the given name or None""" return __BY_NAME.get(name)
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def removeElements(self, head: ListNode, val: int) -> ListNode: current = head previous = None while current is not None: if current.val == val: if previous is None: head = current.next else: previous.next = current.next current = current.next else: previous = current current = current.next return head class WorseSolution: def removeElements(self, head: ListNode, val: int) -> ListNode: current = previous = head while current is not None: if current.val == val: if current == head: previous = current = head = current.next else: previous.next = current.next current = current.next else: previous = current current = current.next return head class SentinelTwoPointersSolution: def removeElements(self, head: ListNode, val: int) -> ListNode: sentinel = ListNode(val=0, next=head) prev, curr = sentinel, head while curr is not None: if curr.val == val: prev.next = curr.next else: prev = curr curr = curr.next return sentinel.next class FinalSolution: def removeElements(self, head: ListNode, val: int) -> ListNode: sentinel = ListNode(val=0, next=head) prev = sentinel while prev.next is not None: if prev.next.val == val: prev.next = prev.next.next else: prev = prev.next return sentinel.next
# Write a program that reads four integers and prints “two pairs” if the input consists # of two matching pairs (in some order) and “not two pairs” otherwise. For example, # 1 2 2 1 two pairs # 1 2 2 3 not two pairs # 2 2 2 2 two pairs number1 = int(input("Enter number one: ")) number2 = int(input("Enter number two: ")) number3 = int(input("Enter number three: ")) number4 = int(input("Enter number four: ")) if number1 == number4 and number2 == number3: print("Two pairs") elif number1 == number2 and number3 == number4: print("Two pairs") elif number1 == number2 and number1 == number3 and number1 == number4: print("Two pairs") else: print("Not two pairs")
## ## # File auto-generated against equivalent DynamicSerialize Java class class DeleteFilesRequest(object): def __init__(self): self.datesToDelete = None def getDatesToDelete(self): return self.datesToDelete def setDatesToDelete(self, datesToDelete): self.datesToDelete = datesToDelete def getFilename(self): return self.filename def setFilename(self, filename): self.filename = filename
# -*- coding: utf-8 -*- ''' In a given list the first element should become the last one. An empty list or list with only one element should stay the same. Input: List. Output: Iterable. ''' def replace_first(items): # your code here return items[1:] + items[:1] if __name__ == "__main__": print("Example:") print(list(replace_first([1, 2, 3, 4]))) # These "asserts" are used for self-checking and not for an auto-testing assert list(replace_first([1, 2, 3, 4])) == [2, 3, 4, 1] assert list(replace_first([1])) == [1] assert list(replace_first([])) == [] print("Coding complete? Click 'Check' to earn cool rewards!")
'''定义状态码''' # 正常 STATUS_OK = 0 #用户相关 STATUAS_INPUT_ERROR = 2001 STATUAS_LOGIN_ERROR = 2002 STATUS_FORM_ERROR = 2003 # 表单字段校验错误 # 服务相关 STATUAS_SERVICE_ERROR = 5001 class LogicError(BaseException): pass def generate_logic_error(name, code): base_cls = (LogicError,) return type(name, base_cls, {'code': code}) VcodeError = generate_logic_error('STATUAS_INPUT_ERROR', 2001)
'''面试题57-2:和为s的连续正数序列 输入一个正数s,打印出所有和为s的连续正数序列(至少含有两个数)。 -------------- Example: input:15 output: 1,2,3,4,5 4,5,6 7,8 ''' def squence_sum(target): if target < 3: return None small = 1 big = 2 cur_sum = small + big mid = (target + 1) >> 1 ret = [] while small < mid: if cur_sum == target: ret.append([x for x in range(small,big+1)]) while cur_sum > target and small < mid: cur_sum -= small small += 1 if cur_sum == target: ret.append([x for x in range(small,big+1)]) big += 1 cur_sum += big return ret if __name__ == '__main__': targets = [9, 15, -2, 4] for target in targets: print(squence_sum(target))
''' Created on 2015年11月30日 @author: Darren ''' ''' Problem Statement In this challenge you need to print the data that accompanies each integer in a list. In addition, if two strings have the same integers, you need to print the strings in their original order. Hence, your sorting algorithm should be stable, i.e. the original order should be maintained for equal elements. Insertion Sort and the simple version of Quicksort were stable, but the faster in-place version of Quicksort was not (since it scrambled around elements while sorting). In cases where you care about the original order, it is important to use a stable sorting algorithm. In this challenge, you will use counting sort to sort a list while keeping the order of the strings (with the accompanying integer) preserved. Challenge In the previous challenge, you created a "helper array" that contains information about the starting position of each element in a sorted array. Can you use this array to help you create a sorted array of the original list? Hint: You can go through the original array to access the strings. You can then use your helper array to help determine where to place those strings in the sorted array. Be careful about being one off. Details and a Twist You will be given a list that contains both integers and strings. Can you print the strings in order of their accompanying integers? If the integers for two strings are equal, ensure that they are print in the order they appeared in the original list. The Twist - Your clients just called with an update. They don't want you to print the first half of the original array. Instead, they want you to print a dash for any element from the first half. So you can modify your counting sort algorithm to sort the second half of the array only. Input Format - n, the size of the list ar. - n lines follow, each containing an integer x and a string s. Output Format Print the strings in their correct order. Constraints 1≤n≤1000000 n is even 1≤ length(s) ≤10 0≤x<100,x∈ar The characters in every string in lowercase. Sample Input 20 0 ab 6 cd 0 ef 6 gh 4 ij 0 ab 6 cd 0 ef 6 gh 0 ij 4 that 3 be 0 to 1 be 5 question 1 or 2 not 4 is 2 to 4 the Sample Output - - - - - to be or not to be - that is the question - - - - Explanation Below is the list in the correct order. The strings of each number were printed above for the second half of the array. Elements from the first half of the original array were replaced with dashes. 0 ab 0 ef 0 ab 0 ef 0 ij 0 to 1 be 1 or 2 not 2 to 3 be 4 ij 4 that 4 is 4 the 5 question 6 cd 6 gh 6 cd 6 gh ''' N=int(input()) l=[] for caseNum in range(N): case=input() num=int(case.strip().split()[0]) word=case.strip().split()[1] if caseNum<N//2: l.append((num,"-")) else: l.append((num,word)) count=[0]*100 for num,word in l: count[num]+=1 for i in range(1,len(count)): count[i]+=count[i-1] res=[0]*len(l) for num,word in reversed(l): res[count[num]-1]=word count[num]-=1 print(" ".join(res))
#!/usr/bin/python # coding=utf-8 """Scripts related to datasets dowloading and preprocessing."""
''' FetcherResponse will return a well-formed FetcherResponse object { name: string, payload: {file_name: binary_data} | None, source: string error: Error object } "payload" - string - binary data from a successful url fetch or None on fail "source" - string - the url the fetch was performed against "error" - error / string - None or the __repr__ of the error on fail ''' class FetcherResponse: name = '' source = '' payload = None error = None def __init__(self, name, payload, source, error): self.name = name self.payload = payload self.source = source self.error = error def __repr__(self): return str(self.to_dict()) def to_dict(self): return { 'name': self.name, 'payload': self.payload, 'source': self.source, 'error': self.error }
load(":character_classes.bzl", "is_alphanumeric", "is_lower_case_letter", "is_numeric", "is_upper_case_letter") def tokenize(s): queue = [] parts = [] part = "" for i in range(len(s)): ch = s[i] if is_alphanumeric(ch): if len(queue) == 2: if is_upper_case_letter(ch): if is_lower_case_letter(queue[0]) or is_numeric(queue[0]): part = part + queue.pop() + queue.pop() parts.append(part) part = "" else: part = part + queue.pop() elif is_lower_case_letter(ch): if is_upper_case_letter(queue[0]) and is_upper_case_letter(queue[1]): part = part + queue.pop() parts.append(part) part = "" else: part = part + queue.pop() else: part = part + queue.pop() elif len(queue) == 1: if is_upper_case_letter(ch): if is_lower_case_letter(queue[0]) or is_numeric(queue[0]): part = part + queue.pop() parts.append(part) part = "" queue.insert(0, ch) else: count = len(queue) for _ in range(count): part = part + queue.pop() if part != "": parts.append(part) part = "" # Drain queue count = len(queue) for _ in range(count): part = part + queue.pop() if part != "": parts.append(part) return parts
class CommodityModel: """ 学生模型:封装数据 """ def __init__(self, name="", price=0, sid=0): self.name = name self.price = price self.sid = sid class CommodityView: """ 学生视图:处理界面逻辑 """ def __init__(self, controller): self.controller = controller def display_menu(self): print("按1键录入商品信息") print("按2键显示商品信息") print("按3键删除商品信息") print("按4键修改商品信息") def select_menu(self): item = input("请输入您的选项:") if item == "1": self.input_commodity() elif item == "2": pass def input_commodity(self): cmd = CommodityModel() cmd.name = input("请输入商品姓名:") cmd.price = int(input("请输入商品单价:")) self.controller.add_commodity(cmd) print("添加成功") class CommodityController: """ 学生控制器:负责处理业务逻辑 """ def add_commodity(self, cmd): pass controller = CommodityController() view = CommodityView(controller) while True: view.display_menu() view.select_menu()
# stats.py def init(): global _stats _stats = {} def event_occurred(event): global _stats try: _stats[event] = _stats[event] + 1 except KeyError: _stats[event] = 1 def get_stats(): global _stats return sorted(_stats.items())
""" his file illustrates the bad version of some_fun. I've included the dependencies but the implementations are dummied out. """ class Logger: def log(self, msg): pass logger = Logger() def is_valid(x): pass def some_fun(x): if is_valid(x): return x * 5 else: logger.log("Invalid input to x")
class TimSort: def __init__(self, array, run_size=32): self.array = array self.run_size = run_size def insertionSort(self, array, left_index, right_index): """ performs insertion sort on a given array :param array: the array to sort :param left_index: the lower bound of the array to sort :param right_index: the upper bound of the array to sort :raises: :rtype: """ for index in range(left_index + 1, right_index): temp = array[index] upper_pointer = index - 1 # short the section while array[upper_pointer] > temp and upper_pointer >= left_index: # swap the elements array[upper_pointer + 1] = array[upper_pointer] # decrement pointer upper_pointer -= 1 array[upper_pointer + 1] = temp return array def merge(self, arr, l, m, r): # original array is broken in two parts # left and right array len1, len2 = m - l + 1, r - m left, right = [], [] for i in range(0, len1): left.append(arr[l + i]) for i in range(0, len2): right.append(arr[m + 1 + i]) i, j, k = 0, 0, l # after comparing, we merge those two array # in larger sub array while i < len1 and j < len2: if left[i] <= right[j]: arr[k] = left[i] i += 1 else: arr[k] = right[j] j += 1 k += 1 # copy remaining elements of left, if any while i < len1: arr[k] = left[i] k += 1 i += 1 # copy remaining element of right, if any while j < len2: arr[k] = right[j] k += 1 j += 1 def sort(self): arr = self.array n = len(arr) # Sort individual subarrays of size RUN for i in range(0, n, self.run_size): self.insertionSort(arr, i, min((i+31), (n-1))) # start merging from size RUN (or 32). It will merge # to form size 64, then 128, 256 and so on .... size = self.run_size while size < n: # pick starting point of left sub array. We # are going to merge arr[left..left+size-1] # and arr[left+size, left+2*size-1] # After every merge, we increase left by 2*size for left in range(0, n, 2*size): # find ending point of left sub array # mid+1 is starting point of right sub array mid = left + size - 1 right = min((left + 2*size - 1), (n-1)) # merge sub array arr[left.....mid] & # arr[mid+1....right] self.merge(arr, left, mid, right) size = 2*size if __name__ == "__main__": array = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] timSort = TimSort(array) arr = timSort.sort() print(arr)
#Padrao de projeto, é qualquer tipo python que pode ser usado com um loop for. Listas, tuplas, dicionarios. #Fibonacci: 1, 1, 2, 3, 5, 8, 13... class Fibonacci: def __init__(self, max): self.max = max def __iter__(self): self.x, self.y = 1, 1 return self def __next__(self): fib = self.x if fib > self.max: raise StopIteration self.x, self.y = self.y, self.x + self.y return fib fib = Fibonacci(100) for i in fib: print(i, end=' ')
def is_odd(n): return n % 2 == 1 def collatz(n): xs = [] while n != 1: xs.append(n) if is_odd(n): n = 3*n + 1 else: n = n // 2 xs.append(1) return xs def test_collatz(): assert collatz(8) == [8, 4, 2, 1] assert collatz(5) == [5, 16, 8, 4, 2, 1]
email = [ "rwandaonline.rw", "rra.gov.rw", "ur.ac.rw", "gmail.com", "yahoo.com", "yahoo.fr" ]
print('list as x y z ...') a = [] a = input().split(' ') a = list(map(int, a)) for elemt in (map(lambda x: 'par' if x%2 == 0 else 'impar', a)): print (elemt)
while True: try: n = int(input()) except: break data = list() maax = list() miin = list() for x in range(n): data.append(list(map(int, input().split()))) for x in range(n): maax.append(data[x][1]) miin.append(data[x][0]) result = [0]*(max(maax)-min(miin)) for x in range(n): for y in range(maax[x]-miin[x]): result[miin[x]-min(miin)+y] = 1 print(result.count(1))
applyPatch('20210630-dldt-disable-unused-targets.patch') applyPatch('20210630-dldt-pdb.patch') applyPatch('20210630-dldt-disable-multidevice-autoplugin.patch') applyPatch('20210630-dldt-vs-version.patch')
try: age = int(input("How old are you: ")) #if statement if age < 0: print("You are a time traveller") else: if 0 < age <= 17: print("Too young to vote") else: if age >= 18: print("You can vote") except: print("Please use only numeric values")
# iterating backwards # removing rogue vlues # when an item 's removed from the list, all the later items are shuffled down, to fill in the gap # That messes upu the index numbers, as we work forwards through the list data = [104, 101, 4, 105, 308, 103, 5, 107, 100, 306, 106, 102, 108] min_valid = 100 max_valid = 200 # for index in range(len(data) - 1, - 1, - 1): # if data[index] < min_valid or data[index] > max_valid: # print(index, data) # print(index) # del data[index] # print(data) # this does the same thing as the one in outlier # another way top_index = len(data) -1 for index, value in enumerate(reversed(data)): if value < min_valid or value > max_valid: print(top_index - index, value) del data[top_index - index] print(data)
# A quick solution for day 12 part 2 in Python # for debugging of the Pascal version x = 0 y = 0 wx = 10 wy = -1 with open('resources/input.txt', 'r') as f: for l in f.readlines(): l = l.strip() i = l[0] n = int(l[1:]) if i == 'N': wy -= n elif i == 'W': wx -= n elif i == 'S': wy += n elif i == 'E': wx += n elif i == 'F': x += wx * n y += wy * n elif i == 'L': for i in range(n // 90): (wx, wy) = (wy, -wx) elif i == 'R': for i in range(n // 90): (wx, wy) = (-wy, wx) print(f'{l} - pos x: {x}, y: {y}, wp x: {wx}, y: {wy}') print(f'Part 2: {abs(x) + abs(y)}')
a = get() b = execute(mogrify(get())) print(b) mogrify(a) c = get()
""" (System)Verilog language keyword lists """ IEEE1364_1995_KEYWORDS = [ "always", "and", "assign", "begin", "buf", "bufif0", "bufif1", "case", "casex", "casez", "cmos", "deassign", "default", "defparam", "disable", "edge", "else", "end", "endcase", "endfunction", "endmodule", "endprimitive", "endspecify", "endtable", "endtask", "event", "for", "force", "forever", "fork", "function", "highz0", "highz1", "if", "ifnone", "rpmos", "initial", "rtran", "inout", "rtranif0", "input", "rtranif1", "integer", "scalared", "join", "small", "large", "specify", "macromodule", "specparam", "medium", "strong0", "module", "strong1", "nand", "supply0", "negedge", "supply1", "nmos", "table", "nor", "task", "not", "time", "notif0", "tran", "notif1", "tranif0", "or", "tranif1", "output", "tri", "parameter", "tri0", "pmos", "tri1", "posedge", "triand", "primitive", "trior", "pull0", "trireg", "pull1", "vectored", "pulldown", "wait", "pullup", "wand", "rcmos", "weak0", "real", "weak1", "realtime", "while", "reg", "wire", "release", "wor", "repeat", "xnor", "rnmos", "xor", ] IEEE1364_2001_KEYWORDS = IEEE1364_1995_KEYWORDS + [ "automatic", "cell", "config", "incdir", "include", "instance", "liblist", "library", "localparam", "noshowcancelled", "pulsestyle_ondetect", "design", "endconfig", "endgenerate", "generate", "genvar", "pulsestyle_onevent", "showcancelled", "signed", "unsigned", "use", ] IEEE1364_2001_NOCONFIG_KEYWORDS = [ kw for kw in IEEE1364_2001_KEYWORDS if kw not in { "cell", "config", "design", "endconfig", "incdir", "include", "instance", "liblist", "library", "use", } ] IEEE1364_2005_KEYWORDS = IEEE1364_2001_KEYWORDS + ["uwire"] IEEE1800_2005_KEYWORDS = IEEE1364_2005_KEYWORDS + [ "alias", "endsequence", "pure", "always_comb", "enum", "rand", "always_ff", "expect", "randc", "always_latch", "export", "randcase", "assert", "extends", "randsequence", "assume", "extern", "ref", "before", "final", "return", "bind", "first_match", "sequence", "bins", "foreach", "shortint", "binsof", "forkjoin", "shortreal", "bit", "iff", "solve", "break", "ignore_bins", "static", "byte", "illegal_bins", "string", "chandle", "import", "struct", "class", "inside", "super", "clocking", "int", "tagged", "const", "interface", "this", "constraint", "intersect", "throughout", "context", "join_any", "timeprecision", "continue", "join_none", "timeunit", "cover", "local", "type", "covergroup", "logic", "typedef", "coverpoint", "longint", "union", "cross", "matches", "unique", "dist", "modport", "var", "do", "new", "virtual", "endclass", "null", "void", "endclocking", "package", "wait_order", "endgroup", "packed", "wildcard", "endinterface", "priority", "with", "endpackage", "program", "within", "endprogram", "property", "endproperty", "protected", ] IEEE1800_2009_KEYWORDS = IEEE1800_2005_KEYWORDS + [ "accept_on", "checker", "endchecker", "eventually", "global", "implies", "let", "nexttime", "reject_on", "restrict", "s_always", "s_eventually", "s_nexttime", "s_until", "s_until_with", "strong", "sync_accept_on", "sync_reject_on", "unique0", "until", "until_with", "untyped", "weak", ] IEEE1800_2012_KEYWORDS = IEEE1800_2009_KEYWORDS + [ "implements", "nettype", "interconnect", "soft", ] IEEE1800_2017_KEYWORDS = IEEE1800_2012_KEYWORDS + [ ] IEEE1800_2017_DOLAR_SYMBOLS = [ #Simulation control tasks (20.2) '$finish', '$stop', '$exit', # Simulation time functions (20.3) '$realtime', '$stime', '$time', # Timescale tasks (20.4)', '$printtimescale', '$timeformat', # Conversion functions (20.5)', '$bitstoreal', '$realtobits', '$bitstoshortreal', '$shortrealtobits', '$itor', '$rtoi', '$signed', '$unsigned', '$cast', # Data query functions (20.6) '$bits', '$isunbounded', '$typename', # Array query functions (20.7) '$unpacked_dimensions', '$dimensions', '$left', '$right', '$low', '$high', '$increment' '$size', # Math functions (20.8) '$clog2', '$asin', '$ln', '$acos', '$log10', '$atan', '$exp', '$atan2', '$sqrt', '$hypot', '$pow', '$sinh', '$floor', '$cosh', '$ceil', '$tanh', '$sin', '$asinh', '$cos', '$acosh', '$tan', '$atanh', # Bit vector system functions (20.9) '$countbits', '$countones', '$onehot', '$onehot0', '$isunknown', # Severity tasks (20.10) # Elaboration tasks (20.11) '$fatal', '$error', '$warning', '$info', # Assertion control tasks (20.12) '$asserton', '$assertoff', '$assertkill', '$assertcontrol', '$assertpasson', '$assertpassoff', '$assertfailon', '$assertfailoff', '$assertnonvacuouson', '$assertvacuousoff', # Sampled value system functions (20.13) '$sampled', '$rose', '$fell', '$stable', '$changed', '$past', '$past_gclk', '$rose_gclk', '$fell_gclk', '$stable_gclk', '$changed_gclk', '$future_gclk', '$rising_gclk', '$falling_gclk', '$steady_gclk', '$changing_gclk', # Coverage control functions (20.14) '$coverage_control', '$coverage_get_max', '$coverage_get', '$coverage_merge', '$coverage_save', '$get_coverage', '$set_coverage_db_name', '$load_coverage_db', # Probabilistic distribution functions (20.15) '$random', '$dist_chi_square', '$dist_erlang', '$dist_exponential', '$dist_normal', '$dist_poisson', '$dist_t', '$dist_uniform', # Stochastic analysis tasks and functions (20.16) '$q_initialize', '$q_add', '$q_remove', '$q_full', '$q_exam', # PLA modeling tasks (20.17) '$async$and$array', '$async$and$plane', '$async$nand$array', '$async$nand$plane', '$async$or$array', '$async$or$plane', '$async$nor$array', '$async$nor$plane', '$sync$and$array', '$sync$and$plane', '$sync$nand$array', '$sync$nand$plane', '$sync$or$array', '$sync$or$plane', '$sync$nor$array', '$sync$nor$plane', # Miscellaneous tasks and functions (20.18) '$system', #Display tasks (21.2) '$display', '$write', '$displayb', '$writeb', '$displayh', '$writeh ', '$displayo', '$writeo', '$strobe', '$monitor ', '$strobeb', '$monitorb', '$strobeh', '$monitorh', '$strobeo', '$monitoro', '$monitoroff', '$monitoron', # File I/O tasks and functions (21.3) '$fclose', '$fopen', '$fdisplay', '$fwrite', '$fdisplayb', '$fwriteb', '$fdisplayh', '$fwriteh ', '$fdisplayo', '$fwriteo', '$fstrobe', '$fmonitor ', '$fstrobeb', '$fmonitorb', '$fstrobeh', '$fmonitorh', '$fstrobeo', '$fmonitoro', '$swrite', '$sformat', '$swriteb', '$sformatf ', '$swriteh', '$fgetc', '$swriteo', '$ungetc', '$fscanf', '$fgets', '$fread', '$sscanf', '$fseek', '$rewind', '$fflush', '$ftell', '$feof ', '$ferror', # Memory load tasks (21.4) '$readmemb', '$readmemh', # Memory dump tasks (21.5) '$writememb', '$writememh', # Command line input (21.6) '$test', '$value', '$plusargs', # VCD tasks (21.7) '$dumpfile', '$dumpvars', '$dumpoff', '$dumpon', '$dumpall', '$dumplimit', '$dumpflush', '$dumpports', '$dumpportsoff', '$dumpportson', '$dumpportsall', '$dumpportslimit', '$dumpportsflush', ]
year=int(input('enter a num:')) if year%4==0 or year%400==0: print('leap year') else: print('not')
# A few global config settings API_KEY='' ORG_ID='' S3_BUCKET_NAME='' S3_ACCESS_KEY='' S3_SECRET_KEY='' MY_ID='' PLAYER_LICENSE=''
""" Split, Join, Enumerate em Python * Split - Dividir uma string # str * Join - Juntar uma lista # str * Enumerate - Enumerar elementos da lista # iteráveis """ string = 'O Brasil é penta.' lista = string.split(' ') print(lista) print('---------------------') for indice, valor in enumerate(lista): print(indice, valor) print('---------------------') lista2 = ' '.join(lista) print(lista2)
__authors__ = "" __copyright__ = "(c) 2014, pymal" __license__ = "BSD License" __contact__ = "Name Of Current Guardian of this file <email@address>" USER_AGENT = 'api-indiv-0829BA2B33942A4A5E6338FE05EFB8A1' HOST_NAME = "http://myanimelist.net" DEBUG = False RETRY_NUMBER = 4 RETRY_SLEEP = 1 SHORT_SITE_FORMAT_TIME = '%b %Y' LONG_SITE_FORMAT_TIME = '%b %d, %Y' MALAPPINFO_FORMAT_TIME = "%Y-%m-%d" MALAPPINFO_NONE_TIME = "0000-00-00" MALAPI_FORMAT_TIME = "%Y%m%d" MALAPI_NONE_TIME = "00000000"
# By manish.17, contest: ITMO Academy. Двоичный поиск - 4, problem: (C) Pair Selection # https://codeforces.com/profile/manish.17 n, k = map(int, input().split()) pairs = [] for i in range(n): a, b = map(int, input().split()) pairs += [[a, b]] alpha, omega = 0, 10**18 while alpha < omega: mid = (alpha + omega)/2 if mid == alpha:break queue = [] for a, b in pairs: # sum(a[i]) / sum(b[i]) >= mid # sum(a[i] - mid*b[i]) >= 0 queue += [a - b*mid] ans = sum(sorted(queue,reverse=True)[:k]) if ans >= 0: alpha = mid else: omega = mid - 10**-8 print(omega)
class Solution: def nextGreaterElements(self, nums: List[int]) -> List[int]: n = len(nums) stack = [] result = [-1] * n for i in range(n * 2): value = nums[i % n] while stack and nums[stack[-1] % n] < value: result[stack.pop() % n] = value stack.append(i) return result
# Part One matrix = [] with open("input") as f: for row in f: matrix.append(row) gama_rate = "" epsilon_rate = "" element_list = [] def most_frequent(List): return max(set(List), key=List.count) l_row = int(len(matrix[0])) for el in range(1, l_row): for row in matrix: element = row[el - 1] element_list.append(int(element)) most_fr = str(most_frequent(element_list)) gama_rate += most_fr if most_fr == "1": epsilon_rate += "0" else: epsilon_rate += "1" element_list = [] gama_rate_decimal = int(gama_rate, 2) epsilon_rate_decimal = int(epsilon_rate, 2) print(gama_rate_decimal * epsilon_rate_decimal) # Part One list_ones = [] list_zeroes = [] counter = 0 original_matrix = matrix while len(matrix) != 1: for row in matrix: if row[counter] == '0': list_zeroes.append(row) else: list_ones.append(row) if len(list_zeroes) > len(list_ones): list_ones = [] matrix = list_zeroes list_zeroes = [] elif len(list_ones) > len(list_zeroes): list_zeroes = [] matrix = list_ones list_ones = [] else: list_zeroes = [] matrix = list_ones list_ones = [] counter += 1 oxygen_generator = matrix[0] # print(oxygen_generator) list_ones = [] list_zeroes = [] counter = 0 matrix = original_matrix while len(matrix) != 1: for row in matrix: if row[counter] == '0': list_zeroes.append(row) else: list_ones.append(row) if len(list_zeroes) < len(list_ones): list_ones = [] matrix = list_zeroes list_zeroes = [] elif len(list_ones) < len(list_zeroes): list_zeroes = [] matrix = list_ones list_ones = [] else: list_ones = [] matrix = list_zeroes list_zeroes = [] counter += 1 co2_scrubber = matrix[0] # print(co2_scrubber) oxygen_generator_decimal = int(oxygen_generator, 2) co2_scrubber_decimal = int(co2_scrubber, 2) print(oxygen_generator_decimal * co2_scrubber_decimal)
class Address: host = 'localhost' port = '9666' def __init__(self, host=None, port=None): if host is not None: self.host = host if port is not None: self.port = port def is_empty(self) -> bool: return self.host == '' or self.port == '' def string(self) -> str: return f'{self.host}:{self.port}' def new_address_from_string(address: str) -> Address: parts = address.split(':') if len(parts) == 1: return Address(host=parts[0]) elif len(parts) == 2: return Address(host=parts[0], port=parts[1]) else: raise Exception(f'parsing address error: {address}')
f = open("cub_200/val.txt", "r") class_dict = {} rtn = open('val_tmp.txt', 'w') for x in f: class_int = int(x[7:10]) if class_int not in class_dict.keys(): class_dict[class_int] = 1 else: class_dict[class_int] += 1 if class_dict[class_int] > 5: if class_int % 2 == 0: if class_dict[class_int] <= 15: rtn.write(x) else: pass else: rtn.write(x)
class Solution(object): def kSmallestPairs(self, nums1, nums2, k): """ :type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]] """ # https://discuss.leetcode.com/topic/50450/slow-1-liner-to-fast-solutions queue = [] def push(i, j): if i < len(nums1) and j < len(nums2): heapq.heappush(queue, [nums1[i] + nums2[j], i, j]) push(0, 0) pairs = [] while queue and len(pairs) < k: _, i, j = heapq.heappop(queue) pairs.append([nums1[i], nums2[j]]) push(i, j + 1) if j == 0: push(i + 1, 0) return pairs
# coding: utf-8 DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', }, } INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.sites', 'django.contrib.sessions', 'django.contrib.contenttypes', 'registration', 'test_app', ) SECRET_KEY = '_' SITE_ID = 1 ROOT_URLCONF = 'test_app.urls' TEMPLATE_LOADERS = ( 'django.template.loaders.app_directories.Loader', ) MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', )
# -*- coding: utf-8 -*- """ 1561. Maximum Number of Coins You Can Get There are 3n piles of coins of varying size, you and your friends will take piles of coins as follows: In each step, you will choose any 3 piles of coins (not necessarily consecutive). Of your choice, Alice will pick the pile with the maximum number of coins. You will pick the next pile with maximum number of coins. Your friend Bob will pick the last pile. Repeat until there are no more piles of coins. Given an array of integers piles where piles[i] is the number of coins in the ith pile. Return the maximum number of coins which you can have. Constraints: 3 <= piles.length <= 10^5 piles.length % 3 == 0 1 <= piles[i] <= 10^4 """ class Solution: def maxCoins(self, piles): sorted_piles = sorted(piles) count = len(piles) // 3 ind = len(piles) - 2 res = 0 while count > 0: res += sorted_piles[ind] ind -= 2 count -= 1 return res
class APIError(Exception): code = -1 message = 'Unknown error' def __init__(self, message=None, details=None, data={}, response=None): self.message = message or self.message self.details = details self.data = data or {} self.response = response def __str__(self): message = self.message if self.details: message = f'{message}: {self.details}' if self.code: message = f'{self.code} {message}' return message # Specific exception classes class BadRequestException(APIError): code = 400 message = ( 'The request was unacceptable, often due ' 'to missing a required parameter') class UnauthorizedException(APIError): code = 401 message = 'No valid API key provided' class FailedException(APIError): code = 402 message = 'The requested resource doesn\'t exist' class NotFoundException(APIError): code = 404 message = 'The parameters were valid but the request failed' class MethodNotAllowedException(APIError): code = 405 message = 'Method not allowed' class ConflictException(APIError): code = 409 message = 'The request conflicts with another request' class TooManyRequestsException(APIError): code = 429 message = 'Too many requests hit the API too quickly' class InternalServerException(APIError): code = 500 message = 'Something went wrong on services end' # Mapping of API response codes to exception classes API_RETURN_CODES = { -1: APIError, 400: BadRequestException, 401: UnauthorizedException, 402: FailedException, 404: NotFoundException, 405: MethodNotAllowedException, 409: ConflictException, 429: TooManyRequestsException, 500: InternalServerException, } def handle_error_response(resp): """Take a HTTP response object and translate it into an Exception instance.""" response_json = resp.json() message = response_json.get('message') details = response_json.get('details') code = response_json.get('code', -1) data = response_json.get('data', {}) # Build the appropriate exception class with as much data as we can pull # from the API response and raise it. raise API_RETURN_CODES[code]( message=message, details=details, data=data, response=resp)
""" 347. Top K Frequent Elements Given a non-empty array of integers, return the k most frequent elements. Example 1: Input: nums = [1,1,1,2,2,3], k = 2 Output: [1,2] Example 2: Input: nums = [1], k = 1 Output: [1] Note: You may assume k is always valid, 1 ≤ k ≤ number of unique elements. Your algorithm's time complexity must be better than O(n log n), where n is the array's size. """ # speed: O(k*n) ~= O(n^2) --> 192ms/6.04%,15MB/100% class Solution(object): def topKFrequent(self, nums, k): """ :type nums: List[int] :type k: int :rtype: List[int] """ if len(nums) == 0: return None counterDict = {} result = [] for i in range(0, len(nums)): if nums[i] not in counterDict: counterDict[nums[i]] = 1 else: counterDict[nums[i]] += 1 for i in range(0, k): maxVal = max(counterDict, key=counterDict.get) result.append(maxVal) counterDict.pop(maxVal) return result
#! /usr/bin/env python # -*- coding: utf-8 -*- # # Copyright © 2020 Patrick Nanys <patrick.nanys2000@gmail.com> # # Distributed under terms of the MIT license. def reduce(list_to_reduce, acc_func, accumulator=None): if accumulator is not None: accumulated = acc_func(accumulator, list_to_reduce[0]) ll = list_to_reduce[1:] else: accumulated = acc_func(list_to_reduce[0], list_to_reduce[1]) ll = list_to_reduce[2:] for item in ll: accumulated = acc_func(accumulated, item) return accumulated def add(x, y): return x + y def string_len_add(acc, s): return acc + len(s) def main(): l1 = [1, 2, -1, 5] reduce(l1, add) assert (reduce(l1, add) == 7) assert (reduce(l1, add, 10) == 17) assert (reduce(l1, max) == 5) assert (reduce(l1, max, 12) == 12) l2 = ["foo", "bar", "hello"] assert (reduce(l2, string_len_add, 0) == 11) assert (reduce(l2, string_len_add, 0) == 11) # Testing that the original lists are unchanged assert (l1 == [1, 2, -1, 5]) assert (l2 == ["foo", "bar", "hello"]) print("Tests passed.") if __name__ == '__main__': main()
def show_state(state, player): return { 'hands': state['hands'], 'turn': state['turn'], }
class MultimodalDataset: def __init__(self, samples, modality_factories): super().__init__() self.samples = samples self.modality_factories = modality_factories self._register_modalites_to_samples() def _register_modalites_to_samples(self): for sample in self.samples: for modality_factory in self.modality_factories: sample.add_modality(modality_factory) def __getitem__(self, index): return self.samples[index].fetch() def __len__(self): return len(self.samples)
class Solution: def isValid(self, s: str) -> bool: matched=[0 for i in range(len(s))] open_brace=0 find='' for i in range (len(s)): if(s[i]==')' or s[i]=='}' or s[i]==']'): if(s[i]==')'): find='(' elif(s[i]=='}'): find='{' elif(s[i]==']'): find='[' if(i==0): return False else: j=i-1 while j>=0: if(matched[j]==0 and s[j]==find): matched[i]=1 matched[j]=1 open_brace-=1 find='' break elif(matched[j]==0): return False j-=1 else: open_brace+=1 if(open_brace==0 and find==''): return True else: return False
aluno = {} aluno['Nome'] = str(input('Nome aluno: ')).strip().title() aluno['Média'] = float(input(f'Média do(e) {aluno["Nome"]}: ')) if aluno['Média'] >= 7: aluno['Status'] = 'APROVADO' elif aluno['Média'] >= 5 < 7: aluno['Status'] = 'EM RECUPERAÇÃO' else: aluno['Status'] = 'REPROVADO' for i, d in aluno.items(): print(f' -{i} é igual a {d}')
def generate( args ): args = args.split(',') start = int(args[0]) numGroups = int(args[1]) perGroup = int(args[2]) interval = int(args[3]) ret = '' for i in range(numGroups): first = start + i * interval last = first + perGroup - 1 ret = ret + '{0}-{1}'.format(first,last) if i + 1 < numGroups: ret = ret + ',' return ret
_base_ = '../retinanet/retinanet_r50_fpn_1x_coco.py' model = dict( neck=[ dict( type='FPN', in_channels=[256, 512, 1024, 2048], out_channels=256, start_level=1, add_extra_convs='on_input', num_outs=5), dict( type='SEPC', out_channels=256, Pconv_num=4, pconv_deform=False, lcconv_deform=False, iBN=False, # when open, please set imgs/gpu >= 4 ) ], bbox_head=dict(type='SepcRetinaHead', num_classes=80, in_channels=256, stacked_convs=0, feat_channels=256, anchor_generator=dict( type='AnchorGenerator', octave_base_scale=4, scales_per_octave=3, ratios=[0.5, 1.0, 2.0], strides=[8, 16, 32, 64, 128]), bbox_coder=dict( type='DeltaXYWHBBoxCoder', target_means=[.0, .0, .0, .0], target_stds=[1.0, 1.0, 1.0, 1.0]), loss_cls=dict( type='FocalLoss', use_sigmoid=True, gamma=2.0, alpha=0.25, loss_weight=1.0), loss_bbox=dict(type='L1Loss', loss_weight=1.0))) work_dir = 'work_dirs/coco/spec/pconv_retinanet_r50_fpn_1x_coco'
vorname = "Hans"; # Name: vorname, Datentyp: String, Wert: Hans a = 7; # Datentyp: integer width = "11"; # Datentyp: string # Fläche des Rechtecks b = int(width); # Konvertiere zu integer (Zahl) area = a * b; print(area); # Neue Datentypen dezimalzahl = 3.14; # Datentyp: float, Name: dezimalzahl, Wert:3.14 istWahr = True; # Datentyp: bool - kann nur True oder False annehmen
def main(): week={'A':'MON','B':'TUE','C':'WED','D':'THU','E':'FRI','F':'SAT','G':'SUN'} strs = [] for i in range(0,4): strs.append(input()) for i in range(0,min(len(strs[0]),len(strs[1]))): if(strs[0][i]==strs[1][i]): if(strs[0][i]>='A' and strs[0][i]<='G'): w=week[strs[0][i]] last = i+1 break for i in range(last,min(len(strs[0]),len(strs[1]))): if(strs[0][i]==strs[1][i]): if((strs[0][i]>='A' and strs[0][i]<='N') or strs[0][i].isdigit()): hour = int(strs[0][i]) if strs[0][i].isdigit() else int(ord(strs[0][i]))-int(ord('A'))+10 break for i in range(0,min(len(strs[2]),len(strs[3]))): if(strs[2][i] == strs[3][i]): if(strs[2][i].isalpha()): m = i break print("{} {:0>2d}:{:0>2d}".format(w,hour,m)) main()
# Copyright 2020 The Kythe Authors. 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. """RBE toolchain specification.""" load("//tools/platforms/configs:versions.bzl", "TOOLCHAIN_CONFIG_AUTOGEN_SPEC") DEFAULT_TOOLCHAIN_CONFIG_SUITE_SPEC = { "repo_name": "io_kythe", "output_base": "tools/platforms/configs", "container_repo": "kythe-repo/kythe-builder", "container_registry": "gcr.io", "default_java_home": "/usr/lib/jvm/11.29.3-ca-jdk11.0.2/reduced", "toolchain_config_suite_autogen_spec": TOOLCHAIN_CONFIG_AUTOGEN_SPEC, }
class Mail: def __init__(self, application, driver_config=None): self.application = application self.drivers = {} self.driver_config = driver_config or {} self.options = {} def add_driver(self, name, driver): self.drivers.update({name: driver}) def set_configuration(self, config): self.driver_config = config return self def get_driver(self, name=None): if name is None: return self.drivers[self.driver_config.get("default")] return self.drivers[name] def get_config_options(self, driver=None): if driver is None: return self.driver_config.get(self.driver_config.get("default"), {}) return self.driver_config.get(driver, {}) def mailable(self, mailable): self.options = mailable.set_application(self.application).build().get_options() return self def send(self, driver=None): selected_driver = driver or self.options.get("driver", None) self.options.update(self.get_config_options(selected_driver)) return self.get_driver(selected_driver).set_options(self.options).send()
n = int(input('Digite um número para saber seu fatorial: ')) i = n v = 0 m = 1 s = 1 print('{}! = '.format(i), end='') while n != 1: s += 1 m *= s v = n - 1 f = n * v print('{}'.format(n), end=' x ') n -= 1 print('1 = {}'.format(m))
# # PySNMP MIB module H3C-BLG-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/H3C-BLG-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:21:27 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ConstraintsUnion, ConstraintsIntersection, ValueRangeConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ConstraintsUnion", "ConstraintsIntersection", "ValueRangeConstraint", "ValueSizeConstraint") h3cCommon, = mibBuilder.importSymbols("HUAWEI-3COM-OID-MIB", "h3cCommon") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") MibIdentifier, TimeTicks, iso, Gauge32, ObjectIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, Unsigned32, Counter64, ModuleIdentity, Bits, NotificationType, IpAddress, Integer32, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "MibIdentifier", "TimeTicks", "iso", "Gauge32", "ObjectIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Unsigned32", "Counter64", "ModuleIdentity", "Bits", "NotificationType", "IpAddress", "Integer32", "Counter32") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") h3cBlg = ModuleIdentity((1, 3, 6, 1, 4, 1, 2011, 10, 2, 108)) h3cBlg.setRevisions(('2009-09-15 11:11',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: h3cBlg.setRevisionsDescriptions(('The initial version of this MIB.',)) if mibBuilder.loadTexts: h3cBlg.setLastUpdated('200909151111Z') if mibBuilder.loadTexts: h3cBlg.setOrganization('H3C Technologies Co., Ltd.') if mibBuilder.loadTexts: h3cBlg.setContactInfo('Platform Team H3C Technologies Co., Ltd. Hai-Dian District Beijing P.R. China Http://www.h3c.com Zip:100085') if mibBuilder.loadTexts: h3cBlg.setDescription('This MIB module defines a set of basic objects for configuring switches and routers to set/get balance group information.') class CounterClear(TextualConvention, Integer32): description = "Cleared: reset the value of the group's counter. Nouse: 'nouse' will be returned when getting." status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2)) namedValues = NamedValues(("cleared", 1), ("nouse", 2)) h3cBlgObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 108, 1)) h3cBlgStatsTable = MibTable((1, 3, 6, 1, 4, 1, 2011, 10, 2, 108, 1, 1), ) if mibBuilder.loadTexts: h3cBlgStatsTable.setStatus('current') if mibBuilder.loadTexts: h3cBlgStatsTable.setDescription('This table contains the statistics information about balance groups.') h3cBlgStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2011, 10, 2, 108, 1, 1, 1), ).setIndexNames((0, "H3C-BLG-MIB", "h3cBlgIndex")) if mibBuilder.loadTexts: h3cBlgStatsEntry.setStatus('current') if mibBuilder.loadTexts: h3cBlgStatsEntry.setDescription('This list contains statistics information.') h3cBlgIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 108, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))) if mibBuilder.loadTexts: h3cBlgIndex.setStatus('current') if mibBuilder.loadTexts: h3cBlgIndex.setDescription('The index of the balance group.') h3cBlgGroupTxPacketCount = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 108, 1, 1, 1, 2), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cBlgGroupTxPacketCount.setStatus('current') if mibBuilder.loadTexts: h3cBlgGroupTxPacketCount.setDescription('When retrieved, this object returns the count of packets the balance group has sent.') h3cBlgGroupRxPacketCount = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 108, 1, 1, 1, 3), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cBlgGroupRxPacketCount.setStatus('current') if mibBuilder.loadTexts: h3cBlgGroupRxPacketCount.setDescription('When retrieved, this object returns the count of packets the balance group has received.') h3cBlgGroupTxByteCount = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 108, 1, 1, 1, 4), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cBlgGroupTxByteCount.setStatus('current') if mibBuilder.loadTexts: h3cBlgGroupTxByteCount.setDescription('When retrieved, this object returns the count of bytes the balance group has sent.') h3cBlgGroupRxByteCount = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 108, 1, 1, 1, 5), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cBlgGroupRxByteCount.setStatus('current') if mibBuilder.loadTexts: h3cBlgGroupRxByteCount.setDescription('When retrieved, this object returns the count of bytes the balance group has received.') h3cBlgGroupCountClear = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 108, 1, 1, 1, 6), CounterClear()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cBlgGroupCountClear.setStatus('current') if mibBuilder.loadTexts: h3cBlgGroupCountClear.setDescription('This object is used to reset the counter of the balance group. Read operation is meaningless.') mibBuilder.exportSymbols("H3C-BLG-MIB", h3cBlgIndex=h3cBlgIndex, h3cBlgObjects=h3cBlgObjects, h3cBlgStatsEntry=h3cBlgStatsEntry, h3cBlgGroupCountClear=h3cBlgGroupCountClear, h3cBlgGroupTxByteCount=h3cBlgGroupTxByteCount, PYSNMP_MODULE_ID=h3cBlg, h3cBlg=h3cBlg, h3cBlgGroupTxPacketCount=h3cBlgGroupTxPacketCount, h3cBlgGroupRxPacketCount=h3cBlgGroupRxPacketCount, CounterClear=CounterClear, h3cBlgGroupRxByteCount=h3cBlgGroupRxByteCount, h3cBlgStatsTable=h3cBlgStatsTable)
class AutoTuneCommands(object): _command = "ju" def __init__(self, send_command): self._send_command = send_command async def call(self): return await self._send_command(self._command, 1)
#Heap Sort as the name suggests, uses the heap data structure. #First the array is converted into a binary heap. Then the first element which is the maximum elemet in case of a max-heap, #is swapped with the last element so that the maximum element goes to the end of the array as it should be in a sorted array. #Then the heap size is reduced by 1 and max-heapify function is called on the root. #Time complexity is O(nlog N) in all cases and space complexity = O(1) count = 0 def max_heapify(array, heap_size, i): left = 2 * i + 1 right = 2 * i + 2 largest = i global count if left < heap_size: count += 1 if array[left] > array[largest]: largest = left if right < heap_size: count += 1 if array[right] > array[largest]: largest = right if largest != i: array[i], array[largest] = array[largest], array[i] max_heapify(array, heap_size, largest) def build_heap(array): heap_size = len(array) for i in range ((heap_size//2),-1,-1): max_heapify(array,heap_size, i) def heap_sort(array): heap_size = len(array) build_heap(array) print (f'Heap : {array}') for i in range(heap_size-1,0,-1): array[0], array[i] = array[i], array[0] heap_size -= 1 max_heapify(array, heap_size, 0) array = [5,9,3,10,45,2,0] heap_sort(array) print (array) print(f'Number of comparisons = {count}') ''' Heap : [45, 10, 3, 5, 9, 2, 0] [0, 2, 3, 5, 9, 10, 45] Number of comparisons = 22 ''' sorted_array = [5,6,7,8,9] heap_sort(sorted_array) print(sorted_array) print(f'Number of comparisons = {count}') ''' Heap : [9, 8, 7, 5, 6] [5, 6, 7, 8, 9] Number of comparisons = 12 ''' reverse_sorted_array = [9,8,7,6,5,4,3,2,1,0,-1,-2,-3,-4,-5,-6,-7,-8,-9,-10] heap_sort(reverse_sorted_array) print(reverse_sorted_array) print(f'Number of comparisons = {count}') ''' Heap : [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10] [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] Number of comparisons = 105 '''
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' """ Вашей программе на вход подаются две строки s и t, состоящие из строчных латинских букв. Выведите одно число – количество вхождений строки t в строку s. Пример: s = "abababa" t = "aba" Sample Input 1: abababa aba Sample Output 1: 3 Sample Input 2: abababa abc Sample Output 2: 0 Sample Input 3: abc abc Sample Output 3: 1 Sample Input 4: aaaaa a Sample Output 4: 5 """ # Пример использования. В консоли: # > python main.py < in # 3 def count_sub_string(s, t): """Функция подсчитывает и возвращает количество вхождений строки t в строку s.""" count = 0 for i in range(len(s)): part = s[i:i + len(t)] if not part: break if t == part: count += 1 return count if __name__ == '__main__': s = input() t = input() print(count_sub_string(s, t))
class A: def __init__(self, *, a): pass class B(A): def __init__(self, a): super().__init__(a=a)
class Ball: def __init__(self): self.position = PVector(width * 0.5, height * 0.5) self.w = 20 self.velocity = PVector(5, 5) self.score_player_one = False self.score_player_two = False def show(self): fill(255) ellipse(self.position.x, self.position.y, self.w, self.w) # TODO: Create a move() method that adds the velocity to the position # Help: https://processing.org/reference/PVector_add_.html # TODO: Create a border() method that checks for collision using the current possition # Help: check if the x or y of the possition are outside the screen borders # TODO: Create an update() method that simply calls the 2 methods you just created
#!/usr/bin/env python3 # coding: utf8 """ This script contains functions to calculate error rates, including word error rate, sentence error rate, and more specific error rates such as digit error rate. """ def sentence_error(source, target): """ Evaluate whether the target is identical to the source. Args: source (str): Source string. target (str): Target string. Returns: int: 0 if the target is equal to the source, 1 otherweise. """ return 0 if target == source else 1 def count_word_errors(source, target): """ Calculate the number of edit operations between a target and the source. Args: source (str): Source string. target (str): Target string. Returns: tuple (int, int): A tuple containing the number of word errors and the total number of words in the source. """ error_count = 0 for code in edit_operations(source, target): if code in 'dis': # delete, insert, substitute error_count += 1 return error_count, len(source) def prepare_special_error_type(source, target, error_type, charset=None): """ Remove all non-matching words from both the source and the target string. Args: source (str): Source string. target (str): Target string. error_type (str): One of: 'copy_chars', 'uppercase', 'digits', 'punctuation', 'symbols'. Other strings are ignored and the standard word error rate will be calculated. charset (set): the set with all characters (or strings) to be considered. Defaults to None. Returns: tuple (list, list): a tuple with the source and the target strings. """ if error_type == 'copy_chars': source = [word for word in source if all(c in charset for c in word)] target = [word for word in target if all(c in charset for c in word) and word in source] elif error_type == 'uppercase': source = [word for word in source if any(c.isupper() for c in word)] target = [word for word in target if any(c.isupper() for c in word)] elif error_type == 'digits': source = [word for word in source if any(c.isdigit() for c in word)] target = [word for word in target if any(c.isdigit() for c in word)] elif error_type in ('punctuation', 'symbols'): source = [word for word in source if word in charset] target = [word for word in target if word in charset] return source, target def count_special_errors(source, target, error_type, charset=None): """ Calculate the number of edit operations between the target and the source for only a subset of all words (e.g. digits). Args: source (str): Source string. target (str): Target string. error_type (str): One of: 'copy_chars', 'uppercase', 'digits', 'punctuation', 'symbols'. Other strings are ignored and the standard word error rate will be calculated. charset (set): the set with all characters (or strings) to be considered. Defaults to None. Returns: tuple (int, int): A tuple containing the number of word errors and the total number of words in the source. """ source, target = prepare_special_error_type( source, target, error_type, charset) return count_word_errors(source, target) def edit_operations(source, target): """ Get a list of edit operations for converting the source into the target. Args: source (str): Source string. target (str): Target string. Returns: list: The list of edit operations. """ matrix = levenshtein_distance(source, target) codes = [] # initiate row and column so that the reading begins # at the bottom right corner of the matrix row = len(matrix) - 1 column = len(matrix[0]) - 1 while row != 0 or column != 0: # retrieve value of the current cell and the surrounding cells currentcell = matrix[row][column] if row != 0 and column != 0: diagonal = matrix[row-1][column-1] top = matrix[row-1][column] left = matrix[row][column-1] elif row == 0: diagonal = matrix[row][column-1]+1 top = matrix[row][column]+1 left = matrix[row][column-1] elif column == 0: diagonal = matrix[row-1][column]+1 top = matrix[row-1][column] left = matrix[row][column]+1 # find the lowest value surrounding the current cell options = [diagonal, top, left] cheapest = options.index(min(options)) # effect the movement to the cell with the lowest value # and add the corresponding code to the list of codes if cheapest == 0: if diagonal == currentcell: codes.insert(0, 'e') else: codes.insert(0, 's') row -= 1 column -= 1 elif cheapest == 1: codes.insert(0, 'd') row -= 1 elif cheapest == 2: codes.insert(0, 'i') column -= 1 return codes def levenshtein_distance(source, target): """ Get a matrix with local Levenshtein distance optima. Args: source (str): Source string. target (str): Target string. Returns: list of lists: A matrix with Levenshtein operations. """ n = len(source) m = len(target) # create matrix with None in every field d = [[None for _ in range(m+1)] for _ in range(n+1)] # set the top left field to 0 d[0][0] = 0 # complete first column and first row for i in range(1, n+1): d[i][0] = d[i-1][0] + 1 for j in range(1, m+1): d[0][j] = d[0][j-1] + 1 # fill the rest of the matrix with the minimal value # of all possible operations # comparing the field to the left, upper left and top for i in range(1, n+1): for j in range(1, m+1): d[i][j] = min( d[i-1][j] + 1, # del d[i][j-1] + 1, # ins d[i-1][j-1] + (1 if source[i-1] != target[j-1] else 0) ) # sub return d def error_rate(error_count, total): """ Calculate the error rate, given the error count and the total number of words. Args: error_count (int): Number of errors. total (int): Total number of words (of the same type). Returns: tuple (int, int, float): The error count, the total number of words, and the calculated error rate. """ if total == 0: return error_count, total, 0.0 return error_count, total, (error_count/total)*100 def calculate_error_rates(source_file, target_file, config): """ Calculate sentence error rate, word error rate and some additional specific word error rates, including punctuation and digit error rates. Args: source_file (str): File with source strings. target_file (str): File with target string. config (dict): A dictionary with character and symbol sets. Returns: tuple of tuples: A tuple containing a tuple for each implemented error type. Each sub-tuple contains the name of the error type (e.g., 'Punctuation'), the number of errors, the total number of tokens, and the error rate. """ with open(source_file) as src_file, open(target_file) as tgt_file: sents, sent_errors = 0, 0 words, word_errors = 0, 0 copy_words, copy_errors = 0, 0 upper_words, upper_errors = 0, 0 digit_words, digit_errors = 0, 0 punct_words, punct_errors = 0, 0 symbol_words, symbol_errors = 0, 0 for src, tgt in zip(src_file, tgt_file): src, tgt = src.strip(), tgt.strip() sents += 1 sent_errors += sentence_error(src, tgt) src, tgt = src.split(), tgt.split() errors, total = count_word_errors(src, tgt) word_errors += errors words += total errors, total = count_special_errors( src, tgt, 'copy_chars', set(config['copy_chars'])) copy_errors += errors copy_words += total errors, total = count_special_errors(src, tgt, 'uppercase') upper_errors += errors upper_words += total errors, total = count_special_errors(src, tgt, 'digits') digit_errors += errors digit_words += total errors, total = count_special_errors( src, tgt, 'punctuation', set(config['punctuation'])) punct_errors += errors punct_words += total errors, total = count_special_errors( src, tgt, 'symbols', set(config['symbols'].split())) symbol_errors += errors symbol_words += total return (('Sentence', error_rate(sent_errors, sents)), ('Word', error_rate(word_errors, words)), ('Copy Word', error_rate(copy_errors, copy_words)), ('Uppercase Word', error_rate(upper_errors, upper_words)), ('Digit', error_rate(digit_errors, digit_words)), ('Punctuation', error_rate(punct_errors, punct_words)), ('Symbol', error_rate(symbol_errors, symbol_words))) def get_alignments(source_file, target_file): """ Get word alignments for all pairs of strings which contain a word error. Args: source_file (str): File with source strings. target_file (str): File with target string. Returns: list: alignment for all pairs of strings which are not identical. """ alignments = [] with open(source_file) as src_file, open(target_file) as tgt_file: for src, tgt in zip(src_file, tgt_file): src, tgt = src.strip().split(), tgt.strip().split() if src != tgt: alignment = get_alignment(src, tgt) alignments.append(alignment) return alignments def get_alignment(source, target): """ Get the visual alignment of two strings. Args: source (str): Source string. target (str): Target string. Returns: list: containing the strings, their alignment and the edit operations. """ i, j = 0, 0 alignment = [[] for _ in range(4)] # 4 lines: source, bars, target, codes for code in edit_operations(source, target): code = code[0].upper() try: s = source[i] except IndexError: pass try: t = target[j] except IndexError: pass if code == 'D': # Deletion: empty string on the target side t = '*' elif code == 'I': # Insertion: empty string on the source side s = '*' elif code == 'E': # Equal: omit the code code = ' ' # Format all elements to the same width. width = max(len(x) for x in (s, t, code)) for line, token in zip(alignment, [s, '|', t, code]): line.append(token.center(width)) # pad to width with spaces # Increase the counters depending on the operation. if code != 'D': # proceed on the target side, except for deletion j += 1 if code != 'I': # proceed on the source side, except for insertion i += 1 # Return the accumulated lines. return alignment
ISOCHRONES_DATASET_NAME = "webapp_isochrones" LOCATIONS_DATASET_NAME = "webapp_locations" CUSTOMERS_DATASET_NAME = "webapp_customers" CUSTOMERS_NO_FILTERING_COLUMNS = [ 'id', 'customer_uuid', 'location_uuid', 'isochrone_type', 'distance_customer_location', 'isochrone_id', 'isochrone_amplitude', 'isochrone_label', 'isochrone_data', 'customer_id_denormalized', 'latitude', 'longitude', 'geo_point', 'city', 'department', 'region', 'country_iso' ] CUSTOMER_COLUMNS_TO_SEND = [ "id", "customer_uuid", "isochrone_amplitude", "longitude", "latitude", "filteringFeatures" ] LOCATIONS_NO_FILTERING_COLUMNS = [ 'address', 'id', 'latitude', 'longitude', 'geo_point', 'isochrone_5_min', 'isochrone_5_min_total_pop', 'isochrone_5_min_area', 'isochrone_5_min_reachfactor', 'isochrone_10_min', 'isochrone_10_min_total_pop', 'isochrone_10_min_area', 'isochrone_10_min_reachfactor', 'isochrone_15_min', 'isochrone_15_min_total_pop', 'isochrone_15_min_area', 'isochrone_15_min_reachfactor', 'isochrone_30_min', 'isochrone_30_min_total_pop', 'isochrone_30_min_area', 'isochrone_30_min_reachfactor', 'isochrone_45_min', 'isochrone_45_min_total_pop', 'isochrone_45_min_area', 'isochrone_45_min_reachfactor', 'isochrone_60_min', 'isochrone_60_min_total_pop', 'isochrone_60_min_area', 'isochrone_60_min_reachfactor', 'location_uuid' ] LOCATION_COLUMNS_TO_SEND = [ "id", "location_uuid", "longitude", "latitude", "filteringFeatures", "address", "isochrones" ]
# # PySNMP MIB module Nortel-MsCarrier-MscPassport-AtmBearerServiceMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-AtmBearerServiceMIB # Produced by pysmi-0.3.4 at Wed May 1 14:29:02 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, ValueRangeConstraint, ConstraintsIntersection, ValueSizeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueRangeConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "SingleValueConstraint") mscAtmIfVpc, mscAtmIfVccIndex, mscAtmIfVcc, mscAtmIfIndex, mscAtmIfVpcIndex, mscAtmIfVptIndex, mscAtmIfVptVccIndex, mscAtmIfVptVcc = mibBuilder.importSymbols("Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfVpc", "mscAtmIfVccIndex", "mscAtmIfVcc", "mscAtmIfIndex", "mscAtmIfVpcIndex", "mscAtmIfVptIndex", "mscAtmIfVptVccIndex", "mscAtmIfVptVcc") StorageType, RowStatus, DisplayString = mibBuilder.importSymbols("Nortel-MsCarrier-MscPassport-StandardTextualConventionsMIB", "StorageType", "RowStatus", "DisplayString") NonReplicated, Link = mibBuilder.importSymbols("Nortel-MsCarrier-MscPassport-TextualConventionsMIB", "NonReplicated", "Link") mscPassportMIBs, = mibBuilder.importSymbols("Nortel-MsCarrier-MscPassport-UsefulDefinitionsMIB", "mscPassportMIBs") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") Integer32, Counter32, Counter64, Gauge32, MibIdentifier, NotificationType, ObjectIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, ModuleIdentity, Unsigned32, TimeTicks, Bits, iso, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "Counter32", "Counter64", "Gauge32", "MibIdentifier", "NotificationType", "ObjectIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ModuleIdentity", "Unsigned32", "TimeTicks", "Bits", "iso", "IpAddress") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") atmBearerServiceMIB = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 64)) mscAtmIfVpcNrp = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4)) mscAtmIfVpcNrpRowStatusTable = MibTable((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 1), ) if mibBuilder.loadTexts: mscAtmIfVpcNrpRowStatusTable.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcNrpRowStatusTable.setDescription('This entry controls the addition and deletion of mscAtmIfVpcNrp components.') mscAtmIfVpcNrpRowStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 1, 1), ).setIndexNames((0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfVpcIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmBearerServiceMIB", "mscAtmIfVpcNrpIndex")) if mibBuilder.loadTexts: mscAtmIfVpcNrpRowStatusEntry.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcNrpRowStatusEntry.setDescription('A single entry in the table represents a single mscAtmIfVpcNrp component.') mscAtmIfVpcNrpRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 1, 1, 1), RowStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVpcNrpRowStatus.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcNrpRowStatus.setDescription('This variable is used as the basis for SNMP naming of mscAtmIfVpcNrp components. These components can be added and deleted.') mscAtmIfVpcNrpComponentName = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 1, 1, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: mscAtmIfVpcNrpComponentName.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcNrpComponentName.setDescription("This variable provides the component's string name for use with the ASCII Console Interface") mscAtmIfVpcNrpStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 1, 1, 4), StorageType()).setMaxAccess("readonly") if mibBuilder.loadTexts: mscAtmIfVpcNrpStorageType.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcNrpStorageType.setDescription('This variable represents the storage type value for the mscAtmIfVpcNrp tables.') mscAtmIfVpcNrpIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 1, 1, 10), NonReplicated()) if mibBuilder.loadTexts: mscAtmIfVpcNrpIndex.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcNrpIndex.setDescription('This variable represents the index for the mscAtmIfVpcNrp tables.') mscAtmIfVpcNrpProvTable = MibTable((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 100), ) if mibBuilder.loadTexts: mscAtmIfVpcNrpProvTable.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcNrpProvTable.setDescription('This group contains the provisionable attributes for the Nrp component.') mscAtmIfVpcNrpProvEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 100, 1), ).setIndexNames((0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfVpcIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmBearerServiceMIB", "mscAtmIfVpcNrpIndex")) if mibBuilder.loadTexts: mscAtmIfVpcNrpProvEntry.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcNrpProvEntry.setDescription('An entry in the mscAtmIfVpcNrpProvTable.') mscAtmIfVpcNrpNextHop = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 100, 1, 10), Link()).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVpcNrpNextHop.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcNrpNextHop.setDescription('This attribute specifies the Nrp component with which this Nrp is associated. A sample value is AtmIf/31 Vcc/0.32 Nrp.') mscAtmIfVpcNrpConnectionPointType = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 100, 1, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 4))).clone(namedValues=NamedValues(("segmentEndPoint", 1), ("connectingPoint", 2), ("autoConfigure", 4))).clone('autoConfigure')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVpcNrpConnectionPointType.setStatus('obsolete') if mibBuilder.loadTexts: mscAtmIfVpcNrpConnectionPointType.setDescription("This attribute specifies the connection point type desired for a Nrp component. The actual connection point type value is visible in the parent component's connectionPointType attribute. The desired connection point type can be specified directly as a segmentEndPoint or connectingPoint. If autoConfigure is specified, the switch will select the connection point type based on the type attribute of the associated AtmIf, choosing segmentEndPoint for a UNI-type ATM interface and connectingPoint for a PPI-type ATM interface. It is obsoleted. The value is mapped into oamSegmentBoundary attribute. segmentEndPoint is mapped into yes. connectingPoint is mapped into no. autoConfigure is mapped into sameAsInterface.") mscAtmIfVpcNrpOamSegmentBoundary = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 100, 1, 30), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("no", 0), ("yes", 1), ("sameAsInterface", 2))).clone('sameAsInterface')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVpcNrpOamSegmentBoundary.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcNrpOamSegmentBoundary.setDescription("This attribute specifies the OAM segment boundary desired for a Nrp component. It affects the connection point type value visible in the parent component's connectionPointType attribute. The desired OAM segment boundary can be specified directly as yes, no or sameAsInterface. If sameAsInterface is specified, the OAM segment boundary is same as the oamSegmentBoundary attribute of the associated AtmIf and the switch will set the connectionPointType, choosing segmentEndPoint for a segment- boundary ATM interface and connectingPoint for a non-segment- boundary ATM interface.") mscAtmIfVpcNrpTxAal5PartialPacketDiscard = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 100, 1, 31), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("disabled", 0), ("enabled", 1))).clone('disabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVpcNrpTxAal5PartialPacketDiscard.setStatus('obsolete') if mibBuilder.loadTexts: mscAtmIfVpcNrpTxAal5PartialPacketDiscard.setDescription("This attribute is obsolete in P4.2 and has been migrated under Vcd (Vpd) component. This attribute specifies whether the AAL5 Partial Packet Discard (PPD) feature has been enabled or disabled on the Nrp in the transmit direction. This feature allows the NRP to discard the remainder of a cell-forwarded AAL5 frame if a cell of this frame has been discarded due to congestion. This increases the 'goodput' of the link, since cells which are only going to be discarded by the AAL5 reassembly are not transmitted. When this attribute is set to enabled, the PPD feature is applied in the transmit direction. It should only be enabled for connections whose end points are performing AAL5 segmentation and reassembly. When this attribute is set to disabled, the PPD feature is not applied to traffic for this connection in the transmit direction. Note that specifying enabled for a non-AAL5 connection will cause all traffic to be discarded once congestion is encountered.") mscAtmIfVpcNrpRxAal5PartialPacketDiscard = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 100, 1, 32), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("disabled", 0), ("enabled", 1), ("sameAsTx", 2))).clone('sameAsTx')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVpcNrpRxAal5PartialPacketDiscard.setStatus('obsolete') if mibBuilder.loadTexts: mscAtmIfVpcNrpRxAal5PartialPacketDiscard.setDescription("This attribute is obsolete in P4.2 and has been migrated under Vcd (Vpd) component. This attribute specifies whether the AAL5 Partial Packet Discard (PPD) feature has been enabled or disabled on the Nrp in the receive direction. This feature allows the NRP to discard the remainder of a cell-forwarded AAL5 frame if a cell of this frame has been discarded due to congestion or usage parameter control (UPC). This increases the 'goodput' of the link, since cells which are only going to be discarded by the AAL5 reassembly are not transmitted. When this attribute is set to enabled, the PPD feature is applied in the receive direction. It should only be enabled for connections whose end points are performing AAL5 segmentation and reassembly. When this attribute is set to disabled, the PPD feature is not applied to traffic for this connection in the receive direction. When this attribute is set to sameAsTx, the PPD feature for traffic in the receive direction will be configured the same way as it is in the transmit direction. Note that specifying enabled for a non-AAL5 connection will cause all traffic to be discarded once congestion is encountered.") mscAtmIfVpcNrpBandwidthElastic = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 100, 1, 33), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("no", 0), ("yes", 1))).clone('no')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVpcNrpBandwidthElastic.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcNrpBandwidthElastic.setDescription('This attribute is only of importance for connections which are carried on a link with a variable bandwidth. For example, the bandwidth may be reduced in the event that one or more physical links in the IMA group fail, such that the originally requested bandwidth cannot be maintained. This attribute shows whether the application running on this connection can continue to operate if the bandwidth is reduced. If the bandwidth is reduced, the amount by which it is reduced will be displayed in the bandwidthReduction attribute. A value of yes, indicates that this connection is elastic, and the bandwidth may be reduced but the connection will not be released. Currently, this attribute should only be set to yes for situations where this Nrp is functioning as a loopback on one side of an IMA link. There are no other situations where this setting is valid. A value of no indicates that the bandwidth for this connection will not be reduced in the event of link bandwidth reduction. However, this connection may be released based on its holdingPriority.') mscAtmIfVpcNrpOverrideHoldingPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 100, 1, 34), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 6))).clone(namedValues=NamedValues(("n0", 0), ("n1", 1), ("n2", 2), ("n3", 3), ("n4", 4), ("noOverride", 6))).clone('noOverride')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVpcNrpOverrideHoldingPriority.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcNrpOverrideHoldingPriority.setDescription('This attribute specifies the holding priority of this connection. Holding priority is used when there is an IMA group where some physical links have failed. Holding priority determines the order in which connections are released. 4 is the lowest holding priority and is released first. 0 is a higher priority and is released last. The value specified in this attribute will override whatever holdingPriority that has been provisioned at the Vcd (or Vpd). If the value is left at the default of noOverride, the holdingPriority provisioned at the Vcd (or Vpd) will be used.') mscAtmIfVpcMnrp = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12)) mscAtmIfVpcMnrpRowStatusTable = MibTable((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12, 1), ) if mibBuilder.loadTexts: mscAtmIfVpcMnrpRowStatusTable.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcMnrpRowStatusTable.setDescription('This entry controls the addition and deletion of mscAtmIfVpcMnrp components.') mscAtmIfVpcMnrpRowStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12, 1, 1), ).setIndexNames((0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfVpcIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmBearerServiceMIB", "mscAtmIfVpcMnrpIndex")) if mibBuilder.loadTexts: mscAtmIfVpcMnrpRowStatusEntry.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcMnrpRowStatusEntry.setDescription('A single entry in the table represents a single mscAtmIfVpcMnrp component.') mscAtmIfVpcMnrpRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12, 1, 1, 1), RowStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVpcMnrpRowStatus.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcMnrpRowStatus.setDescription('This variable is used as the basis for SNMP naming of mscAtmIfVpcMnrp components. These components can be added and deleted.') mscAtmIfVpcMnrpComponentName = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12, 1, 1, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: mscAtmIfVpcMnrpComponentName.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcMnrpComponentName.setDescription("This variable provides the component's string name for use with the ASCII Console Interface") mscAtmIfVpcMnrpStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12, 1, 1, 4), StorageType()).setMaxAccess("readonly") if mibBuilder.loadTexts: mscAtmIfVpcMnrpStorageType.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcMnrpStorageType.setDescription('This variable represents the storage type value for the mscAtmIfVpcMnrp tables.') mscAtmIfVpcMnrpIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12, 1, 1, 10), NonReplicated()) if mibBuilder.loadTexts: mscAtmIfVpcMnrpIndex.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcMnrpIndex.setDescription('This variable represents the index for the mscAtmIfVpcMnrp tables.') mscAtmIfVpcMnrpProvTable = MibTable((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12, 101), ) if mibBuilder.loadTexts: mscAtmIfVpcMnrpProvTable.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcMnrpProvTable.setDescription('This group contains the provisionable attributes for the Mnrp component.') mscAtmIfVpcMnrpProvEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12, 101, 1), ).setIndexNames((0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfVpcIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmBearerServiceMIB", "mscAtmIfVpcMnrpIndex")) if mibBuilder.loadTexts: mscAtmIfVpcMnrpProvEntry.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcMnrpProvEntry.setDescription('An entry in the mscAtmIfVpcMnrpProvTable.') mscAtmIfVpcMnrpOamSegmentBoundary = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12, 101, 1, 30), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("no", 0), ("yes", 1), ("sameAsInterface", 2))).clone('sameAsInterface')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVpcMnrpOamSegmentBoundary.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcMnrpOamSegmentBoundary.setDescription("This attribute specifies the OAM segment boundary desired for a Mnrp component. It affects the connection point type value visible in the parent component's connectionPointType attribute. The desired OAM segment boundary can be specified directly as yes, no or sameAsInterface. If sameAsInterface is specified, the OAM segment boundary is same as the oamSegmentBoundary attribute of the associated AtmIf and the switch will set the connectionPointType, choosing segmentEndPoint for a segment- boundary ATM interface and connectingPoint for a non-segment- boundary ATM interface.") mscAtmIfVpcMnrpBandwidthElastic = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12, 101, 1, 33), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("no", 0), ("yes", 1))).clone('no')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVpcMnrpBandwidthElastic.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcMnrpBandwidthElastic.setDescription('This attribute is only of importance for connections which are carried on a link with a variable bandwidth. For example, the bandwidth may be reduced in the event that one or more physical links in the IMA group fail, such that the originally requested bandwidth cannot be maintained. This attribute shows whether the application running on this connection can continue to operate if the bandwidth is reduced. If the bandwidth is reduced, the amount by which it is reduced will be displayed in the bandwidthReduction attribute. A value of yes, indicates that this connection is elastic, and the bandwidth may be reduced but the connection will not be released. Currently, this attribute should only be set to yes for situations where this Mnrp is functioning as a loopback on one side of an IMA link. There are no other situations where this setting is valid. A value of no indicates that the bandwidth for this connection will not be reduced in the event of link bandwidth reduction. However, this connection may be released based on its holdingPriority.') mscAtmIfVpcMnrpOverrideHoldingPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12, 101, 1, 34), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 6))).clone(namedValues=NamedValues(("n0", 0), ("n1", 1), ("n2", 2), ("n3", 3), ("n4", 4), ("noOverride", 6))).clone('noOverride')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVpcMnrpOverrideHoldingPriority.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcMnrpOverrideHoldingPriority.setDescription('This attribute specifies the holding priority of this connection. Holding priority is used when there is an IMA group where some physical links have failed. Holding priority determines the order in which connections are released. 4 is the lowest holding priority and is released first. 0 is a higher priority and is released last. The value specified in this attribute will override whatever holdingPriority that has been provisioned at the Vcd (or Vpd). If the value is left at the default of noOverride, the holdingPriority provisioned at the Vcd (or Vpd) will be used.') mscAtmIfVpcMnrpNextHopsTable = MibTable((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12, 658), ) if mibBuilder.loadTexts: mscAtmIfVpcMnrpNextHopsTable.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcMnrpNextHopsTable.setDescription('This attribute specifies the list of Nrp components with which this Mnrp is associated. A sample value is AtmIf/31 Vcc/0.32 Nrp. This attribute must be provisioned with at least one Nrp component under a compatible connection type.') mscAtmIfVpcMnrpNextHopsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12, 658, 1), ).setIndexNames((0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfVpcIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmBearerServiceMIB", "mscAtmIfVpcMnrpIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmBearerServiceMIB", "mscAtmIfVpcMnrpNextHopsValue")) if mibBuilder.loadTexts: mscAtmIfVpcMnrpNextHopsEntry.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcMnrpNextHopsEntry.setDescription('An entry in the mscAtmIfVpcMnrpNextHopsTable.') mscAtmIfVpcMnrpNextHopsValue = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12, 658, 1, 1), Link()).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVpcMnrpNextHopsValue.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcMnrpNextHopsValue.setDescription('This variable represents both the value and the index for the mscAtmIfVpcMnrpNextHopsTable.') mscAtmIfVpcMnrpNextHopsRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12, 658, 1, 2), RowStatus()).setMaxAccess("writeonly") if mibBuilder.loadTexts: mscAtmIfVpcMnrpNextHopsRowStatus.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcMnrpNextHopsRowStatus.setDescription('This variable is used to control the addition and deletion of individual values of the mscAtmIfVpcMnrpNextHopsTable.') mscAtmIfVccNrp = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4)) mscAtmIfVccNrpRowStatusTable = MibTable((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 1), ) if mibBuilder.loadTexts: mscAtmIfVccNrpRowStatusTable.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccNrpRowStatusTable.setDescription('This entry controls the addition and deletion of mscAtmIfVccNrp components.') mscAtmIfVccNrpRowStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 1, 1), ).setIndexNames((0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfVccIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmBearerServiceMIB", "mscAtmIfVccNrpIndex")) if mibBuilder.loadTexts: mscAtmIfVccNrpRowStatusEntry.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccNrpRowStatusEntry.setDescription('A single entry in the table represents a single mscAtmIfVccNrp component.') mscAtmIfVccNrpRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 1, 1, 1), RowStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVccNrpRowStatus.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccNrpRowStatus.setDescription('This variable is used as the basis for SNMP naming of mscAtmIfVccNrp components. These components can be added and deleted.') mscAtmIfVccNrpComponentName = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 1, 1, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: mscAtmIfVccNrpComponentName.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccNrpComponentName.setDescription("This variable provides the component's string name for use with the ASCII Console Interface") mscAtmIfVccNrpStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 1, 1, 4), StorageType()).setMaxAccess("readonly") if mibBuilder.loadTexts: mscAtmIfVccNrpStorageType.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccNrpStorageType.setDescription('This variable represents the storage type value for the mscAtmIfVccNrp tables.') mscAtmIfVccNrpIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 1, 1, 10), NonReplicated()) if mibBuilder.loadTexts: mscAtmIfVccNrpIndex.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccNrpIndex.setDescription('This variable represents the index for the mscAtmIfVccNrp tables.') mscAtmIfVccNrpProvTable = MibTable((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 100), ) if mibBuilder.loadTexts: mscAtmIfVccNrpProvTable.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccNrpProvTable.setDescription('This group contains the provisionable attributes for the Nrp component.') mscAtmIfVccNrpProvEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 100, 1), ).setIndexNames((0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfVccIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmBearerServiceMIB", "mscAtmIfVccNrpIndex")) if mibBuilder.loadTexts: mscAtmIfVccNrpProvEntry.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccNrpProvEntry.setDescription('An entry in the mscAtmIfVccNrpProvTable.') mscAtmIfVccNrpNextHop = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 100, 1, 10), Link()).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVccNrpNextHop.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccNrpNextHop.setDescription('This attribute specifies the Nrp component with which this Nrp is associated. A sample value is AtmIf/31 Vcc/0.32 Nrp.') mscAtmIfVccNrpConnectionPointType = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 100, 1, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 4))).clone(namedValues=NamedValues(("segmentEndPoint", 1), ("connectingPoint", 2), ("autoConfigure", 4))).clone('autoConfigure')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVccNrpConnectionPointType.setStatus('obsolete') if mibBuilder.loadTexts: mscAtmIfVccNrpConnectionPointType.setDescription("This attribute specifies the connection point type desired for a Nrp component. The actual connection point type value is visible in the parent component's connectionPointType attribute. The desired connection point type can be specified directly as a segmentEndPoint or connectingPoint. If autoConfigure is specified, the switch will select the connection point type based on the type attribute of the associated AtmIf, choosing segmentEndPoint for a UNI-type ATM interface and connectingPoint for a PPI-type ATM interface. It is obsoleted. The value is mapped into oamSegmentBoundary attribute. segmentEndPoint is mapped into yes. connectingPoint is mapped into no. autoConfigure is mapped into sameAsInterface.") mscAtmIfVccNrpOamSegmentBoundary = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 100, 1, 30), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("no", 0), ("yes", 1), ("sameAsInterface", 2))).clone('sameAsInterface')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVccNrpOamSegmentBoundary.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccNrpOamSegmentBoundary.setDescription("This attribute specifies the OAM segment boundary desired for a Nrp component. It affects the connection point type value visible in the parent component's connectionPointType attribute. The desired OAM segment boundary can be specified directly as yes, no or sameAsInterface. If sameAsInterface is specified, the OAM segment boundary is same as the oamSegmentBoundary attribute of the associated AtmIf and the switch will set the connectionPointType, choosing segmentEndPoint for a segment- boundary ATM interface and connectingPoint for a non-segment- boundary ATM interface.") mscAtmIfVccNrpTxAal5PartialPacketDiscard = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 100, 1, 31), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("disabled", 0), ("enabled", 1))).clone('disabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVccNrpTxAal5PartialPacketDiscard.setStatus('obsolete') if mibBuilder.loadTexts: mscAtmIfVccNrpTxAal5PartialPacketDiscard.setDescription("This attribute is obsolete in P4.2 and has been migrated under Vcd (Vpd) component. This attribute specifies whether the AAL5 Partial Packet Discard (PPD) feature has been enabled or disabled on the Nrp in the transmit direction. This feature allows the NRP to discard the remainder of a cell-forwarded AAL5 frame if a cell of this frame has been discarded due to congestion. This increases the 'goodput' of the link, since cells which are only going to be discarded by the AAL5 reassembly are not transmitted. When this attribute is set to enabled, the PPD feature is applied in the transmit direction. It should only be enabled for connections whose end points are performing AAL5 segmentation and reassembly. When this attribute is set to disabled, the PPD feature is not applied to traffic for this connection in the transmit direction. Note that specifying enabled for a non-AAL5 connection will cause all traffic to be discarded once congestion is encountered.") mscAtmIfVccNrpRxAal5PartialPacketDiscard = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 100, 1, 32), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("disabled", 0), ("enabled", 1), ("sameAsTx", 2))).clone('sameAsTx')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVccNrpRxAal5PartialPacketDiscard.setStatus('obsolete') if mibBuilder.loadTexts: mscAtmIfVccNrpRxAal5PartialPacketDiscard.setDescription("This attribute is obsolete in P4.2 and has been migrated under Vcd (Vpd) component. This attribute specifies whether the AAL5 Partial Packet Discard (PPD) feature has been enabled or disabled on the Nrp in the receive direction. This feature allows the NRP to discard the remainder of a cell-forwarded AAL5 frame if a cell of this frame has been discarded due to congestion or usage parameter control (UPC). This increases the 'goodput' of the link, since cells which are only going to be discarded by the AAL5 reassembly are not transmitted. When this attribute is set to enabled, the PPD feature is applied in the receive direction. It should only be enabled for connections whose end points are performing AAL5 segmentation and reassembly. When this attribute is set to disabled, the PPD feature is not applied to traffic for this connection in the receive direction. When this attribute is set to sameAsTx, the PPD feature for traffic in the receive direction will be configured the same way as it is in the transmit direction. Note that specifying enabled for a non-AAL5 connection will cause all traffic to be discarded once congestion is encountered.") mscAtmIfVccNrpBandwidthElastic = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 100, 1, 33), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("no", 0), ("yes", 1))).clone('no')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVccNrpBandwidthElastic.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccNrpBandwidthElastic.setDescription('This attribute is only of importance for connections which are carried on a link with a variable bandwidth. For example, the bandwidth may be reduced in the event that one or more physical links in the IMA group fail, such that the originally requested bandwidth cannot be maintained. This attribute shows whether the application running on this connection can continue to operate if the bandwidth is reduced. If the bandwidth is reduced, the amount by which it is reduced will be displayed in the bandwidthReduction attribute. A value of yes, indicates that this connection is elastic, and the bandwidth may be reduced but the connection will not be released. Currently, this attribute should only be set to yes for situations where this Nrp is functioning as a loopback on one side of an IMA link. There are no other situations where this setting is valid. A value of no indicates that the bandwidth for this connection will not be reduced in the event of link bandwidth reduction. However, this connection may be released based on its holdingPriority.') mscAtmIfVccNrpOverrideHoldingPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 100, 1, 34), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 6))).clone(namedValues=NamedValues(("n0", 0), ("n1", 1), ("n2", 2), ("n3", 3), ("n4", 4), ("noOverride", 6))).clone('noOverride')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVccNrpOverrideHoldingPriority.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccNrpOverrideHoldingPriority.setDescription('This attribute specifies the holding priority of this connection. Holding priority is used when there is an IMA group where some physical links have failed. Holding priority determines the order in which connections are released. 4 is the lowest holding priority and is released first. 0 is a higher priority and is released last. The value specified in this attribute will override whatever holdingPriority that has been provisioned at the Vcd (or Vpd). If the value is left at the default of noOverride, the holdingPriority provisioned at the Vcd (or Vpd) will be used.') mscAtmIfVccMnrp = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13)) mscAtmIfVccMnrpRowStatusTable = MibTable((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13, 1), ) if mibBuilder.loadTexts: mscAtmIfVccMnrpRowStatusTable.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccMnrpRowStatusTable.setDescription('This entry controls the addition and deletion of mscAtmIfVccMnrp components.') mscAtmIfVccMnrpRowStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13, 1, 1), ).setIndexNames((0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfVccIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmBearerServiceMIB", "mscAtmIfVccMnrpIndex")) if mibBuilder.loadTexts: mscAtmIfVccMnrpRowStatusEntry.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccMnrpRowStatusEntry.setDescription('A single entry in the table represents a single mscAtmIfVccMnrp component.') mscAtmIfVccMnrpRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13, 1, 1, 1), RowStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVccMnrpRowStatus.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccMnrpRowStatus.setDescription('This variable is used as the basis for SNMP naming of mscAtmIfVccMnrp components. These components can be added and deleted.') mscAtmIfVccMnrpComponentName = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13, 1, 1, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: mscAtmIfVccMnrpComponentName.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccMnrpComponentName.setDescription("This variable provides the component's string name for use with the ASCII Console Interface") mscAtmIfVccMnrpStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13, 1, 1, 4), StorageType()).setMaxAccess("readonly") if mibBuilder.loadTexts: mscAtmIfVccMnrpStorageType.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccMnrpStorageType.setDescription('This variable represents the storage type value for the mscAtmIfVccMnrp tables.') mscAtmIfVccMnrpIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13, 1, 1, 10), NonReplicated()) if mibBuilder.loadTexts: mscAtmIfVccMnrpIndex.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccMnrpIndex.setDescription('This variable represents the index for the mscAtmIfVccMnrp tables.') mscAtmIfVccMnrpProvTable = MibTable((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13, 101), ) if mibBuilder.loadTexts: mscAtmIfVccMnrpProvTable.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccMnrpProvTable.setDescription('This group contains the provisionable attributes for the Mnrp component.') mscAtmIfVccMnrpProvEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13, 101, 1), ).setIndexNames((0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfVccIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmBearerServiceMIB", "mscAtmIfVccMnrpIndex")) if mibBuilder.loadTexts: mscAtmIfVccMnrpProvEntry.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccMnrpProvEntry.setDescription('An entry in the mscAtmIfVccMnrpProvTable.') mscAtmIfVccMnrpOamSegmentBoundary = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13, 101, 1, 30), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("no", 0), ("yes", 1), ("sameAsInterface", 2))).clone('sameAsInterface')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVccMnrpOamSegmentBoundary.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccMnrpOamSegmentBoundary.setDescription("This attribute specifies the OAM segment boundary desired for a Mnrp component. It affects the connection point type value visible in the parent component's connectionPointType attribute. The desired OAM segment boundary can be specified directly as yes, no or sameAsInterface. If sameAsInterface is specified, the OAM segment boundary is same as the oamSegmentBoundary attribute of the associated AtmIf and the switch will set the connectionPointType, choosing segmentEndPoint for a segment- boundary ATM interface and connectingPoint for a non-segment- boundary ATM interface.") mscAtmIfVccMnrpBandwidthElastic = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13, 101, 1, 33), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("no", 0), ("yes", 1))).clone('no')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVccMnrpBandwidthElastic.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccMnrpBandwidthElastic.setDescription('This attribute is only of importance for connections which are carried on a link with a variable bandwidth. For example, the bandwidth may be reduced in the event that one or more physical links in the IMA group fail, such that the originally requested bandwidth cannot be maintained. This attribute shows whether the application running on this connection can continue to operate if the bandwidth is reduced. If the bandwidth is reduced, the amount by which it is reduced will be displayed in the bandwidthReduction attribute. A value of yes, indicates that this connection is elastic, and the bandwidth may be reduced but the connection will not be released. Currently, this attribute should only be set to yes for situations where this Mnrp is functioning as a loopback on one side of an IMA link. There are no other situations where this setting is valid. A value of no indicates that the bandwidth for this connection will not be reduced in the event of link bandwidth reduction. However, this connection may be released based on its holdingPriority.') mscAtmIfVccMnrpOverrideHoldingPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13, 101, 1, 34), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 6))).clone(namedValues=NamedValues(("n0", 0), ("n1", 1), ("n2", 2), ("n3", 3), ("n4", 4), ("noOverride", 6))).clone('noOverride')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVccMnrpOverrideHoldingPriority.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccMnrpOverrideHoldingPriority.setDescription('This attribute specifies the holding priority of this connection. Holding priority is used when there is an IMA group where some physical links have failed. Holding priority determines the order in which connections are released. 4 is the lowest holding priority and is released first. 0 is a higher priority and is released last. The value specified in this attribute will override whatever holdingPriority that has been provisioned at the Vcd (or Vpd). If the value is left at the default of noOverride, the holdingPriority provisioned at the Vcd (or Vpd) will be used.') mscAtmIfVccMnrpNextHopsTable = MibTable((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13, 658), ) if mibBuilder.loadTexts: mscAtmIfVccMnrpNextHopsTable.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccMnrpNextHopsTable.setDescription('This attribute specifies the list of Nrp components with which this Mnrp is associated. A sample value is AtmIf/31 Vcc/0.32 Nrp. This attribute must be provisioned with at least one Nrp component under a compatible connection type.') mscAtmIfVccMnrpNextHopsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13, 658, 1), ).setIndexNames((0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfVccIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmBearerServiceMIB", "mscAtmIfVccMnrpIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmBearerServiceMIB", "mscAtmIfVccMnrpNextHopsValue")) if mibBuilder.loadTexts: mscAtmIfVccMnrpNextHopsEntry.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccMnrpNextHopsEntry.setDescription('An entry in the mscAtmIfVccMnrpNextHopsTable.') mscAtmIfVccMnrpNextHopsValue = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13, 658, 1, 1), Link()).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVccMnrpNextHopsValue.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccMnrpNextHopsValue.setDescription('This variable represents both the value and the index for the mscAtmIfVccMnrpNextHopsTable.') mscAtmIfVccMnrpNextHopsRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13, 658, 1, 2), RowStatus()).setMaxAccess("writeonly") if mibBuilder.loadTexts: mscAtmIfVccMnrpNextHopsRowStatus.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccMnrpNextHopsRowStatus.setDescription('This variable is used to control the addition and deletion of individual values of the mscAtmIfVccMnrpNextHopsTable.') mscAtmIfVptVccNrp = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4)) mscAtmIfVptVccNrpRowStatusTable = MibTable((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 1), ) if mibBuilder.loadTexts: mscAtmIfVptVccNrpRowStatusTable.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccNrpRowStatusTable.setDescription('This entry controls the addition and deletion of mscAtmIfVptVccNrp components.') mscAtmIfVptVccNrpRowStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 1, 1), ).setIndexNames((0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfVptIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfVptVccIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmBearerServiceMIB", "mscAtmIfVptVccNrpIndex")) if mibBuilder.loadTexts: mscAtmIfVptVccNrpRowStatusEntry.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccNrpRowStatusEntry.setDescription('A single entry in the table represents a single mscAtmIfVptVccNrp component.') mscAtmIfVptVccNrpRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 1, 1, 1), RowStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVptVccNrpRowStatus.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccNrpRowStatus.setDescription('This variable is used as the basis for SNMP naming of mscAtmIfVptVccNrp components. These components can be added and deleted.') mscAtmIfVptVccNrpComponentName = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 1, 1, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: mscAtmIfVptVccNrpComponentName.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccNrpComponentName.setDescription("This variable provides the component's string name for use with the ASCII Console Interface") mscAtmIfVptVccNrpStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 1, 1, 4), StorageType()).setMaxAccess("readonly") if mibBuilder.loadTexts: mscAtmIfVptVccNrpStorageType.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccNrpStorageType.setDescription('This variable represents the storage type value for the mscAtmIfVptVccNrp tables.') mscAtmIfVptVccNrpIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 1, 1, 10), NonReplicated()) if mibBuilder.loadTexts: mscAtmIfVptVccNrpIndex.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccNrpIndex.setDescription('This variable represents the index for the mscAtmIfVptVccNrp tables.') mscAtmIfVptVccNrpProvTable = MibTable((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 100), ) if mibBuilder.loadTexts: mscAtmIfVptVccNrpProvTable.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccNrpProvTable.setDescription('This group contains the provisionable attributes for the Nrp component.') mscAtmIfVptVccNrpProvEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 100, 1), ).setIndexNames((0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfVptIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfVptVccIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmBearerServiceMIB", "mscAtmIfVptVccNrpIndex")) if mibBuilder.loadTexts: mscAtmIfVptVccNrpProvEntry.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccNrpProvEntry.setDescription('An entry in the mscAtmIfVptVccNrpProvTable.') mscAtmIfVptVccNrpNextHop = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 100, 1, 10), Link()).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVptVccNrpNextHop.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccNrpNextHop.setDescription('This attribute specifies the Nrp component with which this Nrp is associated. A sample value is AtmIf/31 Vcc/0.32 Nrp.') mscAtmIfVptVccNrpConnectionPointType = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 100, 1, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 4))).clone(namedValues=NamedValues(("segmentEndPoint", 1), ("connectingPoint", 2), ("autoConfigure", 4))).clone('autoConfigure')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVptVccNrpConnectionPointType.setStatus('obsolete') if mibBuilder.loadTexts: mscAtmIfVptVccNrpConnectionPointType.setDescription("This attribute specifies the connection point type desired for a Nrp component. The actual connection point type value is visible in the parent component's connectionPointType attribute. The desired connection point type can be specified directly as a segmentEndPoint or connectingPoint. If autoConfigure is specified, the switch will select the connection point type based on the type attribute of the associated AtmIf, choosing segmentEndPoint for a UNI-type ATM interface and connectingPoint for a PPI-type ATM interface. It is obsoleted. The value is mapped into oamSegmentBoundary attribute. segmentEndPoint is mapped into yes. connectingPoint is mapped into no. autoConfigure is mapped into sameAsInterface.") mscAtmIfVptVccNrpOamSegmentBoundary = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 100, 1, 30), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("no", 0), ("yes", 1), ("sameAsInterface", 2))).clone('sameAsInterface')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVptVccNrpOamSegmentBoundary.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccNrpOamSegmentBoundary.setDescription("This attribute specifies the OAM segment boundary desired for a Nrp component. It affects the connection point type value visible in the parent component's connectionPointType attribute. The desired OAM segment boundary can be specified directly as yes, no or sameAsInterface. If sameAsInterface is specified, the OAM segment boundary is same as the oamSegmentBoundary attribute of the associated AtmIf and the switch will set the connectionPointType, choosing segmentEndPoint for a segment- boundary ATM interface and connectingPoint for a non-segment- boundary ATM interface.") mscAtmIfVptVccNrpTxAal5PartialPacketDiscard = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 100, 1, 31), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("disabled", 0), ("enabled", 1))).clone('disabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVptVccNrpTxAal5PartialPacketDiscard.setStatus('obsolete') if mibBuilder.loadTexts: mscAtmIfVptVccNrpTxAal5PartialPacketDiscard.setDescription("This attribute is obsolete in P4.2 and has been migrated under Vcd (Vpd) component. This attribute specifies whether the AAL5 Partial Packet Discard (PPD) feature has been enabled or disabled on the Nrp in the transmit direction. This feature allows the NRP to discard the remainder of a cell-forwarded AAL5 frame if a cell of this frame has been discarded due to congestion. This increases the 'goodput' of the link, since cells which are only going to be discarded by the AAL5 reassembly are not transmitted. When this attribute is set to enabled, the PPD feature is applied in the transmit direction. It should only be enabled for connections whose end points are performing AAL5 segmentation and reassembly. When this attribute is set to disabled, the PPD feature is not applied to traffic for this connection in the transmit direction. Note that specifying enabled for a non-AAL5 connection will cause all traffic to be discarded once congestion is encountered.") mscAtmIfVptVccNrpRxAal5PartialPacketDiscard = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 100, 1, 32), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("disabled", 0), ("enabled", 1), ("sameAsTx", 2))).clone('sameAsTx')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVptVccNrpRxAal5PartialPacketDiscard.setStatus('obsolete') if mibBuilder.loadTexts: mscAtmIfVptVccNrpRxAal5PartialPacketDiscard.setDescription("This attribute is obsolete in P4.2 and has been migrated under Vcd (Vpd) component. This attribute specifies whether the AAL5 Partial Packet Discard (PPD) feature has been enabled or disabled on the Nrp in the receive direction. This feature allows the NRP to discard the remainder of a cell-forwarded AAL5 frame if a cell of this frame has been discarded due to congestion or usage parameter control (UPC). This increases the 'goodput' of the link, since cells which are only going to be discarded by the AAL5 reassembly are not transmitted. When this attribute is set to enabled, the PPD feature is applied in the receive direction. It should only be enabled for connections whose end points are performing AAL5 segmentation and reassembly. When this attribute is set to disabled, the PPD feature is not applied to traffic for this connection in the receive direction. When this attribute is set to sameAsTx, the PPD feature for traffic in the receive direction will be configured the same way as it is in the transmit direction. Note that specifying enabled for a non-AAL5 connection will cause all traffic to be discarded once congestion is encountered.") mscAtmIfVptVccNrpBandwidthElastic = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 100, 1, 33), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("no", 0), ("yes", 1))).clone('no')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVptVccNrpBandwidthElastic.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccNrpBandwidthElastic.setDescription('This attribute is only of importance for connections which are carried on a link with a variable bandwidth. For example, the bandwidth may be reduced in the event that one or more physical links in the IMA group fail, such that the originally requested bandwidth cannot be maintained. This attribute shows whether the application running on this connection can continue to operate if the bandwidth is reduced. If the bandwidth is reduced, the amount by which it is reduced will be displayed in the bandwidthReduction attribute. A value of yes, indicates that this connection is elastic, and the bandwidth may be reduced but the connection will not be released. Currently, this attribute should only be set to yes for situations where this Nrp is functioning as a loopback on one side of an IMA link. There are no other situations where this setting is valid. A value of no indicates that the bandwidth for this connection will not be reduced in the event of link bandwidth reduction. However, this connection may be released based on its holdingPriority.') mscAtmIfVptVccNrpOverrideHoldingPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 100, 1, 34), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 6))).clone(namedValues=NamedValues(("n0", 0), ("n1", 1), ("n2", 2), ("n3", 3), ("n4", 4), ("noOverride", 6))).clone('noOverride')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVptVccNrpOverrideHoldingPriority.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccNrpOverrideHoldingPriority.setDescription('This attribute specifies the holding priority of this connection. Holding priority is used when there is an IMA group where some physical links have failed. Holding priority determines the order in which connections are released. 4 is the lowest holding priority and is released first. 0 is a higher priority and is released last. The value specified in this attribute will override whatever holdingPriority that has been provisioned at the Vcd (or Vpd). If the value is left at the default of noOverride, the holdingPriority provisioned at the Vcd (or Vpd) will be used.') mscAtmIfVptVccMnrp = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13)) mscAtmIfVptVccMnrpRowStatusTable = MibTable((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13, 1), ) if mibBuilder.loadTexts: mscAtmIfVptVccMnrpRowStatusTable.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccMnrpRowStatusTable.setDescription('This entry controls the addition and deletion of mscAtmIfVptVccMnrp components.') mscAtmIfVptVccMnrpRowStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13, 1, 1), ).setIndexNames((0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfVptIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfVptVccIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmBearerServiceMIB", "mscAtmIfVptVccMnrpIndex")) if mibBuilder.loadTexts: mscAtmIfVptVccMnrpRowStatusEntry.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccMnrpRowStatusEntry.setDescription('A single entry in the table represents a single mscAtmIfVptVccMnrp component.') mscAtmIfVptVccMnrpRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13, 1, 1, 1), RowStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVptVccMnrpRowStatus.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccMnrpRowStatus.setDescription('This variable is used as the basis for SNMP naming of mscAtmIfVptVccMnrp components. These components can be added and deleted.') mscAtmIfVptVccMnrpComponentName = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13, 1, 1, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: mscAtmIfVptVccMnrpComponentName.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccMnrpComponentName.setDescription("This variable provides the component's string name for use with the ASCII Console Interface") mscAtmIfVptVccMnrpStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13, 1, 1, 4), StorageType()).setMaxAccess("readonly") if mibBuilder.loadTexts: mscAtmIfVptVccMnrpStorageType.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccMnrpStorageType.setDescription('This variable represents the storage type value for the mscAtmIfVptVccMnrp tables.') mscAtmIfVptVccMnrpIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13, 1, 1, 10), NonReplicated()) if mibBuilder.loadTexts: mscAtmIfVptVccMnrpIndex.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccMnrpIndex.setDescription('This variable represents the index for the mscAtmIfVptVccMnrp tables.') mscAtmIfVptVccMnrpProvTable = MibTable((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13, 101), ) if mibBuilder.loadTexts: mscAtmIfVptVccMnrpProvTable.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccMnrpProvTable.setDescription('This group contains the provisionable attributes for the Mnrp component.') mscAtmIfVptVccMnrpProvEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13, 101, 1), ).setIndexNames((0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfVptIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfVptVccIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmBearerServiceMIB", "mscAtmIfVptVccMnrpIndex")) if mibBuilder.loadTexts: mscAtmIfVptVccMnrpProvEntry.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccMnrpProvEntry.setDescription('An entry in the mscAtmIfVptVccMnrpProvTable.') mscAtmIfVptVccMnrpOamSegmentBoundary = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13, 101, 1, 30), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("no", 0), ("yes", 1), ("sameAsInterface", 2))).clone('sameAsInterface')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVptVccMnrpOamSegmentBoundary.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccMnrpOamSegmentBoundary.setDescription("This attribute specifies the OAM segment boundary desired for a Mnrp component. It affects the connection point type value visible in the parent component's connectionPointType attribute. The desired OAM segment boundary can be specified directly as yes, no or sameAsInterface. If sameAsInterface is specified, the OAM segment boundary is same as the oamSegmentBoundary attribute of the associated AtmIf and the switch will set the connectionPointType, choosing segmentEndPoint for a segment- boundary ATM interface and connectingPoint for a non-segment- boundary ATM interface.") mscAtmIfVptVccMnrpBandwidthElastic = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13, 101, 1, 33), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("no", 0), ("yes", 1))).clone('no')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVptVccMnrpBandwidthElastic.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccMnrpBandwidthElastic.setDescription('This attribute is only of importance for connections which are carried on a link with a variable bandwidth. For example, the bandwidth may be reduced in the event that one or more physical links in the IMA group fail, such that the originally requested bandwidth cannot be maintained. This attribute shows whether the application running on this connection can continue to operate if the bandwidth is reduced. If the bandwidth is reduced, the amount by which it is reduced will be displayed in the bandwidthReduction attribute. A value of yes, indicates that this connection is elastic, and the bandwidth may be reduced but the connection will not be released. Currently, this attribute should only be set to yes for situations where this Mnrp is functioning as a loopback on one side of an IMA link. There are no other situations where this setting is valid. A value of no indicates that the bandwidth for this connection will not be reduced in the event of link bandwidth reduction. However, this connection may be released based on its holdingPriority.') mscAtmIfVptVccMnrpOverrideHoldingPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13, 101, 1, 34), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 6))).clone(namedValues=NamedValues(("n0", 0), ("n1", 1), ("n2", 2), ("n3", 3), ("n4", 4), ("noOverride", 6))).clone('noOverride')).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVptVccMnrpOverrideHoldingPriority.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccMnrpOverrideHoldingPriority.setDescription('This attribute specifies the holding priority of this connection. Holding priority is used when there is an IMA group where some physical links have failed. Holding priority determines the order in which connections are released. 4 is the lowest holding priority and is released first. 0 is a higher priority and is released last. The value specified in this attribute will override whatever holdingPriority that has been provisioned at the Vcd (or Vpd). If the value is left at the default of noOverride, the holdingPriority provisioned at the Vcd (or Vpd) will be used.') mscAtmIfVptVccMnrpNextHopsTable = MibTable((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13, 658), ) if mibBuilder.loadTexts: mscAtmIfVptVccMnrpNextHopsTable.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccMnrpNextHopsTable.setDescription('This attribute specifies the list of Nrp components with which this Mnrp is associated. A sample value is AtmIf/31 Vcc/0.32 Nrp. This attribute must be provisioned with at least one Nrp component under a compatible connection type.') mscAtmIfVptVccMnrpNextHopsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13, 658, 1), ).setIndexNames((0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfVptIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmCoreMIB", "mscAtmIfVptVccIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmBearerServiceMIB", "mscAtmIfVptVccMnrpIndex"), (0, "Nortel-MsCarrier-MscPassport-AtmBearerServiceMIB", "mscAtmIfVptVccMnrpNextHopsValue")) if mibBuilder.loadTexts: mscAtmIfVptVccMnrpNextHopsEntry.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccMnrpNextHopsEntry.setDescription('An entry in the mscAtmIfVptVccMnrpNextHopsTable.') mscAtmIfVptVccMnrpNextHopsValue = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13, 658, 1, 1), Link()).setMaxAccess("readwrite") if mibBuilder.loadTexts: mscAtmIfVptVccMnrpNextHopsValue.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccMnrpNextHopsValue.setDescription('This variable represents both the value and the index for the mscAtmIfVptVccMnrpNextHopsTable.') mscAtmIfVptVccMnrpNextHopsRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13, 658, 1, 2), RowStatus()).setMaxAccess("writeonly") if mibBuilder.loadTexts: mscAtmIfVptVccMnrpNextHopsRowStatus.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccMnrpNextHopsRowStatus.setDescription('This variable is used to control the addition and deletion of individual values of the mscAtmIfVptVccMnrpNextHopsTable.') atmBearerServiceGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 64, 1)) atmBearerServiceGroupCA = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 64, 1, 1)) atmBearerServiceGroupCA02 = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 64, 1, 1, 3)) atmBearerServiceGroupCA02A = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 64, 1, 1, 3, 2)) atmBearerServiceCapabilities = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 64, 3)) atmBearerServiceCapabilitiesCA = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 64, 3, 1)) atmBearerServiceCapabilitiesCA02 = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 64, 3, 1, 3)) atmBearerServiceCapabilitiesCA02A = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 64, 3, 1, 3, 2)) mibBuilder.exportSymbols("Nortel-MsCarrier-MscPassport-AtmBearerServiceMIB", mscAtmIfVpcNrpNextHop=mscAtmIfVpcNrpNextHop, mscAtmIfVpcMnrpIndex=mscAtmIfVpcMnrpIndex, mscAtmIfVccNrpConnectionPointType=mscAtmIfVccNrpConnectionPointType, mscAtmIfVptVccMnrpNextHopsTable=mscAtmIfVptVccMnrpNextHopsTable, atmBearerServiceGroupCA02=atmBearerServiceGroupCA02, mscAtmIfVpcNrpRowStatus=mscAtmIfVpcNrpRowStatus, mscAtmIfVccNrpIndex=mscAtmIfVccNrpIndex, mscAtmIfVptVccNrpBandwidthElastic=mscAtmIfVptVccNrpBandwidthElastic, mscAtmIfVccNrpStorageType=mscAtmIfVccNrpStorageType, mscAtmIfVccMnrpNextHopsTable=mscAtmIfVccMnrpNextHopsTable, mscAtmIfVptVccMnrpRowStatusTable=mscAtmIfVptVccMnrpRowStatusTable, mscAtmIfVpcMnrpProvTable=mscAtmIfVpcMnrpProvTable, mscAtmIfVpcMnrpNextHopsEntry=mscAtmIfVpcMnrpNextHopsEntry, mscAtmIfVpcMnrpOverrideHoldingPriority=mscAtmIfVpcMnrpOverrideHoldingPriority, mscAtmIfVccNrpComponentName=mscAtmIfVccNrpComponentName, mscAtmIfVptVccNrpRxAal5PartialPacketDiscard=mscAtmIfVptVccNrpRxAal5PartialPacketDiscard, mscAtmIfVpcMnrpRowStatus=mscAtmIfVpcMnrpRowStatus, atmBearerServiceGroupCA=atmBearerServiceGroupCA, mscAtmIfVptVccMnrpProvTable=mscAtmIfVptVccMnrpProvTable, mscAtmIfVpcNrpComponentName=mscAtmIfVpcNrpComponentName, mscAtmIfVccNrpRowStatusTable=mscAtmIfVccNrpRowStatusTable, mscAtmIfVpcNrpOamSegmentBoundary=mscAtmIfVpcNrpOamSegmentBoundary, mscAtmIfVptVccMnrpOverrideHoldingPriority=mscAtmIfVptVccMnrpOverrideHoldingPriority, mscAtmIfVptVccNrpOverrideHoldingPriority=mscAtmIfVptVccNrpOverrideHoldingPriority, mscAtmIfVccNrpRowStatusEntry=mscAtmIfVccNrpRowStatusEntry, mscAtmIfVptVccMnrpRowStatusEntry=mscAtmIfVptVccMnrpRowStatusEntry, mscAtmIfVccMnrpOamSegmentBoundary=mscAtmIfVccMnrpOamSegmentBoundary, mscAtmIfVptVccNrpStorageType=mscAtmIfVptVccNrpStorageType, mscAtmIfVccNrpOamSegmentBoundary=mscAtmIfVccNrpOamSegmentBoundary, mscAtmIfVpcMnrpNextHopsValue=mscAtmIfVpcMnrpNextHopsValue, mscAtmIfVptVccNrp=mscAtmIfVptVccNrp, mscAtmIfVptVccMnrpOamSegmentBoundary=mscAtmIfVptVccMnrpOamSegmentBoundary, mscAtmIfVccMnrpIndex=mscAtmIfVccMnrpIndex, mscAtmIfVccMnrpProvEntry=mscAtmIfVccMnrpProvEntry, mscAtmIfVpcMnrpBandwidthElastic=mscAtmIfVpcMnrpBandwidthElastic, mscAtmIfVpcNrpProvEntry=mscAtmIfVpcNrpProvEntry, mscAtmIfVccNrpTxAal5PartialPacketDiscard=mscAtmIfVccNrpTxAal5PartialPacketDiscard, atmBearerServiceCapabilitiesCA02A=atmBearerServiceCapabilitiesCA02A, mscAtmIfVccNrp=mscAtmIfVccNrp, mscAtmIfVpcNrpRowStatusEntry=mscAtmIfVpcNrpRowStatusEntry, mscAtmIfVpcNrpConnectionPointType=mscAtmIfVpcNrpConnectionPointType, mscAtmIfVpcMnrpNextHopsRowStatus=mscAtmIfVpcMnrpNextHopsRowStatus, mscAtmIfVpcNrpTxAal5PartialPacketDiscard=mscAtmIfVpcNrpTxAal5PartialPacketDiscard, mscAtmIfVccNrpOverrideHoldingPriority=mscAtmIfVccNrpOverrideHoldingPriority, mscAtmIfVpcNrpIndex=mscAtmIfVpcNrpIndex, mscAtmIfVptVccMnrpProvEntry=mscAtmIfVptVccMnrpProvEntry, mscAtmIfVpcNrpStorageType=mscAtmIfVpcNrpStorageType, mscAtmIfVptVccNrpConnectionPointType=mscAtmIfVptVccNrpConnectionPointType, mscAtmIfVccMnrp=mscAtmIfVccMnrp, mscAtmIfVccMnrpStorageType=mscAtmIfVccMnrpStorageType, mscAtmIfVccMnrpOverrideHoldingPriority=mscAtmIfVccMnrpOverrideHoldingPriority, atmBearerServiceGroup=atmBearerServiceGroup, mscAtmIfVptVccMnrpNextHopsEntry=mscAtmIfVptVccMnrpNextHopsEntry, mscAtmIfVpcNrpRowStatusTable=mscAtmIfVpcNrpRowStatusTable, mscAtmIfVpcMnrpRowStatusTable=mscAtmIfVpcMnrpRowStatusTable, atmBearerServiceGroupCA02A=atmBearerServiceGroupCA02A, mscAtmIfVptVccMnrpComponentName=mscAtmIfVptVccMnrpComponentName, mscAtmIfVccNrpBandwidthElastic=mscAtmIfVccNrpBandwidthElastic, mscAtmIfVptVccNrpRowStatus=mscAtmIfVptVccNrpRowStatus, mscAtmIfVpcMnrp=mscAtmIfVpcMnrp, mscAtmIfVptVccNrpOamSegmentBoundary=mscAtmIfVptVccNrpOamSegmentBoundary, mscAtmIfVptVccNrpComponentName=mscAtmIfVptVccNrpComponentName, mscAtmIfVptVccMnrpIndex=mscAtmIfVptVccMnrpIndex, mscAtmIfVpcNrpBandwidthElastic=mscAtmIfVpcNrpBandwidthElastic, mscAtmIfVccMnrpRowStatus=mscAtmIfVccMnrpRowStatus, atmBearerServiceCapabilitiesCA=atmBearerServiceCapabilitiesCA, mscAtmIfVpcNrpRxAal5PartialPacketDiscard=mscAtmIfVpcNrpRxAal5PartialPacketDiscard, mscAtmIfVptVccNrpProvEntry=mscAtmIfVptVccNrpProvEntry, mscAtmIfVccNrpRowStatus=mscAtmIfVccNrpRowStatus, mscAtmIfVccMnrpProvTable=mscAtmIfVccMnrpProvTable, mscAtmIfVccMnrpRowStatusEntry=mscAtmIfVccMnrpRowStatusEntry, mscAtmIfVptVccMnrpRowStatus=mscAtmIfVptVccMnrpRowStatus, mscAtmIfVccMnrpRowStatusTable=mscAtmIfVccMnrpRowStatusTable, mscAtmIfVptVccNrpRowStatusEntry=mscAtmIfVptVccNrpRowStatusEntry, mscAtmIfVpcNrpOverrideHoldingPriority=mscAtmIfVpcNrpOverrideHoldingPriority, mscAtmIfVptVccMnrp=mscAtmIfVptVccMnrp, mscAtmIfVpcNrpProvTable=mscAtmIfVpcNrpProvTable, mscAtmIfVpcMnrpOamSegmentBoundary=mscAtmIfVpcMnrpOamSegmentBoundary, mscAtmIfVpcMnrpNextHopsTable=mscAtmIfVpcMnrpNextHopsTable, mscAtmIfVccMnrpNextHopsEntry=mscAtmIfVccMnrpNextHopsEntry, atmBearerServiceCapabilitiesCA02=atmBearerServiceCapabilitiesCA02, mscAtmIfVccNrpRxAal5PartialPacketDiscard=mscAtmIfVccNrpRxAal5PartialPacketDiscard, mscAtmIfVpcMnrpProvEntry=mscAtmIfVpcMnrpProvEntry, mscAtmIfVpcMnrpComponentName=mscAtmIfVpcMnrpComponentName, mscAtmIfVpcMnrpRowStatusEntry=mscAtmIfVpcMnrpRowStatusEntry, mscAtmIfVpcNrp=mscAtmIfVpcNrp, atmBearerServiceCapabilities=atmBearerServiceCapabilities, mscAtmIfVptVccNrpProvTable=mscAtmIfVptVccNrpProvTable, mscAtmIfVptVccNrpRowStatusTable=mscAtmIfVptVccNrpRowStatusTable, mscAtmIfVccNrpProvTable=mscAtmIfVccNrpProvTable, mscAtmIfVptVccNrpNextHop=mscAtmIfVptVccNrpNextHop, mscAtmIfVptVccMnrpStorageType=mscAtmIfVptVccMnrpStorageType, mscAtmIfVptVccMnrpNextHopsValue=mscAtmIfVptVccMnrpNextHopsValue, mscAtmIfVpcMnrpStorageType=mscAtmIfVpcMnrpStorageType, mscAtmIfVccMnrpNextHopsValue=mscAtmIfVccMnrpNextHopsValue, mscAtmIfVptVccNrpTxAal5PartialPacketDiscard=mscAtmIfVptVccNrpTxAal5PartialPacketDiscard, mscAtmIfVptVccMnrpBandwidthElastic=mscAtmIfVptVccMnrpBandwidthElastic, mscAtmIfVptVccNrpIndex=mscAtmIfVptVccNrpIndex, mscAtmIfVccMnrpNextHopsRowStatus=mscAtmIfVccMnrpNextHopsRowStatus, mscAtmIfVccMnrpBandwidthElastic=mscAtmIfVccMnrpBandwidthElastic, mscAtmIfVccMnrpComponentName=mscAtmIfVccMnrpComponentName, mscAtmIfVptVccMnrpNextHopsRowStatus=mscAtmIfVptVccMnrpNextHopsRowStatus, atmBearerServiceMIB=atmBearerServiceMIB, mscAtmIfVccNrpNextHop=mscAtmIfVccNrpNextHop, mscAtmIfVccNrpProvEntry=mscAtmIfVccNrpProvEntry)
class Solution: def XXX(self, a: str, b: str) -> str: if len(a) < len(b): a, b = b, a b = '0' * (len(a) - len(b)) + b c = [] flag = 0 for i in range(1, len(a) + 1): c.insert(0, str( (int(a[-i]) + int(b[-i]) + flag) % 2)) flag = ( int(a[-i]) + int(b[-i]) + flag ) // 2 if flag != 0: c.insert(0, str(flag)) return ''.join(c)
soma = 0 cont = 0 for c in range(1, 7): n = int(input(f'Digite o {c}° numero:')) if n % 2 == 0: soma += n cont += 1 print(f'A soma de todos os {cont} valores pares é igual á {soma}')
def application(environment, start_response): response_body = ( 'Greetings to all Python developers! ' 'This is standard WSGI handler.' ) status = '200 OK' response_headers = [ ('Content-Type', 'text/plain'), ('Content-Length', str(len(response_body))), ] start_response(status, response_headers) return [response_body]
# 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 isValidBST(self, root: TreeNode) -> bool: if not root: return True stack=[(root,-math.inf,math.inf)] while stack: node,lower,upper=stack.pop() if node: val=node.val print(val,lower,upper) if val<=lower or val>=upper: return False stack.append((node.right,val,upper)) stack.append((node.left,lower,val)) return True
def test_soap(app): project_list = app.soap.get_project_name_list("administrator", "root") print("\n" + str(project_list)) print(len(project_list))
MOCK_DATA = [ { "symbol": "AMD", "companyName": "Advanced Micro Devices Inc.", "exchange": "NASDAQ Capital Market", "industry": "Semiconductors", "website": "http://www.amd.com", "description": "Advanced Micro Devices Inc designs and produces microprocessors and low-power processor solutions for the computer, communications, and consumer electronics industries.", "CEO": "Lisa T. Su", "issueType": "cs", "sector": "Technology" }, { "symbol": "AAPL", "companyName": "Apple Inc.", "exchange": "Nasdaq Global Select", "industry": "Computer Hardware", "website": "http://www.apple.com", "description": "Apple Inc is an American multinational technology company. It designs, manufactures, and markets mobile communication and media devices, personal computers, and portable digital music players.", "CEO": "Timothy D. Cook", "issueType": "cs", "sector": "Technology", }, { "symbol": "CRAY", "companyName": "Cray Inc", "exchange": "Nasdaq Global Select", "industry": "Computer Hardware", "website": "http://www.cray.com", "description": "Cray Inc designs, develops, and supports high-performance computer systems, commonly known as supercomputers and/or clusters, and provide storage solutions, software and engineering services related to HPC systems.", "CEO": "Peter J. Ungaro", "issueType": "cs", "sector": "Technology" }, { "symbol": "ATVI", "companyName": "Activision Blizzard Inc", "exchange": "Nasdaq Global Select", "industry": "Application Software", "website": "http://www.activisionblizzard.com", "description": "Activision Blizzard is a developer and publisher of interactive entertainment content and services. It develops and distributes content and services on video game consoles, personal computers, and mobile devices.", "CEO": "Robert A. Kotick", "issueType": "cs", "sector": "Technology" }, { "symbol": "GOOG", "companyName": "Alphabet Inc.", "exchange": "Nasdaq Global Select", "industry": "Online Media", "website": "https://www.abc.xyz", "description": "Alphabet Inc is a provider of internet content products and portals. Its suite of brands includes Search, Android, YouTube, Apps, Maps & Ads.", "CEO": "Larry Page", "issueType": "cs", "sector": "Technology" }, { "symbol": "TWTR", "companyName": "Twitter Inc.", "exchange": "New York Stock Exchange", "industry": "Online Media", "website": "https://www.twitter.com", "description": "Twitter Inc is a social networking platform for public self-expression and conversation in real time. Its services are live, which includes live commentary, live connections, and live conversations. It generates a majority of its revenue from advertising.", "CEO": "Jack Dorsey", "issueType": "cs", "sector": "Technology" }, { "symbol": "CARB", "companyName": "Carbonite Inc.", "exchange": "NASDAQ Global Market", "industry": "Application Software", "website": "http://www.carbonite.com", "description": "Carbonite Inc provides data protection solutions including cloud, hybrid, and on-premise backup and restores, disaster recovery as a service and email archiving. It offers annual and multi-year cloud backup plans for multi-year subscriptions.", "CEO": "Mohamad Ali", "issueType": "cs", "sector": "Technology" }, { "symbol": "WDC", "companyName": "Western Digital Corporation", "exchange": "Nasdaq Global Select", "industry": "Computer Hardware", "website": "https://www.wdc.com", "description": "Western Digital Corp is the global leader in the hard disk drive market. It develops, manufactures, and provides data storage solutions that enable consumers to create, manage, experience and preserve digital content. Its products include HDDs and SSDs.", "CEO": "Stephen D. Milligan", "issueType": "cs", "sector": "Technology" }, { "symbol": "INTC", "companyName": "Intel Corporation", "exchange": "Nasdaq Global Select", "industry": "Semiconductors", "website": "http://www.intel.com", "description": "Intel Corp is the world's largest chipmaker. It engaged in making a semiconductor chip. It designs and manufactures integrated digital technology products like integrated circuits, for industries such as computing and communications.", "CEO": "Brian M. Krzanich", "issueType": "cs", "sector": "Technology" }, { "symbol": "CSCO", "companyName": "Cisco Systems Inc.", "exchange": "Nasdaq Global Select", "industry": "Communication Equipment", "website": "http://www.cisco.com", "description": "Cisco Systems Inc is a supplier of data networking equipment and software. Its products include routers, switches, access equipment, and security and network management software which allow data communication among dispersed computer networks.", "CEO": "Charles Robbins", "issueType": "cs", "sector": "Technology" } ]
""" Identities: module definition """ PROPERTIES = { 'title': 'Contacts', 'details': 'Manage users, groups, companies and corresponding contacts', 'url': '/contacts/', 'system': True, 'type': 'minor', } URL_PATTERNS = [ '^/contacts/', ]
"""Without the letter 'E', CodeWars Kata, level 7.""" def with_without_e(s): """Return number of Es in string. input = string output = count in string form of Es """ if not s: return s count = 0 for e in s: if e == 'e' or e == 'E': count += 1 if count == 0: return 'There is no "e".' else: st_count = str(count) return st_count
class Solution: # O(n) time | O(1) space - where n is the length of the input list. def maxProfit(self, prices: List[int]) -> int: minPrice = prices[0] maxProfit = 0 for i in range(1, len(prices)): if prices[i] < minPrice: minPrice = prices[i] elif prices[i] - minPrice > maxProfit: maxProfit = prices[i] - minPrice return maxProfit
class Article: def __init__(self,title,urlToImage,description,url,author): self.title=title self.urlToImage=urlToImage self.description=description self.author=author self.url=url class Source: def __init__(self,name,description): self.name=name self.description=description
def findDecision(obj): #obj[0]: Passanger, obj[1]: Time, obj[2]: Coupon, obj[3]: Coupon_validity, obj[4]: Gender, obj[5]: Age, obj[6]: Children, obj[7]: Education, obj[8]: Occupation, obj[9]: Income, obj[10]: Bar, obj[11]: Coffeehouse, obj[12]: Restaurant20to50, obj[13]: Direction_same, obj[14]: Distance # {"feature": "Children", "instances": 34, "metric_value": 0.9082, "depth": 1} if obj[6]>0: # {"feature": "Bar", "instances": 17, "metric_value": 0.9774, "depth": 2} if obj[10]<=1.0: # {"feature": "Time", "instances": 12, "metric_value": 0.9799, "depth": 3} if obj[1]>0: # {"feature": "Restaurant20to50", "instances": 8, "metric_value": 0.9544, "depth": 4} if obj[12]<=1.0: return 'False' elif obj[12]>1.0: return 'True' else: return 'True' elif obj[1]<=0: return 'True' else: return 'True' elif obj[10]>1.0: return 'False' else: return 'False' elif obj[6]<=0: # {"feature": "Age", "instances": 17, "metric_value": 0.3228, "depth": 2} if obj[5]>0: return 'True' elif obj[5]<=0: # {"feature": "Passanger", "instances": 3, "metric_value": 0.9183, "depth": 3} if obj[0]<=1: return 'True' elif obj[0]>1: return 'False' else: return 'False' else: return 'True' else: return 'True'
""" ThreatStack Python Client Exceptions """ class Error(Exception): pass class ThreatStackClientError(Exception): pass class ThreatStackAPIError(Error): pass class APIRateLimitError(Error): """ Used to trigger retry on rate limit """ pass
class Solution: def XXX(self, nums: List[int]) -> bool: nextdis = 0 curdis = 0 for i in range(len(nums)): nextdis = max(i+nums[i], nextdis) if i==curdis: curdis = nextdis if nextdis >= len(nums)-1: return True return False
"""This module is for learning This module has basic functions to work with numbers """ def is_even(number: int) -> bool: """ This method will find if the number passed is even or not :param number : a number :return: True if even False otherwise """ if number <= 0: return False return number % 2 == 0 print(__name__) if __name__ == '__main__': # if someone is executing the code directly by calling python app.py then this block will be executed print(is_even(5)) print(is_even(10))
# -*- coding: utf-8 -*- ''' File name: code\criss_cross\sol_166.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x ''' # Solution to Project Euler Problem #166 :: Criss Cross # # For more information see: # https://projecteuler.net/problem=166 # Problem Statement ''' A 4x4 grid is filled with digits d, 0 ≤ d ≤ 9. It can be seen that in the grid 6 3 3 0 5 0 4 3 0 7 1 4 1 2 4 5 the sum of each row and each column has the value 12. Moreover the sum of each diagonal is also 12. In how many ways can you fill a 4x4 grid with the digits d, 0 ≤ d ≤ 9 so that each row, each column, and both diagonals have the same sum? ''' # Solution # Solution Approach ''' '''
class FieldError(Exception): """ Base class for errors to do with setting fields on PointClouds and their subclasses. """ pass class PointFieldError(FieldError): """ Raised when setting point fields on PointClouds. """ pass
name = 'pyjoystick' version = '1.2.4' description = 'Tools to get Joystick events.' url = 'https://github.com/justengel/pyjoystick' author = 'Justin Engel' author_email = 'jengel@sealandaire.com'
# -*- coding: utf-8 -*- list_samples = ['元素1', '元素2', '元素3', '元素4'] print(list_samples) # 获取列表指定元素 print(list_samples[0].title()) print(list_samples[-1].title()) # 修改元素 list_samples[0] = '修改后的元素1' print(list_samples) # 末尾添加元素 list_samples.append("末尾添加元素") print(list_samples) # 插入元素 list_samples.insert(0, "新插入元素") print(list_samples) # 删除元素 del list_samples[0] print(list_samples) # pop删除 last_item = list_samples.pop() print(list_samples) print(last_item) pop_item = list_samples.pop(0) print(list_samples) print(last_item) # remove list_samples.remove('元素2') print(list_samples) # 排序 list_samples.sort(reverse=True) print(list_samples) list_samples.sort(reverse=False) print(list_samples) print(sorted(list_samples, reverse=True)) print(list_samples) # 反向排序 list_samples.reverse() print(list_samples)
pi = "141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128" pi += "4811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066" pi += "0631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735" pi += "1885752724 891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342" pi += "7577896091 736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328" pi += "1609631859502445945534690830264252230825334468503526193118817101000313783875288658753320838142061717766914730359825349042875546873115956286388235378759375195778" pi += "18577805321712268066130019278766111959092164201989" a = int(input()) print(pi[a-1])
#Before running this code we should run 2 commands in command prompt they are :- #1) pip install Image #2) pip install qrcodeimport qrcode code=qrcode.QRCode(version=5,box_size=15,border=5) link=input("copy the content:") code.add_data(link) code.make(fit=True) img=code.make_image(fill="black",back_color="white") img.save(input("Enter the Qrcode name:")+".png")
def find_outlier(integers): even, odd = [], [] for i in sorted(integers): if i % 2 != 0: odd.append(i) else: even.append(i) if len(even) > 1 and len(odd) != 0: return odd[0] elif len(odd) > 1 and len(even) != 0: return even[0]
class BaseSnappyError(Exception): """ Base error class for snappy module. """ class CorruptError(BaseSnappyError): """ Corrupt input. """ class TooLargeError(BaseSnappyError): """ Decoded block is too large. """
#leia o primeiro termo e a razão de uma Progressão aritimética.No final, mostre os 10 primeiros termos dessa progressão. print('-='*10) print('{:=^20}'.format('Desafio 51')) print('-='*10) n1=int(input('Qual o primeiro termo? ')) r=int(input('Qual a razão da progressão? ')) for n1 in range (n1,(n1+(10-1))*r+1,r): print(n1,end='->') print(' Fim')
#Thea M Factorial of a positive no def func_factorial(n): # factorial is n * by all the '+' no less than it #n= 7 #if n == 1: # if n is 1 return 1 #return n #else: #return n * (n-1) # # Python program to find the factorial of a number provided by the user. # change the value for a different result #n= 7 # uncomment to take input from the user #num = int(input("Enter a number: ")) factorial = 1 # check if the number is negative, positive or zero if n < 0: print("not doing factorial for zero") elif n == 0: print("The factorial of 0 is 1") else: for i in range(1,n + 1): factorial = factorial*i print("The factorial of",n,"is",factorial) func_factorial (7)
class Solution(object): def reverseString(self, s): """ :type s: str :rtype: str """ rs = [] for i in range(len(s) - 1, -1, -1): rs.append(s[i]) return "".join(rs)
# MongoDB数据库 host = "localhost" port = 27017 db = 'cqbot' # 忽略名单 ignore_list = [2177486721, 80000000] # 自动生草最小间隔,单位:秒 grass_delay = 15
#Now that we looked at aleatoric and epistemic uncertainty in isolation, we can use TFP layers’ composable API to create a model that reports both types of uncertainty: # Build model. model = tf.keras.Sequential([ tfp.layers.DenseVariational(1 + 1, posterior_mean_field, prior_trainable), tfp.layers.DistributionLambda( lambda t: tfd.Normal(loc=t[..., :1], scale=1e-3 + tf.math.softplus(0.01 * t[..., 1:]))), ]) # Do inference. model.compile(optimizer=tf.optimizers.Adam(learning_rate=0.05), loss=negloglik) model.fit(x, y, epochs=500, verbose=False); # Make predictions. yhats = [model(x_tst) for _ in range(100)] #The only change we’ve made to the previous model is that we added an extra output to DenseVariational layer to also model the scale of the label distribution. As in our previous solution, we get an ensemble of models, but this time they all also report the variability of y as a function of x. Let us plot this ensemble: #Note the qualitative difference between the predictions of this model compared to those from the model that considered only aleatoric uncertainty: this model predicts more variability as x gets more negative in addition to getting more positive — something that is not possible to do with a simple linear model of aleatoric uncertainty.
""" TODO : does not work!!! """ string_to_decode = "Ива Попова" output_file = "decoded_cp1251.txt" with open(output_file, "w") as fh: # fh.writelines(string_to_decode+"\n") bytes_decoded = string_to_decode.encode() print(bytes_decoded) decoded_string = bytes_decoded.decode(encoding="cp1251") # fh.write(decoded_string)
class Solution(object): def numDistinct(self, s, t): """ :type s: str :type t: str :rtype: int """ row, col = len(s), len(t) if col > row: return 0 dp = [[0 for _ in range(col+1)] for _ in range(row+1)] for r in range(row+1): for c in range(col+1): if r == 0 and c == 0: dp[r][c] = 1 elif r == 0: dp[r][c] = 0 elif c == 0: dp[r][c] = 1 else: dp[r][c] = dp[r-1][c] if s[r-1] == t[c-1]: dp[r][c] += dp[r-1][c-1] return dp[row][col] # Time: O(N^2) # Space: O(N^2)
def build_ast_dictionary(code, prefix=tuple(), d=None): if d is None: d = dict() if prefix == tuple(): d['total'] = code else: d[prefix] = code tag, subcode = code if isinstance(subcode, list): for i, subitem in enumerate(subcode): build_ast_dictionary(subitem, prefix=prefix + (i,), d=d) return d
_base_ = [ '../_base_/models/upernet_swin.py', '../_base_/datasets/Vaihingen.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_80k.py' ] model = dict( pretrained='pretrain/swin_tiny_patch4_window7_224.pth', backbone=dict( embed_dims=96, depths=[2, 2, 6, 2], num_heads=[3, 6, 12, 24], window_size=7, use_abs_pos_embed=False, drop_path_rate=0.3, patch_norm=True), decode_head=dict(in_channels=[96, 192, 384, 768], num_classes=6), auxiliary_head=dict(in_channels=384, num_classes=6), test_cfg=dict(mode='slide',crop_size=(256,256),stride=(171,171))) optimizer = dict( _delete_=True, type='AdamW', lr=0.00006, betas=(0.9, 0.999), weight_decay=0.01, paramwise_cfg=dict( custom_keys={ 'absolute_pos_embed': dict(decay_mult=0.), 'relative_position_bias_table': dict(decay_mult=0.), 'norm': dict(decay_mult=0.) })) lr_config = dict( _delete_=True, policy='poly', warmup='linear', warmup_iters=1500, warmup_ratio=1e-6, power=1.0, min_lr=0.0, by_epoch=False) data = dict(samples_per_gpu=2, workers_per_gpu=2) evaluation = dict(metric=['mIoU', 'mFscore'], save_best='mIoU')