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

remove code that was needed for py<=37 #3317

Merged
merged 1 commit into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions newsfragments/3317.internal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove code conditionally necessary for ``python<=3.7``
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"bumpversion",
"flaky>=3.7.0",
"hypothesis>=3.31.2",
"importlib-metadata<5.0;python_version<'3.8'",
"pytest>=7.0.0",
"pytest-asyncio>=0.18.1,<0.23",
"pytest-mock>=1.10",
Expand Down
9 changes: 2 additions & 7 deletions web3/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
from eth_account import Account # noqa: E402
import sys

if sys.version_info.major == 3 and sys.version_info.minor < 8:
import pkg_resources
from importlib.metadata import version

__version__ = pkg_resources.get_distribution("web3").version
else:
from importlib.metadata import version

__version__ = version("web3")
__version__ = version("web3")


from web3.main import (
Expand Down
3 changes: 0 additions & 3 deletions web3/_utils/compat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
# imported from `typing`

from typing_extensions import (
Literal, # py38
NotRequired, # py311
Protocol, # py38
TypedDict, # py38
Self, # py311
)
2 changes: 1 addition & 1 deletion web3/_utils/empty.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from web3._utils.compat import (
from typing import (
Literal,
)

Expand Down
4 changes: 1 addition & 3 deletions web3/_utils/module_testing/module_testing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Collection,
Dict,
Generator,
Literal,
Sequence,
Union,
)
Expand All @@ -28,9 +29,6 @@
HexBytes,
)

from web3._utils.compat import (
Literal,
)
from web3._utils.request import (
async_cache_and_return_session,
cache_and_return_session,
Expand Down
4 changes: 1 addition & 3 deletions web3/_utils/threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
Any,
Callable,
Generic,
Literal,
Type,
)

from web3._utils.compat import (
Literal,
)
from web3.types import (
TReturn,
)
Expand Down
4 changes: 1 addition & 3 deletions web3/_utils/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import (
TYPE_CHECKING,
List,
Literal,
Optional,
Union,
cast,
Expand All @@ -19,9 +20,6 @@
HexBytes,
)

from web3._utils.compat import (
Literal,
)
from web3._utils.utility_methods import (
all_in_dict,
any_in_dict,
Expand Down
4 changes: 1 addition & 3 deletions web3/geth.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Dict,
List,
Optional,
Protocol,
Tuple,
)

Expand All @@ -18,9 +19,6 @@
HexBytes,
)

from web3._utils.compat import (
Protocol,
)
from web3._utils.rpc_abi import (
RPC,
)
Expand Down
2 changes: 1 addition & 1 deletion web3/middleware/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Any,
Callable,
Coroutine,
Literal,
Optional,
Union,
cast,
Expand All @@ -21,7 +22,6 @@
EthSubscriptionParams,
Formatters,
FormattersDict,
Literal,
RPCEndpoint,
RPCResponse,
)
Expand Down
4 changes: 1 addition & 3 deletions web3/providers/eth_tester/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Callable,
Coroutine,
Dict,
Literal,
Optional,
Union,
)
Expand All @@ -18,9 +19,6 @@
is_bytes,
)

from web3._utils.compat import (
Literal,
)
from web3.providers import (
BaseProvider,
)
Expand Down
4 changes: 2 additions & 2 deletions web3/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
Coroutine,
Dict,
List,
Literal,
NewType,
Optional,
Sequence,
Type,
TypedDict,
TypeVar,
Union,
)
Expand All @@ -25,9 +27,7 @@
)

from web3._utils.compat import (
Literal,
NotRequired,
TypedDict,
)
from web3._utils.function_identifiers import (
FallbackFn,
Expand Down