Skip to content

Commit b6661ce

Browse files
committed
black => yapf, 88 => 99 line length
1 parent eafdebd commit b6661ce

File tree

12 files changed

+133
-284
lines changed

12 files changed

+133
-284
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ repos:
3737
- flake8-debugger
3838
- flake8-isort
3939
- flake8-string-format
40-
- repo: https://github.com/psf/black
41-
rev: 21.9b0
40+
- repo: https://github.com/google/yapf
41+
rev: v0.31.0
4242
hooks:
43-
- id: black
43+
- id: yapf
44+
args: [-i]
4445
- repo: https://github.com/PyCQA/isort
45-
rev: 5.9.3
46+
rev: 5.10.1
4647
hooks:
4748
- id: isort

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ object from `docopt <https://pypi.org/project/docopt>`_ syntax:
277277
<you> : Your name [default: Anon]
278278
<me> : My name [default: Casper]
279279
"""
280-
import sys, argopt, shtab # NOQA
280+
import argopt, shtab
281281
282282
parser = argopt.argopt(__doc__)
283283
shtab.add_argument_to(parser, ["-s", "--print-completion"]) # magic!

docs/pydoc_markdown_shtab.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ def _process(self, node):
88
if not getattr(node, "docstring", None):
99
return super()._process(node)
1010
# convert parameter lists to markdown list
11-
node.docstring = re.sub(
12-
r"^(\w+)\s{2,}(:.*?)$", r"* __\1__*\2* ", node.docstring, flags=re.M
13-
)
11+
node.docstring = re.sub(r"^(\w+)\s{2,}(:.*?)$", r"* __\1__*\2* ", node.docstring,
12+
flags=re.M)
1413
return super()._process(node)

docs/use.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ Add direct support to scripts for a little more configurability:
172172
<you> : Your name [default: Anon]
173173
<me> : My name [default: Casper]
174174
"""
175-
import sys, argopt, shtab # NOQA
175+
import argopt, shtab
176176

177177
parser = argopt.argopt(__doc__)
178178
shtab.add_argument_to(parser, ["-s", "--print-completion"]) # magic!

examples/customcomplete.py

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88

99
import shtab # for completion magic
1010

11-
TXT_FILE = {
12-
"bash": "_shtab_greeter_compgen_TXTFiles",
13-
"zsh": "_files -g '(*.txt|*.TXT)'",
14-
}
11+
TXT_FILE = {"bash": "_shtab_greeter_compgen_TXTFiles", "zsh": "_files -g '(*.txt|*.TXT)'"}
1512
PREAMBLE = {
1613
"bash": """
1714
# $1=COMP_WORDS[1]
@@ -20,16 +17,12 @@
2017
compgen -f -X '!*?.txt' -- $1
2118
compgen -f -X '!*?.TXT' -- $1
2219
}
23-
""",
24-
"zsh": "",
25-
}
20+
""", "zsh": ""}
2621

2722

2823
def process(args):
29-
print(
30-
"received <input_txt>=%r --input-file=%r --output-name=%r"
31-
% (args.input_txt, args.input_file, args.output_name)
32-
)
24+
print("received <input_txt>=%r --input-file=%r --output-name=%r" %
25+
(args.input_txt, args.input_file, args.output_name))
3326

3427

3528
def get_main_parser():
@@ -40,9 +33,7 @@ def get_main_parser():
4033
subparsers.dest = "subcommand"
4134

4235
parser = subparsers.add_parser("completion", help="print tab completion")
43-
shtab.add_argument_to(
44-
parser, "shell", parent=main_parser, preamble=PREAMBLE
45-
) # magic!
36+
shtab.add_argument_to(parser, "shell", parent=main_parser, preamble=PREAMBLE) # magic!
4637

4738
parser = subparsers.add_parser("process", help="parse files")
4839
# `*.txt` file tab completion
@@ -52,11 +43,11 @@ def get_main_parser():
5243
parser.add_argument(
5344
"-o",
5445
"--output-name",
55-
help=(
56-
"output file name. Completes directory names to avoid users"
57-
" accidentally overwriting existing files."
58-
),
59-
).complete = shtab.DIRECTORY # directory tab completion builtin shortcut
46+
help=("output file name. Completes directory names to avoid users"
47+
" accidentally overwriting existing files."),
48+
).complete = shtab.DIRECTORY
49+
# directory tab completion builtin shortcut
50+
6051
parser.set_defaults(func=process)
6152
return main_parser
6253

examples/docopt-greeter.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@
1111
<you> : Your name [default: Anon]
1212
<me> : My name [default: Casper]
1313
"""
14-
import sys # NOQA
15-
1614
import argopt
1715

1816
import shtab
1917

2018
parser = argopt.argopt(__doc__)
21-
shtab.add_argument_to(parser, ["-s", "--print-completion"]) # magic!
19+
shtab.add_argument_to(parser, ["-s", "--print-completion"]) # magic!
2220
if __name__ == "__main__":
2321
args = parser.parse_args()
2422

examples/pathcomplete.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313
def get_main_parser():
1414
parser = argparse.ArgumentParser(prog="pathcomplete")
15-
shtab.add_argument_to(parser, ["-s", "--print-completion"]) # magic!
15+
shtab.add_argument_to(parser, ["-s", "--print-completion"]) # magic!
16+
1617
# file & directory tab complete
1718
parser.add_argument("file", nargs="?").complete = shtab.FILE
1819
parser.add_argument("--dir", default=".").complete = shtab.DIRECTORY

pyproject.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
[build-system]
22
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"]
3-
build-backend = "setuptools.build_meta"
43

54
[tool.setuptools_scm]
65
write_to = "shtab/_dist_ver.py"
76
write_to_template = "__version__ = '{version}'\n"
8-
9-
[tool.black]
10-
target_version = ["py27", "py36", "py38"]

setup.cfg

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ classifiers=
6666
Topic :: Terminals
6767
Topic :: Utilities
6868
[options]
69-
setup_requires=setuptools>=42; setuptools_scm[toml]>=3.4
69+
setup_requires=setuptools>=42; wheel; setuptools_scm[toml]>=3.4
7070
install_requires=
7171
argparse; python_version < "2.7" or ("3.0" <= python_version and python_version < "3.2")
72-
python_requires= >=2.7, !=3.0.*, !=3.1.*
72+
python_requires=>=2.7, !=3.0.*, !=3.1.*
7373
packages=find:
7474
[options.entry_points]
7575
console_scripts=
@@ -80,12 +80,24 @@ exclude=docs,tests
8080
universal=1
8181

8282
[flake8]
83-
max_line_length=88
84-
extend-ignore=E203,P1
83+
max_line_length=99
84+
extend-ignore=E261,P1
8585
exclude=build,dist,.eggs,.git,__pycache__
8686

87+
[yapf]
88+
spaces_before_comment=15, 20
89+
arithmetic_precedence_indication=true
90+
allow_split_before_dict_value=false
91+
coalesce_brackets=True
92+
column_limit=99
93+
each_dict_entry_on_separate_line=False
94+
space_between_ending_comma_and_closing_bracket=False
95+
split_before_named_assigns=False
96+
split_before_closing_bracket=False
97+
8798
[isort]
8899
profile=black
100+
line_length=99
89101
known_first_party=shtab,tests
90102

91103
[tool:pytest]

0 commit comments

Comments
 (0)