summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ci/download_appveyor.py6
-rw-r--r--coverage/control.py2
-rw-r--r--coverage/debug.py8
-rw-r--r--coverage/files.py2
-rw-r--r--coverage/inorout.py2
-rw-r--r--coverage/parser.py38
-rw-r--r--coverage/python.py4
-rw-r--r--coverage/pytracer.py2
-rw-r--r--coverage/report.py2
-rw-r--r--coverage/summary.py2
-rw-r--r--igor.py2
-rw-r--r--lab/parser.py4
-rw-r--r--lab/platform_info.py4
-rw-r--r--perf/perf_measure.py2
-rw-r--r--setup.py2
-rw-r--r--tests/test_concurrency.py6
-rw-r--r--tests/test_data.py4
-rw-r--r--tests/test_html.py2
-rw-r--r--tests/test_oddball.py2
-rw-r--r--tests/test_plugins.py2
-rw-r--r--tests/test_process.py6
-rw-r--r--tests/test_xml.py6
22 files changed, 55 insertions, 55 deletions
diff --git a/ci/download_appveyor.py b/ci/download_appveyor.py
index 7cec413c..a3d81496 100644
--- a/ci/download_appveyor.py
+++ b/ci/download_appveyor.py
@@ -17,7 +17,7 @@ def make_auth_headers():
token = f.read().strip()
headers = {
- 'Authorization': 'Bearer {0}'.format(token),
+ 'Authorization': 'Bearer {}'.format(token),
}
return headers
@@ -50,7 +50,7 @@ def download_latest_artifacts(account_project):
for artifact in artifacts:
is_zip = artifact['type'] == "Zip"
filename = artifact['fileName']
- print(" {0}, {1} bytes".format(filename, artifact['size']))
+ print(" {}, {} bytes".format(filename, artifact['size']))
url = make_url(
"/buildjobs/{jobid}/artifacts/{filename}",
@@ -86,7 +86,7 @@ def unpack_zipfile(filename):
with open(filename, 'rb') as fzip:
z = zipfile.ZipFile(fzip)
for name in z.namelist():
- print(" extracting {0}".format(name))
+ print(" extracting {}".format(name))
ensure_dirs(name)
z.extract(name)
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:
diff --git a/igor.py b/igor.py
index 1bb7d19f..5d7828c3 100644
--- a/igor.py
+++ b/igor.py
@@ -218,7 +218,7 @@ def do_zip_mods():
(u'cp1252', u'“hi”'),
]
for encoding, text in details:
- filename = 'encoded_{0}.py'.format(encoding)
+ filename = 'encoded_{}.py'.format(encoding)
ords = [ord(c) for c in text]
source_text = source.format(encoding=encoding, text=text, ords=ords)
zf.writestr(filename, source_text.encode(encoding))
diff --git a/lab/parser.py b/lab/parser.py
index b3560506..bf203189 100644
--- a/lab/parser.py
+++ b/lab/parser.py
@@ -65,9 +65,9 @@ class ParserMain(object):
if options.histogram:
total = sum(opcode_counts.values())
- print("{0} total opcodes".format(total))
+ print("{} total opcodes".format(total))
for opcode, number in opcode_counts.most_common():
- print("{0:20s} {1:6d} {2:.1%}".format(opcode, number, number/total))
+ print("{:20s} {:6d} {:.1%}".format(opcode, number, number/total))
def one_file(self, options, filename):
"""Process just one file."""
diff --git a/lab/platform_info.py b/lab/platform_info.py
index 61e02dd2..7ddde47a 100644
--- a/lab/platform_info.py
+++ b/lab/platform_info.py
@@ -15,11 +15,11 @@ def whatever(f):
def dump_module(mod):
- print("\n### {0} ---------------------------".format(mod.__name__))
+ print("\n### {} ---------------------------".format(mod.__name__))
for name in dir(mod):
if name.startswith("_"):
continue
- print("{0:30s}: {1!r:.100}".format(name, whatever(getattr(mod, name))))
+ print("{:30s}: {!r:.100}".format(name, whatever(getattr(mod, name))))
for mod in [platform, sys]:
diff --git a/perf/perf_measure.py b/perf/perf_measure.py
index a8f2ffaa..b903567c 100644
--- a/perf/perf_measure.py
+++ b/perf/perf_measure.py
@@ -137,7 +137,7 @@ class StressTest(object):
yield kwargs['file_count'] * kwargs['call_count'] * kwargs['line_count']
ops = sum(sum(operations(thing)) for thing in ["file", "call", "line"])
- print("{0:.1f}M operations".format(ops/1e6))
+ print("{:.1f}M operations".format(ops/1e6))
def check_coefficients(self):
# For checking the calculation of actual stats:
diff --git a/setup.py b/setup.py
index a964412c..b1d086be 100644
--- a/setup.py
+++ b/setup.py
@@ -98,7 +98,7 @@ setup_args = dict(
# We need to get HTML assets from our htmlfiles directory.
zip_safe=False,
- author='Ned Batchelder and {0} others'.format(num_others),
+ author='Ned Batchelder and {} others'.format(num_others),
author_email='ned@nedbatchelder.com',
description=doc,
long_description=long_description,
diff --git a/tests/test_concurrency.py b/tests/test_concurrency.py
index bcf61942..9d777afe 100644
--- a/tests/test_concurrency.py
+++ b/tests/test_concurrency.py
@@ -69,7 +69,7 @@ def line_count(s):
def print_simple_annotation(code, linenos):
"""Print the lines in `code` with X for each line number in `linenos`."""
for lineno, line in enumerate(code.splitlines(), start=1):
- print(" {0} {1}".format("X" if lineno in linenos else " ", line))
+ print(" {} {}".format("X" if lineno in linenos else " ", line))
class LineCountTest(CoverageTest):
@@ -242,7 +242,7 @@ class ConcurrencyTest(CoverageTest):
# If the test fails, it's helpful to see this info:
fname = abs_file("try_it.py")
linenos = data.lines(fname)
- print("{0}: {1}".format(len(linenos), linenos))
+ print("{}: {}".format(len(linenos), linenos))
print_simple_annotation(code, linenos)
lines = line_count(code)
@@ -500,7 +500,7 @@ def test_thread_safe_save_data(tmpdir):
# Create some Python modules and put them in the path
modules_dir = tmpdir.mkdir('test_modules')
- module_names = ["m{0:03d}".format(i) for i in range(1000)]
+ module_names = ["m{:03d}".format(i) for i in range(1000)]
for module_name in module_names:
modules_dir.join(module_name + ".py").write("def f(): pass\n")
diff --git a/tests/test_data.py b/tests/test_data.py
index ff97b330..e09aaf44 100644
--- a/tests/test_data.py
+++ b/tests/test_data.py
@@ -556,7 +556,7 @@ class CoverageDataTestInTempDir(DataTestHelpers, CoverageTest):
with sqlite3.connect("wrong_schema.db") as con:
con.execute("create table coverage_schema (version integer)")
con.execute("insert into coverage_schema (version) values (99)")
- msg = r"Couldn't .* '.*[/\\]{0}': wrong schema: 99 instead of \d+".format("wrong_schema.db")
+ msg = r"Couldn't .* '.*[/\\]{}': wrong schema: 99 instead of \d+".format("wrong_schema.db")
with self.assertRaisesRegex(CoverageException, msg):
covdata = CoverageData("wrong_schema.db")
covdata.read()
@@ -564,7 +564,7 @@ class CoverageDataTestInTempDir(DataTestHelpers, CoverageTest):
with sqlite3.connect("no_schema.db") as con:
con.execute("create table foobar (baz text)")
- msg = r"Couldn't .* '.*[/\\]{0}': \S+".format("no_schema.db")
+ msg = r"Couldn't .* '.*[/\\]{}': \S+".format("no_schema.db")
with self.assertRaisesRegex(CoverageException, msg):
covdata = CoverageData("no_schema.db")
covdata.read()
diff --git a/tests/test_html.py b/tests/test_html.py
index 3e567113..d30279a5 100644
--- a/tests/test_html.py
+++ b/tests/test_html.py
@@ -87,7 +87,7 @@ class HtmlTestHelpers(CoverageTest):
self.assert_recent_datetime(
timestamp,
seconds=120,
- msg="Timestamp is wrong: {0}".format(timestamp),
+ msg="Timestamp is wrong: {}".format(timestamp),
)
diff --git a/tests/test_oddball.py b/tests/test_oddball.py
index 1087ea57..3574806c 100644
--- a/tests/test_oddball.py
+++ b/tests/test_oddball.py
@@ -541,7 +541,7 @@ class ExecTest(CoverageTest):
# but now it's fixed. :)
self.make_file("to_exec.py", """\
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
- print("var is {0}".format(var)) # line 31
+ print("var is {}".format(var)) # line 31
""")
self.make_file("main.py", """\
namespace = {'var': 17}
diff --git a/tests/test_plugins.py b/tests/test_plugins.py
index a4c7a5ee..416f05a2 100644
--- a/tests/test_plugins.py
+++ b/tests/test_plugins.py
@@ -321,7 +321,7 @@ class GoodFileTracerTest(FileTracerTest):
# will examine the `filename` and `linenum` locals to
# determine the source file and line number.
fiddle_around = 1 # not used, just chaff.
- return "[{0} @ {1}]".format(filename, linenum)
+ return "[{} @ {}]".format(filename, linenum)
def helper(x):
# This function is here just to show that not all code in
diff --git a/tests/test_process.py b/tests/test_process.py
index 000330ad..be7ae446 100644
--- a/tests/test_process.py
+++ b/tests/test_process.py
@@ -164,7 +164,7 @@ class ProcessTest(CoverageTest):
self.assertEqual(status, 1)
for n in "12":
- self.assert_exists(".coverage.bad{0}".format(n))
+ self.assert_exists(".coverage.bad{}".format(n))
warning_regex = (
r"(" # JSON message:
r"Coverage.py warning: Couldn't read data from '.*\.coverage\.bad{0}': "
@@ -1345,7 +1345,7 @@ def possible_pth_dirs():
def find_writable_pth_directory():
"""Find a place to write a .pth file."""
for pth_dir in possible_pth_dirs(): # pragma: part covered
- try_it = os.path.join(pth_dir, "touch_{0}.it".format(WORKER))
+ try_it = os.path.join(pth_dir, "touch_{}.it".format(WORKER))
with open(try_it, "w") as f:
try:
f.write("foo")
@@ -1370,7 +1370,7 @@ class ProcessCoverageMixin(object):
# Create the .pth file.
self.assertTrue(PTH_DIR)
pth_contents = "import coverage; coverage.process_startup()\n"
- pth_path = os.path.join(PTH_DIR, "subcover_{0}.pth".format(WORKER))
+ pth_path = os.path.join(PTH_DIR, "subcover_{}.pth".format(WORKER))
with open(pth_path, "w") as pth:
pth.write(pth_contents)
self.pth_path = pth_path
diff --git a/tests/test_xml.py b/tests/test_xml.py
index 09ab2f85..658a6ab6 100644
--- a/tests/test_xml.py
+++ b/tests/test_xml.py
@@ -51,13 +51,13 @@ class XmlTestHelpers(CoverageTest):
return os.path.join(curdir, p)
for i in range(width):
- next_dir = here("d{0}".format(i))
+ next_dir = here("d{}".format(i))
self.make_tree(width, depth-1, next_dir)
if curdir != ".":
self.make_file(here("__init__.py"), "")
for i in range(width):
- filename = here("f{0}.py".format(i))
- self.make_file(filename, "# {0}\n".format(filename))
+ filename = here("f{}.py".format(i))
+ self.make_file(filename, "# {}\n".format(filename))
def assert_source(self, xmldom, src):
"""Assert that the XML has a <source> element with `src`."""