
_namemodmap = dict(
    SimpleRunner='simple',
    IPythonParallelRunner='ipythonparallel',
    MultiprocessingRunner='multiprocessingpool',
)


def getrunner(classname):
    import sys
    module = 'buildlet.runner.{0}'.format(_namemodmap[classname])
    __import__(module)
    return getattr(sys.modules[module], classname)


def listrunner():
    return list(_namemodmap)


def run(classname, task, *args, **kwds):
    runner = getrunner(classname)(*args, **kwds)
    runner.run(task)
    return runner


_namemodmap = dict(
    SimpleRunner='simple',
    IPythonParallelRunner='ipythonparallel',
    MultiprocessingRunner='multiprocessingpool',
)


def getrunner(classname):
    """
    Get a runner class named `classname`.
    """
    import sys
    module = 'buildlet.runner.{0}'.format(_namemodmap[classname])
    __import__(module)
    return getattr(sys.modules[module], classname)


def listrunner():
    """
    Get a list of runner class names (a list of strings).
    """
    return list(_namemodmap)


def run(classname, task, *args, **kwds):
    """
    Run `task` using runner named `classname`.

    Rest of the arguments are passed to the runner class.
    Return the instance of the used runner class.

    """
    runner = getrunner(classname)(*args, **kwds)
    runner.run(task)
    return runner

Document utility functions in buildlet.runner
Document utility functions in buildlet.runner

  
  _namemodmap = dict(
      SimpleRunner='simple',
      IPythonParallelRunner='ipythonparallel',
      MultiprocessingRunner='multiprocessingpool',
  )
  
  
  def getrunner(classname):
+     """
+     Get a runner class named `classname`.
+     """
      import sys
      module = 'buildlet.runner.{0}'.format(_namemodmap[classname])
      __import__(module)
      return getattr(sys.modules[module], classname)
  
  
  def listrunner():
+     """
+     Get a list of runner class names (a list of strings).
+     """
      return list(_namemodmap)
  
  
  def run(classname, task, *args, **kwds):
+     """
+     Run `task` using runner named `classname`.
+ 
+     Rest of the arguments are passed to the runner class.
+     Return the instance of the used runner class.
+ 
+     """
      runner = getrunner(classname)(*args, **kwds)
      runner.run(task)
      return runner
  
Document utility functions in buildlet.runner
## Code Before:

_namemodmap = dict(
    SimpleRunner='simple',
    IPythonParallelRunner='ipythonparallel',
    MultiprocessingRunner='multiprocessingpool',
)


def getrunner(classname):
    import sys
    module = 'buildlet.runner.{0}'.format(_namemodmap[classname])
    __import__(module)
    return getattr(sys.modules[module], classname)


def listrunner():
    return list(_namemodmap)


def run(classname, task, *args, **kwds):
    runner = getrunner(classname)(*args, **kwds)
    runner.run(task)
    return runner

## Instruction:
Document utility functions in buildlet.runner
## Code After:

_namemodmap = dict(
    SimpleRunner='simple',
    IPythonParallelRunner='ipythonparallel',
    MultiprocessingRunner='multiprocessingpool',
)


def getrunner(classname):
    """
    Get a runner class named `classname`.
    """
    import sys
    module = 'buildlet.runner.{0}'.format(_namemodmap[classname])
    __import__(module)
    return getattr(sys.modules[module], classname)


def listrunner():
    """
    Get a list of runner class names (a list of strings).
    """
    return list(_namemodmap)


def run(classname, task, *args, **kwds):
    """
    Run `task` using runner named `classname`.

    Rest of the arguments are passed to the runner class.
    Return the instance of the used runner class.

    """
    runner = getrunner(classname)(*args, **kwds)
    runner.run(task)
    return runner
