From 651ac4028ef1808d5918a84bb2bb2ff2aafd81f7 Mon Sep 17 00:00:00 2001 From: Jo Sama <jo.sama@usit.uio.no> Date: Thu, 27 May 2021 13:33:25 +0200 Subject: [PATCH] Make BatchProgressEnum inherit from str This allows more readable code, as we can do if batch.batch_progress == BatchProgressEnum.VALIDATION_FAILED: instead of if batch.batch_progress == str(BatchProgressEnum.VALIDATION_FAILED): or if batch.batch_progress == BatchProgressEnum.VALIDATION_FAILED.value: --- setra_client/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setra_client/models.py b/setra_client/models.py index 4f32b65..343285a 100644 --- a/setra_client/models.py +++ b/setra_client/models.py @@ -27,7 +27,7 @@ class BaseModel(pydantic.BaseModel): return cls.from_dict(data) -class BatchProgressEnum(Enum): +class BatchProgressEnum(str, Enum): CREATED = 'created' VALIDATION_COMPLETED = 'validation_completed' VALIDATION_FAILED = 'validation_failed' -- GitLab