Skip to content

Commit

Permalink
Simplify reading/writing of bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed Sep 5, 2024
1 parent 6ebe43a commit 130b037
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions extension_helpers/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,12 @@ def write_if_different(filepath, data):
assert isinstance(data, bytes)

if filepath.exists():
with open(filepath, "rb") as fd:
original_data = fd.read()
original_data = filepath.read_bytes()
else:
original_data = None

if original_data != data:
with open(filepath, "wb") as fd:
fd.write(data)
filepath.write_bytes(data)


def import_file(filepath, name=None):
Expand Down

0 comments on commit 130b037

Please sign in to comment.