Skip to content

Commit

Permalink
Merge pull request #251 from ynput/revert-250-settings_add_new_enumer…
Browse files Browse the repository at this point in the history
…ators

Revert "Add application and tools enumeration functions."
  • Loading branch information
martastain authored Jun 19, 2024
2 parents f1d1382 + 250e66c commit c14e5d4
Showing 1 changed file with 0 additions and 44 deletions.
44 changes: 0 additions & 44 deletions ayon_server/settings/enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,47 +99,3 @@ async def _get_app_host_names():
async def addon_all_app_host_names_enum():
result = await _get_app_host_names()
return [{"label": host_name, "value": host_name} for host_name in result]


async def application_enum(apps: list[str] | None = None) -> list[dict[str, str]]:
"""Return a list of all applications.
If app is provided, return only applications that start with app.
Example:
nuke_variant: str = SettingsField(
default="",
title="Nuke variant",
description="Nuke variant to be used for transcoding.",
enum_resolver=functools.partial(application_enum, "nuke"),
)
Args:
app Optional[list[str]]: Application names to filter. Defaults to None.
Returns:
list[dict]: List of applications.
"""
res = await Postgres.fetch(
"SELECT data FROM attributes WHERE name = 'applications'"
)
if not res:
return []
all_apps = res[0]["data"].get("enum", [])

if apps:
return_apps = []
for app in apps:
return_apps += [
a for a in all_apps if a["value"].split("/")[0] == app.lower()
]
return return_apps

return all_apps


async def tools_enum() -> list[dict[str, str]]:
"""Return a list of all tools."""
res = await Postgres.fetch("SELECT data FROM attributes WHERE name = 'tools'")

return res[0]["data"].get("enum", []) if res else []

0 comments on commit c14e5d4

Please sign in to comment.