Changeset 3008

Show
Ignore:
Timestamp:
02/02/08 10:13:00 (10 months ago)
Author:
walter.doerwald
Message:

Use "::" to get proper literal blocks in the docstrings.

Use definition lists in a few spots in the docstrings.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • ipython/trunk/IPython/Extensions/ipipe.py

    r3000 r3008  
    77 
    88``ipipe`` supports "pipeline expressions", which is something resembling Unix 
    9 pipes. An example is: 
     9pipes. An example is:: 
    1010 
    1111    >>> ienv | isort("key.lower()") 
     
    4646* Objects that can be iterated by ``Pipe``s must iterable. For special cases, 
    4747  where iteration for display is different than the normal iteration a special 
    48   implementation can be registered with the generic function ``xiter``. This makes 
    49   it possible to use dictionaries and modules in pipeline expressions, for example: 
     48  implementation can be registered with the generic function ``xiter``. This 
     49  makes it possible to use dictionaries and modules in pipeline expressions, 
     50  for example:: 
    5051 
    5152      >>> import sys 
     
    6263  Note: The expression strings passed to ``ifilter()`` and ``isort()`` can 
    6364  refer to the object to be filtered or sorted via the variable ``_`` and to any 
    64   of the attributes of the object, i.e.: 
     65  of the attributes of the object, i.e.:: 
    6566 
    6667      >>> sys.modules | ifilter("_.value is not None") | isort("_.key.lower()") 
    6768 
    68   does the same as 
     69  does the same as:: 
    6970 
    7071      >>> sys.modules | ifilter("value is not None") | isort("key.lower()") 
    7172 
    7273  In addition to expression strings, it's possible to pass callables (taking 
    73   the object as an argument) to ``ifilter()``, ``isort()`` and ``ieval()``: 
     74  the object as an argument) to ``ifilter()``, ``isort()`` and ``ieval()``:: 
    7475 
    7576      >>> sys | ifilter(lambda _:isinstance(_.value, int)) \ 
     
    640641    the ``Display`` object will display ``item``: 
    641642 
    642     * ``"header"``: ``item`` will be displayed in a header line (this is used by 
    643       ``ibrowse``). 
    644     * ``"footer"``: ``item`` will be displayed in a footer line (this is used by 
    645       ``ibrowse``). 
    646     * ``"cell"``: ``item`` will be displayed in a table cell/list. 
    647     * ``"default"``: default mode. If an ``xrepr`` implementation recursively 
    648       outputs objects, ``"default"`` must be passed in the recursive calls to 
    649       ``xrepr``. 
     643    ``"header"`` 
     644        ``item`` will be displayed in a header line (this is used by ``ibrowse``). 
     645 
     646    ``"footer"`` 
     647        ``item`` will be displayed in a footer line (this is used by ``ibrowse``). 
     648 
     649    ``"cell"`` 
     650        ``item`` will be displayed in a table cell/list. 
     651 
     652    ``"default"`` 
     653        default mode. If an ``xrepr`` implementation recursively outputs objects, 
     654        ``"default"`` must be passed in the recursive calls to ``xrepr``. 
    650655 
    651656    If no implementation is registered for ``item``, ``xrepr`` will try the 
     
    875880    There are two possible modes: 
    876881 
    877     * ``"detail"``: The ``Display`` object wants to display a detailed list 
    878       of the object attributes. 
    879     * ``"default"``: The ``Display`` object wants to display the object in a 
    880       list view. 
     882    ``"detail"`` 
     883        The ``Display`` object wants to display a detailed list of the object 
     884        attributes. 
     885 
     886    ``"default"`` 
     887        The ``Display`` object wants to display the object in a list view. 
    881888 
    882889    If no implementation is registered for the object ``item`` ``xattrs`` falls 
     
    12011208    List the current (or a specified) directory. 
    12021209 
    1203     Examples: 
     1210    Examples:: 
    12041211 
    12051212        >>> ils 
     
    12391246    (See ``glob.glob()`` for more info.). 
    12401247 
    1241     Examples: 
     1248    Examples:: 
    12421249 
    12431250        >>> iglob("*.py") 
     
    12641271class iwalk(Table): 
    12651272    """ 
    1266     List all files and directories in a directory and it's subdirectory. 
     1273    List all files and directories in a directory and it's subdirectory:: 
    12671274 
    12681275        >>> iwalk 
     
    13691376    List all entries in the Unix user account and password database. 
    13701377 
    1371     Example: 
     1378    Example:: 
    13721379 
    13731380        >>> ipwd | isort("uid") 
     
    15531560    List environment variables. 
    15541561 
    1555     Example: 
     1562    Example:: 
    15561563 
    15571564        >>> ienv 
     
    15741581    IPython input history 
    15751582 
    1576     Example: 
     1583    Example:: 
    15771584 
    15781585        >>> ihist 
     
    15941601class icsv(Pipe): 
    15951602    """ 
    1596     This ``Pipe`` lists turn the input (with must be a pipe outputting lines 
     1603    This ``Pipe`` turns the input (with must be a pipe outputting lines 
    15971604    or an ``ifile``) into lines of CVS columns. 
    15981605    """ 
     
    16431650    (similar to ``os.popen()``). 
    16441651 
    1645     Examples: 
     1652    Examples:: 
    16461653 
    16471654        >>> ix("ps x") 
     
    16821689    (and doesn't raise an exception) are listed. 
    16831690 
    1684     Examples: 
     1691    Examples:: 
    16851692 
    16861693        >>> ils | ifilter("_.isfile() and size>1000") 
     
    16971704        of ``expr`` are handled: 
    16981705 
    1699         * ``drop``: drop all items that have errors; 
    1700  
    1701         * ``keep``: keep all items that have errors; 
    1702  
    1703         * ``keeperror``: keep the exception of all items that have errors; 
    1704  
    1705         * ``raise``: raise the exception; 
    1706  
    1707         * ``raiseifallfail``: raise the first exception if all items have errors; 
    1708           otherwise drop those with errors (this is the default). 
     1706        ``"drop"`` 
     1707            drop all items that have errors; 
     1708 
     1709        ``"keep"`` 
     1710            keep all items that have errors; 
     1711 
     1712        ``"keeperror"`` 
     1713            keep the exception of all items that have errors; 
     1714 
     1715        ``"raise"`` 
     1716            raise the exception; 
     1717 
     1718        ``"raiseifallfail"`` 
     1719            raise the first exception if all items have errors; otherwise drop 
     1720            those with errors (this is the default). 
    17091721        """ 
    17101722        self.expr = expr 
     
    17691781    Evaluate an expression for each object in the input pipe. 
    17701782 
    1771     Examples: 
     1783    Examples:: 
    17721784 
    17731785        >>> ils | ieval("_.abspath()") 
     
    18411853    with ``index`` and ``object`` attributes). 
    18421854 
    1843     Examples: 
     1855    Examples:: 
    18441856 
    18451857        >>> xrange(20) | ieval("_,_*_") | ienum | ifilter("index % 2 == 0") | ieval("object") 
     
    18551867    Sorts the input pipe. 
    18561868 
    1857     Examples: 
     1869    Examples:: 
    18581870 
    18591871        >>> ils | isort("size") 
     
    20132025    Execute a python string and capture any output to stderr/stdout. 
    20142026 
    2015     Examples: 
     2027    Examples:: 
    20162028 
    20172029        >>> import time