Open
Description
Problem
Version 2.1.0 introduced AlgodResponseType
that is returned by most of AlgodClient
methods.
It's a union of dict
and bytes
meaning that I must cast the response type every time I use any algod method.
last_round = cast(dict, algod_client.status())["last-round"]
# instead of
last_round = algod_client.status()["last-round"]
This complicates the code for no real benefit as the underlying dict is still not typed and the type checker has no idea what fields are inside the dict.
Now I have to add the pointless casting to my multiple repositories that use the algod.
It's a counter-productive way of typing things.
Solution
One of two things:
- Remove the return type completely on the algod methods.
- Make two versions of each method - one that returns bytes and one that returns a dict. A nice addition would be to have the dict fully typed.
Dependencies
N/A
Urgency
Low, nothing is broken but it prevents me from updating.