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

Fix mypy error #1030

Merged
merged 3 commits into from
Aug 31, 2022
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ The types of changes are:

* Added more taxonomy fields that can be edited via the UI [#1000](https://github.com/ethyca/fides/pull/1000)

### Fixed

* Fixed failing mypy tests [#1030](https://github.com/ethyca/fides/pull/1030)

## [1.8.2](https://github.com/ethyca/fides/compare/1.8.1...1.8.2) - 2022-08-18

### Added
Expand Down
3 changes: 2 additions & 1 deletion src/fidesctl/ctl/core/config/cli_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class FidesctlCLISettings(FidesSettings):
server_url: Optional[AnyHttpUrl]

@validator("server_url", always=True)
def get_server_url(cls: FidesSettings, value: str, values: Dict) -> str:
@classmethod
def get_server_url(cls, value: str, values: Dict) -> str:
"Create the server_url."
host = values["server_host"]
port = values["server_port"]
Expand Down
9 changes: 6 additions & 3 deletions src/fidesctl/ctl/core/config/logging_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ class FidesctlLoggingSettings(FidesSettings):
serialization: str = ""

@validator("destination", pre=True)
def get_destination(cls: FidesSettings, value: str) -> str:
@classmethod
def get_destination(cls, value: str) -> str:
"""
Print logs to sys.stdout, unless a valid file path is specified.
"""
return value if os.path.exists(value) else ""

@validator("level", pre=True)
def get_level(cls: FidesSettings, value: str) -> str:
@classmethod
def get_level(cls, value: str) -> str:
"""
Set the logging level to DEBUG if in test mode, INFO by default.
Ensures that the string-form of a valid logging._Level is
Expand All @@ -41,7 +43,8 @@ def get_level(cls: FidesSettings, value: str) -> str:
return value if getLevelName(value) != f"Level {value}" else getLevelName(INFO)

@validator("serialization", pre=True)
def get_serialization(cls: FidesSettings, value: str) -> str:
@classmethod
def get_serialization(cls, value: str) -> str:
"""
Ensure that only JSON serialization, or no serialization, is used.
"""
Expand Down
7 changes: 3 additions & 4 deletions src/fidesctl/ctl/core/config/user_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from typing import Dict, Optional

from pydantic import BaseModel, validator
from pydantic import validator

from fidesctl.ctl.core.utils import generate_request_headers

Expand All @@ -22,9 +22,8 @@ class FidesctlUserSettings(FidesSettings):

# Automatically generate the request_headers on object creation
@validator("request_headers", pre=True, always=True)
def get_request_headers(
cls: BaseModel, value: Optional[Dict], values: Dict
) -> Dict[str, str]:
@classmethod
def get_request_headers(cls, value: Optional[Dict], values: Dict) -> Dict[str, str]:
return generate_request_headers(values["user_id"], values["api_key"])

class Config:
Expand Down