Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid unnecessary isfile/exists calls #14527

Merged
merged 2 commits into from
Jan 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge branch 'dev' into avoid-isfiles
  • Loading branch information
AUTOMATIC1111 authored Jan 4, 2024
commit df62ffbd2525792c115adefdbaeb7799699624b1
8 changes: 4 additions & 4 deletions modules/extra_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ def get_user_metadata(filename, lister=None):

metadata = {}
try:
with open(metadata_filename, "r", encoding="utf8") as file:
metadata = json.load(file)
except FileNotFoundError:
pass
exists = lister.exists(metadata_filename) if lister else os.path.exists(metadata_filename)
if exists:
with open(metadata_filename, "r", encoding="utf8") as file:
metadata = json.load(file)
except Exception as e:
errors.display(e, f"reading extra network user metadata from {metadata_filename}")

Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.