content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def expectOne(vals): assert len(vals) == 1 return vals[0]
def expect_one(vals): assert len(vals) == 1 return vals[0]
class CSVDumper: @classmethod def dump(self, matrix, encoding='sjis'): rows = [] for row in matrix: fields = [] for field in row: if field is None: fields.append('') elif str(field).isdigit(): fields.append(str(field)) else: fields.append('"{0}"'.format(str(field).replace('"', '""'))) rows.append(','.join(fields)) return '\n'.join(rows).encode(encoding, 'ignore')
class Csvdumper: @classmethod def dump(self, matrix, encoding='sjis'): rows = [] for row in matrix: fields = [] for field in row: if field is None: fields.append('') elif str(field).isdigit(): fields.append(str(field)) else: fields.append('"{0}"'.format(str(field).replace('"', '""'))) rows.append(','.join(fields)) return '\n'.join(rows).encode(encoding, 'ignore')
'''Hercy wants to save money for his first car. He puts money in the Leetcode bank every day. He starts by putting in $1 on Monday, the first day. Every day from Tuesday to Sunday, he will put in $1 more than the day before. On every subsequent Monday, he will put in $1 more than the previous Monday. Given n, return the total amount of money he will have in the Leetcode bank at the end of the nth day. Example 1: Input: n = 4 Output: 10 Explanation: After the 4th day, the total is 1 + 2 + 3 + 4 = 10. ''' class Lb: def totalMoney(self, n: int) -> int: x=0 carr=n//7 rem=n%7 for i in range (carr+1,rem+carr+1): x+=i for i in range(carr): x += 7 * (i + 4) return x print(Lb().totalMoney(10)) print(Lb().totalMoney(100)) print(Lb().totalMoney(8)) print(Lb().totalMoney(3)) print(Lb().totalMoney(900)) print(Lb().totalMoney(128))
"""Hercy wants to save money for his first car. He puts money in the Leetcode bank every day. He starts by putting in $1 on Monday, the first day. Every day from Tuesday to Sunday, he will put in $1 more than the day before. On every subsequent Monday, he will put in $1 more than the previous Monday. Given n, return the total amount of money he will have in the Leetcode bank at the end of the nth day. Example 1: Input: n = 4 Output: 10 Explanation: After the 4th day, the total is 1 + 2 + 3 + 4 = 10. """ class Lb: def total_money(self, n: int) -> int: x = 0 carr = n // 7 rem = n % 7 for i in range(carr + 1, rem + carr + 1): x += i for i in range(carr): x += 7 * (i + 4) return x print(lb().totalMoney(10)) print(lb().totalMoney(100)) print(lb().totalMoney(8)) print(lb().totalMoney(3)) print(lb().totalMoney(900)) print(lb().totalMoney(128))
# Radix Sort is an improvement over Counting Sort # Counting Sort is highly inefficient with large ranges # Radix sort sorts digit by digit from least to most significant digit. # It can be imagined as a bucket sort based on place values. def radixSort(array, base=10): # Get the maximum in the array to find the maximum number of digits # Since we are sorting digit wise m = max(array) # Initially we start by sorting the least significant digit placeValue = 1 # We loop till all digits have been sorted while m/placeValue > 0: # Apply digit wise counting Sort # Find the occurence of each digit and store that value occurence = [0]*base for element in array: occurence[int((element/placeValue) % base)] += 1 # Since occurence array is already sorted by index, the actual position of the element will # be the next of sum of all occurences before it for i in range(1, base): occurence[i] += occurence[i-1] temp = [0]*len(array) # Traverse array backwards to count down occurences for i in range(len(array)-1, -1, -1): pos = array[i]/placeValue temp[occurence[int(pos % base)]-1] = array[i] occurence[int(pos % base)] -= 1 # Copy temproary array to original one for i, val in enumerate(temp): array[i] = val # The next digit will be the immediate next placevalue [tens, hundreds in the decimal system] placeValue *= base return array # Driver code a = [40, 122, 1, 5, 28, 99] print(radixSort(a)) # Since radix sort is not a comparison based one, the time complexity is linear # Worst case: O(d(n+b)) # Where n is the len of array, d is the number of maximum digits and b is the base
def radix_sort(array, base=10): m = max(array) place_value = 1 while m / placeValue > 0: occurence = [0] * base for element in array: occurence[int(element / placeValue % base)] += 1 for i in range(1, base): occurence[i] += occurence[i - 1] temp = [0] * len(array) for i in range(len(array) - 1, -1, -1): pos = array[i] / placeValue temp[occurence[int(pos % base)] - 1] = array[i] occurence[int(pos % base)] -= 1 for (i, val) in enumerate(temp): array[i] = val place_value *= base return array a = [40, 122, 1, 5, 28, 99] print(radix_sort(a))
''' -- Make required Folder & open Integrated CMD in it ! In CMD type : [To make exact copy of system base python but no modules included!] -- pip install virtualenv -- virtualenv [nameOfSubFolderInRequiredFolder] // Here I used VirtualEnvironment --OR-- To make exact copy of system base python[with Modules] : -- virtualenv --system-site-packages [nameOfSubFolderInRequiredFolder] // Here I used VirtualEnvironment To activate : -- .\[nameOfSubFolderInRequiredFolder]\Scripts\activate // Here I used VirtualEnvironment To deactivate : -- deactivate To get guide in Virtual Environment : -- pip freeze > requirements.txt To install modules mentioned in requirements.txt : -- pip install -r .\requirements.txt '''
""" -- Make required Folder & open Integrated CMD in it ! In CMD type : [To make exact copy of system base python but no modules included!] -- pip install virtualenv -- virtualenv [nameOfSubFolderInRequiredFolder] // Here I used VirtualEnvironment --OR-- To make exact copy of system base python[with Modules] : -- virtualenv --system-site-packages [nameOfSubFolderInRequiredFolder] // Here I used VirtualEnvironment To activate : -- .\\[nameOfSubFolderInRequiredFolder]\\Scripts\x07ctivate // Here I used VirtualEnvironment To deactivate : -- deactivate To get guide in Virtual Environment : -- pip freeze > requirements.txt To install modules mentioned in requirements.txt : -- pip install -r .\requirements.txt """
ME = ''' query getMe { me { username isStaff isSuperuser isAgreed profile { id oauthType name nameKo nameEn bio bioKo bioEn email phone organization nationality image avatarUrl } } } ''' UPDATE_PROFILE = ''' mutation UpdateProfile($data: ProfileInput!) { updateProfile(data: $data) { profile { id oauthType name nameKo nameEn bio bioKo bioEn email phone organization nationality image avatarUrl } } } ''' UPDATE_AGREEMENT = ''' mutation UpdateAgreement($isPrivacyPolicy: Boolean, $isTermsOfService: Boolean) { updateAgreement(isPrivacyPolicy: $isPrivacyPolicy, isTermsOfService: $isTermsOfService) { isAgreedAll user { username isStaff isSuperuser isAgreed profile { id oauthType name nameKo nameEn bio bioKo bioEn email phone organization nationality image avatarUrl } } } } ''' PATRONS = ''' query getPatrons { patrons { id name nameKo nameEn bio bioKo bioEn organization image avatarUrl } } '''
me = '\nquery getMe {\n me {\n username\n isStaff\n isSuperuser\n isAgreed\n profile { \n id\n oauthType\n name\n nameKo\n nameEn\n bio\n bioKo\n bioEn\n email\n phone\n organization\n nationality\n image\n avatarUrl\n }\n }\n}\n' update_profile = '\nmutation UpdateProfile($data: ProfileInput!) {\n updateProfile(data: $data) {\n profile { \n id\n oauthType\n name \n nameKo\n nameEn\n bio\n bioKo\n bioEn\n email\n phone\n organization\n nationality\n image\n avatarUrl\n }\n }\n}\n' update_agreement = '\nmutation UpdateAgreement($isPrivacyPolicy: Boolean, $isTermsOfService: Boolean) {\n updateAgreement(isPrivacyPolicy: $isPrivacyPolicy, isTermsOfService: $isTermsOfService) {\n isAgreedAll\n user {\n username\n isStaff\n isSuperuser\n isAgreed\n profile { \n id\n oauthType\n name \n nameKo\n nameEn\n bio\n bioKo\n bioEn\n email\n phone\n organization\n nationality\n image\n avatarUrl\n }\n }\n }\n}\n' patrons = '\nquery getPatrons {\n patrons {\n id\n name\n nameKo\n nameEn\n bio\n bioKo\n bioEn\n organization\n image\n avatarUrl\n }\n}\n'
# -*- coding: utf-8 -*- args = input().split() n1, n2, n3 = list(map (int, args)) average = (lambda a, b, c: (a + b + c)/3)(n1, n2, n3) result = (lambda av: "Approved" if av >= 6 else "Disapproved") print(result(average))
args = input().split() (n1, n2, n3) = list(map(int, args)) average = (lambda a, b, c: (a + b + c) / 3)(n1, n2, n3) result = lambda av: 'Approved' if av >= 6 else 'Disapproved' print(result(average))
# leetcode class Solution: def isPalindrome(self, s: str) -> bool: s_cp = s.replace(" ", "").lower() clean_s = '' for l in s_cp: # check if num if ord(l) >= 48 and ord(l) <= 57: clean_s += l elif ord(l) >= 97 and ord(l) <= 122: clean_s += l return clean_s == clean_s[::-1]
class Solution: def is_palindrome(self, s: str) -> bool: s_cp = s.replace(' ', '').lower() clean_s = '' for l in s_cp: if ord(l) >= 48 and ord(l) <= 57: clean_s += l elif ord(l) >= 97 and ord(l) <= 122: clean_s += l return clean_s == clean_s[::-1]
''' Two intervals i1, i2overlap if the following requirements are satisfied: requirement 1: i1.end >= i2.start requirement 2: i1.start <= i2.end We preprocess the list by sorting intervals by starts increasingly. In this way, requirement 2 i1.start <= i2.start < i2.end is promised. We only have to compare i1.end with i2.start to see if requirement 1 is satisfied. ''' def merge(intervals): # Sort by first element in list children intervals = sorted(intervals, key=lambda x: x[0]) result = [] for cur in intervals: if len(result) < 1: result.append(cur) else: prev = result[-1] if prev[-1] >= cur[0]: prev[-1] = max(prev[-1], cur[-1]) else: result.append(cur) return result def merge_intervals2(intervals): if not intervals or len(intervals) <=1: return intervals result = [] i = len(intervals)-1 while i >= 0: arr = list(range(intervals[i][0], intervals[i][-1]+1)) k = 0 for j in range(1, len(intervals)): if intervals[i-j][-1] in arr: k +=1 if k > 0: result.append([intervals[i-k][0],arr[-1]]) else: result.append([arr[0], arr[-1]]) i = i-k-1 return list(reversed(result)) intervals = [[1,3],[2,6],[8,10],[15,18]] intervals2 = [[1,4],[4,5]] print(merge(intervals)) print(merge(intervals2)) print(merge2(intervals)) print(merge2(intervals2))
""" Two intervals i1, i2overlap if the following requirements are satisfied: requirement 1: i1.end >= i2.start requirement 2: i1.start <= i2.end We preprocess the list by sorting intervals by starts increasingly. In this way, requirement 2 i1.start <= i2.start < i2.end is promised. We only have to compare i1.end with i2.start to see if requirement 1 is satisfied. """ def merge(intervals): intervals = sorted(intervals, key=lambda x: x[0]) result = [] for cur in intervals: if len(result) < 1: result.append(cur) else: prev = result[-1] if prev[-1] >= cur[0]: prev[-1] = max(prev[-1], cur[-1]) else: result.append(cur) return result def merge_intervals2(intervals): if not intervals or len(intervals) <= 1: return intervals result = [] i = len(intervals) - 1 while i >= 0: arr = list(range(intervals[i][0], intervals[i][-1] + 1)) k = 0 for j in range(1, len(intervals)): if intervals[i - j][-1] in arr: k += 1 if k > 0: result.append([intervals[i - k][0], arr[-1]]) else: result.append([arr[0], arr[-1]]) i = i - k - 1 return list(reversed(result)) intervals = [[1, 3], [2, 6], [8, 10], [15, 18]] intervals2 = [[1, 4], [4, 5]] print(merge(intervals)) print(merge(intervals2)) print(merge2(intervals)) print(merge2(intervals2))
""" 110. Balanced Binary Tree Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as: a binary tree in which the left and right subtrees of every node differ in height by no more than 1. Example 1: Given the following tree [3,9,20,null,null,15,7]: 3 / \ 9 20 / \ 15 7 Return true. Example 2: Given the following tree [1,2,2,3,3,null,null,4,4]: 1 / \ 2 2 / \ 3 3 / \ 4 4 Return false. """ # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def isBalanced(self, root): """ :type root: TreeNode :rtype: bool """ def dfs(root): if not root: return 0, 1 l, res_l = dfs(root.left) r, res_r = dfs(root.right) if res_l and res_r and (-1 <= l-r <= 1): res = 1 else: res = 0 return max(l,r)+1, res return dfs(root)[1] == 1
""" 110. Balanced Binary Tree Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as: a binary tree in which the left and right subtrees of every node differ in height by no more than 1. Example 1: Given the following tree [3,9,20,null,null,15,7]: 3 / 9 20 / 15 7 Return true. Example 2: Given the following tree [1,2,2,3,3,null,null,4,4]: 1 / 2 2 / 3 3 / 4 4 Return false. """ class Solution(object): def is_balanced(self, root): """ :type root: TreeNode :rtype: bool """ def dfs(root): if not root: return (0, 1) (l, res_l) = dfs(root.left) (r, res_r) = dfs(root.right) if res_l and res_r and (-1 <= l - r <= 1): res = 1 else: res = 0 return (max(l, r) + 1, res) return dfs(root)[1] == 1
"""Utility to store int or float parameters with a label The label is added merely for information: there is no extra functionality associated with it. The module has a factory class Parameter(value, label) which returns either ParameterInt ot ParameterFloat depending on type(value). """ class ParameterInt(int): """Integer parameter with a label""" def __new__(cls, *args): """Arguements: args[0] is the value """ return super(ParameterInt, cls).__new__(cls, args[0]) def __init__(self, value, label): """Arguments value (integer): the value label (string, Label, ...): associated label """ super(ParameterInt, self).__init__() self.label = label def __repr__(self): """Return string including the label""" parameter = "value= {!s}, label= {!r}".format(self, self.label) return "ParameterInt({!s})".format(parameter) class ParameterFloat(float): """Real parameter with label""" def __new__(cls, *args): """Arguments: args[0] is the value """ return super(ParameterFloat, cls).__new__(cls, args[0]) def __init__(self, value, label): """Arguments value (float): the value label (string, Label, ...): a description """ super(ParameterFloat, self).__init__() self.label = label def __repr__(self): """Return a string including the label""" parameter = "value= {!s}, label= {!r}".format(self, self.label) return "ParameterFloat({!s})".format(parameter) class Parameter(object): """A factory to return a Parameter of the correct type""" def __new__(cls, value, label): """Arguments: value (int or float) label (string or Label) """ if isinstance(value, int): return ParameterInt(value, label) elif isinstance(value, float): return ParameterFloat(value, label) else: raise TypeError("A Parameter is either int or float")
"""Utility to store int or float parameters with a label The label is added merely for information: there is no extra functionality associated with it. The module has a factory class Parameter(value, label) which returns either ParameterInt ot ParameterFloat depending on type(value). """ class Parameterint(int): """Integer parameter with a label""" def __new__(cls, *args): """Arguements: args[0] is the value """ return super(ParameterInt, cls).__new__(cls, args[0]) def __init__(self, value, label): """Arguments value (integer): the value label (string, Label, ...): associated label """ super(ParameterInt, self).__init__() self.label = label def __repr__(self): """Return string including the label""" parameter = 'value= {!s}, label= {!r}'.format(self, self.label) return 'ParameterInt({!s})'.format(parameter) class Parameterfloat(float): """Real parameter with label""" def __new__(cls, *args): """Arguments: args[0] is the value """ return super(ParameterFloat, cls).__new__(cls, args[0]) def __init__(self, value, label): """Arguments value (float): the value label (string, Label, ...): a description """ super(ParameterFloat, self).__init__() self.label = label def __repr__(self): """Return a string including the label""" parameter = 'value= {!s}, label= {!r}'.format(self, self.label) return 'ParameterFloat({!s})'.format(parameter) class Parameter(object): """A factory to return a Parameter of the correct type""" def __new__(cls, value, label): """Arguments: value (int or float) label (string or Label) """ if isinstance(value, int): return parameter_int(value, label) elif isinstance(value, float): return parameter_float(value, label) else: raise type_error('A Parameter is either int or float')
# # PySNMP MIB module Nortel-Magellan-Passport-DataCollectionMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-DataCollectionMIB # Produced by pysmi-0.3.4 at Wed May 1 14:26:47 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint", "ConstraintsIntersection") DisplayString, StorageType, RowStatus, Unsigned32, Integer32, Gauge32, Counter32 = mibBuilder.importSymbols("Nortel-Magellan-Passport-StandardTextualConventionsMIB", "DisplayString", "StorageType", "RowStatus", "Unsigned32", "Integer32", "Gauge32", "Counter32") NonReplicated, EnterpriseDateAndTime, AsciiString = mibBuilder.importSymbols("Nortel-Magellan-Passport-TextualConventionsMIB", "NonReplicated", "EnterpriseDateAndTime", "AsciiString") passportMIBs, components = mibBuilder.importSymbols("Nortel-Magellan-Passport-UsefulDefinitionsMIB", "passportMIBs", "components") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") MibScalar, MibTable, MibTableRow, MibTableColumn, ModuleIdentity, Bits, TimeTicks, iso, Integer32, Unsigned32, IpAddress, Counter64, Gauge32, Counter32, ObjectIdentity, MibIdentifier, NotificationType = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ModuleIdentity", "Bits", "TimeTicks", "iso", "Integer32", "Unsigned32", "IpAddress", "Counter64", "Gauge32", "Counter32", "ObjectIdentity", "MibIdentifier", "NotificationType") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") dataCollectionMIB = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 14)) col = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21)) colRowStatusTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 1), ) if mibBuilder.loadTexts: colRowStatusTable.setStatus('mandatory') if mibBuilder.loadTexts: colRowStatusTable.setDescription('This entry controls the addition and deletion of col components.') colRowStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 1, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-DataCollectionMIB", "colIndex")) if mibBuilder.loadTexts: colRowStatusEntry.setStatus('mandatory') if mibBuilder.loadTexts: colRowStatusEntry.setDescription('A single entry in the table represents a single col component.') colRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 1, 1, 1), RowStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: colRowStatus.setStatus('mandatory') if mibBuilder.loadTexts: colRowStatus.setDescription('This variable is used as the basis for SNMP naming of col components. These components can be added.') colComponentName = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 1, 1, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: colComponentName.setStatus('mandatory') if mibBuilder.loadTexts: colComponentName.setDescription("This variable provides the component's string name for use with the ASCII Console Interface") colStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 1, 1, 4), StorageType()).setMaxAccess("readonly") if mibBuilder.loadTexts: colStorageType.setStatus('mandatory') if mibBuilder.loadTexts: colStorageType.setDescription('This variable represents the storage type value for the col tables.') colIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 1, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("accounting", 0), ("alarm", 1), ("log", 2), ("debug", 3), ("scn", 4), ("trap", 5), ("stats", 6)))) if mibBuilder.loadTexts: colIndex.setStatus('mandatory') if mibBuilder.loadTexts: colIndex.setDescription('This variable represents the index for the col tables.') colProvTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 10), ) if mibBuilder.loadTexts: colProvTable.setStatus('mandatory') if mibBuilder.loadTexts: colProvTable.setDescription('This group specifies all of the provisioning data for a DCS Collector.') colProvEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 10, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-DataCollectionMIB", "colIndex")) if mibBuilder.loadTexts: colProvEntry.setStatus('mandatory') if mibBuilder.loadTexts: colProvEntry.setDescription('An entry in the colProvTable.') colAgentQueueSize = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 10, 1, 1), Unsigned32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(20, 10000), ))).setMaxAccess("readwrite") if mibBuilder.loadTexts: colAgentQueueSize.setStatus('obsolete') if mibBuilder.loadTexts: colAgentQueueSize.setDescription("This attribute has been replaced with the agentQueueSize attribute in the Lp Engineering DataStream Ov component. Upon migration, if the existing provisioned value of this attribute is the same as the system default for this type of data, no new components are added because the default is what the DataStream component already would be using. Otherwise, if the value is not the same as the system default, then for each Lp which is provisioned at the time of the migration, a DataStream is provisioned and the Ov's agentQueueSize is set to the non-default value.") colStatsTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 11), ) if mibBuilder.loadTexts: colStatsTable.setStatus('mandatory') if mibBuilder.loadTexts: colStatsTable.setDescription('This group specifies the statistics operational attributes of the DCS Collector, Agent and Spooler components.') colStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 11, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-DataCollectionMIB", "colIndex")) if mibBuilder.loadTexts: colStatsEntry.setStatus('mandatory') if mibBuilder.loadTexts: colStatsEntry.setDescription('An entry in the colStatsTable.') colCurrentQueueSize = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 11, 1, 1), Gauge32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly") if mibBuilder.loadTexts: colCurrentQueueSize.setStatus('mandatory') if mibBuilder.loadTexts: colCurrentQueueSize.setDescription('This gauge contains the current number of records held by this DCS component.') colRecordsRx = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 11, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: colRecordsRx.setStatus('mandatory') if mibBuilder.loadTexts: colRecordsRx.setDescription('This counter contains the cumulative number of records received by a DCS component, from applications which send data to it, since the processor last restarted. This counter wraps to 0 when the maximum value is exceeded.') colRecordsDiscarded = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 11, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: colRecordsDiscarded.setStatus('mandatory') if mibBuilder.loadTexts: colRecordsDiscarded.setDescription('This is the cumulative number of records discarded by this DCS component since the processor last restarted. This counter wraps to 0 when the maximum value is exceeded.') colTimesTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 266), ) if mibBuilder.loadTexts: colTimesTable.setStatus('mandatory') if mibBuilder.loadTexts: colTimesTable.setDescription('This attribute specifies the scheduled times at which data should be collected. Only accounting applications need the capability to generate data in this way. Setting this attribute for other streams has no effect. The user can enter the times in any order and duplicates are prevented at data entry. There is a limit of 24 entries, which is imposed at semantic check time. The collection times are triggered in chronological order. A semantic check error is issued if any 2 entries are less than 1 hour apart or if any 2 entries are more than 12 hours apart (which implies that if any entries are provided, there must be at least 2 entries). Note that by default (that is, in the absence of a provisioned schedule), a Virtual Circuit (VC) starts its own 12-hour accounting timer. If any collection times are provisioned here, then the Time- Of-Day-Accounting (TODA) method is used in place of 12-hour accounting. This is applicable to both Switched VCs and Permanent VCs.') colTimesEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 266, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-DataCollectionMIB", "colIndex"), (0, "Nortel-Magellan-Passport-DataCollectionMIB", "colTimesValue")) if mibBuilder.loadTexts: colTimesEntry.setStatus('mandatory') if mibBuilder.loadTexts: colTimesEntry.setDescription('An entry in the colTimesTable.') colTimesValue = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 266, 1, 1), EnterpriseDateAndTime().subtype(subtypeSpec=ValueSizeConstraint(5, 5)).setFixedLength(5)).setMaxAccess("readwrite") if mibBuilder.loadTexts: colTimesValue.setStatus('mandatory') if mibBuilder.loadTexts: colTimesValue.setDescription('This variable represents both the value and the index for the colTimesTable.') colTimesRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 266, 1, 2), RowStatus()).setMaxAccess("writeonly") if mibBuilder.loadTexts: colTimesRowStatus.setStatus('mandatory') if mibBuilder.loadTexts: colTimesRowStatus.setDescription('This variable is used to control the addition and deletion of individual values of the colTimesTable.') colLastTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 275), ) if mibBuilder.loadTexts: colLastTable.setStatus('obsolete') if mibBuilder.loadTexts: colLastTable.setDescription('Note: This was made obsolete in R4.1 (BD0108A). This attribute is used for Collector/stats and Collector/account. For statistics, when collection is turned off, or prior to the very first probe, the value is the empty list. Otherwise, this is the network time at which the last probe was sent out (that is, the last time that statistics were collected from, or at least reset by, the applications providing them). For accounting, when no entries exist in collectionTimes, or prior to the very first collection time, the value is the empty list. Otherwise, this is the network time at which the last time-of-day changeover occurred.') colLastEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 275, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-DataCollectionMIB", "colIndex"), (0, "Nortel-Magellan-Passport-DataCollectionMIB", "colLastValue")) if mibBuilder.loadTexts: colLastEntry.setStatus('obsolete') if mibBuilder.loadTexts: colLastEntry.setDescription('An entry in the colLastTable.') colLastValue = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 275, 1, 1), EnterpriseDateAndTime().subtype(subtypeSpec=ValueSizeConstraint(19, 19)).setFixedLength(19)).setMaxAccess("readonly") if mibBuilder.loadTexts: colLastValue.setStatus('obsolete') if mibBuilder.loadTexts: colLastValue.setDescription('This variable represents both the value and the index for the colLastTable.') colPeakTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 279), ) if mibBuilder.loadTexts: colPeakTable.setStatus('mandatory') if mibBuilder.loadTexts: colPeakTable.setDescription('This attribute specifies the length of the accounting peak water mark interval. It is at least one minute and at most 15 minutes long. An accounting peak water mark within a given accounting interval is the accounting count which occured during a peak water mark interval with the highest traffic. Peak water marks are used to determine traffic bursts. If no value is provisioned for this attribute value of 5 minutes is assumed. Peak water mark is only measured if attribute collectionTimes in Collector/account is provisioned.') colPeakEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 279, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-DataCollectionMIB", "colIndex"), (0, "Nortel-Magellan-Passport-DataCollectionMIB", "colPeakValue")) if mibBuilder.loadTexts: colPeakEntry.setStatus('mandatory') if mibBuilder.loadTexts: colPeakEntry.setDescription('An entry in the colPeakTable.') colPeakValue = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 279, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 15))).setMaxAccess("readwrite") if mibBuilder.loadTexts: colPeakValue.setStatus('mandatory') if mibBuilder.loadTexts: colPeakValue.setDescription('This variable represents both the value and the index for the colPeakTable.') colPeakRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 279, 1, 2), RowStatus()).setMaxAccess("writeonly") if mibBuilder.loadTexts: colPeakRowStatus.setStatus('mandatory') if mibBuilder.loadTexts: colPeakRowStatus.setDescription('This variable is used to control the addition and deletion of individual values of the colPeakTable.') colSp = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2)) colSpRowStatusTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 1), ) if mibBuilder.loadTexts: colSpRowStatusTable.setStatus('mandatory') if mibBuilder.loadTexts: colSpRowStatusTable.setDescription('This entry controls the addition and deletion of colSp components.') colSpRowStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 1, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-DataCollectionMIB", "colIndex"), (0, "Nortel-Magellan-Passport-DataCollectionMIB", "colSpIndex")) if mibBuilder.loadTexts: colSpRowStatusEntry.setStatus('mandatory') if mibBuilder.loadTexts: colSpRowStatusEntry.setDescription('A single entry in the table represents a single colSp component.') colSpRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 1, 1, 1), RowStatus()).setMaxAccess("readonly") if mibBuilder.loadTexts: colSpRowStatus.setStatus('mandatory') if mibBuilder.loadTexts: colSpRowStatus.setDescription('This variable is used as the basis for SNMP naming of colSp components. These components cannot be added nor deleted.') colSpComponentName = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 1, 1, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: colSpComponentName.setStatus('mandatory') if mibBuilder.loadTexts: colSpComponentName.setDescription("This variable provides the component's string name for use with the ASCII Console Interface") colSpStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 1, 1, 4), StorageType()).setMaxAccess("readonly") if mibBuilder.loadTexts: colSpStorageType.setStatus('mandatory') if mibBuilder.loadTexts: colSpStorageType.setDescription('This variable represents the storage type value for the colSp tables.') colSpIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 1, 1, 10), NonReplicated()) if mibBuilder.loadTexts: colSpIndex.setStatus('mandatory') if mibBuilder.loadTexts: colSpIndex.setDescription('This variable represents the index for the colSp tables.') colSpProvTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 10), ) if mibBuilder.loadTexts: colSpProvTable.setStatus('mandatory') if mibBuilder.loadTexts: colSpProvTable.setDescription('This group specifies all of the provisioning data for a DCS Spooler.') colSpProvEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 10, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-DataCollectionMIB", "colIndex"), (0, "Nortel-Magellan-Passport-DataCollectionMIB", "colSpIndex")) if mibBuilder.loadTexts: colSpProvEntry.setStatus('mandatory') if mibBuilder.loadTexts: colSpProvEntry.setDescription('An entry in the colSpProvTable.') colSpSpooling = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 10, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("off", 0), ("on", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: colSpSpooling.setStatus('mandatory') if mibBuilder.loadTexts: colSpSpooling.setDescription('This attribute specifies whether or not this type of data is spooled to the disk. If set to off, it is roughly equivalent to Locking the Spooler (except this will survive processor restarts). The following defaults are used: - alarm: on - accounting: on - log: on - debug: off - scn: on - trap: off (see Note below) - stats: on Note that SNMP Traps cannot be spooled. A semantic check prevents the user from setting the value to on for the trap stream.') colSpMaximumNumberOfFiles = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 10, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 200))).setMaxAccess("readwrite") if mibBuilder.loadTexts: colSpMaximumNumberOfFiles.setStatus('mandatory') if mibBuilder.loadTexts: colSpMaximumNumberOfFiles.setDescription("This attribute specifies the maximum number of files that should be kept on the disk in the directory containing the closed files of this type. The value 0 is defined to mean 'unlimited'. A different default for each type of Spooler is defined as follows: - alarm: 30 - accounting: 200 - debug: 2 - log: 10 - scn: 10 - trap: 2 (this value is meaningless and is ignored) - stats: 200") colSpStateTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 11), ) if mibBuilder.loadTexts: colSpStateTable.setStatus('mandatory') if mibBuilder.loadTexts: colSpStateTable.setDescription('This group contains the three OSI State attributes and the six OSI Status attributes. The descriptions generically indicate what each attribute implies about the component. Note that not all the values and state combinations described here are supported by every component which uses this group. For component-specific information and the valid state combinations, refer to NTP 241- 7001-150, Passport Operations and Maintenance Guide.') colSpStateEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 11, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-DataCollectionMIB", "colIndex"), (0, "Nortel-Magellan-Passport-DataCollectionMIB", "colSpIndex")) if mibBuilder.loadTexts: colSpStateEntry.setStatus('mandatory') if mibBuilder.loadTexts: colSpStateEntry.setDescription('An entry in the colSpStateTable.') colSpAdminState = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 11, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("locked", 0), ("unlocked", 1), ("shuttingDown", 2))).clone('unlocked')).setMaxAccess("readonly") if mibBuilder.loadTexts: colSpAdminState.setStatus('mandatory') if mibBuilder.loadTexts: colSpAdminState.setDescription('This attribute indicates the OSI Administrative State of the component. The value locked indicates that the component is administratively prohibited from providing services for its users. A Lock or Lock - force command has been previously issued for this component. When the value is locked, the value of usageState must be idle. The value shuttingDown indicates that the component is administratively permitted to provide service to its existing users only. A Lock command was issued against the component and it is in the process of shutting down. The value unlocked indicates that the component is administratively permitted to provide services for its users. To enter this state, issue an Unlock command to this component. The OSI Status attributes, if supported by the component, may provide more details, qualifying the state of the component.') colSpOperationalState = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 11, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("disabled", 0), ("enabled", 1))).clone('disabled')).setMaxAccess("readonly") if mibBuilder.loadTexts: colSpOperationalState.setStatus('mandatory') if mibBuilder.loadTexts: colSpOperationalState.setDescription('This attribute indicates the OSI Operational State of the component. The value enabled indicates that the component is available for operation. Note that if adminState is locked, it would still not be providing service. The value disabled indicates that the component is not available for operation. For example, something is wrong with the component itself, or with another component on which this one depends. If the value is disabled, the usageState must be idle. The OSI Status attributes, if supported by the component, may provide more details, qualifying the state of the component.') colSpUsageState = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 11, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("idle", 0), ("active", 1), ("busy", 2))).clone('idle')).setMaxAccess("readonly") if mibBuilder.loadTexts: colSpUsageState.setStatus('mandatory') if mibBuilder.loadTexts: colSpUsageState.setDescription('This attribute indicates the OSI Usage State of the component. The value idle indicates that the component is not currently in use. The value active indicates that the component is in use and has spare capacity to provide for additional users. The value busy indicates that the component is in use and has no spare operating capacity for additional users at this time. The OSI Status attributes, if supported by the component, may provide more details, qualifying the state of the component.') colSpAvailabilityStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 11, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(2, 2)).setFixedLength(2)).setMaxAccess("readonly") if mibBuilder.loadTexts: colSpAvailabilityStatus.setStatus('mandatory') if mibBuilder.loadTexts: colSpAvailabilityStatus.setDescription('If supported by the component, this attribute indicates the OSI Availability status of the component. Note that, even though it is defined as a multi-valued set, at most one value is shown to the user. When no values are in the set, this indicates that either the attribute is not supported or that none of the status conditions described below are present. The value inTest indicates that the resource is undergoing a test procedure. If adminState is locked or shuttingDown, the normal users are precluded from using the resource and controlStatus is reservedForTest. Tests that do not exclude additional users can be present in any operational or administrative state but the reservedForTest condition should not be present. The value failed indicates that the component has an internal fault that prevents it from operating. The operationalState is disabled. The value dependency indicates that the component cannot operate because some other resource on which it depends is unavailable. The operationalState is disabled. The value powerOff indicates the resource requires power to be applied and it is not powered on. The operationalState is disabled. The value offLine indicates the resource requires a routine operation (either manual, automatic, or both) to be performed to place it on-line and make it available for use. The operationalState is disabled. The value offDuty indicates the resource is inactive in accordance with a predetermined time schedule. In the absence of other disabling conditions, the operationalState is enabled or disabled. The value degraded indicates the service provided by the component is degraded in some way, such as in speed or operating capacity. However, the resource remains available for service. The operationalState is enabled. The value notInstalled indicates the resource is not present. The operationalState is disabled. The value logFull is not used. Description of bits: inTest(0) failed(1) powerOff(2) offLine(3) offDuty(4) dependency(5) degraded(6) notInstalled(7) logFull(8)') colSpProceduralStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 11, 1, 5), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 1)).setFixedLength(1)).setMaxAccess("readonly") if mibBuilder.loadTexts: colSpProceduralStatus.setStatus('mandatory') if mibBuilder.loadTexts: colSpProceduralStatus.setDescription("If supported by the component, this attribute indicates the OSI Procedural status of the component. Note that, even though it is defined as a multi-valued set, at most one value is shown to the user. When no values are in the set, this indicates that either the attribute is not supported or that none of the status conditions described below are present. The value initializationRequired indicates (for a resource which doesn't initialize autonomously) that initialization is required before it can perform its normal functions, and this procedure has not been initiated. The operationalState is disabled. The value notInitialized indicates (for a resource which does initialize autonomously) that initialization is required before it can perform its normal functions, and this procedure has not been initiated. The operationalState may be enabled or disabled. The value initializing indicates that initialization has been initiated but is not yet complete. The operationalState may be enabled or disabled. The value reporting indicates the resource has completed some processing operation and is notifying the results. The operationalState is enabled. The value terminating indicates the component is in a termination phase. If the resource doesn't reinitialize autonomously, operationalState is disabled; otherwise it is enabled or disabled. Description of bits: initializationRequired(0) notInitialized(1) initializing(2) reporting(3) terminating(4)") colSpControlStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 11, 1, 6), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 1)).setFixedLength(1)).setMaxAccess("readonly") if mibBuilder.loadTexts: colSpControlStatus.setStatus('mandatory') if mibBuilder.loadTexts: colSpControlStatus.setDescription('If supported by the component, this attribute indicates the OSI Control status of the component. Note that, even though it is defined as a multi-valued set, at most one value is shown to the user. When no values are in the set, this indicates that either the attribute is not supported or that none of the status conditions described below are present. The value subjectToTest indicates the resource is available but tests may be conducted simultaneously at unpredictable times, which may cause it to exhibit unusual characteristics. The value partOfServicesLocked indicates that part of the service is restricted from users of a resource. The adminState is unlocked. The value reservedForTest indicates that the component is administratively unavailable because it is undergoing a test procedure. The adminState is locked. The value suspended indicates that the service has been administratively suspended. Description of bits: subjectToTest(0) partOfServicesLocked(1) reservedForTest(2) suspended(3)') colSpAlarmStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 11, 1, 7), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 1)).setFixedLength(1)).setMaxAccess("readonly") if mibBuilder.loadTexts: colSpAlarmStatus.setStatus('mandatory') if mibBuilder.loadTexts: colSpAlarmStatus.setDescription('If supported by the component, this attribute indicates the OSI Alarm status of the component. Note that, even though it is defined as a multi-valued set, at most one value is shown to the user. When no values are in the set, this indicates that either the attribute is not supported or that none of the status conditions described below are present. The value underRepair indicates the component is currently being repaired. The operationalState is enabled or disabled. The value critical indicates one or more critical alarms are outstanding against the component. Other, less severe, alarms may also be outstanding. The operationalState is enabled or disabled. The value major indicates one or more major alarms are outstanding against the component. Other, less severe, alarms may also be outstanding. The operationalState is enabled or disabled. The value minor indicates one or more minor alarms are outstanding against the component. Other, less severe, alarms may also be outstanding. The operationalState is enabled or disabled. The value alarmOutstanding generically indicates that an alarm of some severity is outstanding against the component. Description of bits: underRepair(0) critical(1) major(2) minor(3) alarmOutstanding(4)') colSpStandbyStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 11, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 15))).clone(namedValues=NamedValues(("hotStandby", 0), ("coldStandby", 1), ("providingService", 2), ("notSet", 15))).clone('notSet')).setMaxAccess("readonly") if mibBuilder.loadTexts: colSpStandbyStatus.setStatus('mandatory') if mibBuilder.loadTexts: colSpStandbyStatus.setDescription('If supported by the component, this attribute indicates the OSI Standby status of the component. The value notSet indicates that either the attribute is not supported or that none of the status conditions described below are present. Note that this is a non-standard value, used because the original specification indicated this attribute was set-valued and thus, did not provide a value to indicate that none of the other three are applicable. The value hotStandby indicates that the resource is not providing service but will be immediately able to take over the role of the resource to be backed up, without initialization activity, and containing the same information as the resource to be backed up. The value coldStandby indicates the resource is a backup for another resource but will not be immediately able to take over the role of the backed up resource and will require some initialization activity. The value providingService indicates that this component, as a backup resource, is currently backing up another resource.') colSpUnknownStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 11, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("false", 0), ("true", 1))).clone('false')).setMaxAccess("readonly") if mibBuilder.loadTexts: colSpUnknownStatus.setStatus('mandatory') if mibBuilder.loadTexts: colSpUnknownStatus.setDescription('This attribute indicates the OSI Unknown status of the component. The value false indicates that all of the other OSI State and Status attribute values can be considered accurate. The value true indicates that the actual state of the component is not known for sure.') colSpOperTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 12), ) if mibBuilder.loadTexts: colSpOperTable.setStatus('mandatory') if mibBuilder.loadTexts: colSpOperTable.setDescription('This group contains the operational attributes specific to a DCS Spooler.') colSpOperEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 12, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-DataCollectionMIB", "colIndex"), (0, "Nortel-Magellan-Passport-DataCollectionMIB", "colSpIndex")) if mibBuilder.loadTexts: colSpOperEntry.setStatus('mandatory') if mibBuilder.loadTexts: colSpOperEntry.setDescription('An entry in the colSpOperTable.') colSpSpoolingFileName = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 12, 1, 1), AsciiString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly") if mibBuilder.loadTexts: colSpSpoolingFileName.setStatus('mandatory') if mibBuilder.loadTexts: colSpSpoolingFileName.setDescription('When spooling is on, this attribute contains the name of the open file into which data is currently being spooled. When spooling is off, the value of this attribute is the empty string.') colSpStatsTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 13), ) if mibBuilder.loadTexts: colSpStatsTable.setStatus('mandatory') if mibBuilder.loadTexts: colSpStatsTable.setDescription('This group specifies the statistics operational attributes of the DCS Collector, Agent and Spooler components.') colSpStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 13, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-DataCollectionMIB", "colIndex"), (0, "Nortel-Magellan-Passport-DataCollectionMIB", "colSpIndex")) if mibBuilder.loadTexts: colSpStatsEntry.setStatus('mandatory') if mibBuilder.loadTexts: colSpStatsEntry.setDescription('An entry in the colSpStatsTable.') colSpCurrentQueueSize = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 13, 1, 1), Gauge32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly") if mibBuilder.loadTexts: colSpCurrentQueueSize.setStatus('mandatory') if mibBuilder.loadTexts: colSpCurrentQueueSize.setDescription('This gauge contains the current number of records held by this DCS component.') colSpRecordsRx = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 13, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: colSpRecordsRx.setStatus('mandatory') if mibBuilder.loadTexts: colSpRecordsRx.setDescription('This counter contains the cumulative number of records received by a DCS component, from applications which send data to it, since the processor last restarted. This counter wraps to 0 when the maximum value is exceeded.') colSpRecordsDiscarded = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 13, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: colSpRecordsDiscarded.setStatus('mandatory') if mibBuilder.loadTexts: colSpRecordsDiscarded.setDescription('This is the cumulative number of records discarded by this DCS component since the processor last restarted. This counter wraps to 0 when the maximum value is exceeded.') colAg = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3)) colAgRowStatusTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 1), ) if mibBuilder.loadTexts: colAgRowStatusTable.setStatus('mandatory') if mibBuilder.loadTexts: colAgRowStatusTable.setDescription('*** THIS TABLE CURRENTLY NOT IMPLEMENTED *** This entry controls the addition and deletion of colAg components.') colAgRowStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 1, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-DataCollectionMIB", "colIndex"), (0, "Nortel-Magellan-Passport-DataCollectionMIB", "colAgIndex")) if mibBuilder.loadTexts: colAgRowStatusEntry.setStatus('mandatory') if mibBuilder.loadTexts: colAgRowStatusEntry.setDescription('A single entry in the table represents a single colAg component.') colAgRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 1, 1, 1), RowStatus()).setMaxAccess("readonly") if mibBuilder.loadTexts: colAgRowStatus.setStatus('mandatory') if mibBuilder.loadTexts: colAgRowStatus.setDescription('This variable is used as the basis for SNMP naming of colAg components. These components cannot be added nor deleted.') colAgComponentName = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 1, 1, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: colAgComponentName.setStatus('mandatory') if mibBuilder.loadTexts: colAgComponentName.setDescription("This variable provides the component's string name for use with the ASCII Console Interface") colAgStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 1, 1, 4), StorageType()).setMaxAccess("readonly") if mibBuilder.loadTexts: colAgStorageType.setStatus('mandatory') if mibBuilder.loadTexts: colAgStorageType.setDescription('This variable represents the storage type value for the colAg tables.') colAgIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 1, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 15))) if mibBuilder.loadTexts: colAgIndex.setStatus('mandatory') if mibBuilder.loadTexts: colAgIndex.setDescription('This variable represents the index for the colAg tables.') colAgStatsTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 10), ) if mibBuilder.loadTexts: colAgStatsTable.setStatus('mandatory') if mibBuilder.loadTexts: colAgStatsTable.setDescription('*** THIS TABLE CURRENTLY NOT IMPLEMENTED *** This group specifies the statistics operational attributes of the DCS Collector, Agent and Spooler components.') colAgStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 10, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-DataCollectionMIB", "colIndex"), (0, "Nortel-Magellan-Passport-DataCollectionMIB", "colAgIndex")) if mibBuilder.loadTexts: colAgStatsEntry.setStatus('mandatory') if mibBuilder.loadTexts: colAgStatsEntry.setDescription('An entry in the colAgStatsTable.') colAgCurrentQueueSize = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 10, 1, 1), Gauge32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly") if mibBuilder.loadTexts: colAgCurrentQueueSize.setStatus('mandatory') if mibBuilder.loadTexts: colAgCurrentQueueSize.setDescription('This gauge contains the current number of records held by this DCS component.') colAgRecordsRx = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 10, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: colAgRecordsRx.setStatus('mandatory') if mibBuilder.loadTexts: colAgRecordsRx.setDescription('This counter contains the cumulative number of records received by a DCS component, from applications which send data to it, since the processor last restarted. This counter wraps to 0 when the maximum value is exceeded.') colAgRecordsDiscarded = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 10, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: colAgRecordsDiscarded.setStatus('mandatory') if mibBuilder.loadTexts: colAgRecordsDiscarded.setDescription('This is the cumulative number of records discarded by this DCS component since the processor last restarted. This counter wraps to 0 when the maximum value is exceeded.') colAgAgentStatsTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 11), ) if mibBuilder.loadTexts: colAgAgentStatsTable.setStatus('mandatory') if mibBuilder.loadTexts: colAgAgentStatsTable.setDescription('*** THIS TABLE CURRENTLY NOT IMPLEMENTED *** This group contains the statistical attributes specific to the DCS Agent components.') colAgAgentStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 11, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-DataCollectionMIB", "colIndex"), (0, "Nortel-Magellan-Passport-DataCollectionMIB", "colAgIndex")) if mibBuilder.loadTexts: colAgAgentStatsEntry.setStatus('mandatory') if mibBuilder.loadTexts: colAgAgentStatsEntry.setDescription('An entry in the colAgAgentStatsTable.') colAgRecordsNotGenerated = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 11, 1, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: colAgRecordsNotGenerated.setStatus('mandatory') if mibBuilder.loadTexts: colAgRecordsNotGenerated.setDescription('This attribute counts the records of a particular event type on this Card which could not be generated by some application due to some problem such as insufficient resources. One cannot tell exactly which event could not be generated, nor which application instance tried to generate it, but when this count increases, it is an indicator that some re-engineering may be required and will provide some idea as to why a record is missing. This counter wraps to 0 when the maximum value is exceeded.') dataCollectionGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 14, 1)) dataCollectionGroupBE = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 14, 1, 5)) dataCollectionGroupBE00 = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 14, 1, 5, 1)) dataCollectionGroupBE00A = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 14, 1, 5, 1, 2)) dataCollectionCapabilities = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 14, 3)) dataCollectionCapabilitiesBE = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 14, 3, 5)) dataCollectionCapabilitiesBE00 = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 14, 3, 5, 1)) dataCollectionCapabilitiesBE00A = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 14, 3, 5, 1, 2)) mibBuilder.exportSymbols("Nortel-Magellan-Passport-DataCollectionMIB", colSpProvEntry=colSpProvEntry, dataCollectionCapabilitiesBE=dataCollectionCapabilitiesBE, colTimesEntry=colTimesEntry, colSpSpooling=colSpSpooling, colAgAgentStatsEntry=colAgAgentStatsEntry, colSpStorageType=colSpStorageType, colProvEntry=colProvEntry, colTimesTable=colTimesTable, colSp=colSp, colAgRowStatusTable=colAgRowStatusTable, colAgRecordsDiscarded=colAgRecordsDiscarded, colRowStatusEntry=colRowStatusEntry, colAgAgentStatsTable=colAgAgentStatsTable, colSpCurrentQueueSize=colSpCurrentQueueSize, colSpSpoolingFileName=colSpSpoolingFileName, colSpOperEntry=colSpOperEntry, dataCollectionMIB=dataCollectionMIB, colSpMaximumNumberOfFiles=colSpMaximumNumberOfFiles, colAg=colAg, colSpComponentName=colSpComponentName, dataCollectionCapabilitiesBE00A=dataCollectionCapabilitiesBE00A, dataCollectionGroup=dataCollectionGroup, colAgentQueueSize=colAgentQueueSize, dataCollectionCapabilities=dataCollectionCapabilities, colRowStatusTable=colRowStatusTable, colSpUsageState=colSpUsageState, colSpStandbyStatus=colSpStandbyStatus, colIndex=colIndex, colLastTable=colLastTable, colSpIndex=colSpIndex, colAgRecordsNotGenerated=colAgRecordsNotGenerated, colPeakRowStatus=colPeakRowStatus, colSpAlarmStatus=colSpAlarmStatus, colTimesRowStatus=colTimesRowStatus, colSpAvailabilityStatus=colSpAvailabilityStatus, colAgIndex=colAgIndex, colSpUnknownStatus=colSpUnknownStatus, colComponentName=colComponentName, colSpRowStatusTable=colSpRowStatusTable, colLastValue=colLastValue, colSpRowStatus=colSpRowStatus, colPeakTable=colPeakTable, colSpRowStatusEntry=colSpRowStatusEntry, colTimesValue=colTimesValue, colSpOperationalState=colSpOperationalState, colAgCurrentQueueSize=colAgCurrentQueueSize, colSpOperTable=colSpOperTable, colCurrentQueueSize=colCurrentQueueSize, dataCollectionGroupBE00A=dataCollectionGroupBE00A, colSpProceduralStatus=colSpProceduralStatus, colSpStateEntry=colSpStateEntry, col=col, colAgStatsEntry=colAgStatsEntry, colSpControlStatus=colSpControlStatus, colStatsTable=colStatsTable, colSpRecordsDiscarded=colSpRecordsDiscarded, colPeakValue=colPeakValue, colSpRecordsRx=colSpRecordsRx, colAgStatsTable=colAgStatsTable, colAgRecordsRx=colAgRecordsRx, colRowStatus=colRowStatus, colAgRowStatusEntry=colAgRowStatusEntry, colSpAdminState=colSpAdminState, colAgComponentName=colAgComponentName, colRecordsRx=colRecordsRx, colAgStorageType=colAgStorageType, colRecordsDiscarded=colRecordsDiscarded, colSpStatsTable=colSpStatsTable, colStatsEntry=colStatsEntry, colSpStatsEntry=colSpStatsEntry, colProvTable=colProvTable, dataCollectionCapabilitiesBE00=dataCollectionCapabilitiesBE00, colStorageType=colStorageType, colAgRowStatus=colAgRowStatus, colSpProvTable=colSpProvTable, colSpStateTable=colSpStateTable, colPeakEntry=colPeakEntry, dataCollectionGroupBE=dataCollectionGroupBE, colLastEntry=colLastEntry, dataCollectionGroupBE00=dataCollectionGroupBE00)
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, constraints_union, value_size_constraint, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ValueRangeConstraint', 'ConstraintsUnion', 'ValueSizeConstraint', 'ConstraintsIntersection') (display_string, storage_type, row_status, unsigned32, integer32, gauge32, counter32) = mibBuilder.importSymbols('Nortel-Magellan-Passport-StandardTextualConventionsMIB', 'DisplayString', 'StorageType', 'RowStatus', 'Unsigned32', 'Integer32', 'Gauge32', 'Counter32') (non_replicated, enterprise_date_and_time, ascii_string) = mibBuilder.importSymbols('Nortel-Magellan-Passport-TextualConventionsMIB', 'NonReplicated', 'EnterpriseDateAndTime', 'AsciiString') (passport_mi_bs, components) = mibBuilder.importSymbols('Nortel-Magellan-Passport-UsefulDefinitionsMIB', 'passportMIBs', 'components') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (mib_scalar, mib_table, mib_table_row, mib_table_column, module_identity, bits, time_ticks, iso, integer32, unsigned32, ip_address, counter64, gauge32, counter32, object_identity, mib_identifier, notification_type) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ModuleIdentity', 'Bits', 'TimeTicks', 'iso', 'Integer32', 'Unsigned32', 'IpAddress', 'Counter64', 'Gauge32', 'Counter32', 'ObjectIdentity', 'MibIdentifier', 'NotificationType') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') data_collection_mib = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 14)) col = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21)) col_row_status_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 1)) if mibBuilder.loadTexts: colRowStatusTable.setStatus('mandatory') if mibBuilder.loadTexts: colRowStatusTable.setDescription('This entry controls the addition and deletion of col components.') col_row_status_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 1, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colIndex')) if mibBuilder.loadTexts: colRowStatusEntry.setStatus('mandatory') if mibBuilder.loadTexts: colRowStatusEntry.setDescription('A single entry in the table represents a single col component.') col_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 1, 1, 1), row_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: colRowStatus.setStatus('mandatory') if mibBuilder.loadTexts: colRowStatus.setDescription('This variable is used as the basis for SNMP naming of col components. These components can be added.') col_component_name = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 1, 1, 2), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: colComponentName.setStatus('mandatory') if mibBuilder.loadTexts: colComponentName.setDescription("This variable provides the component's string name for use with the ASCII Console Interface") col_storage_type = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 1, 1, 4), storage_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: colStorageType.setStatus('mandatory') if mibBuilder.loadTexts: colStorageType.setDescription('This variable represents the storage type value for the col tables.') col_index = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 1, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('accounting', 0), ('alarm', 1), ('log', 2), ('debug', 3), ('scn', 4), ('trap', 5), ('stats', 6)))) if mibBuilder.loadTexts: colIndex.setStatus('mandatory') if mibBuilder.loadTexts: colIndex.setDescription('This variable represents the index for the col tables.') col_prov_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 10)) if mibBuilder.loadTexts: colProvTable.setStatus('mandatory') if mibBuilder.loadTexts: colProvTable.setDescription('This group specifies all of the provisioning data for a DCS Collector.') col_prov_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 10, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colIndex')) if mibBuilder.loadTexts: colProvEntry.setStatus('mandatory') if mibBuilder.loadTexts: colProvEntry.setDescription('An entry in the colProvTable.') col_agent_queue_size = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 10, 1, 1), unsigned32().subtype(subtypeSpec=constraints_union(value_range_constraint(0, 0), value_range_constraint(20, 10000)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: colAgentQueueSize.setStatus('obsolete') if mibBuilder.loadTexts: colAgentQueueSize.setDescription("This attribute has been replaced with the agentQueueSize attribute in the Lp Engineering DataStream Ov component. Upon migration, if the existing provisioned value of this attribute is the same as the system default for this type of data, no new components are added because the default is what the DataStream component already would be using. Otherwise, if the value is not the same as the system default, then for each Lp which is provisioned at the time of the migration, a DataStream is provisioned and the Ov's agentQueueSize is set to the non-default value.") col_stats_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 11)) if mibBuilder.loadTexts: colStatsTable.setStatus('mandatory') if mibBuilder.loadTexts: colStatsTable.setDescription('This group specifies the statistics operational attributes of the DCS Collector, Agent and Spooler components.') col_stats_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 11, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colIndex')) if mibBuilder.loadTexts: colStatsEntry.setStatus('mandatory') if mibBuilder.loadTexts: colStatsEntry.setDescription('An entry in the colStatsTable.') col_current_queue_size = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 11, 1, 1), gauge32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readonly') if mibBuilder.loadTexts: colCurrentQueueSize.setStatus('mandatory') if mibBuilder.loadTexts: colCurrentQueueSize.setDescription('This gauge contains the current number of records held by this DCS component.') col_records_rx = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 11, 1, 2), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: colRecordsRx.setStatus('mandatory') if mibBuilder.loadTexts: colRecordsRx.setDescription('This counter contains the cumulative number of records received by a DCS component, from applications which send data to it, since the processor last restarted. This counter wraps to 0 when the maximum value is exceeded.') col_records_discarded = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 11, 1, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: colRecordsDiscarded.setStatus('mandatory') if mibBuilder.loadTexts: colRecordsDiscarded.setDescription('This is the cumulative number of records discarded by this DCS component since the processor last restarted. This counter wraps to 0 when the maximum value is exceeded.') col_times_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 266)) if mibBuilder.loadTexts: colTimesTable.setStatus('mandatory') if mibBuilder.loadTexts: colTimesTable.setDescription('This attribute specifies the scheduled times at which data should be collected. Only accounting applications need the capability to generate data in this way. Setting this attribute for other streams has no effect. The user can enter the times in any order and duplicates are prevented at data entry. There is a limit of 24 entries, which is imposed at semantic check time. The collection times are triggered in chronological order. A semantic check error is issued if any 2 entries are less than 1 hour apart or if any 2 entries are more than 12 hours apart (which implies that if any entries are provided, there must be at least 2 entries). Note that by default (that is, in the absence of a provisioned schedule), a Virtual Circuit (VC) starts its own 12-hour accounting timer. If any collection times are provisioned here, then the Time- Of-Day-Accounting (TODA) method is used in place of 12-hour accounting. This is applicable to both Switched VCs and Permanent VCs.') col_times_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 266, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colIndex'), (0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colTimesValue')) if mibBuilder.loadTexts: colTimesEntry.setStatus('mandatory') if mibBuilder.loadTexts: colTimesEntry.setDescription('An entry in the colTimesTable.') col_times_value = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 266, 1, 1), enterprise_date_and_time().subtype(subtypeSpec=value_size_constraint(5, 5)).setFixedLength(5)).setMaxAccess('readwrite') if mibBuilder.loadTexts: colTimesValue.setStatus('mandatory') if mibBuilder.loadTexts: colTimesValue.setDescription('This variable represents both the value and the index for the colTimesTable.') col_times_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 266, 1, 2), row_status()).setMaxAccess('writeonly') if mibBuilder.loadTexts: colTimesRowStatus.setStatus('mandatory') if mibBuilder.loadTexts: colTimesRowStatus.setDescription('This variable is used to control the addition and deletion of individual values of the colTimesTable.') col_last_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 275)) if mibBuilder.loadTexts: colLastTable.setStatus('obsolete') if mibBuilder.loadTexts: colLastTable.setDescription('Note: This was made obsolete in R4.1 (BD0108A). This attribute is used for Collector/stats and Collector/account. For statistics, when collection is turned off, or prior to the very first probe, the value is the empty list. Otherwise, this is the network time at which the last probe was sent out (that is, the last time that statistics were collected from, or at least reset by, the applications providing them). For accounting, when no entries exist in collectionTimes, or prior to the very first collection time, the value is the empty list. Otherwise, this is the network time at which the last time-of-day changeover occurred.') col_last_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 275, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colIndex'), (0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colLastValue')) if mibBuilder.loadTexts: colLastEntry.setStatus('obsolete') if mibBuilder.loadTexts: colLastEntry.setDescription('An entry in the colLastTable.') col_last_value = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 275, 1, 1), enterprise_date_and_time().subtype(subtypeSpec=value_size_constraint(19, 19)).setFixedLength(19)).setMaxAccess('readonly') if mibBuilder.loadTexts: colLastValue.setStatus('obsolete') if mibBuilder.loadTexts: colLastValue.setDescription('This variable represents both the value and the index for the colLastTable.') col_peak_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 279)) if mibBuilder.loadTexts: colPeakTable.setStatus('mandatory') if mibBuilder.loadTexts: colPeakTable.setDescription('This attribute specifies the length of the accounting peak water mark interval. It is at least one minute and at most 15 minutes long. An accounting peak water mark within a given accounting interval is the accounting count which occured during a peak water mark interval with the highest traffic. Peak water marks are used to determine traffic bursts. If no value is provisioned for this attribute value of 5 minutes is assumed. Peak water mark is only measured if attribute collectionTimes in Collector/account is provisioned.') col_peak_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 279, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colIndex'), (0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colPeakValue')) if mibBuilder.loadTexts: colPeakEntry.setStatus('mandatory') if mibBuilder.loadTexts: colPeakEntry.setDescription('An entry in the colPeakTable.') col_peak_value = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 279, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 15))).setMaxAccess('readwrite') if mibBuilder.loadTexts: colPeakValue.setStatus('mandatory') if mibBuilder.loadTexts: colPeakValue.setDescription('This variable represents both the value and the index for the colPeakTable.') col_peak_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 279, 1, 2), row_status()).setMaxAccess('writeonly') if mibBuilder.loadTexts: colPeakRowStatus.setStatus('mandatory') if mibBuilder.loadTexts: colPeakRowStatus.setDescription('This variable is used to control the addition and deletion of individual values of the colPeakTable.') col_sp = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2)) col_sp_row_status_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 1)) if mibBuilder.loadTexts: colSpRowStatusTable.setStatus('mandatory') if mibBuilder.loadTexts: colSpRowStatusTable.setDescription('This entry controls the addition and deletion of colSp components.') col_sp_row_status_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 1, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colIndex'), (0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colSpIndex')) if mibBuilder.loadTexts: colSpRowStatusEntry.setStatus('mandatory') if mibBuilder.loadTexts: colSpRowStatusEntry.setDescription('A single entry in the table represents a single colSp component.') col_sp_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 1, 1, 1), row_status()).setMaxAccess('readonly') if mibBuilder.loadTexts: colSpRowStatus.setStatus('mandatory') if mibBuilder.loadTexts: colSpRowStatus.setDescription('This variable is used as the basis for SNMP naming of colSp components. These components cannot be added nor deleted.') col_sp_component_name = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 1, 1, 2), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: colSpComponentName.setStatus('mandatory') if mibBuilder.loadTexts: colSpComponentName.setDescription("This variable provides the component's string name for use with the ASCII Console Interface") col_sp_storage_type = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 1, 1, 4), storage_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: colSpStorageType.setStatus('mandatory') if mibBuilder.loadTexts: colSpStorageType.setDescription('This variable represents the storage type value for the colSp tables.') col_sp_index = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 1, 1, 10), non_replicated()) if mibBuilder.loadTexts: colSpIndex.setStatus('mandatory') if mibBuilder.loadTexts: colSpIndex.setDescription('This variable represents the index for the colSp tables.') col_sp_prov_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 10)) if mibBuilder.loadTexts: colSpProvTable.setStatus('mandatory') if mibBuilder.loadTexts: colSpProvTable.setDescription('This group specifies all of the provisioning data for a DCS Spooler.') col_sp_prov_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 10, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colIndex'), (0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colSpIndex')) if mibBuilder.loadTexts: colSpProvEntry.setStatus('mandatory') if mibBuilder.loadTexts: colSpProvEntry.setDescription('An entry in the colSpProvTable.') col_sp_spooling = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 10, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('off', 0), ('on', 1)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: colSpSpooling.setStatus('mandatory') if mibBuilder.loadTexts: colSpSpooling.setDescription('This attribute specifies whether or not this type of data is spooled to the disk. If set to off, it is roughly equivalent to Locking the Spooler (except this will survive processor restarts). The following defaults are used: - alarm: on - accounting: on - log: on - debug: off - scn: on - trap: off (see Note below) - stats: on Note that SNMP Traps cannot be spooled. A semantic check prevents the user from setting the value to on for the trap stream.') col_sp_maximum_number_of_files = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 10, 1, 2), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 200))).setMaxAccess('readwrite') if mibBuilder.loadTexts: colSpMaximumNumberOfFiles.setStatus('mandatory') if mibBuilder.loadTexts: colSpMaximumNumberOfFiles.setDescription("This attribute specifies the maximum number of files that should be kept on the disk in the directory containing the closed files of this type. The value 0 is defined to mean 'unlimited'. A different default for each type of Spooler is defined as follows: - alarm: 30 - accounting: 200 - debug: 2 - log: 10 - scn: 10 - trap: 2 (this value is meaningless and is ignored) - stats: 200") col_sp_state_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 11)) if mibBuilder.loadTexts: colSpStateTable.setStatus('mandatory') if mibBuilder.loadTexts: colSpStateTable.setDescription('This group contains the three OSI State attributes and the six OSI Status attributes. The descriptions generically indicate what each attribute implies about the component. Note that not all the values and state combinations described here are supported by every component which uses this group. For component-specific information and the valid state combinations, refer to NTP 241- 7001-150, Passport Operations and Maintenance Guide.') col_sp_state_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 11, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colIndex'), (0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colSpIndex')) if mibBuilder.loadTexts: colSpStateEntry.setStatus('mandatory') if mibBuilder.loadTexts: colSpStateEntry.setDescription('An entry in the colSpStateTable.') col_sp_admin_state = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 11, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('locked', 0), ('unlocked', 1), ('shuttingDown', 2))).clone('unlocked')).setMaxAccess('readonly') if mibBuilder.loadTexts: colSpAdminState.setStatus('mandatory') if mibBuilder.loadTexts: colSpAdminState.setDescription('This attribute indicates the OSI Administrative State of the component. The value locked indicates that the component is administratively prohibited from providing services for its users. A Lock or Lock - force command has been previously issued for this component. When the value is locked, the value of usageState must be idle. The value shuttingDown indicates that the component is administratively permitted to provide service to its existing users only. A Lock command was issued against the component and it is in the process of shutting down. The value unlocked indicates that the component is administratively permitted to provide services for its users. To enter this state, issue an Unlock command to this component. The OSI Status attributes, if supported by the component, may provide more details, qualifying the state of the component.') col_sp_operational_state = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 11, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('disabled', 0), ('enabled', 1))).clone('disabled')).setMaxAccess('readonly') if mibBuilder.loadTexts: colSpOperationalState.setStatus('mandatory') if mibBuilder.loadTexts: colSpOperationalState.setDescription('This attribute indicates the OSI Operational State of the component. The value enabled indicates that the component is available for operation. Note that if adminState is locked, it would still not be providing service. The value disabled indicates that the component is not available for operation. For example, something is wrong with the component itself, or with another component on which this one depends. If the value is disabled, the usageState must be idle. The OSI Status attributes, if supported by the component, may provide more details, qualifying the state of the component.') col_sp_usage_state = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 11, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('idle', 0), ('active', 1), ('busy', 2))).clone('idle')).setMaxAccess('readonly') if mibBuilder.loadTexts: colSpUsageState.setStatus('mandatory') if mibBuilder.loadTexts: colSpUsageState.setDescription('This attribute indicates the OSI Usage State of the component. The value idle indicates that the component is not currently in use. The value active indicates that the component is in use and has spare capacity to provide for additional users. The value busy indicates that the component is in use and has no spare operating capacity for additional users at this time. The OSI Status attributes, if supported by the component, may provide more details, qualifying the state of the component.') col_sp_availability_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 11, 1, 4), octet_string().subtype(subtypeSpec=value_size_constraint(2, 2)).setFixedLength(2)).setMaxAccess('readonly') if mibBuilder.loadTexts: colSpAvailabilityStatus.setStatus('mandatory') if mibBuilder.loadTexts: colSpAvailabilityStatus.setDescription('If supported by the component, this attribute indicates the OSI Availability status of the component. Note that, even though it is defined as a multi-valued set, at most one value is shown to the user. When no values are in the set, this indicates that either the attribute is not supported or that none of the status conditions described below are present. The value inTest indicates that the resource is undergoing a test procedure. If adminState is locked or shuttingDown, the normal users are precluded from using the resource and controlStatus is reservedForTest. Tests that do not exclude additional users can be present in any operational or administrative state but the reservedForTest condition should not be present. The value failed indicates that the component has an internal fault that prevents it from operating. The operationalState is disabled. The value dependency indicates that the component cannot operate because some other resource on which it depends is unavailable. The operationalState is disabled. The value powerOff indicates the resource requires power to be applied and it is not powered on. The operationalState is disabled. The value offLine indicates the resource requires a routine operation (either manual, automatic, or both) to be performed to place it on-line and make it available for use. The operationalState is disabled. The value offDuty indicates the resource is inactive in accordance with a predetermined time schedule. In the absence of other disabling conditions, the operationalState is enabled or disabled. The value degraded indicates the service provided by the component is degraded in some way, such as in speed or operating capacity. However, the resource remains available for service. The operationalState is enabled. The value notInstalled indicates the resource is not present. The operationalState is disabled. The value logFull is not used. Description of bits: inTest(0) failed(1) powerOff(2) offLine(3) offDuty(4) dependency(5) degraded(6) notInstalled(7) logFull(8)') col_sp_procedural_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 11, 1, 5), octet_string().subtype(subtypeSpec=value_size_constraint(1, 1)).setFixedLength(1)).setMaxAccess('readonly') if mibBuilder.loadTexts: colSpProceduralStatus.setStatus('mandatory') if mibBuilder.loadTexts: colSpProceduralStatus.setDescription("If supported by the component, this attribute indicates the OSI Procedural status of the component. Note that, even though it is defined as a multi-valued set, at most one value is shown to the user. When no values are in the set, this indicates that either the attribute is not supported or that none of the status conditions described below are present. The value initializationRequired indicates (for a resource which doesn't initialize autonomously) that initialization is required before it can perform its normal functions, and this procedure has not been initiated. The operationalState is disabled. The value notInitialized indicates (for a resource which does initialize autonomously) that initialization is required before it can perform its normal functions, and this procedure has not been initiated. The operationalState may be enabled or disabled. The value initializing indicates that initialization has been initiated but is not yet complete. The operationalState may be enabled or disabled. The value reporting indicates the resource has completed some processing operation and is notifying the results. The operationalState is enabled. The value terminating indicates the component is in a termination phase. If the resource doesn't reinitialize autonomously, operationalState is disabled; otherwise it is enabled or disabled. Description of bits: initializationRequired(0) notInitialized(1) initializing(2) reporting(3) terminating(4)") col_sp_control_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 11, 1, 6), octet_string().subtype(subtypeSpec=value_size_constraint(1, 1)).setFixedLength(1)).setMaxAccess('readonly') if mibBuilder.loadTexts: colSpControlStatus.setStatus('mandatory') if mibBuilder.loadTexts: colSpControlStatus.setDescription('If supported by the component, this attribute indicates the OSI Control status of the component. Note that, even though it is defined as a multi-valued set, at most one value is shown to the user. When no values are in the set, this indicates that either the attribute is not supported or that none of the status conditions described below are present. The value subjectToTest indicates the resource is available but tests may be conducted simultaneously at unpredictable times, which may cause it to exhibit unusual characteristics. The value partOfServicesLocked indicates that part of the service is restricted from users of a resource. The adminState is unlocked. The value reservedForTest indicates that the component is administratively unavailable because it is undergoing a test procedure. The adminState is locked. The value suspended indicates that the service has been administratively suspended. Description of bits: subjectToTest(0) partOfServicesLocked(1) reservedForTest(2) suspended(3)') col_sp_alarm_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 11, 1, 7), octet_string().subtype(subtypeSpec=value_size_constraint(1, 1)).setFixedLength(1)).setMaxAccess('readonly') if mibBuilder.loadTexts: colSpAlarmStatus.setStatus('mandatory') if mibBuilder.loadTexts: colSpAlarmStatus.setDescription('If supported by the component, this attribute indicates the OSI Alarm status of the component. Note that, even though it is defined as a multi-valued set, at most one value is shown to the user. When no values are in the set, this indicates that either the attribute is not supported or that none of the status conditions described below are present. The value underRepair indicates the component is currently being repaired. The operationalState is enabled or disabled. The value critical indicates one or more critical alarms are outstanding against the component. Other, less severe, alarms may also be outstanding. The operationalState is enabled or disabled. The value major indicates one or more major alarms are outstanding against the component. Other, less severe, alarms may also be outstanding. The operationalState is enabled or disabled. The value minor indicates one or more minor alarms are outstanding against the component. Other, less severe, alarms may also be outstanding. The operationalState is enabled or disabled. The value alarmOutstanding generically indicates that an alarm of some severity is outstanding against the component. Description of bits: underRepair(0) critical(1) major(2) minor(3) alarmOutstanding(4)') col_sp_standby_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 11, 1, 8), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 15))).clone(namedValues=named_values(('hotStandby', 0), ('coldStandby', 1), ('providingService', 2), ('notSet', 15))).clone('notSet')).setMaxAccess('readonly') if mibBuilder.loadTexts: colSpStandbyStatus.setStatus('mandatory') if mibBuilder.loadTexts: colSpStandbyStatus.setDescription('If supported by the component, this attribute indicates the OSI Standby status of the component. The value notSet indicates that either the attribute is not supported or that none of the status conditions described below are present. Note that this is a non-standard value, used because the original specification indicated this attribute was set-valued and thus, did not provide a value to indicate that none of the other three are applicable. The value hotStandby indicates that the resource is not providing service but will be immediately able to take over the role of the resource to be backed up, without initialization activity, and containing the same information as the resource to be backed up. The value coldStandby indicates the resource is a backup for another resource but will not be immediately able to take over the role of the backed up resource and will require some initialization activity. The value providingService indicates that this component, as a backup resource, is currently backing up another resource.') col_sp_unknown_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 11, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('false', 0), ('true', 1))).clone('false')).setMaxAccess('readonly') if mibBuilder.loadTexts: colSpUnknownStatus.setStatus('mandatory') if mibBuilder.loadTexts: colSpUnknownStatus.setDescription('This attribute indicates the OSI Unknown status of the component. The value false indicates that all of the other OSI State and Status attribute values can be considered accurate. The value true indicates that the actual state of the component is not known for sure.') col_sp_oper_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 12)) if mibBuilder.loadTexts: colSpOperTable.setStatus('mandatory') if mibBuilder.loadTexts: colSpOperTable.setDescription('This group contains the operational attributes specific to a DCS Spooler.') col_sp_oper_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 12, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colIndex'), (0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colSpIndex')) if mibBuilder.loadTexts: colSpOperEntry.setStatus('mandatory') if mibBuilder.loadTexts: colSpOperEntry.setDescription('An entry in the colSpOperTable.') col_sp_spooling_file_name = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 12, 1, 1), ascii_string().subtype(subtypeSpec=value_size_constraint(0, 128))).setMaxAccess('readonly') if mibBuilder.loadTexts: colSpSpoolingFileName.setStatus('mandatory') if mibBuilder.loadTexts: colSpSpoolingFileName.setDescription('When spooling is on, this attribute contains the name of the open file into which data is currently being spooled. When spooling is off, the value of this attribute is the empty string.') col_sp_stats_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 13)) if mibBuilder.loadTexts: colSpStatsTable.setStatus('mandatory') if mibBuilder.loadTexts: colSpStatsTable.setDescription('This group specifies the statistics operational attributes of the DCS Collector, Agent and Spooler components.') col_sp_stats_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 13, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colIndex'), (0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colSpIndex')) if mibBuilder.loadTexts: colSpStatsEntry.setStatus('mandatory') if mibBuilder.loadTexts: colSpStatsEntry.setDescription('An entry in the colSpStatsTable.') col_sp_current_queue_size = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 13, 1, 1), gauge32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readonly') if mibBuilder.loadTexts: colSpCurrentQueueSize.setStatus('mandatory') if mibBuilder.loadTexts: colSpCurrentQueueSize.setDescription('This gauge contains the current number of records held by this DCS component.') col_sp_records_rx = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 13, 1, 2), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: colSpRecordsRx.setStatus('mandatory') if mibBuilder.loadTexts: colSpRecordsRx.setDescription('This counter contains the cumulative number of records received by a DCS component, from applications which send data to it, since the processor last restarted. This counter wraps to 0 when the maximum value is exceeded.') col_sp_records_discarded = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 2, 13, 1, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: colSpRecordsDiscarded.setStatus('mandatory') if mibBuilder.loadTexts: colSpRecordsDiscarded.setDescription('This is the cumulative number of records discarded by this DCS component since the processor last restarted. This counter wraps to 0 when the maximum value is exceeded.') col_ag = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3)) col_ag_row_status_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 1)) if mibBuilder.loadTexts: colAgRowStatusTable.setStatus('mandatory') if mibBuilder.loadTexts: colAgRowStatusTable.setDescription('*** THIS TABLE CURRENTLY NOT IMPLEMENTED *** This entry controls the addition and deletion of colAg components.') col_ag_row_status_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 1, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colIndex'), (0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colAgIndex')) if mibBuilder.loadTexts: colAgRowStatusEntry.setStatus('mandatory') if mibBuilder.loadTexts: colAgRowStatusEntry.setDescription('A single entry in the table represents a single colAg component.') col_ag_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 1, 1, 1), row_status()).setMaxAccess('readonly') if mibBuilder.loadTexts: colAgRowStatus.setStatus('mandatory') if mibBuilder.loadTexts: colAgRowStatus.setDescription('This variable is used as the basis for SNMP naming of colAg components. These components cannot be added nor deleted.') col_ag_component_name = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 1, 1, 2), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: colAgComponentName.setStatus('mandatory') if mibBuilder.loadTexts: colAgComponentName.setDescription("This variable provides the component's string name for use with the ASCII Console Interface") col_ag_storage_type = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 1, 1, 4), storage_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: colAgStorageType.setStatus('mandatory') if mibBuilder.loadTexts: colAgStorageType.setDescription('This variable represents the storage type value for the colAg tables.') col_ag_index = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 1, 1, 10), integer32().subtype(subtypeSpec=value_range_constraint(0, 15))) if mibBuilder.loadTexts: colAgIndex.setStatus('mandatory') if mibBuilder.loadTexts: colAgIndex.setDescription('This variable represents the index for the colAg tables.') col_ag_stats_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 10)) if mibBuilder.loadTexts: colAgStatsTable.setStatus('mandatory') if mibBuilder.loadTexts: colAgStatsTable.setDescription('*** THIS TABLE CURRENTLY NOT IMPLEMENTED *** This group specifies the statistics operational attributes of the DCS Collector, Agent and Spooler components.') col_ag_stats_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 10, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colIndex'), (0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colAgIndex')) if mibBuilder.loadTexts: colAgStatsEntry.setStatus('mandatory') if mibBuilder.loadTexts: colAgStatsEntry.setDescription('An entry in the colAgStatsTable.') col_ag_current_queue_size = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 10, 1, 1), gauge32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readonly') if mibBuilder.loadTexts: colAgCurrentQueueSize.setStatus('mandatory') if mibBuilder.loadTexts: colAgCurrentQueueSize.setDescription('This gauge contains the current number of records held by this DCS component.') col_ag_records_rx = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 10, 1, 2), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: colAgRecordsRx.setStatus('mandatory') if mibBuilder.loadTexts: colAgRecordsRx.setDescription('This counter contains the cumulative number of records received by a DCS component, from applications which send data to it, since the processor last restarted. This counter wraps to 0 when the maximum value is exceeded.') col_ag_records_discarded = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 10, 1, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: colAgRecordsDiscarded.setStatus('mandatory') if mibBuilder.loadTexts: colAgRecordsDiscarded.setDescription('This is the cumulative number of records discarded by this DCS component since the processor last restarted. This counter wraps to 0 when the maximum value is exceeded.') col_ag_agent_stats_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 11)) if mibBuilder.loadTexts: colAgAgentStatsTable.setStatus('mandatory') if mibBuilder.loadTexts: colAgAgentStatsTable.setDescription('*** THIS TABLE CURRENTLY NOT IMPLEMENTED *** This group contains the statistical attributes specific to the DCS Agent components.') col_ag_agent_stats_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 11, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colIndex'), (0, 'Nortel-Magellan-Passport-DataCollectionMIB', 'colAgIndex')) if mibBuilder.loadTexts: colAgAgentStatsEntry.setStatus('mandatory') if mibBuilder.loadTexts: colAgAgentStatsEntry.setDescription('An entry in the colAgAgentStatsTable.') col_ag_records_not_generated = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 21, 3, 11, 1, 1), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: colAgRecordsNotGenerated.setStatus('mandatory') if mibBuilder.loadTexts: colAgRecordsNotGenerated.setDescription('This attribute counts the records of a particular event type on this Card which could not be generated by some application due to some problem such as insufficient resources. One cannot tell exactly which event could not be generated, nor which application instance tried to generate it, but when this count increases, it is an indicator that some re-engineering may be required and will provide some idea as to why a record is missing. This counter wraps to 0 when the maximum value is exceeded.') data_collection_group = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 14, 1)) data_collection_group_be = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 14, 1, 5)) data_collection_group_be00 = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 14, 1, 5, 1)) data_collection_group_be00_a = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 14, 1, 5, 1, 2)) data_collection_capabilities = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 14, 3)) data_collection_capabilities_be = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 14, 3, 5)) data_collection_capabilities_be00 = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 14, 3, 5, 1)) data_collection_capabilities_be00_a = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 14, 3, 5, 1, 2)) mibBuilder.exportSymbols('Nortel-Magellan-Passport-DataCollectionMIB', colSpProvEntry=colSpProvEntry, dataCollectionCapabilitiesBE=dataCollectionCapabilitiesBE, colTimesEntry=colTimesEntry, colSpSpooling=colSpSpooling, colAgAgentStatsEntry=colAgAgentStatsEntry, colSpStorageType=colSpStorageType, colProvEntry=colProvEntry, colTimesTable=colTimesTable, colSp=colSp, colAgRowStatusTable=colAgRowStatusTable, colAgRecordsDiscarded=colAgRecordsDiscarded, colRowStatusEntry=colRowStatusEntry, colAgAgentStatsTable=colAgAgentStatsTable, colSpCurrentQueueSize=colSpCurrentQueueSize, colSpSpoolingFileName=colSpSpoolingFileName, colSpOperEntry=colSpOperEntry, dataCollectionMIB=dataCollectionMIB, colSpMaximumNumberOfFiles=colSpMaximumNumberOfFiles, colAg=colAg, colSpComponentName=colSpComponentName, dataCollectionCapabilitiesBE00A=dataCollectionCapabilitiesBE00A, dataCollectionGroup=dataCollectionGroup, colAgentQueueSize=colAgentQueueSize, dataCollectionCapabilities=dataCollectionCapabilities, colRowStatusTable=colRowStatusTable, colSpUsageState=colSpUsageState, colSpStandbyStatus=colSpStandbyStatus, colIndex=colIndex, colLastTable=colLastTable, colSpIndex=colSpIndex, colAgRecordsNotGenerated=colAgRecordsNotGenerated, colPeakRowStatus=colPeakRowStatus, colSpAlarmStatus=colSpAlarmStatus, colTimesRowStatus=colTimesRowStatus, colSpAvailabilityStatus=colSpAvailabilityStatus, colAgIndex=colAgIndex, colSpUnknownStatus=colSpUnknownStatus, colComponentName=colComponentName, colSpRowStatusTable=colSpRowStatusTable, colLastValue=colLastValue, colSpRowStatus=colSpRowStatus, colPeakTable=colPeakTable, colSpRowStatusEntry=colSpRowStatusEntry, colTimesValue=colTimesValue, colSpOperationalState=colSpOperationalState, colAgCurrentQueueSize=colAgCurrentQueueSize, colSpOperTable=colSpOperTable, colCurrentQueueSize=colCurrentQueueSize, dataCollectionGroupBE00A=dataCollectionGroupBE00A, colSpProceduralStatus=colSpProceduralStatus, colSpStateEntry=colSpStateEntry, col=col, colAgStatsEntry=colAgStatsEntry, colSpControlStatus=colSpControlStatus, colStatsTable=colStatsTable, colSpRecordsDiscarded=colSpRecordsDiscarded, colPeakValue=colPeakValue, colSpRecordsRx=colSpRecordsRx, colAgStatsTable=colAgStatsTable, colAgRecordsRx=colAgRecordsRx, colRowStatus=colRowStatus, colAgRowStatusEntry=colAgRowStatusEntry, colSpAdminState=colSpAdminState, colAgComponentName=colAgComponentName, colRecordsRx=colRecordsRx, colAgStorageType=colAgStorageType, colRecordsDiscarded=colRecordsDiscarded, colSpStatsTable=colSpStatsTable, colStatsEntry=colStatsEntry, colSpStatsEntry=colSpStatsEntry, colProvTable=colProvTable, dataCollectionCapabilitiesBE00=dataCollectionCapabilitiesBE00, colStorageType=colStorageType, colAgRowStatus=colAgRowStatus, colSpProvTable=colSpProvTable, colSpStateTable=colSpStateTable, colPeakEntry=colPeakEntry, dataCollectionGroupBE=dataCollectionGroupBE, colLastEntry=colLastEntry, dataCollectionGroupBE00=dataCollectionGroupBE00)
numbers = [-1,0] target = -1 hashMap = {} for index, num in enumerate(numbers): diff = target - num if diff in hashMap: print([hashMap[diff]+1, index+1]) hashMap[num] = index
numbers = [-1, 0] target = -1 hash_map = {} for (index, num) in enumerate(numbers): diff = target - num if diff in hashMap: print([hashMap[diff] + 1, index + 1]) hashMap[num] = index
#SCOPE USING NONLOCAL KEYWORD x = 10#GLOBAL VARIABLE X def outer(): x=20#LOCAL VARIABLE X y=30#LOCAL VARIABLE Y print("outer func x before inner call:", x) print("outer func y before inner call:", y) def inner(): nonlocal y#LOCAL VARIABLE Y REFERS TO ITS ABOVE LEVEL OUTER Y global x#REFERS GLOBAL X x=30#MAKS GLOBAL X TO 30 y=40#MAKES LOCAL Y IN OUTER TO 40 print("inner func x :", x) print("inner func y :", y) inner() print("outer func x after inner call:", x) print("outer func y after inner call:", y) print("x before outer call:", x) outer() print("x after outer call:", x) ''' OUTPUT: x before outer call:10 outer func x before inner call:20 outer func y before inner call:30 inner func x :30 inner func y :30 outer func x after inner call:20 outer func y after inner call:40 x before outer call:30'''
x = 10 def outer(): x = 20 y = 30 print('outer func x before inner call:', x) print('outer func y before inner call:', y) def inner(): nonlocal y global x x = 30 y = 40 print('inner func x :', x) print('inner func y :', y) inner() print('outer func x after inner call:', x) print('outer func y after inner call:', y) print('x before outer call:', x) outer() print('x after outer call:', x) '\nOUTPUT:\nx before outer call:10\nouter func x before inner call:20\nouter func y before inner call:30\ninner func x :30\ninner func y :30\nouter func x after inner call:20\nouter func y after inner call:40\nx before outer call:30'
""" 1. Clarification 2. Possible solutions - dp 3. Coding 4. Tests """ # T=O(n), S=O(n) # dp[i][j], i: day, j: # 0 - have a share of stock # 1 - have no stock and cool down next day # 2 - have no stock and no cool down next day class Solution: def maxProfit(self, prices: List[int]) -> int: if not prices: return 0 n = len(prices) dp = [[0] * 3 for _ in range(n)] dp[0][0], dp[0][1], dp[0][2] = -prices[0], 0, 0 for i in range(1, n): dp[i][0] = max(dp[i - 1][0], dp[i - 1][2] - prices[i]) dp[i][1] = dp[i - 1][0] + prices[i] dp[i][2] = max(dp[i - 1][1], dp[i - 1][2]) return max(dp[n - 1][1], dp[n - 1][2])
""" 1. Clarification 2. Possible solutions - dp 3. Coding 4. Tests """ class Solution: def max_profit(self, prices: List[int]) -> int: if not prices: return 0 n = len(prices) dp = [[0] * 3 for _ in range(n)] (dp[0][0], dp[0][1], dp[0][2]) = (-prices[0], 0, 0) for i in range(1, n): dp[i][0] = max(dp[i - 1][0], dp[i - 1][2] - prices[i]) dp[i][1] = dp[i - 1][0] + prices[i] dp[i][2] = max(dp[i - 1][1], dp[i - 1][2]) return max(dp[n - 1][1], dp[n - 1][2])
#======================================================================================================== # TOPIC: PYTHON - Modules #======================================================================================================== # NOTES: * Any Python file is a module. # * Module is a file with Python statements, file extension ".py" # * Modules have classes, functions and variables # * Using the ModuleName.FunctionName is the notation to refer to the # module objects (classes, functions and variables) # * Modules can import other modules. # * The keyword "import <module-name>" is used to import a module # * The keyword "from <module-name> import <function1>" enables the developer to import # specific objects of a module. # * Python comes with a library of standard modules # # #======================================================================================================== # # FILE-NAME : 013_module.py # DEPENDANT-FILES : These are the files and libraries needed to run this program ; # 013_module.py and 013_module_usage.py # # AUTHOR : learnpython.com / Hemaxi # (c) 2013 # # DESC : Python Modules , used to organize code. # #======================================================================================================== # Declare GLOBAL Variables # Some variables country_1 = "USA" country_2 = "China" country_3 = "India" # GLOBAL list list_world_nations = ["USA", "China", "India"] # GLOBAL tuple tuple_world_nations = ("USA", "China", "India") # GLOBAL dictionary dictionary_world_nations = {'Country_1':'USA', 'Country_1':'China', 'Country_1':'India'} # Module Function WITHOUT a return type def module_function_add(in_number1, in_number2): "This function add the two input numbers" return in_number1 + in_number2 #======================================================================================================== # END OF CODE #========================================================================================================
country_1 = 'USA' country_2 = 'China' country_3 = 'India' list_world_nations = ['USA', 'China', 'India'] tuple_world_nations = ('USA', 'China', 'India') dictionary_world_nations = {'Country_1': 'USA', 'Country_1': 'China', 'Country_1': 'India'} def module_function_add(in_number1, in_number2): """This function add the two input numbers""" return in_number1 + in_number2
# Define a sum_of_lengths function that accepts a list of strings. # The function should return the sum of the string lengths. # # EXAMPLES # sum_of_lengths(["Hello", "Bob"]) => 8 # sum_of_lengths(["Nonsense"]) => 8 # sum_of_lengths(["Nonsense", "or", "confidence"]) => 20 def sum_of_lengths(array): sum = 0 for element in array: sum += len(element) return sum print(sum_of_lengths(['Hello', 'Bob'])) print(sum_of_lengths(['Nonsense'])) print(sum_of_lengths(['Nonsense', 'or', 'confidence']))
def sum_of_lengths(array): sum = 0 for element in array: sum += len(element) return sum print(sum_of_lengths(['Hello', 'Bob'])) print(sum_of_lengths(['Nonsense'])) print(sum_of_lengths(['Nonsense', 'or', 'confidence']))
# Generates an infinite series of odd numbers def odds(): n = 1 while True: yield n n += 2 def pi_series(): odd_nums = odds() approximation = 0 while True: approximation += (4 / next(odd_nums)) yield approximation approximation -= (4 / next(odd_nums)) yield approximation approx_pi = pi_series() # The higher the range used here the closer to an acurate approximation of PI. for x in range(10000): print(next(approx_pi))
def odds(): n = 1 while True: yield n n += 2 def pi_series(): odd_nums = odds() approximation = 0 while True: approximation += 4 / next(odd_nums) yield approximation approximation -= 4 / next(odd_nums) yield approximation approx_pi = pi_series() for x in range(10000): print(next(approx_pi))
data = [ {'v': 'v0.1', 't': 1391}, {'v': 'v0.1', 't': 1394}, {'v': 'v0.1', 't': 1300}, {'v': 'v0.1', 't': 1321}, {'v': 'v0.1.3', 't': 1491}, {'v': 'v0.1.3', 't': 1494}, {'v': 'v0.1.3', 't': 1400}, {'v': 'v0.1.3', 't': 1421}, {'v': 'v0.1.2', 't': 1291}, {'v': 'v0.1.2', 't': 1294}, {'v': 'v0.1.2', 't': 1200}, {'v': 'v0.1.2', 't': 1221}, {'v': 'v0.0.2', 't': 294}, {'v': 'v0.0.2', 't': 200}, {'v': 'v0.0.20', 't': 221}, {'v': 'v0.0.20', 't': 294}, {'v': 'v0.0.20', 't': 200}, {'v': 'v0.0.19', 't': 321}, {'v': 'v0.0.19', 't': 294}, {'v': 'v0.0.19', 't': 200}, {'v': 'v0.3', 't': 621}, {'v': 'v0.3', 't': 421}, {'v': 'v0.3', 't': 794}, {'v': 'v0.3', 't': 300}, {'v': 'v0.3', 't': 121} ] def version_str_to_int(version_str: str) -> int: parts = version_str.split('.') if len(parts) > 3: raise VersionError(f'version tag "{version_str}" should only have 3 parts (major, minor, patch numbers)') elif len(parts) == 0: raise VersionError(f'version tag "{version_str}" should have at least major number') major = 0 minor = 0 patch = 0 try: if parts[0][0] == 'v': major = int(parts[0][1:]) else: major = int(parts[0]) if len(parts) > 1: minor = int(parts[1]) if len(parts) > 2: patch = int(parts[2]) except Exception as e: print(f'unable to parse version tag "{version_str}": {e}') version_int = major * 1000 * 1000 + minor * 1000 + patch return version_int data.sort(key=lambda x: (-version_str_to_int(x['v']), -x['t'])) print(data)
data = [{'v': 'v0.1', 't': 1391}, {'v': 'v0.1', 't': 1394}, {'v': 'v0.1', 't': 1300}, {'v': 'v0.1', 't': 1321}, {'v': 'v0.1.3', 't': 1491}, {'v': 'v0.1.3', 't': 1494}, {'v': 'v0.1.3', 't': 1400}, {'v': 'v0.1.3', 't': 1421}, {'v': 'v0.1.2', 't': 1291}, {'v': 'v0.1.2', 't': 1294}, {'v': 'v0.1.2', 't': 1200}, {'v': 'v0.1.2', 't': 1221}, {'v': 'v0.0.2', 't': 294}, {'v': 'v0.0.2', 't': 200}, {'v': 'v0.0.20', 't': 221}, {'v': 'v0.0.20', 't': 294}, {'v': 'v0.0.20', 't': 200}, {'v': 'v0.0.19', 't': 321}, {'v': 'v0.0.19', 't': 294}, {'v': 'v0.0.19', 't': 200}, {'v': 'v0.3', 't': 621}, {'v': 'v0.3', 't': 421}, {'v': 'v0.3', 't': 794}, {'v': 'v0.3', 't': 300}, {'v': 'v0.3', 't': 121}] def version_str_to_int(version_str: str) -> int: parts = version_str.split('.') if len(parts) > 3: raise version_error(f'version tag "{version_str}" should only have 3 parts (major, minor, patch numbers)') elif len(parts) == 0: raise version_error(f'version tag "{version_str}" should have at least major number') major = 0 minor = 0 patch = 0 try: if parts[0][0] == 'v': major = int(parts[0][1:]) else: major = int(parts[0]) if len(parts) > 1: minor = int(parts[1]) if len(parts) > 2: patch = int(parts[2]) except Exception as e: print(f'unable to parse version tag "{version_str}": {e}') version_int = major * 1000 * 1000 + minor * 1000 + patch return version_int data.sort(key=lambda x: (-version_str_to_int(x['v']), -x['t'])) print(data)
def minimum(a): b=list[0] i=0 while i<len(list): if list[i]<b: b=list[i] i=i+1 return(b) list=[5,3,1,6,5,4,7,6] print(minimum(list))
def minimum(a): b = list[0] i = 0 while i < len(list): if list[i] < b: b = list[i] i = i + 1 return b list = [5, 3, 1, 6, 5, 4, 7, 6] print(minimum(list))
__about__="Class method vs Static Method." class MyClass: def method(self): print("Instance of method called", self) @classmethod def classmethod(cls): print("Instance of classmethod called", cls) @staticmethod def staticmethod(): print("Instance of staticmethod called")
__about__ = 'Class method vs Static Method.' class Myclass: def method(self): print('Instance of method called', self) @classmethod def classmethod(cls): print('Instance of classmethod called', cls) @staticmethod def staticmethod(): print('Instance of staticmethod called')
''' Class for adding the expreimental data for the cell model ''' class Experimental: def __init__(self): self.experimental_data = dict() def define_exp(self, **kwargs): for exp_type, data in kwargs.items(): self.experimental_data.update({exp_type: data})
""" Class for adding the expreimental data for the cell model """ class Experimental: def __init__(self): self.experimental_data = dict() def define_exp(self, **kwargs): for (exp_type, data) in kwargs.items(): self.experimental_data.update({exp_type: data})
def get_hard_coded_app_id_dict(): # Matches, manually added, from game names to Steam appIDs hard_coded_dict = { # Manually fix matches for which the automatic name matching (based on Levenshtein distance) is wrong: "The Missing": "842910", "Pillars of Eternity 2": "560130", "Dragon Quest XI": "742120", "DRAGON QUEST XI: Echoes of an Elusive Age": "742120", "Dragon Quest XI: Echoes of an Elusive Age": "742120", "Dragon Quest XI: Shadows of an Elusive Age": "742120", "Atelier Rorona ~The Alchemist of Arland~ DX": "936160", "Megaman 11": "742300", "Mega Man 11": "742300", "Ys VIII: Lacrimosa of DANA": "579180", "The Curse of the Pharaohs (Assassin's Creed Origins)": "662351", "ATOM RPG": "552620", "Spider-Man": "-1", "F76": "-2", "Deltarune": "-4", "DELTARUNE": "-4", "The Orb Vallis (Warframe Expansion)": "-101", "CSGO: Danger Zone": "-102", "Epic Game Launcher": "-201", } return hard_coded_dict def check_database_of_problematic_game_names(game_name): hard_coded_dict = get_hard_coded_app_id_dict() is_a_problematic_game_name = bool(game_name in hard_coded_dict.keys()) return is_a_problematic_game_name def find_hard_coded_app_id(game_name_input): hard_coded_dict = get_hard_coded_app_id_dict() hard_coded_app_id = hard_coded_dict[game_name_input] return hard_coded_app_id if __name__ == '__main__': hard_coded_dict = get_hard_coded_app_id_dict()
def get_hard_coded_app_id_dict(): hard_coded_dict = {'The Missing': '842910', 'Pillars of Eternity 2': '560130', 'Dragon Quest XI': '742120', 'DRAGON QUEST XI: Echoes of an Elusive Age': '742120', 'Dragon Quest XI: Echoes of an Elusive Age': '742120', 'Dragon Quest XI: Shadows of an Elusive Age': '742120', 'Atelier Rorona ~The Alchemist of Arland~ DX': '936160', 'Megaman 11': '742300', 'Mega Man 11': '742300', 'Ys VIII: Lacrimosa of DANA': '579180', "The Curse of the Pharaohs (Assassin's Creed Origins)": '662351', 'ATOM RPG': '552620', 'Spider-Man': '-1', 'F76': '-2', 'Deltarune': '-4', 'DELTARUNE': '-4', 'The Orb Vallis (Warframe Expansion)': '-101', 'CSGO: Danger Zone': '-102', 'Epic Game Launcher': '-201'} return hard_coded_dict def check_database_of_problematic_game_names(game_name): hard_coded_dict = get_hard_coded_app_id_dict() is_a_problematic_game_name = bool(game_name in hard_coded_dict.keys()) return is_a_problematic_game_name def find_hard_coded_app_id(game_name_input): hard_coded_dict = get_hard_coded_app_id_dict() hard_coded_app_id = hard_coded_dict[game_name_input] return hard_coded_app_id if __name__ == '__main__': hard_coded_dict = get_hard_coded_app_id_dict()
rates = list() # Equals to: rates = [] genres = list() ages = list() another_one = True while another_one: genre = input('Please enter your genre (either M or F): ') genres.append(genre) age = int(input('Type your age: ')) ages.append(age) rate = input('You rate the product as ' '1-unsatisfactory 2-bad 3-regular 4-good 5-great: ') rates.append(rate) print() another_one = input('Do you want to add another client\'s rate (Y/N): ') print() if another_one == 'N': another_one = False counter = 0 females = 0 females_40 = 0 females_50 = 0 men_rate_un = 0 while counter < len(genres): if genres[counter] == "F": females += 1 if ages[counter] > 50 and rates[counter] == 4: females_50 += 1 elif ages[counter] > 40 and rates[counter] == 4: females_40 += 1 else: if rates[counter] == 1: men_rate_un += 1 counter += 1 men = len(genres) - females print(f'{females_40} women over 40 years old rated the product as good.') print(f'{females_50} women over 50 years old rated the product as good.') print(f'{men_rate_un} men rated the product as unsatisfactory.') print(f'{females} women partipated in the survey.') print(f'{men} men partipated in the survey.')
rates = list() genres = list() ages = list() another_one = True while another_one: genre = input('Please enter your genre (either M or F): ') genres.append(genre) age = int(input('Type your age: ')) ages.append(age) rate = input('You rate the product as 1-unsatisfactory 2-bad 3-regular 4-good 5-great: ') rates.append(rate) print() another_one = input("Do you want to add another client's rate (Y/N): ") print() if another_one == 'N': another_one = False counter = 0 females = 0 females_40 = 0 females_50 = 0 men_rate_un = 0 while counter < len(genres): if genres[counter] == 'F': females += 1 if ages[counter] > 50 and rates[counter] == 4: females_50 += 1 elif ages[counter] > 40 and rates[counter] == 4: females_40 += 1 elif rates[counter] == 1: men_rate_un += 1 counter += 1 men = len(genres) - females print(f'{females_40} women over 40 years old rated the product as good.') print(f'{females_50} women over 50 years old rated the product as good.') print(f'{men_rate_un} men rated the product as unsatisfactory.') print(f'{females} women partipated in the survey.') print(f'{men} men partipated in the survey.')
def euclidean_distance(x1, y1, x2, y2): """Compute euclidean distance between two points.""" def which_start_and_pitstop(pitstop_num, pitstop_coords, start_coords): """Computes the relevant pitstop and startpoint info. Extracts the pitstop coordinates, relevant startpoint number and startpoint coordinates and returns them.""" # Write your code here return my_pitstop_coord, my_start_coord, my_start_num # Feel free to add more utility functions
def euclidean_distance(x1, y1, x2, y2): """Compute euclidean distance between two points.""" def which_start_and_pitstop(pitstop_num, pitstop_coords, start_coords): """Computes the relevant pitstop and startpoint info. Extracts the pitstop coordinates, relevant startpoint number and startpoint coordinates and returns them.""" return (my_pitstop_coord, my_start_coord, my_start_num)
greetings = ["hey", "howdy", "hi", "hello", "hi there"] questions = ["how_are_you_feeling", "how_are_you", "what_is_your_name", "how_old_are_you", "where_are_you_from", "are_you_a_boy_or_a_girl", "what_up"] insults = ["dumb", "stupid", "Ugly", "Retard", "Retarded", "suck"] complements = ["great", "awesome"] cuss_words = ["fucking", "god damn"] moods = ["Aweful", "bad", "not so good", "alright", "good", "Great", "amazing"] whys = ["why_is_that","why","how_come"] name = "Stewart" mood_level = 3 talk_level = 2 age = 2 cuss_box = [] memory_box = []
greetings = ['hey', 'howdy', 'hi', 'hello', 'hi there'] questions = ['how_are_you_feeling', 'how_are_you', 'what_is_your_name', 'how_old_are_you', 'where_are_you_from', 'are_you_a_boy_or_a_girl', 'what_up'] insults = ['dumb', 'stupid', 'Ugly', 'Retard', 'Retarded', 'suck'] complements = ['great', 'awesome'] cuss_words = ['fucking', 'god damn'] moods = ['Aweful', 'bad', 'not so good', 'alright', 'good', 'Great', 'amazing'] whys = ['why_is_that', 'why', 'how_come'] name = 'Stewart' mood_level = 3 talk_level = 2 age = 2 cuss_box = [] memory_box = []
def extractEachKth(inputArray, k): return [x for i, x in enumerate(inputArray) if (i + 1) % k != 0] print(extractEachKth([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 3))
def extract_each_kth(inputArray, k): return [x for (i, x) in enumerate(inputArray) if (i + 1) % k != 0] print(extract_each_kth([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 3))
# Sage version information for Python scripts # This file is auto-generated by the sage-update-version script, do not edit! version = '9.3.beta7' date = '2021-02-07' banner = 'SageMath version 9.3.beta7, Release Date: 2021-02-07'
version = '9.3.beta7' date = '2021-02-07' banner = 'SageMath version 9.3.beta7, Release Date: 2021-02-07'
_attrs = { "base": attr.string( mandatory = True ), # See: https://github.com/opencontainers/image-spec/blob/main/config.md#properties "entrypoint": attr.string_list(), "cmd": attr.string_list(), "labels": attr.string_list(), "tag": attr.string_list(), "layers": attr.label_list(), } def _strip_external(path): return path[len("external/"):] if path.startswith("external/") else path def _impl(ctx): toolchain = ctx.toolchains["@rules_container//container:toolchain_type"] launcher = ctx.actions.declare_file("crane.sh") # TODO: dynamically get --platform from toolchain ctx.actions.write( launcher, """#!/usr/bin/env bash set -euo pipefail {crane} $@""".format( crane = toolchain.containerinfo.crane_path, ), is_executable = True, ) # Pull the image pull = ctx.actions.args() tar = ctx.actions.declare_file("base_%s.tar" % ctx.label.name) pull.add_all([ "append", "--base", ctx.attr.base, "--output", tar, "--new_tag", ctx.label.name, ]) inputs = list() inputs.extend(toolchain.containerinfo.crane_files) if ctx.attr.layers: pull.add("--new_layer") for layer in ctx.attr.layers: inputs.extend(layer[DefaultInfo].files.to_list()) pull.add_all(layer[DefaultInfo].files) ctx.actions.run( inputs = inputs, arguments = [pull], outputs = [tar], executable = launcher, progress_message = "Pulling base image and appending new layers (%s)" % ctx.attr.base ) # Mutate it mutate = ctx.actions.args() resultTar = ctx.actions.declare_file("%s.tar" % ctx.label.name) mutate.add_all([ "mutate", "--tag", ctx.label.name, tar, "--output", resultTar ]) if ctx.attr.entrypoint: mutate.add_joined("--entrypoint", ctx.attr.entrypoint, join_with=",") if ctx.attr.cmd: mutate.add_joined("--cmd", ctx.attr.cmd, join_with=",") ctx.actions.run( inputs = [tar] + toolchain.containerinfo.crane_files, arguments = [mutate], outputs = [resultTar], executable = launcher, progress_message = "Mutating base image (%s)" % ctx.attr.base ) return [ DefaultInfo( files = depset([resultTar]), ), ] container = struct( implementation = _impl, attrs = _attrs, toolchains = ["@rules_container//container:toolchain_type"], )
_attrs = {'base': attr.string(mandatory=True), 'entrypoint': attr.string_list(), 'cmd': attr.string_list(), 'labels': attr.string_list(), 'tag': attr.string_list(), 'layers': attr.label_list()} def _strip_external(path): return path[len('external/'):] if path.startswith('external/') else path def _impl(ctx): toolchain = ctx.toolchains['@rules_container//container:toolchain_type'] launcher = ctx.actions.declare_file('crane.sh') ctx.actions.write(launcher, '#!/usr/bin/env bash\nset -euo pipefail\n{crane} $@'.format(crane=toolchain.containerinfo.crane_path), is_executable=True) pull = ctx.actions.args() tar = ctx.actions.declare_file('base_%s.tar' % ctx.label.name) pull.add_all(['append', '--base', ctx.attr.base, '--output', tar, '--new_tag', ctx.label.name]) inputs = list() inputs.extend(toolchain.containerinfo.crane_files) if ctx.attr.layers: pull.add('--new_layer') for layer in ctx.attr.layers: inputs.extend(layer[DefaultInfo].files.to_list()) pull.add_all(layer[DefaultInfo].files) ctx.actions.run(inputs=inputs, arguments=[pull], outputs=[tar], executable=launcher, progress_message='Pulling base image and appending new layers (%s)' % ctx.attr.base) mutate = ctx.actions.args() result_tar = ctx.actions.declare_file('%s.tar' % ctx.label.name) mutate.add_all(['mutate', '--tag', ctx.label.name, tar, '--output', resultTar]) if ctx.attr.entrypoint: mutate.add_joined('--entrypoint', ctx.attr.entrypoint, join_with=',') if ctx.attr.cmd: mutate.add_joined('--cmd', ctx.attr.cmd, join_with=',') ctx.actions.run(inputs=[tar] + toolchain.containerinfo.crane_files, arguments=[mutate], outputs=[resultTar], executable=launcher, progress_message='Mutating base image (%s)' % ctx.attr.base) return [default_info(files=depset([resultTar]))] container = struct(implementation=_impl, attrs=_attrs, toolchains=['@rules_container//container:toolchain_type'])
def numsum(n): ''' The recursive sum of all digits in a number unit a single character is obtained''' res = sum([int(i) for i in str(n)]) if res < 10: return res else : return numsum(res) for n in range(1,101): response = 'Fizz'*(numsum(n) in [3,6,9]) + \ 'Buzz'*(str(n)[-1] in ['5','0'])\ or n print(response)
def numsum(n): """ The recursive sum of all digits in a number unit a single character is obtained""" res = sum([int(i) for i in str(n)]) if res < 10: return res else: return numsum(res) for n in range(1, 101): response = 'Fizz' * (numsum(n) in [3, 6, 9]) + 'Buzz' * (str(n)[-1] in ['5', '0']) or n print(response)
class Solution: def matrixScore(self, A): """ :type A: List[List[int]] :rtype: int """ if not A or not A[0]: return 0 n, m = len(A), len(A[0]) tot = n*2**(m-1) for i in range(1, m): zero = sum(A[j][0]^A[j][i] for j in range(n)) tot += max(zero, n-zero)*2**(m-i-1) return tot class Solution: def matrixScore(self, A): if not A or not A[0]: return 0 n, m = len(A), len(A[0]) tot = 0 for i in range(m): zero = sum(A[j][0]^A[j][i] for j in range(n)) tot += max(zero, n-zero)*2**(m-i-1) return tot class Solution: def matrixScore(self, A): """ :type A: List[List[int]] :rtype: int """ M = len(A) N = len(A[0]) res = M << (N - 1) for j in range(1, N): m = sum(A[i][j] == A[i][0] for i in range(M)) res += max(m, M - m) <<(N - 1 - j) return res class Solution: def matrixScore(self, A: List[List[int]]) -> int: for i in range(len(A)): if A[i][0] == 0: self.flip_row(A, i) return self.dfs(A, 1) def dfs(self, a, j): if j == len(a[0]): return sum([int(''.join(map(str, a[i])), 2) for i in range(len(a))]) count = sum([1 for i in range(len(a)) if a[i][j]]) if count < (len(a)+1)//2: self.flip_col(a, j) return self.dfs(a, j + 1) def flip_row(self, a, i): for j in range(len(a[0])): a[i][j] = int(not a[i][j]) def flip_col(self, a, j): for i in range(len(a)): a[i][j] = int(not a[i][j])
class Solution: def matrix_score(self, A): """ :type A: List[List[int]] :rtype: int """ if not A or not A[0]: return 0 (n, m) = (len(A), len(A[0])) tot = n * 2 ** (m - 1) for i in range(1, m): zero = sum((A[j][0] ^ A[j][i] for j in range(n))) tot += max(zero, n - zero) * 2 ** (m - i - 1) return tot class Solution: def matrix_score(self, A): if not A or not A[0]: return 0 (n, m) = (len(A), len(A[0])) tot = 0 for i in range(m): zero = sum((A[j][0] ^ A[j][i] for j in range(n))) tot += max(zero, n - zero) * 2 ** (m - i - 1) return tot class Solution: def matrix_score(self, A): """ :type A: List[List[int]] :rtype: int """ m = len(A) n = len(A[0]) res = M << N - 1 for j in range(1, N): m = sum((A[i][j] == A[i][0] for i in range(M))) res += max(m, M - m) << N - 1 - j return res class Solution: def matrix_score(self, A: List[List[int]]) -> int: for i in range(len(A)): if A[i][0] == 0: self.flip_row(A, i) return self.dfs(A, 1) def dfs(self, a, j): if j == len(a[0]): return sum([int(''.join(map(str, a[i])), 2) for i in range(len(a))]) count = sum([1 for i in range(len(a)) if a[i][j]]) if count < (len(a) + 1) // 2: self.flip_col(a, j) return self.dfs(a, j + 1) def flip_row(self, a, i): for j in range(len(a[0])): a[i][j] = int(not a[i][j]) def flip_col(self, a, j): for i in range(len(a)): a[i][j] = int(not a[i][j])
{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import json\n", "import plotly\n", "import pandas as pd\n", "\n", "from nltk.stem import WordNetLemmatizer\n", "from nltk.tokenize import word_tokenize\n", "\n", "from flask import Flask\n", "from flask import render_template, request, jsonify\n", "from plotly.graph_objs import Bar\n", "from sklearn.externals import joblib\n", "from sqlalchemy import create_engine\n", "\n", "\n", "app = Flask(__name__)\n", "\n", "def tokenize(text):\n", " tokens = word_tokenize(text)\n", " lemmatizer = WordNetLemmatizer()\n", "\n", " clean_tokens = []\n", " for tok in tokens:\n", " clean_tok = lemmatizer.lemmatize(tok).lower().strip()\n", " clean_tokens.append(clean_tok)\n", "\n", " return clean_tokens\n", "\n", "# load data\n", "engine = create_engine('sqlite:///../data/DisasterResponse.db')\n", "df = pd.read_sql_table('Messages', engine)\n", "\n", "# load model\n", "model = joblib.load(\"../models/classifier.pkl\")\n", "\n", "\n", "# index webpage displays cool visuals and receives user input text for model\n", "@app.route('/')\n", "@app.route('/index')\n", "\n", "def index():\n", " \n", " # extract data needed for visuals\n", " # Calculate message count by genre and related status \n", " genre_related = df[df['related']==1].groupby('genre').count()['message']\n", " genre_not_rel = df[df['related']==0].groupby('genre').count()['message']\n", " genre_names = list(genre_related.index)\n", " \n", " # Calculate proportion of each category with label = 1\n", " cat_props = df.drop(['id', 'message', 'original', 'genre'], axis = 1).sum()/len(df)\n", " cat_props = cat_props.sort_values(ascending = False)\n", " cat_names = list(cat_props.index)\n", " \n", "\n", " # create visuals\n", " graphs = [\n", " {\n", " 'data': [\n", " Bar(\n", " x=genre_names,\n", " y=genre_related,\n", " name = 'Related'\n", " ),\n", " \n", " Bar(\n", " x=genre_names,\n", " y=genre_not_rel,\n", " name = 'Not Related'\n", " )\n", " ],\n", "\n", " 'layout': {\n", " 'title': 'Distribution of Messages by Genre and Related Status',\n", " 'yaxis': {\n", " 'title': \"Count\"\n", " },\n", " 'xaxis': {\n", " 'title': \"Genre\"\n", " },\n", " 'barmode': 'group'\n", " }\n", " },\n", " {\n", " 'data': [\n", " Bar(\n", " x=cat_names,\n", " y=cat_props\n", " )\n", " ],\n", "\n", " 'layout': {\n", " 'title': 'Proportion of Messages by Category',\n", " 'yaxis': {\n", " 'title': \"Proportion\"\n", " },\n", " 'xaxis': {\n", " 'title': \"Category\",\n", " 'tickangle': -45\n", " }\n", " }\n", " }\n", " ]\n", " \n", " # encode plotly graphs in JSON\n", " ids = [\"graph-{}\".format(i) for i, _ in enumerate(graphs)]\n", " graphJSON = json.dumps(graphs, cls=plotly.utils.PlotlyJSONEncoder)\n", " \n", " # render web page with plotly graphs\n", " return render_template('master.html', ids=ids, graphJSON=graphJSON)\n", "\n", "# web page that handles user query and displays model results\n", "@app.route('/go')\n", "def go():\n", " # save user input in query\n", " query = request.args.get('query', '') \n", "\n", " # use model to predict classification for query\n", " classification_labels = model.predict([query])[0]\n", " classification_results = dict(zip(df.columns[4:], classification_labels))\n", "\n", " # This will render the go.html Please see that file. \n", " return render_template(\n", " 'go.html',\n", " query=query,\n", " classification_result=classification_results\n", " )\n", "\n", "\n", "def main():\n", " app.run(host='0.0.0.0', port=3001, debug=True)\n", "\n", "\n", "if __name__ == '__main__':\n", " main()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 2 }
{'cells': [{'cell_type': 'code', 'execution_count': null, 'metadata': {}, 'outputs': [], 'source': ['import json\n', 'import plotly\n', 'import pandas as pd\n', '\n', 'from nltk.stem import WordNetLemmatizer\n', 'from nltk.tokenize import word_tokenize\n', '\n', 'from flask import Flask\n', 'from flask import render_template, request, jsonify\n', 'from plotly.graph_objs import Bar\n', 'from sklearn.externals import joblib\n', 'from sqlalchemy import create_engine\n', '\n', '\n', 'app = Flask(__name__)\n', '\n', 'def tokenize(text):\n', ' tokens = word_tokenize(text)\n', ' lemmatizer = WordNetLemmatizer()\n', '\n', ' clean_tokens = []\n', ' for tok in tokens:\n', ' clean_tok = lemmatizer.lemmatize(tok).lower().strip()\n', ' clean_tokens.append(clean_tok)\n', '\n', ' return clean_tokens\n', '\n', '# load data\n', "engine = create_engine('sqlite:///../data/DisasterResponse.db')\n", "df = pd.read_sql_table('Messages', engine)\n", '\n', '# load model\n', 'model = joblib.load("../models/classifier.pkl")\n', '\n', '\n', '# index webpage displays cool visuals and receives user input text for model\n', "@app.route('/')\n", "@app.route('/index')\n", '\n', 'def index():\n', ' \n', ' # extract data needed for visuals\n', ' # Calculate message count by genre and related status \n', " genre_related = df[df['related']==1].groupby('genre').count()['message']\n", " genre_not_rel = df[df['related']==0].groupby('genre').count()['message']\n", ' genre_names = list(genre_related.index)\n', ' \n', ' # Calculate proportion of each category with label = 1\n', " cat_props = df.drop(['id', 'message', 'original', 'genre'], axis = 1).sum()/len(df)\n", ' cat_props = cat_props.sort_values(ascending = False)\n', ' cat_names = list(cat_props.index)\n', ' \n', '\n', ' # create visuals\n', ' graphs = [\n', ' {\n', " 'data': [\n", ' Bar(\n', ' x=genre_names,\n', ' y=genre_related,\n', " name = 'Related'\n", ' ),\n', ' \n', ' Bar(\n', ' x=genre_names,\n', ' y=genre_not_rel,\n', " name = 'Not Related'\n", ' )\n', ' ],\n', '\n', " 'layout': {\n", " 'title': 'Distribution of Messages by Genre and Related Status',\n", " 'yaxis': {\n", ' \'title\': "Count"\n', ' },\n', " 'xaxis': {\n", ' \'title\': "Genre"\n', ' },\n', " 'barmode': 'group'\n", ' }\n', ' },\n', ' {\n', " 'data': [\n", ' Bar(\n', ' x=cat_names,\n', ' y=cat_props\n', ' )\n', ' ],\n', '\n', " 'layout': {\n", " 'title': 'Proportion of Messages by Category',\n", " 'yaxis': {\n", ' \'title\': "Proportion"\n', ' },\n', " 'xaxis': {\n", ' \'title\': "Category",\n', " 'tickangle': -45\n", ' }\n', ' }\n', ' }\n', ' ]\n', ' \n', ' # encode plotly graphs in JSON\n', ' ids = ["graph-{}".format(i) for i, _ in enumerate(graphs)]\n', ' graphJSON = json.dumps(graphs, cls=plotly.utils.PlotlyJSONEncoder)\n', ' \n', ' # render web page with plotly graphs\n', " return render_template('master.html', ids=ids, graphJSON=graphJSON)\n", '\n', '# web page that handles user query and displays model results\n', "@app.route('/go')\n", 'def go():\n', ' # save user input in query\n', " query = request.args.get('query', '') \n", '\n', ' # use model to predict classification for query\n', ' classification_labels = model.predict([query])[0]\n', ' classification_results = dict(zip(df.columns[4:], classification_labels))\n', '\n', ' # This will render the go.html Please see that file. \n', ' return render_template(\n', " 'go.html',\n", ' query=query,\n', ' classification_result=classification_results\n', ' )\n', '\n', '\n', 'def main():\n', " app.run(host='0.0.0.0', port=3001, debug=True)\n", '\n', '\n', "if __name__ == '__main__':\n", ' main()']}], 'metadata': {'kernelspec': {'display_name': 'Python 3', 'language': 'python', 'name': 'python3'}}, 'nbformat': 4, 'nbformat_minor': 2}
# Solution 1 # O(n^2) time / O(1) space # n - number of buildings def largestRectangleUnderSkyline(buildings): maxArea = 0 for pillarIdx in range(len(buildings)): currentHeight = buildings[pillarIdx] furthestLeft = pillarIdx while furthestLeft > 0 and buildings[furthestLeft - 1] >= currentHeight: furthestLeft -= 1 furthestRight = pillarIdx while furthestRight < len(buildings) - 1 and buildings[furthestRight + 1] >= currentHeight: furthestRight += 1 areaWithCurrentBuilding = (furthestRight - furthestLeft + 1) * currentHeight maxArea = max(areaWithCurrentBuilding, maxArea) return maxArea # Solution 2 # O(n) time / O(n) space # n - number of buildings def largestRectangleUnderSkyline(buildings): pillarIndices = [] maxArea = 0 for idx, height in enumerate(buildings + [0]): while len(pillarIndices) != 0 and buildings[pillarIndices[len(pillarIndices) - 1]] >= height: pillarHeight = buildings[pillarIndices.pop()] width = idx if len(pillarIndices) == 0 else idx - pillarIndices[len(pillarIndices) - 1] - 1 maxArea = max(width * pillarHeight, maxArea) pillarIndices.append(idx) return maxArea
def largest_rectangle_under_skyline(buildings): max_area = 0 for pillar_idx in range(len(buildings)): current_height = buildings[pillarIdx] furthest_left = pillarIdx while furthestLeft > 0 and buildings[furthestLeft - 1] >= currentHeight: furthest_left -= 1 furthest_right = pillarIdx while furthestRight < len(buildings) - 1 and buildings[furthestRight + 1] >= currentHeight: furthest_right += 1 area_with_current_building = (furthestRight - furthestLeft + 1) * currentHeight max_area = max(areaWithCurrentBuilding, maxArea) return maxArea def largest_rectangle_under_skyline(buildings): pillar_indices = [] max_area = 0 for (idx, height) in enumerate(buildings + [0]): while len(pillarIndices) != 0 and buildings[pillarIndices[len(pillarIndices) - 1]] >= height: pillar_height = buildings[pillarIndices.pop()] width = idx if len(pillarIndices) == 0 else idx - pillarIndices[len(pillarIndices) - 1] - 1 max_area = max(width * pillarHeight, maxArea) pillarIndices.append(idx) return maxArea
t=int(input()) while(t): t=t-1 n=int(input()) c=0 a=list(map(int,input().split())) b=[] b.append(int(a[0])) for i in range(1,len(a)): b.append(min(int(a[i]),int(b[i-1]))) for i in range(0,len(a)): if(int(a[i])==int(b[i])): c+=1 print(c)
t = int(input()) while t: t = t - 1 n = int(input()) c = 0 a = list(map(int, input().split())) b = [] b.append(int(a[0])) for i in range(1, len(a)): b.append(min(int(a[i]), int(b[i - 1]))) for i in range(0, len(a)): if int(a[i]) == int(b[i]): c += 1 print(c)
#!/usr/bin/env python3 __author__ = "Mert Erol" # This signature is required for the automated grading to work. # Do not rename the function or change its list of parameters! def visualize(records): pclass_1 = 0 pclass_1_alive = 0 pclass_2 = 0 pclass_2_alive = 0 pclass_3 = 0 pclass_3_alive = 0 dataset = records[1] for p in dataset: pclass = p[1] alive = p[0] #first class counter if pclass == 1: pclass_1 += 1 if alive == True: pclass_1_alive += 1 #second class counter elif pclass == 2: pclass_2 += 1 if alive == True: pclass_2_alive += 1 #third class counter elif pclass == 3: pclass_3 += 1 if alive == True: pclass_3_alive += 1 #percentage of passengers in each class totpas = len(dataset) tot_1 = round((pclass_1/totpas * 100), 1) tot_2 = round((pclass_2/totpas * 100), 1) tot_3 = round((pclass_3/totpas * 100), 1) #percentage of each passanger that survived in each class surv_1 = round((pclass_1_alive/pclass_1 * 100), 1) surv_2 = round((pclass_2_alive/pclass_2 * 100), 1) surv_3 = round((pclass_3_alive/pclass_3 * 100), 1) #building the visual step by step string = "== 1st Class ==\n" string += "Total |" + (round(tot_1/5)) * "*" + str((20- round(tot_1/5))* " ") + "| " + str(tot_1) + "%\n" string += "Alive |" + (round(surv_1/5)) * "*" + str((20-round(surv_1/5)) * " ") + "| " + str(surv_1) + "%\n" string += "== 2nd Class ==\n" string += "Total |" + (round(tot_2/5)) * "*" + str((20- round(tot_2/5))* " ") + "| " + str(tot_2) + "%\n" string += "Alive |" + (round(surv_2/5)) * "*" + str((20-round(surv_2/5)) * " ") + "| " + str(surv_2) + "%\n" string += "== 3rd Class ==\n" string += "Total |" + (round(tot_3/5)) * "*" + str((20- round(tot_3/5))* " ") + "| " + str(tot_3) + "%\n" string += "Alive |" + (round(surv_3/5)) * "*" + str((20-round(surv_3/5)) * " ") + "| " + str(surv_3) + "%\n" return string # The following line calls the function and prints the return # value to the Console. This way you can check what it does. # However, we encourage you to write tests, because then you # can easily test many different values on every "Test & Run"! if __name__ == '__main__': print(visualize(( ('Survived', 'Pclass', 'Name', 'Gender', 'Age', 'Fare'), [ (True, 1, 'Cumings Mrs. John Bradley (Florence Briggs Thayer)', 'female', 38, 71.2833), (True, 2, 'Flunky Mr Hazelnut', 'female', 18, 51.2), (False, 3, 'Heikkinen Miss. Laina', 'female', 26, 7.925) ] )))
__author__ = 'Mert Erol' def visualize(records): pclass_1 = 0 pclass_1_alive = 0 pclass_2 = 0 pclass_2_alive = 0 pclass_3 = 0 pclass_3_alive = 0 dataset = records[1] for p in dataset: pclass = p[1] alive = p[0] if pclass == 1: pclass_1 += 1 if alive == True: pclass_1_alive += 1 elif pclass == 2: pclass_2 += 1 if alive == True: pclass_2_alive += 1 elif pclass == 3: pclass_3 += 1 if alive == True: pclass_3_alive += 1 totpas = len(dataset) tot_1 = round(pclass_1 / totpas * 100, 1) tot_2 = round(pclass_2 / totpas * 100, 1) tot_3 = round(pclass_3 / totpas * 100, 1) surv_1 = round(pclass_1_alive / pclass_1 * 100, 1) surv_2 = round(pclass_2_alive / pclass_2 * 100, 1) surv_3 = round(pclass_3_alive / pclass_3 * 100, 1) string = '== 1st Class ==\n' string += 'Total |' + round(tot_1 / 5) * '*' + str((20 - round(tot_1 / 5)) * ' ') + '| ' + str(tot_1) + '%\n' string += 'Alive |' + round(surv_1 / 5) * '*' + str((20 - round(surv_1 / 5)) * ' ') + '| ' + str(surv_1) + '%\n' string += '== 2nd Class ==\n' string += 'Total |' + round(tot_2 / 5) * '*' + str((20 - round(tot_2 / 5)) * ' ') + '| ' + str(tot_2) + '%\n' string += 'Alive |' + round(surv_2 / 5) * '*' + str((20 - round(surv_2 / 5)) * ' ') + '| ' + str(surv_2) + '%\n' string += '== 3rd Class ==\n' string += 'Total |' + round(tot_3 / 5) * '*' + str((20 - round(tot_3 / 5)) * ' ') + '| ' + str(tot_3) + '%\n' string += 'Alive |' + round(surv_3 / 5) * '*' + str((20 - round(surv_3 / 5)) * ' ') + '| ' + str(surv_3) + '%\n' return string if __name__ == '__main__': print(visualize((('Survived', 'Pclass', 'Name', 'Gender', 'Age', 'Fare'), [(True, 1, 'Cumings Mrs. John Bradley (Florence Briggs Thayer)', 'female', 38, 71.2833), (True, 2, 'Flunky Mr Hazelnut', 'female', 18, 51.2), (False, 3, 'Heikkinen Miss. Laina', 'female', 26, 7.925)])))
# Dummy class for packages that have no MPI class MPIDummy(object): def __init__(self): pass def Get_rank(self): return 0 def Get_size(self): return 1 def barrier(self): pass def send(self, lnlike0, dest=1, tag=55): pass def recv(self, source=1, tag=55): pass def Iprobe(self, source=1, tag=55): pass # Global object representing no MPI: COMM_WORLD = MPIDummy()
class Mpidummy(object): def __init__(self): pass def get_rank(self): return 0 def get_size(self): return 1 def barrier(self): pass def send(self, lnlike0, dest=1, tag=55): pass def recv(self, source=1, tag=55): pass def iprobe(self, source=1, tag=55): pass comm_world = mpi_dummy()
def gcd(a, b): factors_a = [] for i in range(1, a+1): if (a%i) == 0: factors_a.append(i) factors_b = [] for i in range(1, b+1): if (b%i) == 0: factors_b.append(i) common_factors = [] for i in factors_a: if i in factors_b: common_factors.append(i) return (common_factors[-1]) def p(s): print(s) if __name__ == "__main__": p("input a:") a = int(input()) p("input b:") b = int(input()) p("gcd of "+str(a)+" and "+str(b)+" is:") print(gcd(a, b))
def gcd(a, b): factors_a = [] for i in range(1, a + 1): if a % i == 0: factors_a.append(i) factors_b = [] for i in range(1, b + 1): if b % i == 0: factors_b.append(i) common_factors = [] for i in factors_a: if i in factors_b: common_factors.append(i) return common_factors[-1] def p(s): print(s) if __name__ == '__main__': p('input a:') a = int(input()) p('input b:') b = int(input()) p('gcd of ' + str(a) + ' and ' + str(b) + ' is:') print(gcd(a, b))
"""Pygame Zero, a zero-boilerplate game framework for education. You shouldn't need to import things from the 'pgzero' package directly; just use 'pgzrun' to run the game file. """ __version__ = '1.2'
"""Pygame Zero, a zero-boilerplate game framework for education. You shouldn't need to import things from the 'pgzero' package directly; just use 'pgzrun' to run the game file. """ __version__ = '1.2'
# Specialization: Google IT Automation with Python # Course 01: Crash Course with Python # Week 3 Module Part 1 - Practice Quiz # Student: Shawn Solomon # Learning Platform: Coursera.org # Scripting examples encountered during the Module Part 1 Practice Quiz: # 02. Fill in the blanks to make the print_prime_factors function print all the prime factors of a number. # A prime factor is a number that is prime and divides another without a remainder. # def print_prime_factors(number): # # Start with two, which is the first prime # factor = ___ # # Keep going until the factor is larger than the number # while factor <= number: # # Check if factor is a divisor of number # if number % factor == ___: # # If it is, print it and divide the original number # print(factor) # number = number / factor # else: # # If it's not, increment the factor by one # ___ # return "Done" # # print_prime_factors(100) # # Should print 2,2,5,5 # # DO NOT DELETE THIS COMMENT def print_prime_factors(number): # Start with two, which is the first prime factor = 2 # Keep going until the factor is larger than the number while factor <= number: # Check if factor is a divisor of number if number % factor == 0: # If it is, print it and divide the original number print(factor) number = number / factor else: # If it's not, increment the factor by one factor += 1 return "Done" print_prime_factors(100) # Should print 2,2,5,5 # DO NOT DELETE THIS COMMENT # 03. The following code can lead to an infinite loop. Fix the code so that it can finish successfully for all numbers. # Note: Try running your function with the number 0 as the input, and see what you get! # def is_power_of_two(n): # # Check if the number can be divided by two without a remainder # while n % 2 == 0: # n = n / 2 # # If after dividing by two the number is 1, it's a power of two # if n == 1: # return True # return False # # # print(is_power_of_two(0)) # Should be False # print(is_power_of_two(1)) # Should be True # print(is_power_of_two(8)) # Should be True # print(is_power_of_two(9)) # Should be False def is_power_of_two(n): # Check if the number can be divided by two without a remainder while n % 2 == 0: if n == 0: return False n = n / 2 # If after dividing by two the number is 1, it's a power of two if n == 1: return True return False print(is_power_of_two(0)) # Should be False print(is_power_of_two(1)) # Should be True print(is_power_of_two(8)) # Should be True print(is_power_of_two(9)) # Should be False # 04. Fill in the empty function so that it returns the sum of all the divisors of a number, without including it. # A divisor is a number that divides into another without a remainder. # def sum_divisors(n): # sum = 0 # # Return the sum of all divisors of n, not including n # return sum # # print(sum_divisors(0)) # # 0 # print(sum_divisors(3)) # Should sum of 1 # # 1 # print(sum_divisors(36)) # Should sum of 1+2+3+4+6+9+12+18 # # 55 # print(sum_divisors(102)) # Should be sum of 2+3+6+17+34+51 # # 114 def sum_divisors(number): sum = 0 divs = 1 while divs < number: # Check if factor is a divisor of number if number == 0: return 0 if number % divs == 0: # If it is, print it and divide the original number sum = sum + divs divs = divs + 1 else: divs += 1 # Return the sum of all divisors of n, not including n return sum print(sum_divisors(0)) # 0 print(sum_divisors(3)) # Should sum of 1 # 1 print(sum_divisors(36)) # Should sum of 1+2+3+4+6+9+12+18 # 55 print(sum_divisors(102)) # Should be sum of 2+3+6+17+34+51 # 114 # 05. The multiplication_table function prints the results of a number passed to it multiplied by 1 through 5. # An additional requirement is that the result is not to exceed 25, which is done with the break statement. # Fill in the blanks to complete the function to satisfy these conditions. # def multiplication_table(number): # # Initialize the starting point of the multiplication table # multiplier = 1 # # Only want to loop through 5 # while multiplier <= 5: # result = ___ # # What is the additional condition to exit out of the loop? # if ___ : # break # print(str(number) + "x" + str(multiplier) + "=" + str(result)) # # Increment the variable for the loop # ___ += 1 # # multiplication_table(3) # # Should print: 3x1=3 3x2=6 3x3=9 3x4=12 3x5=15 # # multiplication_table(5) # # Should print: 5x1=5 5x2=10 5x3=15 5x4=20 5x5=25 # # multiplication_table(8) # # Should print: 8x1=8 8x2=16 8x3=24 def multiplication_table(number): # Initialize the starting point of the multiplication table multiplier = 1 # Only want to loop through 5 while multiplier <= 5: result = number * multiplier # What is the additional condition to exit out of the loop? if result > 25 : break print(str(number) + "x" + str(multiplier) + "=" + str(result)) # Increment the variable for the loop multiplier += 1 multiplication_table(3) # Should print: 3x1=3 3x2=6 3x3=9 3x4=12 3x5=15 multiplication_table(5) # Should print: 5x1=5 5x2=10 5x3=15 5x4=20 5x5=25 multiplication_table(8) # Should print: 8x1=8 8x2=16 8x3=24
def print_prime_factors(number): factor = 2 while factor <= number: if number % factor == 0: print(factor) number = number / factor else: factor += 1 return 'Done' print_prime_factors(100) def is_power_of_two(n): while n % 2 == 0: if n == 0: return False n = n / 2 if n == 1: return True return False print(is_power_of_two(0)) print(is_power_of_two(1)) print(is_power_of_two(8)) print(is_power_of_two(9)) def sum_divisors(number): sum = 0 divs = 1 while divs < number: if number == 0: return 0 if number % divs == 0: sum = sum + divs divs = divs + 1 else: divs += 1 return sum print(sum_divisors(0)) print(sum_divisors(3)) print(sum_divisors(36)) print(sum_divisors(102)) def multiplication_table(number): multiplier = 1 while multiplier <= 5: result = number * multiplier if result > 25: break print(str(number) + 'x' + str(multiplier) + '=' + str(result)) multiplier += 1 multiplication_table(3) multiplication_table(5) multiplication_table(8)
test = """2H2 + O2 -> 2H2O""" def times_sep(s): elem = [] times = [] checking_pro = False last = 0 for i in range(len(s)): if checking_pro: if s[i].isalpha() and not s[i].islower() or s[i].isdigit(): elem.append(s[last]) checking_pro = False if s[i].islower() and s[i].isalpha(): elem.append(s[i-1]+s[i]) if s[i].isupper(): checking_pro = True if s[i].isupper() and i == len(s)-1: elem.append(s[i]) last = (i) last = 0 checking_pro = False for i in range(1, len(s)): if checking_pro: if s[i].isupper(): times.append(1) checking_pro = False if s[i].isdigit():times.append(int(s[i])) if s[i].isalpha(): checking_pro = True if s[i].isupper() and i == len(s)-1: times.append(1) return list(zip(elem, times)) def coeff_sep(ele): d = {} for i in ele: coeff = "" for j in i: if not j.isdigit(): break coeff += j d.update({i[len(coeff):]: coeff if coeff != "" else 1}) return d def checker(equation): a = equation.split(" -> ") reactants = a[0].split(" + ") products = a[1].split(" + ") stoichiometry = coeff_sep(reactants), coeff_sep(products) print(*stoichiometry, sep="\n") for i in stoichiometry: for j in i.keys(): print(times_sep(j)) checker(test) # print(times_sep("H2O"))
test = '2H2 + O2 -> 2H2O' def times_sep(s): elem = [] times = [] checking_pro = False last = 0 for i in range(len(s)): if checking_pro: if s[i].isalpha() and (not s[i].islower()) or s[i].isdigit(): elem.append(s[last]) checking_pro = False if s[i].islower() and s[i].isalpha(): elem.append(s[i - 1] + s[i]) if s[i].isupper(): checking_pro = True if s[i].isupper() and i == len(s) - 1: elem.append(s[i]) last = i last = 0 checking_pro = False for i in range(1, len(s)): if checking_pro: if s[i].isupper(): times.append(1) checking_pro = False if s[i].isdigit(): times.append(int(s[i])) if s[i].isalpha(): checking_pro = True if s[i].isupper() and i == len(s) - 1: times.append(1) return list(zip(elem, times)) def coeff_sep(ele): d = {} for i in ele: coeff = '' for j in i: if not j.isdigit(): break coeff += j d.update({i[len(coeff):]: coeff if coeff != '' else 1}) return d def checker(equation): a = equation.split(' -> ') reactants = a[0].split(' + ') products = a[1].split(' + ') stoichiometry = (coeff_sep(reactants), coeff_sep(products)) print(*stoichiometry, sep='\n') for i in stoichiometry: for j in i.keys(): print(times_sep(j)) checker(test)
#4: Skriv alle primtal mellem 1 og 100 for primtal in range(2, 101): for i in range(2, primtal): if (primtal % i) == 0: break else: print(primtal)
for primtal in range(2, 101): for i in range(2, primtal): if primtal % i == 0: break else: print(primtal)
class Checkers: def __init__(self): pass def is_operation(self, command): operations = ['+', '-', 'x', '*', '/', 'plus', 'minus', 'times', 'divide'] for operation in operations: if operation in command: return True
class Checkers: def __init__(self): pass def is_operation(self, command): operations = ['+', '-', 'x', '*', '/', 'plus', 'minus', 'times', 'divide'] for operation in operations: if operation in command: return True
# noinspection PyUnusedLocal # skus = unicode string class InvalidOfferException(Exception): def __init__(self, expression, message): self.expression = expression self.message = message def checkout(skus): products = { 'A': productA, 'B': productB, 'C': productC,'D': productD,'E': productE, 'F': productF, 'G': productG, 'H': productH,'I': productI,'J': productJ, 'K': productK, 'L': productL, 'M': productM,'N': productN,'O': productO, 'P': productP, 'Q': productQ, 'R': productR,'S': productS,'T': productT, 'U': productU, 'V': productV, 'W': productW,'X': productX,'Y': productY, 'Z': productZ} competing_offers = [ [Offer({productB: 2}, 45), Offer({productB: 1, productE: 2}, 80)], [Offer({productQ: 3}, 80), Offer({productR: 3, productQ:1}, 150)] ] non_competing_offers = [ Offer({productA: 5}, 200, Offer({productA: 3}, 130)), Offer({productH: 10}, 80, Offer({productH: 5}, 45)), Offer({productV: 3}, 130, Offer({productV: 2}, 90)), Offer({productF: 3}, 20), Offer({productK: 2}, 120), Offer({productU: 4}, 120), Offer({productN: 3, productM:1}, 120), Offer({productP: 5}, 200) ] group_offers = [GroupOffer([productS, productT, productX, productY, productZ], 3, 45)] basket = Basket(competing_offers, non_competing_offers, group_offers, {}, 0) for letter in skus: try: basket.add_item(products[letter]) except Exception as e: return -1 return basket.calculate_value() class GroupOffer: def __init__(self, elements, required_number, price): self.elements = elements.copy() self.elements.sort(key= lambda l: l.standardPrice, reverse=True) self.required_number = required_number self.price = price def apply_offer(self, basket): value_ranked_collection = [(x,basket.items.get(x, 0)) for x in self.elements] number_of_items = sum(j for _, j in value_ranked_collection) if (number_of_items < self.required_number): raise InvalidOfferException("Invalid Offer") still_required = self.required_number for item_tuple in value_ranked_collection: count = item_tuple[1] item = item_tuple[0] if count == 0: continue if count < still_required: still_required = still_required - count basket.remove_items(item, count) else: basket.remove_items(item, still_required) break basket.add_item_price(self.price) return basket class Offer: def __init__(self, combinationDict, dealPrice, dominated_offer=None): self.combinationDict = combinationDict self.dealPrice = dealPrice self.dominated_offer = dominated_offer def apply_offer(self, basket): for key, value in self.combinationDict.items(): if value > basket.items[key]: raise InvalidOfferException("Invalid Offer") for key,value in self.combinationDict.items(): basket.remove_items(key, value) basket.add_item_price(self.dealPrice) return basket class Item: def __init__(self, name, standardPrice): self.name = name self.standardPrice = standardPrice class Basket: def __init__(self, competing_offers, non_competing_offers, group_offers, items, price): self.non_competing_offers = non_competing_offers.copy() self.competing_offers = competing_offers.copy() self.items = items.copy() self.price = price self.group_offers = group_offers.copy() def add_item(self, item): if item in self.items: self.items[item] += 1 else: self.items[item] = 1 def remove_items(self, item, count): self.items[item] = self.items[item] - count def add_item_price(self, price): self.price += price def calculate_value(self): if self.non_competing_offers: self.apply_non_competing_offers() if self.group_offers: self.apply_group_offers() if self.competing_offers: competing_offer = self.competing_offers[0] return min(self.apply_competing_offer(competing_offer[0], competing_offer[1], competing_offer), self.apply_competing_offer(competing_offer[1], competing_offer[0], competing_offer)) for item, count in self.items.items(): self.price += item.standardPrice * count return self.price def apply_non_competing_offers(self): for offer in self.non_competing_offers: while True: try: self = offer.apply_offer(self) except: try: self = offer.dominated_offer.apply_offer(self) except: break break def apply_group_offers(self): for offer in self.group_offers: while True: try: self = offer.apply_offer(self) except: break def apply_competing_offer(self, offer, alternative, competing_offer): basket = Basket(self.competing_offers,[],[],self.items, self.price) try: basket = offer.apply_offer(basket) except: basket.competing_offers.remove(competing_offer) basket.non_competing_offers.append(alternative) return basket.calculate_value() productA = Item('A',50) productB = Item('B',30) productC = Item('C',20) productD = Item('D',15) productE = Item('E',40) productF = Item('F',10) productG = Item('G',20) productH = Item('H',10) productI = Item('I',35) productJ = Item('J',60) productK = Item('K',70) productL = Item('L',90) productM = Item('M',15) productN = Item('N',40) productO = Item('O',10) productP = Item('P',50) productQ = Item('Q',30) productR = Item('R',50) productS = Item('S',20) productT = Item('T',20) productU = Item('U',40) productV = Item('V',50) productW = Item('W',20) productX = Item('X',17) productY = Item('Y',20) productZ = Item('Z',21)
class Invalidofferexception(Exception): def __init__(self, expression, message): self.expression = expression self.message = message def checkout(skus): products = {'A': productA, 'B': productB, 'C': productC, 'D': productD, 'E': productE, 'F': productF, 'G': productG, 'H': productH, 'I': productI, 'J': productJ, 'K': productK, 'L': productL, 'M': productM, 'N': productN, 'O': productO, 'P': productP, 'Q': productQ, 'R': productR, 'S': productS, 'T': productT, 'U': productU, 'V': productV, 'W': productW, 'X': productX, 'Y': productY, 'Z': productZ} competing_offers = [[offer({productB: 2}, 45), offer({productB: 1, productE: 2}, 80)], [offer({productQ: 3}, 80), offer({productR: 3, productQ: 1}, 150)]] non_competing_offers = [offer({productA: 5}, 200, offer({productA: 3}, 130)), offer({productH: 10}, 80, offer({productH: 5}, 45)), offer({productV: 3}, 130, offer({productV: 2}, 90)), offer({productF: 3}, 20), offer({productK: 2}, 120), offer({productU: 4}, 120), offer({productN: 3, productM: 1}, 120), offer({productP: 5}, 200)] group_offers = [group_offer([productS, productT, productX, productY, productZ], 3, 45)] basket = basket(competing_offers, non_competing_offers, group_offers, {}, 0) for letter in skus: try: basket.add_item(products[letter]) except Exception as e: return -1 return basket.calculate_value() class Groupoffer: def __init__(self, elements, required_number, price): self.elements = elements.copy() self.elements.sort(key=lambda l: l.standardPrice, reverse=True) self.required_number = required_number self.price = price def apply_offer(self, basket): value_ranked_collection = [(x, basket.items.get(x, 0)) for x in self.elements] number_of_items = sum((j for (_, j) in value_ranked_collection)) if number_of_items < self.required_number: raise invalid_offer_exception('Invalid Offer') still_required = self.required_number for item_tuple in value_ranked_collection: count = item_tuple[1] item = item_tuple[0] if count == 0: continue if count < still_required: still_required = still_required - count basket.remove_items(item, count) else: basket.remove_items(item, still_required) break basket.add_item_price(self.price) return basket class Offer: def __init__(self, combinationDict, dealPrice, dominated_offer=None): self.combinationDict = combinationDict self.dealPrice = dealPrice self.dominated_offer = dominated_offer def apply_offer(self, basket): for (key, value) in self.combinationDict.items(): if value > basket.items[key]: raise invalid_offer_exception('Invalid Offer') for (key, value) in self.combinationDict.items(): basket.remove_items(key, value) basket.add_item_price(self.dealPrice) return basket class Item: def __init__(self, name, standardPrice): self.name = name self.standardPrice = standardPrice class Basket: def __init__(self, competing_offers, non_competing_offers, group_offers, items, price): self.non_competing_offers = non_competing_offers.copy() self.competing_offers = competing_offers.copy() self.items = items.copy() self.price = price self.group_offers = group_offers.copy() def add_item(self, item): if item in self.items: self.items[item] += 1 else: self.items[item] = 1 def remove_items(self, item, count): self.items[item] = self.items[item] - count def add_item_price(self, price): self.price += price def calculate_value(self): if self.non_competing_offers: self.apply_non_competing_offers() if self.group_offers: self.apply_group_offers() if self.competing_offers: competing_offer = self.competing_offers[0] return min(self.apply_competing_offer(competing_offer[0], competing_offer[1], competing_offer), self.apply_competing_offer(competing_offer[1], competing_offer[0], competing_offer)) for (item, count) in self.items.items(): self.price += item.standardPrice * count return self.price def apply_non_competing_offers(self): for offer in self.non_competing_offers: while True: try: self = offer.apply_offer(self) except: try: self = offer.dominated_offer.apply_offer(self) except: break break def apply_group_offers(self): for offer in self.group_offers: while True: try: self = offer.apply_offer(self) except: break def apply_competing_offer(self, offer, alternative, competing_offer): basket = basket(self.competing_offers, [], [], self.items, self.price) try: basket = offer.apply_offer(basket) except: basket.competing_offers.remove(competing_offer) basket.non_competing_offers.append(alternative) return basket.calculate_value() product_a = item('A', 50) product_b = item('B', 30) product_c = item('C', 20) product_d = item('D', 15) product_e = item('E', 40) product_f = item('F', 10) product_g = item('G', 20) product_h = item('H', 10) product_i = item('I', 35) product_j = item('J', 60) product_k = item('K', 70) product_l = item('L', 90) product_m = item('M', 15) product_n = item('N', 40) product_o = item('O', 10) product_p = item('P', 50) product_q = item('Q', 30) product_r = item('R', 50) product_s = item('S', 20) product_t = item('T', 20) product_u = item('U', 40) product_v = item('V', 50) product_w = item('W', 20) product_x = item('X', 17) product_y = item('Y', 20) product_z = item('Z', 21)
str = "RahulShettyAcademy.com" str1 = "Consulting firm" str3 = "RahulShetty" print(str[1]) #a print(str[0:5]) # if you want substring in python print(str+str1) # concatenation print(str3 in str) # substring check var = str.split(".") print(var) print(var[0]) str4 = " great " print(str4.strip()) print(str4.lstrip()) print(str4.rstrip())
str = 'RahulShettyAcademy.com' str1 = 'Consulting firm' str3 = 'RahulShetty' print(str[1]) print(str[0:5]) print(str + str1) print(str3 in str) var = str.split('.') print(var) print(var[0]) str4 = ' great ' print(str4.strip()) print(str4.lstrip()) print(str4.rstrip())
class Solution: def secondHighest(self, s: str) -> int: a = [] for i in s: if i.isdigit(): a.append(int(i)) stack = [-1] maxs = max(a) for i in a: if i < maxs: while stack and stack[-1] < i: stack.pop() stack.append(i) return stack[-1] if __name__ == '__main__': s = Solution() t = "asdac456a453dqwe1865s4df645s495q6w1e6qw13e" print(s.secondHighest(t))
class Solution: def second_highest(self, s: str) -> int: a = [] for i in s: if i.isdigit(): a.append(int(i)) stack = [-1] maxs = max(a) for i in a: if i < maxs: while stack and stack[-1] < i: stack.pop() stack.append(i) return stack[-1] if __name__ == '__main__': s = solution() t = 'asdac456a453dqwe1865s4df645s495q6w1e6qw13e' print(s.secondHighest(t))
''' Fibonacci Sequence ''' print("Enter a number for Fibonacci") f = input()
""" Fibonacci Sequence """ print('Enter a number for Fibonacci') f = input()
class Duration: def __init__(self, hours: int = 0, minutes: int = 0, seconds: int = 0): # setup the class instance and convert any provided times to seconds self.total_duration: int = (hours * 60 * 60) + (minutes * 60) + seconds def __add__(self, other): new_total: int = self.total_duration + other.total_duration return Duration(seconds=new_total) def get_hours(self) -> int: # return only the hours return self.total_duration // (60 * 60) def get_minutes(self) -> int: # return only the minutes return (self.total_duration % (60 * 60)) // 60 def get_seconds(self) -> int: # return only the seconds return (self.total_duration % (60 * 60)) % 60 def get_all(self) -> tuple[int, int, int]: # return the total duration as hours, minutes & seconds individually return self.get_hours(), self.get_minutes(), self.get_minutes() def __str__(self) -> str: # quick and simple representation of the duration return f'{self.get_hours()}hrs {self.get_minutes()}mins {self.get_seconds()}secs'
class Duration: def __init__(self, hours: int=0, minutes: int=0, seconds: int=0): self.total_duration: int = hours * 60 * 60 + minutes * 60 + seconds def __add__(self, other): new_total: int = self.total_duration + other.total_duration return duration(seconds=new_total) def get_hours(self) -> int: return self.total_duration // (60 * 60) def get_minutes(self) -> int: return self.total_duration % (60 * 60) // 60 def get_seconds(self) -> int: return self.total_duration % (60 * 60) % 60 def get_all(self) -> tuple[int, int, int]: return (self.get_hours(), self.get_minutes(), self.get_minutes()) def __str__(self) -> str: return f'{self.get_hours()}hrs {self.get_minutes()}mins {self.get_seconds()}secs'
# https://lospec.com/palette-list/pear36 COLORS = [ "#5e315b", "#8c3f5d", "#ba6156", "#f2a65e", "#ffe478", "#cfff70", "#8fde5d", "#3ca370", "#3d6e70", "#323e4f", "#322947", "#473b78", "#4b5bab", "#4da6ff", "#66ffe3", "#ffffeb", "#c2c2d1", "#7e7e8f", "#606070", "#43434f", "#272736", "#3e2347", "#57294b", "#964253", "#e36956", "#ffb570", "#ff9166", "#eb564b", "#b0305c", "#73275c", "#422445", "#5a265e", "#80366b", "#bd4882", "#ff6b97", "#ffb5b5", "#ef7379", ] POINT_GRADIENT = [ COLORS[-7], COLORS[-6], COLORS[-5], COLORS[-4], COLORS[-3], COLORS[-2], ] TEAM_1_PALLETE = [ COLORS[25], COLORS[3], COLORS[26], COLORS[24], COLORS[27], ] TEAM_2_PALLETE = [ COLORS[14], COLORS[13], COLORS[12], COLORS[11], COLORS[10], ] GREYSCALE = [ COLORS[15], COLORS[16], COLORS[17], COLORS[18], COLORS[19], ]
colors = ['#5e315b', '#8c3f5d', '#ba6156', '#f2a65e', '#ffe478', '#cfff70', '#8fde5d', '#3ca370', '#3d6e70', '#323e4f', '#322947', '#473b78', '#4b5bab', '#4da6ff', '#66ffe3', '#ffffeb', '#c2c2d1', '#7e7e8f', '#606070', '#43434f', '#272736', '#3e2347', '#57294b', '#964253', '#e36956', '#ffb570', '#ff9166', '#eb564b', '#b0305c', '#73275c', '#422445', '#5a265e', '#80366b', '#bd4882', '#ff6b97', '#ffb5b5', '#ef7379'] point_gradient = [COLORS[-7], COLORS[-6], COLORS[-5], COLORS[-4], COLORS[-3], COLORS[-2]] team_1_pallete = [COLORS[25], COLORS[3], COLORS[26], COLORS[24], COLORS[27]] team_2_pallete = [COLORS[14], COLORS[13], COLORS[12], COLORS[11], COLORS[10]] greyscale = [COLORS[15], COLORS[16], COLORS[17], COLORS[18], COLORS[19]]
fout = open('output.txt', 'w') line1 = "This here's the wattle,\n" fout.write(line1) line2 = "the emblem of our land.\n" fout.write(line2) fout.close()
fout = open('output.txt', 'w') line1 = "This here's the wattle,\n" fout.write(line1) line2 = 'the emblem of our land.\n' fout.write(line2) fout.close()
class Solution: def subarraysDivByK(self, A: List[int], K: int) -> int: """Prefix sum. Running time: O(n) where n is the length of A. """ n = len(A) pre = 0 res = 0 d = {0: 1} for a in A: pre = (pre + a) % K res += d.get(pre, 0) d[pre] = d.get(pre, 0) + 1 return res
class Solution: def subarrays_div_by_k(self, A: List[int], K: int) -> int: """Prefix sum. Running time: O(n) where n is the length of A. """ n = len(A) pre = 0 res = 0 d = {0: 1} for a in A: pre = (pre + a) % K res += d.get(pre, 0) d[pre] = d.get(pre, 0) + 1 return res
def unique_markers(n_markers): """Returns a unique list of distinguishable markers. These are predominantly based on the default seaborn markers. Parameters ---------- n_markers The number of markers to return (max=11). """ markers = [ "circle", "x", "diamond", "cross", "square", "star-diamond", "triangle-up", "star-square", "triangle-down", "pentagon", "hexagon", ] assert n_markers <= len(markers) return markers[:n_markers] def unique_colors(n_colors): """Returns a unique list of distinguishable colors. These are taken from the default seaborn `colorblind` color palette. Parameters ---------- n_colors The number of colors to return (max=10). """ colors = [ (0.004, 0.451, 0.698), (0.871, 0.561, 0.020), (0.008, 0.620, 0.451), (0.835, 0.369, 0.000), (0.800, 0.471, 0.737), (0.792, 0.569, 0.380), (0.984, 0.686, 0.894), (0.580, 0.580, 0.580), (0.925, 0.882, 0.200), (0.337, 0.706, 0.914), ] assert n_colors <= len(colors) return colors[:n_colors]
def unique_markers(n_markers): """Returns a unique list of distinguishable markers. These are predominantly based on the default seaborn markers. Parameters ---------- n_markers The number of markers to return (max=11). """ markers = ['circle', 'x', 'diamond', 'cross', 'square', 'star-diamond', 'triangle-up', 'star-square', 'triangle-down', 'pentagon', 'hexagon'] assert n_markers <= len(markers) return markers[:n_markers] def unique_colors(n_colors): """Returns a unique list of distinguishable colors. These are taken from the default seaborn `colorblind` color palette. Parameters ---------- n_colors The number of colors to return (max=10). """ colors = [(0.004, 0.451, 0.698), (0.871, 0.561, 0.02), (0.008, 0.62, 0.451), (0.835, 0.369, 0.0), (0.8, 0.471, 0.737), (0.792, 0.569, 0.38), (0.984, 0.686, 0.894), (0.58, 0.58, 0.58), (0.925, 0.882, 0.2), (0.337, 0.706, 0.914)] assert n_colors <= len(colors) return colors[:n_colors]
""" This file contains the functional tests for the `devices` blueprint. These tests use GETs and POSTs to different URLs to check for the proper behavior of the `devices` blueprint. """ def test_inventory(client): """ GIVEN a Flask application configured for testing WHEN the '/inventory/<category>' page is requested (GET) with a sample category THEN check the response is valid """ response = client.get('/inventory/Phone') assert response.status_code == 200 def test_add_device(client): """ GIVEN a Flask application configured for testing WHEN the '/add_device' page is requested (GET) THEN check the response is valid """ response = client.get('/add_device') assert response.status_code == 200 assert b'Name' in response.data assert b'Type' in response.data assert b'Serial' in response.data assert b'Model' in response.data assert b'MAC Address' in response.data assert b'Device Status' in response.data assert b'Purchase Date' in response.data assert b'Owner Username' in response.data assert b'Device Category' in response.data assert b'Notes' in response.data assert b'Add/Update Device' in response.data def test_select_device(client): """ GIVEN a Flask application configured for testing WHEN the '/select_device' page is requested (GET) with a sample letter range THEN check the response is valid """ response = client.get('/select_device/AF') assert response.status_code == 200 # TODO: # def test_edit_or_delete(client): # """ # GIVEN a Flask application configured for testing # WHEN the '/select_device' page is requested (GET) # THEN check the response is valid # """ # def test_delete_result(client): # """ # GIVEN a Flask application configured for testing # WHEN the '/select_device' page is requested (GET) # THEN check the response is valid # """ # def test_edit_result(client): # """ # GIVEN a Flask application configured for testing # WHEN the '/edit_result' page is posted to (POST) # THEN check the response is valid # """
""" This file contains the functional tests for the `devices` blueprint. These tests use GETs and POSTs to different URLs to check for the proper behavior of the `devices` blueprint. """ def test_inventory(client): """ GIVEN a Flask application configured for testing WHEN the '/inventory/<category>' page is requested (GET) with a sample category THEN check the response is valid """ response = client.get('/inventory/Phone') assert response.status_code == 200 def test_add_device(client): """ GIVEN a Flask application configured for testing WHEN the '/add_device' page is requested (GET) THEN check the response is valid """ response = client.get('/add_device') assert response.status_code == 200 assert b'Name' in response.data assert b'Type' in response.data assert b'Serial' in response.data assert b'Model' in response.data assert b'MAC Address' in response.data assert b'Device Status' in response.data assert b'Purchase Date' in response.data assert b'Owner Username' in response.data assert b'Device Category' in response.data assert b'Notes' in response.data assert b'Add/Update Device' in response.data def test_select_device(client): """ GIVEN a Flask application configured for testing WHEN the '/select_device' page is requested (GET) with a sample letter range THEN check the response is valid """ response = client.get('/select_device/AF') assert response.status_code == 200
def main(fn): with open(fn, 'r') as f: lines = [li.strip() for li in f.readlines()] cmds = list() for li in lines: fields = li.split() cmds.append([fields[0], int(fields[1])]) is_looping, acc = run(cmds) print(acc) for i in range(len(cmds)): if not flip_cmd(cmds[i]): continue is_looping, acc = run(cmds) if not is_looping: print(acc) break flip_cmd(cmds[i]) def flip_cmd(cmd): if cmd[0] == 'nop': cmd[0] = 'jmp' elif cmd[0] == 'jmp': cmd[0] = 'nop' else: return False return True def run(cmds): acc = 0 pc = 0 visited = set() is_looping = False while pc != len(cmds): if pc in visited: is_looping = True break visited.add(pc) cmd, val = cmds[pc] if cmd == 'nop': pc += 1 elif cmd == 'acc': acc += val pc += 1 elif cmd == 'jmp': pc += val else: raise ValueError return is_looping, acc if __name__ == '__main__': fn = 'input.txt' #fn = 'test.txt' main(fn)
def main(fn): with open(fn, 'r') as f: lines = [li.strip() for li in f.readlines()] cmds = list() for li in lines: fields = li.split() cmds.append([fields[0], int(fields[1])]) (is_looping, acc) = run(cmds) print(acc) for i in range(len(cmds)): if not flip_cmd(cmds[i]): continue (is_looping, acc) = run(cmds) if not is_looping: print(acc) break flip_cmd(cmds[i]) def flip_cmd(cmd): if cmd[0] == 'nop': cmd[0] = 'jmp' elif cmd[0] == 'jmp': cmd[0] = 'nop' else: return False return True def run(cmds): acc = 0 pc = 0 visited = set() is_looping = False while pc != len(cmds): if pc in visited: is_looping = True break visited.add(pc) (cmd, val) = cmds[pc] if cmd == 'nop': pc += 1 elif cmd == 'acc': acc += val pc += 1 elif cmd == 'jmp': pc += val else: raise ValueError return (is_looping, acc) if __name__ == '__main__': fn = 'input.txt' main(fn)
class Solution(object): def exist(self, board, word): """ :type board: List[List[str]] :type word: str :rtype: bool """ def dfs(word, idx, r, c): m, n = len(board), len(board[0]) if idx == len(word): return True if (not (0 <= r < m and 0 <= c < n)) or word[idx] != board[r][c]: return False for i, j in ((r - 1, c), (r + 1, c), (r, c - 1), (r, c + 1)): if (i, j) not in visited: visited.add((i, j)) if dfs(word, idx + 1, i, j): return True visited.remove((i, j)) return False visited = set() for i, row in enumerate(board): for j, val in enumerate(row): visited.add((i, j)) if dfs(word, 0, i, j): return True visited.clear() return False
class Solution(object): def exist(self, board, word): """ :type board: List[List[str]] :type word: str :rtype: bool """ def dfs(word, idx, r, c): (m, n) = (len(board), len(board[0])) if idx == len(word): return True if not (0 <= r < m and 0 <= c < n) or word[idx] != board[r][c]: return False for (i, j) in ((r - 1, c), (r + 1, c), (r, c - 1), (r, c + 1)): if (i, j) not in visited: visited.add((i, j)) if dfs(word, idx + 1, i, j): return True visited.remove((i, j)) return False visited = set() for (i, row) in enumerate(board): for (j, val) in enumerate(row): visited.add((i, j)) if dfs(word, 0, i, j): return True visited.clear() return False
print ('hello world') print ('hello second time') print ('Again and Again')
print('hello world') print('hello second time') print('Again and Again')
#!/usr/bin/env python3 disc_size = [17, 19, 7, 13, 5, 3] disc_pos = [5, 8, 1, 7, 1, 0] def solve(): shift_pos = [(disc_pos[i]+i+1)%disc_size[i] for i in range(len(disc_pos))] t = 0 while max(shift_pos) != 0: shift_pos = [(shift_pos[i]+1)%disc_size[i] for i in range(len(shift_pos))] t += 1 print(t) solve() disc_size += [11] disc_pos += [0] solve()
disc_size = [17, 19, 7, 13, 5, 3] disc_pos = [5, 8, 1, 7, 1, 0] def solve(): shift_pos = [(disc_pos[i] + i + 1) % disc_size[i] for i in range(len(disc_pos))] t = 0 while max(shift_pos) != 0: shift_pos = [(shift_pos[i] + 1) % disc_size[i] for i in range(len(shift_pos))] t += 1 print(t) solve() disc_size += [11] disc_pos += [0] solve()
''' enable extension for this user link : https://bits.bitcoin.org.hk/extensions?usr=dd09c7b0fe33480ab28252c9c9b85c6b&enable=lnurlp create a lnurlp pay link needs an admin key POST /lnurlp/api/v1/links Headers {"X-Api-Key": <admin_key>} Body (application/json) {"description": <string> "amount": <integer> "max": <integer> "min": <integer> "comment_chars": <integer>} Returns 201 CREATED (application/json) {"lnurl": <string>} '''
""" enable extension for this user link : https://bits.bitcoin.org.hk/extensions?usr=dd09c7b0fe33480ab28252c9c9b85c6b&enable=lnurlp create a lnurlp pay link needs an admin key POST /lnurlp/api/v1/links Headers {"X-Api-Key": <admin_key>} Body (application/json) {"description": <string> "amount": <integer> "max": <integer> "min": <integer> "comment_chars": <integer>} Returns 201 CREATED (application/json) {"lnurl": <string>} """
""" Person class """ # Create a Person class with the following properties # 1. name # 2. age # 3. social security number
""" Person class """
class Config: def __init__(self): self.DARKNET_PATH = "lib/pyyolo/darknet" self.DATACFG = "data/obj.data" self.CFGFILE = "cfg/yolo-obj.cfg" self.WEIGHTFILE_SKETCH = "models/yolo-obj_final_sketch.weights" self.WEIGHTFILE_TEMPLATES = "models/yolo-obj_45000.weights" self.CLASSESFILE = "data/predefined_classes.txt" self.THRESH = 0.45 self.HIER_THRESH = 0.5 self.OUT_DIR = "server/static/images" self.ASSET_DIR = "assets" # Snap to grid self.gheight = 200 self.gwidth = 200 # Color code self.cc_default = (0, 255, 0) self.cc_blue = (255, 0, 0) self.cc_green = (0, 255, 0) self.cc_red = (0, 0, 255) self.color_scheme = { "red": self.cc_red, "green": self.cc_green, "blue": self.cc_blue, "default": self.cc_default, }
class Config: def __init__(self): self.DARKNET_PATH = 'lib/pyyolo/darknet' self.DATACFG = 'data/obj.data' self.CFGFILE = 'cfg/yolo-obj.cfg' self.WEIGHTFILE_SKETCH = 'models/yolo-obj_final_sketch.weights' self.WEIGHTFILE_TEMPLATES = 'models/yolo-obj_45000.weights' self.CLASSESFILE = 'data/predefined_classes.txt' self.THRESH = 0.45 self.HIER_THRESH = 0.5 self.OUT_DIR = 'server/static/images' self.ASSET_DIR = 'assets' self.gheight = 200 self.gwidth = 200 self.cc_default = (0, 255, 0) self.cc_blue = (255, 0, 0) self.cc_green = (0, 255, 0) self.cc_red = (0, 0, 255) self.color_scheme = {'red': self.cc_red, 'green': self.cc_green, 'blue': self.cc_blue, 'default': self.cc_default}
# coding = utf-8 # Create date: 2018-11-6 # Author :Bowen Lee def test_kernel_headers(ros_kvm_init, cloud_config_url): command = 'sleep 10; sudo system-docker inspect kernel-headers' kwargs = dict(cloud_config='{url}test_kernel_headers.yml'.format(url=cloud_config_url), is_install_to_hard_drive=True) tuple_return = ros_kvm_init(**kwargs) client = tuple_return[0] stdin, stdout, stderr = client.exec_command(command) output = stdout.read().decode('utf-8') client.close() assert ('kernel-headers' in output)
def test_kernel_headers(ros_kvm_init, cloud_config_url): command = 'sleep 10; sudo system-docker inspect kernel-headers' kwargs = dict(cloud_config='{url}test_kernel_headers.yml'.format(url=cloud_config_url), is_install_to_hard_drive=True) tuple_return = ros_kvm_init(**kwargs) client = tuple_return[0] (stdin, stdout, stderr) = client.exec_command(command) output = stdout.read().decode('utf-8') client.close() assert 'kernel-headers' in output
NAME='router_xmldir' CFLAGS = [] LDFLAGS = [] LIBS = [] GCC_LIST = ['router_xmldir']
name = 'router_xmldir' cflags = [] ldflags = [] libs = [] gcc_list = ['router_xmldir']
class Solution: def brokenCalc(self, X, Y): res = 0 while X < Y: res += Y % 2 + 1 Y = (Y + 1) // 2 return res + X - Y
class Solution: def broken_calc(self, X, Y): res = 0 while X < Y: res += Y % 2 + 1 y = (Y + 1) // 2 return res + X - Y
class RemoteDockerException(RuntimeError): pass class InstanceNotRunning(RemoteDockerException): pass
class Remotedockerexception(RuntimeError): pass class Instancenotrunning(RemoteDockerException): pass
# 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 flipMatchVoyage(self, root: TreeNode, voyage: List[int]) -> List[int]: self.ix = 0 self.flipped = [] self.n = len(voyage) def preorder(node): if node: if node.val == voyage[self.ix]: self.ix += 1 if self.ix < self.n and node.left and node.left.val != voyage[self.ix]: self.flipped.append(node.val) preorder(node.right) preorder(node.left) else: preorder(node.left) preorder(node.right) else: self.flipped.append(-1) preorder(root) if self.flipped: for flg in self.flipped: if flg == -1: self.flipped = [-1] break return self.flipped
class Solution: def flip_match_voyage(self, root: TreeNode, voyage: List[int]) -> List[int]: self.ix = 0 self.flipped = [] self.n = len(voyage) def preorder(node): if node: if node.val == voyage[self.ix]: self.ix += 1 if self.ix < self.n and node.left and (node.left.val != voyage[self.ix]): self.flipped.append(node.val) preorder(node.right) preorder(node.left) else: preorder(node.left) preorder(node.right) else: self.flipped.append(-1) preorder(root) if self.flipped: for flg in self.flipped: if flg == -1: self.flipped = [-1] break return self.flipped
""" @author: magician @date: 2019/12/19 @file: key_word_demo.py """ def safe_division(number, divisor, ignore_overflow=False, ignore_zero_division=False): """ safe_division :param number: :param divisor: :param ignore_overflow: :param ignore_zero_division: :return: """ try: return number / divisor except OverflowError: if ignore_overflow: return 0 else: raise except ZeroDivisionError: if ignore_zero_division: return float('inf') else: raise def safe_division_d(number, divisor, **kwargs): """ safe_division_d :param number: :param divisor: :param kwargs: :return: """ # ignore_overflow = kwargs.pop('ignore_overflow', False) # ignore_zero_div = kwargs.pop('ignore_zero_division', False) if kwargs: raise TypeError('Unexpected **kwargs:{0}'.format(kwargs)) return True if __name__ == '__main__': result = safe_division(1.0, 10**500, True, False) print(result) result = safe_division(1, 0, False, True) print(result) try: safe_division(1, 10**500, ignore_overflow=True) except Exception as e: print(e) try: safe_division(1, 0, ignore_overflow=False) except Exception as e: print(e)
""" @author: magician @date: 2019/12/19 @file: key_word_demo.py """ def safe_division(number, divisor, ignore_overflow=False, ignore_zero_division=False): """ safe_division :param number: :param divisor: :param ignore_overflow: :param ignore_zero_division: :return: """ try: return number / divisor except OverflowError: if ignore_overflow: return 0 else: raise except ZeroDivisionError: if ignore_zero_division: return float('inf') else: raise def safe_division_d(number, divisor, **kwargs): """ safe_division_d :param number: :param divisor: :param kwargs: :return: """ if kwargs: raise type_error('Unexpected **kwargs:{0}'.format(kwargs)) return True if __name__ == '__main__': result = safe_division(1.0, 10 ** 500, True, False) print(result) result = safe_division(1, 0, False, True) print(result) try: safe_division(1, 10 ** 500, ignore_overflow=True) except Exception as e: print(e) try: safe_division(1, 0, ignore_overflow=False) except Exception as e: print(e)
def run_api_workflow_with_assertions(workflow_specification, current_request, test_context): current_request_result = current_request(test_context) if current_request_result is not None and current_request_result["continue_workflow"]: run_api_workflow_with_assertions( workflow_specification, workflow_specification[current_request_result["next_request"]], current_request_result["test_context"] )
def run_api_workflow_with_assertions(workflow_specification, current_request, test_context): current_request_result = current_request(test_context) if current_request_result is not None and current_request_result['continue_workflow']: run_api_workflow_with_assertions(workflow_specification, workflow_specification[current_request_result['next_request']], current_request_result['test_context'])
INPUT_SCHEMA = { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Deriva Demo Input", "description": ("Input schema for the demo DERIVA ingest Action Provider. This Action " "Provider can restore a DERIVA backup to a new or existing catalog, " "or create a new DERIVA catalog from a BDBag containing TableSchema."), "type": "object", "properties": { "data_url": { "type": "string", "format": "uri", "description": "The URL or path to the data for DERIVA ingest." }, ''' "fair_re_path": { "type": "string", "description": ("Path on the FAIR Research Examples endpoint, to support " "Globus Transfer (with Automate) input.") }, "restore": { "type": "boolean", "description": ("Whether or not this is a restoration of a backed-up catalog (true), " "or an ingest of TableSchema data (false). When true, data_url " "must point to a DERIVA backup. When false, data_url must point " "to a BDBag of TableSchema data. The default is false.") }, ''' "operation": { "type": "string", "description": ("The operation to perform on the data. If the data is a DERIVA backup " "to restore, use 'restore'. If the data is TableSchema to ingest into " "a new or existing DERIVA catalog, use 'ingest'. If you are only " "modifying the parameters of one catalog, use 'modify'."), "enum": [ "restore", "ingest", "modify" ] }, "server": { "type": "string", "description": ("The DERIVA server to ingest into. By default, will use the DERIVA " "demo server.") }, "catalog_id": { "type": ["string", "integer"], "description": ("The existing catalog ID to ingest into, or the name of a pre-defined " "catalog (e.g. 'prod'). To create a new catalog, do not specify " "this value. If specified, the catalog must exist.") }, "catalog_acls": { "type": "object", "description": ("The DERIVA permissions to apply to a new catalog. " "If no ACLs are provided here and a new catalog is being created, " "default ACLs will be used."), "properties": { "owner": { "type": "array", "description": "Formatted UUIDs for 'owner' permissions.", "items": { "type": "string", "description": "One UUID" } }, "insert": { "type": "array", "description": "Formatted UUIDs for 'insert' permissions.", "items": { "type": "string", "description": "One UUID" } }, "update": { "type": "array", "description": "Formatted UUIDs for 'update' permissions.", "items": { "type": "string", "description": "One UUID" } }, "delete": { "type": "array", "description": "Formatted UUIDs for 'delete' permissions.", "items": { "type": "string", "description": "One UUID" } }, "select": { "type": "array", "description": "Formatted UUIDs for 'select' permissions.", "items": { "type": "string", "description": "One UUID" } }, "enumerate": { "type": "array", "description": "Formatted UUIDs for 'enumerate' permissions.", "items": { "type": "string", "description": "One UUID" } } } } }, "required": ["operation"] } # TODO OUTPUT_SCHEMA = { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Deriva Demo Output", "description": "Output schema for the demo Deriva ingest Action Provider.", "type": "object", "properties": { }, "required": [ ] }
input_schema = {'$schema': 'http://json-schema.org/draft-04/schema#', 'title': 'Deriva Demo Input', 'description': 'Input schema for the demo DERIVA ingest Action Provider. This Action Provider can restore a DERIVA backup to a new or existing catalog, or create a new DERIVA catalog from a BDBag containing TableSchema.', 'type': 'object', 'properties': {'data_url': {'type': 'string', 'format': 'uri', 'description': 'The URL or path to the data for DERIVA ingest.'}, '\n "fair_re_path": {\n "type": "string",\n "description": ("Path on the FAIR Research Examples endpoint, to support "\n "Globus Transfer (with Automate) input.")\n },\n "restore": {\n "type": "boolean",\n "description": ("Whether or not this is a restoration of a backed-up catalog (true), "\n "or an ingest of TableSchema data (false). When true, data_url "\n "must point to a DERIVA backup. When false, data_url must point "\n "to a BDBag of TableSchema data. The default is false.")\n },\n operation': {'type': 'string', 'description': "The operation to perform on the data. If the data is a DERIVA backup to restore, use 'restore'. If the data is TableSchema to ingest into a new or existing DERIVA catalog, use 'ingest'. If you are only modifying the parameters of one catalog, use 'modify'.", 'enum': ['restore', 'ingest', 'modify']}, 'server': {'type': 'string', 'description': 'The DERIVA server to ingest into. By default, will use the DERIVA demo server.'}, 'catalog_id': {'type': ['string', 'integer'], 'description': "The existing catalog ID to ingest into, or the name of a pre-defined catalog (e.g. 'prod'). To create a new catalog, do not specify this value. If specified, the catalog must exist."}, 'catalog_acls': {'type': 'object', 'description': 'The DERIVA permissions to apply to a new catalog. If no ACLs are provided here and a new catalog is being created, default ACLs will be used.', 'properties': {'owner': {'type': 'array', 'description': "Formatted UUIDs for 'owner' permissions.", 'items': {'type': 'string', 'description': 'One UUID'}}, 'insert': {'type': 'array', 'description': "Formatted UUIDs for 'insert' permissions.", 'items': {'type': 'string', 'description': 'One UUID'}}, 'update': {'type': 'array', 'description': "Formatted UUIDs for 'update' permissions.", 'items': {'type': 'string', 'description': 'One UUID'}}, 'delete': {'type': 'array', 'description': "Formatted UUIDs for 'delete' permissions.", 'items': {'type': 'string', 'description': 'One UUID'}}, 'select': {'type': 'array', 'description': "Formatted UUIDs for 'select' permissions.", 'items': {'type': 'string', 'description': 'One UUID'}}, 'enumerate': {'type': 'array', 'description': "Formatted UUIDs for 'enumerate' permissions.", 'items': {'type': 'string', 'description': 'One UUID'}}}}}, 'required': ['operation']} output_schema = {'$schema': 'http://json-schema.org/draft-04/schema#', 'title': 'Deriva Demo Output', 'description': 'Output schema for the demo Deriva ingest Action Provider.', 'type': 'object', 'properties': {}, 'required': []}
h,m,s = map(int, input().split()) s += (m*60 + h*3600 + int(input())) h = s//3600 m = (s%3600)//60 s = (s%3600)%60 if h>23: h %= 24 print(h,m,s)
(h, m, s) = map(int, input().split()) s += m * 60 + h * 3600 + int(input()) h = s // 3600 m = s % 3600 // 60 s = s % 3600 % 60 if h > 23: h %= 24 print(h, m, s)
#!/usr/bin/env python3 def main(): s = 0 for j in range(1, 1001): s += j ** j print(str(s)[-10:]) if __name__ == '__main__': main()
def main(): s = 0 for j in range(1, 1001): s += j ** j print(str(s)[-10:]) if __name__ == '__main__': main()
""" Audio segment """ class Segment(): """ Audio segment """ def __init__(self, waveform, boundaries, sample_rate, channel): self._waveform = waveform self._boundaries = boundaries self._sample_rate = sample_rate self._channel = channel @property def waveform(self): """ Segment waveform """ return self._waveform @property def boundaries(self): """ Segment begin and end timestamp (in seconds) """ return self._boundaries @property def sample_rate(self): """ Sample rate """ return self._sample_rate @property def channel(self): """ Channel number (starts from 0) """ return self._channel
""" Audio segment """ class Segment: """ Audio segment """ def __init__(self, waveform, boundaries, sample_rate, channel): self._waveform = waveform self._boundaries = boundaries self._sample_rate = sample_rate self._channel = channel @property def waveform(self): """ Segment waveform """ return self._waveform @property def boundaries(self): """ Segment begin and end timestamp (in seconds) """ return self._boundaries @property def sample_rate(self): """ Sample rate """ return self._sample_rate @property def channel(self): """ Channel number (starts from 0) """ return self._channel
f = open("thirteen.txt", "r") lines = [x.strip() for x in f.readlines()] dots = [] for line in lines: if line == "": break p = line.split(",") dots.append((int(p[0]), int(p[1]))) folds = [line.split()[2] for line in lines if line.startswith("fold along ")] fold = folds[0] dir = fold[0] line = int(fold[2:]) new_dots = [] for x,y in dots: if dir == "y": if y > line: new_dots.append((x, y - 2 * (y - line))) else: new_dots.append((x, y)) elif dir == "x": if x > line: new_dots.append((x- 2 * (x - line), y)) else: new_dots.append((x, y)) print(len(set(new_dots))) for fold in folds: dir = fold[0] line = int(fold[2:]) new_dots = [] for x,y in dots: if dir == "y": if y > line: new_dots.append((x, y - 2 * (y - line))) else: new_dots.append((x, y)) elif dir == "x": if x > line: new_dots.append((x- 2 * (x - line), y)) else: new_dots.append((x, y)) dots = list(set(new_dots)) max_x = max([x for x,y in dots]) + 1 max_y = max([y for x,y in dots]) + 1 print(dots) screen = [] for y in range(max_y): screen.append([" "] * max_x) for x,y in dots: screen[y][x] = "#" for s in screen: print("".join(s))
f = open('thirteen.txt', 'r') lines = [x.strip() for x in f.readlines()] dots = [] for line in lines: if line == '': break p = line.split(',') dots.append((int(p[0]), int(p[1]))) folds = [line.split()[2] for line in lines if line.startswith('fold along ')] fold = folds[0] dir = fold[0] line = int(fold[2:]) new_dots = [] for (x, y) in dots: if dir == 'y': if y > line: new_dots.append((x, y - 2 * (y - line))) else: new_dots.append((x, y)) elif dir == 'x': if x > line: new_dots.append((x - 2 * (x - line), y)) else: new_dots.append((x, y)) print(len(set(new_dots))) for fold in folds: dir = fold[0] line = int(fold[2:]) new_dots = [] for (x, y) in dots: if dir == 'y': if y > line: new_dots.append((x, y - 2 * (y - line))) else: new_dots.append((x, y)) elif dir == 'x': if x > line: new_dots.append((x - 2 * (x - line), y)) else: new_dots.append((x, y)) dots = list(set(new_dots)) max_x = max([x for (x, y) in dots]) + 1 max_y = max([y for (x, y) in dots]) + 1 print(dots) screen = [] for y in range(max_y): screen.append([' '] * max_x) for (x, y) in dots: screen[y][x] = '#' for s in screen: print(''.join(s))
class FormattedTextRun(object, IDisposable): """ A structure that defines a single run of a formatted text. """ def Dispose(self): """ Dispose(self: FormattedTextRun) """ pass def ReleaseUnmanagedResources(self, *args): """ ReleaseUnmanagedResources(self: FormattedTextRun,disposing: bool) """ pass def __enter__(self, *args): """ __enter__(self: IDisposable) -> object """ pass def __exit__(self, *args): """ __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """ pass def __init__(self, *args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass def __repr__(self, *args): """ __repr__(self: object) -> str """ pass BaselineStyle = property( lambda self: object(), lambda self, v: None, lambda self: None ) """Specifies the style of the text as related to the baseline position. Get: BaselineStyle(self: FormattedTextRun) -> TextBaselineStyle """ Bold = property(lambda self: object(), lambda self, v: None, lambda self: None) """Indicates whether this text run uses Bold text. Get: Bold(self: FormattedTextRun) -> bool """ IsValidObject = property( lambda self: object(), lambda self, v: None, lambda self: None ) """Specifies whether the .NET object represents a valid Revit entity. Get: IsValidObject(self: FormattedTextRun) -> bool """ Italic = property(lambda self: object(), lambda self, v: None, lambda self: None) """Indicates whether this text run uses Italic text. Get: Italic(self: FormattedTextRun) -> bool """ ListStyle = property(lambda self: object(), lambda self, v: None, lambda self: None) """Specifies the style of a paragraph if the paragraph is a list. Get: ListStyle(self: FormattedTextRun) -> TextListStyle """ NewLine = property(lambda self: object(), lambda self, v: None, lambda self: None) """Indicates whether this text run starts on a new line. Get: NewLine(self: FormattedTextRun) -> bool """ NewParagraph = property( lambda self: object(), lambda self, v: None, lambda self: None ) """Indicates whether this text run starts a new paragraph. Get: NewParagraph(self: FormattedTextRun) -> bool """ TabNumber = property(lambda self: object(), lambda self, v: None, lambda self: None) """For a text run that starts at a tab stop,this value indicates the number of the tab stop. Get: TabNumber(self: FormattedTextRun) -> int """ Text = property(lambda self: object(), lambda self, v: None, lambda self: None) """The text segment in this text run. Get: Text(self: FormattedTextRun) -> str """ Underlined = property( lambda self: object(), lambda self, v: None, lambda self: None ) """Indicates whether this text run uses Underlined text. Get: Underlined(self: FormattedTextRun) -> bool """
class Formattedtextrun(object, IDisposable): """ A structure that defines a single run of a formatted text. """ def dispose(self): """ Dispose(self: FormattedTextRun) """ pass def release_unmanaged_resources(self, *args): """ ReleaseUnmanagedResources(self: FormattedTextRun,disposing: bool) """ pass def __enter__(self, *args): """ __enter__(self: IDisposable) -> object """ pass def __exit__(self, *args): """ __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """ pass def __init__(self, *args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass def __repr__(self, *args): """ __repr__(self: object) -> str """ pass baseline_style = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Specifies the style of the text as related to the baseline position.\n\n\n\nGet: BaselineStyle(self: FormattedTextRun) -> TextBaselineStyle\n\n\n\n' bold = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Indicates whether this text run uses Bold text.\n\n\n\nGet: Bold(self: FormattedTextRun) -> bool\n\n\n\n' is_valid_object = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Specifies whether the .NET object represents a valid Revit entity.\n\n\n\nGet: IsValidObject(self: FormattedTextRun) -> bool\n\n\n\n' italic = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Indicates whether this text run uses Italic text.\n\n\n\nGet: Italic(self: FormattedTextRun) -> bool\n\n\n\n' list_style = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Specifies the style of a paragraph if the paragraph is a list.\n\n\n\nGet: ListStyle(self: FormattedTextRun) -> TextListStyle\n\n\n\n' new_line = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Indicates whether this text run starts on a new line.\n\n\n\nGet: NewLine(self: FormattedTextRun) -> bool\n\n\n\n' new_paragraph = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Indicates whether this text run starts a new paragraph.\n\n\n\nGet: NewParagraph(self: FormattedTextRun) -> bool\n\n\n\n' tab_number = property(lambda self: object(), lambda self, v: None, lambda self: None) 'For a text run that starts at a tab stop,this value indicates the number of the tab stop.\n\n\n\nGet: TabNumber(self: FormattedTextRun) -> int\n\n\n\n' text = property(lambda self: object(), lambda self, v: None, lambda self: None) 'The text segment in this text run.\n\n\n\nGet: Text(self: FormattedTextRun) -> str\n\n\n\n' underlined = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Indicates whether this text run uses Underlined text.\n\n\n\nGet: Underlined(self: FormattedTextRun) -> bool\n\n\n\n'
def test_register_get(client, captured_templates): """ GIVEN a Flask application configured for testing (client) WHEN the '/' route is requested (GET) THEN there should be the correct `status_code`, `template.name`, and the correct `page_title` in the context """ # mimic a browser: 'GET /', as if you visit the site response = client.get("/register") # check that the HTTP response is a success assert response.status_code == 200 # check that the rendered template is the correct one assert len(captured_templates) == 1 template, context = captured_templates[0] assert template.name == "register.html" assert "page_title" in context assert context["page_title"] == "Register" def test_valid_register_post(client, captured_templates, test_db): """ GIVEN a Flask application configured for testing (client), the test db WHEN a user wants to register and posts valid data to '/register' (POST) THEN the user should be registered to the db, logged in, and redirected to the landing page. """ # mimic a browser: 'POST /register', as if you visit the site response = client.post( "/register", data=dict( username="28kadsen", email_address="28kadsen@gmail.com", password1="123456", password2="123456", ), follow_redirects=True, ) # check that the HTTP response fail assert response.status_code == 200 # check that the rendered template is the correct one assert len(captured_templates) == 1 template, context = captured_templates[0] assert template.name == "landing_page.html" assert "page_title" in context assert context["page_title"] == "Help & Help" html_content = response.data.decode() assert '<a class="nav-link" href="#">Welcome, 28kadsen</a>' in html_content def test_invalid_register_post(client, captured_templates, test_db): """ GIVEN a Flask application configured for testing (client) and the test db WHEN a user wants to register and posts invalid data to '/register' (POST) THEN the user should NOT be registered to the db, html contain error messages. """ # mimic a browser: 'POST /register', as if you visit the site response = client.post( "/register", data=dict( username="gottheit", email_address="28kadsengmail.com", password1="44444", password2="55555", ), follow_redirects=True, ) # check that the HTTP response is a success assert response.status_code == 400 # check that the rendered template is the correct one assert len(captured_templates) == 1 template, context = captured_templates[0] assert template.name == "register.html" assert "page_title" in context assert context["page_title"] == "Register" html_content = response.data.decode() assert "Invalid email address." in html_content assert "Field must be equal to password1." in html_content def test_login_get(client, captured_templates): """ GIVEN a Flask application configured for testing (client) WHEN the '/login' route is requested (GET) THEN there should be the correct `status_code`, `template.name`, and the correct `page_title` in the context """ # mimic a browser: 'GET /', as if you visit the site response = client.get("/login") # check that the HTTP response is a success assert response.status_code == 200 # check that the rendered template is the correct one assert len(captured_templates) == 1 template, context = captured_templates[0] assert template.name == "login.html" assert "page_title" in context assert context["page_title"] == "Login" def test_login_post(client, captured_templates, fake_user): """ GIVEN a Flask application configured for testing (client) and the fake_user WHEN the fake_user data is posted THEN then the fake_user should be logged in and redirected to the landing page """ # mimic a browser: 'POST /', as if you visit the site response = client.post( "/login", data=dict(username=fake_user.username, password="123456"), follow_redirects=True, ) # check that the HTTP response is a success assert response.status_code == 200 # check that the rendered template is the correct one assert len(captured_templates) == 1 template, context = captured_templates[0] assert template.name == "landing_page.html" assert "page_title" in context assert context["page_title"] == "Help & Help" def test_logout(client, captured_templates): """ GIVEN a Flask application configured for testing (client) WHEN the '/logout' route is requested (GET) THEN the user should be logged out and there should be the correct `status_code`, `template.name`, and the correct `page_title` in the context """ # mimic a browser: 'GET /', as if you visit the site response = client.get("/logout", follow_redirects=True) # check that the HTTP response is a success assert response.status_code == 200 # check that the rendered template is the correct one assert len(captured_templates) == 1 template, context = captured_templates[0] assert template.name == "login.html" assert "page_title" in context assert context["page_title"] == "Login"
def test_register_get(client, captured_templates): """ GIVEN a Flask application configured for testing (client) WHEN the '/' route is requested (GET) THEN there should be the correct `status_code`, `template.name`, and the correct `page_title` in the context """ response = client.get('/register') assert response.status_code == 200 assert len(captured_templates) == 1 (template, context) = captured_templates[0] assert template.name == 'register.html' assert 'page_title' in context assert context['page_title'] == 'Register' def test_valid_register_post(client, captured_templates, test_db): """ GIVEN a Flask application configured for testing (client), the test db WHEN a user wants to register and posts valid data to '/register' (POST) THEN the user should be registered to the db, logged in, and redirected to the landing page. """ response = client.post('/register', data=dict(username='28kadsen', email_address='28kadsen@gmail.com', password1='123456', password2='123456'), follow_redirects=True) assert response.status_code == 200 assert len(captured_templates) == 1 (template, context) = captured_templates[0] assert template.name == 'landing_page.html' assert 'page_title' in context assert context['page_title'] == 'Help & Help' html_content = response.data.decode() assert '<a class="nav-link" href="#">Welcome, 28kadsen</a>' in html_content def test_invalid_register_post(client, captured_templates, test_db): """ GIVEN a Flask application configured for testing (client) and the test db WHEN a user wants to register and posts invalid data to '/register' (POST) THEN the user should NOT be registered to the db, html contain error messages. """ response = client.post('/register', data=dict(username='gottheit', email_address='28kadsengmail.com', password1='44444', password2='55555'), follow_redirects=True) assert response.status_code == 400 assert len(captured_templates) == 1 (template, context) = captured_templates[0] assert template.name == 'register.html' assert 'page_title' in context assert context['page_title'] == 'Register' html_content = response.data.decode() assert 'Invalid email address.' in html_content assert 'Field must be equal to password1.' in html_content def test_login_get(client, captured_templates): """ GIVEN a Flask application configured for testing (client) WHEN the '/login' route is requested (GET) THEN there should be the correct `status_code`, `template.name`, and the correct `page_title` in the context """ response = client.get('/login') assert response.status_code == 200 assert len(captured_templates) == 1 (template, context) = captured_templates[0] assert template.name == 'login.html' assert 'page_title' in context assert context['page_title'] == 'Login' def test_login_post(client, captured_templates, fake_user): """ GIVEN a Flask application configured for testing (client) and the fake_user WHEN the fake_user data is posted THEN then the fake_user should be logged in and redirected to the landing page """ response = client.post('/login', data=dict(username=fake_user.username, password='123456'), follow_redirects=True) assert response.status_code == 200 assert len(captured_templates) == 1 (template, context) = captured_templates[0] assert template.name == 'landing_page.html' assert 'page_title' in context assert context['page_title'] == 'Help & Help' def test_logout(client, captured_templates): """ GIVEN a Flask application configured for testing (client) WHEN the '/logout' route is requested (GET) THEN the user should be logged out and there should be the correct `status_code`, `template.name`, and the correct `page_title` in the context """ response = client.get('/logout', follow_redirects=True) assert response.status_code == 200 assert len(captured_templates) == 1 (template, context) = captured_templates[0] assert template.name == 'login.html' assert 'page_title' in context assert context['page_title'] == 'Login'
class Solution: # @param A : integer # @return a list of strings def fizzBuzz(self, n): result = [] for i in range(1, n+1): s = '' if i %3 == 0: s += 'Fizz' if i % 5 == 0: s += 'Buzz' if s == '': result.append(i) else: result.append(s) return result
class Solution: def fizz_buzz(self, n): result = [] for i in range(1, n + 1): s = '' if i % 3 == 0: s += 'Fizz' if i % 5 == 0: s += 'Buzz' if s == '': result.append(i) else: result.append(s) return result
class Tag: _major: str _minor: str _separator: str _factors: dict def __init__(self, major: str, minor="", separator="", **kwargs): self._major = major self._minor = minor self._separator = separator self._factors = kwargs @property def major(self) -> str: return self._major @major.setter def major(self, value: str): self._major = value @property def minor(self) -> str: return self._minor @minor.setter def minor(self, value: str): self._minor = value @property def separator(self) -> str: return self._separator @separator.setter def separator(self, value: str): self._separator = value @property def factors(self) -> dict: return self._factors @factors.setter def factors(self, value: dict): self._factors = value def __str__(self): tags = [] if self._minor != '': tags.append(self._major + self._separator + self._minor) else: tags.append(self._major) for key, val in self._factors.items(): tags.append(f"{key}={val}") return ';'.join(tags) class MimeTypeTag(Tag): def __init__(self, mime_type: str = "*", sub_type: str = "*", **kwargs): super(MimeTypeTag, self).__init__(mime_type, sub_type, '/', **kwargs) class LanguageTag(Tag): def __init__(self, lang: str, country_code: str = '', **kwargs): super(LanguageTag, self).__init__(lang, country_code, '-', **kwargs)
class Tag: _major: str _minor: str _separator: str _factors: dict def __init__(self, major: str, minor='', separator='', **kwargs): self._major = major self._minor = minor self._separator = separator self._factors = kwargs @property def major(self) -> str: return self._major @major.setter def major(self, value: str): self._major = value @property def minor(self) -> str: return self._minor @minor.setter def minor(self, value: str): self._minor = value @property def separator(self) -> str: return self._separator @separator.setter def separator(self, value: str): self._separator = value @property def factors(self) -> dict: return self._factors @factors.setter def factors(self, value: dict): self._factors = value def __str__(self): tags = [] if self._minor != '': tags.append(self._major + self._separator + self._minor) else: tags.append(self._major) for (key, val) in self._factors.items(): tags.append(f'{key}={val}') return ';'.join(tags) class Mimetypetag(Tag): def __init__(self, mime_type: str='*', sub_type: str='*', **kwargs): super(MimeTypeTag, self).__init__(mime_type, sub_type, '/', **kwargs) class Languagetag(Tag): def __init__(self, lang: str, country_code: str='', **kwargs): super(LanguageTag, self).__init__(lang, country_code, '-', **kwargs)
def boyer_moore_bad_environment(A, p, m, k): bad_table = {(i, a): True for i in range(1, m + 1) for a in A} for i in range(1, m + 1): for j in range(max(0, i - k), min(i + k, m) + 1): bad_table[(j, p[i])] = False return bad_table def boyer_moore_multi_dim_shift(A, p, m, k): ready = {a: m + 1 for a in A} BM_k = {(i, a): m for a in A for i in range(m, m - k - 1, -1)} for i in range(m - 1, 0, -1): for j in range(ready[p[i]] - 1, max(i, m - k) - 1, -1): BM_k[(j, p[i])] = j - i ready[p[i]] = max(i, m - k) return BM_k def approximate_boyer_moore(text, p, n, m, k, A=None): if A is None: A = set(list(text[1:] + p[1:])) BM_k = boyer_moore_multi_dim_shift(A, p, m, k) BAD = boyer_moore_bad_environment(A, p, m, k) j, top = m, min(k + 1, m) D_0 = list(range(m + 1)) D_curr = D_0[:] curr_col, j = next_possible_occurence(text, n, m, k, BM_k, BAD, j) if curr_col <= 0: curr_col = 1 last_col = curr_col + m + 2 * k while curr_col <= n: for r in range(curr_col, last_col + 1): c = 0 # evaluate another column of D for i in range(1, top + 1): d = c if r <= n and p[i] == text[r] \ else min(D_curr[i - 1], D_curr[i], c) + 1 c, D_curr[i] = D_curr[i], d while D_curr[top] > k: top -= 1 # if D[m] <= k we have a match if top == m: if r <= n: yield r else: top += 1 next_possible, j = next_possible_occurence(text, n, m, k, BM_k, BAD, j) if next_possible > last_col + 1: D_curr, top, curr_col = D_0[:], min(k + 1, m), next_possible else: curr_col = last_col + 1 last_col = next_possible + m + 2 * k def next_possible_occurence(text, n, m, k, BM_k, BAD, j): while j <= n + k: r, i, bad, d = j, m, 0, m while i > k >= bad: if i >= m - k and r <= n: d = min(d, BM_k[(i, text[r])]) if r <= n and BAD[(i, text[r])]: bad = bad + 1 i, r = i - 1, r - 1 if bad <= k: if j <= (n + k): npo = j - m - k j = j + max(k + 1, d) return npo, j j = j + max(k + 1, d) return n + 1, j def simple_dynamic_edit_distance(text, p, n, m, k): D = {(0, j): 0 for j in range(n + 1)} for i in range(m + 1): D[(i, 0)] = i for i in range(1, m + 1): for j in range(1, n + 1): D[(i, j)] = min(D[(i - 1, j)] + 1, D[(i, j - 1)] + 1, D[(i - 1, j - 1)] + int(p[i] != text[j])) for j in range(1, n + 1): if D[(m, j)] <= k: yield j
def boyer_moore_bad_environment(A, p, m, k): bad_table = {(i, a): True for i in range(1, m + 1) for a in A} for i in range(1, m + 1): for j in range(max(0, i - k), min(i + k, m) + 1): bad_table[j, p[i]] = False return bad_table def boyer_moore_multi_dim_shift(A, p, m, k): ready = {a: m + 1 for a in A} bm_k = {(i, a): m for a in A for i in range(m, m - k - 1, -1)} for i in range(m - 1, 0, -1): for j in range(ready[p[i]] - 1, max(i, m - k) - 1, -1): BM_k[j, p[i]] = j - i ready[p[i]] = max(i, m - k) return BM_k def approximate_boyer_moore(text, p, n, m, k, A=None): if A is None: a = set(list(text[1:] + p[1:])) bm_k = boyer_moore_multi_dim_shift(A, p, m, k) bad = boyer_moore_bad_environment(A, p, m, k) (j, top) = (m, min(k + 1, m)) d_0 = list(range(m + 1)) d_curr = D_0[:] (curr_col, j) = next_possible_occurence(text, n, m, k, BM_k, BAD, j) if curr_col <= 0: curr_col = 1 last_col = curr_col + m + 2 * k while curr_col <= n: for r in range(curr_col, last_col + 1): c = 0 for i in range(1, top + 1): d = c if r <= n and p[i] == text[r] else min(D_curr[i - 1], D_curr[i], c) + 1 (c, D_curr[i]) = (D_curr[i], d) while D_curr[top] > k: top -= 1 if top == m: if r <= n: yield r else: top += 1 (next_possible, j) = next_possible_occurence(text, n, m, k, BM_k, BAD, j) if next_possible > last_col + 1: (d_curr, top, curr_col) = (D_0[:], min(k + 1, m), next_possible) else: curr_col = last_col + 1 last_col = next_possible + m + 2 * k def next_possible_occurence(text, n, m, k, BM_k, BAD, j): while j <= n + k: (r, i, bad, d) = (j, m, 0, m) while i > k >= bad: if i >= m - k and r <= n: d = min(d, BM_k[i, text[r]]) if r <= n and BAD[i, text[r]]: bad = bad + 1 (i, r) = (i - 1, r - 1) if bad <= k: if j <= n + k: npo = j - m - k j = j + max(k + 1, d) return (npo, j) j = j + max(k + 1, d) return (n + 1, j) def simple_dynamic_edit_distance(text, p, n, m, k): d = {(0, j): 0 for j in range(n + 1)} for i in range(m + 1): D[i, 0] = i for i in range(1, m + 1): for j in range(1, n + 1): D[i, j] = min(D[i - 1, j] + 1, D[i, j - 1] + 1, D[i - 1, j - 1] + int(p[i] != text[j])) for j in range(1, n + 1): if D[m, j] <= k: yield j
# dfir_ntfs: an NTFS parser for digital forensics & incident response # (c) Maxim Suhanov __version__ = '1.0.3' __all__ = [ 'MFT', 'Attributes', 'WSL', 'USN', 'LogFile', 'BootSector', 'ShadowCopy', 'PartitionTable' ]
__version__ = '1.0.3' __all__ = ['MFT', 'Attributes', 'WSL', 'USN', 'LogFile', 'BootSector', 'ShadowCopy', 'PartitionTable']
# motorsports.vehicles # description # # Author: Allen Leis <allen.leis@georgetown.edu> # Created: Fri Sep 11 23:22:32 2015 -0400 # # Copyright (C) 2015 georgetown.edu # For license information, see LICENSE.txt # # ID: vehicles.py [] allen.leis@georgetown.edu $ """ A module to supply building related classes """ ########################################################################## ## Imports ########################################################################## ########################################################################## ## Classes ########################################################################## class BaseVehicle(object): def __init__(self): self._state = None @property def state(self): """ return a string describing the state of the vehicle """ return self._state or 'stopped' @property def description(self): """ return a string describing this object """ return self.__class__.__name__ def start(self): """ Starts the vehicle """ self._state = 'started' def shutdown(self): """ Starts the vehicle """ self._state = 'stopped' def __str__(self): return "I am a {}.".format(self.description) class Car(BaseVehicle): def __init__(self, color, make, model): self.color = color self.make = make self.model = model super(Car, self).__init__() @property def description(self): """ return a string describing this object """ return '{} {} {}'.format(self.color, self.make, self.model) def start(self): """ Starts the vehicle """ super(Car, self).start() print('vroom') ########################################################################## ## Execution ########################################################################## if __name__ == '__main__': c = Car('white', 'Ford', 'Bronco') print(c.state) c.start() print(c.state)
""" A module to supply building related classes """ class Basevehicle(object): def __init__(self): self._state = None @property def state(self): """ return a string describing the state of the vehicle """ return self._state or 'stopped' @property def description(self): """ return a string describing this object """ return self.__class__.__name__ def start(self): """ Starts the vehicle """ self._state = 'started' def shutdown(self): """ Starts the vehicle """ self._state = 'stopped' def __str__(self): return 'I am a {}.'.format(self.description) class Car(BaseVehicle): def __init__(self, color, make, model): self.color = color self.make = make self.model = model super(Car, self).__init__() @property def description(self): """ return a string describing this object """ return '{} {} {}'.format(self.color, self.make, self.model) def start(self): """ Starts the vehicle """ super(Car, self).start() print('vroom') if __name__ == '__main__': c = car('white', 'Ford', 'Bronco') print(c.state) c.start() print(c.state)
# obtain the comma-separated value from the user csv = input("Enter string: ") # split the string by the coma and save it in a list csv = csv.split(',') # displaying each of the variables # csv[0] is the name # csv[1] is the age # csv[2] is the phone number print('\n{0:=<30}\nName: {1:30}\nAge: {2:30}\nContact: {3:30}\n{4:=<30}\n'.format('', csv[0], csv[1], csv[2], ''))
csv = input('Enter string: ') csv = csv.split(',') print('\n{0:=<30}\nName: {1:30}\nAge: {2:30}\nContact: {3:30}\n{4:=<30}\n'.format('', csv[0], csv[1], csv[2], ''))
class Solution: def sortedSquares(self, nums: List[int]) -> List[int]: arr = [] for i in nums: sq = i*i arr.append(sq) return sorted(arr)
class Solution: def sorted_squares(self, nums: List[int]) -> List[int]: arr = [] for i in nums: sq = i * i arr.append(sq) return sorted(arr)
# Fibonacci numbers def fibs(_to, _from=0): ''' Returns a given range of fibonacci sequence. Both indexes are included. fibonacci_sequence[_from:_to] param _to: int [required] - upper index of requested range param _from: int [optional] - lower index of requested range returns: list - requested range of fibonacci sequence ''' rev_ord = _from > _to if rev_ord: neg_end, pos_end = _to, _from else: neg_end, pos_end = _from, _to neg = neg_end < 0 pos = pos_end > 0 if pos_end < 0: rev_ord = not rev_ord def fib_a(end, neg=0): seq.append(0) if end > 1: seq.append(neg or 1) if end > 2: fib_b(end-2) neg and seq.reverse() def fib_b(reps): for i in range(reps): seq.append(seq[-2] + seq[-1]) seq = []; if neg: fib_a(-neg_end, -1) if pos: fib_a(pos_end) if pos_end < 0: seq.reverse() seq = seq[-(pos_end-neg_end+1):] if rev_ord: seq.reverse() return seq def fib(num): ''' Runs a fibs function with given num param as fibs(end=num), and returns last element from fibs run result. param num: int, required; requested number of fibonacci sequence returns: int; number from fibonacci sequence ''' if num == 0: return None return fibs(num)[-1] if __name__ == '__main__': print(fibs(255, -255))
def fibs(_to, _from=0): """ Returns a given range of fibonacci sequence. Both indexes are included. fibonacci_sequence[_from:_to] param _to: int [required] - upper index of requested range param _from: int [optional] - lower index of requested range returns: list - requested range of fibonacci sequence """ rev_ord = _from > _to if rev_ord: (neg_end, pos_end) = (_to, _from) else: (neg_end, pos_end) = (_from, _to) neg = neg_end < 0 pos = pos_end > 0 if pos_end < 0: rev_ord = not rev_ord def fib_a(end, neg=0): seq.append(0) if end > 1: seq.append(neg or 1) if end > 2: fib_b(end - 2) neg and seq.reverse() def fib_b(reps): for i in range(reps): seq.append(seq[-2] + seq[-1]) seq = [] if neg: fib_a(-neg_end, -1) if pos: fib_a(pos_end) if pos_end < 0: seq.reverse() seq = seq[-(pos_end - neg_end + 1):] if rev_ord: seq.reverse() return seq def fib(num): """ Runs a fibs function with given num param as fibs(end=num), and returns last element from fibs run result. param num: int, required; requested number of fibonacci sequence returns: int; number from fibonacci sequence """ if num == 0: return None return fibs(num)[-1] if __name__ == '__main__': print(fibs(255, -255))
def greedy_player_mgt(game_mgr): game_mgr = game_mgr def fn_get_action(pieces): valid_moves = game_mgr.fn_get_valid_moves(pieces, 1) if valid_moves is None: return None candidates = [] for a in range(game_mgr.fn_get_action_size()): if valid_moves[a]==0: continue nextPieces = game_mgr.fn_get_next_state(pieces, 1, a) score = game_mgr.fn_get_score(nextPieces, 1) candidates += [(-score, a)] candidates.sort() return candidates[0][1] return fn_get_action
def greedy_player_mgt(game_mgr): game_mgr = game_mgr def fn_get_action(pieces): valid_moves = game_mgr.fn_get_valid_moves(pieces, 1) if valid_moves is None: return None candidates = [] for a in range(game_mgr.fn_get_action_size()): if valid_moves[a] == 0: continue next_pieces = game_mgr.fn_get_next_state(pieces, 1, a) score = game_mgr.fn_get_score(nextPieces, 1) candidates += [(-score, a)] candidates.sort() return candidates[0][1] return fn_get_action
# Time: O(n) # Space: O(1) class Solution(object): def maximumPopulation(self, logs): """ :type logs: List[List[int]] :rtype: int """ MIN_YEAR, MAX_YEAR = 1950, 2050 years = [0]*(MAX_YEAR-MIN_YEAR+1) for s, e in logs: years[s-MIN_YEAR] += 1 years[e-MIN_YEAR] -= 1 result = 0 for i in xrange(len(years)): if i: years[i] += years[i-1] if years[i] > years[result]: result = i return result+MIN_YEAR
class Solution(object): def maximum_population(self, logs): """ :type logs: List[List[int]] :rtype: int """ (min_year, max_year) = (1950, 2050) years = [0] * (MAX_YEAR - MIN_YEAR + 1) for (s, e) in logs: years[s - MIN_YEAR] += 1 years[e - MIN_YEAR] -= 1 result = 0 for i in xrange(len(years)): if i: years[i] += years[i - 1] if years[i] > years[result]: result = i return result + MIN_YEAR
# Time: O(1), per move. # Space: O(n^2) class TicTacToe(object): def __init__(self, n): """ Initialize your data structure here. :type n: int """ self.__rows = [[0, 0] for _ in xrange(n)] self.__cols = [[0, 0] for _ in xrange(n)] self.__diagonal = [0, 0] self.__anti_diagonal = [0, 0] def move(self, row, col, player): """ Player {player} makes a move at ({row}, {col}). @param row The row of the board. @param col The column of the board. @param player The player, can be either 1 or 2. @return The current winning condition, can be either: 0: No one wins. 1: Player 1 wins. 2: Player 2 wins. :type row: int :type col: int :type player: int :rtype: int """ i = player - 1 self.__rows[row][i] += 1 self.__cols[col][i] += 1 if row == col: self.__diagonal[i] += 1 if col == len(self.__rows) - row - 1: self.__anti_diagonal[i] += 1 if any([self.__rows[row][i] == len(self.__rows), \ self.__cols[col][i] == len(self.__cols), \ self.__diagonal[i] == len(self.__rows), \ self.__anti_diagonal[i] == len(self.__cols)]): return player return 0 # Your TicTacToe object will be instantiated and called as such: # obj = TicTacToe(n) # param_1 = obj.move(row,col,player)
class Tictactoe(object): def __init__(self, n): """ Initialize your data structure here. :type n: int """ self.__rows = [[0, 0] for _ in xrange(n)] self.__cols = [[0, 0] for _ in xrange(n)] self.__diagonal = [0, 0] self.__anti_diagonal = [0, 0] def move(self, row, col, player): """ Player {player} makes a move at ({row}, {col}). @param row The row of the board. @param col The column of the board. @param player The player, can be either 1 or 2. @return The current winning condition, can be either: 0: No one wins. 1: Player 1 wins. 2: Player 2 wins. :type row: int :type col: int :type player: int :rtype: int """ i = player - 1 self.__rows[row][i] += 1 self.__cols[col][i] += 1 if row == col: self.__diagonal[i] += 1 if col == len(self.__rows) - row - 1: self.__anti_diagonal[i] += 1 if any([self.__rows[row][i] == len(self.__rows), self.__cols[col][i] == len(self.__cols), self.__diagonal[i] == len(self.__rows), self.__anti_diagonal[i] == len(self.__cols)]): return player return 0
# Lists in Python are mutable objects that may contain # any number of items of different types my_list = [1, "Hello", True, 3.4] # Python allows negative indexing my_list = [1, 2, 3, 4, 5, 6] print(my_list[-1]) # We can access a range of items within the list using slicing # my_list[start:stop:step] my_list = ['H', 'e', 'l', 'l', 'o', 'W', 'o', 'r', 'l', 'd'] print(my_list[2:5]) print(my_list[5:]) print(my_list[:-2]) print(my_list[::-1]) my_list = [1, 2, 3, 4, 5] my_list.append(6) my_list.insert(2, 7) print(my_list) print(my_list.pop()) print(my_list.pop(0)) print(my_list.count(3))
my_list = [1, 'Hello', True, 3.4] my_list = [1, 2, 3, 4, 5, 6] print(my_list[-1]) my_list = ['H', 'e', 'l', 'l', 'o', 'W', 'o', 'r', 'l', 'd'] print(my_list[2:5]) print(my_list[5:]) print(my_list[:-2]) print(my_list[::-1]) my_list = [1, 2, 3, 4, 5] my_list.append(6) my_list.insert(2, 7) print(my_list) print(my_list.pop()) print(my_list.pop(0)) print(my_list.count(3))
l = [2, 5, 6, 5, 11] def isPal(x): str_num = str(x) if len(str_num) == 1: return True if len(str_num) % 2 != 0: mid = int(len(str_num)/2) front = str_num[:mid] back = str_num[mid+1:] else: mid = int(len(str_num)/2) front = str_num[:mid] back = str_num[mid:] stack = [i for i in back] back = '' for i in range(0, len(stack)): back = back + stack.pop() if front == back: return True else: return False print(isPal(1011301))
l = [2, 5, 6, 5, 11] def is_pal(x): str_num = str(x) if len(str_num) == 1: return True if len(str_num) % 2 != 0: mid = int(len(str_num) / 2) front = str_num[:mid] back = str_num[mid + 1:] else: mid = int(len(str_num) / 2) front = str_num[:mid] back = str_num[mid:] stack = [i for i in back] back = '' for i in range(0, len(stack)): back = back + stack.pop() if front == back: return True else: return False print(is_pal(1011301))
# take two input numbers number1 = input("Insert first number : ") number2 = input("Insert second number : ") operator = input("Insert operator (+ or - or * or /)") if operator == '+': total = number1 + number2 elif operator == '-': total = number1 - number2 elif operator == '*': total = number2 * number1 elif operator == '/': total = number1 / number2 else: total = "invalid operator" # printing output print(total)
number1 = input('Insert first number : ') number2 = input('Insert second number : ') operator = input('Insert operator (+ or - or * or /)') if operator == '+': total = number1 + number2 elif operator == '-': total = number1 - number2 elif operator == '*': total = number2 * number1 elif operator == '/': total = number1 / number2 else: total = 'invalid operator' print(total)
""" File containing all local variable necessary for the script to run """ #Enter your domain name. A value beginning with a period can be used as a subdomain wildcard. DOMAIN = ".locktopus.fr" #PATHS : DEVELOPMENT_SETTINGS_FILE_PATH = "../locktopus/web_project/settings.py"
""" File containing all local variable necessary for the script to run """ domain = '.locktopus.fr' development_settings_file_path = '../locktopus/web_project/settings.py'
# https://leetcode.com/problems/gray-code/ # # algorithms # Easy (35.75%) # Total Accepted: 365,649 # Total Submissions: 1,022,741 # beats 95.52% of python submissions class Solution(object): def merge(self, nums1, m, nums2, n): """ :type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void Do not return anything, modify nums1 in-place instead. """ while m and n: if nums1[m - 1] > nums2[n - 1]: nums1[m + n - 1] = nums1[m - 1] m -= 1 else: nums1[m + n - 1] = nums2[n - 1] n -= 1 nums1[:n] = nums2[:n] return nums1
class Solution(object): def merge(self, nums1, m, nums2, n): """ :type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void Do not return anything, modify nums1 in-place instead. """ while m and n: if nums1[m - 1] > nums2[n - 1]: nums1[m + n - 1] = nums1[m - 1] m -= 1 else: nums1[m + n - 1] = nums2[n - 1] n -= 1 nums1[:n] = nums2[:n] return nums1
# Geometry.py # Tasks # Write these functions to calculate following tasks # 1. Areas ==> Circle, Triangle, Reactangle, Square,.. # 2. Volumes ==> Sphere, Pyramid, Prism, Cone, def rectangle(width, length): return width * length def perimeter_rect(width, length): return 2*width + 2*length def triangle(base, height): return 0.5 * base * height def perimeter_triangle(a, b, c): return a + b + c if __name__ == '__main__': print("Geometry.py") area_rect = rectangle(10, 100) peri_rect = perimeter_rect(10, 100) area_tri = triangle(30, 60) peri_tri = perimeter_triangle(10, 20, 30) print(f'Area of React = {area_rect} unit sqrt.') print(f'Perimeter of React = {peri_rect} unit.') print('='*50) print(f'Area of Triangle = {area_tri} unit sqrt') print(f'Perimeter of Triangle = {peri_tri} unit')
def rectangle(width, length): return width * length def perimeter_rect(width, length): return 2 * width + 2 * length def triangle(base, height): return 0.5 * base * height def perimeter_triangle(a, b, c): return a + b + c if __name__ == '__main__': print('Geometry.py') area_rect = rectangle(10, 100) peri_rect = perimeter_rect(10, 100) area_tri = triangle(30, 60) peri_tri = perimeter_triangle(10, 20, 30) print(f'Area of React = {area_rect} unit sqrt.') print(f'Perimeter of React = {peri_rect} unit.') print('=' * 50) print(f'Area of Triangle = {area_tri} unit sqrt') print(f'Perimeter of Triangle = {peri_tri} unit')
def pascal(p): result = [] for i in range(p): if i == 0: result.append([1]) else: result.append([1] + [result[i - 1][j] + result[i - 1][j + 1] for j in range(len(result[i - 1]) - 1)] + [1]) return result
def pascal(p): result = [] for i in range(p): if i == 0: result.append([1]) else: result.append([1] + [result[i - 1][j] + result[i - 1][j + 1] for j in range(len(result[i - 1]) - 1)] + [1]) return result
def encode(key: str, txt: str): txt_c = '' for index in range(0, len(txt)): txt_int = ord(txt[index].lower()) + (ord(key[index % len(key)].upper()) - 65) if txt_int > 122: txt_int = txt_int - 26 if txt_int < 97 or txt_int > 122: txt_c = txt_c + txt[index] else: txt_c = txt_c + chr(txt_int) return txt_c.upper() def decode(key: str, txt_c: str): txt = '' for index in range(0, len(txt_c)): txt_int = ord(txt_c[index]) - (ord(key[index % len(key)].upper()) - 65) if txt_int < 97: txt_int = txt_int + 26 if txt_int < 97 or txt_int > 122: txt = txt + txt_c[index] else: txt = txt + chr(txt_int) return txt
def encode(key: str, txt: str): txt_c = '' for index in range(0, len(txt)): txt_int = ord(txt[index].lower()) + (ord(key[index % len(key)].upper()) - 65) if txt_int > 122: txt_int = txt_int - 26 if txt_int < 97 or txt_int > 122: txt_c = txt_c + txt[index] else: txt_c = txt_c + chr(txt_int) return txt_c.upper() def decode(key: str, txt_c: str): txt = '' for index in range(0, len(txt_c)): txt_int = ord(txt_c[index]) - (ord(key[index % len(key)].upper()) - 65) if txt_int < 97: txt_int = txt_int + 26 if txt_int < 97 or txt_int > 122: txt = txt + txt_c[index] else: txt = txt + chr(txt_int) return txt
# Class to store Trie(Patterns) # It handles all cases particularly the case where a pattern Pi is a subtext of a pattern Pj for i != j class Trie_Patterns: def __init__(self, patterns, start, end): self.build_trie(patterns, start, end) # The trie will be a dictionary of dictionaries where: # ... The key of the external dictionary is the node ID (integer), # ... The internal dictionary: # ...... It contains all the trie edges outgoing from the corresponding node # ...... Its keys are the letters on those edges # ...... Its values are the node IDs to which these edges lead # Time Complexity: O(|patterns|) # Space Complexity: O(|patterns|) def build_trie(self, patterns, start, end): self.trie = dict() self.trie[0] = dict() self.node_patterns_mapping = dict() self.max_node_no = 0 for i in range(len(patterns)): self.insert(patterns[i], i, start, end) def insert(self, pattern, pattern_no, start, end): (index, node) = self.search_text(pattern, start, end) i = index while i <= (end+1): if i == end + 1: c = '$' # to handle the case where Pi is a substring of Pj for i != j else: c = pattern[i] self.max_node_no += 1 self.trie[node][c] = self.max_node_no self.trie[self.max_node_no] = dict() node = self.max_node_no i += 1 if not node in self.node_patterns_mapping: self.node_patterns_mapping[node] = [] self.node_patterns_mapping[node].append(pattern_no) def search_text(self, pattern, start, end): if len(self.trie) == 0: return (0, -1) node = 0 i = start while i <= (end+1): if i == end + 1: c = '$' # to handle the case where Pi is a substring of Pj for i != j else: c = pattern[i] if c in self.trie[node]: node = self.trie[node][c] i += 1 continue else: break return (i, node) # Prints the trie in the form of a dictionary of dictionaries # E.g. For the following patterns: ["AC", "T"] {0:{'A':1,'T':2},1:{'C':3}} def print_tree(self): for node in self.trie: for c in self.trie[node]: print("{}->{}:{}".format(node, self.trie[node][c], c)) print(self.node_patterns_mapping) # Time Complexity: O(|text| * |longest pattern|) def multi_pattern_matching(self, text, start, end): if len(self.trie) == 0: return [] (i, node) = self.search_text(text, start, end) return self.node_patterns_mapping[node] if node in self.node_patterns_mapping else []
class Trie_Patterns: def __init__(self, patterns, start, end): self.build_trie(patterns, start, end) def build_trie(self, patterns, start, end): self.trie = dict() self.trie[0] = dict() self.node_patterns_mapping = dict() self.max_node_no = 0 for i in range(len(patterns)): self.insert(patterns[i], i, start, end) def insert(self, pattern, pattern_no, start, end): (index, node) = self.search_text(pattern, start, end) i = index while i <= end + 1: if i == end + 1: c = '$' else: c = pattern[i] self.max_node_no += 1 self.trie[node][c] = self.max_node_no self.trie[self.max_node_no] = dict() node = self.max_node_no i += 1 if not node in self.node_patterns_mapping: self.node_patterns_mapping[node] = [] self.node_patterns_mapping[node].append(pattern_no) def search_text(self, pattern, start, end): if len(self.trie) == 0: return (0, -1) node = 0 i = start while i <= end + 1: if i == end + 1: c = '$' else: c = pattern[i] if c in self.trie[node]: node = self.trie[node][c] i += 1 continue else: break return (i, node) def print_tree(self): for node in self.trie: for c in self.trie[node]: print('{}->{}:{}'.format(node, self.trie[node][c], c)) print(self.node_patterns_mapping) def multi_pattern_matching(self, text, start, end): if len(self.trie) == 0: return [] (i, node) = self.search_text(text, start, end) return self.node_patterns_mapping[node] if node in self.node_patterns_mapping else []
def trikotniska_stevila(n): vsota = 0 for i in range(1, n + 1): vsota += i return vsota def najdi(): j = 0 n = 0 st_deliteljev = 0 while st_deliteljev <= 500: st_deliteljev = 0 j += 1 n = trikotniska_stevila(j) i = 1 while i <= n ** 0.5: if n % i == 0: st_deliteljev += 1 i += 1 st_deliteljev *= 2 return n print(najdi())
def trikotniska_stevila(n): vsota = 0 for i in range(1, n + 1): vsota += i return vsota def najdi(): j = 0 n = 0 st_deliteljev = 0 while st_deliteljev <= 500: st_deliteljev = 0 j += 1 n = trikotniska_stevila(j) i = 1 while i <= n ** 0.5: if n % i == 0: st_deliteljev += 1 i += 1 st_deliteljev *= 2 return n print(najdi())
pid_yaw = rm_ctrl.PIDCtrl() list_LineList = RmList() variable_X = 0 def start(): global variable_X global list_LineList global pid_yaw robot_ctrl.set_mode(rm_define.robot_mode_chassis_follow) # rotate gimbal downward so the line is more visible gimbal_ctrl.pitch_ctrl(-20) # enable line detection and set color to blue vision_ctrl.enable_detection(rm_define.vision_detection_line) vision_ctrl.line_follow_color_set(rm_define.line_follow_color_blue) pid_yaw.set_ctrl_params(330, 0, 28) gimbal_ctrl.set_rotate_speed(30) while True: # get line information list_LineList = RmList(vision_ctrl.get_line_detection_info()) # if ten points are detected follow the line if len(list_LineList) == 42: if list_LineList[2] <= 1: variable_X = list_LineList[19] pid_yaw.set_error(variable_X - 0.5) gimbal_ctrl.rotate_with_speed(pid_yaw.get_output(), 0) chassis_ctrl.set_trans_speed(0.5) chassis_ctrl.move(0) time.sleep(0.05) # if no line was detected rotate around to find line else: chassis_ctrl.stop() gimbal_ctrl.rotate_with_speed(90, -20) time.sleep(2)
pid_yaw = rm_ctrl.PIDCtrl() list__line_list = rm_list() variable_x = 0 def start(): global variable_X global list_LineList global pid_yaw robot_ctrl.set_mode(rm_define.robot_mode_chassis_follow) gimbal_ctrl.pitch_ctrl(-20) vision_ctrl.enable_detection(rm_define.vision_detection_line) vision_ctrl.line_follow_color_set(rm_define.line_follow_color_blue) pid_yaw.set_ctrl_params(330, 0, 28) gimbal_ctrl.set_rotate_speed(30) while True: list__line_list = rm_list(vision_ctrl.get_line_detection_info()) if len(list_LineList) == 42: if list_LineList[2] <= 1: variable_x = list_LineList[19] pid_yaw.set_error(variable_X - 0.5) gimbal_ctrl.rotate_with_speed(pid_yaw.get_output(), 0) chassis_ctrl.set_trans_speed(0.5) chassis_ctrl.move(0) time.sleep(0.05) else: chassis_ctrl.stop() gimbal_ctrl.rotate_with_speed(90, -20) time.sleep(2)
def f1(a, b, c=0, *args, **kw): print('a =', a, 'b =', b, 'c =', c, 'args =', args, 'kw =', kw) def f2(a, b, c=0, *, d, **kw): print('a =', a, 'b =', b, 'c =', c, 'd =', d, 'kw =', kw) def product(*x): sum = 1 if len(x) > 0: for item in x: sum = item * sum print(sum) def trim(s): start = 0 for c in s[:]: if(c == ' '): start += 1 else: break end = -1 for c in s[-1:]: if (c == ' '): end += -1 else: break print(s[start: end]) def find_min_and_max(L): temp_min = L[0] temp_max = L[0] for x in L: if x < temp_min: temp_min = x if x > temp_max: temp_max = x print(temp_min, temp_max) def fib(max): n, a, b = 0, 0, 1 while n < max: yield b a, b = b, a + b n = n + 1 return 'done' def triangles(n = 10): results = [] for x in range(n): if x == 0: results.append([1]) elif x == 1: results.append([1, 1]) else: temp = [1] for y in range(x): temp.append(results[x-1][y]) def odd(): n = 1 for index in range(1, max + 1): yield n n = n + 2 print('step = ', index, 'n = ', n) def add(x, y, f): return f(x) + f(y) f1(1, 2) f1(1, 2, c=3) f1(1, 2, 3, 'a', 'b') f1(1, 2, 3, 'a', 'b', x=99) f2(1, 2, d=99, ext=None) product(5, 6, 7, 9) trim(" 123 ") find_min_and_max([10, 9, 11, 23, 21, 7, 99, 11]) L1 = ['Hello', 'World', 18, 'Apple', None] L2 = [x.lower() for x in L1 if isinstance(x, str)] list1 = [1,6,2,5,3] list2 = [34,67,13,678,67] print(add(list1,list2,max))
def f1(a, b, c=0, *args, **kw): print('a =', a, 'b =', b, 'c =', c, 'args =', args, 'kw =', kw) def f2(a, b, c=0, *, d, **kw): print('a =', a, 'b =', b, 'c =', c, 'd =', d, 'kw =', kw) def product(*x): sum = 1 if len(x) > 0: for item in x: sum = item * sum print(sum) def trim(s): start = 0 for c in s[:]: if c == ' ': start += 1 else: break end = -1 for c in s[-1:]: if c == ' ': end += -1 else: break print(s[start:end]) def find_min_and_max(L): temp_min = L[0] temp_max = L[0] for x in L: if x < temp_min: temp_min = x if x > temp_max: temp_max = x print(temp_min, temp_max) def fib(max): (n, a, b) = (0, 0, 1) while n < max: yield b (a, b) = (b, a + b) n = n + 1 return 'done' def triangles(n=10): results = [] for x in range(n): if x == 0: results.append([1]) elif x == 1: results.append([1, 1]) else: temp = [1] for y in range(x): temp.append(results[x - 1][y]) def odd(): n = 1 for index in range(1, max + 1): yield n n = n + 2 print('step = ', index, 'n = ', n) def add(x, y, f): return f(x) + f(y) f1(1, 2) f1(1, 2, c=3) f1(1, 2, 3, 'a', 'b') f1(1, 2, 3, 'a', 'b', x=99) f2(1, 2, d=99, ext=None) product(5, 6, 7, 9) trim(' 123 ') find_min_and_max([10, 9, 11, 23, 21, 7, 99, 11]) l1 = ['Hello', 'World', 18, 'Apple', None] l2 = [x.lower() for x in L1 if isinstance(x, str)] list1 = [1, 6, 2, 5, 3] list2 = [34, 67, 13, 678, 67] print(add(list1, list2, max))
# def form_list(): # with open("words.txt",'r') as f: # import pdb; pdb.set_trace() # data=f.readlines() # form_list() data=['TEMPERATURE', 'PARTICULAR', 'INSTRUMENT', 'EXPERIMENT', 'EXPERIENCE', 'ESPECIALLY', 'DICTIONARY', 'SUBSTANCE', 'REPRESENT', 'PARAGRAPH', 'NECESSARY', 'DIFFICULT', 'DETERMINE', 'CONTINENT', 'CONSONANT', 'CONDITION', 'CHARACTER', 'TRIANGLE', 'TOGETHER', 'THOUSAND', 'SYLLABLE', 'SURPRISE', 'SUBTRACT', 'STRAIGHT', 'SOLUTION', 'SHOULDER', 'SEPARATE', 'SENTENCE', 'REMEMBER', 'QUOTIENT', 'QUESTION', 'PROPERTY', 'PROBABLE', 'PRACTICE', 'POSSIBLE', 'POSITION', 'POPULATE', 'ORIGINAL', 'OPPOSITE', 'NEIGHBOR', 'MULTIPLY', 'MOUNTAIN', 'MOLECULE', 'MATERIAL', 'LANGUAGE', 'INTEREST', 'INDUSTRY', 'INDICATE', 'FRACTION', 'EXERCISE', 'ELECTRIC', 'DIVISION', 'DESCRIBE', 'CONTINUE', 'CONSIDER', 'COMPLETE', 'CHILDREN', 'WRITTEN', 'WHETHER', 'WEATHER', 'VILLAGE', 'TROUBLE', 'THROUGH', 'THOUGHT', 'SURFACE', 'SUPPORT', 'SUGGEST', 'SUCCESS', 'SUBJECT', 'STUDENT', 'STRETCH', 'STRANGE', 'STATION', 'SPECIAL', 'SOLDIER', 'SIMILAR', 'SEVERAL', 'SEGMENT', 'SECTION', 'SCIENCE', 'REQUIRE', 'RECEIVE', 'PROVIDE', 'PROTECT', 'PRODUCT', 'PRODUCE', 'PROCESS', 'PROBLEM', 'PRESENT', 'PREPARE', 'PICTURE', 'PERHAPS', 'PATTERN', 'OPERATE', 'OBSERVE', 'NUMERAL', 'NOTHING', 'NATURAL', 'MORNING', 'MILLION', 'MEASURE', 'MACHINE', 'INSTANT', 'INCLUDE', 'IMAGINE', 'HUNDRED', 'HISTORY', 'GENERAL', 'FORWARD', 'EXAMPLE', 'EVENING', 'ELEMENT', 'DISTANT', 'DISCUSS', 'DEVELOP', 'DECIMAL', 'CURRENT', 'COUNTRY', 'CORRECT', 'CONTROL', 'CONTAIN', 'CONNECT', 'COMPARE', 'COMPANY', 'COLLECT', 'CERTAIN', 'CENTURY', 'CAPTAIN', 'CAPITAL', 'BROUGHT', 'BROTHER', 'BETWEEN', 'BELIEVE', 'ARRANGE', 'AGAINST', 'YELLOW', 'WONDER', 'WINTER', 'WINDOW', 'WEIGHT', 'VALLEY', 'TWENTY', 'TRAVEL', 'TOWARD', 'THOUGH', 'SYSTEM', 'SYMBOL', 'SUPPLY', 'SUMMER', 'SUFFIX', 'SUDDEN', 'STRONG', 'STRING', 'STREET', 'STREAM', 'SQUARE', 'SPRING', 'SPREAD', 'SPEECH', 'SISTER', 'SINGLE', 'SIMPLE', 'SILVER', 'SILENT', 'SHOULD', 'SETTLE', 'SELECT', 'SECOND', 'SEASON', 'SEARCH', 'SCHOOL', 'RESULT', 'REPEAT', 'REGION', 'RECORD', 'REASON', 'RATHER', 'PROPER', 'PRETTY', 'PLURAL', 'PLEASE', 'PLANET', 'PHRASE', 'PERSON', 'PERIOD', 'PEOPLE', 'PARENT', 'OXYGEN', 'OFFICE', 'OBJECT', 'NUMBER', 'NOTICE', 'NATURE', 'NATION', 'MOTION', 'MOTHER', 'MOMENT', 'MODERN', 'MINUTE', 'MIDDLE', 'METHOD', 'MELODY', 'MATTER', 'MASTER', 'MARKET', 'MAGNET', 'LOCATE', 'LITTLE', 'LISTEN', 'LIQUID', 'LETTER', 'LENGTH', 'ISLAND', 'INVENT', 'INSECT', 'HAPPEN', 'GROUND', 'GOVERN', 'GENTLE', 'GATHER', 'GARDEN', 'FRIEND', 'FOREST', 'FOLLOW', 'FLOWER', 'FINISH', 'FINGER', 'FIGURE', 'FATHER', 'FAMOUS', 'FAMILY', 'EXPECT', 'EXCITE', 'EXCEPT', 'EQUATE', 'ENOUGH', 'ENGINE', 'ENERGY', 'EITHER', 'EFFECT', 'DURING', 'DOUBLE', 'DOLLAR', 'DOCTOR', 'DIVIDE', 'DIRECT', 'DIFFER', 'DESIGN', 'DESERT', 'DEPEND', 'DEGREE', 'DECIDE', 'DANGER', 'CREATE', 'CREASE', 'COURSE', 'COTTON', 'CORNER', 'COMMON', 'COLUMN', 'COLONY', 'CLOTHE', 'CIRCLE', 'CHOOSE', 'CHARGE', 'CHANGE', 'CHANCE', 'CENTER', 'CAUGHT', 'BRIGHT', 'BRANCH', 'BOUGHT', 'BOTTOM', 'BETTER', 'BEHIND', 'BEFORE', 'BEAUTY', 'ARRIVE', 'APPEAR', 'ANSWER', 'ANIMAL', 'ALWAYS', 'AFRAID', 'YOUNG', 'WROTE', 'WRONG', 'WRITE', 'WOULD', 'WORLD', "WON'T", 'WOMEN', 'WOMAN', 'WHOSE', 'WHOLE', 'WHITE', 'WHILE', 'WHICH', 'WHERE', 'WHEEL', 'WATER', 'WATCH', 'VOWEL', 'VOICE', 'VISIT', 'VALUE', 'USUAL', 'UNTIL', 'UNDER', 'TRUCK', 'TRAIN', 'TRADE', 'TRACK', 'TOUCH', 'TOTAL', 'THROW', 'THREE', 'THOSE', 'THIRD', 'THINK', 'THING', 'THICK', 'THESE', 'THERE', 'THEIR', 'THANK', 'TEETH', 'TEACH', 'TABLE', 'SUGAR', 'STUDY', 'STORY', 'STORE', 'STOOD', 'STONE', 'STILL', 'STICK', 'STEEL', 'STEAM', 'STEAD', 'STATE', 'START', 'STAND', 'SPOKE', 'SPEND', 'SPELL', 'SPEED', 'SPEAK', 'SPACE', 'SOUTH', 'SOUND', 'SOLVE', 'SMILE', 'SMELL', 'SMALL', 'SLEEP', 'SLAVE', 'SKILL', 'SINCE', 'SIGHT', 'SHOUT', 'SHORT', 'SHORE', 'SHINE', 'SHELL', 'SHEET', 'SHARP', 'SHARE', 'SHAPE', 'SHALL', 'SEVEN', 'SERVE', 'SENSE', 'SCORE', 'SCALE', 'ROUND', 'RIVER', 'RIGHT', 'REPLY', 'READY', 'REACH', 'RANGE', 'RAISE', 'RADIO', 'QUITE', 'QUIET', 'QUICK', 'QUART', 'PROVE', 'PRINT', 'PRESS', 'POWER', 'POUND', 'POINT', 'PLANT', 'PLANE', 'PLAIN', 'PLACE', 'PITCH', 'PIECE', 'PARTY', 'PAPER', 'PAINT', 'OTHER', 'ORGAN', 'ORDER', 'OFTEN', 'OFFER', 'OCEAN', 'OCCUR', 'NORTH', 'NOISE', 'NIGHT', 'NEVER', 'MUSIC', 'MOUTH', 'MOUNT', 'MONTH', 'MONEY', 'MIGHT', 'METAL', 'MEANT', 'MATCH', 'MAJOR', 'LIGHT', 'LEVEL', 'LEAVE', 'LEAST', 'LEARN', 'LAUGH', 'LARGE', 'HURRY', 'HUMAN', 'HOUSE', 'HORSE', 'HEAVY', 'HEART', 'HEARD', 'HAPPY', 'GUIDE', 'GUESS', 'GROUP', 'GREEN', 'GREAT', 'GRASS', 'GRAND', 'GLASS', 'FRUIT', 'FRONT', 'FRESH', 'FOUND', 'FORCE', 'FLOOR', 'FIRST', 'FINAL', 'FIGHT', 'FIELD', 'FAVOR', 'EXACT', 'EVERY', 'EVENT', 'EQUAL', 'ENTER', 'ENEMY', 'EIGHT', 'EARTH', 'EARLY', 'DRIVE', 'DRINK', 'DRESS', 'DREAM', "DON'T", 'DEATH', 'DANCE', 'CROWD', 'CROSS', 'COVER', 'COUNT', 'COULD', 'COLOR', 'COAST', 'CLOUD', 'CLOSE', 'CLOCK', 'CLIMB', 'CLEAR', 'CLEAN', 'CLASS', 'CLAIM', 'CHORD', 'CHILD', 'CHIEF', 'CHICK', 'CHECK', 'CHART', 'CHAIR', 'CAUSE', 'CATCH', 'CARRY', 'BUILD', 'BROWN', 'BROKE', 'BROAD', 'BRING', 'BREAK', 'BREAD', 'BOARD', 'BLOOD', 'BLOCK', 'BLACK', 'BEGIN', 'BEGAN', 'BASIC', 'APPLE', 'ANGER', 'AMONG', 'ALLOW', 'AGREE', 'AGAIN', 'AFTER', 'ABOVE', 'ABOUT', 'YOUR', 'YEAR', 'YARD', 'WORK', 'WORD', 'WOOD', 'WITH', 'WISH', 'WIRE', 'WING', 'WIND', 'WILL', 'WILD', 'WIFE', 'WIDE', 'WHEN', 'WHAT', 'WEST', 'WERE', 'WENT', 'WELL', 'WEEK', 'WEAR', 'WAVE', 'WASH', 'WARM', 'WANT', 'WALL', 'WALK', 'WAIT', 'VIEW', 'VERY', 'VERB', 'VARY', 'UNIT', 'TYPE', 'TURN', 'TUBE', 'TRUE', 'TRIP', 'TREE', 'TOWN', 'TOOL', 'TOOK', 'TONE', 'TOLD', 'TIRE', 'TINY', 'TIME', 'THUS', 'THIS', 'THIN', 'THEY', 'THEN', 'THEM', 'THAT', 'THAN', 'TEST', 'TERM', 'TELL', 'TEAM', 'TALL', 'TALK', 'TAKE', 'TAIL', 'SWIM', 'SURE', 'SUIT', 'SUCH', 'STOP', 'STEP', 'STAY', 'STAR', 'SPOT', 'SOON', 'SONG', 'SOME', 'SOIL', 'SOFT', 'SNOW', 'SLOW', 'SLIP', 'SKIN', 'SIZE', 'SING', 'SIGN', 'SIDE', 'SHOW', 'SHOP', 'SHOE', 'SHIP', 'SENT', 'SEND', 'SELL', 'SELF', 'SEEM', 'SEED', 'SEAT', 'SAVE', 'SAND', 'SAME', 'SALT', 'SAIL', 'SAID', 'SAFE', 'RULE', 'ROSE', 'ROPE', 'ROOT', 'ROOM', 'ROLL', 'ROCK', 'ROAD', 'RISE', 'RING', 'RIDE', 'RICH', 'REST', 'REAL', 'READ', 'RAIN', 'RAIL', 'RACE', 'PUSH', 'PULL', 'POST', 'POSE', 'PORT', 'POOR', 'POEM', 'PLAY', 'PLAN', 'PICK', 'PATH', 'PAST', 'PASS', 'PART', 'PAIR', 'PAGE', 'OVER', 'OPEN', 'ONLY', 'ONCE', 'NOUN', 'NOTE', 'NOSE', 'NOON', 'NINE', 'NEXT', 'NEED', 'NEAR', 'NAME', 'MUST', 'MUCH', 'MOVE', 'MOST', 'MORE', 'MOON', 'MISS', 'MINE', 'MIND', 'MILK', 'MILE', 'MEET', 'MEAT', 'MEAN', 'MASS', 'MARK', 'MANY', 'MAKE', 'MAIN', 'MADE', 'LOVE', 'LOUD', 'LOST', 'LOOK', 'LONG', 'LONE', 'LIVE', 'LIST', 'LINE', 'LIKE', 'LIFT', 'LIFE', 'LESS', 'LEFT', 'LEAD', 'LATE', 'LAST', 'LAND', 'LAKE', 'LADY', 'KNOW', 'KNEW', 'KING', 'KIND', 'KILL', 'KEPT', 'KEEP', 'JUST', 'JUMP', 'JOIN', 'IRON', 'INCH', 'IDEA', 'HUNT', 'HUGE', 'HOUR', 'HOPE', 'HOME', 'HOLE', 'HOLD', 'HILL', 'HIGH', 'HERE', 'HELP', 'HELD', 'HEAT', 'HEAR', 'HEAD', 'HAVE', 'HARD', 'HAND', 'HALF', 'HAIR', 'GROW', 'GREW', 'GRAY', 'GOOD', 'GONE', 'GOLD', 'GLAD', 'GIVE', 'GIRL', 'GAVE', 'GAME', 'FULL', 'FROM', 'FREE', 'FOUR', 'FORM', 'FOOT', 'FOOD', 'FLOW', 'FLAT', 'FIVE', 'FISH', 'FIRE', 'FINE', 'FIND', 'FILL', 'FELT', 'FELL', 'FEET', 'FEEL', 'FEED', 'FEAR', 'FAST', 'FARM', 'FALL', 'FAIR', 'FACT', 'FACE', 'EVER', 'EVEN', 'ELSE', 'EDGE', 'EAST', 'EASE', 'EACH', 'DUCK', 'DROP', 'DRAW', 'DOWN', 'DOOR', 'DONE', 'DOES', 'DEEP', 'DEAR', 'DEAL', 'DEAD', 'DARK', 'CROP', 'COST', 'CORN', 'COPY', 'COOL', 'COOK', 'COME', 'COLD', 'COAT', 'CITY', 'CENT', 'CELL', 'CASE', 'CARE', 'CARD', 'CAMP', 'CAME', 'CALL', 'BUSY', 'BURN', 'BOTH', 'BORN', 'BOOK', 'BONE', 'BODY', 'BOAT', 'BLUE', 'BLOW', 'BIRD', 'BEST', 'BELL', 'BEEN', 'BEAT', 'BEAR', 'BASE', 'BANK', 'BAND', 'BALL', 'BACK', 'BABY', 'ATOM', 'AREA', 'ALSO', 'ABLE', 'YOU', 'YET', 'YES', 'WIN', 'WHY', 'WHO', 'WAY', 'WAS', 'WAR', 'USE', 'TWO', 'TRY', 'TOP', 'TOO', 'TIE', 'THE', 'TEN', 'SUN', 'SON', 'SKY', 'SIX', 'SIT', 'SHE', 'SET', 'SEE', 'SEA', 'SAY', 'SAW', 'SAT', 'RUN', 'RUB', 'ROW', 'RED', 'RAN', 'PUT', 'PAY', 'OWN', 'OUT', 'OUR', 'ONE', 'OLD', 'OIL', 'OFF', 'NOW', 'NOR', 'NEW', 'NEC', 'MIX', 'MEN', 'MAY', 'MAP', 'MAN', 'LOW', 'LOT', 'LOG', 'LIE', 'LET', 'LEG', 'LED', 'LAY', 'LAW', 'KEY', 'JOY', 'JOB', 'ICE', 'HOW', 'HOT', 'HOT', 'HIT', 'HIS', 'HIM', 'HER', 'HAT', 'HAS', 'HAD', 'GUN', 'GOT', 'GET', 'GAS', 'FUN', 'FOR', 'FLY', 'FIT', 'FIG', 'FEW', 'FAT', 'FAR', 'EYE', 'END', 'EGG', 'EAT', 'EAR', 'DRY', 'DOG', 'DIE', 'DID', 'DAY', 'DAD', 'CUT', 'CRY', 'COW', 'CAT', 'CAR', 'CAN', 'BUY', 'BUT', 'BOY', 'BOX', 'BIT', 'BIG', 'BED', 'BAT', 'BAR', 'BAD', 'ASK', 'ART', 'ARM', 'ARE', 'ANY', 'AND', 'ALL', 'AIR', 'AGO', 'AGE', 'ADD', 'ACT', 'WE', 'US', 'UP', 'TO', 'SO', 'OR', 'ON', 'OH', 'OF', 'NO', 'MY', 'ME', 'IT', 'IS', 'IN', 'IF', 'HE', 'GO', 'DO', 'BY', 'BE', 'AT', 'AS', 'AN', 'AM', 'I', 'A'] # import pdb; pdb.set_trace() # data.sort(reverse=true)
data = ['TEMPERATURE', 'PARTICULAR', 'INSTRUMENT', 'EXPERIMENT', 'EXPERIENCE', 'ESPECIALLY', 'DICTIONARY', 'SUBSTANCE', 'REPRESENT', 'PARAGRAPH', 'NECESSARY', 'DIFFICULT', 'DETERMINE', 'CONTINENT', 'CONSONANT', 'CONDITION', 'CHARACTER', 'TRIANGLE', 'TOGETHER', 'THOUSAND', 'SYLLABLE', 'SURPRISE', 'SUBTRACT', 'STRAIGHT', 'SOLUTION', 'SHOULDER', 'SEPARATE', 'SENTENCE', 'REMEMBER', 'QUOTIENT', 'QUESTION', 'PROPERTY', 'PROBABLE', 'PRACTICE', 'POSSIBLE', 'POSITION', 'POPULATE', 'ORIGINAL', 'OPPOSITE', 'NEIGHBOR', 'MULTIPLY', 'MOUNTAIN', 'MOLECULE', 'MATERIAL', 'LANGUAGE', 'INTEREST', 'INDUSTRY', 'INDICATE', 'FRACTION', 'EXERCISE', 'ELECTRIC', 'DIVISION', 'DESCRIBE', 'CONTINUE', 'CONSIDER', 'COMPLETE', 'CHILDREN', 'WRITTEN', 'WHETHER', 'WEATHER', 'VILLAGE', 'TROUBLE', 'THROUGH', 'THOUGHT', 'SURFACE', 'SUPPORT', 'SUGGEST', 'SUCCESS', 'SUBJECT', 'STUDENT', 'STRETCH', 'STRANGE', 'STATION', 'SPECIAL', 'SOLDIER', 'SIMILAR', 'SEVERAL', 'SEGMENT', 'SECTION', 'SCIENCE', 'REQUIRE', 'RECEIVE', 'PROVIDE', 'PROTECT', 'PRODUCT', 'PRODUCE', 'PROCESS', 'PROBLEM', 'PRESENT', 'PREPARE', 'PICTURE', 'PERHAPS', 'PATTERN', 'OPERATE', 'OBSERVE', 'NUMERAL', 'NOTHING', 'NATURAL', 'MORNING', 'MILLION', 'MEASURE', 'MACHINE', 'INSTANT', 'INCLUDE', 'IMAGINE', 'HUNDRED', 'HISTORY', 'GENERAL', 'FORWARD', 'EXAMPLE', 'EVENING', 'ELEMENT', 'DISTANT', 'DISCUSS', 'DEVELOP', 'DECIMAL', 'CURRENT', 'COUNTRY', 'CORRECT', 'CONTROL', 'CONTAIN', 'CONNECT', 'COMPARE', 'COMPANY', 'COLLECT', 'CERTAIN', 'CENTURY', 'CAPTAIN', 'CAPITAL', 'BROUGHT', 'BROTHER', 'BETWEEN', 'BELIEVE', 'ARRANGE', 'AGAINST', 'YELLOW', 'WONDER', 'WINTER', 'WINDOW', 'WEIGHT', 'VALLEY', 'TWENTY', 'TRAVEL', 'TOWARD', 'THOUGH', 'SYSTEM', 'SYMBOL', 'SUPPLY', 'SUMMER', 'SUFFIX', 'SUDDEN', 'STRONG', 'STRING', 'STREET', 'STREAM', 'SQUARE', 'SPRING', 'SPREAD', 'SPEECH', 'SISTER', 'SINGLE', 'SIMPLE', 'SILVER', 'SILENT', 'SHOULD', 'SETTLE', 'SELECT', 'SECOND', 'SEASON', 'SEARCH', 'SCHOOL', 'RESULT', 'REPEAT', 'REGION', 'RECORD', 'REASON', 'RATHER', 'PROPER', 'PRETTY', 'PLURAL', 'PLEASE', 'PLANET', 'PHRASE', 'PERSON', 'PERIOD', 'PEOPLE', 'PARENT', 'OXYGEN', 'OFFICE', 'OBJECT', 'NUMBER', 'NOTICE', 'NATURE', 'NATION', 'MOTION', 'MOTHER', 'MOMENT', 'MODERN', 'MINUTE', 'MIDDLE', 'METHOD', 'MELODY', 'MATTER', 'MASTER', 'MARKET', 'MAGNET', 'LOCATE', 'LITTLE', 'LISTEN', 'LIQUID', 'LETTER', 'LENGTH', 'ISLAND', 'INVENT', 'INSECT', 'HAPPEN', 'GROUND', 'GOVERN', 'GENTLE', 'GATHER', 'GARDEN', 'FRIEND', 'FOREST', 'FOLLOW', 'FLOWER', 'FINISH', 'FINGER', 'FIGURE', 'FATHER', 'FAMOUS', 'FAMILY', 'EXPECT', 'EXCITE', 'EXCEPT', 'EQUATE', 'ENOUGH', 'ENGINE', 'ENERGY', 'EITHER', 'EFFECT', 'DURING', 'DOUBLE', 'DOLLAR', 'DOCTOR', 'DIVIDE', 'DIRECT', 'DIFFER', 'DESIGN', 'DESERT', 'DEPEND', 'DEGREE', 'DECIDE', 'DANGER', 'CREATE', 'CREASE', 'COURSE', 'COTTON', 'CORNER', 'COMMON', 'COLUMN', 'COLONY', 'CLOTHE', 'CIRCLE', 'CHOOSE', 'CHARGE', 'CHANGE', 'CHANCE', 'CENTER', 'CAUGHT', 'BRIGHT', 'BRANCH', 'BOUGHT', 'BOTTOM', 'BETTER', 'BEHIND', 'BEFORE', 'BEAUTY', 'ARRIVE', 'APPEAR', 'ANSWER', 'ANIMAL', 'ALWAYS', 'AFRAID', 'YOUNG', 'WROTE', 'WRONG', 'WRITE', 'WOULD', 'WORLD', "WON'T", 'WOMEN', 'WOMAN', 'WHOSE', 'WHOLE', 'WHITE', 'WHILE', 'WHICH', 'WHERE', 'WHEEL', 'WATER', 'WATCH', 'VOWEL', 'VOICE', 'VISIT', 'VALUE', 'USUAL', 'UNTIL', 'UNDER', 'TRUCK', 'TRAIN', 'TRADE', 'TRACK', 'TOUCH', 'TOTAL', 'THROW', 'THREE', 'THOSE', 'THIRD', 'THINK', 'THING', 'THICK', 'THESE', 'THERE', 'THEIR', 'THANK', 'TEETH', 'TEACH', 'TABLE', 'SUGAR', 'STUDY', 'STORY', 'STORE', 'STOOD', 'STONE', 'STILL', 'STICK', 'STEEL', 'STEAM', 'STEAD', 'STATE', 'START', 'STAND', 'SPOKE', 'SPEND', 'SPELL', 'SPEED', 'SPEAK', 'SPACE', 'SOUTH', 'SOUND', 'SOLVE', 'SMILE', 'SMELL', 'SMALL', 'SLEEP', 'SLAVE', 'SKILL', 'SINCE', 'SIGHT', 'SHOUT', 'SHORT', 'SHORE', 'SHINE', 'SHELL', 'SHEET', 'SHARP', 'SHARE', 'SHAPE', 'SHALL', 'SEVEN', 'SERVE', 'SENSE', 'SCORE', 'SCALE', 'ROUND', 'RIVER', 'RIGHT', 'REPLY', 'READY', 'REACH', 'RANGE', 'RAISE', 'RADIO', 'QUITE', 'QUIET', 'QUICK', 'QUART', 'PROVE', 'PRINT', 'PRESS', 'POWER', 'POUND', 'POINT', 'PLANT', 'PLANE', 'PLAIN', 'PLACE', 'PITCH', 'PIECE', 'PARTY', 'PAPER', 'PAINT', 'OTHER', 'ORGAN', 'ORDER', 'OFTEN', 'OFFER', 'OCEAN', 'OCCUR', 'NORTH', 'NOISE', 'NIGHT', 'NEVER', 'MUSIC', 'MOUTH', 'MOUNT', 'MONTH', 'MONEY', 'MIGHT', 'METAL', 'MEANT', 'MATCH', 'MAJOR', 'LIGHT', 'LEVEL', 'LEAVE', 'LEAST', 'LEARN', 'LAUGH', 'LARGE', 'HURRY', 'HUMAN', 'HOUSE', 'HORSE', 'HEAVY', 'HEART', 'HEARD', 'HAPPY', 'GUIDE', 'GUESS', 'GROUP', 'GREEN', 'GREAT', 'GRASS', 'GRAND', 'GLASS', 'FRUIT', 'FRONT', 'FRESH', 'FOUND', 'FORCE', 'FLOOR', 'FIRST', 'FINAL', 'FIGHT', 'FIELD', 'FAVOR', 'EXACT', 'EVERY', 'EVENT', 'EQUAL', 'ENTER', 'ENEMY', 'EIGHT', 'EARTH', 'EARLY', 'DRIVE', 'DRINK', 'DRESS', 'DREAM', "DON'T", 'DEATH', 'DANCE', 'CROWD', 'CROSS', 'COVER', 'COUNT', 'COULD', 'COLOR', 'COAST', 'CLOUD', 'CLOSE', 'CLOCK', 'CLIMB', 'CLEAR', 'CLEAN', 'CLASS', 'CLAIM', 'CHORD', 'CHILD', 'CHIEF', 'CHICK', 'CHECK', 'CHART', 'CHAIR', 'CAUSE', 'CATCH', 'CARRY', 'BUILD', 'BROWN', 'BROKE', 'BROAD', 'BRING', 'BREAK', 'BREAD', 'BOARD', 'BLOOD', 'BLOCK', 'BLACK', 'BEGIN', 'BEGAN', 'BASIC', 'APPLE', 'ANGER', 'AMONG', 'ALLOW', 'AGREE', 'AGAIN', 'AFTER', 'ABOVE', 'ABOUT', 'YOUR', 'YEAR', 'YARD', 'WORK', 'WORD', 'WOOD', 'WITH', 'WISH', 'WIRE', 'WING', 'WIND', 'WILL', 'WILD', 'WIFE', 'WIDE', 'WHEN', 'WHAT', 'WEST', 'WERE', 'WENT', 'WELL', 'WEEK', 'WEAR', 'WAVE', 'WASH', 'WARM', 'WANT', 'WALL', 'WALK', 'WAIT', 'VIEW', 'VERY', 'VERB', 'VARY', 'UNIT', 'TYPE', 'TURN', 'TUBE', 'TRUE', 'TRIP', 'TREE', 'TOWN', 'TOOL', 'TOOK', 'TONE', 'TOLD', 'TIRE', 'TINY', 'TIME', 'THUS', 'THIS', 'THIN', 'THEY', 'THEN', 'THEM', 'THAT', 'THAN', 'TEST', 'TERM', 'TELL', 'TEAM', 'TALL', 'TALK', 'TAKE', 'TAIL', 'SWIM', 'SURE', 'SUIT', 'SUCH', 'STOP', 'STEP', 'STAY', 'STAR', 'SPOT', 'SOON', 'SONG', 'SOME', 'SOIL', 'SOFT', 'SNOW', 'SLOW', 'SLIP', 'SKIN', 'SIZE', 'SING', 'SIGN', 'SIDE', 'SHOW', 'SHOP', 'SHOE', 'SHIP', 'SENT', 'SEND', 'SELL', 'SELF', 'SEEM', 'SEED', 'SEAT', 'SAVE', 'SAND', 'SAME', 'SALT', 'SAIL', 'SAID', 'SAFE', 'RULE', 'ROSE', 'ROPE', 'ROOT', 'ROOM', 'ROLL', 'ROCK', 'ROAD', 'RISE', 'RING', 'RIDE', 'RICH', 'REST', 'REAL', 'READ', 'RAIN', 'RAIL', 'RACE', 'PUSH', 'PULL', 'POST', 'POSE', 'PORT', 'POOR', 'POEM', 'PLAY', 'PLAN', 'PICK', 'PATH', 'PAST', 'PASS', 'PART', 'PAIR', 'PAGE', 'OVER', 'OPEN', 'ONLY', 'ONCE', 'NOUN', 'NOTE', 'NOSE', 'NOON', 'NINE', 'NEXT', 'NEED', 'NEAR', 'NAME', 'MUST', 'MUCH', 'MOVE', 'MOST', 'MORE', 'MOON', 'MISS', 'MINE', 'MIND', 'MILK', 'MILE', 'MEET', 'MEAT', 'MEAN', 'MASS', 'MARK', 'MANY', 'MAKE', 'MAIN', 'MADE', 'LOVE', 'LOUD', 'LOST', 'LOOK', 'LONG', 'LONE', 'LIVE', 'LIST', 'LINE', 'LIKE', 'LIFT', 'LIFE', 'LESS', 'LEFT', 'LEAD', 'LATE', 'LAST', 'LAND', 'LAKE', 'LADY', 'KNOW', 'KNEW', 'KING', 'KIND', 'KILL', 'KEPT', 'KEEP', 'JUST', 'JUMP', 'JOIN', 'IRON', 'INCH', 'IDEA', 'HUNT', 'HUGE', 'HOUR', 'HOPE', 'HOME', 'HOLE', 'HOLD', 'HILL', 'HIGH', 'HERE', 'HELP', 'HELD', 'HEAT', 'HEAR', 'HEAD', 'HAVE', 'HARD', 'HAND', 'HALF', 'HAIR', 'GROW', 'GREW', 'GRAY', 'GOOD', 'GONE', 'GOLD', 'GLAD', 'GIVE', 'GIRL', 'GAVE', 'GAME', 'FULL', 'FROM', 'FREE', 'FOUR', 'FORM', 'FOOT', 'FOOD', 'FLOW', 'FLAT', 'FIVE', 'FISH', 'FIRE', 'FINE', 'FIND', 'FILL', 'FELT', 'FELL', 'FEET', 'FEEL', 'FEED', 'FEAR', 'FAST', 'FARM', 'FALL', 'FAIR', 'FACT', 'FACE', 'EVER', 'EVEN', 'ELSE', 'EDGE', 'EAST', 'EASE', 'EACH', 'DUCK', 'DROP', 'DRAW', 'DOWN', 'DOOR', 'DONE', 'DOES', 'DEEP', 'DEAR', 'DEAL', 'DEAD', 'DARK', 'CROP', 'COST', 'CORN', 'COPY', 'COOL', 'COOK', 'COME', 'COLD', 'COAT', 'CITY', 'CENT', 'CELL', 'CASE', 'CARE', 'CARD', 'CAMP', 'CAME', 'CALL', 'BUSY', 'BURN', 'BOTH', 'BORN', 'BOOK', 'BONE', 'BODY', 'BOAT', 'BLUE', 'BLOW', 'BIRD', 'BEST', 'BELL', 'BEEN', 'BEAT', 'BEAR', 'BASE', 'BANK', 'BAND', 'BALL', 'BACK', 'BABY', 'ATOM', 'AREA', 'ALSO', 'ABLE', 'YOU', 'YET', 'YES', 'WIN', 'WHY', 'WHO', 'WAY', 'WAS', 'WAR', 'USE', 'TWO', 'TRY', 'TOP', 'TOO', 'TIE', 'THE', 'TEN', 'SUN', 'SON', 'SKY', 'SIX', 'SIT', 'SHE', 'SET', 'SEE', 'SEA', 'SAY', 'SAW', 'SAT', 'RUN', 'RUB', 'ROW', 'RED', 'RAN', 'PUT', 'PAY', 'OWN', 'OUT', 'OUR', 'ONE', 'OLD', 'OIL', 'OFF', 'NOW', 'NOR', 'NEW', 'NEC', 'MIX', 'MEN', 'MAY', 'MAP', 'MAN', 'LOW', 'LOT', 'LOG', 'LIE', 'LET', 'LEG', 'LED', 'LAY', 'LAW', 'KEY', 'JOY', 'JOB', 'ICE', 'HOW', 'HOT', 'HOT', 'HIT', 'HIS', 'HIM', 'HER', 'HAT', 'HAS', 'HAD', 'GUN', 'GOT', 'GET', 'GAS', 'FUN', 'FOR', 'FLY', 'FIT', 'FIG', 'FEW', 'FAT', 'FAR', 'EYE', 'END', 'EGG', 'EAT', 'EAR', 'DRY', 'DOG', 'DIE', 'DID', 'DAY', 'DAD', 'CUT', 'CRY', 'COW', 'CAT', 'CAR', 'CAN', 'BUY', 'BUT', 'BOY', 'BOX', 'BIT', 'BIG', 'BED', 'BAT', 'BAR', 'BAD', 'ASK', 'ART', 'ARM', 'ARE', 'ANY', 'AND', 'ALL', 'AIR', 'AGO', 'AGE', 'ADD', 'ACT', 'WE', 'US', 'UP', 'TO', 'SO', 'OR', 'ON', 'OH', 'OF', 'NO', 'MY', 'ME', 'IT', 'IS', 'IN', 'IF', 'HE', 'GO', 'DO', 'BY', 'BE', 'AT', 'AS', 'AN', 'AM', 'I', 'A']
# -*- coding: utf-8 -*- """ 1534. Count Good Triplets Given an array of integers arr, and three integers a, b and c. You need to find the number of good triplets. A triplet (arr[i], arr[j], arr[k]) is good if the following conditions are true: 0 <= i < j < k < arr.length |arr[i] - arr[j]| <= a |arr[j] - arr[k]| <= b |arr[i] - arr[k]| <= c Where |x| denotes the absolute value of x. Return the number of good triplets. Constraints: 3 <= arr.length <= 100 0 <= arr[i] <= 1000 0 <= a, b, c <= 1000 """ class Solution: def countGoodTriplets(self, arr, a: int, b: int, c: int) -> int: res = 0 cache = {} length = len(arr) for i in range(0, length - 2): for j in range(i + 1, length - 1): for k in range(j + 1, length): if (i, j) not in cache: cache[(i, j)] = abs(arr[i] - arr[j]) if (j, k) not in cache: cache[(j, k)] = abs(arr[j] - arr[k]) if (i, k) not in cache: cache[(i, k)] = abs(arr[i] - arr[k]) if cache[(i, j)] <= a and cache[(j, k)] <= b and cache[(i, k)] <= c: res += 1 return res
""" 1534. Count Good Triplets Given an array of integers arr, and three integers a, b and c. You need to find the number of good triplets. A triplet (arr[i], arr[j], arr[k]) is good if the following conditions are true: 0 <= i < j < k < arr.length |arr[i] - arr[j]| <= a |arr[j] - arr[k]| <= b |arr[i] - arr[k]| <= c Where |x| denotes the absolute value of x. Return the number of good triplets. Constraints: 3 <= arr.length <= 100 0 <= arr[i] <= 1000 0 <= a, b, c <= 1000 """ class Solution: def count_good_triplets(self, arr, a: int, b: int, c: int) -> int: res = 0 cache = {} length = len(arr) for i in range(0, length - 2): for j in range(i + 1, length - 1): for k in range(j + 1, length): if (i, j) not in cache: cache[i, j] = abs(arr[i] - arr[j]) if (j, k) not in cache: cache[j, k] = abs(arr[j] - arr[k]) if (i, k) not in cache: cache[i, k] = abs(arr[i] - arr[k]) if cache[i, j] <= a and cache[j, k] <= b and (cache[i, k] <= c): res += 1 return res
# # PySNMP MIB module HH3C-RADIUS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-RADIUS-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:29:17 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, ConstraintsUnion, SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint") hh3cCommon, = mibBuilder.importSymbols("HH3C-OID-MIB", "hh3cCommon") InetAddress, InetAddressType = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddress", "InetAddressType") Ipv6Address, = mibBuilder.importSymbols("IPV6-TC", "Ipv6Address") radiusAccServerAddress, radiusAccClientServerPortNumber, radiusAccServerIndex = mibBuilder.importSymbols("RADIUS-ACC-CLIENT-MIB", "radiusAccServerAddress", "radiusAccClientServerPortNumber", "radiusAccServerIndex") radiusAuthClientServerPortNumber, radiusAuthServerIndex, radiusAuthServerAddress = mibBuilder.importSymbols("RADIUS-AUTH-CLIENT-MIB", "radiusAuthClientServerPortNumber", "radiusAuthServerIndex", "radiusAuthServerAddress") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") ObjectIdentity, TimeTicks, Unsigned32, MibIdentifier, IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, Counter32, Counter64, Gauge32, iso, NotificationType, ModuleIdentity, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "ObjectIdentity", "TimeTicks", "Unsigned32", "MibIdentifier", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "Counter32", "Counter64", "Gauge32", "iso", "NotificationType", "ModuleIdentity", "Integer32") DisplayString, RowStatus, TextualConvention, TruthValue = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "RowStatus", "TextualConvention", "TruthValue") hh3cRadius = ModuleIdentity((1, 3, 6, 1, 4, 1, 25506, 2, 13)) hh3cRadius.setRevisions(('2014-06-07 18:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: hh3cRadius.setRevisionsDescriptions(('Modified description of hh3cRdSecondaryAuthRowStatus. Modified description of hh3cRdSecondaryAccRowStatus',)) if mibBuilder.loadTexts: hh3cRadius.setLastUpdated('201406071800Z') if mibBuilder.loadTexts: hh3cRadius.setOrganization('Hangzhou H3C Technologies Co., Ltd.') if mibBuilder.loadTexts: hh3cRadius.setContactInfo('Platform Team Hangzhou H3C Technologies Co., Ltd. Hai-Dian District Beijing P.R. China http://www.h3c.com Zip:100085 ') if mibBuilder.loadTexts: hh3cRadius.setDescription('The HH3C-RADIUS-MIB contains objects to Manage configuration and Monitor running state for RADIUS feature.') hh3cRdObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1)) hh3cRdInfoTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1), ) if mibBuilder.loadTexts: hh3cRdInfoTable.setStatus('current') if mibBuilder.loadTexts: hh3cRdInfoTable.setDescription('The (conceptual) table listing RADIUS authentication servers.') hh3cRdInfoEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1), ).setIndexNames((0, "HH3C-RADIUS-MIB", "hh3cRdGroupName")) if mibBuilder.loadTexts: hh3cRdInfoEntry.setStatus('current') if mibBuilder.loadTexts: hh3cRdInfoEntry.setDescription('An entry (conceptual row) representing a RADIUS authentication server.') hh3cRdGroupName = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))) if mibBuilder.loadTexts: hh3cRdGroupName.setStatus('current') if mibBuilder.loadTexts: hh3cRdGroupName.setDescription('The name of the RADIUS authentication group referred to in this table entry.') hh3cRdPrimAuthIp = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 2), IpAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdPrimAuthIp.setStatus('deprecated') if mibBuilder.loadTexts: hh3cRdPrimAuthIp.setDescription('The IP address of primary RADIUS authentication server.') hh3cRdPrimUdpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 3), Integer32()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdPrimUdpPort.setStatus('current') if mibBuilder.loadTexts: hh3cRdPrimUdpPort.setDescription('The UDP port the client is using to send requests to primary RADIUS authentication server. Default value is 1812.') hh3cRdPrimState = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("active", 1), ("block", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdPrimState.setStatus('current') if mibBuilder.loadTexts: hh3cRdPrimState.setDescription('The state of the primary RADIUS authentication server. 1 (active) The primary authentication server is in active state. 2 (block) The primary authentication server is in block state.') hh3cRdSecAuthIp = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 5), IpAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdSecAuthIp.setStatus('deprecated') if mibBuilder.loadTexts: hh3cRdSecAuthIp.setDescription('The IP address of secondary RADIUS authentication server.') hh3cRdSecUdpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 6), Integer32()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdSecUdpPort.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecUdpPort.setDescription('The UDP port the client is using to send requests to secondary RADIUS authentication server. Default value is 1812.') hh3cRdSecState = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("active", 1), ("block", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdSecState.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecState.setDescription('The state of the secondary RADIUS authentication server. 1 (active) The secondary authentication server is in active state. 2 (block) The secondary authentication server is in block state.') hh3cRdKey = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 8), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdKey.setStatus('current') if mibBuilder.loadTexts: hh3cRdKey.setDescription('The secret shared between the RADIUS client and RADIUS authentication server used in encoding and decoding sensitive data. When read, hh3cRdKey always returns an Octet String of length zero.') hh3cRdRetry = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 9), Integer32()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdRetry.setStatus('current') if mibBuilder.loadTexts: hh3cRdRetry.setDescription('The number of attempts the client will make when trying to send requests to a server before it will consider the attempt failed. Default value is 3.') hh3cRdTimeout = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 10), Integer32()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdTimeout.setStatus('current') if mibBuilder.loadTexts: hh3cRdTimeout.setDescription('The timeout value the client will use when sending requests to a server. The unit is second. Default value is 3.') hh3cRdPrimAuthIpAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 11), InetAddressType()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdPrimAuthIpAddrType.setStatus('current') if mibBuilder.loadTexts: hh3cRdPrimAuthIpAddrType.setDescription('The IP addresses type (IPv4 or IPv6) of primary RADIUS authentication server.') hh3cRdPrimAuthIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 12), InetAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdPrimAuthIpAddr.setStatus('current') if mibBuilder.loadTexts: hh3cRdPrimAuthIpAddr.setDescription('The IP address of primary RADIUS authentication server.') hh3cRdSecAuthIpAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 13), InetAddressType()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdSecAuthIpAddrType.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecAuthIpAddrType.setDescription('The IP addresses type (IPv4 or IPv6) of secondary RADIUS authentication server.') hh3cRdSecAuthIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 14), InetAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdSecAuthIpAddr.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecAuthIpAddr.setDescription('The IP address of secondary RADIUS authentication server.') hh3cRdServerType = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("standard", 1), ("iphotel", 2), ("portal", 3), ("extended", 4)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdServerType.setStatus('current') if mibBuilder.loadTexts: hh3cRdServerType.setDescription('Specify the type of RADIUS server. 1 (standard) - Server based on RFC protocol(s). 2 (iphotel) - Server for IP-Hotel or 201+ system. 3 (portal) - Server for iTellin Portal system. 4 (extended) - Server based on RADIUS extensions. Default type is standard.') hh3cRdQuietTime = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdQuietTime.setStatus('current') if mibBuilder.loadTexts: hh3cRdQuietTime.setDescription('The time for server returning active. The unit is minute. When the value is 0, the server state retains active. Default value is 5.') hh3cRdUserNameFormat = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 17), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("withoutdomain", 1), ("withdomain", 2), ("keeporignal", 3)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdUserNameFormat.setStatus('current') if mibBuilder.loadTexts: hh3cRdUserNameFormat.setDescription('Specify the user-name format that is sent to RADIUS server. 1 (withoutdomain) - send the user-name without domain. 2 (withdomain) - send the user-name with domain. 3 (keeporignal) - send the user-name as it is entered. Default format is withdomain.') hh3cRdRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 18), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdRowStatus.setStatus('current') if mibBuilder.loadTexts: hh3cRdRowStatus.setDescription('This object is responsible for managing the creation, deletion and modification of rows, which support active status and CreateAndGo, Destroy operation. To create a new row, hh3cRdGroupName must be specified. To destroy an existent row, the hh3cRdGroupName MUST NOT be referred by hh3cDomainTable in hh3cDomainRadiusGroupName column.') hh3cRdSecKey = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 19), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdSecKey.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecKey.setDescription('The secret shared between the RADIUS client and the secondary RADIUS authentication server used in encoding and decoding sensitive data. When read, hh3cRdSecKey always returns an Octet String of length zero.') hh3cRdPrimVpnName = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 20), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 31))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdPrimVpnName.setStatus('current') if mibBuilder.loadTexts: hh3cRdPrimVpnName.setDescription('The human-readable name of the VPN in which the primary RADIUS authentication server is placed.') hh3cRdSecVpnName = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 21), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 31))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdSecVpnName.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecVpnName.setDescription('The human-readable name of the VPN in which the secondary RADIUS authentication server is placed.') hh3cRdAuthNasIpAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 22), InetAddressType()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdAuthNasIpAddrType.setStatus('current') if mibBuilder.loadTexts: hh3cRdAuthNasIpAddrType.setDescription('The type (IPv4 or IPv6) of the source IP used to communicate with RADIUS authentication server.') hh3cRdAuthNasIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 23), IpAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdAuthNasIpAddr.setStatus('current') if mibBuilder.loadTexts: hh3cRdAuthNasIpAddr.setDescription('The source IPv4 address used to communicate with the RADIUS authentication server.') hh3cRdAuthNasIpv6Addr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 24), Ipv6Address()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdAuthNasIpv6Addr.setStatus('current') if mibBuilder.loadTexts: hh3cRdAuthNasIpv6Addr.setDescription('The source IPv6 address used to communicate with the RADIUS authentication server.') hh3cRdAccInfoTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2), ) if mibBuilder.loadTexts: hh3cRdAccInfoTable.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccInfoTable.setDescription('The (conceptual) table listing RADIUS accounting servers.') hh3cRdAccInfoEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1), ).setIndexNames((0, "HH3C-RADIUS-MIB", "hh3cRdAccGroupName")) if mibBuilder.loadTexts: hh3cRdAccInfoEntry.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccInfoEntry.setDescription('An entry (conceptual row) representing a RADIUS accounting server.') hh3cRdAccGroupName = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))) if mibBuilder.loadTexts: hh3cRdAccGroupName.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccGroupName.setDescription('The name of the RADIUS group referred to in this table entry.') hh3cRdPrimAccIpAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 2), InetAddressType()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdPrimAccIpAddrType.setStatus('current') if mibBuilder.loadTexts: hh3cRdPrimAccIpAddrType.setDescription('The IP addresses type (IPv4 or IPv6) of primary RADIUS accounting server.') hh3cRdPrimAccIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 3), InetAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdPrimAccIpAddr.setStatus('current') if mibBuilder.loadTexts: hh3cRdPrimAccIpAddr.setDescription('The IP address of primary RADIUS accounting server.') hh3cRdPrimAccUdpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 4), Integer32()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdPrimAccUdpPort.setStatus('current') if mibBuilder.loadTexts: hh3cRdPrimAccUdpPort.setDescription('The UDP port the client is using to send requests to primary RADIUS accounting server. Default value is 1813.') hh3cRdPrimAccState = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("active", 1), ("block", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdPrimAccState.setStatus('current') if mibBuilder.loadTexts: hh3cRdPrimAccState.setDescription('The state of the primary RADIUS accounting server. 1 (active) The primary accounting server is in active state. 2 (block) The primary accounting server is in block state.') hh3cRdSecAccIpAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 6), InetAddressType()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdSecAccIpAddrType.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecAccIpAddrType.setDescription('The IP addresses type (IPv4 or IPv6) of secondary RADIUS accounting server.') hh3cRdSecAccIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 7), InetAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdSecAccIpAddr.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecAccIpAddr.setDescription('The IP address of secondary RADIUS accounting server.') hh3cRdSecAccUdpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 8), Integer32()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdSecAccUdpPort.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecAccUdpPort.setDescription('The UDP port the client is using to send requests to secondary RADIUS accounting server. Default value is 1813.') hh3cRdSecAccState = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("active", 1), ("block", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdSecAccState.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecAccState.setDescription('The state of the secondary RADIUS accounting server. 1 (active) The secondary accounting server is in active state. 2 (block) The secondary accounting server is in block state.') hh3cRdAccKey = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 10), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdAccKey.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccKey.setDescription('The secret shared between the RADIUS client and RADIUS accounting server used in encoding and decoding sensitive data. When read, hh3cRdAccKey always returns an Octet String of length zero.') hh3cRdAccRetry = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 11), Integer32()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdAccRetry.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccRetry.setDescription('The number of attempt the client will make when trying to send requests to a server before it will consider the attempt failed. Default value is 3.') hh3cRdAccTimeout = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 12), Integer32()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdAccTimeout.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccTimeout.setDescription('The timeout value the client will use when sending requests to a server. The unit is second. Default value is 3.') hh3cRdAccServerType = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("standard", 1), ("iphotel", 2), ("portal", 3), ("extended", 4)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdAccServerType.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccServerType.setDescription('Specify the type of RADIUS server. 1 (standard) - Server based on RFC protocol(s). 2 (iphotel) - Server for IP-Hotel or 201+ system. 3 (portal) - Server for iTellin Portal system. 4 (extended) - Server based on RADIUS extensions. Default type is standard.') hh3cRdAccQuietTime = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdAccQuietTime.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccQuietTime.setDescription('The time for server returning active. The unit is minute. When the value is 0, the server state retains active. Default value is 5.') hh3cRdAccFailureAction = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ignore", 1), ("reject", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdAccFailureAction.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccFailureAction.setDescription('Defines the action that authentication should take if authentication succeeds but the associated accounting start fails. 1 (ignore) - treat as authentication success; ignore accounting start failure. 2 (reject) - treat as authentication failed if corresponding accounting start fails. Default value is 1(reject).') hh3cRdAccRealTime = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 60))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdAccRealTime.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccRealTime.setDescription("Interval of realtime-accounting packets. The unit is minute. When the value is 0, the device doesn't send realtime-accounting packets. Default value is 12.") hh3cRdAccRealTimeRetry = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 17), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255)).clone(5)).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdAccRealTimeRetry.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccRealTimeRetry.setDescription('The number of attempt the client will make when trying to send realtime-accounting packet to accounting server before it will consider the attempt failed. Default value is 5.') hh3cRdAccSaveStopPktEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 18), TruthValue()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdAccSaveStopPktEnable.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccSaveStopPktEnable.setDescription("The control of whether save stop-accounting packet in local buffer and resend later when the accounting server doesn't respond. When SaveStopPktEnable is set to false, the value of AccStopRetry will be ignored. Default value is true.") hh3cRdAccStopRetry = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 19), Integer32().subtype(subtypeSpec=ValueRangeConstraint(10, 65535))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdAccStopRetry.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccStopRetry.setDescription('The number of attempt the client will make when trying to send stop-accounting packet to accounting server. Default value is 500.') hh3cRdAccDataFlowUnit = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("byte", 1), ("kiloByte", 2), ("megaByte", 3), ("gigaByte", 4)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdAccDataFlowUnit.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccDataFlowUnit.setDescription("Specify data flow format that is sent to RADIUS server. The value SHOULD be set the same as the value of corresponding server. 1 (byte) - Specify 'byte' as the unit of data flow. 2 (kiloByte) - Specify 'kilo-byte' as the unit of data flow. 3 (megaByte) - Specify 'mega-byte' as the unit of data flow. 4 (gigaByte) - Specify 'giga-byte' as the unit of data flow. Default value is 1.") hh3cRdAccPacketUnit = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 21), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("onePacket", 1), ("kiloPacket", 2), ("megaPacket", 3), ("gigaPacket", 4)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdAccPacketUnit.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccPacketUnit.setDescription("Specify packet format that is sent to RADIUS server. The value SHOULD be set the same as the value of corresponding server. 1 (onePacket) - Specify 'one-packet' as the unit of packet. 2 (kiloPacket) - Specify 'kilo-packet' as the unit of packet. 3 (megaPacket) - Specify 'mega-packet' as the unit of packet. 4 (gigaPacket) - Specify 'giga-packet' as the unit of packet. Default value is 1.") hh3cRdAccRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 22), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdAccRowStatus.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccRowStatus.setDescription('This object is responsible for managing the creation, deletion and modification of rows, which support active status and CreateAndGo, Destroy operation. To create a new row, hh3cRdAccGroupName must be specified. To destroy an existent row, the hh3cRdAccGroupName MUST NOT be referred by hh3cDomainTable in hh3cDomainRadiusGroupName column.') hh3cRdAcctOnEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 23), TruthValue()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdAcctOnEnable.setStatus('current') if mibBuilder.loadTexts: hh3cRdAcctOnEnable.setDescription('The control of Accounting-On function. The Accounting-On function is used by the client to mark the start of accounting (for example, upon booting) by sending Accounting-On packets and to mark the end of accounting (for example, just before a scheduled reboot) by sending Accounting-Off packets. Default value is false.') hh3cRdAcctOnSendTimes = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 24), Integer32().clone(50)).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdAcctOnSendTimes.setStatus('current') if mibBuilder.loadTexts: hh3cRdAcctOnSendTimes.setDescription('The number of Accounting-On packets the client will send before it considers the accounting server failed. Default value is 50.') hh3cRdAcctOnSendInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 25), Integer32().clone(3)).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdAcctOnSendInterval.setStatus('current') if mibBuilder.loadTexts: hh3cRdAcctOnSendInterval.setDescription('Interval of Accounting-On packets. The unit is second. Default value is 3.') hh3cRdSecAccKey = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 26), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdSecAccKey.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecAccKey.setDescription('The secret shared between the RADIUS client and the secondary RADIUS accounting server used in encoding and decoding sensitive data. When read, hh3cRdSecAccKey always returns an Octet String of length zero.') hh3cRdPrimAccVpnName = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 27), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 31))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdPrimAccVpnName.setStatus('current') if mibBuilder.loadTexts: hh3cRdPrimAccVpnName.setDescription('The human-readable name of the VPN in which the primary RADIUS accounting server is placed.') hh3cRdSecAccVpnName = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 28), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 31))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdSecAccVpnName.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecAccVpnName.setDescription('The human-readable name of the VPN in which the secondary RADIUS accounting server is placed.') hh3cRdAccNasIpAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 29), InetAddressType()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdAccNasIpAddrType.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccNasIpAddrType.setDescription('The type (IPv4 or IPv6) of the source IP used to communicate with RADIUS accounting server.') hh3cRdAccNasIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 30), IpAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdAccNasIpAddr.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccNasIpAddr.setDescription('The source IPv4 address used to communicate with the RADIUS accounting server.') hh3cRdAccNasIpv6Addr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 31), Ipv6Address()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdAccNasIpv6Addr.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccNasIpv6Addr.setDescription('The source IPv6 address used to communicate with the RADIUS accounting server.') hh3cRadiusGlobalConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 3)) hh3cRadiusAuthErrThreshold = MibScalar((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 3, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 100)).clone(30)).setUnits('percentage').setMaxAccess("readwrite") if mibBuilder.loadTexts: hh3cRadiusAuthErrThreshold.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAuthErrThreshold.setDescription('The threshold of authentication failure trap. A trap will be sent when the percent of the unsuccessful authentication exceeds this threshold.') hh3cRdSecondaryAuthServerTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4), ) if mibBuilder.loadTexts: hh3cRdSecondaryAuthServerTable.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAuthServerTable.setDescription('The (conceptual) table listing RADIUS secondary authentication servers.') hh3cRdSecondaryAuthServerEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4, 1), ).setIndexNames((0, "HH3C-RADIUS-MIB", "hh3cRdGroupName"), (0, "HH3C-RADIUS-MIB", "hh3cRdSecondaryAuthIpAddrType"), (0, "HH3C-RADIUS-MIB", "hh3cRdSecondaryAuthIpAddr"), (0, "HH3C-RADIUS-MIB", "hh3cRdSecondaryAuthVpnName"), (0, "HH3C-RADIUS-MIB", "hh3cRdSecondaryAuthUdpPort")) if mibBuilder.loadTexts: hh3cRdSecondaryAuthServerEntry.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAuthServerEntry.setDescription('An entry (conceptual row) representing a RADIUS secondary authentication server.') hh3cRdSecondaryAuthIpAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4, 1, 1), InetAddressType()) if mibBuilder.loadTexts: hh3cRdSecondaryAuthIpAddrType.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAuthIpAddrType.setDescription('The IP addresses type (IPv4 or IPv6) of secondary RADIUS authentication server.') hh3cRdSecondaryAuthIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4, 1, 2), InetAddress()) if mibBuilder.loadTexts: hh3cRdSecondaryAuthIpAddr.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAuthIpAddr.setDescription('The IP address of secondary RADIUS authentication server.') hh3cRdSecondaryAuthVpnName = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 31))) if mibBuilder.loadTexts: hh3cRdSecondaryAuthVpnName.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAuthVpnName.setDescription('The human-readable name of the VPN in which the secondary RADIUS authentication server is placed.') hh3cRdSecondaryAuthUdpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))) if mibBuilder.loadTexts: hh3cRdSecondaryAuthUdpPort.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAuthUdpPort.setDescription('The UDP port the client is using to send requests to secondary RADIUS authentication server. Default value is 1812.') hh3cRdSecondaryAuthState = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("active", 1), ("block", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdSecondaryAuthState.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAuthState.setDescription('The state of the secondary RADIUS authentication server. 1 (active) The secondary authentication server is in active state. 2 (block) The secondary authentication server is in block state.') hh3cRdSecondaryAuthKey = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4, 1, 6), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdSecondaryAuthKey.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAuthKey.setDescription('The secret shared between the RADIUS client and the secondary RADIUS authentication server used in encoding and decoding sensitive data. When read, hh3cRdSecondaryAuthKey always returns an Octet String of length zero.') hh3cRdSecondaryAuthRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4, 1, 7), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdSecondaryAuthRowStatus.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAuthRowStatus.setDescription("This object is responsible for managing the creation, deletion and modification of rows, which support active status and CreateAndGo, Destroy operation. To create a new row, hh3cRdGroupName must be specified. The number of rows with the same hh3cRdGroupName can't be more than 16.") hh3cRdSecondaryAccServerTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5), ) if mibBuilder.loadTexts: hh3cRdSecondaryAccServerTable.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAccServerTable.setDescription('The (conceptual) table listing RADIUS secondary accounting servers.') hh3cRdSecondaryAccServerEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5, 1), ).setIndexNames((0, "HH3C-RADIUS-MIB", "hh3cRdAccGroupName"), (0, "HH3C-RADIUS-MIB", "hh3cRdSecondaryAccIpAddrType"), (0, "HH3C-RADIUS-MIB", "hh3cRdSecondaryAccIpAddr"), (0, "HH3C-RADIUS-MIB", "hh3cRdSecondaryAccVpnName"), (0, "HH3C-RADIUS-MIB", "hh3cRdSecondaryAccUdpPort")) if mibBuilder.loadTexts: hh3cRdSecondaryAccServerEntry.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAccServerEntry.setDescription('An entry (conceptual row) representing a RADIUS secondary accounting server.') hh3cRdSecondaryAccIpAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5, 1, 1), InetAddressType()) if mibBuilder.loadTexts: hh3cRdSecondaryAccIpAddrType.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAccIpAddrType.setDescription('The IP addresses type (IPv4 or IPv6) of secondary RADIUS accounting server.') hh3cRdSecondaryAccIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5, 1, 2), InetAddress()) if mibBuilder.loadTexts: hh3cRdSecondaryAccIpAddr.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAccIpAddr.setDescription('The IP address of secondary RADIUS accounting server.') hh3cRdSecondaryAccVpnName = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 31))) if mibBuilder.loadTexts: hh3cRdSecondaryAccVpnName.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAccVpnName.setDescription('The human-readable name of the VPN in which the secondary RADIUS accounting server is placed.') hh3cRdSecondaryAccUdpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))) if mibBuilder.loadTexts: hh3cRdSecondaryAccUdpPort.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAccUdpPort.setDescription('The UDP port the client is using to send requests to secondary RADIUS accounting server. Default value is 1813.') hh3cRdSecondaryAccState = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("active", 1), ("block", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdSecondaryAccState.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAccState.setDescription('The state of the secondary RADIUS accounting server. 1 (active) The secondary accounting server is in active state. 2 (block) The secondary accounting server is in block state.') hh3cRdSecondaryAccKey = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5, 1, 6), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdSecondaryAccKey.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAccKey.setDescription('The secret shared between the RADIUS client and the secondary RADIUS accounting server used in encoding and decoding sensitive data. When read, hh3cRdSecondaryAccKey always returns an Octet String of length zero.') hh3cRdSecondaryAccRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5, 1, 7), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRdSecondaryAccRowStatus.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAccRowStatus.setDescription("This object is responsible for managing the creation, deletion and modification of rows, which support active status and CreateAndGo, Destroy operation. To create a new row, hh3cRdAccGroupName must be specified. The number of rows with the same hh3cRdAccGroupName can't be more than 16.") hh3cRadiusAccounting = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2)) hh3cRadiusAccClient = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1)) hh3cRadiusAccServerTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1, 1), ) if mibBuilder.loadTexts: hh3cRadiusAccServerTable.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAccServerTable.setDescription('The (conceptual) table listing the RADIUS accounting servers with which the client shares a secret.') hh3cRadiusAccServerEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1, 1, 1), ).setIndexNames((0, "RADIUS-ACC-CLIENT-MIB", "radiusAccServerIndex")) if mibBuilder.loadTexts: hh3cRadiusAccServerEntry.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAccServerEntry.setDescription('An entry (conceptual row) representing a RADIUS accounting server with which a client shares a secret.') hh3cRadiusAccClientStartRequests = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1, 1, 1, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cRadiusAccClientStartRequests.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAccClientStartRequests.setDescription('The number of RADIUS accounting start request sent to this server.') hh3cRadiusAccClientStartResponses = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1, 1, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cRadiusAccClientStartResponses.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAccClientStartResponses.setDescription('The number of RADIUS accounting start response received from this server.') hh3cRadiusAccClientInterimRequests = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1, 1, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cRadiusAccClientInterimRequests.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAccClientInterimRequests.setDescription('The number of RADIUS interim accounting request sent to this server.') hh3cRadiusAccClientInterimResponses = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1, 1, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cRadiusAccClientInterimResponses.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAccClientInterimResponses.setDescription('The number of RADIUS interim accounting response received from this server.') hh3cRadiusAccClientStopRequests = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1, 1, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cRadiusAccClientStopRequests.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAccClientStopRequests.setDescription('The number of RADIUS stop accounting request sent to this RADIUS server.') hh3cRadiusAccClientStopResponses = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1, 1, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cRadiusAccClientStopResponses.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAccClientStopResponses.setDescription('The number of RADIUS stop accounting response received from this server.') hh3cRadiusServerTrap = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 3)) hh3cRadiusAuthServerDownTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 2, 13, 3, 1)).setObjects(("RADIUS-AUTH-CLIENT-MIB", "radiusAuthServerAddress"), ("RADIUS-AUTH-CLIENT-MIB", "radiusAuthClientServerPortNumber"), ("HH3C-RADIUS-MIB", "hh3cRadiusServerFirstTrapTime")) if mibBuilder.loadTexts: hh3cRadiusAuthServerDownTrap.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAuthServerDownTrap.setDescription("This trap is generated when the authentication RADIUS server doesn't respond client's requests for specified times.") hh3cRadiusAccServerDownTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 2, 13, 3, 2)).setObjects(("RADIUS-ACC-CLIENT-MIB", "radiusAccServerAddress"), ("RADIUS-ACC-CLIENT-MIB", "radiusAccClientServerPortNumber"), ("HH3C-RADIUS-MIB", "hh3cRadiusServerFirstTrapTime")) if mibBuilder.loadTexts: hh3cRadiusAccServerDownTrap.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAccServerDownTrap.setDescription("This trap is generated when the accounting RADIUS server doesn't respond client's requests for specified times.") hh3cRadiusServerTrapPrefix = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 3, 0)) hh3cRadiusAuthServerUpTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 2, 13, 3, 0, 1)).setObjects(("RADIUS-AUTH-CLIENT-MIB", "radiusAuthServerAddress"), ("RADIUS-AUTH-CLIENT-MIB", "radiusAuthClientServerPortNumber"), ("HH3C-RADIUS-MIB", "hh3cRadiusServerFirstTrapTime")) if mibBuilder.loadTexts: hh3cRadiusAuthServerUpTrap.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAuthServerUpTrap.setDescription('This trap is generated when the device finds that the state of RADIUS authentication server becomes reachable from unreachable.') hh3cRadiusAccServerUpTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 2, 13, 3, 0, 2)).setObjects(("RADIUS-ACC-CLIENT-MIB", "radiusAccServerAddress"), ("RADIUS-ACC-CLIENT-MIB", "radiusAccClientServerPortNumber"), ("HH3C-RADIUS-MIB", "hh3cRadiusServerFirstTrapTime")) if mibBuilder.loadTexts: hh3cRadiusAccServerUpTrap.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAccServerUpTrap.setDescription('This trap is generated when the device finds that the state of RADIUS accounting server becomes reachable from unreachable.') hh3cRadiusAuthErrTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 2, 13, 3, 0, 3)).setObjects(("RADIUS-AUTH-CLIENT-MIB", "radiusAuthServerAddress"), ("RADIUS-AUTH-CLIENT-MIB", "radiusAuthClientServerPortNumber")) if mibBuilder.loadTexts: hh3cRadiusAuthErrTrap.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAuthErrTrap.setDescription('This trap is generated when the device finds that the percent of unsuccessful authentication exceeds a threshold, and the threshold is the value of node hh3cRadiusAuthErrThreshold.') hh3cRadiusAuthenticating = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 4)) hh3cRadiusAuthClient = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 4, 1)) hh3cRadiusAuthServerTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 13, 4, 1, 1), ) if mibBuilder.loadTexts: hh3cRadiusAuthServerTable.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAuthServerTable.setDescription('The (conceptual) table listing the RADIUS authenticating servers with which the client shares a secret.') hh3cRadiusAuthServerEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 13, 4, 1, 1, 1), ).setIndexNames((0, "RADIUS-AUTH-CLIENT-MIB", "radiusAuthServerIndex")) if mibBuilder.loadTexts: hh3cRadiusAuthServerEntry.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAuthServerEntry.setDescription('An entry (conceptual row) representing a RADIUS authenticating server with which a client shares a secret.') hh3cRadiusAuthFailureTimes = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 4, 1, 1, 1, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cRadiusAuthFailureTimes.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAuthFailureTimes.setDescription('The number of RADIUS authenticating failed to this server.') hh3cRadiusAuthTimeoutTimes = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 4, 1, 1, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cRadiusAuthTimeoutTimes.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAuthTimeoutTimes.setDescription('The number of RADIUS authenticating timeout to this server.') hh3cRadiusAuthRejectTimes = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 4, 1, 1, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cRadiusAuthRejectTimes.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAuthRejectTimes.setDescription('The number of RADIUS authenticating rejected to this server.') hh3cRadiusExtend = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5)) hh3cRadiusExtendObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 1)) hh3cRadiusExtendTables = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2)) hh3cRadiusExtendTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 3)) hh3cRadiusSchAuthTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1), ) if mibBuilder.loadTexts: hh3cRadiusSchAuthTable.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAuthTable.setDescription('The (conceptual) table listing RADIUS authentication servers.') hh3cRadiusSchAuthEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1), ).setIndexNames((0, "HH3C-RADIUS-MIB", "hh3cRadiusSchAuthGroupName")) if mibBuilder.loadTexts: hh3cRadiusSchAuthEntry.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAuthEntry.setDescription('An entry (conceptual row) representing RADIUS authentication servers.') hh3cRadiusSchAuthGroupName = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1, 1), DisplayString()) if mibBuilder.loadTexts: hh3cRadiusSchAuthGroupName.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAuthGroupName.setDescription('The name of the RADIUS authentication server group referred to in this table entry.') hh3cRadiusSchAuthPrimIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1, 2), IpAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRadiusSchAuthPrimIpAddr.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAuthPrimIpAddr.setDescription('The IP address of primary RADIUS authenticaiton server.') hh3cRadiusSchAuthPrimUdpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1, 3), Integer32().clone(1812)).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRadiusSchAuthPrimUdpPort.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAuthPrimUdpPort.setDescription('The UDP port the client is using to send requests to primary RADIUS authentication server. Default value is 1812.') hh3cRadiusSchAuthPrimKey = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1, 4), DisplayString()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRadiusSchAuthPrimKey.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAuthPrimKey.setDescription('The secret shared between the RADIUS client and the primary RADIUS authentication server used in encoding and decoding sensitive data.') hh3cRadiusSchAuthSecIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1, 5), IpAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRadiusSchAuthSecIpAddr.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAuthSecIpAddr.setDescription('The IP address of secondary RADIUS authenticaiton server.') hh3cRadiusSchAuthSecUdpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1, 6), Integer32().clone(1812)).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRadiusSchAuthSecUdpPort.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAuthSecUdpPort.setDescription('The UDP port the client is using to send requests to secondary RADIUS authentication server. Default value is 1812.') hh3cRadiusSchAuthSecKey = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1, 7), DisplayString()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRadiusSchAuthSecKey.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAuthSecKey.setDescription('The secret shared between the RADIUS client and the secondary RADIUS authentication server used in encoding and decoding sensitive data.') hh3cRadiusSchAuthRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1, 8), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRadiusSchAuthRowStatus.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAuthRowStatus.setDescription('This object is responsible for managing the creation, deletion and modification of rows, which support active status and CreateAndGo, Destroy operation. To create a new row, hh3cRadiusSchAuthGroupName must be specified, and this action will create a corresponding domain that hh3cDomainRadiusGroupName is the same as hh3cRadiusSchAuthGroupName. To destroy an existent row, the hh3cRadiusSchAuthGroupName MUST NOT be referred by hh3cDomainTable in hh3cDomainRadiusGroupName column.') hh3cRadiusSchAccTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2), ) if mibBuilder.loadTexts: hh3cRadiusSchAccTable.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAccTable.setDescription('The (conceptual) table listing RADIUS accounting servers.') hh3cRadiusSchAccEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1), ).setIndexNames((0, "HH3C-RADIUS-MIB", "hh3cRadiusSchAccGroupName")) if mibBuilder.loadTexts: hh3cRadiusSchAccEntry.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAccEntry.setDescription('An entry (conceptual row) representing RADIUS accounting servers.') hh3cRadiusSchAccGroupName = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1, 1), DisplayString()) if mibBuilder.loadTexts: hh3cRadiusSchAccGroupName.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAccGroupName.setDescription('The name of the RADIUS accounting server group referred to in this table entry.') hh3cRadiusSchAccPrimIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1, 2), IpAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRadiusSchAccPrimIpAddr.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAccPrimIpAddr.setDescription('The IP address of primary RADIUS accounting server.') hh3cRadiusSchAccPrimUdpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1, 3), Integer32().clone(1813)).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRadiusSchAccPrimUdpPort.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAccPrimUdpPort.setDescription('The UDP port the client is using to send requests to primary RADIUS accounting server. Default value is 1813.') hh3cRadiusSchAccPrimKey = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1, 4), DisplayString()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRadiusSchAccPrimKey.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAccPrimKey.setDescription('The secret shared between the RADIUS client and the primary RADIUS accounting server used in encoding and decoding sensitive data.') hh3cRadiusSchAccSecIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1, 5), IpAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRadiusSchAccSecIpAddr.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAccSecIpAddr.setDescription('The IP address of secondary RADIUS accounting server.') hh3cRadiusSchAccSecUdpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1, 6), Integer32().clone(1813)).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRadiusSchAccSecUdpPort.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAccSecUdpPort.setDescription('The UDP port the client is using to send requests to secondary RADIUS accounting server. Default value is 1813.') hh3cRadiusSchAccSecKey = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1, 7), DisplayString()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRadiusSchAccSecKey.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAccSecKey.setDescription('The secret shared between the RADIUS client and the secondary RADIUS accounting server used in encoding and decoding sensitive data.') hh3cRadiusSchAccRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1, 8), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hh3cRadiusSchAccRowStatus.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAccRowStatus.setDescription('This object is responsible for managing the creation, deletion and modification of rows, which support active status and CreateAndGo, Destroy operation. To create a new row, hh3cRadiusSchAccGroupName must be specified, and this action will create a corresponding domain that hh3cDomainRadiusGroupName is the same as hh3cRadiusSchAccGroupName. To destroy an existent row, the hh3cRadiusSchAccGroupName MUST NOT be referred by hh3cDomainTable in hh3cDomainRadiusGroupName column.') hh3cRadiusStatistic = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 6)) hh3cRadiusStatAccReq = MibScalar((1, 3, 6, 1, 4, 1, 25506, 2, 13, 6, 1), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cRadiusStatAccReq.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusStatAccReq.setDescription('It shows the number of radius account request to the radius server.') hh3cRadiusStatAccAck = MibScalar((1, 3, 6, 1, 4, 1, 25506, 2, 13, 6, 2), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cRadiusStatAccAck.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusStatAccAck.setDescription('It shows the number of radius account response from the radius server.') hh3cRadiusStatLogoutReq = MibScalar((1, 3, 6, 1, 4, 1, 25506, 2, 13, 6, 3), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cRadiusStatLogoutReq.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusStatLogoutReq.setDescription('It shows the number of logout request to the radius server.') hh3cRadiusStatLogoutAck = MibScalar((1, 3, 6, 1, 4, 1, 25506, 2, 13, 6, 4), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cRadiusStatLogoutAck.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusStatLogoutAck.setDescription('It shows the number of logout response from the radius server.') hh3cRadiusServerTrapVarObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 7)) hh3cRadiusServerFirstTrapTime = MibScalar((1, 3, 6, 1, 4, 1, 25506, 2, 13, 7, 1), TimeTicks()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cRadiusServerFirstTrapTime.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusServerFirstTrapTime.setDescription('Represents the first trap time.') mibBuilder.exportSymbols("HH3C-RADIUS-MIB", hh3cRdSecondaryAccState=hh3cRdSecondaryAccState, hh3cRdSecAccUdpPort=hh3cRdSecAccUdpPort, hh3cRdSecondaryAccKey=hh3cRdSecondaryAccKey, hh3cRadiusSchAccSecUdpPort=hh3cRadiusSchAccSecUdpPort, hh3cRdSecondaryAuthIpAddr=hh3cRdSecondaryAuthIpAddr, hh3cRdSecondaryAuthVpnName=hh3cRdSecondaryAuthVpnName, hh3cRdAuthNasIpAddrType=hh3cRdAuthNasIpAddrType, hh3cRadiusExtendTraps=hh3cRadiusExtendTraps, hh3cRadiusSchAuthGroupName=hh3cRadiusSchAuthGroupName, hh3cRadiusGlobalConfig=hh3cRadiusGlobalConfig, hh3cRdSecondaryAuthKey=hh3cRdSecondaryAuthKey, hh3cRadiusAccClientInterimResponses=hh3cRadiusAccClientInterimResponses, hh3cRadiusStatAccAck=hh3cRadiusStatAccAck, hh3cRdKey=hh3cRdKey, hh3cRdSecAuthIpAddrType=hh3cRdSecAuthIpAddrType, hh3cRdAccRetry=hh3cRdAccRetry, hh3cRadiusSchAuthSecKey=hh3cRadiusSchAuthSecKey, hh3cRdUserNameFormat=hh3cRdUserNameFormat, hh3cRdAccServerType=hh3cRdAccServerType, hh3cRdAcctOnSendTimes=hh3cRdAcctOnSendTimes, hh3cRadiusSchAccGroupName=hh3cRadiusSchAccGroupName, hh3cRadiusServerFirstTrapTime=hh3cRadiusServerFirstTrapTime, hh3cRdAuthNasIpAddr=hh3cRdAuthNasIpAddr, hh3cRdRowStatus=hh3cRdRowStatus, hh3cRadiusAuthServerDownTrap=hh3cRadiusAuthServerDownTrap, hh3cRdAccNasIpv6Addr=hh3cRdAccNasIpv6Addr, hh3cRdRetry=hh3cRdRetry, hh3cRadiusAccounting=hh3cRadiusAccounting, hh3cRadiusServerTrap=hh3cRadiusServerTrap, hh3cRdAccQuietTime=hh3cRdAccQuietTime, hh3cRadiusAccServerEntry=hh3cRadiusAccServerEntry, hh3cRdAccInfoEntry=hh3cRdAccInfoEntry, hh3cRdAccPacketUnit=hh3cRdAccPacketUnit, hh3cRadiusAuthServerUpTrap=hh3cRadiusAuthServerUpTrap, hh3cRadiusSchAuthEntry=hh3cRadiusSchAuthEntry, hh3cRadiusServerTrapVarObjects=hh3cRadiusServerTrapVarObjects, hh3cRadiusStatLogoutAck=hh3cRadiusStatLogoutAck, hh3cRdPrimAuthIpAddr=hh3cRdPrimAuthIpAddr, hh3cRadiusAccServerDownTrap=hh3cRadiusAccServerDownTrap, hh3cRdPrimState=hh3cRdPrimState, hh3cRadiusExtendObjects=hh3cRadiusExtendObjects, hh3cRdGroupName=hh3cRdGroupName, hh3cRdPrimAccIpAddr=hh3cRdPrimAccIpAddr, hh3cRadiusSchAccEntry=hh3cRadiusSchAccEntry, hh3cRadiusSchAccSecKey=hh3cRadiusSchAccSecKey, hh3cRdAccStopRetry=hh3cRdAccStopRetry, hh3cRdServerType=hh3cRdServerType, hh3cRadiusSchAuthPrimUdpPort=hh3cRadiusSchAuthPrimUdpPort, hh3cRdInfoEntry=hh3cRdInfoEntry, PYSNMP_MODULE_ID=hh3cRadius, hh3cRadiusAuthServerEntry=hh3cRadiusAuthServerEntry, hh3cRadiusSchAuthSecUdpPort=hh3cRadiusSchAuthSecUdpPort, hh3cRdSecUdpPort=hh3cRdSecUdpPort, hh3cRdAccDataFlowUnit=hh3cRdAccDataFlowUnit, hh3cRdPrimAccVpnName=hh3cRdPrimAccVpnName, hh3cRdSecAccVpnName=hh3cRdSecAccVpnName, hh3cRdSecondaryAccVpnName=hh3cRdSecondaryAccVpnName, hh3cRadiusAuthTimeoutTimes=hh3cRadiusAuthTimeoutTimes, hh3cRdAccFailureAction=hh3cRdAccFailureAction, hh3cRdQuietTime=hh3cRdQuietTime, hh3cRdAccGroupName=hh3cRdAccGroupName, hh3cRadiusAccClient=hh3cRadiusAccClient, hh3cRadiusSchAccSecIpAddr=hh3cRadiusSchAccSecIpAddr, hh3cRdSecondaryAuthServerEntry=hh3cRdSecondaryAuthServerEntry, hh3cRdObjects=hh3cRdObjects, hh3cRdAccRowStatus=hh3cRdAccRowStatus, hh3cRdSecondaryAccUdpPort=hh3cRdSecondaryAccUdpPort, hh3cRdSecondaryAccRowStatus=hh3cRdSecondaryAccRowStatus, hh3cRdSecondaryAuthUdpPort=hh3cRdSecondaryAuthUdpPort, hh3cRdSecAuthIp=hh3cRdSecAuthIp, hh3cRadiusSchAccPrimIpAddr=hh3cRadiusSchAccPrimIpAddr, hh3cRadiusExtendTables=hh3cRadiusExtendTables, hh3cRadiusStatAccReq=hh3cRadiusStatAccReq, hh3cRdSecondaryAuthServerTable=hh3cRdSecondaryAuthServerTable, hh3cRadiusSchAuthPrimKey=hh3cRadiusSchAuthPrimKey, hh3cRadiusAccClientStartResponses=hh3cRadiusAccClientStartResponses, hh3cRdSecondaryAccServerEntry=hh3cRdSecondaryAccServerEntry, hh3cRadiusAccServerUpTrap=hh3cRadiusAccServerUpTrap, hh3cRadiusAccClientInterimRequests=hh3cRadiusAccClientInterimRequests, hh3cRdAccRealTimeRetry=hh3cRdAccRealTimeRetry, hh3cRdSecAccIpAddr=hh3cRdSecAccIpAddr, hh3cRdPrimAccState=hh3cRdPrimAccState, hh3cRdInfoTable=hh3cRdInfoTable, hh3cRdPrimAuthIpAddrType=hh3cRdPrimAuthIpAddrType, hh3cRdSecAccState=hh3cRdSecAccState, hh3cRadiusAuthFailureTimes=hh3cRadiusAuthFailureTimes, hh3cRdSecAccKey=hh3cRdSecAccKey, hh3cRadiusAuthErrTrap=hh3cRadiusAuthErrTrap, hh3cRdSecondaryAccIpAddrType=hh3cRdSecondaryAccIpAddrType, hh3cRadiusAccClientStartRequests=hh3cRadiusAccClientStartRequests, hh3cRadiusAuthErrThreshold=hh3cRadiusAuthErrThreshold, hh3cRdPrimAuthIp=hh3cRdPrimAuthIp, hh3cRadiusSchAuthSecIpAddr=hh3cRadiusSchAuthSecIpAddr, hh3cRadiusStatistic=hh3cRadiusStatistic, hh3cRadiusAuthRejectTimes=hh3cRadiusAuthRejectTimes, hh3cRadiusSchAccRowStatus=hh3cRadiusSchAccRowStatus, hh3cRdSecondaryAuthRowStatus=hh3cRdSecondaryAuthRowStatus, hh3cRadiusSchAccPrimKey=hh3cRadiusSchAccPrimKey, hh3cRdSecKey=hh3cRdSecKey, hh3cRdPrimAccIpAddrType=hh3cRdPrimAccIpAddrType, hh3cRdPrimVpnName=hh3cRdPrimVpnName, hh3cRdTimeout=hh3cRdTimeout, hh3cRdAcctOnSendInterval=hh3cRdAcctOnSendInterval, hh3cRdPrimAccUdpPort=hh3cRdPrimAccUdpPort, hh3cRadiusAuthServerTable=hh3cRadiusAuthServerTable, hh3cRadius=hh3cRadius, hh3cRadiusExtend=hh3cRadiusExtend, hh3cRdAccKey=hh3cRdAccKey, hh3cRdSecVpnName=hh3cRdSecVpnName, hh3cRadiusSchAuthRowStatus=hh3cRadiusSchAuthRowStatus, hh3cRadiusServerTrapPrefix=hh3cRadiusServerTrapPrefix, hh3cRadiusSchAuthPrimIpAddr=hh3cRadiusSchAuthPrimIpAddr, hh3cRadiusAccClientStopRequests=hh3cRadiusAccClientStopRequests, hh3cRdAccInfoTable=hh3cRdAccInfoTable, hh3cRdSecondaryAccIpAddr=hh3cRdSecondaryAccIpAddr, hh3cRadiusAuthenticating=hh3cRadiusAuthenticating, hh3cRadiusSchAuthTable=hh3cRadiusSchAuthTable, hh3cRdAccTimeout=hh3cRdAccTimeout, hh3cRadiusAccClientStopResponses=hh3cRadiusAccClientStopResponses, hh3cRdAuthNasIpv6Addr=hh3cRdAuthNasIpv6Addr, hh3cRdAccSaveStopPktEnable=hh3cRdAccSaveStopPktEnable, hh3cRadiusAuthClient=hh3cRadiusAuthClient, hh3cRdPrimUdpPort=hh3cRdPrimUdpPort, hh3cRdSecAccIpAddrType=hh3cRdSecAccIpAddrType, hh3cRdSecondaryAccServerTable=hh3cRdSecondaryAccServerTable, hh3cRadiusSchAccPrimUdpPort=hh3cRadiusSchAccPrimUdpPort, hh3cRdSecAuthIpAddr=hh3cRdSecAuthIpAddr, hh3cRdAccRealTime=hh3cRdAccRealTime, hh3cRadiusAccServerTable=hh3cRadiusAccServerTable, hh3cRdSecondaryAuthState=hh3cRdSecondaryAuthState, hh3cRadiusSchAccTable=hh3cRadiusSchAccTable, hh3cRdSecondaryAuthIpAddrType=hh3cRdSecondaryAuthIpAddrType, hh3cRdAcctOnEnable=hh3cRdAcctOnEnable, hh3cRadiusStatLogoutReq=hh3cRadiusStatLogoutReq, hh3cRdSecState=hh3cRdSecState, hh3cRdAccNasIpAddrType=hh3cRdAccNasIpAddrType, hh3cRdAccNasIpAddr=hh3cRdAccNasIpAddr)
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_union, single_value_constraint, constraints_intersection, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ConstraintsUnion', 'SingleValueConstraint', 'ConstraintsIntersection', 'ValueRangeConstraint') (hh3c_common,) = mibBuilder.importSymbols('HH3C-OID-MIB', 'hh3cCommon') (inet_address, inet_address_type) = mibBuilder.importSymbols('INET-ADDRESS-MIB', 'InetAddress', 'InetAddressType') (ipv6_address,) = mibBuilder.importSymbols('IPV6-TC', 'Ipv6Address') (radius_acc_server_address, radius_acc_client_server_port_number, radius_acc_server_index) = mibBuilder.importSymbols('RADIUS-ACC-CLIENT-MIB', 'radiusAccServerAddress', 'radiusAccClientServerPortNumber', 'radiusAccServerIndex') (radius_auth_client_server_port_number, radius_auth_server_index, radius_auth_server_address) = mibBuilder.importSymbols('RADIUS-AUTH-CLIENT-MIB', 'radiusAuthClientServerPortNumber', 'radiusAuthServerIndex', 'radiusAuthServerAddress') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (object_identity, time_ticks, unsigned32, mib_identifier, ip_address, mib_scalar, mib_table, mib_table_row, mib_table_column, bits, counter32, counter64, gauge32, iso, notification_type, module_identity, integer32) = mibBuilder.importSymbols('SNMPv2-SMI', 'ObjectIdentity', 'TimeTicks', 'Unsigned32', 'MibIdentifier', 'IpAddress', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Bits', 'Counter32', 'Counter64', 'Gauge32', 'iso', 'NotificationType', 'ModuleIdentity', 'Integer32') (display_string, row_status, textual_convention, truth_value) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'RowStatus', 'TextualConvention', 'TruthValue') hh3c_radius = module_identity((1, 3, 6, 1, 4, 1, 25506, 2, 13)) hh3cRadius.setRevisions(('2014-06-07 18:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: hh3cRadius.setRevisionsDescriptions(('Modified description of hh3cRdSecondaryAuthRowStatus. Modified description of hh3cRdSecondaryAccRowStatus',)) if mibBuilder.loadTexts: hh3cRadius.setLastUpdated('201406071800Z') if mibBuilder.loadTexts: hh3cRadius.setOrganization('Hangzhou H3C Technologies Co., Ltd.') if mibBuilder.loadTexts: hh3cRadius.setContactInfo('Platform Team Hangzhou H3C Technologies Co., Ltd. Hai-Dian District Beijing P.R. China http://www.h3c.com Zip:100085 ') if mibBuilder.loadTexts: hh3cRadius.setDescription('The HH3C-RADIUS-MIB contains objects to Manage configuration and Monitor running state for RADIUS feature.') hh3c_rd_objects = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1)) hh3c_rd_info_table = mib_table((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1)) if mibBuilder.loadTexts: hh3cRdInfoTable.setStatus('current') if mibBuilder.loadTexts: hh3cRdInfoTable.setDescription('The (conceptual) table listing RADIUS authentication servers.') hh3c_rd_info_entry = mib_table_row((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1)).setIndexNames((0, 'HH3C-RADIUS-MIB', 'hh3cRdGroupName')) if mibBuilder.loadTexts: hh3cRdInfoEntry.setStatus('current') if mibBuilder.loadTexts: hh3cRdInfoEntry.setDescription('An entry (conceptual row) representing a RADIUS authentication server.') hh3c_rd_group_name = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 1), display_string().subtype(subtypeSpec=value_size_constraint(1, 32))) if mibBuilder.loadTexts: hh3cRdGroupName.setStatus('current') if mibBuilder.loadTexts: hh3cRdGroupName.setDescription('The name of the RADIUS authentication group referred to in this table entry.') hh3c_rd_prim_auth_ip = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 2), ip_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdPrimAuthIp.setStatus('deprecated') if mibBuilder.loadTexts: hh3cRdPrimAuthIp.setDescription('The IP address of primary RADIUS authentication server.') hh3c_rd_prim_udp_port = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 3), integer32()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdPrimUdpPort.setStatus('current') if mibBuilder.loadTexts: hh3cRdPrimUdpPort.setDescription('The UDP port the client is using to send requests to primary RADIUS authentication server. Default value is 1812.') hh3c_rd_prim_state = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('active', 1), ('block', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdPrimState.setStatus('current') if mibBuilder.loadTexts: hh3cRdPrimState.setDescription('The state of the primary RADIUS authentication server. 1 (active) The primary authentication server is in active state. 2 (block) The primary authentication server is in block state.') hh3c_rd_sec_auth_ip = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 5), ip_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdSecAuthIp.setStatus('deprecated') if mibBuilder.loadTexts: hh3cRdSecAuthIp.setDescription('The IP address of secondary RADIUS authentication server.') hh3c_rd_sec_udp_port = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 6), integer32()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdSecUdpPort.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecUdpPort.setDescription('The UDP port the client is using to send requests to secondary RADIUS authentication server. Default value is 1812.') hh3c_rd_sec_state = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('active', 1), ('block', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdSecState.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecState.setDescription('The state of the secondary RADIUS authentication server. 1 (active) The secondary authentication server is in active state. 2 (block) The secondary authentication server is in block state.') hh3c_rd_key = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 8), display_string().subtype(subtypeSpec=value_size_constraint(0, 64))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdKey.setStatus('current') if mibBuilder.loadTexts: hh3cRdKey.setDescription('The secret shared between the RADIUS client and RADIUS authentication server used in encoding and decoding sensitive data. When read, hh3cRdKey always returns an Octet String of length zero.') hh3c_rd_retry = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 9), integer32()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdRetry.setStatus('current') if mibBuilder.loadTexts: hh3cRdRetry.setDescription('The number of attempts the client will make when trying to send requests to a server before it will consider the attempt failed. Default value is 3.') hh3c_rd_timeout = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 10), integer32()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdTimeout.setStatus('current') if mibBuilder.loadTexts: hh3cRdTimeout.setDescription('The timeout value the client will use when sending requests to a server. The unit is second. Default value is 3.') hh3c_rd_prim_auth_ip_addr_type = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 11), inet_address_type()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdPrimAuthIpAddrType.setStatus('current') if mibBuilder.loadTexts: hh3cRdPrimAuthIpAddrType.setDescription('The IP addresses type (IPv4 or IPv6) of primary RADIUS authentication server.') hh3c_rd_prim_auth_ip_addr = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 12), inet_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdPrimAuthIpAddr.setStatus('current') if mibBuilder.loadTexts: hh3cRdPrimAuthIpAddr.setDescription('The IP address of primary RADIUS authentication server.') hh3c_rd_sec_auth_ip_addr_type = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 13), inet_address_type()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdSecAuthIpAddrType.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecAuthIpAddrType.setDescription('The IP addresses type (IPv4 or IPv6) of secondary RADIUS authentication server.') hh3c_rd_sec_auth_ip_addr = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 14), inet_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdSecAuthIpAddr.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecAuthIpAddr.setDescription('The IP address of secondary RADIUS authentication server.') hh3c_rd_server_type = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 15), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('standard', 1), ('iphotel', 2), ('portal', 3), ('extended', 4)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdServerType.setStatus('current') if mibBuilder.loadTexts: hh3cRdServerType.setDescription('Specify the type of RADIUS server. 1 (standard) - Server based on RFC protocol(s). 2 (iphotel) - Server for IP-Hotel or 201+ system. 3 (portal) - Server for iTellin Portal system. 4 (extended) - Server based on RADIUS extensions. Default type is standard.') hh3c_rd_quiet_time = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 16), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdQuietTime.setStatus('current') if mibBuilder.loadTexts: hh3cRdQuietTime.setDescription('The time for server returning active. The unit is minute. When the value is 0, the server state retains active. Default value is 5.') hh3c_rd_user_name_format = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 17), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('withoutdomain', 1), ('withdomain', 2), ('keeporignal', 3)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdUserNameFormat.setStatus('current') if mibBuilder.loadTexts: hh3cRdUserNameFormat.setDescription('Specify the user-name format that is sent to RADIUS server. 1 (withoutdomain) - send the user-name without domain. 2 (withdomain) - send the user-name with domain. 3 (keeporignal) - send the user-name as it is entered. Default format is withdomain.') hh3c_rd_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 18), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdRowStatus.setStatus('current') if mibBuilder.loadTexts: hh3cRdRowStatus.setDescription('This object is responsible for managing the creation, deletion and modification of rows, which support active status and CreateAndGo, Destroy operation. To create a new row, hh3cRdGroupName must be specified. To destroy an existent row, the hh3cRdGroupName MUST NOT be referred by hh3cDomainTable in hh3cDomainRadiusGroupName column.') hh3c_rd_sec_key = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 19), display_string().subtype(subtypeSpec=value_size_constraint(0, 64))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdSecKey.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecKey.setDescription('The secret shared between the RADIUS client and the secondary RADIUS authentication server used in encoding and decoding sensitive data. When read, hh3cRdSecKey always returns an Octet String of length zero.') hh3c_rd_prim_vpn_name = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 20), display_string().subtype(subtypeSpec=value_size_constraint(0, 31))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdPrimVpnName.setStatus('current') if mibBuilder.loadTexts: hh3cRdPrimVpnName.setDescription('The human-readable name of the VPN in which the primary RADIUS authentication server is placed.') hh3c_rd_sec_vpn_name = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 21), display_string().subtype(subtypeSpec=value_size_constraint(0, 31))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdSecVpnName.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecVpnName.setDescription('The human-readable name of the VPN in which the secondary RADIUS authentication server is placed.') hh3c_rd_auth_nas_ip_addr_type = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 22), inet_address_type()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdAuthNasIpAddrType.setStatus('current') if mibBuilder.loadTexts: hh3cRdAuthNasIpAddrType.setDescription('The type (IPv4 or IPv6) of the source IP used to communicate with RADIUS authentication server.') hh3c_rd_auth_nas_ip_addr = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 23), ip_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdAuthNasIpAddr.setStatus('current') if mibBuilder.loadTexts: hh3cRdAuthNasIpAddr.setDescription('The source IPv4 address used to communicate with the RADIUS authentication server.') hh3c_rd_auth_nas_ipv6_addr = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 1, 1, 24), ipv6_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdAuthNasIpv6Addr.setStatus('current') if mibBuilder.loadTexts: hh3cRdAuthNasIpv6Addr.setDescription('The source IPv6 address used to communicate with the RADIUS authentication server.') hh3c_rd_acc_info_table = mib_table((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2)) if mibBuilder.loadTexts: hh3cRdAccInfoTable.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccInfoTable.setDescription('The (conceptual) table listing RADIUS accounting servers.') hh3c_rd_acc_info_entry = mib_table_row((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1)).setIndexNames((0, 'HH3C-RADIUS-MIB', 'hh3cRdAccGroupName')) if mibBuilder.loadTexts: hh3cRdAccInfoEntry.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccInfoEntry.setDescription('An entry (conceptual row) representing a RADIUS accounting server.') hh3c_rd_acc_group_name = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 1), display_string().subtype(subtypeSpec=value_size_constraint(1, 32))) if mibBuilder.loadTexts: hh3cRdAccGroupName.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccGroupName.setDescription('The name of the RADIUS group referred to in this table entry.') hh3c_rd_prim_acc_ip_addr_type = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 2), inet_address_type()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdPrimAccIpAddrType.setStatus('current') if mibBuilder.loadTexts: hh3cRdPrimAccIpAddrType.setDescription('The IP addresses type (IPv4 or IPv6) of primary RADIUS accounting server.') hh3c_rd_prim_acc_ip_addr = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 3), inet_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdPrimAccIpAddr.setStatus('current') if mibBuilder.loadTexts: hh3cRdPrimAccIpAddr.setDescription('The IP address of primary RADIUS accounting server.') hh3c_rd_prim_acc_udp_port = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 4), integer32()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdPrimAccUdpPort.setStatus('current') if mibBuilder.loadTexts: hh3cRdPrimAccUdpPort.setDescription('The UDP port the client is using to send requests to primary RADIUS accounting server. Default value is 1813.') hh3c_rd_prim_acc_state = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('active', 1), ('block', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdPrimAccState.setStatus('current') if mibBuilder.loadTexts: hh3cRdPrimAccState.setDescription('The state of the primary RADIUS accounting server. 1 (active) The primary accounting server is in active state. 2 (block) The primary accounting server is in block state.') hh3c_rd_sec_acc_ip_addr_type = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 6), inet_address_type()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdSecAccIpAddrType.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecAccIpAddrType.setDescription('The IP addresses type (IPv4 or IPv6) of secondary RADIUS accounting server.') hh3c_rd_sec_acc_ip_addr = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 7), inet_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdSecAccIpAddr.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecAccIpAddr.setDescription('The IP address of secondary RADIUS accounting server.') hh3c_rd_sec_acc_udp_port = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 8), integer32()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdSecAccUdpPort.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecAccUdpPort.setDescription('The UDP port the client is using to send requests to secondary RADIUS accounting server. Default value is 1813.') hh3c_rd_sec_acc_state = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('active', 1), ('block', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdSecAccState.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecAccState.setDescription('The state of the secondary RADIUS accounting server. 1 (active) The secondary accounting server is in active state. 2 (block) The secondary accounting server is in block state.') hh3c_rd_acc_key = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 10), display_string().subtype(subtypeSpec=value_size_constraint(0, 64))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdAccKey.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccKey.setDescription('The secret shared between the RADIUS client and RADIUS accounting server used in encoding and decoding sensitive data. When read, hh3cRdAccKey always returns an Octet String of length zero.') hh3c_rd_acc_retry = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 11), integer32()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdAccRetry.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccRetry.setDescription('The number of attempt the client will make when trying to send requests to a server before it will consider the attempt failed. Default value is 3.') hh3c_rd_acc_timeout = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 12), integer32()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdAccTimeout.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccTimeout.setDescription('The timeout value the client will use when sending requests to a server. The unit is second. Default value is 3.') hh3c_rd_acc_server_type = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 13), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('standard', 1), ('iphotel', 2), ('portal', 3), ('extended', 4)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdAccServerType.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccServerType.setDescription('Specify the type of RADIUS server. 1 (standard) - Server based on RFC protocol(s). 2 (iphotel) - Server for IP-Hotel or 201+ system. 3 (portal) - Server for iTellin Portal system. 4 (extended) - Server based on RADIUS extensions. Default type is standard.') hh3c_rd_acc_quiet_time = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 14), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdAccQuietTime.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccQuietTime.setDescription('The time for server returning active. The unit is minute. When the value is 0, the server state retains active. Default value is 5.') hh3c_rd_acc_failure_action = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 15), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('ignore', 1), ('reject', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdAccFailureAction.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccFailureAction.setDescription('Defines the action that authentication should take if authentication succeeds but the associated accounting start fails. 1 (ignore) - treat as authentication success; ignore accounting start failure. 2 (reject) - treat as authentication failed if corresponding accounting start fails. Default value is 1(reject).') hh3c_rd_acc_real_time = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 16), integer32().subtype(subtypeSpec=value_range_constraint(0, 60))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdAccRealTime.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccRealTime.setDescription("Interval of realtime-accounting packets. The unit is minute. When the value is 0, the device doesn't send realtime-accounting packets. Default value is 12.") hh3c_rd_acc_real_time_retry = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 17), integer32().subtype(subtypeSpec=value_range_constraint(1, 255)).clone(5)).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdAccRealTimeRetry.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccRealTimeRetry.setDescription('The number of attempt the client will make when trying to send realtime-accounting packet to accounting server before it will consider the attempt failed. Default value is 5.') hh3c_rd_acc_save_stop_pkt_enable = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 18), truth_value()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdAccSaveStopPktEnable.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccSaveStopPktEnable.setDescription("The control of whether save stop-accounting packet in local buffer and resend later when the accounting server doesn't respond. When SaveStopPktEnable is set to false, the value of AccStopRetry will be ignored. Default value is true.") hh3c_rd_acc_stop_retry = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 19), integer32().subtype(subtypeSpec=value_range_constraint(10, 65535))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdAccStopRetry.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccStopRetry.setDescription('The number of attempt the client will make when trying to send stop-accounting packet to accounting server. Default value is 500.') hh3c_rd_acc_data_flow_unit = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 20), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('byte', 1), ('kiloByte', 2), ('megaByte', 3), ('gigaByte', 4)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdAccDataFlowUnit.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccDataFlowUnit.setDescription("Specify data flow format that is sent to RADIUS server. The value SHOULD be set the same as the value of corresponding server. 1 (byte) - Specify 'byte' as the unit of data flow. 2 (kiloByte) - Specify 'kilo-byte' as the unit of data flow. 3 (megaByte) - Specify 'mega-byte' as the unit of data flow. 4 (gigaByte) - Specify 'giga-byte' as the unit of data flow. Default value is 1.") hh3c_rd_acc_packet_unit = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 21), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('onePacket', 1), ('kiloPacket', 2), ('megaPacket', 3), ('gigaPacket', 4)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdAccPacketUnit.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccPacketUnit.setDescription("Specify packet format that is sent to RADIUS server. The value SHOULD be set the same as the value of corresponding server. 1 (onePacket) - Specify 'one-packet' as the unit of packet. 2 (kiloPacket) - Specify 'kilo-packet' as the unit of packet. 3 (megaPacket) - Specify 'mega-packet' as the unit of packet. 4 (gigaPacket) - Specify 'giga-packet' as the unit of packet. Default value is 1.") hh3c_rd_acc_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 22), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdAccRowStatus.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccRowStatus.setDescription('This object is responsible for managing the creation, deletion and modification of rows, which support active status and CreateAndGo, Destroy operation. To create a new row, hh3cRdAccGroupName must be specified. To destroy an existent row, the hh3cRdAccGroupName MUST NOT be referred by hh3cDomainTable in hh3cDomainRadiusGroupName column.') hh3c_rd_acct_on_enable = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 23), truth_value()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdAcctOnEnable.setStatus('current') if mibBuilder.loadTexts: hh3cRdAcctOnEnable.setDescription('The control of Accounting-On function. The Accounting-On function is used by the client to mark the start of accounting (for example, upon booting) by sending Accounting-On packets and to mark the end of accounting (for example, just before a scheduled reboot) by sending Accounting-Off packets. Default value is false.') hh3c_rd_acct_on_send_times = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 24), integer32().clone(50)).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdAcctOnSendTimes.setStatus('current') if mibBuilder.loadTexts: hh3cRdAcctOnSendTimes.setDescription('The number of Accounting-On packets the client will send before it considers the accounting server failed. Default value is 50.') hh3c_rd_acct_on_send_interval = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 25), integer32().clone(3)).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdAcctOnSendInterval.setStatus('current') if mibBuilder.loadTexts: hh3cRdAcctOnSendInterval.setDescription('Interval of Accounting-On packets. The unit is second. Default value is 3.') hh3c_rd_sec_acc_key = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 26), display_string().subtype(subtypeSpec=value_size_constraint(0, 64))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdSecAccKey.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecAccKey.setDescription('The secret shared between the RADIUS client and the secondary RADIUS accounting server used in encoding and decoding sensitive data. When read, hh3cRdSecAccKey always returns an Octet String of length zero.') hh3c_rd_prim_acc_vpn_name = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 27), display_string().subtype(subtypeSpec=value_size_constraint(0, 31))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdPrimAccVpnName.setStatus('current') if mibBuilder.loadTexts: hh3cRdPrimAccVpnName.setDescription('The human-readable name of the VPN in which the primary RADIUS accounting server is placed.') hh3c_rd_sec_acc_vpn_name = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 28), display_string().subtype(subtypeSpec=value_size_constraint(0, 31))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdSecAccVpnName.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecAccVpnName.setDescription('The human-readable name of the VPN in which the secondary RADIUS accounting server is placed.') hh3c_rd_acc_nas_ip_addr_type = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 29), inet_address_type()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdAccNasIpAddrType.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccNasIpAddrType.setDescription('The type (IPv4 or IPv6) of the source IP used to communicate with RADIUS accounting server.') hh3c_rd_acc_nas_ip_addr = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 30), ip_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdAccNasIpAddr.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccNasIpAddr.setDescription('The source IPv4 address used to communicate with the RADIUS accounting server.') hh3c_rd_acc_nas_ipv6_addr = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 2, 1, 31), ipv6_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdAccNasIpv6Addr.setStatus('current') if mibBuilder.loadTexts: hh3cRdAccNasIpv6Addr.setDescription('The source IPv6 address used to communicate with the RADIUS accounting server.') hh3c_radius_global_config = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 3)) hh3c_radius_auth_err_threshold = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 3, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 100)).clone(30)).setUnits('percentage').setMaxAccess('readwrite') if mibBuilder.loadTexts: hh3cRadiusAuthErrThreshold.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAuthErrThreshold.setDescription('The threshold of authentication failure trap. A trap will be sent when the percent of the unsuccessful authentication exceeds this threshold.') hh3c_rd_secondary_auth_server_table = mib_table((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4)) if mibBuilder.loadTexts: hh3cRdSecondaryAuthServerTable.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAuthServerTable.setDescription('The (conceptual) table listing RADIUS secondary authentication servers.') hh3c_rd_secondary_auth_server_entry = mib_table_row((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4, 1)).setIndexNames((0, 'HH3C-RADIUS-MIB', 'hh3cRdGroupName'), (0, 'HH3C-RADIUS-MIB', 'hh3cRdSecondaryAuthIpAddrType'), (0, 'HH3C-RADIUS-MIB', 'hh3cRdSecondaryAuthIpAddr'), (0, 'HH3C-RADIUS-MIB', 'hh3cRdSecondaryAuthVpnName'), (0, 'HH3C-RADIUS-MIB', 'hh3cRdSecondaryAuthUdpPort')) if mibBuilder.loadTexts: hh3cRdSecondaryAuthServerEntry.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAuthServerEntry.setDescription('An entry (conceptual row) representing a RADIUS secondary authentication server.') hh3c_rd_secondary_auth_ip_addr_type = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4, 1, 1), inet_address_type()) if mibBuilder.loadTexts: hh3cRdSecondaryAuthIpAddrType.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAuthIpAddrType.setDescription('The IP addresses type (IPv4 or IPv6) of secondary RADIUS authentication server.') hh3c_rd_secondary_auth_ip_addr = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4, 1, 2), inet_address()) if mibBuilder.loadTexts: hh3cRdSecondaryAuthIpAddr.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAuthIpAddr.setDescription('The IP address of secondary RADIUS authentication server.') hh3c_rd_secondary_auth_vpn_name = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4, 1, 3), display_string().subtype(subtypeSpec=value_size_constraint(0, 31))) if mibBuilder.loadTexts: hh3cRdSecondaryAuthVpnName.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAuthVpnName.setDescription('The human-readable name of the VPN in which the secondary RADIUS authentication server is placed.') hh3c_rd_secondary_auth_udp_port = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))) if mibBuilder.loadTexts: hh3cRdSecondaryAuthUdpPort.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAuthUdpPort.setDescription('The UDP port the client is using to send requests to secondary RADIUS authentication server. Default value is 1812.') hh3c_rd_secondary_auth_state = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('active', 1), ('block', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdSecondaryAuthState.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAuthState.setDescription('The state of the secondary RADIUS authentication server. 1 (active) The secondary authentication server is in active state. 2 (block) The secondary authentication server is in block state.') hh3c_rd_secondary_auth_key = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4, 1, 6), display_string().subtype(subtypeSpec=value_size_constraint(0, 64))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdSecondaryAuthKey.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAuthKey.setDescription('The secret shared between the RADIUS client and the secondary RADIUS authentication server used in encoding and decoding sensitive data. When read, hh3cRdSecondaryAuthKey always returns an Octet String of length zero.') hh3c_rd_secondary_auth_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 4, 1, 7), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdSecondaryAuthRowStatus.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAuthRowStatus.setDescription("This object is responsible for managing the creation, deletion and modification of rows, which support active status and CreateAndGo, Destroy operation. To create a new row, hh3cRdGroupName must be specified. The number of rows with the same hh3cRdGroupName can't be more than 16.") hh3c_rd_secondary_acc_server_table = mib_table((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5)) if mibBuilder.loadTexts: hh3cRdSecondaryAccServerTable.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAccServerTable.setDescription('The (conceptual) table listing RADIUS secondary accounting servers.') hh3c_rd_secondary_acc_server_entry = mib_table_row((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5, 1)).setIndexNames((0, 'HH3C-RADIUS-MIB', 'hh3cRdAccGroupName'), (0, 'HH3C-RADIUS-MIB', 'hh3cRdSecondaryAccIpAddrType'), (0, 'HH3C-RADIUS-MIB', 'hh3cRdSecondaryAccIpAddr'), (0, 'HH3C-RADIUS-MIB', 'hh3cRdSecondaryAccVpnName'), (0, 'HH3C-RADIUS-MIB', 'hh3cRdSecondaryAccUdpPort')) if mibBuilder.loadTexts: hh3cRdSecondaryAccServerEntry.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAccServerEntry.setDescription('An entry (conceptual row) representing a RADIUS secondary accounting server.') hh3c_rd_secondary_acc_ip_addr_type = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5, 1, 1), inet_address_type()) if mibBuilder.loadTexts: hh3cRdSecondaryAccIpAddrType.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAccIpAddrType.setDescription('The IP addresses type (IPv4 or IPv6) of secondary RADIUS accounting server.') hh3c_rd_secondary_acc_ip_addr = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5, 1, 2), inet_address()) if mibBuilder.loadTexts: hh3cRdSecondaryAccIpAddr.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAccIpAddr.setDescription('The IP address of secondary RADIUS accounting server.') hh3c_rd_secondary_acc_vpn_name = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5, 1, 3), display_string().subtype(subtypeSpec=value_size_constraint(0, 31))) if mibBuilder.loadTexts: hh3cRdSecondaryAccVpnName.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAccVpnName.setDescription('The human-readable name of the VPN in which the secondary RADIUS accounting server is placed.') hh3c_rd_secondary_acc_udp_port = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))) if mibBuilder.loadTexts: hh3cRdSecondaryAccUdpPort.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAccUdpPort.setDescription('The UDP port the client is using to send requests to secondary RADIUS accounting server. Default value is 1813.') hh3c_rd_secondary_acc_state = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('active', 1), ('block', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdSecondaryAccState.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAccState.setDescription('The state of the secondary RADIUS accounting server. 1 (active) The secondary accounting server is in active state. 2 (block) The secondary accounting server is in block state.') hh3c_rd_secondary_acc_key = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5, 1, 6), display_string().subtype(subtypeSpec=value_size_constraint(0, 64))).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdSecondaryAccKey.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAccKey.setDescription('The secret shared between the RADIUS client and the secondary RADIUS accounting server used in encoding and decoding sensitive data. When read, hh3cRdSecondaryAccKey always returns an Octet String of length zero.') hh3c_rd_secondary_acc_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 1, 5, 1, 7), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRdSecondaryAccRowStatus.setStatus('current') if mibBuilder.loadTexts: hh3cRdSecondaryAccRowStatus.setDescription("This object is responsible for managing the creation, deletion and modification of rows, which support active status and CreateAndGo, Destroy operation. To create a new row, hh3cRdAccGroupName must be specified. The number of rows with the same hh3cRdAccGroupName can't be more than 16.") hh3c_radius_accounting = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2)) hh3c_radius_acc_client = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1)) hh3c_radius_acc_server_table = mib_table((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1, 1)) if mibBuilder.loadTexts: hh3cRadiusAccServerTable.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAccServerTable.setDescription('The (conceptual) table listing the RADIUS accounting servers with which the client shares a secret.') hh3c_radius_acc_server_entry = mib_table_row((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1, 1, 1)).setIndexNames((0, 'RADIUS-ACC-CLIENT-MIB', 'radiusAccServerIndex')) if mibBuilder.loadTexts: hh3cRadiusAccServerEntry.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAccServerEntry.setDescription('An entry (conceptual row) representing a RADIUS accounting server with which a client shares a secret.') hh3c_radius_acc_client_start_requests = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1, 1, 1, 1), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hh3cRadiusAccClientStartRequests.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAccClientStartRequests.setDescription('The number of RADIUS accounting start request sent to this server.') hh3c_radius_acc_client_start_responses = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1, 1, 1, 2), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hh3cRadiusAccClientStartResponses.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAccClientStartResponses.setDescription('The number of RADIUS accounting start response received from this server.') hh3c_radius_acc_client_interim_requests = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1, 1, 1, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hh3cRadiusAccClientInterimRequests.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAccClientInterimRequests.setDescription('The number of RADIUS interim accounting request sent to this server.') hh3c_radius_acc_client_interim_responses = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1, 1, 1, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hh3cRadiusAccClientInterimResponses.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAccClientInterimResponses.setDescription('The number of RADIUS interim accounting response received from this server.') hh3c_radius_acc_client_stop_requests = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1, 1, 1, 5), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hh3cRadiusAccClientStopRequests.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAccClientStopRequests.setDescription('The number of RADIUS stop accounting request sent to this RADIUS server.') hh3c_radius_acc_client_stop_responses = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 2, 1, 1, 1, 6), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hh3cRadiusAccClientStopResponses.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAccClientStopResponses.setDescription('The number of RADIUS stop accounting response received from this server.') hh3c_radius_server_trap = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 3)) hh3c_radius_auth_server_down_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 2, 13, 3, 1)).setObjects(('RADIUS-AUTH-CLIENT-MIB', 'radiusAuthServerAddress'), ('RADIUS-AUTH-CLIENT-MIB', 'radiusAuthClientServerPortNumber'), ('HH3C-RADIUS-MIB', 'hh3cRadiusServerFirstTrapTime')) if mibBuilder.loadTexts: hh3cRadiusAuthServerDownTrap.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAuthServerDownTrap.setDescription("This trap is generated when the authentication RADIUS server doesn't respond client's requests for specified times.") hh3c_radius_acc_server_down_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 2, 13, 3, 2)).setObjects(('RADIUS-ACC-CLIENT-MIB', 'radiusAccServerAddress'), ('RADIUS-ACC-CLIENT-MIB', 'radiusAccClientServerPortNumber'), ('HH3C-RADIUS-MIB', 'hh3cRadiusServerFirstTrapTime')) if mibBuilder.loadTexts: hh3cRadiusAccServerDownTrap.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAccServerDownTrap.setDescription("This trap is generated when the accounting RADIUS server doesn't respond client's requests for specified times.") hh3c_radius_server_trap_prefix = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 3, 0)) hh3c_radius_auth_server_up_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 2, 13, 3, 0, 1)).setObjects(('RADIUS-AUTH-CLIENT-MIB', 'radiusAuthServerAddress'), ('RADIUS-AUTH-CLIENT-MIB', 'radiusAuthClientServerPortNumber'), ('HH3C-RADIUS-MIB', 'hh3cRadiusServerFirstTrapTime')) if mibBuilder.loadTexts: hh3cRadiusAuthServerUpTrap.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAuthServerUpTrap.setDescription('This trap is generated when the device finds that the state of RADIUS authentication server becomes reachable from unreachable.') hh3c_radius_acc_server_up_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 2, 13, 3, 0, 2)).setObjects(('RADIUS-ACC-CLIENT-MIB', 'radiusAccServerAddress'), ('RADIUS-ACC-CLIENT-MIB', 'radiusAccClientServerPortNumber'), ('HH3C-RADIUS-MIB', 'hh3cRadiusServerFirstTrapTime')) if mibBuilder.loadTexts: hh3cRadiusAccServerUpTrap.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAccServerUpTrap.setDescription('This trap is generated when the device finds that the state of RADIUS accounting server becomes reachable from unreachable.') hh3c_radius_auth_err_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 2, 13, 3, 0, 3)).setObjects(('RADIUS-AUTH-CLIENT-MIB', 'radiusAuthServerAddress'), ('RADIUS-AUTH-CLIENT-MIB', 'radiusAuthClientServerPortNumber')) if mibBuilder.loadTexts: hh3cRadiusAuthErrTrap.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAuthErrTrap.setDescription('This trap is generated when the device finds that the percent of unsuccessful authentication exceeds a threshold, and the threshold is the value of node hh3cRadiusAuthErrThreshold.') hh3c_radius_authenticating = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 4)) hh3c_radius_auth_client = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 4, 1)) hh3c_radius_auth_server_table = mib_table((1, 3, 6, 1, 4, 1, 25506, 2, 13, 4, 1, 1)) if mibBuilder.loadTexts: hh3cRadiusAuthServerTable.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAuthServerTable.setDescription('The (conceptual) table listing the RADIUS authenticating servers with which the client shares a secret.') hh3c_radius_auth_server_entry = mib_table_row((1, 3, 6, 1, 4, 1, 25506, 2, 13, 4, 1, 1, 1)).setIndexNames((0, 'RADIUS-AUTH-CLIENT-MIB', 'radiusAuthServerIndex')) if mibBuilder.loadTexts: hh3cRadiusAuthServerEntry.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAuthServerEntry.setDescription('An entry (conceptual row) representing a RADIUS authenticating server with which a client shares a secret.') hh3c_radius_auth_failure_times = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 4, 1, 1, 1, 1), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hh3cRadiusAuthFailureTimes.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAuthFailureTimes.setDescription('The number of RADIUS authenticating failed to this server.') hh3c_radius_auth_timeout_times = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 4, 1, 1, 1, 2), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hh3cRadiusAuthTimeoutTimes.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAuthTimeoutTimes.setDescription('The number of RADIUS authenticating timeout to this server.') hh3c_radius_auth_reject_times = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 4, 1, 1, 1, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hh3cRadiusAuthRejectTimes.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusAuthRejectTimes.setDescription('The number of RADIUS authenticating rejected to this server.') hh3c_radius_extend = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5)) hh3c_radius_extend_objects = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 1)) hh3c_radius_extend_tables = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2)) hh3c_radius_extend_traps = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 3)) hh3c_radius_sch_auth_table = mib_table((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1)) if mibBuilder.loadTexts: hh3cRadiusSchAuthTable.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAuthTable.setDescription('The (conceptual) table listing RADIUS authentication servers.') hh3c_radius_sch_auth_entry = mib_table_row((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1)).setIndexNames((0, 'HH3C-RADIUS-MIB', 'hh3cRadiusSchAuthGroupName')) if mibBuilder.loadTexts: hh3cRadiusSchAuthEntry.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAuthEntry.setDescription('An entry (conceptual row) representing RADIUS authentication servers.') hh3c_radius_sch_auth_group_name = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1, 1), display_string()) if mibBuilder.loadTexts: hh3cRadiusSchAuthGroupName.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAuthGroupName.setDescription('The name of the RADIUS authentication server group referred to in this table entry.') hh3c_radius_sch_auth_prim_ip_addr = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1, 2), ip_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRadiusSchAuthPrimIpAddr.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAuthPrimIpAddr.setDescription('The IP address of primary RADIUS authenticaiton server.') hh3c_radius_sch_auth_prim_udp_port = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1, 3), integer32().clone(1812)).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRadiusSchAuthPrimUdpPort.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAuthPrimUdpPort.setDescription('The UDP port the client is using to send requests to primary RADIUS authentication server. Default value is 1812.') hh3c_radius_sch_auth_prim_key = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1, 4), display_string()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRadiusSchAuthPrimKey.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAuthPrimKey.setDescription('The secret shared between the RADIUS client and the primary RADIUS authentication server used in encoding and decoding sensitive data.') hh3c_radius_sch_auth_sec_ip_addr = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1, 5), ip_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRadiusSchAuthSecIpAddr.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAuthSecIpAddr.setDescription('The IP address of secondary RADIUS authenticaiton server.') hh3c_radius_sch_auth_sec_udp_port = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1, 6), integer32().clone(1812)).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRadiusSchAuthSecUdpPort.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAuthSecUdpPort.setDescription('The UDP port the client is using to send requests to secondary RADIUS authentication server. Default value is 1812.') hh3c_radius_sch_auth_sec_key = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1, 7), display_string()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRadiusSchAuthSecKey.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAuthSecKey.setDescription('The secret shared between the RADIUS client and the secondary RADIUS authentication server used in encoding and decoding sensitive data.') hh3c_radius_sch_auth_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 1, 1, 8), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRadiusSchAuthRowStatus.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAuthRowStatus.setDescription('This object is responsible for managing the creation, deletion and modification of rows, which support active status and CreateAndGo, Destroy operation. To create a new row, hh3cRadiusSchAuthGroupName must be specified, and this action will create a corresponding domain that hh3cDomainRadiusGroupName is the same as hh3cRadiusSchAuthGroupName. To destroy an existent row, the hh3cRadiusSchAuthGroupName MUST NOT be referred by hh3cDomainTable in hh3cDomainRadiusGroupName column.') hh3c_radius_sch_acc_table = mib_table((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2)) if mibBuilder.loadTexts: hh3cRadiusSchAccTable.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAccTable.setDescription('The (conceptual) table listing RADIUS accounting servers.') hh3c_radius_sch_acc_entry = mib_table_row((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1)).setIndexNames((0, 'HH3C-RADIUS-MIB', 'hh3cRadiusSchAccGroupName')) if mibBuilder.loadTexts: hh3cRadiusSchAccEntry.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAccEntry.setDescription('An entry (conceptual row) representing RADIUS accounting servers.') hh3c_radius_sch_acc_group_name = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1, 1), display_string()) if mibBuilder.loadTexts: hh3cRadiusSchAccGroupName.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAccGroupName.setDescription('The name of the RADIUS accounting server group referred to in this table entry.') hh3c_radius_sch_acc_prim_ip_addr = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1, 2), ip_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRadiusSchAccPrimIpAddr.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAccPrimIpAddr.setDescription('The IP address of primary RADIUS accounting server.') hh3c_radius_sch_acc_prim_udp_port = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1, 3), integer32().clone(1813)).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRadiusSchAccPrimUdpPort.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAccPrimUdpPort.setDescription('The UDP port the client is using to send requests to primary RADIUS accounting server. Default value is 1813.') hh3c_radius_sch_acc_prim_key = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1, 4), display_string()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRadiusSchAccPrimKey.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAccPrimKey.setDescription('The secret shared between the RADIUS client and the primary RADIUS accounting server used in encoding and decoding sensitive data.') hh3c_radius_sch_acc_sec_ip_addr = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1, 5), ip_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRadiusSchAccSecIpAddr.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAccSecIpAddr.setDescription('The IP address of secondary RADIUS accounting server.') hh3c_radius_sch_acc_sec_udp_port = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1, 6), integer32().clone(1813)).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRadiusSchAccSecUdpPort.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAccSecUdpPort.setDescription('The UDP port the client is using to send requests to secondary RADIUS accounting server. Default value is 1813.') hh3c_radius_sch_acc_sec_key = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1, 7), display_string()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRadiusSchAccSecKey.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAccSecKey.setDescription('The secret shared between the RADIUS client and the secondary RADIUS accounting server used in encoding and decoding sensitive data.') hh3c_radius_sch_acc_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 13, 5, 2, 2, 1, 8), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hh3cRadiusSchAccRowStatus.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusSchAccRowStatus.setDescription('This object is responsible for managing the creation, deletion and modification of rows, which support active status and CreateAndGo, Destroy operation. To create a new row, hh3cRadiusSchAccGroupName must be specified, and this action will create a corresponding domain that hh3cDomainRadiusGroupName is the same as hh3cRadiusSchAccGroupName. To destroy an existent row, the hh3cRadiusSchAccGroupName MUST NOT be referred by hh3cDomainTable in hh3cDomainRadiusGroupName column.') hh3c_radius_statistic = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 6)) hh3c_radius_stat_acc_req = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 2, 13, 6, 1), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: hh3cRadiusStatAccReq.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusStatAccReq.setDescription('It shows the number of radius account request to the radius server.') hh3c_radius_stat_acc_ack = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 2, 13, 6, 2), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: hh3cRadiusStatAccAck.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusStatAccAck.setDescription('It shows the number of radius account response from the radius server.') hh3c_radius_stat_logout_req = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 2, 13, 6, 3), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: hh3cRadiusStatLogoutReq.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusStatLogoutReq.setDescription('It shows the number of logout request to the radius server.') hh3c_radius_stat_logout_ack = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 2, 13, 6, 4), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: hh3cRadiusStatLogoutAck.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusStatLogoutAck.setDescription('It shows the number of logout response from the radius server.') hh3c_radius_server_trap_var_objects = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 2, 13, 7)) hh3c_radius_server_first_trap_time = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 2, 13, 7, 1), time_ticks()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cRadiusServerFirstTrapTime.setStatus('current') if mibBuilder.loadTexts: hh3cRadiusServerFirstTrapTime.setDescription('Represents the first trap time.') mibBuilder.exportSymbols('HH3C-RADIUS-MIB', hh3cRdSecondaryAccState=hh3cRdSecondaryAccState, hh3cRdSecAccUdpPort=hh3cRdSecAccUdpPort, hh3cRdSecondaryAccKey=hh3cRdSecondaryAccKey, hh3cRadiusSchAccSecUdpPort=hh3cRadiusSchAccSecUdpPort, hh3cRdSecondaryAuthIpAddr=hh3cRdSecondaryAuthIpAddr, hh3cRdSecondaryAuthVpnName=hh3cRdSecondaryAuthVpnName, hh3cRdAuthNasIpAddrType=hh3cRdAuthNasIpAddrType, hh3cRadiusExtendTraps=hh3cRadiusExtendTraps, hh3cRadiusSchAuthGroupName=hh3cRadiusSchAuthGroupName, hh3cRadiusGlobalConfig=hh3cRadiusGlobalConfig, hh3cRdSecondaryAuthKey=hh3cRdSecondaryAuthKey, hh3cRadiusAccClientInterimResponses=hh3cRadiusAccClientInterimResponses, hh3cRadiusStatAccAck=hh3cRadiusStatAccAck, hh3cRdKey=hh3cRdKey, hh3cRdSecAuthIpAddrType=hh3cRdSecAuthIpAddrType, hh3cRdAccRetry=hh3cRdAccRetry, hh3cRadiusSchAuthSecKey=hh3cRadiusSchAuthSecKey, hh3cRdUserNameFormat=hh3cRdUserNameFormat, hh3cRdAccServerType=hh3cRdAccServerType, hh3cRdAcctOnSendTimes=hh3cRdAcctOnSendTimes, hh3cRadiusSchAccGroupName=hh3cRadiusSchAccGroupName, hh3cRadiusServerFirstTrapTime=hh3cRadiusServerFirstTrapTime, hh3cRdAuthNasIpAddr=hh3cRdAuthNasIpAddr, hh3cRdRowStatus=hh3cRdRowStatus, hh3cRadiusAuthServerDownTrap=hh3cRadiusAuthServerDownTrap, hh3cRdAccNasIpv6Addr=hh3cRdAccNasIpv6Addr, hh3cRdRetry=hh3cRdRetry, hh3cRadiusAccounting=hh3cRadiusAccounting, hh3cRadiusServerTrap=hh3cRadiusServerTrap, hh3cRdAccQuietTime=hh3cRdAccQuietTime, hh3cRadiusAccServerEntry=hh3cRadiusAccServerEntry, hh3cRdAccInfoEntry=hh3cRdAccInfoEntry, hh3cRdAccPacketUnit=hh3cRdAccPacketUnit, hh3cRadiusAuthServerUpTrap=hh3cRadiusAuthServerUpTrap, hh3cRadiusSchAuthEntry=hh3cRadiusSchAuthEntry, hh3cRadiusServerTrapVarObjects=hh3cRadiusServerTrapVarObjects, hh3cRadiusStatLogoutAck=hh3cRadiusStatLogoutAck, hh3cRdPrimAuthIpAddr=hh3cRdPrimAuthIpAddr, hh3cRadiusAccServerDownTrap=hh3cRadiusAccServerDownTrap, hh3cRdPrimState=hh3cRdPrimState, hh3cRadiusExtendObjects=hh3cRadiusExtendObjects, hh3cRdGroupName=hh3cRdGroupName, hh3cRdPrimAccIpAddr=hh3cRdPrimAccIpAddr, hh3cRadiusSchAccEntry=hh3cRadiusSchAccEntry, hh3cRadiusSchAccSecKey=hh3cRadiusSchAccSecKey, hh3cRdAccStopRetry=hh3cRdAccStopRetry, hh3cRdServerType=hh3cRdServerType, hh3cRadiusSchAuthPrimUdpPort=hh3cRadiusSchAuthPrimUdpPort, hh3cRdInfoEntry=hh3cRdInfoEntry, PYSNMP_MODULE_ID=hh3cRadius, hh3cRadiusAuthServerEntry=hh3cRadiusAuthServerEntry, hh3cRadiusSchAuthSecUdpPort=hh3cRadiusSchAuthSecUdpPort, hh3cRdSecUdpPort=hh3cRdSecUdpPort, hh3cRdAccDataFlowUnit=hh3cRdAccDataFlowUnit, hh3cRdPrimAccVpnName=hh3cRdPrimAccVpnName, hh3cRdSecAccVpnName=hh3cRdSecAccVpnName, hh3cRdSecondaryAccVpnName=hh3cRdSecondaryAccVpnName, hh3cRadiusAuthTimeoutTimes=hh3cRadiusAuthTimeoutTimes, hh3cRdAccFailureAction=hh3cRdAccFailureAction, hh3cRdQuietTime=hh3cRdQuietTime, hh3cRdAccGroupName=hh3cRdAccGroupName, hh3cRadiusAccClient=hh3cRadiusAccClient, hh3cRadiusSchAccSecIpAddr=hh3cRadiusSchAccSecIpAddr, hh3cRdSecondaryAuthServerEntry=hh3cRdSecondaryAuthServerEntry, hh3cRdObjects=hh3cRdObjects, hh3cRdAccRowStatus=hh3cRdAccRowStatus, hh3cRdSecondaryAccUdpPort=hh3cRdSecondaryAccUdpPort, hh3cRdSecondaryAccRowStatus=hh3cRdSecondaryAccRowStatus, hh3cRdSecondaryAuthUdpPort=hh3cRdSecondaryAuthUdpPort, hh3cRdSecAuthIp=hh3cRdSecAuthIp, hh3cRadiusSchAccPrimIpAddr=hh3cRadiusSchAccPrimIpAddr, hh3cRadiusExtendTables=hh3cRadiusExtendTables, hh3cRadiusStatAccReq=hh3cRadiusStatAccReq, hh3cRdSecondaryAuthServerTable=hh3cRdSecondaryAuthServerTable, hh3cRadiusSchAuthPrimKey=hh3cRadiusSchAuthPrimKey, hh3cRadiusAccClientStartResponses=hh3cRadiusAccClientStartResponses, hh3cRdSecondaryAccServerEntry=hh3cRdSecondaryAccServerEntry, hh3cRadiusAccServerUpTrap=hh3cRadiusAccServerUpTrap, hh3cRadiusAccClientInterimRequests=hh3cRadiusAccClientInterimRequests, hh3cRdAccRealTimeRetry=hh3cRdAccRealTimeRetry, hh3cRdSecAccIpAddr=hh3cRdSecAccIpAddr, hh3cRdPrimAccState=hh3cRdPrimAccState, hh3cRdInfoTable=hh3cRdInfoTable, hh3cRdPrimAuthIpAddrType=hh3cRdPrimAuthIpAddrType, hh3cRdSecAccState=hh3cRdSecAccState, hh3cRadiusAuthFailureTimes=hh3cRadiusAuthFailureTimes, hh3cRdSecAccKey=hh3cRdSecAccKey, hh3cRadiusAuthErrTrap=hh3cRadiusAuthErrTrap, hh3cRdSecondaryAccIpAddrType=hh3cRdSecondaryAccIpAddrType, hh3cRadiusAccClientStartRequests=hh3cRadiusAccClientStartRequests, hh3cRadiusAuthErrThreshold=hh3cRadiusAuthErrThreshold, hh3cRdPrimAuthIp=hh3cRdPrimAuthIp, hh3cRadiusSchAuthSecIpAddr=hh3cRadiusSchAuthSecIpAddr, hh3cRadiusStatistic=hh3cRadiusStatistic, hh3cRadiusAuthRejectTimes=hh3cRadiusAuthRejectTimes, hh3cRadiusSchAccRowStatus=hh3cRadiusSchAccRowStatus, hh3cRdSecondaryAuthRowStatus=hh3cRdSecondaryAuthRowStatus, hh3cRadiusSchAccPrimKey=hh3cRadiusSchAccPrimKey, hh3cRdSecKey=hh3cRdSecKey, hh3cRdPrimAccIpAddrType=hh3cRdPrimAccIpAddrType, hh3cRdPrimVpnName=hh3cRdPrimVpnName, hh3cRdTimeout=hh3cRdTimeout, hh3cRdAcctOnSendInterval=hh3cRdAcctOnSendInterval, hh3cRdPrimAccUdpPort=hh3cRdPrimAccUdpPort, hh3cRadiusAuthServerTable=hh3cRadiusAuthServerTable, hh3cRadius=hh3cRadius, hh3cRadiusExtend=hh3cRadiusExtend, hh3cRdAccKey=hh3cRdAccKey, hh3cRdSecVpnName=hh3cRdSecVpnName, hh3cRadiusSchAuthRowStatus=hh3cRadiusSchAuthRowStatus, hh3cRadiusServerTrapPrefix=hh3cRadiusServerTrapPrefix, hh3cRadiusSchAuthPrimIpAddr=hh3cRadiusSchAuthPrimIpAddr, hh3cRadiusAccClientStopRequests=hh3cRadiusAccClientStopRequests, hh3cRdAccInfoTable=hh3cRdAccInfoTable, hh3cRdSecondaryAccIpAddr=hh3cRdSecondaryAccIpAddr, hh3cRadiusAuthenticating=hh3cRadiusAuthenticating, hh3cRadiusSchAuthTable=hh3cRadiusSchAuthTable, hh3cRdAccTimeout=hh3cRdAccTimeout, hh3cRadiusAccClientStopResponses=hh3cRadiusAccClientStopResponses, hh3cRdAuthNasIpv6Addr=hh3cRdAuthNasIpv6Addr, hh3cRdAccSaveStopPktEnable=hh3cRdAccSaveStopPktEnable, hh3cRadiusAuthClient=hh3cRadiusAuthClient, hh3cRdPrimUdpPort=hh3cRdPrimUdpPort, hh3cRdSecAccIpAddrType=hh3cRdSecAccIpAddrType, hh3cRdSecondaryAccServerTable=hh3cRdSecondaryAccServerTable, hh3cRadiusSchAccPrimUdpPort=hh3cRadiusSchAccPrimUdpPort, hh3cRdSecAuthIpAddr=hh3cRdSecAuthIpAddr, hh3cRdAccRealTime=hh3cRdAccRealTime, hh3cRadiusAccServerTable=hh3cRadiusAccServerTable, hh3cRdSecondaryAuthState=hh3cRdSecondaryAuthState, hh3cRadiusSchAccTable=hh3cRadiusSchAccTable, hh3cRdSecondaryAuthIpAddrType=hh3cRdSecondaryAuthIpAddrType, hh3cRdAcctOnEnable=hh3cRdAcctOnEnable, hh3cRadiusStatLogoutReq=hh3cRadiusStatLogoutReq, hh3cRdSecState=hh3cRdSecState, hh3cRdAccNasIpAddrType=hh3cRdAccNasIpAddrType, hh3cRdAccNasIpAddr=hh3cRdAccNasIpAddr)
#!/usr/bin/env python3 # python3 program of subtraction of # two numbers using 2's complement . # function to subtract two values # using 2's complement method def Subtract(a, b): # ~b is the 1's Complement of b # adding 1 to it make it 2's Complement c = a + (~b + 1) return c # Driver code if __name__ == "__main__": # multiple assignments a, b = 56, 22 print(Subtract(a, b)) # a, b = 9, 7 # print(Subtract(a, b))
def subtract(a, b): c = a + (~b + 1) return c if __name__ == '__main__': (a, b) = (56, 22) print(subtract(a, b))