mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
added docstring
This commit is contained in:
parent
6807664188
commit
50531fa35a
1 changed files with 21 additions and 0 deletions
|
|
@ -725,6 +725,27 @@ def get_representation_path_with_roots(
|
||||||
|
|
||||||
|
|
||||||
def _backwards_compatibility_repre_path(func):
|
def _backwards_compatibility_repre_path(func):
|
||||||
|
"""Wrapper handling backwards compatibility of 'get_representation_path'.
|
||||||
|
|
||||||
|
Allows 'get_representation_path' to support old and new signatures of the
|
||||||
|
function. The old signature supported passing in representation entity
|
||||||
|
and optional roots. The new signature requires the project name
|
||||||
|
to be passed. In case custom roots should be used, a dedicated function
|
||||||
|
'get_representation_path_with_roots' is available.
|
||||||
|
|
||||||
|
The wrapper handles passed arguments, and based on kwargs and types
|
||||||
|
of the arguments will call the function which relates to
|
||||||
|
the arguments.
|
||||||
|
|
||||||
|
The function is also marked with an attribute 'version' so other addons
|
||||||
|
can check if the function is using the new signature or is using
|
||||||
|
the old signature. That should allow addons to adapt to new signature.
|
||||||
|
>>> if getattr(get_representation_path, "version", None) == 2:
|
||||||
|
>>> path = get_representation_path(project_name, repre_entity)
|
||||||
|
>>> else:
|
||||||
|
>>> path = get_representation_path(repre_entity)
|
||||||
|
|
||||||
|
"""
|
||||||
# Add an attribute to the function so addons can check if the new variant
|
# Add an attribute to the function so addons can check if the new variant
|
||||||
# of the function is available.
|
# of the function is available.
|
||||||
# >>> getattr(get_representation_path, "version", None) == 2
|
# >>> getattr(get_representation_path, "version", None) == 2
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue