Reformat code with automated tools

Apply standardized code style
This commit is contained in:
medmunds
2023-02-06 12:27:43 -08:00
committed by Mike Edmunds
parent 40891fcb4a
commit b4e22c63b3
94 changed files with 12936 additions and 7443 deletions

View File

@@ -2,14 +2,15 @@ import re
from codecs import open # to use a consistent encoding
from collections import OrderedDict
from os import path
from setuptools import setup
here = path.abspath(path.dirname(__file__))
# get versions from anymail/_version.py,
# but without importing from anymail (which would break setup)
with open(path.join(here, "anymail/_version.py"), encoding='utf-8') as f:
code = compile(f.read(), "anymail/_version.py", 'exec')
with open(path.join(here, "anymail/_version.py"), encoding="utf-8") as f:
code = compile(f.read(), "anymail/_version.py", "exec")
_version = {}
exec(code, _version)
version = _version["__version__"] # X.Y or X.Y.Z or X.Y.Z.dev1 etc.
@@ -19,14 +20,21 @@ with open(path.join(here, "anymail/_version.py"), encoding='utf-8') as f:
def long_description_from_readme(rst):
# Freeze external links (on PyPI) to refer to this X.Y or X.Y.Z tag.
# (This relies on tagging releases with 'vX.Y' or 'vX.Y.Z' in GitHub.)
rst = re.sub(r'(?<=branch[=:])main' # GitHub Actions build status: branch=main --> branch=vX.Y.Z
r'|(?<=/)stable' # ReadTheDocs links: /stable --> /vX.Y.Z
r'|(?<=version=)stable', # ReadTheDocs badge: version=stable --> version=vX.Y.Z
release_tag, rst) # (?<=...) is "positive lookbehind": must be there, but won't get replaced
rst = re.sub(
# (?<=...) is "positive lookbehind": must be there, but won't get replaced
# GitHub Actions build status: branch=main --> branch=vX.Y.Z:
r"(?<=branch[=:])main"
# ReadTheDocs links: /stable --> /vX.Y.Z:
r"|(?<=/)stable"
# ReadTheDocs badge: version=stable --> version=vX.Y.Z:
r"|(?<=version=)stable",
release_tag,
rst,
)
return rst
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
with open(path.join(here, "README.rst"), encoding="utf-8") as f:
long_description = long_description_from_readme(f.read())
@@ -47,17 +55,22 @@ requirements_test = []
setup(
name="django-anymail",
version=version,
description='Django email backends and webhooks for Amazon SES, Mailgun, Mailjet, Mandrill, '
'Postal, Postmark, SendGrid, SendinBlue, and SparkPost',
keywords="Django, email, email backend, ESP, transactional mail, "
"Amazon SES, Mailgun, Mailjet, Mandrill, Postal, Postmark, SendGrid, SendinBlue, SparkPost",
description=(
"Django email backends and webhooks for Amazon SES, Mailgun, Mailjet,"
" Mandrill, Postal, Postmark, SendGrid, SendinBlue, and SparkPost"
),
keywords=(
"Django, email, email backend, ESP, transactional mail,"
" Amazon SES, Mailgun, Mailjet, Mandrill, Postal, Postmark,"
" SendGrid, SendinBlue, SparkPost"
),
author="Mike Edmunds and Anymail contributors",
author_email="medmunds@gmail.com",
url="https://github.com/anymail/django-anymail",
license="BSD License",
packages=["anymail"],
zip_safe=False,
python_requires='>=3.6',
python_requires=">=3.6",
install_requires=["django>=2.0", "requests>=2.4.3"],
extras_require={
# This can be used if particular backends have unique dependencies.
@@ -71,7 +84,8 @@ setup(
"sendinblue": [],
"sparkpost": [],
"postal": ["cryptography"],
# Development/test-only requirements (install with python -m pip -e '.[dev,test]')
# Development/test-only requirements
# (install with python -m pip -e '.[dev,test]')
"dev": requirements_dev,
"test": requirements_test,
},
@@ -103,10 +117,15 @@ setup(
],
long_description=long_description,
long_description_content_type="text/x-rst",
project_urls=OrderedDict([
("Documentation", "https://anymail.readthedocs.io/en/%s/" % release_tag),
("Source", "https://github.com/anymail/django-anymail"),
("Changelog", "https://anymail.readthedocs.io/en/%s/changelog/" % release_tag),
("Tracker", "https://github.com/anymail/django-anymail/issues"),
]),
project_urls=OrderedDict(
[
("Documentation", "https://anymail.readthedocs.io/en/%s/" % release_tag),
("Source", "https://github.com/anymail/django-anymail"),
(
"Changelog",
"https://anymail.readthedocs.io/en/%s/changelog/" % release_tag,
),
("Tracker", "https://github.com/anymail/django-anymail/issues"),
]
),
)