Use pathclass.walk instead of spinal.walk.

This commit is contained in:
voussoir 2022-01-09 21:49:47 -08:00
parent 622632ce35
commit 57f80ecd90
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -6,7 +6,6 @@ import sys
from voussoirkit import passwordy from voussoirkit import passwordy
from voussoirkit import pathclass from voussoirkit import pathclass
from voussoirkit import spinal
from voussoirkit import vlogging from voussoirkit import vlogging
log = vlogging.getLogger(__name__, 'sole_subdir_lift') log = vlogging.getLogger(__name__, 'sole_subdir_lift')
@ -14,7 +13,7 @@ log = vlogging.getLogger(__name__, 'sole_subdir_lift')
def sole_lift_argparse(args): def sole_lift_argparse(args):
starting = pathclass.Path(args.starting) starting = pathclass.Path(args.starting)
queue = collections.deque() queue = collections.deque()
queue.extend(spinal.walk(starting, yield_files=False, yield_directories=True)) queue.extend(starting.walk_directories())
while len(queue) > 0: while len(queue) > 0:
directory = queue.popleft() directory = queue.popleft()
@ -48,7 +47,7 @@ def sole_lift_argparse(args):
shutil.move(grandchild, directory) shutil.move(grandchild, directory)
if temp_dir.listdir(): if temp_dir.listdir():
raise Exception() raise Exception('The temp dir is supposed to be empty by this point.')
os.rmdir(temp_dir) os.rmdir(temp_dir)
queue.append(directory.parent) queue.append(directory.parent)