Skip to content

Commit 032f3f3

Browse files
akbakb
authored andcommitted
Apply pre-commit hooks.
1 parent 545367e commit 032f3f3

File tree

12 files changed

+96
-55
lines changed

12 files changed

+96
-55
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
66

77
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
88

9-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

changelog.d/towncrier_template.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,3 @@ No significant changes.
3434
{% endif %}
3535
{% endfor %}
3636
----
37-

ci/appveyor-bootstrap.py

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
with various fixes and improvements that just weren't feasible to implement in PowerShell.
66
"""
77
from __future__ import print_function
8+
89
from os import environ
910
from os.path import exists
1011
from subprocess import check_call
1112

13+
1214
try:
1315
from urllib.request import urlretrieve
1416
except ImportError:
@@ -29,10 +31,30 @@
2931
}
3032
INSTALL_CMD = {
3133
# Commands are allowed to fail only if they are not the last command. Eg: uninstall (/x) allowed to fail.
32-
"2.7": [["msiexec.exe", "/L*+!", "install.log", "/qn", "/x", "{path}"],
33-
["msiexec.exe", "/L*+!", "install.log", "/qn", "/i", "{path}", "TARGETDIR={home}"]],
34-
"3.4": [["msiexec.exe", "/L*+!", "install.log", "/qn", "/x", "{path}"],
35-
["msiexec.exe", "/L*+!", "install.log", "/qn", "/i", "{path}", "TARGETDIR={home}"]],
34+
"2.7": [
35+
["msiexec.exe", "/L*+!", "install.log", "/qn", "/x", "{path}"],
36+
[
37+
"msiexec.exe",
38+
"/L*+!",
39+
"install.log",
40+
"/qn",
41+
"/i",
42+
"{path}",
43+
"TARGETDIR={home}",
44+
],
45+
],
46+
"3.4": [
47+
["msiexec.exe", "/L*+!", "install.log", "/qn", "/x", "{path}"],
48+
[
49+
"msiexec.exe",
50+
"/L*+!",
51+
"install.log",
52+
"/qn",
53+
"/i",
54+
"{path}",
55+
"TARGETDIR={home}",
56+
],
57+
],
3658
"3.5": [["{path}", "/quiet", "TargetDir={home}"]],
3759
"3.6": [["{path}", "/quiet", "TargetDir={home}"]],
3860
}
@@ -106,6 +128,14 @@ def install_packages(home, *packages):
106128

107129

108130
if __name__ == "__main__":
109-
install_python(environ["PYTHON_VERSION"], environ["PYTHON_ARCH"], environ["PYTHON_HOME"])
131+
install_python(
132+
environ["PYTHON_VERSION"], environ["PYTHON_ARCH"], environ["PYTHON_HOME"]
133+
)
110134
install_pip(environ["PYTHON_HOME"])
111-
install_packages(environ["PYTHON_HOME"], "setuptools>=18.0.1", "wheel", "tox", "virtualenv>=13.1.0")
135+
install_packages(
136+
environ["PYTHON_HOME"],
137+
"setuptools>=18.0.1",
138+
"wheel",
139+
"tox",
140+
"virtualenv>=13.1.0",
141+
)

ci/appveyor-download.py

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ def make_auth_headers():
2626
with open(path) as f:
2727
token = f.read().strip()
2828

29-
headers = {
30-
"Authorization": "Bearer {}".format(token),
31-
}
29+
headers = {"Authorization": "Bearer {}".format(token)}
3230
return headers
3331

3432

@@ -37,14 +35,20 @@ def download_latest_artifacts(account_project, build_id):
3735
if build_id is None:
3836
url = "https://ci.appveyor.com/api/projects/{}".format(account_project)
3937
else:
40-
url = "https://ci.appveyor.com/api/projects/{}/build/{}".format(account_project, build_id)
38+
url = "https://ci.appveyor.com/api/projects/{}/build/{}".format(
39+
account_project, build_id
40+
)
4141
build = requests.get(url, headers=make_auth_headers()).json()
4242
jobs = build["build"]["jobs"]
43-
print(u"Build {0[build][version]}, {1} jobs: {0[build][message]}".format(build, len(jobs)))
43+
print(
44+
"Build {0[build][version]}, {1} jobs: {0[build][message]}".format(
45+
build, len(jobs)
46+
)
47+
)
4448

4549
for job in jobs:
4650
name = job["name"]
47-
print(u" {0}: {1[status]}, {1[artifactsCount]} artifacts".format(name, job))
51+
print(" {0}: {1[status]}, {1[artifactsCount]} artifacts".format(name, job))
4852

4953
url = "https://ci.appveyor.com/api/buildjobs/{}/artifacts".format(job["jobId"])
5054
response = requests.get(url, headers=make_auth_headers())
@@ -53,9 +57,11 @@ def download_latest_artifacts(account_project, build_id):
5357
for artifact in artifacts:
5458
is_zip = artifact["type"] == "Zip"
5559
filename = artifact["fileName"]
56-
print(u" {0}, {1} bytes".format(filename, artifact["size"]))
60+
print(" {0}, {1} bytes".format(filename, artifact["size"]))
5761

58-
url = "https://ci.appveyor.com/api/buildjobs/{}/artifacts/{}".format(job["jobId"], filename)
62+
url = "https://ci.appveyor.com/api/buildjobs/{}/artifacts/{}".format(
63+
job["jobId"], filename
64+
)
5965
download_url(url, filename, make_auth_headers())
6066

6167
if is_zip:
@@ -79,28 +85,29 @@ def download_url(url, filename, headers):
7985
for chunk in response.iter_content(16 * 1024):
8086
f.write(chunk)
8187
else:
82-
print(u" Error downloading {}: {}".format(url, response))
88+
print(" Error downloading {}: {}".format(url, response))
8389

8490

8591
def unpack_zipfile(filename):
8692
"""Unpack a zipfile, using the names in the zip."""
8793
with open(filename, "rb") as fzip:
8894
z = zipfile.ZipFile(fzip)
8995
for name in z.namelist():
90-
print(u" extracting {}".format(name))
96+
print(" extracting {}".format(name))
9197
ensure_dirs(name)
9298
z.extract(name)
9399

94100

95101
parser = argparse.ArgumentParser(description="Download artifacts from AppVeyor.")
96-
parser.add_argument("--id",
97-
metavar="PROJECT_ID",
98-
default="python-mario/mario-addons",
99-
help="Project ID in AppVeyor.")
100-
parser.add_argument("build",
101-
nargs="?",
102-
metavar="BUILD_ID",
103-
help="Build ID in AppVeyor. Eg: master-123")
102+
parser.add_argument(
103+
"--id",
104+
metavar="PROJECT_ID",
105+
default="python-mario/mario-addons",
106+
help="Project ID in AppVeyor.",
107+
)
108+
parser.add_argument(
109+
"build", nargs="?", metavar="BUILD_ID", help="Build ID in AppVeyor. Eg: master-123"
110+
)
104111

105112
if __name__ == "__main__":
106113
# import logging

ci/bootstrap.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
3-
from __future__ import absolute_import, print_function, unicode_literals
3+
from __future__ import absolute_import
4+
from __future__ import print_function
5+
from __future__ import unicode_literals
46

57
import os
68
import sys
@@ -41,15 +43,21 @@
4143
loader=jinja2.FileSystemLoader(join(base_path, "ci", "templates")),
4244
trim_blocks=True,
4345
lstrip_blocks=True,
44-
keep_trailing_newline=True
46+
keep_trailing_newline=True,
4547
)
4648

4749
tox_environments = [
4850
line.strip()
4951
# WARNING: "tox" must be installed globally or in the project"s virtualenv
50-
for line in subprocess.check_output(["tox", "--listenvs"], universal_newlines=True).splitlines()
52+
for line in subprocess.check_output(
53+
["tox", "--listenvs"], universal_newlines=True
54+
).splitlines()
55+
]
56+
tox_environments = [
57+
line
58+
for line in tox_environments
59+
if line not in ["clean", "report", "docs", "check"]
5160
]
52-
tox_environments = [line for line in tox_environments if line not in ["clean", "report", "docs", "check"]]
5361

5462
for name in os.listdir(join("ci", "templates")):
5563
with open(join(base_path, name), "w") as fh:

docs/conf.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@
1818
"sphinx.ext.viewcode",
1919
]
2020
if os.getenv("SPELLCHECK"):
21-
extensions += "sphinxcontrib.spelling",
21+
extensions += ("sphinxcontrib.spelling",)
2222
spelling_show_suggestions = True
2323
spelling_lang = "en_US"
2424

2525
source_suffix = ".rst"
2626
master_doc = "index"
27-
project = 'mario_addons'
28-
year = '2019'
29-
author = 'Mario contributors'
27+
project = "mario_addons"
28+
year = "2019"
29+
author = "Mario contributors"
3030
copyright = "{0}, {1}".format(year, author)
31-
version = release = '0.1.0'
31+
version = release = "0.1.0"
3232

3333
pygments_style = "trac"
3434
templates_path = ["."]
@@ -45,9 +45,7 @@
4545
html_use_smartypants = True
4646
html_last_updated_fmt = "%b %d, %Y"
4747
html_split_index = False
48-
html_sidebars = {
49-
"**": ["searchbox.html", "globaltoc.html", "sourcelink.html"],
50-
}
48+
html_sidebars = {"**": ["searchbox.html", "globaltoc.html", "sourcelink.html"]}
5149
html_short_title = "%s-%s" % (project, version)
5250

5351
napoleon_use_ivar = True

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ default_section = THIRDPARTY
3131
forced_separate = test_mario_addons
3232
not_skip = __init__.py
3333
skip = migrations
34-
known_third_party=pytest,click[check-manifest]
34+
known_third_party=click,requests,setuptools
3535
ignore =
3636
.flake8
3737
dev-requirements.in

setup.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818

1919
def read(*names, **kwargs):
2020
with io.open(
21-
join(dirname(__file__), *names),
22-
encoding=kwargs.get("encoding", "utf8")
21+
join(dirname(__file__), *names), encoding=kwargs.get("encoding", "utf8")
2322
) as fh:
2423
return fh.read()
2524

25+
2626
try:
2727
with open("requirements.in") as f:
2828
INSTALL_REQUIRES = f.read().splitlines()
@@ -34,13 +34,16 @@ def read(*names, **kwargs):
3434
setup(
3535
name="mario-addons",
3636
version="0.1.0",
37-
description='More commands for Mario.',
38-
long_description="%s\n%s" % (
39-
re.compile("^.. start-badges.*^.. end-badges", re.M | re.S).sub("", read("README.rst")),
40-
re.sub(":[a-z]+:`~?(.*?)`", r"``\1``", read("CHANGELOG.rst"))
37+
description="More commands for Mario.",
38+
long_description="%s\n%s"
39+
% (
40+
re.compile("^.. start-badges.*^.. end-badges", re.M | re.S).sub(
41+
"", read("README.rst")
42+
),
43+
re.sub(":[a-z]+:`~?(.*?)`", r"``\1``", read("CHANGELOG.rst")),
4144
),
42-
author='Mario contributors',
43-
author_email='[email protected]',
45+
author="Mario contributors",
46+
author_email="[email protected]",
4447
url="https://github.com/python-mario/mario-addons",
4548
packages=find_packages("src"),
4649
package_dir={"": "src"},
@@ -71,16 +74,12 @@ def read(*names, **kwargs):
7174
# eg: "keyword1", "keyword2", "keyword3",
7275
],
7376
install_requires=INSTALL_REQUIRES
74-
# eg: "aspectlib==1.1.1", "six>=1.7",
77+
# eg: "aspectlib==1.1.1", "six>=1.7",
7578
,
7679
extras_require={
7780
# eg:
7881
# "rst": ["docutils>=0.11"],
7982
# ":python_version=="2.6"": ["argparse"],
8083
},
81-
entry_points={
82-
"console_scripts": [
83-
"mario-addons = mario_addons.cli:cli",
84-
]
85-
},
84+
entry_points={"console_scripts": ["mario-addons = mario_addons.cli:cli"]},
8685
)

src/mario_addons/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010
"""
1111
import mario_addons.cli
1212

13+
1314
if __name__ == "__main__":
1415
mario_addons.cli.cli()

src/mario_addons/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
from mario_addons import app
2020

21+
2122
@click.command()
2223
def cli(**kwargs):
2324
app.main(**kwargs)

0 commit comments

Comments
 (0)