Skip to content

Commit

Permalink
Fix mypy error (#1030)
Browse files Browse the repository at this point in the history
* Fix mypy error

* Update CHANGELOG

* Remove unused import

Co-authored-by: Paul Sanders <[email protected]>
  • Loading branch information
sanders41 and Paul Sanders authored Aug 31, 2022
1 parent 362fac9 commit 0079c9e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
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

0 comments on commit 0079c9e

Please sign in to comment.