Migrate scripts from spinal.walk_generator to spinal.walk.

This commit is contained in:
voussoir 2021-05-17 17:00:51 -07:00
parent a2c80f8a79
commit 05d59c2149
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB
9 changed files with 9 additions and 9 deletions

View file

@ -60,7 +60,7 @@ def unicode_normalize(s):
def brename(transformation, autoyes=False, do_naturalsort=False, recurse=False): def brename(transformation, autoyes=False, do_naturalsort=False, recurse=False):
if recurse: if recurse:
walker = spinal.walk_generator('.', yield_files=True, yield_directories=True) walker = spinal.walk('.', yield_files=True, yield_directories=True)
olds = list(walker) olds = list(walker)
else: else:
olds = cwd.listdir() olds = cwd.listdir()

View file

@ -2,7 +2,7 @@ from voussoirkit import spinal
basenames = {} basenames = {}
walker = spinal.walk_generator('.', yield_directories=True, yield_files=False) walker = spinal.walk('.', yield_directories=True, yield_files=False)
for directory in walker: for directory in walker:
basenames.setdefault(directory.basename, []).append(directory) basenames.setdefault(directory.basename, []).append(directory)

View file

@ -4,7 +4,7 @@ from voussoirkit import spinal
counts = collections.Counter() counts = collections.Counter()
extensions = {} extensions = {}
walker = spinal.walk_generator() walker = spinal.walk()
for file in walker: for file in walker:
extensions.setdefault(file.extension, []).append(file) extensions.setdefault(file.extension, []).append(file)
counts[file.extension] += 1 counts[file.extension] += 1

View file

@ -9,7 +9,7 @@ from voussoirkit import interactive
from voussoirkit import spinal from voussoirkit import spinal
def filepull(pull_from='.', autoyes=False): def filepull(pull_from='.', autoyes=False):
files = list(spinal.walk_generator(pull_from)) files = list(spinal.walk(pull_from))
cwd = os.getcwd() cwd = os.getcwd()
files = [f for f in files if os.path.split(f.absolute_path)[0] != cwd] files = [f for f in files if os.path.split(f.absolute_path)[0] != cwd]

View file

@ -35,7 +35,7 @@ def hash_hardlink_argparse(args):
if path.is_file: if path.is_file:
files.append(path) files.append(path)
elif path.is_dir: elif path.is_dir:
files.extend(spinal.walk_generator(path)) files.extend(spinal.walk(path))
inodes = set() inodes = set()
hashes = {} hashes = {}

View file

@ -12,7 +12,7 @@ from voussoirkit import spinal
@pipeable.ctrlc_return1 @pipeable.ctrlc_return1
def inputrename_argparse(args): def inputrename_argparse(args):
if args.recurse: if args.recurse:
files = (file for file in spinal.walk_generator('.') if args.keyword in file.basename) files = (file for file in spinal.walk('.') if args.keyword in file.basename)
else: else:
files = (file for file in pathclass.cwd().listdir() if args.keyword in file.basename) files = (file for file in pathclass.cwd().listdir() if args.keyword in file.basename)
prev = None prev = None

View file

@ -17,7 +17,7 @@ from voussoirkit import pathclass
def prune_dirs(starting): def prune_dirs(starting):
starting = pathclass.Path(starting) starting = pathclass.Path(starting)
walker = spinal.walk_generator(starting, yield_directories=True, yield_files=False) walker = spinal.walk(starting, yield_directories=True, yield_files=False)
double_check = set() double_check = set()

View file

@ -14,7 +14,7 @@ from voussoirkit import spinal
def prune_shortcuts(recurse=False, autoyes=False): def prune_shortcuts(recurse=False, autoyes=False):
if recurse: if recurse:
lnks = [file for file in spinal.walk_generator('.') if file.extension == 'lnk'] lnks = [file for file in spinal.walk('.') if file.extension == 'lnk']
else: else:
lnks = pathclass.cwd().glob('*.lnk') lnks = pathclass.cwd().glob('*.lnk')

View file

@ -165,7 +165,7 @@ def search(
terms = {k: [x.lower() for x in v] for (k, v) in terms.items()} terms = {k: [x.lower() for x in v] for (k, v) in terms.items()}
if text is None: if text is None:
search_objects = spinal.walk_generator( search_objects = spinal.walk(
root_path, root_path,
recurse=not local_only, recurse=not local_only,
yield_directories=True, yield_directories=True,