From 11a5432dc9360bad334aa3b37ded1f21b73ada1d Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Fri, 29 Nov 2024 19:22:05 +0100 Subject: [PATCH] fix automated api again --- automated_api.py | 11 +++++++++-- ayon_api/_api.py | 5 +++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/automated_api.py b/automated_api.py index a764663c2..73b33d668 100644 --- a/automated_api.py +++ b/automated_api.py @@ -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(?P[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"(?PForwardRef\('(?P[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: diff --git a/ayon_api/_api.py b/ayon_api/_api.py index 726ee9f7a..1ef1e8d2b 100644 --- a/ayon_api/_api.py +++ b/ayon_api/_api.py @@ -22,6 +22,7 @@ from .exceptions import FailedServiceInit from .utils import ( NOT_SET, + SortOrder, get_default_settings_variant as _get_default_settings_variant, ) @@ -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. @@ -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.