read_only_cached_property

A read-only version of functools.cached_property.

ReadOnlyCachedProperty

Bases: cached_property[_T]

flowchart LR tm_devices.helpers.read_only_cached_property.ReadOnlyCachedProperty[ReadOnlyCachedProperty] click tm_devices.helpers.read_only_cached_property.ReadOnlyCachedProperty href "" "tm_devices.helpers.read_only_cached_property.ReadOnlyCachedProperty"

An implementation of cached_property that is read-only.

Notes

In order for the PyCharm IDE to properly provide auto-complete hints, this class must be imported in the following way:

from tm_devices.helpers import ReadOnlyCachedProperty as cached_property.

Examples:

>>> from tm_devices.helpers import ReadOnlyCachedProperty
>>> class ClassWithReadOnlyCachedProperty:
...     @ReadOnlyCachedProperty
...     def c(self) -> str:
...         return "cached value"