def load_mib(filenames):
    """Load the conf.mib dict from a list of filenames"""
    the_mib = {'iso': ['1']}
    unresolved = {}
    for k in six.iterkeys(conf.mib):
        _mib_register(conf.mib[k], k.split("."), the_mib, unresolved)

    if isinstance(filenames, (str, bytes)):
        filenames = [filenames]
    for fnames in filenames:
        for fname in glob(fnames):
            f = open(fname)
            text = f.read()
            cleantext = " ".join(_mib_re_strings.split(" ".join(_mib_re_comments.split(text))))  # noqa: E501
            for m in _mib_re_oiddecl.finditer(cleantext):
                gr = m.groups()
                ident, oid = gr[0], gr[-1]
                ident = fixname(ident)
                oid = oid.split()
                for i, elt in enumerate(oid):
                    m = _mib_re_both.match(elt)
                    if m:
                        oid[i] = m.groups()[1]
                _mib_register(ident, oid, the_mib, unresolved)

    newmib = MIBDict(_name="MIB")
    for oid, key in six.iteritems(the_mib):
        newmib[".".join(key)] = oid
    for oid, key in six.iteritems(unresolved):
        newmib[".".join(key)] = oid

    conf.mib = newmib
def load_mib ( filenames ) : the_mib = { 'iso' : [ '1' ] } unresolved = { } for k in six . iterkeys ( conf . mib ) : _mib_register ( conf . mib [ k ] , k . split ( "." ) , the_mib , unresolved ) if isinstance ( filenames , ( str , bytes ) ) : filenames = [ filenames ] for fnames in filenames : for fname in glob ( fnames ) : f = open ( fname ) text = f . read ( ) cleantext = " " . join ( _mib_re_strings . split ( " " . join ( _mib_re_comments . split ( text ) ) ) ) for m in _mib_re_oiddecl . finditer ( cleantext ) : gr = m . groups ( ) ident , oid = gr [ 0 ] , gr [ - 1 ] ident = fixname ( ident ) oid = oid . split ( ) for i , elt in enumerate ( oid ) : m = _mib_re_both . match ( elt ) if m : oid [ i ] = m . groups ( ) [ 1 ] _mib_register ( ident , oid , the_mib , unresolved ) newmib = MIBDict ( _name = "MIB" ) for oid , key in six . iteritems ( the_mib ) : newmib [ "." . join ( key ) ] = oid for oid , key in six . iteritems ( unresolved ) : newmib [ "." . join ( key ) ] = oid conf . mib = newmib
Load the conf.mib dict from a list of filenames