Skip to content

Commit

Permalink
Fix open encoding, typing-mpymssql
Browse files Browse the repository at this point in the history
  • Loading branch information
jlubken committed Sep 23, 2021
1 parent ba18741 commit 43f8ed6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"pytest",
"pytest-cov",
"types-pkg-resources",
"types-pymssql",
"types-python-dateutil",
"types-pyyaml",
)
Expand Down
2 changes: 1 addition & 1 deletion src/dsdk/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def namespace_directory(root: str = "./", ext: str = ".sql") -> Namespace:
s_name, s_ext = splitext(name)
if s_ext != ext:
continue
with open(path) as fin:
with open(path, encoding="utf-8") as fin:
setattr(result, s_name, fin.read())
return result

Expand Down
2 changes: 1 addition & 1 deletion src/dsdk/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class Evidence(OrderedDict):
def __setitem__(self, key, value):
"""__setitem__."""
if key in self:
raise KeyError("{} has already been set".format(key))
raise KeyError(f"{key} has already been set")
super().__setitem__(key, value)


Expand Down
4 changes: 2 additions & 2 deletions src/dsdk/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def chunks(sequence: Sequence[Any], n: int):

def dump_json_file(obj: Any, path: str) -> None:
"""Dump json to file."""
with open(path, "w") as fout:
with open(path, "w", encoding="utf-8") as fout:
json_dump(obj, fout)


Expand All @@ -61,7 +61,7 @@ def dump_pickle_file(obj: Any, path: str) -> None:

def load_json_file(path: str) -> object:
"""Load json from file."""
with open(path, "r") as fin:
with open(path, "r", encoding="utf-8") as fin:
return json_load(fin)


Expand Down
4 changes: 2 additions & 2 deletions test/test_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ def load_pickle_file(path: str) -> object:

def dump_json_file(obj, path: str) -> None:
"""Dump json to file."""
with open(path, "w") as fout:
with open(path, "w", encoding="utf-8") as fout:
json_dump(obj, fout)


def load_json_file(path: str) -> object:
"""Load json from file."""
with open(path, "r") as fin:
with open(path, "r", encoding="utf-8") as fin:
return json_load(fin)


Expand Down

0 comments on commit 43f8ed6

Please sign in to comment.