content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
#
# PySNMP MIB module HH3C-VSI-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-VSI-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:15:32 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")
ConstraintsUnion, ConstraintsIntersection, ValueSizeConstraint, SingleValueConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ConstraintsIntersection", "ValueSizeConstraint", "SingleValueConstraint", "ValueRangeConstraint")
hh3cCommon, = mibBuilder.importSymbols("HH3C-OID-MIB", "hh3cCommon")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
MibIdentifier, NotificationType, ObjectIdentity, Unsigned32, Bits, IpAddress, Counter64, iso, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter32, Gauge32, ModuleIdentity, TimeTicks, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "MibIdentifier", "NotificationType", "ObjectIdentity", "Unsigned32", "Bits", "IpAddress", "Counter64", "iso", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter32", "Gauge32", "ModuleIdentity", "TimeTicks", "Integer32")
RowStatus, DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "DisplayString", "TextualConvention")
hh3cVsi = ModuleIdentity((1, 3, 6, 1, 4, 1, 25506, 2, 105))
hh3cVsi.setRevisions(('2009-08-08 10:00',))
if mibBuilder.loadTexts: hh3cVsi.setLastUpdated('200908081000Z')
if mibBuilder.loadTexts: hh3cVsi.setOrganization('Hangzhou H3C Tech. Co., Ltd.')
hh3cVsiObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1))
hh3cVsiScalarGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 1))
hh3cVsiNextAvailableVsiIndex = MibScalar((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 1, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cVsiNextAvailableVsiIndex.setStatus('current')
hh3cVsiTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 2), )
if mibBuilder.loadTexts: hh3cVsiTable.setStatus('current')
hh3cVsiEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 2, 1), ).setIndexNames((0, "HH3C-VSI-MIB", "hh3cVsiIndex"))
if mibBuilder.loadTexts: hh3cVsiEntry.setStatus('current')
hh3cVsiIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 2, 1, 1), Unsigned32())
if mibBuilder.loadTexts: hh3cVsiIndex.setStatus('current')
hh3cVsiName = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 2, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 31))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cVsiName.setStatus('current')
hh3cVsiMode = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("martini", 1), ("minm", 2), ("martiniAndMinm", 3), ("kompella", 4), ("kompellaAndMinm", 5)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cVsiMode.setStatus('current')
hh3cMinmIsid = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 2, 1, 4), Integer32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cMinmIsid.setStatus('current')
hh3cVsiId = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 2, 1, 5), Unsigned32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cVsiId.setStatus('current')
hh3cVsiTransMode = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 2, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("vlan", 1), ("ethernet", 2)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cVsiTransMode.setStatus('current')
hh3cVsiEnableHubSpoke = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 2, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disable", 1), ("enable", 2)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cVsiEnableHubSpoke.setStatus('current')
hh3cVsiAdminState = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 2, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("adminUp", 1), ("adminDown", 2)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cVsiAdminState.setStatus('current')
hh3cVsiRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 2, 1, 9), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cVsiRowStatus.setStatus('current')
hh3cVsiXconnectTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 3), )
if mibBuilder.loadTexts: hh3cVsiXconnectTable.setStatus('current')
hh3cVsiXconnectEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 3, 1), ).setIndexNames((0, "HH3C-VSI-MIB", "hh3cVsiXconnectIfIndex"), (0, "HH3C-VSI-MIB", "hh3cVsiXconnectEvcSrvInstId"))
if mibBuilder.loadTexts: hh3cVsiXconnectEntry.setStatus('current')
hh3cVsiXconnectIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 3, 1, 1), Unsigned32())
if mibBuilder.loadTexts: hh3cVsiXconnectIfIndex.setStatus('current')
hh3cVsiXconnectEvcSrvInstId = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 3, 1, 2), Unsigned32())
if mibBuilder.loadTexts: hh3cVsiXconnectEvcSrvInstId.setStatus('current')
hh3cVsiXconnectVsiName = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 3, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 31))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cVsiXconnectVsiName.setStatus('current')
hh3cVsiXconnectAccessMode = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 3, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("vlan", 1), ("ethernet", 2)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cVsiXconnectAccessMode.setStatus('current')
hh3cVsiXconnectHubSpoke = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 3, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("none", 1), ("hub", 2), ("spoke", 3)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cVsiXconnectHubSpoke.setStatus('current')
hh3cVsiXconnectRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 3, 1, 6), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cVsiXconnectRowStatus.setStatus('current')
mibBuilder.exportSymbols("HH3C-VSI-MIB", hh3cVsiMode=hh3cVsiMode, hh3cMinmIsid=hh3cMinmIsid, hh3cVsi=hh3cVsi, hh3cVsiXconnectAccessMode=hh3cVsiXconnectAccessMode, hh3cVsiXconnectRowStatus=hh3cVsiXconnectRowStatus, hh3cVsiXconnectHubSpoke=hh3cVsiXconnectHubSpoke, hh3cVsiEntry=hh3cVsiEntry, hh3cVsiObjects=hh3cVsiObjects, hh3cVsiNextAvailableVsiIndex=hh3cVsiNextAvailableVsiIndex, hh3cVsiTransMode=hh3cVsiTransMode, hh3cVsiXconnectVsiName=hh3cVsiXconnectVsiName, hh3cVsiAdminState=hh3cVsiAdminState, hh3cVsiIndex=hh3cVsiIndex, hh3cVsiScalarGroup=hh3cVsiScalarGroup, hh3cVsiId=hh3cVsiId, hh3cVsiRowStatus=hh3cVsiRowStatus, PYSNMP_MODULE_ID=hh3cVsi, hh3cVsiName=hh3cVsiName, hh3cVsiEnableHubSpoke=hh3cVsiEnableHubSpoke, hh3cVsiTable=hh3cVsiTable, hh3cVsiXconnectEntry=hh3cVsiXconnectEntry, hh3cVsiXconnectEvcSrvInstId=hh3cVsiXconnectEvcSrvInstId, hh3cVsiXconnectIfIndex=hh3cVsiXconnectIfIndex, hh3cVsiXconnectTable=hh3cVsiXconnectTable)
| (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, value_size_constraint, single_value_constraint, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ConstraintsIntersection', 'ValueSizeConstraint', 'SingleValueConstraint', 'ValueRangeConstraint')
(hh3c_common,) = mibBuilder.importSymbols('HH3C-OID-MIB', 'hh3cCommon')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(mib_identifier, notification_type, object_identity, unsigned32, bits, ip_address, counter64, iso, mib_scalar, mib_table, mib_table_row, mib_table_column, counter32, gauge32, module_identity, time_ticks, integer32) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibIdentifier', 'NotificationType', 'ObjectIdentity', 'Unsigned32', 'Bits', 'IpAddress', 'Counter64', 'iso', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter32', 'Gauge32', 'ModuleIdentity', 'TimeTicks', 'Integer32')
(row_status, display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'RowStatus', 'DisplayString', 'TextualConvention')
hh3c_vsi = module_identity((1, 3, 6, 1, 4, 1, 25506, 2, 105))
hh3cVsi.setRevisions(('2009-08-08 10:00',))
if mibBuilder.loadTexts:
hh3cVsi.setLastUpdated('200908081000Z')
if mibBuilder.loadTexts:
hh3cVsi.setOrganization('Hangzhou H3C Tech. Co., Ltd.')
hh3c_vsi_objects = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1))
hh3c_vsi_scalar_group = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 1))
hh3c_vsi_next_available_vsi_index = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 1, 1), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cVsiNextAvailableVsiIndex.setStatus('current')
hh3c_vsi_table = mib_table((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 2))
if mibBuilder.loadTexts:
hh3cVsiTable.setStatus('current')
hh3c_vsi_entry = mib_table_row((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 2, 1)).setIndexNames((0, 'HH3C-VSI-MIB', 'hh3cVsiIndex'))
if mibBuilder.loadTexts:
hh3cVsiEntry.setStatus('current')
hh3c_vsi_index = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 2, 1, 1), unsigned32())
if mibBuilder.loadTexts:
hh3cVsiIndex.setStatus('current')
hh3c_vsi_name = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 2, 1, 2), octet_string().subtype(subtypeSpec=value_size_constraint(1, 31))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hh3cVsiName.setStatus('current')
hh3c_vsi_mode = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 2, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('martini', 1), ('minm', 2), ('martiniAndMinm', 3), ('kompella', 4), ('kompellaAndMinm', 5)))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hh3cVsiMode.setStatus('current')
hh3c_minm_isid = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 2, 1, 4), integer32()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hh3cMinmIsid.setStatus('current')
hh3c_vsi_id = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 2, 1, 5), unsigned32()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hh3cVsiId.setStatus('current')
hh3c_vsi_trans_mode = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 2, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('vlan', 1), ('ethernet', 2)))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hh3cVsiTransMode.setStatus('current')
hh3c_vsi_enable_hub_spoke = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 2, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('disable', 1), ('enable', 2)))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hh3cVsiEnableHubSpoke.setStatus('current')
hh3c_vsi_admin_state = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 2, 1, 8), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('adminUp', 1), ('adminDown', 2)))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hh3cVsiAdminState.setStatus('current')
hh3c_vsi_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 2, 1, 9), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hh3cVsiRowStatus.setStatus('current')
hh3c_vsi_xconnect_table = mib_table((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 3))
if mibBuilder.loadTexts:
hh3cVsiXconnectTable.setStatus('current')
hh3c_vsi_xconnect_entry = mib_table_row((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 3, 1)).setIndexNames((0, 'HH3C-VSI-MIB', 'hh3cVsiXconnectIfIndex'), (0, 'HH3C-VSI-MIB', 'hh3cVsiXconnectEvcSrvInstId'))
if mibBuilder.loadTexts:
hh3cVsiXconnectEntry.setStatus('current')
hh3c_vsi_xconnect_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 3, 1, 1), unsigned32())
if mibBuilder.loadTexts:
hh3cVsiXconnectIfIndex.setStatus('current')
hh3c_vsi_xconnect_evc_srv_inst_id = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 3, 1, 2), unsigned32())
if mibBuilder.loadTexts:
hh3cVsiXconnectEvcSrvInstId.setStatus('current')
hh3c_vsi_xconnect_vsi_name = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 3, 1, 3), octet_string().subtype(subtypeSpec=value_size_constraint(1, 31))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hh3cVsiXconnectVsiName.setStatus('current')
hh3c_vsi_xconnect_access_mode = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 3, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('vlan', 1), ('ethernet', 2)))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hh3cVsiXconnectAccessMode.setStatus('current')
hh3c_vsi_xconnect_hub_spoke = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 3, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('none', 1), ('hub', 2), ('spoke', 3)))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hh3cVsiXconnectHubSpoke.setStatus('current')
hh3c_vsi_xconnect_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 105, 1, 3, 1, 6), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hh3cVsiXconnectRowStatus.setStatus('current')
mibBuilder.exportSymbols('HH3C-VSI-MIB', hh3cVsiMode=hh3cVsiMode, hh3cMinmIsid=hh3cMinmIsid, hh3cVsi=hh3cVsi, hh3cVsiXconnectAccessMode=hh3cVsiXconnectAccessMode, hh3cVsiXconnectRowStatus=hh3cVsiXconnectRowStatus, hh3cVsiXconnectHubSpoke=hh3cVsiXconnectHubSpoke, hh3cVsiEntry=hh3cVsiEntry, hh3cVsiObjects=hh3cVsiObjects, hh3cVsiNextAvailableVsiIndex=hh3cVsiNextAvailableVsiIndex, hh3cVsiTransMode=hh3cVsiTransMode, hh3cVsiXconnectVsiName=hh3cVsiXconnectVsiName, hh3cVsiAdminState=hh3cVsiAdminState, hh3cVsiIndex=hh3cVsiIndex, hh3cVsiScalarGroup=hh3cVsiScalarGroup, hh3cVsiId=hh3cVsiId, hh3cVsiRowStatus=hh3cVsiRowStatus, PYSNMP_MODULE_ID=hh3cVsi, hh3cVsiName=hh3cVsiName, hh3cVsiEnableHubSpoke=hh3cVsiEnableHubSpoke, hh3cVsiTable=hh3cVsiTable, hh3cVsiXconnectEntry=hh3cVsiXconnectEntry, hh3cVsiXconnectEvcSrvInstId=hh3cVsiXconnectEvcSrvInstId, hh3cVsiXconnectIfIndex=hh3cVsiXconnectIfIndex, hh3cVsiXconnectTable=hh3cVsiXconnectTable) |
vals = [0,10,-30,173247,123,19892122]
formats = ['%o','%020o', '%-20o', '%#o', '+%o', '+%#o']
for val in vals:
for fmt in formats:
print(fmt+":", fmt % val)
| vals = [0, 10, -30, 173247, 123, 19892122]
formats = ['%o', '%020o', '%-20o', '%#o', '+%o', '+%#o']
for val in vals:
for fmt in formats:
print(fmt + ':', fmt % val) |
# File: gcloudcomputeengine_consts.py
#
# Copyright (c) 2021 Splunk Inc.
#
# Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
# Define your constants here
COMPUTE = 'compute'
COMPUTE_VERSION = 'v1'
# Error message handling constants
ERR_CODE_MSG = "Error code unavailable"
ERR_MSG_UNAVAILABLE = "Error message unavailable. Please check the asset configuration and|or action parameters"
PARSE_ERR_MSG = "Unable to parse the error message. Please check the asset configuration and|or action parameters"
| compute = 'compute'
compute_version = 'v1'
err_code_msg = 'Error code unavailable'
err_msg_unavailable = 'Error message unavailable. Please check the asset configuration and|or action parameters'
parse_err_msg = 'Unable to parse the error message. Please check the asset configuration and|or action parameters' |
#!/usr/bin/env python3
def byterize(obj):
objdict = obj.__dict__['fields']
def do_encode(dictio, key):
if isinstance(dictio[key], str) and len(dictio[key]) > 0 and key not in ['SecondaryAddr']:
dictio[key] = dictio[key].encode('latin-1')
elif hasattr(dictio[key], '__dict__'):
subdictio = dictio[key].__dict__['fields']
for subkey in subdictio:
do_encode(subdictio, subkey)
for field in objdict:
do_encode(objdict, field)
return obj
def justify(astring, indent = 35, break_every = 100):
str_indent = ('\n' + ' ' * indent)
splitted = astring.split('\n')
longests = [(n, s) for n, s in enumerate(splitted) if len(s) >= break_every]
for longest in longests:
lines = []
for i in range(0, len(longest[1]), break_every):
lines.append(longest[1][i : i + break_every])
splitted[longest[0]] = str_indent.join(lines)
if len(splitted) > 1:
justy = str_indent.join(splitted)
else:
justy = str_indent + str_indent.join(splitted)
return justy
class ShellStyle(object):
def style(self, s, style):
return style + s + '\033[0m'
def green(self, s):
return self.style(s, '\033[92m')
def blue(self, s):
return self.style(s, '\033[94m')
def yellow(self, s):
return self.style(s, '\033[93m')
def red(self, s):
return self.style(s, '\033[91m')
def magenta(self, s):
return self.style(s, '\033[95m')
def cyan(self, s):
return self.style(s, '\033[96m')
def white(self, s):
return self.style(s, '\033[97m')
def bold(self, s):
return self.style(s, '\033[1m')
def underline(self, s):
return self.style(s, '\033[4m')
def shell_message(nshell):
shelldict = {0: ShellStyle().yellow("Client generating RPC Bind Request..."),
1: ShellStyle().yellow("Client sending RPC Bind Request...") + ShellStyle().red("\t\t\t\t===============>"),
2: ShellStyle().red("===============>\t\t") + ShellStyle().yellow("Server received RPC Bind Request !!!"),
3: ShellStyle().yellow("\t\t\t\tServer parsing RPC Bind Request..."),
4: ShellStyle().yellow("\t\t\t\tServer generating RPC Bind Response..."),
5: ShellStyle().red("<===============\t\t") + ShellStyle().yellow("Server sending RPC Bind Response..."),
6: ShellStyle().green("\t\t\t\tRPC Bind acknowledged !!!\n"),
7: ShellStyle().yellow("Client received RPC Bind Response !!!") + ShellStyle().red("\t\t\t\t<==============="),
8: ShellStyle().green("RPC Bind acknowledged !!!\n"),
9: ShellStyle().blue("Client generating Activation Request dictionary..."),
10: ShellStyle().blue("Client generating Activation Request data..."),
11: ShellStyle().blue("Client generating RPC Activation Request..."),
12: ShellStyle().blue("Client sending RPC Activation Request...") + ShellStyle().red("\t\t\t===============>"),
13: ShellStyle().red("===============>\t\t") + ShellStyle().blue("Server received RPC Activation Request !!!"),
14: ShellStyle().blue("\t\t\t\tServer parsing RPC Activation Request..."),
15: ShellStyle().blue("\t\t\t\tServer processing KMS Activation Request..."),
16: ShellStyle().blue("\t\t\t\tServer processing KMS Activation Response..."),
17: ShellStyle().blue("\t\t\t\tServer generating RPC Activation Response..."),
18: ShellStyle().red("<===============\t\t") + ShellStyle().blue("Server sending RPC Activation Response..."),
19: ShellStyle().green("\t\t\t\tServer responded, now in Stand by...\n"),
20: ShellStyle().blue("Client received Response !!!") + ShellStyle().red("\t\t\t\t\t<==============="),
21: ShellStyle().green("Activation Done !!!"),
-1: ShellStyle().red("\t\t\t\t\t\t\t\tServer receiving"),
-2: ShellStyle().red("Client sending"),
-3: ShellStyle().red("Client receiving"),
-4: ShellStyle().red("\t\t\t\t\t\t\t\tServer sending")
}
if isinstance(nshell, list):
for n in nshell:
print(shelldict[n])
else:
print(shelldict[nshell])
| def byterize(obj):
objdict = obj.__dict__['fields']
def do_encode(dictio, key):
if isinstance(dictio[key], str) and len(dictio[key]) > 0 and (key not in ['SecondaryAddr']):
dictio[key] = dictio[key].encode('latin-1')
elif hasattr(dictio[key], '__dict__'):
subdictio = dictio[key].__dict__['fields']
for subkey in subdictio:
do_encode(subdictio, subkey)
for field in objdict:
do_encode(objdict, field)
return obj
def justify(astring, indent=35, break_every=100):
str_indent = '\n' + ' ' * indent
splitted = astring.split('\n')
longests = [(n, s) for (n, s) in enumerate(splitted) if len(s) >= break_every]
for longest in longests:
lines = []
for i in range(0, len(longest[1]), break_every):
lines.append(longest[1][i:i + break_every])
splitted[longest[0]] = str_indent.join(lines)
if len(splitted) > 1:
justy = str_indent.join(splitted)
else:
justy = str_indent + str_indent.join(splitted)
return justy
class Shellstyle(object):
def style(self, s, style):
return style + s + '\x1b[0m'
def green(self, s):
return self.style(s, '\x1b[92m')
def blue(self, s):
return self.style(s, '\x1b[94m')
def yellow(self, s):
return self.style(s, '\x1b[93m')
def red(self, s):
return self.style(s, '\x1b[91m')
def magenta(self, s):
return self.style(s, '\x1b[95m')
def cyan(self, s):
return self.style(s, '\x1b[96m')
def white(self, s):
return self.style(s, '\x1b[97m')
def bold(self, s):
return self.style(s, '\x1b[1m')
def underline(self, s):
return self.style(s, '\x1b[4m')
def shell_message(nshell):
shelldict = {0: shell_style().yellow('Client generating RPC Bind Request...'), 1: shell_style().yellow('Client sending RPC Bind Request...') + shell_style().red('\t\t\t\t===============>'), 2: shell_style().red('===============>\t\t') + shell_style().yellow('Server received RPC Bind Request !!!'), 3: shell_style().yellow('\t\t\t\tServer parsing RPC Bind Request...'), 4: shell_style().yellow('\t\t\t\tServer generating RPC Bind Response...'), 5: shell_style().red('<===============\t\t') + shell_style().yellow('Server sending RPC Bind Response...'), 6: shell_style().green('\t\t\t\tRPC Bind acknowledged !!!\n'), 7: shell_style().yellow('Client received RPC Bind Response !!!') + shell_style().red('\t\t\t\t<==============='), 8: shell_style().green('RPC Bind acknowledged !!!\n'), 9: shell_style().blue('Client generating Activation Request dictionary...'), 10: shell_style().blue('Client generating Activation Request data...'), 11: shell_style().blue('Client generating RPC Activation Request...'), 12: shell_style().blue('Client sending RPC Activation Request...') + shell_style().red('\t\t\t===============>'), 13: shell_style().red('===============>\t\t') + shell_style().blue('Server received RPC Activation Request !!!'), 14: shell_style().blue('\t\t\t\tServer parsing RPC Activation Request...'), 15: shell_style().blue('\t\t\t\tServer processing KMS Activation Request...'), 16: shell_style().blue('\t\t\t\tServer processing KMS Activation Response...'), 17: shell_style().blue('\t\t\t\tServer generating RPC Activation Response...'), 18: shell_style().red('<===============\t\t') + shell_style().blue('Server sending RPC Activation Response...'), 19: shell_style().green('\t\t\t\tServer responded, now in Stand by...\n'), 20: shell_style().blue('Client received Response !!!') + shell_style().red('\t\t\t\t\t<==============='), 21: shell_style().green('Activation Done !!!'), -1: shell_style().red('\t\t\t\t\t\t\t\tServer receiving'), -2: shell_style().red('Client sending'), -3: shell_style().red('Client receiving'), -4: shell_style().red('\t\t\t\t\t\t\t\tServer sending')}
if isinstance(nshell, list):
for n in nshell:
print(shelldict[n])
else:
print(shelldict[nshell]) |
class DaftException(Exception):
def __init__(self, reason):
self.reason = reason
def __str__(self):
return "Error: " + self.reason
| class Daftexception(Exception):
def __init__(self, reason):
self.reason = reason
def __str__(self):
return 'Error: ' + self.reason |
class Solution:
def transformArray(self, arr: List[int]) -> List[int]:
na = arr[:]
stable = False
while not stable:
stable = True
for i in range(1, len(arr) - 1):
if arr[i] < arr[i-1] and arr[i] < arr[i+1]:
na[i] = arr[i] + 1
stable = False
elif arr[i] > arr[i-1] and arr[i] > arr[i+1]:
na[i] = arr[i] - 1
stable = False
else:
na[i] = arr[i]
arr = na[:]
return arr
| class Solution:
def transform_array(self, arr: List[int]) -> List[int]:
na = arr[:]
stable = False
while not stable:
stable = True
for i in range(1, len(arr) - 1):
if arr[i] < arr[i - 1] and arr[i] < arr[i + 1]:
na[i] = arr[i] + 1
stable = False
elif arr[i] > arr[i - 1] and arr[i] > arr[i + 1]:
na[i] = arr[i] - 1
stable = False
else:
na[i] = arr[i]
arr = na[:]
return arr |
try:
p=8778
b=56434
#f = open("ab.txt")
p = b/0
f = open("ab.txt")
for line in f:
print(line)
except FileNotFoundError as e:
print( e.filename)
except Exception as e:
print(e)
except ZeroDivisionError as e:
print(e)
#except (FileNotFoundError , ZeroDivisionError):
#print("file not found")
#except ZeroDivisionError:
#print("zero division error")
#i = 0/0
#we made some changes
| try:
p = 8778
b = 56434
p = b / 0
f = open('ab.txt')
for line in f:
print(line)
except FileNotFoundError as e:
print(e.filename)
except Exception as e:
print(e)
except ZeroDivisionError as e:
print(e) |
# ***************************************************************************************
# ***************************************************************************************
#
# Name : errors.py
# Author : Paul Robson (paul@robsons.org.uk)
# Date : 9th December 2018
# Purpose : Error classes
#
# ***************************************************************************************
# ***************************************************************************************
# ***************************************************************************************
# Compiler Error
# ***************************************************************************************
class CompilerException(Exception):
def __init__(self,message):
self.message = message
def get(self):
return "{0} ({1}:{2})".format(self.message,CompilerException.FILENAME,CompilerException.LINENUMBER)
CompilerException.FILENAME = "test"
CompilerException.LINENUMBER = 42
if __name__ == "__main__":
ex = CompilerException("Division by 42 error")
print(ex.get())
raise ex
| class Compilerexception(Exception):
def __init__(self, message):
self.message = message
def get(self):
return '{0} ({1}:{2})'.format(self.message, CompilerException.FILENAME, CompilerException.LINENUMBER)
CompilerException.FILENAME = 'test'
CompilerException.LINENUMBER = 42
if __name__ == '__main__':
ex = compiler_exception('Division by 42 error')
print(ex.get())
raise ex |
def get_options_ratio(options, total):
return options / total
def get_faculty_rating(get_options_ratio):
if get_options_ratio > .9 and get_options_ratio < 1:
return "Excellent"
if get_options_ratio > .8 and get_options_ratio < .9:
return "Very Good"
if get_options_ratio > .7 and get_options_ratio < .8:
return "Good"
if get_options_ratio > .6 and get_options_ratio < .7:
return "Needs Improvement"
if get_options_ratio > 0 and get_options_ratio < .6:
return "Unacceptable" | def get_options_ratio(options, total):
return options / total
def get_faculty_rating(get_options_ratio):
if get_options_ratio > 0.9 and get_options_ratio < 1:
return 'Excellent'
if get_options_ratio > 0.8 and get_options_ratio < 0.9:
return 'Very Good'
if get_options_ratio > 0.7 and get_options_ratio < 0.8:
return 'Good'
if get_options_ratio > 0.6 and get_options_ratio < 0.7:
return 'Needs Improvement'
if get_options_ratio > 0 and get_options_ratio < 0.6:
return 'Unacceptable' |
'''
Given a word, you need to judge whether the usage of capitals in it is right or not.
We define the usage of capitals in a word to be right when one of the following cases holds:
All letters in this word are capitals, like "USA".
All letters in this word are not capitals, like "leetcode".
Only the first letter in this word is capital, like "Google".
Otherwise, we define that this word doesn't use capitals in a right way.
'''
class Solution:
def detectCapitalUse(self, word: str) -> bool:
s = word
all_caps = True
all_low = True
for i in range(len(s)):
if s[i].isupper() == False:
all_caps = False
break
for i in range(len(s)):
if s[i].islower() == False:
all_low = False
break
first_letter_cap = s[0].isupper()
the_rest = s[1:]
for i in range(len(the_rest)):
if the_rest[i].isupper():
first_letter_cap = False
break
if all_caps or all_low or first_letter_cap:
return True
return False
| """
Given a word, you need to judge whether the usage of capitals in it is right or not.
We define the usage of capitals in a word to be right when one of the following cases holds:
All letters in this word are capitals, like "USA".
All letters in this word are not capitals, like "leetcode".
Only the first letter in this word is capital, like "Google".
Otherwise, we define that this word doesn't use capitals in a right way.
"""
class Solution:
def detect_capital_use(self, word: str) -> bool:
s = word
all_caps = True
all_low = True
for i in range(len(s)):
if s[i].isupper() == False:
all_caps = False
break
for i in range(len(s)):
if s[i].islower() == False:
all_low = False
break
first_letter_cap = s[0].isupper()
the_rest = s[1:]
for i in range(len(the_rest)):
if the_rest[i].isupper():
first_letter_cap = False
break
if all_caps or all_low or first_letter_cap:
return True
return False |
# See readme.md for instructions on running this code.
class HelpHandler(object):
def usage(self):
return '''
This plugin will give info about Zulip to
any user that types a message saying "help".
This is example code; ideally, you would flesh
this out for more useful help pertaining to
your Zulip instance.
'''
def triage_message(self, message):
# return True if we think the message may be of interest
original_content = message['content']
if message['type'] != 'stream':
return True
if original_content.lower().strip() != 'help':
return False
return True
def handle_message(self, message, client):
help_content = '''
Info on Zulip can be found here:
https://github.com/zulip/zulip
'''.strip()
client.send_message(dict(
type='stream',
to=message['display_recipient'],
subject=message['subject'],
content=help_content,
))
handler_class = HelpHandler
| class Helphandler(object):
def usage(self):
return '\n This plugin will give info about Zulip to\n any user that types a message saying "help".\n\n This is example code; ideally, you would flesh\n this out for more useful help pertaining to\n your Zulip instance.\n '
def triage_message(self, message):
original_content = message['content']
if message['type'] != 'stream':
return True
if original_content.lower().strip() != 'help':
return False
return True
def handle_message(self, message, client):
help_content = '\n Info on Zulip can be found here:\n https://github.com/zulip/zulip\n '.strip()
client.send_message(dict(type='stream', to=message['display_recipient'], subject=message['subject'], content=help_content))
handler_class = HelpHandler |
'''
Given a string S, return the "reversed" string where all characters that are not a letter stay in the same place, and all letters reverse their positions.
Example 1:
Input: "ab-cd"
Output: "dc-ba"
Example 2:
Input: "a-bC-dEf-ghIj"
Output: "j-Ih-gfE-dCba"
Example 3:
Input: "Test1ng-Leet=code-Q!"
Output: "Qedo1ct-eeLg=ntse-T!"
Note:
S.length <= 100
33 <= S[i].ASCIIcode <= 122
S doesn't contain \ or "
'''
def reverseOnlyLetters(S):
l = ""
r = [None]*len(S)
# add not letters
for i, char in enumerate(S):
if char.isalpha():
l+=char
else:
r[i] = char
# print(l, r)
# add leters
j=len(l)-1
for i in range(len(r)):
if r[i] == None:
r[i] = l[j]
j-=1
# print("".join(r))
return("".join(r))
def reverseOnlyLetters2(S):
r = ['']*len(S)
i, j = len(S)-1, 0
while i >=0 and j < len(S):
if S[i].isalpha():
r[j] = S[i]
else:
while not S[j].isalpha():
j+=1
if j >=len(S):
j-=1
break
if j < len(S):
r[j] = S[i]
i-=1
j+=1
print("".join(r))
return "".join(r)
reverseOnlyLetters("21-a_bc1=")
| """
Given a string S, return the "reversed" string where all characters that are not a letter stay in the same place, and all letters reverse their positions.
Example 1:
Input: "ab-cd"
Output: "dc-ba"
Example 2:
Input: "a-bC-dEf-ghIj"
Output: "j-Ih-gfE-dCba"
Example 3:
Input: "Test1ng-Leet=code-Q!"
Output: "Qedo1ct-eeLg=ntse-T!"
Note:
S.length <= 100
33 <= S[i].ASCIIcode <= 122
S doesn't contain \\ or "
"""
def reverse_only_letters(S):
l = ''
r = [None] * len(S)
for (i, char) in enumerate(S):
if char.isalpha():
l += char
else:
r[i] = char
j = len(l) - 1
for i in range(len(r)):
if r[i] == None:
r[i] = l[j]
j -= 1
return ''.join(r)
def reverse_only_letters2(S):
r = [''] * len(S)
(i, j) = (len(S) - 1, 0)
while i >= 0 and j < len(S):
if S[i].isalpha():
r[j] = S[i]
else:
while not S[j].isalpha():
j += 1
if j >= len(S):
j -= 1
break
if j < len(S):
r[j] = S[i]
i -= 1
j += 1
print(''.join(r))
return ''.join(r)
reverse_only_letters('21-a_bc1=') |
#
# PySNMP MIB module NMS-EPON-ONU-SERIAL-PORT (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NMS-EPON-ONU-SERIAL-PORT
# Produced by pysmi-0.3.4 at Mon Apr 29 20:12:14 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, ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint", "SingleValueConstraint")
nmsEPONGroup, = mibBuilder.importSymbols("NMS-SMI", "nmsEPONGroup")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
iso, MibScalar, MibTable, MibTableRow, MibTableColumn, ModuleIdentity, Integer32, ObjectIdentity, IpAddress, Counter32, MibIdentifier, Bits, Unsigned32, TimeTicks, Counter64, NotificationType, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "iso", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ModuleIdentity", "Integer32", "ObjectIdentity", "IpAddress", "Counter32", "MibIdentifier", "Bits", "Unsigned32", "TimeTicks", "Counter64", "NotificationType", "Gauge32")
DisplayString, RowStatus, MacAddress, TruthValue, PhysAddress, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "RowStatus", "MacAddress", "TruthValue", "PhysAddress", "TextualConvention")
nmsEponOnuSerialPort = MibIdentifier((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27))
nmsEponOnuSerialPortTable = MibTable((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1), )
if mibBuilder.loadTexts: nmsEponOnuSerialPortTable.setStatus('mandatory')
nmsEponOnuSerialPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1), ).setIndexNames((0, "NMS-EPON-ONU-SERIAL-PORT", "llidIfIndex"), (0, "NMS-EPON-ONU-SERIAL-PORT", "onuSerialPortSeqNo"))
if mibBuilder.loadTexts: nmsEponOnuSerialPortEntry.setStatus('mandatory')
llidIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: llidIfIndex.setStatus('mandatory')
onuSerialPortSeqNo = MibTableColumn((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(224, 239))).setMaxAccess("readonly")
if mibBuilder.loadTexts: onuSerialPortSeqNo.setStatus('mandatory')
onuSerialPortSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(300, 115200))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: onuSerialPortSpeed.setStatus('mandatory')
onuSerialPortDataBits = MibTableColumn((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(5, 8))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: onuSerialPortDataBits.setStatus('mandatory')
onuSerialPortHaltBits = MibTableColumn((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: onuSerialPortHaltBits.setStatus('mandatory')
onuSerialPortParity = MibTableColumn((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("none", 0), ("odd", 1), ("even", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: onuSerialPortParity.setStatus('mandatory')
onuSerialPortFlowControl = MibTableColumn((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("none", 0), ("software", 1), ("hardware", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: onuSerialPortFlowControl.setStatus('mandatory')
onuSerialPortPropRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 8), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: onuSerialPortPropRowStatus.setStatus('mandatory')
onuSerialPortDataReadInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(10, 100000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: onuSerialPortDataReadInterval.setStatus('mandatory')
onuSerialPortDataReadBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(10, 1000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: onuSerialPortDataReadBytes.setStatus('mandatory')
onuSerialPortBufferRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 11), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: onuSerialPortBufferRowStatus.setStatus('mandatory')
onuSerialPortKeepaliveMode = MibTableColumn((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("disable", 0), ("enable", 1)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: onuSerialPortKeepaliveMode.setStatus('mandatory')
onuSerialPortKeepaliveIdle = MibTableColumn((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 10000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: onuSerialPortKeepaliveIdle.setStatus('mandatory')
onuSerialPortKeepaliveTimeout = MibTableColumn((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 10000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: onuSerialPortKeepaliveTimeout.setStatus('mandatory')
onuSerialPortKeepaliveProbeCount = MibTableColumn((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: onuSerialPortKeepaliveProbeCount.setStatus('mandatory')
onuSerialPortKeepaliveRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 16), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: onuSerialPortKeepaliveRowStatus.setStatus('mandatory')
onuSerialPortLoopback = MibTableColumn((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 17), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: onuSerialPortLoopback.setStatus('mandatory')
mibBuilder.exportSymbols("NMS-EPON-ONU-SERIAL-PORT", onuSerialPortDataReadInterval=onuSerialPortDataReadInterval, onuSerialPortDataReadBytes=onuSerialPortDataReadBytes, nmsEponOnuSerialPortEntry=nmsEponOnuSerialPortEntry, onuSerialPortHaltBits=onuSerialPortHaltBits, onuSerialPortBufferRowStatus=onuSerialPortBufferRowStatus, onuSerialPortDataBits=onuSerialPortDataBits, onuSerialPortSeqNo=onuSerialPortSeqNo, onuSerialPortLoopback=onuSerialPortLoopback, onuSerialPortKeepaliveTimeout=onuSerialPortKeepaliveTimeout, onuSerialPortKeepaliveMode=onuSerialPortKeepaliveMode, onuSerialPortParity=onuSerialPortParity, onuSerialPortPropRowStatus=onuSerialPortPropRowStatus, onuSerialPortKeepaliveProbeCount=onuSerialPortKeepaliveProbeCount, onuSerialPortKeepaliveIdle=onuSerialPortKeepaliveIdle, onuSerialPortSpeed=onuSerialPortSpeed, nmsEponOnuSerialPort=nmsEponOnuSerialPort, onuSerialPortFlowControl=onuSerialPortFlowControl, llidIfIndex=llidIfIndex, onuSerialPortKeepaliveRowStatus=onuSerialPortKeepaliveRowStatus, nmsEponOnuSerialPortTable=nmsEponOnuSerialPortTable)
| (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, constraints_union, value_range_constraint, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'ValueSizeConstraint', 'ConstraintsUnion', 'ValueRangeConstraint', 'SingleValueConstraint')
(nms_epon_group,) = mibBuilder.importSymbols('NMS-SMI', 'nmsEPONGroup')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(iso, mib_scalar, mib_table, mib_table_row, mib_table_column, module_identity, integer32, object_identity, ip_address, counter32, mib_identifier, bits, unsigned32, time_ticks, counter64, notification_type, gauge32) = mibBuilder.importSymbols('SNMPv2-SMI', 'iso', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ModuleIdentity', 'Integer32', 'ObjectIdentity', 'IpAddress', 'Counter32', 'MibIdentifier', 'Bits', 'Unsigned32', 'TimeTicks', 'Counter64', 'NotificationType', 'Gauge32')
(display_string, row_status, mac_address, truth_value, phys_address, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'RowStatus', 'MacAddress', 'TruthValue', 'PhysAddress', 'TextualConvention')
nms_epon_onu_serial_port = mib_identifier((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27))
nms_epon_onu_serial_port_table = mib_table((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1))
if mibBuilder.loadTexts:
nmsEponOnuSerialPortTable.setStatus('mandatory')
nms_epon_onu_serial_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1)).setIndexNames((0, 'NMS-EPON-ONU-SERIAL-PORT', 'llidIfIndex'), (0, 'NMS-EPON-ONU-SERIAL-PORT', 'onuSerialPortSeqNo'))
if mibBuilder.loadTexts:
nmsEponOnuSerialPortEntry.setStatus('mandatory')
llid_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
llidIfIndex.setStatus('mandatory')
onu_serial_port_seq_no = mib_table_column((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(224, 239))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
onuSerialPortSeqNo.setStatus('mandatory')
onu_serial_port_speed = mib_table_column((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(300, 115200))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
onuSerialPortSpeed.setStatus('mandatory')
onu_serial_port_data_bits = mib_table_column((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(5, 8))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
onuSerialPortDataBits.setStatus('mandatory')
onu_serial_port_halt_bits = mib_table_column((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(1, 2))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
onuSerialPortHaltBits.setStatus('mandatory')
onu_serial_port_parity = mib_table_column((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('none', 0), ('odd', 1), ('even', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
onuSerialPortParity.setStatus('mandatory')
onu_serial_port_flow_control = mib_table_column((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('none', 0), ('software', 1), ('hardware', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
onuSerialPortFlowControl.setStatus('mandatory')
onu_serial_port_prop_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 8), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
onuSerialPortPropRowStatus.setStatus('mandatory')
onu_serial_port_data_read_interval = mib_table_column((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 9), integer32().subtype(subtypeSpec=value_range_constraint(10, 100000))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
onuSerialPortDataReadInterval.setStatus('mandatory')
onu_serial_port_data_read_bytes = mib_table_column((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 10), integer32().subtype(subtypeSpec=value_range_constraint(10, 1000))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
onuSerialPortDataReadBytes.setStatus('mandatory')
onu_serial_port_buffer_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 11), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
onuSerialPortBufferRowStatus.setStatus('mandatory')
onu_serial_port_keepalive_mode = mib_table_column((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 12), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('disable', 0), ('enable', 1)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
onuSerialPortKeepaliveMode.setStatus('mandatory')
onu_serial_port_keepalive_idle = mib_table_column((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 13), integer32().subtype(subtypeSpec=value_range_constraint(1, 10000))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
onuSerialPortKeepaliveIdle.setStatus('mandatory')
onu_serial_port_keepalive_timeout = mib_table_column((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 14), integer32().subtype(subtypeSpec=value_range_constraint(1, 10000))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
onuSerialPortKeepaliveTimeout.setStatus('mandatory')
onu_serial_port_keepalive_probe_count = mib_table_column((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 15), integer32().subtype(subtypeSpec=value_range_constraint(1, 1000))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
onuSerialPortKeepaliveProbeCount.setStatus('mandatory')
onu_serial_port_keepalive_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 16), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
onuSerialPortKeepaliveRowStatus.setStatus('mandatory')
onu_serial_port_loopback = mib_table_column((1, 3, 6, 1, 4, 1, 11606, 10, 101, 27, 1, 1, 17), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
onuSerialPortLoopback.setStatus('mandatory')
mibBuilder.exportSymbols('NMS-EPON-ONU-SERIAL-PORT', onuSerialPortDataReadInterval=onuSerialPortDataReadInterval, onuSerialPortDataReadBytes=onuSerialPortDataReadBytes, nmsEponOnuSerialPortEntry=nmsEponOnuSerialPortEntry, onuSerialPortHaltBits=onuSerialPortHaltBits, onuSerialPortBufferRowStatus=onuSerialPortBufferRowStatus, onuSerialPortDataBits=onuSerialPortDataBits, onuSerialPortSeqNo=onuSerialPortSeqNo, onuSerialPortLoopback=onuSerialPortLoopback, onuSerialPortKeepaliveTimeout=onuSerialPortKeepaliveTimeout, onuSerialPortKeepaliveMode=onuSerialPortKeepaliveMode, onuSerialPortParity=onuSerialPortParity, onuSerialPortPropRowStatus=onuSerialPortPropRowStatus, onuSerialPortKeepaliveProbeCount=onuSerialPortKeepaliveProbeCount, onuSerialPortKeepaliveIdle=onuSerialPortKeepaliveIdle, onuSerialPortSpeed=onuSerialPortSpeed, nmsEponOnuSerialPort=nmsEponOnuSerialPort, onuSerialPortFlowControl=onuSerialPortFlowControl, llidIfIndex=llidIfIndex, onuSerialPortKeepaliveRowStatus=onuSerialPortKeepaliveRowStatus, nmsEponOnuSerialPortTable=nmsEponOnuSerialPortTable) |
# A simple color module I wrote for my projects
# Feel free to copy this script and use it for your own projects!
class Color:
purple = '\033[95m'
blue = '\033[94m'
green = '\033[92m'
yellow = '\033[93m'
red = '\033[91m'
white = '\033[0m'
class textType:
bold = '\033[1m'
underline = '\033[4m'
| class Color:
purple = '\x1b[95m'
blue = '\x1b[94m'
green = '\x1b[92m'
yellow = '\x1b[93m'
red = '\x1b[91m'
white = '\x1b[0m'
class Texttype:
bold = '\x1b[1m'
underline = '\x1b[4m' |
# LC 1268
class TrieNode:
def __init__(self):
self.next = dict()
self.words = list()
class Trie:
def __init__(self):
self.root = TrieNode()
def insert(self, word):
node = self.root
for char in word:
# node = node.next.setdefault(char, TrieNode())
if char not in node.next:
node.next[char] = TrieNode()
node = node.next[char]
if len(node.words) < 3:
node.words.append(word)
def getSuggestionsFor(self, word):
ans = []
node = self.root
for char in word:
if node:
node = node.next.get(char, None)
if node:
ans.append(node.words)
else:
ans.append([])
return ans
class Solution:
def suggestedProducts(self, products: List[str], searchWord: str) -> List[List[str]]:
products.sort()
trie = Trie()
for word in products:
trie.insert(word)
return trie.getSuggestionsFor(searchWord)
| class Trienode:
def __init__(self):
self.next = dict()
self.words = list()
class Trie:
def __init__(self):
self.root = trie_node()
def insert(self, word):
node = self.root
for char in word:
if char not in node.next:
node.next[char] = trie_node()
node = node.next[char]
if len(node.words) < 3:
node.words.append(word)
def get_suggestions_for(self, word):
ans = []
node = self.root
for char in word:
if node:
node = node.next.get(char, None)
if node:
ans.append(node.words)
else:
ans.append([])
return ans
class Solution:
def suggested_products(self, products: List[str], searchWord: str) -> List[List[str]]:
products.sort()
trie = trie()
for word in products:
trie.insert(word)
return trie.getSuggestionsFor(searchWord) |
x = int(input())
y = int(input())
print(y % x)
| x = int(input())
y = int(input())
print(y % x) |
class OutputBase:
def __init__(self):
self.output_buffer = []
def __call__(self, obj):
self.write(obj)
def write(self, obj):
pass
def clear(self):
self.output_buffer = []
| class Outputbase:
def __init__(self):
self.output_buffer = []
def __call__(self, obj):
self.write(obj)
def write(self, obj):
pass
def clear(self):
self.output_buffer = [] |
DEBUG = False
# if False, "0" will be used
ENABLE_STRING_SEEDING = True
# use headless evaluator
HEADLESS = False
# === Emulator ===
DEVICE_NUM = 1
AVD_BOOT_DELAY = 30
AVD_SERIES = "api19_"
EVAL_TIMEOUT = 120
# if run on Mac OS, use "gtimeout"
TIMEOUT_CMD = "timeout"
# === Env. Paths ===
# path should end with a '/'
ANDROID_HOME = '/home/shadeimi/Software/android-sdk-linux/'
# the path of sapienz folder
WORKING_DIR = '/home/shadeimi/Software/eclipseWorkspace/sapienz/'
# === GA parameters ===
SEQUENCE_LENGTH_MIN = 20
SEQUENCE_LENGTH_MAX = 500
SUITE_SIZE = 5
POPULATION_SIZE = 50
OFFSPRING_SIZE = 50
GENERATION = 100
# Crossover probability
CXPB = 0.7
# Mutation probability
MUTPB = 0.3
# === Only for main_multi ===
# start from the ith apk
APK_OFFSET = 0
APK_DIR = ""
REPEATED_RESULTS_DIR = ""
REPEATED_RUNS = 20
# === MOTIFCORE script ===
# for initial population
MOTIFCORE_SCRIPT_PATH = '/mnt/sdcard/motifcore.script'
# header for evolved scripts
MOTIFCORE_SCRIPT_HEADER = 'type= raw events\ncount= -1\nspeed= 1.0\nstart data >>\n'
| debug = False
enable_string_seeding = True
headless = False
device_num = 1
avd_boot_delay = 30
avd_series = 'api19_'
eval_timeout = 120
timeout_cmd = 'timeout'
android_home = '/home/shadeimi/Software/android-sdk-linux/'
working_dir = '/home/shadeimi/Software/eclipseWorkspace/sapienz/'
sequence_length_min = 20
sequence_length_max = 500
suite_size = 5
population_size = 50
offspring_size = 50
generation = 100
cxpb = 0.7
mutpb = 0.3
apk_offset = 0
apk_dir = ''
repeated_results_dir = ''
repeated_runs = 20
motifcore_script_path = '/mnt/sdcard/motifcore.script'
motifcore_script_header = 'type= raw events\ncount= -1\nspeed= 1.0\nstart data >>\n' |
class InvalidDataFrameException(Exception):
pass
class InvalidCheckTypeException(Exception):
pass
| class Invaliddataframeexception(Exception):
pass
class Invalidchecktypeexception(Exception):
pass |
#!/usr/bin/python
# vim: set ts=4:
# vim: set shiftwidth=4:
# vim: set expandtab:
#-------------------------------------------------------------------------------
#---> Elections supported
#-------------------------------------------------------------------------------
# election id - base_url - election type - year - has special polling stations tuples for each election
elections = [
('20150920', 'http://ekloges.ypes.gr/current', 'v', 2015, True),
('20150125', 'http://ekloges-prev.singularlogic.eu/v2015a', 'v', 2015, True),
('20150705', 'http://ekloges-prev.singularlogic.eu/r2015', 'e', 2015, True),
('20140525', 'http://ekloges-prev.singularlogic.eu/may2014', 'e', 2014, False),
('20120617', 'http://ekloges-prev.singularlogic.eu/v2012b', 'v', 2012, True),
('20120506', 'http://ekloges-prev.singularlogic.eu/v2012a', 'v', 2012, True)]
# chosen election
_ELECTION = 5
election_str = elections[_ELECTION][0]
base_url = elections[_ELECTION][1]
election_type = elections[_ELECTION][2]
year = elections[_ELECTION][3]
has_special = elections[_ELECTION][4]
#-------------------------------------------------------------------------------
#---> Json files urls
#-------------------------------------------------------------------------------
def get_url(lvl, idx, dynamic):
content_type = 'dyn' if dynamic else 'stat'
if year > 2012:
first_part = '{0}/{1}/{2}'.format(base_url, content_type, election_type)
else:
first_part = '{0}/{1}'.format(base_url, content_type)
if lvl == 'epik' or lvl == 'top':
return '{0}/{1}'.format(first_part, 'statics.js')
elif lvl == 'ep' or lvl == 'district':
return '{0}/ep_{1}.js'.format(first_part, idx)
elif lvl == 'den' or lvl == 'munical_unit':
return '{0}/den_{1}.js'.format(first_part, idx)
elif lvl == 'special':
return '{0}/special_{1}.js'.format(first_part, idx)
elif lvl == 'tm' or lvl == 'pstation':
if year > 2012:
return '{0}/{1}/tm_{2}.js'.format(first_part, int(idx / 10000), idx)
else:
return '{0}/tm_{1}.js'.format(first_part, idx)
else:
raise Exception
#-------------------------------------------------------------------------------
#---> Top level file structure
#-------------------------------------------------------------------------------
if election_type == 'v' and year >= 2015:
lvl_labels = ['epik', 'snom', 'ep', 'dhm', 'den']
lvl_structs = [['id', 'name', 'pstation_cnt', 'population'],
['id', 'name', 'pstation_cnt'],
['id', 'name', 'pstation_cnt', 'alt_id', 'mps', 'unknown'],
['id', 'name', 'pstation_cnt', 'upper_id'],
['id', 'name', 'pstation_cnt', 'upper_id']]
parties_label = 'party'
parties_struct = ['id', 'alt_id', 'name', 'colour', 'in_parliament']
elif election_type == 'v' and year >= 2012:
lvl_labels = ['epik', 'ep', 'dhm', 'den']
lvl_structs = [['id', 'name', 'pstation_cnt', 'population'],
['id', 'name', 'pstation_cnt', 'alt_id', 'mps'],
['id', 'name', 'pstation_cnt', 'upper_id'],
['id', 'name', 'pstation_cnt', 'upper_id']]
parties_label = 'party'
parties_struct = ['id', 'alt_id', 'name', 'colour']
elif election_type == 'e':
lvl_labels = ['epik', 'snom', 'ep', 'dhm', 'den']
lvl_structs = [['id', 'name', 'pstation_cnt', 'population', 'mps', 'unknown'],
['id', 'upper_id', 'name', 'pstation_cnt'],
['id', 'name', 'pstation_cnt', 'alt_id', 'upper_id'],
['id', 'name', 'pstation_cnt', 'upper_id'],
['id', 'name', 'pstation_cnt', 'upper_id']]
parties_label = 'party'
parties_struct = ['id', 'alt_id', 'name', 'colour', 'in_parliament']
#-------------------------------------------------------------------------------
#---> Translations
#-------------------------------------------------------------------------------
translations = dict([
('NumTm', 'pstation_cnt'),
('Gramenoi', 'registered'),
('Egkyra', 'valid'),
('Akyra', 'invalid'),
('Leyka', 'blank')])
#-------------------------------------------------------------------------------
#---> Top level access helpers
#-------------------------------------------------------------------------------
def get(data_lst, lvl, field):
structure = lvl_structs[lvl_labels.index(lvl)]
try:
idx = structure.index(field)
except:
if field == 'upper_id':
return -1
else:
raise ValueError
return data_lst[idx]
def get_parties_list(data):
return data[parties_label]
def get_party_field(data_lst, field):
idx = parties_struct.index(field)
return data_lst[idx]
def has_special_list():
if election_str == '20120506':
return False
return True
| elections = [('20150920', 'http://ekloges.ypes.gr/current', 'v', 2015, True), ('20150125', 'http://ekloges-prev.singularlogic.eu/v2015a', 'v', 2015, True), ('20150705', 'http://ekloges-prev.singularlogic.eu/r2015', 'e', 2015, True), ('20140525', 'http://ekloges-prev.singularlogic.eu/may2014', 'e', 2014, False), ('20120617', 'http://ekloges-prev.singularlogic.eu/v2012b', 'v', 2012, True), ('20120506', 'http://ekloges-prev.singularlogic.eu/v2012a', 'v', 2012, True)]
_election = 5
election_str = elections[_ELECTION][0]
base_url = elections[_ELECTION][1]
election_type = elections[_ELECTION][2]
year = elections[_ELECTION][3]
has_special = elections[_ELECTION][4]
def get_url(lvl, idx, dynamic):
content_type = 'dyn' if dynamic else 'stat'
if year > 2012:
first_part = '{0}/{1}/{2}'.format(base_url, content_type, election_type)
else:
first_part = '{0}/{1}'.format(base_url, content_type)
if lvl == 'epik' or lvl == 'top':
return '{0}/{1}'.format(first_part, 'statics.js')
elif lvl == 'ep' or lvl == 'district':
return '{0}/ep_{1}.js'.format(first_part, idx)
elif lvl == 'den' or lvl == 'munical_unit':
return '{0}/den_{1}.js'.format(first_part, idx)
elif lvl == 'special':
return '{0}/special_{1}.js'.format(first_part, idx)
elif lvl == 'tm' or lvl == 'pstation':
if year > 2012:
return '{0}/{1}/tm_{2}.js'.format(first_part, int(idx / 10000), idx)
else:
return '{0}/tm_{1}.js'.format(first_part, idx)
else:
raise Exception
if election_type == 'v' and year >= 2015:
lvl_labels = ['epik', 'snom', 'ep', 'dhm', 'den']
lvl_structs = [['id', 'name', 'pstation_cnt', 'population'], ['id', 'name', 'pstation_cnt'], ['id', 'name', 'pstation_cnt', 'alt_id', 'mps', 'unknown'], ['id', 'name', 'pstation_cnt', 'upper_id'], ['id', 'name', 'pstation_cnt', 'upper_id']]
parties_label = 'party'
parties_struct = ['id', 'alt_id', 'name', 'colour', 'in_parliament']
elif election_type == 'v' and year >= 2012:
lvl_labels = ['epik', 'ep', 'dhm', 'den']
lvl_structs = [['id', 'name', 'pstation_cnt', 'population'], ['id', 'name', 'pstation_cnt', 'alt_id', 'mps'], ['id', 'name', 'pstation_cnt', 'upper_id'], ['id', 'name', 'pstation_cnt', 'upper_id']]
parties_label = 'party'
parties_struct = ['id', 'alt_id', 'name', 'colour']
elif election_type == 'e':
lvl_labels = ['epik', 'snom', 'ep', 'dhm', 'den']
lvl_structs = [['id', 'name', 'pstation_cnt', 'population', 'mps', 'unknown'], ['id', 'upper_id', 'name', 'pstation_cnt'], ['id', 'name', 'pstation_cnt', 'alt_id', 'upper_id'], ['id', 'name', 'pstation_cnt', 'upper_id'], ['id', 'name', 'pstation_cnt', 'upper_id']]
parties_label = 'party'
parties_struct = ['id', 'alt_id', 'name', 'colour', 'in_parliament']
translations = dict([('NumTm', 'pstation_cnt'), ('Gramenoi', 'registered'), ('Egkyra', 'valid'), ('Akyra', 'invalid'), ('Leyka', 'blank')])
def get(data_lst, lvl, field):
structure = lvl_structs[lvl_labels.index(lvl)]
try:
idx = structure.index(field)
except:
if field == 'upper_id':
return -1
else:
raise ValueError
return data_lst[idx]
def get_parties_list(data):
return data[parties_label]
def get_party_field(data_lst, field):
idx = parties_struct.index(field)
return data_lst[idx]
def has_special_list():
if election_str == '20120506':
return False
return True |
def ortho_locs(row, col):
offsets = [(-1,0), (0,-1), (0,1), (1,0)]
for row_offset, col_offset in offsets:
yield row + row_offset, col + col_offset
def adj_locs(row, col):
offsets = [(-1,-1), (-1,0), (-1,1), (0,-1), (0,1), (1,-1), (1,0), (1,1)]
for row_offset, col_offset in offsets:
yield row + row_offset, col + col_offset
class Grid:
def __init__(self, grid):
self.grid = grid
self.rows = len(grid)
self.cols = len(grid[0])
def __getitem__(self, row):
return self.grid[row]
def __iter__(self):
return self.grid.__iter__()
def valid_loc(self, row, col):
return row >= 0 and row < self.rows and col >= 0 and col < self.cols
def ortho_locs(self, row, col):
for ortho_row, ortho_col in ortho_locs(row, col):
if self.valid_loc(ortho_row, ortho_col):
yield ortho_row, ortho_col
def adj_locs(self, row, col):
for adj_row, adj_col in adj_locs(row, col):
if self.valid_loc(adj_row, adj_col):
yield adj_row, adj_col
def make_mirror(self, value):
return [[value for _ in row] for row in self.grid]
def build_grid(rows, cols, value):
return Grid([[value for _ in range(cols)] for _ in range(rows)])
def print_grid(grid, formatter=lambda v: v):
for row in grid:
for col in row:
print(formatter(col), end="")
print("")
| def ortho_locs(row, col):
offsets = [(-1, 0), (0, -1), (0, 1), (1, 0)]
for (row_offset, col_offset) in offsets:
yield (row + row_offset, col + col_offset)
def adj_locs(row, col):
offsets = [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)]
for (row_offset, col_offset) in offsets:
yield (row + row_offset, col + col_offset)
class Grid:
def __init__(self, grid):
self.grid = grid
self.rows = len(grid)
self.cols = len(grid[0])
def __getitem__(self, row):
return self.grid[row]
def __iter__(self):
return self.grid.__iter__()
def valid_loc(self, row, col):
return row >= 0 and row < self.rows and (col >= 0) and (col < self.cols)
def ortho_locs(self, row, col):
for (ortho_row, ortho_col) in ortho_locs(row, col):
if self.valid_loc(ortho_row, ortho_col):
yield (ortho_row, ortho_col)
def adj_locs(self, row, col):
for (adj_row, adj_col) in adj_locs(row, col):
if self.valid_loc(adj_row, adj_col):
yield (adj_row, adj_col)
def make_mirror(self, value):
return [[value for _ in row] for row in self.grid]
def build_grid(rows, cols, value):
return grid([[value for _ in range(cols)] for _ in range(rows)])
def print_grid(grid, formatter=lambda v: v):
for row in grid:
for col in row:
print(formatter(col), end='')
print('') |
def GetByTitle(type, title):
type = type.upper()
if type != 'ANIME' and type != 'MANGA':
return False
variables = {
'type' : type,
'search' : title
}
return variables | def get_by_title(type, title):
type = type.upper()
if type != 'ANIME' and type != 'MANGA':
return False
variables = {'type': type, 'search': title}
return variables |
def queryValue(cur, sql, fields=None, error=None) :
row = queryRow(cur, sql, fields, error);
if row is None : return None
return row[0]
def queryRow(cur, sql, fields=None, error=None) :
row = doQuery(cur, sql, fields)
try:
row = cur.fetchone()
return row
except Exception as e:
if error:
print(error, e)
else :
print(e)
return None
def doQuery(cur, sql, fields=None) :
row = cur.execute(sql, fields)
return row
| def query_value(cur, sql, fields=None, error=None):
row = query_row(cur, sql, fields, error)
if row is None:
return None
return row[0]
def query_row(cur, sql, fields=None, error=None):
row = do_query(cur, sql, fields)
try:
row = cur.fetchone()
return row
except Exception as e:
if error:
print(error, e)
else:
print(e)
return None
def do_query(cur, sql, fields=None):
row = cur.execute(sql, fields)
return row |
HEADERS_FOR_HTTP_GET = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'
}
AGE_CATEGORIES = [
'JM10', 'JW10',
'JM11-14', 'JW11-14',
'JM15-17', 'JW15-17',
'SM18-19', 'SW18-19',
'SM20-24', 'SW20-24',
'SM25-29', 'SW25-29',
'SM30-34', 'SW30-34',
'VM35-39', 'VW35-39',
'VM40-44', 'VW40-44',
'VM45-49', 'VW45-49',
'VM50-54', 'VW50-54',
'VM55-59', 'VW55-59',
'VM60-64', 'VW60-64',
'VM65-69', 'VW65-69',
'VM70-74', 'VW70-74',
'VM75-79', 'VW75-79',
'VM---', 'VW---'
] | headers_for_http_get = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
age_categories = ['JM10', 'JW10', 'JM11-14', 'JW11-14', 'JM15-17', 'JW15-17', 'SM18-19', 'SW18-19', 'SM20-24', 'SW20-24', 'SM25-29', 'SW25-29', 'SM30-34', 'SW30-34', 'VM35-39', 'VW35-39', 'VM40-44', 'VW40-44', 'VM45-49', 'VW45-49', 'VM50-54', 'VW50-54', 'VM55-59', 'VW55-59', 'VM60-64', 'VW60-64', 'VM65-69', 'VW65-69', 'VM70-74', 'VW70-74', 'VM75-79', 'VW75-79', 'VM---', 'VW---'] |
#
# PySNMP MIB module MICOM-IFDNA-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MICOM-IFDNA-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:02:03 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "SingleValueConstraint", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsIntersection")
micom_oscar, = mibBuilder.importSymbols("MICOM-OSCAR-MIB", "micom-oscar")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Counter64, NotificationType, iso, Bits, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, IpAddress, Unsigned32, TimeTicks, Integer32, MibIdentifier, Gauge32, ModuleIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "NotificationType", "iso", "Bits", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "IpAddress", "Unsigned32", "TimeTicks", "Integer32", "MibIdentifier", "Gauge32", "ModuleIdentity")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
micom_ifdna = MibIdentifier((1, 3, 6, 1, 4, 1, 335, 1, 4, 18)).setLabel("micom-ifdna")
ifDna = MibIdentifier((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 1))
ifNvDna = MibIdentifier((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 2))
mcmIfDnaTable = MibTable((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 1, 1), )
if mibBuilder.loadTexts: mcmIfDnaTable.setStatus('mandatory')
mcmIfDnaEntry = MibTableRow((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 1, 1, 1), ).setIndexNames((0, "MICOM-IFDNA-MIB", "mcmIfDnaIfIndex"), (0, "MICOM-IFDNA-MIB", "mcmIfDnaType"))
if mibBuilder.loadTexts: mcmIfDnaEntry.setStatus('mandatory')
mcmIfDnaIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mcmIfDnaIfIndex.setStatus('mandatory')
mcmIfDnaType = MibTableColumn((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("provisioned", 1), ("learnt", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mcmIfDnaType.setStatus('mandatory')
mcmIfDNADigits = MibTableColumn((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 1, 1, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 34))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: mcmIfDNADigits.setStatus('mandatory')
mcmIfDnaStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("valid", 1), ("active", 2), ("invalid", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: mcmIfDnaStatus.setStatus('mandatory')
nvmIfDnaTable = MibTable((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 2, 1), )
if mibBuilder.loadTexts: nvmIfDnaTable.setStatus('mandatory')
nvmIfDnaEntry = MibTableRow((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 2, 1, 1), ).setIndexNames((0, "MICOM-IFDNA-MIB", "nvmIfDnaIfIndex"), (0, "MICOM-IFDNA-MIB", "nvmIfDnaType"))
if mibBuilder.loadTexts: nvmIfDnaEntry.setStatus('mandatory')
nvmIfDnaIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nvmIfDnaIfIndex.setStatus('mandatory')
nvmIfDnaType = MibTableColumn((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("provisioned", 1), ("learnt", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nvmIfDnaType.setStatus('mandatory')
nvmIfDNADigits = MibTableColumn((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 2, 1, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 34))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nvmIfDNADigits.setStatus('mandatory')
nvmIfDnaStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 2, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("valid", 1), ("active", 2), ("invalid", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nvmIfDnaStatus.setStatus('mandatory')
mibBuilder.exportSymbols("MICOM-IFDNA-MIB", nvmIfDnaStatus=nvmIfDnaStatus, mcmIfDnaType=mcmIfDnaType, mcmIfDnaTable=mcmIfDnaTable, mcmIfDnaEntry=mcmIfDnaEntry, micom_ifdna=micom_ifdna, mcmIfDnaIfIndex=mcmIfDnaIfIndex, ifNvDna=ifNvDna, mcmIfDnaStatus=mcmIfDnaStatus, nvmIfDnaTable=nvmIfDnaTable, nvmIfDnaEntry=nvmIfDnaEntry, ifDna=ifDna, nvmIfDnaType=nvmIfDnaType, nvmIfDNADigits=nvmIfDNADigits, mcmIfDNADigits=mcmIfDNADigits, nvmIfDnaIfIndex=nvmIfDnaIfIndex)
| (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'SingleValueConstraint', 'ValueRangeConstraint', 'ValueSizeConstraint', 'ConstraintsIntersection')
(micom_oscar,) = mibBuilder.importSymbols('MICOM-OSCAR-MIB', 'micom-oscar')
(notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance')
(counter64, notification_type, iso, bits, counter32, mib_scalar, mib_table, mib_table_row, mib_table_column, object_identity, ip_address, unsigned32, time_ticks, integer32, mib_identifier, gauge32, module_identity) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter64', 'NotificationType', 'iso', 'Bits', 'Counter32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ObjectIdentity', 'IpAddress', 'Unsigned32', 'TimeTicks', 'Integer32', 'MibIdentifier', 'Gauge32', 'ModuleIdentity')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
micom_ifdna = mib_identifier((1, 3, 6, 1, 4, 1, 335, 1, 4, 18)).setLabel('micom-ifdna')
if_dna = mib_identifier((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 1))
if_nv_dna = mib_identifier((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 2))
mcm_if_dna_table = mib_table((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 1, 1))
if mibBuilder.loadTexts:
mcmIfDnaTable.setStatus('mandatory')
mcm_if_dna_entry = mib_table_row((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 1, 1, 1)).setIndexNames((0, 'MICOM-IFDNA-MIB', 'mcmIfDnaIfIndex'), (0, 'MICOM-IFDNA-MIB', 'mcmIfDnaType'))
if mibBuilder.loadTexts:
mcmIfDnaEntry.setStatus('mandatory')
mcm_if_dna_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 1, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 255))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mcmIfDnaIfIndex.setStatus('mandatory')
mcm_if_dna_type = mib_table_column((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 1, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('provisioned', 1), ('learnt', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mcmIfDnaType.setStatus('mandatory')
mcm_if_dna_digits = mib_table_column((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 1, 1, 1, 3), display_string().subtype(subtypeSpec=value_size_constraint(1, 34))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
mcmIfDNADigits.setStatus('mandatory')
mcm_if_dna_status = mib_table_column((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 1, 1, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('valid', 1), ('active', 2), ('invalid', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
mcmIfDnaStatus.setStatus('mandatory')
nvm_if_dna_table = mib_table((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 2, 1))
if mibBuilder.loadTexts:
nvmIfDnaTable.setStatus('mandatory')
nvm_if_dna_entry = mib_table_row((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 2, 1, 1)).setIndexNames((0, 'MICOM-IFDNA-MIB', 'nvmIfDnaIfIndex'), (0, 'MICOM-IFDNA-MIB', 'nvmIfDnaType'))
if mibBuilder.loadTexts:
nvmIfDnaEntry.setStatus('mandatory')
nvm_if_dna_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 2, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 255))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
nvmIfDnaIfIndex.setStatus('mandatory')
nvm_if_dna_type = mib_table_column((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 2, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('provisioned', 1), ('learnt', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
nvmIfDnaType.setStatus('mandatory')
nvm_if_dna_digits = mib_table_column((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 2, 1, 1, 3), display_string().subtype(subtypeSpec=value_size_constraint(1, 34))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
nvmIfDNADigits.setStatus('mandatory')
nvm_if_dna_status = mib_table_column((1, 3, 6, 1, 4, 1, 335, 1, 4, 18, 2, 1, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('valid', 1), ('active', 2), ('invalid', 3)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
nvmIfDnaStatus.setStatus('mandatory')
mibBuilder.exportSymbols('MICOM-IFDNA-MIB', nvmIfDnaStatus=nvmIfDnaStatus, mcmIfDnaType=mcmIfDnaType, mcmIfDnaTable=mcmIfDnaTable, mcmIfDnaEntry=mcmIfDnaEntry, micom_ifdna=micom_ifdna, mcmIfDnaIfIndex=mcmIfDnaIfIndex, ifNvDna=ifNvDna, mcmIfDnaStatus=mcmIfDnaStatus, nvmIfDnaTable=nvmIfDnaTable, nvmIfDnaEntry=nvmIfDnaEntry, ifDna=ifDna, nvmIfDnaType=nvmIfDnaType, nvmIfDNADigits=nvmIfDNADigits, mcmIfDNADigits=mcmIfDNADigits, nvmIfDnaIfIndex=nvmIfDnaIfIndex) |
a = 5
b = 3
def timeit_1():
print(a + b)
c = 8
def timeit_2():
print(a + b + c)
| a = 5
b = 3
def timeit_1():
print(a + b)
c = 8
def timeit_2():
print(a + b + c) |
def some_but_not_all(seq, pred):
has = [False,False]
for it in seq:
has[bool(pred(it))] = True
# exit as fast as possible
if all(has):
return True
# sequennce is scanned with only True or False predictions.
return False | def some_but_not_all(seq, pred):
has = [False, False]
for it in seq:
has[bool(pred(it))] = True
if all(has):
return True
return False |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
''' A short description of this file
A slightly longer description of this file
can be found under the shorter desription.
'''
def get_code():
''' Get mysterious code... '''
return '100111011111101010110110101100'
| """ A short description of this file
A slightly longer description of this file
can be found under the shorter desription.
"""
def get_code():
""" Get mysterious code... """
return '100111011111101010110110101100' |
class StdoutMock():
def __init__(self, *args, **kwargs):
self.content = ''
def write(self, content):
self.content += content
def read(self):
return self.content
def __str__(self):
return self.read()
| class Stdoutmock:
def __init__(self, *args, **kwargs):
self.content = ''
def write(self, content):
self.content += content
def read(self):
return self.content
def __str__(self):
return self.read() |
def flatten(list):
final = []
for item in list:
final += item
return final
def flattenN(list):
if type(list[0]) != type([]):
return list
return flattenN(flatten(list))
list = [[[1,2],[3,4]],[[3,4],["hello","there"]]]
result = flattenN(list)
print(result)
| def flatten(list):
final = []
for item in list:
final += item
return final
def flatten_n(list):
if type(list[0]) != type([]):
return list
return flatten_n(flatten(list))
list = [[[1, 2], [3, 4]], [[3, 4], ['hello', 'there']]]
result = flatten_n(list)
print(result) |
def imp_notas(quantidade, valor):
return '{:.0f} nota(s) de R$ {:.2f}'.format(quantidade, valor)
def imp_moedas(quantidade, valor):
return '{:.0f} moeda(s) de R$ {:.2f}'.format(quantidade, valor)
numero = float(input())
numero += 0.0001
if numero >= 0 or numero <= 1000000.00:
notas = [100.00, 50.00, 20.00, 10.00, 5.00, 2.00]
moedas = [1.00, 0.50, 0.25, 0.10, 0.05, 0.01]
dcp_notas = []
dcp_moedas = []
for nota in notas:
dcp_notas.append( (numero // nota) )
numero = numero - ( ( numero // nota ) * nota )
for moeda in moedas:
dcp_moedas.append( (numero // moeda) )
numero = numero - ( ( numero // moeda ) * moeda )
print('NOTAS:')
for i in range(6):
print(imp_notas(dcp_notas[i], notas[i]))
print('MOEDAS:')
for i in range(6):
print(imp_moedas(dcp_moedas[i], moedas[i]))
| def imp_notas(quantidade, valor):
return '{:.0f} nota(s) de R$ {:.2f}'.format(quantidade, valor)
def imp_moedas(quantidade, valor):
return '{:.0f} moeda(s) de R$ {:.2f}'.format(quantidade, valor)
numero = float(input())
numero += 0.0001
if numero >= 0 or numero <= 1000000.0:
notas = [100.0, 50.0, 20.0, 10.0, 5.0, 2.0]
moedas = [1.0, 0.5, 0.25, 0.1, 0.05, 0.01]
dcp_notas = []
dcp_moedas = []
for nota in notas:
dcp_notas.append(numero // nota)
numero = numero - numero // nota * nota
for moeda in moedas:
dcp_moedas.append(numero // moeda)
numero = numero - numero // moeda * moeda
print('NOTAS:')
for i in range(6):
print(imp_notas(dcp_notas[i], notas[i]))
print('MOEDAS:')
for i in range(6):
print(imp_moedas(dcp_moedas[i], moedas[i])) |
class Wizard:
def __init__(self, app):
self.app = app
def skip_wizard(self):
driver = self.app.driver
driver.find_element_by_class_name("skip").click()
| class Wizard:
def __init__(self, app):
self.app = app
def skip_wizard(self):
driver = self.app.driver
driver.find_element_by_class_name('skip').click() |
def linked_sort(a_to_sort, a_linked, key=str):
res = sorted(zip(a_to_sort, a_linked), key=key)
for i in range(len(a_to_sort)):
a_to_sort[i], a_linked[i] = res[i]
return a_to_sort | def linked_sort(a_to_sort, a_linked, key=str):
res = sorted(zip(a_to_sort, a_linked), key=key)
for i in range(len(a_to_sort)):
(a_to_sort[i], a_linked[i]) = res[i]
return a_to_sort |
# -*- coding: utf-8 -*-
# :copyright: (c) 2011 - 2015 by Arezqui Belaid.
# :license: MPL 2.0, see COPYING for more details.
__version__ = '1.0.3'
__author__ = "Arezqui Belaid"
__contact__ = "info@star2billing.com"
__homepage__ = "http://www.star2billing.org"
__docformat__ = "restructuredtext"
| __version__ = '1.0.3'
__author__ = 'Arezqui Belaid'
__contact__ = 'info@star2billing.com'
__homepage__ = 'http://www.star2billing.org'
__docformat__ = 'restructuredtext' |
def print_stats(num_broke, num_profitors, sample_size, profits, loses, type):
broke_percent = (num_broke / sample_size) * 100
profit_percent = (num_profitors / sample_size) * 100
try:
survive_profit_percent = (num_profitors / (sample_size - num_broke)) * 100
except ZeroDivisionError:
survive_profit_percent = 0
try:
avg_profit = sum(profits) / len(profits)
except ZeroDivisionError:
avg_profit = 0
try:
avg_loses = sum(loses) / len(loses)
except ZeroDivisionError:
avg_loses = 0
print(f'\n{type} Percentage Broke: {broke_percent}%')
print(f'{type} Percentage Profited: {profit_percent}%')
print(f'{type} Percentage Survivors Profited: {survive_profit_percent}%')
print(f'{type} Avergage Profit: {avg_profit}')
print(f'{type} Avergage Loses: {avg_loses}')
print(f' {type} Expected Profit: {avg_profit * (profit_percent/ 100)}')
print(f' {type} Expected Loss: {avg_loses * (1 - (profit_percent / 100))}')
| def print_stats(num_broke, num_profitors, sample_size, profits, loses, type):
broke_percent = num_broke / sample_size * 100
profit_percent = num_profitors / sample_size * 100
try:
survive_profit_percent = num_profitors / (sample_size - num_broke) * 100
except ZeroDivisionError:
survive_profit_percent = 0
try:
avg_profit = sum(profits) / len(profits)
except ZeroDivisionError:
avg_profit = 0
try:
avg_loses = sum(loses) / len(loses)
except ZeroDivisionError:
avg_loses = 0
print(f'\n{type} Percentage Broke: {broke_percent}%')
print(f'{type} Percentage Profited: {profit_percent}%')
print(f'{type} Percentage Survivors Profited: {survive_profit_percent}%')
print(f'{type} Avergage Profit: {avg_profit}')
print(f'{type} Avergage Loses: {avg_loses}')
print(f' {type} Expected Profit: {avg_profit * (profit_percent / 100)}')
print(f' {type} Expected Loss: {avg_loses * (1 - profit_percent / 100)}') |
class Similarity:
def __init__(self, path, score):
self.path = path
self.score = score
@classmethod
def from_dict(cls, adict):
return cls(
path=adict['path'],
score=adict['score'],
)
def to_dict(self):
return {
'path': self.path,
'score': self.score
}
def __eq__(self, other):
return self.to_dict() == other.to_dict()
| class Similarity:
def __init__(self, path, score):
self.path = path
self.score = score
@classmethod
def from_dict(cls, adict):
return cls(path=adict['path'], score=adict['score'])
def to_dict(self):
return {'path': self.path, 'score': self.score}
def __eq__(self, other):
return self.to_dict() == other.to_dict() |
EFFICIENTDET = {
'efficientdet-d0': {'input_size': 512,
'backbone': 'B0',
'W_bifpn': 64,
'D_bifpn': 2,
'D_class': 3},
'efficientdet-d1': {'input_size': 640,
'backbone': 'B1',
'W_bifpn': 88,
'D_bifpn': 3,
'D_class': 3},
'efficientdet-d2': {'input_size': 768,
'backbone': 'B2',
'W_bifpn': 112,
'D_bifpn': 4,
'D_class': 3},
'efficientdet-d3': {'input_size': 896,
'backbone': 'B3',
'W_bifpn': 160,
'D_bifpn': 5,
'D_class': 4},
'efficientdet-d4': {'input_size': 1024,
'backbone': 'B4',
'W_bifpn': 224,
'D_bifpn': 6,
'D_class': 4},
'efficientdet-d5': {'input_size': 1280,
'backbone': 'B5',
'W_bifpn': 288,
'D_bifpn': 7,
'D_class': 4},
'efficientdet-d6': {'input_size': 1408,
'backbone': 'B6',
'W_bifpn': 384,
'D_bifpn': 8,
'D_class': 5},
'efficientdet-d7': {'input_size': 1636,
'backbone': 'B6',
'W_bifpn': 384,
'D_bifpn': 8,
'D_class': 5},
} | efficientdet = {'efficientdet-d0': {'input_size': 512, 'backbone': 'B0', 'W_bifpn': 64, 'D_bifpn': 2, 'D_class': 3}, 'efficientdet-d1': {'input_size': 640, 'backbone': 'B1', 'W_bifpn': 88, 'D_bifpn': 3, 'D_class': 3}, 'efficientdet-d2': {'input_size': 768, 'backbone': 'B2', 'W_bifpn': 112, 'D_bifpn': 4, 'D_class': 3}, 'efficientdet-d3': {'input_size': 896, 'backbone': 'B3', 'W_bifpn': 160, 'D_bifpn': 5, 'D_class': 4}, 'efficientdet-d4': {'input_size': 1024, 'backbone': 'B4', 'W_bifpn': 224, 'D_bifpn': 6, 'D_class': 4}, 'efficientdet-d5': {'input_size': 1280, 'backbone': 'B5', 'W_bifpn': 288, 'D_bifpn': 7, 'D_class': 4}, 'efficientdet-d6': {'input_size': 1408, 'backbone': 'B6', 'W_bifpn': 384, 'D_bifpn': 8, 'D_class': 5}, 'efficientdet-d7': {'input_size': 1636, 'backbone': 'B6', 'W_bifpn': 384, 'D_bifpn': 8, 'D_class': 5}} |
month = int(input("Enter month: "))
year = int(input("Enter year: "))
if month == 1:
monthName = "January"
numberOfDaysInMonth = 31
elif month == 2:
monthName = "February"
if year % 400 == 0 or (year % 4 == 0 and year % 100 != 0):
numberOfDaysInMonth = 29
else:
numberOfDaysInMonth = 28
elif month == 3:
monthName = "March"
numberOfDaysInMonth = 31
elif month == 4:
monthName = "April"
numberOfDaysInMonth = 30
elif month == 5:
monthName = "May"
numberOfDaysInMonth = 31
elif month == 6:
monthName = "June"
numberOfDaysInMonth = 30
elif month == 7:
monthName = "July"
numberOfDaysInMonth = 31
elif month == 8:
monthName = "August"
numberOfDaysInMonth = 31
elif month == 9:
monthName = "September"
numberOfDaysInMonth = 30
elif month == 10:
monthName = "October"
numberOfDaysInMonth = 31
elif month == 11:
monthName = "November"
numberOfDaysInMonth = 30
else:
monthName = "December"
numberOfDaysInMonth = 31
print(monthName, year, "has", numberOfDaysInMonth, "days")
| month = int(input('Enter month: '))
year = int(input('Enter year: '))
if month == 1:
month_name = 'January'
number_of_days_in_month = 31
elif month == 2:
month_name = 'February'
if year % 400 == 0 or (year % 4 == 0 and year % 100 != 0):
number_of_days_in_month = 29
else:
number_of_days_in_month = 28
elif month == 3:
month_name = 'March'
number_of_days_in_month = 31
elif month == 4:
month_name = 'April'
number_of_days_in_month = 30
elif month == 5:
month_name = 'May'
number_of_days_in_month = 31
elif month == 6:
month_name = 'June'
number_of_days_in_month = 30
elif month == 7:
month_name = 'July'
number_of_days_in_month = 31
elif month == 8:
month_name = 'August'
number_of_days_in_month = 31
elif month == 9:
month_name = 'September'
number_of_days_in_month = 30
elif month == 10:
month_name = 'October'
number_of_days_in_month = 31
elif month == 11:
month_name = 'November'
number_of_days_in_month = 30
else:
month_name = 'December'
number_of_days_in_month = 31
print(monthName, year, 'has', numberOfDaysInMonth, 'days') |
# Problem: Given as an input two strings, X = x_{1} x_{2}... x_{m}, and Y = y_{1} y_{2}... y_{m}, output the alignment of the strings, character by character,
# so that the net penalty is minimised.
gap_penalty = 3 # cost of gap
mismatch_penalty = 2 # cost of mismatch
memoScore = {}
memoSequence = {}
def sequenceAlignment(seq1, seq2):
if (seq1,seq2) in memoScore:return memoScore[(seq1,seq2)] # memoization
if seq1 == "" and seq2 == "" : # base case
memoSequence[(seq1,seq2)] = ["",""]
return 0
elif seq1 == "" or seq2== "" :
maxim = max(len(seq1),len(seq2))
memoSequence[(seq1,seq2)] = [seq1.ljust(maxim,"_"), seq2.ljust(maxim,"_")]
return gap_penalty*maxim
penalty = 0 if seq1[0] == seq2[0] else mismatch_penalty
nogap = sequenceAlignment( seq1[1:],seq2[1:] ) + penalty # cost of match/mistmatch
seq1gap = sequenceAlignment( seq1,seq2[1:] ) + gap_penalty # cost of gap in sequence 1
seq2gap = sequenceAlignment( seq1[1:],seq2 ) + gap_penalty # cost of gap in sequence 2
if seq1gap < nogap and seq1gap <= seq2gap:
result = seq1gap
newSeq1 = "_" + memoSequence[(seq1,seq2[1:])][0]
newSeq2 = seq2[0] + memoSequence[(seq1,seq2[1:])][1]
elif seq2gap < nogap and seq2gap <= seq1gap:
result = seq2gap
newSeq1 = seq1[0] + memoSequence[(seq1[1:],seq2)][0]
newSeq2 = "_" + memoSequence[(seq1[1:],seq2)][1]
else:
result = nogap
newSeq1 = seq1[0] + memoSequence[(seq1[1:],seq2[1:])][0]
newSeq2 = seq2[0] + memoSequence[(seq1[1:],seq2[1:])][1]
memoScore[(seq1,seq2)] = result
memoSequence[(seq1,seq2)] = [newSeq1,newSeq2]
return result
# Testing
sequence1 = "AGGGCT"
sequence2 = "AGGCA"
sequenceAlignment(sequence1,sequence2)
finalsequence = memoSequence[(sequence1,sequence2)]
print("First sequence : ", finalsequence[0])
print("Second sequence : ", finalsequence[1])
print("Min penalty : ",memoScore[(sequence1,sequence2)] )
| gap_penalty = 3
mismatch_penalty = 2
memo_score = {}
memo_sequence = {}
def sequence_alignment(seq1, seq2):
if (seq1, seq2) in memoScore:
return memoScore[seq1, seq2]
if seq1 == '' and seq2 == '':
memoSequence[seq1, seq2] = ['', '']
return 0
elif seq1 == '' or seq2 == '':
maxim = max(len(seq1), len(seq2))
memoSequence[seq1, seq2] = [seq1.ljust(maxim, '_'), seq2.ljust(maxim, '_')]
return gap_penalty * maxim
penalty = 0 if seq1[0] == seq2[0] else mismatch_penalty
nogap = sequence_alignment(seq1[1:], seq2[1:]) + penalty
seq1gap = sequence_alignment(seq1, seq2[1:]) + gap_penalty
seq2gap = sequence_alignment(seq1[1:], seq2) + gap_penalty
if seq1gap < nogap and seq1gap <= seq2gap:
result = seq1gap
new_seq1 = '_' + memoSequence[seq1, seq2[1:]][0]
new_seq2 = seq2[0] + memoSequence[seq1, seq2[1:]][1]
elif seq2gap < nogap and seq2gap <= seq1gap:
result = seq2gap
new_seq1 = seq1[0] + memoSequence[seq1[1:], seq2][0]
new_seq2 = '_' + memoSequence[seq1[1:], seq2][1]
else:
result = nogap
new_seq1 = seq1[0] + memoSequence[seq1[1:], seq2[1:]][0]
new_seq2 = seq2[0] + memoSequence[seq1[1:], seq2[1:]][1]
memoScore[seq1, seq2] = result
memoSequence[seq1, seq2] = [newSeq1, newSeq2]
return result
sequence1 = 'AGGGCT'
sequence2 = 'AGGCA'
sequence_alignment(sequence1, sequence2)
finalsequence = memoSequence[sequence1, sequence2]
print('First sequence : ', finalsequence[0])
print('Second sequence : ', finalsequence[1])
print('Min penalty : ', memoScore[sequence1, sequence2]) |
A = int(input())
B = set("aeiou")
for i in range(A):
S = input()
count = 0
for j in range(len(S)):
if S[j] in B:
count += 1
print(count)
| a = int(input())
b = set('aeiou')
for i in range(A):
s = input()
count = 0
for j in range(len(S)):
if S[j] in B:
count += 1
print(count) |
# Configuration for running the Avalon Music Server under Gunicorn
# http://docs.gunicorn.org
# Note that this configuration omits a bunch of features that Gunicorn
# has (such as running as a daemon, changing users, error and access
# logging) because it is designed to be used when running Gunicorn
# with supervisord and a separate public facing web server (such as
# Nginx).
# Bind the server to an address only accessible locally. We'll be
# running Nginx which will proxy to Gunicorn and act as the public-
# facing web server.
bind = 'localhost:8000'
# Use three workers in addition to the master process. Since the Avalon
# Music Server is largely CPU bound, you can increase the number of
# request that can be handled by increasing this number (up to a point!).
# The Gunicorn docs recommend 2N + 1 where N is the number of CPUs you
# have.
workers = 3
# Make sure to load the application only in the main process before
# spawning the worker processes. This will save us memory when using
# multiple worker processes since the OS will be be able to take advantage
# of copy-on-write optimizations.
preload_app = True
| bind = 'localhost:8000'
workers = 3
preload_app = True |
#check if number is prime or not
n = int(input("enter a number "))
for i in range(2, n):
if n % i == 0:
print("not a prime number")
break
else:
print("it is a prime number") | n = int(input('enter a number '))
for i in range(2, n):
if n % i == 0:
print('not a prime number')
break
else:
print('it is a prime number') |
#
# PySNMP MIB module EXTREME-EAPS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EXTREME-BASE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:07:14 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")
ValueRangeConstraint, ValueSizeConstraint, ConstraintsUnion, SingleValueConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ConstraintsIntersection")
extremeAgent, = mibBuilder.importSymbols("EXTREME-BASE-MIB", "extremeAgent")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
Counter64, IpAddress, Integer32, Gauge32, Counter32, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, iso, NotificationType, ModuleIdentity, ObjectIdentity, TimeTicks, Bits, Unsigned32 = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "IpAddress", "Integer32", "Gauge32", "Counter32", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "NotificationType", "ModuleIdentity", "ObjectIdentity", "TimeTicks", "Bits", "Unsigned32")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
extremeEaps = ModuleIdentity((1, 3, 6, 1, 4, 1, 1916, 1, 18))
if mibBuilder.loadTexts: extremeEaps.setLastUpdated('0007240000Z')
if mibBuilder.loadTexts: extremeEaps.setOrganization('Extreme Networks, Inc.')
if mibBuilder.loadTexts: extremeEaps.setContactInfo('www.extremenetworks.com')
if mibBuilder.loadTexts: extremeEaps.setDescription('Ethernet Automatic Protection Switching information')
extremeEapsTable = MibTable((1, 3, 6, 1, 4, 1, 1916, 1, 18, 1), )
if mibBuilder.loadTexts: extremeEapsTable.setStatus('current')
if mibBuilder.loadTexts: extremeEapsTable.setDescription('This table contains EAPS information about all EAPS domains on this device.')
extremeEapsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1916, 1, 18, 1, 1), ).setIndexNames((0, "EXTREME-EAPS-MIB", "extremeEapsName"))
if mibBuilder.loadTexts: extremeEapsEntry.setStatus('current')
if mibBuilder.loadTexts: extremeEapsEntry.setDescription('An individual entry of this table contains EAPS information related to that EAPS domain.')
extremeEapsName = MibTableColumn((1, 3, 6, 1, 4, 1, 1916, 1, 18, 1, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readonly")
if mibBuilder.loadTexts: extremeEapsName.setStatus('current')
if mibBuilder.loadTexts: extremeEapsName.setDescription('The EAPS domain name.')
extremeEapsMode = MibTableColumn((1, 3, 6, 1, 4, 1, 1916, 1, 18, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("invalid", 0), ("master", 1), ("transit", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: extremeEapsMode.setStatus('current')
if mibBuilder.loadTexts: extremeEapsMode.setDescription('This indicates the mode of the EAPS domain.')
extremeEapsState = MibTableColumn((1, 3, 6, 1, 4, 1, 1916, 1, 18, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("idle", 0), ("complete", 1), ("failed", 2), ("linksup", 3), ("linkdown", 4), ("preforwarding", 5), ("init", 6)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: extremeEapsState.setStatus('current')
if mibBuilder.loadTexts: extremeEapsState.setDescription('This indicates the current EAPS state of this EAPS domain.')
extremeEapsPrevState = MibScalar((1, 3, 6, 1, 4, 1, 1916, 1, 18, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("idle", 0), ("complete", 1), ("failed", 2), ("linksup", 3), ("linkdown", 4), ("preforwarding", 5), ("init", 6)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: extremeEapsPrevState.setStatus('current')
if mibBuilder.loadTexts: extremeEapsPrevState.setDescription('This indicates the previous EAPS state of this EAPS domain. Used in state change traps information.')
mibBuilder.exportSymbols("EXTREME-EAPS-MIB", extremeEapsEntry=extremeEapsEntry, extremeEapsMode=extremeEapsMode, PYSNMP_MODULE_ID=extremeEaps, extremeEapsState=extremeEapsState, extremeEapsName=extremeEapsName, extremeEapsPrevState=extremeEapsPrevState, extremeEaps=extremeEaps, extremeEapsTable=extremeEapsTable)
| (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, constraints_union, single_value_constraint, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ValueSizeConstraint', 'ConstraintsUnion', 'SingleValueConstraint', 'ConstraintsIntersection')
(extreme_agent,) = mibBuilder.importSymbols('EXTREME-BASE-MIB', 'extremeAgent')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(counter64, ip_address, integer32, gauge32, counter32, mib_identifier, mib_scalar, mib_table, mib_table_row, mib_table_column, iso, notification_type, module_identity, object_identity, time_ticks, bits, unsigned32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter64', 'IpAddress', 'Integer32', 'Gauge32', 'Counter32', 'MibIdentifier', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'iso', 'NotificationType', 'ModuleIdentity', 'ObjectIdentity', 'TimeTicks', 'Bits', 'Unsigned32')
(display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention')
extreme_eaps = module_identity((1, 3, 6, 1, 4, 1, 1916, 1, 18))
if mibBuilder.loadTexts:
extremeEaps.setLastUpdated('0007240000Z')
if mibBuilder.loadTexts:
extremeEaps.setOrganization('Extreme Networks, Inc.')
if mibBuilder.loadTexts:
extremeEaps.setContactInfo('www.extremenetworks.com')
if mibBuilder.loadTexts:
extremeEaps.setDescription('Ethernet Automatic Protection Switching information')
extreme_eaps_table = mib_table((1, 3, 6, 1, 4, 1, 1916, 1, 18, 1))
if mibBuilder.loadTexts:
extremeEapsTable.setStatus('current')
if mibBuilder.loadTexts:
extremeEapsTable.setDescription('This table contains EAPS information about all EAPS domains on this device.')
extreme_eaps_entry = mib_table_row((1, 3, 6, 1, 4, 1, 1916, 1, 18, 1, 1)).setIndexNames((0, 'EXTREME-EAPS-MIB', 'extremeEapsName'))
if mibBuilder.loadTexts:
extremeEapsEntry.setStatus('current')
if mibBuilder.loadTexts:
extremeEapsEntry.setDescription('An individual entry of this table contains EAPS information related to that EAPS domain.')
extreme_eaps_name = mib_table_column((1, 3, 6, 1, 4, 1, 1916, 1, 18, 1, 1, 1), display_string().subtype(subtypeSpec=value_size_constraint(0, 32))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
extremeEapsName.setStatus('current')
if mibBuilder.loadTexts:
extremeEapsName.setDescription('The EAPS domain name.')
extreme_eaps_mode = mib_table_column((1, 3, 6, 1, 4, 1, 1916, 1, 18, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('invalid', 0), ('master', 1), ('transit', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
extremeEapsMode.setStatus('current')
if mibBuilder.loadTexts:
extremeEapsMode.setDescription('This indicates the mode of the EAPS domain.')
extreme_eaps_state = mib_table_column((1, 3, 6, 1, 4, 1, 1916, 1, 18, 1, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('idle', 0), ('complete', 1), ('failed', 2), ('linksup', 3), ('linkdown', 4), ('preforwarding', 5), ('init', 6)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
extremeEapsState.setStatus('current')
if mibBuilder.loadTexts:
extremeEapsState.setDescription('This indicates the current EAPS state of this EAPS domain.')
extreme_eaps_prev_state = mib_scalar((1, 3, 6, 1, 4, 1, 1916, 1, 18, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('idle', 0), ('complete', 1), ('failed', 2), ('linksup', 3), ('linkdown', 4), ('preforwarding', 5), ('init', 6)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
extremeEapsPrevState.setStatus('current')
if mibBuilder.loadTexts:
extremeEapsPrevState.setDescription('This indicates the previous EAPS state of this EAPS domain. Used in state change traps information.')
mibBuilder.exportSymbols('EXTREME-EAPS-MIB', extremeEapsEntry=extremeEapsEntry, extremeEapsMode=extremeEapsMode, PYSNMP_MODULE_ID=extremeEaps, extremeEapsState=extremeEapsState, extremeEapsName=extremeEapsName, extremeEapsPrevState=extremeEapsPrevState, extremeEaps=extremeEaps, extremeEapsTable=extremeEapsTable) |
# -*- coding: utf-8 -*-
operation = input()
total = 0
for i in range(144):
N = float(input())
line = i // 12
if (i > (13 * line)):
total += N
answer = total if (operation == 'S') else (total / 66)
print("%.1f" % answer) | operation = input()
total = 0
for i in range(144):
n = float(input())
line = i // 12
if i > 13 * line:
total += N
answer = total if operation == 'S' else total / 66
print('%.1f' % answer) |
S = [3, 1, 3, 1]
N = len(S)-1
big_val = 1 << 62 # left bitwise shift is equivalent to raising 2 to the power of the positions shifted. so, big_val = 2 ^ 62.
A = [[big_val for i in range(N+1)] for j in range(N+1)]
def matrix_chain_cost(i, j):
global A
if i == j:
return 0
if A[i][j] != big_val:
return A[i][j]
for k in range(i, j):
A[i][j] = min(A[i][j], matrix_chain_cost(i, k) + matrix_chain_cost(k+1, j) + S[i-1] * S[k] * S[j])
return A[i][j]
print("Minimum cost of multiplication is", matrix_chain_cost(1, N)) | s = [3, 1, 3, 1]
n = len(S) - 1
big_val = 1 << 62
a = [[big_val for i in range(N + 1)] for j in range(N + 1)]
def matrix_chain_cost(i, j):
global A
if i == j:
return 0
if A[i][j] != big_val:
return A[i][j]
for k in range(i, j):
A[i][j] = min(A[i][j], matrix_chain_cost(i, k) + matrix_chain_cost(k + 1, j) + S[i - 1] * S[k] * S[j])
return A[i][j]
print('Minimum cost of multiplication is', matrix_chain_cost(1, N)) |
# Function: flips a pattern by mirror image
# Input:
# string - string pattern
# direction - flip horizontally or vertically
# Ouput: modified string pattern
def flip(st, direction):
row_strings = st.split("\n")
row_strings = row_strings[:-1]
st_out = ''
if (direction == 'Flip Horizontally'):
row_strings = row_strings[::-1]
for row in row_strings:
st_out += row + '\n'
else:
for row in row_strings:
st_out += row[::-1] + '\n'
return(st_out)
# Function: reflects pattern vertically
# Input:
# st - string pattern
# space - positive integer value, gap between original pattern and reflected pattern
# direction - 'Reflect Left' or 'Reflect Right', direction to perform vertical reflection
# Output:
# modified string pattern
def reflect_v(st, space, direction):
row_strings = st.split("\n")
row_strings = row_strings[:-1]
space_st = ""
if (direction == "Reflect Left"):
# Add spaces on the left of pattern
for row in row_strings:
row = space*"-" + row
space_st = space_st + row + "\n"
new_row_strings = space_st.split("\n")
reflected_row_strings = new_row_strings[:len(row_strings)]
st_out = ""
for row in reflected_row_strings:
if space >= 0:
row = row[::-1] + row
# Overlap
else:
row = row[:0:-1] + row
st_out = st_out + row + "\n"
else:
# Add spaces on the right of pattern
for row in row_strings:
row = row + space*"-"
space_st = space_st + row + "\n"
new_row_strings = space_st.split("\n")
reflected_row_strings = new_row_strings[:len(row_strings)]
st_out = ""
for row in reflected_row_strings:
if space >= 0:
row = row + row[::-1]
# Overlap
else:
row = row + row[len(row_strings[0])-2::-1]
st_out = st_out + row + "\n"
return st_out
# Function: reflect pattern horizontally
# Input:
# st - pattern string
# spacing - positive integer value, gap between original and reflected pattern
# direction - 'Reflect above' or 'Reflect below', direction to reflect horizontally
# Output: modified string pattern
def reflect_h(st, spacing, direction):
row_strings = st.split("\n")
reflect_st = ""
if spacing >= 0 :
row_strings = row_strings[:-1]
reflected_row_strings = list(reversed(row_strings))
row_length = len(row_strings[0])
# Create string for spacing area
spacing_st = 2*spacing*(row_length*'-' + '\n')
for row in reflected_row_strings:
reflect_st = reflect_st + row + "\n"
if (direction == 'Reflect Above'):
st_out = reflect_st + spacing_st + st
else:
st_out = st + spacing_st + reflect_st
# Overlap
else:
row_strings = row_strings[:-1]
reflected_row_strings = list(reversed(row_strings[1:]))
for row in reflected_row_strings:
reflect_st = reflect_st + row + "\n"
if (direction == 'Reflect Above'):
st_out = reflect_st + st
else:
st_out = st + reflect_st
return(st_out)
# Function: stack string pattern horizontally (by copying original string pattern and placing it above original string pattern)
# Input:
# st - string pattern
# space - positive integer, space between original pattern and copied pattern
# Output: modified string pattern
def stack_h(st, space):
row_strings = st.split("\n")
row_strings = row_strings[:-1]
st_out = ''
for row in row_strings:
st_out += row + space*'-' + row + '\n'
return(st_out)
# Function: stack string pattern horizontally (by copying original string pattern and placing it to the right of original string pattern)
# Input:
# st - string pattern
# space - positive integer, space between original pattern and copied pattern
# Output: modified string pattern
def stack_v(st, space):
row_strings = st.split("\n")
row_length = len(row_strings[0])
spacing_st = space*(row_length*'-' + '\n')
st_out = st + spacing_st + st
return(st_out)
# Function: copies original string pattern top left or bottom right direction
# Input:
# st - string pattern
# space - positive integer, space between original pattern and copied pattern
# Output: modified string pattern
def stack_d(st, space, direction):
row_strings = st.split("\n")
row_strings = row_strings[:-1]
row_height = len(row_strings)
row_length = len(row_strings[0])
left_pattern = ''
right_pattern = ''
st_out = ''
spacing_st = (row_length + space)*'-'
for row in row_strings:
left_pattern += row + spacing_st + '\n'
right_pattern += spacing_st + row + '\n'
if (direction == 'Stack Left'):
st_out += left_pattern + right_pattern
else:
st_out += right_pattern + left_pattern
return(st_out)
# Function: joins two string pattern horizontally
# Input:
# st1, st2 - string patterns
# space - positive integer, gap between two joined patterns
# Output: modified string pattern
def join_patterns(st1, st2, space):
pattern_1 = st1.split("\n")
pattern_1 = pattern_1[:-1]
pattern_2 = st2.split("\n")
pattern_2 = pattern_2[:-1]
height = max(len(pattern_1), len(pattern_2))
space_to_add_p1 = math.ceil( (height - len(pattern_1))/2 )
space_to_add_p2 = math.ceil( (height - len(pattern_2))/2 )
p1 = add_basket_space(st1, space_to_add_p1, 0)
p2 = add_basket_space(st2, space_to_add_p2, 0)
pattern_1 = p1.split("\n")
pattern_1 = pattern_1[:-1]
pattern_2 = p2.split("\n")
pattern_2 = pattern_2[:-1]
st_out = ''
for a,b in zip(pattern_1, pattern_2):
st_out += a + space*'-' + b + '\n'
return(st_out)
| def flip(st, direction):
row_strings = st.split('\n')
row_strings = row_strings[:-1]
st_out = ''
if direction == 'Flip Horizontally':
row_strings = row_strings[::-1]
for row in row_strings:
st_out += row + '\n'
else:
for row in row_strings:
st_out += row[::-1] + '\n'
return st_out
def reflect_v(st, space, direction):
row_strings = st.split('\n')
row_strings = row_strings[:-1]
space_st = ''
if direction == 'Reflect Left':
for row in row_strings:
row = space * '-' + row
space_st = space_st + row + '\n'
new_row_strings = space_st.split('\n')
reflected_row_strings = new_row_strings[:len(row_strings)]
st_out = ''
for row in reflected_row_strings:
if space >= 0:
row = row[::-1] + row
else:
row = row[:0:-1] + row
st_out = st_out + row + '\n'
else:
for row in row_strings:
row = row + space * '-'
space_st = space_st + row + '\n'
new_row_strings = space_st.split('\n')
reflected_row_strings = new_row_strings[:len(row_strings)]
st_out = ''
for row in reflected_row_strings:
if space >= 0:
row = row + row[::-1]
else:
row = row + row[len(row_strings[0]) - 2::-1]
st_out = st_out + row + '\n'
return st_out
def reflect_h(st, spacing, direction):
row_strings = st.split('\n')
reflect_st = ''
if spacing >= 0:
row_strings = row_strings[:-1]
reflected_row_strings = list(reversed(row_strings))
row_length = len(row_strings[0])
spacing_st = 2 * spacing * (row_length * '-' + '\n')
for row in reflected_row_strings:
reflect_st = reflect_st + row + '\n'
if direction == 'Reflect Above':
st_out = reflect_st + spacing_st + st
else:
st_out = st + spacing_st + reflect_st
else:
row_strings = row_strings[:-1]
reflected_row_strings = list(reversed(row_strings[1:]))
for row in reflected_row_strings:
reflect_st = reflect_st + row + '\n'
if direction == 'Reflect Above':
st_out = reflect_st + st
else:
st_out = st + reflect_st
return st_out
def stack_h(st, space):
row_strings = st.split('\n')
row_strings = row_strings[:-1]
st_out = ''
for row in row_strings:
st_out += row + space * '-' + row + '\n'
return st_out
def stack_v(st, space):
row_strings = st.split('\n')
row_length = len(row_strings[0])
spacing_st = space * (row_length * '-' + '\n')
st_out = st + spacing_st + st
return st_out
def stack_d(st, space, direction):
row_strings = st.split('\n')
row_strings = row_strings[:-1]
row_height = len(row_strings)
row_length = len(row_strings[0])
left_pattern = ''
right_pattern = ''
st_out = ''
spacing_st = (row_length + space) * '-'
for row in row_strings:
left_pattern += row + spacing_st + '\n'
right_pattern += spacing_st + row + '\n'
if direction == 'Stack Left':
st_out += left_pattern + right_pattern
else:
st_out += right_pattern + left_pattern
return st_out
def join_patterns(st1, st2, space):
pattern_1 = st1.split('\n')
pattern_1 = pattern_1[:-1]
pattern_2 = st2.split('\n')
pattern_2 = pattern_2[:-1]
height = max(len(pattern_1), len(pattern_2))
space_to_add_p1 = math.ceil((height - len(pattern_1)) / 2)
space_to_add_p2 = math.ceil((height - len(pattern_2)) / 2)
p1 = add_basket_space(st1, space_to_add_p1, 0)
p2 = add_basket_space(st2, space_to_add_p2, 0)
pattern_1 = p1.split('\n')
pattern_1 = pattern_1[:-1]
pattern_2 = p2.split('\n')
pattern_2 = pattern_2[:-1]
st_out = ''
for (a, b) in zip(pattern_1, pattern_2):
st_out += a + space * '-' + b + '\n'
return st_out |
matrix = [[dot == '#' for dot in line.strip()] for line in open('input.txt')]
diffs = [(x, y) for x in (-1, 0, 1) for y in (-1, 0, 1) if (x, y) != (0, 0)]
corners = [(x, y) for x in (0, len(matrix)-1) for y in (0, len(matrix[0])-1)]
for x, y in corners:
matrix[x][y] = True
def neighbors(matrix, x, y):
for i, j in diffs:
if 0 <= i+x < len(matrix) and 0 <= y+j < len(matrix[0]):
yield matrix[x+i][y+j]
else:
yield False
for i in range(100):
new_matrix = [[False] * len(row) for row in matrix]
for x in range(len(matrix)):
for y in range(len(matrix[0])):
neighbor_count = sum(neighbors(matrix, x, y))
if matrix[x][y]:
new_matrix[x][y] = neighbor_count in (2, 3)
else:
new_matrix[x][y] = neighbor_count == 3
matrix = new_matrix
for x, y in corners:
matrix[x][y] = True
print(sum(sum(row) for row in matrix))
| matrix = [[dot == '#' for dot in line.strip()] for line in open('input.txt')]
diffs = [(x, y) for x in (-1, 0, 1) for y in (-1, 0, 1) if (x, y) != (0, 0)]
corners = [(x, y) for x in (0, len(matrix) - 1) for y in (0, len(matrix[0]) - 1)]
for (x, y) in corners:
matrix[x][y] = True
def neighbors(matrix, x, y):
for (i, j) in diffs:
if 0 <= i + x < len(matrix) and 0 <= y + j < len(matrix[0]):
yield matrix[x + i][y + j]
else:
yield False
for i in range(100):
new_matrix = [[False] * len(row) for row in matrix]
for x in range(len(matrix)):
for y in range(len(matrix[0])):
neighbor_count = sum(neighbors(matrix, x, y))
if matrix[x][y]:
new_matrix[x][y] = neighbor_count in (2, 3)
else:
new_matrix[x][y] = neighbor_count == 3
matrix = new_matrix
for (x, y) in corners:
matrix[x][y] = True
print(sum((sum(row) for row in matrix))) |
def multiply(a, b):
c = [[0] * 3 for _ in range(3)]
for i in range(3):
for j in range(3):
for k in range(3):
c[i][j] += a[i][k] * b[k][j]
return c
q = int(input())
for _ in range(q):
x, y, z, t = input().split()
x = float(x)
y = float(y)
z = float(z)
t = int(t)
m = [
[1 - x, y, 0],
[0, 1 - y, z],
[x, 0, 1 - z],
]
mat = None
while t > 0:
if t & 1 == 1:
if mat is None:
mat = [[m[i][j] for j in range(3)] for i in range(3)]
else:
mat = multiply(mat, m)
m = multiply(m, m)
t >>= 1
print(*[sum(mat[i]) for i in range(3)]) | def multiply(a, b):
c = [[0] * 3 for _ in range(3)]
for i in range(3):
for j in range(3):
for k in range(3):
c[i][j] += a[i][k] * b[k][j]
return c
q = int(input())
for _ in range(q):
(x, y, z, t) = input().split()
x = float(x)
y = float(y)
z = float(z)
t = int(t)
m = [[1 - x, y, 0], [0, 1 - y, z], [x, 0, 1 - z]]
mat = None
while t > 0:
if t & 1 == 1:
if mat is None:
mat = [[m[i][j] for j in range(3)] for i in range(3)]
else:
mat = multiply(mat, m)
m = multiply(m, m)
t >>= 1
print(*[sum(mat[i]) for i in range(3)]) |
# Exercise 3.1: Rewrite your pay computation to give the employee 1.5 times the
# rate for hours worked above 40 hours.
# Enter Hours: 45
# Enter Rate: 10
# Pay: 475.0
# Python for Everybody: Exploring Data Using Python 3
# by Charles R. Severance
hours = float(input("Enter hours: "))
rate_per_hour = float(input("Enter rate per hour: "))
additional_hours = hours - 40
gross_pay = 0
if additional_hours > 0:
hours_with_rate_per_hour = hours - additional_hours
gross_pay = hours_with_rate_per_hour * rate_per_hour
modified_rate_per_hour = rate_per_hour * 1.5
gross_pay += additional_hours * modified_rate_per_hour
else:
gross_pay = hours * rate_per_hour
print(gross_pay)
| hours = float(input('Enter hours: '))
rate_per_hour = float(input('Enter rate per hour: '))
additional_hours = hours - 40
gross_pay = 0
if additional_hours > 0:
hours_with_rate_per_hour = hours - additional_hours
gross_pay = hours_with_rate_per_hour * rate_per_hour
modified_rate_per_hour = rate_per_hour * 1.5
gross_pay += additional_hours * modified_rate_per_hour
else:
gross_pay = hours * rate_per_hour
print(gross_pay) |
class BaseEmployee():
"The base class for an employee."
# Note: Unlike c#, on initiliazing a child class, the base contructor is not called
# unless specifically called.
def __init__(self, id, city):
"Constructor for the base employee class."
print('Base constructor called.');
self.id = id;
self.city = city;
def __del__(self):
"Will be called on destruction of employee object. Can also be called explicitly."
print(self.__class__.__name__, 'destroyed');
def printEmployee(self):
print("Id:", self.id, "Name:", self.name, "City:", self.city); | class Baseemployee:
"""The base class for an employee."""
def __init__(self, id, city):
"""Constructor for the base employee class."""
print('Base constructor called.')
self.id = id
self.city = city
def __del__(self):
"""Will be called on destruction of employee object. Can also be called explicitly."""
print(self.__class__.__name__, 'destroyed')
def print_employee(self):
print('Id:', self.id, 'Name:', self.name, 'City:', self.city) |
ix.enable_command_history()
app = ix.application
clarisse_win = app.get_event_window()
ix.application.open_edit_color_space_window(clarisse_win)
ix.disable_command_history()
| ix.enable_command_history()
app = ix.application
clarisse_win = app.get_event_window()
ix.application.open_edit_color_space_window(clarisse_win)
ix.disable_command_history() |
distanca = int(input())
tempo = (2 * distanca)
print('%d minutos' %tempo) | distanca = int(input())
tempo = 2 * distanca
print('%d minutos' % tempo) |
def sayhello(name=None):
if name is None:
return "Hello World, Everyone!"
else:
return f"Hello World, {name}"
| def sayhello(name=None):
if name is None:
return 'Hello World, Everyone!'
else:
return f'Hello World, {name}' |
def imgcd(m,n):
for i in range(1,min(m,n)+1):
if m%i==0 and n%i==0:
mcrf=i
return mcrf
a=input()
b=input()
c=imgcd(int(a),int(b))
print(c) | def imgcd(m, n):
for i in range(1, min(m, n) + 1):
if m % i == 0 and n % i == 0:
mcrf = i
return mcrf
a = input()
b = input()
c = imgcd(int(a), int(b))
print(c) |
class Tape(object):
blank = " "
def __init__(self, tape):
self.tape = tape
self.head = 0
| class Tape(object):
blank = ' '
def __init__(self, tape):
self.tape = tape
self.head = 0 |
''''
Problem:
Determine if two strings are permutations.
Assumptions:
String is composed of lower 128 ASCII characters.
Capitalization matters.
'''
def isPerm(s1, s2):
if len(s1) != len(s2):
return False
arr1 = [0] * 128
arr2 = [0] * 128
for c, d in zip(s1, s2):
arr1[ord(c)] += 1
arr2[ord(d)] += 1
for i in xrange(len(arr1)):
if arr1[i] != arr2[i]:
return False
return True
def test():
s1 = "read"
s2 = "dear"
assert isPerm(s1, s2) == True
s1 = "read"
s2 = "red"
assert isPerm(s1, s2) == False
s1 = "read"
s2 = "race"
assert isPerm(s1, s2) == False
s1 = "Read"
s2 = "read"
assert isPerm(s1, s2) == False
print("Test passed")
test()
| """'
Problem:
Determine if two strings are permutations.
Assumptions:
String is composed of lower 128 ASCII characters.
Capitalization matters.
"""
def is_perm(s1, s2):
if len(s1) != len(s2):
return False
arr1 = [0] * 128
arr2 = [0] * 128
for (c, d) in zip(s1, s2):
arr1[ord(c)] += 1
arr2[ord(d)] += 1
for i in xrange(len(arr1)):
if arr1[i] != arr2[i]:
return False
return True
def test():
s1 = 'read'
s2 = 'dear'
assert is_perm(s1, s2) == True
s1 = 'read'
s2 = 'red'
assert is_perm(s1, s2) == False
s1 = 'read'
s2 = 'race'
assert is_perm(s1, s2) == False
s1 = 'Read'
s2 = 'read'
assert is_perm(s1, s2) == False
print('Test passed')
test() |
#Write a function to find the longest common prefix string amongst an array of strings.
#If there is no common prefix, return an empty string "".
def longest_common_prefix(strs) -> str:
common = ""
strs.sort()
for i in range(0, len(strs[0])):
if strs[0][i] == strs[-1][i]:
common += strs[0][i]
if strs[0][i] != strs[-1][i]:
break
return common
print(longest_common_prefix(["flow", "flower", "flowing"]))
| def longest_common_prefix(strs) -> str:
common = ''
strs.sort()
for i in range(0, len(strs[0])):
if strs[0][i] == strs[-1][i]:
common += strs[0][i]
if strs[0][i] != strs[-1][i]:
break
return common
print(longest_common_prefix(['flow', 'flower', 'flowing'])) |
def target_file():
return ".html"
def target_domain():
return "https://lyricsmania.com/"
def artist_query(name):
return target_domain() + str.lower(name) + "_lyrics" + target_file()
if __name__ == "__main__":
print(artist_query("Lizzo")) | def target_file():
return '.html'
def target_domain():
return 'https://lyricsmania.com/'
def artist_query(name):
return target_domain() + str.lower(name) + '_lyrics' + target_file()
if __name__ == '__main__':
print(artist_query('Lizzo')) |
load("@bazel_skylib//lib:paths.bzl", "paths")
GlslLibraryInfo = provider("Set of GLSL header files", fields = ["hdrs", "includes"])
SpirvLibraryInfo = provider("Set of Spirv files", fields = ["spvs", "includes"])
def _export_headers(ctx, virtual_header_prefix):
strip_include_prefix = ctx.attr.strip_include_prefix
include_prefix = ctx.attr.include_prefix
outs = []
for hdr in ctx.files.hdrs:
path = hdr.owner.name
if strip_include_prefix:
if path.startswith(strip_include_prefix):
out = path.lstrip(strip_include_prefix)
out = out.lstrip("/")
else:
fail("{} is not a prefix of {}".format(strip_include_prefix, path))
else:
out = path
if include_prefix:
out = paths.join(include_prefix, out)
name = out.replace("/", "_") + "_export"
out = paths.join(
virtual_header_prefix,
out,
)
symlink = ctx.actions.declare_file(out)
ctx.actions.symlink(
output = symlink,
target_file = hdr,
)
outs.append(symlink)
return outs
def _compile_files(ctx, includes):
dephdrs = []
for dep in ctx.attr.deps:
glsllibraryinfo = dep[GlslLibraryInfo]
includes.extend(glsllibraryinfo.includes)
dephdrs.extend(
glsllibraryinfo.hdrs,
)
args = ctx.actions.args()
args.add("--target-env={}".format(ctx.attr.target_env))
args.add("--target-spv={}".format(ctx.attr.target_spv))
args.add("-std={}{}".format(ctx.attr.std_version, ctx.attr.std_profile))
args.add_all(includes, format_each = "-I%s", uniquify = True)
args.add_all(ctx.attr.defines, format_each = "-D%s", uniquify = True)
if ctx.attr.debug:
args.add("-g")
if ctx.attr.optimize:
args.add("-O")
strip_output_prefix = ctx.attr.strip_output_prefix
output_prefix = ctx.attr.output_prefix
outputs = []
for src in ctx.files.srcs:
path = src.owner.name
if strip_output_prefix:
if path.startswith(strip_output_prefix):
output_path = path.lstrip(strip_output_prefix)
output_path = output_path.lstrip("/")
else:
fail("{} is not a prefix of {}".format(strip_output_prefix, path))
else:
output_path = path
if output_prefix:
output_path = paths.join(output_prefix, output_path)
output_path = output_path + ".spv"
output_file = ctx.actions.declare_file(output_path)
outputs.append((output_path, output_file))
argsio = ctx.actions.args()
argsio.add_all(["-o", output_file.path, src])
ctx.actions.run(
outputs = [output_file],
inputs = ctx.files.srcs + ctx.files.hdrs + dephdrs,
executable = ctx.files.glslc[0],
arguments = [args, argsio],
)
return outputs
def _glsl_library_impl(ctx):
# compile the files
this_build_file_dir = paths.dirname(ctx.build_file_path)
this_package_dir = paths.join(this_build_file_dir, ctx.attr.name)
spirvs = {spv[0]: spv[1] for spv in _compile_files(ctx, [this_package_dir])}
# Make sure they are correctly exposed to other packages
virtual_header_prefix = "_virtual_includes/{}".format(ctx.attr.name)
hdrs = _export_headers(ctx, virtual_header_prefix)
includes = [paths.dirname(ctx.build_file_path)]
for include in ctx.attr.includes:
path = paths.normalize(paths.join(
this_build_file_dir,
virtual_header_prefix,
include,
))
includes.append(path)
includes.append(paths.join(ctx.bin_dir.path, path))
providers = [
DefaultInfo(
files = depset(hdrs + spirvs.values()),
runfiles = ctx.runfiles(
files = spirvs.values(),
),
),
GlslLibraryInfo(
hdrs = hdrs,
includes = includes,
),
CcInfo(), # So it can be used as a dep for cc_library/binary and have spirvs embedded as runfiles
]
if spirvs:
# Compute output location for spv files
# This will be used to populate the includes variable of the SpirvLibraryInfo provider
# Check if this could made more resilient
spirvs_root = paths.join(ctx.bin_dir.path, spirvs.values()[0].owner.workspace_root)
providers.append(SpirvLibraryInfo(
spvs = spirvs.values(),
includes = [spirvs_root],
))
return providers
glsl_library = rule(
implementation = _glsl_library_impl,
attrs = {
"include_prefix": attr.string(),
"strip_include_prefix": attr.string(),
"output_prefix": attr.string(),
"strip_output_prefix": attr.string(),
"srcs": attr.label_list(allow_files = [
"vert",
"tesc",
"tese",
"geom",
"frag",
# compute
"comp",
# mesh shaders
"mesh",
"task",
# ray tracing
"rgen",
"rint",
"rahit",
"rchit",
"rmiss",
"rcall",
# generic, for inclusion
"glsl",
]),
"hdrs": attr.label_list(allow_files = ["glsl"]),
"includes": attr.string_list(default = ["./"]),
"deps": attr.label_list(
providers = [GlslLibraryInfo],
),
"std_version": attr.string(
default = "460",
values = ["410", "420", "430", "440", "450", "460"],
),
"std_profile": attr.string(
default = "core",
values = ["core", "compatibility", "es"],
),
"target_spv": attr.string(
default = "spv1.3",
values = ["spv1.0", "spv1.1", "spv1.2", "spv1.3", "spv1.4", "spv1.5"],
),
"target_env": attr.string(
default = "vulkan1.2",
values = [
"vulkan1.0",
"vulkan1.1",
"vulkan1.2",
"vulkan", # Same as vulkan1.0
"opengl4.5",
"opengl", # Same as opengl4.5
],
),
"defines": attr.string_list(),
"debug": attr.bool(default = True),
"optimize": attr.bool(default = True),
"glslc": attr.label(
allow_single_file = True,
default = "@shaderc//:glslc",
),
},
)
| load('@bazel_skylib//lib:paths.bzl', 'paths')
glsl_library_info = provider('Set of GLSL header files', fields=['hdrs', 'includes'])
spirv_library_info = provider('Set of Spirv files', fields=['spvs', 'includes'])
def _export_headers(ctx, virtual_header_prefix):
strip_include_prefix = ctx.attr.strip_include_prefix
include_prefix = ctx.attr.include_prefix
outs = []
for hdr in ctx.files.hdrs:
path = hdr.owner.name
if strip_include_prefix:
if path.startswith(strip_include_prefix):
out = path.lstrip(strip_include_prefix)
out = out.lstrip('/')
else:
fail('{} is not a prefix of {}'.format(strip_include_prefix, path))
else:
out = path
if include_prefix:
out = paths.join(include_prefix, out)
name = out.replace('/', '_') + '_export'
out = paths.join(virtual_header_prefix, out)
symlink = ctx.actions.declare_file(out)
ctx.actions.symlink(output=symlink, target_file=hdr)
outs.append(symlink)
return outs
def _compile_files(ctx, includes):
dephdrs = []
for dep in ctx.attr.deps:
glsllibraryinfo = dep[GlslLibraryInfo]
includes.extend(glsllibraryinfo.includes)
dephdrs.extend(glsllibraryinfo.hdrs)
args = ctx.actions.args()
args.add('--target-env={}'.format(ctx.attr.target_env))
args.add('--target-spv={}'.format(ctx.attr.target_spv))
args.add('-std={}{}'.format(ctx.attr.std_version, ctx.attr.std_profile))
args.add_all(includes, format_each='-I%s', uniquify=True)
args.add_all(ctx.attr.defines, format_each='-D%s', uniquify=True)
if ctx.attr.debug:
args.add('-g')
if ctx.attr.optimize:
args.add('-O')
strip_output_prefix = ctx.attr.strip_output_prefix
output_prefix = ctx.attr.output_prefix
outputs = []
for src in ctx.files.srcs:
path = src.owner.name
if strip_output_prefix:
if path.startswith(strip_output_prefix):
output_path = path.lstrip(strip_output_prefix)
output_path = output_path.lstrip('/')
else:
fail('{} is not a prefix of {}'.format(strip_output_prefix, path))
else:
output_path = path
if output_prefix:
output_path = paths.join(output_prefix, output_path)
output_path = output_path + '.spv'
output_file = ctx.actions.declare_file(output_path)
outputs.append((output_path, output_file))
argsio = ctx.actions.args()
argsio.add_all(['-o', output_file.path, src])
ctx.actions.run(outputs=[output_file], inputs=ctx.files.srcs + ctx.files.hdrs + dephdrs, executable=ctx.files.glslc[0], arguments=[args, argsio])
return outputs
def _glsl_library_impl(ctx):
this_build_file_dir = paths.dirname(ctx.build_file_path)
this_package_dir = paths.join(this_build_file_dir, ctx.attr.name)
spirvs = {spv[0]: spv[1] for spv in _compile_files(ctx, [this_package_dir])}
virtual_header_prefix = '_virtual_includes/{}'.format(ctx.attr.name)
hdrs = _export_headers(ctx, virtual_header_prefix)
includes = [paths.dirname(ctx.build_file_path)]
for include in ctx.attr.includes:
path = paths.normalize(paths.join(this_build_file_dir, virtual_header_prefix, include))
includes.append(path)
includes.append(paths.join(ctx.bin_dir.path, path))
providers = [default_info(files=depset(hdrs + spirvs.values()), runfiles=ctx.runfiles(files=spirvs.values())), glsl_library_info(hdrs=hdrs, includes=includes), cc_info()]
if spirvs:
spirvs_root = paths.join(ctx.bin_dir.path, spirvs.values()[0].owner.workspace_root)
providers.append(spirv_library_info(spvs=spirvs.values(), includes=[spirvs_root]))
return providers
glsl_library = rule(implementation=_glsl_library_impl, attrs={'include_prefix': attr.string(), 'strip_include_prefix': attr.string(), 'output_prefix': attr.string(), 'strip_output_prefix': attr.string(), 'srcs': attr.label_list(allow_files=['vert', 'tesc', 'tese', 'geom', 'frag', 'comp', 'mesh', 'task', 'rgen', 'rint', 'rahit', 'rchit', 'rmiss', 'rcall', 'glsl']), 'hdrs': attr.label_list(allow_files=['glsl']), 'includes': attr.string_list(default=['./']), 'deps': attr.label_list(providers=[GlslLibraryInfo]), 'std_version': attr.string(default='460', values=['410', '420', '430', '440', '450', '460']), 'std_profile': attr.string(default='core', values=['core', 'compatibility', 'es']), 'target_spv': attr.string(default='spv1.3', values=['spv1.0', 'spv1.1', 'spv1.2', 'spv1.3', 'spv1.4', 'spv1.5']), 'target_env': attr.string(default='vulkan1.2', values=['vulkan1.0', 'vulkan1.1', 'vulkan1.2', 'vulkan', 'opengl4.5', 'opengl']), 'defines': attr.string_list(), 'debug': attr.bool(default=True), 'optimize': attr.bool(default=True), 'glslc': attr.label(allow_single_file=True, default='@shaderc//:glslc')}) |
node = S(input, "application/json")
node.prop("comment", "42!")
propertyNode = node.prop("comment")
value = propertyNode.stringValue() | node = s(input, 'application/json')
node.prop('comment', '42!')
property_node = node.prop('comment')
value = propertyNode.stringValue() |
def moeda(funcao, moeda='R$'):
return f'{moeda}{funcao:.2f}'.replace('.', ',')
def aumentar(p, taxa):
res = p * (1 + taxa/100)
return res
def diminuir(p, taxa):
res = p * (1 - taxa/100)
return res
def dobro(p):
res = p * 2
return res
def metade(p):
res = p / 2
return res
| def moeda(funcao, moeda='R$'):
return f'{moeda}{funcao:.2f}'.replace('.', ',')
def aumentar(p, taxa):
res = p * (1 + taxa / 100)
return res
def diminuir(p, taxa):
res = p * (1 - taxa / 100)
return res
def dobro(p):
res = p * 2
return res
def metade(p):
res = p / 2
return res |
class Solution:
def naive(self,root):
self.res = 0
def dfs(tree,s):
s_ = s*10+tree.val
if tree.left==None and tree.right==None:
self.res+=s_
return
if tree.left:
dfs(tree.left,s_)
if tree.right:
dfs(tree.right,s_)
dfs(root,0)
return self.res | class Solution:
def naive(self, root):
self.res = 0
def dfs(tree, s):
s_ = s * 10 + tree.val
if tree.left == None and tree.right == None:
self.res += s_
return
if tree.left:
dfs(tree.left, s_)
if tree.right:
dfs(tree.right, s_)
dfs(root, 0)
return self.res |
class Solution:
def getSmallestString(self, n: int, k: int) -> str:
op=['a']*n
k=k-n
i=n-1
while k:
k+=1
if k/26>=1:
op[i]='z'
i-=1
k=k-26
else:
op[i]=chr(k+96)
k=0
return ''.join(op)
| class Solution:
def get_smallest_string(self, n: int, k: int) -> str:
op = ['a'] * n
k = k - n
i = n - 1
while k:
k += 1
if k / 26 >= 1:
op[i] = 'z'
i -= 1
k = k - 26
else:
op[i] = chr(k + 96)
k = 0
return ''.join(op) |
def summation(n,term):
total,k=0,1
while k<=n:
total,k = term(k) + total, k+1
return total
def square(x):
return x*x
def pi_summantion(n):
return summation(n, lambda x: 8 / ((4*x-3) * (4*x-1)))
def suqare_summantio(n):
return summation(n, square)
print(pi_summantion(1e6))
print(suqare_summantio(4))
| def summation(n, term):
(total, k) = (0, 1)
while k <= n:
(total, k) = (term(k) + total, k + 1)
return total
def square(x):
return x * x
def pi_summantion(n):
return summation(n, lambda x: 8 / ((4 * x - 3) * (4 * x - 1)))
def suqare_summantio(n):
return summation(n, square)
print(pi_summantion(1000000.0))
print(suqare_summantio(4)) |
class PhotoAlbum:
def __init__(self, pages: int):
self.pages = pages
self.photos = [[] for _ in range(self.pages)]
@classmethod
def from_photos_count(cls, photos_count: int):
pages_count = photos_count // 4
if photos_count % 4 != 0:
pages_count += 1
return cls(pages_count)
def add_photo(self, label: str):
for index, current_page in enumerate(self.photos):
if len(current_page) < 4:
current_page.append(label)
return f"{label} photo added successfully on page {index + 1} slot {len(current_page)}"
return "No more free slots"
def display(self):
matrix = []
for row in self.photos:
current_sheet = []
for col in row:
current_sheet.append(str([]))
matrix.append(' '.join(current_sheet))
result = []
result.append("-----------")
for row in matrix:
result.append(row)
result.append("-----------")
return '\n'.join(result)
| class Photoalbum:
def __init__(self, pages: int):
self.pages = pages
self.photos = [[] for _ in range(self.pages)]
@classmethod
def from_photos_count(cls, photos_count: int):
pages_count = photos_count // 4
if photos_count % 4 != 0:
pages_count += 1
return cls(pages_count)
def add_photo(self, label: str):
for (index, current_page) in enumerate(self.photos):
if len(current_page) < 4:
current_page.append(label)
return f'{label} photo added successfully on page {index + 1} slot {len(current_page)}'
return 'No more free slots'
def display(self):
matrix = []
for row in self.photos:
current_sheet = []
for col in row:
current_sheet.append(str([]))
matrix.append(' '.join(current_sheet))
result = []
result.append('-----------')
for row in matrix:
result.append(row)
result.append('-----------')
return '\n'.join(result) |
print('hii'+str(5))
print(int(8)+5);
print(float(8.5)+5);
print(int(8.5)+5);
#print(int('C'))
| print('hii' + str(5))
print(int(8) + 5)
print(float(8.5) + 5)
print(int(8.5) + 5) |
def compare(v1, operator, v2):
if operator == ">":
return v1 > v2
elif operator == "<":
return v1 < v2
elif operator == ">=":
return v1 >= v2
elif operator == "<=":
return v1 <= v2
elif operator == "=" or "==":
return v1 == v2
elif operator == "!=":
return v1 != v2
| def compare(v1, operator, v2):
if operator == '>':
return v1 > v2
elif operator == '<':
return v1 < v2
elif operator == '>=':
return v1 >= v2
elif operator == '<=':
return v1 <= v2
elif operator == '=' or '==':
return v1 == v2
elif operator == '!=':
return v1 != v2 |
#pythran export fib_pythran(int)
def fib_pythran(n):
i, sum, last, curr = 0, 0, 0, 1
if n <= 2:
return 1
while i < n - 1:
sum = last + curr
last = curr
curr = sum
i += 1
return sum
#pythran export count_doubles_pythran_zip(str, int)
def count_doubles_pythran_zip(val, n):
total = 0
for c1, c2 in zip(val, val[1:]):
if c1 == c2:
total += 1
return total
#pythran export count_doubles_pythran(str, int)
def count_doubles_pythran(val, n):
total = 0
last = val[0]
for i in range(1, n):
cur = val[i]
if last == cur:
total += 1
last = cur
return total
#pythran export sum2d_pythran(int[][], int, int)
def sum2d_pythran(arr, m, n):
result = 0.0
for i in range(m):
for j in range(n):
result += arr[i,j]
return result
#pythran export mandel_pythran(int, int, int)
def mandel_pythran(x, y, max_iters):
i = 0
c = complex(x, y)
z = 0.0j
for i in range(max_iters):
z = z * z + c
if (z.real * z.real + z.imag * z.imag) >= 4:
return i
return 255
#pythran export fractal_pythran(float, float, float, float, uint8[][], int)
def fractal_pythran(min_x, max_x, min_y, max_y, image, iters):
height = image.shape[0]
width = image.shape[1]
pixel_size_x = (max_x - min_x) / width
pixel_size_y = (max_y - min_y) / height
for x in range(width):
real = min_x + x * pixel_size_x
for y in range(height):
imag = min_y + y * pixel_size_y
color = mandel_pythran(real, imag, iters)
image[y, x] = color
return image
| def fib_pythran(n):
(i, sum, last, curr) = (0, 0, 0, 1)
if n <= 2:
return 1
while i < n - 1:
sum = last + curr
last = curr
curr = sum
i += 1
return sum
def count_doubles_pythran_zip(val, n):
total = 0
for (c1, c2) in zip(val, val[1:]):
if c1 == c2:
total += 1
return total
def count_doubles_pythran(val, n):
total = 0
last = val[0]
for i in range(1, n):
cur = val[i]
if last == cur:
total += 1
last = cur
return total
def sum2d_pythran(arr, m, n):
result = 0.0
for i in range(m):
for j in range(n):
result += arr[i, j]
return result
def mandel_pythran(x, y, max_iters):
i = 0
c = complex(x, y)
z = 0j
for i in range(max_iters):
z = z * z + c
if z.real * z.real + z.imag * z.imag >= 4:
return i
return 255
def fractal_pythran(min_x, max_x, min_y, max_y, image, iters):
height = image.shape[0]
width = image.shape[1]
pixel_size_x = (max_x - min_x) / width
pixel_size_y = (max_y - min_y) / height
for x in range(width):
real = min_x + x * pixel_size_x
for y in range(height):
imag = min_y + y * pixel_size_y
color = mandel_pythran(real, imag, iters)
image[y, x] = color
return image |
#
# PySNMP MIB module PNNI-EXT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PNNI-EXT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:41:07 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, ConstraintsUnion, ValueRangeConstraint, SingleValueConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "ValueRangeConstraint", "SingleValueConstraint", "ValueSizeConstraint")
extensions, = mibBuilder.importSymbols("CENTILLION-ROOT-MIB", "extensions")
lecsConfIndex, = mibBuilder.importSymbols("LAN-EMULATION-ELAN-MIB", "lecsConfIndex")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Unsigned32, Bits, ModuleIdentity, MibIdentifier, IpAddress, iso, NotificationType, Gauge32, Counter64, Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, Counter32, ObjectIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "Bits", "ModuleIdentity", "MibIdentifier", "IpAddress", "iso", "NotificationType", "Gauge32", "Counter64", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "Counter32", "ObjectIdentity")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
cnPnniExt = MibIdentifier((1, 3, 6, 1, 4, 1, 930, 3, 5))
cnPnniMainExt = MibIdentifier((1, 3, 6, 1, 4, 1, 930, 3, 5, 1))
cnPnnilecsExt = MibIdentifier((1, 3, 6, 1, 4, 1, 930, 3, 5, 2))
cnPnniTdbOverload = MibIdentifier((1, 3, 6, 1, 4, 1, 930, 3, 5, 3))
cnPnniAdminStatus = MibScalar((1, 3, 6, 1, 4, 1, 930, 3, 5, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cnPnniAdminStatus.setStatus('mandatory')
if mibBuilder.loadTexts: cnPnniAdminStatus.setDescription('The desired state of PNNI in the switching system. Setting this object to disabled(2) disables PNNI capability in the switch. Setting it to enabled(1) enables PNNI capability.')
cnPnniCurNodes = MibScalar((1, 3, 6, 1, 4, 1, 930, 3, 5, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnPnniCurNodes.setStatus('mandatory')
if mibBuilder.loadTexts: cnPnniCurNodes.setDescription('The number of PNNI logical nodes currently configured in the switching system.')
lecsConfExtTable = MibTable((1, 3, 6, 1, 4, 1, 930, 3, 5, 2, 1), )
if mibBuilder.loadTexts: lecsConfExtTable.setStatus('mandatory')
if mibBuilder.loadTexts: lecsConfExtTable.setDescription('This table contains the configuration information that are additional to the existing lecsConfTable')
lecsConfExtEntry = MibTableRow((1, 3, 6, 1, 4, 1, 930, 3, 5, 2, 1, 1), ).setIndexNames((0, "LAN-EMULATION-ELAN-MIB", "lecsConfIndex"))
if mibBuilder.loadTexts: lecsConfExtEntry.setStatus('mandatory')
if mibBuilder.loadTexts: lecsConfExtEntry.setDescription('Each entry represents a LECS this agent maintains in this extension table. A row in this table is not valid unless the same row is valid in the lecsConfTable defined in af1129r5.mib')
lecsConfExtScope = MibTableColumn((1, 3, 6, 1, 4, 1, 930, 3, 5, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 104))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: lecsConfExtScope.setStatus('mandatory')
if mibBuilder.loadTexts: lecsConfExtScope.setDescription('PNNI scope value')
cnPnniMemConsumptionLowwater = MibScalar((1, 3, 6, 1, 4, 1, 930, 3, 5, 3, 1), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cnPnniMemConsumptionLowwater.setStatus('mandatory')
if mibBuilder.loadTexts: cnPnniMemConsumptionLowwater.setDescription('The value of low memory watermark. If memory allocated to PNNI task is less than this value, then the Database resynchronization be attempted.')
cnPnniMemConsumptionHighwater = MibScalar((1, 3, 6, 1, 4, 1, 930, 3, 5, 3, 2), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cnPnniMemConsumptionHighwater.setStatus('mandatory')
if mibBuilder.loadTexts: cnPnniMemConsumptionHighwater.setDescription('The value of high memory watermark. If memory allocated to PNNI task is greater than this value, then the node will enter to topology database overload state.')
cnPnniOverLoadRetryTime = MibScalar((1, 3, 6, 1, 4, 1, 930, 3, 5, 3, 3), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cnPnniOverLoadRetryTime.setStatus('mandatory')
if mibBuilder.loadTexts: cnPnniOverLoadRetryTime.setDescription('The value of the database resynch attempt timer in seconds.')
mibBuilder.exportSymbols("PNNI-EXT-MIB", lecsConfExtEntry=lecsConfExtEntry, cnPnniTdbOverload=cnPnniTdbOverload, lecsConfExtTable=lecsConfExtTable, cnPnniOverLoadRetryTime=cnPnniOverLoadRetryTime, cnPnniMainExt=cnPnniMainExt, cnPnniCurNodes=cnPnniCurNodes, cnPnniMemConsumptionHighwater=cnPnniMemConsumptionHighwater, cnPnniExt=cnPnniExt, cnPnniMemConsumptionLowwater=cnPnniMemConsumptionLowwater, lecsConfExtScope=lecsConfExtScope, cnPnnilecsExt=cnPnnilecsExt, cnPnniAdminStatus=cnPnniAdminStatus)
| (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, value_range_constraint, single_value_constraint, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'ConstraintsUnion', 'ValueRangeConstraint', 'SingleValueConstraint', 'ValueSizeConstraint')
(extensions,) = mibBuilder.importSymbols('CENTILLION-ROOT-MIB', 'extensions')
(lecs_conf_index,) = mibBuilder.importSymbols('LAN-EMULATION-ELAN-MIB', 'lecsConfIndex')
(notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance')
(unsigned32, bits, module_identity, mib_identifier, ip_address, iso, notification_type, gauge32, counter64, integer32, mib_scalar, mib_table, mib_table_row, mib_table_column, time_ticks, counter32, object_identity) = mibBuilder.importSymbols('SNMPv2-SMI', 'Unsigned32', 'Bits', 'ModuleIdentity', 'MibIdentifier', 'IpAddress', 'iso', 'NotificationType', 'Gauge32', 'Counter64', 'Integer32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'TimeTicks', 'Counter32', 'ObjectIdentity')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
cn_pnni_ext = mib_identifier((1, 3, 6, 1, 4, 1, 930, 3, 5))
cn_pnni_main_ext = mib_identifier((1, 3, 6, 1, 4, 1, 930, 3, 5, 1))
cn_pnnilecs_ext = mib_identifier((1, 3, 6, 1, 4, 1, 930, 3, 5, 2))
cn_pnni_tdb_overload = mib_identifier((1, 3, 6, 1, 4, 1, 930, 3, 5, 3))
cn_pnni_admin_status = mib_scalar((1, 3, 6, 1, 4, 1, 930, 3, 5, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cnPnniAdminStatus.setStatus('mandatory')
if mibBuilder.loadTexts:
cnPnniAdminStatus.setDescription('The desired state of PNNI in the switching system. Setting this object to disabled(2) disables PNNI capability in the switch. Setting it to enabled(1) enables PNNI capability.')
cn_pnni_cur_nodes = mib_scalar((1, 3, 6, 1, 4, 1, 930, 3, 5, 1, 2), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cnPnniCurNodes.setStatus('mandatory')
if mibBuilder.loadTexts:
cnPnniCurNodes.setDescription('The number of PNNI logical nodes currently configured in the switching system.')
lecs_conf_ext_table = mib_table((1, 3, 6, 1, 4, 1, 930, 3, 5, 2, 1))
if mibBuilder.loadTexts:
lecsConfExtTable.setStatus('mandatory')
if mibBuilder.loadTexts:
lecsConfExtTable.setDescription('This table contains the configuration information that are additional to the existing lecsConfTable')
lecs_conf_ext_entry = mib_table_row((1, 3, 6, 1, 4, 1, 930, 3, 5, 2, 1, 1)).setIndexNames((0, 'LAN-EMULATION-ELAN-MIB', 'lecsConfIndex'))
if mibBuilder.loadTexts:
lecsConfExtEntry.setStatus('mandatory')
if mibBuilder.loadTexts:
lecsConfExtEntry.setDescription('Each entry represents a LECS this agent maintains in this extension table. A row in this table is not valid unless the same row is valid in the lecsConfTable defined in af1129r5.mib')
lecs_conf_ext_scope = mib_table_column((1, 3, 6, 1, 4, 1, 930, 3, 5, 2, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 104))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
lecsConfExtScope.setStatus('mandatory')
if mibBuilder.loadTexts:
lecsConfExtScope.setDescription('PNNI scope value')
cn_pnni_mem_consumption_lowwater = mib_scalar((1, 3, 6, 1, 4, 1, 930, 3, 5, 3, 1), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cnPnniMemConsumptionLowwater.setStatus('mandatory')
if mibBuilder.loadTexts:
cnPnniMemConsumptionLowwater.setDescription('The value of low memory watermark. If memory allocated to PNNI task is less than this value, then the Database resynchronization be attempted.')
cn_pnni_mem_consumption_highwater = mib_scalar((1, 3, 6, 1, 4, 1, 930, 3, 5, 3, 2), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cnPnniMemConsumptionHighwater.setStatus('mandatory')
if mibBuilder.loadTexts:
cnPnniMemConsumptionHighwater.setDescription('The value of high memory watermark. If memory allocated to PNNI task is greater than this value, then the node will enter to topology database overload state.')
cn_pnni_over_load_retry_time = mib_scalar((1, 3, 6, 1, 4, 1, 930, 3, 5, 3, 3), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cnPnniOverLoadRetryTime.setStatus('mandatory')
if mibBuilder.loadTexts:
cnPnniOverLoadRetryTime.setDescription('The value of the database resynch attempt timer in seconds.')
mibBuilder.exportSymbols('PNNI-EXT-MIB', lecsConfExtEntry=lecsConfExtEntry, cnPnniTdbOverload=cnPnniTdbOverload, lecsConfExtTable=lecsConfExtTable, cnPnniOverLoadRetryTime=cnPnniOverLoadRetryTime, cnPnniMainExt=cnPnniMainExt, cnPnniCurNodes=cnPnniCurNodes, cnPnniMemConsumptionHighwater=cnPnniMemConsumptionHighwater, cnPnniExt=cnPnniExt, cnPnniMemConsumptionLowwater=cnPnniMemConsumptionLowwater, lecsConfExtScope=lecsConfExtScope, cnPnnilecsExt=cnPnnilecsExt, cnPnniAdminStatus=cnPnniAdminStatus) |
# flake8: noqa
bm25 = BatchRetrieve(index, "BM25")
axiom = (ArgUC() & QTArg() & QTPArg()) | ORIG()
# Re-rank top-20 documents with KwikSort.
kwiksort = bm25 % 20 >> \
KwikSortReranker(axiom, index)
pipeline = kwiksort ^ bm25
| bm25 = batch_retrieve(index, 'BM25')
axiom = arg_uc() & qt_arg() & qtp_arg() | orig()
kwiksort = bm25 % 20 >> kwik_sort_reranker(axiom, index)
pipeline = kwiksort ^ bm25 |
ciphertext = "WAPSD EXTCO EEREF SELIO RSARC LIETE OIHHP VASTF EGBER IPAPN TOEGI AIATH DDHIY EACYE RQAEN OHRTE TEVME BGHMF EIOWS GFHCL XEUUC OMTOT LERES SDEWW ORCCS HEURE ATTEG ALSEB APXET IURWV RTEEH IOTLO SNACN NULCV LCMTH HHCOH TIOTD ASNAL TSANA CASOR LEKAS TATCW INTLO TRYER YLTND RILER AOMAX OITDE ECOIA HAALS TYIOA DAEHI OTSTE IEYES HHSNG EHCAT SOUAC EHSST TCODN FSOTS TIIGN LTTNL DUBST TCMIM EHTAO IUUPF TSTTI PUEAY OAEOA EEALA LWGWM GNHYU IAAHD TORYA OLVMH RHTGY IHNNM UAARL MMHID HYFCP GRAET MTCNT HIIIO RCVCL BOTSA OFRNR YEHTG IFHEA WLYSC EEEEY UVEIM SOEUE TAYHN NITEK AERAW DSIAE QTDIE HET".replace(" ","")
def getLineLength(l_cipher,line,key):
n = key
q = l_cipher // (2*n-2)
r = l_cipher % (2*n-2)
assert type(q) is int
if line == 1:
return (q+1) if r >= 1 else q
elif line == key:
return (q+1) if r >= key else q
else:
if r >= (2*n-2) - (line - 2):
return 2*q + 2
elif r >= line:
return 2*q + 1
else:
return 2*q
def sumRowIndex(l_cipher,row,key):
sum = 0
for line in range (1,row+1):
sum += getLineLength(l_cipher,line,key)
return sum
def decrypt(cipher,key):
plain = ''
l = len(cipher)
for i in range (1,l+1):
# i = nq + r
n = key
q = i // (2*n-2)
r = i % (2*n-2)
if r >= key + 1:
row = key - (r-key)
column = 2*q + 2
elif r == key:
row = key
column = q + 1
elif r >= 2:
row = r
column = 2*q +1
elif r == 1:
row = 1
column = q+1
else:
row = 2
column = 2*q
print(i, sumRowIndex(l,row-1,key)+column)
print(plain)
plain += cipher[sumRowIndex(l,row-1,key)+column-1]
return plain
test_vector = 'WECRL TEERD SOEEF EAOCA IVDEN'.replace(' ','')
print(decrypt(ciphertext,17))
| ciphertext = 'WAPSD EXTCO EEREF SELIO RSARC LIETE OIHHP VASTF EGBER IPAPN TOEGI AIATH DDHIY EACYE RQAEN OHRTE TEVME BGHMF EIOWS GFHCL XEUUC OMTOT LERES SDEWW ORCCS HEURE ATTEG ALSEB APXET IURWV RTEEH IOTLO SNACN NULCV LCMTH HHCOH TIOTD ASNAL TSANA CASOR LEKAS TATCW INTLO TRYER YLTND RILER AOMAX OITDE ECOIA HAALS TYIOA DAEHI OTSTE IEYES HHSNG EHCAT SOUAC EHSST TCODN FSOTS TIIGN LTTNL DUBST TCMIM EHTAO IUUPF TSTTI PUEAY OAEOA EEALA LWGWM GNHYU IAAHD TORYA OLVMH RHTGY IHNNM UAARL MMHID HYFCP GRAET MTCNT HIIIO RCVCL BOTSA OFRNR YEHTG IFHEA WLYSC EEEEY UVEIM SOEUE TAYHN NITEK AERAW DSIAE QTDIE HET'.replace(' ', '')
def get_line_length(l_cipher, line, key):
n = key
q = l_cipher // (2 * n - 2)
r = l_cipher % (2 * n - 2)
assert type(q) is int
if line == 1:
return q + 1 if r >= 1 else q
elif line == key:
return q + 1 if r >= key else q
elif r >= 2 * n - 2 - (line - 2):
return 2 * q + 2
elif r >= line:
return 2 * q + 1
else:
return 2 * q
def sum_row_index(l_cipher, row, key):
sum = 0
for line in range(1, row + 1):
sum += get_line_length(l_cipher, line, key)
return sum
def decrypt(cipher, key):
plain = ''
l = len(cipher)
for i in range(1, l + 1):
n = key
q = i // (2 * n - 2)
r = i % (2 * n - 2)
if r >= key + 1:
row = key - (r - key)
column = 2 * q + 2
elif r == key:
row = key
column = q + 1
elif r >= 2:
row = r
column = 2 * q + 1
elif r == 1:
row = 1
column = q + 1
else:
row = 2
column = 2 * q
print(i, sum_row_index(l, row - 1, key) + column)
print(plain)
plain += cipher[sum_row_index(l, row - 1, key) + column - 1]
return plain
test_vector = 'WECRL TEERD SOEEF EAOCA IVDEN'.replace(' ', '')
print(decrypt(ciphertext, 17)) |
class PractitionerTemplate:
def __init__(self):
super().__init__()
def practitioner_default(self, data_list):
keys = []
for data in data_list:
key = f"{data.get('rowid')},{data.get('employee_id')}"
keys.append(key)
return keys
| class Practitionertemplate:
def __init__(self):
super().__init__()
def practitioner_default(self, data_list):
keys = []
for data in data_list:
key = f"{data.get('rowid')},{data.get('employee_id')}"
keys.append(key)
return keys |
def update_bit(num, bit, value):
mask = ~(1 << bit)
return (num & mask) | (value << bit)
def get_bit(num, bit):
return (num & (1 << bit)) != 0
def insert_bits(n, m, i, j):
for bit in range(i, j + 1):
n = update_bit(n, bit, get_bit(m, bit - i))
return n
def insert_bits_mask(n, m, i, j):
mask = (~0 << (j + 1)) + ~(~0 << i)
n = n & mask
m = m << i
return n | m
n = 2**11
m = 0b10011
i = 2
j = 6
bin(insert_bits(n, m, 2, 6))
bin(insert_bits_mask(n, m, 2, 6))
| def update_bit(num, bit, value):
mask = ~(1 << bit)
return num & mask | value << bit
def get_bit(num, bit):
return num & 1 << bit != 0
def insert_bits(n, m, i, j):
for bit in range(i, j + 1):
n = update_bit(n, bit, get_bit(m, bit - i))
return n
def insert_bits_mask(n, m, i, j):
mask = (~0 << j + 1) + ~(~0 << i)
n = n & mask
m = m << i
return n | m
n = 2 ** 11
m = 19
i = 2
j = 6
bin(insert_bits(n, m, 2, 6))
bin(insert_bits_mask(n, m, 2, 6)) |
nodes = [[1,3], [0,2], [1,3], [0,2]]
otherNodes = [[1,2,3], [0,2], [0,1,3], [0,2]]
def isBipartite(nodes):
colors = [0] * len(nodes)
for index, node in enumerate(nodes):
if colors[index] == 0 and not properColor(nodes, colors, 1, index):
return False
return True
def properColor(graph, colors, color, nodeNum):
if colors[nodeNum] != 0:
return colors[nodeNum] == color
colors[nodeNum] = color
for children in graph[nodeNum]:
if not properColor(graph, colors, -color, children):
return False
return True
print(isBipartite(nodes))
print(isBipartite(otherNodes)) | nodes = [[1, 3], [0, 2], [1, 3], [0, 2]]
other_nodes = [[1, 2, 3], [0, 2], [0, 1, 3], [0, 2]]
def is_bipartite(nodes):
colors = [0] * len(nodes)
for (index, node) in enumerate(nodes):
if colors[index] == 0 and (not proper_color(nodes, colors, 1, index)):
return False
return True
def proper_color(graph, colors, color, nodeNum):
if colors[nodeNum] != 0:
return colors[nodeNum] == color
colors[nodeNum] = color
for children in graph[nodeNum]:
if not proper_color(graph, colors, -color, children):
return False
return True
print(is_bipartite(nodes))
print(is_bipartite(otherNodes)) |
manipulated_string = input()
while True:
line = input()
if line == "end":
break
command_element = line.split(' ')
command = command_element[0]
first_condition = int(command_element[1])
if command == 'Right':
for i in range(first_condition):
manipulated_string = manipulated_string[-1] + manipulated_string[0:len(manipulated_string)-1]
elif command == 'Left':
for i in range(first_condition):
manipulated_string = manipulated_string[1:len(manipulated_string)] + manipulated_string[0]
elif command == 'Delete':
second_condition = int(command_element[2])
manipulated_string = manipulated_string.replace(manipulated_string[first_condition:second_condition+1], '')
elif command == 'Insert':
second_condition = command_element[2]
if first_condition == 0:
manipulated_string = second_condition + manipulated_string
else:
manipulated_string = manipulated_string[0:first_condition] + second_condition + manipulated_string[(first_condition+1):len(manipulated_string)]
else:
print(f'Unsolved command: {command}')
print(manipulated_string) | manipulated_string = input()
while True:
line = input()
if line == 'end':
break
command_element = line.split(' ')
command = command_element[0]
first_condition = int(command_element[1])
if command == 'Right':
for i in range(first_condition):
manipulated_string = manipulated_string[-1] + manipulated_string[0:len(manipulated_string) - 1]
elif command == 'Left':
for i in range(first_condition):
manipulated_string = manipulated_string[1:len(manipulated_string)] + manipulated_string[0]
elif command == 'Delete':
second_condition = int(command_element[2])
manipulated_string = manipulated_string.replace(manipulated_string[first_condition:second_condition + 1], '')
elif command == 'Insert':
second_condition = command_element[2]
if first_condition == 0:
manipulated_string = second_condition + manipulated_string
else:
manipulated_string = manipulated_string[0:first_condition] + second_condition + manipulated_string[first_condition + 1:len(manipulated_string)]
else:
print(f'Unsolved command: {command}')
print(manipulated_string) |
c = {a: 1, b: 2}
fun(a, b, **c)
# EXPECTED:
[
...,
LOAD_NAME('fun'),
...,
BUILD_TUPLE(2),
...,
CALL_FUNCTION_EX(1),
...,
]
| c = {a: 1, b: 2}
fun(a, b, **c)
[..., load_name('fun'), ..., build_tuple(2), ..., call_function_ex(1), ...] |
entrada = 'Gilberto'
saida = '{:+^12}'.format(entrada)
print(saida)
entrada = 'sensoriamento remoto'
saida = entrada.capitalize()
print(saida)
entrada = 'sensoriamento remoto'
saida = entrada.title()
print(saida)
entrada = 'GilberTo'
saida = entrada.lower()
print(saida)
entrada = 'Gilberto'
saida = '{:*<10}'.format(entrada)
print(saida)
entrada = 'Gilberto'
saida = '{:*>10}'.format(entrada)
print(saida)
entrada = ' Gilberto'
saida = entrada.strip()
print(saida)
entrada = 'ser347@dpi.inpe.br'
saida = entrada.partition('@')
print(saida)
entrada = 'CBERS_4_PAN5M_20180308'
saida = entrada.split('_')
print(saida)
entrada = 'Gilberto@@@'
saida = entrada.strip('@')
print(saida)
entrada = '@@Gilberto@@@'
saida = entrada.strip('@')
print = saida
| entrada = 'Gilberto'
saida = '{:+^12}'.format(entrada)
print(saida)
entrada = 'sensoriamento remoto'
saida = entrada.capitalize()
print(saida)
entrada = 'sensoriamento remoto'
saida = entrada.title()
print(saida)
entrada = 'GilberTo'
saida = entrada.lower()
print(saida)
entrada = 'Gilberto'
saida = '{:*<10}'.format(entrada)
print(saida)
entrada = 'Gilberto'
saida = '{:*>10}'.format(entrada)
print(saida)
entrada = ' Gilberto'
saida = entrada.strip()
print(saida)
entrada = 'ser347@dpi.inpe.br'
saida = entrada.partition('@')
print(saida)
entrada = 'CBERS_4_PAN5M_20180308'
saida = entrada.split('_')
print(saida)
entrada = 'Gilberto@@@'
saida = entrada.strip('@')
print(saida)
entrada = '@@Gilberto@@@'
saida = entrada.strip('@')
print = saida |
n = int(input())
l = {}
for i in range(n):
k = input()
if k in l:
l[k] += 1
else:
l[k] = 1
print(len(l))
for i in l:
print(l[i], end=" ")
| n = int(input())
l = {}
for i in range(n):
k = input()
if k in l:
l[k] += 1
else:
l[k] = 1
print(len(l))
for i in l:
print(l[i], end=' ') |
# @Time: 2022/4/12 20:29
# @Author: chang liu
# @Email: chang_liu_tamu@gmail.com
# @File:4-3-Creating-New-Iteration-Patterns-With-Generators.py
def frange(start, stop, increment):
x = start
while x < stop:
yield x
x += increment
# for n in frange(1, 5, 0.6):
# print(n)
def countdown(n):
print(f"starting counting from {n}")
while n > 0:
yield n
n -= 1
print("Done")
g = countdown(3)
print(next(g))
print(next(g))
print(next(g))
#stuck in yield point
# print(next(g))
print("*" * 30)
i = iter([])
print(next(i)) | def frange(start, stop, increment):
x = start
while x < stop:
yield x
x += increment
def countdown(n):
print(f'starting counting from {n}')
while n > 0:
yield n
n -= 1
print('Done')
g = countdown(3)
print(next(g))
print(next(g))
print(next(g))
print('*' * 30)
i = iter([])
print(next(i)) |
# https://leetcode.com/explore/learn/card/fun-with-arrays/527/searching-for-items-in-an-array/3251/
class Solution:
def validMountainArray(self, arr: List[int]) -> bool:
inc = True
incd = False
decd = False
for i,elmnt in enumerate(arr):
if i == 0:continue
if (inc == True) and (arr[i]>arr[i-1]):
incd = True
continue
else:
inc = False
if (inc == False) and (incd == True) and (arr[i]<arr[i-1]):
decd = True
continue
else:
return False
if incd == True and decd==True:
return True | class Solution:
def valid_mountain_array(self, arr: List[int]) -> bool:
inc = True
incd = False
decd = False
for (i, elmnt) in enumerate(arr):
if i == 0:
continue
if inc == True and arr[i] > arr[i - 1]:
incd = True
continue
else:
inc = False
if inc == False and incd == True and (arr[i] < arr[i - 1]):
decd = True
continue
else:
return False
if incd == True and decd == True:
return True |
def get_input() -> list:
with open(f"{__file__.rstrip('code.py')}input.txt") as f:
return [int(l[:-1]) for l in f.readlines()]
def has_pair(sum_val: int, vals: list) -> bool:
for idx_i, i in enumerate(vals):
for j in vals[idx_i+1:]:
if i + j == sum_val:
return True
return False
def find_invalid(numbers: list, preamble: int) -> int:
for idx, val in enumerate(numbers[preamble:]):
if not has_pair(val, numbers[idx:preamble+idx]):
return val
def part1(vals: list, preamble: int) -> int:
return find_invalid(vals, preamble)
def part2(vals: list, preamble: int) -> int:
invalid_number = find_invalid(vals, preamble)
count = len(vals)
for x in range(count):
set_sum = vals[x]
for y in range(x+1, count):
set_sum += vals[y]
if set_sum == invalid_number:
return min(vals[x:y]) + max(vals[x:y])
if set_sum > invalid_number:
break
def main():
file_input = get_input()
print(f"Part 1: {part1(file_input, 25)}")
print(f"Part 2: {part2(file_input, 25)}")
def test():
test_input = [
35,
20,
15,
25,
47,
40,
62,
55,
65,
95,
102,
117,
150,
182,
127,
219,
299,
277,
309,
576,
]
assert part1(test_input, 5) == 127
assert part2(test_input, 5) == 62
if __name__ == "__main__":
test()
main()
| def get_input() -> list:
with open(f"{__file__.rstrip('code.py')}input.txt") as f:
return [int(l[:-1]) for l in f.readlines()]
def has_pair(sum_val: int, vals: list) -> bool:
for (idx_i, i) in enumerate(vals):
for j in vals[idx_i + 1:]:
if i + j == sum_val:
return True
return False
def find_invalid(numbers: list, preamble: int) -> int:
for (idx, val) in enumerate(numbers[preamble:]):
if not has_pair(val, numbers[idx:preamble + idx]):
return val
def part1(vals: list, preamble: int) -> int:
return find_invalid(vals, preamble)
def part2(vals: list, preamble: int) -> int:
invalid_number = find_invalid(vals, preamble)
count = len(vals)
for x in range(count):
set_sum = vals[x]
for y in range(x + 1, count):
set_sum += vals[y]
if set_sum == invalid_number:
return min(vals[x:y]) + max(vals[x:y])
if set_sum > invalid_number:
break
def main():
file_input = get_input()
print(f'Part 1: {part1(file_input, 25)}')
print(f'Part 2: {part2(file_input, 25)}')
def test():
test_input = [35, 20, 15, 25, 47, 40, 62, 55, 65, 95, 102, 117, 150, 182, 127, 219, 299, 277, 309, 576]
assert part1(test_input, 5) == 127
assert part2(test_input, 5) == 62
if __name__ == '__main__':
test()
main() |
n = int(input())
arr = [int(x) for x in input().split()]
counter = [0]*1001
for i in range(n):
counter[arr[i]] += 1
counts = []
for i in range(1001):
if counter[i] > 0:
counts.append((counter[i],i))
counts.sort(key=lambda x: (-x[0], x[1]))
q = []
for freq,i in counts:
q.extend([i]*freq)
j = 0
out = [None]*n
for i in range(0,n,2):
out[i] = q[j]
j += 1
for i in range(1,n,2):
out[i] = q[j]
j += 1
# print(out)
msg = "YES"
for i in range(1,n):
if out[i] == out[i-1]:
msg = "NO"
break
print(msg)
| n = int(input())
arr = [int(x) for x in input().split()]
counter = [0] * 1001
for i in range(n):
counter[arr[i]] += 1
counts = []
for i in range(1001):
if counter[i] > 0:
counts.append((counter[i], i))
counts.sort(key=lambda x: (-x[0], x[1]))
q = []
for (freq, i) in counts:
q.extend([i] * freq)
j = 0
out = [None] * n
for i in range(0, n, 2):
out[i] = q[j]
j += 1
for i in range(1, n, 2):
out[i] = q[j]
j += 1
msg = 'YES'
for i in range(1, n):
if out[i] == out[i - 1]:
msg = 'NO'
break
print(msg) |
def testIter(encoder, decoder, sentence, word2ix, ix2word, max_length=20):
input_variable = sentence
input_length = input_variable.size()[0]
encoder_hidden = encoder.initHidden()
encoder_outputs = Variable(torch.zeros(max_length, encoder.hidden_size))
if use_cuda:
encoder_outputs = encoder_outputs.cuda()
for ei in range(input_length):
encoder_output, encoder_hidden = encoder(input_variable[ei],
encoder_hidden)
encoder_outputs[ei] = encoder_outputs[ei] + encoder_output[0][0]
decoder_input = Variable(torch.LongTensor([[BOS_TOKEN_ix]]))
if use_cuda:
decoder_input = decoder_input.cuda()
decoder_hidden = encoder_hidden
decoded_words = []
if decoder.attn_status:
decoder_attentions = torch.zeros(max_length, max_length)
for di in range(max_length):
if decoder.attn_status:
decoder_output, decoder_hidden, decoder_attention = decoder(
decoder_input, decoder_hidden, encoder_outputs)
decoder_attentions[di] = decoder_attention.data
else:
decoder_output, decoder_hidden = decoder(decoder_input, decoder_hidden)
topv, topi = decoder_output.data.topk(1)
ni = topi[0][0]
if ni == EOS_TOKEN_ix:
decoded_words.append(EOS_TOKEN)
break
else:
decoded_words.append(ix2word[str(ni)])
decoder_input = Variable(torch.LongTensor([[ni]]))
if use_cuda:
decoder_input = decoder_input.cuda()
if decoder.attn_status:
return decoded_words, decoder_attentions[:di + 1]
else:
return decoded_words
def testModel(encoder, decoder, dataset, word2ix, ix2word,
n=10, max_length=20):
for i in range(n):
pair = random.choice(dataset)
input_str = ''.join(e for e in \
preprocessing.convertIndexSentenceToWord(pair['input']))
target_str = ''.join(e for e in \
preprocessing.convertIndexSentenceToWord(pair['target']))
print('>', input_str)
print('=', target_str)
temp = Variable(torch.LongTensor(pair['input']).view(-1, 1))
if USE_CUDA:
temp = temp.cuda()
output_words, attentions = evaluate(encoder, decoder, temp,
word2ix, ix2word,
max_length=max_length)
output_sentence = ' '.join(output_words)
print('<', output_sentence)
print('')
encoder.load_state_dict(torch.load("encoder.ckpt"))
decoder.load_state_dict(torch.load("decoder.ckpt")) | def test_iter(encoder, decoder, sentence, word2ix, ix2word, max_length=20):
input_variable = sentence
input_length = input_variable.size()[0]
encoder_hidden = encoder.initHidden()
encoder_outputs = variable(torch.zeros(max_length, encoder.hidden_size))
if use_cuda:
encoder_outputs = encoder_outputs.cuda()
for ei in range(input_length):
(encoder_output, encoder_hidden) = encoder(input_variable[ei], encoder_hidden)
encoder_outputs[ei] = encoder_outputs[ei] + encoder_output[0][0]
decoder_input = variable(torch.LongTensor([[BOS_TOKEN_ix]]))
if use_cuda:
decoder_input = decoder_input.cuda()
decoder_hidden = encoder_hidden
decoded_words = []
if decoder.attn_status:
decoder_attentions = torch.zeros(max_length, max_length)
for di in range(max_length):
if decoder.attn_status:
(decoder_output, decoder_hidden, decoder_attention) = decoder(decoder_input, decoder_hidden, encoder_outputs)
decoder_attentions[di] = decoder_attention.data
else:
(decoder_output, decoder_hidden) = decoder(decoder_input, decoder_hidden)
(topv, topi) = decoder_output.data.topk(1)
ni = topi[0][0]
if ni == EOS_TOKEN_ix:
decoded_words.append(EOS_TOKEN)
break
else:
decoded_words.append(ix2word[str(ni)])
decoder_input = variable(torch.LongTensor([[ni]]))
if use_cuda:
decoder_input = decoder_input.cuda()
if decoder.attn_status:
return (decoded_words, decoder_attentions[:di + 1])
else:
return decoded_words
def test_model(encoder, decoder, dataset, word2ix, ix2word, n=10, max_length=20):
for i in range(n):
pair = random.choice(dataset)
input_str = ''.join((e for e in preprocessing.convertIndexSentenceToWord(pair['input'])))
target_str = ''.join((e for e in preprocessing.convertIndexSentenceToWord(pair['target'])))
print('>', input_str)
print('=', target_str)
temp = variable(torch.LongTensor(pair['input']).view(-1, 1))
if USE_CUDA:
temp = temp.cuda()
(output_words, attentions) = evaluate(encoder, decoder, temp, word2ix, ix2word, max_length=max_length)
output_sentence = ' '.join(output_words)
print('<', output_sentence)
print('')
encoder.load_state_dict(torch.load('encoder.ckpt'))
decoder.load_state_dict(torch.load('decoder.ckpt')) |
#!/usr/bin/python
'''
From careercup.com
Write a pattern matching function using wild char
? Matches any char exactly one instance
* Matches one or more instances of previous char
Ex text = "abcd" pattern = "ab?d" True
Ex text = "abccdddef" pattern = "ab?*f" True
Ex text = "abccd" pattern = "ab?*ccd" false
(added missing cases, making assumptions for ambiguity)
Ex text = "abcd" pattern = "a*cd" False
Ex text = "abbbbcd" pattern = "ab*cd" True
Ex text = "aabbccdd" pattern = "a?*" and "?*" True
Not sure what to do with '?*?', ignoring
'''
def pattern_match(text, pattern):
if pattern[0] == '*':
return False # invalid pattern
i_txt = 0
i_pat = 0
prv_ch = ''
while (i_txt < len(text)):
if pattern[i_pat] not in ('?','*'):
if pattern[i_pat] != text[i_txt]:
return False
prv_ch = text[i_txt] # save in case of '*' next
i_pat += 1
i_txt += 1
elif pattern[i_pat] == '?':
prv_ch = '?' # save in case of '*' next
i_pat += 1
i_txt += 1
elif pattern[i_pat] == '*':
if prv_ch != '?':
while i_txt < len(text) and text[i_txt] == prv_ch:
i_txt += 1
i_pat += 1
else:
# end '?*' on next character match
# if no next character, return true (right?)
if i_pat + 1 == len(pattern):
return True
# find next char in pattern
i_pat += 1
assert pattern[i_pat] != '?', "do not handle ?*? yet"
while i_txt < len(text) and text[i_txt] != pattern[i_pat]:
i_txt += 1
# if not at end of pattern fail (except if '*')
if i_pat != len(pattern) and not (i_pat == len(pattern) - 1 and pattern[i_pat] == '*'):
return False
return True
s = "hello"
assert(pattern_match(s,"hello") is True)
assert(pattern_match(s,"h3ll0") is False)
assert(pattern_match(s,"h?llo") is True)
assert(pattern_match(s,"?????") is True)
assert(pattern_match(s,"h??lo") is True)
assert(pattern_match(s,"h?el?") is False)
assert(pattern_match(s,"hel*?") is True)
assert(pattern_match(s,"hel*o") is True)
assert(pattern_match(s,"he*o") is False)
assert(pattern_match(s,"hel*o*") is True)
assert(pattern_match(s,"h?*") is True)
assert(pattern_match(s,"h?*o") is True)
assert(pattern_match(s,"h?*llo") is True)
assert(pattern_match(s,"?*o") is True)
assert(pattern_match(s,"hel?*f") is False)
| """
From careercup.com
Write a pattern matching function using wild char
? Matches any char exactly one instance
* Matches one or more instances of previous char
Ex text = "abcd" pattern = "ab?d" True
Ex text = "abccdddef" pattern = "ab?*f" True
Ex text = "abccd" pattern = "ab?*ccd" false
(added missing cases, making assumptions for ambiguity)
Ex text = "abcd" pattern = "a*cd" False
Ex text = "abbbbcd" pattern = "ab*cd" True
Ex text = "aabbccdd" pattern = "a?*" and "?*" True
Not sure what to do with '?*?', ignoring
"""
def pattern_match(text, pattern):
if pattern[0] == '*':
return False
i_txt = 0
i_pat = 0
prv_ch = ''
while i_txt < len(text):
if pattern[i_pat] not in ('?', '*'):
if pattern[i_pat] != text[i_txt]:
return False
prv_ch = text[i_txt]
i_pat += 1
i_txt += 1
elif pattern[i_pat] == '?':
prv_ch = '?'
i_pat += 1
i_txt += 1
elif pattern[i_pat] == '*':
if prv_ch != '?':
while i_txt < len(text) and text[i_txt] == prv_ch:
i_txt += 1
i_pat += 1
else:
if i_pat + 1 == len(pattern):
return True
i_pat += 1
assert pattern[i_pat] != '?', 'do not handle ?*? yet'
while i_txt < len(text) and text[i_txt] != pattern[i_pat]:
i_txt += 1
if i_pat != len(pattern) and (not (i_pat == len(pattern) - 1 and pattern[i_pat] == '*')):
return False
return True
s = 'hello'
assert pattern_match(s, 'hello') is True
assert pattern_match(s, 'h3ll0') is False
assert pattern_match(s, 'h?llo') is True
assert pattern_match(s, '?????') is True
assert pattern_match(s, 'h??lo') is True
assert pattern_match(s, 'h?el?') is False
assert pattern_match(s, 'hel*?') is True
assert pattern_match(s, 'hel*o') is True
assert pattern_match(s, 'he*o') is False
assert pattern_match(s, 'hel*o*') is True
assert pattern_match(s, 'h?*') is True
assert pattern_match(s, 'h?*o') is True
assert pattern_match(s, 'h?*llo') is True
assert pattern_match(s, '?*o') is True
assert pattern_match(s, 'hel?*f') is False |
frase = str(input('Digite uma frase:\n->')).strip()
separado = frase.split()
junto = ''.join(separado)
correto = list(junto.upper())
invertido = list(reversed(junto.upper()))
print(correto)
print(invertido)
if correto == invertido:
print('verdadeiro')
else:
print('falso')
| frase = str(input('Digite uma frase:\n->')).strip()
separado = frase.split()
junto = ''.join(separado)
correto = list(junto.upper())
invertido = list(reversed(junto.upper()))
print(correto)
print(invertido)
if correto == invertido:
print('verdadeiro')
else:
print('falso') |
# Copied from https://rosettacode.org/wiki/Trabb_Pardo%E2%80%93Knuth_algorithm#Python
def f(x):
return abs(x) ** 0.5 + 5 * x**3
def ask():
return [float(y)
for y in input('\n11 numbers: ').strip().split()[:11]]
if __name__ == '__main__':
s = ask()
s.reverse()
for x in s:
result = f(x)
if result > 400:
print(' %s:%s' % (x, "TOO LARGE!"), end='')
else:
print(' %s:%s' % (x, result), end='')
print('')
| def f(x):
return abs(x) ** 0.5 + 5 * x ** 3
def ask():
return [float(y) for y in input('\n11 numbers: ').strip().split()[:11]]
if __name__ == '__main__':
s = ask()
s.reverse()
for x in s:
result = f(x)
if result > 400:
print(' %s:%s' % (x, 'TOO LARGE!'), end='')
else:
print(' %s:%s' % (x, result), end='')
print('') |
def toBaseTen(n, base):
'''
This function takes arguments: number that you want to convert and its base
It will return an int in base 10
Examples:
..................
>>> toBaseTen(2112, 3)
68
..................
>>> toBaseTen('AB12', 12)
61904
..................
>>> toBaseTen('AB12', 16)
111828
..................
'''
baseTen = 0
num = str(num)
for i in range(len(num)):
baseTen += base ** (len(num) - 1 - i) * int(num[i], 36)
return baseTen
def toAnyBase(num, base):
'''
This function takes 2 arguments: number (in base 10, if you have number in any other base,
please use toBaseTen function first to get get your number in base 10) and base that you
want to convert your number to.
It will return a string
Examples:
..................
>>> toAnyBase(23412,30)
'Q0C'
..................
>>> toAnyBase(23412,15)
'6E0C'
..................
>>> toAnyBase(12, 2)
'1100'
'''
bases = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
if num < base:
return bases[num]
else:
return toAnyBase(num // base, base) + bases[num % base] | def to_base_ten(n, base):
"""
This function takes arguments: number that you want to convert and its base
It will return an int in base 10
Examples:
..................
>>> toBaseTen(2112, 3)
68
..................
>>> toBaseTen('AB12', 12)
61904
..................
>>> toBaseTen('AB12', 16)
111828
..................
"""
base_ten = 0
num = str(num)
for i in range(len(num)):
base_ten += base ** (len(num) - 1 - i) * int(num[i], 36)
return baseTen
def to_any_base(num, base):
"""
This function takes 2 arguments: number (in base 10, if you have number in any other base,
please use toBaseTen function first to get get your number in base 10) and base that you
want to convert your number to.
It will return a string
Examples:
..................
>>> toAnyBase(23412,30)
'Q0C'
..................
>>> toAnyBase(23412,15)
'6E0C'
..................
>>> toAnyBase(12, 2)
'1100'
"""
bases = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
if num < base:
return bases[num]
else:
return to_any_base(num // base, base) + bases[num % base] |
vc = float(input('Qual o valor da casa: R$'))
s = float(input('Qual o seu salario'))
a = int(input('Em quantos anos voce quer pagar :'))
m = a * 12
p = vc/m
if s*(30/100) >= p :
print ('O emprestimo sera feito em {} anos com prestacoes mensais de R${:.2f} e foi aprovado '.format(a,p))
else:
print(' Emprestimo nao aprovado a prestacao de R${:.2f} e passa dos 30% so seu salario'.format(p))
| vc = float(input('Qual o valor da casa: R$'))
s = float(input('Qual o seu salario'))
a = int(input('Em quantos anos voce quer pagar :'))
m = a * 12
p = vc / m
if s * (30 / 100) >= p:
print('O emprestimo sera feito em {} anos com prestacoes mensais de R${:.2f} e foi aprovado '.format(a, p))
else:
print(' Emprestimo nao aprovado a prestacao de R${:.2f} e passa dos 30% so seu salario'.format(p)) |
grid = [
[0, 1, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0],
[0, 0, 0, 0, 1, 0],
]
goal = [len(grid) - 1, len(grid[0]) - 1]
cost = 1 # the cost associated with moving from a cell to an adjacent one
delta = [
[-1, 0], # go up
[0, -1], # go left
[1, 0], # go down
[0, 1],
] # go right
delta_name = ["^", "<", "v", ">"]
def compute_value(grid, goal, cost):
value = [[99 for row in range(len(grid[0]))] for col in range(len(grid))]
policy = [[" " for row in range(len(grid[0]))] for col in range(len(grid))]
change = True
while change:
change = False
for x in range(len(grid)):
for y in range(len(grid[0])):
# If it is goal
if goal[0] == x and goal[1] == y:
if value[x][y] > 0:
value[x][y] = 0
policy[x][y] = "*"
change = True
# If it is navigable
elif grid[x][y] == 0:
for a in range(len(delta)):
x2 = x + delta[a][0]
y2 = y + delta[a][1]
if (
x2 >= 0
and x2 < len(grid)
and y2 >= 0
and y2 < len(grid[0])
and grid[x2][y2] == 0
):
v2 = value[x2][y2] + cost
if v2 < value[x][y]:
change = True
value[x][y] = v2
policy[x][y] = delta_name[a]
for i in range(len(value)):
print(value[i])
for i in range(len(value)):
print(policy[i])
# make sure your function returns a grid of values as
# demonstrated in the previous video.
return value
compute_value(grid, goal, cost)
| grid = [[0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0]]
goal = [len(grid) - 1, len(grid[0]) - 1]
cost = 1
delta = [[-1, 0], [0, -1], [1, 0], [0, 1]]
delta_name = ['^', '<', 'v', '>']
def compute_value(grid, goal, cost):
value = [[99 for row in range(len(grid[0]))] for col in range(len(grid))]
policy = [[' ' for row in range(len(grid[0]))] for col in range(len(grid))]
change = True
while change:
change = False
for x in range(len(grid)):
for y in range(len(grid[0])):
if goal[0] == x and goal[1] == y:
if value[x][y] > 0:
value[x][y] = 0
policy[x][y] = '*'
change = True
elif grid[x][y] == 0:
for a in range(len(delta)):
x2 = x + delta[a][0]
y2 = y + delta[a][1]
if x2 >= 0 and x2 < len(grid) and (y2 >= 0) and (y2 < len(grid[0])) and (grid[x2][y2] == 0):
v2 = value[x2][y2] + cost
if v2 < value[x][y]:
change = True
value[x][y] = v2
policy[x][y] = delta_name[a]
for i in range(len(value)):
print(value[i])
for i in range(len(value)):
print(policy[i])
return value
compute_value(grid, goal, cost) |
## Read input as specified in the question.
## Print output as specified in the question.
# Pattern 1-212-32123...
# Reading number of rows
row = int(input())
# Generating pattern
for i in range(1,row+1):
# for space
for j in range(1, row+1-i):
print(' ', end='')
# for decreasing pattern
for j in range(i,0,-1):
print(j, end='')
# for increasing pattern
for j in range(2,i+1):
print(j, end='')
# Moving to next line
print()
| row = int(input())
for i in range(1, row + 1):
for j in range(1, row + 1 - i):
print(' ', end='')
for j in range(i, 0, -1):
print(j, end='')
for j in range(2, i + 1):
print(j, end='')
print() |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def run():
print("run")
main()
return None
def aaa():
print("aaa")
return None
def main():#
print ("Hello, test is running")
if __name__ == '__main__':
main()
| def run():
print('run')
main()
return None
def aaa():
print('aaa')
return None
def main():
print('Hello, test is running')
if __name__ == '__main__':
main() |
class GradientBoostingMachine():
def __init__(self, nEstimators = 100):
self.nEstimators = nEstimators
if __name__ == '__main__':
gbm = GradientBoostingMachine(nEstimators=10)
| class Gradientboostingmachine:
def __init__(self, nEstimators=100):
self.nEstimators = nEstimators
if __name__ == '__main__':
gbm = gradient_boosting_machine(nEstimators=10) |
def exp_sum(n):
p = n
# calculation taken from here
# https://math.stackexchange.com/questions/2675382/calculating-integer-partitions
def pentagonal_number(k):
return int(k * (3 * k - 1) / 2)
def compute_partitions(goal):
partitions = [1]
for n in range(1, goal + 1):
partitions.append(0)
for k in range(1, n + 1):
coeff = (-1) ** (k + 1)
for t in [pentagonal_number(k), pentagonal_number(-k)]:
if (n - t) >= 0:
partitions[n] = partitions[n] + coeff * partitions[n - t]
return partitions
return (compute_partitions(n))[-1] | def exp_sum(n):
p = n
def pentagonal_number(k):
return int(k * (3 * k - 1) / 2)
def compute_partitions(goal):
partitions = [1]
for n in range(1, goal + 1):
partitions.append(0)
for k in range(1, n + 1):
coeff = (-1) ** (k + 1)
for t in [pentagonal_number(k), pentagonal_number(-k)]:
if n - t >= 0:
partitions[n] = partitions[n] + coeff * partitions[n - t]
return partitions
return compute_partitions(n)[-1] |
def encode_for_get_list(src_data, thats_all_flag, default_keys, items_fetcher, item_handler):
if not isinstance(src_data, dict):
src_data = {"*": None}
result = {}
unknown_flag = False
for name, value in src_data.items():
if name == "*":
for name2 in items_fetcher():
if not name2 in src_data:
if value != None and value != {}:
result[name2] = item_handler(name2, value)
elif value == None and name2 in default_keys:
result[name2] = item_handler(name2, None)
else:
result[name2] = {}
unknown_flag = True
else:
d = item_handler(name, value)
if d != None:
result[name] = d
if unknown_flag and thats_all_flag:
result["*"] = None
return result
def encode_for_get_resource(data):
return encode_for_get_resource2(None, data, False)
def encode_for_get_resource2(src_data, curr_data, thats_all_flag):
if not isinstance(curr_data, dict):
return curr_data
if not isinstance(src_data, dict):
src_data = {"*": None}
result = {}
unknown_flag = False
for name, value in src_data.items():
if name == "*":
if value == None:
for name2, value2 in curr_data.items():
if not name2 in src_data:
result[name2] = encode_for_get_resource2(value, value2, thats_all_flag)
unknown_flag = True
elif name in curr_data:
result[name] = encode_for_get_resource2(value, curr_data[name], thats_all_flag)
else:
pass
if unknown_flag and thats_all_flag:
result["*"] = None
return result
def decode_for_put(src_data):
if isinstance(src_data, str):
return src_data
if not isinstance(src_data, dict):
return src_data
src_data2 = {}
for name, value in src_data.items():
if name == "*":
continue
src_data2[name] = decode_for_put(value)
return src_data2
| def encode_for_get_list(src_data, thats_all_flag, default_keys, items_fetcher, item_handler):
if not isinstance(src_data, dict):
src_data = {'*': None}
result = {}
unknown_flag = False
for (name, value) in src_data.items():
if name == '*':
for name2 in items_fetcher():
if not name2 in src_data:
if value != None and value != {}:
result[name2] = item_handler(name2, value)
elif value == None and name2 in default_keys:
result[name2] = item_handler(name2, None)
else:
result[name2] = {}
unknown_flag = True
else:
d = item_handler(name, value)
if d != None:
result[name] = d
if unknown_flag and thats_all_flag:
result['*'] = None
return result
def encode_for_get_resource(data):
return encode_for_get_resource2(None, data, False)
def encode_for_get_resource2(src_data, curr_data, thats_all_flag):
if not isinstance(curr_data, dict):
return curr_data
if not isinstance(src_data, dict):
src_data = {'*': None}
result = {}
unknown_flag = False
for (name, value) in src_data.items():
if name == '*':
if value == None:
for (name2, value2) in curr_data.items():
if not name2 in src_data:
result[name2] = encode_for_get_resource2(value, value2, thats_all_flag)
unknown_flag = True
elif name in curr_data:
result[name] = encode_for_get_resource2(value, curr_data[name], thats_all_flag)
else:
pass
if unknown_flag and thats_all_flag:
result['*'] = None
return result
def decode_for_put(src_data):
if isinstance(src_data, str):
return src_data
if not isinstance(src_data, dict):
return src_data
src_data2 = {}
for (name, value) in src_data.items():
if name == '*':
continue
src_data2[name] = decode_for_put(value)
return src_data2 |
#!/usr/bin/python
def generateSet(name, value, type, indentationLevel):
finalLine = " "*indentationLevel
finalLine += name
finalLine += " = "
if type == 'string':
# Whatever you use for defining strings (either single, double, etc.)
finalLine += '"' + value + '"'
else:
finalLine += value
finalLine += "\n"
return finalLine
def generateIf(comparison, leftHandType, leftHandValue, rightHandType, rightHandValue, indentationLevel):
finalLine = " " * indentationLevel
finalLine += "if "
if leftHandType == "string":
finalLine += '"' + leftHandValue + '"'
else:
finalLine += leftHandValue
if comparison == "equals":
finalLine += " == "
if rightHandType == "string":
finalLine += '"' + rightHandValue + '"'
else:
finalLine += rightHandValue
finalLine += ":\n"
return finalLine
def generateEndIf(indentationLevel):
finalLine = " "*indentationLevel
finalLine += "\n"
return finalLine | def generate_set(name, value, type, indentationLevel):
final_line = ' ' * indentationLevel
final_line += name
final_line += ' = '
if type == 'string':
final_line += '"' + value + '"'
else:
final_line += value
final_line += '\n'
return finalLine
def generate_if(comparison, leftHandType, leftHandValue, rightHandType, rightHandValue, indentationLevel):
final_line = ' ' * indentationLevel
final_line += 'if '
if leftHandType == 'string':
final_line += '"' + leftHandValue + '"'
else:
final_line += leftHandValue
if comparison == 'equals':
final_line += ' == '
if rightHandType == 'string':
final_line += '"' + rightHandValue + '"'
else:
final_line += rightHandValue
final_line += ':\n'
return finalLine
def generate_end_if(indentationLevel):
final_line = ' ' * indentationLevel
final_line += '\n'
return finalLine |
#
# PySNMP MIB module SIP-COMMON-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SIP-COMMON-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:04: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)
#
ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ValueRangeConstraint, ConstraintsIntersection, ConstraintsUnion, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsIntersection", "ConstraintsUnion", "SingleValueConstraint")
InetPortNumber, = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetPortNumber")
applIndex, = mibBuilder.importSymbols("NETWORK-SERVICES-MIB", "applIndex")
SipTCTransportProtocol, SipTCEntityRole, SipTCOptionTagHeaders, SipTCMethodName = mibBuilder.importSymbols("SIP-TC-MIB", "SipTCTransportProtocol", "SipTCEntityRole", "SipTCOptionTagHeaders", "SipTCMethodName")
SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString")
ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup")
Bits, ModuleIdentity, IpAddress, NotificationType, Gauge32, TimeTicks, MibScalar, MibTable, MibTableRow, MibTableColumn, iso, mib_2, Unsigned32, ObjectIdentity, MibIdentifier, Counter64, Counter32, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "ModuleIdentity", "IpAddress", "NotificationType", "Gauge32", "TimeTicks", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "mib-2", "Unsigned32", "ObjectIdentity", "MibIdentifier", "Counter64", "Counter32", "Integer32")
RowStatus, TextualConvention, TimeStamp, TruthValue, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "TextualConvention", "TimeStamp", "TruthValue", "DisplayString")
sipCommonMIB = ModuleIdentity((1, 3, 6, 1, 2, 1, 149))
sipCommonMIB.setRevisions(('2007-04-20 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: sipCommonMIB.setRevisionsDescriptions(('Initial version of the IETF SIP-COMMON-MIB module. This version published as part of RFC 4780.',))
if mibBuilder.loadTexts: sipCommonMIB.setLastUpdated('200704200000Z')
if mibBuilder.loadTexts: sipCommonMIB.setOrganization('IETF Session Initiation Protocol Working Group')
if mibBuilder.loadTexts: sipCommonMIB.setContactInfo('SIP WG email: sip@ietf.org Co-editor Kevin Lingle Cisco Systems, Inc. postal: 7025 Kit Creek Road P.O. Box 14987 Research Triangle Park, NC 27709 USA email: klingle@cisco.com phone: +1 919 476 2029 Co-editor Joon Maeng email: jmaeng@austin.rr.com Co-editor Jean-Francois Mule CableLabs postal: 858 Coal Creek Circle Louisville, CO 80027 USA email: jf.mule@cablelabs.com phone: +1 303 661 9100 Co-editor Dave Walker email: drwalker@rogers.com')
if mibBuilder.loadTexts: sipCommonMIB.setDescription('Session Initiation Protocol (SIP) Common MIB module. This module defines objects that may be common to all SIP entities. SIP is an application-layer signaling protocol for creating, modifying and terminating multimedia sessions with one or more participants. These sessions include Internet multimedia conferences and Internet telephone calls. SIP is defined in RFC 3261 (June 2002). This MIB is defined for managing objects that are common to SIP User Agents (UAs), Proxy, Redirect, and Registrar servers. Objects specific to each of these entities MAY be managed using entity specific MIBs defined in other modules. Copyright (C) The IETF Trust (2007). This version of this MIB module is part of RFC 4780; see the RFC itself for full legal notices.')
sipCommonMIBNotifications = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 0))
sipCommonMIBObjects = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 1))
sipCommonMIBConformance = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 2))
sipCommonCfgBase = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 1, 1))
sipCommonCfgTimer = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 1, 2))
sipCommonSummaryStats = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 1, 3))
sipCommonMethodStats = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 1, 4))
sipCommonStatusCode = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 1, 5))
sipCommonStatsTrans = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 1, 6))
sipCommonStatsRetry = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 1, 7))
sipCommonOtherStats = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 1, 8))
sipCommonNotifObjects = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 1, 9))
sipCommonCfgTable = MibTable((1, 3, 6, 1, 2, 1, 149, 1, 1, 1), )
if mibBuilder.loadTexts: sipCommonCfgTable.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTable.setDescription('This table contains the common configuration objects applicable to all SIP entities.')
sipCommonCfgEntry = MibTableRow((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"))
if mibBuilder.loadTexts: sipCommonCfgEntry.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgEntry.setDescription('A row of common configuration. Each row represents objects for a particular SIP entity instance present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sipCommonCfgProtocolVersion = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 1), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgProtocolVersion.setReference('RFC 3261, Section 7.1')
if mibBuilder.loadTexts: sipCommonCfgProtocolVersion.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgProtocolVersion.setDescription("This object will reflect the version of SIP supported by this SIP entity. It will follow the same format as SIP version information contained in the SIP messages generated by this SIP entity. For example, entities supporting SIP version 2 will return 'SIP/2.0' as dictated by the standard.")
sipCommonCfgServiceOperStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("unknown", 1), ("up", 2), ("down", 3), ("congested", 4), ("restarting", 5), ("quiescing", 6), ("testing", 7)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgServiceOperStatus.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgServiceOperStatus.setDescription('This object contains the current operational state of the SIP application. unknown : The operational status cannot be determined for some reason. up : The application is operating normally and is processing (receiving and possibly issuing) SIP requests and responses. down : The application is currently unable to process SIP messages. congested : The application is operational but no additional inbound transactions can be accommodated at the moment. restarting : The application is currently unavailable, but it is in the process of restarting and will presumably, soon be able to process SIP messages. quiescing : The application is currently operational but has been administratively put into quiescence mode. Additional inbound transactions MAY be rejected. testing : The application is currently in test mode and MAY not be able to process SIP messages. The operational status values defined for this object are not based on any specific information contained in the SIP standard.')
sipCommonCfgServiceStartTime = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 3), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgServiceStartTime.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgServiceStartTime.setDescription('The value of sysUpTime at the time the SIP entity was last started. If started prior to the last re-initialization of the local network management subsystem, then this object contains a zero value.')
sipCommonCfgServiceLastChange = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 4), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgServiceLastChange.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgServiceLastChange.setDescription('The value of sysUpTime at the time the SIP entity entered its current operational state. If the current state was entered prior to the last re-initialization of the local network management subsystem, then this object contains a zero value.')
sipCommonCfgOrganization = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 5), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgOrganization.setReference('RFC 3261, Section 20.25')
if mibBuilder.loadTexts: sipCommonCfgOrganization.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgOrganization.setDescription('This object contains the organization name that the SIP entity inserts into Organization headers of SIP messages processed by this system. If the string is empty, no Organization header is to be generated.')
sipCommonCfgMaxTransactions = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 6), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgMaxTransactions.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgMaxTransactions.setDescription("This object indicates the maximum number of simultaneous transactions per second that the SIP entity can manage. In general, the value of this object SHOULD reflect a level of transaction processing per second that is considered high enough to impact the system's CPU and/or memory resources to the point of deteriorating SIP call processing but not high enough to cause catastrophic system failure.")
sipCommonCfgServiceNotifEnable = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 7), Bits().clone(namedValues=NamedValues(("sipCommonServiceColdStart", 0), ("sipCommonServiceWarmStart", 1), ("sipCommonServiceStatusChanged", 2))).clone(namedValues=NamedValues(("sipCommonServiceColdStart", 0), ("sipCommonServiceWarmStart", 1)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sipCommonCfgServiceNotifEnable.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgServiceNotifEnable.setDescription("This object specifies which SIP service related notifications are enabled. Each bit represents a specific notification. If a bit has a value 1, the associated notification is enabled and will be generated by the SIP entity at the appropriate time. Support for these notifications is OPTIONAL: either none or all notification values are supported. If an implementation does not support this object, it should return a 'noSuchObject' exception to an SNMP GET operation. If notifications are supported, this object's default value SHOULD reflect sipCommonServiceColdStart and sipCommonServiceWarmStart enabled and sipCommonServiceStatusChanged disabled. This object value SHOULD persist across reboots.")
sipCommonCfgEntityType = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 8), SipTCEntityRole()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgEntityType.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgEntityType.setDescription('This object identifies the list of SIP entities to which this row is related. It is defined as a bit map. Each bit represents a type of SIP entity. If a bit has value 1, the SIP entity represented by this row plays the role of this entity type. If a bit has value 0, the SIP entity represented by this row does not act as this entity type. Combinations of bits can be set when the SIP entity plays multiple SIP roles.')
sipCommonPortTable = MibTable((1, 3, 6, 1, 2, 1, 149, 1, 1, 2), )
if mibBuilder.loadTexts: sipCommonPortTable.setStatus('current')
if mibBuilder.loadTexts: sipCommonPortTable.setDescription('This table contains the list of ports that each SIP entity in this system is allowed to use. These ports can be advertised using the Contact header in a REGISTER request or response.')
sipCommonPortEntry = MibTableRow((1, 3, 6, 1, 2, 1, 149, 1, 1, 2, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"), (0, "SIP-COMMON-MIB", "sipCommonPort"))
if mibBuilder.loadTexts: sipCommonPortEntry.setStatus('current')
if mibBuilder.loadTexts: sipCommonPortEntry.setDescription('Specification of a particular port. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sipCommonPort = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 2, 1, 1), InetPortNumber().subtype(subtypeSpec=ValueRangeConstraint(1, 65535)))
if mibBuilder.loadTexts: sipCommonPort.setStatus('current')
if mibBuilder.loadTexts: sipCommonPort.setDescription('This object reflects a particular port that can be used by the SIP application.')
sipCommonPortTransportRcv = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 2, 1, 2), SipTCTransportProtocol()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonPortTransportRcv.setStatus('current')
if mibBuilder.loadTexts: sipCommonPortTransportRcv.setDescription('This object will specify the transport protocol the SIP entity will use to receive SIP messages. This object is a bit map. Each bit represents a transport protocol. If a bit has value 1, then that transport protocol is currently being used. If a bit has value 0, then that transport protocol is currently not being used.')
sipCommonOptionTagTable = MibTable((1, 3, 6, 1, 2, 1, 149, 1, 1, 3), )
if mibBuilder.loadTexts: sipCommonOptionTagTable.setReference('RFC 3261, Sections 19.2, 20.32, 20.29, 20.37, and 20.40')
if mibBuilder.loadTexts: sipCommonOptionTagTable.setStatus('current')
if mibBuilder.loadTexts: sipCommonOptionTagTable.setDescription("This table contains a list of the SIP option tags (SIP extensions) that are either required, supported, or unsupported by the SIP entity. These option tags are used in the Require, Proxy-Require, Supported, and Unsupported header fields. Example: If a user agent client supports, and requires the server to support, reliability of provisional responses (RFC 3262), this table contains a row with the option tag string '100rel' in sipCommonOptionTag and the OCTET STRING value of '1010 0000' or '0xA0' in sipCommonOptionTagHeaderField. If a server does not support the required feature (indicated in a Require header to a UAS, or in a Proxy-Require to a Proxy Server), the server returns a 420 Bad Extension listing the feature in an Unsupported header. Normally, the list of such features supported by an entity is static (i.e., will not change over time).")
sipCommonOptionTagEntry = MibTableRow((1, 3, 6, 1, 2, 1, 149, 1, 1, 3, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"), (0, "SIP-COMMON-MIB", "sipCommonOptionTagIndex"))
if mibBuilder.loadTexts: sipCommonOptionTagEntry.setStatus('current')
if mibBuilder.loadTexts: sipCommonOptionTagEntry.setDescription('A particular SIP option tag (extension) supported or unsupported by the SIP entity, and which may be supported or required by a peer. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sipCommonOptionTagIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 3, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295)))
if mibBuilder.loadTexts: sipCommonOptionTagIndex.setStatus('current')
if mibBuilder.loadTexts: sipCommonOptionTagIndex.setDescription('This object uniquely identifies a conceptual row in the table.')
sipCommonOptionTag = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 3, 1, 2), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonOptionTag.setReference('RFC 3261, Section 27.1')
if mibBuilder.loadTexts: sipCommonOptionTag.setStatus('current')
if mibBuilder.loadTexts: sipCommonOptionTag.setDescription('This object indicates the SIP option tag. The option tag names are registered with IANA and available at http://www.iana.org.')
sipCommonOptionTagHeaderField = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 3, 1, 3), SipTCOptionTagHeaders()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonOptionTagHeaderField.setStatus('current')
if mibBuilder.loadTexts: sipCommonOptionTagHeaderField.setDescription('This object indicates whether the SIP option tag is supported (Supported header), unsupported (Unsupported header), or required (Require or Proxy-Require header) by the SIP entity. A SIP option tag may be both supported and required.')
sipCommonMethodSupportedTable = MibTable((1, 3, 6, 1, 2, 1, 149, 1, 1, 4), )
if mibBuilder.loadTexts: sipCommonMethodSupportedTable.setStatus('current')
if mibBuilder.loadTexts: sipCommonMethodSupportedTable.setDescription('This table contains a list of methods supported by each SIP entity in this system (see the standard set of SIP methods in Section 7.1 of RFC 3261). Any additional methods that may be incorporated into the SIP protocol can be represented by this table without any requirement to update this MIB module. The table is informational in nature and conveys capabilities of the managed system to the SNMP Manager. From a protocol point of view, the list of methods advertised by the SIP entity in the Allow header (Section 20.5 of RFC 3261) MUST be consistent with the methods reflected in this table.')
sipCommonMethodSupportedEntry = MibTableRow((1, 3, 6, 1, 2, 1, 149, 1, 1, 4, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"), (0, "SIP-COMMON-MIB", "sipCommonMethodSupportedIndex"))
if mibBuilder.loadTexts: sipCommonMethodSupportedEntry.setStatus('current')
if mibBuilder.loadTexts: sipCommonMethodSupportedEntry.setDescription('A particular method supported by the SIP entity. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sipCommonMethodSupportedIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 4, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295)))
if mibBuilder.loadTexts: sipCommonMethodSupportedIndex.setStatus('current')
if mibBuilder.loadTexts: sipCommonMethodSupportedIndex.setDescription('This object uniquely identifies a conceptual row in the table and reflects an assigned number used to identify a specific SIP method. This identifier is suitable for referencing the associated method throughout this and other MIBs supported by this managed system.')
sipCommonMethodSupportedName = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 4, 1, 2), SipTCMethodName()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonMethodSupportedName.setStatus('current')
if mibBuilder.loadTexts: sipCommonMethodSupportedName.setDescription("This object reflects the supported method's name. The method name MUST be all upper case (e.g., 'INVITE').")
sipCommonCfgTimerTable = MibTable((1, 3, 6, 1, 2, 1, 149, 1, 2, 1), )
if mibBuilder.loadTexts: sipCommonCfgTimerTable.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerTable.setDescription('This table contains timer configuration objects applicable to SIP user agent and SIP stateful Proxy Server entities.')
sipCommonCfgTimerEntry = MibTableRow((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"))
if mibBuilder.loadTexts: sipCommonCfgTimerEntry.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerEntry.setDescription('A row of timer configuration. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788). The objects in this table entry SHOULD be non-volatile and their value SHOULD be kept at reboot.')
sipCommonCfgTimerA = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(100, 1000)).clone(500)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerA.setReference('RFC 3261, Section 17.1.1.2')
if mibBuilder.loadTexts: sipCommonCfgTimerA.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerA.setDescription('This object reflects the initial value for the retransmit timer for the INVITE method. The retransmit timer doubles after each retransmission, ensuring an exponential backoff in network traffic. This object represents the initial time a SIP entity will wait to receive a provisional response to an INVITE before resending the INVITE request.')
sipCommonCfgTimerB = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(32000, 300000)).clone(32000)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerB.setReference('RFC 3261, Section 17.1.1.2')
if mibBuilder.loadTexts: sipCommonCfgTimerB.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerB.setDescription('This object reflects the maximum time a SIP entity will wait to receive a final response to an INVITE. The timer is started upon transmission of the initial INVITE request.')
sipCommonCfgTimerC = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(180000, 300000)).clone(180000)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerC.setReference('RFC 3261, Section 16.6')
if mibBuilder.loadTexts: sipCommonCfgTimerC.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerC.setDescription('This object reflects the maximum time a SIP Proxy Server will wait to receive a provisional response to an INVITE. The Timer C MUST be set for each client transaction when an INVITE request is proxied.')
sipCommonCfgTimerD = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 300000)).clone(32000)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerD.setReference('RFC 3261, Section 17.1.1.2')
if mibBuilder.loadTexts: sipCommonCfgTimerD.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerD.setDescription("This object reflects the amount of time that the server transaction can remain in the 'Completed' state when unreliable transports are used. The default value MUST be equal to or greater than 32000 for UDP transport, and its value MUST be 0 for TCP/SCTP transport.")
sipCommonCfgTimerE = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 5), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(100, 1000)).clone(500)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerE.setReference('RFC 3261, Section 17.1.2.2')
if mibBuilder.loadTexts: sipCommonCfgTimerE.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerE.setDescription("This object reflects the initial value for the retransmit timer for a non-INVITE method while in 'Trying' state. The retransmit timer doubles after each retransmission until it reaches T2 to ensure an exponential backoff in network traffic. This object represents the initial time a SIP entity will wait to receive a provisional response to the request before resending the non-INVITE request.")
sipCommonCfgTimerF = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 6), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(32000, 300000)).clone(32000)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerF.setReference('RFC 3261, Section 17.1.2.2')
if mibBuilder.loadTexts: sipCommonCfgTimerF.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerF.setDescription('This object reflects the maximum time a SIP entity will wait to receive a final response to a non-INVITE request. The timer is started upon transmission of the initial request.')
sipCommonCfgTimerG = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 7), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1000)).clone(500)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerG.setReference('RFC 3261, Section 17.2.1')
if mibBuilder.loadTexts: sipCommonCfgTimerG.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerG.setDescription('This object reflects the initial value for the retransmit timer for final responses to INVITE requests. If timer G fires, the response is passed to the transport layer again for retransmission, and timer G is set to fire in MIN(2*T1, T2) seconds. From then on, when timer G fires, the response is passed to the transport again for transmission, and timer G is reset with a value that doubles, unless that value exceeds T2, in which case, it is reset with the value of T2. The default value MUST be T1 for UDP transport, and its value MUST be 0 for reliable transport like TCP/SCTP.')
sipCommonCfgTimerH = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 8), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(32000, 300000)).clone(32000)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerH.setReference('RFC 3261, Section 17.2.1')
if mibBuilder.loadTexts: sipCommonCfgTimerH.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerH.setDescription("This object reflects the maximum time a server will wait to receive an ACK before it abandons retransmitting the response. The timer is started upon entering the 'Completed' state.")
sipCommonCfgTimerI = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 9), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 10000)).clone(5000)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerI.setReference('RFC 3261, Section 17.2.1')
if mibBuilder.loadTexts: sipCommonCfgTimerI.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerI.setDescription("This object reflects the maximum time a SIP entity will wait to receive additional ACK message retransmissions. The timer is started upon entering the 'Confirmed' state. The default value MUST be T4 for UDP transport and its value MUST be 0 for reliable transport like TCP/SCTP.")
sipCommonCfgTimerJ = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 10), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(32000, 300000)).clone(32000)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerJ.setReference('RFC 3261, Section 17.2.2')
if mibBuilder.loadTexts: sipCommonCfgTimerJ.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerJ.setDescription("This object reflects the maximum time a SIP server will wait to receive retransmissions of non-INVITE requests. The timer is started upon entering the 'Completed' state for non-INVITE transactions. When timer J fires, the server MUST transition to the 'Terminated' state.")
sipCommonCfgTimerK = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 11), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 10000)).clone(5000)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerK.setReference('RFC 3261, Section 17.1.2.2')
if mibBuilder.loadTexts: sipCommonCfgTimerK.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerK.setDescription("This object reflects the maximum time a SIP client will wait to receive retransmissions of responses to non-INVITE requests. The timer is started upon entering the 'Completed' state for non-INVITE transactions. When timer K fires, the server MUST transition to the 'Terminated' state. The default value MUST be T4 for UDP transport, and its value MUST be 0 for reliable transport like TCP/SCTP.")
sipCommonCfgTimerT1 = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 12), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(200, 10000)).clone(500)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerT1.setReference('RFC 3261, Section 17')
if mibBuilder.loadTexts: sipCommonCfgTimerT1.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerT1.setDescription('This object reflects the T1 timer for a SIP entity. T1 is an estimate of the round-trip time (RTT) between the client and server transactions.')
sipCommonCfgTimerT2 = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 13), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(200, 10000)).clone(4000)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerT2.setReference('RFC 3261, Section 17')
if mibBuilder.loadTexts: sipCommonCfgTimerT2.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerT2.setDescription("This object reflects the T2 timer for a SIP entity. T2 is the maximum retransmit interval for non-INVITE requests and INVITE responses. It's used in various parts of the protocol to reset other Timer* objects to this value.")
sipCommonCfgTimerT4 = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 14), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(200, 10000)).clone(5000)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerT4.setReference('RFC 3261, Section 17')
if mibBuilder.loadTexts: sipCommonCfgTimerT4.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerT4.setDescription("This object reflects the T4 timer for a SIP entity. T4 is the maximum duration a message will remain in the network. It represents the amount of time the network will take to clear messages between client and server transactions. It's used in various parts of the protocol to reset other Timer* objects to this value.")
sipCommonSummaryStatsTable = MibTable((1, 3, 6, 1, 2, 1, 149, 1, 3, 1), )
if mibBuilder.loadTexts: sipCommonSummaryStatsTable.setStatus('current')
if mibBuilder.loadTexts: sipCommonSummaryStatsTable.setDescription('This table contains the summary statistics objects applicable to all SIP entities. Each row represents those objects for a particular SIP entity present in this system.')
sipCommonSummaryStatsEntry = MibTableRow((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"))
if mibBuilder.loadTexts: sipCommonSummaryStatsEntry.setStatus('current')
if mibBuilder.loadTexts: sipCommonSummaryStatsEntry.setDescription('A row of summary statistics. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sipCommonSummaryInRequests = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1, 1), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonSummaryInRequests.setStatus('current')
if mibBuilder.loadTexts: sipCommonSummaryInRequests.setDescription('This object indicates the total number of SIP request messages received by the SIP entity, including retransmissions. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonSummaryDisconTime object in the same row.')
sipCommonSummaryOutRequests = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonSummaryOutRequests.setStatus('current')
if mibBuilder.loadTexts: sipCommonSummaryOutRequests.setDescription('This object contains the total number of SIP request messages sent out (originated and relayed) by the SIP entity. Where a particular message is sent more than once, for example as a retransmission or as a result of forking, each transmission is counted separately. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonSummaryDisconTime object in the same row.')
sipCommonSummaryInResponses = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonSummaryInResponses.setStatus('current')
if mibBuilder.loadTexts: sipCommonSummaryInResponses.setDescription('This object contains the total number of SIP response messages received by the SIP entity, including retransmissions. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonSummaryDisconTime object in the same row.')
sipCommonSummaryOutResponses = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonSummaryOutResponses.setStatus('current')
if mibBuilder.loadTexts: sipCommonSummaryOutResponses.setDescription('This object contains the total number of SIP response messages sent (originated and relayed) by the SIP entity including retransmissions. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonSummaryDisconTime object in the same row.')
sipCommonSummaryTotalTransactions = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonSummaryTotalTransactions.setStatus('current')
if mibBuilder.loadTexts: sipCommonSummaryTotalTransactions.setDescription("This object contains a count of the number of transactions that are in progress and transactions that have reached the 'Terminated' state. It is not applicable to stateless SIP Proxy Servers. A SIP transaction occurs between a client and a server, and comprises all messages from the first request sent from the client to the server, up to a final (non-1xx) response sent from the server to the client. If the request is INVITE and the final response is a non-2xx, the transaction also include an ACK to the response. The ACK for a 2xx response to an INVITE request is a separate transaction. The branch ID parameter in the Via header field values serves as a transaction identifier. A transaction is identified by the CSeq sequence number within a single call leg. The ACK request has the same CSeq number as the corresponding INVITE request, but comprises a transaction of its own. In the case of a forked request, each branch counts as a single transaction. For a transaction stateless Proxy Server, this counter is always 0. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonSummaryDisconTime object in the same row.")
sipCommonSummaryDisconTime = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1, 6), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonSummaryDisconTime.setStatus('current')
if mibBuilder.loadTexts: sipCommonSummaryDisconTime.setDescription('The value of the sysUpTime object when the counters for the summary statistics objects in this row last experienced a discontinuity.')
sipCommonMethodStatsTable = MibTable((1, 3, 6, 1, 2, 1, 149, 1, 4, 1), )
if mibBuilder.loadTexts: sipCommonMethodStatsTable.setStatus('current')
if mibBuilder.loadTexts: sipCommonMethodStatsTable.setDescription('This table contains the method statistics objects for SIP entities. Each row represents those objects for a particular SIP entity present in this system.')
sipCommonMethodStatsEntry = MibTableRow((1, 3, 6, 1, 2, 1, 149, 1, 4, 1, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"), (0, "SIP-COMMON-MIB", "sipCommonMethodStatsName"))
if mibBuilder.loadTexts: sipCommonMethodStatsEntry.setStatus('current')
if mibBuilder.loadTexts: sipCommonMethodStatsEntry.setDescription('A row of per entity method statistics. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sipCommonMethodStatsName = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 4, 1, 1, 1), SipTCMethodName())
if mibBuilder.loadTexts: sipCommonMethodStatsName.setStatus('current')
if mibBuilder.loadTexts: sipCommonMethodStatsName.setDescription('This object uniquely identifies the SIP method related to the objects in a particular row.')
sipCommonMethodStatsOutbounds = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 4, 1, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonMethodStatsOutbounds.setReference('RFC 3261, Section 7.1')
if mibBuilder.loadTexts: sipCommonMethodStatsOutbounds.setStatus('current')
if mibBuilder.loadTexts: sipCommonMethodStatsOutbounds.setDescription('This object reflects the total number of requests sent by the SIP entity, excluding retransmissions. Retransmissions are counted separately and are not reflected in this counter. A Management Station can detect discontinuities in this counter by monitoring the sipCommonMethodStatsDisconTime object in the same row.')
sipCommonMethodStatsInbounds = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 4, 1, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonMethodStatsInbounds.setReference('RFC 3261, Section 7.1')
if mibBuilder.loadTexts: sipCommonMethodStatsInbounds.setStatus('current')
if mibBuilder.loadTexts: sipCommonMethodStatsInbounds.setDescription('This object reflects the total number of requests received by the SIP entity. Retransmissions are counted separately and are not reflected in this counter. A Management Station can detect discontinuities in this counter by monitoring the sipCommonMethodStatsDisconTime object in the same row.')
sipCommonMethodStatsDisconTime = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 4, 1, 1, 4), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonMethodStatsDisconTime.setStatus('current')
if mibBuilder.loadTexts: sipCommonMethodStatsDisconTime.setDescription('The value of the sysUpTime object when the counters for the method statistics objects in this row last experienced a discontinuity.')
sipCommonStatusCodeTable = MibTable((1, 3, 6, 1, 2, 1, 149, 1, 5, 1), )
if mibBuilder.loadTexts: sipCommonStatusCodeTable.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeTable.setDescription('This table contains the list of SIP status codes that each SIP entity in this system has been requested to monitor. It is the mechanism by which specific status codes are monitored. Entries created in this table must not persist across reboots.')
sipCommonStatusCodeEntry = MibTableRow((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"), (0, "SIP-COMMON-MIB", "sipCommonStatusCodeMethod"), (0, "SIP-COMMON-MIB", "sipCommonStatusCodeValue"))
if mibBuilder.loadTexts: sipCommonStatusCodeEntry.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeEntry.setDescription('This row contains information on a particular SIP status code that the SIP entity has been requested to monitor. Entries created in this table must not persist across reboots. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sipCommonStatusCodeMethod = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1, 1), SipTCMethodName())
if mibBuilder.loadTexts: sipCommonStatusCodeMethod.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeMethod.setDescription('This object uniquely identifies a conceptual row in the table.')
sipCommonStatusCodeValue = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(100, 999)))
if mibBuilder.loadTexts: sipCommonStatusCodeValue.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeValue.setDescription('This object contains a SIP status code value that the SIP entity has been requested to monitor. All of the other information in the row is related to this value.')
sipCommonStatusCodeIns = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonStatusCodeIns.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeIns.setDescription('This object reflects the total number of response messages received by the SIP entity with the status code value contained in the sipCommonStatusCodeValue column. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service, or when the monitoring of the status code is temporarily disabled. A Management Station can detect discontinuities in this counter by monitoring the sipCommonStatusCodeDisconTime object in the same row.')
sipCommonStatusCodeOuts = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonStatusCodeOuts.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeOuts.setDescription('This object reflects the total number of response messages sent by the SIP entity with the status code value contained in the sipCommonStatusCodeValue column. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service, or when the monitoring of the Status code is temporarily disabled. A Management Station can detect discontinuities in this counter by monitoring the sipCommonStatusCodeDisconTime object in the same row.')
sipCommonStatusCodeRowStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1, 5), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: sipCommonStatusCodeRowStatus.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeRowStatus.setDescription("The row augmentation in sipCommonStatusCodeNotifTable will be governed by the value of this RowStatus. The values 'createAndGo' and 'destroy' are the only valid values allowed for this object. If a row exists, it will reflect a status of 'active' when queried.")
sipCommonStatusCodeDisconTime = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1, 6), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonStatusCodeDisconTime.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeDisconTime.setDescription('The value of the sysUpTime object when the counters for the status code statistics objects in this row last experienced a discontinuity.')
sipCommonStatusCodeNotifTable = MibTable((1, 3, 6, 1, 2, 1, 149, 1, 5, 2), )
if mibBuilder.loadTexts: sipCommonStatusCodeNotifTable.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeNotifTable.setDescription('This table contains objects to control notifications related to particular status codes that each SIP entity in this system has been requested to monitor. There is an entry in this table corresponding to each entry in sipCommonStatusCodeTable. Therefore, this table augments sipCommonStatusCodeTable and utilizes the same index methodology. The objects in this table are not included directly in the sipCommonStatusCodeTable simply to keep the status code notification control objects separate from the actual status code statistics.')
sipCommonStatusCodeNotifEntry = MibTableRow((1, 3, 6, 1, 2, 1, 149, 1, 5, 2, 1), )
sipCommonStatusCodeEntry.registerAugmentions(("SIP-COMMON-MIB", "sipCommonStatusCodeNotifEntry"))
sipCommonStatusCodeNotifEntry.setIndexNames(*sipCommonStatusCodeEntry.getIndexNames())
if mibBuilder.loadTexts: sipCommonStatusCodeNotifEntry.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeNotifEntry.setDescription('This row contains information controlling notifications for a particular SIP status code that the SIP entity has been requested to monitor.')
sipCommonStatusCodeNotifSend = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 5, 2, 1, 1), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sipCommonStatusCodeNotifSend.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeNotifSend.setDescription("This object controls whether a sipCommonStatusCodeNotif is emitted when the status code value specified by sipCommonStatusCodeValue is sent or received. If the value of this object is 'true', then a notification is sent. If it is 'false', no notification is sent. Note well that a notification MAY be emitted for every message sent or received that contains the particular status code. Depending on the status code involved, this can cause a significant number of notification emissions that could be detrimental to network performance. Managers are forewarned to be prudent in the use of this object to enable notifications. Look to sipCommonStatusCodeNotifEmitMode for alternative controls for sipCommonStatusCodeNotif emissions.")
sipCommonStatusCodeNotifEmitMode = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 5, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("normal", 1), ("oneShot", 2), ("triggered", 3))).clone('oneShot')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sipCommonStatusCodeNotifEmitMode.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeNotifEmitMode.setDescription("The object sipCommonStatusCodeNotifSend MUST be set to 'true' for the values of this object to have any effect. It is RECOMMENDED that the desired emit mode be established by this object prior to setting sipCommonStatusCodeNotifSend to 'true'. This object and the sipCommonStatusCodeNotifSend object can obviously be set independently, but their respective values will have a dependency on each other and the resulting notifications. This object specifies the mode for emissions of sipCommonStatusCodeNotif notifications. normal : sipCommonStatusCodeNotif notifications will be emitted by the system for each SIP response message sent or received that contains the desired status code. oneShot : Only one sipCommonStatusCodeNotif notification will be emitted. It will be the next SIP response message sent or received that contains the desired status code. No more notifications are emitted until this object is set to 'oneShot' again or set to 'normal'. This option is provided as a means of quelling the potential promiscuous behavior that can be associated with the sipCommonStatusCodeNotif. triggered : This value is only readable and cannot be set. It reflects that the 'oneShot' case has occurred, and indicates that the mode needs to be reset to get further notifications. The mode is reset by setting this object to 'oneShot' or 'normal'.")
sipCommonStatusCodeNotifThresh = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 5, 2, 1, 3), Unsigned32().clone(500)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sipCommonStatusCodeNotifThresh.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeNotifThresh.setDescription('This object specifies the number of response messages sent or received by this system that are considered excessive. Based on crossing that threshold, a sipCommonStatusCodeThreshExceededInNotif notification or a sipCommonStatusCodeThreshExceededOutNotif will be sent. The sipCommonStatusCodeThreshExceededInNotif and sipCommonStatusCodeThreshExceededOutNotif notifications can be used as an early warning mechanism in lieu of using sipCommonStatusCodeNotif. Note that the configuration applied by this object will be applied equally to inbound and outbound response messages.')
sipCommonStatusCodeNotifInterval = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 5, 2, 1, 4), Unsigned32().clone(60)).setUnits('seconds').setMaxAccess("readwrite")
if mibBuilder.loadTexts: sipCommonStatusCodeNotifInterval.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeNotifInterval.setDescription('This object specifies the time interval over which, if sipCommonStatusCodeThresh is exceeded with respect to sent or received messages, a sipCommonStatusCodeThreshExceededInNotif or sipCommonStatusCodeThreshExceededOutNotif notification will be sent. Note that the configuration applied by this object will be applied equally to inbound and outbound response messages.')
sipCommonTransCurrentTable = MibTable((1, 3, 6, 1, 2, 1, 149, 1, 6, 1), )
if mibBuilder.loadTexts: sipCommonTransCurrentTable.setStatus('current')
if mibBuilder.loadTexts: sipCommonTransCurrentTable.setDescription('This table contains information on the transactions currently awaiting definitive responses by each SIP entity in this system. This table does not apply to transaction stateless Proxy Servers.')
sipCommonTransCurrentEntry = MibTableRow((1, 3, 6, 1, 2, 1, 149, 1, 6, 1, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"))
if mibBuilder.loadTexts: sipCommonTransCurrentEntry.setStatus('current')
if mibBuilder.loadTexts: sipCommonTransCurrentEntry.setDescription("Information on a particular SIP entity's current transactions. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).")
sipCommonTransCurrentactions = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 6, 1, 1, 1), Gauge32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonTransCurrentactions.setStatus('current')
if mibBuilder.loadTexts: sipCommonTransCurrentactions.setDescription('This object contains the number of transactions awaiting definitive (non-1xx) response. In the case of a forked request, each branch counts as a single transaction corresponding to the entity identified by applIndex.')
sipCommonStatsRetryTable = MibTable((1, 3, 6, 1, 2, 1, 149, 1, 7, 1), )
if mibBuilder.loadTexts: sipCommonStatsRetryTable.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatsRetryTable.setDescription('This table contains retry statistics objects applicable to each SIP entity in this system.')
sipCommonStatsRetryEntry = MibTableRow((1, 3, 6, 1, 2, 1, 149, 1, 7, 1, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"), (0, "SIP-COMMON-MIB", "sipCommonStatsRetryMethod"))
if mibBuilder.loadTexts: sipCommonStatsRetryEntry.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatsRetryEntry.setDescription('A row of retry statistics. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sipCommonStatsRetryMethod = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 7, 1, 1, 1), SipTCMethodName())
if mibBuilder.loadTexts: sipCommonStatsRetryMethod.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatsRetryMethod.setDescription('This object uniquely identifies the SIP method related to the objects in a row.')
sipCommonStatsRetries = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 7, 1, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonStatsRetries.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatsRetries.setDescription('This object reflects the total number of request retransmissions that have been sent by the SIP entity. Note that there could be multiple retransmissions per request. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonStatsRetryDisconTime object in the same row.')
sipCommonStatsRetryFinalResponses = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 7, 1, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonStatsRetryFinalResponses.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatsRetryFinalResponses.setDescription('This object reflects the total number of Final Response retries that have been sent by the SIP entity. Note that there could be multiple retransmissions per request. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonStatsRetryDisconTime object in the same row.')
sipCommonStatsRetryNonFinalResponses = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 7, 1, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonStatsRetryNonFinalResponses.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatsRetryNonFinalResponses.setDescription('This object reflects the total number of non-Final Response retries that have been sent by the SIP entity. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonStatsRetryDisconTime object in the same row.')
sipCommonStatsRetryDisconTime = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 7, 1, 1, 5), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonStatsRetryDisconTime.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatsRetryDisconTime.setDescription('The value of the sysUpTime object when the counters for the retry statistics objects in this row last experienced a discontinuity.')
sipCommonOtherStatsTable = MibTable((1, 3, 6, 1, 2, 1, 149, 1, 8, 1), )
if mibBuilder.loadTexts: sipCommonOtherStatsTable.setStatus('current')
if mibBuilder.loadTexts: sipCommonOtherStatsTable.setDescription('This table contains other common statistics supported by each SIP entity in this system.')
sipCommonOtherStatsEntry = MibTableRow((1, 3, 6, 1, 2, 1, 149, 1, 8, 1, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"))
if mibBuilder.loadTexts: sipCommonOtherStatsEntry.setStatus('current')
if mibBuilder.loadTexts: sipCommonOtherStatsEntry.setDescription("Information on a particular SIP entity's other common statistics. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).")
sipCommonOtherStatsNumUnsupportedUris = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 8, 1, 1, 1), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonOtherStatsNumUnsupportedUris.setStatus('current')
if mibBuilder.loadTexts: sipCommonOtherStatsNumUnsupportedUris.setDescription('Number of RequestURIs received with an unsupported scheme. A server normally responds to such requests with a 400 Bad Request status code. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonOtherStatsDisconTime object in the same row.')
sipCommonOtherStatsNumUnsupportedMethods = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 8, 1, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonOtherStatsNumUnsupportedMethods.setStatus('current')
if mibBuilder.loadTexts: sipCommonOtherStatsNumUnsupportedMethods.setDescription('Number of SIP requests received with unsupported methods. A server normally responds to such requests with a 501 (Not Implemented) or 405 (Method Not Allowed). Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonOtherStatsDisconTime object in the same row.')
sipCommonOtherStatsOtherwiseDiscardedMsgs = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 8, 1, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonOtherStatsOtherwiseDiscardedMsgs.setStatus('current')
if mibBuilder.loadTexts: sipCommonOtherStatsOtherwiseDiscardedMsgs.setDescription('Number of SIP messages received that, for any number of reasons, was discarded without a response. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonOtherStatsDisconTime object in the same row.')
sipCommonOtherStatsDisconTime = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 8, 1, 1, 4), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonOtherStatsDisconTime.setStatus('current')
if mibBuilder.loadTexts: sipCommonOtherStatsDisconTime.setDescription('The value of the sysUpTime object when the counters for the statistics objects in this row last experienced a discontinuity.')
sipCommonStatusCodeNotifTo = MibScalar((1, 3, 6, 1, 2, 1, 149, 1, 9, 1), SnmpAdminString()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: sipCommonStatusCodeNotifTo.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeNotifTo.setDescription("This object contains the value of the To header in the message containing the status code that caused the notification. The header name will be part of this object value. For example, 'To: Watson '.")
sipCommonStatusCodeNotifFrom = MibScalar((1, 3, 6, 1, 2, 1, 149, 1, 9, 2), SnmpAdminString()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: sipCommonStatusCodeNotifFrom.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeNotifFrom.setDescription("This object contains the value of the From header in the message containing the status code that caused the notification. The header name will be part of this object value. For example, 'From: Watson '.")
sipCommonStatusCodeNotifCallId = MibScalar((1, 3, 6, 1, 2, 1, 149, 1, 9, 3), SnmpAdminString()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: sipCommonStatusCodeNotifCallId.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeNotifCallId.setDescription("This object contains the value of the Call-ID in the message containing the status code that caused the notification. The header name will be part of this object value. For example, 'Call-ID: 5551212@example.com'.")
sipCommonStatusCodeNotifCSeq = MibScalar((1, 3, 6, 1, 2, 1, 149, 1, 9, 4), Unsigned32()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: sipCommonStatusCodeNotifCSeq.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeNotifCSeq.setDescription("This object contains the CSeq value in the message containing the status code that caused the notification. The header name will be part of this object value. For example, 'CSeq: 1722 INVITE'.")
sipCommonNotifApplIndex = MibScalar((1, 3, 6, 1, 2, 1, 149, 1, 9, 5), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: sipCommonNotifApplIndex.setStatus('current')
if mibBuilder.loadTexts: sipCommonNotifApplIndex.setDescription('This object contains the applIndex as described in RFC 2788. This object is created in order to allow a variable binding containing a value of applIndex in a notification.')
sipCommonNotifSequenceNumber = MibScalar((1, 3, 6, 1, 2, 1, 149, 1, 9, 6), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: sipCommonNotifSequenceNumber.setStatus('current')
if mibBuilder.loadTexts: sipCommonNotifSequenceNumber.setDescription('This object contains a sequence number for each notification generated by this SIP entity. Each notification SHOULD have a unique sequence number. A network manager can use this information to determine whether notifications from a particular SIP entity have been missed. The value of this object MUST start at 1 and increase by 1 with each generated notification. If a system restarts, the sequence number MAY start again from 1.')
sipCommonStatusCodeNotif = NotificationType((1, 3, 6, 1, 2, 1, 149, 0, 1)).setObjects(("SIP-COMMON-MIB", "sipCommonNotifSequenceNumber"), ("SIP-COMMON-MIB", "sipCommonNotifApplIndex"), ("SIP-COMMON-MIB", "sipCommonStatusCodeNotifTo"), ("SIP-COMMON-MIB", "sipCommonStatusCodeNotifFrom"), ("SIP-COMMON-MIB", "sipCommonStatusCodeNotifCallId"), ("SIP-COMMON-MIB", "sipCommonStatusCodeNotifCSeq"), ("SIP-COMMON-MIB", "sipCommonStatusCodeIns"), ("SIP-COMMON-MIB", "sipCommonStatusCodeOuts"))
if mibBuilder.loadTexts: sipCommonStatusCodeNotif.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeNotif.setDescription('Signifies that a specific status code has been sent or received by the system.')
sipCommonStatusCodeThreshExceededInNotif = NotificationType((1, 3, 6, 1, 2, 1, 149, 0, 2)).setObjects(("SIP-COMMON-MIB", "sipCommonNotifSequenceNumber"), ("SIP-COMMON-MIB", "sipCommonNotifApplIndex"), ("SIP-COMMON-MIB", "sipCommonStatusCodeIns"))
if mibBuilder.loadTexts: sipCommonStatusCodeThreshExceededInNotif.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeThreshExceededInNotif.setDescription('Signifies that a specific status code was found to have been received by the system frequently enough to exceed the configured threshold. This notification can be used as an early warning mechanism in lieu of using sipCommonStatusCodeNotif.')
sipCommonStatusCodeThreshExceededOutNotif = NotificationType((1, 3, 6, 1, 2, 1, 149, 0, 3)).setObjects(("SIP-COMMON-MIB", "sipCommonNotifSequenceNumber"), ("SIP-COMMON-MIB", "sipCommonNotifApplIndex"), ("SIP-COMMON-MIB", "sipCommonStatusCodeOuts"))
if mibBuilder.loadTexts: sipCommonStatusCodeThreshExceededOutNotif.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeThreshExceededOutNotif.setDescription('Signifies that a specific status code was found to have been sent by the system enough to exceed the configured threshold. This notification can be used as an early warning mechanism in lieu of using sipCommonStatusCodeNotif.')
sipCommonServiceColdStart = NotificationType((1, 3, 6, 1, 2, 1, 149, 0, 4)).setObjects(("SIP-COMMON-MIB", "sipCommonNotifSequenceNumber"), ("SIP-COMMON-MIB", "sipCommonNotifApplIndex"), ("SIP-COMMON-MIB", "sipCommonCfgServiceStartTime"))
if mibBuilder.loadTexts: sipCommonServiceColdStart.setStatus('current')
if mibBuilder.loadTexts: sipCommonServiceColdStart.setDescription("Signifies that the SIP service has reinitialized itself or started for the first time. This SHOULD result from a hard 'down' to 'up' administrative status change. The configuration or behavior of the service MAY be altered.")
sipCommonServiceWarmStart = NotificationType((1, 3, 6, 1, 2, 1, 149, 0, 5)).setObjects(("SIP-COMMON-MIB", "sipCommonNotifSequenceNumber"), ("SIP-COMMON-MIB", "sipCommonNotifApplIndex"), ("SIP-COMMON-MIB", "sipCommonCfgServiceLastChange"))
if mibBuilder.loadTexts: sipCommonServiceWarmStart.setStatus('current')
if mibBuilder.loadTexts: sipCommonServiceWarmStart.setDescription("Signifies that the SIP service has reinitialized itself and is restarting after an administrative 'reset'. The configuration or behavior of the service MAY be altered.")
sipCommonServiceStatusChanged = NotificationType((1, 3, 6, 1, 2, 1, 149, 0, 6)).setObjects(("SIP-COMMON-MIB", "sipCommonNotifSequenceNumber"), ("SIP-COMMON-MIB", "sipCommonNotifApplIndex"), ("SIP-COMMON-MIB", "sipCommonCfgServiceLastChange"), ("SIP-COMMON-MIB", "sipCommonCfgServiceOperStatus"))
if mibBuilder.loadTexts: sipCommonServiceStatusChanged.setStatus('current')
if mibBuilder.loadTexts: sipCommonServiceStatusChanged.setDescription('Signifies that the SIP service operational status has changed.')
sipCommonMIBCompliances = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 2, 1))
sipCommonMIBGroups = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 2, 2))
sipCommonCompliance = ModuleCompliance((1, 3, 6, 1, 2, 1, 149, 2, 1, 1)).setObjects(("SIP-COMMON-MIB", "sipCommonConfigGroup"), ("SIP-COMMON-MIB", "sipCommonStatsGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sipCommonCompliance = sipCommonCompliance.setStatus('current')
if mibBuilder.loadTexts: sipCommonCompliance.setDescription('The compliance statement for SIP entities.')
sipCommonConfigGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 149, 2, 2, 1)).setObjects(("SIP-COMMON-MIB", "sipCommonCfgProtocolVersion"), ("SIP-COMMON-MIB", "sipCommonCfgServiceOperStatus"), ("SIP-COMMON-MIB", "sipCommonCfgServiceStartTime"), ("SIP-COMMON-MIB", "sipCommonCfgServiceLastChange"), ("SIP-COMMON-MIB", "sipCommonPortTransportRcv"), ("SIP-COMMON-MIB", "sipCommonOptionTag"), ("SIP-COMMON-MIB", "sipCommonOptionTagHeaderField"), ("SIP-COMMON-MIB", "sipCommonCfgMaxTransactions"), ("SIP-COMMON-MIB", "sipCommonCfgServiceNotifEnable"), ("SIP-COMMON-MIB", "sipCommonCfgEntityType"), ("SIP-COMMON-MIB", "sipCommonMethodSupportedName"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sipCommonConfigGroup = sipCommonConfigGroup.setStatus('current')
if mibBuilder.loadTexts: sipCommonConfigGroup.setDescription('A collection of objects providing configuration common to all SIP entities.')
sipCommonInformationalGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 149, 2, 2, 2)).setObjects(("SIP-COMMON-MIB", "sipCommonCfgOrganization"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sipCommonInformationalGroup = sipCommonInformationalGroup.setStatus('current')
if mibBuilder.loadTexts: sipCommonInformationalGroup.setDescription('A collection of objects providing configuration common to all SIP entities.')
sipCommonConfigTimerGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 149, 2, 2, 3)).setObjects(("SIP-COMMON-MIB", "sipCommonCfgTimerA"), ("SIP-COMMON-MIB", "sipCommonCfgTimerB"), ("SIP-COMMON-MIB", "sipCommonCfgTimerC"), ("SIP-COMMON-MIB", "sipCommonCfgTimerD"), ("SIP-COMMON-MIB", "sipCommonCfgTimerE"), ("SIP-COMMON-MIB", "sipCommonCfgTimerF"), ("SIP-COMMON-MIB", "sipCommonCfgTimerG"), ("SIP-COMMON-MIB", "sipCommonCfgTimerH"), ("SIP-COMMON-MIB", "sipCommonCfgTimerI"), ("SIP-COMMON-MIB", "sipCommonCfgTimerJ"), ("SIP-COMMON-MIB", "sipCommonCfgTimerK"), ("SIP-COMMON-MIB", "sipCommonCfgTimerT1"), ("SIP-COMMON-MIB", "sipCommonCfgTimerT2"), ("SIP-COMMON-MIB", "sipCommonCfgTimerT4"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sipCommonConfigTimerGroup = sipCommonConfigTimerGroup.setStatus('current')
if mibBuilder.loadTexts: sipCommonConfigTimerGroup.setDescription('A collection of objects providing timer configuration common to all SIP entities.')
sipCommonStatsGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 149, 2, 2, 4)).setObjects(("SIP-COMMON-MIB", "sipCommonSummaryInRequests"), ("SIP-COMMON-MIB", "sipCommonSummaryOutRequests"), ("SIP-COMMON-MIB", "sipCommonSummaryInResponses"), ("SIP-COMMON-MIB", "sipCommonSummaryOutResponses"), ("SIP-COMMON-MIB", "sipCommonSummaryTotalTransactions"), ("SIP-COMMON-MIB", "sipCommonSummaryDisconTime"), ("SIP-COMMON-MIB", "sipCommonMethodStatsOutbounds"), ("SIP-COMMON-MIB", "sipCommonMethodStatsInbounds"), ("SIP-COMMON-MIB", "sipCommonMethodStatsDisconTime"), ("SIP-COMMON-MIB", "sipCommonStatusCodeIns"), ("SIP-COMMON-MIB", "sipCommonStatusCodeOuts"), ("SIP-COMMON-MIB", "sipCommonStatusCodeRowStatus"), ("SIP-COMMON-MIB", "sipCommonStatusCodeDisconTime"), ("SIP-COMMON-MIB", "sipCommonTransCurrentactions"), ("SIP-COMMON-MIB", "sipCommonOtherStatsNumUnsupportedUris"), ("SIP-COMMON-MIB", "sipCommonOtherStatsNumUnsupportedMethods"), ("SIP-COMMON-MIB", "sipCommonOtherStatsOtherwiseDiscardedMsgs"), ("SIP-COMMON-MIB", "sipCommonOtherStatsDisconTime"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sipCommonStatsGroup = sipCommonStatsGroup.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatsGroup.setDescription('A collection of objects providing statistics common to all SIP entities.')
sipCommonStatsRetryGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 149, 2, 2, 5)).setObjects(("SIP-COMMON-MIB", "sipCommonStatsRetries"), ("SIP-COMMON-MIB", "sipCommonStatsRetryFinalResponses"), ("SIP-COMMON-MIB", "sipCommonStatsRetryNonFinalResponses"), ("SIP-COMMON-MIB", "sipCommonStatsRetryDisconTime"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sipCommonStatsRetryGroup = sipCommonStatsRetryGroup.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatsRetryGroup.setDescription('A collection of objects providing retry statistics.')
sipCommonNotifGroup = NotificationGroup((1, 3, 6, 1, 2, 1, 149, 2, 2, 6)).setObjects(("SIP-COMMON-MIB", "sipCommonStatusCodeNotif"), ("SIP-COMMON-MIB", "sipCommonStatusCodeThreshExceededInNotif"), ("SIP-COMMON-MIB", "sipCommonStatusCodeThreshExceededOutNotif"), ("SIP-COMMON-MIB", "sipCommonServiceColdStart"), ("SIP-COMMON-MIB", "sipCommonServiceWarmStart"), ("SIP-COMMON-MIB", "sipCommonServiceStatusChanged"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sipCommonNotifGroup = sipCommonNotifGroup.setStatus('current')
if mibBuilder.loadTexts: sipCommonNotifGroup.setDescription('A collection of notifications common to all SIP entities.')
sipCommonStatusCodeNotifGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 149, 2, 2, 7)).setObjects(("SIP-COMMON-MIB", "sipCommonStatusCodeNotifSend"), ("SIP-COMMON-MIB", "sipCommonStatusCodeNotifEmitMode"), ("SIP-COMMON-MIB", "sipCommonStatusCodeNotifThresh"), ("SIP-COMMON-MIB", "sipCommonStatusCodeNotifInterval"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sipCommonStatusCodeNotifGroup = sipCommonStatusCodeNotifGroup.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeNotifGroup.setDescription('A collection of objects related to the control and attribution of notifications common to all SIP entities.')
sipCommonNotifObjectsGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 149, 2, 2, 8)).setObjects(("SIP-COMMON-MIB", "sipCommonStatusCodeNotifTo"), ("SIP-COMMON-MIB", "sipCommonStatusCodeNotifFrom"), ("SIP-COMMON-MIB", "sipCommonStatusCodeNotifCallId"), ("SIP-COMMON-MIB", "sipCommonStatusCodeNotifCSeq"), ("SIP-COMMON-MIB", "sipCommonNotifApplIndex"), ("SIP-COMMON-MIB", "sipCommonNotifSequenceNumber"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sipCommonNotifObjectsGroup = sipCommonNotifObjectsGroup.setStatus('current')
if mibBuilder.loadTexts: sipCommonNotifObjectsGroup.setDescription('A collection of accessible-for-notify objects related to the notification defined in this MIB module.')
mibBuilder.exportSymbols("SIP-COMMON-MIB", sipCommonStatusCodeNotifTable=sipCommonStatusCodeNotifTable, sipCommonStatsRetryNonFinalResponses=sipCommonStatsRetryNonFinalResponses, sipCommonStatusCodeValue=sipCommonStatusCodeValue, sipCommonMIBConformance=sipCommonMIBConformance, sipCommonPortTable=sipCommonPortTable, sipCommonMethodStats=sipCommonMethodStats, sipCommonCfgTimer=sipCommonCfgTimer, sipCommonOptionTagTable=sipCommonOptionTagTable, sipCommonCfgServiceLastChange=sipCommonCfgServiceLastChange, sipCommonNotifObjectsGroup=sipCommonNotifObjectsGroup, sipCommonMIBObjects=sipCommonMIBObjects, sipCommonCfgTimerG=sipCommonCfgTimerG, sipCommonSummaryInResponses=sipCommonSummaryInResponses, sipCommonCompliance=sipCommonCompliance, sipCommonSummaryDisconTime=sipCommonSummaryDisconTime, sipCommonStatusCode=sipCommonStatusCode, sipCommonCfgEntityType=sipCommonCfgEntityType, sipCommonCfgTimerB=sipCommonCfgTimerB, sipCommonStatusCodeNotifTo=sipCommonStatusCodeNotifTo, sipCommonStatsRetryGroup=sipCommonStatsRetryGroup, sipCommonNotifSequenceNumber=sipCommonNotifSequenceNumber, sipCommonNotifObjects=sipCommonNotifObjects, sipCommonStatsRetryDisconTime=sipCommonStatsRetryDisconTime, sipCommonPort=sipCommonPort, sipCommonMethodStatsEntry=sipCommonMethodStatsEntry, sipCommonStatsRetryTable=sipCommonStatsRetryTable, sipCommonStatusCodeNotifInterval=sipCommonStatusCodeNotifInterval, sipCommonStatusCodeRowStatus=sipCommonStatusCodeRowStatus, sipCommonCfgTimerD=sipCommonCfgTimerD, sipCommonSummaryOutResponses=sipCommonSummaryOutResponses, sipCommonCfgServiceStartTime=sipCommonCfgServiceStartTime, sipCommonCfgTimerA=sipCommonCfgTimerA, sipCommonConfigTimerGroup=sipCommonConfigTimerGroup, sipCommonCfgTimerT4=sipCommonCfgTimerT4, sipCommonMethodSupportedIndex=sipCommonMethodSupportedIndex, sipCommonNotifGroup=sipCommonNotifGroup, sipCommonStatusCodeNotifEmitMode=sipCommonStatusCodeNotifEmitMode, sipCommonMethodStatsInbounds=sipCommonMethodStatsInbounds, sipCommonConfigGroup=sipCommonConfigGroup, sipCommonNotifApplIndex=sipCommonNotifApplIndex, sipCommonMIB=sipCommonMIB, sipCommonCfgTimerTable=sipCommonCfgTimerTable, sipCommonStatusCodeDisconTime=sipCommonStatusCodeDisconTime, sipCommonInformationalGroup=sipCommonInformationalGroup, sipCommonMethodStatsDisconTime=sipCommonMethodStatsDisconTime, sipCommonCfgTimerT1=sipCommonCfgTimerT1, sipCommonCfgOrganization=sipCommonCfgOrganization, sipCommonOtherStatsNumUnsupportedUris=sipCommonOtherStatsNumUnsupportedUris, sipCommonServiceWarmStart=sipCommonServiceWarmStart, sipCommonCfgTimerI=sipCommonCfgTimerI, sipCommonCfgTimerK=sipCommonCfgTimerK, sipCommonStatusCodeNotifSend=sipCommonStatusCodeNotifSend, sipCommonOtherStatsTable=sipCommonOtherStatsTable, sipCommonMIBNotifications=sipCommonMIBNotifications, sipCommonStatusCodeThreshExceededOutNotif=sipCommonStatusCodeThreshExceededOutNotif, sipCommonStatusCodeNotifCSeq=sipCommonStatusCodeNotifCSeq, sipCommonStatsRetryMethod=sipCommonStatsRetryMethod, sipCommonStatusCodeNotifGroup=sipCommonStatusCodeNotifGroup, sipCommonMIBGroups=sipCommonMIBGroups, sipCommonOtherStatsOtherwiseDiscardedMsgs=sipCommonOtherStatsOtherwiseDiscardedMsgs, sipCommonTransCurrentEntry=sipCommonTransCurrentEntry, sipCommonCfgEntry=sipCommonCfgEntry, sipCommonStatsTrans=sipCommonStatsTrans, sipCommonCfgServiceOperStatus=sipCommonCfgServiceOperStatus, sipCommonOtherStatsNumUnsupportedMethods=sipCommonOtherStatsNumUnsupportedMethods, sipCommonOptionTagIndex=sipCommonOptionTagIndex, sipCommonMethodStatsTable=sipCommonMethodStatsTable, sipCommonCfgTimerJ=sipCommonCfgTimerJ, sipCommonStatusCodeNotifThresh=sipCommonStatusCodeNotifThresh, sipCommonCfgTable=sipCommonCfgTable, sipCommonStatsRetries=sipCommonStatsRetries, sipCommonStatusCodeEntry=sipCommonStatusCodeEntry, sipCommonServiceColdStart=sipCommonServiceColdStart, sipCommonStatusCodeNotifFrom=sipCommonStatusCodeNotifFrom, sipCommonCfgTimerEntry=sipCommonCfgTimerEntry, sipCommonCfgTimerH=sipCommonCfgTimerH, sipCommonOtherStats=sipCommonOtherStats, sipCommonPortEntry=sipCommonPortEntry, sipCommonStatsRetry=sipCommonStatsRetry, sipCommonStatusCodeNotif=sipCommonStatusCodeNotif, sipCommonMethodStatsOutbounds=sipCommonMethodStatsOutbounds, sipCommonTransCurrentTable=sipCommonTransCurrentTable, sipCommonSummaryStatsTable=sipCommonSummaryStatsTable, sipCommonStatusCodeThreshExceededInNotif=sipCommonStatusCodeThreshExceededInNotif, sipCommonPortTransportRcv=sipCommonPortTransportRcv, sipCommonSummaryStatsEntry=sipCommonSummaryStatsEntry, sipCommonStatusCodeMethod=sipCommonStatusCodeMethod, sipCommonOtherStatsDisconTime=sipCommonOtherStatsDisconTime, sipCommonSummaryStats=sipCommonSummaryStats, sipCommonOptionTagHeaderField=sipCommonOptionTagHeaderField, sipCommonCfgTimerT2=sipCommonCfgTimerT2, sipCommonOtherStatsEntry=sipCommonOtherStatsEntry, sipCommonSummaryTotalTransactions=sipCommonSummaryTotalTransactions, sipCommonCfgTimerC=sipCommonCfgTimerC, sipCommonCfgMaxTransactions=sipCommonCfgMaxTransactions, sipCommonStatusCodeOuts=sipCommonStatusCodeOuts, sipCommonMethodSupportedTable=sipCommonMethodSupportedTable, sipCommonCfgProtocolVersion=sipCommonCfgProtocolVersion, sipCommonStatusCodeIns=sipCommonStatusCodeIns, sipCommonServiceStatusChanged=sipCommonServiceStatusChanged, sipCommonCfgTimerF=sipCommonCfgTimerF, sipCommonCfgBase=sipCommonCfgBase, sipCommonSummaryInRequests=sipCommonSummaryInRequests, sipCommonOptionTagEntry=sipCommonOptionTagEntry, sipCommonStatsGroup=sipCommonStatsGroup, sipCommonStatsRetryFinalResponses=sipCommonStatsRetryFinalResponses, sipCommonTransCurrentactions=sipCommonTransCurrentactions, PYSNMP_MODULE_ID=sipCommonMIB, sipCommonOptionTag=sipCommonOptionTag, sipCommonStatusCodeTable=sipCommonStatusCodeTable, sipCommonMethodSupportedEntry=sipCommonMethodSupportedEntry, sipCommonSummaryOutRequests=sipCommonSummaryOutRequests, sipCommonCfgServiceNotifEnable=sipCommonCfgServiceNotifEnable, sipCommonStatsRetryEntry=sipCommonStatsRetryEntry, sipCommonMethodSupportedName=sipCommonMethodSupportedName, sipCommonStatusCodeNotifEntry=sipCommonStatusCodeNotifEntry, sipCommonStatusCodeNotifCallId=sipCommonStatusCodeNotifCallId, sipCommonCfgTimerE=sipCommonCfgTimerE, sipCommonMIBCompliances=sipCommonMIBCompliances, sipCommonMethodStatsName=sipCommonMethodStatsName)
| (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, constraints_intersection, constraints_union, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ValueRangeConstraint', 'ConstraintsIntersection', 'ConstraintsUnion', 'SingleValueConstraint')
(inet_port_number,) = mibBuilder.importSymbols('INET-ADDRESS-MIB', 'InetPortNumber')
(appl_index,) = mibBuilder.importSymbols('NETWORK-SERVICES-MIB', 'applIndex')
(sip_tc_transport_protocol, sip_tc_entity_role, sip_tc_option_tag_headers, sip_tc_method_name) = mibBuilder.importSymbols('SIP-TC-MIB', 'SipTCTransportProtocol', 'SipTCEntityRole', 'SipTCOptionTagHeaders', 'SipTCMethodName')
(snmp_admin_string,) = mibBuilder.importSymbols('SNMP-FRAMEWORK-MIB', 'SnmpAdminString')
(module_compliance, notification_group, object_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup', 'ObjectGroup')
(bits, module_identity, ip_address, notification_type, gauge32, time_ticks, mib_scalar, mib_table, mib_table_row, mib_table_column, iso, mib_2, unsigned32, object_identity, mib_identifier, counter64, counter32, integer32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Bits', 'ModuleIdentity', 'IpAddress', 'NotificationType', 'Gauge32', 'TimeTicks', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'iso', 'mib-2', 'Unsigned32', 'ObjectIdentity', 'MibIdentifier', 'Counter64', 'Counter32', 'Integer32')
(row_status, textual_convention, time_stamp, truth_value, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'RowStatus', 'TextualConvention', 'TimeStamp', 'TruthValue', 'DisplayString')
sip_common_mib = module_identity((1, 3, 6, 1, 2, 1, 149))
sipCommonMIB.setRevisions(('2007-04-20 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts:
sipCommonMIB.setRevisionsDescriptions(('Initial version of the IETF SIP-COMMON-MIB module. This version published as part of RFC 4780.',))
if mibBuilder.loadTexts:
sipCommonMIB.setLastUpdated('200704200000Z')
if mibBuilder.loadTexts:
sipCommonMIB.setOrganization('IETF Session Initiation Protocol Working Group')
if mibBuilder.loadTexts:
sipCommonMIB.setContactInfo('SIP WG email: sip@ietf.org Co-editor Kevin Lingle Cisco Systems, Inc. postal: 7025 Kit Creek Road P.O. Box 14987 Research Triangle Park, NC 27709 USA email: klingle@cisco.com phone: +1 919 476 2029 Co-editor Joon Maeng email: jmaeng@austin.rr.com Co-editor Jean-Francois Mule CableLabs postal: 858 Coal Creek Circle Louisville, CO 80027 USA email: jf.mule@cablelabs.com phone: +1 303 661 9100 Co-editor Dave Walker email: drwalker@rogers.com')
if mibBuilder.loadTexts:
sipCommonMIB.setDescription('Session Initiation Protocol (SIP) Common MIB module. This module defines objects that may be common to all SIP entities. SIP is an application-layer signaling protocol for creating, modifying and terminating multimedia sessions with one or more participants. These sessions include Internet multimedia conferences and Internet telephone calls. SIP is defined in RFC 3261 (June 2002). This MIB is defined for managing objects that are common to SIP User Agents (UAs), Proxy, Redirect, and Registrar servers. Objects specific to each of these entities MAY be managed using entity specific MIBs defined in other modules. Copyright (C) The IETF Trust (2007). This version of this MIB module is part of RFC 4780; see the RFC itself for full legal notices.')
sip_common_mib_notifications = mib_identifier((1, 3, 6, 1, 2, 1, 149, 0))
sip_common_mib_objects = mib_identifier((1, 3, 6, 1, 2, 1, 149, 1))
sip_common_mib_conformance = mib_identifier((1, 3, 6, 1, 2, 1, 149, 2))
sip_common_cfg_base = mib_identifier((1, 3, 6, 1, 2, 1, 149, 1, 1))
sip_common_cfg_timer = mib_identifier((1, 3, 6, 1, 2, 1, 149, 1, 2))
sip_common_summary_stats = mib_identifier((1, 3, 6, 1, 2, 1, 149, 1, 3))
sip_common_method_stats = mib_identifier((1, 3, 6, 1, 2, 1, 149, 1, 4))
sip_common_status_code = mib_identifier((1, 3, 6, 1, 2, 1, 149, 1, 5))
sip_common_stats_trans = mib_identifier((1, 3, 6, 1, 2, 1, 149, 1, 6))
sip_common_stats_retry = mib_identifier((1, 3, 6, 1, 2, 1, 149, 1, 7))
sip_common_other_stats = mib_identifier((1, 3, 6, 1, 2, 1, 149, 1, 8))
sip_common_notif_objects = mib_identifier((1, 3, 6, 1, 2, 1, 149, 1, 9))
sip_common_cfg_table = mib_table((1, 3, 6, 1, 2, 1, 149, 1, 1, 1))
if mibBuilder.loadTexts:
sipCommonCfgTable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTable.setDescription('This table contains the common configuration objects applicable to all SIP entities.')
sip_common_cfg_entry = mib_table_row((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'))
if mibBuilder.loadTexts:
sipCommonCfgEntry.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgEntry.setDescription('A row of common configuration. Each row represents objects for a particular SIP entity instance present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sip_common_cfg_protocol_version = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 1), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgProtocolVersion.setReference('RFC 3261, Section 7.1')
if mibBuilder.loadTexts:
sipCommonCfgProtocolVersion.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgProtocolVersion.setDescription("This object will reflect the version of SIP supported by this SIP entity. It will follow the same format as SIP version information contained in the SIP messages generated by this SIP entity. For example, entities supporting SIP version 2 will return 'SIP/2.0' as dictated by the standard.")
sip_common_cfg_service_oper_status = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('unknown', 1), ('up', 2), ('down', 3), ('congested', 4), ('restarting', 5), ('quiescing', 6), ('testing', 7)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgServiceOperStatus.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgServiceOperStatus.setDescription('This object contains the current operational state of the SIP application. unknown : The operational status cannot be determined for some reason. up : The application is operating normally and is processing (receiving and possibly issuing) SIP requests and responses. down : The application is currently unable to process SIP messages. congested : The application is operational but no additional inbound transactions can be accommodated at the moment. restarting : The application is currently unavailable, but it is in the process of restarting and will presumably, soon be able to process SIP messages. quiescing : The application is currently operational but has been administratively put into quiescence mode. Additional inbound transactions MAY be rejected. testing : The application is currently in test mode and MAY not be able to process SIP messages. The operational status values defined for this object are not based on any specific information contained in the SIP standard.')
sip_common_cfg_service_start_time = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 3), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgServiceStartTime.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgServiceStartTime.setDescription('The value of sysUpTime at the time the SIP entity was last started. If started prior to the last re-initialization of the local network management subsystem, then this object contains a zero value.')
sip_common_cfg_service_last_change = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 4), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgServiceLastChange.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgServiceLastChange.setDescription('The value of sysUpTime at the time the SIP entity entered its current operational state. If the current state was entered prior to the last re-initialization of the local network management subsystem, then this object contains a zero value.')
sip_common_cfg_organization = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 5), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgOrganization.setReference('RFC 3261, Section 20.25')
if mibBuilder.loadTexts:
sipCommonCfgOrganization.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgOrganization.setDescription('This object contains the organization name that the SIP entity inserts into Organization headers of SIP messages processed by this system. If the string is empty, no Organization header is to be generated.')
sip_common_cfg_max_transactions = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 6), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 4294967295))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgMaxTransactions.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgMaxTransactions.setDescription("This object indicates the maximum number of simultaneous transactions per second that the SIP entity can manage. In general, the value of this object SHOULD reflect a level of transaction processing per second that is considered high enough to impact the system's CPU and/or memory resources to the point of deteriorating SIP call processing but not high enough to cause catastrophic system failure.")
sip_common_cfg_service_notif_enable = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 7), bits().clone(namedValues=named_values(('sipCommonServiceColdStart', 0), ('sipCommonServiceWarmStart', 1), ('sipCommonServiceStatusChanged', 2))).clone(namedValues=named_values(('sipCommonServiceColdStart', 0), ('sipCommonServiceWarmStart', 1)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sipCommonCfgServiceNotifEnable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgServiceNotifEnable.setDescription("This object specifies which SIP service related notifications are enabled. Each bit represents a specific notification. If a bit has a value 1, the associated notification is enabled and will be generated by the SIP entity at the appropriate time. Support for these notifications is OPTIONAL: either none or all notification values are supported. If an implementation does not support this object, it should return a 'noSuchObject' exception to an SNMP GET operation. If notifications are supported, this object's default value SHOULD reflect sipCommonServiceColdStart and sipCommonServiceWarmStart enabled and sipCommonServiceStatusChanged disabled. This object value SHOULD persist across reboots.")
sip_common_cfg_entity_type = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 8), sip_tc_entity_role()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgEntityType.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgEntityType.setDescription('This object identifies the list of SIP entities to which this row is related. It is defined as a bit map. Each bit represents a type of SIP entity. If a bit has value 1, the SIP entity represented by this row plays the role of this entity type. If a bit has value 0, the SIP entity represented by this row does not act as this entity type. Combinations of bits can be set when the SIP entity plays multiple SIP roles.')
sip_common_port_table = mib_table((1, 3, 6, 1, 2, 1, 149, 1, 1, 2))
if mibBuilder.loadTexts:
sipCommonPortTable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonPortTable.setDescription('This table contains the list of ports that each SIP entity in this system is allowed to use. These ports can be advertised using the Contact header in a REGISTER request or response.')
sip_common_port_entry = mib_table_row((1, 3, 6, 1, 2, 1, 149, 1, 1, 2, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'), (0, 'SIP-COMMON-MIB', 'sipCommonPort'))
if mibBuilder.loadTexts:
sipCommonPortEntry.setStatus('current')
if mibBuilder.loadTexts:
sipCommonPortEntry.setDescription('Specification of a particular port. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sip_common_port = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 2, 1, 1), inet_port_number().subtype(subtypeSpec=value_range_constraint(1, 65535)))
if mibBuilder.loadTexts:
sipCommonPort.setStatus('current')
if mibBuilder.loadTexts:
sipCommonPort.setDescription('This object reflects a particular port that can be used by the SIP application.')
sip_common_port_transport_rcv = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 2, 1, 2), sip_tc_transport_protocol()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonPortTransportRcv.setStatus('current')
if mibBuilder.loadTexts:
sipCommonPortTransportRcv.setDescription('This object will specify the transport protocol the SIP entity will use to receive SIP messages. This object is a bit map. Each bit represents a transport protocol. If a bit has value 1, then that transport protocol is currently being used. If a bit has value 0, then that transport protocol is currently not being used.')
sip_common_option_tag_table = mib_table((1, 3, 6, 1, 2, 1, 149, 1, 1, 3))
if mibBuilder.loadTexts:
sipCommonOptionTagTable.setReference('RFC 3261, Sections 19.2, 20.32, 20.29, 20.37, and 20.40')
if mibBuilder.loadTexts:
sipCommonOptionTagTable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonOptionTagTable.setDescription("This table contains a list of the SIP option tags (SIP extensions) that are either required, supported, or unsupported by the SIP entity. These option tags are used in the Require, Proxy-Require, Supported, and Unsupported header fields. Example: If a user agent client supports, and requires the server to support, reliability of provisional responses (RFC 3262), this table contains a row with the option tag string '100rel' in sipCommonOptionTag and the OCTET STRING value of '1010 0000' or '0xA0' in sipCommonOptionTagHeaderField. If a server does not support the required feature (indicated in a Require header to a UAS, or in a Proxy-Require to a Proxy Server), the server returns a 420 Bad Extension listing the feature in an Unsupported header. Normally, the list of such features supported by an entity is static (i.e., will not change over time).")
sip_common_option_tag_entry = mib_table_row((1, 3, 6, 1, 2, 1, 149, 1, 1, 3, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'), (0, 'SIP-COMMON-MIB', 'sipCommonOptionTagIndex'))
if mibBuilder.loadTexts:
sipCommonOptionTagEntry.setStatus('current')
if mibBuilder.loadTexts:
sipCommonOptionTagEntry.setDescription('A particular SIP option tag (extension) supported or unsupported by the SIP entity, and which may be supported or required by a peer. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sip_common_option_tag_index = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 3, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 4294967295)))
if mibBuilder.loadTexts:
sipCommonOptionTagIndex.setStatus('current')
if mibBuilder.loadTexts:
sipCommonOptionTagIndex.setDescription('This object uniquely identifies a conceptual row in the table.')
sip_common_option_tag = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 3, 1, 2), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonOptionTag.setReference('RFC 3261, Section 27.1')
if mibBuilder.loadTexts:
sipCommonOptionTag.setStatus('current')
if mibBuilder.loadTexts:
sipCommonOptionTag.setDescription('This object indicates the SIP option tag. The option tag names are registered with IANA and available at http://www.iana.org.')
sip_common_option_tag_header_field = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 3, 1, 3), sip_tc_option_tag_headers()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonOptionTagHeaderField.setStatus('current')
if mibBuilder.loadTexts:
sipCommonOptionTagHeaderField.setDescription('This object indicates whether the SIP option tag is supported (Supported header), unsupported (Unsupported header), or required (Require or Proxy-Require header) by the SIP entity. A SIP option tag may be both supported and required.')
sip_common_method_supported_table = mib_table((1, 3, 6, 1, 2, 1, 149, 1, 1, 4))
if mibBuilder.loadTexts:
sipCommonMethodSupportedTable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonMethodSupportedTable.setDescription('This table contains a list of methods supported by each SIP entity in this system (see the standard set of SIP methods in Section 7.1 of RFC 3261). Any additional methods that may be incorporated into the SIP protocol can be represented by this table without any requirement to update this MIB module. The table is informational in nature and conveys capabilities of the managed system to the SNMP Manager. From a protocol point of view, the list of methods advertised by the SIP entity in the Allow header (Section 20.5 of RFC 3261) MUST be consistent with the methods reflected in this table.')
sip_common_method_supported_entry = mib_table_row((1, 3, 6, 1, 2, 1, 149, 1, 1, 4, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'), (0, 'SIP-COMMON-MIB', 'sipCommonMethodSupportedIndex'))
if mibBuilder.loadTexts:
sipCommonMethodSupportedEntry.setStatus('current')
if mibBuilder.loadTexts:
sipCommonMethodSupportedEntry.setDescription('A particular method supported by the SIP entity. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sip_common_method_supported_index = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 4, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 4294967295)))
if mibBuilder.loadTexts:
sipCommonMethodSupportedIndex.setStatus('current')
if mibBuilder.loadTexts:
sipCommonMethodSupportedIndex.setDescription('This object uniquely identifies a conceptual row in the table and reflects an assigned number used to identify a specific SIP method. This identifier is suitable for referencing the associated method throughout this and other MIBs supported by this managed system.')
sip_common_method_supported_name = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 4, 1, 2), sip_tc_method_name()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonMethodSupportedName.setStatus('current')
if mibBuilder.loadTexts:
sipCommonMethodSupportedName.setDescription("This object reflects the supported method's name. The method name MUST be all upper case (e.g., 'INVITE').")
sip_common_cfg_timer_table = mib_table((1, 3, 6, 1, 2, 1, 149, 1, 2, 1))
if mibBuilder.loadTexts:
sipCommonCfgTimerTable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerTable.setDescription('This table contains timer configuration objects applicable to SIP user agent and SIP stateful Proxy Server entities.')
sip_common_cfg_timer_entry = mib_table_row((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'))
if mibBuilder.loadTexts:
sipCommonCfgTimerEntry.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerEntry.setDescription('A row of timer configuration. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788). The objects in this table entry SHOULD be non-volatile and their value SHOULD be kept at reboot.')
sip_common_cfg_timer_a = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(100, 1000)).clone(500)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerA.setReference('RFC 3261, Section 17.1.1.2')
if mibBuilder.loadTexts:
sipCommonCfgTimerA.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerA.setDescription('This object reflects the initial value for the retransmit timer for the INVITE method. The retransmit timer doubles after each retransmission, ensuring an exponential backoff in network traffic. This object represents the initial time a SIP entity will wait to receive a provisional response to an INVITE before resending the INVITE request.')
sip_common_cfg_timer_b = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 2), unsigned32().subtype(subtypeSpec=value_range_constraint(32000, 300000)).clone(32000)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerB.setReference('RFC 3261, Section 17.1.1.2')
if mibBuilder.loadTexts:
sipCommonCfgTimerB.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerB.setDescription('This object reflects the maximum time a SIP entity will wait to receive a final response to an INVITE. The timer is started upon transmission of the initial INVITE request.')
sip_common_cfg_timer_c = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 3), unsigned32().subtype(subtypeSpec=value_range_constraint(180000, 300000)).clone(180000)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerC.setReference('RFC 3261, Section 16.6')
if mibBuilder.loadTexts:
sipCommonCfgTimerC.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerC.setDescription('This object reflects the maximum time a SIP Proxy Server will wait to receive a provisional response to an INVITE. The Timer C MUST be set for each client transaction when an INVITE request is proxied.')
sip_common_cfg_timer_d = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 4), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 300000)).clone(32000)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerD.setReference('RFC 3261, Section 17.1.1.2')
if mibBuilder.loadTexts:
sipCommonCfgTimerD.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerD.setDescription("This object reflects the amount of time that the server transaction can remain in the 'Completed' state when unreliable transports are used. The default value MUST be equal to or greater than 32000 for UDP transport, and its value MUST be 0 for TCP/SCTP transport.")
sip_common_cfg_timer_e = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 5), unsigned32().subtype(subtypeSpec=value_range_constraint(100, 1000)).clone(500)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerE.setReference('RFC 3261, Section 17.1.2.2')
if mibBuilder.loadTexts:
sipCommonCfgTimerE.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerE.setDescription("This object reflects the initial value for the retransmit timer for a non-INVITE method while in 'Trying' state. The retransmit timer doubles after each retransmission until it reaches T2 to ensure an exponential backoff in network traffic. This object represents the initial time a SIP entity will wait to receive a provisional response to the request before resending the non-INVITE request.")
sip_common_cfg_timer_f = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 6), unsigned32().subtype(subtypeSpec=value_range_constraint(32000, 300000)).clone(32000)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerF.setReference('RFC 3261, Section 17.1.2.2')
if mibBuilder.loadTexts:
sipCommonCfgTimerF.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerF.setDescription('This object reflects the maximum time a SIP entity will wait to receive a final response to a non-INVITE request. The timer is started upon transmission of the initial request.')
sip_common_cfg_timer_g = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 7), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 1000)).clone(500)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerG.setReference('RFC 3261, Section 17.2.1')
if mibBuilder.loadTexts:
sipCommonCfgTimerG.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerG.setDescription('This object reflects the initial value for the retransmit timer for final responses to INVITE requests. If timer G fires, the response is passed to the transport layer again for retransmission, and timer G is set to fire in MIN(2*T1, T2) seconds. From then on, when timer G fires, the response is passed to the transport again for transmission, and timer G is reset with a value that doubles, unless that value exceeds T2, in which case, it is reset with the value of T2. The default value MUST be T1 for UDP transport, and its value MUST be 0 for reliable transport like TCP/SCTP.')
sip_common_cfg_timer_h = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 8), unsigned32().subtype(subtypeSpec=value_range_constraint(32000, 300000)).clone(32000)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerH.setReference('RFC 3261, Section 17.2.1')
if mibBuilder.loadTexts:
sipCommonCfgTimerH.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerH.setDescription("This object reflects the maximum time a server will wait to receive an ACK before it abandons retransmitting the response. The timer is started upon entering the 'Completed' state.")
sip_common_cfg_timer_i = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 9), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 10000)).clone(5000)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerI.setReference('RFC 3261, Section 17.2.1')
if mibBuilder.loadTexts:
sipCommonCfgTimerI.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerI.setDescription("This object reflects the maximum time a SIP entity will wait to receive additional ACK message retransmissions. The timer is started upon entering the 'Confirmed' state. The default value MUST be T4 for UDP transport and its value MUST be 0 for reliable transport like TCP/SCTP.")
sip_common_cfg_timer_j = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 10), unsigned32().subtype(subtypeSpec=value_range_constraint(32000, 300000)).clone(32000)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerJ.setReference('RFC 3261, Section 17.2.2')
if mibBuilder.loadTexts:
sipCommonCfgTimerJ.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerJ.setDescription("This object reflects the maximum time a SIP server will wait to receive retransmissions of non-INVITE requests. The timer is started upon entering the 'Completed' state for non-INVITE transactions. When timer J fires, the server MUST transition to the 'Terminated' state.")
sip_common_cfg_timer_k = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 11), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 10000)).clone(5000)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerK.setReference('RFC 3261, Section 17.1.2.2')
if mibBuilder.loadTexts:
sipCommonCfgTimerK.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerK.setDescription("This object reflects the maximum time a SIP client will wait to receive retransmissions of responses to non-INVITE requests. The timer is started upon entering the 'Completed' state for non-INVITE transactions. When timer K fires, the server MUST transition to the 'Terminated' state. The default value MUST be T4 for UDP transport, and its value MUST be 0 for reliable transport like TCP/SCTP.")
sip_common_cfg_timer_t1 = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 12), unsigned32().subtype(subtypeSpec=value_range_constraint(200, 10000)).clone(500)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerT1.setReference('RFC 3261, Section 17')
if mibBuilder.loadTexts:
sipCommonCfgTimerT1.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerT1.setDescription('This object reflects the T1 timer for a SIP entity. T1 is an estimate of the round-trip time (RTT) between the client and server transactions.')
sip_common_cfg_timer_t2 = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 13), unsigned32().subtype(subtypeSpec=value_range_constraint(200, 10000)).clone(4000)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerT2.setReference('RFC 3261, Section 17')
if mibBuilder.loadTexts:
sipCommonCfgTimerT2.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerT2.setDescription("This object reflects the T2 timer for a SIP entity. T2 is the maximum retransmit interval for non-INVITE requests and INVITE responses. It's used in various parts of the protocol to reset other Timer* objects to this value.")
sip_common_cfg_timer_t4 = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 14), unsigned32().subtype(subtypeSpec=value_range_constraint(200, 10000)).clone(5000)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerT4.setReference('RFC 3261, Section 17')
if mibBuilder.loadTexts:
sipCommonCfgTimerT4.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerT4.setDescription("This object reflects the T4 timer for a SIP entity. T4 is the maximum duration a message will remain in the network. It represents the amount of time the network will take to clear messages between client and server transactions. It's used in various parts of the protocol to reset other Timer* objects to this value.")
sip_common_summary_stats_table = mib_table((1, 3, 6, 1, 2, 1, 149, 1, 3, 1))
if mibBuilder.loadTexts:
sipCommonSummaryStatsTable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonSummaryStatsTable.setDescription('This table contains the summary statistics objects applicable to all SIP entities. Each row represents those objects for a particular SIP entity present in this system.')
sip_common_summary_stats_entry = mib_table_row((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'))
if mibBuilder.loadTexts:
sipCommonSummaryStatsEntry.setStatus('current')
if mibBuilder.loadTexts:
sipCommonSummaryStatsEntry.setDescription('A row of summary statistics. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sip_common_summary_in_requests = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1, 1), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonSummaryInRequests.setStatus('current')
if mibBuilder.loadTexts:
sipCommonSummaryInRequests.setDescription('This object indicates the total number of SIP request messages received by the SIP entity, including retransmissions. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonSummaryDisconTime object in the same row.')
sip_common_summary_out_requests = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonSummaryOutRequests.setStatus('current')
if mibBuilder.loadTexts:
sipCommonSummaryOutRequests.setDescription('This object contains the total number of SIP request messages sent out (originated and relayed) by the SIP entity. Where a particular message is sent more than once, for example as a retransmission or as a result of forking, each transmission is counted separately. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonSummaryDisconTime object in the same row.')
sip_common_summary_in_responses = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonSummaryInResponses.setStatus('current')
if mibBuilder.loadTexts:
sipCommonSummaryInResponses.setDescription('This object contains the total number of SIP response messages received by the SIP entity, including retransmissions. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonSummaryDisconTime object in the same row.')
sip_common_summary_out_responses = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonSummaryOutResponses.setStatus('current')
if mibBuilder.loadTexts:
sipCommonSummaryOutResponses.setDescription('This object contains the total number of SIP response messages sent (originated and relayed) by the SIP entity including retransmissions. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonSummaryDisconTime object in the same row.')
sip_common_summary_total_transactions = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonSummaryTotalTransactions.setStatus('current')
if mibBuilder.loadTexts:
sipCommonSummaryTotalTransactions.setDescription("This object contains a count of the number of transactions that are in progress and transactions that have reached the 'Terminated' state. It is not applicable to stateless SIP Proxy Servers. A SIP transaction occurs between a client and a server, and comprises all messages from the first request sent from the client to the server, up to a final (non-1xx) response sent from the server to the client. If the request is INVITE and the final response is a non-2xx, the transaction also include an ACK to the response. The ACK for a 2xx response to an INVITE request is a separate transaction. The branch ID parameter in the Via header field values serves as a transaction identifier. A transaction is identified by the CSeq sequence number within a single call leg. The ACK request has the same CSeq number as the corresponding INVITE request, but comprises a transaction of its own. In the case of a forked request, each branch counts as a single transaction. For a transaction stateless Proxy Server, this counter is always 0. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonSummaryDisconTime object in the same row.")
sip_common_summary_discon_time = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1, 6), time_stamp()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonSummaryDisconTime.setStatus('current')
if mibBuilder.loadTexts:
sipCommonSummaryDisconTime.setDescription('The value of the sysUpTime object when the counters for the summary statistics objects in this row last experienced a discontinuity.')
sip_common_method_stats_table = mib_table((1, 3, 6, 1, 2, 1, 149, 1, 4, 1))
if mibBuilder.loadTexts:
sipCommonMethodStatsTable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonMethodStatsTable.setDescription('This table contains the method statistics objects for SIP entities. Each row represents those objects for a particular SIP entity present in this system.')
sip_common_method_stats_entry = mib_table_row((1, 3, 6, 1, 2, 1, 149, 1, 4, 1, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'), (0, 'SIP-COMMON-MIB', 'sipCommonMethodStatsName'))
if mibBuilder.loadTexts:
sipCommonMethodStatsEntry.setStatus('current')
if mibBuilder.loadTexts:
sipCommonMethodStatsEntry.setDescription('A row of per entity method statistics. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sip_common_method_stats_name = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 4, 1, 1, 1), sip_tc_method_name())
if mibBuilder.loadTexts:
sipCommonMethodStatsName.setStatus('current')
if mibBuilder.loadTexts:
sipCommonMethodStatsName.setDescription('This object uniquely identifies the SIP method related to the objects in a particular row.')
sip_common_method_stats_outbounds = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 4, 1, 1, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonMethodStatsOutbounds.setReference('RFC 3261, Section 7.1')
if mibBuilder.loadTexts:
sipCommonMethodStatsOutbounds.setStatus('current')
if mibBuilder.loadTexts:
sipCommonMethodStatsOutbounds.setDescription('This object reflects the total number of requests sent by the SIP entity, excluding retransmissions. Retransmissions are counted separately and are not reflected in this counter. A Management Station can detect discontinuities in this counter by monitoring the sipCommonMethodStatsDisconTime object in the same row.')
sip_common_method_stats_inbounds = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 4, 1, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonMethodStatsInbounds.setReference('RFC 3261, Section 7.1')
if mibBuilder.loadTexts:
sipCommonMethodStatsInbounds.setStatus('current')
if mibBuilder.loadTexts:
sipCommonMethodStatsInbounds.setDescription('This object reflects the total number of requests received by the SIP entity. Retransmissions are counted separately and are not reflected in this counter. A Management Station can detect discontinuities in this counter by monitoring the sipCommonMethodStatsDisconTime object in the same row.')
sip_common_method_stats_discon_time = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 4, 1, 1, 4), time_stamp()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonMethodStatsDisconTime.setStatus('current')
if mibBuilder.loadTexts:
sipCommonMethodStatsDisconTime.setDescription('The value of the sysUpTime object when the counters for the method statistics objects in this row last experienced a discontinuity.')
sip_common_status_code_table = mib_table((1, 3, 6, 1, 2, 1, 149, 1, 5, 1))
if mibBuilder.loadTexts:
sipCommonStatusCodeTable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeTable.setDescription('This table contains the list of SIP status codes that each SIP entity in this system has been requested to monitor. It is the mechanism by which specific status codes are monitored. Entries created in this table must not persist across reboots.')
sip_common_status_code_entry = mib_table_row((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'), (0, 'SIP-COMMON-MIB', 'sipCommonStatusCodeMethod'), (0, 'SIP-COMMON-MIB', 'sipCommonStatusCodeValue'))
if mibBuilder.loadTexts:
sipCommonStatusCodeEntry.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeEntry.setDescription('This row contains information on a particular SIP status code that the SIP entity has been requested to monitor. Entries created in this table must not persist across reboots. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sip_common_status_code_method = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1, 1), sip_tc_method_name())
if mibBuilder.loadTexts:
sipCommonStatusCodeMethod.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeMethod.setDescription('This object uniquely identifies a conceptual row in the table.')
sip_common_status_code_value = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1, 2), unsigned32().subtype(subtypeSpec=value_range_constraint(100, 999)))
if mibBuilder.loadTexts:
sipCommonStatusCodeValue.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeValue.setDescription('This object contains a SIP status code value that the SIP entity has been requested to monitor. All of the other information in the row is related to this value.')
sip_common_status_code_ins = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonStatusCodeIns.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeIns.setDescription('This object reflects the total number of response messages received by the SIP entity with the status code value contained in the sipCommonStatusCodeValue column. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service, or when the monitoring of the status code is temporarily disabled. A Management Station can detect discontinuities in this counter by monitoring the sipCommonStatusCodeDisconTime object in the same row.')
sip_common_status_code_outs = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonStatusCodeOuts.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeOuts.setDescription('This object reflects the total number of response messages sent by the SIP entity with the status code value contained in the sipCommonStatusCodeValue column. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service, or when the monitoring of the Status code is temporarily disabled. A Management Station can detect discontinuities in this counter by monitoring the sipCommonStatusCodeDisconTime object in the same row.')
sip_common_status_code_row_status = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1, 5), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
sipCommonStatusCodeRowStatus.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeRowStatus.setDescription("The row augmentation in sipCommonStatusCodeNotifTable will be governed by the value of this RowStatus. The values 'createAndGo' and 'destroy' are the only valid values allowed for this object. If a row exists, it will reflect a status of 'active' when queried.")
sip_common_status_code_discon_time = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1, 6), time_stamp()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonStatusCodeDisconTime.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeDisconTime.setDescription('The value of the sysUpTime object when the counters for the status code statistics objects in this row last experienced a discontinuity.')
sip_common_status_code_notif_table = mib_table((1, 3, 6, 1, 2, 1, 149, 1, 5, 2))
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifTable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifTable.setDescription('This table contains objects to control notifications related to particular status codes that each SIP entity in this system has been requested to monitor. There is an entry in this table corresponding to each entry in sipCommonStatusCodeTable. Therefore, this table augments sipCommonStatusCodeTable and utilizes the same index methodology. The objects in this table are not included directly in the sipCommonStatusCodeTable simply to keep the status code notification control objects separate from the actual status code statistics.')
sip_common_status_code_notif_entry = mib_table_row((1, 3, 6, 1, 2, 1, 149, 1, 5, 2, 1))
sipCommonStatusCodeEntry.registerAugmentions(('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifEntry'))
sipCommonStatusCodeNotifEntry.setIndexNames(*sipCommonStatusCodeEntry.getIndexNames())
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifEntry.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifEntry.setDescription('This row contains information controlling notifications for a particular SIP status code that the SIP entity has been requested to monitor.')
sip_common_status_code_notif_send = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 5, 2, 1, 1), truth_value().clone('false')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifSend.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifSend.setDescription("This object controls whether a sipCommonStatusCodeNotif is emitted when the status code value specified by sipCommonStatusCodeValue is sent or received. If the value of this object is 'true', then a notification is sent. If it is 'false', no notification is sent. Note well that a notification MAY be emitted for every message sent or received that contains the particular status code. Depending on the status code involved, this can cause a significant number of notification emissions that could be detrimental to network performance. Managers are forewarned to be prudent in the use of this object to enable notifications. Look to sipCommonStatusCodeNotifEmitMode for alternative controls for sipCommonStatusCodeNotif emissions.")
sip_common_status_code_notif_emit_mode = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 5, 2, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('normal', 1), ('oneShot', 2), ('triggered', 3))).clone('oneShot')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifEmitMode.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifEmitMode.setDescription("The object sipCommonStatusCodeNotifSend MUST be set to 'true' for the values of this object to have any effect. It is RECOMMENDED that the desired emit mode be established by this object prior to setting sipCommonStatusCodeNotifSend to 'true'. This object and the sipCommonStatusCodeNotifSend object can obviously be set independently, but their respective values will have a dependency on each other and the resulting notifications. This object specifies the mode for emissions of sipCommonStatusCodeNotif notifications. normal : sipCommonStatusCodeNotif notifications will be emitted by the system for each SIP response message sent or received that contains the desired status code. oneShot : Only one sipCommonStatusCodeNotif notification will be emitted. It will be the next SIP response message sent or received that contains the desired status code. No more notifications are emitted until this object is set to 'oneShot' again or set to 'normal'. This option is provided as a means of quelling the potential promiscuous behavior that can be associated with the sipCommonStatusCodeNotif. triggered : This value is only readable and cannot be set. It reflects that the 'oneShot' case has occurred, and indicates that the mode needs to be reset to get further notifications. The mode is reset by setting this object to 'oneShot' or 'normal'.")
sip_common_status_code_notif_thresh = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 5, 2, 1, 3), unsigned32().clone(500)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifThresh.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifThresh.setDescription('This object specifies the number of response messages sent or received by this system that are considered excessive. Based on crossing that threshold, a sipCommonStatusCodeThreshExceededInNotif notification or a sipCommonStatusCodeThreshExceededOutNotif will be sent. The sipCommonStatusCodeThreshExceededInNotif and sipCommonStatusCodeThreshExceededOutNotif notifications can be used as an early warning mechanism in lieu of using sipCommonStatusCodeNotif. Note that the configuration applied by this object will be applied equally to inbound and outbound response messages.')
sip_common_status_code_notif_interval = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 5, 2, 1, 4), unsigned32().clone(60)).setUnits('seconds').setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifInterval.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifInterval.setDescription('This object specifies the time interval over which, if sipCommonStatusCodeThresh is exceeded with respect to sent or received messages, a sipCommonStatusCodeThreshExceededInNotif or sipCommonStatusCodeThreshExceededOutNotif notification will be sent. Note that the configuration applied by this object will be applied equally to inbound and outbound response messages.')
sip_common_trans_current_table = mib_table((1, 3, 6, 1, 2, 1, 149, 1, 6, 1))
if mibBuilder.loadTexts:
sipCommonTransCurrentTable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonTransCurrentTable.setDescription('This table contains information on the transactions currently awaiting definitive responses by each SIP entity in this system. This table does not apply to transaction stateless Proxy Servers.')
sip_common_trans_current_entry = mib_table_row((1, 3, 6, 1, 2, 1, 149, 1, 6, 1, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'))
if mibBuilder.loadTexts:
sipCommonTransCurrentEntry.setStatus('current')
if mibBuilder.loadTexts:
sipCommonTransCurrentEntry.setDescription("Information on a particular SIP entity's current transactions. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).")
sip_common_trans_currentactions = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 6, 1, 1, 1), gauge32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonTransCurrentactions.setStatus('current')
if mibBuilder.loadTexts:
sipCommonTransCurrentactions.setDescription('This object contains the number of transactions awaiting definitive (non-1xx) response. In the case of a forked request, each branch counts as a single transaction corresponding to the entity identified by applIndex.')
sip_common_stats_retry_table = mib_table((1, 3, 6, 1, 2, 1, 149, 1, 7, 1))
if mibBuilder.loadTexts:
sipCommonStatsRetryTable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatsRetryTable.setDescription('This table contains retry statistics objects applicable to each SIP entity in this system.')
sip_common_stats_retry_entry = mib_table_row((1, 3, 6, 1, 2, 1, 149, 1, 7, 1, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'), (0, 'SIP-COMMON-MIB', 'sipCommonStatsRetryMethod'))
if mibBuilder.loadTexts:
sipCommonStatsRetryEntry.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatsRetryEntry.setDescription('A row of retry statistics. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sip_common_stats_retry_method = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 7, 1, 1, 1), sip_tc_method_name())
if mibBuilder.loadTexts:
sipCommonStatsRetryMethod.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatsRetryMethod.setDescription('This object uniquely identifies the SIP method related to the objects in a row.')
sip_common_stats_retries = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 7, 1, 1, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonStatsRetries.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatsRetries.setDescription('This object reflects the total number of request retransmissions that have been sent by the SIP entity. Note that there could be multiple retransmissions per request. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonStatsRetryDisconTime object in the same row.')
sip_common_stats_retry_final_responses = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 7, 1, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonStatsRetryFinalResponses.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatsRetryFinalResponses.setDescription('This object reflects the total number of Final Response retries that have been sent by the SIP entity. Note that there could be multiple retransmissions per request. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonStatsRetryDisconTime object in the same row.')
sip_common_stats_retry_non_final_responses = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 7, 1, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonStatsRetryNonFinalResponses.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatsRetryNonFinalResponses.setDescription('This object reflects the total number of non-Final Response retries that have been sent by the SIP entity. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonStatsRetryDisconTime object in the same row.')
sip_common_stats_retry_discon_time = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 7, 1, 1, 5), time_stamp()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonStatsRetryDisconTime.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatsRetryDisconTime.setDescription('The value of the sysUpTime object when the counters for the retry statistics objects in this row last experienced a discontinuity.')
sip_common_other_stats_table = mib_table((1, 3, 6, 1, 2, 1, 149, 1, 8, 1))
if mibBuilder.loadTexts:
sipCommonOtherStatsTable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonOtherStatsTable.setDescription('This table contains other common statistics supported by each SIP entity in this system.')
sip_common_other_stats_entry = mib_table_row((1, 3, 6, 1, 2, 1, 149, 1, 8, 1, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'))
if mibBuilder.loadTexts:
sipCommonOtherStatsEntry.setStatus('current')
if mibBuilder.loadTexts:
sipCommonOtherStatsEntry.setDescription("Information on a particular SIP entity's other common statistics. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).")
sip_common_other_stats_num_unsupported_uris = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 8, 1, 1, 1), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonOtherStatsNumUnsupportedUris.setStatus('current')
if mibBuilder.loadTexts:
sipCommonOtherStatsNumUnsupportedUris.setDescription('Number of RequestURIs received with an unsupported scheme. A server normally responds to such requests with a 400 Bad Request status code. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonOtherStatsDisconTime object in the same row.')
sip_common_other_stats_num_unsupported_methods = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 8, 1, 1, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonOtherStatsNumUnsupportedMethods.setStatus('current')
if mibBuilder.loadTexts:
sipCommonOtherStatsNumUnsupportedMethods.setDescription('Number of SIP requests received with unsupported methods. A server normally responds to such requests with a 501 (Not Implemented) or 405 (Method Not Allowed). Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonOtherStatsDisconTime object in the same row.')
sip_common_other_stats_otherwise_discarded_msgs = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 8, 1, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonOtherStatsOtherwiseDiscardedMsgs.setStatus('current')
if mibBuilder.loadTexts:
sipCommonOtherStatsOtherwiseDiscardedMsgs.setDescription('Number of SIP messages received that, for any number of reasons, was discarded without a response. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonOtherStatsDisconTime object in the same row.')
sip_common_other_stats_discon_time = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 8, 1, 1, 4), time_stamp()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonOtherStatsDisconTime.setStatus('current')
if mibBuilder.loadTexts:
sipCommonOtherStatsDisconTime.setDescription('The value of the sysUpTime object when the counters for the statistics objects in this row last experienced a discontinuity.')
sip_common_status_code_notif_to = mib_scalar((1, 3, 6, 1, 2, 1, 149, 1, 9, 1), snmp_admin_string()).setMaxAccess('accessiblefornotify')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifTo.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifTo.setDescription("This object contains the value of the To header in the message containing the status code that caused the notification. The header name will be part of this object value. For example, 'To: Watson '.")
sip_common_status_code_notif_from = mib_scalar((1, 3, 6, 1, 2, 1, 149, 1, 9, 2), snmp_admin_string()).setMaxAccess('accessiblefornotify')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifFrom.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifFrom.setDescription("This object contains the value of the From header in the message containing the status code that caused the notification. The header name will be part of this object value. For example, 'From: Watson '.")
sip_common_status_code_notif_call_id = mib_scalar((1, 3, 6, 1, 2, 1, 149, 1, 9, 3), snmp_admin_string()).setMaxAccess('accessiblefornotify')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifCallId.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifCallId.setDescription("This object contains the value of the Call-ID in the message containing the status code that caused the notification. The header name will be part of this object value. For example, 'Call-ID: 5551212@example.com'.")
sip_common_status_code_notif_c_seq = mib_scalar((1, 3, 6, 1, 2, 1, 149, 1, 9, 4), unsigned32()).setMaxAccess('accessiblefornotify')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifCSeq.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifCSeq.setDescription("This object contains the CSeq value in the message containing the status code that caused the notification. The header name will be part of this object value. For example, 'CSeq: 1722 INVITE'.")
sip_common_notif_appl_index = mib_scalar((1, 3, 6, 1, 2, 1, 149, 1, 9, 5), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))).setMaxAccess('accessiblefornotify')
if mibBuilder.loadTexts:
sipCommonNotifApplIndex.setStatus('current')
if mibBuilder.loadTexts:
sipCommonNotifApplIndex.setDescription('This object contains the applIndex as described in RFC 2788. This object is created in order to allow a variable binding containing a value of applIndex in a notification.')
sip_common_notif_sequence_number = mib_scalar((1, 3, 6, 1, 2, 1, 149, 1, 9, 6), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))).setMaxAccess('accessiblefornotify')
if mibBuilder.loadTexts:
sipCommonNotifSequenceNumber.setStatus('current')
if mibBuilder.loadTexts:
sipCommonNotifSequenceNumber.setDescription('This object contains a sequence number for each notification generated by this SIP entity. Each notification SHOULD have a unique sequence number. A network manager can use this information to determine whether notifications from a particular SIP entity have been missed. The value of this object MUST start at 1 and increase by 1 with each generated notification. If a system restarts, the sequence number MAY start again from 1.')
sip_common_status_code_notif = notification_type((1, 3, 6, 1, 2, 1, 149, 0, 1)).setObjects(('SIP-COMMON-MIB', 'sipCommonNotifSequenceNumber'), ('SIP-COMMON-MIB', 'sipCommonNotifApplIndex'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifTo'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifFrom'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifCallId'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifCSeq'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeIns'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeOuts'))
if mibBuilder.loadTexts:
sipCommonStatusCodeNotif.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotif.setDescription('Signifies that a specific status code has been sent or received by the system.')
sip_common_status_code_thresh_exceeded_in_notif = notification_type((1, 3, 6, 1, 2, 1, 149, 0, 2)).setObjects(('SIP-COMMON-MIB', 'sipCommonNotifSequenceNumber'), ('SIP-COMMON-MIB', 'sipCommonNotifApplIndex'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeIns'))
if mibBuilder.loadTexts:
sipCommonStatusCodeThreshExceededInNotif.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeThreshExceededInNotif.setDescription('Signifies that a specific status code was found to have been received by the system frequently enough to exceed the configured threshold. This notification can be used as an early warning mechanism in lieu of using sipCommonStatusCodeNotif.')
sip_common_status_code_thresh_exceeded_out_notif = notification_type((1, 3, 6, 1, 2, 1, 149, 0, 3)).setObjects(('SIP-COMMON-MIB', 'sipCommonNotifSequenceNumber'), ('SIP-COMMON-MIB', 'sipCommonNotifApplIndex'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeOuts'))
if mibBuilder.loadTexts:
sipCommonStatusCodeThreshExceededOutNotif.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeThreshExceededOutNotif.setDescription('Signifies that a specific status code was found to have been sent by the system enough to exceed the configured threshold. This notification can be used as an early warning mechanism in lieu of using sipCommonStatusCodeNotif.')
sip_common_service_cold_start = notification_type((1, 3, 6, 1, 2, 1, 149, 0, 4)).setObjects(('SIP-COMMON-MIB', 'sipCommonNotifSequenceNumber'), ('SIP-COMMON-MIB', 'sipCommonNotifApplIndex'), ('SIP-COMMON-MIB', 'sipCommonCfgServiceStartTime'))
if mibBuilder.loadTexts:
sipCommonServiceColdStart.setStatus('current')
if mibBuilder.loadTexts:
sipCommonServiceColdStart.setDescription("Signifies that the SIP service has reinitialized itself or started for the first time. This SHOULD result from a hard 'down' to 'up' administrative status change. The configuration or behavior of the service MAY be altered.")
sip_common_service_warm_start = notification_type((1, 3, 6, 1, 2, 1, 149, 0, 5)).setObjects(('SIP-COMMON-MIB', 'sipCommonNotifSequenceNumber'), ('SIP-COMMON-MIB', 'sipCommonNotifApplIndex'), ('SIP-COMMON-MIB', 'sipCommonCfgServiceLastChange'))
if mibBuilder.loadTexts:
sipCommonServiceWarmStart.setStatus('current')
if mibBuilder.loadTexts:
sipCommonServiceWarmStart.setDescription("Signifies that the SIP service has reinitialized itself and is restarting after an administrative 'reset'. The configuration or behavior of the service MAY be altered.")
sip_common_service_status_changed = notification_type((1, 3, 6, 1, 2, 1, 149, 0, 6)).setObjects(('SIP-COMMON-MIB', 'sipCommonNotifSequenceNumber'), ('SIP-COMMON-MIB', 'sipCommonNotifApplIndex'), ('SIP-COMMON-MIB', 'sipCommonCfgServiceLastChange'), ('SIP-COMMON-MIB', 'sipCommonCfgServiceOperStatus'))
if mibBuilder.loadTexts:
sipCommonServiceStatusChanged.setStatus('current')
if mibBuilder.loadTexts:
sipCommonServiceStatusChanged.setDescription('Signifies that the SIP service operational status has changed.')
sip_common_mib_compliances = mib_identifier((1, 3, 6, 1, 2, 1, 149, 2, 1))
sip_common_mib_groups = mib_identifier((1, 3, 6, 1, 2, 1, 149, 2, 2))
sip_common_compliance = module_compliance((1, 3, 6, 1, 2, 1, 149, 2, 1, 1)).setObjects(('SIP-COMMON-MIB', 'sipCommonConfigGroup'), ('SIP-COMMON-MIB', 'sipCommonStatsGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sip_common_compliance = sipCommonCompliance.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCompliance.setDescription('The compliance statement for SIP entities.')
sip_common_config_group = object_group((1, 3, 6, 1, 2, 1, 149, 2, 2, 1)).setObjects(('SIP-COMMON-MIB', 'sipCommonCfgProtocolVersion'), ('SIP-COMMON-MIB', 'sipCommonCfgServiceOperStatus'), ('SIP-COMMON-MIB', 'sipCommonCfgServiceStartTime'), ('SIP-COMMON-MIB', 'sipCommonCfgServiceLastChange'), ('SIP-COMMON-MIB', 'sipCommonPortTransportRcv'), ('SIP-COMMON-MIB', 'sipCommonOptionTag'), ('SIP-COMMON-MIB', 'sipCommonOptionTagHeaderField'), ('SIP-COMMON-MIB', 'sipCommonCfgMaxTransactions'), ('SIP-COMMON-MIB', 'sipCommonCfgServiceNotifEnable'), ('SIP-COMMON-MIB', 'sipCommonCfgEntityType'), ('SIP-COMMON-MIB', 'sipCommonMethodSupportedName'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sip_common_config_group = sipCommonConfigGroup.setStatus('current')
if mibBuilder.loadTexts:
sipCommonConfigGroup.setDescription('A collection of objects providing configuration common to all SIP entities.')
sip_common_informational_group = object_group((1, 3, 6, 1, 2, 1, 149, 2, 2, 2)).setObjects(('SIP-COMMON-MIB', 'sipCommonCfgOrganization'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sip_common_informational_group = sipCommonInformationalGroup.setStatus('current')
if mibBuilder.loadTexts:
sipCommonInformationalGroup.setDescription('A collection of objects providing configuration common to all SIP entities.')
sip_common_config_timer_group = object_group((1, 3, 6, 1, 2, 1, 149, 2, 2, 3)).setObjects(('SIP-COMMON-MIB', 'sipCommonCfgTimerA'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerB'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerC'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerD'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerE'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerF'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerG'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerH'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerI'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerJ'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerK'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerT1'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerT2'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerT4'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sip_common_config_timer_group = sipCommonConfigTimerGroup.setStatus('current')
if mibBuilder.loadTexts:
sipCommonConfigTimerGroup.setDescription('A collection of objects providing timer configuration common to all SIP entities.')
sip_common_stats_group = object_group((1, 3, 6, 1, 2, 1, 149, 2, 2, 4)).setObjects(('SIP-COMMON-MIB', 'sipCommonSummaryInRequests'), ('SIP-COMMON-MIB', 'sipCommonSummaryOutRequests'), ('SIP-COMMON-MIB', 'sipCommonSummaryInResponses'), ('SIP-COMMON-MIB', 'sipCommonSummaryOutResponses'), ('SIP-COMMON-MIB', 'sipCommonSummaryTotalTransactions'), ('SIP-COMMON-MIB', 'sipCommonSummaryDisconTime'), ('SIP-COMMON-MIB', 'sipCommonMethodStatsOutbounds'), ('SIP-COMMON-MIB', 'sipCommonMethodStatsInbounds'), ('SIP-COMMON-MIB', 'sipCommonMethodStatsDisconTime'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeIns'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeOuts'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeRowStatus'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeDisconTime'), ('SIP-COMMON-MIB', 'sipCommonTransCurrentactions'), ('SIP-COMMON-MIB', 'sipCommonOtherStatsNumUnsupportedUris'), ('SIP-COMMON-MIB', 'sipCommonOtherStatsNumUnsupportedMethods'), ('SIP-COMMON-MIB', 'sipCommonOtherStatsOtherwiseDiscardedMsgs'), ('SIP-COMMON-MIB', 'sipCommonOtherStatsDisconTime'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sip_common_stats_group = sipCommonStatsGroup.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatsGroup.setDescription('A collection of objects providing statistics common to all SIP entities.')
sip_common_stats_retry_group = object_group((1, 3, 6, 1, 2, 1, 149, 2, 2, 5)).setObjects(('SIP-COMMON-MIB', 'sipCommonStatsRetries'), ('SIP-COMMON-MIB', 'sipCommonStatsRetryFinalResponses'), ('SIP-COMMON-MIB', 'sipCommonStatsRetryNonFinalResponses'), ('SIP-COMMON-MIB', 'sipCommonStatsRetryDisconTime'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sip_common_stats_retry_group = sipCommonStatsRetryGroup.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatsRetryGroup.setDescription('A collection of objects providing retry statistics.')
sip_common_notif_group = notification_group((1, 3, 6, 1, 2, 1, 149, 2, 2, 6)).setObjects(('SIP-COMMON-MIB', 'sipCommonStatusCodeNotif'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeThreshExceededInNotif'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeThreshExceededOutNotif'), ('SIP-COMMON-MIB', 'sipCommonServiceColdStart'), ('SIP-COMMON-MIB', 'sipCommonServiceWarmStart'), ('SIP-COMMON-MIB', 'sipCommonServiceStatusChanged'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sip_common_notif_group = sipCommonNotifGroup.setStatus('current')
if mibBuilder.loadTexts:
sipCommonNotifGroup.setDescription('A collection of notifications common to all SIP entities.')
sip_common_status_code_notif_group = object_group((1, 3, 6, 1, 2, 1, 149, 2, 2, 7)).setObjects(('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifSend'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifEmitMode'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifThresh'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifInterval'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sip_common_status_code_notif_group = sipCommonStatusCodeNotifGroup.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifGroup.setDescription('A collection of objects related to the control and attribution of notifications common to all SIP entities.')
sip_common_notif_objects_group = object_group((1, 3, 6, 1, 2, 1, 149, 2, 2, 8)).setObjects(('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifTo'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifFrom'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifCallId'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifCSeq'), ('SIP-COMMON-MIB', 'sipCommonNotifApplIndex'), ('SIP-COMMON-MIB', 'sipCommonNotifSequenceNumber'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sip_common_notif_objects_group = sipCommonNotifObjectsGroup.setStatus('current')
if mibBuilder.loadTexts:
sipCommonNotifObjectsGroup.setDescription('A collection of accessible-for-notify objects related to the notification defined in this MIB module.')
mibBuilder.exportSymbols('SIP-COMMON-MIB', sipCommonStatusCodeNotifTable=sipCommonStatusCodeNotifTable, sipCommonStatsRetryNonFinalResponses=sipCommonStatsRetryNonFinalResponses, sipCommonStatusCodeValue=sipCommonStatusCodeValue, sipCommonMIBConformance=sipCommonMIBConformance, sipCommonPortTable=sipCommonPortTable, sipCommonMethodStats=sipCommonMethodStats, sipCommonCfgTimer=sipCommonCfgTimer, sipCommonOptionTagTable=sipCommonOptionTagTable, sipCommonCfgServiceLastChange=sipCommonCfgServiceLastChange, sipCommonNotifObjectsGroup=sipCommonNotifObjectsGroup, sipCommonMIBObjects=sipCommonMIBObjects, sipCommonCfgTimerG=sipCommonCfgTimerG, sipCommonSummaryInResponses=sipCommonSummaryInResponses, sipCommonCompliance=sipCommonCompliance, sipCommonSummaryDisconTime=sipCommonSummaryDisconTime, sipCommonStatusCode=sipCommonStatusCode, sipCommonCfgEntityType=sipCommonCfgEntityType, sipCommonCfgTimerB=sipCommonCfgTimerB, sipCommonStatusCodeNotifTo=sipCommonStatusCodeNotifTo, sipCommonStatsRetryGroup=sipCommonStatsRetryGroup, sipCommonNotifSequenceNumber=sipCommonNotifSequenceNumber, sipCommonNotifObjects=sipCommonNotifObjects, sipCommonStatsRetryDisconTime=sipCommonStatsRetryDisconTime, sipCommonPort=sipCommonPort, sipCommonMethodStatsEntry=sipCommonMethodStatsEntry, sipCommonStatsRetryTable=sipCommonStatsRetryTable, sipCommonStatusCodeNotifInterval=sipCommonStatusCodeNotifInterval, sipCommonStatusCodeRowStatus=sipCommonStatusCodeRowStatus, sipCommonCfgTimerD=sipCommonCfgTimerD, sipCommonSummaryOutResponses=sipCommonSummaryOutResponses, sipCommonCfgServiceStartTime=sipCommonCfgServiceStartTime, sipCommonCfgTimerA=sipCommonCfgTimerA, sipCommonConfigTimerGroup=sipCommonConfigTimerGroup, sipCommonCfgTimerT4=sipCommonCfgTimerT4, sipCommonMethodSupportedIndex=sipCommonMethodSupportedIndex, sipCommonNotifGroup=sipCommonNotifGroup, sipCommonStatusCodeNotifEmitMode=sipCommonStatusCodeNotifEmitMode, sipCommonMethodStatsInbounds=sipCommonMethodStatsInbounds, sipCommonConfigGroup=sipCommonConfigGroup, sipCommonNotifApplIndex=sipCommonNotifApplIndex, sipCommonMIB=sipCommonMIB, sipCommonCfgTimerTable=sipCommonCfgTimerTable, sipCommonStatusCodeDisconTime=sipCommonStatusCodeDisconTime, sipCommonInformationalGroup=sipCommonInformationalGroup, sipCommonMethodStatsDisconTime=sipCommonMethodStatsDisconTime, sipCommonCfgTimerT1=sipCommonCfgTimerT1, sipCommonCfgOrganization=sipCommonCfgOrganization, sipCommonOtherStatsNumUnsupportedUris=sipCommonOtherStatsNumUnsupportedUris, sipCommonServiceWarmStart=sipCommonServiceWarmStart, sipCommonCfgTimerI=sipCommonCfgTimerI, sipCommonCfgTimerK=sipCommonCfgTimerK, sipCommonStatusCodeNotifSend=sipCommonStatusCodeNotifSend, sipCommonOtherStatsTable=sipCommonOtherStatsTable, sipCommonMIBNotifications=sipCommonMIBNotifications, sipCommonStatusCodeThreshExceededOutNotif=sipCommonStatusCodeThreshExceededOutNotif, sipCommonStatusCodeNotifCSeq=sipCommonStatusCodeNotifCSeq, sipCommonStatsRetryMethod=sipCommonStatsRetryMethod, sipCommonStatusCodeNotifGroup=sipCommonStatusCodeNotifGroup, sipCommonMIBGroups=sipCommonMIBGroups, sipCommonOtherStatsOtherwiseDiscardedMsgs=sipCommonOtherStatsOtherwiseDiscardedMsgs, sipCommonTransCurrentEntry=sipCommonTransCurrentEntry, sipCommonCfgEntry=sipCommonCfgEntry, sipCommonStatsTrans=sipCommonStatsTrans, sipCommonCfgServiceOperStatus=sipCommonCfgServiceOperStatus, sipCommonOtherStatsNumUnsupportedMethods=sipCommonOtherStatsNumUnsupportedMethods, sipCommonOptionTagIndex=sipCommonOptionTagIndex, sipCommonMethodStatsTable=sipCommonMethodStatsTable, sipCommonCfgTimerJ=sipCommonCfgTimerJ, sipCommonStatusCodeNotifThresh=sipCommonStatusCodeNotifThresh, sipCommonCfgTable=sipCommonCfgTable, sipCommonStatsRetries=sipCommonStatsRetries, sipCommonStatusCodeEntry=sipCommonStatusCodeEntry, sipCommonServiceColdStart=sipCommonServiceColdStart, sipCommonStatusCodeNotifFrom=sipCommonStatusCodeNotifFrom, sipCommonCfgTimerEntry=sipCommonCfgTimerEntry, sipCommonCfgTimerH=sipCommonCfgTimerH, sipCommonOtherStats=sipCommonOtherStats, sipCommonPortEntry=sipCommonPortEntry, sipCommonStatsRetry=sipCommonStatsRetry, sipCommonStatusCodeNotif=sipCommonStatusCodeNotif, sipCommonMethodStatsOutbounds=sipCommonMethodStatsOutbounds, sipCommonTransCurrentTable=sipCommonTransCurrentTable, sipCommonSummaryStatsTable=sipCommonSummaryStatsTable, sipCommonStatusCodeThreshExceededInNotif=sipCommonStatusCodeThreshExceededInNotif, sipCommonPortTransportRcv=sipCommonPortTransportRcv, sipCommonSummaryStatsEntry=sipCommonSummaryStatsEntry, sipCommonStatusCodeMethod=sipCommonStatusCodeMethod, sipCommonOtherStatsDisconTime=sipCommonOtherStatsDisconTime, sipCommonSummaryStats=sipCommonSummaryStats, sipCommonOptionTagHeaderField=sipCommonOptionTagHeaderField, sipCommonCfgTimerT2=sipCommonCfgTimerT2, sipCommonOtherStatsEntry=sipCommonOtherStatsEntry, sipCommonSummaryTotalTransactions=sipCommonSummaryTotalTransactions, sipCommonCfgTimerC=sipCommonCfgTimerC, sipCommonCfgMaxTransactions=sipCommonCfgMaxTransactions, sipCommonStatusCodeOuts=sipCommonStatusCodeOuts, sipCommonMethodSupportedTable=sipCommonMethodSupportedTable, sipCommonCfgProtocolVersion=sipCommonCfgProtocolVersion, sipCommonStatusCodeIns=sipCommonStatusCodeIns, sipCommonServiceStatusChanged=sipCommonServiceStatusChanged, sipCommonCfgTimerF=sipCommonCfgTimerF, sipCommonCfgBase=sipCommonCfgBase, sipCommonSummaryInRequests=sipCommonSummaryInRequests, sipCommonOptionTagEntry=sipCommonOptionTagEntry, sipCommonStatsGroup=sipCommonStatsGroup, sipCommonStatsRetryFinalResponses=sipCommonStatsRetryFinalResponses, sipCommonTransCurrentactions=sipCommonTransCurrentactions, PYSNMP_MODULE_ID=sipCommonMIB, sipCommonOptionTag=sipCommonOptionTag, sipCommonStatusCodeTable=sipCommonStatusCodeTable, sipCommonMethodSupportedEntry=sipCommonMethodSupportedEntry, sipCommonSummaryOutRequests=sipCommonSummaryOutRequests, sipCommonCfgServiceNotifEnable=sipCommonCfgServiceNotifEnable, sipCommonStatsRetryEntry=sipCommonStatsRetryEntry, sipCommonMethodSupportedName=sipCommonMethodSupportedName, sipCommonStatusCodeNotifEntry=sipCommonStatusCodeNotifEntry, sipCommonStatusCodeNotifCallId=sipCommonStatusCodeNotifCallId, sipCommonCfgTimerE=sipCommonCfgTimerE, sipCommonMIBCompliances=sipCommonMIBCompliances, sipCommonMethodStatsName=sipCommonMethodStatsName) |
if 3 > 4 or 5 < 10: # true
pass
if 3 > 4 or 5 > 10: # false
pass
| if 3 > 4 or 5 < 10:
pass
if 3 > 4 or 5 > 10:
pass |
class Solution:
# Runtime: 36 ms
# Memory Usage: 16.3 MB
def maxDepth(self, root: TreeNode) -> int:
if root is None:
return 0
return self.search(root, 0)
def search(self, node, depth):
depth += 1
depth_left = depth
depth_right = depth
if node.left is not None:
depth_left = self.search(node.left, depth)
if node.right is not None:
depth_right = self.search(node.right, depth)
if depth_right < depth_left:
return depth_left
else:
return depth_right | class Solution:
def max_depth(self, root: TreeNode) -> int:
if root is None:
return 0
return self.search(root, 0)
def search(self, node, depth):
depth += 1
depth_left = depth
depth_right = depth
if node.left is not None:
depth_left = self.search(node.left, depth)
if node.right is not None:
depth_right = self.search(node.right, depth)
if depth_right < depth_left:
return depth_left
else:
return depth_right |
# Write a program that uses a for loop to print the numbers 8, 11, 14, 17, 20, ..., 83, 86, 89.
for i in range(8, 90, 3):
print(i)
| for i in range(8, 90, 3):
print(i) |
puzzle_input = "359282-820401"
pwd_interval = [int(a) for a in puzzle_input.split('-')]
pwd_range = range(pwd_interval[0] , pwd_interval[1]+1)
# Part 1
def is_valid_pwd(code):
str_code = str(code)
double = False
increase = True
for i in range(5):
if str_code[i] == str_code[i+1]:
double = True
elif str_code[i] > str_code[i+1]:
increase = False
break
return double and increase
valid_passwords_1 = []
for code in pwd_range:
if is_valid_pwd(code):
valid_passwords_1.append(code)
print(len(valid_passwords_1))
# Part 2
def is_only_two_adjacents_digits(code):
str_code = str(code)
adjacent = 1
for i in range(5):
if str_code[i] == str_code[i+1]:
adjacent += 1
elif adjacent == 2:
return True
else:
adjacent = 1
return adjacent == 2
valid_passwords_2 = []
for code in valid_passwords_1:
if is_only_two_adjacents_digits(code):
valid_passwords_2.append(code)
print(len(valid_passwords_2))
| puzzle_input = '359282-820401'
pwd_interval = [int(a) for a in puzzle_input.split('-')]
pwd_range = range(pwd_interval[0], pwd_interval[1] + 1)
def is_valid_pwd(code):
str_code = str(code)
double = False
increase = True
for i in range(5):
if str_code[i] == str_code[i + 1]:
double = True
elif str_code[i] > str_code[i + 1]:
increase = False
break
return double and increase
valid_passwords_1 = []
for code in pwd_range:
if is_valid_pwd(code):
valid_passwords_1.append(code)
print(len(valid_passwords_1))
def is_only_two_adjacents_digits(code):
str_code = str(code)
adjacent = 1
for i in range(5):
if str_code[i] == str_code[i + 1]:
adjacent += 1
elif adjacent == 2:
return True
else:
adjacent = 1
return adjacent == 2
valid_passwords_2 = []
for code in valid_passwords_1:
if is_only_two_adjacents_digits(code):
valid_passwords_2.append(code)
print(len(valid_passwords_2)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.