def switch_context(self, context): self.previous_context.append(self.context) self.context = context global_assumptions.clear() global_assumptions.update(self.context.assumptions)
def restore(self): if self.previous is None: return self.assumptions.update(global_assumptions) global_assumptions.clear() global_assumptions.update(self.previous.assumptions)
def switch(self): global context self.previous = context context = self global_assumptions.clear() global_assumptions.update(self.assumptions)
def restore_context(self): self.context.assumptions.update(global_assumptions) self.context = self.previous_context.pop() global_assumptions.clear() global_assumptions.update(self.context.assumptions)