core.prompts — IPython 0.11 documentation

### Navigation

- index
- modules |
- next |
- previous |
- home|
- search|
- documentation »
- The IPython API »

# core.prompts

## Module: `core.prompts`

Inheritance diagram for `IPython.core.prompts`:

Classes for handling input/output prompts.

Authors:

- Fernando Perez
- Brian Granger

## Classes

### `BasePrompt`

class `IPython.core.prompts.``BasePrompt`(cache, sep, prompt, pad_left=False)

  Bases: `object`

  Interactive prompt similar to Mathematica’s.

  `__init__`(cache, sep, prompt, pad_left=False)
  `cwd_filt`(depth)

    Return the last depth elements of the current working directory.

    $HOME is always replaced with ‘~’. If depth==0, the full path is returned.

  `cwd_filt2`(depth)

    Return the last depth elements of the current working directory.

    $HOME is always replaced with ‘~’. If depth==0, the full path is returned.

  `p_template`

    Template for prompt string creation

  `set_p_str`()

    Set the interpolating prompt strings.

    This must be called every time the color settings change, because the prompt_specials global may have changed.

  `write`(msg)

### `Prompt1`

class `IPython.core.prompts.``Prompt1`(cache, sep='n', prompt='In [\#]: ', pad_left=True)

  Bases: `IPython.core.prompts.BasePrompt`

  Input interactive prompt similar to Mathematica’s.

  `__init__`(cache, sep='n', prompt='In [\#]: ', pad_left=True)
  `auto_rewrite`()

    Return a string of the form ‘—>’ which lines up with the previous input string. Useful for systems which re-write the user input when handling automatically special syntaxes.

  `cwd_filt`(depth)

    Return the last depth elements of the current working directory.

    $HOME is always replaced with ‘~’. If depth==0, the full path is returned.

  `cwd_filt2`(depth)

    Return the last depth elements of the current working directory.

    $HOME is always replaced with ‘~’. If depth==0, the full path is returned.

  `p_template`

    Template for prompt string creation

  `set_colors`()
  `set_p_str`()

    Set the interpolating prompt strings.

    This must be called every time the color settings change, because the prompt_specials global may have changed.

  `write`(msg)

### `Prompt2`

class `IPython.core.prompts.``Prompt2`(cache, prompt=' .\D.: ', pad_left=True)

  Bases: `IPython.core.prompts.BasePrompt`

  Interactive continuation prompt.

  `__init__`(cache, prompt=' .\D.: ', pad_left=True)
  `cwd_filt`(depth)

    Return the last depth elements of the current working directory.

    $HOME is always replaced with ‘~’. If depth==0, the full path is returned.

  `cwd_filt2`(depth)

    Return the last depth elements of the current working directory.

    $HOME is always replaced with ‘~’. If depth==0, the full path is returned.

  `p_template`

    Template for prompt string creation

  `set_colors`()
  `set_p_str`()
  `write`(msg)

### `PromptOut`

class `IPython.core.prompts.``PromptOut`(cache, sep='', prompt='Out[\#]: ', pad_left=True)

  Bases: `IPython.core.prompts.BasePrompt`

  Output interactive prompt similar to Mathematica’s.

  `__init__`(cache, sep='', prompt='Out[\#]: ', pad_left=True)
  `cwd_filt`(depth)

    Return the last depth elements of the current working directory.

    $HOME is always replaced with ‘~’. If depth==0, the full path is returned.

  `cwd_filt2`(depth)

    Return the last depth elements of the current working directory.

    $HOME is always replaced with ‘~’. If depth==0, the full path is returned.

  `p_template`

    Template for prompt string creation

  `set_colors`()
  `set_p_str`()

    Set the interpolating prompt strings.

    This must be called every time the color settings change, because the prompt_specials global may have changed.

  `write`(msg)

## Functions

`IPython.core.prompts.``multiple_replace`(dict, text)

  Replace in ‘text’ all occurences of any key in the given dictionary by its corresponding value. Returns the new string.

`IPython.core.prompts.``str_safe`(arg)

  Convert to a string, without ever raising an exception.

  If str(arg) fails, <ERROR: ... > is returned, where ... is the exception error message.

### Navigation

- index
- modules |
- next |
- previous |
- home|
- search|
- documentation »
- The IPython API »