From 01e86752b4f1bcda39bf5a30275f3b291288929c Mon Sep 17 00:00:00 2001 From: BJ Dierkes Date: Thu, 7 Jul 2016 02:33:18 -0500 Subject: [PATCH] Flake8 Fixes --- ChangeLog | 4 ++-- cement/core/foundation.py | 11 +++++------ cement/core/interface.py | 13 +++---------- cement/core/log.py | 2 +- cement/ext/ext_logging.py | 7 ++++--- cement/ext/ext_plugin.py | 12 ++++++------ 6 files changed, 21 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index b4507995..0706d30b 100755 --- a/ChangeLog +++ b/ChangeLog @@ -55,9 +55,9 @@ Incompatible: Deprecation: - * :issue:`365` - Deprecate ``LoggingLogHandler.warn()`` + * :issue:`365` - Deprecated ``LoggingLogHandler.warn()`` * :issue:`372` - Deprecated Explicit Python 3.2 Support - * :issue:`376` - Deprecate ``cement.core.interface.list()`` + * :issue:`376` - Deprecated ``cement.core.interface.list()`` 2.8.0 - Wed Feb 24, 2016 diff --git a/cement/core/foundation.py b/cement/core/foundation.py index 3cd31e6b..a752d203 100644 --- a/cement/core/foundation.py +++ b/cement/core/foundation.py @@ -5,7 +5,7 @@ import sys import signal import platform from time import sleep -from ..core import backend, exc, log, config, plugin, interface +from ..core import backend, exc, log, config, plugin from ..core import output, extension, arg, controller, meta, cache, mail from ..core.handler import HandlerManager from ..core.hook import HookManager @@ -39,7 +39,6 @@ def add_handler_override_options(app): " is not defined, can not override handlers") continue - if len(app.handler.list(i)) > 1: handlers = [] for h in app.handler.list(i): @@ -227,7 +226,7 @@ class CementApp(meta.MetaMixin): the last configuration loaded has precedence (and overwrites settings loaded from previous configuration files). - Note that ``.conf`` is the default config file extension, defined by + Note that ``.conf`` is the default config file extension, defined by ``CementApp.Meta.config_extension``. """ @@ -260,10 +259,10 @@ class CementApp(meta.MetaMixin): plugin_config_dir = None """ - A directory path where plugin config files can be found. Files must + A directory path where plugin config files can be found. Files must end in ``.conf`` (or the extension defined by - ``CementApp.Meta.config_extension``) or they will be ignored. By - default, this setting is also overridden by the + ``CementApp.Meta.config_extension``) or they will be ignored. By + default, this setting is also overridden by the ``[] -> plugin_config_dir`` config setting parsed in any of the application configuration files. diff --git a/cement/core/interface.py b/cement/core/interface.py index 8e4c7d82..0dc3c152 100644 --- a/cement/core/interface.py +++ b/cement/core/interface.py @@ -4,7 +4,6 @@ Cement core interface module. """ from ..core import exc, backend -from ..utils.misc import is_true DEFAULT_META = ['interface', 'label', 'config_defaults', 'config_section'] @@ -12,7 +11,7 @@ DEFAULT_META = ['interface', 'label', 'config_defaults', 'config_section'] def list(): """ DEPRECATION WARNING: This function is deprecated as of Cement 2.9 - in favor of the `CementApp.handler.list_types()` function, and will be + in favor of the `CementApp.handler.list_types()` function, and will be removed in future versions of Cement. Return a list of defined interfaces (handler types). @@ -22,14 +21,8 @@ def list(): """ - ### FIXME: Can't print a deprecation warning here because we don't have - ### access to the app... and this is too deep to use minimal logger... ;\ - # if not is_true(self._meta.ignore_deprecation_warnings): - # self.log.warn("Cement Deprecation Warning: " + - # "cement.core.interface.list() has been " + - # "deprecated, and will be removed in future " + - # "versions of Cement. You should use the " + - # "CementApp.handler.list_types() function instead.") + # FIXME: Can't print a deprecation warning here because we don't have + # access to the app... and this is too deep to use minimal logger... ;\ return backend.__handlers__.keys() diff --git a/cement/core/log.py b/cement/core/log.py index e0325816..efbe2292 100644 --- a/cement/core/log.py +++ b/cement/core/log.py @@ -14,7 +14,7 @@ def log_validator(klass, obj): 'set_level', 'get_level', 'info', - 'warn', ### DEPRECATED + 'warn', # DEPRECATED 'warning', 'error', 'fatal', diff --git a/cement/ext/ext_logging.py b/cement/ext/ext_logging.py index 7c90eaa1..29af73a4 100644 --- a/cement/ext/ext_logging.py +++ b/cement/ext/ext_logging.py @@ -162,7 +162,8 @@ class LoggingLogHandler(log.CementLogHandler): def set_level(self, level): """ Set the log level. Must be one of the log levels configured in - self.levels which are ``['INFO', 'WARNING', 'ERROR', 'DEBUG', 'FATAL']``. + self.levels which are + ``['INFO', 'WARNING', 'ERROR', 'DEBUG', 'FATAL']``. :param level: The log level to set. @@ -171,7 +172,7 @@ class LoggingLogHandler(log.CementLogHandler): level = 'WARNING' LOG.warning("Cement Deprecation Warning: Use of the `WARN` " + "level is deprecated as of Cement 2.9.x, and will " + - "be removed in future versions of Cement. You " + + "be removed in future versions of Cement. You " + "should use `WARNING` instead.") self.clear_loggers(self._meta.namespace) @@ -333,7 +334,7 @@ class LoggingLogHandler(log.CementLogHandler): def warn(self, msg, namespace=None, **kw): """ DEPRECATION WARNING: This function is deprecated as of Cement 2.9.x - in favor of the ``LoggingLogHandler.warning()`` function, and will be + in favor of the ``LoggingLogHandler.warning()`` function, and will be removed in future versions of Cement. See: :ref:LoggingLogHandler.warning(): diff --git a/cement/ext/ext_plugin.py b/cement/ext/ext_plugin.py index 0d4a62b6..e0e00319 100644 --- a/cement/ext/ext_plugin.py +++ b/cement/ext/ext_plugin.py @@ -84,7 +84,7 @@ class CementPluginHandler(plugin.CementPluginHandler): else: # sort so that we always load plugins in the same order # regardless of OS (seems some don't sort reliably) - path = "%s/*%s" % (config_dir, + path = "%s/*%s" % (config_dir, self.app._meta.config_extension) plugin_config_files = glob.glob(path) plugin_config_files.sort() @@ -153,12 +153,12 @@ class CementPluginHandler(plugin.CementPluginHandler): def _load_plugin_from_dir(self, plugin_name, plugin_dir): """ - Load a plugin from a directory path rather than a python package - within sys.path. This would either be ``myplugin.py`` or + Load a plugin from a directory path rather than a python package + within sys.path. This would either be ``myplugin.py`` or ``myplugin/__init__.py`` within the given ``plugin_dir``. :param plugin_name: The name of the plugin. - :param plugin_dir: The filesystem directory path where the plugin + :param plugin_dir: The filesystem directory path where the plugin exists. """ @@ -171,7 +171,7 @@ class CementPluginHandler(plugin.CementPluginHandler): LOG.debug("attempting to load '%s' from '%s'" % (plugin_name, path)) if os.path.exists(path): - # We don't catch this because it would make debugging a + # We don't catch this because it would make debugging a # nightmare f, path, desc = imp.find_module(plugin_name, [plugin_dir]) mod = imp.load_module(plugin_name, f, path, desc) @@ -179,7 +179,7 @@ class CementPluginHandler(plugin.CementPluginHandler): mod.load(self.app) return True - LOG.debug("plugin '%s' does not exist in '%s'." % \ + LOG.debug("plugin '%s' does not exist in '%s'." % (plugin_name, plugin_dir)) return False