Skip to content

Commit 020edeb

Browse files
committed
Changed overload order on GeoComProtocol
1 parent e65ec3f commit 020edeb

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

src/geocompy/protocols.py

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -138,59 +138,58 @@ def request(
138138
self,
139139
rpc: int,
140140
params: Iterable[int | float | bool | str | Angle | Byte] = (),
141-
parsers: Iterable[Callable[[str], Any]] | None = None
142-
) -> GeoComResponse[Iterable]:
141+
parsers: Callable[[str], _T] | None = None
142+
) -> GeoComResponse[_T]:
143143
"""
144144
Executes an RPC request and returns the parsed GeoCom response.
145145
146146
Constructs a request (from the given RPC code and parameters),
147147
writes it to the serial line, then reads the response. The
148-
response is then parsed using the provided parser functions.
148+
response is then parsed using the provided parser function.
149149
150150
Parameters
151151
----------
152152
rpc : int
153153
Number of the RPC to execute.
154154
params : Iterable[int | float | bool | str | Angle | Byte], optional
155-
Parameters for the request, by default ()
156-
parsers : Iterable[Callable[[str], Any]] | None, optional
157-
Parser functions for the values in the RPC response,
155+
Parameters for the request, by default []
156+
parsers : Callable[[str], Any] | None, optional
157+
Parser function for the value in the RPC response,
158158
by default None
159159
160160
Returns
161161
-------
162162
GeoComResponse
163-
Parsed return codes and parameters from the RPC response.
163+
Parsed return codes and parameter from the RPC response.
164164
165165
Raises
166166
------
167167
NotImplementedError
168168
If the method is not implemented on the class.
169-
170169
"""
171170

172171
@overload
173172
def request(
174173
self,
175174
rpc: int,
176175
params: Iterable[int | float | bool | str | Angle | Byte] = (),
177-
parsers: Callable[[str], _T] | None = None
178-
) -> GeoComResponse[_T]:
176+
parsers: Iterable[Callable[[str], Any]] | None = None
177+
) -> GeoComResponse[tuple]:
179178
"""
180179
Executes an RPC request and returns the parsed GeoCom response.
181180
182181
Constructs a request (from the given RPC code and parameters),
183182
writes it to the serial line, then reads the response. The
184-
response is then parsed using the provided parser function.
183+
response is then parsed using the provided parser functions.
185184
186185
Parameters
187186
----------
188187
rpc : int
189188
Number of the RPC to execute.
190189
params : Iterable[int | float | bool | str | Angle | Byte], optional
191-
Parameters for the request, by default []
192-
parsers : Callable[[str], Any] | None, optional
193-
Parser function for the value in the RPC response,
190+
Parameters for the request, by default ()
191+
parsers : Iterable[Callable[[str], Any]] | None, optional
192+
Parser functions for the values in the RPC response,
194193
by default None
195194
196195
Returns
@@ -249,8 +248,8 @@ def parse_response(
249248
cls,
250249
cmd: str,
251250
response: str,
252-
parsers: Iterable[Callable[[str], Any]] | None = None
253-
) -> GeoComResponse[Iterable]:
251+
parsers: Callable[[str], _T] | None = None
252+
) -> GeoComResponse[_T]:
254253
"""
255254
Parses RPC response and constructs :class:`GeoComResponse`
256255
instance.
@@ -261,14 +260,14 @@ def parse_response(
261260
Full, serialized request, that invoked the response.
262261
response : str
263262
Full, received response.
264-
parsers : Iterable[Callable[[str], Any]], optional
265-
Parser functions for the values in the RPC response, by
263+
parsers : Callable[[str], Any] | None, optional
264+
Parser function for the value in the RPC response, by
266265
default None
267266
268267
Returns
269268
-------
270269
GeoComResponse
271-
Parsed return codes and parameters from the RPC response.
270+
Parsed return codes and parameter from the RPC response.
272271
273272
Raises
274273
------
@@ -281,8 +280,8 @@ def parse_response(
281280
cls,
282281
cmd: str,
283282
response: str,
284-
parsers: Callable[[str], _T] | None = None
285-
) -> GeoComResponse[_T]:
283+
parsers: Iterable[Callable[[str], Any]] | None = None
284+
) -> GeoComResponse[tuple]:
286285
"""
287286
Parses RPC response and constructs :class:`GeoComResponse`
288287
instance.
@@ -293,8 +292,8 @@ def parse_response(
293292
Full, serialized request, that invoked the response.
294293
response : str
295294
Full, received response.
296-
parsers : Callable[[str], Any] | None, optional
297-
Parser function for the value in the RPC response, by
295+
parsers : Iterable[Callable[[str], Any]], optional
296+
Parser functions for the values in the RPC response, by
298297
default None
299298
300299
Returns

0 commit comments

Comments
 (0)