Better support for file contents writing // Issue #2796

This commit is contained in:
Ivan Kravets committed 2019-10-17 18:48:59 +03:00
1 parent 7bcfea13fb
commit 6218b773fd
14 files changed
+80 -91

No files matched your search

-12
View File
@@ -52,10 +52,6 @@ if PY2:
return path
return path.decode(get_filesystem_encoding()).encode("utf-8")
def get_file_contents(path):
with open(path) as f:
return f.read()
def hashlib_encode_data(data):
if is_bytes(data):
return data
@@ -104,14 +100,6 @@ else:
def path_to_unicode(path):
return path
def get_file_contents(path):
try:
with open(path) as f:
return f.read()
except UnicodeDecodeError:
with open(path, encoding="latin-1") as f:
return f.read()
def hashlib_encode_data(data):
if is_bytes(data):
return data