Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed May 22, 2024
1 parent 98b9501 commit 90c9dd8
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 11 deletions.
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import codecs
import re

from pathlib import Path


Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import codecs
import re

from pathlib import Path

from setuptools import find_packages, setup
Expand Down
7 changes: 5 additions & 2 deletions src/interrogate/badge_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
from __future__ import annotations

import sys
from pathlib import Path

from importlib import resources
from pathlib import Path
from typing import TYPE_CHECKING, Union
from xml.dom import minidom


if TYPE_CHECKING:
from os import PathLike

Expand Down Expand Up @@ -183,7 +184,9 @@ def get_badge(result: float, color: str, style: str | None = None) -> str:
return tmpl


def should_generate_badge(output: PathLike[str] | str, color: str, result: float) -> bool:
def should_generate_badge(
output: PathLike[str] | str, color: str, result: float
) -> bool:
"""Detect if existing badge needs updating.
This is to help avoid unnecessary newline updates. See
Expand Down
2 changes: 1 addition & 1 deletion src/interrogate/cli.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright 2020-2024 Lynn Root
"""CLI entrypoint into `interrogate`."""

from pathlib import Path
import sys

from pathlib import Path
from typing import List, Optional, Pattern, Tuple, Union

import click
Expand Down
5 changes: 4 additions & 1 deletion src/interrogate/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import attr
import click


if TYPE_CHECKING:
from os import PathLike

Expand Down Expand Up @@ -115,7 +116,9 @@ def find_project_root(srcs: Sequence[PathLike[str] | str]) -> Path:
return directory


def find_project_config(path_search_start: Sequence[PathLike[str] | str]) -> str | None:
def find_project_config(
path_search_start: Sequence[PathLike[str] | str],
) -> str | None:
"""Find the absolute filepath to a pyproject.toml if it exists."""
project_root = find_project_root(path_search_start)
pyproject_toml = project_root / "pyproject.toml"
Expand Down
11 changes: 7 additions & 4 deletions src/interrogate/coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import ast
import decimal
import os
from pathlib import Path

import sys

from pathlib import Path
from typing import TYPE_CHECKING, Final, Iterator

import attr
Expand All @@ -17,6 +17,7 @@

from interrogate import config, utils, visit


if TYPE_CHECKING:
from os import PathLike

Expand Down Expand Up @@ -252,7 +253,9 @@ def _get_file_coverage(
source_tree = filename.read_text(encoding="utf-8")

parsed_tree = ast.parse(source_tree)
visitor = visit.CoverageVisitor(filename=str(filename), config=self.config)
visitor = visit.CoverageVisitor(
filename=str(filename), config=self.config
)
visitor.visit(parsed_tree)

filtered_nodes = self._filter_nodes(visitor.nodes)
Expand Down Expand Up @@ -474,7 +477,7 @@ def _sort_results(results: InterrogateResults) -> InterrogateResults:
# pth = Path.home() / "dev/download/interrogate/log.txt"
# with pth.open("a") as f:
# f.write(f"{cnt} {obj!r}\n")

# log(all_filenames_map) # 1
# log(all_filenames_map_paths) # 2
# log(all_dirs) # 3
Expand Down
1 change: 1 addition & 0 deletions tests/functional/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""Functional tests for the CLI and implicitly interrogate/visit.py."""

import sys

from pathlib import Path

import pytest
Expand Down
3 changes: 2 additions & 1 deletion tests/functional/test_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"""Functional tests for interrogate/coverage.py."""

import os
from pathlib import Path
import sys

from pathlib import Path

import pytest

from interrogate import config, coverage
Expand Down
9 changes: 7 additions & 2 deletions tests/unit/test_badge_gen.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Copyright 2020-2024 Lynn Root
"""Unit tests for interrogate/badge_gen.py module"""

from pathlib import Path
import sys

from pathlib import Path

import pytest

from interrogate import badge_gen
Expand All @@ -20,7 +21,11 @@
(
(None, Path("fixtures/my_badge.svg"), Path("fixtures/my_badge.svg")),
("svg", Path("fixtures/my_badge.svg"), Path("fixtures/my_badge.svg")),
("png", Path("fixtures/my_badge.png"), Path("fixtures/my_badge.tmp.svg")),
(
"png",
Path("fixtures/my_badge.png"),
Path("fixtures/my_badge.tmp.svg"),
),
),
)
def test_save_badge(
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""Unit tests for interrogate/config.py module"""

import configparser

from pathlib import Path

import click
Expand Down

0 comments on commit 90c9dd8

Please sign in to comment.