def reset_context(self, context=None): self.context = {'args': self.args} if isinstance(context, str): context = {'doc': {'text': context}} dict_merge(self.context, context) logging.warning(f"Reset self.context: {self.context}") return self.context
def update_context(self, context=None): logging.warning(f"Updating self.context using context: {context}") if isinstance(context, str): context = {'doc': {'text': context}} context = {} if context is None else dict(context) dict_merge(self.context, context) logging.warning(f"Updated self.context: {self.context}") return self.context
def update_context(self, context=None): log.debug(f"Updating self.context using context: {repr(context)[:60]}") if isinstance(context, str): context = {'doc': {'text': context}} context = {} if context is None else dict(context) dict_merge(self.context, context) log.debug(f"Updated self.context: {repr(self.context)[:60]}") return self.context
def dict_merge(self, other): dict_merge(self, other)