Skip to content

Commit

Permalink
Lint the code.
Browse files Browse the repository at this point in the history
Add support for Python 3.9 and 3.10.
  • Loading branch information
Michael Howitz committed Oct 19, 2021
1 parent a0bad5f commit 9096913
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Expand Up @@ -4,7 +4,7 @@ Changelog
4.2 (unreleased)
----------------

- Add support for Python 3.8.
- Add support for Python 3.8, 3.9 and 3.10.

- Drop support for Python 3.4.

Expand Down
9 changes: 9 additions & 0 deletions setup.py
Expand Up @@ -23,10 +23,17 @@
description="zExceptions contains common exceptions used in Zope.",
author='Zope Foundation and Contributors',
author_email='zope-dev@zope.org',
project_urls={
'Issue Tracker': 'https://github.com/zopefoundation/'
'zExceptions/issues',
'Sources': 'https://github.com/zopefoundation/zExceptions',
},

long_description=(open('README.rst').read() + '\n' +
open('CHANGES.rst').read()),
packages=find_packages('src'),
package_dir={'': 'src'},
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*',
install_requires=[
'setuptools',
'zope.interface',
Expand All @@ -49,6 +56,8 @@
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
],
Expand Down
6 changes: 3 additions & 3 deletions src/zExceptions/ExceptionFormatter.py
Expand Up @@ -56,7 +56,7 @@ def getRevision(self, globals):
if revision is not None:
try:
revision = str(revision).strip()
except:
except: # noqa: E722 do not use bare 'except'
revision = '???'
return revision

Expand Down Expand Up @@ -156,7 +156,7 @@ def formatLine(self, tb):
try:
supp = factory(*args)
result.extend(self.formatSupplement(supp, tb))
except:
except: # noqa: E722 do not use bare 'except'
if DEBUG_EXCEPTION_FORMATTER:
import traceback
traceback.print_exc()
Expand All @@ -166,7 +166,7 @@ def formatLine(self, tb):
tbi = locals.get('__traceback_info__', None)
if tbi is not None:
result.append(self.formatTracebackInfo(tbi))
except:
except: # noqa: E722 do not use bare 'except'
pass

return self.line_sep.join(result)
Expand Down
7 changes: 7 additions & 0 deletions src/zExceptions/__init__.py
Expand Up @@ -261,6 +261,7 @@ class Redirect(_HTTPMove):
errmsg = 'Found'
status = 302


HTTPFound = Redirect # Alias


Expand Down Expand Up @@ -304,6 +305,7 @@ class HTTPClientError(HTTPError):
class BadRequest(HTTPClientError):
pass


HTTPBadRequest = BadRequest # Alias


Expand All @@ -322,6 +324,7 @@ class Forbidden(HTTPException):
errmsg = 'Forbidden'
status = 403


HTTPForbidden = Forbidden # Alias


Expand All @@ -330,6 +333,7 @@ class NotFound(HTTPException):
errmsg = 'Not Found'
status = 404


HTTPNotFound = NotFound # Alias


Expand All @@ -338,6 +342,7 @@ class MethodNotAllowed(HTTPException):
errmsg = 'Method Not Allowed'
status = 405


HTTPMethodNotAllowed = MethodNotAllowed # Alias


Expand Down Expand Up @@ -416,6 +421,7 @@ class ResourceLockedError(HTTPException):
errmsg = 'Locked'
status = 423


HTTPLocked = ResourceLockedError # Alias


Expand Down Expand Up @@ -459,6 +465,7 @@ class HTTPServerError(HTTPError):
class InternalError(HTTPServerError):
pass


HTTPInternalServerError = InternalError # Alias


Expand Down
8 changes: 4 additions & 4 deletions src/zExceptions/_compat.py
Expand Up @@ -2,14 +2,14 @@


PY3 = sys.version_info >= (3, 0)
if PY3:
if PY3: # pragma: PY3
import builtins
class_types = type,
string_types = (str, bytes)
unicode = str
else:
import __builtin__ as builtins # noqa
else: # pragma: PY2
import __builtin__ as builtins # noqa: F401 import unused
from types import ClassType
class_types = (type, ClassType)
string_types = basestring,
string_types = basestring, # noqa: F821 undefined name 'basestring'
unicode = unicode

0 comments on commit 9096913

Please sign in to comment.