diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2022-05-01 08:16:06 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2022-05-01 13:00:38 -0400 |
commit | 420c01394a31415d7a7cbb80be196bcfca48482c (patch) | |
tree | d71672faede9de984c024eadc678ae05ff5af558 /coverage | |
parent | 53f00a00b7cfb5e856136ea600844160746d6ae2 (diff) | |
download | python-coveragepy-git-420c01394a31415d7a7cbb80be196bcfca48482c.tar.gz |
style: parens should indent the same as their opening line
Diffstat (limited to 'coverage')
-rw-r--r-- | coverage/cmdline.py | 24 | ||||
-rw-r--r-- | coverage/config.py | 2 | ||||
-rw-r--r-- | coverage/control.py | 12 | ||||
-rw-r--r-- | coverage/debug.py | 2 | ||||
-rw-r--r-- | coverage/html.py | 6 | ||||
-rw-r--r-- | coverage/inorout.py | 2 | ||||
-rw-r--r-- | coverage/jsonreport.py | 2 | ||||
-rw-r--r-- | coverage/misc.py | 2 | ||||
-rw-r--r-- | coverage/parser.py | 6 | ||||
-rw-r--r-- | coverage/phystokens.py | 2 | ||||
-rw-r--r-- | coverage/python.py | 4 | ||||
-rw-r--r-- | coverage/results.py | 4 | ||||
-rw-r--r-- | coverage/sqldata.py | 6 | ||||
-rw-r--r-- | coverage/summary.py | 4 | ||||
-rw-r--r-- | coverage/xmlreport.py | 4 |
15 files changed, 40 insertions, 42 deletions
diff --git a/coverage/cmdline.py b/coverage/cmdline.py index 0c44378a..dbf66e0a 100644 --- a/coverage/cmdline.py +++ b/coverage/cmdline.py @@ -232,9 +232,7 @@ class CoverageOptionParser(optparse.OptionParser): """ def __init__(self, *args, **kwargs): - super().__init__( - add_help_option=False, *args, **kwargs - ) + super().__init__(add_help_option=False, *args, **kwargs) self.set_defaults( # Keep these arguments alphabetized by their names. action=None, @@ -267,7 +265,7 @@ class CoverageOptionParser(optparse.OptionParser): timid=None, title=None, version=None, - ) + ) self.disable_interspersed_args() @@ -352,7 +350,7 @@ GLOBAL_ARGS = [ Opts.debug, Opts.help, Opts.rcfile, - ] +] COMMANDS = { 'annotate': CmdOptionParser( @@ -473,7 +471,7 @@ COMMANDS = { Opts.output_lcov, Opts.omit, Opts.quiet, - ] + GLOBAL_ARGS, + ] + GLOBAL_ARGS, usage="[options] [modules]", description="Generate an LCOV report of coverage results.", ), @@ -648,7 +646,7 @@ class CoverageScript: check_preimported=True, context=options.context, messages=not options.quiet, - ) + ) if options.action == "debug": return self.do_debug(args) @@ -675,7 +673,7 @@ class CoverageScript: omit=omit, include=include, contexts=contexts, - ) + ) # We need to be able to import from the current directory, because # plugins may try to, for example, to read Django settings. @@ -692,7 +690,7 @@ class CoverageScript: skip_empty=options.skip_empty, sort=options.sort, **report_args - ) + ) elif options.action == "annotate": self.coverage.annotate(directory=options.directory, **report_args) elif options.action == "html": @@ -704,25 +702,25 @@ class CoverageScript: show_contexts=options.show_contexts, title=options.title, **report_args - ) + ) elif options.action == "xml": total = self.coverage.xml_report( outfile=options.outfile, skip_empty=options.skip_empty, **report_args - ) + ) elif options.action == "json": total = self.coverage.json_report( outfile=options.outfile, pretty_print=options.pretty_print, show_contexts=options.show_contexts, **report_args - ) + ) elif options.action == "lcov": total = self.coverage.lcov_report( outfile=options.outfile, **report_args - ) + ) else: # There are no other possible actions. raise AssertionError diff --git a/coverage/config.py b/coverage/config.py index fbfb59f4..1571c017 100644 --- a/coverage/config.py +++ b/coverage/config.py @@ -499,7 +499,7 @@ class CoverageConfig: """Make a list of (name, value) pairs for writing debug info.""" return human_sorted_items( (k, v) for k, v in self.__dict__.items() if not k.startswith("_") - ) + ) def config_files_to_try(config_file): diff --git a/coverage/control.py b/coverage/control.py index 910cfb08..6387d0dd 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -250,7 +250,7 @@ class Coverage: source=source, source_pkgs=source_pkgs, run_omit=omit, run_include=include, debug=debug, report_omit=omit, report_include=include, concurrency=concurrency, context=context, - ) + ) # If we have sub-process measurement happening automatically, then we # want any explicit creation of a Coverage object to mean, this process @@ -489,7 +489,7 @@ class Coverage: branch=self.config.branch, warn=self._warn, concurrency=concurrency, - ) + ) suffix = self._data_suffix_specified if suffix: @@ -515,10 +515,10 @@ class Coverage: ", ".join( plugin._coverage_plugin_name for plugin in self._plugins.file_tracers - ), + ), self._collector.tracer_name(), - ) ) + ) for plugin in self._plugins.file_tracers: plugin._coverage_enabled = False @@ -835,7 +835,7 @@ class Coverage: sorted(analysis.excluded), sorted(analysis.missing), analysis.missing_formatted(), - ) + ) def _analyze(self, it): """Analyze a single morf or code unit. @@ -1146,7 +1146,7 @@ class Coverage: ) )), ('command_line', " ".join(getattr(sys, 'argv', ['-none-']))), - ] + ] if self._inorout: info.extend(self._inorout.sys_info()) diff --git a/coverage/debug.py b/coverage/debug.py index 8c5e3839..7ec3ae42 100644 --- a/coverage/debug.py +++ b/coverage/debug.py @@ -211,7 +211,7 @@ class SimpleReprMixin: klass=self.__class__.__name__, id=id(self), attrs=" ".join(f"{k}={v!r}" for k, v in show_attrs), - ) + ) def simplify(v): # pragma: debugging diff --git a/coverage/html.py b/coverage/html.py index 342d2ad1..e18a30a1 100644 --- a/coverage/html.py +++ b/coverage/html.py @@ -188,7 +188,7 @@ class HtmlReporter: 'mis': 'mis show_mis', 'par': 'par run show_par', 'run': 'run', - } + }, } self.pyfile_html_source = read_data("pyfile.html") self.source_tmpl = Templite(self.pyfile_html_source, self.template_globals) @@ -292,7 +292,7 @@ class HtmlReporter: ldata.annotate = ", ".join( f"{ldata.number} ↛ {d}" for d in ldata.short_annotations - ) + ) else: ldata.annotate = None @@ -306,7 +306,7 @@ class HtmlReporter: ", ".join( f"{num:d}) {ann_long}" for num, ann_long in enumerate(longs, start=1) - ), + ), ) else: ldata.annotate_long = None diff --git a/coverage/inorout.py b/coverage/inorout.py index 25943cb1..ec89d1b4 100644 --- a/coverage/inorout.py +++ b/coverage/inorout.py @@ -591,7 +591,7 @@ class InOrOut: 'source_match', 'source_pkgs_match', 'include_match', 'omit_match', 'cover_match', 'pylib_match', 'third_match', - ] + ] for matcher_name in matcher_names: matcher = getattr(self, matcher_name) diff --git a/coverage/jsonreport.py b/coverage/jsonreport.py index 75ba755d..43edc452 100644 --- a/coverage/jsonreport.py +++ b/coverage/jsonreport.py @@ -70,7 +70,7 @@ class JsonReporter: json.dump( self.report_data, outfile, - indent=4 if self.config.json_pretty_print else None + indent=(4 if self.config.json_pretty_print else None), ) return self.total.n_statements and self.total.pc_covered diff --git a/coverage/misc.py b/coverage/misc.py index aaf1bcf7..777cdc43 100644 --- a/coverage/misc.py +++ b/coverage/misc.py @@ -272,7 +272,7 @@ def _needs_to_implement(that, func_name): raise NotImplementedError( f"{thing} {name!r} needs to implement {func_name}()" - ) + ) class DefaultValue: diff --git a/coverage/parser.py b/coverage/parser.py index dc7c7404..60b6dc35 100644 --- a/coverage/parser.py +++ b/coverage/parser.py @@ -1231,15 +1231,15 @@ class AstArcAnalyzer: if with_block.break_from: self.process_break_exits( self._combine_finally_starts(with_block.break_from, with_exit) - ) + ) if with_block.continue_from: self.process_continue_exits( self._combine_finally_starts(with_block.continue_from, with_exit) - ) + ) if with_block.return_from: self.process_return_exits( self._combine_finally_starts(with_block.return_from, with_exit) - ) + ) return exits _handle__AsyncWith = _handle__With diff --git a/coverage/phystokens.py b/coverage/phystokens.py index b6b08d00..7184f160 100644 --- a/coverage/phystokens.py +++ b/coverage/phystokens.py @@ -60,7 +60,7 @@ def phys_tokens(toks): 99999, "\\\n", (slineno, ccol), (slineno, ccol+2), last_line - ) + ) last_line = ltext if ttype not in (tokenize.NEWLINE, tokenize.NL): last_ttext = ttext diff --git a/coverage/python.py b/coverage/python.py index 78c3e716..da43e6e8 100644 --- a/coverage/python.py +++ b/coverage/python.py @@ -202,8 +202,8 @@ class PythonFileReporter(FileReporter): def no_branch_lines(self): no_branch = self.parser.lines_matching( join_regex(self.coverage.config.partial_list), - join_regex(self.coverage.config.partial_always_list) - ) + join_regex(self.coverage.config.partial_always_list), + ) return no_branch @expensive diff --git a/coverage/results.py b/coverage/results.py index 9675bff9..79439fd9 100644 --- a/coverage/results.py +++ b/coverage/results.py @@ -271,10 +271,10 @@ class Numbers(SimpleReprMixin): nums.n_branches = self.n_branches + other.n_branches nums.n_partial_branches = ( self.n_partial_branches + other.n_partial_branches - ) + ) nums.n_missing_branches = ( self.n_missing_branches + other.n_missing_branches - ) + ) return nums def __radd__(self, other): diff --git a/coverage/sqldata.py b/coverage/sqldata.py index b3157a8a..aa4002a7 100644 --- a/coverage/sqldata.py +++ b/coverage/sqldata.py @@ -643,7 +643,7 @@ class CoverageData(SimpleReprMixin): "from line_bits " + "inner join file on file.id = line_bits.file_id " + "inner join context on context.id = line_bits.context_id" - ) + ) lines = {(files[path], context): numbits for (path, context, numbits) in cur} cur.close() @@ -720,7 +720,7 @@ class CoverageData(SimpleReprMixin): "from line_bits " + "inner join file on file.id = line_bits.file_id " + "inner join context on context.id = line_bits.context_id" - ) + ) for path, context, numbits in cur: key = (aliases.map(path), context) if key in lines: @@ -977,7 +977,7 @@ class CoverageData(SimpleReprMixin): "select l.numbits, c.context from line_bits l, context c " + "where l.context_id = c.id " + "and file_id = ?" - ) + ) data = [file_id] if self._query_context_ids is not None: ids_array = ", ".join("?" * len(self._query_context_ids)) diff --git a/coverage/summary.py b/coverage/summary.py index 467c601d..861fbc53 100644 --- a/coverage/summary.py +++ b/coverage/summary.py @@ -127,11 +127,11 @@ class SummaryReporter: if self.config.skip_covered and self.skipped_count: self.writeout( fmt_skip_covered % (self.skipped_count, 's' if self.skipped_count > 1 else '') - ) + ) if self.config.skip_empty and self.empty_count: self.writeout( fmt_skip_empty % (self.empty_count, 's' if self.empty_count > 1 else '') - ) + ) return self.total.n_statements and self.total.pc_covered diff --git a/coverage/xmlreport.py b/coverage/xmlreport.py index ebc85de4..2c34cb54 100644 --- a/coverage/xmlreport.py +++ b/coverage/xmlreport.py @@ -68,7 +68,7 @@ class XmlReporter: xcoverage.setAttribute("timestamp", str(int(time.time()*1000))) xcoverage.appendChild(self.xml_out.createComment( f" Generated by coverage.py: {__url__} " - )) + )) xcoverage.appendChild(self.xml_out.createComment(f" Based on {DTD_URL} ")) # Call xml_file for each file in the data. @@ -193,7 +193,7 @@ class XmlReporter: xline.setAttribute( "condition-coverage", "%d%% (%d/%d)" % (100*taken//total, taken, total) - ) + ) if line in missing_branch_arcs: annlines = ["exit" if b < 0 else str(b) for b in missing_branch_arcs[line]] xline.setAttribute("missing-branches", ",".join(annlines)) |