This repository was archived by the owner on Sep 8, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +54
-29
lines changed Expand file tree Collapse file tree 7 files changed +54
-29
lines changed Original file line number Diff line number Diff line change 1+ from contextlib import contextmanager
2+ import warnings
3+
4+
5+ # TODO: drop once https://github.com/cython/cython/issues/1720 is resolved
6+ @contextmanager
7+ def catch_and_ignore_import_warning ():
8+ with warnings .catch_warnings ():
9+ warnings .simplefilter ('ignore' , category = ImportWarning )
10+ yield
Original file line number Diff line number Diff line change 2828 Hash32 ,
2929)
3030
31- from eth_utils import (
32- to_set ,
33- ValidationError ,
34- )
35- from eth_utils .toolz import (
36- assoc ,
37- compose ,
38- groupby ,
39- iterate ,
40- take ,
41- )
42-
4331from eth .db .backends .base import BaseAtomicDB
4432from eth .db .chain import (
4533 BaseChainDB ,
10391 AccountState ,
10492)
10593
94+ from eth ._warnings import catch_and_ignore_import_warning
95+ with catch_and_ignore_import_warning ():
96+ from eth_utils import (
97+ to_set ,
98+ ValidationError ,
99+ )
100+ from eth_utils .toolz import (
101+ assoc ,
102+ compose ,
103+ groupby ,
104+ iterate ,
105+ take ,
106+ )
107+
106108if TYPE_CHECKING :
107109 from eth .vm .base import BaseVM # noqa: F401
108110
Original file line number Diff line number Diff line change 22 Address ,
33 Hash32
44)
5- from eth_utils import denoms
5+
6+ from eth ._warnings import catch_and_ignore_import_warning
7+ with catch_and_ignore_import_warning ():
8+ from eth_utils import denoms
69
710
811ANY = 'any'
Original file line number Diff line number Diff line change 1717 BaseDB ,
1818)
1919
20+ from eth ._warnings import catch_and_ignore_import_warning
21+
2022if TYPE_CHECKING :
21- import plyvel # noqa: F401
23+ with catch_and_ignore_import_warning ():
24+ import plyvel # noqa: F401
2225
2326
2427class LevelDB (BaseAtomicDB ):
@@ -29,7 +32,8 @@ def __init__(self, db_path: Path = None) -> None:
2932 if not db_path :
3033 raise TypeError ("Please specifiy a valid path for your database." )
3134 try :
32- import plyvel # noqa: F811
35+ with catch_and_ignore_import_warning ():
36+ import plyvel # noqa: F811
3337 except ImportError :
3438 raise ImportError (
3539 "LevelDB requires the plyvel library which is not available for import."
Original file line number Diff line number Diff line change 1313 TYPE_CHECKING ,
1414)
1515
16- import rlp
17-
18- from trie import (
19- HexaryTrie ,
20- )
21-
2216from eth_typing import (
2317 BlockNumber ,
2418 Hash32
2519)
2620
27- from eth_utils import (
28- to_list ,
29- to_tuple ,
30- ValidationError ,
31- )
32-
3321from eth_hash .auto import keccak
3422
3523from eth .constants import (
5745from eth .validation import (
5846 validate_word ,
5947)
48+ from eth ._warnings import catch_and_ignore_import_warning
49+ with catch_and_ignore_import_warning ():
50+ import rlp
51+ from trie import (
52+ HexaryTrie ,
53+ )
54+ from eth_utils import (
55+ to_list ,
56+ to_tuple ,
57+ ValidationError ,
58+ )
6059
6160if TYPE_CHECKING :
6261 from eth .rlp .blocks import ( # noqa: F401
Original file line number Diff line number Diff line change 1818)
1919import netifaces
2020from p2p .service import BaseService
21- import upnpclient
21+
22+ from eth ._warnings import catch_and_ignore_import_warning
23+ with catch_and_ignore_import_warning ():
24+ import upnpclient
2225
2326
2427# UPnP discovery can take a long time, so use a loooong timeout here.
Original file line number Diff line number Diff line change @@ -21,7 +21,11 @@ def is_uvloop_supported() -> bool:
2121if is_uvloop_supported ():
2222 # Set `uvloop` as the default event loop
2323 import asyncio # noqa: E402
24- import uvloop # noqa: E402
24+
25+ from eth ._warnings import catch_and_ignore_import_warning
26+ with catch_and_ignore_import_warning ():
27+ import uvloop # noqa: E402
28+
2529 asyncio .set_event_loop_policy (uvloop .EventLoopPolicy ())
2630
2731from .main import ( # noqa: F401
You can’t perform that action at this time.
0 commit comments