diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2019-09-01 18:20:32 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2019-09-01 18:20:32 -0400 |
commit | ada27a855934588cf753f8712bd72d41eadb1058 (patch) | |
tree | 5666295cdd896f9e3810a5467a4e9fac8b76ae0a /coverage | |
parent | 6ac3ca707457c62c16470c805fc5fa4e38fd59eb (diff) | |
download | python-coveragepy-git-ada27a855934588cf753f8712bd72d41eadb1058.tar.gz |
No need for format indexes (mostly)
Diffstat (limited to 'coverage')
-rw-r--r-- | coverage/control.py | 2 | ||||
-rw-r--r-- | coverage/debug.py | 8 | ||||
-rw-r--r-- | coverage/files.py | 2 | ||||
-rw-r--r-- | coverage/inorout.py | 2 | ||||
-rw-r--r-- | coverage/parser.py | 38 | ||||
-rw-r--r-- | coverage/python.py | 4 | ||||
-rw-r--r-- | coverage/pytracer.py | 2 | ||||
-rw-r--r-- | coverage/report.py | 2 | ||||
-rw-r--r-- | coverage/summary.py | 2 |
9 files changed, 31 insertions, 31 deletions
diff --git a/coverage/control.py b/coverage/control.py index 8cba6c38..d5988456 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -486,7 +486,7 @@ class Coverage(object): def _atexit(self): """Clean up on process shutdown.""" if self._debug.should("process"): - self._debug.write("atexit: {0!r}".format(self)) + self._debug.write("atexit: {!r}".format(self)) if self._started: self.stop() if self._auto_save: diff --git a/coverage/debug.py b/coverage/debug.py index 29e4977f..6e6b1df1 100644 --- a/coverage/debug.py +++ b/coverage/debug.py @@ -101,7 +101,7 @@ class NoDebugging(object): def info_header(label): """Make a nice header string.""" - return "--{0:-<60s}".format(" "+label+" ") + return "--{:-<60s}".format(" "+label+" ") def info_formatter(info): @@ -174,8 +174,8 @@ def short_id(id64): def add_pid_and_tid(text): """A filter to add pid and tid to debug messages.""" # Thread ids are useful, but too long. Make a shorter one. - tid = "{0:04x}".format(short_id(_thread.get_ident())) - text = "{0:5d}.{1}: {2}".format(os.getpid(), tid, text) + tid = "{:04x}".format(short_id(_thread.get_ident())) + text = "{:5d}.{}: {}".format(os.getpid(), tid, text) return text @@ -241,7 +241,7 @@ class CwdTracker(object): # pragma: debugging """Add a cwd message for each new cwd.""" cwd = os.getcwd() if cwd != self.cwd: - text = "cwd is now {0!r}\n".format(cwd) + text + text = "cwd is now {!r}\n".format(cwd) + text self.cwd = cwd return text diff --git a/coverage/files.py b/coverage/files.py index d9495912..dc8c248f 100644 --- a/coverage/files.py +++ b/coverage/files.py @@ -338,7 +338,7 @@ class PathAliases(object): def pprint(self): # pragma: debugging """Dump the important parts of the PathAliases, for debugging.""" for regex, result in self.aliases: - print("{0!r} --> {1!r}".format(regex.pattern, result)) + print("{!r} --> {!r}".format(regex.pattern, result)) def add(self, pattern, result): """Add the `pattern`/`result` pair to the list of aliases. diff --git a/coverage/inorout.py b/coverage/inorout.py index 3e0613a3..c31e9206 100644 --- a/coverage/inorout.py +++ b/coverage/inorout.py @@ -358,7 +358,7 @@ class InOrOut(object): disp = self.should_trace(filename) if disp.trace: - msg = "Already imported a file that will be measured: {0}".format(filename) + msg = "Already imported a file that will be measured: {}".format(filename) self.warn(msg, slug="already-imported") warned.add(filename) diff --git a/coverage/parser.py b/coverage/parser.py index c2c58a8c..12c2d0a5 100644 --- a/coverage/parser.py +++ b/coverage/parser.py @@ -521,8 +521,8 @@ class AstArcAnalyzer(object): if AST_DUMP: # pragma: debugging # Dump the AST so that failing tests have helpful output. - print("Statements: {0}".format(self.statements)) - print("Multiline map: {0}".format(self.multiline)) + print("Statements: {}".format(self.statements)) + print("Multiline map: {}".format(self.multiline)) ast_dump(self.root_node) self.arcs = set() @@ -653,7 +653,7 @@ class AstArcAnalyzer(object): # to see if it's overlooked. if 0: if node_name not in self.OK_TO_DEFAULT: - print("*** Unhandled: {0}".format(node)) + print("*** Unhandled: {}".format(node)) # Default for simple statements: one exit from this node. return set([ArcStart(self.line_for_node(node))]) @@ -823,7 +823,7 @@ class AstArcAnalyzer(object): for xit in exits: self.add_arc( xit.lineno, -block.start, xit.cause, - "didn't except from function '{0}'".format(block.name), + "didn't except from function {!r}".format(block.name), ) break @@ -838,7 +838,7 @@ class AstArcAnalyzer(object): for xit in exits: self.add_arc( xit.lineno, -block.start, xit.cause, - "didn't return from function '{0}'".format(block.name), + "didn't return from function {!r}".format(block.name), ) break @@ -1161,17 +1161,17 @@ class AstArcAnalyzer(object): for xit in exits: self.add_arc( xit.lineno, -start, xit.cause, - "didn't exit the body of class '{0}'".format(node.name), + "didn't exit the body of class {!r}".format(node.name), ) def _make_oneline_code_method(noun): # pylint: disable=no-self-argument """A function to make methods for online callable _code_object__ methods.""" def _code_object__oneline_callable(self, node): start = self.line_for_node(node) - self.add_arc(-start, start, None, "didn't run the {0} on line {1}".format(noun, start)) + self.add_arc(-start, start, None, "didn't run the {} on line {}".format(noun, start)) self.add_arc( start, -start, None, - "didn't finish the {0} on line {1}".format(noun, start), + "didn't finish the {} on line {}".format(noun, start), ) return _code_object__oneline_callable @@ -1203,15 +1203,15 @@ if AST_DUMP: # pragma: debugging """ indent = " " * depth if not isinstance(node, ast.AST): - print("{0}<{1} {2!r}>".format(indent, node.__class__.__name__, node)) + print("{}<{} {!r}>".format(indent, node.__class__.__name__, node)) return lineno = getattr(node, "lineno", None) if lineno is not None: - linemark = " @ {0}".format(node.lineno) + linemark = " @ {}".format(node.lineno) else: linemark = "" - head = "{0}<{1}{2}".format(indent, node.__class__.__name__, linemark) + head = "{}<{}{}".format(indent, node.__class__.__name__, linemark) named_fields = [ (name, value) @@ -1219,28 +1219,28 @@ if AST_DUMP: # pragma: debugging if name not in SKIP_DUMP_FIELDS ] if not named_fields: - print("{0}>".format(head)) + print("{}>".format(head)) elif len(named_fields) == 1 and _is_simple_value(named_fields[0][1]): field_name, value = named_fields[0] - print("{0} {1}: {2!r}>".format(head, field_name, value)) + print("{} {}: {!r}>".format(head, field_name, value)) else: print(head) if 0: - print("{0}# mro: {1}".format( + print("{}# mro: {}".format( indent, ", ".join(c.__name__ for c in node.__class__.__mro__[1:]), )) next_indent = indent + " " for field_name, value in named_fields: - prefix = "{0}{1}:".format(next_indent, field_name) + prefix = "{}{}:".format(next_indent, field_name) if _is_simple_value(value): - print("{0} {1!r}".format(prefix, value)) + print("{} {!r}".format(prefix, value)) elif isinstance(value, list): - print("{0} [".format(prefix)) + print("{} [".format(prefix)) for n in value: ast_dump(n, depth + 8) - print("{0}]".format(next_indent)) + print("{}]".format(next_indent)) else: print(prefix) ast_dump(value, depth + 8) - print("{0}>".format(indent)) + print("{}>".format(indent)) diff --git a/coverage/python.py b/coverage/python.py index 31db1a27..ed467e61 100644 --- a/coverage/python.py +++ b/coverage/python.py @@ -136,7 +136,7 @@ def source_for_morf(morf): elif isinstance(morf, types.ModuleType): # A module should have had .__file__, otherwise we can't use it. # This could be a PEP-420 namespace package. - raise CoverageException("Module {0} has no file".format(morf)) + raise CoverageException("Module {} has no file".format(morf)) else: filename = morf @@ -170,7 +170,7 @@ class PythonFileReporter(FileReporter): self._excluded = None def __repr__(self): - return "<PythonFileReporter {0!r}>".format(self.filename) + return "<PythonFileReporter {!r}>".format(self.filename) @contract(returns='unicode') def relative_filename(self): diff --git a/coverage/pytracer.py b/coverage/pytracer.py index 4ffe41e3..e64d7f55 100644 --- a/coverage/pytracer.py +++ b/coverage/pytracer.py @@ -60,7 +60,7 @@ class PyTracer(object): atexit.register(setattr, self, 'in_atexit', True) def __repr__(self): - return "<PyTracer at {0}: {1} lines in {2} files>".format( + return "<PyTracer at {}: {} lines in {} files>".format( id(self), sum(len(v) for v in self.data.values()), len(self.data), diff --git a/coverage/report.py b/coverage/report.py index d24dddc8..f58de8d2 100644 --- a/coverage/report.py +++ b/coverage/report.py @@ -78,7 +78,7 @@ def get_analysis_to_report(coverage, morfs): # should_be_python() method. if fr.should_be_python(): if config.ignore_errors: - msg = "Could not parse Python file {0}".format(fr.filename) + msg = "Could not parse Python file {!r}".format(fr.filename) coverage._warn(msg, slug="couldnt-parse") else: raise diff --git a/coverage/summary.py b/coverage/summary.py index 72d21033..08c8a947 100644 --- a/coverage/summary.py +++ b/coverage/summary.py @@ -104,7 +104,7 @@ class SummaryReporter(object): if getattr(self.config, 'sort', None): position = column_order.get(self.config.sort.lower()) if position is None: - raise CoverageException("Invalid sorting option: {0!r}".format(self.config.sort)) + raise CoverageException("Invalid sorting option: {!r}".format(self.config.sort)) lines.sort(key=lambda l: (l[1][position], l[0])) for line in lines: |