parameters: (self, trace_id, keep_holds=False)
docstring: Remove context (called from add_context, with RLock; should not block otrace thread)
docstring_summary: Remove context (called from add_context, with RLock; should not block otrace thread)
docstring_tokens: Remove context ( called from add_context with RLock ; should not block otrace thread )
function: def remove_context(self, trace_id, keep_holds=False):
          """ Remove context (called from add_context, with RLock; should not block otrace thread)
          """
          with Trace_rlock:
              context_type, fullmethodname, context_id, trace_timestamp = self.split_trace_id(trace_id)
              if context_type == "holds":
                  try:
                      context = self[context_type][fullmethodname][context_id][trace_timestamp]
                      self_arg = context["self"]
                      if self_arg and getattr(self_arg, OTrace.resume_attr, None):
                          if keep_holds:
                              # Keep on hold
                              return
                          else:
                              # Cancel hold (within RLock; this call should not block otrace thread)
                              resume_from_hold(self_arg)
                  except Exception:
                      pass
  
              context_trace_ids = self.trace_ids[context_type]
  
              # Remove trace id from list
              try:
                  indx = context_trace_ids.index(trace_id)
                  if indx >= 0:
                      del context_trace_ids[indx]
              except Exception:
                  pass
  
              # Remove context from dictionary
              try:
                  del self[context_type][fullmethodname][context_id][trace_timestamp]
                  if not self[context_type][fullmethodname][context_id]:
                      del self[context_type][fullmethodname][context_id]
                      if not self[context_type][fullmethodname]:
                          del self[context_type][fullmethodname]
              except Exception:
                  pass
function_tokens: def remove_context ( self , trace_id , keep_holds = False ) : with Trace_rlock : context_type , fullmethodname , context_id , trace_timestamp = self . split_trace_id ( trace_id ) if context_type == "holds" : try : context = self [ context_type ] [ fullmethodname ] [ context_id ] [ trace_timestamp ] self_arg = context [ "self" ] if self_arg and getattr ( self_arg , OTrace . resume_attr , None ) : if keep_holds : # Keep on hold return else : # Cancel hold (within RLock; this call should not block otrace thread) resume_from_hold ( self_arg ) except Exception : pass context_trace_ids = self . trace_ids [ context_type ] # Remove trace id from list try : indx = context_trace_ids . index ( trace_id ) if indx >= 0 : del context_trace_ids [ indx ] except Exception : pass # Remove context from dictionary try : del self [ context_type ] [ fullmethodname ] [ context_id ] [ trace_timestamp ] if not self [ context_type ] [ fullmethodname ] [ context_id ] : del self [ context_type ] [ fullmethodname ] [ context_id ] if not self [ context_type ] [ fullmethodname ] : del self [ context_type ] [ fullmethodname ] except Exception : pass