parameters: (self, default)
docstring: A context manager for manipulating a default stack.
docstring_summary: A context manager for manipulating a default stack.
docstring_tokens: A context manager for manipulating a default stack .
function: def get_controller(self, default):
      """A context manager for manipulating a default stack."""
      try:
        self.stack.append(default)
        yield default
      finally:
        if self._enforce_nesting:
          if self.stack[-1] is not default:
            raise AssertionError(
                "Nesting violated for default stack of %s objects"
                % type(default))
          self.stack.pop()
        else:
          self.stack.remove(default)
function_tokens: def get_controller ( self , default ) : try : self . stack . append ( default ) yield default finally : if self . _enforce_nesting : if self . stack [ - 1 ] is not default : raise AssertionError ( "Nesting violated for default stack of %s objects" % type ( default ) ) self . stack . pop ( ) else : self . stack . remove ( default )