• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python debug.logger函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pysmi.debug.logger函数的典型用法代码示例。如果您正苦于以下问题:Python logger函数的具体用法?Python logger怎么用?Python logger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了logger函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: fileExists

    def fileExists(self, mibname, mtime, rebuild=False):
        if rebuild:
            debug.logger & debug.flagSearcher and debug.logger('pretend %s is very old' % mibname)
            return

        mibname = decode(mibname)
        basename = os.path.join(self._path, mibname)

        for sfx in self.exts:
            f = basename + sfx
            if not os.path.exists(f) or not os.path.isfile(f):
                debug.logger & debug.flagSearcher and debug.logger('%s not present or not a file' % f)
                continue

            try:
                fileTime = os.stat(f)[8]

            except OSError:
                raise error.PySmiSearcherError('failure opening compiled file %s: %s' % (f, sys.exc_info()[1]),
                                               searcher=self)

            debug.logger & debug.flagSearcher and debug.logger(
                'found %s, mtime %s' % (f, time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime(fileTime))))

            if fileTime >= mtime:
                raise error.PySmiFileNotModifiedError()

        raise error.PySmiFileNotFoundError('no compiled file %s found' % mibname, searcher=self)
开发者ID:etingof,项目名称:pysmi,代码行数:28,代码来源:anyfile.py


示例2: getData

    def getData(self, mibname, **options):
        debug.logger & debug.flagReader and debug.logger('looking for MIB %s at %s' % (mibname, self._name))

        if self._pendingError:
            raise self._pendingError

        if not self._members:
            raise error.PySmiReaderFileNotFoundError('source MIB %s not found' % mibname, reader=self)

        for mibalias, mibfile in self.getMibVariants(mibname, **options):

            debug.logger & debug.flagReader and debug.logger('trying MIB %s' % mibfile)

            try:
                refs = self._members[mibfile]

            except KeyError:
                continue

            mibData, mtime = self._readZipFile(refs)

            if not mibData:
                continue

            debug.logger & debug.flagReader and debug.logger(
                'source MIB %s, mtime %s, read from %s/%s' % (mibfile, time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime(mtime)), self._name, mibfile)
            )

            if len(mibData) == self.maxMibSize:
                raise IOError('MIB %s/%s too large' % (self._name, mibfile))

            return MibInfo(path='zip://%s/%s' % (self._name, mibfile),
                           file=mibfile, name=mibalias, mtime=mtime), decode(mibData)

        raise error.PySmiReaderFileNotFoundError('source MIB %s not found' % mibname, reader=self)
开发者ID:etingof,项目名称:pysmi,代码行数:35,代码来源:zipreader.py


示例3: getData

    def getData(self, mibname):
        debug.logger & debug.flagReader and debug.logger(
            '%slooking for MIB %s' % (self._recursive and 'recursively ' or '', mibname))
        for path in self.getSubdirs(self._path, self._recursive,
                                    self._ignoreErrors):
            for mibalias, mibfile in self.getMibVariants(mibname):
                f = os.path.join(decode(path), decode(mibfile))
                debug.logger & debug.flagReader and debug.logger('trying MIB %s' % f)
                if os.path.exists(f) and os.path.isfile(f):
                    try:
                        mtime = os.stat(f)[8]
                        debug.logger & debug.flagReader and debug.logger(
                            'source MIB %s mtime is %s, fetching data...' % (
                                f, time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime(mtime))))
                        return MibInfo(path='file://%s' % f, file=mibfile, name=mibalias, mtime=mtime), decode(
                            open(f, mode='rb').read(self.maxMibSize))
                    except (OSError, IOError):
                        debug.logger & debug.flagReader and debug.logger(
                            'source file %s open failure: %s' % (f, sys.exc_info()[1]))
                        if not self._ignoreErrors:
                            raise error.PySmiError('file %s access error: %s' % (f, sys.exc_info()[1]))

                    raise error.PySmiReaderFileNotModifiedError('source MIB %s is older than needed' % f, reader=self)

        raise error.PySmiReaderFileNotFoundError('source MIB %s not found' % mibname, reader=self)
开发者ID:zware,项目名称:pysmi,代码行数:25,代码来源:localfile.py


示例4: getData

    def getData(self, mibname, **kwargs):
        if bool(kwargs.get('genTexts')) != self.genTexts:
            debug.logger & debug.flagBorrower and debug.logger('skipping incompatible borrower %s for file %s' % (self, mibname))
            raise error.PySmiFileNotFoundError(mibname=mibname, reader=self._reader)

        debug.logger & debug.flagBorrower and debug.logger('trying to borrow file %s from %s' % (mibname, self._reader))
        return self._reader.getData(mibname)
开发者ID:imron,项目名称:scalyr-agent-2,代码行数:7,代码来源:base.py


示例5: putData

    def putData(self, mibname, data, comments=[], dryRun=False):
        if dryRun:
            debug.logger & debug.flagWriter and debug.logger('dry run mode')
            return

        try:
            self._cbFun(mibname, data, self._cbCtx)
        except Exception:
            raise error.PySmiWriterError('user callback %s failure writing %s: %s' % (self._cbFun, mibname, sys.exc_info()[1]), writer=self)

        debug.logger & debug.flagWriter and debug.logger('user callback for %s succeeded' % mibname)
开发者ID:bnavarma,项目名称:netsnmp,代码行数:11,代码来源:callback.py


示例6: putData

    def putData(self, mibname, data, comments=(), dryRun=False):
        if dryRun:
            debug.logger & debug.flagWriter and debug.logger('dry run mode')
            return
        if not os.path.exists(self._path):
            try:
                os.makedirs(self._path)
            except OSError:
                raise error.PySmiWriterError(
                    'failure creating destination directory %s: %s' % (self._path, sys.exc_info()[1]), writer=self)

        if comments:
            data = '#\n' + ''.join(['# %s\n' % x for x in comments]) + '#\n' + data

        pyfile = os.path.join(self._path, decode(mibname)) + self.suffixes[imp.PY_SOURCE][0][0]

        tfile = None

        try:
            fd, tfile = tempfile.mkstemp(dir=self._path)
            os.write(fd, encode(data))
            os.close(fd)
            os.rename(tfile, pyfile)
        except (OSError, IOError, UnicodeEncodeError):
            exc = sys.exc_info()
            if tfile:
                try:
                    os.unlink(tfile)
                except OSError:
                    pass
            raise error.PySmiWriterError('failure writing file %s: %s' % (pyfile, exc[1]), file=pyfile, writer=self)

        debug.logger & debug.flagWriter and debug.logger('created file %s' % pyfile)

        if self.pyCompile:
            try:
                if sys.version_info[0:2] > (3, 1):
                    # noinspection PyArgumentList
                    py_compile.compile(pyfile, doraise=True, optimize=self.pyOptimizationLevel)
                else:
                    py_compile.compile(pyfile, doraise=True)
            except (SyntaxError, py_compile.PyCompileError):
                pass  # XXX
            except:
                try:
                    os.unlink(pyfile)
                except Exception:
                    pass
                raise error.PySmiWriterError('failure compiling %s: %s' % (pyfile, sys.exc_info()[1]), file=mibname,
                                             writer=self)

        debug.logger & debug.flagWriter and debug.logger('%s stored' % mibname)
开发者ID:zware,项目名称:pysmi,代码行数:52,代码来源:pyfile.py


示例7: fileWrite

    def fileWrite(self, fileName, data, comments=[], dryRun=False):
        fileName = fileName.replace('-','_')
        if dryRun:
            debug.logger & debug.flagWriter and debug.logger('dry run mode')
            return
        if not os.path.exists(self._path):
            try:
                os.makedirs(self._path)
            except OSError:
                raise error.PySmiWriterError('failure creating destination directory %s: %s' % (self._path, sys.exc_info()[1]), writer=self)
        if comments:
            data = '//\n' + ''.join(['//%s\n'% x for x in comments]) + '//\n' + data
        fileName = os.path.join(self._path,decode(fileName))

        try:
            fd, tfile = tempfile.mkstemp(dir = self._path)
            os.write(fd, encode(data))
            os.close(fd)
            if(os.path.isfile(fileName)):
                os.remove(fileName)
            os.rename(tfile, fileName)
        except (OSError, IOError, UnicodeEncodeError):
            exc = sys.exc_info()
            try:
                os.unlink(tfile)
            except OSError:
                pass
            raise error.PySmiWriterError('failure writing file %s: %s' % (fileName, exc[1]),file=fileName,write=self)
开发者ID:bnavarma,项目名称:netsnmp,代码行数:28,代码来源:cfile.py


示例8: buildIndex

 def buildIndex(self, processedMibs, **options):
     comments = [
         'Produced by %s-%s at %s' % (packageName, packageVersion, time.asctime()),
         'On host %s platform %s version %s by user %s' % (hasattr(os, 'uname') and os.uname()[1] or '?', hasattr(os, 'uname') and os.uname()[0] or '?', hasattr(os, 'uname') and os.uname()[2] or '?', hasattr(os, 'getuid') and getpwuid(os.getuid())[0]) or '?',
         'Using Python version %s' % sys.version.split('\n')[0]
     ]
     try:
         self._writer.putData(
             self.indexFile,
             self._codegen.genIndex(
                 dict([(x, x.oid) for x in processedMibs if hasattr(x, 'oid')]),
                 comments=comments
             ),
             dryRun=options.get('dryRun')
         )
     except error.PySmiError:
         exc_class, exc, tb = sys.exc_info()
         exc.msg += ' at MIB index %s' % self.indexFile
         debug.logger & debug.flagCompiler and debug.logger('error %s when building %s' % (exc, self.indexFile))
         if options.get('ignoreErrors'):
             return
         if hasattr(exc, 'with_traceback'):
             raise exc.with_traceback(tb)
         else:
             raise exc
开发者ID:imron,项目名称:scalyr-agent-2,代码行数:25,代码来源:compiler.py


示例9: genCode

    def genCode(self, ast, symbolTable, **kwargs):
        mibInfo, context = IntermediateCodeGen.genCode(self, ast, symbolTable, **kwargs)

        # TODO: reduce code duplication with the other codegens

        searchPath = os.path.join(os.path.dirname(__file__), 'templates')

        dstTemplate = kwargs.get('dstTemplate')
        if dstTemplate:
            searchPath.insert(0, os.path.dirname(os.path.abspath(dstTemplate)))

        env = jinja2.Environment(loader=jinja2.FileSystemLoader(searchPath),
                                 trim_blocks=True, lstrip_blocks=True)

        env.filters['capfirst'] = jfilters.capfirst

        try:
            tmpl = env.get_template(dstTemplate or self.TEMPLATE_NAME)
            text = tmpl.render(mib=context)

        except jinja2.exceptions.TemplateError:
            err = sys.exc_info()[1]
            raise error.PySmiCodegenError('Jinja template rendering error: %s' % err)

        debug.logger & debug.flagCodegen and debug.logger(
            'canonical MIB name %s (%s), imported MIB(s) %s, rendered from '
            '%s, JSON document size %d bytes' % (
                mibInfo.name, mibInfo.identity,
                ','.join(mibInfo.imported) or '<none>',
                dstTemplate, len(text)))

        return mibInfo, text
开发者ID:etingof,项目名称:pysmi,代码行数:32,代码来源:jsondoc.py


示例10: buildIndex

    def buildIndex(self, processedMibs, **options):
        platform_info, user_info = self._get_system_info()

        comments = [
            'Produced by %s-%s at %s' % (packageName, packageVersion, time.asctime()),
            'On host %s platform %s version %s by user %s' % (platform_info[1], platform_info[0],
                                                              platform_info[2], user_info[0]),
            'Using Python version %s' % sys.version.split('\n')[0]
        ]

        try:
            self._writer.putData(
                self.indexFile,
                self._codegen.genIndex(
                    processedMibs,
                    comments=comments,
                    old_index_data=self._writer.getData(self.indexFile)
                ),
                dryRun=options.get('dryRun')
            )
        except error.PySmiError:
            exc_class, exc, tb = sys.exc_info()
            exc.msg += ' at MIB index %s' % self.indexFile

            debug.logger & debug.flagCompiler and debug.logger('error %s when building %s' % (exc, self.indexFile))

            if options.get('ignoreErrors'):
                return

            if hasattr(exc, 'with_traceback'):
                raise exc.with_traceback(tb)
            else:
                raise exc
开发者ID:etingof,项目名称:pysmi,代码行数:33,代码来源:compiler.py


示例11: genCode

 def genCode(self, ast, symbolTable, **kwargs):
     self.genRules["text"] = kwargs.get("genTexts", False)
     self._rows.clear()
     self._cols.clear()
     self._parentOids.clear()
     self._symsOrder = []
     self._postponedSyms.clear()
     self._importMap.clear()
     self._out = {}  # should be new object, do not use `clear` method
     self.moduleName[0], moduleOid, imports, declarations = ast
     out, importedModules = self.genImports(imports and imports or {})
     for declr in declarations and declarations or []:
         if declr:
             clausetype = declr[0]
             classmode = clausetype == "typeDeclaration"
             self.handlersTable[declr[0]](self, self.prepData(declr[1:], classmode), classmode)
     if self._postponedSyms:
         raise error.PySmiSemanticError("Unknown parents for symbols: %s" % ", ".join(self._postponedSyms))
     for sym in self._parentOids:
         if sym not in self._out and sym not in self._importMap:
             raise error.PySmiSemanticError("Unknown parent symbol: %s" % sym)
     self._out["_symtable_order"] = list(self._symsOrder)
     self._out["_symtable_cols"] = list(self._cols)
     self._out["_symtable_rows"] = list(self._rows)
     debug.logger & debug.flagCodegen and debug.logger(
         "canonical MIB name %s (%s), imported MIB(s) %s, Symbol table size %s symbols"
         % (self.moduleName[0], moduleOid, ",".join(importedModules) or "<none>", len(self._out))
     )
     return MibInfo(oid=None, name=self.moduleName[0], imported=tuple([x for x in importedModules])), self._out
开发者ID:bnavarma,项目名称:netsnmp,代码行数:29,代码来源:symtable.py


示例12: genCode

 def genCode(self, ast, symbolTable, **kwargs):
     self.genRules['text'] = kwargs.get('genTexts', False)
     self.symbolTable = symbolTable
     out = ''
     importedModules = ()
     self._rows.clear()
     self._cols.clear()
     self._exports.clear()
     self._presentedSyms.clear()
     self._importMap.clear()
     self._out.clear()
     self.moduleName[0], moduleOid,imports, declarations = ast
     out, importModules = self.genImports(imports and imports or {})
     for declr in declarations and declarations or []:
         if declr:
             clausetype = declr[0]
             classmode = clausetype == 'typeDeclaration'
             self.handlersTable[declr[0]](self,self.prepData(declr[1:],classmode),classmode)
     for sym in self.symbolTable[self.moduleName[0]]['_symtable_order']:
         if sym not in self._out:
             raise error.PySmiCodegenError('No generated code for symbol %s' % sym)
         out += self._out[sym]
     out += self.genExports()
     if 'comments' in kwargs:
         out = ''.join(['# %s\n' % x for x in kwargs['comments']]) + '#\n' + out
         out = '#\n# NetSnmp MIB module' + out
     debug.logger & debug.flagCodegen and debug.logger('canonical MIB name %s (%s), imported MIB(s) %s, C code size %s bytes' % (self.moduleName[0],moduleOid, ','.join(importedModules) or '<none>', len(out)))
     return MibInfo(oid=None, NameError=self.moduleName[0], importedModules=tuple([x for x in importedModules if x not in fakedMibs])), out
开发者ID:bnavarma,项目名称:netsnmp,代码行数:28,代码来源:netsnmp.py


示例13: getData

    def getData(self, mibname, **options):
        debug.logger & debug.flagReader and debug.logger('calling user callback %s for MIB %s' % (self._cbFun, mibname))

        res = self._cbFun(mibname, self._cbCtx)
        if res:
            return MibInfo(path='file:///dev/stdin', file='', name=mibname, mtime=time.time()), res

        raise error.PySmiReaderFileNotFoundError(mibname=mibname, reader=self)
开发者ID:etingof,项目名称:pysmi,代码行数:8,代码来源:callback.py


示例14: fileExists

    def fileExists(self, mibname, mtime, rebuild=False):
        if mibname in self._mibnames:
            debug.logger & debug.flagSearcher and debug.logger('pretend compiled %s exists and is very new' % mibname)
            raise error.PySmiFileNotModifiedError('compiled file %s is among %s' % (mibname, ', '.join(self._mibnames)),
                                                  searcher=self)

        raise error.PySmiFileNotFoundError('no compiled file %s found among %s' % (mibname, ', '.join(self._mibnames)),
                                           searcher=self)
开发者ID:zware,项目名称:pysmi,代码行数:8,代码来源:stub.py


示例15: parse

 def parse(self, data, **kwargs):
     debug.logger & debug.flagParser and debug.logger('source MIB size is %s characters, first 50 characters are "%s..."' % (len(data), data[:50]))
     ast = self.parser.parse(data, lexer=self.lexer.lexer)
     self.reset()
     if ast and ast[0] == 'mibFile' and ast[1]:   # mibfile is not empty
         return ast[1]
     else:
         return []
开发者ID:437049211,项目名称:PyQYT,代码行数:8,代码来源:smi.py


示例16: getData

    def getData(self, mibname):
        if self._ssl:
            conn = ftplib.FTP_TLS()
        else:
            conn = ftplib.FTP()

        try:
            conn.connect(self._host, self._port, self._timeout)
        except ftplib.all_errors:
            raise error.PySmiReaderFileNotFoundError(
                'failed to connect to FTP server %s:%s: %s' % (self._host, self._port, sys.exc_info()[1]), reader=self)

        try:
            conn.login(self._user, self._password)
        except ftplib.all_errors:
            conn.close()
            raise error.PySmiReaderFileNotFoundError('failed to log in to FTP server %s:%s as %s/%s: %s' % (
            self._host, self._port, self._user, self._password, sys.exc_info()[1]), reader=self)

        mibname = decode(mibname)

        debug.logger & debug.flagReader and debug.logger('looking for MIB %s' % mibname)

        for mibalias, mibfile in self.getMibVariants(mibname):
            location = self._locationTemplate.replace('@[email protected]', mibfile)
            mtime = time.time()
            debug.logger & debug.flagReader and debug.logger(
                'trying to fetch MIB %s from %s:%s' % (location, self._host, self._port))
            data = []
            try:
                try:
                    response = conn.sendcmd('MDTM %s' % location)
                except ftplib.all_errors:
                    debug.logger & debug.flagReader and debug.logger(
                        'server %s:%s does not support MDTM command, fetching file %s' % (
                        self._host, self._port, location))
                else:
                    debug.logger & debug.flagReader and debug.logger(
                        'server %s:%s MDTM response is %s' % (self._host, self._port, response))
                    if response[:3] == 213:
                        mtime = time.mktime(time.strptime(response[4:], "%Y%m%d%H%M%S"))
                debug.logger & debug.flagReader and debug.logger('fetching source MIB %s, mtime %s' % (
                location, time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime(mtime))))
                conn.retrlines('RETR %s' % location, lambda x, y=data: y.append(x))
            except ftplib.all_errors:
                debug.logger & debug.flagReader and debug.logger(
                    'failed to fetch MIB %s from %s:%s: %s' % (location, self._host, self._port, sys.exc_info()[1]))
                continue

            data = decode('\n'.join(data))

            debug.logger & debug.flagReader and debug.logger('fetched %s bytes in %s' % (len(data), location))

            conn.close()
            return MibInfo(path='ftp://%s%s' % (self._host, location), file=mibfile, name=mibalias, mtime=mtime), data

        conn.close()

        raise error.PySmiReaderFileNotFoundError('source MIB %s not found' % mibname, reader=self)
开发者ID:zware,项目名称:pysmi,代码行数:59,代码来源:ftpclient.py


示例17: fileExists

    def fileExists(self, mibname, mtime, rebuild=False):
        if rebuild:
            debug.logger & debug.flagSearcher and debug.logger('pretend %s is very old' % mibname)
            return
        mibname = decode(mibname)
        pyfile = os.path.join(self._path, mibname)
        for fmt in imp.PY_COMPILED, imp.PY_SOURCE:
            for pySfx, pyMode in self.suffixes[fmt]:
                f = pyfile + pySfx
                if not os.path.exists(f) or not os.path.isfile(f):
                    debug.logger & debug.flagSearcher and debug.logger('%s not present or not a file' % f)
                    continue
                if fmt == imp.PY_COMPILED:
                    try:
                        pyData = open(f, pyMode).read(8)
                    except IOError:
                        raise error.PySmiSearcherError('failure opening compiled file %s: %s' % (f, sys.exc_info()[1]),
                                                       searcher=self)
                    if pyData[:4] == imp.get_magic():
                        pyData = pyData[4:]
                        pyTime = struct.unpack('<L', pyData[:4])[0]
                        debug.logger & debug.flagSearcher and debug.logger(
                            'found %s, mtime %s' % (f, time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime(pyTime))))
                        if pyTime >= mtime:
                            raise error.PySmiFileNotModifiedError()
                        else:
                            raise error.PySmiFileNotFoundError('older file %s exists' % mibname, searcher=self)
                    else:
                        debug.logger & debug.flagSearcher and debug.logger('bad magic in %s' % f)
                        continue
                else:
                    try:
                        pyTime = os.stat(f)[8]
                    except OSError:
                        raise error.PySmiSearcherError('failure opening compiled file %s: %s' % (f, sys.exc_info()[1]),
                                                       searcher=self)

                    debug.logger & debug.flagSearcher and debug.logger(
                        'found %s, mtime %s' % (f, time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime(pyTime))))
                    if pyTime >= mtime:
                        raise error.PySmiFileNotModifiedError()

        raise error.PySmiFileNotFoundError('no compiled file %s found' % mibname, searcher=self)
开发者ID:zware,项目名称:pysmi,代码行数:43,代码来源:pyfile.py


示例18: fileExists

    def fileExists(self, mibname, mtime, rebuild=False):
        if rebuild:
            debug.logger & debug.flagSearcher and debug.logger('pretend %s is very old' % mibname)
            return
        mibname = decode(mibname)
        try:
            p = __import__(self._package, globals(), locals(), ['__init__'])
            if hasattr(p, '__loader__') and hasattr(p.__loader__, '_files'):
                self.__loader = p.__loader__
                self._package = self._package.replace('.', os.sep)
                debug.logger & debug.flagSearcher and debug.logger(
                    '%s is an importable egg at %s' % (self._package, os.path.split(p.__file__)[0]))
            elif hasattr(p, '__file__'):
                debug.logger & debug.flagSearcher and debug.logger(
                    '%s is not an egg, trying it as a package directory' % self._package)
                return PyFileSearcher(os.path.split(p.__file__)[0]).fileExists(mibname, mtime, rebuild=rebuild)
            else:
                raise error.PySmiFileNotFoundError('%s is neither importable nor a file' % self._package, searcher=self)

        except ImportError:
            raise error.PySmiFileNotFoundError('%s is not importable, trying as a path' % self._package, searcher=self)

        for fmt in imp.PY_COMPILED, imp.PY_SOURCE:
            for pySfx, pyMode in self.suffixes[fmt]:
                f = os.path.join(self._package, mibname.upper()) + pySfx
                if f not in self.__loader._files:
                    debug.logger & debug.flagSearcher and debug.logger('%s is not in %s' % (f, self._package))
                    continue
                if fmt == imp.PY_COMPILED:
                    pyData = self.__loader.get_data(f)
                    if pyData[:4] == imp.get_magic():
                        pyData = pyData[4:]
                        pyTime = struct.unpack('<L', pyData[:4])[0]
                        debug.logger & debug.flagSearcher and debug.logger(
                            'found %s, mtime %s' % (f, time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime(pyTime))))
                        if pyTime >= mtime:
                            raise error.PySmiFileNotModifiedError()
                        else:
                            raise error.PySmiFileNotFoundError('older file %s exists' % mibname, searcher=self)
                    else:
                        debug.logger & debug.flagSearcher and debug.logger('bad magic in %s' % f)
                        continue
                else:
                    pyTime = self._parseDosTime(
                        self.__loader._files[f][6],
                        self.__loader._files[f][5]
                    )

                    debug.logger & debug.flagSearcher and debug.logger(
                        'found %s, mtime %s' % (f, time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime(pyTime))))
                    if pyTime >= mtime:
                        raise error.PySmiFileNotModifiedError()
                    else:
                        raise error.PySmiFileNotFoundError('older file %s exists' % mibname, searcher=self)

        raise error.PySmiFileNotFoundError('no file %s found' % mibname, searcher=self)
开发者ID:zware,项目名称:pysmi,代码行数:56,代码来源:pypackage.py


示例19: loadIndex

    def loadIndex(self, indexFile):
        mibIndex = {}
        if os.path.exists(indexFile):
            try:
                mibIndex = dict(
                    [x.split()[:2] for x in open(indexFile).readlines()]
                )
                debug.logger & debug.flagReader and debug.logger('loaded MIB index map from %s file, %s entries' % (indexFile, len(mibIndex)))
            except IOError:
                pass

        return mibIndex
开发者ID:bnavarma,项目名称:netsnmp,代码行数:12,代码来源:localfile.py


示例20: genIndex

 def genIndex(self, mibsMap, **kwargs):
     out = '\nfrom pysnmp.proto.rfc1902 import ObjectName\n\noidToMibMap = {\n'
     count = 0
     for name, oid in mibsMap:
         out += 'ObjectName("%s"): "%s",\n' % (oid, name)
         count += 1
     out += '}\n'
     if 'comments' in kwargs:
         out = ''.join(['# %s\n' % x for x in kwargs['comments']]) + '#\n' + out
         out = '#\n# PySNMP MIB indices (http://pysnmp.sf.net)\n' + out
     debug.logger & debug.flagCodegen and debug.logger('OID->MIB index built, %s entries, %s bytes' % (count, len(out)))
     return out
开发者ID:437049211,项目名称:PyQYT,代码行数:12,代码来源:pysnmp.py



注:本文中的pysmi.debug.logger函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python smi.parserFactory函数代码示例发布时间:2022-05-26
下一篇:
Python idehelper.detectCompletionType函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap