Skip to content

Commit aa3ea61

Browse files
committed
Fix recursive import #1059
Signed-off-by: Philippe Ombredanne <[email protected]>
1 parent f9ac3c7 commit aa3ea61

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/extractcode/archive.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
from commoncode import fileutils
3535
from commoncode import filetype
3636
from commoncode.system import on_linux
37-
import typecode
37+
38+
from typecode import contenttype
3839

3940
from extractcode import all_kinds
4041
from extractcode import regular
@@ -165,7 +166,8 @@ def get_handlers(location):
165166
location = fileutils.fsencode(location)
166167

167168
if filetype.is_file(location):
168-
T = typecode.contenttype.get_type(location)
169+
170+
T = contenttype.get_type(location)
169171
ftype = T.filetype_file.lower()
170172
mtype = T.mimetype_file
171173

src/typecode/contenttype.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@
4646
from commoncode import filetype
4747
from commoncode.system import on_linux
4848

49-
from extractcode import archive
50-
5149
from typecode import magic2
5250
from typecode import entropy
5351

@@ -352,6 +350,8 @@ def is_archive(self):
352350
return self._is_archive
353351
self._is_archive = False
354352

353+
from extractcode import archive
354+
355355
ft = self.filetype_file.lower()
356356
can_extract = bool(archive.can_extract(self.location))
357357
docx_ext = 'x' if on_linux else u'x'

tests/extractcode/test_extract.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,3 +892,6 @@ def test_extract_can_extract_to_relative_paths(self):
892892
for r in result:
893893
assert [] == r.warnings
894894
assert [] == r.errors
895+
896+
def test_recursive_import(self):
897+
from extractcode.extract import extract # NOQA

0 commit comments

Comments
 (0)