Skip to content

Commit

Permalink
Workaround to have original error handling for get() and pass mypy …
Browse files Browse the repository at this point in the history
…checks
  • Loading branch information
kysrpex committed Aug 9, 2024
1 parent 6fc0d46 commit 4e6688c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/galaxy/managers/interactivetool.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ def get(self, key, key_type):
gxitproxy.c.key_type == key_type,
)
cursor_result = conn.execute(stmt)
result = cursor_result.fetchone()

try:
return dict(key=key, key_type=key_type, **dict(zip(cursor_result.keys(), cursor_result.fetchone())))
except TypeError: # when `cursor_result.fetchone() is None` (no results)
if result is None:
log.warning("get(): invalid key: %s key_type %s", key, key_type)
return None

return dict(key=key, key_type=key_type, **dict(zip(cursor_result.keys(), result)))

def save(self, key, key_type, token, host, port, info=None):
"""
Write out a key, key_type, token, value store that is can be used for coordinating with external resources.
Expand Down

0 comments on commit 4e6688c

Please sign in to comment.