chore: loosen strict type for parse_json, fix indent

This commit is contained in:
Manuel Schmid 2024-02-04 19:26:10 +01:00
parent c104d58f76
commit 832441e86d
No known key found for this signature in database
GPG Key ID: 32C4F7569B40B84B
1 changed files with 6 additions and 6 deletions

View File

@ -203,7 +203,7 @@ class MetadataParser(ABC):
raise NotImplementedError
@abstractmethod
def parse_json(self, metadata: dict) -> dict:
def parse_json(self, metadata: dict | str) -> dict:
raise NotImplementedError
@abstractmethod
@ -502,11 +502,11 @@ def read_info_from_image(filepath) -> tuple[str | None, dict, MetadataScheme | N
except ValueError:
metadata_scheme = None
# broad fallback
if metadata_scheme is None and isinstance(parameters, dict):
metadata_scheme = MetadataScheme.FOOOCUS
# broad fallback
if isinstance(parameters, dict):
metadata_scheme = MetadataScheme.FOOOCUS
if metadata_scheme is None and isinstance(parameters, str):
metadata_scheme = MetadataScheme.A1111
if isinstance(parameters, str):
metadata_scheme = MetadataScheme.A1111
return parameters, items, metadata_scheme