| 1 |
from functools import lru_cache |
| 2 |
|
| 3 |
# cached_property was introduced in Python 3.8. |
| 4 |
# TODO: Remove this file when support for Python 3.7 is dropped. |
| 5 |
# Recipe from https://stackoverflow.com/a/19979379 |
| 6 |
|
| 7 |
|
| 8 |
def cached_property(fn): |
| 9 |
return property(lru_cache()(fn)) |