Skip to content

Commit

Permalink
Merge pull request #60 from janezpodhostnik/downgrade-python
Browse files Browse the repository at this point in the history
Downgrade to python3.9
  • Loading branch information
janezpodhostnik authored Feb 26, 2023
2 parents 3d673cf + f85c74a commit a41d66b
Show file tree
Hide file tree
Showing 7 changed files with 297 additions and 211 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.11
python-version: 3.9
- name: Setup Poetry
uses: abatilo/[email protected]
- name: Poetry - Cache
Expand All @@ -46,7 +46,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.11
python-version: 3.9
- name: Setup Poetry
uses: abatilo/[email protected]
- name: Poetry - Cache
Expand All @@ -71,7 +71,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.11
python-version: 3.9
- name: Setup Poetry
uses: abatilo/[email protected]
- name: Poetry - Cache
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.11
python-version: 3.9
- name: Setup Poetry
uses: abatilo/[email protected]
- name: Poetry - Cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11
python-version: 3.9
- name: Setup Poetry
uses: abatilo/[email protected]
- name: Install poetry-dynamic-versioning
Expand Down
4 changes: 2 additions & 2 deletions flow_py_sdk/cadence/decode.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Callable, Type
from typing import Any, Callable, Type, Union

from flow_py_sdk.cadence.value import Value
from flow_py_sdk.cadence.kind import Kind
Expand All @@ -17,7 +17,7 @@ def add_cadence_kind_decoder(t: Type[Kind]):
_cadence_kind_decoders[t.kind_str()] = t.decode


def decode(obj: [dict[Any, Any]]) -> Value | Kind:
def decode(obj: [dict[Any, Any]]) -> Union[Value, Kind]:
# json decoder starts from bottom up, so it's possible that this is already decoded
if isinstance(obj, Value) or isinstance(obj, Kind):
return obj
Expand Down
11 changes: 7 additions & 4 deletions flow_py_sdk/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import json
import logging
from types import TracebackType
from typing import Optional, Type, Annotated, List
from typing import Optional, Type, Annotated, List, Union

import time
from grpclib.client import Channel
Expand Down Expand Up @@ -196,7 +196,7 @@ async def get_transaction(self, *, id: bytes = b"") -> entities.Transaction:
return entities.Transaction.from_proto(response.transaction)

async def get_account(
self, *, address: bytes | cadence.Address | str = b""
self, *, address: Union[bytes, cadence.Address, str] = b""
) -> entities.Account:
"""
Get an account using its address.
Expand All @@ -218,7 +218,7 @@ async def get_account(
return entities.Account.from_proto(response.account)

async def get_account_at_latest_block(
self, *, address: bytes | cadence.Address | str = b""
self, *, address: Union[bytes, cadence.Address, str] = b""
) -> entities.Account:
"""
Get an account by address at the latest sealed block.
Expand All @@ -240,7 +240,10 @@ async def get_account_at_latest_block(
return entities.Account.from_proto(response.account)

async def get_account_at_block_height(
self, *, address: bytes | cadence.Address | str = b"", block_height: int = 0
self,
*,
address: Union[bytes, cadence.Address, str] = b"",
block_height: int = 0,
) -> entities.Account:
"""
Get an account by address at the given block height.
Expand Down
478 changes: 280 additions & 198 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ readme = "README.md"
repository = "https://github.com/janezpodhostnik/flow-py-sdk"

[tool.poetry.dependencies]
python = "^3.11"
python = "^3.9"
betterproto = {extras = ["compiler"], version = "v2.0.0-beta5"}
grpcio-tools = "^1.51"
ecdsa = "^v0.18"
Expand Down
3 changes: 2 additions & 1 deletion tests/cadence/encode_test.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import json
import unittest
from ctypes import Union
from dataclasses import dataclass
from flow_py_sdk import cadence


@dataclass
class _EncodeTestParams:
name: str
val: cadence.Value | cadence.Kind
val: any
expected: str


Expand Down

0 comments on commit a41d66b

Please sign in to comment.