Skip to content

Commit 420c013

Browse files
committed
style: parens should indent the same as their opening line
1 parent 53f00a0 commit 420c013

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+164
-166
lines changed

ci/comment_on_fixes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
comment = (
1414
f"This is now released as part of [coverage {version}]" +
1515
f"(https://pypi.org/project/coverage/{version})."
16-
)
16+
)
1717
print(f"Comment will be: {comment}")
1818

1919
owner = "nedbat"

coverage/cmdline.py

+11-13
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,7 @@ class CoverageOptionParser(optparse.OptionParser):
232232
"""
233233

234234
def __init__(self, *args, **kwargs):
235-
super().__init__(
236-
add_help_option=False, *args, **kwargs
237-
)
235+
super().__init__(add_help_option=False, *args, **kwargs)
238236
self.set_defaults(
239237
# Keep these arguments alphabetized by their names.
240238
action=None,
@@ -267,7 +265,7 @@ def __init__(self, *args, **kwargs):
267265
timid=None,
268266
title=None,
269267
version=None,
270-
)
268+
)
271269

272270
self.disable_interspersed_args()
273271

@@ -352,7 +350,7 @@ def get_prog_name(self):
352350
Opts.debug,
353351
Opts.help,
354352
Opts.rcfile,
355-
]
353+
]
356354

357355
COMMANDS = {
358356
'annotate': CmdOptionParser(
@@ -473,7 +471,7 @@ def get_prog_name(self):
473471
Opts.output_lcov,
474472
Opts.omit,
475473
Opts.quiet,
476-
] + GLOBAL_ARGS,
474+
] + GLOBAL_ARGS,
477475
usage="[options] [modules]",
478476
description="Generate an LCOV report of coverage results.",
479477
),
@@ -648,7 +646,7 @@ def command_line(self, argv):
648646
check_preimported=True,
649647
context=options.context,
650648
messages=not options.quiet,
651-
)
649+
)
652650

653651
if options.action == "debug":
654652
return self.do_debug(args)
@@ -675,7 +673,7 @@ def command_line(self, argv):
675673
omit=omit,
676674
include=include,
677675
contexts=contexts,
678-
)
676+
)
679677

680678
# We need to be able to import from the current directory, because
681679
# plugins may try to, for example, to read Django settings.
@@ -692,7 +690,7 @@ def command_line(self, argv):
692690
skip_empty=options.skip_empty,
693691
sort=options.sort,
694692
**report_args
695-
)
693+
)
696694
elif options.action == "annotate":
697695
self.coverage.annotate(directory=options.directory, **report_args)
698696
elif options.action == "html":
@@ -704,25 +702,25 @@ def command_line(self, argv):
704702
show_contexts=options.show_contexts,
705703
title=options.title,
706704
**report_args
707-
)
705+
)
708706
elif options.action == "xml":
709707
total = self.coverage.xml_report(
710708
outfile=options.outfile,
711709
skip_empty=options.skip_empty,
712710
**report_args
713-
)
711+
)
714712
elif options.action == "json":
715713
total = self.coverage.json_report(
716714
outfile=options.outfile,
717715
pretty_print=options.pretty_print,
718716
show_contexts=options.show_contexts,
719717
**report_args
720-
)
718+
)
721719
elif options.action == "lcov":
722720
total = self.coverage.lcov_report(
723721
outfile=options.outfile,
724722
**report_args
725-
)
723+
)
726724
else:
727725
# There are no other possible actions.
728726
raise AssertionError

coverage/config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ def debug_info(self):
499499
"""Make a list of (name, value) pairs for writing debug info."""
500500
return human_sorted_items(
501501
(k, v) for k, v in self.__dict__.items() if not k.startswith("_")
502-
)
502+
)
503503

504504

505505
def config_files_to_try(config_file):

coverage/control.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def __init__(
250250
source=source, source_pkgs=source_pkgs, run_omit=omit, run_include=include, debug=debug,
251251
report_omit=omit, report_include=include,
252252
concurrency=concurrency, context=context,
253-
)
253+
)
254254

255255
# If we have sub-process measurement happening automatically, then we
256256
# want any explicit creation of a Coverage object to mean, this process
@@ -489,7 +489,7 @@ def _init_for_start(self):
489489
branch=self.config.branch,
490490
warn=self._warn,
491491
concurrency=concurrency,
492-
)
492+
)
493493

494494
suffix = self._data_suffix_specified
495495
if suffix:
@@ -515,10 +515,10 @@ def _init_for_start(self):
515515
", ".join(
516516
plugin._coverage_plugin_name
517517
for plugin in self._plugins.file_tracers
518-
),
518+
),
519519
self._collector.tracer_name(),
520-
)
521520
)
521+
)
522522
for plugin in self._plugins.file_tracers:
523523
plugin._coverage_enabled = False
524524

@@ -835,7 +835,7 @@ def analysis2(self, morf):
835835
sorted(analysis.excluded),
836836
sorted(analysis.missing),
837837
analysis.missing_formatted(),
838-
)
838+
)
839839

840840
def _analyze(self, it):
841841
"""Analyze a single morf or code unit.
@@ -1146,7 +1146,7 @@ def plugin_info(plugins):
11461146
)
11471147
)),
11481148
('command_line', " ".join(getattr(sys, 'argv', ['-none-']))),
1149-
]
1149+
]
11501150

11511151
if self._inorout:
11521152
info.extend(self._inorout.sys_info())

coverage/debug.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def __repr__(self):
211211
klass=self.__class__.__name__,
212212
id=id(self),
213213
attrs=" ".join(f"{k}={v!r}" for k, v in show_attrs),
214-
)
214+
)
215215

216216

217217
def simplify(v): # pragma: debugging

coverage/html.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def __init__(self, cov):
188188
'mis': 'mis show_mis',
189189
'par': 'par run show_par',
190190
'run': 'run',
191-
}
191+
},
192192
}
193193
self.pyfile_html_source = read_data("pyfile.html")
194194
self.source_tmpl = Templite(self.pyfile_html_source, self.template_globals)
@@ -292,7 +292,7 @@ def html_file(self, fr, analysis):
292292
ldata.annotate = ",   ".join(
293293
f"{ldata.number} ↛ {d}"
294294
for d in ldata.short_annotations
295-
)
295+
)
296296
else:
297297
ldata.annotate = None
298298

@@ -306,7 +306,7 @@ def html_file(self, fr, analysis):
306306
", ".join(
307307
f"{num:d}) {ann_long}"
308308
for num, ann_long in enumerate(longs, start=1)
309-
),
309+
),
310310
)
311311
else:
312312
ldata.annotate_long = None

coverage/inorout.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ def sys_info(self):
591591
'source_match', 'source_pkgs_match',
592592
'include_match', 'omit_match',
593593
'cover_match', 'pylib_match', 'third_match',
594-
]
594+
]
595595

596596
for matcher_name in matcher_names:
597597
matcher = getattr(self, matcher_name)

coverage/jsonreport.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def report(self, morfs, outfile=None):
7070
json.dump(
7171
self.report_data,
7272
outfile,
73-
indent=4 if self.config.json_pretty_print else None
73+
indent=(4 if self.config.json_pretty_print else None),
7474
)
7575

7676
return self.total.n_statements and self.total.pc_covered

coverage/misc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def _needs_to_implement(that, func_name):
272272

273273
raise NotImplementedError(
274274
f"{thing} {name!r} needs to implement {func_name}()"
275-
)
275+
)
276276

277277

278278
class DefaultValue:

coverage/parser.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1231,15 +1231,15 @@ def _handle__With(self, node):
12311231
if with_block.break_from:
12321232
self.process_break_exits(
12331233
self._combine_finally_starts(with_block.break_from, with_exit)
1234-
)
1234+
)
12351235
if with_block.continue_from:
12361236
self.process_continue_exits(
12371237
self._combine_finally_starts(with_block.continue_from, with_exit)
1238-
)
1238+
)
12391239
if with_block.return_from:
12401240
self.process_return_exits(
12411241
self._combine_finally_starts(with_block.return_from, with_exit)
1242-
)
1242+
)
12431243
return exits
12441244

12451245
_handle__AsyncWith = _handle__With

coverage/phystokens.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def phys_tokens(toks):
6060
99999, "\\\n",
6161
(slineno, ccol), (slineno, ccol+2),
6262
last_line
63-
)
63+
)
6464
last_line = ltext
6565
if ttype not in (tokenize.NEWLINE, tokenize.NL):
6666
last_ttext = ttext

coverage/python.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ def translate_arcs(self, arcs):
202202
def no_branch_lines(self):
203203
no_branch = self.parser.lines_matching(
204204
join_regex(self.coverage.config.partial_list),
205-
join_regex(self.coverage.config.partial_always_list)
206-
)
205+
join_regex(self.coverage.config.partial_always_list),
206+
)
207207
return no_branch
208208

209209
@expensive

coverage/results.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,10 @@ def __add__(self, other):
271271
nums.n_branches = self.n_branches + other.n_branches
272272
nums.n_partial_branches = (
273273
self.n_partial_branches + other.n_partial_branches
274-
)
274+
)
275275
nums.n_missing_branches = (
276276
self.n_missing_branches + other.n_missing_branches
277-
)
277+
)
278278
return nums
279279

280280
def __radd__(self, other):

coverage/sqldata.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ def update(self, other_data, aliases=None):
643643
"from line_bits " +
644644
"inner join file on file.id = line_bits.file_id " +
645645
"inner join context on context.id = line_bits.context_id"
646-
)
646+
)
647647
lines = {(files[path], context): numbits for (path, context, numbits) in cur}
648648
cur.close()
649649

@@ -720,7 +720,7 @@ def update(self, other_data, aliases=None):
720720
"from line_bits " +
721721
"inner join file on file.id = line_bits.file_id " +
722722
"inner join context on context.id = line_bits.context_id"
723-
)
723+
)
724724
for path, context, numbits in cur:
725725
key = (aliases.map(path), context)
726726
if key in lines:
@@ -977,7 +977,7 @@ def contexts_by_lineno(self, filename):
977977
"select l.numbits, c.context from line_bits l, context c " +
978978
"where l.context_id = c.id " +
979979
"and file_id = ?"
980-
)
980+
)
981981
data = [file_id]
982982
if self._query_context_ids is not None:
983983
ids_array = ", ".join("?" * len(self._query_context_ids))

coverage/summary.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,11 @@ def report(self, morfs, outfile=None):
127127
if self.config.skip_covered and self.skipped_count:
128128
self.writeout(
129129
fmt_skip_covered % (self.skipped_count, 's' if self.skipped_count > 1 else '')
130-
)
130+
)
131131
if self.config.skip_empty and self.empty_count:
132132
self.writeout(
133133
fmt_skip_empty % (self.empty_count, 's' if self.empty_count > 1 else '')
134-
)
134+
)
135135

136136
return self.total.n_statements and self.total.pc_covered
137137

coverage/xmlreport.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def report(self, morfs, outfile=None):
6868
xcoverage.setAttribute("timestamp", str(int(time.time()*1000)))
6969
xcoverage.appendChild(self.xml_out.createComment(
7070
f" Generated by coverage.py: {__url__} "
71-
))
71+
))
7272
xcoverage.appendChild(self.xml_out.createComment(f" Based on {DTD_URL} "))
7373

7474
# Call xml_file for each file in the data.
@@ -193,7 +193,7 @@ def xml_file(self, fr, analysis, has_arcs):
193193
xline.setAttribute(
194194
"condition-coverage",
195195
"%d%% (%d/%d)" % (100*taken//total, taken, total)
196-
)
196+
)
197197
if line in missing_branch_arcs:
198198
annlines = ["exit" if b < 0 else str(b) for b in missing_branch_arcs[line]]
199199
xline.setAttribute("missing-branches", ",".join(annlines))

doc/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119

120120
intersphinx_mapping = {
121121
'python': ('https://docs.python.org/3', None),
122-
}
122+
}
123123

124124
# -- Options for HTML output ---------------------------------------------------
125125

lab/goals.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def total_for_files(data, files):
4040
n_branches=sel_summ.get("num_branches", 0),
4141
n_partial_branches=sel_summ.get("num_partial_branches", 0),
4242
n_missing_branches=sel_summ.get("missing_branches", 0),
43-
)
43+
)
4444

4545
return total
4646

lab/hack_pyc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def hack_line_numbers(code):
7171
code.co_argcount, code.co_nlocals, code.co_stacksize, code.co_flags,
7272
code.co_code, tuple(new_consts), code.co_names, code.co_varnames,
7373
code.co_filename, code.co_name, new_firstlineno, new_lnotab
74-
)
74+
)
7575

7676
return new_code
7777

lab/parser.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ def main(self, args):
2828
parser.add_option(
2929
"-d", action="store_true", dest="dis",
3030
help="Disassemble"
31-
)
31+
)
3232
parser.add_option(
3333
"-R", action="store_true", dest="recursive",
3434
help="Recurse to find source files"
35-
)
35+
)
3636
parser.add_option(
3737
"-s", action="store_true", dest="source",
3838
help="Show analyzed source"
39-
)
39+
)
4040
parser.add_option(
4141
"-t", action="store_true", dest="tokens",
4242
help="Show tokens"
43-
)
43+
)
4444

4545
options, args = parser.parse_args()
4646
if options.recursive:

lab/run_trace.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def trace(frame, event, arg):
2020
os.path.basename(frame.f_code.co_filename),
2121
frame.f_lineno,
2222
frame.f_lasti,
23-
))
23+
))
2424

2525
if event == 'call':
2626
nest += 1

0 commit comments

Comments
 (0)