...
This commit is contained in:
parent
3f28cf45d4
commit
0b3228ab16
@ -5,11 +5,15 @@ import importlib
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import unittest
|
import unittest
|
||||||
from importlib.resources import files
|
|
||||||
from typing import Callable, Generator, NoReturn, Sequence, Set, Iterator
|
from typing import Callable, Generator, NoReturn, Sequence, Set, Iterator
|
||||||
|
|
||||||
|
|
||||||
def contents(package: str) -> Iterator[str]:
|
def contents(package: str) -> Iterator[str]:
|
||||||
|
try:
|
||||||
|
from importlib.resources import files
|
||||||
|
except ImportError:
|
||||||
|
from importlib.resources import contents
|
||||||
|
return iter(contents(package))
|
||||||
return (path.name for path in files(package).iterdir())
|
return (path.name for path in files(package).iterdir())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user