Skip to content

Commit

Permalink
fix: cannot use | for Union syntax in 3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
fubuloubu committed Feb 25, 2025
1 parent c4c06fc commit d5d0bf2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
20 changes: 10 additions & 10 deletions ape_safe/factory.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import secrets
from functools import cache
from typing import TYPE_CHECKING, Iterable
from typing import TYPE_CHECKING, Iterable, Optional, Union

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

def create(
self,
owners: Iterable["AddressType | str"],
owners: Iterable[Union["AddressType", str]],
threshold: int,
callback_address: "AddressType | str" = ZERO_ADDRESS,
callback_calldata: bytes | None = None,
fallback_handler: "AddressType | str" = ZERO_ADDRESS,
payment_token: "AddressType | str" = ZERO_ADDRESS,
payment_amount: str | int = 0,
payment_receiver: "AddressType | str" = ZERO_ADDRESS,
salt: int | None = None,
version: "Version | str | None" = None,
callback_address: Union["AddressType", str] = ZERO_ADDRESS,
callback_calldata: Optional[bytes] = None,
fallback_handler: Union["AddressType", str] = ZERO_ADDRESS,
payment_token: Union["AddressType", str] = ZERO_ADDRESS,
payment_amount: Union[str, int] = 0,
payment_receiver: Union["AddressType", str] = ZERO_ADDRESS,
salt: Optional[int] = None,
version: Union[Version, str, None] = None,
**txn_kwargs,
) -> "ContractInstance":
if not (owners := [self.conversion_manager.convert(a, AddressType) for a in owners]):
Expand Down
10 changes: 5 additions & 5 deletions ape_safe/packages.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from enum import Enum
from importlib import resources
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Union

import requests
from ape.managers.project import ProjectManager
Expand All @@ -23,7 +23,7 @@ class PackageType(str, Enum):
PROXY = "SafeProxy"
PROXY_FACTORY = "SafeProxyFactory"

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

Expand Down Expand Up @@ -71,15 +71,15 @@ class DeploymentAsset(BaseModel):
version: str
deployments: dict[DeploymentType, DeploymentInfo]
# ChainID => DeploymentType
networkAddresses: dict[int, DeploymentType | list[DeploymentType]]
networkAddresses: dict[int, Union[DeploymentType, list[DeploymentType]]]


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


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

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


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

Expand Down

0 comments on commit d5d0bf2

Please sign in to comment.