hololinked.core.meta.DescriptorRegistry
A registry for the descriptors of a Thing
class or Thing
instance.
Provides a dictionary interface to access the descriptors under the descriptors
attribute.
Each of properties, actions and events subclasss from here to implement a registry of their available objects.
Source code in hololinked\core\meta.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
|
Attributes
owner
property
The owner of the registry - the instance of a Thing
if a Thing
has been instantiated
or the class/subclass of Thing
when accessed as a class attribute.
descriptor_object
property
The type of descriptor object that this registry holds, i.e. Property
, Action
or Event
descriptors
property
A dictionary with all the descriptors as values and their names as keys.
values
property
The values contained within the descriptors after reading when accessed at instance level, otherwise, the descriptor objects as dictionary when accessed at class level.
Functions
__init__
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
ThingMeta
|
The class/subclass of the |
required |
|
The instance of the |
None
|
Source code in hololinked\core\meta.py
clear
Deletes the descriptors dictionary (value of the descriptors
proeprty) so that it can be recreated.
Does not delete the descriptors themselves. Call this method once if new descriptors are added to the
class/instance dynamically in runtime.
Source code in hololinked\core\meta.py
get_descriptors
a dictionary with all the descriptors as values and their names as keys.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
bool
|
if True, the descriptors dictionary is recreated and returned, otherwise, the cached dictionary is returned. |
False
|
Source code in hololinked\core\meta.py
get_values
the values contained within the descriptors after reading when accessed at instance level, otherwise,
the descriptor objects as dictionary when accessed at class level.
For example, if a Thing
instance's property contains a value of 5, this method will return
{ property_name : 5 } when accessed at instance level, and { property_name : property_object } when accessed
at class level.
This method is also the getter of the values
property.
Source code in hololinked\core\meta.py
dunder
Apart from the above __getitem__
, __contains__
, __dir__
, __iter__
, __len__
, __hash__
, __str__
are supported