diff options
author | Marius Gedminas <marius@gedmin.as> | 2020-04-10 15:41:56 +0300 |
---|---|---|
committer | Marius Gedminas <marius@gedmin.as> | 2020-04-10 15:41:56 +0300 |
commit | 655ecd61c25a32d293cab7983852c8cef6562291 (patch) | |
tree | 6063332c68f90963838ed21962fb48285075a7cb | |
parent | 9dcac26544b02435c14360cb719593d7f5a14902 (diff) | |
download | zope-exceptions-655ecd61c25a32d293cab7983852c8cef6562291.tar.gz |
Roll back some of the changes as per review comments
-rw-r--r-- | setup.cfg | 5 | ||||
-rw-r--r-- | src/zope/exceptions/__init__.py | 34 | ||||
-rw-r--r-- | src/zope/exceptions/exceptionformatter.py | 4 |
3 files changed, 21 insertions, 22 deletions
@@ -11,3 +11,8 @@ docs = easy_install zope.exceptions[docs] [bdist_wheel] universal = 1 + +[flake8] +extend-ignore = F401 +# https://pep8.readthedocs.org/en/latest/intro.html#error-codes +# F401: ``module`` imported but unused diff --git a/src/zope/exceptions/__init__.py b/src/zope/exceptions/__init__.py index 8372efb..053f25b 100644 --- a/src/zope/exceptions/__init__.py +++ b/src/zope/exceptions/__init__.py @@ -17,32 +17,26 @@ These exceptions are so general purpose that they don't belong in Zope application-specific packages. """ -from zope.exceptions.interfaces import ( # noqa: F401 - DuplicationError, - IDuplicationError, - UserError, - IUserError, -) +from zope.exceptions.interfaces import DuplicationError +from zope.exceptions.interfaces import IDuplicationError +from zope.exceptions.interfaces import UserError +from zope.exceptions.interfaces import IUserError -from zope.exceptions.exceptionformatter import ( # noqa: F401 - format_exception, - print_exception, - extract_stack, -) +from zope.exceptions.exceptionformatter import format_exception +from zope.exceptions.exceptionformatter import print_exception +from zope.exceptions.exceptionformatter import extract_stack # avoid dependency on zope.security: try: - import zope.security # noqa: F401 + import zope.security except ImportError as v: # pragma: no cover # "ImportError: No module named security" if 'security' not in str(v): raise else: # pragma: no cover - from zope.security.interfaces import ( # noqa: F401 - IUnauthorized, - Unauthorized, - IForbidden, - IForbiddenAttribute, - Forbidden, - ForbiddenAttribute, - ) + from zope.security.interfaces import IUnauthorized + from zope.security.interfaces import Unauthorized + from zope.security.interfaces import IForbidden + from zope.security.interfaces import IForbiddenAttribute + from zope.security.interfaces import Forbidden + from zope.security.interfaces import ForbiddenAttribute diff --git a/src/zope/exceptions/exceptionformatter.py b/src/zope/exceptions/exceptionformatter.py index 7568a6e..bc2e768 100644 --- a/src/zope/exceptions/exceptionformatter.py +++ b/src/zope/exceptions/exceptionformatter.py @@ -175,7 +175,7 @@ class TextExceptionFormatter(object): def formatException(self, etype, value, tb): # The next line provides a way to detect recursion. - __exception_formatter__ = 1 # noqa: F841 + __exception_formatter__ = 1 # noqa result = [] while tb is not None: if tb.tb_frame.f_locals.get('__exception_formatter__'): @@ -207,7 +207,7 @@ class TextExceptionFormatter(object): f = sys.exc_info()[2].tb_frame.f_back # The next line provides a way to detect recursion. - __exception_formatter__ = 1 # noqa: F841 + __exception_formatter__ = 1 # noqa result = [] while f is not None: if f.f_locals.get('__exception_formatter__'): |