Skip to content

Commit a49deed

Browse files
committed
Fix type annotations and unused imports in fs.tarfs
1 parent 7ac51fb commit a49deed

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

fs/tarfs.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
from __future__ import print_function
55
from __future__ import unicode_literals
66

7-
import operator
87
import os
98
import tarfile
109
import typing
1110
from collections import OrderedDict
12-
from typing import cast, IO
1311

1412
import six
1513
from six.moves import map
@@ -309,7 +307,7 @@ def _directory_entries(self):
309307

310308
# add all implicit dirnames if not in the cache already
311309
for partial_name in map(relpath, recursepath(_name)):
312-
dirinfo = tarfile.TarInfo(self._encode(partial_name))
310+
dirinfo = tarfile.TarInfo(_encode(partial_name))
313311
dirinfo.type = tarfile.DIRTYPE
314312
_cache.setdefault(partial_name, dirinfo)
315313

@@ -391,7 +389,6 @@ def getinfo(self, path, namespaces=None):
391389
raw_info["details"] = {"type": int(ResourceType.directory)}
392390

393391
else:
394-
395392
_realpath = self._resolve(_path)
396393
if _realpath is None:
397394
raise errors.ResourceNotFound(path)
@@ -406,10 +403,10 @@ def getinfo(self, path, namespaces=None):
406403

407404
if "link" in namespaces:
408405
if member.issym():
409-
target = join(
406+
target = normpath(join(
410407
dirname(self._decode(member.name)),
411408
self._decode(member.linkname),
412-
)
409+
)) # type: Option[Text]
413410
else:
414411
target = None
415412
raw_info["link"] = {"target": target}

0 commit comments

Comments
 (0)