Skip to content

Commit ebdcffd

Browse files
committed
Fixed GeoComReturn truthiness
1 parent a4ea834 commit ebdcffd

File tree

5 files changed

+7
-8
lines changed

5 files changed

+7
-8
lines changed

src/geocompy/protocols.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
class GeoComReturnCode(IntEnum):
3939
"""Base class for all GeoCom return code enums."""
4040

41+
def __bool__(self) -> bool:
42+
return self == 0
43+
4144

4245
class GeoComResponse(Generic[_P]):
4346
"""

src/geocompy/tps1000/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,7 @@ def __init__(
173173
for i in range(retry):
174174
try:
175175
self._conn.send("\n")
176-
response = self.com.nullprocess()
177-
if not response.error:
176+
if self.com.nullprocess():
178177
sleep(1)
179178
break
180179
except Exception:

src/geocompy/tps1100/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,7 @@ def __init__(
179179
for i in range(retry):
180180
try:
181181
self._conn.send("\n")
182-
response = self.com.nullprocess()
183-
if not response.error:
182+
if self.com.nullprocess():
184183
sleep(1)
185184
break
186185
except Exception:

src/geocompy/tps1200p/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,7 @@ def __init__(
179179
for i in range(retry):
180180
try:
181181
self._conn.send("\n")
182-
response = self.com.nullprocess()
183-
if not response.error:
182+
if self.com.nullprocess():
184183
sleep(1)
185184
break
186185
except Exception:

src/geocompy/vivatps/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,7 @@ def __init__(
192192
for i in range(retry):
193193
try:
194194
self._conn.send("\n")
195-
response = self.com.nullprocess()
196-
if not response.error:
195+
if self.com.nullprocess():
197196
sleep(1)
198197
break
199198
except Exception:

0 commit comments

Comments
 (0)