1414
1515logger = logging .getLogger (__name__ )
1616
17- if sys .version_info >= (3 , 6 ):
18- _PathLike = os .PathLike
19- else :
20- _PathLike = str
21-
2217
2318def with_warn_for_invalid_lines (mappings : Iterator [Binding ]) -> Iterator [Binding ]:
2419 for mapping in mappings :
@@ -33,14 +28,14 @@ def with_warn_for_invalid_lines(mappings: Iterator[Binding]) -> Iterator[Binding
3328class DotEnv ():
3429 def __init__ (
3530 self ,
36- dotenv_path : Optional [Union [str , _PathLike ]],
31+ dotenv_path : Optional [Union [str , os . PathLike ]],
3732 stream : Optional [IO [str ]] = None ,
3833 verbose : bool = False ,
3934 encoding : Union [None , str ] = None ,
4035 interpolate : bool = True ,
4136 override : bool = True ,
4237 ) -> None :
43- self .dotenv_path = dotenv_path # type: Optional[Union[str, _PathLike ]]
38+ self .dotenv_path = dotenv_path # type: Optional[Union[str, os.PathLike ]]
4439 self .stream = stream # type: Optional[IO[str]]
4540 self ._dict = None # type: Optional[Dict[str, Optional[str]]]
4641 self .verbose = verbose # type: bool
@@ -113,7 +108,7 @@ def get(self, key: str) -> Optional[str]:
113108
114109
115110def get_key (
116- dotenv_path : Union [str , _PathLike ],
111+ dotenv_path : Union [str , os . PathLike ],
117112 key_to_get : str ,
118113 encoding : Optional [str ] = "utf-8" ,
119114) -> Optional [str ]:
@@ -127,7 +122,7 @@ def get_key(
127122
128123@contextmanager
129124def rewrite (
130- path : Union [str , _PathLike ],
125+ path : Union [str , os . PathLike ],
131126 encoding : Optional [str ],
132127) -> Iterator [Tuple [IO [str ], IO [str ]]]:
133128 try :
@@ -146,7 +141,7 @@ def rewrite(
146141
147142
148143def set_key (
149- dotenv_path : Union [str , _PathLike ],
144+ dotenv_path : Union [str , os . PathLike ],
150145 key_to_set : str ,
151146 value_to_set : str ,
152147 quote_mode : str = "always" ,
@@ -195,7 +190,7 @@ def set_key(
195190
196191
197192def unset_key (
198- dotenv_path : Union [str , _PathLike ],
193+ dotenv_path : Union [str , os . PathLike ],
199194 key_to_unset : str ,
200195 quote_mode : str = "always" ,
201196 encoding : Optional [str ] = "utf-8" ,
@@ -310,7 +305,7 @@ def _is_interactive():
310305
311306
312307def load_dotenv (
313- dotenv_path : Union [str , _PathLike , None ] = None ,
308+ dotenv_path : Union [str , os . PathLike , None ] = None ,
314309 stream : Optional [IO [str ]] = None ,
315310 verbose : bool = False ,
316311 override : bool = False ,
@@ -348,7 +343,7 @@ def load_dotenv(
348343
349344
350345def dotenv_values (
351- dotenv_path : Union [str , _PathLike , None ] = None ,
346+ dotenv_path : Union [str , os . PathLike , None ] = None ,
352347 stream : Optional [IO [str ]] = None ,
353348 verbose : bool = False ,
354349 interpolate : bool = True ,
0 commit comments