From e6e6d91d554e10c9c27eb11bdbd6912bdca02ef4 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sat, 8 Sep 2018 14:08:42 -0700 Subject: [PATCH] Deprecate unused argument, content, from guess_mimetype Unused since its introduction in be261ed71ec797d32fe88dae1acf73adb2b33c8e. --- sphinx/util/images.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sphinx/util/images.py b/sphinx/util/images.py index 9abe748e4..c385c19a9 100644 --- a/sphinx/util/images.py +++ b/sphinx/util/images.py @@ -12,6 +12,7 @@ from __future__ import absolute_import import base64 import imghdr +import warnings from collections import OrderedDict from os import path from typing import NamedTuple @@ -19,6 +20,8 @@ from typing import NamedTuple import imagesize from six import PY3, BytesIO, iteritems +from sphinx.deprecation import RemovedInSphinx30Warning + try: from PIL import Image # check for the Python Imaging Library except ImportError: @@ -83,6 +86,8 @@ def guess_mimetype(filename='', content=None, default=None): if ext in mime_suffixes: return mime_suffixes[ext] elif content: + warnings.warn('The content argument of guess_mimetype() is deprecated.', + RemovedInSphinx30Warning) return guess_mimetype_for_stream(BytesIO(content), default=default) elif path.exists(filename): with open(filename, 'rb') as f: