mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-06 12:06:53 +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,6 +1,5 @@
|
|||
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
|
||||
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
|
||||
|
||||
"""
|
||||
.. versionadded:: 4.0
|
||||
|
||||
|
|
@ -111,17 +110,19 @@ In your ``coverage_init`` function, use the ``add_dynamic_context`` method to
|
|||
register your dynamic context switcher.
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import functools
|
||||
|
||||
from types import FrameType
|
||||
from typing import Any, Iterable
|
||||
from typing import Any
|
||||
from typing import Iterable
|
||||
|
||||
from coverage import files
|
||||
from coverage.misc import _needs_to_implement
|
||||
from coverage.types import TArc, TConfigurable, TLineNo, TSourceTokenLines
|
||||
from coverage.types import TArc
|
||||
from coverage.types import TConfigurable
|
||||
from coverage.types import TLineNo
|
||||
from coverage.types import TSourceTokenLines
|
||||
|
||||
|
||||
class CoveragePlugin:
|
||||
|
|
@ -130,7 +131,7 @@ class CoveragePlugin:
|
|||
_coverage_plugin_name: str
|
||||
_coverage_enabled: bool
|
||||
|
||||
def file_tracer(self, filename: str) -> FileTracer | None: # pylint: disable=unused-argument
|
||||
def file_tracer(self, filename: str) -> FileTracer | None: # pylint: disable=unused-argument
|
||||
"""Get a :class:`FileTracer` object for a file.
|
||||
|
||||
Plug-in type: file tracer.
|
||||
|
|
@ -185,7 +186,7 @@ class CoveragePlugin:
|
|||
or the string `"python"` to have coverage.py treat the file as Python.
|
||||
|
||||
"""
|
||||
_needs_to_implement(self, "file_reporter")
|
||||
_needs_to_implement(self, 'file_reporter')
|
||||
|
||||
def dynamic_context(
|
||||
self,
|
||||
|
|
@ -287,7 +288,7 @@ class FileTracer(CoveragePluginBase):
|
|||
Returns the file name to credit with this execution.
|
||||
|
||||
"""
|
||||
_needs_to_implement(self, "source_filename")
|
||||
_needs_to_implement(self, 'source_filename')
|
||||
|
||||
def has_dynamic_source_filename(self) -> bool:
|
||||
"""Does this FileTracer have dynamic source file names?
|
||||
|
|
@ -369,7 +370,7 @@ class FileReporter(CoveragePluginBase):
|
|||
self.filename = filename
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"<{self.__class__.__name__} filename={self.filename!r}>"
|
||||
return f'<{self.__class__.__name__} filename={self.filename!r}>'
|
||||
|
||||
def relative_filename(self) -> str:
|
||||
"""Get the relative file name for this file.
|
||||
|
|
@ -392,7 +393,7 @@ class FileReporter(CoveragePluginBase):
|
|||
as a text file, or if you need other encoding support.
|
||||
|
||||
"""
|
||||
with open(self.filename, encoding="utf-8") as f:
|
||||
with open(self.filename, encoding='utf-8') as f:
|
||||
return f.read()
|
||||
|
||||
def lines(self) -> set[TLineNo]:
|
||||
|
|
@ -404,7 +405,7 @@ class FileReporter(CoveragePluginBase):
|
|||
Returns a set of line numbers.
|
||||
|
||||
"""
|
||||
_needs_to_implement(self, "lines")
|
||||
_needs_to_implement(self, 'lines')
|
||||
|
||||
def excluded_lines(self) -> set[TLineNo]:
|
||||
"""Get the excluded executable lines in this file.
|
||||
|
|
@ -541,7 +542,7 @@ class FileReporter(CoveragePluginBase):
|
|||
|
||||
"""
|
||||
for line in self.source().splitlines():
|
||||
yield [("txt", line)]
|
||||
yield [('txt', line)]
|
||||
|
||||
def __eq__(self, other: Any) -> bool:
|
||||
return isinstance(other, FileReporter) and self.filename == other.filename
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue