From 575890d4bacf3c4734d35e345aa62773ccfaa26c Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sun, 8 Oct 2023 13:55:42 +0200 Subject: [PATCH] Use StrPath in dependency_files. --- src/antsibull_core/dependency_files.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/antsibull_core/dependency_files.py b/src/antsibull_core/dependency_files.py index 5f90d27..303fa82 100644 --- a/src/antsibull_core/dependency_files.py +++ b/src/antsibull_core/dependency_files.py @@ -22,7 +22,7 @@ from packaging.version import Version as PypiVer if t.TYPE_CHECKING: - from _typeshed import StrOrBytesPath + from _typeshed import StrPath from semantic_version import Version as SemVer @@ -36,7 +36,7 @@ class InvalidFileFormat(Exception): pass -def parse_pieces_file(pieces_file: StrOrBytesPath) -> list[str]: +def parse_pieces_file(pieces_file: StrPath) -> list[str]: with open(pieces_file, "rb") as f: contents = f.read() @@ -50,7 +50,7 @@ def parse_pieces_file(pieces_file: StrOrBytesPath) -> list[str]: return collections -def _parse_name_version_spec_file(filename: StrOrBytesPath) -> DependencyFileData: +def _parse_name_version_spec_file(filename: StrPath) -> DependencyFileData: deps: dict[str, str] = {} ansible_core_version: str | None = None ansible_version: str | None = None @@ -112,13 +112,13 @@ class DepsFile: ansible-core version, not an exact dependency on that precise version. """ - def __init__(self, deps_file: StrOrBytesPath) -> None: + def __init__(self, deps_file: StrPath) -> None: """ Create a :mod:`DepsFile`. :arg deps_file: filename of the `DepsFile`. """ - self.filename: StrOrBytesPath = deps_file + self.filename: StrPath = deps_file def parse(self) -> DependencyFileData: """Parse the deps from a dependency file.""" @@ -165,8 +165,8 @@ def write( class BuildFile: - def __init__(self, build_file: StrOrBytesPath) -> None: - self.filename: StrOrBytesPath = build_file + def __init__(self, build_file: StrPath) -> None: + self.filename: StrPath = build_file def parse(self) -> DependencyFileData: """Parse the build from a dependency file."""