Skip to content

Commit 9e98044

Browse files
committed
refactor all enums in uppercase
1 parent e35f036 commit 9e98044

30 files changed

+90
-90
lines changed

edge_orchestrator/src/edge_orchestrator/domain/models/camera_rule/camera_rule_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def check_params(self):
2828
self.camera_rule_type is CameraRuleType.UNEXPECTED_LABEL_RULE and self.expected_class
2929
):
3030
raise ValueError(
31-
"Either provide (EXPECTED_LABEL_RULE and expected_class) or "
32-
"(UNEXPECTED_LABEL_RULE and unexpected_class)"
31+
"Either provide (expected_label_rule and expected_class) or "
32+
"(unexpected_label_rule and unexpected_class)"
3333
)
3434
return self

edge_orchestrator/src/edge_orchestrator/domain/models/image_extension.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33

44
class ImageExtension(str, Enum):
5-
bmp = "bmp"
6-
jpeg = "jpeg"
7-
jpg = "jpg"
8-
png = "png"
9-
tiff = "tiff"
5+
BMP = "bmp"
6+
JPEG = "jpeg"
7+
JPG = "jpg"
8+
PNG = "png"
9+
TIFF = "tiff"

edge_orchestrator/src/edge_orchestrator/domain/models/model_forwarder/classification_prediction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99

1010

1111
class ClassifPrediction(BaseModel):
12-
prediction_type: Literal[PredictionType.class_]
12+
prediction_type: Literal[PredictionType.CLASS_]
1313
label: Optional[str] = None
1414
probability: Annotated[Optional[float], AfterValidator(round_float)] = None

edge_orchestrator/src/edge_orchestrator/domain/models/model_forwarder/detection_prediction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212

1313

1414
class DetectionPrediction(BaseModel):
15-
prediction_type: Literal[PredictionType.objects]
15+
prediction_type: Literal[PredictionType.OBJECTS]
1616
detected_objects: Dict[str, DetectedObject] = Field(default=dict())
1717
label: Optional[Decision] = None

edge_orchestrator/src/edge_orchestrator/domain/models/model_forwarder/model_forwarder_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def check_class_names_path(self):
3939

4040
@model_validator(mode="after")
4141
def check_class_names_or_class_names_path(self):
42-
if self.model_type in [ModelType.classification, ModelType.object_detection] and (
42+
if self.model_type in [ModelType.CLASSIFICATION, ModelType.OBJECT_DETECTION] and (
4343
(not self.class_names and not self.class_names_filepath) or (self.class_names and self.class_names_filepath)
4444
):
4545
raise ValueError("Either class_names or class_names_path is required (exclusive)")

edge_orchestrator/src/edge_orchestrator/domain/models/model_forwarder/model_name.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33

44
class ModelName(str, Enum):
5-
fake_model = "fake_model"
6-
marker_quality_control = "marker_quality_control"
7-
pin_detection = "pin_detection"
8-
mobilenet_ssd_v2_coco = "mobilenet_ssd_v2_coco"
9-
mobilenet_ssd_v2_face = "mobilenet_ssd_v2_face"
10-
yolo_coco_nano = "yolo_coco_nano"
5+
FAKE_MODEL = "fake_model"
6+
MARKER_QUALITY_CONTROL = "marker_quality_control"
7+
PIN_DETECTION = "pin_detection"
8+
MOBILENET_SSD_V2_COCO = "mobilenet_ssd_v2_coco"
9+
MOBILENET_SSD_V2_FACE = "mobilenet_ssd_v2_face"
10+
YOLO_COCO_NANO = "yolo_coco_nano"

edge_orchestrator/src/edge_orchestrator/domain/models/model_forwarder/model_type.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33

44
class ModelType(str, Enum):
5-
classification = "classification"
6-
object_detection = "object_detection"
7-
segmentation = "segmentation"
5+
CLASSIFICATION = "classification"
6+
OBJECT_DETECTION = "object_detection"
7+
SEGMENTATION = "segmentation"

edge_orchestrator/src/edge_orchestrator/domain/models/model_forwarder/prediction_type.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
class PredictionType(str, Enum):
5-
class_ = "class"
6-
objects = "objects"
7-
probability = "probability"
8-
mask = "mask"
5+
CLASS_ = "class"
6+
OBJECTS = "objects"
7+
PROBABILITY = "probability"
8+
MASK = "mask"

edge_orchestrator/src/edge_orchestrator/infrastructure/adapters/camera_rule/expected_label_rule.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ def __init__(self, camera_rule_config: CameraRuleConfig):
1818

1919
def _get_camera_decision(self, prediction: Prediction) -> Decision:
2020
classif = prediction
21-
if classif.prediction_type != PredictionType.class_:
21+
if classif.prediction_type != PredictionType.CLASS_:
2222
self._logger.warning(
23-
f"You can not use an ExpectedLabelRule on something other than {PredictionType.class_.value}, "
23+
f"You can not use an ExpectedLabelRule on something other than {PredictionType.CLASS_.value}, "
2424
"no decision returned."
2525
)
2626
return Decision.NO_DECISION

edge_orchestrator/src/edge_orchestrator/infrastructure/adapters/camera_rule/max_nb_objects_rule.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ def __init__(self, camera_rule_config: CameraRuleConfig):
1818

1919
def _get_camera_decision(self, prediction: Prediction) -> Decision:
2020
detec_predict_with_classif = prediction
21-
if detec_predict_with_classif.prediction_type != PredictionType.objects:
21+
if detec_predict_with_classif.prediction_type != PredictionType.OBJECTS:
2222
self._logger.warning(
2323
"You can not use an MaxNbObjectsRule on something other than "
24-
f"{PredictionType.objects.value}, no decision returned."
24+
f"{PredictionType.OBJECTS.value}, no decision returned."
2525
)
2626
return Decision.NO_DECISION
2727

0 commit comments

Comments
 (0)