Skip to content

Commit

Permalink
Use StrPath in dependency_files.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Oct 8, 2023
1 parent 44445f2 commit 575890d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/antsibull_core/dependency_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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()

Expand All @@ -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
Expand Down Expand Up @@ -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."""
Expand Down Expand Up @@ -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."""
Expand Down

0 comments on commit 575890d

Please sign in to comment.