Skip to content

Commit b7be645

Browse files
committed
style: double quotes
1 parent 5a94109 commit b7be645

20 files changed

+230
-230
lines changed

coverage/config.py

+63-63
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ def getlist(self, section: str, option: str) -> List[str]:
114114
"""
115115
value_list = self.get(section, option)
116116
values = []
117-
for value_line in value_list.split('\n'):
118-
for value in value_line.split(','):
117+
for value_line in value_list.split("\n"):
118+
for value in value_line.split(","):
119119
value = value.strip()
120120
if value:
121121
values.append(value)
@@ -150,20 +150,20 @@ def getregexlist(self, section: str, option: str) -> List[str]:
150150

151151
# The default line exclusion regexes.
152152
DEFAULT_EXCLUDE = [
153-
r'#\s*(pragma|PRAGMA)[:\s]?\s*(no|NO)\s*(cover|COVER)',
153+
r"#\s*(pragma|PRAGMA)[:\s]?\s*(no|NO)\s*(cover|COVER)",
154154
]
155155

156156
# The default partial branch regexes, to be modified by the user.
157157
DEFAULT_PARTIAL = [
158-
r'#\s*(pragma|PRAGMA)[:\s]?\s*(no|NO)\s*(branch|BRANCH)',
158+
r"#\s*(pragma|PRAGMA)[:\s]?\s*(no|NO)\s*(branch|BRANCH)",
159159
]
160160

161161
# The default partial branch regexes, based on Python semantics.
162162
# These are any Python branching constructs that can't actually execute all
163163
# their branches.
164164
DEFAULT_PARTIAL_ALWAYS = [
165-
'while (True|1|False|0):',
166-
'if (True|1|False|0):',
165+
"while (True|1|False|0):",
166+
"if (True|1|False|0):",
167167
]
168168

169169

@@ -286,7 +286,7 @@ def from_file(self, filename: str, warn: Callable[[str], None], our_file: bool)
286286
"""
287287
_, ext = os.path.splitext(filename)
288288
cp: TConfigParser
289-
if ext == '.toml':
289+
if ext == ".toml":
290290
cp = TomlConfigParser(our_file)
291291
else:
292292
cp = HandyConfigParser(our_file)
@@ -328,9 +328,9 @@ def from_file(self, filename: str, warn: Callable[[str], None], our_file: bool)
328328
)
329329

330330
# [paths] is special
331-
if cp.has_section('paths'):
332-
for option in cp.options('paths'):
333-
self.paths[option] = cp.getlist('paths', option)
331+
if cp.has_section("paths"):
332+
for option in cp.options("paths"):
333+
self.paths[option] = cp.getlist("paths", option)
334334
any_set = True
335335

336336
# plugins can have options
@@ -370,72 +370,72 @@ def copy(self) -> CoverageConfig:
370370
# configuration value from the file.
371371

372372
# [run]
373-
('branch', 'run:branch', 'boolean'),
374-
('command_line', 'run:command_line'),
375-
('concurrency', 'run:concurrency', 'list'),
376-
('context', 'run:context'),
377-
('cover_pylib', 'run:cover_pylib', 'boolean'),
378-
('data_file', 'run:data_file'),
379-
('debug', 'run:debug', 'list'),
380-
('debug_file', 'run:debug_file'),
381-
('disable_warnings', 'run:disable_warnings', 'list'),
382-
('dynamic_context', 'run:dynamic_context'),
383-
('parallel', 'run:parallel', 'boolean'),
384-
('plugins', 'run:plugins', 'list'),
385-
('relative_files', 'run:relative_files', 'boolean'),
386-
('run_include', 'run:include', 'list'),
387-
('run_omit', 'run:omit', 'list'),
388-
('sigterm', 'run:sigterm', 'boolean'),
389-
('source', 'run:source', 'list'),
390-
('source_pkgs', 'run:source_pkgs', 'list'),
391-
('timid', 'run:timid', 'boolean'),
392-
('_crash', 'run:_crash'),
373+
("branch", "run:branch", "boolean"),
374+
("command_line", "run:command_line"),
375+
("concurrency", "run:concurrency", "list"),
376+
("context", "run:context"),
377+
("cover_pylib", "run:cover_pylib", "boolean"),
378+
("data_file", "run:data_file"),
379+
("debug", "run:debug", "list"),
380+
("debug_file", "run:debug_file"),
381+
("disable_warnings", "run:disable_warnings", "list"),
382+
("dynamic_context", "run:dynamic_context"),
383+
("parallel", "run:parallel", "boolean"),
384+
("plugins", "run:plugins", "list"),
385+
("relative_files", "run:relative_files", "boolean"),
386+
("run_include", "run:include", "list"),
387+
("run_omit", "run:omit", "list"),
388+
("sigterm", "run:sigterm", "boolean"),
389+
("source", "run:source", "list"),
390+
("source_pkgs", "run:source_pkgs", "list"),
391+
("timid", "run:timid", "boolean"),
392+
("_crash", "run:_crash"),
393393

394394
# [report]
395-
('exclude_list', 'report:exclude_lines', 'regexlist'),
396-
('exclude_also', 'report:exclude_also', 'regexlist'),
397-
('fail_under', 'report:fail_under', 'float'),
398-
('format', 'report:format', 'boolean'),
399-
('ignore_errors', 'report:ignore_errors', 'boolean'),
400-
('include_namespace_packages', 'report:include_namespace_packages', 'boolean'),
401-
('partial_always_list', 'report:partial_branches_always', 'regexlist'),
402-
('partial_list', 'report:partial_branches', 'regexlist'),
403-
('precision', 'report:precision', 'int'),
404-
('report_contexts', 'report:contexts', 'list'),
405-
('report_include', 'report:include', 'list'),
406-
('report_omit', 'report:omit', 'list'),
407-
('show_missing', 'report:show_missing', 'boolean'),
408-
('skip_covered', 'report:skip_covered', 'boolean'),
409-
('skip_empty', 'report:skip_empty', 'boolean'),
410-
('sort', 'report:sort'),
395+
("exclude_list", "report:exclude_lines", "regexlist"),
396+
("exclude_also", "report:exclude_also", "regexlist"),
397+
("fail_under", "report:fail_under", "float"),
398+
("format", "report:format", "boolean"),
399+
("ignore_errors", "report:ignore_errors", "boolean"),
400+
("include_namespace_packages", "report:include_namespace_packages", "boolean"),
401+
("partial_always_list", "report:partial_branches_always", "regexlist"),
402+
("partial_list", "report:partial_branches", "regexlist"),
403+
("precision", "report:precision", "int"),
404+
("report_contexts", "report:contexts", "list"),
405+
("report_include", "report:include", "list"),
406+
("report_omit", "report:omit", "list"),
407+
("show_missing", "report:show_missing", "boolean"),
408+
("skip_covered", "report:skip_covered", "boolean"),
409+
("skip_empty", "report:skip_empty", "boolean"),
410+
("sort", "report:sort"),
411411

412412
# [html]
413-
('extra_css', 'html:extra_css'),
414-
('html_dir', 'html:directory'),
415-
('html_skip_covered', 'html:skip_covered', 'boolean'),
416-
('html_skip_empty', 'html:skip_empty', 'boolean'),
417-
('html_title', 'html:title'),
418-
('show_contexts', 'html:show_contexts', 'boolean'),
413+
("extra_css", "html:extra_css"),
414+
("html_dir", "html:directory"),
415+
("html_skip_covered", "html:skip_covered", "boolean"),
416+
("html_skip_empty", "html:skip_empty", "boolean"),
417+
("html_title", "html:title"),
418+
("show_contexts", "html:show_contexts", "boolean"),
419419

420420
# [xml]
421-
('xml_output', 'xml:output'),
422-
('xml_package_depth', 'xml:package_depth', 'int'),
421+
("xml_output", "xml:output"),
422+
("xml_package_depth", "xml:package_depth", "int"),
423423

424424
# [json]
425-
('json_output', 'json:output'),
426-
('json_pretty_print', 'json:pretty_print', 'boolean'),
427-
('json_show_contexts', 'json:show_contexts', 'boolean'),
425+
("json_output", "json:output"),
426+
("json_pretty_print", "json:pretty_print", "boolean"),
427+
("json_show_contexts", "json:show_contexts", "boolean"),
428428

429429
# [lcov]
430-
('lcov_output', 'lcov:output'),
430+
("lcov_output", "lcov:output"),
431431
]
432432

433433
def _set_attr_from_config_option(
434434
self,
435435
cp: TConfigParser,
436436
attr: str,
437437
where: str,
438-
type_: str = '',
438+
type_: str = "",
439439
) -> bool:
440440
"""Set an attribute on self if it exists in the ConfigParser.
441441
@@ -444,7 +444,7 @@ def _set_attr_from_config_option(
444444
"""
445445
section, option = where.split(":")
446446
if cp.has_option(section, option):
447-
method = getattr(cp, 'get' + type_)
447+
method = getattr(cp, "get" + type_)
448448
setattr(self, attr, method(section, option))
449449
return True
450450
return False
@@ -548,7 +548,7 @@ def config_files_to_try(config_file: Union[bool, str]) -> List[Tuple[str, bool,
548548
specified_file = (config_file is not True)
549549
if not specified_file:
550550
# No file was specified. Check COVERAGE_RCFILE.
551-
rcfile = os.environ.get('COVERAGE_RCFILE')
551+
rcfile = os.environ.get("COVERAGE_RCFILE")
552552
if rcfile:
553553
config_file = rcfile
554554
specified_file = True
@@ -602,10 +602,10 @@ def read_coverage_config(
602602

603603
# $set_env.py: COVERAGE_DEBUG - Options for --debug.
604604
# 3) from environment variables:
605-
env_data_file = os.environ.get('COVERAGE_FILE')
605+
env_data_file = os.environ.get("COVERAGE_FILE")
606606
if env_data_file:
607607
config.data_file = env_data_file
608-
debugs = os.environ.get('COVERAGE_DEBUG')
608+
debugs = os.environ.get("COVERAGE_DEBUG")
609609
if debugs:
610610
config.debug.extend(d.strip() for d in debugs.split(","))
611611

coverage/control.py

+37-37
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class Coverage(TConfigurable):
8484
cov.start()
8585
#.. call your code ..
8686
cov.stop()
87-
cov.html_report(directory='covhtml')
87+
cov.html_report(directory="covhtml")
8888
8989
Note: in keeping with Python custom, names starting with underscore are
9090
not part of the public API. They might stop working at any point. Please
@@ -343,7 +343,7 @@ def _post_init(self) -> None:
343343
self._should_write_debug = False
344344
self._write_startup_debug()
345345

346-
# '[run] _crash' will raise an exception if the value is close by in
346+
# "[run] _crash" will raise an exception if the value is close by in
347347
# the call stack, for testing error handling.
348348
if self.config._crash and self.config._crash in short_stack(limit=4):
349349
raise RuntimeError(f"Crashing because called by {self.config._crash}")
@@ -380,7 +380,7 @@ def _should_trace(self, filename: str, frame: FrameType) -> TFileDisposition:
380380
"""
381381
assert self._inorout is not None
382382
disp = self._inorout.should_trace(filename, frame)
383-
if self._debug.should('trace'):
383+
if self._debug.should("trace"):
384384
self._debug.write(disposition_debug_msg(disp))
385385
return disp
386386

@@ -392,7 +392,7 @@ def _check_include_omit_etc(self, filename: str, frame: FrameType) -> bool:
392392
"""
393393
assert self._inorout is not None
394394
reason = self._inorout.check_include_omit_etc(filename, frame)
395-
if self._debug.should('trace'):
395+
if self._debug.should("trace"):
396396
if not reason:
397397
msg = f"Including {filename!r}"
398398
else:
@@ -420,7 +420,7 @@ def _warn(self, msg: str, slug: Optional[str] = None, once: bool = False) -> Non
420420
self._warnings.append(msg)
421421
if slug:
422422
msg = f"{msg} ({slug})"
423-
if self._debug.should('pid'):
423+
if self._debug.should("pid"):
424424
msg = f"[{os.getpid()}] {msg}"
425425
warnings.warn(msg, category=CoverageWarning, stacklevel=2)
426426

@@ -566,7 +566,7 @@ def _init_for_start(self) -> None:
566566
self._inorout = InOrOut(
567567
config=self.config,
568568
warn=self._warn,
569-
debug=(self._debug if self._debug.should('trace') else None),
569+
debug=(self._debug if self._debug.should("trace") else None),
570570
include_namespace_packages=self.config.include_namespace_packages,
571571
)
572572
self._inorout.plugins = self._plugins
@@ -703,13 +703,13 @@ def switch_context(self, new_context: str) -> None:
703703

704704
self._collector.switch_context(new_context)
705705

706-
def clear_exclude(self, which: str = 'exclude') -> None:
706+
def clear_exclude(self, which: str = "exclude") -> None:
707707
"""Clear the exclude list."""
708708
self._init()
709709
setattr(self.config, which + "_list", [])
710710
self._exclude_regex_stale()
711711

712-
def exclude(self, regex: str, which: str = 'exclude') -> None:
712+
def exclude(self, regex: str, which: str = "exclude") -> None:
713713
"""Exclude source lines from execution consideration.
714714
715715
A number of lists of regular expressions are maintained. Each list
@@ -740,7 +740,7 @@ def _exclude_regex(self, which: str) -> str:
740740
self._exclude_re[which] = join_regex(excl_list)
741741
return self._exclude_re[which]
742742

743-
def get_exclude_list(self, which: str = 'exclude') -> List[str]:
743+
def get_exclude_list(self, which: str = "exclude") -> List[str]:
744744
"""Return a list of excluded regex strings.
745745
746746
`which` indicates which list is desired. See :meth:`exclude` for the
@@ -969,7 +969,7 @@ def _get_file_reporters(self, morfs: Optional[Iterable[TMorf]] = None) -> List[F
969969
return file_reporters
970970

971971
def _prepare_data_for_reporting(self) -> None:
972-
"""Re-map data before reporting, to get implicit 'combine' behavior."""
972+
"""Re-map data before reporting, to get implicit "combine" behavior."""
973973
if self.config.paths:
974974
mapped_data = CoverageData(warn=self._warn, debug=self._debug, no_disk=True)
975975
if self._data is not None:
@@ -1238,10 +1238,10 @@ def lcov_report(
12381238
) -> float:
12391239
"""Generate an LCOV report of coverage results.
12401240
1241-
Each module in 'morfs' is included in the report. 'outfile' is the
1241+
Each module in `morfs` is included in the report. `outfile` is the
12421242
path to write the file to, "-" will write to stdout.
12431243
1244-
See :meth 'report' for other arguments.
1244+
See :meth:`report` for other arguments.
12451245
12461246
.. versionadded:: 6.3
12471247
"""
@@ -1275,38 +1275,38 @@ def plugin_info(plugins: List[Any]) -> List[str]:
12751275
return entries
12761276

12771277
info = [
1278-
('coverage_version', covmod.__version__),
1279-
('coverage_module', covmod.__file__),
1280-
('tracer', self._collector.tracer_name() if self._collector is not None else "-none-"),
1281-
('CTracer', 'available' if HAS_CTRACER else "unavailable"),
1282-
('plugins.file_tracers', plugin_info(self._plugins.file_tracers)),
1283-
('plugins.configurers', plugin_info(self._plugins.configurers)),
1284-
('plugins.context_switchers', plugin_info(self._plugins.context_switchers)),
1285-
('configs_attempted', self.config.attempted_config_files),
1286-
('configs_read', self.config.config_files_read),
1287-
('config_file', self.config.config_file),
1288-
('config_contents',
1289-
repr(self.config._config_contents) if self.config._config_contents else '-none-'
1278+
("coverage_version", covmod.__version__),
1279+
("coverage_module", covmod.__file__),
1280+
("tracer", self._collector.tracer_name() if self._collector is not None else "-none-"),
1281+
("CTracer", "available" if HAS_CTRACER else "unavailable"),
1282+
("plugins.file_tracers", plugin_info(self._plugins.file_tracers)),
1283+
("plugins.configurers", plugin_info(self._plugins.configurers)),
1284+
("plugins.context_switchers", plugin_info(self._plugins.context_switchers)),
1285+
("configs_attempted", self.config.attempted_config_files),
1286+
("configs_read", self.config.config_files_read),
1287+
("config_file", self.config.config_file),
1288+
("config_contents",
1289+
repr(self.config._config_contents) if self.config._config_contents else "-none-"
12901290
),
1291-
('data_file', self._data.data_filename() if self._data is not None else "-none-"),
1292-
('python', sys.version.replace('\n', '')),
1293-
('platform', platform.platform()),
1294-
('implementation', platform.python_implementation()),
1295-
('executable', sys.executable),
1296-
('def_encoding', sys.getdefaultencoding()),
1297-
('fs_encoding', sys.getfilesystemencoding()),
1298-
('pid', os.getpid()),
1299-
('cwd', os.getcwd()),
1300-
('path', sys.path),
1301-
('environment', human_sorted(
1291+
("data_file", self._data.data_filename() if self._data is not None else "-none-"),
1292+
("python", sys.version.replace("\n", "")),
1293+
("platform", platform.platform()),
1294+
("implementation", platform.python_implementation()),
1295+
("executable", sys.executable),
1296+
("def_encoding", sys.getdefaultencoding()),
1297+
("fs_encoding", sys.getfilesystemencoding()),
1298+
("pid", os.getpid()),
1299+
("cwd", os.getcwd()),
1300+
("path", sys.path),
1301+
("environment", human_sorted(
13021302
f"{k} = {v}"
13031303
for k, v in os.environ.items()
13041304
if (
13051305
any(slug in k for slug in ("COV", "PY")) or
13061306
(k in ("HOME", "TEMP", "TMP"))
13071307
)
13081308
)),
1309-
('command_line', " ".join(getattr(sys, 'argv', ['-none-']))),
1309+
("command_line", " ".join(getattr(sys, "argv", ["-none-"]))),
13101310
]
13111311

13121312
if self._inorout is not None:
@@ -1324,7 +1324,7 @@ def plugin_info(plugins: List[Any]) -> List[str]:
13241324

13251325
Coverage = decorate_methods( # type: ignore[misc]
13261326
show_calls(show_args=True),
1327-
butnot=['get_data']
1327+
butnot=["get_data"]
13281328
)(Coverage)
13291329

13301330

0 commit comments

Comments
 (0)