Update use of pathclass.glob_files, directories.
This commit is contained in:
parent
5fa1bd05cc
commit
c5829081aa
12 changed files with 13 additions and 13 deletions
|
@ -12,7 +12,7 @@ log = vlogging.getLogger(__name__, 'adbinstall')
|
||||||
|
|
||||||
def adbinstall_argparse(args):
|
def adbinstall_argparse(args):
|
||||||
patterns = pipeable.input_many(args.apks, skip_blank=True, strip=True)
|
patterns = pipeable.input_many(args.apks, skip_blank=True, strip=True)
|
||||||
apks = pathclass.glob_many(patterns, files=True)
|
apks = pathclass.glob_many_files(patterns)
|
||||||
installs = []
|
installs = []
|
||||||
for apk in apks:
|
for apk in apks:
|
||||||
apk = pathclass.Path(apk)
|
apk = pathclass.Path(apk)
|
||||||
|
|
|
@ -21,7 +21,7 @@ CHUNK_SIZE = 2**20
|
||||||
|
|
||||||
def bitwise_or_argparse(args):
|
def bitwise_or_argparse(args):
|
||||||
patterns = pipeable.input_many(args.files, skip_blank=True, strip=True)
|
patterns = pipeable.input_many(args.files, skip_blank=True, strip=True)
|
||||||
files = pathclass.glob_many(patterns, files=True)
|
files = pathclass.glob_many_files(patterns)
|
||||||
|
|
||||||
if len(files) < 2:
|
if len(files) < 2:
|
||||||
log.fatal('Need at least two input files.')
|
log.fatal('Need at least two input files.')
|
||||||
|
|
2
crc32.py
2
crc32.py
|
@ -12,7 +12,7 @@ def crc32_argparse(args):
|
||||||
return_status = 0
|
return_status = 0
|
||||||
|
|
||||||
patterns = pipeable.input_many(args.patterns, skip_blank=True, strip=True)
|
patterns = pipeable.input_many(args.patterns, skip_blank=True, strip=True)
|
||||||
files = pathclass.glob_many(patterns, files=True)
|
files = pathclass.glob_many_files(patterns)
|
||||||
|
|
||||||
for file in files:
|
for file in files:
|
||||||
try:
|
try:
|
||||||
|
|
2
crop.py
2
crop.py
|
@ -31,7 +31,7 @@ def crop(file, crops, *, inplace=False):
|
||||||
|
|
||||||
def crop_argparse(args):
|
def crop_argparse(args):
|
||||||
patterns = pipeable.input(args.pattern, skip_blank=True, strip=True)
|
patterns = pipeable.input(args.pattern, skip_blank=True, strip=True)
|
||||||
files = pathclass.glob_many(patterns, files=True)
|
files = pathclass.glob_many_files(patterns)
|
||||||
|
|
||||||
for file in files:
|
for file in files:
|
||||||
crop(
|
crop(
|
||||||
|
|
|
@ -6,7 +6,7 @@ from voussoirkit import pipeable
|
||||||
|
|
||||||
def empty_directories_argparse(args):
|
def empty_directories_argparse(args):
|
||||||
patterns = pipeable.input_many(args.patterns, skip_blank=True, strip=True)
|
patterns = pipeable.input_many(args.patterns, skip_blank=True, strip=True)
|
||||||
directories = pathclass.glob_many(patterns, directories=True)
|
directories = pathclass.glob_many_directories(patterns)
|
||||||
|
|
||||||
for directory in directories:
|
for directory in directories:
|
||||||
if len(directory.listdir()) == 0:
|
if len(directory.listdir()) == 0:
|
||||||
|
|
|
@ -25,7 +25,7 @@ def grayscale(filename, *, inplace=False):
|
||||||
|
|
||||||
def grayscale_argparse(args):
|
def grayscale_argparse(args):
|
||||||
patterns = pipeable.input_many(args.patterns, skip_blank=True, strip=True)
|
patterns = pipeable.input_many(args.patterns, skip_blank=True, strip=True)
|
||||||
files = pathclass.glob_many(patterns, files=True)
|
files = pathclass.glob_many_files(patterns)
|
||||||
for file in files:
|
for file in files:
|
||||||
new_filename = grayscale(file, inplace=args.inplace)
|
new_filename = grayscale(file, inplace=args.inplace)
|
||||||
if new_filename:
|
if new_filename:
|
||||||
|
|
|
@ -7,7 +7,7 @@ from voussoirkit import pipeable
|
||||||
|
|
||||||
def inodes_argparse(args):
|
def inodes_argparse(args):
|
||||||
patterns = pipeable.input_many(args.patterns, skip_blank=True, strip=True)
|
patterns = pipeable.input_many(args.patterns, skip_blank=True, strip=True)
|
||||||
files = pathclass.glob_many(patterns, files=True)
|
files = pathclass.glob_many_files(patterns)
|
||||||
for file in files:
|
for file in files:
|
||||||
pipeable.stdout(f'{file.stat.st_dev} {file.stat.st_ino} {file.relative_path}')
|
pipeable.stdout(f'{file.stat.st_dev} {file.stat.st_ino} {file.relative_path}')
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -16,9 +16,9 @@ def main(argv):
|
||||||
|
|
||||||
patterns = argv[:]
|
patterns = argv[:]
|
||||||
if patterns:
|
if patterns:
|
||||||
files = pathclass.glob_many(patterns, files=True)
|
files = pathclass.glob_many_files(patterns)
|
||||||
else:
|
else:
|
||||||
files = pathclass.glob('*.py', files=True)
|
files = pathclass.glob_files('*.py')
|
||||||
|
|
||||||
for file in files:
|
for file in files:
|
||||||
no_py = file.replace_extension('').basename
|
no_py = file.replace_extension('').basename
|
||||||
|
|
|
@ -6,7 +6,7 @@ from voussoirkit import pipeable
|
||||||
|
|
||||||
def nonempty_directories_argparse(args):
|
def nonempty_directories_argparse(args):
|
||||||
patterns = pipeable.input_many(args.patterns, skip_blank=True, strip=True)
|
patterns = pipeable.input_many(args.patterns, skip_blank=True, strip=True)
|
||||||
directories = pathclass.glob_many(patterns, directories=True)
|
directories = pathclass.glob_many_directories(patterns)
|
||||||
|
|
||||||
for directory in directories:
|
for directory in directories:
|
||||||
if len(directory.listdir()) != 0:
|
if len(directory.listdir()) != 0:
|
||||||
|
|
|
@ -102,7 +102,7 @@ def resize(
|
||||||
|
|
||||||
def resize_argparse(args):
|
def resize_argparse(args):
|
||||||
patterns = pipeable.input(args.pattern, skip_blank=True, strip=True)
|
patterns = pipeable.input(args.pattern, skip_blank=True, strip=True)
|
||||||
files = pathclass.glob_many(patterns, files=True)
|
files = pathclass.glob_many_files(patterns)
|
||||||
for file in files:
|
for file in files:
|
||||||
resize(
|
resize(
|
||||||
file,
|
file,
|
||||||
|
|
|
@ -15,7 +15,7 @@ def rotate_argparse(args):
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
patterns = pipeable.input(args.pattern, skip_blank=True, strip=True)
|
patterns = pipeable.input(args.pattern, skip_blank=True, strip=True)
|
||||||
files = pathclass.glob_many(patterns, files=True)
|
files = pathclass.glob_many_files(patterns)
|
||||||
|
|
||||||
for file in files:
|
for file in files:
|
||||||
image = PIL.Image.open(file.absolute_path)
|
image = PIL.Image.open(file.absolute_path)
|
||||||
|
|
|
@ -14,7 +14,7 @@ HORIZONTAL = sentinel.Sentinel('horizontal')
|
||||||
|
|
||||||
def stitch_argparse(args):
|
def stitch_argparse(args):
|
||||||
patterns = pipeable.input_many(args.image_files, skip_blank=True, strip=True)
|
patterns = pipeable.input_many(args.image_files, skip_blank=True, strip=True)
|
||||||
files = pathclass.glob_many(patterns, files=True)
|
files = pathclass.glob_many_files(patterns)
|
||||||
images = [PIL.Image.open(file.absolute_path) for file in files]
|
images = [PIL.Image.open(file.absolute_path) for file in files]
|
||||||
if args.vertical:
|
if args.vertical:
|
||||||
direction = VERTICAL
|
direction = VERTICAL
|
||||||
|
|
Loading…
Reference in a new issue