Skip to content

Commit

Permalink
fix automated api again
Browse files Browse the repository at this point in the history
  • Loading branch information
iLLiCiTiT committed Nov 29, 2024
1 parent 8791324 commit 11a5432
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
11 changes: 9 additions & 2 deletions automated_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,22 @@ def _get_typehint(annotation, api_globals):

typehint = (
str(annotation)
.replace("typing.", "")
.replace("NoneType", "None")
)
full_path_regex = re.compile(
r"(?P<full>(?P<name>[a-zA-Z0-9_\.]+))"
)
for item in full_path_regex.finditer(str(typehint)):
groups = item.groupdict()
name = groups["name"].split(".")[-1]
typehint = typehint.replace(groups["full"], name)

forwardref_regex = re.compile(
r"(?P<full>ForwardRef\('(?P<name>[a-zA-Z0-9]+)'\))"
)
for item in forwardref_regex.finditer(str(typehint)):
groups = item.groupdict()
name = groups["name"]
name = groups["name"].split(".")[-1]
typehint = typehint.replace(groups["full"], f'"{name}"')

try:
Expand Down
5 changes: 3 additions & 2 deletions ayon_api/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from .exceptions import FailedServiceInit
from .utils import (
NOT_SET,
SortOrder,
get_default_settings_variant as _get_default_settings_variant,
)

Expand Down Expand Up @@ -882,7 +883,7 @@ def get_events(
older_than: Optional[str] = None,
fields: Optional[Iterable[str]] = None,
limit: Optional[int] = None,
order: "Optional[ayon_api.utils.SortOrder]" = None,
order: Optional[SortOrder] = None,
states: Optional[Iterable[str]] = None,
):
"""Get events from server with filtering options.
Expand Down Expand Up @@ -1149,7 +1150,7 @@ def get_activities(
reference_types: Optional[Iterable["ActivityReferenceType"]] = None,
fields: Optional[Iterable[str]] = None,
limit: Optional[int] = None,
order: "Optional[ayon_api.utils.SortOrder]" = None,
order: Optional[SortOrder] = None,
) -> Generator[Dict[str, Any], None, None]:
"""Get activities from server with filtering options.
Expand Down

0 comments on commit 11a5432

Please sign in to comment.