Skip to content

Commit 1dcbcb2

Browse files
committed
trivial: Style fixes
Run the 'git_pw.utils' module through black. Signed-off-by: Stephen Finucane <stephen@that.guru>
1 parent 851533f commit 1dcbcb2

File tree

1 file changed

+46
-19
lines changed

1 file changed

+46
-19
lines changed

git_pw/utils.py

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def ensure_str(s: ty.Any) -> str:
2929

3030
def trim(string: str, length: int = 70) -> str:
3131
"""Trim a string to the given length."""
32-
return (string[:length - 1] + '...') if len(string) > length else string
32+
return (string[: length - 1] + '...') if len(string) > length else string
3333

3434

3535
def git_config(value: str) -> str:
@@ -86,7 +86,8 @@ def _tabulate(
8686
elif fmt == 'csv':
8787
result = io.StringIO()
8888
writer = csv.writer(
89-
result, quoting=csv.QUOTE_ALL, lineterminator=os.linesep)
89+
result, quoting=csv.QUOTE_ALL, lineterminator=os.linesep
90+
)
9091
writer.writerow([ensure_str(h) for h in headers])
9192
for item in output:
9293
writer.writerow([ensure_str(i) for i in item])
@@ -165,19 +166,32 @@ def echo(
165166

166167

167168
def pagination_options(
168-
sort_fields: ty.Tuple[str, ...], default_sort: str,
169+
sort_fields: ty.Tuple[str, ...],
170+
default_sort: str,
169171
) -> ty.Callable:
170172
"""Shared pagination options."""
171173

172174
def _pagination_options(f):
173-
f = click.option('--limit', metavar='LIMIT', type=click.INT,
174-
help='Maximum number of items to show.')(f)
175-
f = click.option('--page', metavar='PAGE', type=click.INT,
176-
help='Page to retrieve items from. This is '
177-
'influenced by the size of LIMIT.')(f)
178-
f = click.option('--sort', metavar='FIELD', default=default_sort,
179-
type=click.Choice(sort_fields),
180-
help='Sort output on given field.')(f)
175+
f = click.option(
176+
'--limit',
177+
metavar='LIMIT',
178+
type=click.INT,
179+
help='Maximum number of items to show.',
180+
)(f)
181+
f = click.option(
182+
'--page',
183+
metavar='PAGE',
184+
type=click.INT,
185+
help='Page to retrieve items from. This is '
186+
'influenced by the size of LIMIT.',
187+
)(f)
188+
f = click.option(
189+
'--sort',
190+
metavar='FIELD',
191+
default=default_sort,
192+
type=click.Choice(sort_fields),
193+
help='Sort output on given field.',
194+
)(f)
181195

182196
return f
183197

@@ -191,16 +205,29 @@ def format_options(
191205
"""Shared output format options."""
192206

193207
def _format_options(f):
194-
f = click.option('--format', '-f', 'fmt', default=None,
195-
type=click.Choice(['simple', 'table', 'csv']),
196-
help="Output format. Defaults to the value of "
197-
"'git config pw.format' else 'table'.")(f)
208+
f = click.option(
209+
'--format',
210+
'-f',
211+
'fmt',
212+
default=None,
213+
type=click.Choice(['simple', 'table', 'csv']),
214+
help=(
215+
"Output format. Defaults to the value of "
216+
"'git config pw.format' else 'table'."
217+
),
218+
)(f)
198219

199220
if headers:
200-
f = click.option('--column', '-c', 'headers', metavar='COLUMN',
201-
multiple=True, default=headers,
202-
type=click.Choice(headers),
203-
help='Columns to be included in output.')(f)
221+
f = click.option(
222+
'--column',
223+
'-c',
224+
'headers',
225+
metavar='COLUMN',
226+
multiple=True,
227+
default=headers,
228+
type=click.Choice(headers),
229+
help='Columns to be included in output.',
230+
)(f)
204231
return f
205232

206233
if original_function:

0 commit comments

Comments
 (0)