Skip to content

Commit

Permalink
fix: add missing future annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
k4black committed Dec 16, 2023
1 parent 886862e commit 613da71
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 4 additions & 2 deletions checker/configs/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import re
from pathlib import Path
from typing import Any, Generic, TypeVar, Type, Protocol
Expand Down Expand Up @@ -25,7 +27,7 @@ class CustomBaseModel(pydantic.BaseModel):

class YamlLoaderMixin(Generic[T]):
@classmethod
def from_yaml(cls: Type[T], path: Path) -> T:
def from_yaml(cls: type[T], path: Path) -> T:
try:
with path.open() as f:
return cls(**yaml.safe_load(f))
Expand All @@ -41,5 +43,5 @@ def to_yaml(self: T, path: Path) -> None:
yaml.dump(self.model_dump(), f)

Check warning on line 43 in checker/configs/utils.py

View check run for this annotation

Codecov / codecov/patch

checker/configs/utils.py#L42-L43

Added lines #L42 - L43 were not covered by tests

@classmethod
def get_json_schema(cls: Type[T]) -> dict[str, Any]:
def get_json_schema(cls: type[T]) -> dict[str, Any]:
return cls.model_json_schema()

Check warning on line 47 in checker/configs/utils.py

View check run for this annotation

Codecov / codecov/patch

checker/configs/utils.py#L47

Added line #L47 was not covered by tests
2 changes: 1 addition & 1 deletion checker/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class PipelineRunner:
def __init__(
self,
pipeline: list[PipelineStageConfig],
plugins: dict[str, Type[PluginABC]],
plugins: dict[str, type[PluginABC]],
*,
verbose: bool = False,
):
Expand Down
5 changes: 2 additions & 3 deletions checker/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import sys
from collections.abc import Sequence
from pathlib import Path
from typing import Type

from .base import PluginABC, PluginOutput # noqa: F401

Expand All @@ -18,7 +17,7 @@
]


def get_all_subclasses(cls: Type[PluginABC]) -> set[type[PluginABC]]:
def get_all_subclasses(cls: type[PluginABC]) -> set[type[PluginABC]]:
return set(cls.__subclasses__()).union(

Check warning on line 21 in checker/plugins/__init__.py

View check run for this annotation

Codecov / codecov/patch

checker/plugins/__init__.py#L21

Added line #L21 was not covered by tests
[s for c in cls.__subclasses__() for s in get_all_subclasses(c)]
)
Expand All @@ -28,7 +27,7 @@ def load_plugins(
search_directories: Sequence[str | Path] | None = None,
*,
verbose: bool = False,
) -> dict[str, Type[PluginABC]]:
) -> dict[str, type[PluginABC]]:
"""
Load plugins from the plugins directory.
:param search_directories: list of directories to search for plugins
Expand Down

0 comments on commit 613da71

Please sign in to comment.