From a49deed9c34d471fdaefd3f9e7ca4064e1d1b92c Mon Sep 17 00:00:00 2001 From: Martin Larralde Date: Sat, 19 Sep 2020 20:57:04 +0200 Subject: [PATCH] Fix type annotations and unused imports in `fs.tarfs` --- fs/tarfs.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/fs/tarfs.py b/fs/tarfs.py index 2d12016f..8729027d 100644 --- a/fs/tarfs.py +++ b/fs/tarfs.py @@ -4,12 +4,10 @@ from __future__ import print_function from __future__ import unicode_literals -import operator import os import tarfile import typing from collections import OrderedDict -from typing import cast, IO import six from six.moves import map @@ -309,7 +307,7 @@ def _directory_entries(self): # add all implicit dirnames if not in the cache already for partial_name in map(relpath, recursepath(_name)): - dirinfo = tarfile.TarInfo(self._encode(partial_name)) + dirinfo = tarfile.TarInfo(_encode(partial_name)) dirinfo.type = tarfile.DIRTYPE _cache.setdefault(partial_name, dirinfo) @@ -391,7 +389,6 @@ def getinfo(self, path, namespaces=None): raw_info["details"] = {"type": int(ResourceType.directory)} else: - _realpath = self._resolve(_path) if _realpath is None: raise errors.ResourceNotFound(path) @@ -406,10 +403,10 @@ def getinfo(self, path, namespaces=None): if "link" in namespaces: if member.issym(): - target = join( + target = normpath(join( dirname(self._decode(member.name)), self._decode(member.linkname), - ) + )) # type: Option[Text] else: target = None raw_info["link"] = {"target": target}