Skip to content

Commit 0169ef0

Browse files
akbakb
authored andcommitted
Run pre-commit hooks
1 parent 6a772b8 commit 0169ef0

27 files changed

+147
-121
lines changed

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/python-mario",
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/python-mario",
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'
28-
year = '2019'
29-
author = 'mario contributors'
27+
project = "mario"
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
@@ -35,7 +35,7 @@ default_section = THIRDPARTY
3535
forced_separate = test_mario
3636
not_skip = __init__.py
3737
skip = migrations
38-
known_third_party=pytest,click[check-manifest]
38+
known_third_party=aiohttp,appdirs,async_exit_stack,async_generator,async_timeout,attr,click,contextvars,hypothesis,lxml,marshmallow,parso,pkg_resources,pyrsistent,pytest,requests,setuptools,toml,toolz,trio,trio_typing
3939
ignore =
4040
.flake8
4141
dev-requirements.in

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import re
21
import pathlib
2+
import re
33

44
import setuptools
55

6+
67
PROJECT_ROOT = pathlib.Path(__file__).parent
78

89
with open(PROJECT_ROOT / "requirements.in") as f:

src/mario/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-

src/mario/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
from . import cli
22

3+
34
cli.cli()

src/mario/aliasing.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import marshmallow
66
from marshmallow import fields
77

8+
89
TYPES = {t.__name__: t for t in [int, str, bool, float]}
910

1011

0 commit comments

Comments
 (0)