Skip to content

Commit

Permalink
fix: use os.PathLike[str] for typing
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfikl committed Oct 13, 2024
1 parent a54bf6e commit ce22309
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/pycaputo/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from __future__ import annotations

import pathlib
import os
from dataclasses import Field
from typing import (
TYPE_CHECKING,
Expand All @@ -28,7 +28,7 @@
R = TypeVar("R")
"""A generic invariant :class:`typing.TypeVar`."""

PathLike = pathlib.Path | str
PathLike = os.PathLike[str] | str
"""A union of types supported as paths."""


Expand Down
5 changes: 3 additions & 2 deletions src/pycaputo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from __future__ import annotations

import pathlib
import time
from collections.abc import Callable, Iterable, Iterator
from contextlib import contextmanager, suppress
Expand Down Expand Up @@ -197,7 +196,7 @@ def stringify_eoc(*eocs: EOCRecorder) -> str:


def visualize_eoc(
filename: pathlib.Path,
filename: PathLike,
*eocs: EOCRecorder,
order: float | None = None,
abscissa: str | Literal[False] = "h",
Expand Down Expand Up @@ -477,6 +476,8 @@ def savefig(
:arg overwrite: if *True*, any existing files are overwritten.
:arg kwargs: renaming arguments are passed directly to ``savefig``.
"""
import pathlib

import matplotlib.pyplot as mp

filename = pathlib.Path(filename)
Expand Down

0 comments on commit ce22309

Please sign in to comment.