Skip to content

Commit af67da5

Browse files
authored
import Literal from typing_extensions to work around pydantic bug (#109)
* import literal from typing_extensions to work around pydantic bug * update pylint version to clean up CI
1 parent 06ead93 commit af67da5

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

dev-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ipython
33
mypy==0.910
44
packaging==20.9
55
pre-commit==2.9.3
6-
pylint==2.6.0
6+
pylint==2.10.0
77
pytest==6.2.2
88
pytest-cov==2.11.1
99
requests-mock==1.8.0

src/fideslang/manifests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ def write_manifest(
1717
else:
1818
manifest = {resource_type: manifest}
1919

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

2323

2424
def load_yaml_into_dict(file_path: str) -> Dict:
2525
"""
2626
This loads yaml files into a dictionary to be used in API calls.
2727
"""
28-
with open(file_path, "r") as yaml_file:
28+
with open(file_path, "r", encoding="utf-8") as yaml_file:
2929
loaded = yaml.safe_load(yaml_file)
3030
if isinstance(loaded, dict):
3131
return loaded

src/fideslang/models.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from __future__ import annotations
77

88
from enum import Enum
9-
from typing import Any, Dict, List, Literal, Optional, Union
9+
from typing import Any, Dict, List, Optional, Union
1010
from warnings import warn
1111

1212
from pydantic import (
@@ -20,6 +20,9 @@
2020
validator,
2121
)
2222

23+
# import `Literal` from typing_extensions to work around https://github.com/pydantic/pydantic/issues/5821
24+
from typing_extensions import Literal
25+
2326
from fideslang.validation import (
2427
FidesKey,
2528
check_valid_country_code,

0 commit comments

Comments
 (0)