Replace these uses of glob with winglob.
This commit is contained in:
parent
8eeb22d0b0
commit
2d5ef0c7cf
7 changed files with 12 additions and 14 deletions
|
@ -1,10 +1,11 @@
|
|||
import argparse
|
||||
import codecs
|
||||
import glob
|
||||
import pyperclip
|
||||
import re
|
||||
import sys
|
||||
|
||||
from voussoirkit import winglob
|
||||
|
||||
|
||||
def contentreplace(filename, replace_from, replace_to, autoyes=False, do_regex=False):
|
||||
f = open(filename, 'r', encoding='utf-8')
|
||||
|
@ -34,7 +35,7 @@ def contentreplace(filename, replace_from, replace_to, autoyes=False, do_regex=F
|
|||
f.write(content)
|
||||
|
||||
def contentreplace_argparse(args):
|
||||
filenames = glob.glob(args.filename_glob)
|
||||
filenames = winglob.glob(args.filename_glob)
|
||||
|
||||
if args.clip_prompt:
|
||||
replace_from = input('Ready from')
|
||||
|
|
6
crlf.py
6
crlf.py
|
@ -1,12 +1,10 @@
|
|||
'''
|
||||
Convert LF line endings to CRLF.
|
||||
'''
|
||||
|
||||
import glob
|
||||
import sys
|
||||
|
||||
from voussoirkit import pipeable
|
||||
|
||||
from voussoirkit import winglob
|
||||
|
||||
CR = b'\x0D'
|
||||
LF = b'\x0A'
|
||||
|
@ -22,7 +20,7 @@ def crlf(filename):
|
|||
|
||||
def main(args):
|
||||
for line in pipeable.go(args, strip=True, skip_blank=True):
|
||||
for filename in glob.glob(line):
|
||||
for filename in winglob.glob(line):
|
||||
pipeable.output(filename)
|
||||
crlf(filename)
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import argparse
|
||||
import re
|
||||
import subprocess
|
||||
import glob
|
||||
import sys
|
||||
|
||||
from voussoirkit import pathclass
|
||||
|
|
|
@ -4,7 +4,6 @@ Not a replacement for real version control but could be applicable in very simpl
|
|||
cases where e.g. git is not.
|
||||
'''
|
||||
import argparse
|
||||
import glob
|
||||
import hashlib
|
||||
import os
|
||||
import shutil
|
||||
|
@ -13,6 +12,7 @@ import time
|
|||
|
||||
from voussoirkit import bytestring
|
||||
from voussoirkit import pathclass
|
||||
from voussoirkit import winglob
|
||||
|
||||
def hash_file(filepath, hasher):
|
||||
bytestream = read_filebytes(filepath)
|
||||
|
@ -44,7 +44,7 @@ def filetimelapse(filepath, rate):
|
|||
(noext, extension) = os.path.splitext(filepath)
|
||||
|
||||
last_hash = None
|
||||
existing_timelapses = glob.glob(f'{noext}-*.filetimelapse{extension}')
|
||||
existing_timelapses = winglob.glob(f'{noext}-*.filetimelapse{extension}')
|
||||
if existing_timelapses:
|
||||
last_hash = hash_file_md5(existing_timelapses[-1])
|
||||
print(f'Starting with previous {existing_timelapses[-1]} {last_hash}')
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import glob
|
||||
import sys
|
||||
|
||||
from voussoirkit import pipeable
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import glob
|
||||
import os
|
||||
from PIL import Image
|
||||
import sys
|
||||
|
||||
from voussoirkit import winglob
|
||||
|
||||
def fit_into_bounds(image_width, image_height, frame_width, frame_height):
|
||||
'''
|
||||
Given the w+h of the image and the w+h of the frame,
|
||||
|
@ -22,7 +23,7 @@ def fit_into_bounds(image_width, image_height, frame_width, frame_height):
|
|||
|
||||
filenames = sys.argv[1]
|
||||
|
||||
filenames = glob.glob(filenames)
|
||||
filenames = winglob.glob(filenames)
|
||||
for filename in filenames:
|
||||
i = Image.open(filename)
|
||||
if all(x.isdigit() for x in sys.argv[2:3]):
|
||||
|
|
4
touch.py
4
touch.py
|
@ -1,15 +1,15 @@
|
|||
'''
|
||||
Create the file, or update the last modified timestamp.
|
||||
'''
|
||||
import glob
|
||||
import os
|
||||
import sys
|
||||
|
||||
from voussoirkit import clipext
|
||||
from voussoirkit import safeprint
|
||||
from voussoirkit import winglob
|
||||
|
||||
def touch(glob_pattern):
|
||||
filenames = glob.glob(glob_pattern)
|
||||
filenames = winglob.glob(glob_pattern)
|
||||
if len(filenames) == 0:
|
||||
safeprint.safeprint(glob_pattern)
|
||||
open(glob_pattern, 'a').close()
|
||||
|
|
Loading…
Reference in a new issue