Flake8 Fixes

This commit is contained in:
BJ Dierkes 2016-07-07 02:33:18 -05:00
parent 5f99a0006f
commit 01e86752b4
6 changed files with 21 additions and 28 deletions

View File

@ -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

View File

@ -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
``[<app_label>] -> plugin_config_dir`` config setting parsed in
any of the application configuration files.

View File

@ -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()

View File

@ -14,7 +14,7 @@ def log_validator(klass, obj):
'set_level',
'get_level',
'info',
'warn', ### DEPRECATED
'warn', # DEPRECATED
'warning',
'error',
'fatal',

View File

@ -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():

View File

@ -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