<commit_before># Shortcuts to MIB instrumentation items used internally in SNMP applications
import string
from pysnmp.smi.error import NoSuchObjectError
from pysnmp.entity import config

def getVersionSpecifics(snmpVersion): pass

def getTargetAddr(snmpEngine, snmpTargetAddrName):
    mibInstrumController = snmpEngine.msgAndPduDsp.mibInstrumController
    # Transport endpoint
    snmpTargetAddrEntry, = mibInstrumController.mibBuilder.importSymbols(
        'SNMP-TARGET-MIB', 'snmpTargetAddrEntry'
        )
    tblIdx = snmpTargetAddrEntry.getInstIdFromIndices(
        snmpTargetAddrName
        )

    ((v, snmpTargetAddrTDomain),
     (v, snmpTargetAddrTAddress),
     (v, snmpTargetAddrTimeout),
     (v, snmpTargetAddrRetryCount),
     (v, snmpTargetAddrParams)) = mibInstrumController.readVars(
        ((snmpTargetAddrEntry.name + (2,) + tblIdx, None),
         (snmpTargetAddrEntry.name + (3,) + tblIdx, None),
         (snmpTargetAddrEntry.name + (4,) + tblIdx, None),
         (snmpTargetAddrEntry.name + (5,) + tblIdx, None),
         (snmpTargetAddrEntry.name + (7,) + tblIdx, None))       
        )

    if snmpTargetAddrTDomain == config.snmpUDPDomain:
        SnmpUDPAddress, = snmpEngine.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols('SNMPv2-TM', 'SnmpUDPAddress')
        snmpTargetAddrTAddress = tuple(
            SnmpUDPAddress(snmpTargetAddrTAddress)
            )

    return ( snmpTargetAddrTDomain,
             snmpTargetAddrTAddress,
             snmpTargetAddrTimeout,
             snmpTargetAddrRetryCount,
             snmpTargetAddrParams )

def getTargetInfo(snmpEngine, snmpTargetAddrName):
    # Transport endpoint
    ( snmpTargetAddrTDomain,
      snmpTargetAddrTAddress,
      snmpTargetAddrTimeout,
      snmpTargetAddrRetryCount,
      snmpTargetAddrParams ) = getTargetAddr(snmpEngine, snmpTargetAddrName)

    mibInstrumController = snmpEngine.msgAndPduDsp.mibInstrumController

    # Target params
    snmpTargetParamsEntry, = mibInstrumController.mibBuilder.importSymbols(
        'SNMP-TARGET-MIB', 'snmpTargetParamsEntry'
        )
    tblIdx = snmpTargetParamsEntry.getInstIdFromIndices(
        snmpTargetAddrParams
        )
    ((v, snmpTargetParamsMPModel),
     (v, snmpTargetParamsSecurityModel),
     (v, snmpTargetParamsSecurityName),
     (v, snmpTargetParamsSecurityLevel)) = mibInstrumController.readVars(
        ((snmpTargetParamsEntry.name + (2,) + tblIdx, None),
         (snmpTargetParamsEntry.name + (3,) + tblIdx, None),
         (snmpTargetParamsEntry.name + (4,) + tblIdx, None),
         (snmpTargetParamsEntry.name + (5,) + tblIdx, None))
        )
    
    return ( snmpTargetAddrTDomain,
             snmpTargetAddrTAddress,
             snmpTargetAddrTimeout,
             snmpTargetAddrRetryCount,
             snmpTargetParamsMPModel,
             snmpTargetParamsSecurityModel,
             snmpTargetParamsSecurityName,
             snmpTargetParamsSecurityLevel )

def getTargetParams(snmpEngine, paramsName):
    mibInstrumController = snmpEngine.msgAndPduDsp.mibInstrumController    
    snmpTargetParamsEntry, = mibInstrumController.mibBuilder.importSymbols(
        'SNMP-TARGET-MIB', 'snmpTargetParamsEntry'
        )
    tblIdx = snmpTargetParamsEntry.getInstIdFromIndices(
        paramsName
        )
    ((v, snmpTargetParamsMPModel),
     (v, snmpTargetParamsSecurityModel),
     (v, snmpTargetParamsSecurityName),
     (v, snmpTargetParamsSecurityLevel)) = mibInstrumController.readVars(
        ((snmpTargetParamsEntry.name + (2,) + tblIdx, None),
         (snmpTargetParamsEntry.name + (3,) + tblIdx, None),
         (snmpTargetParamsEntry.name + (4,) + tblIdx, None),
         (snmpTargetParamsEntry.name + (5,) + tblIdx, None))
        )

    return ( snmpTargetParamsMPModel,
             snmpTargetParamsSecurityModel,
             snmpTargetParamsSecurityName,
             snmpTargetParamsSecurityLevel )

def getNotificationInfo(snmpEngine, notificationTarget):
    mibInstrumController = snmpEngine.msgAndPduDsp.mibInstrumController
    # Transport endpoint
    snmpNotifyEntry, = mibInstrumController.mibBuilder.importSymbols(
        'SNMP-NOTIFICATION-MIB', 'snmpNotifyEntry'
        )
    tblIdx = snmpNotifyEntry.getInstIdFromIndices(
        notificationTarget
        )
    ((v, snmpNotifyTag),
     (v, snmpNotifyType)) = mibInstrumController.readVars(
        ((snmpNotifyEntry.name + (2,) + tblIdx, None),
         (snmpNotifyEntry.name + (3,) + tblIdx, None))
        )

    return snmpNotifyTag, snmpNotifyType

def getTargetNames(snmpEngine, tag):
    mibInstrumController = snmpEngine.msgAndPduDsp.mibInstrumController
    # Transport endpoint
    ( snmpTargetAddrEntry,
      snmpTargetAddrTagList ) = mibInstrumController.mibBuilder.importSymbols(
        'SNMP-TARGET-MIB', 'snmpTargetAddrEntry', 'snmpTargetAddrTagList'
        )
    targetNames = []
    nextName =  snmpTargetAddrTagList.name
    while 1:
        try:<commit_msg>catch access to non-configured entries and raise an exception<commit_after># Shortcuts to MIB instrumentation items used internally in SNMP applications
import string
from pysnmp.smi.error import SmiError, NoSuchObjectError
from pysnmp.smi.exval import noSuchInstance
from pysnmp.entity import config

def getVersionSpecifics(snmpVersion): pass

def getTargetAddr(snmpEngine, snmpTargetAddrName):
    mibInstrumController = snmpEngine.msgAndPduDsp.mibInstrumController
    # Transport endpoint
    snmpTargetAddrEntry, = mibInstrumController.mibBuilder.importSymbols(
        'SNMP-TARGET-MIB', 'snmpTargetAddrEntry'
        )
    tblIdx = snmpTargetAddrEntry.getInstIdFromIndices(
        snmpTargetAddrName
        )

    ((v, snmpTargetAddrTDomain),
     (v, snmpTargetAddrTAddress),
     (v, snmpTargetAddrTimeout),
     (v, snmpTargetAddrRetryCount),
     (v, snmpTargetAddrParams)) = mibInstrumController.readVars(
        ((snmpTargetAddrEntry.name + (2,) + tblIdx, None),
         (snmpTargetAddrEntry.name + (3,) + tblIdx, None),
         (snmpTargetAddrEntry.name + (4,) + tblIdx, None),
         (snmpTargetAddrEntry.name + (5,) + tblIdx, None),
         (snmpTargetAddrEntry.name + (7,) + tblIdx, None))       
        )

    if noSuchInstance.isSameTypeWith(snmpTargetAddrParams):
        raise SmiError('Target %s not configured at SMI' % snmpTargetAddrName)

    if snmpTargetAddrTDomain == config.snmpUDPDomain:
        SnmpUDPAddress, = snmpEngine.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols('SNMPv2-TM', 'SnmpUDPAddress')
        snmpTargetAddrTAddress = tuple(
            SnmpUDPAddress(snmpTargetAddrTAddress)
            )

    return ( snmpTargetAddrTDomain,
             snmpTargetAddrTAddress,
             snmpTargetAddrTimeout,
             snmpTargetAddrRetryCount,
             snmpTargetAddrParams )

def getTargetInfo(snmpEngine, snmpTargetAddrName):
    # Transport endpoint
    ( snmpTargetAddrTDomain,
      snmpTargetAddrTAddress,
      snmpTargetAddrTimeout,
      snmpTargetAddrRetryCount,
      snmpTargetAddrParams ) = getTargetAddr(snmpEngine, snmpTargetAddrName)

    mibInstrumController = snmpEngine.msgAndPduDsp.mibInstrumController

    # Target params
    snmpTargetParamsEntry, = mibInstrumController.mibBuilder.importSymbols(
        'SNMP-TARGET-MIB', 'snmpTargetParamsEntry'
        )

    tblIdx = snmpTargetParamsEntry.getInstIdFromIndices(
        snmpTargetAddrParams
        )
    ((v, snmpTargetParamsMPModel),
     (v, snmpTargetParamsSecurityModel),
     (v, snmpTargetParamsSecurityName),
     (v, snmpTargetParamsSecurityLevel)) = mibInstrumController.readVars(
        ((snmpTargetParamsEntry.name + (2,) + tblIdx, None),
         (snmpTargetParamsEntry.name + (3,) + tblIdx, None),
         (snmpTargetParamsEntry.name + (4,) + tblIdx, None),
         (snmpTargetParamsEntry.name + (5,) + tblIdx, None))
        )
    
    if noSuchInstance.isSameTypeWith(snmpTargetParamsSecurityName):
        raise SmiError('Parameters %s not configured at SMI' % snmpTargetAddrParams)

    return ( snmpTargetAddrTDomain,
             snmpTargetAddrTAddress,
             snmpTargetAddrTimeout,
             snmpTargetAddrRetryCount,
             snmpTargetParamsMPModel,
             snmpTargetParamsSecurityModel,
             snmpTargetParamsSecurityName,
             snmpTargetParamsSecurityLevel )

def getTargetParams(snmpEngine, paramsName):
    mibInstrumController = snmpEngine.msgAndPduDsp.mibInstrumController    
    snmpTargetParamsEntry, = mibInstrumController.mibBuilder.importSymbols(
        'SNMP-TARGET-MIB', 'snmpTargetParamsEntry'
        )
    tblIdx = snmpTargetParamsEntry.getInstIdFromIndices(
        paramsName
        )
    ((v, snmpTargetParamsMPModel),
     (v, snmpTargetParamsSecurityModel),
     (v, snmpTargetParamsSecurityName),
     (v, snmpTargetParamsSecurityLevel)) = mibInstrumController.readVars(
        ((snmpTargetParamsEntry.name + (2,) + tblIdx, None),
         (snmpTargetParamsEntry.name + (3,) + tblIdx, None),
         (snmpTargetParamsEntry.name + (4,) + tblIdx, None),
         (snmpTargetParamsEntry.name + (5,) + tblIdx, None))
        )

    if noSuchInstance.isSameTypeWith(snmpTargetParamsMPModel):
        raise SmiError('Parameters %s not configured at SMI' % paramsName)

    return ( snmpTargetParamsMPModel,
             snmpTargetParamsSecurityModel,
             snmpTargetParamsSecurityName,
             snmpTargetParamsSecurityLevel )

def getNotificationInfo(snmpEngine, notificationTarget):
    mibInstrumController = snmpEngine.msgAndPduDsp.mibInstrumController
    # Transport endpoint
    snmpNotifyEntry, = mibInstrumController.mibBuilder.importSymbols(
        'SNMP-NOTIFICATION-MIB', 'snmpNotifyEntry'
        )
    tblIdx = snmpNotifyEntry.getInstIdFromIndices(
        notificationTarget
        )
    ((v, snmpNotifyTag),
     (v, snmpNotifyType)) = mibInstrumController.readVars(
        ((snmpNotifyEntry.name + (2,) + tblIdx, None),
         (snmpNotifyEntry.name + (3,) + tblIdx, None))
        )

    if noSuchInstance.isSameTypeWith(snmpNotifyTag):
        raise SmiError('Target %s not configured at SMI' % notificationTarget)

    return snmpNotifyTag, snmpNotifyType

def getTargetNames(snmpEngine, tag):
    mibInstrumController = snmpEngine.msgAndPduDsp.mibInstrumController
    # Transport endpoint
    ( snmpTargetAddrEntry,
      snmpTargetAddrTagList ) = mibInstrumController.mibBuilder.importSymbols(
        'SNMP-TARGET-MIB', 'snmpTargetAddrEntry', 'snmpTargetAddrTagList'
        )
    targetNames = []
    nextName =  snmpTargetAddrTagList.name
    while 1:
        try:
{'fraction_non_alphanumeric': 0.08547976224172092, 'fraction_numerical': 0.0032078497971506745, 'mean_word_length': 3.3549712407559573, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5914402', 'n_tokens_mistral': 3332, 'n_tokens_neox': 3230, 'n_words': 516}