mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-10 13:24:18 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
72ad6dc953
commit
f4cd1ba0d6
813 changed files with 66015 additions and 58839 deletions
|
|
@ -1,18 +1,18 @@
|
|||
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
|
||||
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
|
||||
|
||||
"""Results of coverage measurement."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import collections
|
||||
|
||||
from typing import Callable, Iterable, TYPE_CHECKING
|
||||
from typing import Callable
|
||||
from typing import Iterable
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from coverage.debug import auto_repr
|
||||
from coverage.exceptions import ConfigError
|
||||
from coverage.misc import nice_pair
|
||||
from coverage.types import TArc, TLineNo
|
||||
from coverage.types import TArc
|
||||
from coverage.types import TLineNo
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from coverage.data import CoverageData
|
||||
|
|
@ -48,8 +48,8 @@ class Analysis:
|
|||
self.no_branch = self.file_reporter.no_branch_lines()
|
||||
n_branches = self._total_branches()
|
||||
mba = self.missing_branch_arcs()
|
||||
n_partial_branches = sum(len(v) for k,v in mba.items() if k not in self.missing)
|
||||
n_missing_branches = sum(len(v) for k,v in mba.items())
|
||||
n_partial_branches = sum(len(v) for k, v in mba.items() if k not in self.missing)
|
||||
n_missing_branches = sum(len(v) for k, v in mba.items())
|
||||
else:
|
||||
self._arc_possibilities = []
|
||||
self.exit_counts = {}
|
||||
|
|
@ -103,9 +103,9 @@ class Analysis:
|
|||
executed = self.arcs_executed()
|
||||
missing = (
|
||||
p for p in possible
|
||||
if p not in executed
|
||||
and p[0] not in self.no_branch
|
||||
and p[1] not in self.excluded
|
||||
if p not in executed and
|
||||
p[0] not in self.no_branch and
|
||||
p[1] not in self.excluded
|
||||
)
|
||||
return sorted(missing)
|
||||
|
||||
|
|
@ -120,15 +120,15 @@ class Analysis:
|
|||
# make sure we have at least one positive value.
|
||||
unpredicted = (
|
||||
e for e in executed
|
||||
if e not in possible
|
||||
and e[0] != e[1]
|
||||
and (e[0] > 0 or e[1] > 0)
|
||||
if e not in possible and
|
||||
e[0] != e[1] and
|
||||
(e[0] > 0 or e[1] > 0)
|
||||
)
|
||||
return sorted(unpredicted)
|
||||
|
||||
def _branch_lines(self) -> list[TLineNo]:
|
||||
"""Returns a list of line numbers that have more than one exit."""
|
||||
return [l1 for l1,count in self.exit_counts.items() if count > 1]
|
||||
return [l1 for l1, count in self.exit_counts.items() if count > 1]
|
||||
|
||||
def _total_branches(self) -> int:
|
||||
"""How many total branches are there?"""
|
||||
|
|
@ -264,7 +264,7 @@ class Numbers:
|
|||
pc = self._near100
|
||||
else:
|
||||
pc = round(pc, self._precision)
|
||||
return "%.*f" % (self._precision, pc)
|
||||
return '%.*f' % (self._precision, pc)
|
||||
|
||||
def pc_str_width(self) -> int:
|
||||
"""How many characters wide can pc_covered_str be?"""
|
||||
|
|
@ -356,10 +356,10 @@ def format_lines(
|
|||
for line, exits in line_exits:
|
||||
for ex in sorted(exits):
|
||||
if line not in lines and ex not in lines:
|
||||
dest = (ex if ex > 0 else "exit")
|
||||
line_items.append((line, f"{line}->{dest}"))
|
||||
dest = (ex if ex > 0 else 'exit')
|
||||
line_items.append((line, f'{line}->{dest}'))
|
||||
|
||||
ret = ", ".join(t[-1] for t in sorted(line_items))
|
||||
ret = ', '.join(t[-1] for t in sorted(line_items))
|
||||
return ret
|
||||
|
||||
|
||||
|
|
@ -375,7 +375,7 @@ def should_fail_under(total: float, fail_under: float, precision: int) -> bool:
|
|||
"""
|
||||
# We can never achieve higher than 100% coverage, or less than zero.
|
||||
if not (0 <= fail_under <= 100.0):
|
||||
msg = f"fail_under={fail_under} is invalid. Must be between 0 and 100."
|
||||
msg = f'fail_under={fail_under} is invalid. Must be between 0 and 100.'
|
||||
raise ConfigError(msg)
|
||||
|
||||
# Special case for fail_under=100, it must really be 100.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue