diff --git a/sigal/gallery.py b/sigal/gallery.py index 048f0ef..96c2585 100644 --- a/sigal/gallery.py +++ b/sigal/gallery.py @@ -33,6 +33,7 @@ import random import sys from collections import defaultdict from datetime import datetime +from functools import cached_property from itertools import cycle from os.path import isfile, join, splitext from urllib.parse import quote as url_quote @@ -46,7 +47,6 @@ from .image import get_exif_tags, get_image_metadata, get_size, process_image from .settings import Status, get_thumb from .utils import ( Devnull, - cached_property, check_or_create_dir, copy, get_mime, diff --git a/sigal/plugins/zip_gallery.py b/sigal/plugins/zip_gallery.py index a009d60..1e9026d 100644 --- a/sigal/plugins/zip_gallery.py +++ b/sigal/plugins/zip_gallery.py @@ -34,11 +34,11 @@ See :ref:`compatibility with the encrypt plugin `. import logging import os import zipfile +from functools import cached_property from os.path import isfile, join from sigal import signals from sigal.gallery import Album -from sigal.utils import cached_property logger = logging.getLogger(__name__) diff --git a/sigal/utils.py b/sigal/utils.py index f8779ad..9b9b7fd 100644 --- a/sigal/utils.py +++ b/sigal/utils.py @@ -119,24 +119,3 @@ def is_valid_html5_video(ext): def get_mime(ext): """Returns mime type for extension.""" return VIDEO_MIMES[ext] - - -class cached_property: - """A property that is only computed once per instance and then replaces - itself with an ordinary attribute. Deleting the attribute resets the - property. - Source: - https://github.com/pydanny/cached-property (BSD Licensed) - https://github.com/bottlepy/bottle/commit/fa7733e075da0d790d809aa3d2f53071897e6f76 - - """ - - def __init__(self, func): - self.__doc__ = getattr(func, '__doc__') - self.func = func - - def __get__(self, obj, cls): - if obj is None: - return self - value = obj.__dict__[self.func.__name__] = self.func(obj) - return value