kernel.core.util — IPython 0.10.2 documentation

### Navigation

- index
- modules |
- next |
- previous |
- IPython 0.10.2 documentation »
- The IPython API »

# kernel.core.util

## Module: `kernel.core.util`

Inheritance diagram for `IPython.kernel.core.util`:

## Classes

### `Bunch`

class `IPython.kernel.core.util.` `Bunch`(*args, **kwds)

  Bases: `dict`

  A dictionary that exposes its keys as attributes.

  `__init__`()

### `InputList`

class `IPython.kernel.core.util.` `InputList`

  Bases: `list`

  Class to store user input.

  It’s basically a list, but slices return a string instead of a list, thus allowing things like (assuming ‘In’ is an instance):

  exec In[4:7]

  or

  exec In[5:9] + In[14] + In[21:25]

  `__init__`()

    x.__init__(...) initializes x; see x.__class__.__doc__ for signature

  `add`()

    Add a command to the list with the appropriate index.

    If the index is greater than the current length of the list, empty strings are added in between.

## Functions

`IPython.kernel.core.util.` `esc_quotes`()

  Return the input string with single and double quotes escaped out.

`IPython.kernel.core.util.` `getoutputerror`()

  Executes a command and returns the output.

  Parameters : | cmd : str The command to execute. verbose : bool If True, print the command to be executed. debug : bool Only print, do not actually execute. header : str Header to print to screen prior to the executed command. No extra newlines are added. split : bool If True, return the output as a list split on newlines.

`IPython.kernel.core.util.` `make_quoted_expr`()

  Return string s in appropriate quotes, using raw string if possible.

  XXX - example removed because it caused encoding errors in documentation generation. We need a new example that doesn’t contain invalid chars.

  Note the use of raw string and padding at the end to allow trailing backslash.

`IPython.kernel.core.util.` `system_shell`()

  Execute a command in the system shell; always return None.

  This returns None so it can be conveniently used in interactive loops without getting the return value (typically 0) printed many times.

  Parameters : | cmd : str The command to execute. verbose : bool If True, print the command to be executed. debug : bool Only print, do not actually execute. header : str Header to print to screen prior to the executed command. No extra newlines are added.

### Navigation

- index
- modules |
- next |
- previous |
- IPython 0.10.2 documentation »
- The IPython API »