From 8fbbe701f2c7a4b5976ce7cadf7230f22878848d Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Tue, 10 Jul 2018 08:37:20 +0200 Subject: common: Remove unused get_base64_from_file() function. --- poezio/common.py | 24 ------------------------ 1 file changed, 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. -- cgit v1.2.3