Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ericvergnaud committed Aug 2, 2024
1 parent 2cb54c0 commit 1b0110c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/databricks/labs/blueprint/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,11 +799,11 @@ def open(
data = f.read()
if encoding is None:
if data.startswith(codecs.BOM_UTF32_LE) or data.startswith(codecs.BOM_UTF32_BE):
encoding = 'utf-32'
encoding = "utf-32"
elif data.startswith(codecs.BOM_UTF16_LE) or data.startswith(codecs.BOM_UTF16_BE):
encoding = 'utf-16'
encoding = "utf-16"
elif data.startswith(codecs.BOM_UTF8):
encoding = 'utf-8-sig'
encoding = "utf-8-sig"
if encoding is None or encoding == "locale":
encoding = locale.getpreferredencoding(False)
return StringIO(data.decode(encoding))
Expand All @@ -812,7 +812,7 @@ def open(
raise ValueError(f"invalid mode: {mode}")

def read_text(self, encoding=None, errors=None):
with self.open(mode='r', encoding=encoding, errors=errors) as f:
with self.open(mode="r", encoding=encoding, errors=errors) as f:
return f.read()

@property
Expand Down
1 change: 0 additions & 1 deletion tests/integration/test_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,3 @@ def test_correctly_encodes_and_decodes_file_with_bom(bom, encoding, ws, make_dir
file_path.write_bytes(data)
text = file_path.read_text()
assert text == "a = 12"

0 comments on commit 1b0110c

Please sign in to comment.