Skip to content

Commit a790350

Browse files
committed
New formatters
Signed-off-by: Bernat Gabor <[email protected]>
1 parent d4e6e77 commit a790350

27 files changed

+287
-159
lines changed

.pre-commit-config.yaml

Lines changed: 67 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,70 @@
11
default_language_version:
22
python: python3
33
repos:
4-
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v3.1.0
6-
hooks:
7-
- id: check-ast
8-
- id: check-builtin-literals
9-
- id: check-docstring-first
10-
- id: check-merge-conflict
11-
- id: check-yaml
12-
- id: check-toml
13-
- id: debug-statements
14-
- id: end-of-file-fixer
15-
- id: trailing-whitespace
16-
- repo: https://github.com/asottile/pyupgrade
17-
rev: v2.7.2
18-
hooks:
19-
- id: pyupgrade
20-
- repo: https://github.com/asottile/seed-isort-config
21-
rev: v2.2.0
22-
hooks:
23-
- id: seed-isort-config
24-
args:
25-
- --application-directories
26-
- .:src
27-
- repo: https://github.com/pre-commit/mirrors-isort
28-
rev: v5.2.1
29-
hooks:
30-
- id: isort
31-
- repo: https://github.com/ambv/black
32-
rev: 19.10b0
33-
hooks:
34-
- id: black
35-
args:
36-
- --safe
37-
language_version: python3.8
38-
- repo: https://github.com/asottile/blacken-docs
39-
rev: v1.7.0
40-
hooks:
41-
- id: blacken-docs
42-
additional_dependencies:
43-
- black==19.10b0
44-
language_version: python3.8
45-
- repo: https://github.com/asottile/add-trailing-comma
46-
rev: v2.0.1
47-
hooks:
48-
- id: add-trailing-comma
49-
- repo: https://github.com/pre-commit/pygrep-hooks
50-
rev: v1.5.1
51-
hooks:
52-
- id: rst-backticks
53-
- repo: https://github.com/asottile/setup-cfg-fmt
54-
rev: v1.11.0
55-
hooks:
56-
- id: setup-cfg-fmt
57-
args:
58-
- --min-py3-version
59-
- '3.4'
60-
- repo: https://gitlab.com/pycqa/flake8
61-
rev: 3.8.3
62-
hooks:
63-
- id: flake8
64-
additional_dependencies:
65-
- flake8-bugbear == 20.1.2
66-
language_version: python3.8
67-
- repo: local
68-
hooks:
69-
- id: changelogs-rst
70-
name: changelog filenames
71-
language: fail
72-
entry: >-
73-
changelog files must be named
74-
####.(bugfix|feature|deprecation|breaking|doc|misc).rst
75-
exclude: >-
76-
^docs/changelog/(\d+\.(bugfix|feature|deprecation|breaking|doc|misc).rst|README.rst|template.jinja2)
77-
files: ^docs/changelog/
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v3.2.0
6+
hooks:
7+
- id: check-ast
8+
- id: check-builtin-literals
9+
- id: check-docstring-first
10+
- id: check-merge-conflict
11+
- id: check-yaml
12+
- id: check-toml
13+
- id: debug-statements
14+
- id: end-of-file-fixer
15+
- id: trailing-whitespace
16+
- repo: https://github.com/asottile/pyupgrade
17+
rev: v2.7.2
18+
hooks:
19+
- id: pyupgrade
20+
- repo: https://github.com/pre-commit/mirrors-isort
21+
rev: v5.4.2
22+
hooks:
23+
- id: isort
24+
- repo: https://github.com/ambv/black
25+
rev: 20.8b1
26+
hooks:
27+
- id: black
28+
args:
29+
- --safe
30+
language_version: python3.8
31+
- repo: https://github.com/asottile/blacken-docs
32+
rev: v1.8.0
33+
hooks:
34+
- id: blacken-docs
35+
additional_dependencies:
36+
- black==19.10b0
37+
language_version: python3.8
38+
- repo: https://github.com/asottile/add-trailing-comma
39+
rev: v2.0.1
40+
hooks:
41+
- id: add-trailing-comma
42+
- repo: https://github.com/pre-commit/pygrep-hooks
43+
rev: v1.6.0
44+
hooks:
45+
- id: rst-backticks
46+
- repo: https://github.com/asottile/setup-cfg-fmt
47+
rev: v1.11.0
48+
hooks:
49+
- id: setup-cfg-fmt
50+
args:
51+
- --min-py3-version
52+
- "3.4"
53+
- repo: https://gitlab.com/pycqa/flake8
54+
rev: 3.8.3
55+
hooks:
56+
- id: flake8
57+
additional_dependencies:
58+
- flake8-bugbear == 20.1.2
59+
language_version: python3.8
60+
- repo: local
61+
hooks:
62+
- id: changelogs-rst
63+
name: changelog filenames
64+
language: fail
65+
entry: >-
66+
changelog files must be named
67+
####.(bugfix|feature|deprecation|breaking|doc|misc).rst
68+
exclude: >-
69+
^docs/changelog/(\d+\.(bugfix|feature|deprecation|breaking|doc|misc).rst|README.rst|template.jinja2)
70+
files: ^docs/changelog/

docs/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ def generate_draft_news():
3535
[os.path.dirname(sys.executable)] + env["PATH"].split(os.pathsep),
3636
)
3737
changelog = subprocess.check_output(
38-
["towncrier", "--draft", "--version", "DRAFT"], cwd=str(ROOT_SRC_TREE_DIR), env=env,
38+
["towncrier", "--draft", "--version", "DRAFT"],
39+
cwd=str(ROOT_SRC_TREE_DIR),
40+
env=env,
3941
).decode("utf-8")
4042
if "No significant changes" in changelog:
4143
content = ""

src/tox/_pytestplugin.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,10 @@ def outlines(self):
183183

184184
def __repr__(self):
185185
res = "RunResult(ret={}, args={!r}, out=\n{}\n, err=\n{})".format(
186-
self.ret, self.args, self.out, self.err,
186+
self.ret,
187+
self.args,
188+
self.out,
189+
self.err,
187190
)
188191
if six.PY2:
189192
return res.encode("UTF-8")
@@ -233,7 +236,9 @@ def getnext(self, cat):
233236
newindex += 1
234237
raise LookupError(
235238
"looking for {!r}, no reports found at >={:d} in {!r}".format(
236-
cat, self._index + 1, self.instance.reported_lines,
239+
cat,
240+
self._index + 1,
241+
self.instance.reported_lines,
237242
),
238243
)
239244

@@ -257,7 +262,10 @@ def expect(self, cat, messagepattern="*", invert=False):
257262
if not invert:
258263
raise AssertionError(
259264
"looking for {}({!r}), no reports found at >={:d} in {!r}".format(
260-
cat, messagepattern, self._index + 1, self.instance.reported_lines,
265+
cat,
266+
messagepattern,
267+
self._index + 1,
268+
self.instance.reported_lines,
261269
),
262270
)
263271

@@ -490,7 +498,7 @@ def create_files(base, filedefs):
490498
def mock_venv(monkeypatch):
491499
"""This creates a mock virtual environment (e.g. will inherit the current interpreter).
492500
Note: because we inherit, to keep things sane you must call the py environment and only that;
493-
and cannot install any packages. """
501+
and cannot install any packages."""
494502

495503
# first ensure we have a clean python path
496504
monkeypatch.delenv(str("PYTHONPATH"), raising=False)

src/tox/_quickstart.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,9 @@ def parse_args():
262262
help="Custom root directory to write config to. Defaults to current directory.",
263263
)
264264
parser.add_argument(
265-
"--version", action="version", version="%(prog)s {}".format(tox.__version__),
265+
"--version",
266+
action="version",
267+
version="%(prog)s {}".format(tox.__version__),
266268
)
267269
return parser.parse_args()
268270

src/tox/action.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,11 @@ def popen(
8787
cmd_args = [str(x) for x in self._rewrite_args(cwd, args)]
8888
cmd_args_shell = " ".join(pipes.quote(i) for i in cmd_args)
8989
stream_getter = self._get_standard_streams(
90-
capture_err, cmd_args_shell, redirect, returnout, cwd,
90+
capture_err,
91+
cmd_args_shell,
92+
redirect,
93+
returnout,
94+
cwd,
9195
)
9296
exit_code, output = None, None
9397
with stream_getter as (fin, out_path, stderr, stdout):

0 commit comments

Comments
 (0)