Skip to content

Commit

Permalink
Deprecate python 3.7
Browse files Browse the repository at this point in the history
- Start supporting python 3.11
  • Loading branch information
Uxio0 committed Nov 9, 2022
1 parent 90e1e6f commit 0f5c0f6
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, "3.10"]
python-version: [3.8, 3.9, "3.10"]
services:
postgres:
image: postgres:13
Expand Down
4 changes: 2 additions & 2 deletions gnosis/eth/ethereum_client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
from enum import Enum
from functools import wraps
from functools import cached_property, wraps
from logging import getLogger
from typing import (
Any,
Expand Down Expand Up @@ -59,7 +59,7 @@
fast_to_checksum_address,
mk_contract_address,
)
from gnosis.util import cache, cached_property, chunks
from gnosis.util import cache, chunks

from .constants import (
ERC20_721_TRANSFER_TOPIC,
Expand Down
3 changes: 1 addition & 2 deletions gnosis/eth/oracles/kyber.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import logging
from functools import cached_property
from typing import Optional

from eth_abi.exceptions import DecodingError
from web3.exceptions import BadFunctionCallOutput

from gnosis.util import cached_property

from .. import EthereumClient, EthereumNetwork
from ..contracts import get_kyber_network_proxy_contract
from .exceptions import CannotGetPriceFromOracle, InvalidPriceFromOracle
Expand Down
3 changes: 1 addition & 2 deletions gnosis/eth/oracles/oracles.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
from abc import ABC, abstractmethod
from dataclasses import dataclass
from functools import cached_property
from typing import List, Optional, Tuple

import requests
Expand All @@ -12,8 +13,6 @@
from web3.contract import Contract
from web3.exceptions import BadFunctionCallOutput

from gnosis.util import cached_property

from .. import EthereumClient, EthereumNetwork
from ..constants import NULL_ADDRESS
from ..contracts import (
Expand Down
3 changes: 1 addition & 2 deletions gnosis/eth/oracles/uniswap_v3.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import functools
import logging
from functools import cached_property
from typing import Optional

from eth_abi.exceptions import DecodingError
from eth_typing import ChecksumAddress
from web3.contract import Contract
from web3.exceptions import BadFunctionCallOutput

from gnosis.util import cached_property

from .. import EthereumClient
from ..constants import NULL_ADDRESS
from ..contracts import get_erc20_contract
Expand Down
8 changes: 1 addition & 7 deletions gnosis/eth/typing.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
from typing import Optional, Union
from typing import Optional, TypedDict, Union

from eth_typing import Hash32, HexStr
from hexbytes import HexBytes

try:
from typing import TypedDict # pylint: disable=no-name-in-module
except ImportError:
from typing_extensions import TypedDict


EthereumHash = Union[Hash32, HexBytes, HexStr]
EthereumData = Union[bytes, HexStr]

Expand Down
9 changes: 2 additions & 7 deletions gnosis/protocol/gnosis_protocol_api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Dict, List, Optional, Union, cast
from functools import cached_property
from typing import Any, Dict, List, Optional, TypedDict, Union, cast

import requests
from eip712_structs import make_domain
Expand All @@ -9,15 +10,9 @@
from web3 import Web3

from gnosis.eth import EthereumNetwork, EthereumNetworkNotSupported
from gnosis.util import cached_property

from .order import Order, OrderKind

try:
from typing import TypedDict # pylint: disable=no-name-in-module
except ImportError:
from typing_extensions import TypedDict


class TradeResponse(TypedDict):
blockNumber: int
Expand Down
6 changes: 1 addition & 5 deletions gnosis/safe/api/relay_service_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from typing import TypedDict
from urllib.parse import urljoin

import requests
Expand All @@ -9,11 +10,6 @@
from ..signatures import signature_split
from .base_api import SafeAPIException, SafeBaseAPI

try:
from typing import TypedDict
except ImportError:
from typing_extensions import TypedDict


class RelayEstimation(TypedDict):
safeTxGas: int
Expand Down
9 changes: 1 addition & 8 deletions gnosis/safe/proxy_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,7 @@
get_proxy_factory_V1_1_1_contract,
)
from gnosis.eth.utils import compare_byte_code, fast_is_checksum_address

try:
from functools import cache
except ImportError:
from functools import lru_cache

cache = lru_cache(maxsize=None)

from gnosis.util import cache

logger = getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion gnosis/safe/safe.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import dataclasses
import math
from enum import Enum
from functools import cached_property
from logging import getLogger
from typing import Callable, List, NamedTuple, Optional, Union

Expand Down Expand Up @@ -33,7 +34,6 @@
get_eth_address_with_key,
)
from gnosis.safe.proxy_factory import ProxyFactory
from gnosis.util import cached_property

from ..eth.typing import EthereumData
from .exceptions import (
Expand Down
2 changes: 1 addition & 1 deletion gnosis/safe/safe_tx.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from functools import cached_property
from typing import Any, Dict, List, NoReturn, Optional, Tuple, Type

from eip712_structs import Address, Bytes, EIP712Struct, Uint, make_domain
Expand All @@ -11,7 +12,6 @@
from gnosis.eth import EthereumClient
from gnosis.eth.constants import NULL_ADDRESS
from gnosis.eth.contracts import get_safe_contract
from gnosis.util import cached_property

from ..eth.ethereum_client import TxSpeed
from ..eth.utils import fast_keccak
Expand Down
4 changes: 2 additions & 2 deletions gnosis/util/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa F401
from .util import cache, cached_property, chunks
from .util import cache, chunks

__all__ = ["chunks", "cached_property", "cache"]
__all__ = ["cache", "chunks"]
6 changes: 0 additions & 6 deletions gnosis/util/util.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
from typing import Any, Iterable, List

try:
from functools import cached_property # noqa F401
except ImportError:
from cached_property import cached_property # noqa F401


try:
from functools import cache
except ImportError:
Expand Down
4 changes: 1 addition & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cached-property==1.5.2
django==3.2.16
django-filter==22.1
djangorestframework==3.14.0
Expand All @@ -7,7 +6,6 @@ hexbytes==0.2.3
packaging
psycopg2-binary==2.9.5
py-evm==0.5.0a3
pysha3>=1.0.0
pysha3>=1.0.2
requests==2.28.1
typing-extensions==3.10.0.2
web3==5.31.1
6 changes: 2 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ classifiers =
License :: OSI Approved :: MIT License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Topic :: Internet :: WWW/HTTP
Topic :: Internet :: WWW/HTTP :: Dynamic Content
project_urls =
Expand All @@ -42,15 +42,13 @@ packages = find:
platforms = any
include_package_data = True
install_requires =
cached-property>=1.5; python_version < "3.8"
eip712_structs
packaging
py-evm==0.5.0a3
pysha3>=1.0.0
requests>=2
typing-extensions>=3.10; python_version < "3.8"
web3>=5.23.0
python_requires = >=3.7
python_requires = >=3.8

[options.package_data]
gnosis =
Expand Down

0 comments on commit 0f5c0f6

Please sign in to comment.