Skip to content

Commit

Permalink
fix: allow broader type for toml file path value (#243)
Browse files Browse the repository at this point in the history
* allow broader type for toml file path value

Signed-off-by: oleg.hoefling <[email protected]>

* reuse strpath from typeshed

Signed-off-by: oleg.hoefling <[email protected]>

Signed-off-by: oleg.hoefling <[email protected]>
  • Loading branch information
hoefling authored Oct 27, 2022
1 parent 86b61f2 commit cb822da
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tomlkit/toml_file.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
import os
import re

from typing import TYPE_CHECKING

from tomlkit.api import loads
from tomlkit.toml_document import TOMLDocument


if TYPE_CHECKING:
from _typeshed import StrPath as _StrPath
else:
from typing import Union

_StrPath = Union[str, os.PathLike]


class TOMLFile:
"""
Represents a TOML file.
:param path: path to the TOML file
"""

def __init__(self, path: str) -> None:
def __init__(self, path: _StrPath) -> None:
self._path = path
self._linesep = os.linesep

Expand Down

0 comments on commit cb822da

Please sign in to comment.