Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/superannotate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys


__version__ = "4.4.30"
__version__ = "4.4.31dev1"

os.environ.update({"sa_version": __version__})
sys.path.append(os.path.split(os.path.realpath(__file__))[0])
Expand Down
19 changes: 9 additions & 10 deletions src/superannotate/lib/app/interface/sdk_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,24 +501,23 @@ def get_component_config(self, project: Union[NotEmptyStr, int], component_id: s
"""

def retrieve_context(
component_data: List[dict], component_pk: str
component_data: List[dict], component_pk: str
) -> Tuple[bool, typing.Any]:
try:
for component in component_data:
if (
component["type"] == "webComponent"
and component["id"] == component_pk
):
return True, component.get("context")
if (
component["type"] in ("group", "grid")
and "children" in component
):
if "children" in component:
found, val = retrieve_context(
component["children"], component_pk
)
if found:
return found, val
if (
"id" in component and
component["id"] == component_pk
and component["type"] == "webComponent"
):
return True, json.loads(component.get("context"))

except KeyError as e:
logger.debug("Got key error:", component_data)
raise e
Expand Down
Loading