Decorators
- UTILITY DECORATORS
enum_class_prop
A decorator for creating a static property for Enum classes.
Source code in src/utils/decorators.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|
__get__(instance, owner)
Computes and caches the value of a property when accessed. @param instance: Instance of the class where descriptor is accessed. @param owner: The class that the descriptor exists on. @return: The cached value.
Source code in src/utils/decorators.py
103 104 105 106 107 108 109 110 111 112 |
|
__init__(method)
Initializes the property. @param method: Class method being decorated.
Source code in src/utils/decorators.py
95 96 97 98 99 100 101 |
|
auto_prop(func)
Property decorator wrapper that automatically creates a setter.
Source code in src/utils/decorators.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
auto_prop_cached(func)
Property decorator wrapper automatically creates a setter and caches the value.
Source code in src/utils/decorators.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
choose_class_route(condition)
A decorator that routes a method call to the current class or its parent based on a bool condition. @param condition: Route to self if True, otherwise route to self's superclass. @return: The wrapped function.
Source code in src/utils/decorators.py
58 59 60 61 62 63 64 65 66 67 68 69 70 |
|
suppress_and_return(return_val)
If an exception occurs within decorated function, suppress it and return given value. @param return_val: Value to return if exception is encountered.
Source code in src/utils/decorators.py
73 74 75 76 77 78 79 80 81 82 83 84 |
|