Fix 'importlib.abc.TraversableResources' deprecation warning in Python 3.12 (#10452)
This commit is contained in:
parent
8e2de91bf8
commit
0314b50c52
|
@ -0,0 +1 @@
|
||||||
|
Fix 'importlib.abc.TraversableResources' deprecation warning in Python 3.12.
|
|
@ -275,7 +275,12 @@ class AssertionRewritingHook(importlib.abc.MetaPathFinder, importlib.abc.Loader)
|
||||||
|
|
||||||
if sys.version_info >= (3, 10):
|
if sys.version_info >= (3, 10):
|
||||||
|
|
||||||
def get_resource_reader(self, name: str) -> importlib.abc.TraversableResources: # type: ignore
|
if sys.version_info >= (3, 12):
|
||||||
|
from importlib.resources.abc import TraversableResources
|
||||||
|
else:
|
||||||
|
from importlib.abc import TraversableResources
|
||||||
|
|
||||||
|
def get_resource_reader(self, name: str) -> TraversableResources: # type: ignore
|
||||||
if sys.version_info < (3, 11):
|
if sys.version_info < (3, 11):
|
||||||
from importlib.readers import FileReader
|
from importlib.readers import FileReader
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue