Pyupgrade to python3.8 (#3616)

* Upgrade to Python 3.8 syntax

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
Christian Clauss
2020-10-21 12:46:14 +02:00
committed by GitHub
parent 74233022a0
commit 9b95e4f662
21 changed files with 38 additions and 33 deletions

View File

@ -17,10 +17,10 @@ def read_file_binary(file_path: str) -> str:
with open(file_path, "rb") as binary_file:
data = binary_file.read()
for dat in data:
curr_byte = "{0:08b}".format(dat)
curr_byte = f"{dat:08b}"
result += curr_byte
return result
except IOError:
except OSError:
print("File not accessible")
sys.exit()
@ -105,7 +105,7 @@ def write_file_binary(file_path: str, to_write: str) -> None:
for elem in result_byte_array:
opened_file.write(int(elem, 2).to_bytes(1, byteorder="big"))
except IOError:
except OSError:
print("File not accessible")
sys.exit()