Source code for api.simulation.data_tables.partial_find_creator_setup
""" Base class for handling setting up data tables in loads, for particular implementations see :ref:`data table setup implementations documentation <data_tables>`"""importtypingfrommore.api.exceptions.api_exceptionimportStaleReferentError# Replace with the correct interface as soon as program interfaces will be made independent of implementationspartial_find_creator_interface_type=typing.Any
[docs]classPartialFindCreatorSetup:def__init__(self,partial_find_creator_getter:typing.Callable[[],partial_find_creator_interface_type],partial_find_creator:partial_find_creator_interface_type):self._partial_find_creator_getter=partial_find_creator_getterself._initial_partial_find_creator=partial_find_creatordef_get_wrapped_object(self):returnself._initial_partial_find_creatordef__getattribute__(self,name):current_partial_find_creator=object.__getattribute__(self,'_partial_find_creator_getter')()initial_partial_find_creator=object.__getattribute__(self,'_initial_partial_find_creator')ifinitial_partial_find_creator!=current_partial_find_creator:raiseStaleReferentError('This query config is stale and no longer valid, ''most probably the chosen data table changed')returnobject.__getattribute__(self,name)