Skip to content

Commit 660ecc6

Browse files
committed
Replaced GeoComResponse code attributes
1 parent 8e58537 commit 660ecc6

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/geocompy/protocols.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,13 @@ def __init__(
100100
"""Full, serialized request, that invoked this response."""
101101
self.response: str = response
102102
"""Full, received response."""
103-
self.comcode: GeoComReturnCode = comcode
104-
"""Parsed COM return code indicating the success/failure of
105-
communication."""
106-
self.rpccode: GeoComReturnCode = rpccode
107-
"""Parsed RPC return code indicating the success/failure of
108-
the command."""
103+
self.code: GeoComReturnCode = (
104+
comcode
105+
if comcode.value == 0
106+
else rpccode
107+
)
108+
"""Parsed return code indicating the success/failure of the
109+
request."""
109110
self.trans: int = trans
110111
"""Parsed transaction ID."""
111112
self.params: _P | None = params
@@ -114,15 +115,14 @@ def __init__(
114115

115116
def __str__(self) -> str:
116117
return (
117-
f"GeoComResponse({self.rpcname}) com: {self.comcode.name:s}, "
118-
f"rpc: {self.rpccode.name:s}, "
118+
f"GeoComResponse({self.rpcname}) code: {self.code.name:s}, "
119119
f"tr: {self.trans:d}, "
120120
f"params: {self.params}, "
121121
f"(cmd: '{self.cmd}', response: '{self.response}')"
122122
)
123123

124124
def __bool__(self) -> bool:
125-
return bool(self.comcode) and bool(self.rpccode)
125+
return bool(self.code)
126126

127127
def map_params(
128128
self,
@@ -151,8 +151,8 @@ def map_params(
151151
self.rpcname,
152152
self.cmd,
153153
self.response,
154-
self.comcode,
155-
self.rpccode,
154+
self.code,
155+
self.code,
156156
self.trans,
157157
params
158158
)

0 commit comments

Comments
 (0)