diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f869f5e..3a4d24f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,7 +23,7 @@ repos: hooks: - id: add-trailing-comma - repo: https://github.com/asottile/pyupgrade - rev: v3.16.0 + rev: v3.17.0 hooks: - id: pyupgrade args: [--py38-plus] diff --git a/git_code_debt/generate.py b/git_code_debt/generate.py index e6b49ab..95469eb 100644 --- a/git_code_debt/generate.py +++ b/git_code_debt/generate.py @@ -44,7 +44,7 @@ def get_metrics( ) -> tuple[Metric, ...]: def get_all_metrics( file_diff_stats: tuple[FileDiffStat, ...], - ) -> Generator[Metric, None, None]: + ) -> Generator[Metric]: for metric_parser_cls in metric_parsers: metric_parser = metric_parser_cls() yield from metric_parser.get_metrics_from_stat( @@ -89,7 +89,7 @@ def _get_metrics_inner( @contextlib.contextmanager def mapper(jobs: int) -> Generator[ - Callable[[Callable[[T2], T], Iterable[T2]], Iterable[T]], None, None, + Callable[[Callable[[T2], T], Iterable[T2]], Iterable[T]], ]: if jobs == 1: yield map diff --git a/git_code_debt/metrics/base.py b/git_code_debt/metrics/base.py index 8930d23..37bcae3 100644 --- a/git_code_debt/metrics/base.py +++ b/git_code_debt/metrics/base.py @@ -26,7 +26,7 @@ def get_metrics_from_stat( self, commit: Commit, file_diff_stats: tuple[FileDiffStat, ...], - ) -> Generator[Metric, None, None]: + ) -> Generator[Metric]: """Implement me to yield Metric objects from the input list of FileStat objects. @@ -50,7 +50,7 @@ def get_metrics_from_stat( self, _: Commit, file_diff_stats: tuple[FileDiffStat, ...], - ) -> Generator[Metric, None, None]: + ) -> Generator[Metric]: metric_value = 0 for file_diff_stat in file_diff_stats: diff --git a/git_code_debt/metrics/binary_file_count.py b/git_code_debt/metrics/binary_file_count.py index 6fcd060..b658a2c 100644 --- a/git_code_debt/metrics/binary_file_count.py +++ b/git_code_debt/metrics/binary_file_count.py @@ -17,7 +17,7 @@ class BinaryFileCount(DiffParserBase): def get_metrics_from_stat( self, _: Commit, file_diff_stats: tuple[FileDiffStat, ...], - ) -> Generator[Metric, None, None]: + ) -> Generator[Metric]: binary_delta = 0 for file_diff_stat in file_diff_stats: diff --git a/git_code_debt/metrics/curse.py b/git_code_debt/metrics/curse.py index 84bb374..d1a982e 100644 --- a/git_code_debt/metrics/curse.py +++ b/git_code_debt/metrics/curse.py @@ -31,7 +31,7 @@ def get_metrics_from_stat( self, _: Commit, file_diff_stats: tuple[FileDiffStat, ...], - ) -> Generator[Metric, None, None]: + ) -> Generator[Metric]: total_curses = 0 curses_by_file_type: dict[str, int] = collections.defaultdict(int) diff --git a/git_code_debt/metrics/lines.py b/git_code_debt/metrics/lines.py index 21cdffe..a4ed85a 100644 --- a/git_code_debt/metrics/lines.py +++ b/git_code_debt/metrics/lines.py @@ -21,7 +21,7 @@ def get_metrics_from_stat( self, _: Commit, file_diff_stats: tuple[FileDiffStat, ...], - ) -> Generator[Metric, None, None]: + ) -> Generator[Metric]: total_lines = 0 lines_by_file_type: dict[str, int] = collections.defaultdict(int) diff --git a/git_code_debt/metrics/submodule_count.py b/git_code_debt/metrics/submodule_count.py index c888499..e2f8d62 100644 --- a/git_code_debt/metrics/submodule_count.py +++ b/git_code_debt/metrics/submodule_count.py @@ -18,7 +18,7 @@ def get_metrics_from_stat( self, _: Commit, file_diff_stats: tuple[FileDiffStat, ...], - ) -> Generator[Metric, None, None]: + ) -> Generator[Metric]: submodule_delta = 0 for file_diff_stat in file_diff_stats: diff --git a/git_code_debt/metrics/symlink_count.py b/git_code_debt/metrics/symlink_count.py index 61d6706..57902ed 100644 --- a/git_code_debt/metrics/symlink_count.py +++ b/git_code_debt/metrics/symlink_count.py @@ -18,7 +18,7 @@ def get_metrics_from_stat( self, _: Commit, file_diff_stats: tuple[FileDiffStat, ...], - ) -> Generator[Metric, None, None]: + ) -> Generator[Metric]: symlink_delta = 0 for file_diff_stat in file_diff_stats: diff --git a/git_code_debt/repo_parser.py b/git_code_debt/repo_parser.py index 4db0ac8..f1fb121 100644 --- a/git_code_debt/repo_parser.py +++ b/git_code_debt/repo_parser.py @@ -28,7 +28,7 @@ def __init__(self, git_repo: str) -> None: self.tempdir: str | None = None @contextlib.contextmanager - def repo_checked_out(self) -> Generator[None, None, None]: + def repo_checked_out(self) -> Generator[None]: assert not self.tempdir with tempfile.TemporaryDirectory(suffix='temp-repo') as self.tempdir: try: diff --git a/git_code_debt/util/iter.py b/git_code_debt/util/iter.py index 26bc239..0e76523 100644 --- a/git_code_debt/util/iter.py +++ b/git_code_debt/util/iter.py @@ -11,7 +11,7 @@ def chunk_iter( iterable: Iterable[T], n: int, -) -> Generator[tuple[T, ...], None, None]: +) -> Generator[tuple[T, ...]]: """Yields an iterator in chunks For example you can do