format
This commit is contained in:
parent
aa1f06c20f
commit
3393f09907
2 changed files with 4 additions and 3 deletions
|
@ -1,4 +1,5 @@
|
||||||
"""Handle errors."""
|
"""Handle errors."""
|
||||||
|
|
||||||
|
|
||||||
class Error(Exception):
|
class Error(Exception):
|
||||||
"""Parent class for all errors."""
|
"""Parent class for all errors."""
|
||||||
|
|
|
@ -56,11 +56,11 @@ def read_file(file_path: str):
|
||||||
return file_object.read()
|
return file_object.read()
|
||||||
|
|
||||||
|
|
||||||
def read_file_lines(file_path: str, charset:str=CHARSET):
|
def read_file_lines(file_path: str, charset: str = CHARSET):
|
||||||
return read_file_text(file_path).split(os.linesep)
|
return read_file_text(file_path).split(os.linesep)
|
||||||
|
|
||||||
|
|
||||||
def read_file_text(file_path: str, charset:str=CHARSET):
|
def read_file_text(file_path: str, charset: str = CHARSET):
|
||||||
return read_file(file_path).decode(charset)
|
return read_file(file_path).decode(charset)
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ def wipe(path: str) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def write(file_path: str, text: str, charset:str=CHARSET) -> None:
|
def write(file_path: str, text: str, charset: str = CHARSET) -> None:
|
||||||
"""Write text into a file."""
|
"""Write text into a file."""
|
||||||
with open(file_path, "bw") as file_object:
|
with open(file_path, "bw") as file_object:
|
||||||
file_object.write(text.encode(charset))
|
file_object.write(text.encode(charset))
|
||||||
|
|
Loading…
Reference in a new issue