aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbyteskeptical <40208858+byteskeptical@users.noreply.github.com>2024-01-23 14:53:14 +0000
committerbyteskeptical <40208858+byteskeptical@users.noreply.github.com>2024-01-23 14:53:14 +0000
commitb70dc042fd2247e06d35cd4fd44f2935f0d40aca (patch)
treefa98ce0bd011fc86dd634d6c022bd0aec861f0c8
parent2638392e6b7ebf6243b6df9c6ffe4004d54a5313 (diff)
taking a bit off the topdouble_deque
-rw-r--r--sftpretty/__init__.py19
-rw-r--r--sftpretty/helpers.py6
2 files changed, 9 insertions, 16 deletions
diff --git a/sftpretty/__init__.py b/sftpretty/__init__.py
index 317f49d..1f8c327 100644
--- a/sftpretty/__init__.py
+++ b/sftpretty/__init__.py
@@ -1377,8 +1377,8 @@ class Connection(object):
container = manager.dict()
with ThreadPoolExecutor() as executor:
_pool = {
- executor.submit(self._remotemap, container,
- remotedir, localdir, recurse): remotedir
+ executor.submit(self._remotemap, container, remotedir,
+ localdir, recurse): remotedir
}
while _pool:
@@ -1392,15 +1392,14 @@ class Connection(object):
log.error(('Exception while processing directory '
f'{remote}: {err}'))
del _pool[future]
-
+
if recurse:
- for _remote, _local in list(container.items()):
- for remote, local in _local:
- if _remote not in _pool.values():
- future = executor.submit(self._remotemap,
- container, _remote,
- _local, recurse)
- _pool[future] = _remote
+ for _remote, _local in container[remotedir]:
+ if _remote not in _pool.values():
+ future = executor.submit(self._remotemap,
+ container, _remote,
+ _local, recurse)
+ _pool[future] = _remote
return dict(container)
def remove(self, remotefile):
diff --git a/sftpretty/helpers.py b/sftpretty/helpers.py
index c69c5e5..b750daf 100644
--- a/sftpretty/helpers.py
+++ b/sftpretty/helpers.py
@@ -134,12 +134,6 @@ def localtree(localdir, remotedir, recurse=True):
_remote, recurse)
_pool[future] = _local
- _pool = {
- _file: localdir
- for _file, localdir in _pool.items()
- if _file not in done
- }
-
return dict(container)