Skip to content

Commit dce1175

Browse files
committed
type fixes
1 parent 49bf525 commit dce1175

3 files changed

Lines changed: 54 additions & 33 deletions

File tree

ayon_api/_api.py

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
ActivityReferenceType,
4949
EntityListEntityType,
5050
EntityListItemMode,
51+
EntityListScope,
5152
BackgroundOperationTask,
5253
LinkDirection,
5354
EventFilter,
@@ -8001,8 +8002,7 @@ def create_entity_list(
80018002
data (Optional[dict[str, Any]]): Custom data of entity list.
80028003
tags (Optional[list[str]]): Entity list tags.
80038004
template (Optional[dict[str, Any]]): Dynamic list template.
8004-
entity_list_folder_id (Optional[dict[str, Any]]): Entity list
8005-
folder id.
8005+
entity_list_folder_id (Optional[str]): Entity list folder id.
80068006
owner (Optional[str]): New owner of the list.
80078007
active (Optional[bool]): Change active state of entity list.
80088008
items (Optional[list[dict[str, Any]]]): Initial items in
@@ -8053,7 +8053,7 @@ def update_entity_list(
80538053
entity list.
80548054
data (Optional[dict[str, Any]]): Custom data of entity list.
80558055
tags (Optional[list[str]]): Entity list tags.
8056-
entity_list_folder_id (dict[str, Any] | None | type[NOT_SET]): New
8056+
entity_list_folder_id (str | None | type[NOT_SET]): New
80578057
entity list folder id. Use 'None' to move entity list to root.
80588058
Use 'NOT_SET' to keep current folder.
80598059
owner (Optional[str]): New owner of the list.
@@ -8291,9 +8291,12 @@ def get_entity_list_entities(
82918291

82928292
def get_entity_list_folders_raw(
82938293
project_name: str,
8294-
) -> dict:
8294+
) -> dict[str, Any]:
82958295
"""Get entity list folders.
82968296
8297+
Args:
8298+
project_name (str): Project name.
8299+
82978300
Returns:
82988301
dict[str, Any]: Raw output of entity list folders output. At this
82998302
moment contains only "folders" key with list of folders,
@@ -8328,9 +8331,9 @@ def create_entity_list_folder(
83288331
parent_id: str | None = None,
83298332
color: str | None = None,
83308333
icon: str | None = None,
8331-
scope: list[str] | None = None,
8332-
data: dict | None = None,
8333-
access: dict | None = None,
8334+
scope: list[EntityListScope] | Non] = None,
8335+
data: dict[str, Any] | None = None,
8336+
access: dict[str, Any] | None = None,
83348337
entity_list_folder_id: str | None = None,
83358338
) -> str:
83368339
"""Create entity list folder.
@@ -8342,9 +8345,11 @@ def create_entity_list_folder(
83428345
be created in root.
83438346
color (str | None): Folder color.
83448347
icon (str | None): Folder icon.
8345-
scope (list[str] | None): Folder scope.
8346-
data (dict | None): Custom data of entity list folder.
8347-
access (dict | None): Access control for entity list folder.
8348+
scope (list[EntityListScope] | None): Folder scope. Empty list can
8349+
be used to scope folder for all views.
8350+
data (dict[str, Any] | None): Custom data of entity list folder.
8351+
access (dict[str, Any] | None): Access control for
8352+
entity list folder.
83488353
entity_list_folder_id (str | None): Id of folder that will be
83498354
created. If None, a new id will be generated.
83508355
@@ -8374,9 +8379,9 @@ def update_entity_list_folder(
83748379
parent_id: str | None | type[NOT_SET] = NOT_SET,
83758380
color: str | None = None,
83768381
icon: str | None = None,
8377-
scope: list[str] | None = None,
8378-
data: dict | None = None,
8379-
access: dict | None = None,
8382+
scope: list[EntityListScope] | Non] = None,
8383+
data: dict[str, Any] | None = None,
8384+
access: dict[str, Any] | None = None,
83808385
) -> None:
83818386
"""Update entity list folder.
83828387
@@ -8388,9 +8393,11 @@ def update_entity_list_folder(
83888393
list folder. If None, the folder will be moved to root.
83898394
color (str | None): New color of entity list folder.
83908395
icon (str | None): New icon of entity list folder.
8391-
scope (list[str] | None): New scope of entity list folder.
8392-
data (dict | None): Custom data of entity list folder.
8393-
access (dict | None): Access control for entity list folder.
8396+
scope (list[EntityListScope] | None): New scope of entity list
8397+
folder. Empty list can be used to scope folder for all views.
8398+
data (dict[str, Any] | None): Custom data of entity list folder.
8399+
access (dict[str, Any] | None): Access control for
8400+
entity list folder.
83948401
83958402
"""
83968403
con = get_server_api_connection()

ayon_api/_api_helpers/lists.py

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
EntityListEntityType,
1616
EntityListAttributeDefinitionDict,
1717
EntityListItemMode,
18+
EntityListScope,
1819
)
1920

2021

@@ -180,8 +181,7 @@ def create_entity_list(
180181
data (Optional[dict[str, Any]]): Custom data of entity list.
181182
tags (Optional[list[str]]): Entity list tags.
182183
template (Optional[dict[str, Any]]): Dynamic list template.
183-
entity_list_folder_id (Optional[dict[str, Any]]): Entity list
184-
folder id.
184+
entity_list_folder_id (Optional[str]): Entity list folder id.
185185
owner (Optional[str]): New owner of the list.
186186
active (Optional[bool]): Change active state of entity list.
187187
items (Optional[list[dict[str, Any]]]): Initial items in
@@ -243,7 +243,7 @@ def update_entity_list(
243243
entity list.
244244
data (Optional[dict[str, Any]]): Custom data of entity list.
245245
tags (Optional[list[str]]): Entity list tags.
246-
entity_list_folder_id (dict[str, Any] | None | type[NOT_SET]): New
246+
entity_list_folder_id (str | None | type[NOT_SET]): New
247247
entity list folder id. Use 'None' to move entity list to root.
248248
Use 'NOT_SET' to keep current folder.
249249
owner (Optional[str]): New owner of the list.
@@ -486,9 +486,14 @@ def get_entity_list_entities(
486486
response.raise_for_status()
487487
return response.data
488488

489-
def get_entity_list_folders_raw(self, project_name: str) -> dict:
489+
def get_entity_list_folders_raw(
490+
self, project_name: str
491+
) -> dict[str, Any]:
490492
"""Get entity list folders.
491493
494+
Args:
495+
project_name (str): Project name.
496+
492497
Returns:
493498
dict[str, Any]: Raw output of entity list folders output. At this
494499
moment contains only "folders" key with list of folders,
@@ -519,9 +524,9 @@ def create_entity_list_folder(
519524
parent_id: str | None = None,
520525
color: str | None = None,
521526
icon: str | None = None,
522-
scope: list[str] | None = None,
523-
data: dict | None = None,
524-
access: dict | None = None,
527+
scope: list[EntityListScope] | None = None,
528+
data: dict[str, Any] | None = None,
529+
access: dict[str, Any] | None = None,
525530
entity_list_folder_id: str | None = None,
526531
) -> str:
527532
"""Create entity list folder.
@@ -533,9 +538,11 @@ def create_entity_list_folder(
533538
be created in root.
534539
color (str | None): Folder color.
535540
icon (str | None): Folder icon.
536-
scope (list[str] | None): Folder scope.
537-
data (dict | None): Custom data of entity list folder.
538-
access (dict | None): Access control for entity list folder.
541+
scope (list[EntityListScope] | None): Folder scope. Empty list can
542+
be used to scope folder for all views.
543+
data (dict[str, Any] | None): Custom data of entity list folder.
544+
access (dict[str, Any] | None): Access control for
545+
entity list folder.
539546
entity_list_folder_id (str | None): Id of folder that will be
540547
created. If None, a new id will be generated.
541548
@@ -582,12 +589,12 @@ def update_entity_list_folder(
582589
entity_list_folder_id: str,
583590
*,
584591
label: str | None = None,
585-
parent_id: str | None| type[NOT_SET] = NOT_SET,
592+
parent_id: str | None | type[NOT_SET] = NOT_SET,
586593
color: str | None = None,
587594
icon: str | None = None,
588-
scope: list[str] | None = None,
589-
data: dict | None = None,
590-
access: dict | None = None,
595+
scope: list[EntityListScope] | None = None,
596+
data: dict[str, Any] | None = None,
597+
access: dict[str, Any] | None = None,
591598
) -> None:
592599
"""Update entity list folder.
593600
@@ -599,9 +606,11 @@ def update_entity_list_folder(
599606
list folder. If None, the folder will be moved to root.
600607
color (str | None): New color of entity list folder.
601608
icon (str | None): New icon of entity list folder.
602-
scope (list[str] | None): New scope of entity list folder.
603-
data (dict | None): Custom data of entity list folder.
604-
access (dict | None): Access control for entity list folder.
609+
scope (list[EntityListScope] | None): New scope of entity list
610+
folder. Empty list can be used to scope folder for all views.
611+
data (dict[str, Any] | None): Custom data of entity list folder.
612+
access (dict[str, Any] | None): Access control for
613+
entity list folder.
605614
606615
"""
607616
if data is None:

ayon_api/typing.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747
"delete",
4848
]
4949

50+
EntityListScope = Literal[
51+
"generic",
52+
"review-session",
53+
]
54+
5055
EventFilterValueType = Union[
5156
None,
5257
str, int, float,

0 commit comments

Comments
 (0)