Skip to content

Commit

Permalink
Merge branch 'develop' into test/entity-hub
Browse files Browse the repository at this point in the history
  • Loading branch information
iLLiCiTiT authored Dec 2, 2024
2 parents adb942d + 11a5432 commit 2b5c21c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 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
17 changes: 17 additions & 0 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 @@ -881,6 +882,8 @@ def get_events(
newer_than: Optional[str] = None,
older_than: Optional[str] = None,
fields: Optional[Iterable[str]] = None,
limit: Optional[int] = None,
order: Optional[SortOrder] = None,
states: Optional[Iterable[str]] = None,
):
"""Get events from server with filtering options.
Expand All @@ -905,6 +908,10 @@ def get_events(
iso datetime string.
fields (Optional[Iterable[str]]): Fields that should be received
for each event.
limit (Optional[int]): Limit number of events to be fetched.
order (Optional[SortOrder]): Order events in ascending
or descending order. It is recommended to set 'limit'
when used descending.
states (Optional[Iterable[str]]): DEPRECATED Filtering by states.
Use 'statuses' instead.
Expand All @@ -924,6 +931,8 @@ def get_events(
newer_than=newer_than,
older_than=older_than,
fields=fields,
limit=limit,
order=order,
states=states,
)

Expand Down Expand Up @@ -1140,6 +1149,8 @@ def get_activities(
changed_before: Optional[str] = None,
reference_types: Optional[Iterable["ActivityReferenceType"]] = None,
fields: Optional[Iterable[str]] = None,
limit: Optional[int] = None,
order: Optional[SortOrder] = None,
) -> Generator[Dict[str, Any], None, None]:
"""Get activities from server with filtering options.
Expand All @@ -1158,6 +1169,10 @@ def get_activities(
Reference types filter. Defaults to `['origin']`.
fields (Optional[Iterable[str]]): Fields that should be received
for each activity.
limit (Optional[int]): Limit number of activities to be fetched.
order (Optional[SortOrder]): Order activities in ascending
or descending order. It is recommended to set 'limit'
when used descending.
Returns:
Generator[dict[str, Any]]: Available activities matching filters.
Expand All @@ -1175,6 +1190,8 @@ def get_activities(
changed_before=changed_before,
reference_types=reference_types,
fields=fields,
limit=limit,
order=order,
)


Expand Down
2 changes: 1 addition & 1 deletion ayon_api/server_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1799,7 +1799,7 @@ def enroll_event_job(
):
kwargs["ignoreOlderThan"] = ignore_older_than
if ignore_sender_types is not None:
if (major, minor, patch) > (1, 5, 4):
if (major, minor, patch) <= (1, 5, 4):
raise ValueError(
"Ignore sender types are not supported for"
f" your version of server {self.server_version}."
Expand Down

0 comments on commit 2b5c21c

Please sign in to comment.