@@ -49,31 +49,6 @@ def __fspath__(self) -> ty.AnyStr:
49
49
path_obj_types = (os .PathLike ,)
50
50
51
51
52
- @ty .overload
53
- def convert_path (path : ty .AnyStr ) -> ty .AnyStr :
54
- ...
55
-
56
-
57
- @ty .overload
58
- def convert_path (path : PathLike_str ) -> PathLike_str :
59
- ...
60
-
61
-
62
- @ty .overload
63
- def convert_path (path : PathLike_bytes ) -> PathLike_bytes :
64
- ...
65
-
66
-
67
- @ty .overload
68
- def convert_path (path : AnyPath ) -> AnyPath :
69
- ...
70
-
71
-
72
- def convert_path (path : AnyPath ) -> AnyPath :
73
- # Not needed since all system APIs also accept an `os.PathLike`
74
- return path
75
-
76
-
77
52
# work around GH/mypy/mypy#731: no recursive structural types yet
78
53
json_primitive_t = ty .Union [bool , float , int , str ]
79
54
json_value_t = ty .Union [
@@ -143,7 +118,7 @@ def clean_file(file: clean_file_t) -> ty.Tuple[ty.IO[bytes], bool]:
143
118
return os .fdopen (file , 'rb' , closefd = False ), True
144
119
elif not hasattr (file , 'read' ):
145
120
file = ty .cast (path_t , file ) # Cannot be ty.IO[bytes] without `.read()`
146
- return open (convert_path ( file ) , 'rb' ), True
121
+ return open (file , 'rb' ), True
147
122
else :
148
123
file = ty .cast (ty .IO [bytes ], file ) # Must be ty.IO[bytes]
149
124
return file , False
@@ -186,10 +161,11 @@ class return_field(ty.Generic[T]):
186
161
The response field to be returned for all invocations
187
162
"""
188
163
__slots__ = ("field" ,)
189
- #field: str
164
+
165
+ field : str
190
166
191
167
def __init__ (self , field : str ) -> None :
192
- self .field = field # type: str
168
+ self .field = field
193
169
194
170
def __call__ (self , cmd : F ) -> ty .Callable [..., T ]:
195
171
"""Wraps a command so that only a specified field is returned.
0 commit comments