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

Python log.warning函数代码示例

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

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



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

示例1: onPayload

 def onPayload(self, payload):
     repo = '%s/%s' % (payload['repository']['owner']['name'],
                       payload['repository']['name'])
     announces = self._load()
     if repo not in announces:
         log.info('Commit for repo %s not announced anywhere' % repo)
         return
     for channel in announces[repo]:
         for irc in world.ircs:
             if channel in irc.state.channels:
                 break
         commits = payload['commits']
         if channel not in irc.state.channels:
             log.info('Cannot announce commit for repo %s on %s' %
                      (repo, channel))
         elif len(commits) == 0:
             log.warning('GitHub callback called without any commit.')
         else:
             hidden = None
             last_commit = commits[-1]
             if last_commit['message'].startswith('Merge ') and \
                     len(commits) > 5:
                 hidden = len(commits) + 1
                 payload['commits'] = [last_commit]
             for commit in payload['commits']:
                 msg = self._createPrivmsg(channel, payload, commit,
                         hidden)
                 irc.queueMsg(msg)
开发者ID:Albnetwork,项目名称:Supybot-plugins,代码行数:28,代码来源:plugin.py


示例2: _loadPlugins

 def _loadPlugins(self, irc):
     self.log.info('Loading plugins (connecting to %s).', irc.network)
     alwaysLoadImportant = conf.supybot.plugins.alwaysLoadImportant()
     important = conf.supybot.commands.defaultPlugins.importantPlugins()
     for (name, value) in conf.supybot.plugins.getValues(fullNames=False):
         if irc.getCallback(name) is None:
             load = value()
             if not load and name in important:
                 if alwaysLoadImportant:
                     s = '%s is configured not to be loaded, but is being '\
                         'loaded anyway because ' \
                         'supybot.plugins.alwaysLoadImportant is True.'
                     self.log.warning(s, name)
                     load = True
             if load:
                 # We don't load plugins that don't start with a capital
                 # letter.
                 if name[0].isupper() and not irc.getCallback(name):
                     # This is debug because each log logs its beginning.
                     self.log.debug('Loading %s.', name)
                     try:
                         m = plugin.loadPluginModule(name,
                                                     ignoreDeprecation=True)
                         plugin.loadPluginClass(irc, m)
                     except callbacks.Error, e:
                         # This is just an error message.
                         log.warning(str(e))
                     except (plugins.NoSuitableDatabase, ImportError), e:
                         s = 'Failed to load %s: %s' % (name, e)
                         if not s.endswith('.'):
                             s += '.'
                         log.warning(s)
                     except Exception, e:
                         log.exception('Failed to load %s:', name)
开发者ID:boamaod,项目名称:Limnoria,代码行数:34,代码来源:plugin.py


示例3: onPayload

 def onPayload(self, headers, payload):
     if "full_name" in payload["repository"]:
         repo = payload["repository"]["full_name"]
     elif "name" in payload["repository"]["owner"]:
         repo = "%s/%s" % (payload["repository"]["owner"]["name"], payload["repository"]["name"])
     else:
         repo = "%s/%s" % (payload["repository"]["owner"]["login"], payload["repository"]["name"])
     event = headers["X-GitHub-Event"]
     announces = self._load()
     if repo not in announces:
         log.info("Commit for repo %s not announced anywhere" % repo)
         return
     for channel in announces[repo]:
         for irc in world.ircs:
             if channel in irc.state.channels:
                 break
         if event == "push":
             commits = payload["commits"]
             if channel not in irc.state.channels:
                 log.info("Cannot announce commit for repo %s on %s" % (repo, channel))
             elif len(commits) == 0:
                 log.warning("GitHub push hook called without any commit.")
             else:
                 hidden = None
                 last_commit = commits[-1]
                 if last_commit["message"].startswith("Merge ") and len(commits) > 5:
                     hidden = len(commits) + 1
                     commits = [last_commit]
                 payload2 = dict(payload)
                 for commit in commits:
                     payload2["__commit"] = commit
                     self._createPrivmsg(irc, channel, payload2, "push", hidden)
         else:
             self._createPrivmsg(irc, channel, payload, event)
开发者ID:CiaranG,项目名称:Supybot-plugins,代码行数:34,代码来源:plugin.py


示例4: loadPluginModule

def loadPluginModule(name, ignoreDeprecation=False):
    """Loads (and returns) the module for the plugin with the given name."""
    files = []
    pluginDirs = conf.supybot.directories.plugins()[:]
    pluginDirs.append(_pluginsDir)
    for dir in pluginDirs:
        try:
            files.extend(os.listdir(dir))
        except EnvironmentError: # OSError, IOError superclass.
            log.warning('Invalid plugin directory: %s; removing.', dir)
            conf.supybot.directories.plugins().remove(dir)
    moduleInfo = imp.find_module(name, pluginDirs)
    try:
        module = imp.load_module(name, *moduleInfo)
    except:
        sys.modules.pop(name, None)
        keys = sys.modules.keys()
        for key in keys:
            if key.startswith(name + '.'):
                sys.modules.pop(key)
        raise
    if 'deprecated' in module.__dict__ and module.deprecated:
        if ignoreDeprecation:
            log.warning('Deprecated plugin loaded: %s', name)
        else:
            raise Deprecated, format('Attempted to load deprecated plugin %s',
                                     name)
    if module.__name__ in sys.modules:
        sys.modules[module.__name__] = module
    linecache.checkcache()
    return module
开发者ID:Athemis,项目名称:Limnoria,代码行数:31,代码来源:plugin.py


示例5: loadPluginModule

def loadPluginModule(name, ignoreDeprecation=False):
    """Loads (and returns) the module for the plugin with the given name."""
    files = []
    pluginDirs = conf.supybot.directories.plugins()[:]
    pluginDirs.append(_pluginsDir)
    for dir in pluginDirs:
        try:
            files.extend(os.listdir(dir))
        except EnvironmentError: # OSError, IOError superclass.
            log.warning('Invalid plugin directory: %s; removing.', dir)
            conf.supybot.directories.plugins().remove(dir)
    if name not in files:
        matched_names = filter(lambda x: re.search(r'(?i)^%s$' % (name,), x),
                                files)
        if len(matched_names) == 1:
            name = matched_names[0]
        else:
            raise ImportError, name
    moduleInfo = imp.find_module(name, pluginDirs)
    try:
        module = imp.load_module(name, *moduleInfo)
    except:
        sys.modules.pop(name, None)
        raise
    if 'deprecated' in module.__dict__ and module.deprecated:
        if ignoreDeprecation:
            log.warning('Deprecated plugin loaded: %s', name)
        else:
            raise Deprecated, format('Attempted to load deprecated plugin %s',
                                     name)
    if module.__name__ in sys.modules:
        sys.modules[module.__name__] = module
    linecache.checkcache()
    return module
开发者ID:Criptomonedas,项目名称:supybot_fixes,代码行数:34,代码来源:plugin.py


示例6: flush

 def flush(self):
     """Exports the database to a file."""
     try:
         with open(filename, 'wb') as f:
             pickle.dump(self.db, f, 2)
     except Exception as e:
         log.warning('LastFM: Unable to write database: %s', e)
开发者ID:Hasimir,项目名称:glolol-supy-plugins,代码行数:7,代码来源:plugin.py


示例7: doPost

 def doPost(self, handler, path, form):
     if not handler.address_string().endswith('.rs.github.com') and \
             not handler.address_string().endswith('.cloud-ips.com') and \
             not handler.address_string() == 'localhost' and \
             not handler.address_string().startswith('127.0.0.') and \
             not handler.address_string().startswith('192.30.252.') and \
             not handler.address_string().startswith('204.232.175.'):
         log.warning("""'%s' tried to act as a web hook for Github,
         but is not GitHub.""" % handler.address_string())
         self.send_response(403)
         self.send_header('Content-type', 'text/plain')
         self.end_headers()
         self.wfile.write(b('Error: you are not a GitHub server.'))
     else:
         headers = dict(self.headers)
         try:
             self.send_response(200)
             self.send_header('Content-type', 'text/plain')
             self.end_headers()
             self.wfile.write(b('Thanks.'))
         except socket.error:
             pass
         if 'X-GitHub-Event' in headers:
             event = headers['X-GitHub-Event']
         else:
             # WTF?
             event = headers['x-github-event']
         if event == 'ping':
             log.info('Got ping event from GitHub.')
             self.send_response(200)
             self.send_header('Content-type', 'text/plain')
             self.end_headers()
             self.wfile.write(b('Thanks.'))
             return
         self.plugin.announce.onPayload(headers, json.loads(form['payload'].value))
开发者ID:joulez,项目名称:Supybot-plugins,代码行数:35,代码来源:plugin.py


示例8: grabSeasonData

    def grabSeasonData(self):
        """Refreshes season/car/track data from the iRacing main page Javascript"""
        rawMainPageHTML = self.iRacingConnection.fetchMainPageRawHTML()

        if rawMainPageHTML is None:
            logger.warning('Unable to fetch iRacing homepage data.')
            return

        self.lastSeasonDataFetchTime = time.time()

        try:
            trackJSON = re.search("var TrackListing\\s*=\\s*extractJSON\\('(.*)'\\);", rawMainPageHTML).group(1)
            carJSON = re.search("var CarListing\\s*=\\s*extractJSON\\('(.*)'\\);", rawMainPageHTML).group(1)
            carClassJSON = re.search("var CarClassListing\\s*=\\s*extractJSON\\('(.*)'\\);", rawMainPageHTML).group(1)
            seasonJSON = re.search("var SeasonListing\\s*=\\s*extractJSON\\('(.*)'\\);", rawMainPageHTML).group(1)

            tracks = json.loads(trackJSON)
            cars = json.loads(carJSON)
            carClasses = json.loads(carClassJSON)
            seasons = json.loads(seasonJSON)

            for track in tracks:
                self.tracksByID[track['id']] = track
            for car in cars:
                self.carsByID[car['id']] = car
            for carClass in carClasses:
                self.carClassesByID[carClass['id']] = carClass
            for season in seasons:
                self.seasonsByID[season['seriesid']] = season

            logger.info('Loaded data for %i tracks, %i cars, %i car classes, and %i seasons.', len(self.tracksByID), len(self.carsByID), len(self.carClassesByID), len(self.seasonsByID))

        except AttributeError:
            logger.info('Unable to match track/car/season (one or more) listing regex in iRacing main page data.  It is possible that iRacing changed the JavaScript structure of their main page!  Oh no!')
开发者ID:jasonn85,项目名称:Racebot,代码行数:34,代码来源:plugin.py


示例9: __init__

    def __init__(self, *args, **kwargs):
        IBugtracker.__init__(self, *args, **kwargs)
        self.lp = None

        # A word to the wise:
        # The Launchpad API is much better than the /+text interface we currently use,
        # it's faster and easier to get the information we need.
        # The current /+text interface is not really maintained by Launchpad and most,
        # or all, of the Launchpad developers hate it. For this reason, we are dropping
        # support for /+text in the future in favour of launchpadlib.
        # Terence Simpson (tsimpson) 2010-04-20

        try: # Attempt to use launchpadlib, python bindings for the Launchpad API
            from launchpadlib.launchpad import Launchpad
            cachedir = os.path.join(conf.supybot.directories.data.tmp(), 'lpcache')
            if hasattr(Launchpad, 'login_anonymously'):
                self.lp = Launchpad.login_anonymously("Ubuntu Bots - Bugtracker", 'production', cachedir)
            else: #NOTE: Most people should have a launchpadlib new enough for .login_anonymously
                self.lp = Launchpad.login("Ubuntu Bots - Bugtracker", '', '', 'production', cahedir)
        except ImportError:
            # Ask for launchpadlib to be installed
            supylog.warning("Please install python-launchpadlib, the old interface is deprecated")
        except Exception: # Something unexpected happened
            self.lp = None
            supylog.exception("Unknown exception while accessing the Launchpad API")
开发者ID:bnrubin,项目名称:Bugtracker,代码行数:25,代码来源:plugin.py


示例10: doPost

 def doPost(self, handler, path, form):
     if (
         not handler.address_string().endswith(".rs.github.com")
         and not handler.address_string().endswith(".cloud-ips.com")
         and not handler.address_string() == "localhost"
         and not handler.address_string().startswith("127.0.0.")
         and not handler.address_string().startswith("192.30.252.")
         and not handler.address_string().startswith("204.232.175.")
     ):
         log.warning(
             """'%s' tried to act as a web hook for Github,
         but is not GitHub."""
             % handler.address_string()
         )
         self.send_response(403)
         self.send_header("Content-type", "text/plain")
         self.end_headers()
         self.wfile.write(b("Error: you are not a GitHub server."))
     else:
         headers = dict(self.headers)
         try:
             self.send_response(200)
             self.send_header("Content-type", "text/plain")
             self.end_headers()
             self.wfile.write(b("Thanks."))
         except socket.error:
             pass
         self.plugin.announce.onPayload(headers, json.loads(form["payload"].value))
开发者ID:CiaranG,项目名称:Supybot-plugins,代码行数:28,代码来源:plugin.py


示例11: hook

 def hook(self, subdir, callback):
     if subdir in self.callbacks:
         log.warning(('The HTTP subdirectory `%s` was already hooked but '
                 'has been claimed by another plugin (or maybe you '
                 'reloaded the plugin and it didn\'t properly unhook. '
                 'Forced unhook.') % subdir)
     self.callbacks[subdir] = callback
开发者ID:Athemis,项目名称:Limnoria,代码行数:7,代码来源:httpserver.py


示例12: doPost

 def doPost(self, handler, path, form):
     if not handler.address_string().endswith('.rs.github.com') and \
             not handler.address_string().endswith('.cloud-ips.com'):
         log.warning("""'%s' tryed to act as a web hook for Github,
         but is not GitHub.""" % handler.address_string())
     else:
         self.plugin.announce.onPayload(json.loads(form['payload'].value))
开发者ID:Azelphur,项目名称:Supybot-plugins,代码行数:7,代码来源:plugin.py


示例13: __init__

 def __init__(self, filename):
     ChannelUserDictionary.__init__(self)
     self.filename = filename
     try:
         fd = file(self.filename)
     except EnvironmentError, e:
         log.warning('Couldn\'t open %s: %s.', self.filename, e)
         return
开发者ID:Elwell,项目名称:supybot,代码行数:8,代码来源:__init__.py


示例14: reload

 def reload(self):
     """Reloads the channel database from its file."""
     if self.filename is not None:
         self.channels.clear()
         try:
             self.open(self.filename)
         except EnvironmentError, e:
             log.warning('ChannelsDictionary.reload failed: %s', e)
开发者ID:Elwell,项目名称:supybot,代码行数:8,代码来源:ircdb.py


示例15: onPayload

 def onPayload(self, headers, payload):
     if 'reply_env' not in ircmsgs.IrcMsg.__slots__:
         log.error("Got event payload from GitHub, but your version "
                   "of Supybot is not compatible with reply "
                   "environments, so, the GitHub plugin can't "
                   "announce it.")
     if 'full_name' in payload['repository']:
         repo = payload['repository']['full_name']
     elif 'name' in payload['repository']['owner']:
         repo = '%s/%s' % (payload['repository']['owner']['name'],
                           payload['repository']['name'])
     else:
         repo = '%s/%s' % (payload['repository']['owner']['login'],
                           payload['repository']['name'])
     event = headers['X-GitHub-Event']
     announces = self._load()
     repoAnnounces = []
     for (dbRepo, network, channel) in announces:
         if dbRepo == repo:
             repoAnnounces.append((network, channel))
     if len(repoAnnounces) == 0:
         log.info('Commit for repo %s not announced anywhere' % repo)
         return
     for (network, channel) in repoAnnounces:
         # Compatability with DBs without a network
         if network == '':
             for irc in world.ircs:
                 if channel in irc.state.channels:
                     break
         else:
             irc = world.getIrc(network)
             if not irc:
                 log.warning('Received GitHub payload with announcing '
                             'enabled in %s on unloaded network %s.',
                             channel, network)
                 return
         if channel not in irc.state.channels:
             log.info(('Cannot announce event for repo '
                      '%s in %s on %s because I\'m not in %s.') %
                      (repo, channel, irc.network, channel))
         if event == 'push':
             commits = payload['commits']
             if len(commits) == 0:
                 log.warning('GitHub push hook called without any commit.')
             else:
                 hidden = None
                 last_commit = commits[-1]
                 if last_commit['message'].startswith('Merge ') and \
                         len(commits) > 5:
                     hidden = len(commits) + 1
                     commits = [last_commit]
                 payload2 = dict(payload)
                 for commit in commits:
                     payload2['__commit'] = commit
                     self._createPrivmsg(irc, channel, payload2,
                             'push', hidden)
         else:
             self._createPrivmsg(irc, channel, payload, event)
开发者ID:ArtRichards,项目名称:Supybot-plugins,代码行数:58,代码来源:plugin.py


示例16: do376

 def do376(self, irc, msg):
     """Watch for the MOTD and login if we can"""
     if irc.state.supported.get('NETWORK', '') == 'UnderNet':
         if self.registryValue('auth.username') and self.registryValue('auth.password'):
             log.info("Attempting login to XService")
         else:
             log.warning("username and password not set, this plugin will not work")
             return
         self._login(irc)
开发者ID:IotaSpencer,项目名称:supyplugins,代码行数:9,代码来源:plugin.py


示例17: fetchDriverStatusJSON

    def fetchDriverStatusJSON(self, friends=True, studied=True, onlineOnly=False):
        url = '%s?friends=%d&studied=%d&onlineOnly=%d' % (self.URL_GET_DRIVER_STATUS, friends, studied, onlineOnly)
        response = self.requestURL(url)

        if response is None:
            logger.warning('Unable to fetch driver status from iRacing site.')
            return None

        return json.loads(response.text)
开发者ID:jasonn85,项目名称:Racebot,代码行数:9,代码来源:plugin.py


示例18: reloadpolls

    def reloadpolls(self, irc, msg, args):
        """<takes no arguments>
        Reloads the Polls file.
        """
        try:
            self.polls = yaml.load(open(self.pollFile, 'r'), Loader=yamlordereddictloader.Loader)

        except FileNotFoundError as e:
            log.warning("Couldn't open file: %s" % e)
            raise
开发者ID:IotaSpencer,项目名称:supyplugins,代码行数:10,代码来源:plugin.py


示例19: __init__

    def __init__(self, irc):
        self.__parent = super(Vote, self)
        self.__parent.__init__(irc)
        self.pollFile = conf.supybot.directories.data.dirize('polls.yml')
        self._requests = {}
        try:
            self.polls = yaml.load(open(self.pollFile, 'r'), Loader=yamlordereddictloader.Loader)

        except FileNotFoundError as e:
            log.warning("Couldn't open file: %s" % e)
            raise
开发者ID:IotaSpencer,项目名称:supyplugins,代码行数:11,代码来源:plugin.py


示例20: flush

 def flush(self):
     if self.filename is not None:
         fd = utils.file.AtomicFile(self.filename)
         now = time.time()
         for (hostmask, expiration) in self.hostmasks.items():
             if now < expiration or not expiration:
                 fd.write('%s %s' % (hostmask, expiration))
                 fd.write(os.linesep)
         fd.close()
     else:
         log.warning('IgnoresDB.flush called without self.filename.')
开发者ID:Elwell,项目名称:supybot,代码行数:11,代码来源:ircdb.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python plugin.isCommand函数代码示例发布时间:2022-05-27
下一篇:
Python log.info函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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