Skip to content

Commit

Permalink
Workaround Python 3.13 removals.
Browse files Browse the repository at this point in the history
So much for the deprecation policy.
  • Loading branch information
domdfcoding committed Oct 19, 2023
1 parent df005dc commit e735a45
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions domdf_python_tools/compat/importlib_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ def _normalize_path(path: Any) -> str:
raise ValueError(f'{path!r} must be only a file name')
return file_name

def open_binary(package: Package, resource: Resource) -> BinaryIO:
def open_binary(package: "Package", resource: "Resource") -> BinaryIO:
"""
Return a file-like object opened for binary reading of the resource.
"""

return (files(package) / _normalize_path(resource)).open("rb")

def read_binary(package: Package, resource: Resource) -> bytes:
def read_binary(package: "Package", resource: "Resource") -> bytes:
"""
Return the binary contents of the resource.
"""

return (files(package) / _normalize_path(resource)).read_bytes()

def open_text(
package: Package,
resource: Resource,
package: "Package",
resource: "Resource",
encoding: str = "utf-8",
errors: str = "strict",
) -> TextIO:
Expand All @@ -61,8 +61,8 @@ def open_text(
)

def read_text(
package: Package,
resource: Resource,
package: "Package",
resource: "Resource",
encoding: str = "utf-8",
errors: str = "strict",
) -> str:
Expand Down

0 comments on commit e735a45

Please sign in to comment.