jenkins-job-builder/jenkins_jobs/cached_property.py
Vsevolod Fedorov 60e8395c62 Add source location and context to error messages
Change-Id: I2e955c01b71a195bb6ff8ba2bb6f3a64cb3e1f58
2023-04-04 13:35:42 +03:00

10 lines
261 B
Python

from functools import lru_cache
# cached_property was introduced in Python 3.8.
# TODO: Remove this file when support for Python 3.7 is dropped.
# Recipe from https://stackoverflow.com/a/19979379
def cached_property(fn):
return property(lru_cache()(fn))