Skip to content

Commit

Permalink
dataclass default value error fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
foo290 committed Nov 5, 2024
1 parent d44b46a commit 5080561
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions verify_email/token_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@

@dataclass
class GeneralConfig:
settings: GetFieldFromSettings = GetFieldFromSettings()
max_age: str = settings.get("max_age", raise_exception=False)
max_retries: int = settings.get("max_retries") + 1
time_units: List = field(default_factory=lambda: ["s", "m", "h", "d"])
settings: GetFieldFromSettings = field(default_factory=GetFieldFromSettings)
max_age: str = field(init=False)
max_retries: int = field(init=False)
time_units: List[str] = field(default_factory=lambda: ["s", "m", "h", "d"])

def __post_init__(self):
self.max_age = self.settings.get("max_age", raise_exception=False)
self.max_retries = self.settings.get("max_retries") + 1


@dataclass
Expand Down

0 comments on commit 5080561

Please sign in to comment.