summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-07-10 08:37:20 +0200
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-07-10 12:07:05 +0200
commit8fbbe701f2c7a4b5976ce7cadf7230f22878848d (patch)
tree1db1b43ba4a3673c378ef343053353693c6154ca
parent59f12b761d15e80dad0b48f56948ac7aa05f7ff6 (diff)
downloadpoezio-8fbbe701f2c7a4b5976ce7cadf7230f22878848d.tar.gz
poezio-8fbbe701f2c7a4b5976ce7cadf7230f22878848d.tar.bz2
poezio-8fbbe701f2c7a4b5976ce7cadf7230f22878848d.tar.xz
poezio-8fbbe701f2c7a4b5976ce7cadf7230f22878848d.zip
common: Remove unused get_base64_from_file() function.
-rw-r--r--poezio/common.py24
1 files changed, 0 insertions, 24 deletions
diff --git a/poezio/common.py b/poezio/common.py
index a7579fcc..d388a2cc 100644
--- a/poezio/common.py
+++ b/poezio/common.py
@@ -21,30 +21,6 @@ import time
import string
-def get_base64_from_file(path):
- """
- Convert the content of a file to base64
-
- :param str path: The path of the file to convert.
- :return: A tuple of (encoded data, mime type, sha1 hash) if
- the file exists and does not exceeds the upper size limit of 16384.
- :return: (None, None, error message) if it fails
- :rtype: :py:class:`tuple`
-
- """
- if not os.path.isfile(path):
- return (None, None, "File does not exist")
- size = os.path.getsize(path)
- if size > 16384:
- return (None, None, "File is too big")
- with open(path, 'rb') as fdes:
- data = fdes.read()
- encoded = base64.encodebytes(data)
- sha1 = hashlib.sha1(data).hexdigest()
- mime_type = mimetypes.guess_type(path)[0]
- return (encoded, mime_type, sha1)
-
-
def _get_output_of_command(command):
"""
Runs a command and returns its output.