Skip to content

Commit

Permalink
Avoid layer not found
Browse files Browse the repository at this point in the history
  • Loading branch information
cxnt committed Aug 22, 2024
1 parent e5fb63c commit f72f8f7
Showing 1 changed file with 37 additions and 29 deletions.
66 changes: 37 additions & 29 deletions src/ui/utils.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,47 @@
import json

from supervisely.app.widgets import Container, Flexbox, FileThumbnail, ProjectThumbnail, Text
from supervisely import ProjectMeta
from supervisely.app.content import StateJson, DataJson
from supervisely.api.labeling_job_api import LabelingJobInfo

import src.globals as g
import src.utils as utils
import supervisely as sly

from src.compute.dtl_utils.item_descriptor import ImageDescriptor
from src.compute.Layer import Layer as NetLayer
from src.compute.Net import Net
from src.exceptions import (
ActionNotFoundError,
BadSettingsError,
CustomException,
LayerNotFoundError,
)
from src.ui.dtl import (
ANNOTATION_TRANSFORMS,
OTHER,
PIXEL_LEVEL_TRANSFORMS,
SAVE_ACTIONS,
SPATIAL_LEVEL_TRANSFORMS,
actions_dict,
actions_list,
hidden_actions_dict,
)
from src.ui.dtl.Action import Action, SourceAction
from src.ui.dtl.Layer import Layer
from src.utils import (
LegacyProjectItem,
get_project_by_name,
download_preview,
get_dataset_by_name,
get_project_by_name,
get_project_meta,
download_preview,
update_project_info,
)
from src.compute.Net import Net
from src.compute.Layer import Layer as NetLayer
from src.compute.dtl_utils.item_descriptor import ImageDescriptor
from src.ui.dtl import actions_dict, actions_list, hidden_actions_dict
from src.ui.dtl.Action import Action, SourceAction
from src.ui.dtl.Layer import Layer
from src.ui.dtl import (
SAVE_ACTIONS,
PIXEL_LEVEL_TRANSFORMS,
SPATIAL_LEVEL_TRANSFORMS,
ANNOTATION_TRANSFORMS,
OTHER,
)
from src.exceptions import (
BadSettingsError,
CustomException,
ActionNotFoundError,
LayerNotFoundError,
from supervisely import ProjectMeta
from supervisely.api.labeling_job_api import LabelingJobInfo
from supervisely.app.content import DataJson, StateJson
from supervisely.app.widgets import (
Container,
FileThumbnail,
Flexbox,
ProjectThumbnail,
Text,
)
import src.globals as g
import src.utils as utils


def find_layer_id_by_dst(dst: str):
Expand Down Expand Up @@ -73,7 +79,9 @@ def init_layers(nodes_state: dict):
all_layers_ids = []
for node_id, node_options in nodes_state.items():
try:
layer = g.layers[node_id]
layer = g.layers.get(node_id, None)
if layer is None:
continue
layer: Layer
except KeyError:
raise LayerNotFoundError(node_id)
Expand Down

0 comments on commit f72f8f7

Please sign in to comment.