Skip to content

Commit d5d0bf2

Browse files
committed
fix: cannot use | for Union syntax in 3.9
1 parent c4c06fc commit d5d0bf2

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

ape_safe/factory.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import secrets
22
from functools import cache
3-
from typing import TYPE_CHECKING, Iterable
3+
from typing import TYPE_CHECKING, Iterable, Optional, Union
44

55
from ape.types import AddressType
66
from ape.utils import ZERO_ADDRESS, ManagerAccessMixin
@@ -42,16 +42,16 @@ def get_singleton(self, version: Version) -> "ContractInstance":
4242

4343
def create(
4444
self,
45-
owners: Iterable["AddressType | str"],
45+
owners: Iterable[Union["AddressType", str]],
4646
threshold: int,
47-
callback_address: "AddressType | str" = ZERO_ADDRESS,
48-
callback_calldata: bytes | None = None,
49-
fallback_handler: "AddressType | str" = ZERO_ADDRESS,
50-
payment_token: "AddressType | str" = ZERO_ADDRESS,
51-
payment_amount: str | int = 0,
52-
payment_receiver: "AddressType | str" = ZERO_ADDRESS,
53-
salt: int | None = None,
54-
version: "Version | str | None" = None,
47+
callback_address: Union["AddressType", str] = ZERO_ADDRESS,
48+
callback_calldata: Optional[bytes] = None,
49+
fallback_handler: Union["AddressType", str] = ZERO_ADDRESS,
50+
payment_token: Union["AddressType", str] = ZERO_ADDRESS,
51+
payment_amount: Union[str, int] = 0,
52+
payment_receiver: Union["AddressType", str] = ZERO_ADDRESS,
53+
salt: Optional[int] = None,
54+
version: Union[Version, str, None] = None,
5555
**txn_kwargs,
5656
) -> "ContractInstance":
5757
if not (owners := [self.conversion_manager.convert(a, AddressType) for a in owners]):

ape_safe/packages.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from enum import Enum
22
from importlib import resources
3-
from typing import TYPE_CHECKING
3+
from typing import TYPE_CHECKING, Union
44

55
import requests
66
from ape.managers.project import ProjectManager
@@ -23,7 +23,7 @@ class PackageType(str, Enum):
2323
PROXY = "SafeProxy"
2424
PROXY_FACTORY = "SafeProxyFactory"
2525

26-
def __call__(self, version: Version | str) -> "ContractContainer":
26+
def __call__(self, version: Union[Version, str]) -> "ContractContainer":
2727
if not isinstance(version, Version):
2828
version = Version(version.lstrip("v"))
2929

@@ -71,15 +71,15 @@ class DeploymentAsset(BaseModel):
7171
version: str
7272
deployments: dict[DeploymentType, DeploymentInfo]
7373
# ChainID => DeploymentType
74-
networkAddresses: dict[int, DeploymentType | list[DeploymentType]]
74+
networkAddresses: dict[int, Union[DeploymentType, list[DeploymentType]]]
7575

7676

7777
BASE_ASSETS_URL = (
7878
"https://raw.githubusercontent.com/safe-global/safe-deployments/refs/heads/main/src/assets/"
7979
)
8080

8181

82-
def get_singleton(chain_id: int, version: Version | str) -> "ContractInstance":
82+
def get_singleton(chain_id: int, version: Union[Version, str]) -> "ContractInstance":
8383
if not isinstance(version, Version):
8484
version = Version(version.lstrip("v"))
8585

@@ -102,7 +102,7 @@ def get_singleton(chain_id: int, version: Version | str) -> "ContractInstance":
102102
return Singleton.at(deployment_info.address)
103103

104104

105-
def get_factory(chain_id: int, version: Version | str) -> "ContractInstance":
105+
def get_factory(chain_id: int, version: Union[Version, str]) -> "ContractInstance":
106106
if not isinstance(version, Version):
107107
version = Version(version.lstrip("v"))
108108

0 commit comments

Comments
 (0)