(instance: Any)
| 281 | """ |
| 282 | |
| 283 | def fget(instance: Any) -> Any: |
| 284 | dict_ = attributes.instance_dict(instance) |
| 285 | state = attributes.instance_state(instance) |
| 286 | |
| 287 | if self.key not in dict_: |
| 288 | # key not present. Iterate through related |
| 289 | # attributes, retrieve their values. This |
| 290 | # ensures they all load. |
| 291 | values = [ |
| 292 | getattr(instance, key) for key in self._attribute_keys |
| 293 | ] |
| 294 | |
| 295 | # current expected behavior here is that the composite is |
| 296 | # created on access if the object is persistent or if |
| 297 | # col attributes have non-None. This would be better |
| 298 | # if the composite were created unconditionally, |
| 299 | # but that would be a behavioral change. |
| 300 | if self.key not in dict_ and ( |
| 301 | state.key is not None or not _none_set.issuperset(values) |
| 302 | ): |
| 303 | dict_[self.key] = self.composite_class(*values) |
| 304 | state.manager.dispatch.refresh( |
| 305 | state, self._COMPOSITE_FGET, [self.key] |
| 306 | ) |
| 307 | |
| 308 | return dict_.get(self.key, None) |
| 309 | |
| 310 | def fset(instance: Any, value: Any) -> None: |
| 311 | dict_ = attributes.instance_dict(instance) |
no test coverage detected