content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Solution:
def rotate(self, matrix: List[List[int]]) -> None:
"""
Do not return anything, modify matrix in-place instead.
"""
top = left = 0
right = bottom = len(matrix) - 1
while top < bottom:
for i in range(bottom - top):
temp = matrix[top][left+i]
matrix[top][left+i] = matrix[bottom-i][left]
matrix[bottom-i][left] = matrix[bottom][right-i]
matrix[bottom][right-i] = matrix[top+i][right]
matrix[top+i][right] = temp
top += 1
bottom -= 1
left += 1
right -= 1 | class Solution:
def rotate(self, matrix: List[List[int]]) -> None:
"""
Do not return anything, modify matrix in-place instead.
"""
top = left = 0
right = bottom = len(matrix) - 1
while top < bottom:
for i in range(bottom - top):
temp = matrix[top][left + i]
matrix[top][left + i] = matrix[bottom - i][left]
matrix[bottom - i][left] = matrix[bottom][right - i]
matrix[bottom][right - i] = matrix[top + i][right]
matrix[top + i][right] = temp
top += 1
bottom -= 1
left += 1
right -= 1 |
someone = input("Enter a famous name: ").strip().title()
place = input("Enter a place: ").strip().lower()
weekday = ""
while weekday not in ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"]:
weekday = input("Enter a weekday: ").strip().lower()
adjective = input("Enter an adjective: ").strip().lower()
print(f"{someone} cycled to the {place} on {weekday} morning with an unidentifiable, and therefore {adjective} emotion.") | someone = input('Enter a famous name: ').strip().title()
place = input('Enter a place: ').strip().lower()
weekday = ''
while weekday not in ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']:
weekday = input('Enter a weekday: ').strip().lower()
adjective = input('Enter an adjective: ').strip().lower()
print(f'{someone} cycled to the {place} on {weekday} morning with an unidentifiable, and therefore {adjective} emotion.') |
# Question: https://projecteuler.net/problem=73
# F(n) -> length of Farey Sequence (https://mathworld.wolfram.com/FareySequence.html)
N = 12000
# https://en.wikipedia.org/wiki/Farey_sequence#Next_term
# From 0/1 to end_n/end_d
def farey_sequence_length(end_n, end_d, n):
a, b, c, d = 0, 1, 1, n
ans = 1
while not (a == end_n and b == end_d):
x = (n + b) // d
a, b, c, d = c, d, x * c - a, x * d - b
ans = ans + 1
return ans
print(farey_sequence_length(1,2,12000)-farey_sequence_length(1,3,12000) - 1)
| n = 12000
def farey_sequence_length(end_n, end_d, n):
(a, b, c, d) = (0, 1, 1, n)
ans = 1
while not (a == end_n and b == end_d):
x = (n + b) // d
(a, b, c, d) = (c, d, x * c - a, x * d - b)
ans = ans + 1
return ans
print(farey_sequence_length(1, 2, 12000) - farey_sequence_length(1, 3, 12000) - 1) |
#
# PySNMP MIB module RDN-CMTS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RDN-CMTS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:46: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)
#
OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, ValueSizeConstraint, ConstraintsIntersection, SingleValueConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueSizeConstraint", "ConstraintsIntersection", "SingleValueConstraint", "ValueRangeConstraint")
docsIfCmtsCmStatusIpAddress, TenthdB, TenthdBmV, docsIfUpChannelId, docsIfCmtsCmStatusEntry, docsIfCmtsCmStatusMacAddress, docsIfCmtsCmStatusIndex, DocsisQosVersion, docsIfCmtsCmStatusDocsisRegMode, docsIfDownChannelId, DocsisUpstreamType = mibBuilder.importSymbols("DOCS-IF-MIB", "docsIfCmtsCmStatusIpAddress", "TenthdB", "TenthdBmV", "docsIfUpChannelId", "docsIfCmtsCmStatusEntry", "docsIfCmtsCmStatusMacAddress", "docsIfCmtsCmStatusIndex", "DocsisQosVersion", "docsIfCmtsCmStatusDocsisRegMode", "docsIfDownChannelId", "DocsisUpstreamType")
IfDirection, docsIf3CmtsCmRegStatusIPv6Addr = mibBuilder.importSymbols("DOCS-IF3-MIB", "IfDirection", "docsIf3CmtsCmRegStatusIPv6Addr")
docsQosServiceClassName, = mibBuilder.importSymbols("DOCS-QOS3-MIB", "docsQosServiceClassName")
IpV4orV6Addr, = mibBuilder.importSymbols("DOCS-SUBMGT-MIB", "IpV4orV6Addr")
ifAdminStatus, ifDescr, InterfaceIndexOrZero, InterfaceIndex, ifType, ifIndex, ifOperStatus = mibBuilder.importSymbols("IF-MIB", "ifAdminStatus", "ifDescr", "InterfaceIndexOrZero", "InterfaceIndex", "ifType", "ifIndex", "ifOperStatus")
InetAddressIPv6, InetAddress, InetAddressType, InetPortNumber = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddressIPv6", "InetAddress", "InetAddressType", "InetPortNumber")
rdnSpectrumGroupName, = mibBuilder.importSymbols("RDN-CABLE-SPECTRUM-GROUP-MIB", "rdnSpectrumGroupName")
riverdelta, = mibBuilder.importSymbols("RDN-MIB", "riverdelta")
rdnPktDQoSClassName, = mibBuilder.importSymbols("RDN-PKTCABLE-GROUP-MIB", "rdnPktDQoSClassName")
ModuleCompliance, ObjectGroup, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "ObjectGroup", "NotificationGroup")
Gauge32, MibIdentifier, NotificationType, Unsigned32, Counter32, TimeTicks, ObjectIdentity, Integer32, Counter64, Bits, ModuleIdentity, iso, IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "MibIdentifier", "NotificationType", "Unsigned32", "Counter32", "TimeTicks", "ObjectIdentity", "Integer32", "Counter64", "Bits", "ModuleIdentity", "iso", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn")
DisplayString, TimeInterval, MacAddress, RowStatus, TruthValue, TextualConvention, TimeStamp = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TimeInterval", "MacAddress", "RowStatus", "TruthValue", "TextualConvention", "TimeStamp")
rdnCmtsMib = ModuleIdentity((1, 3, 6, 1, 4, 1, 4981, 2))
rdnCmtsMib.setRevisions(('2011-03-08 00:00', '2011-02-23 00:00', '2009-11-20 00:00', '2008-08-08 00:00', '2007-06-21 00:00', '2006-05-25 00:00', '2006-05-24 00:00', '2006-04-17 00:00', '2006-01-25 00:00', '2006-01-23 00:00', '2006-01-13 00:00', '2005-03-18 00:00', '2005-02-22 00:00', '2004-08-17 00:00', '1904-04-14 00:00', '2003-12-16 00:00', '2003-11-05 00:00', '2003-11-03 00:00', '2003-07-20 00:00', '2003-05-01 00:00', '2000-04-03 00:00',))
if mibBuilder.loadTexts: rdnCmtsMib.setLastUpdated('201103080000Z')
if mibBuilder.loadTexts: rdnCmtsMib.setOrganization('Motorola')
rdnCmtsIfObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 4981, 2, 1))
rdnCmtsMiscObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 4981, 2, 2))
rdnCmtsDownstreamChannelTable = MibTable((1, 3, 6, 1, 4, 1, 4981, 2, 1, 1), )
if mibBuilder.loadTexts: rdnCmtsDownstreamChannelTable.setStatus('current')
rdnCmtsDownstreamChannelEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4981, 2, 1, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: rdnCmtsDownstreamChannelEntry.setStatus('current')
rdnCmtsDSModulation = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 1, 1, 1, 1), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnCmtsDSModulation.setStatus('current')
rdnCmtsUpstreamChannelTable = MibTable((1, 3, 6, 1, 4, 1, 4981, 2, 1, 2), )
if mibBuilder.loadTexts: rdnCmtsUpstreamChannelTable.setStatus('current')
rdnCmtsUpstreamChannelEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4981, 2, 1, 2, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: rdnCmtsUpstreamChannelEntry.setStatus('current')
rdnCmtsUSNominalRxPower = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-160, 290))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnCmtsUSNominalRxPower.setStatus('current')
rdnCmtsUSNominalRxPowerMode = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 1, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("default", 0), ("absolute", 1)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnCmtsUSNominalRxPowerMode.setStatus('current')
rdnCmtsUSInvitedRangingInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 1, 2, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 30000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnCmtsUSInvitedRangingInterval.setStatus('current')
rdnCmtsUSRangingResponseControl = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 1, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("normal", 0), ("override", 1)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnCmtsUSRangingResponseControl.setStatus('current')
rdnCmtsUSRangingPowerOverride = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 1, 2, 1, 5), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnCmtsUSRangingPowerOverride.setStatus('current')
rdnCmtsUSTotalModemCount = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 1, 2, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnCmtsUSTotalModemCount.setStatus('current')
rdnCmtsUSRegisteredModemCount = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 1, 2, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnCmtsUSRegisteredModemCount.setStatus('current')
rdnCmtsUSUnregisteredModemCount = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 1, 2, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnCmtsUSUnregisteredModemCount.setStatus('current')
rdnCmtsUSOfflineModemCount = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 1, 2, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnCmtsUSOfflineModemCount.setStatus('current')
rdnCmtsStpObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 4981, 2, 1, 3))
rdnCmtsStpEnable = MibScalar((1, 3, 6, 1, 4, 1, 4981, 2, 1, 3, 1), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnCmtsStpEnable.setStatus('current')
rdnCmtsStpTCNEnable = MibScalar((1, 3, 6, 1, 4, 1, 4981, 2, 1, 3, 2), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnCmtsStpTCNEnable.setStatus('current')
rdnCmtsLinkUpDownTrapEnableTable = MibTable((1, 3, 6, 1, 4, 1, 4981, 2, 1, 4), )
if mibBuilder.loadTexts: rdnCmtsLinkUpDownTrapEnableTable.setStatus('current')
rdnCmtsLinkUpDownTrapEnableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4981, 2, 1, 4, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: rdnCmtsLinkUpDownTrapEnableEntry.setStatus('current')
rdnCmtsLinkUpDownTrapEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 1, 4, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnCmtsLinkUpDownTrapEnable.setStatus('current')
rdnCmtsSaveConfig = MibScalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 1), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnCmtsSaveConfig.setStatus('current')
rdnCmtsCmResetByMacAddr = MibScalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 2), MacAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnCmtsCmResetByMacAddr.setStatus('current')
rdnCmtsCmResetByIpAddr = MibScalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 3), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnCmtsCmResetByIpAddr.setStatus('current')
rdnCmtsCmResetAll = MibScalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 4), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnCmtsCmResetAll.setStatus('current')
rdnCmtsHostAuthControl = MibScalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 5), OctetString().subtype(subtypeSpec=ValueSizeConstraint(17, 17)).setFixedLength(17)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnCmtsHostAuthControl.setStatus('obsolete')
rdnCmtsModemAgingTimer = MibScalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(10, 30240), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnCmtsModemAgingTimer.setStatus('current')
rdnCmtsCpeToCmObject = MibIdentifier((1, 3, 6, 1, 4, 1, 4981, 2, 2, 7))
rdnCmtsCpeToCmTable = MibTable((1, 3, 6, 1, 4, 1, 4981, 2, 2, 7, 1), )
if mibBuilder.loadTexts: rdnCmtsCpeToCmTable.setStatus('current')
rdnCmtsCpeToCmEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4981, 2, 2, 7, 1, 1), ).setIndexNames((0, "RDN-CMTS-MIB", "rdnCmtsCpeMac"))
if mibBuilder.loadTexts: rdnCmtsCpeToCmEntry.setStatus('current')
rdnCmtsCpeMac = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 7, 1, 1, 1), MacAddress())
if mibBuilder.loadTexts: rdnCmtsCpeMac.setStatus('current')
rdnCmtsCmMac = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 7, 1, 1, 2), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnCmtsCmMac.setStatus('current')
rdnIfCmtsCmStatusTable = MibTable((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8), )
if mibBuilder.loadTexts: rdnIfCmtsCmStatusTable.setStatus('current')
rdnIfCmtsCmStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1), )
docsIfCmtsCmStatusEntry.registerAugmentions(("RDN-CMTS-MIB", "rdnIfCmtsCmStatusEntry"))
rdnIfCmtsCmStatusEntry.setIndexNames(*docsIfCmtsCmStatusEntry.getIndexNames())
if mibBuilder.loadTexts: rdnIfCmtsCmStatusEntry.setStatus('current')
rdnIfCmtsCmStatusRegistrationTime = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsCmStatusRegistrationTime.setStatus('current')
rdnIfCmtsCmStatusTxUnicastKbytes = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsCmStatusTxUnicastKbytes.setStatus('current')
rdnIfCmtsCmStatusRxUnicastKbytes = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsCmStatusRxUnicastKbytes.setStatus('current')
rdnIfCmtsCmStatusTxUnicastExtKbytes = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 4), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsCmStatusTxUnicastExtKbytes.setStatus('current')
rdnIfCmtsCmStatusRxUnicastExtKbytes = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 5), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsCmStatusRxUnicastExtKbytes.setStatus('current')
rdnIfCmtsCmStatusSpectrumGroupName = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 6), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsCmStatusSpectrumGroupName.setStatus('current')
rdnIfCmtsCmStatusUpstreamPort = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsCmStatusUpstreamPort.setStatus('current')
rdnIfCmtsCmStatusDownStreamPort = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsCmStatusDownStreamPort.setStatus('current')
rdnIfCmtsCmStatusValue = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20))).clone(namedValues=NamedValues(("init-o", 1), ("init-t", 2), ("init-r1", 3), ("init-r2", 4), ("init-rc", 5), ("dhcp-d", 6), ("dhcp-o", 7), ("dhcp-req", 8), ("dhcp-ack", 9), ("online", 10), ("online-d", 11), ("online-un", 12), ("online-pk", 13), ("online-pt", 14), ("reject-m", 15), ("reject-c", 16), ("reject-r", 17), ("reject-pk", 18), ("reject-pt", 19), ("offline", 20)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsCmStatusValue.setStatus('current')
rdnIfCmtsCmStatusDSBondingGroupId = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsCmStatusDSBondingGroupId.setStatus('current')
rdnIfCmtsCmStatusOnlineTimes = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsCmStatusOnlineTimes.setStatus('current')
rdnIfCmtsCmStatusPercentOnline = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsCmStatusPercentOnline.setStatus('current')
rdnIfCmtsCmStatusMinOnlineTime = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 13), TimeInterval()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsCmStatusMinOnlineTime.setStatus('current')
rdnIfCmtsCmStatusAvgOnlineTime = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 14), TimeInterval()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsCmStatusAvgOnlineTime.setStatus('current')
rdnIfCmtsCmStatusMaxOnlineTime = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 15), TimeInterval()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsCmStatusMaxOnlineTime.setStatus('current')
rdnIfCmtsCmStatusMinOfflineTime = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 16), TimeInterval()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsCmStatusMinOfflineTime.setStatus('current')
rdnIfCmtsCmStatusAvgOfflineTime = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 17), TimeInterval()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsCmStatusAvgOfflineTime.setStatus('current')
rdnIfCmtsCmStatusMaxOfflineTime = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 18), TimeInterval()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsCmStatusMaxOfflineTime.setStatus('current')
rdnModemDeregReason = MibScalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23))).clone(namedValues=NamedValues(("normal", 1), ("operatorReset", 2), ("operatorDisabled", 3), ("operatorDeleted", 4), ("transmissionFailed", 5), ("transmissionDisabled", 6), ("transmissionDeleted", 7), ("servingGroupChanged", 8), ("receiverFailed", 9), ("receiverDisabled", 10), ("receiverDeleted", 11), ("channelDeleted", 12), ("channelErrors", 13), ("incompleteReg", 14), ("profileUpdateComplete", 15), ("skeyFailure", 16), ("dnChanChangeFailure", 17), ("noDeregReason", 18), ("powerTolerance", 19), ("freqTolerance", 20), ("timingTolerance", 21), ("rangingTolerance", 22), ("noResponseUCC", 23)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnModemDeregReason.setStatus('current')
rdnModemRegIndex = MibScalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 11), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnModemRegIndex.setStatus('current')
rdnCmToCpeTable = MibTable((1, 3, 6, 1, 4, 1, 4981, 2, 2, 12), )
if mibBuilder.loadTexts: rdnCmToCpeTable.setStatus('current')
rdnCmToCpeEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4981, 2, 2, 12, 1), ).setIndexNames((0, "DOCS-IF-MIB", "docsIfCmtsCmStatusIndex"), (0, "RDN-CMTS-MIB", "rdnCmToCpeIndex"))
if mibBuilder.loadTexts: rdnCmToCpeEntry.setStatus('current')
rdnCmToCpeIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 12, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647)))
if mibBuilder.loadTexts: rdnCmToCpeIndex.setStatus('current')
rdnCmToCpeMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 12, 1, 2), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnCmToCpeMacAddress.setStatus('current')
rdnCmToCpeIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 12, 1, 3), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnCmToCpeIpAddress.setStatus('current')
rdnCmToCpeIPv6Addr = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 12, 1, 4), InetAddressIPv6()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnCmToCpeIPv6Addr.setStatus('current')
rdnCmtsCmRegisteredTrapEnable = MibScalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('enabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnCmtsCmRegisteredTrapEnable.setStatus('current')
rdnCmtsCardType = MibScalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("domestic", 1), ("japan", 2))).clone('domestic')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnCmtsCardType.setStatus('current')
rdnRQueryCmtsCmStatusTable = MibTable((1, 3, 6, 1, 4, 1, 4981, 2, 2, 15), )
if mibBuilder.loadTexts: rdnRQueryCmtsCmStatusTable.setStatus('current')
rdnRQueryCmtsCmStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4981, 2, 2, 15, 1), ).setIndexNames((0, "DOCS-IF-MIB", "docsIfCmtsCmStatusIndex"))
if mibBuilder.loadTexts: rdnRQueryCmtsCmStatusEntry.setStatus('current')
rdnRQueryCmtsCmDownChannelPower = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 15, 1, 1), TenthdBmV()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnRQueryCmtsCmDownChannelPower.setStatus('current')
rdnRQueryCmStatusTxPower = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 15, 1, 2), TenthdBmV()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnRQueryCmStatusTxPower.setStatus('current')
rdnRQueryUpChannelTxTimingOffset = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 15, 1, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnRQueryUpChannelTxTimingOffset.setStatus('current')
rdnRQuerySigQSignalNoise = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 15, 1, 4), TenthdB()).setUnits('dB').setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnRQuerySigQSignalNoise.setStatus('current')
rdnRQuerySigQMicroreflections = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 15, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setUnits('dBc').setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnRQuerySigQMicroreflections.setStatus('current')
rdnRQueryPollTime = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 15, 1, 6), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnRQueryPollTime.setStatus('current')
rdnCmtsServiceClassObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 4981, 2, 2, 19))
rdnCmtsServiceClassTable = MibTable((1, 3, 6, 1, 4, 1, 4981, 2, 2, 19, 1), )
if mibBuilder.loadTexts: rdnCmtsServiceClassTable.setStatus('current')
rdnCmtsServiceClassEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4981, 2, 2, 19, 1, 1), ).setIndexNames((0, "RDN-CMTS-MIB", "rdnCmtsServiceClassName"))
if mibBuilder.loadTexts: rdnCmtsServiceClassEntry.setStatus('current')
rdnCmtsServiceClassName = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 19, 1, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 15)))
if mibBuilder.loadTexts: rdnCmtsServiceClassName.setStatus('current')
rdnCmtsServiceClassMab = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 19, 1, 1, 2), Unsigned32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnCmtsServiceClassMab.setStatus('current')
rdnCmtsServiceClassCap = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 19, 1, 1, 3), Unsigned32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnCmtsServiceClassCap.setStatus('current')
rdnCmtsServiceClassSchedulingPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 19, 1, 1, 4), Unsigned32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnCmtsServiceClassSchedulingPriority.setStatus('current')
rdnCmtsServiceClassAdmittedBWThreshold = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 19, 1, 1, 5), Unsigned32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnCmtsServiceClassAdmittedBWThreshold.setStatus('current')
rdnCmtsServiceClassAllowShare = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 19, 1, 1, 6), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnCmtsServiceClassAllowShare.setStatus('current')
rdnUgsStatsWindow = MibScalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 16), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(5, 120), )).clone(60)).setUnits('minutes').setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnUgsStatsWindow.setStatus('current')
rdnCableUgsStatsTable = MibTable((1, 3, 6, 1, 4, 1, 4981, 2, 2, 17), )
if mibBuilder.loadTexts: rdnCableUgsStatsTable.setStatus('current')
rdnCableUgsStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4981, 2, 2, 17, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: rdnCableUgsStatsEntry.setStatus('current')
rdnCableUgsStatsSlot = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 17, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 15))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnCableUgsStatsSlot.setStatus('current')
rdnCableUgsStatsPort = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 17, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnCableUgsStatsPort.setStatus('current')
rdnCableUgsCurrentTotalFlows = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 17, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnCableUgsCurrentTotalFlows.setStatus('current')
rdnCableUgsMaxFlowsLastFiveMinutes = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 17, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnCableUgsMaxFlowsLastFiveMinutes.setStatus('current')
rdnCableUgsAvFlowsLastFiveMinutes = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 17, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnCableUgsAvFlowsLastFiveMinutes.setStatus('current')
rdnCableUgsMinFlowsLastFiveMinutes = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 17, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnCableUgsMinFlowsLastFiveMinutes.setStatus('current')
rdnCableUgsMaxFlowsLastWindow = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 17, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnCableUgsMaxFlowsLastWindow.setStatus('current')
rdnCableUgsAvFlowsLastWindow = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 17, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnCableUgsAvFlowsLastWindow.setStatus('current')
rdnCableUgsMinFlowsLastWindow = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 17, 1, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnCableUgsMinFlowsLastWindow.setStatus('current')
rdnCableUgsResetStats = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 17, 1, 10), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnCableUgsResetStats.setStatus('current')
rdnServiceClassStatsTable = MibTable((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18), )
if mibBuilder.loadTexts: rdnServiceClassStatsTable.setStatus('current')
rdnServiceClassStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "DOCS-QOS3-MIB", "docsQosServiceClassName"))
if mibBuilder.loadTexts: rdnServiceClassStatsEntry.setStatus('current')
rdnServiceClassStatsIfDirection = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18, 1, 1), IfDirection()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnServiceClassStatsIfDirection.setStatus('current')
rdnServiceClassStatsSlot = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 15))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnServiceClassStatsSlot.setStatus('current')
rdnServiceClassStatsPort = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnServiceClassStatsPort.setStatus('current')
rdnServiceClassStatsTotalPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnServiceClassStatsTotalPackets.setStatus('current')
rdnServiceClassStatsTotalBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnServiceClassStatsTotalBytes.setStatus('current')
rdnServiceClassCurrentTotalFlows = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnServiceClassCurrentTotalFlows.setStatus('current')
rdnServiceClassDeferredFlows = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnServiceClassDeferredFlows.setStatus('current')
rdnServiceClassRestrictedFlows = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnServiceClassRestrictedFlows.setStatus('current')
rdnServiceClassRejectedFlows = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18, 1, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnServiceClassRejectedFlows.setStatus('current')
rdnServiceClassBandWidth = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18, 1, 10), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnServiceClassBandWidth.setStatus('current')
rdnServiceClassResetStats = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18, 1, 11), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnServiceClassResetStats.setStatus('current')
rdnRQueryCmtsCmStatusExtTable = MibTable((1, 3, 6, 1, 4, 1, 4981, 2, 2, 20), )
if mibBuilder.loadTexts: rdnRQueryCmtsCmStatusExtTable.setStatus('current')
rdnRQueryCmtsCmStatusExtEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4981, 2, 2, 20, 1), )
rdnRQueryCmtsCmStatusEntry.registerAugmentions(("RDN-CMTS-MIB", "rdnRQueryCmtsCmStatusExtEntry"))
rdnRQueryCmtsCmStatusExtEntry.setIndexNames(*rdnRQueryCmtsCmStatusEntry.getIndexNames())
if mibBuilder.loadTexts: rdnRQueryCmtsCmStatusExtEntry.setStatus('current')
rdnRQuerySwCurrentVers = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 20, 1, 1), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnRQuerySwCurrentVers.setStatus('current')
rdnRQueryServerConfigFile = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 20, 1, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnRQueryServerConfigFile.setStatus('current')
rdnIfCmtsCmTable = MibTable((1, 3, 6, 1, 4, 1, 4981, 2, 2, 21), )
if mibBuilder.loadTexts: rdnIfCmtsCmTable.setStatus('current')
rdnIfCmtsCmEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4981, 2, 2, 21, 1), )
docsIfCmtsCmStatusEntry.registerAugmentions(("RDN-CMTS-MIB", "rdnIfCmtsCmEntry"))
rdnIfCmtsCmEntry.setIndexNames(*docsIfCmtsCmStatusEntry.getIndexNames())
if mibBuilder.loadTexts: rdnIfCmtsCmEntry.setStatus('current')
rdnIfCmtsCmMaxCpeNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 21, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnIfCmtsCmMaxCpeNumber.setStatus('current')
rdnIfCmtsCmCurrCpeNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 21, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsCmCurrCpeNumber.setStatus('current')
rdnIfCmtsMTAOnlyStatusTable = MibTable((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23), )
if mibBuilder.loadTexts: rdnIfCmtsMTAOnlyStatusTable.setStatus('current')
rdnIfCmtsMTAOnlyStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1), ).setIndexNames((0, "RDN-CMTS-MIB", "rdnIfCmtsMTAOnlyStatusIndex"))
if mibBuilder.loadTexts: rdnIfCmtsMTAOnlyStatusEntry.setStatus('current')
rdnIfCmtsMTAOnlyStatusIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647)))
if mibBuilder.loadTexts: rdnIfCmtsMTAOnlyStatusIndex.setStatus('current')
rdnIfCmtsMTAOnlyStatusMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 2), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsMTAOnlyStatusMacAddress.setStatus('current')
rdnIfCmtsMTAOnlyStatusIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 3), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsMTAOnlyStatusIpAddress.setStatus('deprecated')
rdnIfCmtsMTAOnlyStatusDownChannelIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 4), InterfaceIndexOrZero()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsMTAOnlyStatusDownChannelIfIndex.setStatus('current')
rdnIfCmtsMTAOnlyStatusUpChannelIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 5), InterfaceIndexOrZero()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsMTAOnlyStatusUpChannelIfIndex.setStatus('current')
rdnIfCmtsMTAOnlyStatusRxPower = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 6), TenthdBmV()).setUnits('dBmV').setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsMTAOnlyStatusRxPower.setStatus('current')
rdnIfCmtsMTAOnlyStatusTimingOffset = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 7), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsMTAOnlyStatusTimingOffset.setStatus('current')
rdnIfCmtsMTAOnlyStatusEqualizationData = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 8), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsMTAOnlyStatusEqualizationData.setStatus('current')
rdnIfCmtsMTAOnlyStatusValue = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9))).clone(namedValues=NamedValues(("other", 1), ("ranging", 2), ("rangingAborted", 3), ("rangingComplete", 4), ("ipComplete", 5), ("registrationComplete", 6), ("accessDenied", 7), ("operational", 8), ("registeredBPIInitializing", 9)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsMTAOnlyStatusValue.setStatus('current')
rdnIfCmtsMTAOnlyStatusUnerroreds = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsMTAOnlyStatusUnerroreds.setStatus('current')
rdnIfCmtsMTAOnlyStatusCorrecteds = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsMTAOnlyStatusCorrecteds.setStatus('current')
rdnIfCmtsMTAOnlyStatusUncorrectables = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsMTAOnlyStatusUncorrectables.setStatus('current')
rdnIfCmtsMTAOnlyStatusSignalNoise = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 13), TenthdB()).setUnits('dB').setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsMTAOnlyStatusSignalNoise.setStatus('current')
rdnIfCmtsMTAOnlyStatusMicroreflections = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setUnits('dBc').setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsMTAOnlyStatusMicroreflections.setStatus('current')
rdnIfCmtsMTAOnlyStatusExtUnerroreds = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 15), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsMTAOnlyStatusExtUnerroreds.setStatus('current')
rdnIfCmtsMTAOnlyStatusExtCorrecteds = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 16), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsMTAOnlyStatusExtCorrecteds.setStatus('current')
rdnIfCmtsMTAOnlyStatusExtUncorrectables = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 17), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsMTAOnlyStatusExtUncorrectables.setStatus('current')
rdnIfCmtsMTAOnlyStatusDocsisRegMode = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 18), DocsisQosVersion()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsMTAOnlyStatusDocsisRegMode.setStatus('current')
rdnIfCmtsMTAOnlyStatusModulationType = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 19), DocsisUpstreamType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsMTAOnlyStatusModulationType.setStatus('current')
rdnIfCmtsMTAOnlyStatusInetAddressType = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 20), InetAddressType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsMTAOnlyStatusInetAddressType.setStatus('current')
rdnIfCmtsMTAOnlyStatusInetAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 21), InetAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsMTAOnlyStatusInetAddress.setStatus('current')
rdnIfCmtsMTAOnlyStatusValueLastUpdate = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 22), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsMTAOnlyStatusValueLastUpdate.setStatus('current')
rdnServiceClassBondingStatsTable = MibTable((1, 3, 6, 1, 4, 1, 4981, 2, 2, 24), )
if mibBuilder.loadTexts: rdnServiceClassBondingStatsTable.setStatus('current')
rdnServiceClassBondingStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4981, 2, 2, 24, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "RDN-CMTS-MIB", "rdnServiceClassBondingStatsIfDirection"), (0, "DOCS-QOS3-MIB", "docsQosServiceClassName"), (0, "RDN-CMTS-MIB", "rdnServiceClassBondingStatsMacIfIndex"), (0, "RDN-CMTS-MIB", "rdnServiceClassBondingStatsGroupId"))
if mibBuilder.loadTexts: rdnServiceClassBondingStatsEntry.setStatus('current')
rdnServiceClassBondingStatsMacIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 24, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: rdnServiceClassBondingStatsMacIfIndex.setStatus('current')
rdnServiceClassBondingStatsGroupId = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 24, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535)))
if mibBuilder.loadTexts: rdnServiceClassBondingStatsGroupId.setStatus('current')
rdnServiceClassBondingStatsIfDirection = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 24, 1, 3), IfDirection())
if mibBuilder.loadTexts: rdnServiceClassBondingStatsIfDirection.setStatus('current')
rdnServiceClassBondingStatsSlot = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 24, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 15))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnServiceClassBondingStatsSlot.setStatus('current')
rdnServiceClassBondingStatsChan = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 24, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnServiceClassBondingStatsChan.setStatus('current')
rdnServiceClassBondingCurrentTotalFlows = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 24, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnServiceClassBondingCurrentTotalFlows.setStatus('current')
rdnServiceClassBondingDeferredFlows = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 24, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnServiceClassBondingDeferredFlows.setStatus('current')
rdnServiceClassBondingRestrictedFlows = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 24, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnServiceClassBondingRestrictedFlows.setStatus('current')
rdnServiceClassBondingRejectedFlows = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 24, 1, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnServiceClassBondingRejectedFlows.setStatus('current')
rdnServiceClassBondingBandWidth = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 24, 1, 10), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnServiceClassBondingBandWidth.setStatus('current')
rdnCmtsCmResetByIpv6Addr = MibScalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 25), InetAddressIPv6()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rdnCmtsCmResetByIpv6Addr.setStatus('current')
rdnCmtsMibNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 4981, 2, 4))
rdnCmtsMibNotificationPrefix = MibIdentifier((1, 3, 6, 1, 4, 1, 4981, 2, 4, 0))
rdnCmtsMibNotificationObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 4981, 2, 4, 1))
rdnCmtsCmRegisteredNotification = NotificationType((1, 3, 6, 1, 4, 1, 4981, 2, 4, 0, 1)).setObjects(("DOCS-IF-MIB", "docsIfCmtsCmStatusDocsisRegMode"), ("DOCS-IF-MIB", "docsIfCmtsCmStatusMacAddress"), ("DOCS-IF-MIB", "docsIfCmtsCmStatusIpAddress"), ("DOCS-IF3-MIB", "docsIf3CmtsCmRegStatusIPv6Addr"), ("DOCS-IF-MIB", "docsIfUpChannelId"), ("DOCS-IF-MIB", "docsIfDownChannelId"), ("RDN-CMTS-MIB", "rdnModemRegIndex"), ("RDN-CABLE-SPECTRUM-GROUP-MIB", "rdnSpectrumGroupName"))
if mibBuilder.loadTexts: rdnCmtsCmRegisteredNotification.setStatus('current')
rdnCmtsCmDeregisteredNotification = NotificationType((1, 3, 6, 1, 4, 1, 4981, 2, 4, 0, 2)).setObjects(("DOCS-IF-MIB", "docsIfCmtsCmStatusDocsisRegMode"), ("DOCS-IF-MIB", "docsIfCmtsCmStatusMacAddress"), ("DOCS-IF-MIB", "docsIfUpChannelId"), ("DOCS-IF-MIB", "docsIfDownChannelId"), ("RDN-CMTS-MIB", "rdnModemRegIndex"), ("RDN-CMTS-MIB", "rdnModemDeregReason"), ("RDN-CABLE-SPECTRUM-GROUP-MIB", "rdnSpectrumGroupName"))
if mibBuilder.loadTexts: rdnCmtsCmDeregisteredNotification.setStatus('current')
rdnCmtsUpstreamIfLinkUpTrap = NotificationType((1, 3, 6, 1, 4, 1, 4981, 2, 4, 0, 3)).setObjects(("IF-MIB", "ifIndex"), ("IF-MIB", "ifDescr"), ("IF-MIB", "ifType"), ("IF-MIB", "ifAdminStatus"), ("IF-MIB", "ifOperStatus"), ("RDN-CABLE-SPECTRUM-GROUP-MIB", "rdnSpectrumGroupName"))
if mibBuilder.loadTexts: rdnCmtsUpstreamIfLinkUpTrap.setStatus('current')
rdnCmtsUpstreamIfLinkDownTrap = NotificationType((1, 3, 6, 1, 4, 1, 4981, 2, 4, 0, 4)).setObjects(("IF-MIB", "ifIndex"), ("IF-MIB", "ifDescr"), ("IF-MIB", "ifType"), ("IF-MIB", "ifAdminStatus"), ("IF-MIB", "ifOperStatus"), ("RDN-CABLE-SPECTRUM-GROUP-MIB", "rdnSpectrumGroupName"))
if mibBuilder.loadTexts: rdnCmtsUpstreamIfLinkDownTrap.setStatus('current')
rdnRQueryPollDoneNotification = NotificationType((1, 3, 6, 1, 4, 1, 4981, 2, 4, 0, 5)).setObjects(("RDN-CMTS-MIB", "rdnRQueryLastPollStartTime"), ("RDN-CMTS-MIB", "rdnRQueryLastPollStopTime"))
if mibBuilder.loadTexts: rdnRQueryPollDoneNotification.setStatus('current')
rdnPktDQoSAdmittedBwThresholdTrap = NotificationType((1, 3, 6, 1, 4, 1, 4981, 2, 4, 0, 6)).setObjects(("RDN-CMTS-MIB", "rdnPktDQoSAdmittedBwThresholdReason"), ("RDN-PKTCABLE-GROUP-MIB", "rdnPktDQoSClassName"))
if mibBuilder.loadTexts: rdnPktDQoSAdmittedBwThresholdTrap.setStatus('current')
rdnRQueryLastPollStartTime = MibScalar((1, 3, 6, 1, 4, 1, 4981, 2, 4, 1, 1), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnRQueryLastPollStartTime.setStatus('current')
rdnRQueryLastPollStopTime = MibScalar((1, 3, 6, 1, 4, 1, 4981, 2, 4, 1, 2), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnRQueryLastPollStopTime.setStatus('current')
rdnPktDQoSAdmittedBwThresholdReason = MibScalar((1, 3, 6, 1, 4, 1, 4981, 2, 4, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("admittedBwExceedsThreshold", 1), ("admittedBwClearsOfThreshold", 2)))).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: rdnPktDQoSAdmittedBwThresholdReason.setStatus('current')
rdnCmtsMibConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 4981, 2, 5))
rdnCmtsCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 4981, 2, 5, 1))
rdnCmtsMibGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 4981, 2, 5, 2))
rdnCmtsMibCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 4981, 2, 5, 1, 1)).setObjects(("RDN-CMTS-MIB", "rdnCmtsIfGroup"), ("RDN-CMTS-MIB", "rdnCmtsMiscGroup"), ("RDN-CMTS-MIB", "rdnCmtsNotificationsGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
rdnCmtsMibCompliance = rdnCmtsMibCompliance.setStatus('current')
rdnCmtsIfGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 4981, 2, 5, 2, 1)).setObjects(("RDN-CMTS-MIB", "rdnCmtsDSModulation"), ("RDN-CMTS-MIB", "rdnCmtsUSNominalRxPower"), ("RDN-CMTS-MIB", "rdnCmtsUSInvitedRangingInterval"), ("RDN-CMTS-MIB", "rdnCmtsUSRangingResponseControl"), ("RDN-CMTS-MIB", "rdnCmtsUSRangingPowerOverride"), ("RDN-CMTS-MIB", "rdnCmtsUSNominalRxPowerMode"), ("RDN-CMTS-MIB", "rdnCmtsStpTCNEnable"), ("RDN-CMTS-MIB", "rdnCmtsLinkUpDownTrapEnable"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
rdnCmtsIfGroup = rdnCmtsIfGroup.setStatus('current')
rdnCmtsMiscGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 4981, 2, 5, 2, 2)).setObjects(("RDN-CMTS-MIB", "rdnCmtsSaveConfig"), ("RDN-CMTS-MIB", "rdnCmtsCmResetByMacAddr"), ("RDN-CMTS-MIB", "rdnCmtsCmResetByIpAddr"), ("RDN-CMTS-MIB", "rdnCmtsCmResetAll"), ("RDN-CMTS-MIB", "rdnCmtsModemAgingTimer"), ("RDN-CMTS-MIB", "rdnCmtsCmMac"), ("RDN-CMTS-MIB", "rdnIfCmtsCmStatusRegistrationTime"), ("RDN-CMTS-MIB", "rdnIfCmtsCmStatusTxUnicastKbytes"), ("RDN-CMTS-MIB", "rdnIfCmtsCmStatusRxUnicastKbytes"), ("RDN-CMTS-MIB", "rdnIfCmtsCmStatusTxUnicastExtKbytes"), ("RDN-CMTS-MIB", "rdnIfCmtsCmStatusRxUnicastExtKbytes"), ("RDN-CMTS-MIB", "rdnIfCmtsCmStatusSpectrumGroupName"), ("RDN-CMTS-MIB", "rdnIfCmtsCmStatusUpstreamPort"), ("RDN-CMTS-MIB", "rdnIfCmtsCmStatusDownStreamPort"), ("RDN-CMTS-MIB", "rdnIfCmtsCmStatusValue"), ("RDN-CMTS-MIB", "rdnIfCmtsCmStatusDSBondingGroupId"), ("RDN-CMTS-MIB", "rdnIfCmtsCmStatusOnlineTimes"), ("RDN-CMTS-MIB", "rdnIfCmtsCmStatusPercentOnline"), ("RDN-CMTS-MIB", "rdnIfCmtsCmStatusMinOnlineTime"), ("RDN-CMTS-MIB", "rdnIfCmtsCmStatusAvgOnlineTime"), ("RDN-CMTS-MIB", "rdnIfCmtsCmStatusMaxOnlineTime"), ("RDN-CMTS-MIB", "rdnIfCmtsCmStatusMinOfflineTime"), ("RDN-CMTS-MIB", "rdnIfCmtsCmStatusAvgOfflineTime"), ("RDN-CMTS-MIB", "rdnIfCmtsCmStatusMaxOfflineTime"), ("RDN-CMTS-MIB", "rdnModemDeregReason"), ("RDN-CMTS-MIB", "rdnModemRegIndex"), ("RDN-CMTS-MIB", "rdnCmToCpeMacAddress"), ("RDN-CMTS-MIB", "rdnCmToCpeIpAddress"), ("RDN-CMTS-MIB", "rdnCmtsCmRegisteredTrapEnable"), ("RDN-CMTS-MIB", "rdnCmtsCardType"), ("RDN-CMTS-MIB", "rdnRQueryCmtsCmDownChannelPower"), ("RDN-CMTS-MIB", "rdnRQueryCmStatusTxPower"), ("RDN-CMTS-MIB", "rdnRQueryUpChannelTxTimingOffset"), ("RDN-CMTS-MIB", "rdnRQuerySigQSignalNoise"), ("RDN-CMTS-MIB", "rdnRQuerySigQMicroreflections"), ("RDN-CMTS-MIB", "rdnRQueryPollTime"), ("RDN-CMTS-MIB", "rdnUgsStatsWindow"), ("RDN-CMTS-MIB", "rdnCableUgsStatsSlot"), ("RDN-CMTS-MIB", "rdnCableUgsStatsPort"), ("RDN-CMTS-MIB", "rdnCableUgsCurrentTotalFlows"), ("RDN-CMTS-MIB", "rdnCableUgsMaxFlowsLastFiveMinutes"), ("RDN-CMTS-MIB", "rdnCableUgsAvFlowsLastFiveMinutes"), ("RDN-CMTS-MIB", "rdnCableUgsMinFlowsLastFiveMinutes"), ("RDN-CMTS-MIB", "rdnCableUgsMaxFlowsLastWindow"), ("RDN-CMTS-MIB", "rdnCableUgsAvFlowsLastWindow"), ("RDN-CMTS-MIB", "rdnCableUgsMinFlowsLastWindow"), ("RDN-CMTS-MIB", "rdnCableUgsResetStats"), ("RDN-CMTS-MIB", "rdnServiceClassStatsIfDirection"), ("RDN-CMTS-MIB", "rdnServiceClassStatsSlot"), ("RDN-CMTS-MIB", "rdnServiceClassStatsPort"), ("RDN-CMTS-MIB", "rdnServiceClassStatsTotalPackets"), ("RDN-CMTS-MIB", "rdnServiceClassStatsTotalBytes"), ("RDN-CMTS-MIB", "rdnServiceClassCurrentTotalFlows"), ("RDN-CMTS-MIB", "rdnServiceClassDeferredFlows"), ("RDN-CMTS-MIB", "rdnServiceClassRestrictedFlows"), ("RDN-CMTS-MIB", "rdnServiceClassRejectedFlows"), ("RDN-CMTS-MIB", "rdnServiceClassBandWidth"), ("RDN-CMTS-MIB", "rdnServiceClassResetStats"), ("RDN-CMTS-MIB", "rdnServiceClassBondingStatsSlot"), ("RDN-CMTS-MIB", "rdnServiceClassBondingStatsChan"), ("RDN-CMTS-MIB", "rdnServiceClassBondingCurrentTotalFlows"), ("RDN-CMTS-MIB", "rdnServiceClassBondingDeferredFlows"), ("RDN-CMTS-MIB", "rdnServiceClassBondingRestrictedFlows"), ("RDN-CMTS-MIB", "rdnServiceClassBondingRejectedFlows"), ("RDN-CMTS-MIB", "rdnServiceClassBondingBandWidth"), ("RDN-CMTS-MIB", "rdnRQuerySwCurrentVers"), ("RDN-CMTS-MIB", "rdnCmtsCmResetByIpv6Addr"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
rdnCmtsMiscGroup = rdnCmtsMiscGroup.setStatus('current')
rdnCmtsNotificationsGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 4981, 2, 5, 2, 3)).setObjects(("RDN-CMTS-MIB", "rdnCmtsCmRegisteredNotification"), ("RDN-CMTS-MIB", "rdnCmtsCmDeregisteredNotification"), ("RDN-CMTS-MIB", "rdnCmtsUpstreamIfLinkUpTrap"), ("RDN-CMTS-MIB", "rdnCmtsUpstreamIfLinkDownTrap"), ("RDN-CMTS-MIB", "rdnRQueryPollDoneNotification"), ("RDN-CMTS-MIB", "rdnPktDQoSAdmittedBwThresholdTrap"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
rdnCmtsNotificationsGroup = rdnCmtsNotificationsGroup.setStatus('current')
rdnCableInterceptScalars = MibIdentifier((1, 3, 6, 1, 4, 1, 4981, 2, 2, 26))
rdnCableInterceptAccessPermitted = MibScalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 26, 1), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnCableInterceptAccessPermitted.setStatus('current')
rdnCableInterceptTable = MibTable((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27), )
if mibBuilder.loadTexts: rdnCableInterceptTable.setStatus('current')
rdnCableInterceptEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "RDN-CMTS-MIB", "rdnCableInterceptCpeMac"))
if mibBuilder.loadTexts: rdnCableInterceptEntry.setStatus('current')
rdnCableInterceptCpeMac = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 1), MacAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rdnCableInterceptCpeMac.setStatus('current')
rdnCableInterceptCmMac = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 2), MacAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rdnCableInterceptCmMac.setStatus('current')
rdnCableInterceptDestination1Type = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 3), InetAddressType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rdnCableInterceptDestination1Type.setStatus('current')
rdnCableInterceptDestination1Ip = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 4), InetAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rdnCableInterceptDestination1Ip.setStatus('current')
rdnCableInterceptDestination1Port = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 5), InetPortNumber()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rdnCableInterceptDestination1Port.setStatus('current')
rdnCableInterceptDestination2Type = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 6), InetAddressType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rdnCableInterceptDestination2Type.setStatus('current')
rdnCableInterceptDestination2Ip = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 7), InetAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rdnCableInterceptDestination2Ip.setStatus('current')
rdnCableInterceptDestination2Port = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 8), InetPortNumber()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rdnCableInterceptDestination2Port.setStatus('current')
rdnCableInterceptDestination3Type = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 9), InetAddressType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rdnCableInterceptDestination3Type.setStatus('current')
rdnCableInterceptDestination3Ip = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 10), InetAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rdnCableInterceptDestination3Ip.setStatus('current')
rdnCableInterceptDestination3Port = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 11), InetPortNumber()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rdnCableInterceptDestination3Port.setStatus('current')
rdnCableInterceptSourceType = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 12), InetAddressType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rdnCableInterceptSourceType.setStatus('current')
rdnCableInterceptSourceIp = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 13), InetAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rdnCableInterceptSourceIp.setStatus('current')
rdnCableInterceptPktCnt = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 14), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnCableInterceptPktCnt.setStatus('current')
rdnCableInterceptByteCnt = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 15), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnCableInterceptByteCnt.setStatus('current')
rdnCableInterceptRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 16), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rdnCableInterceptRowStatus.setStatus('current')
rdnCmtsUpChannelCounterTable = MibTable((1, 3, 6, 1, 4, 1, 4981, 2, 2, 28), )
if mibBuilder.loadTexts: rdnCmtsUpChannelCounterTable.setStatus('current')
rdnCmtsUpChannelCounterEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4981, 2, 2, 28, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: rdnCmtsUpChannelCounterEntry.setStatus('current')
rdnIfCmtsUpChCtrReqNoise = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 28, 1, 1), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsUpChCtrReqNoise.setStatus('current')
rdnIfCmtsUpChCtrReqNoEnergy = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 28, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsUpChCtrReqNoEnergy.setStatus('current')
rdnIfCmtsUpChCtrExtReqNoise = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 28, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsUpChCtrExtReqNoise.setStatus('current')
rdnIfCmtsUpChCtrExtReqNoEnergy = MibTableColumn((1, 3, 6, 1, 4, 1, 4981, 2, 2, 28, 1, 4), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rdnIfCmtsUpChCtrExtReqNoEnergy.setStatus('current')
mibBuilder.exportSymbols("RDN-CMTS-MIB", rdnCmtsUpstreamIfLinkDownTrap=rdnCmtsUpstreamIfLinkDownTrap, rdnCableUgsAvFlowsLastFiveMinutes=rdnCableUgsAvFlowsLastFiveMinutes, rdnCableInterceptSourceIp=rdnCableInterceptSourceIp, rdnIfCmtsUpChCtrReqNoEnergy=rdnIfCmtsUpChCtrReqNoEnergy, rdnCmtsUpstreamChannelTable=rdnCmtsUpstreamChannelTable, rdnServiceClassStatsTotalBytes=rdnServiceClassStatsTotalBytes, rdnCableUgsMaxFlowsLastFiveMinutes=rdnCableUgsMaxFlowsLastFiveMinutes, rdnCmtsUpChannelCounterEntry=rdnCmtsUpChannelCounterEntry, rdnIfCmtsUpChCtrExtReqNoise=rdnIfCmtsUpChCtrExtReqNoise, rdnIfCmtsUpChCtrExtReqNoEnergy=rdnIfCmtsUpChCtrExtReqNoEnergy, rdnServiceClassStatsPort=rdnServiceClassStatsPort, rdnCableInterceptDestination3Ip=rdnCableInterceptDestination3Ip, rdnRQueryPollDoneNotification=rdnRQueryPollDoneNotification, rdnCableInterceptDestination2Ip=rdnCableInterceptDestination2Ip, rdnIfCmtsCmStatusTxUnicastExtKbytes=rdnIfCmtsCmStatusTxUnicastExtKbytes, rdnServiceClassBondingDeferredFlows=rdnServiceClassBondingDeferredFlows, rdnCableInterceptDestination2Type=rdnCableInterceptDestination2Type, rdnCmtsUSOfflineModemCount=rdnCmtsUSOfflineModemCount, rdnRQueryCmtsCmStatusExtTable=rdnRQueryCmtsCmStatusExtTable, rdnServiceClassStatsIfDirection=rdnServiceClassStatsIfDirection, rdnCmtsMibGroups=rdnCmtsMibGroups, rdnCmtsMiscObjects=rdnCmtsMiscObjects, rdnIfCmtsCmEntry=rdnIfCmtsCmEntry, rdnIfCmtsCmStatusTable=rdnIfCmtsCmStatusTable, rdnCmtsMibConformance=rdnCmtsMibConformance, rdnServiceClassBondingStatsIfDirection=rdnServiceClassBondingStatsIfDirection, rdnCmToCpeIPv6Addr=rdnCmToCpeIPv6Addr, rdnCmToCpeIpAddress=rdnCmToCpeIpAddress, rdnCmtsCmResetByIpv6Addr=rdnCmtsCmResetByIpv6Addr, rdnCmtsCmResetAll=rdnCmtsCmResetAll, rdnCableUgsAvFlowsLastWindow=rdnCableUgsAvFlowsLastWindow, rdnRQueryCmtsCmStatusEntry=rdnRQueryCmtsCmStatusEntry, rdnCableInterceptDestination3Type=rdnCableInterceptDestination3Type, rdnIfCmtsMTAOnlyStatusDocsisRegMode=rdnIfCmtsMTAOnlyStatusDocsisRegMode, rdnIfCmtsMTAOnlyStatusEntry=rdnIfCmtsMTAOnlyStatusEntry, rdnCmtsStpEnable=rdnCmtsStpEnable, rdnRQueryServerConfigFile=rdnRQueryServerConfigFile, rdnIfCmtsMTAOnlyStatusEqualizationData=rdnIfCmtsMTAOnlyStatusEqualizationData, rdnIfCmtsMTAOnlyStatusUnerroreds=rdnIfCmtsMTAOnlyStatusUnerroreds, rdnCableInterceptTable=rdnCableInterceptTable, rdnIfCmtsMTAOnlyStatusModulationType=rdnIfCmtsMTAOnlyStatusModulationType, rdnServiceClassBondingStatsTable=rdnServiceClassBondingStatsTable, rdnRQueryLastPollStartTime=rdnRQueryLastPollStartTime, rdnUgsStatsWindow=rdnUgsStatsWindow, rdnIfCmtsCmStatusMinOfflineTime=rdnIfCmtsCmStatusMinOfflineTime, rdnIfCmtsMTAOnlyStatusDownChannelIfIndex=rdnIfCmtsMTAOnlyStatusDownChannelIfIndex, rdnRQuerySigQSignalNoise=rdnRQuerySigQSignalNoise, rdnServiceClassStatsEntry=rdnServiceClassStatsEntry, rdnIfCmtsCmStatusMaxOnlineTime=rdnIfCmtsCmStatusMaxOnlineTime, rdnCmtsDownstreamChannelEntry=rdnCmtsDownstreamChannelEntry, rdnIfCmtsMTAOnlyStatusExtUnerroreds=rdnIfCmtsMTAOnlyStatusExtUnerroreds, rdnIfCmtsCmStatusAvgOnlineTime=rdnIfCmtsCmStatusAvgOnlineTime, rdnIfCmtsCmStatusSpectrumGroupName=rdnIfCmtsCmStatusSpectrumGroupName, rdnCmtsUSTotalModemCount=rdnCmtsUSTotalModemCount, rdnRQueryCmStatusTxPower=rdnRQueryCmStatusTxPower, rdnCmtsSaveConfig=rdnCmtsSaveConfig, rdnCmtsServiceClassName=rdnCmtsServiceClassName, rdnServiceClassBondingRestrictedFlows=rdnServiceClassBondingRestrictedFlows, rdnCmtsCpeMac=rdnCmtsCpeMac, rdnCmtsModemAgingTimer=rdnCmtsModemAgingTimer, rdnCmtsCmResetByIpAddr=rdnCmtsCmResetByIpAddr, rdnIfCmtsMTAOnlyStatusValueLastUpdate=rdnIfCmtsMTAOnlyStatusValueLastUpdate, rdnServiceClassBondingCurrentTotalFlows=rdnServiceClassBondingCurrentTotalFlows, rdnCmtsUpChannelCounterTable=rdnCmtsUpChannelCounterTable, rdnCmtsMib=rdnCmtsMib, rdnCmtsCmDeregisteredNotification=rdnCmtsCmDeregisteredNotification, rdnCmtsUpstreamChannelEntry=rdnCmtsUpstreamChannelEntry, rdnCmtsServiceClassAdmittedBWThreshold=rdnCmtsServiceClassAdmittedBWThreshold, rdnCableUgsMaxFlowsLastWindow=rdnCableUgsMaxFlowsLastWindow, rdnCmtsMibNotifications=rdnCmtsMibNotifications, rdnServiceClassStatsTable=rdnServiceClassStatsTable, rdnRQuerySwCurrentVers=rdnRQuerySwCurrentVers, rdnRQueryPollTime=rdnRQueryPollTime, rdnCableInterceptPktCnt=rdnCableInterceptPktCnt, rdnCmToCpeIndex=rdnCmToCpeIndex, rdnServiceClassBandWidth=rdnServiceClassBandWidth, rdnServiceClassRestrictedFlows=rdnServiceClassRestrictedFlows, rdnIfCmtsCmTable=rdnIfCmtsCmTable, rdnIfCmtsCmStatusValue=rdnIfCmtsCmStatusValue, rdnServiceClassBondingStatsSlot=rdnServiceClassBondingStatsSlot, rdnCmtsIfObjects=rdnCmtsIfObjects, rdnCmtsServiceClassCap=rdnCmtsServiceClassCap, rdnCmToCpeEntry=rdnCmToCpeEntry, rdnIfCmtsMTAOnlyStatusRxPower=rdnIfCmtsMTAOnlyStatusRxPower, rdnCmtsHostAuthControl=rdnCmtsHostAuthControl, rdnCableInterceptAccessPermitted=rdnCableInterceptAccessPermitted, rdnIfCmtsUpChCtrReqNoise=rdnIfCmtsUpChCtrReqNoise, rdnCmtsStpTCNEnable=rdnCmtsStpTCNEnable, rdnPktDQoSAdmittedBwThresholdTrap=rdnPktDQoSAdmittedBwThresholdTrap, rdnCmtsCmMac=rdnCmtsCmMac, rdnCableInterceptSourceType=rdnCableInterceptSourceType, PYSNMP_MODULE_ID=rdnCmtsMib, rdnCmtsLinkUpDownTrapEnableTable=rdnCmtsLinkUpDownTrapEnableTable, rdnIfCmtsMTAOnlyStatusTimingOffset=rdnIfCmtsMTAOnlyStatusTimingOffset, rdnIfCmtsMTAOnlyStatusMicroreflections=rdnIfCmtsMTAOnlyStatusMicroreflections, rdnModemRegIndex=rdnModemRegIndex, rdnIfCmtsCmStatusRxUnicastKbytes=rdnIfCmtsCmStatusRxUnicastKbytes, rdnIfCmtsCmStatusDownStreamPort=rdnIfCmtsCmStatusDownStreamPort, rdnServiceClassCurrentTotalFlows=rdnServiceClassCurrentTotalFlows, rdnCmtsNotificationsGroup=rdnCmtsNotificationsGroup, rdnCmtsUSNominalRxPower=rdnCmtsUSNominalRxPower, rdnIfCmtsMTAOnlyStatusInetAddressType=rdnIfCmtsMTAOnlyStatusInetAddressType, rdnCmtsLinkUpDownTrapEnable=rdnCmtsLinkUpDownTrapEnable, rdnCmtsMibCompliance=rdnCmtsMibCompliance, rdnIfCmtsMTAOnlyStatusIndex=rdnIfCmtsMTAOnlyStatusIndex, rdnCableInterceptCpeMac=rdnCableInterceptCpeMac, rdnServiceClassResetStats=rdnServiceClassResetStats, rdnIfCmtsCmCurrCpeNumber=rdnIfCmtsCmCurrCpeNumber, rdnCmtsIfGroup=rdnCmtsIfGroup, rdnCableInterceptDestination1Port=rdnCableInterceptDestination1Port, rdnCmtsLinkUpDownTrapEnableEntry=rdnCmtsLinkUpDownTrapEnableEntry, rdnCmtsUSRangingResponseControl=rdnCmtsUSRangingResponseControl, rdnServiceClassBondingStatsMacIfIndex=rdnServiceClassBondingStatsMacIfIndex, rdnCmtsUpstreamIfLinkUpTrap=rdnCmtsUpstreamIfLinkUpTrap, rdnCableInterceptDestination1Type=rdnCableInterceptDestination1Type, rdnIfCmtsMTAOnlyStatusCorrecteds=rdnIfCmtsMTAOnlyStatusCorrecteds, rdnServiceClassBondingStatsGroupId=rdnServiceClassBondingStatsGroupId, rdnCmtsServiceClassObjects=rdnCmtsServiceClassObjects, rdnCmtsMibNotificationObjects=rdnCmtsMibNotificationObjects, rdnCmtsCardType=rdnCmtsCardType, rdnCmtsCompliances=rdnCmtsCompliances, rdnCmtsCmRegisteredTrapEnable=rdnCmtsCmRegisteredTrapEnable, rdnCmToCpeMacAddress=rdnCmToCpeMacAddress, rdnIfCmtsCmStatusRegistrationTime=rdnIfCmtsCmStatusRegistrationTime, rdnIfCmtsCmStatusRxUnicastExtKbytes=rdnIfCmtsCmStatusRxUnicastExtKbytes, rdnCmtsCmResetByMacAddr=rdnCmtsCmResetByMacAddr, rdnIfCmtsCmStatusOnlineTimes=rdnIfCmtsCmStatusOnlineTimes, rdnIfCmtsCmStatusTxUnicastKbytes=rdnIfCmtsCmStatusTxUnicastKbytes, rdnIfCmtsCmStatusPercentOnline=rdnIfCmtsCmStatusPercentOnline, rdnIfCmtsCmStatusAvgOfflineTime=rdnIfCmtsCmStatusAvgOfflineTime, rdnCableUgsStatsTable=rdnCableUgsStatsTable, rdnCableInterceptDestination1Ip=rdnCableInterceptDestination1Ip, rdnIfCmtsMTAOnlyStatusSignalNoise=rdnIfCmtsMTAOnlyStatusSignalNoise, rdnCableInterceptDestination3Port=rdnCableInterceptDestination3Port, rdnRQueryUpChannelTxTimingOffset=rdnRQueryUpChannelTxTimingOffset, rdnPktDQoSAdmittedBwThresholdReason=rdnPktDQoSAdmittedBwThresholdReason, rdnCableInterceptDestination2Port=rdnCableInterceptDestination2Port, rdnCmtsUSRegisteredModemCount=rdnCmtsUSRegisteredModemCount, rdnCmtsCpeToCmTable=rdnCmtsCpeToCmTable, rdnIfCmtsMTAOnlyStatusUpChannelIfIndex=rdnIfCmtsMTAOnlyStatusUpChannelIfIndex, rdnCmtsMiscGroup=rdnCmtsMiscGroup, rdnRQueryCmtsCmStatusExtEntry=rdnRQueryCmtsCmStatusExtEntry, rdnCableInterceptEntry=rdnCableInterceptEntry, rdnCableUgsStatsPort=rdnCableUgsStatsPort, rdnCableInterceptRowStatus=rdnCableInterceptRowStatus, rdnCmtsServiceClassTable=rdnCmtsServiceClassTable, rdnCableInterceptByteCnt=rdnCableInterceptByteCnt, rdnCmtsUSNominalRxPowerMode=rdnCmtsUSNominalRxPowerMode, rdnIfCmtsCmStatusMinOnlineTime=rdnIfCmtsCmStatusMinOnlineTime, rdnCmtsCpeToCmEntry=rdnCmtsCpeToCmEntry, rdnCableUgsMinFlowsLastWindow=rdnCableUgsMinFlowsLastWindow, rdnServiceClassBondingRejectedFlows=rdnServiceClassBondingRejectedFlows, rdnIfCmtsMTAOnlyStatusIpAddress=rdnIfCmtsMTAOnlyStatusIpAddress, rdnCmtsUSInvitedRangingInterval=rdnCmtsUSInvitedRangingInterval, rdnIfCmtsCmStatusUpstreamPort=rdnIfCmtsCmStatusUpstreamPort, rdnIfCmtsCmStatusMaxOfflineTime=rdnIfCmtsCmStatusMaxOfflineTime, rdnIfCmtsMTAOnlyStatusExtUncorrectables=rdnIfCmtsMTAOnlyStatusExtUncorrectables, rdnServiceClassBondingBandWidth=rdnServiceClassBondingBandWidth, rdnCableUgsStatsSlot=rdnCableUgsStatsSlot, rdnCableUgsResetStats=rdnCableUgsResetStats, rdnModemDeregReason=rdnModemDeregReason, rdnServiceClassStatsTotalPackets=rdnServiceClassStatsTotalPackets, rdnServiceClassStatsSlot=rdnServiceClassStatsSlot, rdnRQueryCmtsCmStatusTable=rdnRQueryCmtsCmStatusTable, rdnRQueryCmtsCmDownChannelPower=rdnRQueryCmtsCmDownChannelPower, rdnCableInterceptCmMac=rdnCableInterceptCmMac, rdnIfCmtsCmStatusDSBondingGroupId=rdnIfCmtsCmStatusDSBondingGroupId, rdnCmToCpeTable=rdnCmToCpeTable, rdnIfCmtsMTAOnlyStatusValue=rdnIfCmtsMTAOnlyStatusValue, rdnServiceClassRejectedFlows=rdnServiceClassRejectedFlows, rdnIfCmtsMTAOnlyStatusInetAddress=rdnIfCmtsMTAOnlyStatusInetAddress, rdnCableInterceptScalars=rdnCableInterceptScalars, rdnCableUgsCurrentTotalFlows=rdnCableUgsCurrentTotalFlows, rdnServiceClassBondingStatsChan=rdnServiceClassBondingStatsChan, rdnServiceClassBondingStatsEntry=rdnServiceClassBondingStatsEntry, rdnCmtsServiceClassMab=rdnCmtsServiceClassMab, rdnIfCmtsCmMaxCpeNumber=rdnIfCmtsCmMaxCpeNumber, rdnCmtsDownstreamChannelTable=rdnCmtsDownstreamChannelTable, rdnServiceClassDeferredFlows=rdnServiceClassDeferredFlows, rdnIfCmtsMTAOnlyStatusExtCorrecteds=rdnIfCmtsMTAOnlyStatusExtCorrecteds, rdnIfCmtsMTAOnlyStatusTable=rdnIfCmtsMTAOnlyStatusTable, rdnRQuerySigQMicroreflections=rdnRQuerySigQMicroreflections, rdnCmtsUSRangingPowerOverride=rdnCmtsUSRangingPowerOverride, rdnCmtsUSUnregisteredModemCount=rdnCmtsUSUnregisteredModemCount, rdnCmtsCpeToCmObject=rdnCmtsCpeToCmObject, rdnCmtsCmRegisteredNotification=rdnCmtsCmRegisteredNotification, rdnIfCmtsMTAOnlyStatusUncorrectables=rdnIfCmtsMTAOnlyStatusUncorrectables, rdnCmtsServiceClassAllowShare=rdnCmtsServiceClassAllowShare, rdnCmtsServiceClassEntry=rdnCmtsServiceClassEntry, rdnIfCmtsMTAOnlyStatusMacAddress=rdnIfCmtsMTAOnlyStatusMacAddress, rdnIfCmtsCmStatusEntry=rdnIfCmtsCmStatusEntry, rdnCableUgsMinFlowsLastFiveMinutes=rdnCableUgsMinFlowsLastFiveMinutes, rdnCmtsServiceClassSchedulingPriority=rdnCmtsServiceClassSchedulingPriority, rdnRQueryLastPollStopTime=rdnRQueryLastPollStopTime, rdnCmtsDSModulation=rdnCmtsDSModulation, rdnCmtsStpObjects=rdnCmtsStpObjects, rdnCableUgsStatsEntry=rdnCableUgsStatsEntry, rdnCmtsMibNotificationPrefix=rdnCmtsMibNotificationPrefix)
| (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, constraints_intersection, single_value_constraint, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ValueSizeConstraint', 'ConstraintsIntersection', 'SingleValueConstraint', 'ValueRangeConstraint')
(docs_if_cmts_cm_status_ip_address, tenthd_b, tenthd_bm_v, docs_if_up_channel_id, docs_if_cmts_cm_status_entry, docs_if_cmts_cm_status_mac_address, docs_if_cmts_cm_status_index, docsis_qos_version, docs_if_cmts_cm_status_docsis_reg_mode, docs_if_down_channel_id, docsis_upstream_type) = mibBuilder.importSymbols('DOCS-IF-MIB', 'docsIfCmtsCmStatusIpAddress', 'TenthdB', 'TenthdBmV', 'docsIfUpChannelId', 'docsIfCmtsCmStatusEntry', 'docsIfCmtsCmStatusMacAddress', 'docsIfCmtsCmStatusIndex', 'DocsisQosVersion', 'docsIfCmtsCmStatusDocsisRegMode', 'docsIfDownChannelId', 'DocsisUpstreamType')
(if_direction, docs_if3_cmts_cm_reg_status_i_pv6_addr) = mibBuilder.importSymbols('DOCS-IF3-MIB', 'IfDirection', 'docsIf3CmtsCmRegStatusIPv6Addr')
(docs_qos_service_class_name,) = mibBuilder.importSymbols('DOCS-QOS3-MIB', 'docsQosServiceClassName')
(ip_v4or_v6_addr,) = mibBuilder.importSymbols('DOCS-SUBMGT-MIB', 'IpV4orV6Addr')
(if_admin_status, if_descr, interface_index_or_zero, interface_index, if_type, if_index, if_oper_status) = mibBuilder.importSymbols('IF-MIB', 'ifAdminStatus', 'ifDescr', 'InterfaceIndexOrZero', 'InterfaceIndex', 'ifType', 'ifIndex', 'ifOperStatus')
(inet_address_i_pv6, inet_address, inet_address_type, inet_port_number) = mibBuilder.importSymbols('INET-ADDRESS-MIB', 'InetAddressIPv6', 'InetAddress', 'InetAddressType', 'InetPortNumber')
(rdn_spectrum_group_name,) = mibBuilder.importSymbols('RDN-CABLE-SPECTRUM-GROUP-MIB', 'rdnSpectrumGroupName')
(riverdelta,) = mibBuilder.importSymbols('RDN-MIB', 'riverdelta')
(rdn_pkt_d_qo_s_class_name,) = mibBuilder.importSymbols('RDN-PKTCABLE-GROUP-MIB', 'rdnPktDQoSClassName')
(module_compliance, object_group, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'ObjectGroup', 'NotificationGroup')
(gauge32, mib_identifier, notification_type, unsigned32, counter32, time_ticks, object_identity, integer32, counter64, bits, module_identity, iso, ip_address, mib_scalar, mib_table, mib_table_row, mib_table_column) = mibBuilder.importSymbols('SNMPv2-SMI', 'Gauge32', 'MibIdentifier', 'NotificationType', 'Unsigned32', 'Counter32', 'TimeTicks', 'ObjectIdentity', 'Integer32', 'Counter64', 'Bits', 'ModuleIdentity', 'iso', 'IpAddress', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn')
(display_string, time_interval, mac_address, row_status, truth_value, textual_convention, time_stamp) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TimeInterval', 'MacAddress', 'RowStatus', 'TruthValue', 'TextualConvention', 'TimeStamp')
rdn_cmts_mib = module_identity((1, 3, 6, 1, 4, 1, 4981, 2))
rdnCmtsMib.setRevisions(('2011-03-08 00:00', '2011-02-23 00:00', '2009-11-20 00:00', '2008-08-08 00:00', '2007-06-21 00:00', '2006-05-25 00:00', '2006-05-24 00:00', '2006-04-17 00:00', '2006-01-25 00:00', '2006-01-23 00:00', '2006-01-13 00:00', '2005-03-18 00:00', '2005-02-22 00:00', '2004-08-17 00:00', '1904-04-14 00:00', '2003-12-16 00:00', '2003-11-05 00:00', '2003-11-03 00:00', '2003-07-20 00:00', '2003-05-01 00:00', '2000-04-03 00:00'))
if mibBuilder.loadTexts:
rdnCmtsMib.setLastUpdated('201103080000Z')
if mibBuilder.loadTexts:
rdnCmtsMib.setOrganization('Motorola')
rdn_cmts_if_objects = mib_identifier((1, 3, 6, 1, 4, 1, 4981, 2, 1))
rdn_cmts_misc_objects = mib_identifier((1, 3, 6, 1, 4, 1, 4981, 2, 2))
rdn_cmts_downstream_channel_table = mib_table((1, 3, 6, 1, 4, 1, 4981, 2, 1, 1))
if mibBuilder.loadTexts:
rdnCmtsDownstreamChannelTable.setStatus('current')
rdn_cmts_downstream_channel_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4981, 2, 1, 1, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'))
if mibBuilder.loadTexts:
rdnCmtsDownstreamChannelEntry.setStatus('current')
rdn_cmts_ds_modulation = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 1, 1, 1, 1), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnCmtsDSModulation.setStatus('current')
rdn_cmts_upstream_channel_table = mib_table((1, 3, 6, 1, 4, 1, 4981, 2, 1, 2))
if mibBuilder.loadTexts:
rdnCmtsUpstreamChannelTable.setStatus('current')
rdn_cmts_upstream_channel_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4981, 2, 1, 2, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'))
if mibBuilder.loadTexts:
rdnCmtsUpstreamChannelEntry.setStatus('current')
rdn_cmts_us_nominal_rx_power = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 1, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(-160, 290))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnCmtsUSNominalRxPower.setStatus('current')
rdn_cmts_us_nominal_rx_power_mode = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 1, 2, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('default', 0), ('absolute', 1)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnCmtsUSNominalRxPowerMode.setStatus('current')
rdn_cmts_us_invited_ranging_interval = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 1, 2, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(0, 30000))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnCmtsUSInvitedRangingInterval.setStatus('current')
rdn_cmts_us_ranging_response_control = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 1, 2, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('normal', 0), ('override', 1)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnCmtsUSRangingResponseControl.setStatus('current')
rdn_cmts_us_ranging_power_override = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 1, 2, 1, 5), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnCmtsUSRangingPowerOverride.setStatus('current')
rdn_cmts_us_total_modem_count = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 1, 2, 1, 6), integer32().subtype(subtypeSpec=value_range_constraint(0, 2147483647))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnCmtsUSTotalModemCount.setStatus('current')
rdn_cmts_us_registered_modem_count = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 1, 2, 1, 7), integer32().subtype(subtypeSpec=value_range_constraint(0, 2147483647))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnCmtsUSRegisteredModemCount.setStatus('current')
rdn_cmts_us_unregistered_modem_count = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 1, 2, 1, 8), integer32().subtype(subtypeSpec=value_range_constraint(0, 2147483647))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnCmtsUSUnregisteredModemCount.setStatus('current')
rdn_cmts_us_offline_modem_count = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 1, 2, 1, 9), integer32().subtype(subtypeSpec=value_range_constraint(0, 2147483647))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnCmtsUSOfflineModemCount.setStatus('current')
rdn_cmts_stp_objects = mib_identifier((1, 3, 6, 1, 4, 1, 4981, 2, 1, 3))
rdn_cmts_stp_enable = mib_scalar((1, 3, 6, 1, 4, 1, 4981, 2, 1, 3, 1), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnCmtsStpEnable.setStatus('current')
rdn_cmts_stp_tcn_enable = mib_scalar((1, 3, 6, 1, 4, 1, 4981, 2, 1, 3, 2), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnCmtsStpTCNEnable.setStatus('current')
rdn_cmts_link_up_down_trap_enable_table = mib_table((1, 3, 6, 1, 4, 1, 4981, 2, 1, 4))
if mibBuilder.loadTexts:
rdnCmtsLinkUpDownTrapEnableTable.setStatus('current')
rdn_cmts_link_up_down_trap_enable_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4981, 2, 1, 4, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'))
if mibBuilder.loadTexts:
rdnCmtsLinkUpDownTrapEnableEntry.setStatus('current')
rdn_cmts_link_up_down_trap_enable = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 1, 4, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone('disabled')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnCmtsLinkUpDownTrapEnable.setStatus('current')
rdn_cmts_save_config = mib_scalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 1), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnCmtsSaveConfig.setStatus('current')
rdn_cmts_cm_reset_by_mac_addr = mib_scalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 2), mac_address()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnCmtsCmResetByMacAddr.setStatus('current')
rdn_cmts_cm_reset_by_ip_addr = mib_scalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 3), ip_address()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnCmtsCmResetByIpAddr.setStatus('current')
rdn_cmts_cm_reset_all = mib_scalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 4), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnCmtsCmResetAll.setStatus('current')
rdn_cmts_host_auth_control = mib_scalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 5), octet_string().subtype(subtypeSpec=value_size_constraint(17, 17)).setFixedLength(17)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnCmtsHostAuthControl.setStatus('obsolete')
rdn_cmts_modem_aging_timer = mib_scalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 6), integer32().subtype(subtypeSpec=constraints_union(value_range_constraint(0, 0), value_range_constraint(10, 30240)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnCmtsModemAgingTimer.setStatus('current')
rdn_cmts_cpe_to_cm_object = mib_identifier((1, 3, 6, 1, 4, 1, 4981, 2, 2, 7))
rdn_cmts_cpe_to_cm_table = mib_table((1, 3, 6, 1, 4, 1, 4981, 2, 2, 7, 1))
if mibBuilder.loadTexts:
rdnCmtsCpeToCmTable.setStatus('current')
rdn_cmts_cpe_to_cm_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4981, 2, 2, 7, 1, 1)).setIndexNames((0, 'RDN-CMTS-MIB', 'rdnCmtsCpeMac'))
if mibBuilder.loadTexts:
rdnCmtsCpeToCmEntry.setStatus('current')
rdn_cmts_cpe_mac = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 7, 1, 1, 1), mac_address())
if mibBuilder.loadTexts:
rdnCmtsCpeMac.setStatus('current')
rdn_cmts_cm_mac = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 7, 1, 1, 2), mac_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnCmtsCmMac.setStatus('current')
rdn_if_cmts_cm_status_table = mib_table((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8))
if mibBuilder.loadTexts:
rdnIfCmtsCmStatusTable.setStatus('current')
rdn_if_cmts_cm_status_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1))
docsIfCmtsCmStatusEntry.registerAugmentions(('RDN-CMTS-MIB', 'rdnIfCmtsCmStatusEntry'))
rdnIfCmtsCmStatusEntry.setIndexNames(*docsIfCmtsCmStatusEntry.getIndexNames())
if mibBuilder.loadTexts:
rdnIfCmtsCmStatusEntry.setStatus('current')
rdn_if_cmts_cm_status_registration_time = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsCmStatusRegistrationTime.setStatus('current')
rdn_if_cmts_cm_status_tx_unicast_kbytes = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsCmStatusTxUnicastKbytes.setStatus('current')
rdn_if_cmts_cm_status_rx_unicast_kbytes = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsCmStatusRxUnicastKbytes.setStatus('current')
rdn_if_cmts_cm_status_tx_unicast_ext_kbytes = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 4), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsCmStatusTxUnicastExtKbytes.setStatus('current')
rdn_if_cmts_cm_status_rx_unicast_ext_kbytes = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 5), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsCmStatusRxUnicastExtKbytes.setStatus('current')
rdn_if_cmts_cm_status_spectrum_group_name = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 6), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsCmStatusSpectrumGroupName.setStatus('current')
rdn_if_cmts_cm_status_upstream_port = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 7), integer32().subtype(subtypeSpec=value_range_constraint(0, 7))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsCmStatusUpstreamPort.setStatus('current')
rdn_if_cmts_cm_status_down_stream_port = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 8), integer32().subtype(subtypeSpec=value_range_constraint(0, 7))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsCmStatusDownStreamPort.setStatus('current')
rdn_if_cmts_cm_status_value = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20))).clone(namedValues=named_values(('init-o', 1), ('init-t', 2), ('init-r1', 3), ('init-r2', 4), ('init-rc', 5), ('dhcp-d', 6), ('dhcp-o', 7), ('dhcp-req', 8), ('dhcp-ack', 9), ('online', 10), ('online-d', 11), ('online-un', 12), ('online-pk', 13), ('online-pt', 14), ('reject-m', 15), ('reject-c', 16), ('reject-r', 17), ('reject-pk', 18), ('reject-pt', 19), ('offline', 20)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsCmStatusValue.setStatus('current')
rdn_if_cmts_cm_status_ds_bonding_group_id = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 10), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsCmStatusDSBondingGroupId.setStatus('current')
rdn_if_cmts_cm_status_online_times = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 11), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsCmStatusOnlineTimes.setStatus('current')
rdn_if_cmts_cm_status_percent_online = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 12), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsCmStatusPercentOnline.setStatus('current')
rdn_if_cmts_cm_status_min_online_time = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 13), time_interval()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsCmStatusMinOnlineTime.setStatus('current')
rdn_if_cmts_cm_status_avg_online_time = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 14), time_interval()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsCmStatusAvgOnlineTime.setStatus('current')
rdn_if_cmts_cm_status_max_online_time = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 15), time_interval()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsCmStatusMaxOnlineTime.setStatus('current')
rdn_if_cmts_cm_status_min_offline_time = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 16), time_interval()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsCmStatusMinOfflineTime.setStatus('current')
rdn_if_cmts_cm_status_avg_offline_time = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 17), time_interval()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsCmStatusAvgOfflineTime.setStatus('current')
rdn_if_cmts_cm_status_max_offline_time = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 8, 1, 18), time_interval()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsCmStatusMaxOfflineTime.setStatus('current')
rdn_modem_dereg_reason = mib_scalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23))).clone(namedValues=named_values(('normal', 1), ('operatorReset', 2), ('operatorDisabled', 3), ('operatorDeleted', 4), ('transmissionFailed', 5), ('transmissionDisabled', 6), ('transmissionDeleted', 7), ('servingGroupChanged', 8), ('receiverFailed', 9), ('receiverDisabled', 10), ('receiverDeleted', 11), ('channelDeleted', 12), ('channelErrors', 13), ('incompleteReg', 14), ('profileUpdateComplete', 15), ('skeyFailure', 16), ('dnChanChangeFailure', 17), ('noDeregReason', 18), ('powerTolerance', 19), ('freqTolerance', 20), ('timingTolerance', 21), ('rangingTolerance', 22), ('noResponseUCC', 23)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnModemDeregReason.setStatus('current')
rdn_modem_reg_index = mib_scalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 11), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnModemRegIndex.setStatus('current')
rdn_cm_to_cpe_table = mib_table((1, 3, 6, 1, 4, 1, 4981, 2, 2, 12))
if mibBuilder.loadTexts:
rdnCmToCpeTable.setStatus('current')
rdn_cm_to_cpe_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4981, 2, 2, 12, 1)).setIndexNames((0, 'DOCS-IF-MIB', 'docsIfCmtsCmStatusIndex'), (0, 'RDN-CMTS-MIB', 'rdnCmToCpeIndex'))
if mibBuilder.loadTexts:
rdnCmToCpeEntry.setStatus('current')
rdn_cm_to_cpe_index = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 12, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647)))
if mibBuilder.loadTexts:
rdnCmToCpeIndex.setStatus('current')
rdn_cm_to_cpe_mac_address = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 12, 1, 2), mac_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnCmToCpeMacAddress.setStatus('current')
rdn_cm_to_cpe_ip_address = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 12, 1, 3), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnCmToCpeIpAddress.setStatus('current')
rdn_cm_to_cpe_i_pv6_addr = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 12, 1, 4), inet_address_i_pv6()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnCmToCpeIPv6Addr.setStatus('current')
rdn_cmts_cm_registered_trap_enable = mib_scalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 13), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone('enabled')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnCmtsCmRegisteredTrapEnable.setStatus('current')
rdn_cmts_card_type = mib_scalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 14), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('domestic', 1), ('japan', 2))).clone('domestic')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnCmtsCardType.setStatus('current')
rdn_r_query_cmts_cm_status_table = mib_table((1, 3, 6, 1, 4, 1, 4981, 2, 2, 15))
if mibBuilder.loadTexts:
rdnRQueryCmtsCmStatusTable.setStatus('current')
rdn_r_query_cmts_cm_status_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4981, 2, 2, 15, 1)).setIndexNames((0, 'DOCS-IF-MIB', 'docsIfCmtsCmStatusIndex'))
if mibBuilder.loadTexts:
rdnRQueryCmtsCmStatusEntry.setStatus('current')
rdn_r_query_cmts_cm_down_channel_power = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 15, 1, 1), tenthd_bm_v()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnRQueryCmtsCmDownChannelPower.setStatus('current')
rdn_r_query_cm_status_tx_power = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 15, 1, 2), tenthd_bm_v()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnRQueryCmStatusTxPower.setStatus('current')
rdn_r_query_up_channel_tx_timing_offset = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 15, 1, 3), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnRQueryUpChannelTxTimingOffset.setStatus('current')
rdn_r_query_sig_q_signal_noise = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 15, 1, 4), tenthd_b()).setUnits('dB').setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnRQuerySigQSignalNoise.setStatus('current')
rdn_r_query_sig_q_microreflections = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 15, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setUnits('dBc').setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnRQuerySigQMicroreflections.setStatus('current')
rdn_r_query_poll_time = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 15, 1, 6), time_stamp()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnRQueryPollTime.setStatus('current')
rdn_cmts_service_class_objects = mib_identifier((1, 3, 6, 1, 4, 1, 4981, 2, 2, 19))
rdn_cmts_service_class_table = mib_table((1, 3, 6, 1, 4, 1, 4981, 2, 2, 19, 1))
if mibBuilder.loadTexts:
rdnCmtsServiceClassTable.setStatus('current')
rdn_cmts_service_class_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4981, 2, 2, 19, 1, 1)).setIndexNames((0, 'RDN-CMTS-MIB', 'rdnCmtsServiceClassName'))
if mibBuilder.loadTexts:
rdnCmtsServiceClassEntry.setStatus('current')
rdn_cmts_service_class_name = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 19, 1, 1, 1), display_string().subtype(subtypeSpec=value_size_constraint(1, 15)))
if mibBuilder.loadTexts:
rdnCmtsServiceClassName.setStatus('current')
rdn_cmts_service_class_mab = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 19, 1, 1, 2), unsigned32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnCmtsServiceClassMab.setStatus('current')
rdn_cmts_service_class_cap = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 19, 1, 1, 3), unsigned32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnCmtsServiceClassCap.setStatus('current')
rdn_cmts_service_class_scheduling_priority = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 19, 1, 1, 4), unsigned32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnCmtsServiceClassSchedulingPriority.setStatus('current')
rdn_cmts_service_class_admitted_bw_threshold = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 19, 1, 1, 5), unsigned32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnCmtsServiceClassAdmittedBWThreshold.setStatus('current')
rdn_cmts_service_class_allow_share = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 19, 1, 1, 6), truth_value().clone('false')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnCmtsServiceClassAllowShare.setStatus('current')
rdn_ugs_stats_window = mib_scalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 16), integer32().subtype(subtypeSpec=constraints_union(value_range_constraint(0, 0), value_range_constraint(5, 120))).clone(60)).setUnits('minutes').setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnUgsStatsWindow.setStatus('current')
rdn_cable_ugs_stats_table = mib_table((1, 3, 6, 1, 4, 1, 4981, 2, 2, 17))
if mibBuilder.loadTexts:
rdnCableUgsStatsTable.setStatus('current')
rdn_cable_ugs_stats_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4981, 2, 2, 17, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'))
if mibBuilder.loadTexts:
rdnCableUgsStatsEntry.setStatus('current')
rdn_cable_ugs_stats_slot = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 17, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 15))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnCableUgsStatsSlot.setStatus('current')
rdn_cable_ugs_stats_port = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 17, 1, 2), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnCableUgsStatsPort.setStatus('current')
rdn_cable_ugs_current_total_flows = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 17, 1, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnCableUgsCurrentTotalFlows.setStatus('current')
rdn_cable_ugs_max_flows_last_five_minutes = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 17, 1, 4), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnCableUgsMaxFlowsLastFiveMinutes.setStatus('current')
rdn_cable_ugs_av_flows_last_five_minutes = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 17, 1, 5), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnCableUgsAvFlowsLastFiveMinutes.setStatus('current')
rdn_cable_ugs_min_flows_last_five_minutes = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 17, 1, 6), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnCableUgsMinFlowsLastFiveMinutes.setStatus('current')
rdn_cable_ugs_max_flows_last_window = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 17, 1, 7), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnCableUgsMaxFlowsLastWindow.setStatus('current')
rdn_cable_ugs_av_flows_last_window = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 17, 1, 8), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnCableUgsAvFlowsLastWindow.setStatus('current')
rdn_cable_ugs_min_flows_last_window = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 17, 1, 9), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnCableUgsMinFlowsLastWindow.setStatus('current')
rdn_cable_ugs_reset_stats = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 17, 1, 10), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnCableUgsResetStats.setStatus('current')
rdn_service_class_stats_table = mib_table((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18))
if mibBuilder.loadTexts:
rdnServiceClassStatsTable.setStatus('current')
rdn_service_class_stats_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'), (0, 'DOCS-QOS3-MIB', 'docsQosServiceClassName'))
if mibBuilder.loadTexts:
rdnServiceClassStatsEntry.setStatus('current')
rdn_service_class_stats_if_direction = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18, 1, 1), if_direction()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnServiceClassStatsIfDirection.setStatus('current')
rdn_service_class_stats_slot = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(0, 15))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnServiceClassStatsSlot.setStatus('current')
rdn_service_class_stats_port = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18, 1, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnServiceClassStatsPort.setStatus('current')
rdn_service_class_stats_total_packets = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnServiceClassStatsTotalPackets.setStatus('current')
rdn_service_class_stats_total_bytes = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnServiceClassStatsTotalBytes.setStatus('current')
rdn_service_class_current_total_flows = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18, 1, 6), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnServiceClassCurrentTotalFlows.setStatus('current')
rdn_service_class_deferred_flows = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18, 1, 7), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnServiceClassDeferredFlows.setStatus('current')
rdn_service_class_restricted_flows = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18, 1, 8), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnServiceClassRestrictedFlows.setStatus('current')
rdn_service_class_rejected_flows = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18, 1, 9), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnServiceClassRejectedFlows.setStatus('current')
rdn_service_class_band_width = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18, 1, 10), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnServiceClassBandWidth.setStatus('current')
rdn_service_class_reset_stats = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 18, 1, 11), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnServiceClassResetStats.setStatus('current')
rdn_r_query_cmts_cm_status_ext_table = mib_table((1, 3, 6, 1, 4, 1, 4981, 2, 2, 20))
if mibBuilder.loadTexts:
rdnRQueryCmtsCmStatusExtTable.setStatus('current')
rdn_r_query_cmts_cm_status_ext_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4981, 2, 2, 20, 1))
rdnRQueryCmtsCmStatusEntry.registerAugmentions(('RDN-CMTS-MIB', 'rdnRQueryCmtsCmStatusExtEntry'))
rdnRQueryCmtsCmStatusExtEntry.setIndexNames(*rdnRQueryCmtsCmStatusEntry.getIndexNames())
if mibBuilder.loadTexts:
rdnRQueryCmtsCmStatusExtEntry.setStatus('current')
rdn_r_query_sw_current_vers = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 20, 1, 1), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnRQuerySwCurrentVers.setStatus('current')
rdn_r_query_server_config_file = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 20, 1, 2), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnRQueryServerConfigFile.setStatus('current')
rdn_if_cmts_cm_table = mib_table((1, 3, 6, 1, 4, 1, 4981, 2, 2, 21))
if mibBuilder.loadTexts:
rdnIfCmtsCmTable.setStatus('current')
rdn_if_cmts_cm_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4981, 2, 2, 21, 1))
docsIfCmtsCmStatusEntry.registerAugmentions(('RDN-CMTS-MIB', 'rdnIfCmtsCmEntry'))
rdnIfCmtsCmEntry.setIndexNames(*docsIfCmtsCmStatusEntry.getIndexNames())
if mibBuilder.loadTexts:
rdnIfCmtsCmEntry.setStatus('current')
rdn_if_cmts_cm_max_cpe_number = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 21, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnIfCmtsCmMaxCpeNumber.setStatus('current')
rdn_if_cmts_cm_curr_cpe_number = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 21, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsCmCurrCpeNumber.setStatus('current')
rdn_if_cmts_mta_only_status_table = mib_table((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23))
if mibBuilder.loadTexts:
rdnIfCmtsMTAOnlyStatusTable.setStatus('current')
rdn_if_cmts_mta_only_status_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1)).setIndexNames((0, 'RDN-CMTS-MIB', 'rdnIfCmtsMTAOnlyStatusIndex'))
if mibBuilder.loadTexts:
rdnIfCmtsMTAOnlyStatusEntry.setStatus('current')
rdn_if_cmts_mta_only_status_index = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647)))
if mibBuilder.loadTexts:
rdnIfCmtsMTAOnlyStatusIndex.setStatus('current')
rdn_if_cmts_mta_only_status_mac_address = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 2), mac_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsMTAOnlyStatusMacAddress.setStatus('current')
rdn_if_cmts_mta_only_status_ip_address = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 3), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsMTAOnlyStatusIpAddress.setStatus('deprecated')
rdn_if_cmts_mta_only_status_down_channel_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 4), interface_index_or_zero()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsMTAOnlyStatusDownChannelIfIndex.setStatus('current')
rdn_if_cmts_mta_only_status_up_channel_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 5), interface_index_or_zero()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsMTAOnlyStatusUpChannelIfIndex.setStatus('current')
rdn_if_cmts_mta_only_status_rx_power = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 6), tenthd_bm_v()).setUnits('dBmV').setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsMTAOnlyStatusRxPower.setStatus('current')
rdn_if_cmts_mta_only_status_timing_offset = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 7), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsMTAOnlyStatusTimingOffset.setStatus('current')
rdn_if_cmts_mta_only_status_equalization_data = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 8), octet_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsMTAOnlyStatusEqualizationData.setStatus('current')
rdn_if_cmts_mta_only_status_value = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9))).clone(namedValues=named_values(('other', 1), ('ranging', 2), ('rangingAborted', 3), ('rangingComplete', 4), ('ipComplete', 5), ('registrationComplete', 6), ('accessDenied', 7), ('operational', 8), ('registeredBPIInitializing', 9)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsMTAOnlyStatusValue.setStatus('current')
rdn_if_cmts_mta_only_status_unerroreds = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 10), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsMTAOnlyStatusUnerroreds.setStatus('current')
rdn_if_cmts_mta_only_status_correcteds = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 11), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsMTAOnlyStatusCorrecteds.setStatus('current')
rdn_if_cmts_mta_only_status_uncorrectables = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 12), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsMTAOnlyStatusUncorrectables.setStatus('current')
rdn_if_cmts_mta_only_status_signal_noise = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 13), tenthd_b()).setUnits('dB').setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsMTAOnlyStatusSignalNoise.setStatus('current')
rdn_if_cmts_mta_only_status_microreflections = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 14), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setUnits('dBc').setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsMTAOnlyStatusMicroreflections.setStatus('current')
rdn_if_cmts_mta_only_status_ext_unerroreds = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 15), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsMTAOnlyStatusExtUnerroreds.setStatus('current')
rdn_if_cmts_mta_only_status_ext_correcteds = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 16), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsMTAOnlyStatusExtCorrecteds.setStatus('current')
rdn_if_cmts_mta_only_status_ext_uncorrectables = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 17), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsMTAOnlyStatusExtUncorrectables.setStatus('current')
rdn_if_cmts_mta_only_status_docsis_reg_mode = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 18), docsis_qos_version()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsMTAOnlyStatusDocsisRegMode.setStatus('current')
rdn_if_cmts_mta_only_status_modulation_type = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 19), docsis_upstream_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsMTAOnlyStatusModulationType.setStatus('current')
rdn_if_cmts_mta_only_status_inet_address_type = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 20), inet_address_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsMTAOnlyStatusInetAddressType.setStatus('current')
rdn_if_cmts_mta_only_status_inet_address = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 21), inet_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsMTAOnlyStatusInetAddress.setStatus('current')
rdn_if_cmts_mta_only_status_value_last_update = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 23, 1, 22), time_stamp()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsMTAOnlyStatusValueLastUpdate.setStatus('current')
rdn_service_class_bonding_stats_table = mib_table((1, 3, 6, 1, 4, 1, 4981, 2, 2, 24))
if mibBuilder.loadTexts:
rdnServiceClassBondingStatsTable.setStatus('current')
rdn_service_class_bonding_stats_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4981, 2, 2, 24, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'), (0, 'RDN-CMTS-MIB', 'rdnServiceClassBondingStatsIfDirection'), (0, 'DOCS-QOS3-MIB', 'docsQosServiceClassName'), (0, 'RDN-CMTS-MIB', 'rdnServiceClassBondingStatsMacIfIndex'), (0, 'RDN-CMTS-MIB', 'rdnServiceClassBondingStatsGroupId'))
if mibBuilder.loadTexts:
rdnServiceClassBondingStatsEntry.setStatus('current')
rdn_service_class_bonding_stats_mac_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 24, 1, 1), interface_index())
if mibBuilder.loadTexts:
rdnServiceClassBondingStatsMacIfIndex.setStatus('current')
rdn_service_class_bonding_stats_group_id = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 24, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535)))
if mibBuilder.loadTexts:
rdnServiceClassBondingStatsGroupId.setStatus('current')
rdn_service_class_bonding_stats_if_direction = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 24, 1, 3), if_direction())
if mibBuilder.loadTexts:
rdnServiceClassBondingStatsIfDirection.setStatus('current')
rdn_service_class_bonding_stats_slot = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 24, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(0, 15))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnServiceClassBondingStatsSlot.setStatus('current')
rdn_service_class_bonding_stats_chan = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 24, 1, 5), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnServiceClassBondingStatsChan.setStatus('current')
rdn_service_class_bonding_current_total_flows = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 24, 1, 6), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnServiceClassBondingCurrentTotalFlows.setStatus('current')
rdn_service_class_bonding_deferred_flows = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 24, 1, 7), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnServiceClassBondingDeferredFlows.setStatus('current')
rdn_service_class_bonding_restricted_flows = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 24, 1, 8), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnServiceClassBondingRestrictedFlows.setStatus('current')
rdn_service_class_bonding_rejected_flows = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 24, 1, 9), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnServiceClassBondingRejectedFlows.setStatus('current')
rdn_service_class_bonding_band_width = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 24, 1, 10), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnServiceClassBondingBandWidth.setStatus('current')
rdn_cmts_cm_reset_by_ipv6_addr = mib_scalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 25), inet_address_i_pv6()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rdnCmtsCmResetByIpv6Addr.setStatus('current')
rdn_cmts_mib_notifications = mib_identifier((1, 3, 6, 1, 4, 1, 4981, 2, 4))
rdn_cmts_mib_notification_prefix = mib_identifier((1, 3, 6, 1, 4, 1, 4981, 2, 4, 0))
rdn_cmts_mib_notification_objects = mib_identifier((1, 3, 6, 1, 4, 1, 4981, 2, 4, 1))
rdn_cmts_cm_registered_notification = notification_type((1, 3, 6, 1, 4, 1, 4981, 2, 4, 0, 1)).setObjects(('DOCS-IF-MIB', 'docsIfCmtsCmStatusDocsisRegMode'), ('DOCS-IF-MIB', 'docsIfCmtsCmStatusMacAddress'), ('DOCS-IF-MIB', 'docsIfCmtsCmStatusIpAddress'), ('DOCS-IF3-MIB', 'docsIf3CmtsCmRegStatusIPv6Addr'), ('DOCS-IF-MIB', 'docsIfUpChannelId'), ('DOCS-IF-MIB', 'docsIfDownChannelId'), ('RDN-CMTS-MIB', 'rdnModemRegIndex'), ('RDN-CABLE-SPECTRUM-GROUP-MIB', 'rdnSpectrumGroupName'))
if mibBuilder.loadTexts:
rdnCmtsCmRegisteredNotification.setStatus('current')
rdn_cmts_cm_deregistered_notification = notification_type((1, 3, 6, 1, 4, 1, 4981, 2, 4, 0, 2)).setObjects(('DOCS-IF-MIB', 'docsIfCmtsCmStatusDocsisRegMode'), ('DOCS-IF-MIB', 'docsIfCmtsCmStatusMacAddress'), ('DOCS-IF-MIB', 'docsIfUpChannelId'), ('DOCS-IF-MIB', 'docsIfDownChannelId'), ('RDN-CMTS-MIB', 'rdnModemRegIndex'), ('RDN-CMTS-MIB', 'rdnModemDeregReason'), ('RDN-CABLE-SPECTRUM-GROUP-MIB', 'rdnSpectrumGroupName'))
if mibBuilder.loadTexts:
rdnCmtsCmDeregisteredNotification.setStatus('current')
rdn_cmts_upstream_if_link_up_trap = notification_type((1, 3, 6, 1, 4, 1, 4981, 2, 4, 0, 3)).setObjects(('IF-MIB', 'ifIndex'), ('IF-MIB', 'ifDescr'), ('IF-MIB', 'ifType'), ('IF-MIB', 'ifAdminStatus'), ('IF-MIB', 'ifOperStatus'), ('RDN-CABLE-SPECTRUM-GROUP-MIB', 'rdnSpectrumGroupName'))
if mibBuilder.loadTexts:
rdnCmtsUpstreamIfLinkUpTrap.setStatus('current')
rdn_cmts_upstream_if_link_down_trap = notification_type((1, 3, 6, 1, 4, 1, 4981, 2, 4, 0, 4)).setObjects(('IF-MIB', 'ifIndex'), ('IF-MIB', 'ifDescr'), ('IF-MIB', 'ifType'), ('IF-MIB', 'ifAdminStatus'), ('IF-MIB', 'ifOperStatus'), ('RDN-CABLE-SPECTRUM-GROUP-MIB', 'rdnSpectrumGroupName'))
if mibBuilder.loadTexts:
rdnCmtsUpstreamIfLinkDownTrap.setStatus('current')
rdn_r_query_poll_done_notification = notification_type((1, 3, 6, 1, 4, 1, 4981, 2, 4, 0, 5)).setObjects(('RDN-CMTS-MIB', 'rdnRQueryLastPollStartTime'), ('RDN-CMTS-MIB', 'rdnRQueryLastPollStopTime'))
if mibBuilder.loadTexts:
rdnRQueryPollDoneNotification.setStatus('current')
rdn_pkt_d_qo_s_admitted_bw_threshold_trap = notification_type((1, 3, 6, 1, 4, 1, 4981, 2, 4, 0, 6)).setObjects(('RDN-CMTS-MIB', 'rdnPktDQoSAdmittedBwThresholdReason'), ('RDN-PKTCABLE-GROUP-MIB', 'rdnPktDQoSClassName'))
if mibBuilder.loadTexts:
rdnPktDQoSAdmittedBwThresholdTrap.setStatus('current')
rdn_r_query_last_poll_start_time = mib_scalar((1, 3, 6, 1, 4, 1, 4981, 2, 4, 1, 1), time_stamp()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnRQueryLastPollStartTime.setStatus('current')
rdn_r_query_last_poll_stop_time = mib_scalar((1, 3, 6, 1, 4, 1, 4981, 2, 4, 1, 2), time_stamp()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnRQueryLastPollStopTime.setStatus('current')
rdn_pkt_d_qo_s_admitted_bw_threshold_reason = mib_scalar((1, 3, 6, 1, 4, 1, 4981, 2, 4, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('admittedBwExceedsThreshold', 1), ('admittedBwClearsOfThreshold', 2)))).setMaxAccess('accessiblefornotify')
if mibBuilder.loadTexts:
rdnPktDQoSAdmittedBwThresholdReason.setStatus('current')
rdn_cmts_mib_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 4981, 2, 5))
rdn_cmts_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 4981, 2, 5, 1))
rdn_cmts_mib_groups = mib_identifier((1, 3, 6, 1, 4, 1, 4981, 2, 5, 2))
rdn_cmts_mib_compliance = module_compliance((1, 3, 6, 1, 4, 1, 4981, 2, 5, 1, 1)).setObjects(('RDN-CMTS-MIB', 'rdnCmtsIfGroup'), ('RDN-CMTS-MIB', 'rdnCmtsMiscGroup'), ('RDN-CMTS-MIB', 'rdnCmtsNotificationsGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
rdn_cmts_mib_compliance = rdnCmtsMibCompliance.setStatus('current')
rdn_cmts_if_group = object_group((1, 3, 6, 1, 4, 1, 4981, 2, 5, 2, 1)).setObjects(('RDN-CMTS-MIB', 'rdnCmtsDSModulation'), ('RDN-CMTS-MIB', 'rdnCmtsUSNominalRxPower'), ('RDN-CMTS-MIB', 'rdnCmtsUSInvitedRangingInterval'), ('RDN-CMTS-MIB', 'rdnCmtsUSRangingResponseControl'), ('RDN-CMTS-MIB', 'rdnCmtsUSRangingPowerOverride'), ('RDN-CMTS-MIB', 'rdnCmtsUSNominalRxPowerMode'), ('RDN-CMTS-MIB', 'rdnCmtsStpTCNEnable'), ('RDN-CMTS-MIB', 'rdnCmtsLinkUpDownTrapEnable'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
rdn_cmts_if_group = rdnCmtsIfGroup.setStatus('current')
rdn_cmts_misc_group = object_group((1, 3, 6, 1, 4, 1, 4981, 2, 5, 2, 2)).setObjects(('RDN-CMTS-MIB', 'rdnCmtsSaveConfig'), ('RDN-CMTS-MIB', 'rdnCmtsCmResetByMacAddr'), ('RDN-CMTS-MIB', 'rdnCmtsCmResetByIpAddr'), ('RDN-CMTS-MIB', 'rdnCmtsCmResetAll'), ('RDN-CMTS-MIB', 'rdnCmtsModemAgingTimer'), ('RDN-CMTS-MIB', 'rdnCmtsCmMac'), ('RDN-CMTS-MIB', 'rdnIfCmtsCmStatusRegistrationTime'), ('RDN-CMTS-MIB', 'rdnIfCmtsCmStatusTxUnicastKbytes'), ('RDN-CMTS-MIB', 'rdnIfCmtsCmStatusRxUnicastKbytes'), ('RDN-CMTS-MIB', 'rdnIfCmtsCmStatusTxUnicastExtKbytes'), ('RDN-CMTS-MIB', 'rdnIfCmtsCmStatusRxUnicastExtKbytes'), ('RDN-CMTS-MIB', 'rdnIfCmtsCmStatusSpectrumGroupName'), ('RDN-CMTS-MIB', 'rdnIfCmtsCmStatusUpstreamPort'), ('RDN-CMTS-MIB', 'rdnIfCmtsCmStatusDownStreamPort'), ('RDN-CMTS-MIB', 'rdnIfCmtsCmStatusValue'), ('RDN-CMTS-MIB', 'rdnIfCmtsCmStatusDSBondingGroupId'), ('RDN-CMTS-MIB', 'rdnIfCmtsCmStatusOnlineTimes'), ('RDN-CMTS-MIB', 'rdnIfCmtsCmStatusPercentOnline'), ('RDN-CMTS-MIB', 'rdnIfCmtsCmStatusMinOnlineTime'), ('RDN-CMTS-MIB', 'rdnIfCmtsCmStatusAvgOnlineTime'), ('RDN-CMTS-MIB', 'rdnIfCmtsCmStatusMaxOnlineTime'), ('RDN-CMTS-MIB', 'rdnIfCmtsCmStatusMinOfflineTime'), ('RDN-CMTS-MIB', 'rdnIfCmtsCmStatusAvgOfflineTime'), ('RDN-CMTS-MIB', 'rdnIfCmtsCmStatusMaxOfflineTime'), ('RDN-CMTS-MIB', 'rdnModemDeregReason'), ('RDN-CMTS-MIB', 'rdnModemRegIndex'), ('RDN-CMTS-MIB', 'rdnCmToCpeMacAddress'), ('RDN-CMTS-MIB', 'rdnCmToCpeIpAddress'), ('RDN-CMTS-MIB', 'rdnCmtsCmRegisteredTrapEnable'), ('RDN-CMTS-MIB', 'rdnCmtsCardType'), ('RDN-CMTS-MIB', 'rdnRQueryCmtsCmDownChannelPower'), ('RDN-CMTS-MIB', 'rdnRQueryCmStatusTxPower'), ('RDN-CMTS-MIB', 'rdnRQueryUpChannelTxTimingOffset'), ('RDN-CMTS-MIB', 'rdnRQuerySigQSignalNoise'), ('RDN-CMTS-MIB', 'rdnRQuerySigQMicroreflections'), ('RDN-CMTS-MIB', 'rdnRQueryPollTime'), ('RDN-CMTS-MIB', 'rdnUgsStatsWindow'), ('RDN-CMTS-MIB', 'rdnCableUgsStatsSlot'), ('RDN-CMTS-MIB', 'rdnCableUgsStatsPort'), ('RDN-CMTS-MIB', 'rdnCableUgsCurrentTotalFlows'), ('RDN-CMTS-MIB', 'rdnCableUgsMaxFlowsLastFiveMinutes'), ('RDN-CMTS-MIB', 'rdnCableUgsAvFlowsLastFiveMinutes'), ('RDN-CMTS-MIB', 'rdnCableUgsMinFlowsLastFiveMinutes'), ('RDN-CMTS-MIB', 'rdnCableUgsMaxFlowsLastWindow'), ('RDN-CMTS-MIB', 'rdnCableUgsAvFlowsLastWindow'), ('RDN-CMTS-MIB', 'rdnCableUgsMinFlowsLastWindow'), ('RDN-CMTS-MIB', 'rdnCableUgsResetStats'), ('RDN-CMTS-MIB', 'rdnServiceClassStatsIfDirection'), ('RDN-CMTS-MIB', 'rdnServiceClassStatsSlot'), ('RDN-CMTS-MIB', 'rdnServiceClassStatsPort'), ('RDN-CMTS-MIB', 'rdnServiceClassStatsTotalPackets'), ('RDN-CMTS-MIB', 'rdnServiceClassStatsTotalBytes'), ('RDN-CMTS-MIB', 'rdnServiceClassCurrentTotalFlows'), ('RDN-CMTS-MIB', 'rdnServiceClassDeferredFlows'), ('RDN-CMTS-MIB', 'rdnServiceClassRestrictedFlows'), ('RDN-CMTS-MIB', 'rdnServiceClassRejectedFlows'), ('RDN-CMTS-MIB', 'rdnServiceClassBandWidth'), ('RDN-CMTS-MIB', 'rdnServiceClassResetStats'), ('RDN-CMTS-MIB', 'rdnServiceClassBondingStatsSlot'), ('RDN-CMTS-MIB', 'rdnServiceClassBondingStatsChan'), ('RDN-CMTS-MIB', 'rdnServiceClassBondingCurrentTotalFlows'), ('RDN-CMTS-MIB', 'rdnServiceClassBondingDeferredFlows'), ('RDN-CMTS-MIB', 'rdnServiceClassBondingRestrictedFlows'), ('RDN-CMTS-MIB', 'rdnServiceClassBondingRejectedFlows'), ('RDN-CMTS-MIB', 'rdnServiceClassBondingBandWidth'), ('RDN-CMTS-MIB', 'rdnRQuerySwCurrentVers'), ('RDN-CMTS-MIB', 'rdnCmtsCmResetByIpv6Addr'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
rdn_cmts_misc_group = rdnCmtsMiscGroup.setStatus('current')
rdn_cmts_notifications_group = notification_group((1, 3, 6, 1, 4, 1, 4981, 2, 5, 2, 3)).setObjects(('RDN-CMTS-MIB', 'rdnCmtsCmRegisteredNotification'), ('RDN-CMTS-MIB', 'rdnCmtsCmDeregisteredNotification'), ('RDN-CMTS-MIB', 'rdnCmtsUpstreamIfLinkUpTrap'), ('RDN-CMTS-MIB', 'rdnCmtsUpstreamIfLinkDownTrap'), ('RDN-CMTS-MIB', 'rdnRQueryPollDoneNotification'), ('RDN-CMTS-MIB', 'rdnPktDQoSAdmittedBwThresholdTrap'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
rdn_cmts_notifications_group = rdnCmtsNotificationsGroup.setStatus('current')
rdn_cable_intercept_scalars = mib_identifier((1, 3, 6, 1, 4, 1, 4981, 2, 2, 26))
rdn_cable_intercept_access_permitted = mib_scalar((1, 3, 6, 1, 4, 1, 4981, 2, 2, 26, 1), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnCableInterceptAccessPermitted.setStatus('current')
rdn_cable_intercept_table = mib_table((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27))
if mibBuilder.loadTexts:
rdnCableInterceptTable.setStatus('current')
rdn_cable_intercept_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'), (0, 'RDN-CMTS-MIB', 'rdnCableInterceptCpeMac'))
if mibBuilder.loadTexts:
rdnCableInterceptEntry.setStatus('current')
rdn_cable_intercept_cpe_mac = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 1), mac_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
rdnCableInterceptCpeMac.setStatus('current')
rdn_cable_intercept_cm_mac = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 2), mac_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
rdnCableInterceptCmMac.setStatus('current')
rdn_cable_intercept_destination1_type = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 3), inet_address_type()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
rdnCableInterceptDestination1Type.setStatus('current')
rdn_cable_intercept_destination1_ip = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 4), inet_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
rdnCableInterceptDestination1Ip.setStatus('current')
rdn_cable_intercept_destination1_port = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 5), inet_port_number()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
rdnCableInterceptDestination1Port.setStatus('current')
rdn_cable_intercept_destination2_type = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 6), inet_address_type()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
rdnCableInterceptDestination2Type.setStatus('current')
rdn_cable_intercept_destination2_ip = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 7), inet_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
rdnCableInterceptDestination2Ip.setStatus('current')
rdn_cable_intercept_destination2_port = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 8), inet_port_number()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
rdnCableInterceptDestination2Port.setStatus('current')
rdn_cable_intercept_destination3_type = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 9), inet_address_type()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
rdnCableInterceptDestination3Type.setStatus('current')
rdn_cable_intercept_destination3_ip = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 10), inet_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
rdnCableInterceptDestination3Ip.setStatus('current')
rdn_cable_intercept_destination3_port = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 11), inet_port_number()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
rdnCableInterceptDestination3Port.setStatus('current')
rdn_cable_intercept_source_type = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 12), inet_address_type()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
rdnCableInterceptSourceType.setStatus('current')
rdn_cable_intercept_source_ip = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 13), inet_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
rdnCableInterceptSourceIp.setStatus('current')
rdn_cable_intercept_pkt_cnt = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 14), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnCableInterceptPktCnt.setStatus('current')
rdn_cable_intercept_byte_cnt = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 15), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnCableInterceptByteCnt.setStatus('current')
rdn_cable_intercept_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 27, 1, 16), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
rdnCableInterceptRowStatus.setStatus('current')
rdn_cmts_up_channel_counter_table = mib_table((1, 3, 6, 1, 4, 1, 4981, 2, 2, 28))
if mibBuilder.loadTexts:
rdnCmtsUpChannelCounterTable.setStatus('current')
rdn_cmts_up_channel_counter_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4981, 2, 2, 28, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'))
if mibBuilder.loadTexts:
rdnCmtsUpChannelCounterEntry.setStatus('current')
rdn_if_cmts_up_ch_ctr_req_noise = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 28, 1, 1), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsUpChCtrReqNoise.setStatus('current')
rdn_if_cmts_up_ch_ctr_req_no_energy = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 28, 1, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsUpChCtrReqNoEnergy.setStatus('current')
rdn_if_cmts_up_ch_ctr_ext_req_noise = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 28, 1, 3), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsUpChCtrExtReqNoise.setStatus('current')
rdn_if_cmts_up_ch_ctr_ext_req_no_energy = mib_table_column((1, 3, 6, 1, 4, 1, 4981, 2, 2, 28, 1, 4), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rdnIfCmtsUpChCtrExtReqNoEnergy.setStatus('current')
mibBuilder.exportSymbols('RDN-CMTS-MIB', rdnCmtsUpstreamIfLinkDownTrap=rdnCmtsUpstreamIfLinkDownTrap, rdnCableUgsAvFlowsLastFiveMinutes=rdnCableUgsAvFlowsLastFiveMinutes, rdnCableInterceptSourceIp=rdnCableInterceptSourceIp, rdnIfCmtsUpChCtrReqNoEnergy=rdnIfCmtsUpChCtrReqNoEnergy, rdnCmtsUpstreamChannelTable=rdnCmtsUpstreamChannelTable, rdnServiceClassStatsTotalBytes=rdnServiceClassStatsTotalBytes, rdnCableUgsMaxFlowsLastFiveMinutes=rdnCableUgsMaxFlowsLastFiveMinutes, rdnCmtsUpChannelCounterEntry=rdnCmtsUpChannelCounterEntry, rdnIfCmtsUpChCtrExtReqNoise=rdnIfCmtsUpChCtrExtReqNoise, rdnIfCmtsUpChCtrExtReqNoEnergy=rdnIfCmtsUpChCtrExtReqNoEnergy, rdnServiceClassStatsPort=rdnServiceClassStatsPort, rdnCableInterceptDestination3Ip=rdnCableInterceptDestination3Ip, rdnRQueryPollDoneNotification=rdnRQueryPollDoneNotification, rdnCableInterceptDestination2Ip=rdnCableInterceptDestination2Ip, rdnIfCmtsCmStatusTxUnicastExtKbytes=rdnIfCmtsCmStatusTxUnicastExtKbytes, rdnServiceClassBondingDeferredFlows=rdnServiceClassBondingDeferredFlows, rdnCableInterceptDestination2Type=rdnCableInterceptDestination2Type, rdnCmtsUSOfflineModemCount=rdnCmtsUSOfflineModemCount, rdnRQueryCmtsCmStatusExtTable=rdnRQueryCmtsCmStatusExtTable, rdnServiceClassStatsIfDirection=rdnServiceClassStatsIfDirection, rdnCmtsMibGroups=rdnCmtsMibGroups, rdnCmtsMiscObjects=rdnCmtsMiscObjects, rdnIfCmtsCmEntry=rdnIfCmtsCmEntry, rdnIfCmtsCmStatusTable=rdnIfCmtsCmStatusTable, rdnCmtsMibConformance=rdnCmtsMibConformance, rdnServiceClassBondingStatsIfDirection=rdnServiceClassBondingStatsIfDirection, rdnCmToCpeIPv6Addr=rdnCmToCpeIPv6Addr, rdnCmToCpeIpAddress=rdnCmToCpeIpAddress, rdnCmtsCmResetByIpv6Addr=rdnCmtsCmResetByIpv6Addr, rdnCmtsCmResetAll=rdnCmtsCmResetAll, rdnCableUgsAvFlowsLastWindow=rdnCableUgsAvFlowsLastWindow, rdnRQueryCmtsCmStatusEntry=rdnRQueryCmtsCmStatusEntry, rdnCableInterceptDestination3Type=rdnCableInterceptDestination3Type, rdnIfCmtsMTAOnlyStatusDocsisRegMode=rdnIfCmtsMTAOnlyStatusDocsisRegMode, rdnIfCmtsMTAOnlyStatusEntry=rdnIfCmtsMTAOnlyStatusEntry, rdnCmtsStpEnable=rdnCmtsStpEnable, rdnRQueryServerConfigFile=rdnRQueryServerConfigFile, rdnIfCmtsMTAOnlyStatusEqualizationData=rdnIfCmtsMTAOnlyStatusEqualizationData, rdnIfCmtsMTAOnlyStatusUnerroreds=rdnIfCmtsMTAOnlyStatusUnerroreds, rdnCableInterceptTable=rdnCableInterceptTable, rdnIfCmtsMTAOnlyStatusModulationType=rdnIfCmtsMTAOnlyStatusModulationType, rdnServiceClassBondingStatsTable=rdnServiceClassBondingStatsTable, rdnRQueryLastPollStartTime=rdnRQueryLastPollStartTime, rdnUgsStatsWindow=rdnUgsStatsWindow, rdnIfCmtsCmStatusMinOfflineTime=rdnIfCmtsCmStatusMinOfflineTime, rdnIfCmtsMTAOnlyStatusDownChannelIfIndex=rdnIfCmtsMTAOnlyStatusDownChannelIfIndex, rdnRQuerySigQSignalNoise=rdnRQuerySigQSignalNoise, rdnServiceClassStatsEntry=rdnServiceClassStatsEntry, rdnIfCmtsCmStatusMaxOnlineTime=rdnIfCmtsCmStatusMaxOnlineTime, rdnCmtsDownstreamChannelEntry=rdnCmtsDownstreamChannelEntry, rdnIfCmtsMTAOnlyStatusExtUnerroreds=rdnIfCmtsMTAOnlyStatusExtUnerroreds, rdnIfCmtsCmStatusAvgOnlineTime=rdnIfCmtsCmStatusAvgOnlineTime, rdnIfCmtsCmStatusSpectrumGroupName=rdnIfCmtsCmStatusSpectrumGroupName, rdnCmtsUSTotalModemCount=rdnCmtsUSTotalModemCount, rdnRQueryCmStatusTxPower=rdnRQueryCmStatusTxPower, rdnCmtsSaveConfig=rdnCmtsSaveConfig, rdnCmtsServiceClassName=rdnCmtsServiceClassName, rdnServiceClassBondingRestrictedFlows=rdnServiceClassBondingRestrictedFlows, rdnCmtsCpeMac=rdnCmtsCpeMac, rdnCmtsModemAgingTimer=rdnCmtsModemAgingTimer, rdnCmtsCmResetByIpAddr=rdnCmtsCmResetByIpAddr, rdnIfCmtsMTAOnlyStatusValueLastUpdate=rdnIfCmtsMTAOnlyStatusValueLastUpdate, rdnServiceClassBondingCurrentTotalFlows=rdnServiceClassBondingCurrentTotalFlows, rdnCmtsUpChannelCounterTable=rdnCmtsUpChannelCounterTable, rdnCmtsMib=rdnCmtsMib, rdnCmtsCmDeregisteredNotification=rdnCmtsCmDeregisteredNotification, rdnCmtsUpstreamChannelEntry=rdnCmtsUpstreamChannelEntry, rdnCmtsServiceClassAdmittedBWThreshold=rdnCmtsServiceClassAdmittedBWThreshold, rdnCableUgsMaxFlowsLastWindow=rdnCableUgsMaxFlowsLastWindow, rdnCmtsMibNotifications=rdnCmtsMibNotifications, rdnServiceClassStatsTable=rdnServiceClassStatsTable, rdnRQuerySwCurrentVers=rdnRQuerySwCurrentVers, rdnRQueryPollTime=rdnRQueryPollTime, rdnCableInterceptPktCnt=rdnCableInterceptPktCnt, rdnCmToCpeIndex=rdnCmToCpeIndex, rdnServiceClassBandWidth=rdnServiceClassBandWidth, rdnServiceClassRestrictedFlows=rdnServiceClassRestrictedFlows, rdnIfCmtsCmTable=rdnIfCmtsCmTable, rdnIfCmtsCmStatusValue=rdnIfCmtsCmStatusValue, rdnServiceClassBondingStatsSlot=rdnServiceClassBondingStatsSlot, rdnCmtsIfObjects=rdnCmtsIfObjects, rdnCmtsServiceClassCap=rdnCmtsServiceClassCap, rdnCmToCpeEntry=rdnCmToCpeEntry, rdnIfCmtsMTAOnlyStatusRxPower=rdnIfCmtsMTAOnlyStatusRxPower, rdnCmtsHostAuthControl=rdnCmtsHostAuthControl, rdnCableInterceptAccessPermitted=rdnCableInterceptAccessPermitted, rdnIfCmtsUpChCtrReqNoise=rdnIfCmtsUpChCtrReqNoise, rdnCmtsStpTCNEnable=rdnCmtsStpTCNEnable, rdnPktDQoSAdmittedBwThresholdTrap=rdnPktDQoSAdmittedBwThresholdTrap, rdnCmtsCmMac=rdnCmtsCmMac, rdnCableInterceptSourceType=rdnCableInterceptSourceType, PYSNMP_MODULE_ID=rdnCmtsMib, rdnCmtsLinkUpDownTrapEnableTable=rdnCmtsLinkUpDownTrapEnableTable, rdnIfCmtsMTAOnlyStatusTimingOffset=rdnIfCmtsMTAOnlyStatusTimingOffset, rdnIfCmtsMTAOnlyStatusMicroreflections=rdnIfCmtsMTAOnlyStatusMicroreflections, rdnModemRegIndex=rdnModemRegIndex, rdnIfCmtsCmStatusRxUnicastKbytes=rdnIfCmtsCmStatusRxUnicastKbytes, rdnIfCmtsCmStatusDownStreamPort=rdnIfCmtsCmStatusDownStreamPort, rdnServiceClassCurrentTotalFlows=rdnServiceClassCurrentTotalFlows, rdnCmtsNotificationsGroup=rdnCmtsNotificationsGroup, rdnCmtsUSNominalRxPower=rdnCmtsUSNominalRxPower, rdnIfCmtsMTAOnlyStatusInetAddressType=rdnIfCmtsMTAOnlyStatusInetAddressType, rdnCmtsLinkUpDownTrapEnable=rdnCmtsLinkUpDownTrapEnable, rdnCmtsMibCompliance=rdnCmtsMibCompliance, rdnIfCmtsMTAOnlyStatusIndex=rdnIfCmtsMTAOnlyStatusIndex, rdnCableInterceptCpeMac=rdnCableInterceptCpeMac, rdnServiceClassResetStats=rdnServiceClassResetStats, rdnIfCmtsCmCurrCpeNumber=rdnIfCmtsCmCurrCpeNumber, rdnCmtsIfGroup=rdnCmtsIfGroup, rdnCableInterceptDestination1Port=rdnCableInterceptDestination1Port, rdnCmtsLinkUpDownTrapEnableEntry=rdnCmtsLinkUpDownTrapEnableEntry, rdnCmtsUSRangingResponseControl=rdnCmtsUSRangingResponseControl, rdnServiceClassBondingStatsMacIfIndex=rdnServiceClassBondingStatsMacIfIndex, rdnCmtsUpstreamIfLinkUpTrap=rdnCmtsUpstreamIfLinkUpTrap, rdnCableInterceptDestination1Type=rdnCableInterceptDestination1Type, rdnIfCmtsMTAOnlyStatusCorrecteds=rdnIfCmtsMTAOnlyStatusCorrecteds, rdnServiceClassBondingStatsGroupId=rdnServiceClassBondingStatsGroupId, rdnCmtsServiceClassObjects=rdnCmtsServiceClassObjects, rdnCmtsMibNotificationObjects=rdnCmtsMibNotificationObjects, rdnCmtsCardType=rdnCmtsCardType, rdnCmtsCompliances=rdnCmtsCompliances, rdnCmtsCmRegisteredTrapEnable=rdnCmtsCmRegisteredTrapEnable, rdnCmToCpeMacAddress=rdnCmToCpeMacAddress, rdnIfCmtsCmStatusRegistrationTime=rdnIfCmtsCmStatusRegistrationTime, rdnIfCmtsCmStatusRxUnicastExtKbytes=rdnIfCmtsCmStatusRxUnicastExtKbytes, rdnCmtsCmResetByMacAddr=rdnCmtsCmResetByMacAddr, rdnIfCmtsCmStatusOnlineTimes=rdnIfCmtsCmStatusOnlineTimes, rdnIfCmtsCmStatusTxUnicastKbytes=rdnIfCmtsCmStatusTxUnicastKbytes, rdnIfCmtsCmStatusPercentOnline=rdnIfCmtsCmStatusPercentOnline, rdnIfCmtsCmStatusAvgOfflineTime=rdnIfCmtsCmStatusAvgOfflineTime, rdnCableUgsStatsTable=rdnCableUgsStatsTable, rdnCableInterceptDestination1Ip=rdnCableInterceptDestination1Ip, rdnIfCmtsMTAOnlyStatusSignalNoise=rdnIfCmtsMTAOnlyStatusSignalNoise, rdnCableInterceptDestination3Port=rdnCableInterceptDestination3Port, rdnRQueryUpChannelTxTimingOffset=rdnRQueryUpChannelTxTimingOffset, rdnPktDQoSAdmittedBwThresholdReason=rdnPktDQoSAdmittedBwThresholdReason, rdnCableInterceptDestination2Port=rdnCableInterceptDestination2Port, rdnCmtsUSRegisteredModemCount=rdnCmtsUSRegisteredModemCount, rdnCmtsCpeToCmTable=rdnCmtsCpeToCmTable, rdnIfCmtsMTAOnlyStatusUpChannelIfIndex=rdnIfCmtsMTAOnlyStatusUpChannelIfIndex, rdnCmtsMiscGroup=rdnCmtsMiscGroup, rdnRQueryCmtsCmStatusExtEntry=rdnRQueryCmtsCmStatusExtEntry, rdnCableInterceptEntry=rdnCableInterceptEntry, rdnCableUgsStatsPort=rdnCableUgsStatsPort, rdnCableInterceptRowStatus=rdnCableInterceptRowStatus, rdnCmtsServiceClassTable=rdnCmtsServiceClassTable, rdnCableInterceptByteCnt=rdnCableInterceptByteCnt, rdnCmtsUSNominalRxPowerMode=rdnCmtsUSNominalRxPowerMode, rdnIfCmtsCmStatusMinOnlineTime=rdnIfCmtsCmStatusMinOnlineTime, rdnCmtsCpeToCmEntry=rdnCmtsCpeToCmEntry, rdnCableUgsMinFlowsLastWindow=rdnCableUgsMinFlowsLastWindow, rdnServiceClassBondingRejectedFlows=rdnServiceClassBondingRejectedFlows, rdnIfCmtsMTAOnlyStatusIpAddress=rdnIfCmtsMTAOnlyStatusIpAddress, rdnCmtsUSInvitedRangingInterval=rdnCmtsUSInvitedRangingInterval, rdnIfCmtsCmStatusUpstreamPort=rdnIfCmtsCmStatusUpstreamPort, rdnIfCmtsCmStatusMaxOfflineTime=rdnIfCmtsCmStatusMaxOfflineTime, rdnIfCmtsMTAOnlyStatusExtUncorrectables=rdnIfCmtsMTAOnlyStatusExtUncorrectables, rdnServiceClassBondingBandWidth=rdnServiceClassBondingBandWidth, rdnCableUgsStatsSlot=rdnCableUgsStatsSlot, rdnCableUgsResetStats=rdnCableUgsResetStats, rdnModemDeregReason=rdnModemDeregReason, rdnServiceClassStatsTotalPackets=rdnServiceClassStatsTotalPackets, rdnServiceClassStatsSlot=rdnServiceClassStatsSlot, rdnRQueryCmtsCmStatusTable=rdnRQueryCmtsCmStatusTable, rdnRQueryCmtsCmDownChannelPower=rdnRQueryCmtsCmDownChannelPower, rdnCableInterceptCmMac=rdnCableInterceptCmMac, rdnIfCmtsCmStatusDSBondingGroupId=rdnIfCmtsCmStatusDSBondingGroupId, rdnCmToCpeTable=rdnCmToCpeTable, rdnIfCmtsMTAOnlyStatusValue=rdnIfCmtsMTAOnlyStatusValue, rdnServiceClassRejectedFlows=rdnServiceClassRejectedFlows, rdnIfCmtsMTAOnlyStatusInetAddress=rdnIfCmtsMTAOnlyStatusInetAddress, rdnCableInterceptScalars=rdnCableInterceptScalars, rdnCableUgsCurrentTotalFlows=rdnCableUgsCurrentTotalFlows, rdnServiceClassBondingStatsChan=rdnServiceClassBondingStatsChan, rdnServiceClassBondingStatsEntry=rdnServiceClassBondingStatsEntry, rdnCmtsServiceClassMab=rdnCmtsServiceClassMab, rdnIfCmtsCmMaxCpeNumber=rdnIfCmtsCmMaxCpeNumber, rdnCmtsDownstreamChannelTable=rdnCmtsDownstreamChannelTable, rdnServiceClassDeferredFlows=rdnServiceClassDeferredFlows, rdnIfCmtsMTAOnlyStatusExtCorrecteds=rdnIfCmtsMTAOnlyStatusExtCorrecteds, rdnIfCmtsMTAOnlyStatusTable=rdnIfCmtsMTAOnlyStatusTable, rdnRQuerySigQMicroreflections=rdnRQuerySigQMicroreflections, rdnCmtsUSRangingPowerOverride=rdnCmtsUSRangingPowerOverride, rdnCmtsUSUnregisteredModemCount=rdnCmtsUSUnregisteredModemCount, rdnCmtsCpeToCmObject=rdnCmtsCpeToCmObject, rdnCmtsCmRegisteredNotification=rdnCmtsCmRegisteredNotification, rdnIfCmtsMTAOnlyStatusUncorrectables=rdnIfCmtsMTAOnlyStatusUncorrectables, rdnCmtsServiceClassAllowShare=rdnCmtsServiceClassAllowShare, rdnCmtsServiceClassEntry=rdnCmtsServiceClassEntry, rdnIfCmtsMTAOnlyStatusMacAddress=rdnIfCmtsMTAOnlyStatusMacAddress, rdnIfCmtsCmStatusEntry=rdnIfCmtsCmStatusEntry, rdnCableUgsMinFlowsLastFiveMinutes=rdnCableUgsMinFlowsLastFiveMinutes, rdnCmtsServiceClassSchedulingPriority=rdnCmtsServiceClassSchedulingPriority, rdnRQueryLastPollStopTime=rdnRQueryLastPollStopTime, rdnCmtsDSModulation=rdnCmtsDSModulation, rdnCmtsStpObjects=rdnCmtsStpObjects, rdnCableUgsStatsEntry=rdnCableUgsStatsEntry, rdnCmtsMibNotificationPrefix=rdnCmtsMibNotificationPrefix) |
# Nokia messages
nokia_update = [
(
"openconfig-interfaces:interfaces/interface[name=1/1/c1/2]",
{
"config": {
"name": "1/1/c1/2",
"enabled": True,
"type": "ethernetCsmacd",
"description": "Test Interface @ pygnmi"
},
"subinterfaces":{
"subinterface": [
{
"index": 0,
"config": {
"index": 0,
"enabled": True
},
"ipv4": {
"addresses": {
"address": [
{
"ip": "10.0.1.1",
"config": {
"ip": "10.0.1.1",
"prefix-length": 31
}
}
]
}
},
"ipv6": {
"addresses": {
"address": [
{
"ip": "fc00:10:0:1::1",
"config": {
"ip": "fc00:10:0:1::1",
"prefix-length": 64
}
}
]
}
}
}
]
}
}
),
(
"openconfig-network-instance:network-instances/network-instance[name=Base]/interfaces/interface[id=1/1/c1/2.0]",
{
"config": {
"id": "1/1/c1/2.0",
"interface": "1/1/c1/2",
"subinterface": 0,
"associated-address-families": ["IPV4", "IPV6"]
}
}
)
]
nokia_delete = [
"openconfig-network-instance:network-instances/network-instance[name=Base]/interfaces/interface[id=1/1/c1/2.0]",
"openconfig-interfaces:interfaces/interface[name=1/1/c1/2]"
]
subscribe = {
'subscription': [
{
'path': 'openconfig-interfaces:interfaces/interface[name=1/1/c1/1]',
'mode': 'sample',
'sample_interval': 10000000000
},
{
'path': 'openconfig-network-instance:network-instances/network-instance[name=Base]/interfaces/interface[id=1/1/c1/1.0]',
'mode': 'sample',
'sample_interval': 10000000000
}
],
'mode': 'stream',
'encoding': 'json'
}
# Arista messages
arista_update = [
(
"openconfig-interfaces:interfaces/interface[name=Loopback0]",
{
"config": {
"name": "Loopback0",
"enabled": True,
"type": "softwareLoopback",
"description": "Test Interface @ pygnmi"
},
"subinterfaces":{
"subinterface": [
{
"index": 0,
"config": {
"index": 0,
"enabled": True
},
"openconfig-if-ip:ipv4": {
"addresses": {
"address": [
{
"ip": "10.0.255.1",
"config": {
"ip": "10.0.255.1",
"arista-intf-augments:addr-type": "PRIMARY",
"prefix-length": 32
}
}
]
}
},
"openconfig-if-ip:ipv6": {
"addresses": {
"address": [
{
"ip": "fc00:10:0:255::1",
"config": {
"ip": "fc00:10:0:255::1",
"prefix-length": 128
}
}
]
}
}
}
]
}
}
)
]
arista_delete = [
"openconfig-network-instance:network-instances/network-instance[name=default]/interfaces/interface[id=Loopback0]",
"openconfig-interfaces:interfaces/interface[name=Loopback0]"
]
arista_subscribe = {
'subscription': [
{
'path': 'openconfig-interfaces:interfaces/interface[name=Ethernet1]',
'mode': 'sample',
'sample_interval': 10000000000
},
{
'path': 'openconfig-interfaces:interfaces/interface[name=Management1]',
'mode': 'sample',
'sample_interval': 10000000000
}
],
'use_aliases': False,
'mode': 'stream',
'encoding': 'proto'
} | nokia_update = [('openconfig-interfaces:interfaces/interface[name=1/1/c1/2]', {'config': {'name': '1/1/c1/2', 'enabled': True, 'type': 'ethernetCsmacd', 'description': 'Test Interface @ pygnmi'}, 'subinterfaces': {'subinterface': [{'index': 0, 'config': {'index': 0, 'enabled': True}, 'ipv4': {'addresses': {'address': [{'ip': '10.0.1.1', 'config': {'ip': '10.0.1.1', 'prefix-length': 31}}]}}, 'ipv6': {'addresses': {'address': [{'ip': 'fc00:10:0:1::1', 'config': {'ip': 'fc00:10:0:1::1', 'prefix-length': 64}}]}}}]}}), ('openconfig-network-instance:network-instances/network-instance[name=Base]/interfaces/interface[id=1/1/c1/2.0]', {'config': {'id': '1/1/c1/2.0', 'interface': '1/1/c1/2', 'subinterface': 0, 'associated-address-families': ['IPV4', 'IPV6']}})]
nokia_delete = ['openconfig-network-instance:network-instances/network-instance[name=Base]/interfaces/interface[id=1/1/c1/2.0]', 'openconfig-interfaces:interfaces/interface[name=1/1/c1/2]']
subscribe = {'subscription': [{'path': 'openconfig-interfaces:interfaces/interface[name=1/1/c1/1]', 'mode': 'sample', 'sample_interval': 10000000000}, {'path': 'openconfig-network-instance:network-instances/network-instance[name=Base]/interfaces/interface[id=1/1/c1/1.0]', 'mode': 'sample', 'sample_interval': 10000000000}], 'mode': 'stream', 'encoding': 'json'}
arista_update = [('openconfig-interfaces:interfaces/interface[name=Loopback0]', {'config': {'name': 'Loopback0', 'enabled': True, 'type': 'softwareLoopback', 'description': 'Test Interface @ pygnmi'}, 'subinterfaces': {'subinterface': [{'index': 0, 'config': {'index': 0, 'enabled': True}, 'openconfig-if-ip:ipv4': {'addresses': {'address': [{'ip': '10.0.255.1', 'config': {'ip': '10.0.255.1', 'arista-intf-augments:addr-type': 'PRIMARY', 'prefix-length': 32}}]}}, 'openconfig-if-ip:ipv6': {'addresses': {'address': [{'ip': 'fc00:10:0:255::1', 'config': {'ip': 'fc00:10:0:255::1', 'prefix-length': 128}}]}}}]}})]
arista_delete = ['openconfig-network-instance:network-instances/network-instance[name=default]/interfaces/interface[id=Loopback0]', 'openconfig-interfaces:interfaces/interface[name=Loopback0]']
arista_subscribe = {'subscription': [{'path': 'openconfig-interfaces:interfaces/interface[name=Ethernet1]', 'mode': 'sample', 'sample_interval': 10000000000}, {'path': 'openconfig-interfaces:interfaces/interface[name=Management1]', 'mode': 'sample', 'sample_interval': 10000000000}], 'use_aliases': False, 'mode': 'stream', 'encoding': 'proto'} |
class _Snake:
def __init__(self, color):
self.head = ()
self.body = []
self.color = color
self.last_op = 'w'
self.score = 0
self.operation = {
'w': lambda x, y: (x - 1, y),
'a': lambda x, y: (x, y - 1),
's': lambda x, y: (x + 1, y),
'd': lambda x, y: (x, y + 1),
}
def move(self, key, field_size, apple):
if key not in 'wasd':
key = self.last_op
new_head = self.operation[key](*self.head)
# snake can not go back
if self.body and new_head == self.body[0]:
key = self.last_op
new_head = self.operation[key](*self.head)
# snake grows from eating apple
if new_head == apple:
self.body = [self.head] + self.body
self.score += 1
elif self.body:
self.body = [self.head] + self.body[:-1]
# snake dies from boundaries
if not (0 <= new_head[0] < field_size and 0 <= new_head[1] < field_size):
print(f"{self} is dead")
return False
# snake dies from itself
if new_head in self.body:
print(f"{self} is dead")
return False
self.head = new_head
self.last_op = key
return True
def attack(self, other):
"""
Rule: Snake that crashed into another snake - attacker. Longer snake will survive, but will suffer damage
:param other: snake-defender
:return: True for survived, False for dead
"""
delta = len(self.body) - len(other.body)
if delta > 0:
self.body = self.body[:delta]
return True, False
if delta < 0:
other.body = other.body[:-delta]
print(other.body)
return False, True
return False, False
def __eq__(self, other):
return self.color == other
def __repr__(self):
return f'Snake {self.color}'
| class _Snake:
def __init__(self, color):
self.head = ()
self.body = []
self.color = color
self.last_op = 'w'
self.score = 0
self.operation = {'w': lambda x, y: (x - 1, y), 'a': lambda x, y: (x, y - 1), 's': lambda x, y: (x + 1, y), 'd': lambda x, y: (x, y + 1)}
def move(self, key, field_size, apple):
if key not in 'wasd':
key = self.last_op
new_head = self.operation[key](*self.head)
if self.body and new_head == self.body[0]:
key = self.last_op
new_head = self.operation[key](*self.head)
if new_head == apple:
self.body = [self.head] + self.body
self.score += 1
elif self.body:
self.body = [self.head] + self.body[:-1]
if not (0 <= new_head[0] < field_size and 0 <= new_head[1] < field_size):
print(f'{self} is dead')
return False
if new_head in self.body:
print(f'{self} is dead')
return False
self.head = new_head
self.last_op = key
return True
def attack(self, other):
"""
Rule: Snake that crashed into another snake - attacker. Longer snake will survive, but will suffer damage
:param other: snake-defender
:return: True for survived, False for dead
"""
delta = len(self.body) - len(other.body)
if delta > 0:
self.body = self.body[:delta]
return (True, False)
if delta < 0:
other.body = other.body[:-delta]
print(other.body)
return (False, True)
return (False, False)
def __eq__(self, other):
return self.color == other
def __repr__(self):
return f'Snake {self.color}' |
c = 1
while True:
n = int(input())
if n == -1: break
print('Experiment {}: {} full cycle(s)'.format(c, n // 2))
c += 1
| c = 1
while True:
n = int(input())
if n == -1:
break
print('Experiment {}: {} full cycle(s)'.format(c, n // 2))
c += 1 |
# Write a function that, given an array A of N integers, returns the smallest positive integer (greater than 0) that does not occur in A.
# SIMPLER APPROACH: 1 is the min answer we return. Iterate through the list and if we we see the val of min then increment min.
# O(n)t | O(1)s
def smallestPositiveInteger(A):
A.sort()
min = 1
for val in A:
if val == min: min += 1
return min
# Approach:
# Use cyclic sort. Whichever index is out of place will be our answer. Can also just use built in .sort() within Python
# # SORT APPROACH
# def solution(A):
# for idx, val in enumerate(A):
# if val < 1: continue
# target = A[idx] - 1
# targetVal = A[target]
# A[target] = A[idx]
# A[idx] = targetVal
# if A[-1] < 1: return 1
# for idx, val in enumerate(A):
# if A[idx] != idx + 1: return idx + 1
# return A[-1] + 1
| def smallest_positive_integer(A):
A.sort()
min = 1
for val in A:
if val == min:
min += 1
return min |
# 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 countNodes(self, root):
"""
:type root: TreeNode
:rtype: int
"""
if root is None:
return 0
if not root.left and not root.right:
return 1
elif not root.left and root.right:
return 2
elif root.left and not root.right:
return 2
left, right = self.get_height(root)
if left == right:
return 2**(left+1)-1
else:
return 1 + self.countNodes(root.left) + self.countNodes(root.right)
def get_height(self, root):
left = 0
cur = root
while cur.left:
left += 1
cur = cur.left
right = 0
cur = root
while cur.right:
right += 1
cur = cur.right
return left, right
| class Solution(object):
def count_nodes(self, root):
"""
:type root: TreeNode
:rtype: int
"""
if root is None:
return 0
if not root.left and (not root.right):
return 1
elif not root.left and root.right:
return 2
elif root.left and (not root.right):
return 2
(left, right) = self.get_height(root)
if left == right:
return 2 ** (left + 1) - 1
else:
return 1 + self.countNodes(root.left) + self.countNodes(root.right)
def get_height(self, root):
left = 0
cur = root
while cur.left:
left += 1
cur = cur.left
right = 0
cur = root
while cur.right:
right += 1
cur = cur.right
return (left, right) |
for i in range(0,10):
for j in range(10, -1, -1): # we count backwards to -1 so we include 0
if(i == j):
print("i == j, so we break")
break
else:
print("i = %d, j= %d" % (i, j))
| for i in range(0, 10):
for j in range(10, -1, -1):
if i == j:
print('i == j, so we break')
break
else:
print('i = %d, j= %d' % (i, j)) |
temp = 0
respuesta = ''
def escribirArchivo(var):
archivo = open('temp.dat', 'a')
archivo.write(var+"\n")
def cerrarArchivo():
archivo = open('temp.dat', 'a')
archivo.close()
b = True
try:
while b == True:
temp = input(" Ingresa tu temperatura: ")
if(float(temp) > 37.5):
r = 'Fiebre' + ' ' + temp
escribirArchivo(r)
cerrarArchivo()
elif(float(temp) < 30.0):
r = 'Estas enfermo' + ' ' + temp
escribirArchivo(r)
cerrarArchivo()
elif(float(temp) < 5.0):
r = 'Estas muerto' + ' ' + temp
escribirArchivo(r)
cerrarArchivo()
else:
print("Estas bien")
cerrarArchivo()
except Exception:
print("Intente de nuevo")
b = False
| temp = 0
respuesta = ''
def escribir_archivo(var):
archivo = open('temp.dat', 'a')
archivo.write(var + '\n')
def cerrar_archivo():
archivo = open('temp.dat', 'a')
archivo.close()
b = True
try:
while b == True:
temp = input(' Ingresa tu temperatura: ')
if float(temp) > 37.5:
r = 'Fiebre' + ' ' + temp
escribir_archivo(r)
cerrar_archivo()
elif float(temp) < 30.0:
r = 'Estas enfermo' + ' ' + temp
escribir_archivo(r)
cerrar_archivo()
elif float(temp) < 5.0:
r = 'Estas muerto' + ' ' + temp
escribir_archivo(r)
cerrar_archivo()
else:
print('Estas bien')
cerrar_archivo()
except Exception:
print('Intente de nuevo')
b = False |
name = "TensorFlow"
description = None
args_and_kwargs = (
(("--run-eagerly",), {
"help":"Running tensorflow in eager mode may be required for high memory models.",
"action":'store_true',
"default":False,
}),
(("--disable-gpu",), {
"help":"Disable GPU for high memory models.",
"action":'store_true',
"default":False,
}),
(("--gpu-id",), {
"help":"Specify the physical device used for acceleration. This is an integer from"
"0 to num accelerators - 1. The default is zero. If `--disable-gpu` is set,"
"this option is ignored.",
"type":int,
"default": 0,
}),
(("--disable-memory-growth",), {
"help":"Disable the experimental dynamic memory allocation.",
"action":'store_true',
"default":False,
}),
(("--tf-debug",), {
"help": "Increase the TensorFlow log verbosity by setting the "
"TF_CPP_MIN_LOG_LEVEL environment variable. ",
"action" : 'store_true',
"default":False,
}),
(("--seed",), {
"help":f"Random number seed for consistent sampling.",
"type":int,
"default":1234,
}),
)
| name = 'TensorFlow'
description = None
args_and_kwargs = ((('--run-eagerly',), {'help': 'Running tensorflow in eager mode may be required for high memory models.', 'action': 'store_true', 'default': False}), (('--disable-gpu',), {'help': 'Disable GPU for high memory models.', 'action': 'store_true', 'default': False}), (('--gpu-id',), {'help': 'Specify the physical device used for acceleration. This is an integer from0 to num accelerators - 1. The default is zero. If `--disable-gpu` is set,this option is ignored.', 'type': int, 'default': 0}), (('--disable-memory-growth',), {'help': 'Disable the experimental dynamic memory allocation.', 'action': 'store_true', 'default': False}), (('--tf-debug',), {'help': 'Increase the TensorFlow log verbosity by setting the TF_CPP_MIN_LOG_LEVEL environment variable. ', 'action': 'store_true', 'default': False}), (('--seed',), {'help': f'Random number seed for consistent sampling.', 'type': int, 'default': 1234})) |
#encoding:utf-8
subreddit = 'behindthegifs'
t_channel = '@r_behindthegifs'
def send_post(submission, r2t):
return r2t.send_simple(submission,
min_upvotes_limit=100,
text=False,
gif=False,
img=False,
album=True,
other=False
) | subreddit = 'behindthegifs'
t_channel = '@r_behindthegifs'
def send_post(submission, r2t):
return r2t.send_simple(submission, min_upvotes_limit=100, text=False, gif=False, img=False, album=True, other=False) |
class DPDSettingsObject(object):
DPD_API_USERNAME = None
DPD_API_PASSWORD = None
DPD_API_FID = None
DPD_API_SANDBOX_USERNAME = None
DPD_API_SANDBOX_PASSWORD = None
DPD_API_SANDBOX_FID = None
| class Dpdsettingsobject(object):
dpd_api_username = None
dpd_api_password = None
dpd_api_fid = None
dpd_api_sandbox_username = None
dpd_api_sandbox_password = None
dpd_api_sandbox_fid = None |
class recipe_defs:
def __init__(self):
self.tags = ["Vegetarian",
"Vegan",
"Burger",
"Baby",
"High protein",
"Gluten free",
"Meat",
"Fish",
"Cold",
"Hot",
"Take away"]
self.types = ["Breakfast",
"Main",
"Dessert",
"Fika",
"Starter",
"Juice",
"Smoothie",
"Soup"]
class ingredient_def:
def __init__(self):
self.seasons = ["Spring",
"Autumn",
"Summer",
"Winter",
"Not applicable"]
self.types = ["Fruit",
"Vegy",
"Spice",
"Condiment",
"Dairy",
"Canned",
"Dry",
"Fish",
"Bird",
"Cow",
"Pig",
"Wild meat",
"Other"]
self.units = ["Piece",
"milli Litre (mL)",
"Litre (L)",
"Gram (m)",
"kilo Gram (kg)",
"Table spoon",
"Tea spoon"]
class search_configuration_def:
def __init__(self, person_count, day_count, lunch_and_dinner, types, tags):
self.configuration = {'person count': person_count,
'day count': day_count,
'lunch and dinner': lunch_and_dinner,
'type': types,
'tags': tags}
| class Recipe_Defs:
def __init__(self):
self.tags = ['Vegetarian', 'Vegan', 'Burger', 'Baby', 'High protein', 'Gluten free', 'Meat', 'Fish', 'Cold', 'Hot', 'Take away']
self.types = ['Breakfast', 'Main', 'Dessert', 'Fika', 'Starter', 'Juice', 'Smoothie', 'Soup']
class Ingredient_Def:
def __init__(self):
self.seasons = ['Spring', 'Autumn', 'Summer', 'Winter', 'Not applicable']
self.types = ['Fruit', 'Vegy', 'Spice', 'Condiment', 'Dairy', 'Canned', 'Dry', 'Fish', 'Bird', 'Cow', 'Pig', 'Wild meat', 'Other']
self.units = ['Piece', 'milli Litre (mL)', 'Litre (L)', 'Gram (m)', 'kilo Gram (kg)', 'Table spoon', 'Tea spoon']
class Search_Configuration_Def:
def __init__(self, person_count, day_count, lunch_and_dinner, types, tags):
self.configuration = {'person count': person_count, 'day count': day_count, 'lunch and dinner': lunch_and_dinner, 'type': types, 'tags': tags} |
# scored.py
# Repeatedly read test scores (from 0 to 100), until the user
# enter -1 to finish. The input part of the program will ensure
# that the numbers are in the correct range.
# For each score, report the corresponding grade:
# 90-100 = A, 80-89 = B, 70-79 = C, 60-69 = D, < 60 = F
# When you have all the scores, report the number of scores
# entered, the total points and the average score.
# Display letter grade
def display_grade(score):
if score >= 90:
print("Congratulations! That is an A.")
elif score >= 80:
print("Good job. That is a B.")
elif score >= 70:
print("You are passing with a C.")
elif score >= 60:
print("Please study more. You have a D.")
else:
print("Sorry, that is an F.")
# Prompt user for score and returns score
def get_score():
valid = False
# Enter scores until a valid score is entered
while not valid:
score = float(input('Enter a score 0-100, or -1 to finish: '))
# Check if valid score was entered
if score == -1 or (score >=0 and score <= 100):
valid = True
else:
print("Please enter a valid score.")
return score
def main():
# Intialize the count of scores and total scores
count_scores = 0
total_scores = 0
# Keep entering scores until finished is set to true
finished = False
# Enter score until the user enters -1
while not finished:
score = get_score()
# Check if user is finished entering scores
if score == -1:
finished = True
else:
# Display letter grade
display_grade(score)
# Update count of scores and total score
count_scores += 1
total_scores += score
# Display number of scores, total score and average if scores were entered
if count_scores > 0:
average = total_scores / count_scores
print(f"Total number of scores: {count_scores}")
print(f"Total number of points: {total_scores:.1f}")
print(f"Average score: {average:.2f}")
else:
print("No scores entered; no average computed.")
# Call main function
main()
| def display_grade(score):
if score >= 90:
print('Congratulations! That is an A.')
elif score >= 80:
print('Good job. That is a B.')
elif score >= 70:
print('You are passing with a C.')
elif score >= 60:
print('Please study more. You have a D.')
else:
print('Sorry, that is an F.')
def get_score():
valid = False
while not valid:
score = float(input('Enter a score 0-100, or -1 to finish: '))
if score == -1 or (score >= 0 and score <= 100):
valid = True
else:
print('Please enter a valid score.')
return score
def main():
count_scores = 0
total_scores = 0
finished = False
while not finished:
score = get_score()
if score == -1:
finished = True
else:
display_grade(score)
count_scores += 1
total_scores += score
if count_scores > 0:
average = total_scores / count_scores
print(f'Total number of scores: {count_scores}')
print(f'Total number of points: {total_scores:.1f}')
print(f'Average score: {average:.2f}')
else:
print('No scores entered; no average computed.')
main() |
def is_possible(m, n, times):
re = 0
for t in times:
re += m // t
if re >= n:
return True
return False
def solution(n, times):
answer = 0
times.sort()
l=0; r=1_000_000_000_000_000; m=0
while l <= r:
m = (l+r)//2
if is_possible(m, n, times):
answer = m
r = m-1
else:
l = m+1
return answer
n, times = 6, [2, 7, 10]
print(solution(n, times))
| def is_possible(m, n, times):
re = 0
for t in times:
re += m // t
if re >= n:
return True
return False
def solution(n, times):
answer = 0
times.sort()
l = 0
r = 1000000000000000
m = 0
while l <= r:
m = (l + r) // 2
if is_possible(m, n, times):
answer = m
r = m - 1
else:
l = m + 1
return answer
(n, times) = (6, [2, 7, 10])
print(solution(n, times)) |
list1=[1,2,6,12]
iteration=0
print ("iteration", iteration, list1)
for i in range(len(list1)):
for j in range(len(list1)-1-i):
iteration=iteration+1
if list1[j]> list1[j+1]:
temp=list1[j]
list1[j] = list1[j+1]
list1[j+1]=temp # Swap!
print ("iteration", iteration, list1)
print(list1)
| list1 = [1, 2, 6, 12]
iteration = 0
print('iteration', iteration, list1)
for i in range(len(list1)):
for j in range(len(list1) - 1 - i):
iteration = iteration + 1
if list1[j] > list1[j + 1]:
temp = list1[j]
list1[j] = list1[j + 1]
list1[j + 1] = temp
print('iteration', iteration, list1)
print(list1) |
class TrackGroupStyle:
def __init__(self, distance=5, internal_offset=2, x_multiplier=1.05, show_label=True,
label_fontsize=16, label_fontweight="normal",
label_fontstyle='normal',
label_hor_aln='right', label_vert_aln='center',
label_y_shift=0,
label_x_shift=-15,
):
self.distance = distance
self.internal_offset = internal_offset
self.x_multiplier = x_multiplier
self.show_label = show_label
self.label_fontweight = label_fontweight
self.label_fontstyle = label_fontstyle
self.label_fontsize = label_fontsize
self.label_hor_aln = label_hor_aln
self.label_vert_aln = label_vert_aln
self.label_y_shift = label_y_shift
self.label_x_shift = label_x_shift
default_track_group_style = TrackGroupStyle()
italic_track_group_style = TrackGroupStyle(label_fontstyle='italic')
| class Trackgroupstyle:
def __init__(self, distance=5, internal_offset=2, x_multiplier=1.05, show_label=True, label_fontsize=16, label_fontweight='normal', label_fontstyle='normal', label_hor_aln='right', label_vert_aln='center', label_y_shift=0, label_x_shift=-15):
self.distance = distance
self.internal_offset = internal_offset
self.x_multiplier = x_multiplier
self.show_label = show_label
self.label_fontweight = label_fontweight
self.label_fontstyle = label_fontstyle
self.label_fontsize = label_fontsize
self.label_hor_aln = label_hor_aln
self.label_vert_aln = label_vert_aln
self.label_y_shift = label_y_shift
self.label_x_shift = label_x_shift
default_track_group_style = track_group_style()
italic_track_group_style = track_group_style(label_fontstyle='italic') |
def new_if(predicate, then, otherwise):
if predicate:
then
else:
otherwise
def p(x):
new_if(x > 5, print(x), p(x+1))
p(1) # what happens here? | def new_if(predicate, then, otherwise):
if predicate:
then
else:
otherwise
def p(x):
new_if(x > 5, print(x), p(x + 1))
p(1) |
a = [1, 2, 3, 4, 5, 6, 7, 8, 9]
#################
# List indexing #
#################
# Classical position indexing
i = 0
while i < len(a):
print(a[i])
i += 1
# Negative indices
print(a[-1])
print(a[-2])
print(a[-3])
################
# List slicing #
################
# Elements between indices 3 and 7
print(a[3:7])
# Elements from index 5 onwards
print(a[5:])
# Elements from the start up to index 8
print(a[:8])
#######################
# List comprehensions #
#######################
# The first 10 square natural numbers
l = [x * x for x in range(1, 10)]
print(l)
# The first even square natural numbers
l = [x * x for x in range(1, 10) if (x * x) % 2 == 0]
print(l)
# Some numbers from the first list
l = [x for x in a if x > 2 and x < 7]
print(l)
#######
# zip #
#######
l = zip([1, 2, 3, 4], ["a", "b", "c"], ["Hello", ",", "World", "!"])
print(l)
| a = [1, 2, 3, 4, 5, 6, 7, 8, 9]
i = 0
while i < len(a):
print(a[i])
i += 1
print(a[-1])
print(a[-2])
print(a[-3])
print(a[3:7])
print(a[5:])
print(a[:8])
l = [x * x for x in range(1, 10)]
print(l)
l = [x * x for x in range(1, 10) if x * x % 2 == 0]
print(l)
l = [x for x in a if x > 2 and x < 7]
print(l)
l = zip([1, 2, 3, 4], ['a', 'b', 'c'], ['Hello', ',', 'World', '!'])
print(l) |
'''
Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.
Note:
The solution set must not contain duplicate quadruplets.
Example:
Given array nums = [1, 0, -1, 0, -2, 2], and target = 0.
A solution set is:
[
[-1, 0, 0, 1],
[-2, -1, 1, 2],
[-2, 0, 0, 2]
]
'''
# 2018-6-17
# Four Sum
class Solution:
def fourSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[List[int]]
"""
res = []
lens = len(nums)
if lens < 3:
return res
nums = sorted(nums)
# print(nums)
i = 0
while i < lens - 3:
j = i + 1
while j < lens - 2:
l = j + 1
r = lens - 1
while l < r:
tmp = []
if nums[j] + nums[l] + nums[r] < (target - nums[i]):
l += 1
elif nums[j] + nums[l] + nums[r] > (target - nums[i]):
r -= 1
else:
tmp = [nums[i], nums[j], nums[l], nums[r]]
if tmp in res:
l += 1
r -= 1
else:
res.append(tmp)
l += 1
r -= 1
j += 1
i += 1
return res
num = [1, 0, -1, 0, -2, 2]
nums = [91277418,66271374,38763793,4092006,11415077,60468277,1122637,72398035,-62267800,22082642,60359529,-16540633,92671879,-64462734,-55855043,-40899846,88007957,-57387813,-49552230,-96789394,18318594,-3246760,-44346548,-21370279,42493875,25185969,83216261,-70078020,-53687927,-76072023,-65863359,-61708176,-29175835,85675811,-80575807,-92211746,44755622,-23368379,23619674,-749263,-40707953,-68966953,72694581,-52328726,-78618474,40958224,-2921736,-55902268,-74278762,63342010,29076029,58781716,56045007,-67966567,-79405127,-45778231,-47167435,1586413,-58822903,-51277270,87348634,-86955956,-47418266,74884315,-36952674,-29067969,-98812826,-44893101,-22516153,-34522513,34091871,-79583480,47562301,6154068,87601405,-48859327,-2183204,17736781,31189878,-23814871,-35880166,39204002,93248899,-42067196,-49473145,-75235452,-61923200,64824322,-88505198,20903451,-80926102,56089387,-58094433,37743524,-71480010,-14975982,19473982,47085913,-90793462,-33520678,70775566,-76347995,-16091435,94700640,17183454,85735982,90399615,-86251609,-68167910,-95327478,90586275,-99524469,16999817,27815883,-88279865,53092631,75125438,44270568,-23129316,-846252,-59608044,90938699,80923976,3534451,6218186,41256179,-9165388,-11897463,92423776,-38991231,-6082654,92275443,74040861,77457712,-80549965,-42515693,69918944,-95198414,15677446,-52451179,-50111167,-23732840,39520751,-90474508,-27860023,65164540,26582346,-20183515,99018741,-2826130,-28461563,-24759460,-83828963,-1739800,71207113,26434787,52931083,-33111208,38314304,-29429107,-5567826,-5149750,9582750,85289753,75490866,-93202942,-85974081,7365682,-42953023,21825824,68329208,-87994788,3460985,18744871,-49724457,-12982362,-47800372,39958829,-95981751,-71017359,-18397211,27941418,-34699076,74174334,96928957,44328607,49293516,-39034828,5945763,-47046163,10986423,63478877,30677010,-21202664,-86235407,3164123,8956697,-9003909,-18929014,-73824245]
test = Solution()
res = test.fourSum(num,0)
print(res) | """
Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.
Note:
The solution set must not contain duplicate quadruplets.
Example:
Given array nums = [1, 0, -1, 0, -2, 2], and target = 0.
A solution set is:
[
[-1, 0, 0, 1],
[-2, -1, 1, 2],
[-2, 0, 0, 2]
]
"""
class Solution:
def four_sum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[List[int]]
"""
res = []
lens = len(nums)
if lens < 3:
return res
nums = sorted(nums)
i = 0
while i < lens - 3:
j = i + 1
while j < lens - 2:
l = j + 1
r = lens - 1
while l < r:
tmp = []
if nums[j] + nums[l] + nums[r] < target - nums[i]:
l += 1
elif nums[j] + nums[l] + nums[r] > target - nums[i]:
r -= 1
else:
tmp = [nums[i], nums[j], nums[l], nums[r]]
if tmp in res:
l += 1
r -= 1
else:
res.append(tmp)
l += 1
r -= 1
j += 1
i += 1
return res
num = [1, 0, -1, 0, -2, 2]
nums = [91277418, 66271374, 38763793, 4092006, 11415077, 60468277, 1122637, 72398035, -62267800, 22082642, 60359529, -16540633, 92671879, -64462734, -55855043, -40899846, 88007957, -57387813, -49552230, -96789394, 18318594, -3246760, -44346548, -21370279, 42493875, 25185969, 83216261, -70078020, -53687927, -76072023, -65863359, -61708176, -29175835, 85675811, -80575807, -92211746, 44755622, -23368379, 23619674, -749263, -40707953, -68966953, 72694581, -52328726, -78618474, 40958224, -2921736, -55902268, -74278762, 63342010, 29076029, 58781716, 56045007, -67966567, -79405127, -45778231, -47167435, 1586413, -58822903, -51277270, 87348634, -86955956, -47418266, 74884315, -36952674, -29067969, -98812826, -44893101, -22516153, -34522513, 34091871, -79583480, 47562301, 6154068, 87601405, -48859327, -2183204, 17736781, 31189878, -23814871, -35880166, 39204002, 93248899, -42067196, -49473145, -75235452, -61923200, 64824322, -88505198, 20903451, -80926102, 56089387, -58094433, 37743524, -71480010, -14975982, 19473982, 47085913, -90793462, -33520678, 70775566, -76347995, -16091435, 94700640, 17183454, 85735982, 90399615, -86251609, -68167910, -95327478, 90586275, -99524469, 16999817, 27815883, -88279865, 53092631, 75125438, 44270568, -23129316, -846252, -59608044, 90938699, 80923976, 3534451, 6218186, 41256179, -9165388, -11897463, 92423776, -38991231, -6082654, 92275443, 74040861, 77457712, -80549965, -42515693, 69918944, -95198414, 15677446, -52451179, -50111167, -23732840, 39520751, -90474508, -27860023, 65164540, 26582346, -20183515, 99018741, -2826130, -28461563, -24759460, -83828963, -1739800, 71207113, 26434787, 52931083, -33111208, 38314304, -29429107, -5567826, -5149750, 9582750, 85289753, 75490866, -93202942, -85974081, 7365682, -42953023, 21825824, 68329208, -87994788, 3460985, 18744871, -49724457, -12982362, -47800372, 39958829, -95981751, -71017359, -18397211, 27941418, -34699076, 74174334, 96928957, 44328607, 49293516, -39034828, 5945763, -47046163, 10986423, 63478877, 30677010, -21202664, -86235407, 3164123, 8956697, -9003909, -18929014, -73824245]
test = solution()
res = test.fourSum(num, 0)
print(res) |
"""
@Author :Furqan Khan
@Email :furqankhan08@gmail.com
@Date :1/3/2017
Objective :
The purpose of this file /module /Class is to map to serve teh Rest request
Depending upon the requested url the views module will fetch the data from the backend
python files and would transform the data to json format ,and would finally return the data back to the
requesting application.
class SetCsrf(APIView):
Objective :
This class is only for test purpose and it forces the framework to generate a csrf token
with custom authentication
@method_decorator(ensure_csrf_cookie)
def get(self,request,format=None):
return Response(JSONRenderer().render({"helllo":"world"}))
class UserList(APIView):
Objective :
The code is only for testing purpose and has no utility with final draft of code
def get(self,request,format=None):
Employee_dict={}
Employee_list=[]
Employee_dict["id"]=1
Employee_dict["name"]="Furqan Khan"
Employee_list.append(Employee_dict)
Employee_dict={}
Employee_dict["id"]=2
Employee_dict["name"]="Burhan Khan"
Employee_list.append(Employee_dict)
serialize=UserSerializer(Employee_list,many=True)
return Response(JSONRenderer().render(serialize.data))
#return JSONResponse(serialize.data)
class StartScanConcurrent(APIView):
Objective :
The objective of this class is to serve the Post method which would take the scan attributes
and would invoke appropriate backend python files Gui_main_driver.py to start the scan as a process.
Note :This class would invoke the dicovery and vulnerability scanning in concurrent mode.
IN order to understand about input given to this method and response returned read API documentation.
#@csrf_exempt
def post(self,request,format=None):
print "Request HIt :"
#data_=JSONParser().parse(request)
scan_attributes=ScanAttributes(data=request.data)
#scan_attributes=ScanAttributes(data=data_)
return_response={}
if scan_attributes.is_valid():
#return Response(scan_attributes.data)
obj=Gui_main_driver.Gui_main()
scan_id=obj.main_start(scan_attributes.data["project_name"],scan_attributes.data["IP_range"],scan_attributes.data["Port_range"],scan_attributes.data["switch"],"1","init",scan_attributes.data["assessment_id"],scan_attributes.data["app_id"],True)
if scan_id !=-1:
return_response["status"]="success" #+str(scan_attributes.data["project_name"])
return_response["project_id"]=str(scan_id)
return_response["value"]=str(scan_id)
else:
return_response["status"]="failure" #+str(scan_attributes.data["project_name"])
return_response["project_id"]=str(scan_id)
return_response["value"]=str(scan_id)
return Response(JSONRenderer().render(return_response))
return_response["status"]="failure"
return_response["errors"]=scan_attributes.errors
return_response["value"]=scan_attributes.errors
#return Response(return_response)
return Response(JSONRenderer().render(return_response))
class StartScan(APIView):
#@csrf_exempt
Objective :
The objective of this class is to serve the Post method which would take the scan attributes
and would invoke appropriate backend python files Gui_main._driver.py to start the scan as a process
Note :This class will invoke the backend code in sequential mode
IN order to understand about input given to this method and response returned read API documentation.
def post(self,request,format=None):
print "Request HIt :"
#data_=JSONParser().parse(request)
scan_attributes=ScanAttributes(data=request.data)
#scan_attributes=ScanAttributes(data=data_)
return_response={}
if scan_attributes.is_valid():
#return Response(scan_attributes.data)
obj=Gui_main_driver.Gui_main()
scan_id=obj.main_start(scan_attributes.data["project_name"],scan_attributes.data["IP_range"],scan_attributes.data["Port_range"],scan_attributes.data["switch"],"1","init",scan_attributes.data["assessment_id"],scan_attributes.data["app_id"])
if scan_id != -1:
return_response["status"]="success" #+str(scan_attributes.data["project_name"])
return_response["project_id"]=str(scan_id)
return_response["value"]=str(scan_id)
else:
return_response["status"]="failure"
return_response["value"]="-1"
return Response(JSONRenderer().render(return_response))
return_response["status"]="failure"
return_response["errors"]=scan_attributes.errors
return_response["value"]=scan_attributes.errors
#return Response(return_response)
return Response(JSONRenderer().render(return_response))
def get(self,request,format=None):
Employee_dict={}
Employee_list=[]
Employee_dict["id"]=1
Employee_dict["name"]="Furqan Khan"
Employee_list.append(Employee_dict)
Employee_dict={}
Employee_dict["id"]=2
Employee_dict["name"]="Burhan Khan"
Employee_list.append(Employee_dict)
serialize=UserSerializer(Employee_list,many=True)
return Response(serialize.data)
class StopScan(APIView):
Objective :
The objective of this class is to serve the Post method which would take the scan/project id
and would invoke appropriate backend python files Gui_main_driver.py to stop the scan
In order to understand about input given to this method and response returned read API documentation.
#@csrf_exempt
@method_decorator(csrf_protect)
def post(self,request,format=None):
scan_attributes=General(data=request.data)
return_response={}
if scan_attributes.is_valid():
#return Response(scan_attributes.data)
obj=Gui_main_driver.Gui_main()
scan_id=obj.main_pause(scan_attributes.data["project_id"],scan_attributes.data["assessment_id"],scan_attributes.data["app_id"])
if scan_id !=0:
return_response["status"]="success" #+str(scan_attributes.data["project_name"])
else:
return_response["status"]="failure"
return_response["response_code"]=str(scan_id)
return_response["value"]=str(scan_id)
#return Response(JSONRenderer().render(return_response))
return Response(JSONRenderer().render(return_response))
return_response["status"]="failure"
return_response["errors"]=scan_attributes.errors
return_response["value"]=scan_attributes.errors
return Response(JSONRenderer().render(return_response))
class StopScanConc(APIView):
Objective :
The objective of this class is to serve the Post method which would take the scan/project id
and would invoke appropriate backend python files Gui_main_driver.py to stop the scan
Note :This class would serve the purpose of stopping concurrent scan.Thus actually it would pause
both the discovery as well as the vulnerability scanning phase.
In order to understand about input given to this method and response returned read API documentation.
#@csrf_exempt
def post(self,request,format=None):
try:
scan_attributes=General(data=request.data)
return_response={}
if scan_attributes.is_valid():
#return Response(scan_attributes.data)
obj=Gui_main_driver.Gui_main()
scan_id=obj.main_pause(scan_attributes.data["project_id"],scan_attributes.data["assessment_id"],scan_attributes.data["app_id"])
exp_id=obj.exploits_pause(scan_attributes.data["project_id"],True)
return_response["status"]="success" #+str(scan_attributes.data["project_name"])
return_response["response_code"]=str(scan_id)
#return Response(JSONRenderer().render(return_response))
return Response(JSONRenderer().render(return_response))
else:
return_response["status"]="failure"
return_response["errors"]=scan_attributes.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response["status"]="failure"
return_response["errors"]=str(ee)
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
class ResumeScanConc(APIView):
Objective :
The objective of this class is to serve the Post method which would take the scan/project id
and would invoke appropriate backend python files Gui_main_driver.py to resume paused the scan
Note :This class would serve the purpose of resuming concurrent scan.Thus actually it would pause
both the discovery as well as the vulnerability scanning phase.
In order to understand about input given to this method and response returned read API documentation.
#@csrf_exempt
def post(self,request,format=None):
try:
scan_attributes=General(data=request.data)
return_response={}
if scan_attributes.is_valid():
#return Response(scan_attributes.data)
obj=Gui_main_driver.Gui_main()
scan_id=obj.main_resume(scan_attributes.data["project_id"],scan_attributes.data["assessment_id"],scan_attributes.data["app_id"],True)
return_response["status"]="success" #+str(scan_attributes.data["project_name"])
return_response["project_id"]=str(scan_id)
return_response["value"]=str(scan_id)
return Response(JSONRenderer().render(return_response))
else:
return_response["status"]="failure"
return_response["errors"]=scan_attributes.errors
return_response["value"]=scan_attributes.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response["status"]="failure"
return_response["errors"]=str(ee)
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
class StopExploits(APIView):
Objective :
The objective of this class is to serve the Post method which would take the scan/project id
and would invoke appropriate backend python files Gui_main_driver.py to stop the vulnerability scan
In order to understand about input given to this method and response returned read API documentation.
#@csrf_exempt
def post(self,request,format=None):
try:
return_response={}
scan_attributes=General(data=request.data)
if scan_attributes.is_valid():
#return Response(scan_attributes.data)
try:
concurrent=request.data["concurrent"]
except Exception ,ex:
return_response["status"]="failure"
return_response["errors"]="Required Concurrent Field"
return_response["value"]="Required Concurrent Field"
return Response(JSONRenderer().render(return_response))
obj=Gui_main_driver.Gui_main()
scan_id=obj.exploits_pause(scan_attributes.data["project_id"],concurrent)
return_response["status"]="success" #+str(scan_attributes.data["project_name"])
return_response["response_code"]=str(scan_id)
return_response["value"]=str(scan_id)
return Response(JSONRenderer().render(return_response))
return_response["status"]="failure"
return_response["errors"]=scan_attributes.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response["status"]="failure"
return_response["errors"]=str(ee)
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
class ResumeScan(APIView):
Objective :
The objective of this class is to serve the Post method which would take the scan/project id
and would invoke appropriate backend python files Gui_main_driver.py to resume the scan.
In order to understand about input given to this method and response returned read API documentation.
#@csrf_exempt
def post(self,request,format=None):
scan_attributes=General(data=request.data)
return_response={}
if scan_attributes.is_valid():
#return Response(scan_attributes.data)
obj=Gui_main_driver.Gui_main()
scan_id=obj.main_resume(scan_attributes.data["project_id"],scan_attributes.data["assessment_id"],scan_attributes.data["app_id"])
return_response["status"]="success" #+str(scan_attributes.data["project_name"])
return_response["project_id"]=str(scan_id)
return_response["value"]=str(scan_id)
return Response(JSONRenderer().render(return_response))
return_response["status"]="failure"
return_response["errors"]=scan_attributes.errors
return_response["value"]=scan_attributes.errors
return Response(JSONRenderer().render(return_response))
class ResumeExploits(APIView):
Objective :
The objective of this class is to serve the Post method which would take the scan/project id
and would invoke appropriate backend python files Gui_main_driver.py to resume the vul scan
In order to understand about input given to this method and response returned read API documentation.
#@csrf_exempt
def post(self,request,format=None):
try:
scan_attributes=General(data=request.data)
return_response={}
if scan_attributes.is_valid():
#return Response(scan_attributes.data)
obj=Gui_main_driver.Gui_main()
scan_id=obj.exploits_resume(scan_attributes.data["project_id"])
return_response["status"]="success" #+str(scan_attributes.data["project_name"])
return_response["project_id"]=str(scan_id)
return_response["value"]=str(scan_id)
return Response(JSONRenderer().render(return_response))
return_response["status"]="failure"
return_response["errors"]=scan_attributes.errors
return_response["value"]=scan_attributes.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response["status"]="failure"
return_response["errors"]=str(ee)
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
class ExploitableProjects(APIView):
Objective :
The objective of this class is to serve the Post method which would return the project id's of the
projects for which the discovery would be over and would be eligible for vulnerability scan
In order to understand about input given to this method and response returned read API documentation.
def get(self,request,format=None):
obj=IPtable.Projects()
projects=obj.completed_projects()
project_list=[]
for project in projects:
#print str(project[0])+ " " +str(project[1])
project_dict={}
project_dict["id"]=project[0]
project_dict["name"]=project[1]
project_list.append(project_dict)
#print "\n\n\n My val is --->"+str(project_list)
return_response={}
try:
serialize=ProjectSerializer(data=project_list,many=True)
#print "\n\n\nserializers are :"+str(serialize)+"\n\n"
except Exception ,ee :
print "EXception " +str(ee)
return_response["status"]="failure"
return_response["errors"]=str(ee)
return Response(JSONRenderer().render(return_response))
if serialize.is_valid():
print "\n\nThe serlize data obtained !!\n\n"
print str(serialize.data)
return_response["status"]="success"
return_response["data"]=serialize.data
else:
return_response["status"]="failure"
return_response["errors"]=serialize.errors
return Response(JSONRenderer().render(return_response))
class ExploitConfig_overwrite(APIView):
Objective :
The objective of this class is to serve the Post method which would take the updated configuration
for a project and would delete the old configuration and results and would update to default
configuration .Thus invoking the file Gui_main_driver.py for the method updateDefaultconfiguration()
In order to understand about input given to this method and response returned read API documentation.
def configure_response(self,default_config):
print "IN configure response !"
config_list=[]
config_dict={}
return_val=[]
for config in default_config["value"]:
print str(config)
config_dict={}
#print str(project[0])+ " " +str(project[1])
config_dict["id"]=config[0]
config_dict["project_id"]=config[1]
config_dict["host"]=config[2]
config_dict["port"]=config[3]
config_dict["service"]=config[4]
config_dict["project_status"]=config[5]
config_dict["Commands"]=config[6]
config_dict["reconfig_service"]=False
config_dict["reconfig_exploit"]=False
config_list.append(config_dict)
return_val.append(config_dict)
return_val.append(config_list)
return return_val
def post(self,request,format=None):
print "\n\n IN post method of config overwrite !!!"
obj=Gui_main_driver.Gui_main()
project_id=request.data["project_id"]
continue_=False
delete=True
default_config=obj.Overwrite_and_GetDefaultConfiguration(project_id,'','',continue_,delete,False)
if default_config["status"]=="reconfig":
resp=self.configure_response(default_config)
config_dict=resp[0]
config_list=resp[1]
#print "\n\n\n"+str(project_list)
return_response={}
if 1:#serialize.is_valid():
return_response["status"]="success"
#return_response["data"]=serialize.data #Note Both work the same !!!
return_response["data"]=config_list#serialize.data #Thus while reteriving data we can simply send back query list to json data !!.No need to build wrapper
else:
return_response["status"]="failure"
return_response["errors"]=serialize.errors
return Response(JSONRenderer().render(return_response))
else:
print "\n\nReturning default config \n\n"
return Response(JSONRenderer().render(default_config))
class ExploitConfig(APIView):
Objective :
The objective of this class is to serve the Post method which would take the updated configuration
for a project and would update the configuration .Thus invoking the file Gui_main_driver.py for the
method updateDefaultconfiguration().Finally it will return the updated configuration
In order to understand about input given to this method and response returned read API documentation.
def post(self,request,format=None):
print "hello world !!"
return_response={}
all_values=[]
obj=Gui_main_driver.Gui_main()
try:
concurrent=request.data["concurrent"]
data_=Configuration(data=request.data["data"],many=True) #it transforms the underlying dictionary to ordered dictionary which is nothing but cololection of tuples.It does that recursively
#data_=test_multi(data=request.data["data"],many=True)
except Exception ,ee:
return_response["status"]="failure"
return_response["errors"]=str(ee)
return_response["value"]="Error message is -->"+str(ee)
return Response(JSONRenderer().render(return_response))
try:
if data_.is_valid(): #list of dictionaries with each dictionary contains list of dict
for key in data_.data: #key would be 1 dict
default_config={}
for i,(k,v) in enumerate(key.iteritems()): #keys would be project_id,commands and etc
#print "--->"+str(type(v))
default_config[k]=v
#print type(default_config)
all_values.append(dict(default_config))
project_id=data_.data[0]["project_id"]
print "Project id is : "+str(project_id)
continue_=False
delete=False
#print "----------------------------------"
#print str(all_values)
#print "\n\n-------------------"
print str(all_values)
if concurrent =="0":
update_result=obj.updateDefaultconfiguration(data_.data,project_id)
elif concurrent=="1":
update_result=obj.updateDefaultconfiguration(data_.data,project_id,'','',True)
print "The length of elements returned :"+str(len(update_result))
print "\n\nObtained result is :" +str(update_result)
return_response["status"]="success"
return_response["value"]=update_result[0] #tedupdate status of services
return_response["data"]=update_result[1] #the list of updated services
else:
return_response["status"]="failure"
return_response["value"]="Error message is :"+str(data_.errors)
return_response["errors"]=data_.errors
except Exception ,ee:
return_response["status"]="failure"
return_response["errors"]=str(ee)
return_response["value"]="Error message is :"+str(ee)
return Response(JSONRenderer().render(return_response))
return Response(JSONRenderer().render(return_response))
def configure_response(self,default_config):
print "IN configure response !"
config_list=[]
config_dict={}
return_val=[]
for config in default_config["value"]:
#print str(config)
config_dict={}
#print str(project[0])+ " " +str(project[1])
config_dict["id"]=config[0]
config_dict["project_id"]=config[1]
config_dict["host"]=config[2]
config_dict["port"]=config[3]
config_dict["service"]=config[4]
config_dict["project_status"]=config[5]
config_dict["Commands"]=config[6]
config_dict["reconfig_service"]=False
config_dict["reconfig_exploit"]=False
config_list.append(config_dict)
return_val.append(config_dict)
return_val.append(config_list)
return return_val
def get(self,request,format=None):
obj=Gui_main_driver.Gui_main()
project_id=request.data["project_id"]
continue_=False
delete=False
default_config=obj.getDefaultConfiguration(project_id,continue_,delete,False)
if default_config["status"]=="reconfig":
resp=self.configure_response(default_config)
config_dict=resp[0]
config_list=resp[1]
#print "\n\n\n"+str(project_list)
return_response={}
try:
print "Reached here"
#serialize=Configuration(data=config_dict)
#print "\n\n\nseturnrializers are :"+str(serialize)+"\n\n"
except Exception ,ee :
print "EXception " +str(ee)
return_response["status"]="failure"
return_response["errors"]=str(ee)
return Response(JSONRenderer().render(return_response))
if 1:#serialize.is_valid():
return_response["status"]="success"
#return_response["data"]=serialize.data #Note Both work the same !!!
return_response["data"]=config_list#serialize.data #Thus while reteriving data we can simply send back query list to json data !!.No need to build wrapper
else:
return_response["status"]="failure"
return_response["errors"]=serialize.errors
return Response(JSONRenderer().render(return_response))
else:
print "\n\nReturning default config \n\n"
return Response(JSONRenderer().render(default_config))
class LaunchExploits(APIView):
Objective :
The objective of this class is to serve the Post method which would take the project id as input and
would start vulneraibility scanning for the obtained project id.
It invokes Gui_main_driver.py file to start vulneribility scanning.
In order to understand about input given to this method and response returned read API documentation.
def post(self,request,format=None):
try:
self.project_obj=IPtable.Projects()
obj=Gui_main_driver.Gui_main()
exploit_data=Exploits(data=request.data)
return_response={}
if(exploit_data.is_valid()):
project_id=exploit_data.data["project_id"]
continue_=True
delete=False
get_default_config=False
threading=exploit_data.data["threading"]
result=self.project_obj.completed_projects(int(project_id))
if result[0] > 0:
exploit_status=obj.LaunchExploits(project_id,continue_,delete,get_default_config,threading)
return_response["status"]="success"
return_response["value"]=exploit_status
else:
return_response["status"]="failure"
return_response["value"]="In valid project id ."
else:
return_response["status"]="failure"
return_response["errors"]=exploit_data.errors
return Response(JSONRenderer().render(return_response))
except Exception,ee:
return_response={}
return_response["status"]="failure"
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
class LaunchExploitsConcurrent(APIView):
Objective :
The objective of this class is to serve the Post method which would take the project id as input and
would start vulneraibility scanning for the obtained project id.
It invokes Gui_main_driver.py file to start vulneribility scanning in concurrent mode.
In order to understand about input given to this method and response returned read API documentation.
def post(self,request,format=None):
try:
obj=Gui_main_driver.Gui_main()
exploit_data=ExploitsConcurrent(data=request.data)
return_response={}
if(exploit_data.is_valid()):
project_id=exploit_data.data["project_id"]
continue_=True
delete=False
get_default_config=False
threading=exploit_data.data["threading"]
if threading==True:
threading=False
rec_list=exploit_data.data["record_list"]
exploit_status=obj.LaunchExploits(project_id,continue_,delete,get_default_config,False,True,rec_list)
return_response["status"]="success"
return_response["value"]=exploit_status
else:
return_response["status"]="failure"
return_response["errors"]=exploit_data.errors
return Response(JSONRenderer().render(return_response))
except Exception,ee:
return_response={}
return_response["status"]="failure"
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
class DownloadAllMannual(APIView):
Objective :
The objective of this class is to serve the Post method which would take the project id as input and
would return a zipped folder containing all the reports, pcap files and etc.
In order to understand about input given to this method and response returned read API documentation.
def __init__(self):
self.folder_dir=os.path.dirname(os.path.realpath(__file__))
self.results_path=os.path.join(self.folder_dir,"Results")
self.folder_name=os.path.join(self.results_path,"Data_")
def zipdir(self,path,ziph):
for dirname,subdirs,files in os.walk(path):
abs_path_dir=dirname
rel_path_dir=abs_path_dir[len(path)+len(os.sep):]
print "ADd dir is :"+str(rel_path_dir)
for file_ in files:
abs_path=os.path.join(dirname,file_)
rel_path=abs_path[len(path)+len(os.sep):]
ziph.write(abs_path,rel_path)
def init_project_directory(self,project_id):
#print "Initialising parent directory "
try:
if not os.path.exists(self.folder_name+str(project_id)):
return -1
return 1;
except Exception ,ee:
#self.print_Error("Error while creating directory !!"+str(ee))
print "EX "+str(ee)
return -1
def post(self,request,format=None):
self.project_obj=IPtable.Projects()
try:
return_response={}
to_validate=General(data=request.data)
if to_validate.is_valid():
print str(to_validate.data)
project_id=to_validate.data["project_id"]
result=self.project_obj.completed_projects(int(project_id))
if result[0] > 0:
status=self.init_project_directory(project_id)
if status != -1:
self.data_path=self.folder_name+str(project_id)
zip_folder_name="Data_"+str(project_id)+".zip"
zip_folder_creation_path=os.path.join(self.results_path,zip_folder_name)
zip_folder_path=self.data_path #file to be zipped
zipf=zipfile.ZipFile(zip_folder_creation_path,'w',zipfile.ZIP_DEFLATED)
self.zipdir(zip_folder_path,zipf)
zipf.close()
zip_file=open(zip_folder_creation_path,'rb')
resp=HttpResponse(FileWrapper(zip_file),content_type="application/zip")
resp['content-Disposition']='attachment;filename="%s"'%'text.zip'
return resp
else:
return_response["status"]="failure"
return_response["value"]="No data is present for the given project id :"
else:
return_response["status"]="failure"
return_response["value"]="In valid project id ."
else:
return_response["status"]="failure"
return_response["value"]=to_validate.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response={}
return_response["status"]="failure"
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
class MergeReports(APIView):
Objective :
The objective of this class is to serve the Post method which would take the project id as input and
would return a zipped folder containing the merged qualys ,nessus and mannual vul scanning report.
In order to understand about input given to this method and response returned read API documentation.
def post(self,request,format=None):
obj=Report_orchestration.Report_merger(True,True)
self.project_obj=IPtable.Projects()
try:
return_response={}
to_validate=Merge_reports(data=request.data)
if to_validate.is_valid():
print str(to_validate.data)
project_id=to_validate.data["project_id"]
format_=to_validate.data["report_format"]
#obj=Report_merger(True,True)
result=self.project_obj.completed_projects(int(project_id))
if result[0] > 0:
resp=obj.generate_report(int(project_id),format_)
if resp["status"]=="success":
return_response["status"]="success"
return_response["value"]=resp["value"]
zip_file=open(resp["value"],'rb')
resp=HttpResponse(FileWrapper(zip_file),content_type="application/zip")
resp['content-Disposition']='attachment;filename="%s"'%'text.zip'
return resp
else:
return_response["status"]="failure"
return_response["value"]=resp["value"]
else:
return_response["status"]="failure"
return_response["value"]="In valid project id ."
else:
return_response["status"]="failure"
return_response["value"]=to_validate.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response={}
return_response["status"]="failure"
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
class UploadQualysXml(APIView):
Objective :
The objective of this class is to serve the Post method which would take the qualys xml report and
would parse it and store it in database table.
In order to understand about input given to this method and response returned read API documentation.
parser_classes=(MultiPartParser,)
def post(self,request,format=None):
try:
print "Inside Qualys XML :"
to_validate=UploadXml(data=request.data)
return_response={}
if to_validate.is_valid():
file_obj=request.FILES['filename']
F_validator=FileValidator.FileValidator()
is_xml=F_validator.validateXML(file_obj)
if is_xml:
#print "Validation results are :-->" +str(is_xml)
print str(file_obj.name)
folder_dir=os.path.dirname(os.path.realpath(__file__))
results_path=os.path.join(folder_dir,"XML_reports")
un_id=uuid.uuid1()
pid=to_validate.data["project_name"]
xml_file_name=str(file_obj.name)+"_pid:"+str(pid)+"_uid:"+str(un_id)+".xml"
xml_file_path=os.path.join(results_path,xml_file_name)
with open (xml_file_path,'wb') as out_file:
for chunks in file_obj.chunks():
out_file.write(chunks)
print "uploaded File :--> "+str(xml_file_path)
qualys=Qualys_parser.QualysParser()
qualys_results=None
val=qualys.parse(xml_file_path,int(pid))
if val["status"]=="success":
return_response["status"]="success"
return_response["value"]=str(pid)
else:
return_response["status"]="failure"
return_response["value"]=str(val["value"])
os.remove(xml_file_path)
print "File removed"
else:
return_response["status"]="failure"
return_response["value"]="Supplied file was not XML ,only XML type accepted"
else:
return_response["status"]="failure"
return_response["value"]=to_validate.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response={}
return_response["status"]="failure"
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
class ReportOnFly(APIView):
Objective :
The objective of this class is to serve the Post method which would take either qualys or nessus
report as input at one time and would parse the report and map cve's with exploits and would
return final copy of integrated report in the format chosen by user.
In order to understand about input given to this method and response returned read API documentation.
parser_classes=(MultiPartParser,)
def post(self,request,format=None):
try:
to_validate=OnFly(data=request.data)
return_response={}
if to_validate.is_valid():
file_obj=request.FILES['filename']
F_validator=FileValidator.FileValidator()
is_xml=F_validator.validateXML(file_obj)
if is_xml:
valid=["nessus","qualys"]
if (to_validate.data["source"] not in valid):
return_response["status"]="failure"
return_response["value"]="The source of report must be either qualys or nessus"
return Response(JSONRenderer().render(return_response))
print str(file_obj.name)
folder_dir=os.path.dirname(os.path.realpath(__file__))
results_path=os.path.join(folder_dir,"XML_reports")
un_id=uuid.uuid1()
xml_file_name=str(file_obj.name)+"_uid:"+str(un_id)+".xml"
xml_file_path=os.path.join(results_path,xml_file_name)
with open (xml_file_path,'wb') as out_file:
for chunks in file_obj.chunks():
out_file.write(chunks)
print "uploaded File -"+str(xml_file_path)
if to_validate.data["source"]=="nessus":
obj=Exploit_mapping.Exploit_mapping(xml_file_path)
else:
obj=Exploit_mapping.Exploit_mapping('',xml_file_path)
val=obj.generate_report(to_validate.data["report_format"])
os.remove(xml_file_path)
if val["status"]=="success":
print "Success reutrned"
#return_response["status"]="success"
#return_response["value"]=str(pid)
return_response["status"]="success"
return_response["value"]=val["value"]
zip_file=open(val["value"],'rb')
resp=HttpResponse(FileWrapper(zip_file),content_type="application/zip")
resp['content-Disposition']='attachment;filename="%s"'%'Report.zip'
return resp
else:
return_response["status"]="failure"
return_response["value"]=str(val["value"])
else:
return_response["status"]="failure"
return_response["value"]="Supplied file was not XML ,only XML type accepted"
else:
return_response["status"]="failure"
return_response["value"]=to_validate.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
print "Inside exception :"+str(ee)
return_response={}
return_response["status"]="failure"
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
#return Response(status=204)
class UploadNessusXml(APIView):
Objective :
The objective of this class is to serve the Post method which would take the nessus xml report and
would parse it and store it in database table.
In order to understand about input given to this method and response returned read API documentation.
parser_classes=(MultiPartParser,)
def post(self,request,format=None):
try:
to_validate=UploadXml(data=request.data)
return_response={}
if to_validate.is_valid():
file_obj=request.FILES['filename']
F_validator=FileValidator.FileValidator()
is_xml=F_validator.validateXML(file_obj)
if is_xml:
#print "Validation results are :-->" +str(is_xml)
print str(file_obj.name)
folder_dir=os.path.dirname(os.path.realpath(__file__))
results_path=os.path.join(folder_dir,"XML_reports")
un_id=uuid.uuid1()
pid=to_validate.data["project_name"]
xml_file_name=str(file_obj.name)+"_pid:"+str(pid)+"_uid:"+str(un_id)+".nessus"
xml_file_path=os.path.join(results_path,xml_file_name)
with open (xml_file_path,'wb') as out_file:
for chunks in file_obj.chunks():
out_file.write(chunks)
print "uploaded File -"+str(xml_file_path)
nessus=Nessus_parser.Nessus_Parser()
nessus_results=None # ('m.nessus','0','',"return"))
val=nessus.parse(xml_file_path,int(pid))
if val["status"]=="success":
return_response["status"]="success"
return_response["value"]=str(pid)
else:
return_response["status"]="failure"
return_response["value"]=str(val["value"])
os.remove(xml_file_path)
print "File removed"
else:
return_response["status"]="failure"
return_response["value"]="Supplied file was not XML ,only XML type accepted"
else:
return_response["status"]="failure"
return_response["value"]=to_validate.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response={}
return_response["status"]="failure"
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
#return Response(status=204)
class UploadNmapXml(APIView):
Objective :
The objective of this class is to serve the Post method which would take the nmap xml report and
would parse it and store it in database table.
In order to understand about input given to this method and response returned read API documentation.
parser_classes=(MultiPartParser,)
def post(self,request,format=None):
try:
IPtable_obj=IPtable.IPtable()
to_validate=UploadXml(data=request.data)
return_response={}
if to_validate.is_valid():
file_obj=request.FILES['filename']
F_validator=FileValidator.FileValidator()
is_xml=F_validator.validateXML(file_obj)
if is_xml:
#print "Validation results are :-->" +str(is_xml)
print str(file_obj.name)
folder_dir=os.path.dirname(os.path.realpath(__file__))
results_path=os.path.join(folder_dir,"XML_reports")
pid=IPtable_obj.Insert(to_validate.data["project_name"],'import',str(file_obj.name))
if (pid==-1):
return_response["status"]="failure"
return_response["value"]="Some error occured while inserting details"
return Response(JSONRenderer().render(return_response))
xml_file_name=str(file_obj.name)+"_"+str(pid)
xml_file_path=os.path.join(results_path,xml_file_name)
with open (xml_file_path,'wb') as out_file:
for chunks in file_obj.chunks():
out_file.write(chunks)
print "uploaded"
val=nmap_parser.Import('gui',xml_file_path,to_validate.data["project_name"],pid)
if val["status"]=="success":
return_response["status"]="success"
return_response["value"]=str(pid)
else:
return_response["status"]="failure"
return_response["value"]=str(val["value"])
else:
return_response["status"]="failure"
return_response["value"]="Supplied file was not XML ,only XML type accepted"
else:
return_response["status"]="failure"
return_response["value"]=to_validate.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response={}
return_response["status"]="failure"
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
class Reconfigure():
Objective :
The objective of this class is to help in reconfiguration of the input given by user for
updating configuration.It does not interact with the web service directly.
In order to understand about input given to this method and response returned read API
documentation.
def configure_response(self,default_config):
print "IN configure response !"
config_list=[]
config_dict={}
record_list=[]
return_val=[]
for config in default_config["value"]:
#print str(config)
config_dict={}
#print str(project[0])+ " " +str(project[1])
config_dict["id"]=config[0]
record_list.append(config[0])
config_dict["project_id"]=config[1]
config_dict["host"]=config[2]
config_dict["port"]=config[3]
config_dict["service"]=config[4]
config_dict["project_status"]=config[5]
config_dict["Commands"]=config[6]
config_dict["reconfig_service"]=False
config_dict["reconfig_exploit"]=False
config_list.append(config_dict)
return_val.append(config_dict)
return_val.append(config_list)
return_val.append(record_list)
return return_val
class PollingConfig(APIView):
Objective :
The objective of this class is to serve the Post-Get methods which would take the project id and would
return the configuration for the vul scanning for the records for which the discovery would be over.
This is essentially used in concurrent mode
In order to understand about input given to this method and response returned read API documentation.
def get(self,request,format=None):
try:
return_response={}
project_id=request.data["project_id"]
obj=Polling.PollingExploits(int(project_id))
continue_=False
delete=False
default_config=obj.getConfiguration()
if default_config["status"]=="reconfig":
exp_obj=Reconfigure()
resp=exp_obj.configure_response(default_config)
config_dict=resp[0]
config_list=resp[1]
record_list=resp[2]
return_response["status"]="success"
#return_response["data"]=serialize.data #Note Both work the same !!!
return_response["data"]=config_list
return_response["record_list"]=record_list
return Response(JSONRenderer().render(return_response))
else:
print "\n\n Returning default config \n\n"
return Response(JSONRenderer().render(default_config))
except Exception ,ee:
return_response["status"]="failure"
return_response["data"]=str(ee)
return Response(JSONRenderer().render(return_response))
def post(self,request,format=None):
try:
return_response={}
update_data=Polling_(data=request.data)
return_response={}
if(update_data.is_valid()):
project_id=update_data.data["project_id"]
record_list=update_data.data["record_list"]
obj=Polling.PollingExploits(int(project_id))
return_response=obj.UpdateStatus(record_list)
else:
return_response["status"]="failure"
return_response["errors"]=update_data.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response["status"]="failure"
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
class PercentPolling(APIView):
Objective :
The objective of this class is to serve the Get-Post method which would return teh percantage of the
completion in case of discovery and vulnerability scanning
In order to understand about input given to this method and response returned read API documentation.
def get(self,request,format=None):
try:
self.project_obj=IPtable.Projects()
return_response={}
poll_data=Poll_me(data=request.data)
if poll_data.is_valid():
project_id=request.data["project_id"]
result=self.project_obj.completed_projects(int(project_id))
if result[0] > 0:
obj=IPtable.Projects()
continue_=False
delete=False
valid_source=["discovery","scan"]
if request.data["source"] not in valid_source:
return_response["status"]="failure"
return_response["data"]="The source can either be scan or discovery"
return_response["value"]="The source can either be scan or discovery"
return Response(JSONRenderer().render(return_response))
poll_results=obj.Poll(int(project_id),request.data["source"])
if poll_results != -1:
return_response["status"]="success"
#return_response["data"]=serialize.data #Note Both work the same !!!
return_response["data"]=poll_results[0]
return_response["value"]=poll_results[0]
return Response(JSONRenderer().render(return_response))
else:
return_response["status"]="failure"
return_response["value"]="Cant fetch Polling status.Kindly check supplied params"
return_response["data"]="Cant fetch Polling status.Kindly check supplied params"
return Response(JSONRenderer().render(return_response))
else:
return_response["status"]="failure"
return_response["value"]="In valid project id"
return_response["data"]="In valid project id"
return Response(JSONRenderer().render(return_response))
else:
return_response["status"]="failure"
return_response["data"]=poll_data.errors
return_response["errors"]=poll_data.errors
return_response["value"]=poll_data.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response["status"]="failure"
return_response["data"]=str(ee)
return Response(JSONRenderer().render(return_response))
class PollingExploit(APIView):
Objective :
The objective of this class is to poll the vulnerability scanning and return results.
In order to understand about input given to this method and response returned read API documentation.
def get(self,request,format=None):
try:
self.project_obj=IPtable.Projects()
return_response={}
project_id=request.data["project_id"]
result=self.project_obj.completed_projects(int(project_id))
if result[0] > 0:
obj=Polling.PollingExploits(int(project_id))
continue_=False
delete=False
default_config=obj.ExploitPoll()
if default_config["status"]=="success":
exp_obj=Reconfigure()
resp=exp_obj.configure_response(default_config)
config_dict=resp[0]
config_list=resp[1]
record_list=resp[2]
return_response["status"]="success"
#return_response["data"]=serialize.data #Note Both work the same !!!
return_response["data"]=config_list
return_response["record_list"]=record_list
return Response(JSONRenderer().render(return_response))
else:
print "\n\n Returning default config \n\n"
return Response(JSONRenderer().render(default_config))
else:
return_response["status"]="failure"
return_response["data"]="In valid project id"
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response["status"]="failure"
return_response["data"]=str(ee)
return Response(JSONRenderer().render(return_response))
def post(self,request,format=None):
try:
return_response={}
update_data=Polling_(data=request.data)
return_response={}
if(update_data.is_valid()):
project_id=update_data.data["project_id"]
record_list=update_data.data["record_list"]
obj=Polling.PollingExploits(int(project_id))
return_response=obj.UpdateStatusExploit(record_list)
else:
return_response["status"]="failure"
return_response["errors"]=update_data.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response["status"]="failure"
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
class ExploitConfigConc(APIView):
Objective :
The objective of this class is to serve Get method which would poll the backend code
to fetch results of vulnerability scanning when mode is concurrent.
In order to understand about input given to this method and response returned read API documentation.
def get(self,request,format=None):
try:
return_response={}
obj=Gui_main_driver.Gui_main()
project_id=request.data["project_id"]
continue_=False
delete=False
default_config=obj.getDefaultConfiguration(project_id,'','',True,True,'')
if default_config["status"]=="reconfig":
exp_obj=Reconfigure()
resp=exp_obj.configure_response(default_config)
config_dict=resp[0]
config_list=resp[1]
record_list=resp[2]
return_response["status"]="success"
#return_response["data"]=serialize.data #Note Both work the same !!!
return_response["data"]=config_list
return_response["record_list"]=record_list
return Response(JSONRenderer().render(return_response))
else:
print "\n\n Returning default config \n\n"
return Response(JSONRenderer().render(default_config))
except Exception ,ee:
#except Exception ,ee:
return_response["status"]="failure"
return_response["data"]=str(ee)
return Response(JSONRenderer().render(return_response))
"""
| """
@Author :Furqan Khan
@Email :furqankhan08@gmail.com
@Date :1/3/2017
Objective :
The purpose of this file /module /Class is to map to serve teh Rest request
Depending upon the requested url the views module will fetch the data from the backend
python files and would transform the data to json format ,and would finally return the data back to the
requesting application.
class SetCsrf(APIView):
Objective :
This class is only for test purpose and it forces the framework to generate a csrf token
with custom authentication
@method_decorator(ensure_csrf_cookie)
def get(self,request,format=None):
return Response(JSONRenderer().render({"helllo":"world"}))
class UserList(APIView):
Objective :
The code is only for testing purpose and has no utility with final draft of code
def get(self,request,format=None):
Employee_dict={}
Employee_list=[]
Employee_dict["id"]=1
Employee_dict["name"]="Furqan Khan"
Employee_list.append(Employee_dict)
Employee_dict={}
Employee_dict["id"]=2
Employee_dict["name"]="Burhan Khan"
Employee_list.append(Employee_dict)
serialize=UserSerializer(Employee_list,many=True)
return Response(JSONRenderer().render(serialize.data))
#return JSONResponse(serialize.data)
class StartScanConcurrent(APIView):
Objective :
The objective of this class is to serve the Post method which would take the scan attributes
and would invoke appropriate backend python files Gui_main_driver.py to start the scan as a process.
Note :This class would invoke the dicovery and vulnerability scanning in concurrent mode.
IN order to understand about input given to this method and response returned read API documentation.
#@csrf_exempt
def post(self,request,format=None):
print "Request HIt :"
#data_=JSONParser().parse(request)
scan_attributes=ScanAttributes(data=request.data)
#scan_attributes=ScanAttributes(data=data_)
return_response={}
if scan_attributes.is_valid():
#return Response(scan_attributes.data)
obj=Gui_main_driver.Gui_main()
scan_id=obj.main_start(scan_attributes.data["project_name"],scan_attributes.data["IP_range"],scan_attributes.data["Port_range"],scan_attributes.data["switch"],"1","init",scan_attributes.data["assessment_id"],scan_attributes.data["app_id"],True)
if scan_id !=-1:
return_response["status"]="success" #+str(scan_attributes.data["project_name"])
return_response["project_id"]=str(scan_id)
return_response["value"]=str(scan_id)
else:
return_response["status"]="failure" #+str(scan_attributes.data["project_name"])
return_response["project_id"]=str(scan_id)
return_response["value"]=str(scan_id)
return Response(JSONRenderer().render(return_response))
return_response["status"]="failure"
return_response["errors"]=scan_attributes.errors
return_response["value"]=scan_attributes.errors
#return Response(return_response)
return Response(JSONRenderer().render(return_response))
class StartScan(APIView):
#@csrf_exempt
Objective :
The objective of this class is to serve the Post method which would take the scan attributes
and would invoke appropriate backend python files Gui_main._driver.py to start the scan as a process
Note :This class will invoke the backend code in sequential mode
IN order to understand about input given to this method and response returned read API documentation.
def post(self,request,format=None):
print "Request HIt :"
#data_=JSONParser().parse(request)
scan_attributes=ScanAttributes(data=request.data)
#scan_attributes=ScanAttributes(data=data_)
return_response={}
if scan_attributes.is_valid():
#return Response(scan_attributes.data)
obj=Gui_main_driver.Gui_main()
scan_id=obj.main_start(scan_attributes.data["project_name"],scan_attributes.data["IP_range"],scan_attributes.data["Port_range"],scan_attributes.data["switch"],"1","init",scan_attributes.data["assessment_id"],scan_attributes.data["app_id"])
if scan_id != -1:
return_response["status"]="success" #+str(scan_attributes.data["project_name"])
return_response["project_id"]=str(scan_id)
return_response["value"]=str(scan_id)
else:
return_response["status"]="failure"
return_response["value"]="-1"
return Response(JSONRenderer().render(return_response))
return_response["status"]="failure"
return_response["errors"]=scan_attributes.errors
return_response["value"]=scan_attributes.errors
#return Response(return_response)
return Response(JSONRenderer().render(return_response))
def get(self,request,format=None):
Employee_dict={}
Employee_list=[]
Employee_dict["id"]=1
Employee_dict["name"]="Furqan Khan"
Employee_list.append(Employee_dict)
Employee_dict={}
Employee_dict["id"]=2
Employee_dict["name"]="Burhan Khan"
Employee_list.append(Employee_dict)
serialize=UserSerializer(Employee_list,many=True)
return Response(serialize.data)
class StopScan(APIView):
Objective :
The objective of this class is to serve the Post method which would take the scan/project id
and would invoke appropriate backend python files Gui_main_driver.py to stop the scan
In order to understand about input given to this method and response returned read API documentation.
#@csrf_exempt
@method_decorator(csrf_protect)
def post(self,request,format=None):
scan_attributes=General(data=request.data)
return_response={}
if scan_attributes.is_valid():
#return Response(scan_attributes.data)
obj=Gui_main_driver.Gui_main()
scan_id=obj.main_pause(scan_attributes.data["project_id"],scan_attributes.data["assessment_id"],scan_attributes.data["app_id"])
if scan_id !=0:
return_response["status"]="success" #+str(scan_attributes.data["project_name"])
else:
return_response["status"]="failure"
return_response["response_code"]=str(scan_id)
return_response["value"]=str(scan_id)
#return Response(JSONRenderer().render(return_response))
return Response(JSONRenderer().render(return_response))
return_response["status"]="failure"
return_response["errors"]=scan_attributes.errors
return_response["value"]=scan_attributes.errors
return Response(JSONRenderer().render(return_response))
class StopScanConc(APIView):
Objective :
The objective of this class is to serve the Post method which would take the scan/project id
and would invoke appropriate backend python files Gui_main_driver.py to stop the scan
Note :This class would serve the purpose of stopping concurrent scan.Thus actually it would pause
both the discovery as well as the vulnerability scanning phase.
In order to understand about input given to this method and response returned read API documentation.
#@csrf_exempt
def post(self,request,format=None):
try:
scan_attributes=General(data=request.data)
return_response={}
if scan_attributes.is_valid():
#return Response(scan_attributes.data)
obj=Gui_main_driver.Gui_main()
scan_id=obj.main_pause(scan_attributes.data["project_id"],scan_attributes.data["assessment_id"],scan_attributes.data["app_id"])
exp_id=obj.exploits_pause(scan_attributes.data["project_id"],True)
return_response["status"]="success" #+str(scan_attributes.data["project_name"])
return_response["response_code"]=str(scan_id)
#return Response(JSONRenderer().render(return_response))
return Response(JSONRenderer().render(return_response))
else:
return_response["status"]="failure"
return_response["errors"]=scan_attributes.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response["status"]="failure"
return_response["errors"]=str(ee)
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
class ResumeScanConc(APIView):
Objective :
The objective of this class is to serve the Post method which would take the scan/project id
and would invoke appropriate backend python files Gui_main_driver.py to resume paused the scan
Note :This class would serve the purpose of resuming concurrent scan.Thus actually it would pause
both the discovery as well as the vulnerability scanning phase.
In order to understand about input given to this method and response returned read API documentation.
#@csrf_exempt
def post(self,request,format=None):
try:
scan_attributes=General(data=request.data)
return_response={}
if scan_attributes.is_valid():
#return Response(scan_attributes.data)
obj=Gui_main_driver.Gui_main()
scan_id=obj.main_resume(scan_attributes.data["project_id"],scan_attributes.data["assessment_id"],scan_attributes.data["app_id"],True)
return_response["status"]="success" #+str(scan_attributes.data["project_name"])
return_response["project_id"]=str(scan_id)
return_response["value"]=str(scan_id)
return Response(JSONRenderer().render(return_response))
else:
return_response["status"]="failure"
return_response["errors"]=scan_attributes.errors
return_response["value"]=scan_attributes.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response["status"]="failure"
return_response["errors"]=str(ee)
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
class StopExploits(APIView):
Objective :
The objective of this class is to serve the Post method which would take the scan/project id
and would invoke appropriate backend python files Gui_main_driver.py to stop the vulnerability scan
In order to understand about input given to this method and response returned read API documentation.
#@csrf_exempt
def post(self,request,format=None):
try:
return_response={}
scan_attributes=General(data=request.data)
if scan_attributes.is_valid():
#return Response(scan_attributes.data)
try:
concurrent=request.data["concurrent"]
except Exception ,ex:
return_response["status"]="failure"
return_response["errors"]="Required Concurrent Field"
return_response["value"]="Required Concurrent Field"
return Response(JSONRenderer().render(return_response))
obj=Gui_main_driver.Gui_main()
scan_id=obj.exploits_pause(scan_attributes.data["project_id"],concurrent)
return_response["status"]="success" #+str(scan_attributes.data["project_name"])
return_response["response_code"]=str(scan_id)
return_response["value"]=str(scan_id)
return Response(JSONRenderer().render(return_response))
return_response["status"]="failure"
return_response["errors"]=scan_attributes.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response["status"]="failure"
return_response["errors"]=str(ee)
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
class ResumeScan(APIView):
Objective :
The objective of this class is to serve the Post method which would take the scan/project id
and would invoke appropriate backend python files Gui_main_driver.py to resume the scan.
In order to understand about input given to this method and response returned read API documentation.
#@csrf_exempt
def post(self,request,format=None):
scan_attributes=General(data=request.data)
return_response={}
if scan_attributes.is_valid():
#return Response(scan_attributes.data)
obj=Gui_main_driver.Gui_main()
scan_id=obj.main_resume(scan_attributes.data["project_id"],scan_attributes.data["assessment_id"],scan_attributes.data["app_id"])
return_response["status"]="success" #+str(scan_attributes.data["project_name"])
return_response["project_id"]=str(scan_id)
return_response["value"]=str(scan_id)
return Response(JSONRenderer().render(return_response))
return_response["status"]="failure"
return_response["errors"]=scan_attributes.errors
return_response["value"]=scan_attributes.errors
return Response(JSONRenderer().render(return_response))
class ResumeExploits(APIView):
Objective :
The objective of this class is to serve the Post method which would take the scan/project id
and would invoke appropriate backend python files Gui_main_driver.py to resume the vul scan
In order to understand about input given to this method and response returned read API documentation.
#@csrf_exempt
def post(self,request,format=None):
try:
scan_attributes=General(data=request.data)
return_response={}
if scan_attributes.is_valid():
#return Response(scan_attributes.data)
obj=Gui_main_driver.Gui_main()
scan_id=obj.exploits_resume(scan_attributes.data["project_id"])
return_response["status"]="success" #+str(scan_attributes.data["project_name"])
return_response["project_id"]=str(scan_id)
return_response["value"]=str(scan_id)
return Response(JSONRenderer().render(return_response))
return_response["status"]="failure"
return_response["errors"]=scan_attributes.errors
return_response["value"]=scan_attributes.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response["status"]="failure"
return_response["errors"]=str(ee)
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
class ExploitableProjects(APIView):
Objective :
The objective of this class is to serve the Post method which would return the project id's of the
projects for which the discovery would be over and would be eligible for vulnerability scan
In order to understand about input given to this method and response returned read API documentation.
def get(self,request,format=None):
obj=IPtable.Projects()
projects=obj.completed_projects()
project_list=[]
for project in projects:
#print str(project[0])+ " " +str(project[1])
project_dict={}
project_dict["id"]=project[0]
project_dict["name"]=project[1]
project_list.append(project_dict)
#print "
My val is --->"+str(project_list)
return_response={}
try:
serialize=ProjectSerializer(data=project_list,many=True)
#print "
serializers are :"+str(serialize)+"
"
except Exception ,ee :
print "EXception " +str(ee)
return_response["status"]="failure"
return_response["errors"]=str(ee)
return Response(JSONRenderer().render(return_response))
if serialize.is_valid():
print "
The serlize data obtained !!
"
print str(serialize.data)
return_response["status"]="success"
return_response["data"]=serialize.data
else:
return_response["status"]="failure"
return_response["errors"]=serialize.errors
return Response(JSONRenderer().render(return_response))
class ExploitConfig_overwrite(APIView):
Objective :
The objective of this class is to serve the Post method which would take the updated configuration
for a project and would delete the old configuration and results and would update to default
configuration .Thus invoking the file Gui_main_driver.py for the method updateDefaultconfiguration()
In order to understand about input given to this method and response returned read API documentation.
def configure_response(self,default_config):
print "IN configure response !"
config_list=[]
config_dict={}
return_val=[]
for config in default_config["value"]:
print str(config)
config_dict={}
#print str(project[0])+ " " +str(project[1])
config_dict["id"]=config[0]
config_dict["project_id"]=config[1]
config_dict["host"]=config[2]
config_dict["port"]=config[3]
config_dict["service"]=config[4]
config_dict["project_status"]=config[5]
config_dict["Commands"]=config[6]
config_dict["reconfig_service"]=False
config_dict["reconfig_exploit"]=False
config_list.append(config_dict)
return_val.append(config_dict)
return_val.append(config_list)
return return_val
def post(self,request,format=None):
print "
IN post method of config overwrite !!!"
obj=Gui_main_driver.Gui_main()
project_id=request.data["project_id"]
continue_=False
delete=True
default_config=obj.Overwrite_and_GetDefaultConfiguration(project_id,'','',continue_,delete,False)
if default_config["status"]=="reconfig":
resp=self.configure_response(default_config)
config_dict=resp[0]
config_list=resp[1]
#print "
"+str(project_list)
return_response={}
if 1:#serialize.is_valid():
return_response["status"]="success"
#return_response["data"]=serialize.data #Note Both work the same !!!
return_response["data"]=config_list#serialize.data #Thus while reteriving data we can simply send back query list to json data !!.No need to build wrapper
else:
return_response["status"]="failure"
return_response["errors"]=serialize.errors
return Response(JSONRenderer().render(return_response))
else:
print "
Returning default config
"
return Response(JSONRenderer().render(default_config))
class ExploitConfig(APIView):
Objective :
The objective of this class is to serve the Post method which would take the updated configuration
for a project and would update the configuration .Thus invoking the file Gui_main_driver.py for the
method updateDefaultconfiguration().Finally it will return the updated configuration
In order to understand about input given to this method and response returned read API documentation.
def post(self,request,format=None):
print "hello world !!"
return_response={}
all_values=[]
obj=Gui_main_driver.Gui_main()
try:
concurrent=request.data["concurrent"]
data_=Configuration(data=request.data["data"],many=True) #it transforms the underlying dictionary to ordered dictionary which is nothing but cololection of tuples.It does that recursively
#data_=test_multi(data=request.data["data"],many=True)
except Exception ,ee:
return_response["status"]="failure"
return_response["errors"]=str(ee)
return_response["value"]="Error message is -->"+str(ee)
return Response(JSONRenderer().render(return_response))
try:
if data_.is_valid(): #list of dictionaries with each dictionary contains list of dict
for key in data_.data: #key would be 1 dict
default_config={}
for i,(k,v) in enumerate(key.iteritems()): #keys would be project_id,commands and etc
#print "--->"+str(type(v))
default_config[k]=v
#print type(default_config)
all_values.append(dict(default_config))
project_id=data_.data[0]["project_id"]
print "Project id is : "+str(project_id)
continue_=False
delete=False
#print "----------------------------------"
#print str(all_values)
#print "
-------------------"
print str(all_values)
if concurrent =="0":
update_result=obj.updateDefaultconfiguration(data_.data,project_id)
elif concurrent=="1":
update_result=obj.updateDefaultconfiguration(data_.data,project_id,'','',True)
print "The length of elements returned :"+str(len(update_result))
print "
Obtained result is :" +str(update_result)
return_response["status"]="success"
return_response["value"]=update_result[0] #tedupdate status of services
return_response["data"]=update_result[1] #the list of updated services
else:
return_response["status"]="failure"
return_response["value"]="Error message is :"+str(data_.errors)
return_response["errors"]=data_.errors
except Exception ,ee:
return_response["status"]="failure"
return_response["errors"]=str(ee)
return_response["value"]="Error message is :"+str(ee)
return Response(JSONRenderer().render(return_response))
return Response(JSONRenderer().render(return_response))
def configure_response(self,default_config):
print "IN configure response !"
config_list=[]
config_dict={}
return_val=[]
for config in default_config["value"]:
#print str(config)
config_dict={}
#print str(project[0])+ " " +str(project[1])
config_dict["id"]=config[0]
config_dict["project_id"]=config[1]
config_dict["host"]=config[2]
config_dict["port"]=config[3]
config_dict["service"]=config[4]
config_dict["project_status"]=config[5]
config_dict["Commands"]=config[6]
config_dict["reconfig_service"]=False
config_dict["reconfig_exploit"]=False
config_list.append(config_dict)
return_val.append(config_dict)
return_val.append(config_list)
return return_val
def get(self,request,format=None):
obj=Gui_main_driver.Gui_main()
project_id=request.data["project_id"]
continue_=False
delete=False
default_config=obj.getDefaultConfiguration(project_id,continue_,delete,False)
if default_config["status"]=="reconfig":
resp=self.configure_response(default_config)
config_dict=resp[0]
config_list=resp[1]
#print "
"+str(project_list)
return_response={}
try:
print "Reached here"
#serialize=Configuration(data=config_dict)
#print "
seturnrializers are :"+str(serialize)+"
"
except Exception ,ee :
print "EXception " +str(ee)
return_response["status"]="failure"
return_response["errors"]=str(ee)
return Response(JSONRenderer().render(return_response))
if 1:#serialize.is_valid():
return_response["status"]="success"
#return_response["data"]=serialize.data #Note Both work the same !!!
return_response["data"]=config_list#serialize.data #Thus while reteriving data we can simply send back query list to json data !!.No need to build wrapper
else:
return_response["status"]="failure"
return_response["errors"]=serialize.errors
return Response(JSONRenderer().render(return_response))
else:
print "
Returning default config
"
return Response(JSONRenderer().render(default_config))
class LaunchExploits(APIView):
Objective :
The objective of this class is to serve the Post method which would take the project id as input and
would start vulneraibility scanning for the obtained project id.
It invokes Gui_main_driver.py file to start vulneribility scanning.
In order to understand about input given to this method and response returned read API documentation.
def post(self,request,format=None):
try:
self.project_obj=IPtable.Projects()
obj=Gui_main_driver.Gui_main()
exploit_data=Exploits(data=request.data)
return_response={}
if(exploit_data.is_valid()):
project_id=exploit_data.data["project_id"]
continue_=True
delete=False
get_default_config=False
threading=exploit_data.data["threading"]
result=self.project_obj.completed_projects(int(project_id))
if result[0] > 0:
exploit_status=obj.LaunchExploits(project_id,continue_,delete,get_default_config,threading)
return_response["status"]="success"
return_response["value"]=exploit_status
else:
return_response["status"]="failure"
return_response["value"]="In valid project id ."
else:
return_response["status"]="failure"
return_response["errors"]=exploit_data.errors
return Response(JSONRenderer().render(return_response))
except Exception,ee:
return_response={}
return_response["status"]="failure"
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
class LaunchExploitsConcurrent(APIView):
Objective :
The objective of this class is to serve the Post method which would take the project id as input and
would start vulneraibility scanning for the obtained project id.
It invokes Gui_main_driver.py file to start vulneribility scanning in concurrent mode.
In order to understand about input given to this method and response returned read API documentation.
def post(self,request,format=None):
try:
obj=Gui_main_driver.Gui_main()
exploit_data=ExploitsConcurrent(data=request.data)
return_response={}
if(exploit_data.is_valid()):
project_id=exploit_data.data["project_id"]
continue_=True
delete=False
get_default_config=False
threading=exploit_data.data["threading"]
if threading==True:
threading=False
rec_list=exploit_data.data["record_list"]
exploit_status=obj.LaunchExploits(project_id,continue_,delete,get_default_config,False,True,rec_list)
return_response["status"]="success"
return_response["value"]=exploit_status
else:
return_response["status"]="failure"
return_response["errors"]=exploit_data.errors
return Response(JSONRenderer().render(return_response))
except Exception,ee:
return_response={}
return_response["status"]="failure"
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
class DownloadAllMannual(APIView):
Objective :
The objective of this class is to serve the Post method which would take the project id as input and
would return a zipped folder containing all the reports, pcap files and etc.
In order to understand about input given to this method and response returned read API documentation.
def __init__(self):
self.folder_dir=os.path.dirname(os.path.realpath(__file__))
self.results_path=os.path.join(self.folder_dir,"Results")
self.folder_name=os.path.join(self.results_path,"Data_")
def zipdir(self,path,ziph):
for dirname,subdirs,files in os.walk(path):
abs_path_dir=dirname
rel_path_dir=abs_path_dir[len(path)+len(os.sep):]
print "ADd dir is :"+str(rel_path_dir)
for file_ in files:
abs_path=os.path.join(dirname,file_)
rel_path=abs_path[len(path)+len(os.sep):]
ziph.write(abs_path,rel_path)
def init_project_directory(self,project_id):
#print "Initialising parent directory "
try:
if not os.path.exists(self.folder_name+str(project_id)):
return -1
return 1;
except Exception ,ee:
#self.print_Error("Error while creating directory !!"+str(ee))
print "EX "+str(ee)
return -1
def post(self,request,format=None):
self.project_obj=IPtable.Projects()
try:
return_response={}
to_validate=General(data=request.data)
if to_validate.is_valid():
print str(to_validate.data)
project_id=to_validate.data["project_id"]
result=self.project_obj.completed_projects(int(project_id))
if result[0] > 0:
status=self.init_project_directory(project_id)
if status != -1:
self.data_path=self.folder_name+str(project_id)
zip_folder_name="Data_"+str(project_id)+".zip"
zip_folder_creation_path=os.path.join(self.results_path,zip_folder_name)
zip_folder_path=self.data_path #file to be zipped
zipf=zipfile.ZipFile(zip_folder_creation_path,'w',zipfile.ZIP_DEFLATED)
self.zipdir(zip_folder_path,zipf)
zipf.close()
zip_file=open(zip_folder_creation_path,'rb')
resp=HttpResponse(FileWrapper(zip_file),content_type="application/zip")
resp['content-Disposition']='attachment;filename="%s"'%'text.zip'
return resp
else:
return_response["status"]="failure"
return_response["value"]="No data is present for the given project id :"
else:
return_response["status"]="failure"
return_response["value"]="In valid project id ."
else:
return_response["status"]="failure"
return_response["value"]=to_validate.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response={}
return_response["status"]="failure"
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
class MergeReports(APIView):
Objective :
The objective of this class is to serve the Post method which would take the project id as input and
would return a zipped folder containing the merged qualys ,nessus and mannual vul scanning report.
In order to understand about input given to this method and response returned read API documentation.
def post(self,request,format=None):
obj=Report_orchestration.Report_merger(True,True)
self.project_obj=IPtable.Projects()
try:
return_response={}
to_validate=Merge_reports(data=request.data)
if to_validate.is_valid():
print str(to_validate.data)
project_id=to_validate.data["project_id"]
format_=to_validate.data["report_format"]
#obj=Report_merger(True,True)
result=self.project_obj.completed_projects(int(project_id))
if result[0] > 0:
resp=obj.generate_report(int(project_id),format_)
if resp["status"]=="success":
return_response["status"]="success"
return_response["value"]=resp["value"]
zip_file=open(resp["value"],'rb')
resp=HttpResponse(FileWrapper(zip_file),content_type="application/zip")
resp['content-Disposition']='attachment;filename="%s"'%'text.zip'
return resp
else:
return_response["status"]="failure"
return_response["value"]=resp["value"]
else:
return_response["status"]="failure"
return_response["value"]="In valid project id ."
else:
return_response["status"]="failure"
return_response["value"]=to_validate.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response={}
return_response["status"]="failure"
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
class UploadQualysXml(APIView):
Objective :
The objective of this class is to serve the Post method which would take the qualys xml report and
would parse it and store it in database table.
In order to understand about input given to this method and response returned read API documentation.
parser_classes=(MultiPartParser,)
def post(self,request,format=None):
try:
print "Inside Qualys XML :"
to_validate=UploadXml(data=request.data)
return_response={}
if to_validate.is_valid():
file_obj=request.FILES['filename']
F_validator=FileValidator.FileValidator()
is_xml=F_validator.validateXML(file_obj)
if is_xml:
#print "Validation results are :-->" +str(is_xml)
print str(file_obj.name)
folder_dir=os.path.dirname(os.path.realpath(__file__))
results_path=os.path.join(folder_dir,"XML_reports")
un_id=uuid.uuid1()
pid=to_validate.data["project_name"]
xml_file_name=str(file_obj.name)+"_pid:"+str(pid)+"_uid:"+str(un_id)+".xml"
xml_file_path=os.path.join(results_path,xml_file_name)
with open (xml_file_path,'wb') as out_file:
for chunks in file_obj.chunks():
out_file.write(chunks)
print "uploaded File :--> "+str(xml_file_path)
qualys=Qualys_parser.QualysParser()
qualys_results=None
val=qualys.parse(xml_file_path,int(pid))
if val["status"]=="success":
return_response["status"]="success"
return_response["value"]=str(pid)
else:
return_response["status"]="failure"
return_response["value"]=str(val["value"])
os.remove(xml_file_path)
print "File removed"
else:
return_response["status"]="failure"
return_response["value"]="Supplied file was not XML ,only XML type accepted"
else:
return_response["status"]="failure"
return_response["value"]=to_validate.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response={}
return_response["status"]="failure"
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
class ReportOnFly(APIView):
Objective :
The objective of this class is to serve the Post method which would take either qualys or nessus
report as input at one time and would parse the report and map cve's with exploits and would
return final copy of integrated report in the format chosen by user.
In order to understand about input given to this method and response returned read API documentation.
parser_classes=(MultiPartParser,)
def post(self,request,format=None):
try:
to_validate=OnFly(data=request.data)
return_response={}
if to_validate.is_valid():
file_obj=request.FILES['filename']
F_validator=FileValidator.FileValidator()
is_xml=F_validator.validateXML(file_obj)
if is_xml:
valid=["nessus","qualys"]
if (to_validate.data["source"] not in valid):
return_response["status"]="failure"
return_response["value"]="The source of report must be either qualys or nessus"
return Response(JSONRenderer().render(return_response))
print str(file_obj.name)
folder_dir=os.path.dirname(os.path.realpath(__file__))
results_path=os.path.join(folder_dir,"XML_reports")
un_id=uuid.uuid1()
xml_file_name=str(file_obj.name)+"_uid:"+str(un_id)+".xml"
xml_file_path=os.path.join(results_path,xml_file_name)
with open (xml_file_path,'wb') as out_file:
for chunks in file_obj.chunks():
out_file.write(chunks)
print "uploaded File -"+str(xml_file_path)
if to_validate.data["source"]=="nessus":
obj=Exploit_mapping.Exploit_mapping(xml_file_path)
else:
obj=Exploit_mapping.Exploit_mapping('',xml_file_path)
val=obj.generate_report(to_validate.data["report_format"])
os.remove(xml_file_path)
if val["status"]=="success":
print "Success reutrned"
#return_response["status"]="success"
#return_response["value"]=str(pid)
return_response["status"]="success"
return_response["value"]=val["value"]
zip_file=open(val["value"],'rb')
resp=HttpResponse(FileWrapper(zip_file),content_type="application/zip")
resp['content-Disposition']='attachment;filename="%s"'%'Report.zip'
return resp
else:
return_response["status"]="failure"
return_response["value"]=str(val["value"])
else:
return_response["status"]="failure"
return_response["value"]="Supplied file was not XML ,only XML type accepted"
else:
return_response["status"]="failure"
return_response["value"]=to_validate.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
print "Inside exception :"+str(ee)
return_response={}
return_response["status"]="failure"
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
#return Response(status=204)
class UploadNessusXml(APIView):
Objective :
The objective of this class is to serve the Post method which would take the nessus xml report and
would parse it and store it in database table.
In order to understand about input given to this method and response returned read API documentation.
parser_classes=(MultiPartParser,)
def post(self,request,format=None):
try:
to_validate=UploadXml(data=request.data)
return_response={}
if to_validate.is_valid():
file_obj=request.FILES['filename']
F_validator=FileValidator.FileValidator()
is_xml=F_validator.validateXML(file_obj)
if is_xml:
#print "Validation results are :-->" +str(is_xml)
print str(file_obj.name)
folder_dir=os.path.dirname(os.path.realpath(__file__))
results_path=os.path.join(folder_dir,"XML_reports")
un_id=uuid.uuid1()
pid=to_validate.data["project_name"]
xml_file_name=str(file_obj.name)+"_pid:"+str(pid)+"_uid:"+str(un_id)+".nessus"
xml_file_path=os.path.join(results_path,xml_file_name)
with open (xml_file_path,'wb') as out_file:
for chunks in file_obj.chunks():
out_file.write(chunks)
print "uploaded File -"+str(xml_file_path)
nessus=Nessus_parser.Nessus_Parser()
nessus_results=None # ('m.nessus','0','',"return"))
val=nessus.parse(xml_file_path,int(pid))
if val["status"]=="success":
return_response["status"]="success"
return_response["value"]=str(pid)
else:
return_response["status"]="failure"
return_response["value"]=str(val["value"])
os.remove(xml_file_path)
print "File removed"
else:
return_response["status"]="failure"
return_response["value"]="Supplied file was not XML ,only XML type accepted"
else:
return_response["status"]="failure"
return_response["value"]=to_validate.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response={}
return_response["status"]="failure"
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
#return Response(status=204)
class UploadNmapXml(APIView):
Objective :
The objective of this class is to serve the Post method which would take the nmap xml report and
would parse it and store it in database table.
In order to understand about input given to this method and response returned read API documentation.
parser_classes=(MultiPartParser,)
def post(self,request,format=None):
try:
IPtable_obj=IPtable.IPtable()
to_validate=UploadXml(data=request.data)
return_response={}
if to_validate.is_valid():
file_obj=request.FILES['filename']
F_validator=FileValidator.FileValidator()
is_xml=F_validator.validateXML(file_obj)
if is_xml:
#print "Validation results are :-->" +str(is_xml)
print str(file_obj.name)
folder_dir=os.path.dirname(os.path.realpath(__file__))
results_path=os.path.join(folder_dir,"XML_reports")
pid=IPtable_obj.Insert(to_validate.data["project_name"],'import',str(file_obj.name))
if (pid==-1):
return_response["status"]="failure"
return_response["value"]="Some error occured while inserting details"
return Response(JSONRenderer().render(return_response))
xml_file_name=str(file_obj.name)+"_"+str(pid)
xml_file_path=os.path.join(results_path,xml_file_name)
with open (xml_file_path,'wb') as out_file:
for chunks in file_obj.chunks():
out_file.write(chunks)
print "uploaded"
val=nmap_parser.Import('gui',xml_file_path,to_validate.data["project_name"],pid)
if val["status"]=="success":
return_response["status"]="success"
return_response["value"]=str(pid)
else:
return_response["status"]="failure"
return_response["value"]=str(val["value"])
else:
return_response["status"]="failure"
return_response["value"]="Supplied file was not XML ,only XML type accepted"
else:
return_response["status"]="failure"
return_response["value"]=to_validate.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response={}
return_response["status"]="failure"
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
class Reconfigure():
Objective :
The objective of this class is to help in reconfiguration of the input given by user for
updating configuration.It does not interact with the web service directly.
In order to understand about input given to this method and response returned read API
documentation.
def configure_response(self,default_config):
print "IN configure response !"
config_list=[]
config_dict={}
record_list=[]
return_val=[]
for config in default_config["value"]:
#print str(config)
config_dict={}
#print str(project[0])+ " " +str(project[1])
config_dict["id"]=config[0]
record_list.append(config[0])
config_dict["project_id"]=config[1]
config_dict["host"]=config[2]
config_dict["port"]=config[3]
config_dict["service"]=config[4]
config_dict["project_status"]=config[5]
config_dict["Commands"]=config[6]
config_dict["reconfig_service"]=False
config_dict["reconfig_exploit"]=False
config_list.append(config_dict)
return_val.append(config_dict)
return_val.append(config_list)
return_val.append(record_list)
return return_val
class PollingConfig(APIView):
Objective :
The objective of this class is to serve the Post-Get methods which would take the project id and would
return the configuration for the vul scanning for the records for which the discovery would be over.
This is essentially used in concurrent mode
In order to understand about input given to this method and response returned read API documentation.
def get(self,request,format=None):
try:
return_response={}
project_id=request.data["project_id"]
obj=Polling.PollingExploits(int(project_id))
continue_=False
delete=False
default_config=obj.getConfiguration()
if default_config["status"]=="reconfig":
exp_obj=Reconfigure()
resp=exp_obj.configure_response(default_config)
config_dict=resp[0]
config_list=resp[1]
record_list=resp[2]
return_response["status"]="success"
#return_response["data"]=serialize.data #Note Both work the same !!!
return_response["data"]=config_list
return_response["record_list"]=record_list
return Response(JSONRenderer().render(return_response))
else:
print "
Returning default config
"
return Response(JSONRenderer().render(default_config))
except Exception ,ee:
return_response["status"]="failure"
return_response["data"]=str(ee)
return Response(JSONRenderer().render(return_response))
def post(self,request,format=None):
try:
return_response={}
update_data=Polling_(data=request.data)
return_response={}
if(update_data.is_valid()):
project_id=update_data.data["project_id"]
record_list=update_data.data["record_list"]
obj=Polling.PollingExploits(int(project_id))
return_response=obj.UpdateStatus(record_list)
else:
return_response["status"]="failure"
return_response["errors"]=update_data.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response["status"]="failure"
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
class PercentPolling(APIView):
Objective :
The objective of this class is to serve the Get-Post method which would return teh percantage of the
completion in case of discovery and vulnerability scanning
In order to understand about input given to this method and response returned read API documentation.
def get(self,request,format=None):
try:
self.project_obj=IPtable.Projects()
return_response={}
poll_data=Poll_me(data=request.data)
if poll_data.is_valid():
project_id=request.data["project_id"]
result=self.project_obj.completed_projects(int(project_id))
if result[0] > 0:
obj=IPtable.Projects()
continue_=False
delete=False
valid_source=["discovery","scan"]
if request.data["source"] not in valid_source:
return_response["status"]="failure"
return_response["data"]="The source can either be scan or discovery"
return_response["value"]="The source can either be scan or discovery"
return Response(JSONRenderer().render(return_response))
poll_results=obj.Poll(int(project_id),request.data["source"])
if poll_results != -1:
return_response["status"]="success"
#return_response["data"]=serialize.data #Note Both work the same !!!
return_response["data"]=poll_results[0]
return_response["value"]=poll_results[0]
return Response(JSONRenderer().render(return_response))
else:
return_response["status"]="failure"
return_response["value"]="Cant fetch Polling status.Kindly check supplied params"
return_response["data"]="Cant fetch Polling status.Kindly check supplied params"
return Response(JSONRenderer().render(return_response))
else:
return_response["status"]="failure"
return_response["value"]="In valid project id"
return_response["data"]="In valid project id"
return Response(JSONRenderer().render(return_response))
else:
return_response["status"]="failure"
return_response["data"]=poll_data.errors
return_response["errors"]=poll_data.errors
return_response["value"]=poll_data.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response["status"]="failure"
return_response["data"]=str(ee)
return Response(JSONRenderer().render(return_response))
class PollingExploit(APIView):
Objective :
The objective of this class is to poll the vulnerability scanning and return results.
In order to understand about input given to this method and response returned read API documentation.
def get(self,request,format=None):
try:
self.project_obj=IPtable.Projects()
return_response={}
project_id=request.data["project_id"]
result=self.project_obj.completed_projects(int(project_id))
if result[0] > 0:
obj=Polling.PollingExploits(int(project_id))
continue_=False
delete=False
default_config=obj.ExploitPoll()
if default_config["status"]=="success":
exp_obj=Reconfigure()
resp=exp_obj.configure_response(default_config)
config_dict=resp[0]
config_list=resp[1]
record_list=resp[2]
return_response["status"]="success"
#return_response["data"]=serialize.data #Note Both work the same !!!
return_response["data"]=config_list
return_response["record_list"]=record_list
return Response(JSONRenderer().render(return_response))
else:
print "
Returning default config
"
return Response(JSONRenderer().render(default_config))
else:
return_response["status"]="failure"
return_response["data"]="In valid project id"
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response["status"]="failure"
return_response["data"]=str(ee)
return Response(JSONRenderer().render(return_response))
def post(self,request,format=None):
try:
return_response={}
update_data=Polling_(data=request.data)
return_response={}
if(update_data.is_valid()):
project_id=update_data.data["project_id"]
record_list=update_data.data["record_list"]
obj=Polling.PollingExploits(int(project_id))
return_response=obj.UpdateStatusExploit(record_list)
else:
return_response["status"]="failure"
return_response["errors"]=update_data.errors
return Response(JSONRenderer().render(return_response))
except Exception ,ee:
return_response["status"]="failure"
return_response["value"]=str(ee)
return Response(JSONRenderer().render(return_response))
class ExploitConfigConc(APIView):
Objective :
The objective of this class is to serve Get method which would poll the backend code
to fetch results of vulnerability scanning when mode is concurrent.
In order to understand about input given to this method and response returned read API documentation.
def get(self,request,format=None):
try:
return_response={}
obj=Gui_main_driver.Gui_main()
project_id=request.data["project_id"]
continue_=False
delete=False
default_config=obj.getDefaultConfiguration(project_id,'','',True,True,'')
if default_config["status"]=="reconfig":
exp_obj=Reconfigure()
resp=exp_obj.configure_response(default_config)
config_dict=resp[0]
config_list=resp[1]
record_list=resp[2]
return_response["status"]="success"
#return_response["data"]=serialize.data #Note Both work the same !!!
return_response["data"]=config_list
return_response["record_list"]=record_list
return Response(JSONRenderer().render(return_response))
else:
print "
Returning default config
"
return Response(JSONRenderer().render(default_config))
except Exception ,ee:
#except Exception ,ee:
return_response["status"]="failure"
return_response["data"]=str(ee)
return Response(JSONRenderer().render(return_response))
""" |
#SPDX-License-Identifier: MIT
"""
Metrics that provide data about platform & their associated activity
"""
| """
Metrics that provide data about platform & their associated activity
""" |
#
# PySNMP MIB module Juniper-HTTP-Profile-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-HTTP-Profile-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:02:54 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint")
juniMibs, = mibBuilder.importSymbols("Juniper-MIBs", "juniMibs")
JuniSetMap, = mibBuilder.importSymbols("Juniper-TC", "JuniSetMap")
ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup")
Counter64, Bits, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, TimeTicks, ModuleIdentity, MibIdentifier, Unsigned32, Integer32, Gauge32, IpAddress, NotificationType, iso = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "Bits", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "TimeTicks", "ModuleIdentity", "MibIdentifier", "Unsigned32", "Integer32", "Gauge32", "IpAddress", "NotificationType", "iso")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
juniHttpProfileMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79))
juniHttpProfileMIB.setRevisions(('2005-08-19 14:21',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: juniHttpProfileMIB.setRevisionsDescriptions(('Initial version of this MIB module.',))
if mibBuilder.loadTexts: juniHttpProfileMIB.setLastUpdated('200508191421Z')
if mibBuilder.loadTexts: juniHttpProfileMIB.setOrganization('Juniper Networks, Inc.')
if mibBuilder.loadTexts: juniHttpProfileMIB.setContactInfo(' Juniper Networks, Inc. Postal: 10 Technology Park Drive Westford, MA 01886-3146 USA Tel: +1 978 589 5800 Email: mib@Juniper.net')
if mibBuilder.loadTexts: juniHttpProfileMIB.setDescription('The HTTP rofile MIB for the Juniper Networks, Inc. enterprise.')
juniHttpProfileObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79, 1))
juniHttpProfile = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79, 1, 1))
juniHttpProfileTable = MibTable((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79, 1, 1, 1), )
if mibBuilder.loadTexts: juniHttpProfileTable.setStatus('current')
if mibBuilder.loadTexts: juniHttpProfileTable.setDescription('This table contains profiles for configuring bulk ATM circuits. Entries in this table are created/deleted as a side-effect of corresponding operations to the juniProfileNameTable in the Juniper-PROFILE-MIB.')
juniHttpProfileEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79, 1, 1, 1, 1), ).setIndexNames((0, "Juniper-HTTP-Profile-MIB", "juniHttpProfileId"))
if mibBuilder.loadTexts: juniHttpProfileEntry.setStatus('current')
if mibBuilder.loadTexts: juniHttpProfileEntry.setDescription('A profile describing VCC configuration of an ATM subinterface.')
juniHttpProfileId = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79, 1, 1, 1, 1, 1), Unsigned32())
if mibBuilder.loadTexts: juniHttpProfileId.setStatus('current')
if mibBuilder.loadTexts: juniHttpProfileId.setDescription('The integer identifier associated with this profile. A value for this identifier is determined by locating or creating a profile name in the juniProfileNameTable.')
juniHttpProfileSetMap = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79, 1, 1, 1, 1, 2), JuniSetMap()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: juniHttpProfileSetMap.setStatus('current')
if mibBuilder.loadTexts: juniHttpProfileSetMap.setDescription("A bitmap representing which objects in this entry have been explicitly configured. See the definition of the JuniSetMap TEXTUAL-CONVENTION for details of use. The INDEX object(s) and this object are excluded from representation (i.e. their bits are never set). When a SET request does not explicitly configure JuniSetMap, bits in JuniSetMap are set as a side-effect of configuring other profile attributes in the same entry. If, however, a SET request explicitly configures JuniSetMap, the explicitly configured value overrides 1) any previous bit settings, and 2) any simultaneous 'side-effect' settings that would otherwise occur. Once set, bits can only be cleared by explicitly configuring JuniSetMap.")
juniHttpProfileRedirectUrl = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79, 1, 1, 1, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: juniHttpProfileRedirectUrl.setStatus('current')
if mibBuilder.loadTexts: juniHttpProfileRedirectUrl.setDescription('This object is a 64 byte string that will be used as the redirect URL when requests arrive at the HTTP server over the Ip Interface configured.')
juniHttpProfileConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79, 4))
juniHttpProfileCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79, 4, 1))
juniHttpProfileGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79, 4, 2))
juniHttpProfileCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79, 4, 1, 1)).setObjects(("Juniper-HTTP-Profile-MIB", "juniHttpProfileGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juniHttpProfileCompliance = juniHttpProfileCompliance.setStatus('current')
if mibBuilder.loadTexts: juniHttpProfileCompliance.setDescription('Compliance statement for entities which implement the Juniper HTTP Profile MIB.')
juniHttpProfileGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79, 4, 2, 1)).setObjects(("Juniper-HTTP-Profile-MIB", "juniHttpProfileSetMap"), ("Juniper-HTTP-Profile-MIB", "juniHttpProfileRedirectUrl"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juniHttpProfileGroup = juniHttpProfileGroup.setStatus('current')
if mibBuilder.loadTexts: juniHttpProfileGroup.setDescription('Current collection of objects providing management of profile functionality for per Interface HTTP objects in a Juniper product.')
mibBuilder.exportSymbols("Juniper-HTTP-Profile-MIB", juniHttpProfileSetMap=juniHttpProfileSetMap, juniHttpProfileGroups=juniHttpProfileGroups, juniHttpProfile=juniHttpProfile, juniHttpProfileCompliances=juniHttpProfileCompliances, juniHttpProfileCompliance=juniHttpProfileCompliance, juniHttpProfileRedirectUrl=juniHttpProfileRedirectUrl, juniHttpProfileTable=juniHttpProfileTable, juniHttpProfileMIB=juniHttpProfileMIB, PYSNMP_MODULE_ID=juniHttpProfileMIB, juniHttpProfileId=juniHttpProfileId, juniHttpProfileConformance=juniHttpProfileConformance, juniHttpProfileGroup=juniHttpProfileGroup, juniHttpProfileEntry=juniHttpProfileEntry, juniHttpProfileObjects=juniHttpProfileObjects)
| (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, constraints_union, value_size_constraint, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'ValueRangeConstraint', 'ConstraintsUnion', 'ValueSizeConstraint', 'SingleValueConstraint')
(juni_mibs,) = mibBuilder.importSymbols('Juniper-MIBs', 'juniMibs')
(juni_set_map,) = mibBuilder.importSymbols('Juniper-TC', 'JuniSetMap')
(module_compliance, notification_group, object_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup', 'ObjectGroup')
(counter64, bits, counter32, mib_scalar, mib_table, mib_table_row, mib_table_column, object_identity, time_ticks, module_identity, mib_identifier, unsigned32, integer32, gauge32, ip_address, notification_type, iso) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter64', 'Bits', 'Counter32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ObjectIdentity', 'TimeTicks', 'ModuleIdentity', 'MibIdentifier', 'Unsigned32', 'Integer32', 'Gauge32', 'IpAddress', 'NotificationType', 'iso')
(display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention')
juni_http_profile_mib = module_identity((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79))
juniHttpProfileMIB.setRevisions(('2005-08-19 14:21',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts:
juniHttpProfileMIB.setRevisionsDescriptions(('Initial version of this MIB module.',))
if mibBuilder.loadTexts:
juniHttpProfileMIB.setLastUpdated('200508191421Z')
if mibBuilder.loadTexts:
juniHttpProfileMIB.setOrganization('Juniper Networks, Inc.')
if mibBuilder.loadTexts:
juniHttpProfileMIB.setContactInfo(' Juniper Networks, Inc. Postal: 10 Technology Park Drive Westford, MA 01886-3146 USA Tel: +1 978 589 5800 Email: mib@Juniper.net')
if mibBuilder.loadTexts:
juniHttpProfileMIB.setDescription('The HTTP rofile MIB for the Juniper Networks, Inc. enterprise.')
juni_http_profile_objects = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79, 1))
juni_http_profile = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79, 1, 1))
juni_http_profile_table = mib_table((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79, 1, 1, 1))
if mibBuilder.loadTexts:
juniHttpProfileTable.setStatus('current')
if mibBuilder.loadTexts:
juniHttpProfileTable.setDescription('This table contains profiles for configuring bulk ATM circuits. Entries in this table are created/deleted as a side-effect of corresponding operations to the juniProfileNameTable in the Juniper-PROFILE-MIB.')
juni_http_profile_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79, 1, 1, 1, 1)).setIndexNames((0, 'Juniper-HTTP-Profile-MIB', 'juniHttpProfileId'))
if mibBuilder.loadTexts:
juniHttpProfileEntry.setStatus('current')
if mibBuilder.loadTexts:
juniHttpProfileEntry.setDescription('A profile describing VCC configuration of an ATM subinterface.')
juni_http_profile_id = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79, 1, 1, 1, 1, 1), unsigned32())
if mibBuilder.loadTexts:
juniHttpProfileId.setStatus('current')
if mibBuilder.loadTexts:
juniHttpProfileId.setDescription('The integer identifier associated with this profile. A value for this identifier is determined by locating or creating a profile name in the juniProfileNameTable.')
juni_http_profile_set_map = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79, 1, 1, 1, 1, 2), juni_set_map()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
juniHttpProfileSetMap.setStatus('current')
if mibBuilder.loadTexts:
juniHttpProfileSetMap.setDescription("A bitmap representing which objects in this entry have been explicitly configured. See the definition of the JuniSetMap TEXTUAL-CONVENTION for details of use. The INDEX object(s) and this object are excluded from representation (i.e. their bits are never set). When a SET request does not explicitly configure JuniSetMap, bits in JuniSetMap are set as a side-effect of configuring other profile attributes in the same entry. If, however, a SET request explicitly configures JuniSetMap, the explicitly configured value overrides 1) any previous bit settings, and 2) any simultaneous 'side-effect' settings that would otherwise occur. Once set, bits can only be cleared by explicitly configuring JuniSetMap.")
juni_http_profile_redirect_url = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79, 1, 1, 1, 1, 3), display_string().subtype(subtypeSpec=value_size_constraint(0, 64))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
juniHttpProfileRedirectUrl.setStatus('current')
if mibBuilder.loadTexts:
juniHttpProfileRedirectUrl.setDescription('This object is a 64 byte string that will be used as the redirect URL when requests arrive at the HTTP server over the Ip Interface configured.')
juni_http_profile_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79, 4))
juni_http_profile_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79, 4, 1))
juni_http_profile_groups = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79, 4, 2))
juni_http_profile_compliance = module_compliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79, 4, 1, 1)).setObjects(('Juniper-HTTP-Profile-MIB', 'juniHttpProfileGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juni_http_profile_compliance = juniHttpProfileCompliance.setStatus('current')
if mibBuilder.loadTexts:
juniHttpProfileCompliance.setDescription('Compliance statement for entities which implement the Juniper HTTP Profile MIB.')
juni_http_profile_group = object_group((1, 3, 6, 1, 4, 1, 4874, 2, 2, 79, 4, 2, 1)).setObjects(('Juniper-HTTP-Profile-MIB', 'juniHttpProfileSetMap'), ('Juniper-HTTP-Profile-MIB', 'juniHttpProfileRedirectUrl'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juni_http_profile_group = juniHttpProfileGroup.setStatus('current')
if mibBuilder.loadTexts:
juniHttpProfileGroup.setDescription('Current collection of objects providing management of profile functionality for per Interface HTTP objects in a Juniper product.')
mibBuilder.exportSymbols('Juniper-HTTP-Profile-MIB', juniHttpProfileSetMap=juniHttpProfileSetMap, juniHttpProfileGroups=juniHttpProfileGroups, juniHttpProfile=juniHttpProfile, juniHttpProfileCompliances=juniHttpProfileCompliances, juniHttpProfileCompliance=juniHttpProfileCompliance, juniHttpProfileRedirectUrl=juniHttpProfileRedirectUrl, juniHttpProfileTable=juniHttpProfileTable, juniHttpProfileMIB=juniHttpProfileMIB, PYSNMP_MODULE_ID=juniHttpProfileMIB, juniHttpProfileId=juniHttpProfileId, juniHttpProfileConformance=juniHttpProfileConformance, juniHttpProfileGroup=juniHttpProfileGroup, juniHttpProfileEntry=juniHttpProfileEntry, juniHttpProfileObjects=juniHttpProfileObjects) |
# create_trusted_globals_dict takes in a module name [module_name], a trusted values dictionary [trusted_values_dict],
# and a boolean [first_time].
# Called by run_test
def create_trusted_globals_dict(self):
# If module is being run for the first time, a trusted_values_dict entry doesn't exist; return an empty dictionary.
if self.first_time:
return {}
# Otherwise, return the trusted_values_dict entry for the string [module_name] with the word 'Globals' concatenated
# onto its end -- this is the standard naming scheme for NRPy unit tests.
else:
return self.trusted_values_dict[self.trusted_values_dict_name]
| def create_trusted_globals_dict(self):
if self.first_time:
return {}
else:
return self.trusted_values_dict[self.trusted_values_dict_name] |
class Truckloads:
def numTrucks(self, numCrates, loadSize):
if numCrates <= loadSize:
return 1
return self.numTrucks(numCrates/2, loadSize) + self.numTrucks((numCrates+1)/2, loadSize)
| class Truckloads:
def num_trucks(self, numCrates, loadSize):
if numCrates <= loadSize:
return 1
return self.numTrucks(numCrates / 2, loadSize) + self.numTrucks((numCrates + 1) / 2, loadSize) |
#!/usr/bin/env python3
def proc(x):
print(x)
x = proc("testing 1, 2, 3...")
print("below is x: ")
print(x)
print("above is x: ")
| def proc(x):
print(x)
x = proc('testing 1, 2, 3...')
print('below is x: ')
print(x)
print('above is x: ') |
GET_POWER_FLOW_REALTIME_DATA = {
'timestamp': {
'value': '2019-01-10T23:33:12+01:00'
},
'status': {
'Code': 0,
'Reason': '',
'UserMessage': ''
},
'energy_day': {
'value': 0,
'unit': 'Wh'
},
'energy_total': {
'value': 26213502,
'unit': 'Wh'
},
'energy_year': {
'value': 12400.100586,
'unit': 'Wh'
},
'meter_location': {
'value': 'load'
},
'meter_mode': {
'value': 'vague-meter'
},
'power_battery': {
'value': None,
'unit': 'W'
},
'power_grid': {
'value': 367.722145,
'unit': 'W'
},
'power_load': {
'value': -367.722145,
'unit': 'W'
},
'power_photovoltaics': {
'value': None,
'unit': 'W'
}
}
GET_METER_REALTIME_DATA_SYSTEM = {
'timestamp': {
'value': '2019-01-10T23:33:13+01:00'
},
'status': {
'Code': 0,
'Reason': '',
'UserMessage': ''
},
'meters': {
'0': {
'power_real': {
'value': -367.722145,
'unit': 'W'
},
'meter_location': {
'value': 1
},
'enable': {
'value': 1
},
'visible': {
'value': 1
},
'manufacturer': {
'value': 'Fronius'
},
'model': {
'value': ''
},
'serial': {
'value': ''
}
}
}
}
GET_METER_REALTIME_DATA_SCOPE_DEVICE = {
'timestamp': {
'value': '2019-01-10T23:33:14+01:00'
},
'status': {
'Code': 0,
'Reason': '',
'UserMessage': ''
},
'power_real': {
'value': -367.722145,
'unit': 'W'
},
'meter_location': {
'value': 1
},
'enable': {
'value': 1
},
'visible': {
'value': 1
},
'manufacturer': {
'value': 'Fronius'
},
'model': {
'value': ''
},
'serial': {
'value': ''
}
}
GET_INVERTER_REALTIME_DATA_SCOPE_DEVICE = {
'timestamp': {
'value': '2019-01-10T23:33:15+01:00'
},
'status': {
'Code': 0,
'Reason': '',
'UserMessage': ''
},
'energy_day': {
'value': 0,
'unit': 'Wh'
},
'energy_total': {
'value': 26213502,
'unit': 'Wh'
},
'energy_year': {
'value': 12400.1,
'unit': 'Wh'
}
}
GET_INVERTER_REALTIME_DATA_SYSTEM = {
'timestamp': {
'value': '2019-01-10T23:33:16+01:00'
},
'status': {
'Code': 0,
'Reason': '',
'UserMessage': ''
},
'energy_day': {
'value': 0,
'unit': 'Wh'
},
'energy_total': {
'value': 26213502,
'unit': 'Wh'
},
'energy_year': {
'value': 12400,
'unit': 'Wh'
},
'power_ac': {
'value': 0,
'unit': 'W'
},
'inverters': {
'1': {
'energy_day': {
'value': 0,
'unit': 'Wh'
},
'energy_total': {
'value': 26213502,
'unit': 'Wh'
},
'energy_year': {
'value': 12400,
'unit': 'Wh'
},
'power_ac': {
'value': 0,
'unit': 'Wh'
}
}
}
}
| get_power_flow_realtime_data = {'timestamp': {'value': '2019-01-10T23:33:12+01:00'}, 'status': {'Code': 0, 'Reason': '', 'UserMessage': ''}, 'energy_day': {'value': 0, 'unit': 'Wh'}, 'energy_total': {'value': 26213502, 'unit': 'Wh'}, 'energy_year': {'value': 12400.100586, 'unit': 'Wh'}, 'meter_location': {'value': 'load'}, 'meter_mode': {'value': 'vague-meter'}, 'power_battery': {'value': None, 'unit': 'W'}, 'power_grid': {'value': 367.722145, 'unit': 'W'}, 'power_load': {'value': -367.722145, 'unit': 'W'}, 'power_photovoltaics': {'value': None, 'unit': 'W'}}
get_meter_realtime_data_system = {'timestamp': {'value': '2019-01-10T23:33:13+01:00'}, 'status': {'Code': 0, 'Reason': '', 'UserMessage': ''}, 'meters': {'0': {'power_real': {'value': -367.722145, 'unit': 'W'}, 'meter_location': {'value': 1}, 'enable': {'value': 1}, 'visible': {'value': 1}, 'manufacturer': {'value': 'Fronius'}, 'model': {'value': ''}, 'serial': {'value': ''}}}}
get_meter_realtime_data_scope_device = {'timestamp': {'value': '2019-01-10T23:33:14+01:00'}, 'status': {'Code': 0, 'Reason': '', 'UserMessage': ''}, 'power_real': {'value': -367.722145, 'unit': 'W'}, 'meter_location': {'value': 1}, 'enable': {'value': 1}, 'visible': {'value': 1}, 'manufacturer': {'value': 'Fronius'}, 'model': {'value': ''}, 'serial': {'value': ''}}
get_inverter_realtime_data_scope_device = {'timestamp': {'value': '2019-01-10T23:33:15+01:00'}, 'status': {'Code': 0, 'Reason': '', 'UserMessage': ''}, 'energy_day': {'value': 0, 'unit': 'Wh'}, 'energy_total': {'value': 26213502, 'unit': 'Wh'}, 'energy_year': {'value': 12400.1, 'unit': 'Wh'}}
get_inverter_realtime_data_system = {'timestamp': {'value': '2019-01-10T23:33:16+01:00'}, 'status': {'Code': 0, 'Reason': '', 'UserMessage': ''}, 'energy_day': {'value': 0, 'unit': 'Wh'}, 'energy_total': {'value': 26213502, 'unit': 'Wh'}, 'energy_year': {'value': 12400, 'unit': 'Wh'}, 'power_ac': {'value': 0, 'unit': 'W'}, 'inverters': {'1': {'energy_day': {'value': 0, 'unit': 'Wh'}, 'energy_total': {'value': 26213502, 'unit': 'Wh'}, 'energy_year': {'value': 12400, 'unit': 'Wh'}, 'power_ac': {'value': 0, 'unit': 'Wh'}}}} |
"""
Problem 4.
The greatest common divisor of two positive integers is the largest
integer that divides each of them without remainder. For example:
gcd(2, 12) = 2
gcd(6, 12) = 6
gcd(9, 12) = 3
gcd(17, 12) = 1
Write an iterative function, gcdIter(a, b), that implements this
idea. One easy way to do this is to begin with a test value equal
to the smaller of the two input arguments, and iteratively reduce
this test value by 1 until you either reach a case where the test
divides both a and b without remainder, or you reach 1.
"""
def gcdIter(a, b):
'''
a, b: positive integers
returns: a positive integer, the greatest common divisor of a & b.
'''
m = a % b
while m > 0:
a = b
b = m
m = a % b
return b
| """
Problem 4.
The greatest common divisor of two positive integers is the largest
integer that divides each of them without remainder. For example:
gcd(2, 12) = 2
gcd(6, 12) = 6
gcd(9, 12) = 3
gcd(17, 12) = 1
Write an iterative function, gcdIter(a, b), that implements this
idea. One easy way to do this is to begin with a test value equal
to the smaller of the two input arguments, and iteratively reduce
this test value by 1 until you either reach a case where the test
divides both a and b without remainder, or you reach 1.
"""
def gcd_iter(a, b):
"""
a, b: positive integers
returns: a positive integer, the greatest common divisor of a & b.
"""
m = a % b
while m > 0:
a = b
b = m
m = a % b
return b |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Python implementation of BlastLine, an alternative Cython implementation is
available in .cblast.BlastLine, which may be up to 2x faster
"""
class BlastLine(object):
__slots__ = ('query', 'subject', 'pctid', 'hitlen', 'nmismatch', 'ngaps', \
'qstart', 'qstop', 'sstart', 'sstop', 'evalue', 'score', \
'qseqid', 'sseqid', 'qi', 'si', 'orientation')
def __init__(self, sline):
args = sline.split("\t")
self.query = args[0]
self.subject = args[1]
self.pctid = float(args[2])
self.hitlen = int(args[3])
self.nmismatch = int(args[4])
self.ngaps = int(args[5])
self.qstart = int(args[6])
self.qstop = int(args[7])
self.sstart = int(args[8])
self.sstop = int(args[9])
if len(args) > 10:
self.evalue = float(args[10])
self.score = float(args[11])
self.orientation = '+'
if self.qstart > self.qstop:
self.qstart, self.qstop = self.qstop, self.qstart
self.orientation = '-'
if self.sstart > self.sstop:
self.sstart, self.sstop = self.sstop, self.sstart
self.orientation = '-'
@property
def has_score(self):
return hasattr(self, "score")
def __repr__(self):
return "BlastLine('%s' to '%s', eval=%.3f, score=%.1f)" % \
(self.query, self.subject, self.evalue, self.score)
def __str__(self):
if self.has_score:
args = [getattr(self, attr) for attr in BlastLine.__slots__[:12]]
else:
args = [getattr(self, attr) for attr in BlastLine.__slots__[:10]]
if self.orientation == '-':
args[8], args[9] = args[9], args[8]
return "\t".join(str(x) for x in args)
@property
def swapped(self):
"""
Swap query and subject.
"""
args = [getattr(self, attr) for attr in BlastLine.__slots__[:12]]
args[0:2] = [self.subject, self.query]
args[6:10] = [self.sstart, self.sstop, self.qstart, self.qstop]
if self.orientation == '-':
args[8], args[9] = args[9], args[8]
b = "\t".join(str(x) for x in args)
return BlastLine(b)
@property
def bedline(self):
return "\t".join(str(x) for x in \
(self.subject, self.sstart - 1, self.sstop, self.query,
self.score, self.orientation))
| """
Python implementation of BlastLine, an alternative Cython implementation is
available in .cblast.BlastLine, which may be up to 2x faster
"""
class Blastline(object):
__slots__ = ('query', 'subject', 'pctid', 'hitlen', 'nmismatch', 'ngaps', 'qstart', 'qstop', 'sstart', 'sstop', 'evalue', 'score', 'qseqid', 'sseqid', 'qi', 'si', 'orientation')
def __init__(self, sline):
args = sline.split('\t')
self.query = args[0]
self.subject = args[1]
self.pctid = float(args[2])
self.hitlen = int(args[3])
self.nmismatch = int(args[4])
self.ngaps = int(args[5])
self.qstart = int(args[6])
self.qstop = int(args[7])
self.sstart = int(args[8])
self.sstop = int(args[9])
if len(args) > 10:
self.evalue = float(args[10])
self.score = float(args[11])
self.orientation = '+'
if self.qstart > self.qstop:
(self.qstart, self.qstop) = (self.qstop, self.qstart)
self.orientation = '-'
if self.sstart > self.sstop:
(self.sstart, self.sstop) = (self.sstop, self.sstart)
self.orientation = '-'
@property
def has_score(self):
return hasattr(self, 'score')
def __repr__(self):
return "BlastLine('%s' to '%s', eval=%.3f, score=%.1f)" % (self.query, self.subject, self.evalue, self.score)
def __str__(self):
if self.has_score:
args = [getattr(self, attr) for attr in BlastLine.__slots__[:12]]
else:
args = [getattr(self, attr) for attr in BlastLine.__slots__[:10]]
if self.orientation == '-':
(args[8], args[9]) = (args[9], args[8])
return '\t'.join((str(x) for x in args))
@property
def swapped(self):
"""
Swap query and subject.
"""
args = [getattr(self, attr) for attr in BlastLine.__slots__[:12]]
args[0:2] = [self.subject, self.query]
args[6:10] = [self.sstart, self.sstop, self.qstart, self.qstop]
if self.orientation == '-':
(args[8], args[9]) = (args[9], args[8])
b = '\t'.join((str(x) for x in args))
return blast_line(b)
@property
def bedline(self):
return '\t'.join((str(x) for x in (self.subject, self.sstart - 1, self.sstop, self.query, self.score, self.orientation))) |
#
# PySNMP MIB module Wellfleet-CONSOLE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-CONSOLE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:39:44 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, SingleValueConstraint, ConstraintsUnion, ValueRangeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsUnion", "ValueRangeConstraint", "ConstraintsIntersection")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
TimeTicks, ModuleIdentity, Gauge32, Unsigned32, iso, Counter32, Bits, ObjectIdentity, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, Integer32, NotificationType, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "TimeTicks", "ModuleIdentity", "Gauge32", "Unsigned32", "iso", "Counter32", "Bits", "ObjectIdentity", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "Integer32", "NotificationType", "IpAddress")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
wfServices, wfSerialPortGroup = mibBuilder.importSymbols("Wellfleet-COMMON-MIB", "wfServices", "wfSerialPortGroup")
wfConsole = MibIdentifier((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1))
wfBaudRate = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 1), Integer32().clone(9600)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfBaudRate.setStatus('obsolete')
if mibBuilder.loadTexts: wfBaudRate.setDescription('Baud rate configured on the Technician Interface console')
wfDataBits = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 2), Integer32().clone(8)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfDataBits.setStatus('obsolete')
if mibBuilder.loadTexts: wfDataBits.setDescription('Number of data bits configured on the Technician Interface console')
wfParity = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("none", 1), ("odd", 2), ("even", 3))).clone('none')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfParity.setStatus('obsolete')
if mibBuilder.loadTexts: wfParity.setDescription('Type of parity configured on the Technician Interface console')
wfStopBits = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("s1bit", 1), ("s15bit", 2), ("s2bit", 3))).clone('s1bit')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfStopBits.setStatus('obsolete')
if mibBuilder.loadTexts: wfStopBits.setDescription('Number of stop bits configured on the Technician Interface console')
wfModemEnable = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfModemEnable.setStatus('obsolete')
if mibBuilder.loadTexts: wfModemEnable.setDescription('Enable the Technician Interface console to run over a modem')
wfLinesPerScreen = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 6), Integer32().clone(24)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfLinesPerScreen.setStatus('obsolete')
if mibBuilder.loadTexts: wfLinesPerScreen.setDescription('Number of lines which can be displayed in one screen on the Technician Interface console')
wfMoreEnable = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('enabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfMoreEnable.setStatus('obsolete')
if mibBuilder.loadTexts: wfMoreEnable.setDescription("Enable the 'more' feature on the Technician Interface console")
wfPrompt = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 8), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfPrompt.setStatus('obsolete')
if mibBuilder.loadTexts: wfPrompt.setDescription('Character string which will be used as the system prompt on the Technician Interface console')
wfLoginTimeOut = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 99)).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfLoginTimeOut.setStatus('obsolete')
if mibBuilder.loadTexts: wfLoginTimeOut.setDescription('IF MODEM_ENABLED then time out in minutes to HUP when at the login prompt')
wfPasswordTimeOut = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 99)).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfPasswordTimeOut.setStatus('obsolete')
if mibBuilder.loadTexts: wfPasswordTimeOut.setDescription('Timout on Password entry')
wfCommandTimeOut = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 99)).clone(15)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfCommandTimeOut.setStatus('obsolete')
if mibBuilder.loadTexts: wfCommandTimeOut.setDescription('IF MODEM_ENABLED then time out in minutes to HUP when at the command prompt')
wfLoginRetries = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 99)).clone(3)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfLoginRetries.setStatus('obsolete')
if mibBuilder.loadTexts: wfLoginRetries.setDescription('IF MODEM_ENABLED then limit # of login attempts then HUP')
wfTotalLogins = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 13), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfTotalLogins.setStatus('obsolete')
if mibBuilder.loadTexts: wfTotalLogins.setDescription('Total number of TI login attempts')
wfUserLoginErrors = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 14), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfUserLoginErrors.setStatus('obsolete')
if mibBuilder.loadTexts: wfUserLoginErrors.setDescription('Total number of FAILED User login attempts')
wfManagerLoginErrors = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 15), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfManagerLoginErrors.setStatus('obsolete')
if mibBuilder.loadTexts: wfManagerLoginErrors.setDescription('Total number of FAILED Manager login attempts')
wfOtherLoginErrors = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 16), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfOtherLoginErrors.setStatus('obsolete')
if mibBuilder.loadTexts: wfOtherLoginErrors.setDescription('Total number of FAILED Other login attempts')
wfTtyFrameErrors = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 17), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfTtyFrameErrors.setStatus('obsolete')
if mibBuilder.loadTexts: wfTtyFrameErrors.setDescription('Count of TTY Frame errors')
wfTtyOverrunErrors = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 18), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfTtyOverrunErrors.setStatus('obsolete')
if mibBuilder.loadTexts: wfTtyOverrunErrors.setDescription('Count of TTY Overrun errors')
wfTtyParityErrors = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 19), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfTtyParityErrors.setStatus('obsolete')
if mibBuilder.loadTexts: wfTtyParityErrors.setDescription('Count of TTY Parity errors')
wfTtyInfifoErrors = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 20), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfTtyInfifoErrors.setStatus('obsolete')
if mibBuilder.loadTexts: wfTtyInfifoErrors.setDescription('Count of TTY Input Fifo errors')
wfSerialPortTable = MibTable((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1), )
if mibBuilder.loadTexts: wfSerialPortTable.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortTable.setDescription('Configuration of system serial port(s)')
wfSerialPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1), ).setIndexNames((0, "Wellfleet-CONSOLE-MIB", "wfSerialPortNumber"))
if mibBuilder.loadTexts: wfSerialPortEntry.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortEntry.setDescription('Information for each serial port.')
wfSerialPortDelete = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("created", 1), ("deleted", 2))).clone('created')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortDelete.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortDelete.setDescription('Flag to indicate Serial Port instance deletion')
wfSerialPortDisable = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('enabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortDisable.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortDisable.setDescription('Enable or disable this Serial Port')
wfSerialPortState = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("init", 3), ("notpresent", 4))).clone('notpresent')).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfSerialPortState.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortState.setDescription('The state of this Serial Port')
wfSerialPortNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfSerialPortNumber.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortNumber.setDescription('Serial Port number')
wfSerialPortName = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 5), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfSerialPortName.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortName.setDescription('Serial Port name')
wfSerialPortSlot = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfSerialPortSlot.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortSlot.setDescription('Slot number of Serial Port session')
wfSerialPortType = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("ti", 1), ("printer", 2), ("rtelnet", 3))).clone('ti')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortType.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortType.setDescription('Type of Serial Port')
wfSerialPortBaudRate = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 8), Integer32().clone(9600)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortBaudRate.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortBaudRate.setDescription('Baud rate configured on this Serial Port')
wfSerialPortDataBits = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 9), Integer32().clone(8)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortDataBits.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortDataBits.setDescription('Number of data bits configured on this Serial Port')
wfSerialPortParity = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("none", 1), ("odd", 2), ("even", 3))).clone('none')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortParity.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortParity.setDescription('Type of parity configured on this Serial Port')
wfSerialPortStopBits = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("s1bit", 1), ("s15bit", 2), ("s2bit", 3))).clone('s1bit')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortStopBits.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortStopBits.setDescription('Number of stop bits configured on this Serial Port')
wfSerialPortModemEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortModemEnable.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortModemEnable.setDescription('Enable the Serial Port to run with modem leads enabled')
wfSerialPortLinesPerScreen = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 13), Integer32().clone(24)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortLinesPerScreen.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortLinesPerScreen.setDescription('Number of lines which can be displayed in one screen on the Serial Port')
wfSerialPortMoreEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('enabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortMoreEnable.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortMoreEnable.setDescription("Enable the 'more' feature on the Serial Port")
wfSerialPortPrompt = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 15), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortPrompt.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortPrompt.setDescription('Character string which will be used as the system prompt on the Serial Port')
wfSerialPortLoginTimeOut = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 99)).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortLoginTimeOut.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortLoginTimeOut.setDescription('IF MODEM_ENABLED then time out in minutes to HUP when at the login prompt')
wfSerialPortPasswordTimeOut = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 17), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 99)).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortPasswordTimeOut.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortPasswordTimeOut.setDescription('Timout on Password entry')
wfSerialPortCommandTimeOut = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 18), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 99)).clone(15)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortCommandTimeOut.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortCommandTimeOut.setDescription('IF MODEM_ENABLED then time out in minutes to HUP when at the command prompt')
wfSerialPortLoginRetries = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 19), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 99)).clone(3)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortLoginRetries.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortLoginRetries.setDescription('IF MODEM_ENABLED then limit # of login attempts then HUP')
wfSerialPortTotalLogins = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 20), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfSerialPortTotalLogins.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortTotalLogins.setDescription('Total number of TI login attempts on Serial Port')
wfSerialPortUserLoginErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 21), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfSerialPortUserLoginErrors.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortUserLoginErrors.setDescription('Total number of FAILED User login attempts on Serial Port')
wfSerialPortManagerLoginErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 22), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfSerialPortManagerLoginErrors.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortManagerLoginErrors.setDescription('Total number of FAILED Manager login attempts on Serial Port')
wfSerialPortOtherLoginErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 23), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfSerialPortOtherLoginErrors.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortOtherLoginErrors.setDescription('Total number of FAILED Other login attempts on Serial Port')
wfSerialPortTtyFrameErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 24), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfSerialPortTtyFrameErrors.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortTtyFrameErrors.setDescription('Count of TTY Frame errors on Serial Port')
wfSerialPortTtyOverrunErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 25), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfSerialPortTtyOverrunErrors.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortTtyOverrunErrors.setDescription('Count of TTY Overrun errors on Serial Port')
wfSerialPortTtyParityErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 26), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfSerialPortTtyParityErrors.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortTtyParityErrors.setDescription('Count of TTY Parity errors on Serial Port')
wfSerialPortTtyInfifoErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 27), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfSerialPortTtyInfifoErrors.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortTtyInfifoErrors.setDescription('Count of TTY Input Fifo errors on Serial Port')
wfSerialPortInitialSearchPath = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 28), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortInitialSearchPath.setStatus('obsolete')
if mibBuilder.loadTexts: wfSerialPortInitialSearchPath.setDescription("Example: 'A:;1:;2:' or '2:;4:6:;9:")
wfSerialPortManagerAutoScript = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 29), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortManagerAutoScript.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortManagerAutoScript.setDescription('for each login.')
wfSerialPortUserAutoScript = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 30), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortUserAutoScript.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortUserAutoScript.setDescription('for each login.')
wfSerialPortUserAbortLogoutDisable = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 31), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortUserAbortLogoutDisable.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortUserAbortLogoutDisable.setDescription('a USER from escaping out of the User Autoscript')
wfSerialPortHistoryDepth = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 32), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 40)).clone(20)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortHistoryDepth.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortHistoryDepth.setDescription('TI command history table size')
wfSerialPortAutoSaveNumFiles = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 33), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 99))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortAutoSaveNumFiles.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortAutoSaveNumFiles.setDescription('Number of times AutoSave will save the log 0 - disable the AutoSave log')
wfSerialPortAutoSaveVolume = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 34), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortAutoSaveVolume.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortAutoSaveVolume.setDescription("Volume, to which AutoSave will save logs Example: 'A:' or '2:'")
wfSerialPortModemIdSwRev = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 35), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 79))).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfSerialPortModemIdSwRev.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortModemIdSwRev.setDescription("A textual description of the modem's firmware version number.")
wfSerialPortModemIdHwRev = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 36), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 79))).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfSerialPortModemIdHwRev.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortModemIdHwRev.setDescription('A textual description of the revision number of the modem daughter card.')
wfSerialPortModemLineState = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 37), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("unknown", 1), ("onHook", 2), ("offHook", 3), ("connected", 4), ("busiedOut", 5), ("reset", 6))).clone('unknown')).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfSerialPortModemLineState.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortModemLineState.setDescription('Indicates the state of the modem.')
wfSerialPortModemCfgFactoryDefaults = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 38), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('enabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortModemCfgFactoryDefaults.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortModemCfgFactoryDefaults.setDescription('This object indicates if factory defaults are to be loaded. If set to enabled(1), factory defaults are loaded. If set to disabled(2), the initialization string in wfModemCfgInitString is not sent to the modem.')
wfSerialPortModemCfgInitString = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 39), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortModemCfgInitString.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortModemCfgInitString.setDescription('An initialization string that will be sent to the modem each time the modem is rebooted.')
wfSerialPortModemCfgDefaultString = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 40), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfSerialPortModemCfgDefaultString.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortModemCfgDefaultString.setDescription('The string contains AT comands for initializing the modem every time the modem comes up, regardless of configuration.')
wfSerialPortModemCfgResultCodeString = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 41), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfSerialPortModemCfgResultCodeString.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortModemCfgResultCodeString.setDescription('The ASCII response string returned by the modem. Response strings will be returned in response to last command to the modem and in response to activity on the line.')
wfSerialPortModemCfgState = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 42), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("cfgIdle", 1), ("cfgInProgress", 2), ("cfgResponseReturned", 3))).clone('cfgIdle')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortModemCfgState.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortModemCfgState.setDescription('Indicates the state of AT command processing. When a new initialization string is to be sent to the modem, the sender sets the state to cfgInProgress(2). After the command has been sent to the modem, and a result code has been returned, the state is set to cfgResponseReturned(3). Once the sender has received the return code, the sender sets the state to cfgIdle(1).')
wfSerialPortModemCfgCountry = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 43), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("northAmerica", 1), ("japan", 2), ("uk", 3), ("germany", 4))).clone('northAmerica')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfSerialPortModemCfgCountry.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortModemCfgCountry.setDescription('Identifies the country the modem is designed to operate in. This object is not read from the modem directly. It must be entered manually when configuring the modem.')
wfSerialPortModemInitState = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 44), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 3, 4, 5, 8))).clone(namedValues=NamedValues(("startup", 1), ("getInfo", 3), ("setDefaults", 4), ("initialization", 5), ("initComplete", 8)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfSerialPortModemInitState.setStatus('mandatory')
if mibBuilder.loadTexts: wfSerialPortModemInitState.setDescription('Indictes the state of the modem initialization sequence. The state will freeze in the state that fails when a failure is detected. Otherwise, the state will be set to initComplete when initialization completes successfully. The state number correspond to those for the COM port modems. Some of the states are not valid for the console modem.')
mibBuilder.exportSymbols("Wellfleet-CONSOLE-MIB", wfTtyInfifoErrors=wfTtyInfifoErrors, wfUserLoginErrors=wfUserLoginErrors, wfSerialPortOtherLoginErrors=wfSerialPortOtherLoginErrors, wfTtyOverrunErrors=wfTtyOverrunErrors, wfSerialPortBaudRate=wfSerialPortBaudRate, wfSerialPortLinesPerScreen=wfSerialPortLinesPerScreen, wfSerialPortStopBits=wfSerialPortStopBits, wfSerialPortCommandTimeOut=wfSerialPortCommandTimeOut, wfSerialPortManagerAutoScript=wfSerialPortManagerAutoScript, wfSerialPortHistoryDepth=wfSerialPortHistoryDepth, wfSerialPortModemEnable=wfSerialPortModemEnable, wfSerialPortModemCfgResultCodeString=wfSerialPortModemCfgResultCodeString, wfSerialPortPasswordTimeOut=wfSerialPortPasswordTimeOut, wfSerialPortEntry=wfSerialPortEntry, wfSerialPortUserLoginErrors=wfSerialPortUserLoginErrors, wfSerialPortUserAutoScript=wfSerialPortUserAutoScript, wfTtyParityErrors=wfTtyParityErrors, wfSerialPortAutoSaveNumFiles=wfSerialPortAutoSaveNumFiles, wfSerialPortAutoSaveVolume=wfSerialPortAutoSaveVolume, wfSerialPortModemCfgFactoryDefaults=wfSerialPortModemCfgFactoryDefaults, wfDataBits=wfDataBits, wfSerialPortDelete=wfSerialPortDelete, wfSerialPortState=wfSerialPortState, wfSerialPortInitialSearchPath=wfSerialPortInitialSearchPath, wfManagerLoginErrors=wfManagerLoginErrors, wfSerialPortModemCfgCountry=wfSerialPortModemCfgCountry, wfParity=wfParity, wfSerialPortName=wfSerialPortName, wfTotalLogins=wfTotalLogins, wfSerialPortLoginRetries=wfSerialPortLoginRetries, wfSerialPortNumber=wfSerialPortNumber, wfSerialPortSlot=wfSerialPortSlot, wfBaudRate=wfBaudRate, wfSerialPortTable=wfSerialPortTable, wfSerialPortMoreEnable=wfSerialPortMoreEnable, wfSerialPortDataBits=wfSerialPortDataBits, wfModemEnable=wfModemEnable, wfSerialPortLoginTimeOut=wfSerialPortLoginTimeOut, wfSerialPortTtyOverrunErrors=wfSerialPortTtyOverrunErrors, wfPrompt=wfPrompt, wfTtyFrameErrors=wfTtyFrameErrors, wfSerialPortModemCfgState=wfSerialPortModemCfgState, wfLinesPerScreen=wfLinesPerScreen, wfSerialPortTtyFrameErrors=wfSerialPortTtyFrameErrors, wfSerialPortModemIdHwRev=wfSerialPortModemIdHwRev, wfSerialPortUserAbortLogoutDisable=wfSerialPortUserAbortLogoutDisable, wfConsole=wfConsole, wfLoginTimeOut=wfLoginTimeOut, wfCommandTimeOut=wfCommandTimeOut, wfSerialPortModemLineState=wfSerialPortModemLineState, wfOtherLoginErrors=wfOtherLoginErrors, wfStopBits=wfStopBits, wfSerialPortTotalLogins=wfSerialPortTotalLogins, wfSerialPortModemCfgDefaultString=wfSerialPortModemCfgDefaultString, wfMoreEnable=wfMoreEnable, wfSerialPortDisable=wfSerialPortDisable, wfSerialPortManagerLoginErrors=wfSerialPortManagerLoginErrors, wfSerialPortModemCfgInitString=wfSerialPortModemCfgInitString, wfSerialPortPrompt=wfSerialPortPrompt, wfSerialPortTtyInfifoErrors=wfSerialPortTtyInfifoErrors, wfPasswordTimeOut=wfPasswordTimeOut, wfSerialPortModemInitState=wfSerialPortModemInitState, wfSerialPortType=wfSerialPortType, wfSerialPortTtyParityErrors=wfSerialPortTtyParityErrors, wfLoginRetries=wfLoginRetries, wfSerialPortParity=wfSerialPortParity, wfSerialPortModemIdSwRev=wfSerialPortModemIdSwRev)
| (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, constraints_union, value_range_constraint, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'SingleValueConstraint', 'ConstraintsUnion', 'ValueRangeConstraint', 'ConstraintsIntersection')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(time_ticks, module_identity, gauge32, unsigned32, iso, counter32, bits, object_identity, mib_identifier, mib_scalar, mib_table, mib_table_row, mib_table_column, counter64, integer32, notification_type, ip_address) = mibBuilder.importSymbols('SNMPv2-SMI', 'TimeTicks', 'ModuleIdentity', 'Gauge32', 'Unsigned32', 'iso', 'Counter32', 'Bits', 'ObjectIdentity', 'MibIdentifier', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter64', 'Integer32', 'NotificationType', 'IpAddress')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
(wf_services, wf_serial_port_group) = mibBuilder.importSymbols('Wellfleet-COMMON-MIB', 'wfServices', 'wfSerialPortGroup')
wf_console = mib_identifier((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1))
wf_baud_rate = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 1), integer32().clone(9600)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfBaudRate.setStatus('obsolete')
if mibBuilder.loadTexts:
wfBaudRate.setDescription('Baud rate configured on the Technician Interface console')
wf_data_bits = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 2), integer32().clone(8)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfDataBits.setStatus('obsolete')
if mibBuilder.loadTexts:
wfDataBits.setDescription('Number of data bits configured on the Technician Interface console')
wf_parity = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('none', 1), ('odd', 2), ('even', 3))).clone('none')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfParity.setStatus('obsolete')
if mibBuilder.loadTexts:
wfParity.setDescription('Type of parity configured on the Technician Interface console')
wf_stop_bits = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('s1bit', 1), ('s15bit', 2), ('s2bit', 3))).clone('s1bit')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfStopBits.setStatus('obsolete')
if mibBuilder.loadTexts:
wfStopBits.setDescription('Number of stop bits configured on the Technician Interface console')
wf_modem_enable = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone('disabled')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfModemEnable.setStatus('obsolete')
if mibBuilder.loadTexts:
wfModemEnable.setDescription('Enable the Technician Interface console to run over a modem')
wf_lines_per_screen = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 6), integer32().clone(24)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfLinesPerScreen.setStatus('obsolete')
if mibBuilder.loadTexts:
wfLinesPerScreen.setDescription('Number of lines which can be displayed in one screen on the Technician Interface console')
wf_more_enable = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone('enabled')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfMoreEnable.setStatus('obsolete')
if mibBuilder.loadTexts:
wfMoreEnable.setDescription("Enable the 'more' feature on the Technician Interface console")
wf_prompt = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 8), display_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfPrompt.setStatus('obsolete')
if mibBuilder.loadTexts:
wfPrompt.setDescription('Character string which will be used as the system prompt on the Technician Interface console')
wf_login_time_out = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 9), integer32().subtype(subtypeSpec=value_range_constraint(1, 99)).clone(1)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfLoginTimeOut.setStatus('obsolete')
if mibBuilder.loadTexts:
wfLoginTimeOut.setDescription('IF MODEM_ENABLED then time out in minutes to HUP when at the login prompt')
wf_password_time_out = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 10), integer32().subtype(subtypeSpec=value_range_constraint(1, 99)).clone(1)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfPasswordTimeOut.setStatus('obsolete')
if mibBuilder.loadTexts:
wfPasswordTimeOut.setDescription('Timout on Password entry')
wf_command_time_out = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 11), integer32().subtype(subtypeSpec=value_range_constraint(1, 99)).clone(15)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfCommandTimeOut.setStatus('obsolete')
if mibBuilder.loadTexts:
wfCommandTimeOut.setDescription('IF MODEM_ENABLED then time out in minutes to HUP when at the command prompt')
wf_login_retries = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 12), integer32().subtype(subtypeSpec=value_range_constraint(1, 99)).clone(3)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfLoginRetries.setStatus('obsolete')
if mibBuilder.loadTexts:
wfLoginRetries.setDescription('IF MODEM_ENABLED then limit # of login attempts then HUP')
wf_total_logins = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 13), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfTotalLogins.setStatus('obsolete')
if mibBuilder.loadTexts:
wfTotalLogins.setDescription('Total number of TI login attempts')
wf_user_login_errors = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 14), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfUserLoginErrors.setStatus('obsolete')
if mibBuilder.loadTexts:
wfUserLoginErrors.setDescription('Total number of FAILED User login attempts')
wf_manager_login_errors = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 15), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfManagerLoginErrors.setStatus('obsolete')
if mibBuilder.loadTexts:
wfManagerLoginErrors.setDescription('Total number of FAILED Manager login attempts')
wf_other_login_errors = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 16), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfOtherLoginErrors.setStatus('obsolete')
if mibBuilder.loadTexts:
wfOtherLoginErrors.setDescription('Total number of FAILED Other login attempts')
wf_tty_frame_errors = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 17), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfTtyFrameErrors.setStatus('obsolete')
if mibBuilder.loadTexts:
wfTtyFrameErrors.setDescription('Count of TTY Frame errors')
wf_tty_overrun_errors = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 18), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfTtyOverrunErrors.setStatus('obsolete')
if mibBuilder.loadTexts:
wfTtyOverrunErrors.setDescription('Count of TTY Overrun errors')
wf_tty_parity_errors = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 19), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfTtyParityErrors.setStatus('obsolete')
if mibBuilder.loadTexts:
wfTtyParityErrors.setDescription('Count of TTY Parity errors')
wf_tty_infifo_errors = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 1, 20), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfTtyInfifoErrors.setStatus('obsolete')
if mibBuilder.loadTexts:
wfTtyInfifoErrors.setDescription('Count of TTY Input Fifo errors')
wf_serial_port_table = mib_table((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1))
if mibBuilder.loadTexts:
wfSerialPortTable.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortTable.setDescription('Configuration of system serial port(s)')
wf_serial_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1)).setIndexNames((0, 'Wellfleet-CONSOLE-MIB', 'wfSerialPortNumber'))
if mibBuilder.loadTexts:
wfSerialPortEntry.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortEntry.setDescription('Information for each serial port.')
wf_serial_port_delete = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('created', 1), ('deleted', 2))).clone('created')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortDelete.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortDelete.setDescription('Flag to indicate Serial Port instance deletion')
wf_serial_port_disable = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone('enabled')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortDisable.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortDisable.setDescription('Enable or disable this Serial Port')
wf_serial_port_state = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('up', 1), ('down', 2), ('init', 3), ('notpresent', 4))).clone('notpresent')).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfSerialPortState.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortState.setDescription('The state of this Serial Port')
wf_serial_port_number = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 4), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfSerialPortNumber.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortNumber.setDescription('Serial Port number')
wf_serial_port_name = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 5), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfSerialPortName.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortName.setDescription('Serial Port name')
wf_serial_port_slot = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 6), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfSerialPortSlot.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortSlot.setDescription('Slot number of Serial Port session')
wf_serial_port_type = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('ti', 1), ('printer', 2), ('rtelnet', 3))).clone('ti')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortType.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortType.setDescription('Type of Serial Port')
wf_serial_port_baud_rate = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 8), integer32().clone(9600)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortBaudRate.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortBaudRate.setDescription('Baud rate configured on this Serial Port')
wf_serial_port_data_bits = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 9), integer32().clone(8)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortDataBits.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortDataBits.setDescription('Number of data bits configured on this Serial Port')
wf_serial_port_parity = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('none', 1), ('odd', 2), ('even', 3))).clone('none')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortParity.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortParity.setDescription('Type of parity configured on this Serial Port')
wf_serial_port_stop_bits = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('s1bit', 1), ('s15bit', 2), ('s2bit', 3))).clone('s1bit')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortStopBits.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortStopBits.setDescription('Number of stop bits configured on this Serial Port')
wf_serial_port_modem_enable = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 12), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone('disabled')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortModemEnable.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortModemEnable.setDescription('Enable the Serial Port to run with modem leads enabled')
wf_serial_port_lines_per_screen = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 13), integer32().clone(24)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortLinesPerScreen.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortLinesPerScreen.setDescription('Number of lines which can be displayed in one screen on the Serial Port')
wf_serial_port_more_enable = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 14), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone('enabled')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortMoreEnable.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortMoreEnable.setDescription("Enable the 'more' feature on the Serial Port")
wf_serial_port_prompt = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 15), display_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortPrompt.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortPrompt.setDescription('Character string which will be used as the system prompt on the Serial Port')
wf_serial_port_login_time_out = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 16), integer32().subtype(subtypeSpec=value_range_constraint(1, 99)).clone(1)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortLoginTimeOut.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortLoginTimeOut.setDescription('IF MODEM_ENABLED then time out in minutes to HUP when at the login prompt')
wf_serial_port_password_time_out = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 17), integer32().subtype(subtypeSpec=value_range_constraint(1, 99)).clone(1)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortPasswordTimeOut.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortPasswordTimeOut.setDescription('Timout on Password entry')
wf_serial_port_command_time_out = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 18), integer32().subtype(subtypeSpec=value_range_constraint(1, 99)).clone(15)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortCommandTimeOut.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortCommandTimeOut.setDescription('IF MODEM_ENABLED then time out in minutes to HUP when at the command prompt')
wf_serial_port_login_retries = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 19), integer32().subtype(subtypeSpec=value_range_constraint(1, 99)).clone(3)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortLoginRetries.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortLoginRetries.setDescription('IF MODEM_ENABLED then limit # of login attempts then HUP')
wf_serial_port_total_logins = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 20), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfSerialPortTotalLogins.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortTotalLogins.setDescription('Total number of TI login attempts on Serial Port')
wf_serial_port_user_login_errors = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 21), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfSerialPortUserLoginErrors.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortUserLoginErrors.setDescription('Total number of FAILED User login attempts on Serial Port')
wf_serial_port_manager_login_errors = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 22), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfSerialPortManagerLoginErrors.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortManagerLoginErrors.setDescription('Total number of FAILED Manager login attempts on Serial Port')
wf_serial_port_other_login_errors = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 23), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfSerialPortOtherLoginErrors.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortOtherLoginErrors.setDescription('Total number of FAILED Other login attempts on Serial Port')
wf_serial_port_tty_frame_errors = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 24), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfSerialPortTtyFrameErrors.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortTtyFrameErrors.setDescription('Count of TTY Frame errors on Serial Port')
wf_serial_port_tty_overrun_errors = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 25), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfSerialPortTtyOverrunErrors.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortTtyOverrunErrors.setDescription('Count of TTY Overrun errors on Serial Port')
wf_serial_port_tty_parity_errors = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 26), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfSerialPortTtyParityErrors.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortTtyParityErrors.setDescription('Count of TTY Parity errors on Serial Port')
wf_serial_port_tty_infifo_errors = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 27), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfSerialPortTtyInfifoErrors.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortTtyInfifoErrors.setDescription('Count of TTY Input Fifo errors on Serial Port')
wf_serial_port_initial_search_path = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 28), display_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortInitialSearchPath.setStatus('obsolete')
if mibBuilder.loadTexts:
wfSerialPortInitialSearchPath.setDescription("Example: 'A:;1:;2:' or '2:;4:6:;9:")
wf_serial_port_manager_auto_script = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 29), display_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortManagerAutoScript.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortManagerAutoScript.setDescription('for each login.')
wf_serial_port_user_auto_script = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 30), display_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortUserAutoScript.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortUserAutoScript.setDescription('for each login.')
wf_serial_port_user_abort_logout_disable = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 31), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone('disabled')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortUserAbortLogoutDisable.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortUserAbortLogoutDisable.setDescription('a USER from escaping out of the User Autoscript')
wf_serial_port_history_depth = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 32), integer32().subtype(subtypeSpec=value_range_constraint(1, 40)).clone(20)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortHistoryDepth.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortHistoryDepth.setDescription('TI command history table size')
wf_serial_port_auto_save_num_files = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 33), integer32().subtype(subtypeSpec=value_range_constraint(0, 99))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortAutoSaveNumFiles.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortAutoSaveNumFiles.setDescription('Number of times AutoSave will save the log 0 - disable the AutoSave log')
wf_serial_port_auto_save_volume = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 34), display_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortAutoSaveVolume.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortAutoSaveVolume.setDescription("Volume, to which AutoSave will save logs Example: 'A:' or '2:'")
wf_serial_port_modem_id_sw_rev = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 35), display_string().subtype(subtypeSpec=value_size_constraint(0, 79))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfSerialPortModemIdSwRev.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortModemIdSwRev.setDescription("A textual description of the modem's firmware version number.")
wf_serial_port_modem_id_hw_rev = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 36), display_string().subtype(subtypeSpec=value_size_constraint(0, 79))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfSerialPortModemIdHwRev.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortModemIdHwRev.setDescription('A textual description of the revision number of the modem daughter card.')
wf_serial_port_modem_line_state = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 37), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('unknown', 1), ('onHook', 2), ('offHook', 3), ('connected', 4), ('busiedOut', 5), ('reset', 6))).clone('unknown')).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfSerialPortModemLineState.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortModemLineState.setDescription('Indicates the state of the modem.')
wf_serial_port_modem_cfg_factory_defaults = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 38), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone('enabled')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortModemCfgFactoryDefaults.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortModemCfgFactoryDefaults.setDescription('This object indicates if factory defaults are to be loaded. If set to enabled(1), factory defaults are loaded. If set to disabled(2), the initialization string in wfModemCfgInitString is not sent to the modem.')
wf_serial_port_modem_cfg_init_string = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 39), display_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortModemCfgInitString.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortModemCfgInitString.setDescription('An initialization string that will be sent to the modem each time the modem is rebooted.')
wf_serial_port_modem_cfg_default_string = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 40), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfSerialPortModemCfgDefaultString.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortModemCfgDefaultString.setDescription('The string contains AT comands for initializing the modem every time the modem comes up, regardless of configuration.')
wf_serial_port_modem_cfg_result_code_string = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 41), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfSerialPortModemCfgResultCodeString.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortModemCfgResultCodeString.setDescription('The ASCII response string returned by the modem. Response strings will be returned in response to last command to the modem and in response to activity on the line.')
wf_serial_port_modem_cfg_state = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 42), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('cfgIdle', 1), ('cfgInProgress', 2), ('cfgResponseReturned', 3))).clone('cfgIdle')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortModemCfgState.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortModemCfgState.setDescription('Indicates the state of AT command processing. When a new initialization string is to be sent to the modem, the sender sets the state to cfgInProgress(2). After the command has been sent to the modem, and a result code has been returned, the state is set to cfgResponseReturned(3). Once the sender has received the return code, the sender sets the state to cfgIdle(1).')
wf_serial_port_modem_cfg_country = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 43), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('northAmerica', 1), ('japan', 2), ('uk', 3), ('germany', 4))).clone('northAmerica')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
wfSerialPortModemCfgCountry.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortModemCfgCountry.setDescription('Identifies the country the modem is designed to operate in. This object is not read from the modem directly. It must be entered manually when configuring the modem.')
wf_serial_port_modem_init_state = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 11, 1, 1, 44), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 3, 4, 5, 8))).clone(namedValues=named_values(('startup', 1), ('getInfo', 3), ('setDefaults', 4), ('initialization', 5), ('initComplete', 8)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
wfSerialPortModemInitState.setStatus('mandatory')
if mibBuilder.loadTexts:
wfSerialPortModemInitState.setDescription('Indictes the state of the modem initialization sequence. The state will freeze in the state that fails when a failure is detected. Otherwise, the state will be set to initComplete when initialization completes successfully. The state number correspond to those for the COM port modems. Some of the states are not valid for the console modem.')
mibBuilder.exportSymbols('Wellfleet-CONSOLE-MIB', wfTtyInfifoErrors=wfTtyInfifoErrors, wfUserLoginErrors=wfUserLoginErrors, wfSerialPortOtherLoginErrors=wfSerialPortOtherLoginErrors, wfTtyOverrunErrors=wfTtyOverrunErrors, wfSerialPortBaudRate=wfSerialPortBaudRate, wfSerialPortLinesPerScreen=wfSerialPortLinesPerScreen, wfSerialPortStopBits=wfSerialPortStopBits, wfSerialPortCommandTimeOut=wfSerialPortCommandTimeOut, wfSerialPortManagerAutoScript=wfSerialPortManagerAutoScript, wfSerialPortHistoryDepth=wfSerialPortHistoryDepth, wfSerialPortModemEnable=wfSerialPortModemEnable, wfSerialPortModemCfgResultCodeString=wfSerialPortModemCfgResultCodeString, wfSerialPortPasswordTimeOut=wfSerialPortPasswordTimeOut, wfSerialPortEntry=wfSerialPortEntry, wfSerialPortUserLoginErrors=wfSerialPortUserLoginErrors, wfSerialPortUserAutoScript=wfSerialPortUserAutoScript, wfTtyParityErrors=wfTtyParityErrors, wfSerialPortAutoSaveNumFiles=wfSerialPortAutoSaveNumFiles, wfSerialPortAutoSaveVolume=wfSerialPortAutoSaveVolume, wfSerialPortModemCfgFactoryDefaults=wfSerialPortModemCfgFactoryDefaults, wfDataBits=wfDataBits, wfSerialPortDelete=wfSerialPortDelete, wfSerialPortState=wfSerialPortState, wfSerialPortInitialSearchPath=wfSerialPortInitialSearchPath, wfManagerLoginErrors=wfManagerLoginErrors, wfSerialPortModemCfgCountry=wfSerialPortModemCfgCountry, wfParity=wfParity, wfSerialPortName=wfSerialPortName, wfTotalLogins=wfTotalLogins, wfSerialPortLoginRetries=wfSerialPortLoginRetries, wfSerialPortNumber=wfSerialPortNumber, wfSerialPortSlot=wfSerialPortSlot, wfBaudRate=wfBaudRate, wfSerialPortTable=wfSerialPortTable, wfSerialPortMoreEnable=wfSerialPortMoreEnable, wfSerialPortDataBits=wfSerialPortDataBits, wfModemEnable=wfModemEnable, wfSerialPortLoginTimeOut=wfSerialPortLoginTimeOut, wfSerialPortTtyOverrunErrors=wfSerialPortTtyOverrunErrors, wfPrompt=wfPrompt, wfTtyFrameErrors=wfTtyFrameErrors, wfSerialPortModemCfgState=wfSerialPortModemCfgState, wfLinesPerScreen=wfLinesPerScreen, wfSerialPortTtyFrameErrors=wfSerialPortTtyFrameErrors, wfSerialPortModemIdHwRev=wfSerialPortModemIdHwRev, wfSerialPortUserAbortLogoutDisable=wfSerialPortUserAbortLogoutDisable, wfConsole=wfConsole, wfLoginTimeOut=wfLoginTimeOut, wfCommandTimeOut=wfCommandTimeOut, wfSerialPortModemLineState=wfSerialPortModemLineState, wfOtherLoginErrors=wfOtherLoginErrors, wfStopBits=wfStopBits, wfSerialPortTotalLogins=wfSerialPortTotalLogins, wfSerialPortModemCfgDefaultString=wfSerialPortModemCfgDefaultString, wfMoreEnable=wfMoreEnable, wfSerialPortDisable=wfSerialPortDisable, wfSerialPortManagerLoginErrors=wfSerialPortManagerLoginErrors, wfSerialPortModemCfgInitString=wfSerialPortModemCfgInitString, wfSerialPortPrompt=wfSerialPortPrompt, wfSerialPortTtyInfifoErrors=wfSerialPortTtyInfifoErrors, wfPasswordTimeOut=wfPasswordTimeOut, wfSerialPortModemInitState=wfSerialPortModemInitState, wfSerialPortType=wfSerialPortType, wfSerialPortTtyParityErrors=wfSerialPortTtyParityErrors, wfLoginRetries=wfLoginRetries, wfSerialPortParity=wfSerialPortParity, wfSerialPortModemIdSwRev=wfSerialPortModemIdSwRev) |
##Q1
def sumOfDigits(String):
sumNumber=0
for i in range(0,len(String)):
if String[i].isdigit():
sumNumber=sumNumber+int(String[i])
return sumNumber
##Q2
def smallerThanN(intList,integer):
newList=[]
for intInList in intList:
if intInList<integer:
newList.append(intInList)
return newList
assertEqual(smallerThanN([2,5,8,15,58,3,4],8),[2,5,3,4])
assertEqual(smallerThanN([],8),[])
assertEqual(smallerThanN([5,4,3,2,1],3),[2,1])
##Q3
def sumNegativeInts(List):
sumInts=0
for i in List:
if i<0:
sumInts+=i
return sumInts
assertEqual(sumNegativeInts([2, 1, -5, 0]),-5)
assertEqual(sumNegativeInts([-1, 1, -9, 1]),-10)
assertEqual(sumNegativeInts([9, 2, -7, 7]),-7)
assertEqual(sumNegativeInts([]),0)
##Q4
def reverseList(List):
newList=[]
for i in range(len(List)-1,-1,-1):
content=List[i]
newList.append(content)
return newList
assertEqual(reverseList([1,2,3,4,5]),[5,4,3,2,1])
assertEqual(reverseList([]),[])
assertEqual(reverseList([1,4,7,5,10]),[10,5,7,4,1])
##Q5
def sentenceCapitalizer(String):
newString=String.split(". ")
secondNewString=""
if len(String)==0:
return ""
for i in range(0,len(newString)):
stringWord=newString[i]
secondNewString+=stringWord[0:1].upper()+stringWord[1:]
if(i<len(newString)-1):
secondNewString+=". "
return secondNewString
assertEqual(sentenceCapitalizer("hello. my name is Joe. what is your name?"),"Hello. My name is Joe. What is your name?")
assertEqual(sentenceCapitalizer("it's Friday. what is your plan?"),"It's Friday. What is your plan?")
assertEqual(sentenceCapitalizer("write a function. don't forget test cases."+" and comments also."),"Write a function. Don't forget test cases. And comments also.")
assertEqual(sentenceCapitalizer("this is a one sentence string."),"This is a one sentence string.")
assertEqual(sentenceCapitalizer(""),"")
##Lab 3-2
def main():
integerList=input("Enter a list of integers: ")
integer=int(input("Enter an integer: "))
newList=integerList.split(",")
secondNewList=[]
for i in range(len(newList)):
if newList[i]!=",":
secondNewList.append(int(newList[i]))
secondNewList=smallerThanN(secondNewList,integer)
print(secondNewList)
main()
def main():
inputList=input("Enter a list of integers seperated by commas with no spaces: ")
newList=inputList.split(",")
secondNewList=[]
for i in range(len(newList)):
while not newList[i].lstrip("-").isdigit():
inputList=input("Enter a list of integers again: ")
secondNewList.append(int(newList[i]))
sum=sumNegativeInts(secondNewList)
print(sum)
main()
| def sum_of_digits(String):
sum_number = 0
for i in range(0, len(String)):
if String[i].isdigit():
sum_number = sumNumber + int(String[i])
return sumNumber
def smaller_than_n(intList, integer):
new_list = []
for int_in_list in intList:
if intInList < integer:
newList.append(intInList)
return newList
assert_equal(smaller_than_n([2, 5, 8, 15, 58, 3, 4], 8), [2, 5, 3, 4])
assert_equal(smaller_than_n([], 8), [])
assert_equal(smaller_than_n([5, 4, 3, 2, 1], 3), [2, 1])
def sum_negative_ints(List):
sum_ints = 0
for i in List:
if i < 0:
sum_ints += i
return sumInts
assert_equal(sum_negative_ints([2, 1, -5, 0]), -5)
assert_equal(sum_negative_ints([-1, 1, -9, 1]), -10)
assert_equal(sum_negative_ints([9, 2, -7, 7]), -7)
assert_equal(sum_negative_ints([]), 0)
def reverse_list(List):
new_list = []
for i in range(len(List) - 1, -1, -1):
content = List[i]
newList.append(content)
return newList
assert_equal(reverse_list([1, 2, 3, 4, 5]), [5, 4, 3, 2, 1])
assert_equal(reverse_list([]), [])
assert_equal(reverse_list([1, 4, 7, 5, 10]), [10, 5, 7, 4, 1])
def sentence_capitalizer(String):
new_string = String.split('. ')
second_new_string = ''
if len(String) == 0:
return ''
for i in range(0, len(newString)):
string_word = newString[i]
second_new_string += stringWord[0:1].upper() + stringWord[1:]
if i < len(newString) - 1:
second_new_string += '. '
return secondNewString
assert_equal(sentence_capitalizer('hello. my name is Joe. what is your name?'), 'Hello. My name is Joe. What is your name?')
assert_equal(sentence_capitalizer("it's Friday. what is your plan?"), "It's Friday. What is your plan?")
assert_equal(sentence_capitalizer("write a function. don't forget test cases." + ' and comments also.'), "Write a function. Don't forget test cases. And comments also.")
assert_equal(sentence_capitalizer('this is a one sentence string.'), 'This is a one sentence string.')
assert_equal(sentence_capitalizer(''), '')
def main():
integer_list = input('Enter a list of integers: ')
integer = int(input('Enter an integer: '))
new_list = integerList.split(',')
second_new_list = []
for i in range(len(newList)):
if newList[i] != ',':
secondNewList.append(int(newList[i]))
second_new_list = smaller_than_n(secondNewList, integer)
print(secondNewList)
main()
def main():
input_list = input('Enter a list of integers seperated by commas with no spaces: ')
new_list = inputList.split(',')
second_new_list = []
for i in range(len(newList)):
while not newList[i].lstrip('-').isdigit():
input_list = input('Enter a list of integers again: ')
secondNewList.append(int(newList[i]))
sum = sum_negative_ints(secondNewList)
print(sum)
main() |
'''
Calculating Function
'''
n = int(input())
result = 0
if n % 2 == 0:
result = n // 2
else:
result = n // 2 - n
print(result) | """
Calculating Function
"""
n = int(input())
result = 0
if n % 2 == 0:
result = n // 2
else:
result = n // 2 - n
print(result) |
## this file is for common methods that are not necessarily Pokemon related
## for now, i'll just call this common or convenience functions.
## they might be added TO dnio later, if they're useful enough
# import pokefunctions as pkf
def make_nicknames_dictionary(input_names, nickname_as_key=True, verbose=False):
'''
This makes nicknames that are absolute and WILL refer to one specific name. This is not a FCFS system for nicknames.
i.e.,
CORRECT: ["Abra","Absol"] -> ["abr","abs"]
INCORRECT: ["Abra","Absol"] -> ["a","ab"]
'''
names = sorted(list(set([name.strip().title() for name in input_names])))
## you know - let's just do the most brute-force thing.
## this should work fine if there are a small (<1000) number of names
nicknames = []
for this_name in names:
outstring = this_name + " -> "
other_names = [name for name in names if name!=this_name]
name_length = len(this_name)
attempt_length = 1
current_nickname_attempt = ''
## while our attempt is still SHORTER than the original, just in case we get a runaway number for some reason...
## and (mainly) while our attempt is still not useable (i.e., it starts a different name),
while (attempt_length<=name_length) and any([oname.startswith(current_nickname_attempt) for oname in other_names]):
## we need to keep finding new attempts
current_nickname_attempt = this_name[:attempt_length]
attempt_length += 1
## after all that, we SHOULD be left with the proper nickname
settled_nickname = current_nickname_attempt.lower()
nicknames.append(settled_nickname)
outstring += settled_nickname
if verbose:
print(outstring)
## now we have all the names & nicknames. time to make the dict, depending on what we want as the key
if nickname_as_key==False:
keys,vals = [names, nicknames]
else:
keys,vals = [nicknames,names]
N_names = len(names)
return {keys[i]:vals[i] for i in range(N_names)}
class NameBook(dict):
nn = 'nickname'
tn = 'name'
def __init__(self, user_input):
## gonna default a few values. so we can reference these later and see if they've been set at all
self._names = []
self._nicknames = []
self._nickname_dictionary = None
## first, let's interpret the input. it's either a filename or a list of names itself
if type(user_input) in [str,unicode]:
## if it's a string, then it's a filename - if so, then this is a cleaned, preset file with the expected ":\t" delimiter
## we don't have to do anything! just read the preset nicknames
self.read(user_input)
elif type(user_input) in (set,list):
## otherwise, let's interpret the list of names that was just given to us
self._names = list(user_input)
self.generate_nicknames()
self.generate_nickname_dictionary()
def generate_nicknames(self, verbose=False):
names = self._names
for this_name in names:
other_names = [nIter for nIter in names if nIter!=this_name]
name_length = len(this_name)
attempt_length = 1
current_nickname_attempt = ''
while (attempt_length<=name_length) and any([oname.startswith(current_nickname_attempt) for oname in other_names]):
## we need to keep finding new attempts
current_nickname_attempt = this_name[:attempt_length]
attempt_length += 1
settled_nickname = current_nickname_attempt.lower()
if verbose==True:
print("{} -> {}".format(this_name, settled_nickname))
self._nicknames.append(settled_nickname)
def generate_nickname_dictionary(self):
N_names = len(self._names)
self._nickname_dictionary = {self._nicknames[i]:self._names[i] for i in range(N_names)}
def read(self, filename:str, delimiter=':\t'):
lines = dnio.read(filename,JSON=False)
for line in lines:
nickname,name = line.split(delimiter)
if name.strip()=='':
## no empty name entries, skip it if its empty
continue
self._names.append(name)
self._nicknames.append(nickname)
self.generate_nickname_dictionary()
def write(self, filename:str, delimiter=':\t'):
return False
def lookup(self, value:str):
'''
Attempts to look up a value, even if it doesn't entirely match. Does NOT look for swapped/misplaced letters however. Only missing END letters.
'''
value = value.lower()
possible_nicknames = [nickname for nickname in self._nicknames if (nickname.startswith(value) or value.startswith(nickname)) ]
N_possible_nicknames = len(possible_nicknames)
if N_possible_nicknames==1:
return self._nickname_dictionary[possible_nicknames[0]]
elif N_possible_nicknames>1:
nickname_query = "Please enter an INDEX:\n" "\n".join(["[{}]\t{} ({})".format(i, self._nickname_dictionary[possible_nicknames[i]], possible_nicknames[i]) for i in range(N_possible_nicknames)]) + "\n"
nickname_selection = input(nickname_query)
return self._nickname_dictionary[possible_nicknames[nickname_selection]]
else:
print("No matches found. Please try again.")
def read_pokepaste(string):
return False
def assess(user_situation:str):
"""
user_situation will look something like this:
glas, icicle, +6Atk - garch
"""
DEFAULT_DICT = {'multipliers':[1], 'stages':[], 'pokemon':'', 'move':''}
offender_info, defender_info = [[info.strip() for info in side.split(',')] for side in user_situation.split('-')]
offender = DEFAULT_DICT
defender = DEFAULT_DICT
for pk_info in [offender_info,defender_info]:
N_info = len(pk_info)
for i in range(N_info):
this_info = pk_info[i]
if i==0:
# pk_info['pokemon'] = pkf.lookup_name(this_info)
pk_info['pokemon'] = this_info
elif this_info[0]=='+':
pk_info['stages'].append(this_info)
elif this_info[0]=='*':
pk_info['multipliers'].append(float(this_info[1:]))
else:
# pk_info['move'] = pkf.lookup_move(this_info)
pk_info['move'] = this_info
| def make_nicknames_dictionary(input_names, nickname_as_key=True, verbose=False):
"""
This makes nicknames that are absolute and WILL refer to one specific name. This is not a FCFS system for nicknames.
i.e.,
CORRECT: ["Abra","Absol"] -> ["abr","abs"]
INCORRECT: ["Abra","Absol"] -> ["a","ab"]
"""
names = sorted(list(set([name.strip().title() for name in input_names])))
nicknames = []
for this_name in names:
outstring = this_name + ' -> '
other_names = [name for name in names if name != this_name]
name_length = len(this_name)
attempt_length = 1
current_nickname_attempt = ''
while attempt_length <= name_length and any([oname.startswith(current_nickname_attempt) for oname in other_names]):
current_nickname_attempt = this_name[:attempt_length]
attempt_length += 1
settled_nickname = current_nickname_attempt.lower()
nicknames.append(settled_nickname)
outstring += settled_nickname
if verbose:
print(outstring)
if nickname_as_key == False:
(keys, vals) = [names, nicknames]
else:
(keys, vals) = [nicknames, names]
n_names = len(names)
return {keys[i]: vals[i] for i in range(N_names)}
class Namebook(dict):
nn = 'nickname'
tn = 'name'
def __init__(self, user_input):
self._names = []
self._nicknames = []
self._nickname_dictionary = None
if type(user_input) in [str, unicode]:
self.read(user_input)
elif type(user_input) in (set, list):
self._names = list(user_input)
self.generate_nicknames()
self.generate_nickname_dictionary()
def generate_nicknames(self, verbose=False):
names = self._names
for this_name in names:
other_names = [nIter for n_iter in names if nIter != this_name]
name_length = len(this_name)
attempt_length = 1
current_nickname_attempt = ''
while attempt_length <= name_length and any([oname.startswith(current_nickname_attempt) for oname in other_names]):
current_nickname_attempt = this_name[:attempt_length]
attempt_length += 1
settled_nickname = current_nickname_attempt.lower()
if verbose == True:
print('{} -> {}'.format(this_name, settled_nickname))
self._nicknames.append(settled_nickname)
def generate_nickname_dictionary(self):
n_names = len(self._names)
self._nickname_dictionary = {self._nicknames[i]: self._names[i] for i in range(N_names)}
def read(self, filename: str, delimiter=':\t'):
lines = dnio.read(filename, JSON=False)
for line in lines:
(nickname, name) = line.split(delimiter)
if name.strip() == '':
continue
self._names.append(name)
self._nicknames.append(nickname)
self.generate_nickname_dictionary()
def write(self, filename: str, delimiter=':\t'):
return False
def lookup(self, value: str):
"""
Attempts to look up a value, even if it doesn't entirely match. Does NOT look for swapped/misplaced letters however. Only missing END letters.
"""
value = value.lower()
possible_nicknames = [nickname for nickname in self._nicknames if nickname.startswith(value) or value.startswith(nickname)]
n_possible_nicknames = len(possible_nicknames)
if N_possible_nicknames == 1:
return self._nickname_dictionary[possible_nicknames[0]]
elif N_possible_nicknames > 1:
nickname_query = 'Please enter an INDEX:\n\n'.join(['[{}]\t{} ({})'.format(i, self._nickname_dictionary[possible_nicknames[i]], possible_nicknames[i]) for i in range(N_possible_nicknames)]) + '\n'
nickname_selection = input(nickname_query)
return self._nickname_dictionary[possible_nicknames[nickname_selection]]
else:
print('No matches found. Please try again.')
def read_pokepaste(string):
return False
def assess(user_situation: str):
"""
user_situation will look something like this:
glas, icicle, +6Atk - garch
"""
default_dict = {'multipliers': [1], 'stages': [], 'pokemon': '', 'move': ''}
(offender_info, defender_info) = [[info.strip() for info in side.split(',')] for side in user_situation.split('-')]
offender = DEFAULT_DICT
defender = DEFAULT_DICT
for pk_info in [offender_info, defender_info]:
n_info = len(pk_info)
for i in range(N_info):
this_info = pk_info[i]
if i == 0:
pk_info['pokemon'] = this_info
elif this_info[0] == '+':
pk_info['stages'].append(this_info)
elif this_info[0] == '*':
pk_info['multipliers'].append(float(this_info[1:]))
else:
pk_info['move'] = this_info |
Motivations = [ # Acolyte
'I ran away from home at an early age and found refuge in a temple.',
'My family gave me to a temple, since they were unable or unwilling to care for me.',
'I grew up in a household with strong religious convictions. Entering the service of one or more gods seemed natural.',
'An impassioned sermon struck a chord deep in my soul and moved me to serve the faith.',
'I followed a childhood friend, a respected acquaintance, or someone I loved into religious service.',
'After encountering a true servant of the gods, I was so inspired that I immediately entered the service of a religious group.',
# Charlatan
'I was left to my own devices, and my knack for manipulating others helped me survive.',
'I learned early on that people are gullible and easy to explot.',
'I often got in trouble, but I managed to talk my way out of it every time.',
'I took up with a confidence artist, from whom I earned my craft.',
'After a charlatan fleeced my family, I decided to take up the trade so I would never be fooled by such deception again.',
'I was poor or I feared becoming poor, so I learned the tricks I needed to keep myself out of poverty.',
# Criminal
'I resented authority in my younger days and saw a life of crime as the best way to fight against tyranny and oppression.',
'Necessity forced me to take up the life, since it was the only way I could survive.',
'I fell in with a gang of reprobates and I learned my specialty from them.',
'A parent or relative taught me my criminal specialty to prepare me for the family business.',
'I left home and found my place in a criminal organization.',
'I was always bored, so I turned to crime to pass the time and discovered I was quite good at it.',
# Entertainer
'Member of my family made ends meet by performing, so it was fitting for me to follow their example.',
'I always had a keen insight into other people, enough so that I could make them laugh or cry with my strings or songs.',
'I ran away form home to follow a minstrel troupe.',
'I saw a bard perform once, and I knew from that moment on what I was born to do.',
'I earned coin by performing on street corners and eventually made a name for myself.',
'A traveling entertainer took me in and taught me the trade.',
# Folk Hero
'I learned what was right and wrong from my family.',
'I was always enamored by tales of heroes and wished I could be something more than ordinary.',
'I hated my mundane life, so when it was time for someone to step up and do the right thing, I took my chance.',
'A parent of one of my relatives was an adventurer, and I was inspired by their courage.',
'A mad old hermit spoke a prophecy when I was born, saying that I would accomplish great things.',
'I have always stood up for those who are weaker than I am.',
#Guild Artisan
'I was appointed to a master who taught me the business of the guild.',
'I helped a guild artisan keep a secret or complete a task, and in return I was taken on as an apprentice.',
'One of my family members who belonged to the guild made a place for me.',
'I was always good with my hands, so I took the opportunity to learn a trade.',
'I wanted to get awat from my home situation and start a new life.',
'I learned the essentials of my craft from a mentor but had no guild to finish my training.',
# Hermit
'My enemies ruined my reputation, and I fled to the wilds to avoid further disappointment.',
'I am comfortabe with being isolated, as I seek inner peace.',
'I never liked the people I called my friends, so it was easy for me to strike out on my own.',
'I felt compelled to forsake my past, but did so with great reluctance, and sometimes I regret making that decision.',
'I lost everything - my home, my family, my friends. Going it alone was all I could do.',
'The decadence of society disgusted me, so I decided to leave it behind.',
# Noble
'I come from an old and storied family, and it fell to me to preserve the family name.',
'My family has been disgraced, and I intend to clear our name.',
'My family recently came by its title, and that elevation thrust us into a new and strange world.',
'My family has a title, but none of my ancestors have distinguished themselves since we gained it.',
'My family is filled with remakrable people. I hope to live up to their example.'
'I hope to increase the power and influence of my family.',
# Outlander
'I spent a lot of time in the wilderness as a youngster, and I came to love that way of life.',
'From a young age, I could not abide the stink of cities and preferred to spend my time in nature.',
'I came to understand the darness that lurks in the wilds, and I vowed to combat it.',
'My people lived on the edges of civilization, and I learned the methods of survival from my family.',
'After a tragedy, I retreated to the wilderness, leaving my old life behind.',
'My family moved awat from civilization, and I learned to adapt to my new environment.',
# Sage
'I was naturally curious, so I packed up and went to a university to learn more about the world.',
'The teachings of my mentor opened my mind to new possibilities in that field of study.',
'I was always an avid reader, and I learned much about my favorite topic on my own.',
'I discovered an old library and pored over the texts I found there. That experience awakened a hunger for more knowledge.',
'I impressed a wizard who told me I was squandering my talents and should seek out an education to take advantage of my gifts.',
'One of my parents or a relative gave me a basic education that whetted my appetite, and I left home to build on what I had learned.',
# Sailor
'I was press-ganged by pirates and forced to serve on their ship until I finally escaped.',
'I wanted to see the world, so I signed on as a deck-hand for a merchant ship.',
'One of my relatives was a sailor who took me to sea.',
'I needed to escape my community quickly, so I stowed away on a ship. When the crew found me, I was forced to work for my passage.',
'Reavers attacked my community, so I found refuge on a ship until I could seek vengeance.',
'I had few prospects where I was living, so I left to find my fortune elsewhere.',
# Soldier
'I joined the militia to help protect my community from monsters.',
'A relative of mine was a soldier, and I wanted to carry on the family tradtition.',
'The local lord forced me to enlist in the army.',
'War ravaged my homeland while I was growing up. Fighting was the only life I ever knew.',
'I wanted fame and fortune, so I joined a mercenary company, selling my sword to the highest bidder.',
'Invaders attacked my homeland. It was my duty to take up arms in defnse of my people.',
# Urchin
'Wanderlust caused me to leave my family to see the world. I look after myself.',
'I ran away form a bad situation at home and made my own way in the world.',
'Monsters wiped out my village, and I was the sole survivor.',
'A notorious thief looked after me and other orphans, and we spied and stole to earn our keep.',
'One day I woke up on the streets, alone and hungry, with no memory of my early childhood.',
'My parents died, leaving no one to look after me. I raised myself.']
| motivations = ['I ran away from home at an early age and found refuge in a temple.', 'My family gave me to a temple, since they were unable or unwilling to care for me.', 'I grew up in a household with strong religious convictions. Entering the service of one or more gods seemed natural.', 'An impassioned sermon struck a chord deep in my soul and moved me to serve the faith.', 'I followed a childhood friend, a respected acquaintance, or someone I loved into religious service.', 'After encountering a true servant of the gods, I was so inspired that I immediately entered the service of a religious group.', 'I was left to my own devices, and my knack for manipulating others helped me survive.', 'I learned early on that people are gullible and easy to explot.', 'I often got in trouble, but I managed to talk my way out of it every time.', 'I took up with a confidence artist, from whom I earned my craft.', 'After a charlatan fleeced my family, I decided to take up the trade so I would never be fooled by such deception again.', 'I was poor or I feared becoming poor, so I learned the tricks I needed to keep myself out of poverty.', 'I resented authority in my younger days and saw a life of crime as the best way to fight against tyranny and oppression.', 'Necessity forced me to take up the life, since it was the only way I could survive.', 'I fell in with a gang of reprobates and I learned my specialty from them.', 'A parent or relative taught me my criminal specialty to prepare me for the family business.', 'I left home and found my place in a criminal organization.', 'I was always bored, so I turned to crime to pass the time and discovered I was quite good at it.', 'Member of my family made ends meet by performing, so it was fitting for me to follow their example.', 'I always had a keen insight into other people, enough so that I could make them laugh or cry with my strings or songs.', 'I ran away form home to follow a minstrel troupe.', 'I saw a bard perform once, and I knew from that moment on what I was born to do.', 'I earned coin by performing on street corners and eventually made a name for myself.', 'A traveling entertainer took me in and taught me the trade.', 'I learned what was right and wrong from my family.', 'I was always enamored by tales of heroes and wished I could be something more than ordinary.', 'I hated my mundane life, so when it was time for someone to step up and do the right thing, I took my chance.', 'A parent of one of my relatives was an adventurer, and I was inspired by their courage.', 'A mad old hermit spoke a prophecy when I was born, saying that I would accomplish great things.', 'I have always stood up for those who are weaker than I am.', 'I was appointed to a master who taught me the business of the guild.', 'I helped a guild artisan keep a secret or complete a task, and in return I was taken on as an apprentice.', 'One of my family members who belonged to the guild made a place for me.', 'I was always good with my hands, so I took the opportunity to learn a trade.', 'I wanted to get awat from my home situation and start a new life.', 'I learned the essentials of my craft from a mentor but had no guild to finish my training.', 'My enemies ruined my reputation, and I fled to the wilds to avoid further disappointment.', 'I am comfortabe with being isolated, as I seek inner peace.', 'I never liked the people I called my friends, so it was easy for me to strike out on my own.', 'I felt compelled to forsake my past, but did so with great reluctance, and sometimes I regret making that decision.', 'I lost everything - my home, my family, my friends. Going it alone was all I could do.', 'The decadence of society disgusted me, so I decided to leave it behind.', 'I come from an old and storied family, and it fell to me to preserve the family name.', 'My family has been disgraced, and I intend to clear our name.', 'My family recently came by its title, and that elevation thrust us into a new and strange world.', 'My family has a title, but none of my ancestors have distinguished themselves since we gained it.', 'My family is filled with remakrable people. I hope to live up to their example.I hope to increase the power and influence of my family.', 'I spent a lot of time in the wilderness as a youngster, and I came to love that way of life.', 'From a young age, I could not abide the stink of cities and preferred to spend my time in nature.', 'I came to understand the darness that lurks in the wilds, and I vowed to combat it.', 'My people lived on the edges of civilization, and I learned the methods of survival from my family.', 'After a tragedy, I retreated to the wilderness, leaving my old life behind.', 'My family moved awat from civilization, and I learned to adapt to my new environment.', 'I was naturally curious, so I packed up and went to a university to learn more about the world.', 'The teachings of my mentor opened my mind to new possibilities in that field of study.', 'I was always an avid reader, and I learned much about my favorite topic on my own.', 'I discovered an old library and pored over the texts I found there. That experience awakened a hunger for more knowledge.', 'I impressed a wizard who told me I was squandering my talents and should seek out an education to take advantage of my gifts.', 'One of my parents or a relative gave me a basic education that whetted my appetite, and I left home to build on what I had learned.', 'I was press-ganged by pirates and forced to serve on their ship until I finally escaped.', 'I wanted to see the world, so I signed on as a deck-hand for a merchant ship.', 'One of my relatives was a sailor who took me to sea.', 'I needed to escape my community quickly, so I stowed away on a ship. When the crew found me, I was forced to work for my passage.', 'Reavers attacked my community, so I found refuge on a ship until I could seek vengeance.', 'I had few prospects where I was living, so I left to find my fortune elsewhere.', 'I joined the militia to help protect my community from monsters.', 'A relative of mine was a soldier, and I wanted to carry on the family tradtition.', 'The local lord forced me to enlist in the army.', 'War ravaged my homeland while I was growing up. Fighting was the only life I ever knew.', 'I wanted fame and fortune, so I joined a mercenary company, selling my sword to the highest bidder.', 'Invaders attacked my homeland. It was my duty to take up arms in defnse of my people.', 'Wanderlust caused me to leave my family to see the world. I look after myself.', 'I ran away form a bad situation at home and made my own way in the world.', 'Monsters wiped out my village, and I was the sole survivor.', 'A notorious thief looked after me and other orphans, and we spied and stole to earn our keep.', 'One day I woke up on the streets, alone and hungry, with no memory of my early childhood.', 'My parents died, leaving no one to look after me. I raised myself.'] |
"""Stack implementation."""
class Stack():
"""Stack class."""
def __init__(self):
"""
:type None
:rtype None
"""
self.items = []
def push(self, item):
"""
Push item onto the stack.
:type item to add to the top of the stack.
:rtype None
"""
self.items.append(item)
def pop(self):
"""
Pop/remove item from the stack.
:type None
:rtype item popped off the top of the stack.
"""
return self.items.pop()
def peek(self):
"""
Peek at top of the stack.
:type None
:rtype item at the top of the stack.
"""
return self.items[-1]
def isEmpty(self):
"""
Tests if stack is empty.
:type None
:rtype True/False if stack is empty or not.
"""
return len(self.items) == 0
def size(self):
"""
Get the size of the stack.
:type None
:rtype integer size of stack.
"""
return len(self.items)
if __name__=="__main__":
s = Stack()
assert(s.isEmpty() == True)
assert(s.size() == 0)
s.push(1)
s.push('Dog')
s.push('Hello world')
s.push(13.532)
assert(s.pop() == 13.532)
assert(s.size() == 3)
assert(s.isEmpty() == False) | """Stack implementation."""
class Stack:
"""Stack class."""
def __init__(self):
"""
:type None
:rtype None
"""
self.items = []
def push(self, item):
"""
Push item onto the stack.
:type item to add to the top of the stack.
:rtype None
"""
self.items.append(item)
def pop(self):
"""
Pop/remove item from the stack.
:type None
:rtype item popped off the top of the stack.
"""
return self.items.pop()
def peek(self):
"""
Peek at top of the stack.
:type None
:rtype item at the top of the stack.
"""
return self.items[-1]
def is_empty(self):
"""
Tests if stack is empty.
:type None
:rtype True/False if stack is empty or not.
"""
return len(self.items) == 0
def size(self):
"""
Get the size of the stack.
:type None
:rtype integer size of stack.
"""
return len(self.items)
if __name__ == '__main__':
s = stack()
assert s.isEmpty() == True
assert s.size() == 0
s.push(1)
s.push('Dog')
s.push('Hello world')
s.push(13.532)
assert s.pop() == 13.532
assert s.size() == 3
assert s.isEmpty() == False |
# coding: utf8
# Copyright 2017 Vincent Jacques <vincent@vincent-jacques.net>
project = "sphinxcontrib-ocaml"
author = '<a href="http://vincent-jacques.net/">Vincent Jacques</a>'
copyright = ('2017 {} <script>var jacquev6_ribbon_github="{}"</script>'.format(author, project) +
'<script src="https://jacquev6.github.io/ribbon.js"></script>')
version = "0.3.0" # @todo Remove duplication of version (/sphincontrib-ocaml.opam and /doc/conf.py)
release = version
master_doc = "index"
extensions = []
nitpicky = True
# http://www.sphinx-doc.org/en/stable/ext/githubpages.html
extensions.append("sphinx.ext.githubpages")
# https://github.com/bitprophet/alabaster
html_sidebars = {
"**": ["about.html", "navigation.html", "searchbox.html"],
}
html_theme_options = {
"github_user": "jacquev6",
"github_repo": project,
"travis_button": True,
}
# https://github.com/jacquev6/sphinxcontrib-ocaml
extensions.append("sphinxcontrib.ocaml")
| project = 'sphinxcontrib-ocaml'
author = '<a href="http://vincent-jacques.net/">Vincent Jacques</a>'
copyright = '2017 {} <script>var jacquev6_ribbon_github="{}"</script>'.format(author, project) + '<script src="https://jacquev6.github.io/ribbon.js"></script>'
version = '0.3.0'
release = version
master_doc = 'index'
extensions = []
nitpicky = True
extensions.append('sphinx.ext.githubpages')
html_sidebars = {'**': ['about.html', 'navigation.html', 'searchbox.html']}
html_theme_options = {'github_user': 'jacquev6', 'github_repo': project, 'travis_button': True}
extensions.append('sphinxcontrib.ocaml') |
def add(x, *args):
total = x
for i in args:
total += i
print(f'{x=} + {args=} = {total}')
add(1, 2, 3)
add(1, 2)
add(1, 2, 3, 4, 5, 6, 7)
add(1)
| def add(x, *args):
total = x
for i in args:
total += i
print(f'x={x!r} + args={args!r} = {total}')
add(1, 2, 3)
add(1, 2)
add(1, 2, 3, 4, 5, 6, 7)
add(1) |
class orphan_external_exception(Exception):
def __init__(self, args=None):
if args:
self.args = (args,)
else:
self.args = ("Wow I have been imported",)
self.external_demo_attr = "Now imported"
| class Orphan_External_Exception(Exception):
def __init__(self, args=None):
if args:
self.args = (args,)
else:
self.args = ('Wow I have been imported',)
self.external_demo_attr = 'Now imported' |
# Created by Egor Kostan.
# GitHub: https://github.com/ikostan
# LinkedIn: https://www.linkedin.com/in/egor-kostan/
def increment_string(string: str) -> str:
"""
A function which increments a string, to create a new string:
1. If the string already ends with a number, the number should be incremented by 1.
2. If the string does not end with a number. the number 1 should be appended to the new string.
:param string: input string
:return: output string with incremented number
"""
first_digit = get_first_digit_index(string)
if first_digit:
digit: int = int(string[first_digit:])
incremented_digit: str = '{}{}'.format(('0' * (len(string[first_digit:]) - len(str(
digit + 1))) if len(str(digit + 1)) != len(string[first_digit:]) else ''), digit + 1)
return '{}{}'.format(string[:first_digit], incremented_digit)
else:
if string.isdigit():
digit = int(string)
incremented_digit = '{}{}'.format(
('0' * (len(string) - len(str(digit + 1))) if len(str(digit + 1)) != len(string)
else ''), digit + 1)
return incremented_digit
else:
return '{}{}'.format(string, 1)
def get_first_digit_index(string: str):
"""
Find index of first non digit char from right to left
:param string: input string
:return: index of first non digit char or None
"""
for i in range(-1, -1 * len(string) - 1, -1):
if not string[i].isdigit():
return i + 1
return None
| def increment_string(string: str) -> str:
"""
A function which increments a string, to create a new string:
1. If the string already ends with a number, the number should be incremented by 1.
2. If the string does not end with a number. the number 1 should be appended to the new string.
:param string: input string
:return: output string with incremented number
"""
first_digit = get_first_digit_index(string)
if first_digit:
digit: int = int(string[first_digit:])
incremented_digit: str = '{}{}'.format('0' * (len(string[first_digit:]) - len(str(digit + 1))) if len(str(digit + 1)) != len(string[first_digit:]) else '', digit + 1)
return '{}{}'.format(string[:first_digit], incremented_digit)
elif string.isdigit():
digit = int(string)
incremented_digit = '{}{}'.format('0' * (len(string) - len(str(digit + 1))) if len(str(digit + 1)) != len(string) else '', digit + 1)
return incremented_digit
else:
return '{}{}'.format(string, 1)
def get_first_digit_index(string: str):
"""
Find index of first non digit char from right to left
:param string: input string
:return: index of first non digit char or None
"""
for i in range(-1, -1 * len(string) - 1, -1):
if not string[i].isdigit():
return i + 1
return None |
__title__ = 'imgur-cli'
__author__ = 'Usman Ehtesham Gul'
__email__ = 'uehtesham90@gmail.com'
__license__ = 'MIT'
__version__ = '0.0.1'
__url__ = 'https://github.com/ueg1990/imgur-cli.git'
| __title__ = 'imgur-cli'
__author__ = 'Usman Ehtesham Gul'
__email__ = 'uehtesham90@gmail.com'
__license__ = 'MIT'
__version__ = '0.0.1'
__url__ = 'https://github.com/ueg1990/imgur-cli.git' |
class Solution:
# @param candidates, a list of integers
# @param target, integer
# @return a list of lists of integers
def combinationSum(self, candidates, target):
self.results = []
candidates.sort()
self.combination(candidates, target, 0, [])
return self.results
def combination(self, candidates, target, start, result):
if target ==0:
self.results.append(result[:])
elif target > 0:
for i in range(start, len(candidates)):
result.append(candidates[i])
self.combination(candidates, candidates[i] - target, i, result)
result.pop()
| class Solution:
def combination_sum(self, candidates, target):
self.results = []
candidates.sort()
self.combination(candidates, target, 0, [])
return self.results
def combination(self, candidates, target, start, result):
if target == 0:
self.results.append(result[:])
elif target > 0:
for i in range(start, len(candidates)):
result.append(candidates[i])
self.combination(candidates, candidates[i] - target, i, result)
result.pop() |
a = True
b = False
print('AND Logic:')
print('a and a =', a and a)
print('a and b =', a and b)
print('b and b =', b and b)
print('b and a =', b and a)
print('\nOR Logic:')
print('a or a =', a or a)
print('a or b =', a or b)
print('b or b =', b or b)
print('\nNOT Logic:')
print('a =' , a , '\tnot a =' , not a )
print('b =' , b , '\tnot b =' , not b )
| a = True
b = False
print('AND Logic:')
print('a and a =', a and a)
print('a and b =', a and b)
print('b and b =', b and b)
print('b and a =', b and a)
print('\nOR Logic:')
print('a or a =', a or a)
print('a or b =', a or b)
print('b or b =', b or b)
print('\nNOT Logic:')
print('a =', a, '\tnot a =', not a)
print('b =', b, '\tnot b =', not b) |
'''https://leetcode.com/problems/non-overlapping-intervals/
435. Non-overlapping Intervals
Medium
2867
79
Add to List
Share
Given an array of intervals intervals where intervals[i] = [starti, endi], return the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.
Example 1:
Input: intervals = [[1,2],[2,3],[3,4],[1,3]]
Output: 1
Explanation: [1,3] can be removed and the rest of the intervals are non-overlapping.
Example 2:
Input: intervals = [[1,2],[1,2],[1,2]]
Output: 2
Explanation: You need to remove two [1,2] to make the rest of the intervals non-overlapping.
Example 3:
Input: intervals = [[1,2],[2,3]]
Output: 0
Explanation: You don't need to remove any of the intervals since they're already non-overlapping.
Constraints:
1 <= intervals.length <= 105
intervals[i].length == 2
-5 * 104 <= starti < endi <= 5 * 104'''
# Time: O(nlogn)
# Space: O(1)
class Solution(object):
def eraseOverlapIntervals(self, intervals: List[List[int]]) -> int:
size = len(intervals)
if size <= 1:
return 0
intervals.sort(key=lambda x: x[1])
first_end = intervals[0][1]
res = 0
for i in range(1, size):
start, end = intervals[i]
if start >= first_end:
first_end = end
else:
res += 1
return res
| """https://leetcode.com/problems/non-overlapping-intervals/
435. Non-overlapping Intervals
Medium
2867
79
Add to List
Share
Given an array of intervals intervals where intervals[i] = [starti, endi], return the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.
Example 1:
Input: intervals = [[1,2],[2,3],[3,4],[1,3]]
Output: 1
Explanation: [1,3] can be removed and the rest of the intervals are non-overlapping.
Example 2:
Input: intervals = [[1,2],[1,2],[1,2]]
Output: 2
Explanation: You need to remove two [1,2] to make the rest of the intervals non-overlapping.
Example 3:
Input: intervals = [[1,2],[2,3]]
Output: 0
Explanation: You don't need to remove any of the intervals since they're already non-overlapping.
Constraints:
1 <= intervals.length <= 105
intervals[i].length == 2
-5 * 104 <= starti < endi <= 5 * 104"""
class Solution(object):
def erase_overlap_intervals(self, intervals: List[List[int]]) -> int:
size = len(intervals)
if size <= 1:
return 0
intervals.sort(key=lambda x: x[1])
first_end = intervals[0][1]
res = 0
for i in range(1, size):
(start, end) = intervals[i]
if start >= first_end:
first_end = end
else:
res += 1
return res |
# LANGUAGE: Python 3
# AUTHOR: Luiz Devitte
# GitHub: https://github.com/LuizDevitte
def greetings(name):
print('\n')
print('Hello, World!')
print('And Hello, {}!'.format(name))
print('\n')
return 0
def main():
name = input('Hey, who are you? ')
greetings(name)
if __name__=='__main__':
main()
| def greetings(name):
print('\n')
print('Hello, World!')
print('And Hello, {}!'.format(name))
print('\n')
return 0
def main():
name = input('Hey, who are you? ')
greetings(name)
if __name__ == '__main__':
main() |
# ---------------------------------------------------------------------------
# Copyright 2018 The Open Source Electronic Health Record Agent
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ---------------------------------------------------------------------------
FOOTER = """
<center>
<br/>
<br/>
<br/>
<br/>
<div id="footer">©2011-2018 Open Source Electronic Health Record Alliance<br />This work is licensed under a <a href="https://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 Unported License</a> <a href="https://creativecommons.org/licenses/by/3.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/3.0/88x31.png" /></a></div>
</center>
</body>
</html>
"""
| footer = '\n<center>\n<br/>\n<br/>\n<br/>\n<br/>\n<div id="footer">©2011-2018 Open Source Electronic Health Record Alliance<br />This work is licensed under a <a href="https://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 Unported License</a> <a href="https://creativecommons.org/licenses/by/3.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/3.0/88x31.png" /></a></div>\n</center>\n</body>\n</html>\n' |
#!/usr/bin/env python
MAX_LOG_LENGTH = 1000
MESSAGE_MAX_LENGTH = 2000
class ScriptLogger:
def __init__(self, db):
self.db = db
def save(self, user_name, path, logs):
# Don't save empty logs
if len(logs) == 0:
return
# If logs are longer than the maximum allowed,
# trim them to the last MAX_LOG_LENGTH messages.
if len(logs) > MAX_LOG_LENGTH:
logs = logs[-MAX_LOG_LENGTH:]
all_messages = self.transform_log_entries(logs)
user_id = self.db.get_user_id(user_name)
if user_id is None:
return
return self.db.save_logs(user_id, path, all_messages)
def load(self, user_name, path):
all_messages = []
user_id = self.db.get_user_id(user_name)
if user_id is None:
return None
log_records = self.db.get_logs(user_id, path)
for entry in log_records:
all_messages.append(self.transform_messages(entry))
return str(all_messages)
def transform_messages(self, log_entry):
result = []
logs = log_entry["logs"]
for entry in logs:
result.append(self.transform_log_entries([entry]))
return result
@staticmethod
def transform_log_entries(log):
result = []
for entry in log:
try:
message = str(entry["message"])
time = int(entry["time"])
except Exception as e:
# Messages were of incorrect format,
# ignore them and return empty
print(e)
return result
result.append({
"time": time,
"message": message
})
return result
| max_log_length = 1000
message_max_length = 2000
class Scriptlogger:
def __init__(self, db):
self.db = db
def save(self, user_name, path, logs):
if len(logs) == 0:
return
if len(logs) > MAX_LOG_LENGTH:
logs = logs[-MAX_LOG_LENGTH:]
all_messages = self.transform_log_entries(logs)
user_id = self.db.get_user_id(user_name)
if user_id is None:
return
return self.db.save_logs(user_id, path, all_messages)
def load(self, user_name, path):
all_messages = []
user_id = self.db.get_user_id(user_name)
if user_id is None:
return None
log_records = self.db.get_logs(user_id, path)
for entry in log_records:
all_messages.append(self.transform_messages(entry))
return str(all_messages)
def transform_messages(self, log_entry):
result = []
logs = log_entry['logs']
for entry in logs:
result.append(self.transform_log_entries([entry]))
return result
@staticmethod
def transform_log_entries(log):
result = []
for entry in log:
try:
message = str(entry['message'])
time = int(entry['time'])
except Exception as e:
print(e)
return result
result.append({'time': time, 'message': message})
return result |
#
# PySNMP MIB module Fore-DSX1-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Fore-DSX1-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:03:21 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, ValueRangeConstraint, SingleValueConstraint, ConstraintsIntersection, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ValueSizeConstraint")
asx, = mibBuilder.importSymbols("Fore-Common-MIB", "asx")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
iso, ModuleIdentity, TimeTicks, Gauge32, MibScalar, MibTable, MibTableRow, MibTableColumn, Integer32, Unsigned32, IpAddress, Counter64, Counter32, NotificationType, ObjectIdentity, Bits, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "iso", "ModuleIdentity", "TimeTicks", "Gauge32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Integer32", "Unsigned32", "IpAddress", "Counter64", "Counter32", "NotificationType", "ObjectIdentity", "Bits", "MibIdentifier")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
foreDsx1 = ModuleIdentity((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10))
if mibBuilder.loadTexts: foreDsx1.setLastUpdated('9911050000Z')
if mibBuilder.loadTexts: foreDsx1.setOrganization('FORE')
dsx1ForeConfGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1))
dsx1ForeStatsGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2))
dsx1ForeConfTable = MibTable((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1, 1), )
if mibBuilder.loadTexts: dsx1ForeConfTable.setStatus('current')
dsx1ForeConfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1, 1, 1), ).setIndexNames((0, "Fore-DSX1-MIB", "dsx1ForeLineIndex"))
if mibBuilder.loadTexts: dsx1ForeConfEntry.setStatus('current')
dsx1ForeLineIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ForeLineIndex.setStatus('current')
dsx1ForeReceiveCode = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("dsx1ReceiveNoCode", 1), ("dsx1ReceiveLineCode", 2), ("dsx1ReceivePayloadCode", 3), ("dsx1ReceiveResetCode", 4), ("dsx1ReceiveQRS", 5), ("dsx1Receive511Pattern", 6), ("dsx1Receive3in24Pattern", 7), ("dsx1ReceiveOtherTestPattern", 8)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ForeReceiveCode.setStatus('current')
dsx1ForeLineLength = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("dsx1LineLt40", 1), ("dsx1Line40-80", 2), ("dsx1Line80-120", 3), ("dsx1Line120-160", 4), ("dsx1Line160-200", 5), ("dsx1LineE1Coax", 6), ("dsx1LineTwistedPair", 7))).clone('dsx1LineLt40')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dsx1ForeLineLength.setStatus('current')
dsx1ForeFdlConfiguration = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("network", 1), ("user", 2))).clone('network')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dsx1ForeFdlConfiguration.setStatus('current')
dsx1ForeLineImpedance = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1, 1, 1, 5), Integer32().clone(75)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dsx1ForeLineImpedance.setStatus('deprecated')
dsx1ForeFdlPerfConf = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dsx1ForeFdlPerfConf.setStatus('current')
dsx1ForeFdlBomConf = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dsx1ForeFdlBomConf.setStatus('current')
dsx1ForeUpStreamAIS = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1, 1, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('enabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dsx1ForeUpStreamAIS.setStatus('current')
dsx1ForePortModel = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1, 1, 1, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ForePortModel.setStatus('current')
dsx1ForeAdminStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1, 1, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("testing", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dsx1ForeAdminStatus.setStatus('current')
dsx1ForeFramingTable = MibTable((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1), )
if mibBuilder.loadTexts: dsx1ForeFramingTable.setStatus('current')
dsx1ForeFramingEntry = MibTableRow((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1), ).setIndexNames((0, "Fore-DSX1-MIB", "dsx1ForeFramingIndex"))
if mibBuilder.loadTexts: dsx1ForeFramingEntry.setStatus('current')
dsx1ForeFramingIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ForeFramingIndex.setStatus('current')
dsx1ForeFramingLOSs = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ForeFramingLOSs.setStatus('current')
dsx1ForeFramingLCVs = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ForeFramingLCVs.setStatus('current')
dsx1ForeFramingFERRs = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ForeFramingFERRs.setStatus('current')
dsx1ForeFramingOOFs = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ForeFramingOOFs.setStatus('current')
dsx1ForeFramingAISs = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ForeFramingAISs.setStatus('current')
dsx1ForeFramingB8ZSPatterns = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ForeFramingB8ZSPatterns.setStatus('current')
dsx1ForeFraming8Zeros = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ForeFraming8Zeros.setStatus('current')
dsx1ForeFraming16Zeros = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ForeFraming16Zeros.setStatus('current')
dsx1ForeFramingYellowAlarms = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ForeFramingYellowAlarms.setStatus('current')
dsx1ForeFramingRedAlarms = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ForeFramingRedAlarms.setStatus('current')
dsx1ForeFramingBEEs = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ForeFramingBEEs.setStatus('current')
dsx1ForeAtmTable = MibTable((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 2), )
if mibBuilder.loadTexts: dsx1ForeAtmTable.setStatus('current')
dsx1ForeAtmEntry = MibTableRow((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 2, 1), ).setIndexNames((0, "Fore-DSX1-MIB", "dsx1ForeAtmIndex"))
if mibBuilder.loadTexts: dsx1ForeAtmEntry.setStatus('current')
dsx1ForeAtmIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 2, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ForeAtmIndex.setStatus('current')
dsx1ForeAtmRxCells = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 2, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ForeAtmRxCells.setStatus('current')
dsx1ForeAtmTxCells = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 2, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ForeAtmTxCells.setStatus('current')
mibBuilder.exportSymbols("Fore-DSX1-MIB", dsx1ForeFramingOOFs=dsx1ForeFramingOOFs, dsx1ForeFramingB8ZSPatterns=dsx1ForeFramingB8ZSPatterns, dsx1ForeFramingEntry=dsx1ForeFramingEntry, dsx1ForeFramingLCVs=dsx1ForeFramingLCVs, dsx1ForeLineImpedance=dsx1ForeLineImpedance, foreDsx1=foreDsx1, PYSNMP_MODULE_ID=foreDsx1, dsx1ForeFramingFERRs=dsx1ForeFramingFERRs, dsx1ForeAtmTable=dsx1ForeAtmTable, dsx1ForeFraming16Zeros=dsx1ForeFraming16Zeros, dsx1ForeConfEntry=dsx1ForeConfEntry, dsx1ForeFramingRedAlarms=dsx1ForeFramingRedAlarms, dsx1ForeAtmTxCells=dsx1ForeAtmTxCells, dsx1ForeStatsGroup=dsx1ForeStatsGroup, dsx1ForeConfTable=dsx1ForeConfTable, dsx1ForePortModel=dsx1ForePortModel, dsx1ForeFdlBomConf=dsx1ForeFdlBomConf, dsx1ForeAtmRxCells=dsx1ForeAtmRxCells, dsx1ForeAtmIndex=dsx1ForeAtmIndex, dsx1ForeConfGroup=dsx1ForeConfGroup, dsx1ForeFramingYellowAlarms=dsx1ForeFramingYellowAlarms, dsx1ForeFramingAISs=dsx1ForeFramingAISs, dsx1ForeFramingBEEs=dsx1ForeFramingBEEs, dsx1ForeLineIndex=dsx1ForeLineIndex, dsx1ForeFramingTable=dsx1ForeFramingTable, dsx1ForeReceiveCode=dsx1ForeReceiveCode, dsx1ForeUpStreamAIS=dsx1ForeUpStreamAIS, dsx1ForeFdlPerfConf=dsx1ForeFdlPerfConf, dsx1ForeFraming8Zeros=dsx1ForeFraming8Zeros, dsx1ForeAtmEntry=dsx1ForeAtmEntry, dsx1ForeFramingLOSs=dsx1ForeFramingLOSs, dsx1ForeLineLength=dsx1ForeLineLength, dsx1ForeFramingIndex=dsx1ForeFramingIndex, dsx1ForeFdlConfiguration=dsx1ForeFdlConfiguration, dsx1ForeAdminStatus=dsx1ForeAdminStatus)
| (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, single_value_constraint, constraints_intersection, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ValueRangeConstraint', 'SingleValueConstraint', 'ConstraintsIntersection', 'ValueSizeConstraint')
(asx,) = mibBuilder.importSymbols('Fore-Common-MIB', 'asx')
(notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance')
(iso, module_identity, time_ticks, gauge32, mib_scalar, mib_table, mib_table_row, mib_table_column, integer32, unsigned32, ip_address, counter64, counter32, notification_type, object_identity, bits, mib_identifier) = mibBuilder.importSymbols('SNMPv2-SMI', 'iso', 'ModuleIdentity', 'TimeTicks', 'Gauge32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Integer32', 'Unsigned32', 'IpAddress', 'Counter64', 'Counter32', 'NotificationType', 'ObjectIdentity', 'Bits', 'MibIdentifier')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
fore_dsx1 = module_identity((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10))
if mibBuilder.loadTexts:
foreDsx1.setLastUpdated('9911050000Z')
if mibBuilder.loadTexts:
foreDsx1.setOrganization('FORE')
dsx1_fore_conf_group = mib_identifier((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1))
dsx1_fore_stats_group = mib_identifier((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2))
dsx1_fore_conf_table = mib_table((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1, 1))
if mibBuilder.loadTexts:
dsx1ForeConfTable.setStatus('current')
dsx1_fore_conf_entry = mib_table_row((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1, 1, 1)).setIndexNames((0, 'Fore-DSX1-MIB', 'dsx1ForeLineIndex'))
if mibBuilder.loadTexts:
dsx1ForeConfEntry.setStatus('current')
dsx1_fore_line_index = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dsx1ForeLineIndex.setStatus('current')
dsx1_fore_receive_code = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=named_values(('dsx1ReceiveNoCode', 1), ('dsx1ReceiveLineCode', 2), ('dsx1ReceivePayloadCode', 3), ('dsx1ReceiveResetCode', 4), ('dsx1ReceiveQRS', 5), ('dsx1Receive511Pattern', 6), ('dsx1Receive3in24Pattern', 7), ('dsx1ReceiveOtherTestPattern', 8)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dsx1ForeReceiveCode.setStatus('current')
dsx1_fore_line_length = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1, 1, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('dsx1LineLt40', 1), ('dsx1Line40-80', 2), ('dsx1Line80-120', 3), ('dsx1Line120-160', 4), ('dsx1Line160-200', 5), ('dsx1LineE1Coax', 6), ('dsx1LineTwistedPair', 7))).clone('dsx1LineLt40')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
dsx1ForeLineLength.setStatus('current')
dsx1_fore_fdl_configuration = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1, 1, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('network', 1), ('user', 2))).clone('network')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
dsx1ForeFdlConfiguration.setStatus('current')
dsx1_fore_line_impedance = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1, 1, 1, 5), integer32().clone(75)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
dsx1ForeLineImpedance.setStatus('deprecated')
dsx1_fore_fdl_perf_conf = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1, 1, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone('disabled')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
dsx1ForeFdlPerfConf.setStatus('current')
dsx1_fore_fdl_bom_conf = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1, 1, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone('disabled')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
dsx1ForeFdlBomConf.setStatus('current')
dsx1_fore_up_stream_ais = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1, 1, 1, 8), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone('enabled')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
dsx1ForeUpStreamAIS.setStatus('current')
dsx1_fore_port_model = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1, 1, 1, 9), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dsx1ForePortModel.setStatus('current')
dsx1_fore_admin_status = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 1, 1, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('up', 1), ('down', 2), ('testing', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
dsx1ForeAdminStatus.setStatus('current')
dsx1_fore_framing_table = mib_table((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1))
if mibBuilder.loadTexts:
dsx1ForeFramingTable.setStatus('current')
dsx1_fore_framing_entry = mib_table_row((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1)).setIndexNames((0, 'Fore-DSX1-MIB', 'dsx1ForeFramingIndex'))
if mibBuilder.loadTexts:
dsx1ForeFramingEntry.setStatus('current')
dsx1_fore_framing_index = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dsx1ForeFramingIndex.setStatus('current')
dsx1_fore_framing_lo_ss = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dsx1ForeFramingLOSs.setStatus('current')
dsx1_fore_framing_lc_vs = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dsx1ForeFramingLCVs.setStatus('current')
dsx1_fore_framing_fer_rs = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dsx1ForeFramingFERRs.setStatus('current')
dsx1_fore_framing_oo_fs = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dsx1ForeFramingOOFs.setStatus('current')
dsx1_fore_framing_ai_ss = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1, 6), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dsx1ForeFramingAISs.setStatus('current')
dsx1_fore_framing_b8_zs_patterns = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1, 7), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dsx1ForeFramingB8ZSPatterns.setStatus('current')
dsx1_fore_framing8_zeros = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1, 8), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dsx1ForeFraming8Zeros.setStatus('current')
dsx1_fore_framing16_zeros = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1, 9), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dsx1ForeFraming16Zeros.setStatus('current')
dsx1_fore_framing_yellow_alarms = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1, 10), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dsx1ForeFramingYellowAlarms.setStatus('current')
dsx1_fore_framing_red_alarms = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1, 11), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dsx1ForeFramingRedAlarms.setStatus('current')
dsx1_fore_framing_be_es = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 1, 1, 12), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dsx1ForeFramingBEEs.setStatus('current')
dsx1_fore_atm_table = mib_table((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 2))
if mibBuilder.loadTexts:
dsx1ForeAtmTable.setStatus('current')
dsx1_fore_atm_entry = mib_table_row((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 2, 1)).setIndexNames((0, 'Fore-DSX1-MIB', 'dsx1ForeAtmIndex'))
if mibBuilder.loadTexts:
dsx1ForeAtmEntry.setStatus('current')
dsx1_fore_atm_index = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 2, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dsx1ForeAtmIndex.setStatus('current')
dsx1_fore_atm_rx_cells = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 2, 1, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dsx1ForeAtmRxCells.setStatus('current')
dsx1_fore_atm_tx_cells = mib_table_column((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 10, 2, 2, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dsx1ForeAtmTxCells.setStatus('current')
mibBuilder.exportSymbols('Fore-DSX1-MIB', dsx1ForeFramingOOFs=dsx1ForeFramingOOFs, dsx1ForeFramingB8ZSPatterns=dsx1ForeFramingB8ZSPatterns, dsx1ForeFramingEntry=dsx1ForeFramingEntry, dsx1ForeFramingLCVs=dsx1ForeFramingLCVs, dsx1ForeLineImpedance=dsx1ForeLineImpedance, foreDsx1=foreDsx1, PYSNMP_MODULE_ID=foreDsx1, dsx1ForeFramingFERRs=dsx1ForeFramingFERRs, dsx1ForeAtmTable=dsx1ForeAtmTable, dsx1ForeFraming16Zeros=dsx1ForeFraming16Zeros, dsx1ForeConfEntry=dsx1ForeConfEntry, dsx1ForeFramingRedAlarms=dsx1ForeFramingRedAlarms, dsx1ForeAtmTxCells=dsx1ForeAtmTxCells, dsx1ForeStatsGroup=dsx1ForeStatsGroup, dsx1ForeConfTable=dsx1ForeConfTable, dsx1ForePortModel=dsx1ForePortModel, dsx1ForeFdlBomConf=dsx1ForeFdlBomConf, dsx1ForeAtmRxCells=dsx1ForeAtmRxCells, dsx1ForeAtmIndex=dsx1ForeAtmIndex, dsx1ForeConfGroup=dsx1ForeConfGroup, dsx1ForeFramingYellowAlarms=dsx1ForeFramingYellowAlarms, dsx1ForeFramingAISs=dsx1ForeFramingAISs, dsx1ForeFramingBEEs=dsx1ForeFramingBEEs, dsx1ForeLineIndex=dsx1ForeLineIndex, dsx1ForeFramingTable=dsx1ForeFramingTable, dsx1ForeReceiveCode=dsx1ForeReceiveCode, dsx1ForeUpStreamAIS=dsx1ForeUpStreamAIS, dsx1ForeFdlPerfConf=dsx1ForeFdlPerfConf, dsx1ForeFraming8Zeros=dsx1ForeFraming8Zeros, dsx1ForeAtmEntry=dsx1ForeAtmEntry, dsx1ForeFramingLOSs=dsx1ForeFramingLOSs, dsx1ForeLineLength=dsx1ForeLineLength, dsx1ForeFramingIndex=dsx1ForeFramingIndex, dsx1ForeFdlConfiguration=dsx1ForeFdlConfiguration, dsx1ForeAdminStatus=dsx1ForeAdminStatus) |
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 18 18:30:07 2021
@author: SethHarden
Given an array nums of distinct integers,
return all the possible permutations.
You can return the answer in any order.
"""
nums = [1,5,4,3]
list = ['a','b','c']
list.append('s')
popped = list.pop()
courses_2 = ['x', 'z']
list.insert(0, courses_2)
list.extend(courses_2)
list.remove(['x','z'])
#print('pop: ',popped)
#print('list: ', list)
list.reverse()
#print('reversed: ', list)
list.sort()
#print('sorted: ', list)
list.sort(reverse=True)
#print('reversed: ', list)
sorted_list = sorted(nums)
#print('nums: ', sorted_list)
#['a','b','c','d','e']
# print(min(nums))
# print(max(nums))
# print(sum(nums))
# return_index = list.index('b')
# print('art' in list)
# for i, list in enumerate(list, start=1):
# print(i, list)
list_str = ' - '.join(list)
new_list = list_str.split(' - ')
print(list_str)
print(new_list)
1,2,3
1,
1,2
1,3
2
2,3
3
| """
Created on Mon Jan 18 18:30:07 2021
@author: SethHarden
Given an array nums of distinct integers,
return all the possible permutations.
You can return the answer in any order.
"""
nums = [1, 5, 4, 3]
list = ['a', 'b', 'c']
list.append('s')
popped = list.pop()
courses_2 = ['x', 'z']
list.insert(0, courses_2)
list.extend(courses_2)
list.remove(['x', 'z'])
list.reverse()
list.sort()
list.sort(reverse=True)
sorted_list = sorted(nums)
list_str = ' - '.join(list)
new_list = list_str.split(' - ')
print(list_str)
print(new_list)
(1, 2, 3)
(1,)
(1, 2)
(1, 3)
2
(2, 3)
3 |
class BattleEventsListener:
def on_battle_begins(self):
pass
def on_battle_ends(self):
pass
def on_reflected_attack(self, attack_obj):
pass
def on_unit_damaged(self, attack_obj):
pass
def on_unit_killed(self, attack_obj):
pass
def on_squad_killed(self, attack_obj):
pass
| class Battleeventslistener:
def on_battle_begins(self):
pass
def on_battle_ends(self):
pass
def on_reflected_attack(self, attack_obj):
pass
def on_unit_damaged(self, attack_obj):
pass
def on_unit_killed(self, attack_obj):
pass
def on_squad_killed(self, attack_obj):
pass |
# -*- coding: utf-8 -*-
class GameConfig:
# Frame dimensions
width = 30
height = 15
# Start the game at this speed
initial_speed = 3.0
# For every point scored, increase game speed by this amount
speed_increase_factor = 0.15
# Maximum game speed.
max_speed = 30
# Enforce collision with frame boundaries.
solid_walls = True
# Amount of food initially displayed on screen.
initial_food_count = 1
# Max amount of food ever displayed at one time.
max_food_count = 5
# Increment the number of food items displayed in game
# once every 'food_increase_interval' points scored.
# (Set to 0 to never increment food display count).
food_increase_interval = 10
| class Gameconfig:
width = 30
height = 15
initial_speed = 3.0
speed_increase_factor = 0.15
max_speed = 30
solid_walls = True
initial_food_count = 1
max_food_count = 5
food_increase_interval = 10 |
# fibonaccisequence2.py
# This program sums numbers in a Fibonacci sequence to a point specified by the
# user.
"""The Fibonacci sequence starts 1, 1, 2, 3, 5, 8,... Each number in the
sequence (after the first two) is the sum of the previous two. Write a program
that computes and outputs the nth Fibonacci number, where n is a value entered
by the user."""
def getInput():
while True:
try:
n = int(input("Please input how many numbers you wish to proceed \
down the sequence: "))
except (SyntaxError, NameError, TypeError, ValueError):
print("You have to enter a whole number.")
continue
return n
def fibonacciNumber(n):
ans = 1
sum = 0
for i in range(n-1):
print("n = {0}, {1}".format((i+1),ans))
ans = sum + ans
sum = ans - sum
print("n = {0}, {1}".format(n,ans))
return ans
def main():
print("This program sums a series of numbers to produce a Fibonacci \
sequence to a point specified by the user.")
n = getInput()
fibNum = fibonacciNumber(n)
print("The Fibonacci number for n = {0} is {1}.".format(n, fibNum))
main()
| """The Fibonacci sequence starts 1, 1, 2, 3, 5, 8,... Each number in the
sequence (after the first two) is the sum of the previous two. Write a program
that computes and outputs the nth Fibonacci number, where n is a value entered
by the user."""
def get_input():
while True:
try:
n = int(input('Please input how many numbers you wish to proceed down the sequence: '))
except (SyntaxError, NameError, TypeError, ValueError):
print('You have to enter a whole number.')
continue
return n
def fibonacci_number(n):
ans = 1
sum = 0
for i in range(n - 1):
print('n = {0}, {1}'.format(i + 1, ans))
ans = sum + ans
sum = ans - sum
print('n = {0}, {1}'.format(n, ans))
return ans
def main():
print('This program sums a series of numbers to produce a Fibonacci sequence to a point specified by the user.')
n = get_input()
fib_num = fibonacci_number(n)
print('The Fibonacci number for n = {0} is {1}.'.format(n, fibNum))
main() |
print("%s" % 1.0)
print("%r" % 1.0)
print("%d" % 1.0)
print("%i" % 1.0)
print("%u" % 1.0)
# these 3 have different behaviour in Python 3.x versions
# uPy raises a TypeError, following Python 3.5 (earlier versions don't)
#print("%x" % 18.0)
#print("%o" % 18.0)
#print("%X" % 18.0)
print("%e" % 1.23456)
print("%E" % 1.23456)
print("%f" % 1.23456)
print("%F" % 1.23456)
print("%g" % 1.23456)
print("%G" % 1.23456)
print("%06e" % float("inf"))
print("%06e" % float("-inf"))
print("%06e" % float("nan"))
print("%02.3d" % 123) # prec > width
print("%+f %+f" % (1.23, -1.23)) # float sign
print("% f % f" % (1.23, -1.23)) # float space sign
print("%0f" % -1.23) # negative number with 0 padding
| print('%s' % 1.0)
print('%r' % 1.0)
print('%d' % 1.0)
print('%i' % 1.0)
print('%u' % 1.0)
print('%e' % 1.23456)
print('%E' % 1.23456)
print('%f' % 1.23456)
print('%F' % 1.23456)
print('%g' % 1.23456)
print('%G' % 1.23456)
print('%06e' % float('inf'))
print('%06e' % float('-inf'))
print('%06e' % float('nan'))
print('%02.3d' % 123)
print('%+f %+f' % (1.23, -1.23))
print('% f % f' % (1.23, -1.23))
print('%0f' % -1.23) |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def binaryTreePaths(self, root):
"""
:type root: TreeNode
:rtype: List[str]
"""
result = []
if not root:
return result
if not root.left and not root.right:
result.append(str(root.val))
return result
left = self.binaryTreePaths(root.left)
right = self.binaryTreePaths(root.right)
for path in left:
result.append(str(root.val) + '->' + path)
for path in right:
result.append(str(root.val) + '->' + path)
return result
| class Solution:
def binary_tree_paths(self, root):
"""
:type root: TreeNode
:rtype: List[str]
"""
result = []
if not root:
return result
if not root.left and (not root.right):
result.append(str(root.val))
return result
left = self.binaryTreePaths(root.left)
right = self.binaryTreePaths(root.right)
for path in left:
result.append(str(root.val) + '->' + path)
for path in right:
result.append(str(root.val) + '->' + path)
return result |
N,K=map(int,input().split())
S=[int(input()) for i in range(N)]
length=left=0
mul=1
if 0 in S:
length=N
else:
for right in range(N):
mul*=S[right]
if mul<=K:
length=max(length,right-left+1)
else:
mul//=S[left]
left+=1
print(length) | (n, k) = map(int, input().split())
s = [int(input()) for i in range(N)]
length = left = 0
mul = 1
if 0 in S:
length = N
else:
for right in range(N):
mul *= S[right]
if mul <= K:
length = max(length, right - left + 1)
else:
mul //= S[left]
left += 1
print(length) |
class SERPException(Exception):
pass
class ItemNotFoundException(SERPException):
pass
| class Serpexception(Exception):
pass
class Itemnotfoundexception(SERPException):
pass |
#! /usr/bin/python3
def parts(arr):
arr.append(0)
arr.append(max(arr)+3)
arr.sort()
_type1 = 0
_type2 = 0
for _x in range(0, len(arr)-1):
_difference = arr[_x+1] - arr[_x]
if _difference == 1:
_type1 += 1
elif _difference == 3:
_type2 += 1
_dict = {}
def two(_index):
if _index == len(arr) - 1:
print('end return 1')
return 1
if _index in _dict:
return _dict[_index]
_sum = 0
if _index + 1 < len(arr) and arr[_index+1] - arr[_index] <= 3:
_sum += two(_index+1)
if _index + 2 < len(arr) and arr[_index+2] - arr[_index] <= 3:
_sum += two(_index+2)
if _index + 3 < len(arr) and arr[_index+3] - arr[_index] <= 3:
_sum += two(_index + 3)
_dict[_index] = _sum
return _sum
print(f'partOne: {_type1*_type2}')
print(arr)
print(f'partTwo: {two(0)}')
inputs = [int(x.strip()) for x in open('input.txt', 'r').readlines()]
parts(inputs)
| def parts(arr):
arr.append(0)
arr.append(max(arr) + 3)
arr.sort()
_type1 = 0
_type2 = 0
for _x in range(0, len(arr) - 1):
_difference = arr[_x + 1] - arr[_x]
if _difference == 1:
_type1 += 1
elif _difference == 3:
_type2 += 1
_dict = {}
def two(_index):
if _index == len(arr) - 1:
print('end return 1')
return 1
if _index in _dict:
return _dict[_index]
_sum = 0
if _index + 1 < len(arr) and arr[_index + 1] - arr[_index] <= 3:
_sum += two(_index + 1)
if _index + 2 < len(arr) and arr[_index + 2] - arr[_index] <= 3:
_sum += two(_index + 2)
if _index + 3 < len(arr) and arr[_index + 3] - arr[_index] <= 3:
_sum += two(_index + 3)
_dict[_index] = _sum
return _sum
print(f'partOne: {_type1 * _type2}')
print(arr)
print(f'partTwo: {two(0)}')
inputs = [int(x.strip()) for x in open('input.txt', 'r').readlines()]
parts(inputs) |
# Debug flag
DEBUG = False
# Menu tuple IDX return
IDX_STOCK = 0
IDX_DATE_RANGE = 1
IDX_PERCENT_TRAINED = 2 | debug = False
idx_stock = 0
idx_date_range = 1
idx_percent_trained = 2 |
""" Detecting Loop in a given linked list """
class Node:
# Function to initialise the node object
def __init__(self, data):
self.data = data # Assign data
self.next = None # Initialize next as null
class LinkedList:
# Function to initialize head
def __init__(self):
self.head = None
def print_list(self):
temp = self.head
while temp:
print(temp.data, end=" -> ")
temp = temp.next
print("")
def detect_loop(l_list):
if l_list.head is None:
print("Null List")
return
if l_list.head.next is None:
if l_list.head.next == l_list.head:
print("Loop Present")
return
temp = l_list.head.next
while temp:
curr_head = l_list.head
while curr_head:
if curr_head == temp.next:
print(curr_head.data, temp.data)
print("Loop Present")
return
if curr_head == temp:
break
curr_head = curr_head.next
temp = temp.next
""" Another approach would be to add a boolean visited in the Node class and mark it True. If we see any visited we
print that the loop is present as we already seen this element before"""
""" Another approach would be to create a dummy node and once you visit a node you change it's next to this dummy node
If you visit this node again due to loop you would find the next as this dummy node. """
""" To do this without modifying the linked list we can use a hash set """
def detect_loop_hash(l_list):
if l_list.head is None:
return
temp = l_list.head
hash_set = {temp: 1}
while temp:
temp = temp.next
if temp in hash_set.keys():
print(temp.data)
print("Loop Detected")
return
else:
hash_set[temp] = 1
""" To do this with O(1) aux space we can use the floyd cycle detection algorithm. Also to remove the loop we can use
the fact that when these two pointers meet if we reset slow to head and move them again at the same speed they
will meet at the beginning of the loop"""
def detect_loop_floyd(l_list):
if l_list.head is None:
return
s_head = l_list.head
f_head = l_list.head
while f_head and f_head.next:
s_head = s_head.next
f_head = f_head.next.next
if s_head == f_head:
break
if s_head != f_head:
return
s_head = l_list.head
while f_head.next != s_head.next:
f_head = f_head.next
s_head = s_head.next
f_head.next = None
def main():
l_list = LinkedList()
l_list.head = Node(10)
second = Node(20)
third = Node(30)
fourth = Node(40)
l_list.head.next = second
second.next = third # Link second node with the third node
third.next = fourth
fourth.next = second
detect_loop_floyd(l_list)
l_list.print_list()
if __name__ == '__main__':
# Start with the empty list
main()
| """ Detecting Loop in a given linked list """
class Node:
def __init__(self, data):
self.data = data
self.next = None
class Linkedlist:
def __init__(self):
self.head = None
def print_list(self):
temp = self.head
while temp:
print(temp.data, end=' -> ')
temp = temp.next
print('')
def detect_loop(l_list):
if l_list.head is None:
print('Null List')
return
if l_list.head.next is None:
if l_list.head.next == l_list.head:
print('Loop Present')
return
temp = l_list.head.next
while temp:
curr_head = l_list.head
while curr_head:
if curr_head == temp.next:
print(curr_head.data, temp.data)
print('Loop Present')
return
if curr_head == temp:
break
curr_head = curr_head.next
temp = temp.next
' Another approach would be to add a boolean visited in the Node class and mark it True. If we see any visited we \n print that the loop is present as we already seen this element before'
" Another approach would be to create a dummy node and once you visit a node you change it's next to this dummy node\n If you visit this node again due to loop you would find the next as this dummy node. "
' To do this without modifying the linked list we can use a hash set '
def detect_loop_hash(l_list):
if l_list.head is None:
return
temp = l_list.head
hash_set = {temp: 1}
while temp:
temp = temp.next
if temp in hash_set.keys():
print(temp.data)
print('Loop Detected')
return
else:
hash_set[temp] = 1
' To do this with O(1) aux space we can use the floyd cycle detection algorithm. Also to remove the loop we can use \n the fact that when these two pointers meet if we reset slow to head and move them again at the same speed they\n will meet at the beginning of the loop'
def detect_loop_floyd(l_list):
if l_list.head is None:
return
s_head = l_list.head
f_head = l_list.head
while f_head and f_head.next:
s_head = s_head.next
f_head = f_head.next.next
if s_head == f_head:
break
if s_head != f_head:
return
s_head = l_list.head
while f_head.next != s_head.next:
f_head = f_head.next
s_head = s_head.next
f_head.next = None
def main():
l_list = linked_list()
l_list.head = node(10)
second = node(20)
third = node(30)
fourth = node(40)
l_list.head.next = second
second.next = third
third.next = fourth
fourth.next = second
detect_loop_floyd(l_list)
l_list.print_list()
if __name__ == '__main__':
main() |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Blaze targets for golden file testing.
This file defines targets `diff_test` and `cmd_diff_test` for "golden file
testing".
The diff_test target computes the diff of some `actual` output and some
`expected` output, either succeeding if the diff is empty or failing and
printing the nonempty diff otherwise. To auto-generate or update the expected
file, run:
```sh
bazel run <diff test target> -- --update`
```
Make sure that the expected file exists.
"""
def execpath(path):
return "$(execpath %s)" % path
def rootpath(path):
return "$(rootpath %s)" % path
def _diff_test_script(ctx):
"""Returns bash script to be executed by the diff_test target."""
return """
if [[ "$1" == "--update" || "$1" == "--test" ]]; then
cp -f "{actual}" "${{BUILD_WORKSPACE_DIRECTORY}}/{expected}"
fi
diff -u "{expected}" "{actual}"
if [[ $? = 0 ]]; then
# Expected and actual agree.
if [[ "$1" == "--update" ]]; then
echo "Successfully updated: {expected}."
elif [[ "$1" == "--test" ]]; then
echo "Successfully updated: {expected}."
echo ""
cat {expected}
else
echo "PASSED"
fi
exit 0
else
# Expected and actual disagree.
if [[ "$1" == "--update" ]]; then
echo "Failed to update: {expected}. Try updating manually."
else
cat << EOF
Output not as expected. To update $(basename {expected}), run the following command:
bazel run {target} -- --update
EOF
fi
exit 1
fi
""".format(
actual = ctx.file.actual.short_path,
expected = ctx.file.expected.short_path,
target = ctx.label,
)
def _diff_test_impl(ctx):
"""Computes diff of two files, checking that they agree.
When invoked as `bazel run <target> -- --update`, will update the `expected`
file to match the contents of the `actual` file. Note that the file must
already exist.
"""
# Write test script that will be executed by 'bazel test'.
ctx.actions.write(
output = ctx.outputs.executable,
content = _diff_test_script(ctx),
is_executable = True,
)
# Make test script dependencies available at runtime.
runfiles = [ctx.file.actual, ctx.file.expected]
return DefaultInfo(
runfiles = ctx.runfiles(files = runfiles),
)
diff_test = rule(
doc = """Computes diff of two files, checking that they agree.
Typically used to test that the output of some command looks as expected.
To update the expected file, run `bazel run <target> -- --update`.
""",
implementation = _diff_test_impl,
test = True,
attrs = {
"actual": attr.label(
doc = "'Actual' file, typically containing the output of some command.",
mandatory = True,
allow_single_file = True,
),
"expected": attr.label(
doc = """\
Expected file (aka golden file), containing the expected output.
To auto-generate or update, run `bazel run <target> -- --update`.
""",
mandatory = True,
allow_single_file = True,
),
},
)
def cmd_diff_test(name, actual_cmd, expected, tools = [], data = [], visibility = None):
"""Runs a command to get the actual output, to compare against `expected`."""
native.genrule(
name = name + "_output",
visibility = visibility,
srcs = data,
outs = [name + ".actual"],
tools = tools,
cmd = actual_cmd + " > '$@'",
testonly = True,
)
diff_test(
name = name,
actual = name + ".actual",
expected = expected,
)
| """Blaze targets for golden file testing.
This file defines targets `diff_test` and `cmd_diff_test` for "golden file
testing".
The diff_test target computes the diff of some `actual` output and some
`expected` output, either succeeding if the diff is empty or failing and
printing the nonempty diff otherwise. To auto-generate or update the expected
file, run:
```sh
bazel run <diff test target> -- --update`
```
Make sure that the expected file exists.
"""
def execpath(path):
return '$(execpath %s)' % path
def rootpath(path):
return '$(rootpath %s)' % path
def _diff_test_script(ctx):
"""Returns bash script to be executed by the diff_test target."""
return '\nif [[ "$1" == "--update" || "$1" == "--test" ]]; then\n cp -f "{actual}" "${{BUILD_WORKSPACE_DIRECTORY}}/{expected}"\nfi\n\ndiff -u "{expected}" "{actual}"\n\nif [[ $? = 0 ]]; then\n # Expected and actual agree.\n if [[ "$1" == "--update" ]]; then\n echo "Successfully updated: {expected}."\n elif [[ "$1" == "--test" ]]; then\n echo "Successfully updated: {expected}."\n echo ""\n cat {expected}\n else\n echo "PASSED"\n fi\n exit 0\nelse\n # Expected and actual disagree.\n if [[ "$1" == "--update" ]]; then\n echo "Failed to update: {expected}. Try updating manually."\n else\n cat << EOF\n\nOutput not as expected. To update $(basename {expected}), run the following command:\nbazel run {target} -- --update\nEOF\n fi\n exit 1\nfi\n '.format(actual=ctx.file.actual.short_path, expected=ctx.file.expected.short_path, target=ctx.label)
def _diff_test_impl(ctx):
"""Computes diff of two files, checking that they agree.
When invoked as `bazel run <target> -- --update`, will update the `expected`
file to match the contents of the `actual` file. Note that the file must
already exist.
"""
ctx.actions.write(output=ctx.outputs.executable, content=_diff_test_script(ctx), is_executable=True)
runfiles = [ctx.file.actual, ctx.file.expected]
return default_info(runfiles=ctx.runfiles(files=runfiles))
diff_test = rule(doc='Computes diff of two files, checking that they agree.\n\n Typically used to test that the output of some command looks as expected.\n To update the expected file, run `bazel run <target> -- --update`.\n ', implementation=_diff_test_impl, test=True, attrs={'actual': attr.label(doc="'Actual' file, typically containing the output of some command.", mandatory=True, allow_single_file=True), 'expected': attr.label(doc='Expected file (aka golden file), containing the expected output.\nTo auto-generate or update, run `bazel run <target> -- --update`.\n', mandatory=True, allow_single_file=True)})
def cmd_diff_test(name, actual_cmd, expected, tools=[], data=[], visibility=None):
"""Runs a command to get the actual output, to compare against `expected`."""
native.genrule(name=name + '_output', visibility=visibility, srcs=data, outs=[name + '.actual'], tools=tools, cmd=actual_cmd + " > '$@'", testonly=True)
diff_test(name=name, actual=name + '.actual', expected=expected) |
def deep_reverse(arr):
if len(arr) == 0:
return []
last_el = arr[-1]
rem_list = deep_reverse(arr[:-1]) # remaining list
if type(last_el) is list:
last_el = deep_reverse(last_el)
rem_list.insert(0, last_el)
return rem_list
def test_function(test_case):
arr = test_case[0]
solution = test_case[1]
output = deep_reverse(arr)
if output == solution:
print("Pass")
else:
print("False")
arr = [1, 2, 3, 4, 5]
solution = [5, 4, 3, 2, 1]
test_case = [arr, solution]
test_function(test_case)
arr = [1, 2, [3, 4, 5], 4, 5]
solution = [5, 4, [5, 4, 3], 2, 1]
test_case = [arr, solution]
test_function(test_case)
arr = [1, [2, 3, [4, [5, 6]]]]
solution = [[[[6, 5], 4], 3, 2], 1]
test_case = [arr, solution]
test_function(test_case)
arr = [1, [2,3], 4, [5,6]]
solution = [ [6,5], 4, [3, 2], 1]
test_case = [arr, solution]
test_function(test_case)
| def deep_reverse(arr):
if len(arr) == 0:
return []
last_el = arr[-1]
rem_list = deep_reverse(arr[:-1])
if type(last_el) is list:
last_el = deep_reverse(last_el)
rem_list.insert(0, last_el)
return rem_list
def test_function(test_case):
arr = test_case[0]
solution = test_case[1]
output = deep_reverse(arr)
if output == solution:
print('Pass')
else:
print('False')
arr = [1, 2, 3, 4, 5]
solution = [5, 4, 3, 2, 1]
test_case = [arr, solution]
test_function(test_case)
arr = [1, 2, [3, 4, 5], 4, 5]
solution = [5, 4, [5, 4, 3], 2, 1]
test_case = [arr, solution]
test_function(test_case)
arr = [1, [2, 3, [4, [5, 6]]]]
solution = [[[[6, 5], 4], 3, 2], 1]
test_case = [arr, solution]
test_function(test_case)
arr = [1, [2, 3], 4, [5, 6]]
solution = [[6, 5], 4, [3, 2], 1]
test_case = [arr, solution]
test_function(test_case) |
# problem link: https://leetcode.com/problems/combination-sum-iii/
class Solution:
def combinationSum3(self, k: int, n: int) -> List[List[int]]:
end_num = 10 # candidates numbers are btw 0 - 9
def dfs(cur_list, cur_size, next_num):
if cur_size == k and sum(cur_list) == n:
res.append(cur_list)
return
if cur_size > k or sum(cur_list) > n: # pruning
return
for i in range(next_num, end_num):
dfs(cur_list + [i], cur_size + 1, i + 1)
res = []
dfs([], 0, 1)
return res | class Solution:
def combination_sum3(self, k: int, n: int) -> List[List[int]]:
end_num = 10
def dfs(cur_list, cur_size, next_num):
if cur_size == k and sum(cur_list) == n:
res.append(cur_list)
return
if cur_size > k or sum(cur_list) > n:
return
for i in range(next_num, end_num):
dfs(cur_list + [i], cur_size + 1, i + 1)
res = []
dfs([], 0, 1)
return res |
def insertion_sort(arr):
for k in range(1, len(arr)):
key = arr[k]
j = k
while j > 0 and arr[j-1] > arr[j]:
arr[j], arr[j-1] = arr[j-1], arr[j]
j = j - 1
my_list = [24, 81, 13, 57, 16]
insertion_sort(my_list)
print(my_list) | def insertion_sort(arr):
for k in range(1, len(arr)):
key = arr[k]
j = k
while j > 0 and arr[j - 1] > arr[j]:
(arr[j], arr[j - 1]) = (arr[j - 1], arr[j])
j = j - 1
my_list = [24, 81, 13, 57, 16]
insertion_sort(my_list)
print(my_list) |
#
# PySNMP MIB module ELTEX-MES-VLAN-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELTEX-MES-VLAN-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:02:10 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ConstraintsIntersection, SingleValueConstraint, ValueRangeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsIntersection", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsUnion")
dot1dBasePort, = mibBuilder.importSymbols("BRIDGE-MIB", "dot1dBasePort")
eltMes, = mibBuilder.importSymbols("ELTEX-MES", "eltMes")
ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex")
InetAddressType, = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddressType")
VlanIndex, dot1qVlanIndex, PortList = mibBuilder.importSymbols("Q-BRIDGE-MIB", "VlanIndex", "dot1qVlanIndex", "PortList")
rnd, = mibBuilder.importSymbols("RADLAN-MIB", "rnd")
vlanMulticastTvEntry, = mibBuilder.importSymbols("RADLAN-vlan-MIB", "vlanMulticastTvEntry")
SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Counter64, MibIdentifier, IpAddress, Counter32, Gauge32, iso, Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn, Unsigned32, TimeTicks, ObjectIdentity, ModuleIdentity, Bits, NotificationType = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "MibIdentifier", "IpAddress", "Counter32", "Gauge32", "iso", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Unsigned32", "TimeTicks", "ObjectIdentity", "ModuleIdentity", "Bits", "NotificationType")
TruthValue, RowStatus, MacAddress, DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "RowStatus", "MacAddress", "DisplayString", "TextualConvention")
eltMesVlan = ModuleIdentity((1, 3, 6, 1, 4, 1, 35265, 1, 23, 5))
eltMesVlan.setRevisions(('2013-11-18 00:00', '2013-11-18 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: eltMesVlan.setRevisionsDescriptions(('Editorial changes to support new MIB compilers.', 'Initial version of this MIB.',))
if mibBuilder.loadTexts: eltMesVlan.setLastUpdated('201311180000Z')
if mibBuilder.loadTexts: eltMesVlan.setOrganization('Eltex Ltd.')
if mibBuilder.loadTexts: eltMesVlan.setContactInfo('www.eltex.nsk.ru')
if mibBuilder.loadTexts: eltMesVlan.setDescription('The private MIB module definition for IP Multicast support in Eltex devices.')
class EltVlanMode(TextualConvention, Integer32):
reference = 'TR-101'
description = 'Indicates global VLAN QinQ operation mode. '
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2))
namedValues = NamedValues(("basic", 1), ("tr101", 2))
eltVlanMulticastTvTable = MibTable((1, 3, 6, 1, 4, 1, 35265, 1, 23, 5, 1), )
if mibBuilder.loadTexts: eltVlanMulticastTvTable.setStatus('current')
if mibBuilder.loadTexts: eltVlanMulticastTvTable.setDescription('Multicast vlan used for this port')
eltVlanMulticastTvEntry = MibTableRow((1, 3, 6, 1, 4, 1, 35265, 1, 23, 5, 1, 1), )
vlanMulticastTvEntry.registerAugmentions(("ELTEX-MES-VLAN-MIB", "eltVlanMulticastTvEntry"))
eltVlanMulticastTvEntry.setIndexNames(*vlanMulticastTvEntry.getIndexNames())
if mibBuilder.loadTexts: eltVlanMulticastTvEntry.setStatus('current')
if mibBuilder.loadTexts: eltVlanMulticastTvEntry.setDescription('Entry of multicast tag')
eltVlanMulticastTvVIDIsTagged = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 5, 1, 1, 1), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltVlanMulticastTvVIDIsTagged.setStatus('current')
if mibBuilder.loadTexts: eltVlanMulticastTvVIDIsTagged.setDescription('Specify whether the port is tagged in TV vlan or not.')
eltVlanMode = MibScalar((1, 3, 6, 1, 4, 1, 35265, 1, 23, 5, 2), EltVlanMode()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltVlanMode.setStatus('current')
if mibBuilder.loadTexts: eltVlanMode.setDescription('Global VLAN QinQ operation mode')
eltdot1qPortVlanCurrentTable = MibTable((1, 3, 6, 1, 4, 1, 35265, 1, 23, 5, 3), )
if mibBuilder.loadTexts: eltdot1qPortVlanCurrentTable.setStatus('current')
if mibBuilder.loadTexts: eltdot1qPortVlanCurrentTable.setDescription('A table containing current vlan port membership information.')
eltdot1qPortVlanCurrentEntry = MibTableRow((1, 3, 6, 1, 4, 1, 35265, 1, 23, 5, 3, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: eltdot1qPortVlanCurrentEntry.setStatus('current')
if mibBuilder.loadTexts: eltdot1qPortVlanCurrentEntry.setDescription('Current vlan membership information per port')
eltdot1qPortVlanCurrentEgressList1to1024 = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 5, 3, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: eltdot1qPortVlanCurrentEgressList1to1024.setStatus('current')
if mibBuilder.loadTexts: eltdot1qPortVlanCurrentEgressList1to1024.setDescription('The port egress vlan current list.')
eltdot1qPortVlanCurrentEgressList1025to2048 = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 5, 3, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: eltdot1qPortVlanCurrentEgressList1025to2048.setStatus('current')
if mibBuilder.loadTexts: eltdot1qPortVlanCurrentEgressList1025to2048.setDescription('The port egress vlan current list.')
eltdot1qPortVlanCurrentEgressList2049to3072 = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 5, 3, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: eltdot1qPortVlanCurrentEgressList2049to3072.setStatus('current')
if mibBuilder.loadTexts: eltdot1qPortVlanCurrentEgressList2049to3072.setDescription('The port egress vlan current list.')
eltdot1qPortVlanCurrentEgressList3073to4094 = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 5, 3, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: eltdot1qPortVlanCurrentEgressList3073to4094.setStatus('current')
if mibBuilder.loadTexts: eltdot1qPortVlanCurrentEgressList3073to4094.setDescription('The port egress vlan current list.')
mibBuilder.exportSymbols("ELTEX-MES-VLAN-MIB", eltVlanMulticastTvEntry=eltVlanMulticastTvEntry, EltVlanMode=EltVlanMode, eltdot1qPortVlanCurrentTable=eltdot1qPortVlanCurrentTable, PYSNMP_MODULE_ID=eltMesVlan, eltVlanMulticastTvTable=eltVlanMulticastTvTable, eltdot1qPortVlanCurrentEntry=eltdot1qPortVlanCurrentEntry, eltVlanMulticastTvVIDIsTagged=eltVlanMulticastTvVIDIsTagged, eltdot1qPortVlanCurrentEgressList1to1024=eltdot1qPortVlanCurrentEgressList1to1024, eltdot1qPortVlanCurrentEgressList2049to3072=eltdot1qPortVlanCurrentEgressList2049to3072, eltdot1qPortVlanCurrentEgressList3073to4094=eltdot1qPortVlanCurrentEgressList3073to4094, eltdot1qPortVlanCurrentEgressList1025to2048=eltdot1qPortVlanCurrentEgressList1025to2048, eltMesVlan=eltMesVlan, eltVlanMode=eltVlanMode)
| (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, single_value_constraint, value_range_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ConstraintsIntersection', 'SingleValueConstraint', 'ValueRangeConstraint', 'ConstraintsUnion')
(dot1d_base_port,) = mibBuilder.importSymbols('BRIDGE-MIB', 'dot1dBasePort')
(elt_mes,) = mibBuilder.importSymbols('ELTEX-MES', 'eltMes')
(if_index,) = mibBuilder.importSymbols('IF-MIB', 'ifIndex')
(inet_address_type,) = mibBuilder.importSymbols('INET-ADDRESS-MIB', 'InetAddressType')
(vlan_index, dot1q_vlan_index, port_list) = mibBuilder.importSymbols('Q-BRIDGE-MIB', 'VlanIndex', 'dot1qVlanIndex', 'PortList')
(rnd,) = mibBuilder.importSymbols('RADLAN-MIB', 'rnd')
(vlan_multicast_tv_entry,) = mibBuilder.importSymbols('RADLAN-vlan-MIB', 'vlanMulticastTvEntry')
(snmp_admin_string,) = mibBuilder.importSymbols('SNMP-FRAMEWORK-MIB', 'SnmpAdminString')
(notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance')
(counter64, mib_identifier, ip_address, counter32, gauge32, iso, integer32, mib_scalar, mib_table, mib_table_row, mib_table_column, unsigned32, time_ticks, object_identity, module_identity, bits, notification_type) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter64', 'MibIdentifier', 'IpAddress', 'Counter32', 'Gauge32', 'iso', 'Integer32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Unsigned32', 'TimeTicks', 'ObjectIdentity', 'ModuleIdentity', 'Bits', 'NotificationType')
(truth_value, row_status, mac_address, display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'TruthValue', 'RowStatus', 'MacAddress', 'DisplayString', 'TextualConvention')
elt_mes_vlan = module_identity((1, 3, 6, 1, 4, 1, 35265, 1, 23, 5))
eltMesVlan.setRevisions(('2013-11-18 00:00', '2013-11-18 00:00'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts:
eltMesVlan.setRevisionsDescriptions(('Editorial changes to support new MIB compilers.', 'Initial version of this MIB.'))
if mibBuilder.loadTexts:
eltMesVlan.setLastUpdated('201311180000Z')
if mibBuilder.loadTexts:
eltMesVlan.setOrganization('Eltex Ltd.')
if mibBuilder.loadTexts:
eltMesVlan.setContactInfo('www.eltex.nsk.ru')
if mibBuilder.loadTexts:
eltMesVlan.setDescription('The private MIB module definition for IP Multicast support in Eltex devices.')
class Eltvlanmode(TextualConvention, Integer32):
reference = 'TR-101'
description = 'Indicates global VLAN QinQ operation mode. '
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2))
named_values = named_values(('basic', 1), ('tr101', 2))
elt_vlan_multicast_tv_table = mib_table((1, 3, 6, 1, 4, 1, 35265, 1, 23, 5, 1))
if mibBuilder.loadTexts:
eltVlanMulticastTvTable.setStatus('current')
if mibBuilder.loadTexts:
eltVlanMulticastTvTable.setDescription('Multicast vlan used for this port')
elt_vlan_multicast_tv_entry = mib_table_row((1, 3, 6, 1, 4, 1, 35265, 1, 23, 5, 1, 1))
vlanMulticastTvEntry.registerAugmentions(('ELTEX-MES-VLAN-MIB', 'eltVlanMulticastTvEntry'))
eltVlanMulticastTvEntry.setIndexNames(*vlanMulticastTvEntry.getIndexNames())
if mibBuilder.loadTexts:
eltVlanMulticastTvEntry.setStatus('current')
if mibBuilder.loadTexts:
eltVlanMulticastTvEntry.setDescription('Entry of multicast tag')
elt_vlan_multicast_tv_vid_is_tagged = mib_table_column((1, 3, 6, 1, 4, 1, 35265, 1, 23, 5, 1, 1, 1), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
eltVlanMulticastTvVIDIsTagged.setStatus('current')
if mibBuilder.loadTexts:
eltVlanMulticastTvVIDIsTagged.setDescription('Specify whether the port is tagged in TV vlan or not.')
elt_vlan_mode = mib_scalar((1, 3, 6, 1, 4, 1, 35265, 1, 23, 5, 2), elt_vlan_mode()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
eltVlanMode.setStatus('current')
if mibBuilder.loadTexts:
eltVlanMode.setDescription('Global VLAN QinQ operation mode')
eltdot1q_port_vlan_current_table = mib_table((1, 3, 6, 1, 4, 1, 35265, 1, 23, 5, 3))
if mibBuilder.loadTexts:
eltdot1qPortVlanCurrentTable.setStatus('current')
if mibBuilder.loadTexts:
eltdot1qPortVlanCurrentTable.setDescription('A table containing current vlan port membership information.')
eltdot1q_port_vlan_current_entry = mib_table_row((1, 3, 6, 1, 4, 1, 35265, 1, 23, 5, 3, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'))
if mibBuilder.loadTexts:
eltdot1qPortVlanCurrentEntry.setStatus('current')
if mibBuilder.loadTexts:
eltdot1qPortVlanCurrentEntry.setDescription('Current vlan membership information per port')
eltdot1q_port_vlan_current_egress_list1to1024 = mib_table_column((1, 3, 6, 1, 4, 1, 35265, 1, 23, 5, 3, 1, 1), octet_string().subtype(subtypeSpec=value_size_constraint(0, 128))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
eltdot1qPortVlanCurrentEgressList1to1024.setStatus('current')
if mibBuilder.loadTexts:
eltdot1qPortVlanCurrentEgressList1to1024.setDescription('The port egress vlan current list.')
eltdot1q_port_vlan_current_egress_list1025to2048 = mib_table_column((1, 3, 6, 1, 4, 1, 35265, 1, 23, 5, 3, 1, 2), octet_string().subtype(subtypeSpec=value_size_constraint(0, 128))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
eltdot1qPortVlanCurrentEgressList1025to2048.setStatus('current')
if mibBuilder.loadTexts:
eltdot1qPortVlanCurrentEgressList1025to2048.setDescription('The port egress vlan current list.')
eltdot1q_port_vlan_current_egress_list2049to3072 = mib_table_column((1, 3, 6, 1, 4, 1, 35265, 1, 23, 5, 3, 1, 3), octet_string().subtype(subtypeSpec=value_size_constraint(0, 128))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
eltdot1qPortVlanCurrentEgressList2049to3072.setStatus('current')
if mibBuilder.loadTexts:
eltdot1qPortVlanCurrentEgressList2049to3072.setDescription('The port egress vlan current list.')
eltdot1q_port_vlan_current_egress_list3073to4094 = mib_table_column((1, 3, 6, 1, 4, 1, 35265, 1, 23, 5, 3, 1, 4), octet_string().subtype(subtypeSpec=value_size_constraint(0, 128))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
eltdot1qPortVlanCurrentEgressList3073to4094.setStatus('current')
if mibBuilder.loadTexts:
eltdot1qPortVlanCurrentEgressList3073to4094.setDescription('The port egress vlan current list.')
mibBuilder.exportSymbols('ELTEX-MES-VLAN-MIB', eltVlanMulticastTvEntry=eltVlanMulticastTvEntry, EltVlanMode=EltVlanMode, eltdot1qPortVlanCurrentTable=eltdot1qPortVlanCurrentTable, PYSNMP_MODULE_ID=eltMesVlan, eltVlanMulticastTvTable=eltVlanMulticastTvTable, eltdot1qPortVlanCurrentEntry=eltdot1qPortVlanCurrentEntry, eltVlanMulticastTvVIDIsTagged=eltVlanMulticastTvVIDIsTagged, eltdot1qPortVlanCurrentEgressList1to1024=eltdot1qPortVlanCurrentEgressList1to1024, eltdot1qPortVlanCurrentEgressList2049to3072=eltdot1qPortVlanCurrentEgressList2049to3072, eltdot1qPortVlanCurrentEgressList3073to4094=eltdot1qPortVlanCurrentEgressList3073to4094, eltdot1qPortVlanCurrentEgressList1025to2048=eltdot1qPortVlanCurrentEgressList1025to2048, eltMesVlan=eltMesVlan, eltVlanMode=eltVlanMode) |
L, R = int(input()), int(input())
max_xor = 0
for i in range(L, R+1):
for j in range(i+1, R+1):
if i^j > max_xor:
max_xor = i^j
print(max_xor)
| (l, r) = (int(input()), int(input()))
max_xor = 0
for i in range(L, R + 1):
for j in range(i + 1, R + 1):
if i ^ j > max_xor:
max_xor = i ^ j
print(max_xor) |
f = open("file_name.txt", "w") # open file for writing
f.write("Some text with out new line ")
f.write("Some text.\nSome text.\nSome text.")
f.close() # always close the file
# "D:\\myfiles\file_name.txt" - backslash symbol (\) is for path in windows
# "/myfiles/file_name.txt" - slash symbol (/) is for path in Mac or Linux
f = open("file_name.txt", "r") # open file for reading
# END OF FILE (EOF) - name of the symbol which defines that file is ended
# read() - reads everything from current cursor position till EOF and returns everything in one string
# print (f.read())
# readline() - reads line from current cursor position till end of line(\n) or EOF
# print (f.readline())
# readlines() - reads each line from current cursor position till EOF and stores them as array
# print (f.readlines())
print(f.read()) # example of reading the file
f.close() # always close the file
# options: w - open file for writing, r - open file for reading
f = open("file_name", "w")
f.write("line to file") # write to file
f.close()
f = open("file_name", "r")
f.read() # reads everything from current cursor position till EOF and returns everything in one string
f.close()
f = open("file_name", "r")
f.readline() # readline() - reads line from current cursor position till end of line(\n) or EOF
f.close()
f = open("file_name", "r")
f.readlines() # readlines() - reads all lines from current cursor position till end of line(\n) or EOF
f.close()
| f = open('file_name.txt', 'w')
f.write('Some text with out new line ')
f.write('Some text.\nSome text.\nSome text.')
f.close()
f = open('file_name.txt', 'r')
print(f.read())
f.close()
f = open('file_name', 'w')
f.write('line to file')
f.close()
f = open('file_name', 'r')
f.read()
f.close()
f = open('file_name', 'r')
f.readline()
f.close()
f = open('file_name', 'r')
f.readlines()
f.close() |
class ActivitiesHelper:
'''
Given a pressure data timeseries, calculate a step count
'''
def calculate_step_count(self, dataframe, low_threshold = 0, high_threshold = 4):
p_avg = dataframe.mean(axis=1)
p_diff = p_avg.diff()
status = 0
step_count = 0
for p_diff_t in p_diff:
if p_diff_t < low_threshold:
if status == 1:
step_count += 1
status = -1
elif p_diff_t > high_threshold:
status = 1
return step_count
'''
Given a pressure timeseries, calculate a cadence
'''
def calculate_cadence(self, dataframe):
duration = (dataframe.index.max() - dataframe.index.min()).seconds
return self.calculate_step_count(dataframe) / duration
| class Activitieshelper:
"""
Given a pressure data timeseries, calculate a step count
"""
def calculate_step_count(self, dataframe, low_threshold=0, high_threshold=4):
p_avg = dataframe.mean(axis=1)
p_diff = p_avg.diff()
status = 0
step_count = 0
for p_diff_t in p_diff:
if p_diff_t < low_threshold:
if status == 1:
step_count += 1
status = -1
elif p_diff_t > high_threshold:
status = 1
return step_count
'\n Given a pressure timeseries, calculate a cadence\n '
def calculate_cadence(self, dataframe):
duration = (dataframe.index.max() - dataframe.index.min()).seconds
return self.calculate_step_count(dataframe) / duration |
class SemiFinder:
def __init__(self):
self.f = ""
self.counter = 0
#Path is inputted from AIPController
#Returns semicolon counter
def sendFile(self, path):
self.f = open(path)
for line in self.f:
try:
self.counter += self.get_all_semis(line)
except:
continue
c = self.counter
self.counter = 0
return c
#Gets next occurence of a semicolon
#Retuns True/False value, position of semicolon
def get_next_target(self, page):
pos_semi = page.find(';')
if pos_semi == -1:
return False, 0
return True, pos_semi+1
#Returns the length of an array which contains all
#instances of semicolons
def get_all_semis(self, page):
semis = []
while True:
value, c = self.get_next_target(page)
if value:
semis.append(c)
page = page[c:]
else:
break
return len(semis)
| class Semifinder:
def __init__(self):
self.f = ''
self.counter = 0
def send_file(self, path):
self.f = open(path)
for line in self.f:
try:
self.counter += self.get_all_semis(line)
except:
continue
c = self.counter
self.counter = 0
return c
def get_next_target(self, page):
pos_semi = page.find(';')
if pos_semi == -1:
return (False, 0)
return (True, pos_semi + 1)
def get_all_semis(self, page):
semis = []
while True:
(value, c) = self.get_next_target(page)
if value:
semis.append(c)
page = page[c:]
else:
break
return len(semis) |
#operate string of imgdata ,get the new string after ','
def cutstr(sStr1,sStr2):
nPos = sStr1.index(sStr2)
return sStr1[(nPos+1):]
if __name__ == '__main__':
print (cutstr('qwe,qw123123e2134123',','))
| def cutstr(sStr1, sStr2):
n_pos = sStr1.index(sStr2)
return sStr1[nPos + 1:]
if __name__ == '__main__':
print(cutstr('qwe,qw123123e2134123', ',')) |
flame_graph_template = """
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/spiermar/d3-flame-graph@2.0.3/dist/d3-flamegraph.css">
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<style>
/* Space out content a bit */
body {
padding-top: 20px;
padding-bottom: 20px;
}
/* Custom page header */
.header {
padding-bottom: 20px;
padding-right: 15px;
padding-left: 15px;
border-bottom: 1px solid #e5e5e5;
}
/* Make the masthead heading the same height as the navigation */
.header h3 {
margin-top: 0;
margin-bottom: 0;
line-height: 40px;
}
/* Customize container */
.container {
max-width: 990px;
}
</style>
<title>d3-flame-graph</title>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="header clearfix">
<nav>
<div class="pull-right">
<form class="form-inline" id="form">
<select id="sample" class="form-control">
{% for sample in list_of_samples %}
<option>{{sample}}</option>
{% endfor %}
</select>
<a class="btn" href="javascript: resetZoom();">Reset zoom</a>
<a class="btn" href="javascript: clear();">Clear</a>
<div class="form-group">
<input type="text" class="form-control" id="term">
</div>
<a class="btn btn-primary" href="javascript: search();">Search</a>
</form>
</div>
</nav>
<h3 class="text-muted">Benchmarking</h3>
</div>
<div id="chart">
</div>
<hr>
<div id="details">
</div>
</div>
<!-- D3.js -->
<script src="https://d3js.org/d3.v4.min.js" charset="utf-8"></script>
<!-- d3-tip -->
<script type="text/javascript" src=https://cdnjs.cloudflare.com/ajax/libs/d3-tip/0.9.1/d3-tip.min.js></script>
<!-- d3-flamegraph -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/spiermar/d3-flame-graph@2.0.3/dist/d3-flamegraph.min.js"></script>
<script type="text/javascript">
var payload = {
{% for json in payload %}
'{{json["name"]}}': {{json}},
{% endfor %}
};
var flameGraph = null;
$(document).ready(function(){
$(document).ready(render_flame_graph);
$('#sample').on('change', render_flame_graph);
});
document.getElementById("form").addEventListener("submit", function(event){
event.preventDefault();
search();
});
function search() {
var term = document.getElementById("term").value;
flameGraph.search(term);
}
function clear() {
document.getElementById('term').value = '';
flameGraph.clear();
}
function resetZoom() {
flameGraph.resetZoom();
}
function onClick(d) {
console.info("Clicked on " + d.data.name);
}
function render_flame_graph(){
$("#chart").empty();
var selected_sample = $('select[id="sample"] option:selected').val()
flameGraph = d3.flamegraph()
.width(960)
.cellHeight(25)
.transitionDuration(750)
.minFrameSize(5)
.transitionEase(d3.easeCubic)
.sort(true)
.title("")
.onClick(onClick)
.differential(false)
.selfValue(false);
var details = document.getElementById("details");
flameGraph.setDetailsElement(details);
d3.select("#chart")
.datum(payload[selected_sample])
.call(flameGraph);
}
</script>
</body>
</html>
""" | flame_graph_template = '\n<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="utf-8">\n <meta http-equiv="X-UA-Compatible" content="IE=edge">\n <meta name="viewport" content="width=device-width, initial-scale=1">\n\n <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">\n <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/spiermar/d3-flame-graph@2.0.3/dist/d3-flamegraph.css">\n <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>\n\n <style>\n\n /* Space out content a bit */\n body {\n padding-top: 20px;\n padding-bottom: 20px;\n }\n\n /* Custom page header */\n .header {\n padding-bottom: 20px;\n padding-right: 15px;\n padding-left: 15px;\n border-bottom: 1px solid #e5e5e5;\n }\n\n /* Make the masthead heading the same height as the navigation */\n .header h3 {\n margin-top: 0;\n margin-bottom: 0;\n line-height: 40px;\n }\n\n /* Customize container */\n .container {\n max-width: 990px;\n }\n </style>\n\n <title>d3-flame-graph</title>\n\n <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->\n <!--[if lt IE 9]>\n <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>\n <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>\n <![endif]-->\n </head>\n <body>\n <div class="container">\n <div class="header clearfix">\n <nav>\n <div class="pull-right">\n <form class="form-inline" id="form">\n <select id="sample" class="form-control">\n {% for sample in list_of_samples %}\n <option>{{sample}}</option>\n {% endfor %}\n </select>\n <a class="btn" href="javascript: resetZoom();">Reset zoom</a>\n <a class="btn" href="javascript: clear();">Clear</a>\n <div class="form-group">\n <input type="text" class="form-control" id="term">\n </div>\n <a class="btn btn-primary" href="javascript: search();">Search</a>\n </form>\n </div>\n </nav>\n <h3 class="text-muted">Benchmarking</h3>\n </div>\n <div id="chart">\n </div>\n <hr>\n <div id="details">\n </div>\n </div>\n\n <!-- D3.js -->\n <script src="https://d3js.org/d3.v4.min.js" charset="utf-8"></script>\n\n <!-- d3-tip -->\n <script type="text/javascript" src=https://cdnjs.cloudflare.com/ajax/libs/d3-tip/0.9.1/d3-tip.min.js></script>\n\n <!-- d3-flamegraph -->\n <script type="text/javascript" src="https://cdn.jsdelivr.net/gh/spiermar/d3-flame-graph@2.0.3/dist/d3-flamegraph.min.js"></script>\n\n <script type="text/javascript">\n\n var payload = {\n {% for json in payload %}\n \'{{json["name"]}}\': {{json}},\n {% endfor %}\n };\n\n var flameGraph = null;\n\n $(document).ready(function(){\n $(document).ready(render_flame_graph);\n $(\'#sample\').on(\'change\', render_flame_graph);\n });\n\n document.getElementById("form").addEventListener("submit", function(event){\n event.preventDefault();\n search();\n });\n\n function search() {\n var term = document.getElementById("term").value;\n flameGraph.search(term);\n }\n\n function clear() {\n document.getElementById(\'term\').value = \'\';\n flameGraph.clear();\n }\n\n function resetZoom() {\n flameGraph.resetZoom();\n }\n\n function onClick(d) {\n console.info("Clicked on " + d.data.name);\n }\n\n function render_flame_graph(){\n\n $("#chart").empty();\n var selected_sample = $(\'select[id="sample"] option:selected\').val()\n\n flameGraph = d3.flamegraph()\n .width(960)\n .cellHeight(25)\n .transitionDuration(750)\n .minFrameSize(5)\n .transitionEase(d3.easeCubic)\n .sort(true)\n .title("")\n .onClick(onClick)\n .differential(false)\n .selfValue(false);\n\n var details = document.getElementById("details");\n flameGraph.setDetailsElement(details);\n\n d3.select("#chart")\n .datum(payload[selected_sample])\n .call(flameGraph);\n }\n </script>\n </body>\n</html>\n' |
"""
Chapter 01 - Problem 01 - Is Unique - CTCI 6th Edition page 90
Problem Statement:
Implement an algorithm to determine if a string has all unique characters.
What if you cannot use additional data structures?
Example:
"aalex" -> False
Solution:
Assume that the input string will contain only ASCII characters. Traverse the
string one character at a time and use a hash table to record which characters
have been observed. If a character is observed more than once, return False.
If no character is observed more than once, return True. Because we assumed that
the string would contain only ASCII characters, we can implement the hash table as
a 128-wide bit vector that uses a character's ASCII value as its hash code.
Time complexity: O(N) where N is the length of the of the linearly traversed string.
Space complexity: O(1) because bit vector size does not scale with input string length.
Follow-up discussion (unimplemented):
If we cannot use additional structures, we can do O(N^2) character comparisons
to check for uniqueness. If we are allowed to modify the original string, we
could sort it in place in N*log(N) time and test consecutive characters for equality.
"""
def is_unique(input_string):
hash_table = [False]*128 # hash table implemented as 128 bit vector
for character in input_string: # inspect each character
index = ord(character) # convert character into its ASCII value
if hash_table[index]: # check if bit at this ASCII value is True
return False
hash_table[index] = True # add unobserved character to hash table
return True
| """
Chapter 01 - Problem 01 - Is Unique - CTCI 6th Edition page 90
Problem Statement:
Implement an algorithm to determine if a string has all unique characters.
What if you cannot use additional data structures?
Example:
"aalex" -> False
Solution:
Assume that the input string will contain only ASCII characters. Traverse the
string one character at a time and use a hash table to record which characters
have been observed. If a character is observed more than once, return False.
If no character is observed more than once, return True. Because we assumed that
the string would contain only ASCII characters, we can implement the hash table as
a 128-wide bit vector that uses a character's ASCII value as its hash code.
Time complexity: O(N) where N is the length of the of the linearly traversed string.
Space complexity: O(1) because bit vector size does not scale with input string length.
Follow-up discussion (unimplemented):
If we cannot use additional structures, we can do O(N^2) character comparisons
to check for uniqueness. If we are allowed to modify the original string, we
could sort it in place in N*log(N) time and test consecutive characters for equality.
"""
def is_unique(input_string):
hash_table = [False] * 128
for character in input_string:
index = ord(character)
if hash_table[index]:
return False
hash_table[index] = True
return True |
class Node:
def __init__(self,data,freq):
self.left=None
self.right=None
self.data=data
self.freq=freq
root=Node("x",5)
root.left=Node("x",2)
root.right=Node("A",3)
root.left.left=Node("B",1)
root.left.right=Node("C",1)
s="1001011" #encoded data
ans=""
root2=root
for i in range(len(s)):
if(s[i]=="1"):
root=root.right
elif(s[i]=="0"):
root=root.left
if(root.left==None and root.right==None):
ans+=root.data
root=root2
print(ans) #decoded data
| class Node:
def __init__(self, data, freq):
self.left = None
self.right = None
self.data = data
self.freq = freq
root = node('x', 5)
root.left = node('x', 2)
root.right = node('A', 3)
root.left.left = node('B', 1)
root.left.right = node('C', 1)
s = '1001011'
ans = ''
root2 = root
for i in range(len(s)):
if s[i] == '1':
root = root.right
elif s[i] == '0':
root = root.left
if root.left == None and root.right == None:
ans += root.data
root = root2
print(ans) |
class NehushtanMPTerminatedSituation(Exception):
"""
Since 0.2.13
"""
pass
| class Nehushtanmpterminatedsituation(Exception):
"""
Since 0.2.13
"""
pass |
# Q6. Write a programs to print the following pattern :
''' a)A
A B
A B C
A B C D
A B C D E
b)1
1 2
1 2 3
1 2 3 4
c) 4 3 2 1
3 2 1
2 1
1 '''
| """ a)A
A B
A B C
A B C D
A B C D E
b)1
1 2
1 2 3
1 2 3 4
c) 4 3 2 1
3 2 1
2 1
1 """ |
"""
Project constants module.
All the constants are included in this script.
"""
# ======================================= Comma.ai dataset test data size and random state constants
TEST_SIZE = .2
RANDOM_STATE = 42
# ======================================= Comma.ai dataset training data and label directories
TRAIN_DATA_DIR = "./dataset/64_batched_sunny/frames/*.npy"
TRAIN_LABELS_FL_DIR = "./dataset/64_batched_sunny/angles/*.npy"
# ======================================= Cloudy weather evaluation data and label directories
C_TEST_DATA_DIR = "./dataset/64_batched_cloudy/frames/*.npy"
C_TEST_LABELS_FL_DIR = "./dataset/64_batched_cloudy/angles/*.npy"
# ======================================= Night time evaluation data and label directories
N_TEST_DATA_DIR = "./dataset/64_batched_night/frames/*.npy"
N_TEST_LABELS_FL_DIR = "./dataset/64_batched_night/angles/*.npy"
# ======================================= Comma.ai dataset model training hyperparameters
B_SIZE = 64
NB_EPOCHS = 10
LR = 5e-06 # Since trains the model to the best val_loss in 10 epochs (model starts overfitting)
VERBOSITY = 1
INPUT_SHAPE = (80, 120, 3) # Image input shape
RESIZE_DIMS = [80, 120]
CROP_SIZE = [40, -40] | """
Project constants module.
All the constants are included in this script.
"""
test_size = 0.2
random_state = 42
train_data_dir = './dataset/64_batched_sunny/frames/*.npy'
train_labels_fl_dir = './dataset/64_batched_sunny/angles/*.npy'
c_test_data_dir = './dataset/64_batched_cloudy/frames/*.npy'
c_test_labels_fl_dir = './dataset/64_batched_cloudy/angles/*.npy'
n_test_data_dir = './dataset/64_batched_night/frames/*.npy'
n_test_labels_fl_dir = './dataset/64_batched_night/angles/*.npy'
b_size = 64
nb_epochs = 10
lr = 5e-06
verbosity = 1
input_shape = (80, 120, 3)
resize_dims = [80, 120]
crop_size = [40, -40] |
data = (
'Shou ', # 0x00
'Yi ', # 0x01
'Zhi ', # 0x02
'Gu ', # 0x03
'Chu ', # 0x04
'Jiang ', # 0x05
'Feng ', # 0x06
'Bei ', # 0x07
'Cay ', # 0x08
'Bian ', # 0x09
'Sui ', # 0x0a
'Qun ', # 0x0b
'Ling ', # 0x0c
'Fu ', # 0x0d
'Zuo ', # 0x0e
'Xia ', # 0x0f
'Xiong ', # 0x10
'[?] ', # 0x11
'Nao ', # 0x12
'Xia ', # 0x13
'Kui ', # 0x14
'Xi ', # 0x15
'Wai ', # 0x16
'Yuan ', # 0x17
'Mao ', # 0x18
'Su ', # 0x19
'Duo ', # 0x1a
'Duo ', # 0x1b
'Ye ', # 0x1c
'Qing ', # 0x1d
'Uys ', # 0x1e
'Gou ', # 0x1f
'Gou ', # 0x20
'Qi ', # 0x21
'Meng ', # 0x22
'Meng ', # 0x23
'Yin ', # 0x24
'Huo ', # 0x25
'Chen ', # 0x26
'Da ', # 0x27
'Ze ', # 0x28
'Tian ', # 0x29
'Tai ', # 0x2a
'Fu ', # 0x2b
'Guai ', # 0x2c
'Yao ', # 0x2d
'Yang ', # 0x2e
'Hang ', # 0x2f
'Gao ', # 0x30
'Shi ', # 0x31
'Ben ', # 0x32
'Tai ', # 0x33
'Tou ', # 0x34
'Yan ', # 0x35
'Bi ', # 0x36
'Yi ', # 0x37
'Kua ', # 0x38
'Jia ', # 0x39
'Duo ', # 0x3a
'Kwu ', # 0x3b
'Kuang ', # 0x3c
'Yun ', # 0x3d
'Jia ', # 0x3e
'Pa ', # 0x3f
'En ', # 0x40
'Lian ', # 0x41
'Huan ', # 0x42
'Di ', # 0x43
'Yan ', # 0x44
'Pao ', # 0x45
'Quan ', # 0x46
'Qi ', # 0x47
'Nai ', # 0x48
'Feng ', # 0x49
'Xie ', # 0x4a
'Fen ', # 0x4b
'Dian ', # 0x4c
'[?] ', # 0x4d
'Kui ', # 0x4e
'Zou ', # 0x4f
'Huan ', # 0x50
'Qi ', # 0x51
'Kai ', # 0x52
'Zha ', # 0x53
'Ben ', # 0x54
'Yi ', # 0x55
'Jiang ', # 0x56
'Tao ', # 0x57
'Zang ', # 0x58
'Ben ', # 0x59
'Xi ', # 0x5a
'Xiang ', # 0x5b
'Fei ', # 0x5c
'Diao ', # 0x5d
'Xun ', # 0x5e
'Keng ', # 0x5f
'Dian ', # 0x60
'Ao ', # 0x61
'She ', # 0x62
'Weng ', # 0x63
'Pan ', # 0x64
'Ao ', # 0x65
'Wu ', # 0x66
'Ao ', # 0x67
'Jiang ', # 0x68
'Lian ', # 0x69
'Duo ', # 0x6a
'Yun ', # 0x6b
'Jiang ', # 0x6c
'Shi ', # 0x6d
'Fen ', # 0x6e
'Huo ', # 0x6f
'Bi ', # 0x70
'Lian ', # 0x71
'Duo ', # 0x72
'Nu ', # 0x73
'Nu ', # 0x74
'Ding ', # 0x75
'Nai ', # 0x76
'Qian ', # 0x77
'Jian ', # 0x78
'Ta ', # 0x79
'Jiu ', # 0x7a
'Nan ', # 0x7b
'Cha ', # 0x7c
'Hao ', # 0x7d
'Xian ', # 0x7e
'Fan ', # 0x7f
'Ji ', # 0x80
'Shuo ', # 0x81
'Ru ', # 0x82
'Fei ', # 0x83
'Wang ', # 0x84
'Hong ', # 0x85
'Zhuang ', # 0x86
'Fu ', # 0x87
'Ma ', # 0x88
'Dan ', # 0x89
'Ren ', # 0x8a
'Fu ', # 0x8b
'Jing ', # 0x8c
'Yan ', # 0x8d
'Xie ', # 0x8e
'Wen ', # 0x8f
'Zhong ', # 0x90
'Pa ', # 0x91
'Du ', # 0x92
'Ji ', # 0x93
'Keng ', # 0x94
'Zhong ', # 0x95
'Yao ', # 0x96
'Jin ', # 0x97
'Yun ', # 0x98
'Miao ', # 0x99
'Pei ', # 0x9a
'Shi ', # 0x9b
'Yue ', # 0x9c
'Zhuang ', # 0x9d
'Niu ', # 0x9e
'Yan ', # 0x9f
'Na ', # 0xa0
'Xin ', # 0xa1
'Fen ', # 0xa2
'Bi ', # 0xa3
'Yu ', # 0xa4
'Tuo ', # 0xa5
'Feng ', # 0xa6
'Yuan ', # 0xa7
'Fang ', # 0xa8
'Wu ', # 0xa9
'Yu ', # 0xaa
'Gui ', # 0xab
'Du ', # 0xac
'Ba ', # 0xad
'Ni ', # 0xae
'Zhou ', # 0xaf
'Zhuo ', # 0xb0
'Zhao ', # 0xb1
'Da ', # 0xb2
'Nai ', # 0xb3
'Yuan ', # 0xb4
'Tou ', # 0xb5
'Xuan ', # 0xb6
'Zhi ', # 0xb7
'E ', # 0xb8
'Mei ', # 0xb9
'Mo ', # 0xba
'Qi ', # 0xbb
'Bi ', # 0xbc
'Shen ', # 0xbd
'Qie ', # 0xbe
'E ', # 0xbf
'He ', # 0xc0
'Xu ', # 0xc1
'Fa ', # 0xc2
'Zheng ', # 0xc3
'Min ', # 0xc4
'Ban ', # 0xc5
'Mu ', # 0xc6
'Fu ', # 0xc7
'Ling ', # 0xc8
'Zi ', # 0xc9
'Zi ', # 0xca
'Shi ', # 0xcb
'Ran ', # 0xcc
'Shan ', # 0xcd
'Yang ', # 0xce
'Man ', # 0xcf
'Jie ', # 0xd0
'Gu ', # 0xd1
'Si ', # 0xd2
'Xing ', # 0xd3
'Wei ', # 0xd4
'Zi ', # 0xd5
'Ju ', # 0xd6
'Shan ', # 0xd7
'Pin ', # 0xd8
'Ren ', # 0xd9
'Yao ', # 0xda
'Tong ', # 0xdb
'Jiang ', # 0xdc
'Shu ', # 0xdd
'Ji ', # 0xde
'Gai ', # 0xdf
'Shang ', # 0xe0
'Kuo ', # 0xe1
'Juan ', # 0xe2
'Jiao ', # 0xe3
'Gou ', # 0xe4
'Mu ', # 0xe5
'Jian ', # 0xe6
'Jian ', # 0xe7
'Yi ', # 0xe8
'Nian ', # 0xe9
'Zhi ', # 0xea
'Ji ', # 0xeb
'Ji ', # 0xec
'Xian ', # 0xed
'Heng ', # 0xee
'Guang ', # 0xef
'Jun ', # 0xf0
'Kua ', # 0xf1
'Yan ', # 0xf2
'Ming ', # 0xf3
'Lie ', # 0xf4
'Pei ', # 0xf5
'Yan ', # 0xf6
'You ', # 0xf7
'Yan ', # 0xf8
'Cha ', # 0xf9
'Shen ', # 0xfa
'Yin ', # 0xfb
'Chi ', # 0xfc
'Gui ', # 0xfd
'Quan ', # 0xfe
'Zi ', # 0xff
)
| data = ('Shou ', 'Yi ', 'Zhi ', 'Gu ', 'Chu ', 'Jiang ', 'Feng ', 'Bei ', 'Cay ', 'Bian ', 'Sui ', 'Qun ', 'Ling ', 'Fu ', 'Zuo ', 'Xia ', 'Xiong ', '[?] ', 'Nao ', 'Xia ', 'Kui ', 'Xi ', 'Wai ', 'Yuan ', 'Mao ', 'Su ', 'Duo ', 'Duo ', 'Ye ', 'Qing ', 'Uys ', 'Gou ', 'Gou ', 'Qi ', 'Meng ', 'Meng ', 'Yin ', 'Huo ', 'Chen ', 'Da ', 'Ze ', 'Tian ', 'Tai ', 'Fu ', 'Guai ', 'Yao ', 'Yang ', 'Hang ', 'Gao ', 'Shi ', 'Ben ', 'Tai ', 'Tou ', 'Yan ', 'Bi ', 'Yi ', 'Kua ', 'Jia ', 'Duo ', 'Kwu ', 'Kuang ', 'Yun ', 'Jia ', 'Pa ', 'En ', 'Lian ', 'Huan ', 'Di ', 'Yan ', 'Pao ', 'Quan ', 'Qi ', 'Nai ', 'Feng ', 'Xie ', 'Fen ', 'Dian ', '[?] ', 'Kui ', 'Zou ', 'Huan ', 'Qi ', 'Kai ', 'Zha ', 'Ben ', 'Yi ', 'Jiang ', 'Tao ', 'Zang ', 'Ben ', 'Xi ', 'Xiang ', 'Fei ', 'Diao ', 'Xun ', 'Keng ', 'Dian ', 'Ao ', 'She ', 'Weng ', 'Pan ', 'Ao ', 'Wu ', 'Ao ', 'Jiang ', 'Lian ', 'Duo ', 'Yun ', 'Jiang ', 'Shi ', 'Fen ', 'Huo ', 'Bi ', 'Lian ', 'Duo ', 'Nu ', 'Nu ', 'Ding ', 'Nai ', 'Qian ', 'Jian ', 'Ta ', 'Jiu ', 'Nan ', 'Cha ', 'Hao ', 'Xian ', 'Fan ', 'Ji ', 'Shuo ', 'Ru ', 'Fei ', 'Wang ', 'Hong ', 'Zhuang ', 'Fu ', 'Ma ', 'Dan ', 'Ren ', 'Fu ', 'Jing ', 'Yan ', 'Xie ', 'Wen ', 'Zhong ', 'Pa ', 'Du ', 'Ji ', 'Keng ', 'Zhong ', 'Yao ', 'Jin ', 'Yun ', 'Miao ', 'Pei ', 'Shi ', 'Yue ', 'Zhuang ', 'Niu ', 'Yan ', 'Na ', 'Xin ', 'Fen ', 'Bi ', 'Yu ', 'Tuo ', 'Feng ', 'Yuan ', 'Fang ', 'Wu ', 'Yu ', 'Gui ', 'Du ', 'Ba ', 'Ni ', 'Zhou ', 'Zhuo ', 'Zhao ', 'Da ', 'Nai ', 'Yuan ', 'Tou ', 'Xuan ', 'Zhi ', 'E ', 'Mei ', 'Mo ', 'Qi ', 'Bi ', 'Shen ', 'Qie ', 'E ', 'He ', 'Xu ', 'Fa ', 'Zheng ', 'Min ', 'Ban ', 'Mu ', 'Fu ', 'Ling ', 'Zi ', 'Zi ', 'Shi ', 'Ran ', 'Shan ', 'Yang ', 'Man ', 'Jie ', 'Gu ', 'Si ', 'Xing ', 'Wei ', 'Zi ', 'Ju ', 'Shan ', 'Pin ', 'Ren ', 'Yao ', 'Tong ', 'Jiang ', 'Shu ', 'Ji ', 'Gai ', 'Shang ', 'Kuo ', 'Juan ', 'Jiao ', 'Gou ', 'Mu ', 'Jian ', 'Jian ', 'Yi ', 'Nian ', 'Zhi ', 'Ji ', 'Ji ', 'Xian ', 'Heng ', 'Guang ', 'Jun ', 'Kua ', 'Yan ', 'Ming ', 'Lie ', 'Pei ', 'Yan ', 'You ', 'Yan ', 'Cha ', 'Shen ', 'Yin ', 'Chi ', 'Gui ', 'Quan ', 'Zi ') |
# -*- coding: utf-8 -*-
# Exercise 2.24
# Author: Little Horned Owl
x = 1 # valid, integer
x = 1. # valid, float
x = 1; # valid, integer (with a end-of-statement semicolon)
# x = 1! # invalid
# x = 1? # invalid
# x = 1: # invalid
x = 1, # valid, tuple (but with only one element)
"""
Trial run
python3 punctuation.py
"""
| x = 1
x = 1.0
x = 1
x = (1,)
'\nTrial run\npython3 punctuation.py\n\n' |
def Even_Length(Test_string):
return "\n".join([words for words in Test_string.split() if len(words) % 2 == 0])
Test_string = input("Enter a String: ")
print(f"Output: {Even_Length(Test_string)}") | def even__length(Test_string):
return '\n'.join([words for words in Test_string.split() if len(words) % 2 == 0])
test_string = input('Enter a String: ')
print(f'Output: {even__length(Test_string)}') |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Part of the Reusables package.
#
# Copyright (c) 2014-2020 - Chris Griffith - MIT License
_roman_dict = {
"I": 1,
"IV": 4,
"V": 5,
"IX": 9,
"X": 10,
"XL": 40,
"L": 50,
"XC": 90,
"C": 100,
"CD": 400,
"D": 500,
"CM": 900,
"M": 1000,
}
_numbers = {
0: "zero",
1: "one",
2: "two",
3: "three",
4: "four",
5: "five",
6: "six",
7: "seven",
8: "eight",
9: "nine",
10: "ten",
11: "eleven",
12: "twelve",
13: "thirteen",
14: "fourteen",
15: "fifteen",
16: "sixteen",
17: "seventeen",
18: "eighteen",
19: "nineteen",
20: "twenty",
30: "thirty",
40: "forty",
50: "fifty",
60: "sixty",
70: "seventy",
80: "eighty",
90: "ninety",
}
_places = {
1: "",
2: "thousand",
3: "million",
4: "billion",
5: "trillion",
6: "quadrillion",
7: "quintillion",
8: "sextillion",
9: "septillion",
10: "octillion",
11: "nonillion",
12: "decillion",
}
def cut(string, characters=2, trailing="normal"):
"""
Split a string into a list of N characters each.
.. code:: python
reusables.cut("abcdefghi")
# ['ab', 'cd', 'ef', 'gh', 'i']
trailing gives you the following options:
* normal: leaves remaining characters in their own last position
* remove: return the list without the remainder characters
* combine: add the remainder characters to the previous set
* error: raise an IndexError if there are remaining characters
.. code:: python
reusables.cut("abcdefghi", 2, "error")
# Traceback (most recent call last):
# ...
# IndexError: String of length 9 not divisible by 2 to splice
reusables.cut("abcdefghi", 2, "remove")
# ['ab', 'cd', 'ef', 'gh']
reusables.cut("abcdefghi", 2, "combine")
# ['ab', 'cd', 'ef', 'ghi']
:param string: string to modify
:param characters: how many characters to split it into
:param trailing: "normal", "remove", "combine", or "error"
:return: list of the cut string
"""
split_str = [string[i : i + characters] for i in range(0, len(string), characters)]
if trailing != "normal" and len(split_str[-1]) != characters:
if trailing.lower() == "remove":
return split_str[:-1]
if trailing.lower() == "combine" and len(split_str) >= 2:
return split_str[:-2] + [split_str[-2] + split_str[-1]]
if trailing.lower() == "error":
raise IndexError("String of length {0} not divisible by {1} to" " cut".format(len(string), characters))
return split_str
def int_to_roman(integer):
"""
Convert an integer into a string of roman numbers.
.. code: python
reusables.int_to_roman(445)
# 'CDXLV'
:param integer:
:return: roman string
"""
if not isinstance(integer, int):
raise ValueError("Input integer must be of type int")
output = []
while integer > 0:
for r, i in sorted(_roman_dict.items(), key=lambda x: x[1], reverse=True):
while integer >= i:
output.append(r)
integer -= i
return "".join(output)
def roman_to_int(roman_string):
"""
Converts a string of roman numbers into an integer.
.. code: python
reusables.roman_to_int("XXXVI")
# 36
:param roman_string: XVI or similar
:return: parsed integer
"""
roman_string = roman_string.upper().strip()
if "IIII" in roman_string:
raise ValueError("Malformed roman string")
value = 0
skip_one = False
last_number = None
for i, letter in enumerate(roman_string):
if letter not in _roman_dict:
raise ValueError("Malformed roman string")
if skip_one:
skip_one = False
continue
if i < (len(roman_string) - 1):
double_check = letter + roman_string[i + 1]
if double_check in _roman_dict:
if last_number and _roman_dict[double_check] > last_number:
raise ValueError("Malformed roman string")
last_number = _roman_dict[double_check]
value += _roman_dict[double_check]
skip_one = True
continue
if last_number and _roman_dict[letter] > last_number:
raise ValueError("Malformed roman string")
last_number = _roman_dict[letter]
value += _roman_dict[letter]
return value
def int_to_words(number, european=False):
"""
Converts an integer or float to words.
.. code: python
reusables.int_to_number(445)
# 'four hundred forty-five'
reusables.int_to_number(1.45)
# 'one and forty-five hundredths'
:param number: String, integer, or float to convert to words. The decimal
can only be up to three places long, and max number allowed is 999
decillion.
:param european: If the string uses the european style formatting, i.e.
decimal points instead of commas and commas instead of decimal points,
set this parameter to True
:return: The translated string
"""
def ones(n):
return "" if n == 0 else _numbers[n]
def tens(n):
teen = int("{0}{1}".format(n[0], n[1]))
if n[0] == 0:
return ones(n[1])
if teen in _numbers:
return _numbers[teen]
else:
ten = _numbers[int("{0}0".format(n[0]))]
one = _numbers[n[1]]
return "{0}-{1}".format(ten, one)
def hundreds(n):
if n[0] == 0:
return tens(n[1:])
else:
t = tens(n[1:])
return "{0} hundred {1}".format(_numbers[n[0]], "" if not t else t)
def comma_separated(list_of_strings):
if len(list_of_strings) > 1:
return "{0} ".format("" if len(list_of_strings) == 2 else ",").join(list_of_strings)
else:
return list_of_strings[0]
def while_loop(list_of_numbers, final_list):
index = 0
group_set = int(len(list_of_numbers) / 3)
while group_set != 0:
value = hundreds(list_of_numbers[index : index + 3])
if value:
final_list.append("{0} {1}".format(value, _places[group_set]) if _places[group_set] else value)
group_set -= 1
index += 3
number_list = []
decimal_list = []
decimal = ""
number = str(number)
group_delimiter, point_delimiter = (",", ".") if not european else (".", ",")
if point_delimiter in number:
decimal = number.split(point_delimiter)[1]
number = number.split(point_delimiter)[0].replace(group_delimiter, "")
elif group_delimiter in number:
number = number.replace(group_delimiter, "")
if not number.isdigit():
raise ValueError("Number is not numeric")
if decimal and not decimal.isdigit():
raise ValueError("Decimal is not numeric")
if int(number) == 0:
number_list.append("zero")
r = len(number) % 3
d_r = len(decimal) % 3
number = number.zfill(len(number) + 3 - r if r else 0)
f_decimal = decimal.zfill(len(decimal) + 3 - d_r if d_r else 0)
d = [int(x) for x in f_decimal]
n = [int(x) for x in number]
while_loop(n, number_list)
if decimal and int(decimal) != 0:
while_loop(d, decimal_list)
if decimal_list:
name = ""
if len(decimal) % 3 == 1:
name = "ten"
elif len(decimal) % 3 == 2:
name = "hundred"
place = int((str(len(decimal) / 3).split(".")[0]))
number_list.append(
"and {0} {1}{2}{3}ths".format(
comma_separated(decimal_list), name, "-" if name and _places[place + 1] else "", _places[place + 1]
)
)
return comma_separated(number_list)
| _roman_dict = {'I': 1, 'IV': 4, 'V': 5, 'IX': 9, 'X': 10, 'XL': 40, 'L': 50, 'XC': 90, 'C': 100, 'CD': 400, 'D': 500, 'CM': 900, 'M': 1000}
_numbers = {0: 'zero', 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine', 10: 'ten', 11: 'eleven', 12: 'twelve', 13: 'thirteen', 14: 'fourteen', 15: 'fifteen', 16: 'sixteen', 17: 'seventeen', 18: 'eighteen', 19: 'nineteen', 20: 'twenty', 30: 'thirty', 40: 'forty', 50: 'fifty', 60: 'sixty', 70: 'seventy', 80: 'eighty', 90: 'ninety'}
_places = {1: '', 2: 'thousand', 3: 'million', 4: 'billion', 5: 'trillion', 6: 'quadrillion', 7: 'quintillion', 8: 'sextillion', 9: 'septillion', 10: 'octillion', 11: 'nonillion', 12: 'decillion'}
def cut(string, characters=2, trailing='normal'):
"""
Split a string into a list of N characters each.
.. code:: python
reusables.cut("abcdefghi")
# ['ab', 'cd', 'ef', 'gh', 'i']
trailing gives you the following options:
* normal: leaves remaining characters in their own last position
* remove: return the list without the remainder characters
* combine: add the remainder characters to the previous set
* error: raise an IndexError if there are remaining characters
.. code:: python
reusables.cut("abcdefghi", 2, "error")
# Traceback (most recent call last):
# ...
# IndexError: String of length 9 not divisible by 2 to splice
reusables.cut("abcdefghi", 2, "remove")
# ['ab', 'cd', 'ef', 'gh']
reusables.cut("abcdefghi", 2, "combine")
# ['ab', 'cd', 'ef', 'ghi']
:param string: string to modify
:param characters: how many characters to split it into
:param trailing: "normal", "remove", "combine", or "error"
:return: list of the cut string
"""
split_str = [string[i:i + characters] for i in range(0, len(string), characters)]
if trailing != 'normal' and len(split_str[-1]) != characters:
if trailing.lower() == 'remove':
return split_str[:-1]
if trailing.lower() == 'combine' and len(split_str) >= 2:
return split_str[:-2] + [split_str[-2] + split_str[-1]]
if trailing.lower() == 'error':
raise index_error('String of length {0} not divisible by {1} to cut'.format(len(string), characters))
return split_str
def int_to_roman(integer):
"""
Convert an integer into a string of roman numbers.
.. code: python
reusables.int_to_roman(445)
# 'CDXLV'
:param integer:
:return: roman string
"""
if not isinstance(integer, int):
raise value_error('Input integer must be of type int')
output = []
while integer > 0:
for (r, i) in sorted(_roman_dict.items(), key=lambda x: x[1], reverse=True):
while integer >= i:
output.append(r)
integer -= i
return ''.join(output)
def roman_to_int(roman_string):
"""
Converts a string of roman numbers into an integer.
.. code: python
reusables.roman_to_int("XXXVI")
# 36
:param roman_string: XVI or similar
:return: parsed integer
"""
roman_string = roman_string.upper().strip()
if 'IIII' in roman_string:
raise value_error('Malformed roman string')
value = 0
skip_one = False
last_number = None
for (i, letter) in enumerate(roman_string):
if letter not in _roman_dict:
raise value_error('Malformed roman string')
if skip_one:
skip_one = False
continue
if i < len(roman_string) - 1:
double_check = letter + roman_string[i + 1]
if double_check in _roman_dict:
if last_number and _roman_dict[double_check] > last_number:
raise value_error('Malformed roman string')
last_number = _roman_dict[double_check]
value += _roman_dict[double_check]
skip_one = True
continue
if last_number and _roman_dict[letter] > last_number:
raise value_error('Malformed roman string')
last_number = _roman_dict[letter]
value += _roman_dict[letter]
return value
def int_to_words(number, european=False):
"""
Converts an integer or float to words.
.. code: python
reusables.int_to_number(445)
# 'four hundred forty-five'
reusables.int_to_number(1.45)
# 'one and forty-five hundredths'
:param number: String, integer, or float to convert to words. The decimal
can only be up to three places long, and max number allowed is 999
decillion.
:param european: If the string uses the european style formatting, i.e.
decimal points instead of commas and commas instead of decimal points,
set this parameter to True
:return: The translated string
"""
def ones(n):
return '' if n == 0 else _numbers[n]
def tens(n):
teen = int('{0}{1}'.format(n[0], n[1]))
if n[0] == 0:
return ones(n[1])
if teen in _numbers:
return _numbers[teen]
else:
ten = _numbers[int('{0}0'.format(n[0]))]
one = _numbers[n[1]]
return '{0}-{1}'.format(ten, one)
def hundreds(n):
if n[0] == 0:
return tens(n[1:])
else:
t = tens(n[1:])
return '{0} hundred {1}'.format(_numbers[n[0]], '' if not t else t)
def comma_separated(list_of_strings):
if len(list_of_strings) > 1:
return '{0} '.format('' if len(list_of_strings) == 2 else ',').join(list_of_strings)
else:
return list_of_strings[0]
def while_loop(list_of_numbers, final_list):
index = 0
group_set = int(len(list_of_numbers) / 3)
while group_set != 0:
value = hundreds(list_of_numbers[index:index + 3])
if value:
final_list.append('{0} {1}'.format(value, _places[group_set]) if _places[group_set] else value)
group_set -= 1
index += 3
number_list = []
decimal_list = []
decimal = ''
number = str(number)
(group_delimiter, point_delimiter) = (',', '.') if not european else ('.', ',')
if point_delimiter in number:
decimal = number.split(point_delimiter)[1]
number = number.split(point_delimiter)[0].replace(group_delimiter, '')
elif group_delimiter in number:
number = number.replace(group_delimiter, '')
if not number.isdigit():
raise value_error('Number is not numeric')
if decimal and (not decimal.isdigit()):
raise value_error('Decimal is not numeric')
if int(number) == 0:
number_list.append('zero')
r = len(number) % 3
d_r = len(decimal) % 3
number = number.zfill(len(number) + 3 - r if r else 0)
f_decimal = decimal.zfill(len(decimal) + 3 - d_r if d_r else 0)
d = [int(x) for x in f_decimal]
n = [int(x) for x in number]
while_loop(n, number_list)
if decimal and int(decimal) != 0:
while_loop(d, decimal_list)
if decimal_list:
name = ''
if len(decimal) % 3 == 1:
name = 'ten'
elif len(decimal) % 3 == 2:
name = 'hundred'
place = int(str(len(decimal) / 3).split('.')[0])
number_list.append('and {0} {1}{2}{3}ths'.format(comma_separated(decimal_list), name, '-' if name and _places[place + 1] else '', _places[place + 1]))
return comma_separated(number_list) |
batch_size = 32
stages = 4
epochs = 32
learning_rate = 0.00005
| batch_size = 32
stages = 4
epochs = 32
learning_rate = 5e-05 |
class InvalidSignError(Exception):
pass
class PositionTakenError(Exception):
pass
class ColumnIsFullError(Exception):
pass | class Invalidsignerror(Exception):
pass
class Positiontakenerror(Exception):
pass
class Columnisfullerror(Exception):
pass |
# -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
class AlertTypeBucketEnum(object):
"""Implementation of the 'AlertTypeBucket' enum.
Specifies the Alert type bucket.
Specifies the Alert type bucket.
kSoftware - Alerts which are related to Cohesity services.
kHardware - Alerts related to hardware on which Cohesity software is
running.
kService - Alerts related to other external services.
kOther - Alerts not of one of above categories.
Attributes:
KSOFTWARE: TODO: type description here.
KHARDWARE: TODO: type description here.
KSERVICE: TODO: type description here.
KOTHER: TODO: type description here.
"""
KSOFTWARE = 'kSoftware'
KHARDWARE = 'kHardware'
KSERVICE = 'kService'
KOTHER = 'kOther'
| class Alerttypebucketenum(object):
"""Implementation of the 'AlertTypeBucket' enum.
Specifies the Alert type bucket.
Specifies the Alert type bucket.
kSoftware - Alerts which are related to Cohesity services.
kHardware - Alerts related to hardware on which Cohesity software is
running.
kService - Alerts related to other external services.
kOther - Alerts not of one of above categories.
Attributes:
KSOFTWARE: TODO: type description here.
KHARDWARE: TODO: type description here.
KSERVICE: TODO: type description here.
KOTHER: TODO: type description here.
"""
ksoftware = 'kSoftware'
khardware = 'kHardware'
kservice = 'kService'
kother = 'kOther' |
def test_cookie(request):
"""
Return the result of the last staged test cookie.
returns cookie_state = bool
"""
if request.session.test_cookie_worked():
request.session.delete_test_cookie()
cookie_state = True
else:
cookie_state = False
return cookie_state
class CookeTestResultMixin:
"""From a CBV, get the result of the last test cookie and
set bool session variable cookie_state"""
# def get_cookie_state(self, request, *args, **kwargs):
#
# cookie_state = test_cooke(request)
# request.session['cookie_state'] = cookie_state
#
def get_context_data(self, *args, **kwargs):
context = super(CookeTestResultMixin, self).get_context_data(*args, **kwargs)
context['cookie_state'] = test_cookie(self.request)
return context
# def dispatch(self, request, *args, **kwargs):
# context = super(CookeTestResultMixin, self).get_context_data(*args, **kwargs)
# context['cookie_state'] = test_cookie(self.request)
# return super(CookeTestResultMixin, self).dispatch(request, *args, **kwargs)
# TODO Make this mixin work | def test_cookie(request):
"""
Return the result of the last staged test cookie.
returns cookie_state = bool
"""
if request.session.test_cookie_worked():
request.session.delete_test_cookie()
cookie_state = True
else:
cookie_state = False
return cookie_state
class Cooketestresultmixin:
"""From a CBV, get the result of the last test cookie and
set bool session variable cookie_state"""
def get_context_data(self, *args, **kwargs):
context = super(CookeTestResultMixin, self).get_context_data(*args, **kwargs)
context['cookie_state'] = test_cookie(self.request)
return context |
"""Helper for creating connections to AMQP servers"""
def aio_pika_connect_params(config, keypath: str = None) -> dict:
"""Return a dict keyword arguments that can be passed to
aio_pika.connect
"""
if keypath is None:
mq_conf = config
else:
mq_conf = config.get(keypath)
return {
"host": mq_conf["hostname"],
}
| """Helper for creating connections to AMQP servers"""
def aio_pika_connect_params(config, keypath: str=None) -> dict:
"""Return a dict keyword arguments that can be passed to
aio_pika.connect
"""
if keypath is None:
mq_conf = config
else:
mq_conf = config.get(keypath)
return {'host': mq_conf['hostname']} |
def adjust_travellers_number(travellers_input_val, num, subtract_btn, add_btn):
while travellers_input_val > num:
subtract_btn.click()
travellers_input_val -= 1
while travellers_input_val < num:
add_btn.click()
travellers_input_val += 1
def set_travellers_number(driver, num, form_loc, params: list):
travellers_number_input = driver.find_element(*getattr(form_loc, params[0]))
travellers_input_val = int(travellers_number_input.get_attribute("value"))
add_btn = driver.find_element(*getattr(form_loc, params[1]))
subtract_btn = driver.find_element(*getattr(form_loc, params[2]))
adjust_travellers_number(travellers_input_val, num, subtract_btn, add_btn)
def get_datestamp(driver, form_loc, params: list):
datestamps = driver.find_elements(*getattr(form_loc, params[0]))
for datestamp in datestamps:
if datestamp.is_displayed():
current_datestamp = datestamp.text
return current_datestamp
def click_displayed_datestamp(datestamps):
for datestamp in datestamps:
if datestamp.is_displayed():
datestamp.click()
break
| def adjust_travellers_number(travellers_input_val, num, subtract_btn, add_btn):
while travellers_input_val > num:
subtract_btn.click()
travellers_input_val -= 1
while travellers_input_val < num:
add_btn.click()
travellers_input_val += 1
def set_travellers_number(driver, num, form_loc, params: list):
travellers_number_input = driver.find_element(*getattr(form_loc, params[0]))
travellers_input_val = int(travellers_number_input.get_attribute('value'))
add_btn = driver.find_element(*getattr(form_loc, params[1]))
subtract_btn = driver.find_element(*getattr(form_loc, params[2]))
adjust_travellers_number(travellers_input_val, num, subtract_btn, add_btn)
def get_datestamp(driver, form_loc, params: list):
datestamps = driver.find_elements(*getattr(form_loc, params[0]))
for datestamp in datestamps:
if datestamp.is_displayed():
current_datestamp = datestamp.text
return current_datestamp
def click_displayed_datestamp(datestamps):
for datestamp in datestamps:
if datestamp.is_displayed():
datestamp.click()
break |
class Default:
""" No-op Implementation """
def __init__(self, *args, **kwargs):
pass
def gauge(self, name, value):
pass
def report_time(self, fn):
pass
| class Default:
""" No-op Implementation """
def __init__(self, *args, **kwargs):
pass
def gauge(self, name, value):
pass
def report_time(self, fn):
pass |
# Copyright 2020 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Support macros to assist in detecting build features."""
load("@bazel_skylib//lib:new_sets.bzl", "sets")
def _compute_enabled_features(*, requested_features, unsupported_features):
"""Returns a list of features for the given build.
Args:
requested_features: A list of features requested. Typically from `ctx.features`.
unsupported_features: A list of features to ignore. Typically from `ctx.disabled_features`.
Returns:
A list containing the subset of features that should be used.
"""
enabled_features_set = sets.make(requested_features)
enabled_features_set = sets.difference(
enabled_features_set,
sets.make(unsupported_features),
)
return sets.to_list(enabled_features_set)
features_support = struct(
compute_enabled_features = _compute_enabled_features,
)
| """Support macros to assist in detecting build features."""
load('@bazel_skylib//lib:new_sets.bzl', 'sets')
def _compute_enabled_features(*, requested_features, unsupported_features):
"""Returns a list of features for the given build.
Args:
requested_features: A list of features requested. Typically from `ctx.features`.
unsupported_features: A list of features to ignore. Typically from `ctx.disabled_features`.
Returns:
A list containing the subset of features that should be used.
"""
enabled_features_set = sets.make(requested_features)
enabled_features_set = sets.difference(enabled_features_set, sets.make(unsupported_features))
return sets.to_list(enabled_features_set)
features_support = struct(compute_enabled_features=_compute_enabled_features) |
data_format = {
"Inputs": {
"input2":
{
"ColumnNames": ["temperature", "humidity"],
"Values": [ [ "value", "value" ], ]
}, },
"GlobalParameters": {
}
}
sensor_value = { "ColumnNames": ["currentTime", "indoorTemp", "indoorHumid", "indoorIllum", "outdoorIllum" ],
"Values": [ [ "value", "value" , "value", "value", "value"], ] }
user_input = { "ColumnNames": ["sleepStatus", "joyStatus" ],
"Values": [ [ "value", "value"], ] }
activators_state = { "ColumnNames": ["ledStatus", "coffeeStatus", "curtainStatus"],
"Values": [ [ "value", "value" , "value"], ] }
activators_lock_timer = { "ColumnNames": ["ledStatus", "coffeeStatus", "curtainStatus"],
"Values": [ [ 0, 0 , 0], ] }
lock_time = 100
web_url = 'https://ussouthcentral.services.azureml.net/workspaces/0a46720be6f3493bb4c2c05f05e3e5c4/services/27176938495a45368fbb33bb7f26e1e3/execute?api-version=2.0&details=true'
api_key = 'yuhAKrw329F26sq9vXkc6JPt2kpvW0jNZYocNdHL32z3a8yM1DlCyUcbT06FkllVND2PtghZWOucvu/1r5kgYw=='
| data_format = {'Inputs': {'input2': {'ColumnNames': ['temperature', 'humidity'], 'Values': [['value', 'value']]}}, 'GlobalParameters': {}}
sensor_value = {'ColumnNames': ['currentTime', 'indoorTemp', 'indoorHumid', 'indoorIllum', 'outdoorIllum'], 'Values': [['value', 'value', 'value', 'value', 'value']]}
user_input = {'ColumnNames': ['sleepStatus', 'joyStatus'], 'Values': [['value', 'value']]}
activators_state = {'ColumnNames': ['ledStatus', 'coffeeStatus', 'curtainStatus'], 'Values': [['value', 'value', 'value']]}
activators_lock_timer = {'ColumnNames': ['ledStatus', 'coffeeStatus', 'curtainStatus'], 'Values': [[0, 0, 0]]}
lock_time = 100
web_url = 'https://ussouthcentral.services.azureml.net/workspaces/0a46720be6f3493bb4c2c05f05e3e5c4/services/27176938495a45368fbb33bb7f26e1e3/execute?api-version=2.0&details=true'
api_key = 'yuhAKrw329F26sq9vXkc6JPt2kpvW0jNZYocNdHL32z3a8yM1DlCyUcbT06FkllVND2PtghZWOucvu/1r5kgYw==' |
#
# Generic error collection for pynucleus.
# This file is part of pynucleus.
#
class BoardNotFoundError(IOError):
""" Class representing a condition where no board was found. """
class ProgrammingFailureError(IOError):
""" Class representing a condition where programming failed. """
| class Boardnotfounderror(IOError):
""" Class representing a condition where no board was found. """
class Programmingfailureerror(IOError):
""" Class representing a condition where programming failed. """ |
"""
Premium Question
"""
__author__ = 'Daniel'
"""
This is the interface that allows for creating nested lists.
You should not implement it, or speculate about its implementation
"""
class NestedInteger(object):
def isInteger(self):
"""
@return True if this NestedInteger holds a single integer, rather than a nested list.
:rtype bool
"""
def getInteger(self):
"""
@return the single integer that this NestedInteger holds, if it holds a single integer
Return None if this NestedInteger holds a nested list
:rtype int
"""
def getList(self):
"""
@return the nested list that this NestedInteger holds, if it holds a nested list
Return None if this NestedInteger holds a single integer
:rtype List[NestedInteger]
"""
class Solution(object):
def __init__(self):
self.sum = 0
def depthSum(self, nestedList):
"""
NestedInteger is a union type
:type nestedList: List[NestedInteger]
:rtype: int
"""
for elt in nestedList:
self.dfs(elt, 1)
return self.sum
def dfs(self, ni, depth):
if ni.isInteger():
self.sum += ni.getInteger() * depth
else:
lst = ni.getList()
for elt in lst:
self.dfs(elt, depth + 1)
| """
Premium Question
"""
__author__ = 'Daniel'
'\nThis is the interface that allows for creating nested lists.\nYou should not implement it, or speculate about its implementation\n'
class Nestedinteger(object):
def is_integer(self):
"""
@return True if this NestedInteger holds a single integer, rather than a nested list.
:rtype bool
"""
def get_integer(self):
"""
@return the single integer that this NestedInteger holds, if it holds a single integer
Return None if this NestedInteger holds a nested list
:rtype int
"""
def get_list(self):
"""
@return the nested list that this NestedInteger holds, if it holds a nested list
Return None if this NestedInteger holds a single integer
:rtype List[NestedInteger]
"""
class Solution(object):
def __init__(self):
self.sum = 0
def depth_sum(self, nestedList):
"""
NestedInteger is a union type
:type nestedList: List[NestedInteger]
:rtype: int
"""
for elt in nestedList:
self.dfs(elt, 1)
return self.sum
def dfs(self, ni, depth):
if ni.isInteger():
self.sum += ni.getInteger() * depth
else:
lst = ni.getList()
for elt in lst:
self.dfs(elt, depth + 1) |
def Eyes(thoughts, eyes, eye, tongue):
return f"""
{thoughts}
{thoughts}
.::!!!!!!!:.
.!!!!!:. .:!!!!!!!!!!!!
~~~~!!!!!!. .:!!!!!!!!!UWWW\$\$\$
:\$\$NWX!!: .:!!!!!!XUWW\$\$\$\$\$\$\$\$\$P
\$\$\$\$\$##WX!: .<!!!!UW\$\$\$\$" \$\$\$\$\$\$\$\$#
\$\$\$\$\$ \$\$\$UX :!!UW\$\$\$\$\$\$\$\$\$ 4\$\$\$\$\$*
^\$\$\$B \$\$\$\$\\ \$\$\$\$\$\$\$\$\$\$\$\$ d\$\$R"
"*\$bd\$\$\$\$ '*\$\$\$\$\$\$\$\$\$\$\$o+#"
\"\"\"\" \"\"\"\"\"\"\"
""" | def eyes(thoughts, eyes, eye, tongue):
return f'''\n {thoughts}\n {thoughts}\n .::!!!!!!!:.\n .!!!!!:. .:!!!!!!!!!!!!\n ~~~~!!!!!!. .:!!!!!!!!!UWWW\\$\\$\\$ \n :\\$\\$NWX!!: .:!!!!!!XUWW\\$\\$\\$\\$\\$\\$\\$\\$\\$P \n \\$\\$\\$\\$\\$##WX!: .<!!!!UW\\$\\$\\$\\$" \\$\\$\\$\\$\\$\\$\\$\\$# \n \\$\\$\\$\\$\\$ \\$\\$\\$UX :!!UW\\$\\$\\$\\$\\$\\$\\$\\$\\$ 4\\$\\$\\$\\$\\$* \n ^\\$\\$\\$B \\$\\$\\$\\$\\ \\$\\$\\$\\$\\$\\$\\$\\$\\$\\$\\$\\$ d\\$\\$R" \n "*\\$bd\\$\\$\\$\\$ '*\\$\\$\\$\\$\\$\\$\\$\\$\\$\\$\\$o+#" \n """" """"""" \n''' |
class VegaScatterPlot(object):
def __init__(self, width: int, height: int):
self._width = width
self._height = height
def build(self):
# TODO error log here
print("illegal")
assert 0
| class Vegascatterplot(object):
def __init__(self, width: int, height: int):
self._width = width
self._height = height
def build(self):
print('illegal')
assert 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Astounding Horror 1930s
chart = ["only", "absent-mindedly", "absolutely", "afterward", "ahead", "alike", "alongside", "always", "around", "asleep", "audibly", "away", "backward", "barely", "blankly", "blind", "blindly", "bravely", "brilliantly", "brokenly", "calmly", "close", "composedly", "contemptuously", "curiously", "decidedly", "definitely", "dimly", "distantly", "dizzily", "dully", "elsewhere", "especially", "exactly", "excitedly", "exclusively", "faintly", "fiercely", "finally", "finely", "forward", "foully", "frequently", "genuinely", "gloatingly", "graciously", "gradually", "grimly", "grisly", "half-way", "inexplicably", "instantaneously", "intelligently", "intently", "invariably", "justly", "largely", "less", "louder", "madly", "menacingly", "morosely", "neatly", "noisily", "noiselessly", "noncommittally", "oily", "ordinarily", "parallel", "particularly", "physically", "pleadingly", "positively", "powerlessly", "previously", "radiantly", "readily", "reluctantly", "reprovingly", "resolutely", "savagely", "scrupulously", "strictly", "sufficiently", "sullenly", "surreptitiously", "terribly", "thoughtfully", "thrillingly", "tightly", "timidly", "understand", "unduly", "ungenerously", "unusually", "uppermost", "vividly", "wholly", "wonderingly"],
| chart = (['only', 'absent-mindedly', 'absolutely', 'afterward', 'ahead', 'alike', 'alongside', 'always', 'around', 'asleep', 'audibly', 'away', 'backward', 'barely', 'blankly', 'blind', 'blindly', 'bravely', 'brilliantly', 'brokenly', 'calmly', 'close', 'composedly', 'contemptuously', 'curiously', 'decidedly', 'definitely', 'dimly', 'distantly', 'dizzily', 'dully', 'elsewhere', 'especially', 'exactly', 'excitedly', 'exclusively', 'faintly', 'fiercely', 'finally', 'finely', 'forward', 'foully', 'frequently', 'genuinely', 'gloatingly', 'graciously', 'gradually', 'grimly', 'grisly', 'half-way', 'inexplicably', 'instantaneously', 'intelligently', 'intently', 'invariably', 'justly', 'largely', 'less', 'louder', 'madly', 'menacingly', 'morosely', 'neatly', 'noisily', 'noiselessly', 'noncommittally', 'oily', 'ordinarily', 'parallel', 'particularly', 'physically', 'pleadingly', 'positively', 'powerlessly', 'previously', 'radiantly', 'readily', 'reluctantly', 'reprovingly', 'resolutely', 'savagely', 'scrupulously', 'strictly', 'sufficiently', 'sullenly', 'surreptitiously', 'terribly', 'thoughtfully', 'thrillingly', 'tightly', 'timidly', 'understand', 'unduly', 'ungenerously', 'unusually', 'uppermost', 'vividly', 'wholly', 'wonderingly'],) |
#Program 4
#Write a user defined function to accept two strings and concatenate them
#Name:Vikhyat
#Class:12
#Date of Execution:15.06.2021
def FuncConcat(x,y):
print(x+y)
print("Enter 2 strings to see them concatenated:")
l=(input("Enter String 1:"))
u=(input("Enter String 2:"))
FuncConcat(l,u)
'''Output for Program 4
Enter 2 strings to see them concatenated:
Enter String 1:I love
Enter String 2:Computers
I loveComputers
'''
| def func_concat(x, y):
print(x + y)
print('Enter 2 strings to see them concatenated:')
l = input('Enter String 1:')
u = input('Enter String 2:')
func_concat(l, u)
'Output for Program 4\n\nEnter 2 strings to see them concatenated:\nEnter String 1:I love\nEnter String 2:Computers\nI loveComputers\n\n' |
class Solution(object):
def lengthOfLongestSubstring(self, s):
"""
:type s: str
:rtype: int
"""
index = 0
result = 0
count = 0
cutline = -1
dictionary = {}
while index < len(s):
chr = s[index]
oldIndex = dictionary.get(chr, -1)
if oldIndex == -1 or cutline >= oldIndex:
dictionary[chr] = index
count += 1
else:
if result < count:
result = count
count = index - dictionary[chr]
cutline = dictionary[chr]
dictionary[chr] = index
index += 1
if count > result:
result = count
return result
def lengthOfLongestSubstring2(self, s):
"""
:type s: str
:rtype: int
"""
start = 0
charset = {}
max_length = 0
for end in range(len(s)):
if charset.get(s[end], -1) < start:
charset[s[end]] = end
max_length = max(max_length, end-start+1)
else:
start = charset[s[end]] + 1
charset[s[end]] = end
return max_length | class Solution(object):
def length_of_longest_substring(self, s):
"""
:type s: str
:rtype: int
"""
index = 0
result = 0
count = 0
cutline = -1
dictionary = {}
while index < len(s):
chr = s[index]
old_index = dictionary.get(chr, -1)
if oldIndex == -1 or cutline >= oldIndex:
dictionary[chr] = index
count += 1
else:
if result < count:
result = count
count = index - dictionary[chr]
cutline = dictionary[chr]
dictionary[chr] = index
index += 1
if count > result:
result = count
return result
def length_of_longest_substring2(self, s):
"""
:type s: str
:rtype: int
"""
start = 0
charset = {}
max_length = 0
for end in range(len(s)):
if charset.get(s[end], -1) < start:
charset[s[end]] = end
max_length = max(max_length, end - start + 1)
else:
start = charset[s[end]] + 1
charset[s[end]] = end
return max_length |
def nocache(app):
@app.after_request
def add_header(resp):
resp.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
resp.headers['Pragma'] = 'no-cache'
resp.headers['Expires'] = '0'
resp.headers['Cache-Control'] = 'public, max-age=0'
return resp
| def nocache(app):
@app.after_request
def add_header(resp):
resp.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
resp.headers['Pragma'] = 'no-cache'
resp.headers['Expires'] = '0'
resp.headers['Cache-Control'] = 'public, max-age=0'
return resp |
"""
This module registers the models we created for the "educator" application. After registering
the model, the data will be accessible through Django's admin functionality.
"""
| """
This module registers the models we created for the "educator" application. After registering
the model, the data will be accessible through Django's admin functionality.
""" |
KEY = 'key'
DESCRIPTION = 'description'
TAGS = 'tags'
XTRA_ATTRS = 'xtra_attrs'
SEARCH_TERMS = 'search_terms'
def list_search_terms(key):
'''Given a stat key, returns a list of search terms.'''
terms = []
if KEY in key:
terms += key[KEY].lower().split('.')
terms.append(key[KEY].lower())
if DESCRIPTION in key:
terms += key[DESCRIPTION].lower().split(' ')
if TAGS in key:
terms += [tag.lower() for tag in key[TAGS]]
if XTRA_ATTRS in key:
for attr in key[XTRA_ATTRS].values():
terms += attr.lower().split(' ')
# dedupe the terms
terms = [x for x in set(terms)]
return terms
def add_to_dict(key_dict):
'''Add search terms attr to keys in dict.'''
for key in key_dict.values():
search_terms = list_search_terms(key)
key[SEARCH_TERMS] = search_terms
| key = 'key'
description = 'description'
tags = 'tags'
xtra_attrs = 'xtra_attrs'
search_terms = 'search_terms'
def list_search_terms(key):
"""Given a stat key, returns a list of search terms."""
terms = []
if KEY in key:
terms += key[KEY].lower().split('.')
terms.append(key[KEY].lower())
if DESCRIPTION in key:
terms += key[DESCRIPTION].lower().split(' ')
if TAGS in key:
terms += [tag.lower() for tag in key[TAGS]]
if XTRA_ATTRS in key:
for attr in key[XTRA_ATTRS].values():
terms += attr.lower().split(' ')
terms = [x for x in set(terms)]
return terms
def add_to_dict(key_dict):
"""Add search terms attr to keys in dict."""
for key in key_dict.values():
search_terms = list_search_terms(key)
key[SEARCH_TERMS] = search_terms |
#
# PySNMP MIB module ADTRAN-AOS-DNS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ADTRAN-AOS-DNS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:13:59 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)
#
adGenAOSConformance, adGenAOSApplications = mibBuilder.importSymbols("ADTRAN-AOS", "adGenAOSConformance", "adGenAOSApplications")
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ConstraintsIntersection, ValueSizeConstraint, ConstraintsUnion, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "ConstraintsUnion", "SingleValueConstraint")
InetAddress, InetAddressType = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddress", "InetAddressType")
NotificationGroup, ObjectGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ObjectGroup", "ModuleCompliance")
sysName, = mibBuilder.importSymbols("SNMPv2-MIB", "sysName")
Bits, Counter32, ObjectIdentity, IpAddress, MibIdentifier, Gauge32, Counter64, iso, Unsigned32, NotificationType, Integer32, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "Counter32", "ObjectIdentity", "IpAddress", "MibIdentifier", "Gauge32", "Counter64", "iso", "Unsigned32", "NotificationType", "Integer32", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
adGenAOSDns = ModuleIdentity((1, 3, 6, 1, 4, 1, 664, 5, 53, 8, 1))
adGenAOSDns.setRevisions(('2012-04-30 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: adGenAOSDns.setRevisionsDescriptions(('Created the adGenAosDns MIB. Changes by Stefan Hammer.',))
if mibBuilder.loadTexts: adGenAOSDns.setLastUpdated('201204300000Z')
if mibBuilder.loadTexts: adGenAOSDns.setOrganization('ADTRAN, Inc.')
if mibBuilder.loadTexts: adGenAOSDns.setContactInfo(' Technical Support Dept. Postal: ADTRAN, Inc. 901 Explorer Blvd. Huntsville, AL 35806 Tel: +1 800 923 8726 Fax: +1 256 963 6217 E-mail: support@adtran.com')
if mibBuilder.loadTexts: adGenAOSDns.setDescription('The MIB module for AdtranOS Dns statistics.')
adDnsTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 664, 5, 53, 8, 1, 0))
adDnsTimestamp = MibScalar((1, 3, 6, 1, 4, 1, 664, 5, 53, 8, 1, 1), Unsigned32()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: adDnsTimestamp.setStatus('current')
if mibBuilder.loadTexts: adDnsTimestamp.setDescription('The time (seconds since epoch) that DNS event occured')
adDnsNameserverInetAddressType = MibScalar((1, 3, 6, 1, 4, 1, 664, 5, 53, 8, 1, 2), InetAddressType()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: adDnsNameserverInetAddressType.setStatus('current')
if mibBuilder.loadTexts: adDnsNameserverInetAddressType.setDescription('The address type of adDnsNameserverInetAddress')
adDnsNameserverInetAddress = MibScalar((1, 3, 6, 1, 4, 1, 664, 5, 53, 8, 1, 3), InetAddress()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: adDnsNameserverInetAddress.setStatus('current')
if mibBuilder.loadTexts: adDnsNameserverInetAddress.setDescription('The IP address of the nameserver for the DNS Resolution')
class AdDnsRequestErrorConditionTC(TextualConvention, Integer32):
description = "Indicates which specific error condition occurred. Error codes 0-15 are the RCODE error codes, while 16-n are Adtran proprietary DNS Request error conditions. The noError(0) state indicates that there is no error condition. The formatError(1) state indicates that name server was unable to interpret the query. The serverFailure(2) state indicates that name server was unable to process this query due to a problem with the name server. The nameError(3) state indicates that the domain name referenced in the query does not exist. Meaningful only for responses from an authoritative name server. The notImplemented(4) state indicates that the name server does not support the requested kind of query. The refused(5) state indicates the name server refuses to perform the specified operation for policy reasons. For example, a name server may not wish to provide the information to the particular requester, or a name server may not wish to perform a particular operation (e.g., zone transfer) for particular data. The 6-15 states are reserved for future use. The unsuportedRCode(16) state indicates that the AOS unit does not support the RCODE (error condition) returned by the DNS sever. The malformedResponse(17) state indicates that AOS unit received an improperly formated data packet from the DNS server. The parseError(18) state indicates that AOS unit could not parse the data from the DNS server correctly. The timeoutWaitingForResponse(19) state indicates that AOS unit did not receive a response from DNS server in the predetermined waiting period. The emptyResponse(20) state indicates that the AOS unit received an empty response from the DNS server. Many DNS servers send responses without any answers as a form of failure. The unsupportedType(21) state indicates that the AOS unit does not support the qtype indicated in the DNS server's answer. The onlyRootAnswer(22) state indicates that the DNS server responded only with a '.' answer, the root domain. Per RFC2782 page 6, this is a failure. The portDeficiency(23) state indicates that the AOS unit failed to allocate an open port to send the DNS question to the DNS sever. The noServerConfigured(24) state indicates that the AOS unit does not have a DNS lookup server configured. The updSendError(25) state indicates that the AOS unit could not send the DNS question packet (maybe a routing issue with the configured name-server)."
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25))
namedValues = NamedValues(("noError", 0), ("formatError", 1), ("serverFailure", 2), ("nameError", 3), ("notImplemented", 4), ("refused", 5), ("unsuportedRCode", 16), ("malformedResponse", 17), ("parseError", 18), ("timeoutWaitingForResponse", 19), ("emptyResponse", 20), ("unsupportedType", 21), ("onlyRootAnswer", 22), ("portDeficiency", 23), ("noServerCOnfigured", 24), ("udpSendError", 25))
adDnsRequestErrorCondition = MibScalar((1, 3, 6, 1, 4, 1, 664, 5, 53, 8, 1, 4), AdDnsRequestErrorConditionTC()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: adDnsRequestErrorCondition.setStatus('current')
if mibBuilder.loadTexts: adDnsRequestErrorCondition.setDescription('This field indicates which specific error condition occurred')
adDnsDomainName = MibScalar((1, 3, 6, 1, 4, 1, 664, 5, 53, 8, 1, 5), DisplayString()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: adDnsDomainName.setStatus('current')
if mibBuilder.loadTexts: adDnsDomainName.setDescription('The FQDN sent in the QNAME field of the question section of the DNS request')
class AdDnsResourceRecordTypeTC(TextualConvention, Integer32):
description = " A = 1, // a host address RFC1035 NS = 2, // an authoritative name server RFC1035 MD = 3, // a mail destination (Obsolete - use MX) RFC1035 MF = 4, // a mail forwarder (Obsolete - use MX) RFC1035 CNAME = 5, // the canonical name for an alias RFC1035 SOA = 6, // marks the start of a zone of authority RFC1035 MB = 7, // a mailbox domain name (EXPERIMENTAL) RFC1035 MG = 8, // a mail group member (EXPERIMENTAL) RFC1035 MR = 9, // a mail rename domain name (EXPERIMENTAL) RFC1035 NULL = 10, // a null RR (EXPERIMENTAL) RFC1035 WKS = 11, // a well known service description RFC1035 PTR = 12, // a domain name pointer RFC1035 HINFO = 13, // host information RFC1035 MINFO = 14, // mailbox or mail list information RFC1035 MX = 15, // mail exchange RFC1035 TXT = 16, // text strings RFC1035 AAAA = 28, // Ipv6 quad A addresses RFC3596 SRV = 33, // service record RFC2782 A_PLUS_AAAA = 65537 // Beyond 16 bit range. Not a record. An A query's and AAAA query's results bound together"
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 28, 33, 65537))
namedValues = NamedValues(("a", 1), ("ns", 2), ("md", 3), ("mf", 4), ("cname", 5), ("soa", 6), ("mb", 7), ("mg", 8), ("mr", 9), ("null", 10), ("wks", 11), ("ptr", 12), ("hinfo", 13), ("minfo", 14), ("mx", 15), ("txt", 16), ("aaaa", 28), ("srv", 33), ("aplusaaaa", 65537))
adDnsResourceRecordType = MibScalar((1, 3, 6, 1, 4, 1, 664, 5, 53, 8, 1, 6), AdDnsResourceRecordTypeTC()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: adDnsResourceRecordType.setStatus('current')
if mibBuilder.loadTexts: adDnsResourceRecordType.setDescription('This field indicates which record type the request was querying.')
adDnsIndividualResolutionFailure = NotificationType((1, 3, 6, 1, 4, 1, 664, 5, 53, 8, 1, 0, 1)).setObjects(("SNMPv2-MIB", "sysName"), ("ADTRAN-AOS-DNS-MIB", "adDnsTimestamp"), ("ADTRAN-AOS-DNS-MIB", "adDnsNameserverInetAddressType"), ("ADTRAN-AOS-DNS-MIB", "adDnsNameserverInetAddress"), ("ADTRAN-AOS-DNS-MIB", "adDnsRequestErrorCondition"), ("ADTRAN-AOS-DNS-MIB", "adDnsDomainName"), ("ADTRAN-AOS-DNS-MIB", "adDnsResourceRecordType"))
if mibBuilder.loadTexts: adDnsIndividualResolutionFailure.setStatus('current')
if mibBuilder.loadTexts: adDnsIndividualResolutionFailure.setDescription('This trap indicates that a DNS resolution failure has occured for a single, particular lookup. Information about the lookup and the failure are contained within this trap.')
adGenAOSDnsConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 664, 5, 53, 99, 13))
adGenAOSDnsGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 664, 5, 53, 99, 13, 1))
adGenAOSDnsCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 664, 5, 53, 99, 13, 2))
adGenAOSDnsFullCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 664, 5, 53, 99, 13, 2, 1)).setObjects(("ADTRAN-AOS-DNS-MIB", "adGenAOSDnsInfoGroup"), ("ADTRAN-AOS-DNS-MIB", "adGenAOSDnsNotificationGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
adGenAOSDnsFullCompliance = adGenAOSDnsFullCompliance.setStatus('current')
if mibBuilder.loadTexts: adGenAOSDnsFullCompliance.setDescription('The compliance statement for SNMP entities which implement version 2 of the adGenAOSDns MIB.')
adGenAOSDnsInfoGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 664, 5, 53, 99, 13, 1, 1)).setObjects(("ADTRAN-AOS-DNS-MIB", "adDnsTimestamp"), ("ADTRAN-AOS-DNS-MIB", "adDnsNameserverInetAddressType"), ("ADTRAN-AOS-DNS-MIB", "adDnsNameserverInetAddress"), ("ADTRAN-AOS-DNS-MIB", "adDnsRequestErrorCondition"), ("ADTRAN-AOS-DNS-MIB", "adDnsDomainName"), ("ADTRAN-AOS-DNS-MIB", "adDnsResourceRecordType"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
adGenAOSDnsInfoGroup = adGenAOSDnsInfoGroup.setStatus('current')
if mibBuilder.loadTexts: adGenAOSDnsInfoGroup.setDescription('Objects designed to assist in providing information about DNS Client.')
adGenAOSDnsNotificationGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 664, 5, 53, 99, 13, 1, 2)).setObjects(("ADTRAN-AOS-DNS-MIB", "adDnsIndividualResolutionFailure"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
adGenAOSDnsNotificationGroup = adGenAOSDnsNotificationGroup.setStatus('current')
if mibBuilder.loadTexts: adGenAOSDnsNotificationGroup.setDescription('Objects designed to assist in sending DNS notifications.')
mibBuilder.exportSymbols("ADTRAN-AOS-DNS-MIB", adDnsTraps=adDnsTraps, adDnsTimestamp=adDnsTimestamp, adGenAOSDns=adGenAOSDns, adGenAOSDnsNotificationGroup=adGenAOSDnsNotificationGroup, adDnsRequestErrorCondition=adDnsRequestErrorCondition, adGenAOSDnsConformance=adGenAOSDnsConformance, AdDnsResourceRecordTypeTC=AdDnsResourceRecordTypeTC, adDnsDomainName=adDnsDomainName, adDnsResourceRecordType=adDnsResourceRecordType, adDnsNameserverInetAddressType=adDnsNameserverInetAddressType, adDnsIndividualResolutionFailure=adDnsIndividualResolutionFailure, adGenAOSDnsInfoGroup=adGenAOSDnsInfoGroup, adGenAOSDnsCompliances=adGenAOSDnsCompliances, adDnsNameserverInetAddress=adDnsNameserverInetAddress, AdDnsRequestErrorConditionTC=AdDnsRequestErrorConditionTC, adGenAOSDnsGroup=adGenAOSDnsGroup, adGenAOSDnsFullCompliance=adGenAOSDnsFullCompliance, PYSNMP_MODULE_ID=adGenAOSDns)
| (ad_gen_aos_conformance, ad_gen_aos_applications) = mibBuilder.importSymbols('ADTRAN-AOS', 'adGenAOSConformance', 'adGenAOSApplications')
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, value_size_constraint, constraints_union, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ConstraintsIntersection', 'ValueSizeConstraint', 'ConstraintsUnion', 'SingleValueConstraint')
(inet_address, inet_address_type) = mibBuilder.importSymbols('INET-ADDRESS-MIB', 'InetAddress', 'InetAddressType')
(notification_group, object_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ObjectGroup', 'ModuleCompliance')
(sys_name,) = mibBuilder.importSymbols('SNMPv2-MIB', 'sysName')
(bits, counter32, object_identity, ip_address, mib_identifier, gauge32, counter64, iso, unsigned32, notification_type, integer32, module_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, time_ticks) = mibBuilder.importSymbols('SNMPv2-SMI', 'Bits', 'Counter32', 'ObjectIdentity', 'IpAddress', 'MibIdentifier', 'Gauge32', 'Counter64', 'iso', 'Unsigned32', 'NotificationType', 'Integer32', 'ModuleIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'TimeTicks')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
ad_gen_aos_dns = module_identity((1, 3, 6, 1, 4, 1, 664, 5, 53, 8, 1))
adGenAOSDns.setRevisions(('2012-04-30 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts:
adGenAOSDns.setRevisionsDescriptions(('Created the adGenAosDns MIB. Changes by Stefan Hammer.',))
if mibBuilder.loadTexts:
adGenAOSDns.setLastUpdated('201204300000Z')
if mibBuilder.loadTexts:
adGenAOSDns.setOrganization('ADTRAN, Inc.')
if mibBuilder.loadTexts:
adGenAOSDns.setContactInfo(' Technical Support Dept. Postal: ADTRAN, Inc. 901 Explorer Blvd. Huntsville, AL 35806 Tel: +1 800 923 8726 Fax: +1 256 963 6217 E-mail: support@adtran.com')
if mibBuilder.loadTexts:
adGenAOSDns.setDescription('The MIB module for AdtranOS Dns statistics.')
ad_dns_traps = mib_identifier((1, 3, 6, 1, 4, 1, 664, 5, 53, 8, 1, 0))
ad_dns_timestamp = mib_scalar((1, 3, 6, 1, 4, 1, 664, 5, 53, 8, 1, 1), unsigned32()).setMaxAccess('accessiblefornotify')
if mibBuilder.loadTexts:
adDnsTimestamp.setStatus('current')
if mibBuilder.loadTexts:
adDnsTimestamp.setDescription('The time (seconds since epoch) that DNS event occured')
ad_dns_nameserver_inet_address_type = mib_scalar((1, 3, 6, 1, 4, 1, 664, 5, 53, 8, 1, 2), inet_address_type()).setMaxAccess('accessiblefornotify')
if mibBuilder.loadTexts:
adDnsNameserverInetAddressType.setStatus('current')
if mibBuilder.loadTexts:
adDnsNameserverInetAddressType.setDescription('The address type of adDnsNameserverInetAddress')
ad_dns_nameserver_inet_address = mib_scalar((1, 3, 6, 1, 4, 1, 664, 5, 53, 8, 1, 3), inet_address()).setMaxAccess('accessiblefornotify')
if mibBuilder.loadTexts:
adDnsNameserverInetAddress.setStatus('current')
if mibBuilder.loadTexts:
adDnsNameserverInetAddress.setDescription('The IP address of the nameserver for the DNS Resolution')
class Addnsrequesterrorconditiontc(TextualConvention, Integer32):
description = "Indicates which specific error condition occurred. Error codes 0-15 are the RCODE error codes, while 16-n are Adtran proprietary DNS Request error conditions. The noError(0) state indicates that there is no error condition. The formatError(1) state indicates that name server was unable to interpret the query. The serverFailure(2) state indicates that name server was unable to process this query due to a problem with the name server. The nameError(3) state indicates that the domain name referenced in the query does not exist. Meaningful only for responses from an authoritative name server. The notImplemented(4) state indicates that the name server does not support the requested kind of query. The refused(5) state indicates the name server refuses to perform the specified operation for policy reasons. For example, a name server may not wish to provide the information to the particular requester, or a name server may not wish to perform a particular operation (e.g., zone transfer) for particular data. The 6-15 states are reserved for future use. The unsuportedRCode(16) state indicates that the AOS unit does not support the RCODE (error condition) returned by the DNS sever. The malformedResponse(17) state indicates that AOS unit received an improperly formated data packet from the DNS server. The parseError(18) state indicates that AOS unit could not parse the data from the DNS server correctly. The timeoutWaitingForResponse(19) state indicates that AOS unit did not receive a response from DNS server in the predetermined waiting period. The emptyResponse(20) state indicates that the AOS unit received an empty response from the DNS server. Many DNS servers send responses without any answers as a form of failure. The unsupportedType(21) state indicates that the AOS unit does not support the qtype indicated in the DNS server's answer. The onlyRootAnswer(22) state indicates that the DNS server responded only with a '.' answer, the root domain. Per RFC2782 page 6, this is a failure. The portDeficiency(23) state indicates that the AOS unit failed to allocate an open port to send the DNS question to the DNS sever. The noServerConfigured(24) state indicates that the AOS unit does not have a DNS lookup server configured. The updSendError(25) state indicates that the AOS unit could not send the DNS question packet (maybe a routing issue with the configured name-server)."
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25))
named_values = named_values(('noError', 0), ('formatError', 1), ('serverFailure', 2), ('nameError', 3), ('notImplemented', 4), ('refused', 5), ('unsuportedRCode', 16), ('malformedResponse', 17), ('parseError', 18), ('timeoutWaitingForResponse', 19), ('emptyResponse', 20), ('unsupportedType', 21), ('onlyRootAnswer', 22), ('portDeficiency', 23), ('noServerCOnfigured', 24), ('udpSendError', 25))
ad_dns_request_error_condition = mib_scalar((1, 3, 6, 1, 4, 1, 664, 5, 53, 8, 1, 4), ad_dns_request_error_condition_tc()).setMaxAccess('accessiblefornotify')
if mibBuilder.loadTexts:
adDnsRequestErrorCondition.setStatus('current')
if mibBuilder.loadTexts:
adDnsRequestErrorCondition.setDescription('This field indicates which specific error condition occurred')
ad_dns_domain_name = mib_scalar((1, 3, 6, 1, 4, 1, 664, 5, 53, 8, 1, 5), display_string()).setMaxAccess('accessiblefornotify')
if mibBuilder.loadTexts:
adDnsDomainName.setStatus('current')
if mibBuilder.loadTexts:
adDnsDomainName.setDescription('The FQDN sent in the QNAME field of the question section of the DNS request')
class Addnsresourcerecordtypetc(TextualConvention, Integer32):
description = " A = 1, // a host address RFC1035 NS = 2, // an authoritative name server RFC1035 MD = 3, // a mail destination (Obsolete - use MX) RFC1035 MF = 4, // a mail forwarder (Obsolete - use MX) RFC1035 CNAME = 5, // the canonical name for an alias RFC1035 SOA = 6, // marks the start of a zone of authority RFC1035 MB = 7, // a mailbox domain name (EXPERIMENTAL) RFC1035 MG = 8, // a mail group member (EXPERIMENTAL) RFC1035 MR = 9, // a mail rename domain name (EXPERIMENTAL) RFC1035 NULL = 10, // a null RR (EXPERIMENTAL) RFC1035 WKS = 11, // a well known service description RFC1035 PTR = 12, // a domain name pointer RFC1035 HINFO = 13, // host information RFC1035 MINFO = 14, // mailbox or mail list information RFC1035 MX = 15, // mail exchange RFC1035 TXT = 16, // text strings RFC1035 AAAA = 28, // Ipv6 quad A addresses RFC3596 SRV = 33, // service record RFC2782 A_PLUS_AAAA = 65537 // Beyond 16 bit range. Not a record. An A query's and AAAA query's results bound together"
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 28, 33, 65537))
named_values = named_values(('a', 1), ('ns', 2), ('md', 3), ('mf', 4), ('cname', 5), ('soa', 6), ('mb', 7), ('mg', 8), ('mr', 9), ('null', 10), ('wks', 11), ('ptr', 12), ('hinfo', 13), ('minfo', 14), ('mx', 15), ('txt', 16), ('aaaa', 28), ('srv', 33), ('aplusaaaa', 65537))
ad_dns_resource_record_type = mib_scalar((1, 3, 6, 1, 4, 1, 664, 5, 53, 8, 1, 6), ad_dns_resource_record_type_tc()).setMaxAccess('accessiblefornotify')
if mibBuilder.loadTexts:
adDnsResourceRecordType.setStatus('current')
if mibBuilder.loadTexts:
adDnsResourceRecordType.setDescription('This field indicates which record type the request was querying.')
ad_dns_individual_resolution_failure = notification_type((1, 3, 6, 1, 4, 1, 664, 5, 53, 8, 1, 0, 1)).setObjects(('SNMPv2-MIB', 'sysName'), ('ADTRAN-AOS-DNS-MIB', 'adDnsTimestamp'), ('ADTRAN-AOS-DNS-MIB', 'adDnsNameserverInetAddressType'), ('ADTRAN-AOS-DNS-MIB', 'adDnsNameserverInetAddress'), ('ADTRAN-AOS-DNS-MIB', 'adDnsRequestErrorCondition'), ('ADTRAN-AOS-DNS-MIB', 'adDnsDomainName'), ('ADTRAN-AOS-DNS-MIB', 'adDnsResourceRecordType'))
if mibBuilder.loadTexts:
adDnsIndividualResolutionFailure.setStatus('current')
if mibBuilder.loadTexts:
adDnsIndividualResolutionFailure.setDescription('This trap indicates that a DNS resolution failure has occured for a single, particular lookup. Information about the lookup and the failure are contained within this trap.')
ad_gen_aos_dns_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 664, 5, 53, 99, 13))
ad_gen_aos_dns_group = mib_identifier((1, 3, 6, 1, 4, 1, 664, 5, 53, 99, 13, 1))
ad_gen_aos_dns_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 664, 5, 53, 99, 13, 2))
ad_gen_aos_dns_full_compliance = module_compliance((1, 3, 6, 1, 4, 1, 664, 5, 53, 99, 13, 2, 1)).setObjects(('ADTRAN-AOS-DNS-MIB', 'adGenAOSDnsInfoGroup'), ('ADTRAN-AOS-DNS-MIB', 'adGenAOSDnsNotificationGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ad_gen_aos_dns_full_compliance = adGenAOSDnsFullCompliance.setStatus('current')
if mibBuilder.loadTexts:
adGenAOSDnsFullCompliance.setDescription('The compliance statement for SNMP entities which implement version 2 of the adGenAOSDns MIB.')
ad_gen_aos_dns_info_group = object_group((1, 3, 6, 1, 4, 1, 664, 5, 53, 99, 13, 1, 1)).setObjects(('ADTRAN-AOS-DNS-MIB', 'adDnsTimestamp'), ('ADTRAN-AOS-DNS-MIB', 'adDnsNameserverInetAddressType'), ('ADTRAN-AOS-DNS-MIB', 'adDnsNameserverInetAddress'), ('ADTRAN-AOS-DNS-MIB', 'adDnsRequestErrorCondition'), ('ADTRAN-AOS-DNS-MIB', 'adDnsDomainName'), ('ADTRAN-AOS-DNS-MIB', 'adDnsResourceRecordType'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ad_gen_aos_dns_info_group = adGenAOSDnsInfoGroup.setStatus('current')
if mibBuilder.loadTexts:
adGenAOSDnsInfoGroup.setDescription('Objects designed to assist in providing information about DNS Client.')
ad_gen_aos_dns_notification_group = notification_group((1, 3, 6, 1, 4, 1, 664, 5, 53, 99, 13, 1, 2)).setObjects(('ADTRAN-AOS-DNS-MIB', 'adDnsIndividualResolutionFailure'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ad_gen_aos_dns_notification_group = adGenAOSDnsNotificationGroup.setStatus('current')
if mibBuilder.loadTexts:
adGenAOSDnsNotificationGroup.setDescription('Objects designed to assist in sending DNS notifications.')
mibBuilder.exportSymbols('ADTRAN-AOS-DNS-MIB', adDnsTraps=adDnsTraps, adDnsTimestamp=adDnsTimestamp, adGenAOSDns=adGenAOSDns, adGenAOSDnsNotificationGroup=adGenAOSDnsNotificationGroup, adDnsRequestErrorCondition=adDnsRequestErrorCondition, adGenAOSDnsConformance=adGenAOSDnsConformance, AdDnsResourceRecordTypeTC=AdDnsResourceRecordTypeTC, adDnsDomainName=adDnsDomainName, adDnsResourceRecordType=adDnsResourceRecordType, adDnsNameserverInetAddressType=adDnsNameserverInetAddressType, adDnsIndividualResolutionFailure=adDnsIndividualResolutionFailure, adGenAOSDnsInfoGroup=adGenAOSDnsInfoGroup, adGenAOSDnsCompliances=adGenAOSDnsCompliances, adDnsNameserverInetAddress=adDnsNameserverInetAddress, AdDnsRequestErrorConditionTC=AdDnsRequestErrorConditionTC, adGenAOSDnsGroup=adGenAOSDnsGroup, adGenAOSDnsFullCompliance=adGenAOSDnsFullCompliance, PYSNMP_MODULE_ID=adGenAOSDns) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.