-
Notifications
You must be signed in to change notification settings - Fork 9
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
Skip invalid containers with a warning #179
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -347,11 +347,18 @@ def parse_container(container): | |
container (str): A container node name. | ||
|
||
Returns: | ||
dict: The container schema data for this container node. | ||
dict[str, Any]: The container schema data for this container node. | ||
|
||
""" | ||
data = lib.read(container) | ||
|
||
required = ["id", "name", "namespace", "loader", "representation"] | ||
missing = [key for key in required if key not in data] | ||
if missing: | ||
log.warning("Container '%s' is missing required keys: %s", | ||
container, missing) | ||
return {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shoulnd't this return There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not according to the functions type hint :D |
||
|
||
# Backwards compatibility pre-schemas for containers | ||
data["schema"] = data.get("schema", "openpype:container-1.0") | ||
|
||
|
@@ -411,12 +418,14 @@ def ls(): | |
they are called 'containers' | ||
|
||
Yields: | ||
dict: container | ||
dict[str, Any]: container | ||
|
||
""" | ||
container_names = _ls() | ||
for container in sorted(container_names): | ||
yield parse_container(container) | ||
container_data = parse_container(container) | ||
if container_data: | ||
yield container_data | ||
|
||
|
||
def containerise(name, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.