Skip to content

Commit

Permalink
Make workflow_manager_uuid non-optional again
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Kirichun committed Dec 16, 2024
1 parent 7812365 commit 24da0e4
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions encord/orm/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from typing import Any, Dict, List, Optional, Tuple, Union
from uuid import UUID

from encord.exceptions import WrongProjectTypeError
from encord.orm import base_orm
from encord.orm.analytics import CamelStrEnum
from encord.orm.base_dto import BaseDTO
Expand Down Expand Up @@ -136,11 +137,16 @@ def last_edited_at(self) -> datetime.datetime:
return self["last_edited_at"]

@property
def workflow_manager_uuid(self) -> Optional[UUID]:
if workflow_manager_uuid := self.get("workflow_manager_uuid"):
return UUID(workflow_manager_uuid)
else:
return None
def workflow_manager_uuid(self) -> UUID:
"""
Accessing this property will raise a `WrongProjectTypeError` if the project is not a workflow project.
"""
try:
return self["workflow_manager_uuid"]
except KeyError as e:
raise WrongProjectTypeError(
"This project is not a workflow project, workflow_manager_uuid is not available."
) from e


class ProjectCopy:
Expand Down

0 comments on commit 24da0e4

Please sign in to comment.