__call__ allows the InstanceState to act as a deferred callable for loading expired attributes, which is also serializable (picklable).
(
self, state: InstanceState[_O], passive: PassiveFlag
)
| 812 | self.manager.dispatch.expire(self, attribute_names) |
| 813 | |
| 814 | def _load_expired( |
| 815 | self, state: InstanceState[_O], passive: PassiveFlag |
| 816 | ) -> LoaderCallableStatus: |
| 817 | """__call__ allows the InstanceState to act as a deferred |
| 818 | callable for loading expired attributes, which is also |
| 819 | serializable (picklable). |
| 820 | |
| 821 | """ |
| 822 | |
| 823 | if not passive & SQL_OK: |
| 824 | return PASSIVE_NO_RESULT |
| 825 | |
| 826 | toload = self.expired_attributes.intersection(self.unmodified) |
| 827 | toload = toload.difference( |
| 828 | attr |
| 829 | for attr in toload |
| 830 | if not self.manager[attr].impl.load_on_unexpire |
| 831 | ) |
| 832 | |
| 833 | self.manager.expired_attribute_loader(self, toload, passive) |
| 834 | |
| 835 | # if the loader failed, or this |
| 836 | # instance state didn't have an identity, |
| 837 | # the attributes still might be in the callables |
| 838 | # dict. ensure they are removed. |
| 839 | self.expired_attributes.clear() |
| 840 | |
| 841 | return ATTR_WAS_SET |
| 842 | |
| 843 | @property |
| 844 | def unmodified(self) -> Set[str]: |
no test coverage detected