diff --git a/cg/constants/archiving.py b/cg/constants/archiving.py index 7c51e611f3..c183fd8b14 100644 --- a/cg/constants/archiving.py +++ b/cg/constants/archiving.py @@ -1,4 +1,4 @@ -from cg.utils.enums import StrEnum +from enum import StrEnum class ArchiveLocations(StrEnum): diff --git a/cg/constants/constants.py b/cg/constants/constants.py index 590ae45b19..87d1ae5263 100644 --- a/cg/constants/constants.py +++ b/cg/constants/constants.py @@ -3,7 +3,7 @@ import click from cg.utils.date import get_date -from cg.utils.enums import StrEnum +from enum import StrEnum VALID_DATA_IN_PRODUCTION = get_date("2017-09-27") diff --git a/cg/constants/demultiplexing.py b/cg/constants/demultiplexing.py index 0b16bafa90..7921d760ef 100644 --- a/cg/constants/demultiplexing.py +++ b/cg/constants/demultiplexing.py @@ -4,7 +4,7 @@ import click from cg.constants.sequencing import Sequencers -from cg.utils.enums import Enum, StrEnum +from enum import Enum, StrEnum class BclConverter(StrEnum): diff --git a/cg/constants/encryption.py b/cg/constants/encryption.py index 5c654a5c2a..b71a0e58bb 100644 --- a/cg/constants/encryption.py +++ b/cg/constants/encryption.py @@ -1,10 +1,10 @@ """Constants specific for encryption""" -from enum import Enum +from enum import StrEnum from cg.utils.enums import ListEnum -class CipherAlgorithm(str, Enum): +class CipherAlgorithm(StrEnum): TRIPLE_DES: str = "3DES" AES: str = "AES" AES192: str = "AES192" @@ -18,7 +18,7 @@ class CipherAlgorithm(str, Enum): TWOFISH: str = "TWOFISH" -class EncryptionUserID(str, Enum): +class EncryptionUserID(StrEnum): HASTA_USER_ID: str = '"Clinical Genomics"' diff --git a/cg/constants/gene_panel.py b/cg/constants/gene_panel.py index 6daa12c200..de5baaac4e 100644 --- a/cg/constants/gene_panel.py +++ b/cg/constants/gene_panel.py @@ -1,7 +1,7 @@ """Gene panel specific constants.""" -from cg.utils.enums import StrEnum +from enum import StrEnum GENOME_BUILD_37 = "37" GENOME_BUILD_38 = "GRCh38" diff --git a/cg/constants/housekeeper_tags.py b/cg/constants/housekeeper_tags.py index 8c71ce5331..1f5e71afd2 100644 --- a/cg/constants/housekeeper_tags.py +++ b/cg/constants/housekeeper_tags.py @@ -2,7 +2,7 @@ from cg.constants.constants import Pipeline -from cg.utils.enums import StrEnum +from enum import StrEnum class AlignmentFileTag(StrEnum): diff --git a/cg/constants/invoice.py b/cg/constants/invoice.py index e4fe528ba5..5ab92471db 100644 --- a/cg/constants/invoice.py +++ b/cg/constants/invoice.py @@ -1,4 +1,4 @@ -from cg.utils.enums import StrEnum +from enum import StrEnum class CustomerNames(StrEnum): diff --git a/cg/constants/lims.py b/cg/constants/lims.py index e5cec79a1d..90b1ce5e6f 100644 --- a/cg/constants/lims.py +++ b/cg/constants/lims.py @@ -1,6 +1,6 @@ # LIMS constants -from cg.utils.enums import StrEnum +from enum import StrEnum YES_NO_LIMS_BOOLEANS = ["require_qc_ok", "tumour", "verified_organism"] diff --git a/cg/constants/nf_analysis.py b/cg/constants/nf_analysis.py index fd54f6c2a7..7d3b8f9b04 100644 --- a/cg/constants/nf_analysis.py +++ b/cg/constants/nf_analysis.py @@ -1,5 +1,5 @@ """Nf-tower related constants.""" -from cg.utils.enums import StrEnum +from enum import StrEnum class NfTowerStatus(StrEnum): diff --git a/cg/constants/observations.py b/cg/constants/observations.py index 48d2f66ca2..99f72a7ac1 100644 --- a/cg/constants/observations.py +++ b/cg/constants/observations.py @@ -3,7 +3,7 @@ from cg.constants.constants import Pipeline from cg.constants.sequencing import SequencingMethod -from cg.utils.enums import StrEnum +from enum import StrEnum LOQUSDB_ID = "_id" LOQUSDB_SUPPORTED_PIPELINES = [Pipeline.MIP_DNA, Pipeline.BALSAMIC] diff --git a/cg/constants/orderforms.py b/cg/constants/orderforms.py index d62b9bfdfd..5de0052c33 100644 --- a/cg/constants/orderforms.py +++ b/cg/constants/orderforms.py @@ -1,6 +1,6 @@ from cg.constants import ANALYSIS_SOURCES, METAGENOME_SOURCES from cg.models.orders.order import OrderType -from cg.utils.enums import StrEnum +from enum import StrEnum SEX_MAP = {"male": "M", "female": "F", "unknown": "unknown"} REV_SEX_MAP = {value: key for key, value in SEX_MAP.items()} diff --git a/cg/constants/pdc.py b/cg/constants/pdc.py index 773b2b2508..b9f60a56e5 100644 --- a/cg/constants/pdc.py +++ b/cg/constants/pdc.py @@ -1,5 +1,6 @@ """PDC related constants""" -from cg.utils.enums import IntEnum, ListEnum +from enum import IntEnum +from cg.utils.enums import ListEnum class DSMCParameters(ListEnum): diff --git a/cg/constants/pedigree.py b/cg/constants/pedigree.py index e481386aa9..5ad62967ff 100644 --- a/cg/constants/pedigree.py +++ b/cg/constants/pedigree.py @@ -1,7 +1,7 @@ -from enum import Enum +from enum import StrEnum -class Pedigree(str, Enum): +class Pedigree(StrEnum): FATHER = "father" MOTHER = "mother" CHILD = "child" diff --git a/cg/constants/priority.py b/cg/constants/priority.py index 37a5ae14dc..7958030864 100644 --- a/cg/constants/priority.py +++ b/cg/constants/priority.py @@ -1,7 +1,7 @@ """Priority specific constants""" from enum import IntEnum -from cg.utils.enums import StrEnum +from enum import StrEnum class SlurmQos(StrEnum): diff --git a/cg/constants/scout_upload.py b/cg/constants/scout_upload.py index 1c232104b7..8cc10f7cd8 100644 --- a/cg/constants/scout_upload.py +++ b/cg/constants/scout_upload.py @@ -1,4 +1,4 @@ -from cg.utils.enums import StrEnum +from enum import StrEnum class GenomeBuild(StrEnum): diff --git a/cg/constants/sequencing.py b/cg/constants/sequencing.py index 05f33cb752..352b89f7a1 100644 --- a/cg/constants/sequencing.py +++ b/cg/constants/sequencing.py @@ -1,5 +1,5 @@ """Constants related to sequencing.""" -from cg.utils.enums import StrEnum +from enum import StrEnum class Sequencers(StrEnum): diff --git a/cg/constants/subject.py b/cg/constants/subject.py index 3cbf37693d..6d2e66389f 100644 --- a/cg/constants/subject.py +++ b/cg/constants/subject.py @@ -1,22 +1,22 @@ -from enum import Enum, IntEnum +from enum import Enum, StrEnum, IntEnum -class Gender(str, Enum): +class Gender(StrEnum): FEMALE = "female" MALE = "male" UNKNOWN = "unknown" OTHER = "other" - MISSING = None + MISSING = "" def __repr__(self): return self.value -class PhenotypeStatus(str, Enum): +class PhenotypeStatus(StrEnum): UNKNOWN = "unknown" UNAFFECTED = "unaffected" AFFECTED = "affected" - MISSING = None + MISSING = "" def __repr__(self): return self.value @@ -33,6 +33,12 @@ class PlinkGender(str, Enum): MALE = 1 FEMALE = 2 + def __str__(self) -> str: + return str.__str__(self.value) + class RelationshipStatus(str, Enum): HAS_NO_PARENT = 0 + + def __str__(self) -> str: + return str.__str__(self.value) diff --git a/cg/constants/tb.py b/cg/constants/tb.py index 08e83ddd86..33e26a2e9a 100644 --- a/cg/constants/tb.py +++ b/cg/constants/tb.py @@ -1,4 +1,4 @@ -from enum import Enum +from enum import StrEnum class AnalysisStatus: @@ -12,7 +12,7 @@ class AnalysisStatus: QC: str = "qc" -class AnalysisTypes(str, Enum): +class AnalysisTypes(StrEnum): WGS: str = "wgs" WES: str = "wes" TGS: str = "tgs" diff --git a/cg/meta/archive/ddn_dataflow.py b/cg/meta/archive/ddn_dataflow.py index 4afb1f7ecc..ae2e8cede5 100644 --- a/cg/meta/archive/ddn_dataflow.py +++ b/cg/meta/archive/ddn_dataflow.py @@ -1,6 +1,6 @@ """Module for archiving and retrieving folders via DDN Dataflow.""" from datetime import datetime -from enum import Enum +from enum import StrEnum from pathlib import Path from typing import Optional from urllib.parse import urljoin @@ -28,7 +28,7 @@ SOURCE_ATTRIBUTE: str = "source" -class DataflowEndpoints(str, Enum): +class DataflowEndpoints(StrEnum): """Enum containing all DDN dataflow endpoints used.""" ARCHIVE_FILES = "files/archive" diff --git a/cg/models/orders/constants.py b/cg/models/orders/constants.py index 3e7596e72b..ee831716f7 100644 --- a/cg/models/orders/constants.py +++ b/cg/models/orders/constants.py @@ -1,5 +1,5 @@ from cg.constants.constants import Pipeline -from cg.utils.enums import StrEnum +from enum import StrEnum class OrderType(StrEnum): diff --git a/cg/models/orders/sample_base.py b/cg/models/orders/sample_base.py index e484ce2420..a1ba0c39f6 100644 --- a/cg/models/orders/sample_base.py +++ b/cg/models/orders/sample_base.py @@ -1,4 +1,4 @@ -from enum import Enum +from enum import StrEnum from typing import Optional from pydantic import BaseModel, BeforeValidator, ConfigDict, constr @@ -9,19 +9,19 @@ from cg.store.models import Application, Customer, Family, Pool, Sample -class ControlEnum(str, Enum): +class ControlEnum(StrEnum): not_control = "" positive = "positive" negative = "negative" -class SexEnum(str, Enum): +class SexEnum(StrEnum): male = "male" female = "female" unknown = "unknown" -class PriorityEnum(str, Enum): +class PriorityEnum(StrEnum): research = "research" standard = "standard" priority = "priority" @@ -29,13 +29,13 @@ class PriorityEnum(str, Enum): clinical_trials = "clinical_trials" -class ContainerEnum(str, Enum): +class ContainerEnum(StrEnum): no_container = "No container" plate = "96 well plate" tube = "Tube" -class StatusEnum(str, Enum): +class StatusEnum(StrEnum): affected = "affected" unaffected = "unaffected" unknown = "unknown" diff --git a/cg/utils/enums.py b/cg/utils/enums.py index 057a54f208..55b1edac3a 100644 --- a/cg/utils/enums.py +++ b/cg/utils/enums.py @@ -2,15 +2,5 @@ from enum import Enum -class StrEnum(str, Enum): - def __str__(self) -> str: - return str.__str__(self) - - class ListEnum(list, Enum): pass - - -class IntEnum(int, Enum): - def __int__(self) -> int: - return int.__int__(self)