stravalib.model.lazy_property#
- stravalib.model.lazy_property(fn: Callable[[U], T]) T | None[source]#
Should be used to decorate the functions that return a lazily loaded entity (collection), e.g., the members of a club.
- Parameters:
fn (Callable) – The input function that returns the lazily loaded entity (collection).
- Returns:
A lazily loaded property.
- Return type:
property
- Raises:
exc.UnboundEntity – If the object is unbound (self.bound_client is None) or has a None ID (self.id is None).
Notes
Assumes that fn (like a regular getter property) has as single argument a reference to self, and uses one of the (bound) client methods to retrieve an entity (collection) by self.id.