Skip to content

Commit bfaee17

Browse files
committed
Rely on _compat for Python 2.7 compatibility shims
1 parent 9f4cc35 commit bfaee17

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

importlib_resources/trees.py

+3-11
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
from __future__ import absolute_import
22

33
import abc
4-
import six
54
import zipp
65

7-
try:
8-
import pathlib
9-
except ImportError:
10-
import pathlib2 as pathlib
6+
from ._compat import ABC, Path
117

128

13-
__metaclass__ = type
14-
15-
16-
@six.add_metaclass(abc.ABCMeta)
17-
class Traversable:
9+
class Traversable(ABC):
1810
@abc.abstractmethod
1911
def iterdir(self):
2012
"""
@@ -48,7 +40,7 @@ def is_file(self):
4840

4941
def from_package(package):
5042
"""Return a Traversable object for the given package"""
51-
package_directory = pathlib.Path(package.__spec__.origin).parent
43+
package_directory = Path(package.__spec__.origin).parent
5244
try:
5345
archive_path = package.__spec__.loader.archive
5446
rel_path = package_directory.relative_to(archive_path)

setup.cfg

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ install_requires =
2424
pathlib2; python_version < '3'
2525
typing; python_version < '3.5'
2626
zipp >= 0.4
27-
six
2827
packages = find:
2928

3029
[options.package_data]

0 commit comments

Comments
 (0)