summaryrefslogtreecommitdiff
path: root/sphinx/util/images.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/util/images.py')
-rw-r--r--sphinx/util/images.py14
1 files changed, 2 insertions, 12 deletions
diff --git a/sphinx/util/images.py b/sphinx/util/images.py
index 0e5f3e81b..76bffd88c 100644
--- a/sphinx/util/images.py
+++ b/sphinx/util/images.py
@@ -10,16 +10,12 @@
import base64
import imghdr
-import warnings
from collections import OrderedDict
-from io import BytesIO
from os import path
from typing import NamedTuple
import imagesize
-from sphinx.deprecation import RemovedInSphinx30Warning
-
try:
from PIL import Image
except ImportError:
@@ -72,17 +68,11 @@ def guess_mimetype_for_stream(stream, default=None):
return default
-def guess_mimetype(filename='', content=None, default=None):
- # type: (str, bytes, str) -> str
+def guess_mimetype(filename, default=None):
+ # type: (str, str) -> str
_, ext = path.splitext(filename.lower())
if ext in mime_suffixes:
return mime_suffixes[ext]
- elif content:
- # TODO: When the content argument is removed, make filename a required
- # argument.
- warnings.warn('The content argument of guess_mimetype() is deprecated.',
- RemovedInSphinx30Warning, stacklevel=2)
- return guess_mimetype_for_stream(BytesIO(content), default=default)
elif path.exists(filename):
with open(filename, 'rb') as f:
return guess_mimetype_for_stream(f, default=default)