Drop lots of legacy code. Support Python 3.7-3.11.
[librarian.git] / src / librarian / elements / figures / ilustr.py
index 9b3b165..33099f6 100644 (file)
@@ -1,4 +1,9 @@
-import six.moves
+# This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
+#
+import io
+import urllib.parse
+import urllib.request
 from PIL import Image
 from ..base import WLElement
 
@@ -11,12 +16,12 @@ class Ilustr(WLElement):
     def get_html_attr(self, builder):
         ## TODO: thumbnail.
 
-        url = six.moves.urllib.parse.urljoin(
+        url = urllib.parse.urljoin(
             builder.base_url,
             self.get('src')
         )
         
-        imgfile = six.moves.urllib.request.urlopen(url)
+        imgfile = urllib.request.urlopen(url)
         img = Image.open(imgfile)
         th_format, ext, media_type = {
             'GIF': ('GIF', 'gif', 'image/gif'),
@@ -29,7 +34,7 @@ class Ilustr(WLElement):
         else:
             th = img.resize((width, round(width * img.size[1] / img.size[0])))
 
-        buffer = six.BytesIO()
+        buffer = io.BytesIO()
         th.save(buffer, format=th_format)
         imgfile.close()
         file_name = 'image%d.%s' % (