Skip to content

Commit

Permalink
Change open to Path.open
Browse files Browse the repository at this point in the history
Open is just built-in function of Path.open
  • Loading branch information
ion-elgreco authored Jul 17, 2023
1 parent 6149e6a commit 5e340f5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions py-polars/polars/io/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def managed_file(file: Any) -> Iterator[Any]:
if isinstance(file, str):
file = normalise_filepath(file, check_not_dir)
if has_non_utf8_non_utf8_lossy_encoding:
with open(file, encoding=encoding_str) as f:
with Path.open(file, encoding=encoding_str) as f:
return _check_empty(
BytesIO(f.read().encode("utf8")), context=f"{file!r}"
)
Expand Down Expand Up @@ -261,7 +261,7 @@ def managed_file(file: Any) -> Iterator[Any]:
if isinstance(file, str):
file = normalise_filepath(file, False)
if has_non_utf8_non_utf8_lossy_encoding:
with open(file, encoding=encoding_str) as f:
with Path.open(file, encoding=encoding_str) as f:
return _check_empty(
BytesIO(f.read().encode("utf8")), context=f"{file!r}"
)
Expand Down

0 comments on commit 5e340f5

Please sign in to comment.