content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
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
class Solution: def two_city_sched_cost(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
""" 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))
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
class Solution(object): def delete_node(self, root, key): if not root: return root if root.val > key: root.left = self.deleteNode(root.left, key) elif root.val < key: root.right = self.deleteNode(root.right, key) else: if not root.right: return root.left if not root.left: return root.right temp = root.right mini = temp.val while temp.left: temp = temp.left mini = temp.val root.val = mini root.right = self.deleteNode(root.right, root.val) 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)
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)
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)
""" 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) code = 'code' doc = 'doc' good = 'good' name = 'name' summary = 'summary' values = 'values' abbrev = 'abbrev' 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) throws = ('throw',) snippet_groups = (({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'}, {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'}}, {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'}, {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'}, {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 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)) __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] assert group_0_name not in SNIPPET_NAMES, group_0_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
class Listnode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def remove_elements(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 remove_elements(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 remove_elements(self, head: ListNode, val: int) -> ListNode: sentinel = list_node(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 remove_elements(self, head: ListNode, val: int) -> ListNode: sentinel = list_node(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
## ## # 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
class Deletefilesrequest(object): def __init__(self): self.datesToDelete = None def get_dates_to_delete(self): return self.datesToDelete def set_dates_to_delete(self, datesToDelete): self.datesToDelete = datesToDelete def get_filename(self): return self.filename def set_filename(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!")
""" 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): return items[1:] + items[:1] if __name__ == '__main__': print('Example:') print(list(replace_first([1, 2, 3, 4]))) 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!")
#!/usr/bin/python # coding=utf-8 """Scripts related to datasets dowloading and preprocessing."""
"""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 }
""" 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
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 = '' count = len(queue) for _ in range(count): part = part + queue.pop() if part != '': parts.append(part) return parts
# 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())
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")
""" 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)
class Timsort: def __init__(self, array, run_size=32): self.array = array self.run_size = run_size def insertion_sort(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 while array[upper_pointer] > temp and upper_pointer >= left_index: array[upper_pointer + 1] = array[upper_pointer] upper_pointer -= 1 array[upper_pointer + 1] = temp return array def merge(self, arr, l, m, r): (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) 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 while i < len1: arr[k] = left[i] k += 1 i += 1 while j < len2: arr[k] = right[j] k += 1 j += 1 def sort(self): arr = self.array n = len(arr) for i in range(0, n, self.run_size): self.insertionSort(arr, i, min(i + 31, n - 1)) size = self.run_size while size < n: for left in range(0, n, 2 * size): mid = left + size - 1 right = min(left + 2 * size - 1, n - 1) self.merge(arr, left, mid, right) size = 2 * size if __name__ == '__main__': array = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] tim_sort = tim_sort(array) arr = timSort.sort() print(arr)
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]
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" ]
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)
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))
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')
apply_patch('20210630-dldt-disable-unused-targets.patch') apply_patch('20210630-dldt-pdb.patch') apply_patch('20210630-dldt-disable-multidevice-autoplugin.patch') apply_patch('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")
try: age = int(input('How old are you: ')) if age < 0: print('You are a time traveller') elif 0 < age <= 17: print('Too young to vote') elif 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)
data = [104, 101, 4, 105, 308, 103, 5, 107, 100, 306, 106, 102, 108] min_valid = 100 max_valid = 200 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)}')
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()
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', ]
""" (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 = ['$finish', '$stop', '$exit', '$realtime', '$stime', '$time', '$printtimescale', '$timeformat', '$bitstoreal', '$realtobits', '$bitstoshortreal', '$shortrealtobits', '$itor', '$rtoi', '$signed', '$unsigned', '$cast', '$bits', '$isunbounded', '$typename', '$unpacked_dimensions', '$dimensions', '$left', '$right', '$low', '$high', '$increment$size', '$clog2', '$asin', '$ln', '$acos', '$log10', '$atan', '$exp', '$atan2', '$sqrt', '$hypot', '$pow', '$sinh', '$floor', '$cosh', '$ceil', '$tanh', '$sin', '$asinh', '$cos', '$acosh', '$tan', '$atanh', '$countbits', '$countones', '$onehot', '$onehot0', '$isunknown', '$fatal', '$error', '$warning', '$info', '$asserton', '$assertoff', '$assertkill', '$assertcontrol', '$assertpasson', '$assertpassoff', '$assertfailon', '$assertfailoff', '$assertnonvacuouson', '$assertvacuousoff', '$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', '$coverage_get_max', '$coverage_get', '$coverage_merge', '$coverage_save', '$get_coverage', '$set_coverage_db_name', '$load_coverage_db', '$random', '$dist_chi_square', '$dist_erlang', '$dist_exponential', '$dist_normal', '$dist_poisson', '$dist_t', '$dist_uniform', '$q_initialize', '$q_add', '$q_remove', '$q_full', '$q_exam', '$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', '$system', '$display', '$write', '$displayb', '$writeb', '$displayh', '$writeh ', '$displayo', '$writeo', '$strobe', '$monitor ', '$strobeb', '$monitorb', '$strobeh', '$monitorh', '$strobeo', '$monitoro', '$monitoroff', '$monitoron', '$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', '$readmemb', '$readmemh', '$writememb', '$writememh', '$test', '$value', '$plusargs', '$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')
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=''
api_key = '' org_id = '' s3_bucket_name = '' s3_access_key = '' s3_secret_key = '' my_id = '' player_license = ''
__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"
__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'
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
class Solution: def next_greater_elements(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)
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) 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] 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] 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}')
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)
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
class Solution(object): def k_smallest_pairs(self, nums1, nums2, k): """ :type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]] """ 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', )
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
""" 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 max_coins(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)
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 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' 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', {}) raise API_RETURN_CODES[code](message=message, details=details, data=data, response=resp)
def show_state(state, player): return { 'hands': state['hands'], 'turn': state['turn'], }
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 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
class Solution: def is_valid(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
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
def generate(args): args = args.split(',') start = int(args[0]) num_groups = int(args[1]) per_group = 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'
_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)], 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, 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'
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()
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, }
"""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()
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()
# # 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)
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, constraints_intersection, value_range_constraint, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ConstraintsUnion', 'ConstraintsIntersection', 'ValueRangeConstraint', 'ValueSizeConstraint') (h3c_common,) = mibBuilder.importSymbols('HUAWEI-3COM-OID-MIB', 'h3cCommon') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (mib_identifier, time_ticks, iso, gauge32, object_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, unsigned32, counter64, module_identity, bits, notification_type, ip_address, integer32, counter32) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibIdentifier', 'TimeTicks', 'iso', 'Gauge32', 'ObjectIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Unsigned32', 'Counter64', 'ModuleIdentity', 'Bits', 'NotificationType', 'IpAddress', 'Integer32', 'Counter32') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') h3c_blg = module_identity((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' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2)) named_values = named_values(('cleared', 1), ('nouse', 2)) h3c_blg_objects = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 108, 1)) h3c_blg_stats_table = mib_table((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.') h3c_blg_stats_entry = mib_table_row((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.') h3c_blg_index = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 108, 1, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))) if mibBuilder.loadTexts: h3cBlgIndex.setStatus('current') if mibBuilder.loadTexts: h3cBlgIndex.setDescription('The index of the balance group.') h3c_blg_group_tx_packet_count = mib_table_column((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.') h3c_blg_group_rx_packet_count = mib_table_column((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.') h3c_blg_group_tx_byte_count = mib_table_column((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.') h3c_blg_group_rx_byte_count = mib_table_column((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.') h3c_blg_group_count_clear = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 108, 1, 1, 1, 6), counter_clear()).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)
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 '''
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}') '\nHeap : [45, 10, 3, 5, 9, 2, 0]\n[0, 2, 3, 5, 9, 10, 45]\nNumber of comparisons = 22\n' sorted_array = [5, 6, 7, 8, 9] heap_sort(sorted_array) print(sorted_array) print(f'Number of comparisons = {count}') '\nHeap : [9, 8, 7, 5, 6]\n[5, 6, 7, 8, 9]\nNumber of comparisons = 12\n' 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}') '\nHeap : [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]\n[-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\nNumber of comparisons = 105\n'
class A: def __init__(self, *, a): pass class B(A): def __init__(self, a): super().__init__(a=a)
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
class Ball: def __init__(self): self.position = p_vector(width * 0.5, height * 0.5) self.w = 20 self.velocity = p_vector(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)
#!/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
""" 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': 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 = [] row = len(matrix) - 1 column = len(matrix[0]) - 1 while row != 0 or column != 0: 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 options = [diagonal, top, left] cheapest = options.index(min(options)) 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) d = [[None for _ in range(m + 1)] for _ in range(n + 1)] d[0][0] = 0 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 for i in range(1, n + 1): for j in range(1, m + 1): d[i][j] = min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + (1 if source[i - 1] != target[j - 1] else 0)) 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)] 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': t = '*' elif code == 'I': s = '*' elif code == 'E': code = ' ' width = max((len(x) for x in (s, t, code))) for (line, token) in zip(alignment, [s, '|', t, code]): line.append(token.center(width)) if code != 'D': j += 1 if code != 'I': i += 1 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" ]
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)
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ValueRangeConstraint', 'ConstraintsIntersection', 'ValueSizeConstraint', 'SingleValueConstraint') (msc_atm_if_vpc, msc_atm_if_vcc_index, msc_atm_if_vcc, msc_atm_if_index, msc_atm_if_vpc_index, msc_atm_if_vpt_index, msc_atm_if_vpt_vcc_index, msc_atm_if_vpt_vcc) = mibBuilder.importSymbols('Nortel-MsCarrier-MscPassport-AtmCoreMIB', 'mscAtmIfVpc', 'mscAtmIfVccIndex', 'mscAtmIfVcc', 'mscAtmIfIndex', 'mscAtmIfVpcIndex', 'mscAtmIfVptIndex', 'mscAtmIfVptVccIndex', 'mscAtmIfVptVcc') (storage_type, row_status, display_string) = mibBuilder.importSymbols('Nortel-MsCarrier-MscPassport-StandardTextualConventionsMIB', 'StorageType', 'RowStatus', 'DisplayString') (non_replicated, link) = mibBuilder.importSymbols('Nortel-MsCarrier-MscPassport-TextualConventionsMIB', 'NonReplicated', 'Link') (msc_passport_mi_bs,) = mibBuilder.importSymbols('Nortel-MsCarrier-MscPassport-UsefulDefinitionsMIB', 'mscPassportMIBs') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (integer32, counter32, counter64, gauge32, mib_identifier, notification_type, object_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, module_identity, unsigned32, time_ticks, bits, iso, ip_address) = mibBuilder.importSymbols('SNMPv2-SMI', 'Integer32', 'Counter32', 'Counter64', 'Gauge32', 'MibIdentifier', 'NotificationType', 'ObjectIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ModuleIdentity', 'Unsigned32', 'TimeTicks', 'Bits', 'iso', 'IpAddress') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') atm_bearer_service_mib = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 64)) msc_atm_if_vpc_nrp = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4)) msc_atm_if_vpc_nrp_row_status_table = mib_table((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.') msc_atm_if_vpc_nrp_row_status_entry = mib_table_row((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.') msc_atm_if_vpc_nrp_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 1, 1, 1), row_status()).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.') msc_atm_if_vpc_nrp_component_name = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 1, 1, 2), display_string()).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") msc_atm_if_vpc_nrp_storage_type = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 1, 1, 4), storage_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: mscAtmIfVpcNrpStorageType.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcNrpStorageType.setDescription('This variable represents the storage type value for the mscAtmIfVpcNrp tables.') msc_atm_if_vpc_nrp_index = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 1, 1, 10), non_replicated()) if mibBuilder.loadTexts: mscAtmIfVpcNrpIndex.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcNrpIndex.setDescription('This variable represents the index for the mscAtmIfVpcNrp tables.') msc_atm_if_vpc_nrp_prov_table = mib_table((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.') msc_atm_if_vpc_nrp_prov_entry = mib_table_row((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.') msc_atm_if_vpc_nrp_next_hop = mib_table_column((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.') msc_atm_if_vpc_nrp_connection_point_type = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 100, 1, 20), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 4))).clone(namedValues=named_values(('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.") msc_atm_if_vpc_nrp_oam_segment_boundary = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 100, 1, 30), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('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.") msc_atm_if_vpc_nrp_tx_aal5_partial_packet_discard = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 100, 1, 31), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('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.") msc_atm_if_vpc_nrp_rx_aal5_partial_packet_discard = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 100, 1, 32), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('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.") msc_atm_if_vpc_nrp_bandwidth_elastic = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 100, 1, 33), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('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.') msc_atm_if_vpc_nrp_override_holding_priority = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 4, 100, 1, 34), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 6))).clone(namedValues=named_values(('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.') msc_atm_if_vpc_mnrp = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12)) msc_atm_if_vpc_mnrp_row_status_table = mib_table((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.') msc_atm_if_vpc_mnrp_row_status_entry = mib_table_row((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.') msc_atm_if_vpc_mnrp_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12, 1, 1, 1), row_status()).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.') msc_atm_if_vpc_mnrp_component_name = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12, 1, 1, 2), display_string()).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") msc_atm_if_vpc_mnrp_storage_type = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12, 1, 1, 4), storage_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: mscAtmIfVpcMnrpStorageType.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcMnrpStorageType.setDescription('This variable represents the storage type value for the mscAtmIfVpcMnrp tables.') msc_atm_if_vpc_mnrp_index = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12, 1, 1, 10), non_replicated()) if mibBuilder.loadTexts: mscAtmIfVpcMnrpIndex.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVpcMnrpIndex.setDescription('This variable represents the index for the mscAtmIfVpcMnrp tables.') msc_atm_if_vpc_mnrp_prov_table = mib_table((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.') msc_atm_if_vpc_mnrp_prov_entry = mib_table_row((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.') msc_atm_if_vpc_mnrp_oam_segment_boundary = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12, 101, 1, 30), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('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.") msc_atm_if_vpc_mnrp_bandwidth_elastic = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12, 101, 1, 33), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('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.') msc_atm_if_vpc_mnrp_override_holding_priority = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12, 101, 1, 34), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 6))).clone(namedValues=named_values(('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.') msc_atm_if_vpc_mnrp_next_hops_table = mib_table((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.') msc_atm_if_vpc_mnrp_next_hops_entry = mib_table_row((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.') msc_atm_if_vpc_mnrp_next_hops_value = mib_table_column((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.') msc_atm_if_vpc_mnrp_next_hops_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 4, 12, 658, 1, 2), row_status()).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.') msc_atm_if_vcc_nrp = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4)) msc_atm_if_vcc_nrp_row_status_table = mib_table((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.') msc_atm_if_vcc_nrp_row_status_entry = mib_table_row((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.') msc_atm_if_vcc_nrp_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 1, 1, 1), row_status()).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.') msc_atm_if_vcc_nrp_component_name = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 1, 1, 2), display_string()).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") msc_atm_if_vcc_nrp_storage_type = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 1, 1, 4), storage_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: mscAtmIfVccNrpStorageType.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccNrpStorageType.setDescription('This variable represents the storage type value for the mscAtmIfVccNrp tables.') msc_atm_if_vcc_nrp_index = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 1, 1, 10), non_replicated()) if mibBuilder.loadTexts: mscAtmIfVccNrpIndex.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccNrpIndex.setDescription('This variable represents the index for the mscAtmIfVccNrp tables.') msc_atm_if_vcc_nrp_prov_table = mib_table((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.') msc_atm_if_vcc_nrp_prov_entry = mib_table_row((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.') msc_atm_if_vcc_nrp_next_hop = mib_table_column((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.') msc_atm_if_vcc_nrp_connection_point_type = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 100, 1, 20), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 4))).clone(namedValues=named_values(('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.") msc_atm_if_vcc_nrp_oam_segment_boundary = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 100, 1, 30), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('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.") msc_atm_if_vcc_nrp_tx_aal5_partial_packet_discard = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 100, 1, 31), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('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.") msc_atm_if_vcc_nrp_rx_aal5_partial_packet_discard = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 100, 1, 32), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('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.") msc_atm_if_vcc_nrp_bandwidth_elastic = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 100, 1, 33), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('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.') msc_atm_if_vcc_nrp_override_holding_priority = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 4, 100, 1, 34), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 6))).clone(namedValues=named_values(('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.') msc_atm_if_vcc_mnrp = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13)) msc_atm_if_vcc_mnrp_row_status_table = mib_table((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.') msc_atm_if_vcc_mnrp_row_status_entry = mib_table_row((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.') msc_atm_if_vcc_mnrp_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13, 1, 1, 1), row_status()).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.') msc_atm_if_vcc_mnrp_component_name = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13, 1, 1, 2), display_string()).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") msc_atm_if_vcc_mnrp_storage_type = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13, 1, 1, 4), storage_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: mscAtmIfVccMnrpStorageType.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccMnrpStorageType.setDescription('This variable represents the storage type value for the mscAtmIfVccMnrp tables.') msc_atm_if_vcc_mnrp_index = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13, 1, 1, 10), non_replicated()) if mibBuilder.loadTexts: mscAtmIfVccMnrpIndex.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVccMnrpIndex.setDescription('This variable represents the index for the mscAtmIfVccMnrp tables.') msc_atm_if_vcc_mnrp_prov_table = mib_table((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.') msc_atm_if_vcc_mnrp_prov_entry = mib_table_row((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.') msc_atm_if_vcc_mnrp_oam_segment_boundary = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13, 101, 1, 30), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('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.") msc_atm_if_vcc_mnrp_bandwidth_elastic = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13, 101, 1, 33), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('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.') msc_atm_if_vcc_mnrp_override_holding_priority = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13, 101, 1, 34), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 6))).clone(namedValues=named_values(('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.') msc_atm_if_vcc_mnrp_next_hops_table = mib_table((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.') msc_atm_if_vcc_mnrp_next_hops_entry = mib_table_row((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.') msc_atm_if_vcc_mnrp_next_hops_value = mib_table_column((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.') msc_atm_if_vcc_mnrp_next_hops_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 5, 13, 658, 1, 2), row_status()).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.') msc_atm_if_vpt_vcc_nrp = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4)) msc_atm_if_vpt_vcc_nrp_row_status_table = mib_table((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.') msc_atm_if_vpt_vcc_nrp_row_status_entry = mib_table_row((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.') msc_atm_if_vpt_vcc_nrp_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 1, 1, 1), row_status()).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.') msc_atm_if_vpt_vcc_nrp_component_name = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 1, 1, 2), display_string()).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") msc_atm_if_vpt_vcc_nrp_storage_type = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 1, 1, 4), storage_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: mscAtmIfVptVccNrpStorageType.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccNrpStorageType.setDescription('This variable represents the storage type value for the mscAtmIfVptVccNrp tables.') msc_atm_if_vpt_vcc_nrp_index = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 1, 1, 10), non_replicated()) if mibBuilder.loadTexts: mscAtmIfVptVccNrpIndex.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccNrpIndex.setDescription('This variable represents the index for the mscAtmIfVptVccNrp tables.') msc_atm_if_vpt_vcc_nrp_prov_table = mib_table((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.') msc_atm_if_vpt_vcc_nrp_prov_entry = mib_table_row((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.') msc_atm_if_vpt_vcc_nrp_next_hop = mib_table_column((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.') msc_atm_if_vpt_vcc_nrp_connection_point_type = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 100, 1, 20), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 4))).clone(namedValues=named_values(('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.") msc_atm_if_vpt_vcc_nrp_oam_segment_boundary = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 100, 1, 30), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('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.") msc_atm_if_vpt_vcc_nrp_tx_aal5_partial_packet_discard = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 100, 1, 31), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('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.") msc_atm_if_vpt_vcc_nrp_rx_aal5_partial_packet_discard = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 100, 1, 32), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('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.") msc_atm_if_vpt_vcc_nrp_bandwidth_elastic = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 100, 1, 33), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('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.') msc_atm_if_vpt_vcc_nrp_override_holding_priority = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 4, 100, 1, 34), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 6))).clone(namedValues=named_values(('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.') msc_atm_if_vpt_vcc_mnrp = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13)) msc_atm_if_vpt_vcc_mnrp_row_status_table = mib_table((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.') msc_atm_if_vpt_vcc_mnrp_row_status_entry = mib_table_row((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.') msc_atm_if_vpt_vcc_mnrp_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13, 1, 1, 1), row_status()).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.') msc_atm_if_vpt_vcc_mnrp_component_name = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13, 1, 1, 2), display_string()).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") msc_atm_if_vpt_vcc_mnrp_storage_type = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13, 1, 1, 4), storage_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: mscAtmIfVptVccMnrpStorageType.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccMnrpStorageType.setDescription('This variable represents the storage type value for the mscAtmIfVptVccMnrp tables.') msc_atm_if_vpt_vcc_mnrp_index = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13, 1, 1, 10), non_replicated()) if mibBuilder.loadTexts: mscAtmIfVptVccMnrpIndex.setStatus('mandatory') if mibBuilder.loadTexts: mscAtmIfVptVccMnrpIndex.setDescription('This variable represents the index for the mscAtmIfVptVccMnrp tables.') msc_atm_if_vpt_vcc_mnrp_prov_table = mib_table((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.') msc_atm_if_vpt_vcc_mnrp_prov_entry = mib_table_row((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.') msc_atm_if_vpt_vcc_mnrp_oam_segment_boundary = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13, 101, 1, 30), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('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.") msc_atm_if_vpt_vcc_mnrp_bandwidth_elastic = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13, 101, 1, 33), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('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.') msc_atm_if_vpt_vcc_mnrp_override_holding_priority = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13, 101, 1, 34), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 6))).clone(namedValues=named_values(('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.') msc_atm_if_vpt_vcc_mnrp_next_hops_table = mib_table((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.') msc_atm_if_vpt_vcc_mnrp_next_hops_entry = mib_table_row((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.') msc_atm_if_vpt_vcc_mnrp_next_hops_value = mib_table_column((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.') msc_atm_if_vpt_vcc_mnrp_next_hops_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 114, 9, 20, 13, 658, 1, 2), row_status()).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.') atm_bearer_service_group = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 64, 1)) atm_bearer_service_group_ca = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 64, 1, 1)) atm_bearer_service_group_ca02 = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 64, 1, 1, 3)) atm_bearer_service_group_ca02_a = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 64, 1, 1, 3, 2)) atm_bearer_service_capabilities = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 64, 3)) atm_bearer_service_capabilities_ca = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 64, 3, 1)) atm_bearer_service_capabilities_ca02 = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 64, 3, 1, 3)) atm_bearer_service_capabilities_ca02_a = mib_identifier((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)
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)
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]
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
class Solution: def is_valid_bst(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))
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" } ]
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/', ]
""" 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
"""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 Solution: def max_profit(self, prices: List[int]) -> int: min_price = prices[0] max_profit = 0 for i in range(1, len(prices)): if prices[i] < minPrice: min_price = prices[i] elif prices[i] - minPrice > maxProfit: max_profit = 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
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'
def find_decision(obj): if obj[6] > 0: if obj[10] <= 1.0: if obj[1] > 0: 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: if obj[5] > 0: return 'True' elif obj[5] <= 0: 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
""" 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
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))
"""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__': print(is_even(5)) print(is_even(10))
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
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'
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'
pi = "141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128" pi += "4811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066" pi += "0631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735" pi += "1885752724 891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342" pi += "7577896091 736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328" pi += "1609631859502445945534690830264252230825334468503526193118817101000313783875288658753320838142061717766914730359825349042875546873115956286388235378759375195778" pi += "18577805321712268066130019278766111959092164201989" a = int(input()) print(pi[a-1])
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")
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]
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. """
class Basesnappyerror(Exception): """ Base error class for snappy module. """ class Corrupterror(BaseSnappyError): """ Corrupt input. """ class Toolargeerror(BaseSnappyError): """ Decoded block is too large. """
#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)
def func_factorial(n): factorial = 1 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)
class Solution(object): def reverse_string(self, s): """ :type s: str :rtype: str """ rs = [] for i in range(len(s) - 1, -1, -1): rs.append(s[i]) return ''.join(rs)
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)
class Solution(object): def num_distinct(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]
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
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')
_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=6e-05, betas=(0.9, 0.999), weight_decay=0.01, paramwise_cfg=dict(custom_keys={'absolute_pos_embed': dict(decay_mult=0.0), 'relative_position_bias_table': dict(decay_mult=0.0), 'norm': dict(decay_mult=0.0)})) lr_config = dict(_delete_=True, policy='poly', warmup='linear', warmup_iters=1500, warmup_ratio=1e-06, 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')
num = 1 for i in range(5): for j in range(i+1): print(num, end=" ") num+=1 print()
num = 1 for i in range(5): for j in range(i + 1): print(num, end=' ') num += 1 print()
""" Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input. Example 1: Input: intervals = [[1,3],[2,6],[8,10],[15,18]] Output: [[1,6],[8,10],[15,18]] Explanation: Since intervals [1,3] and [2,6] overlaps, merge them into [1,6]. Example 2: Input: intervals = [[1,4],[4,5]] Output: [[1,5]] Explanation: Intervals [1,4] and [4,5] are considered overlapping. Constraints: 1 <= intervals.length <= 104 intervals[i].length == 2 0 <= starti <= endi <= 104 """ class Solution: def merge(self, intervals): intervals.sort(key=lambda x: x[0]) merged = [] for interval in intervals: first = interval[0] second = interval[1] if not merged or merged[-1][1] < first: merged.append(interval) else: merged[-1][1] = second return merged if __name__ == "__main__": intervals = [[1,3],[8,10],[2,6],[15,18]] assert Solution().merge(intervals) == [[1,6],[8,10],[15,18]]
""" Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input. Example 1: Input: intervals = [[1,3],[2,6],[8,10],[15,18]] Output: [[1,6],[8,10],[15,18]] Explanation: Since intervals [1,3] and [2,6] overlaps, merge them into [1,6]. Example 2: Input: intervals = [[1,4],[4,5]] Output: [[1,5]] Explanation: Intervals [1,4] and [4,5] are considered overlapping. Constraints: 1 <= intervals.length <= 104 intervals[i].length == 2 0 <= starti <= endi <= 104 """ class Solution: def merge(self, intervals): intervals.sort(key=lambda x: x[0]) merged = [] for interval in intervals: first = interval[0] second = interval[1] if not merged or merged[-1][1] < first: merged.append(interval) else: merged[-1][1] = second return merged if __name__ == '__main__': intervals = [[1, 3], [8, 10], [2, 6], [15, 18]] assert solution().merge(intervals) == [[1, 6], [8, 10], [15, 18]]
class Quiz: def __init__(self,question, alt, correct): self.question = question self.alt = alt self.correct = correct self.s ="" for a in range(len(self.alt)): self.s =self.s+str(a+1)+". "+self.alt[a]+"\n" def corect_ansrer_txt(self): return "correct anser is:{self.alt[self.correct-1]}".format(self=self) def __str__(self,*args,**kwargs): return "{self.question}\n{self.s}".format(self=self) class Player: def __init__(self,name,Score): self.score=0 self.name=name def Correct(self): self.score+=1 def Print_Score(self): print(f"{self.name} score is {self.score}") return self.score def __str__(self): return "{self.name}".format(self=self) def Add_players(Player_Nr): List_of_players=[] for l in range(Player_Nr): p=Player(input(f"Player{l+1}s name?"),0) List_of_players.append(p) return List_of_players if __name__=="__main__": file = open("C:/Users/bmm1/Dat120_Ovning9/sporsmaalsfil.txt", encoding="UTF8") Nr_players = int(input("Select number of players")) PlayerL = Add_players(Nr_players) ScoreL = [] for line in file: line = line.replace("[", "").replace("]","") Qst_Ans = line.split(":") Alt = Qst_Ans[2].replace(" ","").split(",") Qst_Ans.pop() int(Qst_Ans[1]) CorrectWrongL = [] Qst= Quiz(Qst_Ans[0], Alt, Qst_Ans[1]) print(Qst) for a in range(Nr_players): anser = int(input(f"{PlayerL[a]} select your anser")) Correct = int(Qst_Ans[1]) if anser == Correct+1: PlayerL[a].Correct() CorrectWrongL.append("Correct") else: CorrectWrongL.append("Wrong") print(f"Correct anser is {Alt[Correct]}") for z in range(len(CorrectWrongL)): print(f"{PlayerL[z]}'s anser is {CorrectWrongL[z]}") print("") for d in range(len(PlayerL)): SL = PlayerL[d].Print_Score() ScoreL.append(SL) max_value = max(ScoreL) max_index = ScoreL.index(max_value) print(f"{PlayerL[max_index]} won")
class Quiz: def __init__(self, question, alt, correct): self.question = question self.alt = alt self.correct = correct self.s = '' for a in range(len(self.alt)): self.s = self.s + str(a + 1) + '. ' + self.alt[a] + '\n' def corect_ansrer_txt(self): return 'correct anser is:{self.alt[self.correct-1]}'.format(self=self) def __str__(self, *args, **kwargs): return '{self.question}\n{self.s}'.format(self=self) class Player: def __init__(self, name, Score): self.score = 0 self.name = name def correct(self): self.score += 1 def print__score(self): print(f'{self.name} score is {self.score}') return self.score def __str__(self): return '{self.name}'.format(self=self) def add_players(Player_Nr): list_of_players = [] for l in range(Player_Nr): p = player(input(f'Player{l + 1}s name?'), 0) List_of_players.append(p) return List_of_players if __name__ == '__main__': file = open('C:/Users/bmm1/Dat120_Ovning9/sporsmaalsfil.txt', encoding='UTF8') nr_players = int(input('Select number of players')) player_l = add_players(Nr_players) score_l = [] for line in file: line = line.replace('[', '').replace(']', '') qst__ans = line.split(':') alt = Qst_Ans[2].replace(' ', '').split(',') Qst_Ans.pop() int(Qst_Ans[1]) correct_wrong_l = [] qst = quiz(Qst_Ans[0], Alt, Qst_Ans[1]) print(Qst) for a in range(Nr_players): anser = int(input(f'{PlayerL[a]} select your anser')) correct = int(Qst_Ans[1]) if anser == Correct + 1: PlayerL[a].Correct() CorrectWrongL.append('Correct') else: CorrectWrongL.append('Wrong') print(f'Correct anser is {Alt[Correct]}') for z in range(len(CorrectWrongL)): print(f"{PlayerL[z]}'s anser is {CorrectWrongL[z]}") print('') for d in range(len(PlayerL)): sl = PlayerL[d].Print_Score() ScoreL.append(SL) max_value = max(ScoreL) max_index = ScoreL.index(max_value) print(f'{PlayerL[max_index]} won')
program_list = [] def execute_command_with_params(input): command, params = input.split(sep=" ", maxsplit=1) if command == "insert": i, e = map(int, params.split(sep=" ", maxsplit=1)) program_list.insert(i, e) if command == "remove": e = int(params) program_list.remove(e) if command == "append": e = int(params) program_list.append(e) def execute_simple_command(input): if input == "print": print(program_list) if input == "sort": program_list.sort() if input == "pop": program_list.pop() if input == "reverse": program_list.reverse() if __name__ == '__main__': commands = list() n = int(input()) for _ in range(n): commands.append(input()) for command in commands: if ' ' in command: execute_command_with_params(command) else: execute_simple_command(command)
program_list = [] def execute_command_with_params(input): (command, params) = input.split(sep=' ', maxsplit=1) if command == 'insert': (i, e) = map(int, params.split(sep=' ', maxsplit=1)) program_list.insert(i, e) if command == 'remove': e = int(params) program_list.remove(e) if command == 'append': e = int(params) program_list.append(e) def execute_simple_command(input): if input == 'print': print(program_list) if input == 'sort': program_list.sort() if input == 'pop': program_list.pop() if input == 'reverse': program_list.reverse() if __name__ == '__main__': commands = list() n = int(input()) for _ in range(n): commands.append(input()) for command in commands: if ' ' in command: execute_command_with_params(command) else: execute_simple_command(command)
def help(): help_file = "help.txt" with open(help_file) as help: content = help.read() return(content)
def help(): help_file = 'help.txt' with open(help_file) as help: content = help.read() return content
"""params.py: default parameters for the neural style algorithm""" #TODO: These should all be settable by command line flags to the actual script content_path = "./images/mitart_lowres.jpg" # relative path of content input image style_path = "./images/starrynight.jpg" # relative path of style input image output_path = "./images/output/lowres" # relative path of output image # Algorithm parameters content_layer = 9 # Which vgg layer to use for matching content style_layers = [0, 2, 4, 8, 12] style_weights = [1.0/len(style_layers)]*len(style_layers) # How to relatively weight style layers; default to equal weights iterations = 1000 checkpoint = 200 content_weight = 5 # alpha and beta are relative weighting of style vs content in output style_weight = 100. tv_weight = 100. learning_rate = 2.0 # arbitrarily picked
"""params.py: default parameters for the neural style algorithm""" content_path = './images/mitart_lowres.jpg' style_path = './images/starrynight.jpg' output_path = './images/output/lowres' content_layer = 9 style_layers = [0, 2, 4, 8, 12] style_weights = [1.0 / len(style_layers)] * len(style_layers) iterations = 1000 checkpoint = 200 content_weight = 5 style_weight = 100.0 tv_weight = 100.0 learning_rate = 2.0
def euclide_e(a, n): u, v = 1, 0 u1, v1 = 0, 1 while n > 0: u1_t = u - a // n * u1 v1_t = v - a // n * v1 u, v = u1, v1 u1, v1 = u1_t, v1_t a, n = n, a - a // n * n; return [u, v, a] print(euclide_e(39, 5))
def euclide_e(a, n): (u, v) = (1, 0) (u1, v1) = (0, 1) while n > 0: u1_t = u - a // n * u1 v1_t = v - a // n * v1 (u, v) = (u1, v1) (u1, v1) = (u1_t, v1_t) (a, n) = (n, a - a // n * n) return [u, v, a] print(euclide_e(39, 5))
# Third-party dependencies fetched by Bazel # Unlike WORKSPACE, the content of this file is unordered. # We keep them separate to make the WORKSPACE file more maintainable. # Install the nodejs "bootstrap" package # This provides the basic tools for running and packaging nodejs programs in Bazel load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def fetch_dependencies(): http_archive( name = "build_bazel_rules_nodejs", sha256 = "8f5f192ba02319254aaf2cdcca00ec12eaafeb979a80a1e946773c520ae0a2c9", urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.7.0/rules_nodejs-3.7.0.tar.gz"], ) http_archive( name = "io_bazel_rules_go", sha256 = "8e968b5fcea1d2d64071872b12737bbb5514524ee5f0a4f54f5920266c261acb", urls = [ "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.28.0/rules_go-v0.28.0.zip", "https://github.com/bazelbuild/rules_go/releases/download/v0.28.0/rules_go-v0.28.0.zip", ], ) http_archive( name = "bazel_gazelle", sha256 = "62ca106be173579c0a167deb23358fdfe71ffa1e4cfdddf5582af26520f1c66f", urls = [ "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz", "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz", ], )
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') def fetch_dependencies(): http_archive(name='build_bazel_rules_nodejs', sha256='8f5f192ba02319254aaf2cdcca00ec12eaafeb979a80a1e946773c520ae0a2c9', urls=['https://github.com/bazelbuild/rules_nodejs/releases/download/3.7.0/rules_nodejs-3.7.0.tar.gz']) http_archive(name='io_bazel_rules_go', sha256='8e968b5fcea1d2d64071872b12737bbb5514524ee5f0a4f54f5920266c261acb', urls=['https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.28.0/rules_go-v0.28.0.zip', 'https://github.com/bazelbuild/rules_go/releases/download/v0.28.0/rules_go-v0.28.0.zip']) http_archive(name='bazel_gazelle', sha256='62ca106be173579c0a167deb23358fdfe71ffa1e4cfdddf5582af26520f1c66f', urls=['https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz', 'https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz'])
""" Copyright 2020 Daniel Cortez Stevenson Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ # fmt: off # from {{cookiecutter.package_name}}.common.util import list_s3_keys # fmt: on def main(spark, logger, bucket, prefix, suffix, **kwargs): """Example One Job of PySpark on AWS EMR.""" keys = list_s3_keys(bucket=bucket, prefix=prefix, suffix=suffix) logger.info(f"Found keys! -> {keys}")
""" Copyright 2020 Daniel Cortez Stevenson Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ def main(spark, logger, bucket, prefix, suffix, **kwargs): """Example One Job of PySpark on AWS EMR.""" keys = list_s3_keys(bucket=bucket, prefix=prefix, suffix=suffix) logger.info(f'Found keys! -> {keys}')
class Solution: def allPathsSourceTarget(self, graph: List[List[int]]) -> List[List[int]]: def dfs(cur, path): if cur == len(graph) - 1: res.append(path) else: for i in graph[cur]: dfs(i, path + [i]) res = [] dfs(0, [0]) return res
class Solution: def all_paths_source_target(self, graph: List[List[int]]) -> List[List[int]]: def dfs(cur, path): if cur == len(graph) - 1: res.append(path) else: for i in graph[cur]: dfs(i, path + [i]) res = [] dfs(0, [0]) return res
# model settings # norm_cfg = dict(type='BN', requires_grad=False) model = dict( type='FasterRCNN', pretrained='open-mmlab://resnext101_32x4d', #resnet50_caffe backbone=dict( type='ResNeXt', depth=101, #50 groups=32, num_stages=3, strides=(1, 2, 2), dilations=(1, 1, 1), out_indices=(2, ), frozen_stages=1, # norm_cfg=norm_cfg, # norm_eval=True, style='pytorch'), shared_head=dict( type='ResxLayer', depth=101, #50 stage=3, stride=1, dilation=2, style='pytorch', # norm_cfg=norm_cfg, # norm_eval=True ), rpn_head=dict( type='RPNHead', in_channels=1024, feat_channels=512, anchor_scales=[2, 4, 8, 16, 32], anchor_ratios=[0.5, 1.0, 2.0], anchor_strides=[16], target_means=[.0, .0, .0, .0], target_stds=[1.0, 1.0, 1.0, 1.0], loss_cls=dict( type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0), loss_bbox=dict(type='SmoothL1Loss', beta=1.0 / 9.0, loss_weight=1.0)), bbox_roi_extractor=dict( type='SingleRoIExtractor', roi_layer=dict(type='RoIAlign', out_size=7, sample_num=2), out_channels=1024, featmap_strides=[16]), bbox_head=dict( type='BBoxHead', with_avg_pool=False, #True roi_feat_size=7, in_channels=1024, num_classes=31, target_means=[0., 0., 0., 0.], target_stds=[0.1, 0.1, 0.2, 0.2], reg_class_agnostic=False, #False loss_cls=dict( type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0), loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)), selsa_head=dict( type='SelsaHead', in_channels=256, out_channels=1024, nongt_dim=3, # number of frames feat_dim=1024, # 1024 dim=[1024, 1024, 1024], # norm_cfg=norm_cfg, # norm_eval=True, apply=True) ) # model training and testing settings train_cfg = dict( rpn=dict( assigner=dict( type='MaxIoUAssigner', pos_iou_thr=0.7, neg_iou_thr=0.3, min_pos_iou=0.3, ignore_iof_thr=-1), sampler=dict( type='RandomSampler', num=256, pos_fraction=0.5, neg_pos_ub=-1, add_gt_as_proposals=False), allowed_border=-1, #0 pos_weight=-1, debug=False), rpn_proposal=dict( nms_across_levels=False, nms_pre=12000, nms_post=2000, max_num=2000, nms_thr=0.7, min_bbox_size=0), rcnn=dict( assigner=dict( type='MaxIoUAssigner', pos_iou_thr=0.5, neg_iou_thr=0.5, min_pos_iou=0.5, ignore_iof_thr=-1), sampler=dict( type='OHEMSampler', num=512, #512 pos_fraction=0.25, #0.25 neg_pos_ub=-1, add_gt_as_proposals=True), NUM_OHEM=None, pos_weight=-1, debug=False) ) test_cfg = dict( rpn=dict( nms_across_levels=False, nms_pre=6000, nms_post=1000, max_num=300, #1000 nms_thr=0.7, min_bbox_size=0), rcnn=dict( score_thr=0.001, nms=dict(type='nms', iou_thr=0.5), max_per_img=300)) #0.05 # dataset settings dataset_type = 'VIDDataset' data_root = '/media/data1/jliang/dataset/ILSVRC/' # img_norm_cfg = dict( # mean=[102.9801, 115.9465, 122.7717], std=[1.0, 1.0, 1.0], to_rgb=False) #maybe need to change img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) train_pipeline = [ dict(type='LoadImageFromFile', to_float32=True), #add to_float32=True dict(type='LoadAnnotations', with_bbox=True), dict( type='PhotoMetricDistortion', brightness_delta=32, contrast_range=(0.5, 1.5), saturation_range=(0.5, 1.5), hue_delta=18), dict( type='Expand', mean=img_norm_cfg['mean'], to_rgb=img_norm_cfg['to_rgb'], ratio_range=(1, 4)), #(1,4) dict( type='MinIoURandomCrop', min_ious=(0.1, 0.3, 0.5, 0.7, 0.9), #(0.1, 0.3, 0.5, 0.7, 0.9) min_crop_size=0.3), dict(type='Resize', img_scale=(600, 1000), keep_ratio=True), # when remove the crop, the gpu-util will be 100% then suspend dict(type='RandomCrop', crop_size=(4096, 4096)), dict(type='RandomFlip', flip_ratio=0.5), dict(type='Normalize', **img_norm_cfg), dict(type='Pad', size_divisor=32), dict(type='DefaultFormatBundle'), dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']), ] test_pipeline = [ dict(type='LoadImageFromFile'), dict( type='MultiScaleFlipAug', img_scale=(600, 1000), flip=False, transforms=[ dict(type='Resize', keep_ratio=True), dict(type='RandomCrop', crop_size=(4096, 4096)), dict(type='RandomFlip'), dict(type='Normalize', **img_norm_cfg), dict(type='Pad', size_divisor=32), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img'], meta_keys=('filename', 'ori_shape', 'img_shape', 'pad_shape', 'scale_factor', 'flip', 'img_norm_cfg', 'img_info')), ]) ] data = dict( imgs_per_gpu=1, workers_per_gpu=2, train=dict( type=dataset_type, image_set='DET_train_30classes+VID_train_15frames',#VID_train_15frames ann_file=data_root, img_prefix=data_root, pipeline=train_pipeline, selsa_offset=dict(MAX_OFFSET=9,MIN_OFFSET=-9)), val=dict( type=dataset_type, image_set='VID_val_frames_o', ann_file=data_root, img_prefix=data_root, pipeline=test_pipeline), test=dict( type=dataset_type, image_set='VID_val_videos', #VID_val_videos_o VID_val_videos_frames VID_val_videos_class_mofbg ann_file=data_root, img_prefix=data_root, pipeline=test_pipeline, selsa_offset=dict(MAX_OFFSET=9, MIN_OFFSET=-9))) evaluation = dict(interval=1) #control eval interval epoch # optimizer optimizer = dict(type='SGD', lr=0.00125, momentum=0.9, weight_decay=0.0001) optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) # learning policy lr_config = dict( policy='step', warmup='linear', warmup_iters=500, warmup_ratio=1.0 / 3, step=[11, 14]) checkpoint_config = dict(interval=1) # yapf:disable log_config = dict( interval=1000, hooks=[ dict(type='TextLoggerHook'), # dict(type='TensorboardLoggerHook') ]) # yapf:enable # runtime settings total_epochs = 15 dist_params = dict(backend='nccl') log_level = 'INFO' work_dir = './work_dirs/faster_rcnn_r101_caffe_c4_1x_gsfa/resnext' load_from = None resume_from = None workflow = [('train', 1)]
model = dict(type='FasterRCNN', pretrained='open-mmlab://resnext101_32x4d', backbone=dict(type='ResNeXt', depth=101, groups=32, num_stages=3, strides=(1, 2, 2), dilations=(1, 1, 1), out_indices=(2,), frozen_stages=1, style='pytorch'), shared_head=dict(type='ResxLayer', depth=101, stage=3, stride=1, dilation=2, style='pytorch'), rpn_head=dict(type='RPNHead', in_channels=1024, feat_channels=512, anchor_scales=[2, 4, 8, 16, 32], anchor_ratios=[0.5, 1.0, 2.0], anchor_strides=[16], target_means=[0.0, 0.0, 0.0, 0.0], target_stds=[1.0, 1.0, 1.0, 1.0], loss_cls=dict(type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0), loss_bbox=dict(type='SmoothL1Loss', beta=1.0 / 9.0, loss_weight=1.0)), bbox_roi_extractor=dict(type='SingleRoIExtractor', roi_layer=dict(type='RoIAlign', out_size=7, sample_num=2), out_channels=1024, featmap_strides=[16]), bbox_head=dict(type='BBoxHead', with_avg_pool=False, roi_feat_size=7, in_channels=1024, num_classes=31, target_means=[0.0, 0.0, 0.0, 0.0], target_stds=[0.1, 0.1, 0.2, 0.2], reg_class_agnostic=False, loss_cls=dict(type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0), loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)), selsa_head=dict(type='SelsaHead', in_channels=256, out_channels=1024, nongt_dim=3, feat_dim=1024, dim=[1024, 1024, 1024], apply=True)) train_cfg = dict(rpn=dict(assigner=dict(type='MaxIoUAssigner', pos_iou_thr=0.7, neg_iou_thr=0.3, min_pos_iou=0.3, ignore_iof_thr=-1), sampler=dict(type='RandomSampler', num=256, pos_fraction=0.5, neg_pos_ub=-1, add_gt_as_proposals=False), allowed_border=-1, pos_weight=-1, debug=False), rpn_proposal=dict(nms_across_levels=False, nms_pre=12000, nms_post=2000, max_num=2000, nms_thr=0.7, min_bbox_size=0), rcnn=dict(assigner=dict(type='MaxIoUAssigner', pos_iou_thr=0.5, neg_iou_thr=0.5, min_pos_iou=0.5, ignore_iof_thr=-1), sampler=dict(type='OHEMSampler', num=512, pos_fraction=0.25, neg_pos_ub=-1, add_gt_as_proposals=True), NUM_OHEM=None, pos_weight=-1, debug=False)) test_cfg = dict(rpn=dict(nms_across_levels=False, nms_pre=6000, nms_post=1000, max_num=300, nms_thr=0.7, min_bbox_size=0), rcnn=dict(score_thr=0.001, nms=dict(type='nms', iou_thr=0.5), max_per_img=300)) dataset_type = 'VIDDataset' data_root = '/media/data1/jliang/dataset/ILSVRC/' img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) train_pipeline = [dict(type='LoadImageFromFile', to_float32=True), dict(type='LoadAnnotations', with_bbox=True), dict(type='PhotoMetricDistortion', brightness_delta=32, contrast_range=(0.5, 1.5), saturation_range=(0.5, 1.5), hue_delta=18), dict(type='Expand', mean=img_norm_cfg['mean'], to_rgb=img_norm_cfg['to_rgb'], ratio_range=(1, 4)), dict(type='MinIoURandomCrop', min_ious=(0.1, 0.3, 0.5, 0.7, 0.9), min_crop_size=0.3), dict(type='Resize', img_scale=(600, 1000), keep_ratio=True), dict(type='RandomCrop', crop_size=(4096, 4096)), dict(type='RandomFlip', flip_ratio=0.5), dict(type='Normalize', **img_norm_cfg), dict(type='Pad', size_divisor=32), dict(type='DefaultFormatBundle'), dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels'])] test_pipeline = [dict(type='LoadImageFromFile'), dict(type='MultiScaleFlipAug', img_scale=(600, 1000), flip=False, transforms=[dict(type='Resize', keep_ratio=True), dict(type='RandomCrop', crop_size=(4096, 4096)), dict(type='RandomFlip'), dict(type='Normalize', **img_norm_cfg), dict(type='Pad', size_divisor=32), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img'], meta_keys=('filename', 'ori_shape', 'img_shape', 'pad_shape', 'scale_factor', 'flip', 'img_norm_cfg', 'img_info'))])] data = dict(imgs_per_gpu=1, workers_per_gpu=2, train=dict(type=dataset_type, image_set='DET_train_30classes+VID_train_15frames', ann_file=data_root, img_prefix=data_root, pipeline=train_pipeline, selsa_offset=dict(MAX_OFFSET=9, MIN_OFFSET=-9)), val=dict(type=dataset_type, image_set='VID_val_frames_o', ann_file=data_root, img_prefix=data_root, pipeline=test_pipeline), test=dict(type=dataset_type, image_set='VID_val_videos', ann_file=data_root, img_prefix=data_root, pipeline=test_pipeline, selsa_offset=dict(MAX_OFFSET=9, MIN_OFFSET=-9))) evaluation = dict(interval=1) optimizer = dict(type='SGD', lr=0.00125, momentum=0.9, weight_decay=0.0001) optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) lr_config = dict(policy='step', warmup='linear', warmup_iters=500, warmup_ratio=1.0 / 3, step=[11, 14]) checkpoint_config = dict(interval=1) log_config = dict(interval=1000, hooks=[dict(type='TextLoggerHook')]) total_epochs = 15 dist_params = dict(backend='nccl') log_level = 'INFO' work_dir = './work_dirs/faster_rcnn_r101_caffe_c4_1x_gsfa/resnext' load_from = None resume_from = None workflow = [('train', 1)]
def resolve(): ''' code here ''' N, H = [int(item) for item in input().split()] ab = [[int(item) for item in input().split()] for _ in range(N)] a_max = max(ab, key=lambda x:x[0]) res = H // a_max if H % a_max != 0: res += 1 temp_attack = res * a_max b_delta = [b - a_max for a, b in ab] throw_atk_sum = 0 throw_num = 0 for item in b_delta: if b_delta > 0: throw_atk_sum += item throw_num += 1 if throw_atk_sum < temp_attack: reduce_num = throw_atk_sum//a_max print(res - reduce_num) else: res = 0 for a, b in ab: H -= b res += 1 if H <= 0: break print(res) if __name__ == "__main__": resolve()
def resolve(): """ code here """ (n, h) = [int(item) for item in input().split()] ab = [[int(item) for item in input().split()] for _ in range(N)] a_max = max(ab, key=lambda x: x[0]) res = H // a_max if H % a_max != 0: res += 1 temp_attack = res * a_max b_delta = [b - a_max for (a, b) in ab] throw_atk_sum = 0 throw_num = 0 for item in b_delta: if b_delta > 0: throw_atk_sum += item throw_num += 1 if throw_atk_sum < temp_attack: reduce_num = throw_atk_sum // a_max print(res - reduce_num) else: res = 0 for (a, b) in ab: h -= b res += 1 if H <= 0: break print(res) if __name__ == '__main__': resolve()
def parensvalid(stringInput): opencount = 0 closedcount = 0 for i in range(0, len(stringInput), 1): if stringInput[i] == "(": opencount += 1 elif stringInput[i] == ")": closedcount += 1 if closedcount > opencount: return False if opencount != closedcount: return False else: return True print(parensvalid(")(()")) def parenvalid2(stringInput): # your code here count = 0 # closedcount = 0 for i in range(0, len(stringInput), 1): if stringInput[i] == "(": count += 1 elif stringInput[i] == ")": count -= 1 if count < 0: return False if count == 0: return True else: return False print(parenvalid2(")(()"))
def parensvalid(stringInput): opencount = 0 closedcount = 0 for i in range(0, len(stringInput), 1): if stringInput[i] == '(': opencount += 1 elif stringInput[i] == ')': closedcount += 1 if closedcount > opencount: return False if opencount != closedcount: return False else: return True print(parensvalid(')(()')) def parenvalid2(stringInput): count = 0 for i in range(0, len(stringInput), 1): if stringInput[i] == '(': count += 1 elif stringInput[i] == ')': count -= 1 if count < 0: return False if count == 0: return True else: return False print(parenvalid2(')(()'))
"""Chapter 1 Practice Projects. Attributes: VOWELS (tuple): Tuple containing characters of the English vowels (except for 'y') ENCODE_ERROR (str): String with :py:exc:`TypeError` for Pig Latin :func:`~p1_pig_latin.encode`. FREQ_ANALYSIS_ERROR (str): String with :py:exc:`TypeError` for Poor Bar Chart :func:`~p2_poor_bar_chart.freq_analysis`. PRINT_BAR_CHART_ERROR (str): String with :py:exc:`TypeError` for Poor Bar Chart :func:`~p2_poor_bar_chart.print_bar_chart`. """ # Constants VOWELS = ('a', 'e', 'i', 'o', 'u') ENCODE_ERROR = 'Word must be a string.' FREQ_ANALYSIS_ERROR = 'Sentence must be a string.' PRINT_BAR_CHART_ERROR = 'Object must be a dictionary.'
"""Chapter 1 Practice Projects. Attributes: VOWELS (tuple): Tuple containing characters of the English vowels (except for 'y') ENCODE_ERROR (str): String with :py:exc:`TypeError` for Pig Latin :func:`~p1_pig_latin.encode`. FREQ_ANALYSIS_ERROR (str): String with :py:exc:`TypeError` for Poor Bar Chart :func:`~p2_poor_bar_chart.freq_analysis`. PRINT_BAR_CHART_ERROR (str): String with :py:exc:`TypeError` for Poor Bar Chart :func:`~p2_poor_bar_chart.print_bar_chart`. """ vowels = ('a', 'e', 'i', 'o', 'u') encode_error = 'Word must be a string.' freq_analysis_error = 'Sentence must be a string.' print_bar_chart_error = 'Object must be a dictionary.'
expected_output = { "operation_summary": { 1: { "command": "rollback", "duration": "00:00:04", "end_date": "2021-11-02", "end_time": "06:50:48", "op_id": 1, "start_date": "2021-11-02", "start_time": "06:50:44", "status": "Fail", "uuid": "2021_11_02_06_50_44_op_rollback", }, 2: { "command": "rollback", "duration": "00:00:05", "end_date": "2021-11-02", "end_time": "05:52:04", "op_id": 1, "start_date": "2021-11-02", "start_time": "05:51:59", "status": "Fail", "uuid": "2021_11_02_05_51_59_op_rollback", }, 3: { "command": "rollback", "duration": "00:00:07", "end_date": "2021-10-29", "end_time": "12:44:21", "op_id": 1, "start_date": "2021-10-29", "start_time": "12:44:14", "status": "Fail", "uuid": "2021_10_29_12_44_14_op_rollback", }, 4: { "command": "commit", "duration": "00:00:04", "end_date": "2021-10-21", "end_time": "16:34:06", "op_id": 1, "start_date": "2021-10-21", "start_time": "16:34:02", "status": "OK", "uuid": "2021_10_21_16_34_02_op_commit", }, } }
expected_output = {'operation_summary': {1: {'command': 'rollback', 'duration': '00:00:04', 'end_date': '2021-11-02', 'end_time': '06:50:48', 'op_id': 1, 'start_date': '2021-11-02', 'start_time': '06:50:44', 'status': 'Fail', 'uuid': '2021_11_02_06_50_44_op_rollback'}, 2: {'command': 'rollback', 'duration': '00:00:05', 'end_date': '2021-11-02', 'end_time': '05:52:04', 'op_id': 1, 'start_date': '2021-11-02', 'start_time': '05:51:59', 'status': 'Fail', 'uuid': '2021_11_02_05_51_59_op_rollback'}, 3: {'command': 'rollback', 'duration': '00:00:07', 'end_date': '2021-10-29', 'end_time': '12:44:21', 'op_id': 1, 'start_date': '2021-10-29', 'start_time': '12:44:14', 'status': 'Fail', 'uuid': '2021_10_29_12_44_14_op_rollback'}, 4: {'command': 'commit', 'duration': '00:00:04', 'end_date': '2021-10-21', 'end_time': '16:34:06', 'op_id': 1, 'start_date': '2021-10-21', 'start_time': '16:34:02', 'status': 'OK', 'uuid': '2021_10_21_16_34_02_op_commit'}}}
a = int(input("Input number a:\n")) b = int(input("Input number b:\n")) print(f"a + b = {a+b}") print(f"a - b = {a-b}") print(f"a * b = {a*b}") print(f"a / b = {a/b}") print(f"a ** b = {a**b}")
a = int(input('Input number a:\n')) b = int(input('Input number b:\n')) print(f'a + b = {a + b}') print(f'a - b = {a - b}') print(f'a * b = {a * b}') print(f'a / b = {a / b}') print(f'a ** b = {a ** b}')
""" This module includes information about Google search page specific HTML information to be used in parsing. It includes class names such as the class assigned to search result DIV's etc. """ class GoogleDomInfoBase(object): RESULT_TITLE_CLASS = 'r' RESULT_URL_CLASS = '_Rm' RESULT_DESCRIPTION_CLASS = 'st' RESULT_RELATED_LINKS_DIV_CLASS = 'osl' RESULT_RELATED_LINK_CLASS = 'fl' NEXT_PAGE_ID = 'pnnext' class GoogleDomInfoWithJS(GoogleDomInfoBase): RESULT_DIV_CLASS = 'rc' SEARCH_BOX_XPATH = '//*[@id="lst-ib"]' class GoogleDomInfoWithoutJS(GoogleDomInfoBase): RESULT_DIV_CLASS = 'g' SEARCH_BOX_XPATH = '//*[@id="sbhost"]' NAVIGATION_LINK_CLASS = 'fl' PREFERENCES_BUTTON_ID = 'gbi5' NUMBER_OF_RESULTS_SELECT_ID = 'numsel' SAVE_PREFERENCES_BUTTON_NAME = 'submit2'
""" This module includes information about Google search page specific HTML information to be used in parsing. It includes class names such as the class assigned to search result DIV's etc. """ class Googledominfobase(object): result_title_class = 'r' result_url_class = '_Rm' result_description_class = 'st' result_related_links_div_class = 'osl' result_related_link_class = 'fl' next_page_id = 'pnnext' class Googledominfowithjs(GoogleDomInfoBase): result_div_class = 'rc' search_box_xpath = '//*[@id="lst-ib"]' class Googledominfowithoutjs(GoogleDomInfoBase): result_div_class = 'g' search_box_xpath = '//*[@id="sbhost"]' navigation_link_class = 'fl' preferences_button_id = 'gbi5' number_of_results_select_id = 'numsel' save_preferences_button_name = 'submit2'
# Our Input Array arr = [3,2,4,1] def Cyclic_sort(arr): """ This function will check if the element at i is at the correct index or not. If it is not at the correct index then it will swap places and if it is then we will increment the value of i by 1. """ i = 0 while i < len(arr): correct_index = arr[i] - 1 if arr[i] != arr[correct_index]: arr[i], arr[correct_index] = arr[correct_index], arr[i] else: i += 1 return arr print(Cyclic_sort(arr))
arr = [3, 2, 4, 1] def cyclic_sort(arr): """ This function will check if the element at i is at the correct index or not. If it is not at the correct index then it will swap places and if it is then we will increment the value of i by 1. """ i = 0 while i < len(arr): correct_index = arr[i] - 1 if arr[i] != arr[correct_index]: (arr[i], arr[correct_index]) = (arr[correct_index], arr[i]) else: i += 1 return arr print(cyclic_sort(arr))
NAME = "vt2geojson" DESCRIPTION = "Dump vector tiles to GeoJSON from remote URLs or local system files." AUTHOR = "Theophile Dancoisne" AUTHOR_EMAIL = "dancoisne.theophile@gmail.com" URL = "https://github.com/Amyantis/python-vt2geojson" __version__ = "0.2.1"
name = 'vt2geojson' description = 'Dump vector tiles to GeoJSON from remote URLs or local system files.' author = 'Theophile Dancoisne' author_email = 'dancoisne.theophile@gmail.com' url = 'https://github.com/Amyantis/python-vt2geojson' __version__ = '0.2.1'
n= int(input()) my_dict = {} for i in range((n*(n-1))//2): mylist = [] x, y, z = input().split() mylist.append(x) mylist.append(y) mylist.append(z) first_t=mylist[0] second_t = mylist[1] first_t_score = mylist[2][0] second_t_score = mylist[2][2] if first_t_score<second_t_score: scorefinalfirst=0 scorefinalsecond =3 if (first_t=='A' and second_t=='B') or (first_t=='B' and second_t=='C') or (first_t=='A' and second_t=='C'): if first_t in my_dict: my_dict[first_t] += 0 else: my_dict[first_t]= 0 if second_t in my_dict: my_dict[second_t] += 3 else: my_dict[second_t] = 3 elif first_t_score == second_t_score: if (first_t == 'A' and second_t == 'B') or (first_t == 'B' and second_t == 'C') or ( first_t == 'A' and second_t == 'C'): if first_t in my_dict: my_dict[first_t] += 1 else: my_dict[first_t] = 1 if second_t in my_dict: my_dict[second_t] += 1 else: my_dict[second_t] = 1 else: scorefinalfirst = 3 scorefinalsecond=0 if (first_t == 'A' and second_t == 'B') or (first_t == 'B' and second_t == 'C') or (first_t == 'A' and second_t == 'C'): if first_t in my_dict: my_dict[first_t] += 3 else: my_dict[first_t] = 3 if second_t in my_dict: my_dict[second_t] += 0 else: my_dict[second_t] = 0 Keymax = max(my_dict, key=my_dict.get) print(Keymax,my_dict[Keymax])
n = int(input()) my_dict = {} for i in range(n * (n - 1) // 2): mylist = [] (x, y, z) = input().split() mylist.append(x) mylist.append(y) mylist.append(z) first_t = mylist[0] second_t = mylist[1] first_t_score = mylist[2][0] second_t_score = mylist[2][2] if first_t_score < second_t_score: scorefinalfirst = 0 scorefinalsecond = 3 if first_t == 'A' and second_t == 'B' or (first_t == 'B' and second_t == 'C') or (first_t == 'A' and second_t == 'C'): if first_t in my_dict: my_dict[first_t] += 0 else: my_dict[first_t] = 0 if second_t in my_dict: my_dict[second_t] += 3 else: my_dict[second_t] = 3 elif first_t_score == second_t_score: if first_t == 'A' and second_t == 'B' or (first_t == 'B' and second_t == 'C') or (first_t == 'A' and second_t == 'C'): if first_t in my_dict: my_dict[first_t] += 1 else: my_dict[first_t] = 1 if second_t in my_dict: my_dict[second_t] += 1 else: my_dict[second_t] = 1 else: scorefinalfirst = 3 scorefinalsecond = 0 if first_t == 'A' and second_t == 'B' or (first_t == 'B' and second_t == 'C') or (first_t == 'A' and second_t == 'C'): if first_t in my_dict: my_dict[first_t] += 3 else: my_dict[first_t] = 3 if second_t in my_dict: my_dict[second_t] += 0 else: my_dict[second_t] = 0 keymax = max(my_dict, key=my_dict.get) print(Keymax, my_dict[Keymax])
''' Katie Naughton Final Project Intro to Programming Sources: '''
""" Katie Naughton Final Project Intro to Programming Sources: """
# NOTE: This address must be verified with Amazon SES. SENDER = "Sender <no-reply@sender.com>" # AWS Region you're using for Amazon SES. AWS_REGION = "us-east-1" # The character encoding for the email. CHARSET = "UTF-8" # This variable should be passed in from the invoker. # NOTE: If your account is still in the sandbox, this address must be verified. DEFAULT_RECIPIENT = "default@recipient.com" # The default subject line for the email. DEFAULT_SUBJECT = "Default email subject" # The default email body for recipients with non-HTML email clients. DEFAULT_BODY_TEXT = ("Default email body, non HTML version. No one should ever get this email.") # The default HTML body of the email. DEFAULT_BODY_HTML = """<html> <head></head> <body> <h1>Default email body</h1> <p> <a href='https://default.com/'>Default</a> test email, HTML version. No one should ever get this email. </p> </body> </html> """
sender = 'Sender <no-reply@sender.com>' aws_region = 'us-east-1' charset = 'UTF-8' default_recipient = 'default@recipient.com' default_subject = 'Default email subject' default_body_text = 'Default email body, non HTML version. No one should ever get this email.' default_body_html = "<html>\n<head></head>\n<body>\n <h1>Default email body</h1>\n <p>\n <a href='https://default.com/'>Default</a> test email, HTML version. No one should ever get this email.\n </p>\n</body>\n</html>\n "
class Canvas(): """A Canvas.""" def __init__(self, height, width): """Initialize Canvas object""" self.height = height self.width = width self.shapes = [] self.canvas_matrix = [] self.clear_shapes() def print_canvas(self): """Print canvas drawing (with shapes) to console.""" for row in self.canvas_matrix: print("".join(row)) def add_shape(self, added_shape): """Add a shape object to the canvas.""" self.shapes.append(added_shape) # clear canvas of all existing shapes and re-draw all shapes on canvas to # allow for correct rendering of shapes that were translated. self.clear_shapes() canvas_matrix = self.canvas_matrix # for each shape, go row by row in the canvas for shape in self.shapes: new_shape = shape.shape_matrix for index, row in enumerate(canvas_matrix): if index >= len(new_shape): continue # start at end of new_shape array (bottom of the shape) shape_row = new_shape[-(index+1)] shape_index = 0 while (shape_index < len(shape_row)) & (shape_index < len(row)): if shape_row[shape_index] != " ": row[shape_index] = shape_row[shape_index] shape_index += 1 # flip the canvas 180 degrees b/c bottom of the shape is at the top of # the canvas canvas_matrix.reverse() self.canvas_matrix = canvas_matrix def clear_shapes(self): """Clears canvas of all shapes.""" self.canvas_matrix = [] for num in range(self.height): row_str = [" " for x in range(self.width)] self.canvas_matrix.append(row_str) class Shape(): """A Shape.""" def __init__(self, start_x, start_y, end_x, end_y, fill_char): """Initializes Shape object.""" self.start_x = start_x self.end_x = end_x self.width = (end_x-start_x) + 1 self.start_y = start_y self.end_y = end_y self.height = (start_y-end_y) + 1 self.fill_char = fill_char self.create_shape() def print_shape(self): """Prints shape drawing to console.""" for row in self.shape_matrix: print("".join(row)) def create_shape(self): """Creates the shape drawing.""" self.shape_matrix = [] row_num = self.start_y for num in range(self.start_y+1): if row_num < (self.end_y): row_str = [" " for x in range(self.end_x + 1)] else: row_str = [" " for x in range(self.start_x)] + \ [self.fill_char for x in range(self.width)] self.shape_matrix.append(row_str) row_num -= 1 def change_fill_char(self, char): """Changes the fill character of the shape drawing.""" self.fill_char = char self.create_shape() def translate(self, axis, num): """Translates the shape drawing.""" if axis == "x": if (self.start_x + num) < 0: print("x coordinate cannot be a negative number") else: self.start_x += num self.end_x += num elif axis == "y": if (self.end_y + num) < 0: print("y coordinate cannot be a negative number") else: self.start_y += num self.end_y += num self.create_shape() def create_canvas(height, width): """Creates blank canvas given height and width. Returns Canvas object.""" new_canvas = Canvas(height, width) return new_canvas def render_canvas(canvas): """Prints canvas drawing to console.""" canvas.print_canvas() def add_shape_to_canvas(canvas, shape): """Adds Shape object to Canvas.""" canvas.add_shape(shape) def clear_shapes(canvas): """Clears all shapes from canvas.""" canvas.clear_shapes() canvas.shapes = [] def create_rectangle(start_x, start_y, end_x, end_y, fill_char): """Creates rectangle. Returns Rectangle object.""" new_rect = Shape(start_x, start_y, end_x, end_y, fill_char) return new_rect def change_fill_char(canvas, rect, char): """Changes fill char of a rectangle and sends changes to canvas.""" canvas.shapes.remove(rect) rect.change_fill_char(char) canvas.add_shape(rect) def translate(canvas, rect, axis, num): """Translates rectangle and sends changes to canvas.""" canvas.shapes.remove(rect) rect.translate(axis, num) canvas.add_shape(rect)
class Canvas: """A Canvas.""" def __init__(self, height, width): """Initialize Canvas object""" self.height = height self.width = width self.shapes = [] self.canvas_matrix = [] self.clear_shapes() def print_canvas(self): """Print canvas drawing (with shapes) to console.""" for row in self.canvas_matrix: print(''.join(row)) def add_shape(self, added_shape): """Add a shape object to the canvas.""" self.shapes.append(added_shape) self.clear_shapes() canvas_matrix = self.canvas_matrix for shape in self.shapes: new_shape = shape.shape_matrix for (index, row) in enumerate(canvas_matrix): if index >= len(new_shape): continue shape_row = new_shape[-(index + 1)] shape_index = 0 while (shape_index < len(shape_row)) & (shape_index < len(row)): if shape_row[shape_index] != ' ': row[shape_index] = shape_row[shape_index] shape_index += 1 canvas_matrix.reverse() self.canvas_matrix = canvas_matrix def clear_shapes(self): """Clears canvas of all shapes.""" self.canvas_matrix = [] for num in range(self.height): row_str = [' ' for x in range(self.width)] self.canvas_matrix.append(row_str) class Shape: """A Shape.""" def __init__(self, start_x, start_y, end_x, end_y, fill_char): """Initializes Shape object.""" self.start_x = start_x self.end_x = end_x self.width = end_x - start_x + 1 self.start_y = start_y self.end_y = end_y self.height = start_y - end_y + 1 self.fill_char = fill_char self.create_shape() def print_shape(self): """Prints shape drawing to console.""" for row in self.shape_matrix: print(''.join(row)) def create_shape(self): """Creates the shape drawing.""" self.shape_matrix = [] row_num = self.start_y for num in range(self.start_y + 1): if row_num < self.end_y: row_str = [' ' for x in range(self.end_x + 1)] else: row_str = [' ' for x in range(self.start_x)] + [self.fill_char for x in range(self.width)] self.shape_matrix.append(row_str) row_num -= 1 def change_fill_char(self, char): """Changes the fill character of the shape drawing.""" self.fill_char = char self.create_shape() def translate(self, axis, num): """Translates the shape drawing.""" if axis == 'x': if self.start_x + num < 0: print('x coordinate cannot be a negative number') else: self.start_x += num self.end_x += num elif axis == 'y': if self.end_y + num < 0: print('y coordinate cannot be a negative number') else: self.start_y += num self.end_y += num self.create_shape() def create_canvas(height, width): """Creates blank canvas given height and width. Returns Canvas object.""" new_canvas = canvas(height, width) return new_canvas def render_canvas(canvas): """Prints canvas drawing to console.""" canvas.print_canvas() def add_shape_to_canvas(canvas, shape): """Adds Shape object to Canvas.""" canvas.add_shape(shape) def clear_shapes(canvas): """Clears all shapes from canvas.""" canvas.clear_shapes() canvas.shapes = [] def create_rectangle(start_x, start_y, end_x, end_y, fill_char): """Creates rectangle. Returns Rectangle object.""" new_rect = shape(start_x, start_y, end_x, end_y, fill_char) return new_rect def change_fill_char(canvas, rect, char): """Changes fill char of a rectangle and sends changes to canvas.""" canvas.shapes.remove(rect) rect.change_fill_char(char) canvas.add_shape(rect) def translate(canvas, rect, axis, num): """Translates rectangle and sends changes to canvas.""" canvas.shapes.remove(rect) rect.translate(axis, num) canvas.add_shape(rect)