Skip to content

Commit

Permalink
refactor: use StrEnum over Enum
Browse files Browse the repository at this point in the history
  • Loading branch information
jackwotherspoon committed Jan 7, 2025
1 parent 7eb7af3 commit 653dd7d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions google/cloud/sql/connector/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

from __future__ import annotations

from enum import Enum
from enum import StrEnum

from google.cloud.sql.connector.exceptions import IncompatibleDriverError


class RefreshStrategy(Enum):
LAZY: str = "LAZY"
BACKGROUND: str = "BACKGROUND"
class RefreshStrategy(StrEnum):
LAZY = "LAZY"
BACKGROUND = "BACKGROUND"

@classmethod
def _missing_(cls, value: object) -> None:
Expand All @@ -36,10 +36,10 @@ def _from_str(cls, refresh_strategy: str) -> RefreshStrategy:
return cls(refresh_strategy.upper())


class IPTypes(Enum):
PUBLIC: str = "PRIMARY"
PRIVATE: str = "PRIVATE"
PSC: str = "PSC"
class IPTypes(StrEnum):
PUBLIC = "PRIMARY"
PRIVATE = "PRIVATE"
PSC = "PSC"

@classmethod
def _missing_(cls, value: object) -> None:
Expand All @@ -56,7 +56,7 @@ def _from_str(cls, ip_type_str: str) -> IPTypes:
return cls(ip_type_str.upper())


class DriverMapping(Enum):
class DriverMapping(StrEnum):
"""Maps a given database driver to it's corresponding database engine."""

ASYNCPG = "POSTGRES"
Expand Down

0 comments on commit 653dd7d

Please sign in to comment.