Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Upgrade black, mypy, and add type annotations to algod.py #442

Merged
merged 51 commits into from
Mar 13, 2023

Conversation

tzaffi
Copy link
Contributor

@tzaffi tzaffi commented Mar 2, 2023

mypy-ifying algod.py

tests/integration.tags Outdated Show resolved Hide resolved
examples/log_sig_example.py Outdated Show resolved Hide resolved
Zeph Grunschlag added 2 commits March 7, 2023 10:03
algosdk/v2client/algod.py Outdated Show resolved Hide resolved
algosdk/v2client/algod.py Outdated Show resolved Hide resolved
pass


class AccountTransactionSigner(TransactionSigner):
Copy link
Contributor Author

@tzaffi tzaffi Mar 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved these up

@@ -23,27 +24,6 @@
T = TypeVar("T")


class AtomicTransactionComposerStatus(IntEnum):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-ordering class definitions

@@ -76,11 +56,234 @@ def populate_foreign_array(
return offset + len(foreign_array) - 1


GenericSignedTransaction = Union[
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now this is imported from transaction.py

on_complete: transaction.OnComplete = transaction.OnComplete.NoOpOC,
local_schema: Optional[transaction.StateSchema] = None,
global_schema: Optional[transaction.StateSchema] = None,
approval_program: Optional[bytes] = None,
clear_program: Optional[bytes] = None,
extra_pages: Optional[int] = None,
extra_pages: int = 0,
Copy link
Contributor Author

@tzaffi tzaffi Mar 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

downstream, the extra_pages param defaults to 0 so I'm unifying the API here.

import urllib.error
from urllib import parse
from urllib.request import Request, urlopen

from algosdk import constants, encoding, error, transaction, util

AlgodResponseType = Union[Dict[str, Any], bytes]
Copy link
Contributor Author

@tzaffi tzaffi Mar 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AlgodResponseType results from the fact that the method algod_request() returns a dict when its response_format == 'json' (this is the default) and otherwise bytes

@tzaffi tzaffi merged commit 945a91f into develop Mar 13, 2023
@tzaffi tzaffi deleted the algod-mypy branch March 13, 2023 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants