akkudoktoreos.core.decorators.classproperty

class akkudoktoreos.core.decorators.classproperty(fget: Callable[[Any], Any])

Bases: object

A decorator to define a read-only property at the class level.

This class replaces the built-in property which is no longer available in combination with @classmethod since Python 3.13 to allow a method to be accessed as a property on the class itself, rather than an instance. This is useful when you want a property-like syntax for methods that depend on the class rather than any instance of the class.

Example

class MyClass:

_value = 42

@classproperty def value(cls):

return cls._value

print(MyClass.value) # Outputs: 42

__get__()

Retrieves the value of the class property by calling the decorated method on the class.

Parameters:

fget (Callable[[Any], Any]) – A method that takes the class as an argument and returns a value.

Raises:

RuntimeError – If fget is not defined when __get__ is called.

__init__(fget: Callable[[Any], Any]) None

Methods

__init__(fget)

__init__(fget: Callable[[Any], Any]) None