mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
* Adding support to inline prompt references * Added unittests * Added an initial documentation for development guidelines * Added a negative number * renamed parameter * removed wrongly committed file * Code fixes * Fixed circular reference * Fixed typo. Added TODO * Fixed merge * Code cleanup * Added missing refernce function * Removed function from util.py... again... * Update modules/async_worker.py Implemented suggested change Co-authored-by: Manuel Schmid <9307310+mashb1t@users.noreply.github.com> * Removed another circular reference * Renamed module * Addressed PR comments * Added return type to function * refactor: move apply_wildcards to module util * refactor: code cleanup, unify usage of tuples in lora list * docs: add instructions for running unittests on embedded python, code cleanup * refactor: code cleanup, move makedirs_with_log back to util --------- Co-authored-by: cantor-set <cantor-set@no-email.net> Co-authored-by: Manuel Schmid <9307310+mashb1t@users.noreply.github.com> Co-authored-by: Manuel Schmid <dev@mash1t.de>
21 lines
770 B
Python
21 lines
770 B
Python
import os
|
|
|
|
|
|
def get_files_from_folder(folder_path, extensions=None, name_filter=None):
|
|
if not os.path.isdir(folder_path):
|
|
raise ValueError("Folder path is not a valid directory.")
|
|
|
|
filenames = []
|
|
|
|
for root, _, files in os.walk(folder_path, topdown=False):
|
|
relative_path = os.path.relpath(root, folder_path)
|
|
if relative_path == ".":
|
|
relative_path = ""
|
|
for filename in sorted(files, key=lambda s: s.casefold()):
|
|
_, file_extension = os.path.splitext(filename)
|
|
if (extensions is None or file_extension.lower() in extensions) and (name_filter is None or name_filter in _):
|
|
path = os.path.join(relative_path, filename)
|
|
filenames.append(path)
|
|
|
|
return filenames
|