41
41
# stdlib
42
42
import os
43
43
import pathlib
44
- import typing
45
44
from decimal import Decimal
46
- from json import JSONDecoder , JSONEncoder
47
- from typing import TYPE_CHECKING , Any , Callable , Dict , List , Optional , Tuple , Type , Union
45
+ from typing import TYPE_CHECKING , Any , Callable , Dict , List , Optional , Tuple , Type , TypeVar , Union
48
46
49
47
# 3rd party
50
48
from typing_extensions import Protocol , runtime_checkable
53
51
import domdf_python_tools
54
52
55
53
if TYPE_CHECKING or domdf_python_tools .__docs : # pragma: no cover
54
+ # stdlib
55
+ from json import JSONDecoder , JSONEncoder
56
+
56
57
# 3rd party
57
58
from pandas import DataFrame , Series
58
59
63
64
JSONEncoder .__module__ = "json"
64
65
65
66
#: .. versionadded:: 1.0.0
66
- FrameOrSeries = typing . TypeVar ("FrameOrSeries" , "Series" , "DataFrame" )
67
+ FrameOrSeries = TypeVar ("FrameOrSeries" , "Series" , "DataFrame" )
67
68
68
69
__all__ = [
69
70
"PathLike" ,
92
93
.. seealso:: :py:obj:`domdf_python_tools.typing.PathType`
93
94
"""
94
95
95
- PathType = typing . TypeVar ("PathType" , str , pathlib .Path , os .PathLike )
96
+ PathType = TypeVar ("PathType" , str , pathlib .Path , os .PathLike )
96
97
"""
97
98
Type variable for objects that represent filesystem paths.
98
99
@@ -138,7 +139,7 @@ def dumps(
138
139
ensure_ascii : bool = ...,
139
140
check_circular : bool = ...,
140
141
allow_nan : bool = ...,
141
- cls : Optional [Type [JSONEncoder ]] = ...,
142
+ cls : Optional [Type [" JSONEncoder" ]] = ...,
142
143
indent : Union [None , int , str ] = ...,
143
144
separators : Optional [Tuple [str , str ]] = ...,
144
145
default : Optional [Callable [[Any ], Any ]] = ...,
@@ -165,7 +166,7 @@ def dumps(
165
166
def loads (
166
167
s : Union [str , bytes ],
167
168
* ,
168
- cls : Optional [Type [JSONDecoder ]] = ...,
169
+ cls : Optional [Type [" JSONDecoder" ]] = ...,
169
170
object_hook : Optional [Callable [[Dict [Any , Any ]], Any ]] = ...,
170
171
parse_float : Optional [Callable [[str ], Any ]] = ...,
171
172
parse_int : Optional [Callable [[str ], Any ]] = ...,
0 commit comments