Skip to content

Commit 653dd7d

Browse files
refactor: use StrEnum over Enum
1 parent 7eb7af3 commit 653dd7d

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

google/cloud/sql/connector/enums.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414

1515
from __future__ import annotations
1616

17-
from enum import Enum
17+
from enum import StrEnum
1818

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

2121

22-
class RefreshStrategy(Enum):
23-
LAZY: str = "LAZY"
24-
BACKGROUND: str = "BACKGROUND"
22+
class RefreshStrategy(StrEnum):
23+
LAZY = "LAZY"
24+
BACKGROUND = "BACKGROUND"
2525

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

3838

39-
class IPTypes(Enum):
40-
PUBLIC: str = "PRIMARY"
41-
PRIVATE: str = "PRIVATE"
42-
PSC: str = "PSC"
39+
class IPTypes(StrEnum):
40+
PUBLIC = "PRIMARY"
41+
PRIVATE = "PRIVATE"
42+
PSC = "PSC"
4343

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

5858

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

6262
ASYNCPG = "POSTGRES"

0 commit comments

Comments
 (0)