Skip to content

Commit

Permalink
import Literal from typing_extensions to work around pydantic bug (
Browse files Browse the repository at this point in the history
…#109)

* import literal from typing_extensions to work around pydantic bug

* update pylint version to clean up CI
  • Loading branch information
adamsachs authored May 23, 2023
1 parent 06ead93 commit af67da5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ipython
mypy==0.910
packaging==20.9
pre-commit==2.9.3
pylint==2.6.0
pylint==2.10.0
pytest==6.2.2
pytest-cov==2.11.1
requests-mock==1.8.0
Expand Down
4 changes: 2 additions & 2 deletions src/fideslang/manifests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ def write_manifest(
else:
manifest = {resource_type: manifest}

with open(file_name, "w") as manifest_file:
with open(file_name, "w", encoding="utf-8") as manifest_file:
yaml.dump(manifest, manifest_file, sort_keys=False, indent=2)


def load_yaml_into_dict(file_path: str) -> Dict:
"""
This loads yaml files into a dictionary to be used in API calls.
"""
with open(file_path, "r") as yaml_file:
with open(file_path, "r", encoding="utf-8") as yaml_file:
loaded = yaml.safe_load(yaml_file)
if isinstance(loaded, dict):
return loaded
Expand Down
5 changes: 4 additions & 1 deletion src/fideslang/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from __future__ import annotations

from enum import Enum
from typing import Any, Dict, List, Literal, Optional, Union
from typing import Any, Dict, List, Optional, Union
from warnings import warn

from pydantic import (
Expand All @@ -20,6 +20,9 @@
validator,
)

# import `Literal` from typing_extensions to work around https://github.com/pydantic/pydantic/issues/5821
from typing_extensions import Literal

from fideslang.validation import (
FidesKey,
check_valid_country_code,
Expand Down

0 comments on commit af67da5

Please sign in to comment.