feat: try sort as ignore-case
https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/8368
This commit is contained in:
parent
0cc0ee1bcb
commit
0492424121
3 changed files with 4 additions and 4 deletions
|
@ -192,7 +192,7 @@ def list_available_loras():
|
|||
glob.glob(os.path.join(shared.cmd_opts.lora_dir, '**/*.safetensors'), recursive=True) + \
|
||||
glob.glob(os.path.join(shared.cmd_opts.lora_dir, '**/*.ckpt'), recursive=True)
|
||||
|
||||
for filename in sorted(candidates):
|
||||
for filename in sorted(candidates, key=str.lower):
|
||||
if os.path.isdir(filename):
|
||||
continue
|
||||
|
||||
|
|
|
@ -702,7 +702,7 @@ mem_mon.start()
|
|||
|
||||
|
||||
def listfiles(dirname):
|
||||
filenames = [os.path.join(dirname, x) for x in sorted(os.listdir(dirname)) if not x.startswith(".")]
|
||||
filenames = [os.path.join(dirname, x) for x in sorted(os.listdir(dirname), key=str.lower) if not x.startswith(".")]
|
||||
return [file for file in filenames if os.path.isfile(file)]
|
||||
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ class EmbeddingDatabase:
|
|||
if first_id not in self.ids_lookup:
|
||||
self.ids_lookup[first_id] = []
|
||||
|
||||
self.ids_lookup[first_id] = sorted(self.ids_lookup[first_id] + [(ids, embedding)], key=lambda x: len(x[0]), reverse=True)
|
||||
self.ids_lookup[first_id] = sorted(self.ids_lookup[first_id] + [(ids, embedding)], key=lambda x: len(x[0]), reverse=True, cmp=lambda x, y: x.lower() > y.lower())
|
||||
|
||||
return embedding
|
||||
|
||||
|
@ -196,7 +196,7 @@ class EmbeddingDatabase:
|
|||
return
|
||||
|
||||
for root, dirs, fns in os.walk(embdir.path, followlinks=True):
|
||||
for fn in fns:
|
||||
for fn in sorted(fns, key=str.lower):
|
||||
try:
|
||||
fullfn = os.path.join(root, fn)
|
||||
|
||||
|
|
Loading…
Reference in a new issue