Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed type hints in config module #285

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ols/app/models/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,13 +767,13 @@ class LoggingConfig(BaseModel):
suppress_metrics_in_log: bool = False
suppress_auth_checks_warning_in_log: bool = False

def __init__(self, **data: Optional[dict]) -> None:
def __init__(self, **data: Any) -> None:
"""Initialize configuration and perform basic validation."""
# convert input strings (level names, eg. debug/info,...) to
# logging level names (integer values) for defined model fields
for field in filter(lambda x: x.endswith("_log_level"), self.model_fields):
if field in data:
data[field] = checks.get_log_level(data[field]) # type: ignore[assignment]
data[field] = checks.get_log_level(data[field])
super().__init__(**data)


Expand Down Expand Up @@ -1007,12 +1007,12 @@ class UserDataCollectorConfig(BaseModel):
ingress_env: Literal["stage", "prod"] = "prod"
cp_offline_token: Optional[str] = None

def __init__(self, **data: Optional[dict]) -> None:
def __init__(self, **data: Any) -> None:
"""Initialize configuration."""
# convert input strings (level names, eg. debug/info,...) to
# logging level name (integer values)
if "log_level" in data:
data["log_level"] = checks.get_log_level(data["log_level"]) # type: ignore[assignment]
data["log_level"] = checks.get_log_level(data["log_level"])
super().__init__(**data)

@model_validator(mode="after")
Expand Down
Loading