[文档]classPropagationManager(KnowledgeBasePlugin):""" Manages the results of Propagator, including intermediate results for unfinished Propagation runs. """
[文档]defexists(self,prop_key:tuple)->bool:""" Internal function to check if a func, specified as a CodeLocation exists in our known propagations :param prop_key: A key of the propagation result. :return: Whether such a key exists or not. """returnprop_keyinself._propagations
[文档]defupdate(self,prop_key:tuple,model:PropagationModel)->None:""" Add the replacements to known propagations :param prop_key: A key of the propagation result. :param model: The propagation result to store """self._propagations[prop_key]=model
[文档]defget(self,prop_key,default=None)->PropagationModel:""" Gets the replacements for a specified function location. If the replacement does not exist in the known propagations, it returns None. :param prop_key: A key of the propagation result. :param default: The default value to return if the prop_key does not exist in the cache. :return: Dict or None """ifprop_keyinself._propagations:returnself._propagations[prop_key]returndefault