Skip to content

Commit

Permalink
Merge pull request #375 from lsst-sqre/tickets/DM-48838
Browse files Browse the repository at this point in the history
DM-48838: Switch to StrEnum
  • Loading branch information
rra authored Feb 11, 2025
2 parents 84958fc + d0eb84e commit 3d87945
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions safir-arq/src/safir/arq/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from dataclasses import dataclass
from datetime import datetime
from enum import Enum
from enum import StrEnum
from typing import Any, Self

from arq.jobs import Job, JobStatus
Expand All @@ -18,7 +18,7 @@
]


class ArqMode(str, Enum):
class ArqMode(StrEnum):
"""Mode configuration for the Arq queue."""

production = "production"
Expand Down
14 changes: 7 additions & 7 deletions safir/src/safir/github/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

from base64 import b64decode
from enum import Enum
from enum import StrEnum

from pydantic import BaseModel, Field, HttpUrl

Expand Down Expand Up @@ -128,7 +128,7 @@ class GitHubRepositoryModel(BaseModel):
)


class GitHubPullState(str, Enum):
class GitHubPullState(StrEnum):
"""The state of a GitHub pull request (PR).
https://docs.github.com/en/rest/pulls/pulls#get-a-pull-request
Expand Down Expand Up @@ -227,7 +227,7 @@ def decode(self) -> str:
)


class GitHubCheckSuiteStatus(str, Enum):
class GitHubCheckSuiteStatus(StrEnum):
"""The status of a GitHub check suite."""

queued = "queued"
Expand All @@ -240,7 +240,7 @@ class GitHubCheckSuiteStatus(str, Enum):
"""The check suite has completed."""


class GitHubCheckSuiteConclusion(str, Enum):
class GitHubCheckSuiteConclusion(StrEnum):
"""The conclusion state of a GitHub check suite."""

success = "success"
Expand Down Expand Up @@ -301,7 +301,7 @@ class GitHubCheckSuiteModel(BaseModel):
)


class GitHubCheckRunStatus(str, Enum):
class GitHubCheckRunStatus(StrEnum):
"""The check run status."""

queued = "queued"
Expand All @@ -314,7 +314,7 @@ class GitHubCheckRunStatus(str, Enum):
"""The check run has completed."""


class GitHubCheckRunConclusion(str, Enum):
class GitHubCheckRunConclusion(StrEnum):
"""The check run conclusion state."""

success = "success"
Expand All @@ -341,7 +341,7 @@ class GitHubCheckRunConclusion(str, Enum):
"""The check run is stale."""


class GitHubCheckRunAnnotationLevel(str, Enum):
class GitHubCheckRunAnnotationLevel(StrEnum):
"""The level of a check run output annotation."""

notice = "notice"
Expand Down
4 changes: 2 additions & 2 deletions safir/src/safir/models/_errors.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Error models for FastAPI applications."""

from enum import Enum
from enum import StrEnum

from pydantic import BaseModel, Field

Expand All @@ -11,7 +11,7 @@
]


class ErrorLocation(str, Enum):
class ErrorLocation(StrEnum):
"""Possible locations for an error.
The first element of ``loc`` in `ErrorDetail` should be chosen from one of
Expand Down

0 comments on commit 3d87945

Please sign in to comment.