Skip to content

Commit

Permalink
Roll back some of the changes as per review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mgedmin committed Apr 10, 2020
1 parent 9dcac26 commit 655ecd6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
34 changes: 14 additions & 20 deletions src/zope/exceptions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,26 @@
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
4 changes: 2 additions & 2 deletions src/zope/exceptions/exceptionformatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def formatLastLine(self, exc_line):

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__'):
Expand Down Expand Up @@ -207,7 +207,7 @@ def extractStack(self, f=None):
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__'):
Expand Down

0 comments on commit 655ecd6

Please sign in to comment.