;ò
ÎÑAHc           @   s*  d  Z  d k l Z d e i d e i d Z e i Z d k Z d k Z d k	 Z	 d k
 Z
 d k Z d k Z d k Z d k Z d k Z d k Z d k Z d k Z d k l Z d k l Z l Z d k l Z l Z d	 k l Z y d k Z d k Z WnI e j
 o= y d k Z d k Z WqFe j
 o e  Z Z qFXn Xd k Z d
 k l! Z! l" Z" l# Z# d k$ l% Z% d k& l' Z' l( Z( l) Z) l* Z* d k+ l, Z, d k- l. Z. d k/ l0 Z0 d k1 Td k l2 Z2 d k3 Z d k4 Z d k4 l5 Z5 d „  Z6 d f  d „  ƒ  YZ7 d „  Z8 d f  d „  ƒ  YZ9 d S(   sW   Magic functions for InteractiveShell.

$Id: Magic.py 2996 2008-01-30 06:31:39Z fperez $(   s   Releases   %s <%s>
%s <%s>s   Jankos   FernandoN(   s   StringIO(   s   getopts   GetoptError(   s   pprints   pformat(   s   Set(   s   Debuggers   OInspects   wildcard(   s
   FakeModule(   s   Itpls   itpls   printpls   itplns(   s   Parser(   s   Struct(   s   Macro(   s   *(   s	   platutils(   s
   UsageErrorc         C   s   d d g |  Sd S(   sA   Return an ON/OFF string for a 1/0 input. Simple utility function.s   OFFs   ONN(   s   tag(   s   tag(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   on_offB   s     s   Bunchc           B   s   t  Z RS(   N(   s   __name__s
   __module__(    (    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   BunchF   s    c         C   st   |  d  |  d f \ } } g  } t ƒ  } x< | D]4 } | | j o q0 n | i | ƒ | i | ƒ q0 W| | Sd  S(   Niöÿÿÿ(	   s   dhs   heads   tails   newheads   Sets   dones   hs   appends   add(   s   dhs   heads   hs   newheads   tails   done(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   compress_dhistH   s    	 s   Magicc           B   s‰  t  Z d  Z d d g Z d „  Z d „  Z d „  Z d „  Z e d „ Z	 e
 d „ Z d	 „  Z d
 „  Z d „  Z d „  Z d d „ Z d d „ Z d d „ Z d d „ Z d d „ Z d d „ Z d d „ Z d d „ Z d e
 d „ Z d e
 d „ Z d e
 d „ Z d e
 d „ Z d d „ Z e
 d „ Z d d „ Z d d „ Z d d „ Z  d d „ Z! d d  „ Z" d d! „ Z# d d" „ Z$ d d# „ Z% d d$ „ Z& d d% „ Z' d d& „ Z( d d' „ Z) d d( e
 e
 e
 d) „ Z* d e
 d* „ Z+ d d+ „ Z, d d, „ Z- d d- „ Z. d d. „ Z/ d d/ „ Z0 d0 „  Z1 d d1 „ Z2 d d d g d2 „ Z3 d d3 „ Z4 d d4 „ Z5 d d5 „ Z6 d d6 „ Z7 d d7 „ Z8 d d8 „ Z9 d d9 „ Z: d d: „ Z; d d; „ Z< d d< „ Z= d d= „ Z> d d> „ Z? d d? „ Z@ d d@ „ ZA d dA „ ZB d dB „ ZC d dC „ ZD d dD „ ZE d dE „ ZF d dF „ ZG d dG „ ZH d dH „ ZI d dI „ ZJ d dJ „ ZK dK „  ZL dL „  ZM d dM „ ZN RS(N   sŸ  Magic functions for InteractiveShell.

    Shell functions which can be reached as %function_name. All magic
    functions should accept a string, which they can parse for their own
    needs. This can make some functions easier to type, eg `%cd ../`
    vs. `%cd("../")`

    ALL definitions MUST begin with the prefix magic_. The user won't need it
    at the command line, but it is is needed in the definition. s9   Automagic is OFF, % prefix IS needed for magic functions.s9   Automagic is ON, % prefix NOT needed for magic functions.c         C   s?   h  |  _ t t j o |  i |  _ n | |  _ t ƒ  |  _ d  S(   N(	   s   selfs   options_tables   profiles   Nones   profile_missing_notices
   magic_pruns   shells   Bunchs   _magic_state(   s   selfs   shell(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   __init__j   s
    		c         O   s   t  d ƒ d  S(   NsÂ   The profile module could not be found. It has been removed from the standard
python packages because of its non-free license. To use profiling, install the
python-profiler package from non-free.(   s   error(   s   selfs   argss   kwargs(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   profile_missing_noticet   s    c         C   s6   | |  i ƒ  j o t d | ƒ n | |  i | <d S(   s<   Make an entry in the options_table for fn, with value optstrs   %s is not a magic functionN(   s   fns   selfs   lsmagics   errors   optstrs   options_table(   s   selfs   fns   optstr(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   default_optionz   s     c            s³   d „  } ‡  d †  } ‡  d †  } t | t i i ƒ  ƒ t | ˆ  i i ƒ  ƒ t | ˆ  i i i ƒ  ƒ } g  } x0 t | ƒ D]" } | i | i d d d ƒ ƒ q{ W| i ƒ  | Sd S(   s§   Return a list of currently available magic functions.

        Gives a list of the bare names after mangling (['ls','cd', ...], not
        ['magic_ls','magic_cd',...]c         C   s!   |  i d ƒ o t t i |  ƒ S(   Ns   magic_(   s   fns
   startswiths   callables   Magics   __dict__(   s   fn(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   <lambda>Š   s    c            s!   |  i d ƒ o t ˆ  i |  ƒ S(   Ns   magic_(   s   fns
   startswiths   callables   selfs   __dict__(   s   fn(   s   self(    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   <lambda>   s    c            s$   |  i d ƒ o t ˆ  i i |  ƒ S(   Ns   magic_(   s   fns
   startswiths   callables   selfs	   __class__s   __dict__(   s   fn(   s   self(    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   <lambda>   s    s   magic_s    i   N(   s   class_magics
   inst_magics   inst_bound_magics   filters   Magics   __dict__s   keyss   selfs	   __class__s   magicss   outs   Sets   fns   appends   replaces   sort(   s   selfs
   inst_magics   class_magics   inst_bound_magics   magicss   fns   out(    (   s   selfs=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   lsmagic   s     	G  
c         C   sÔ   | o |  i i } n |  i i } g  } x  | D]˜ } d | j o" t	 t
 | i d ƒ ƒ \ } } nP d | j o, t	 t
 | i d ƒ ƒ \ } } | d 7} n t
 | ƒ } | d } | i | | | !ƒ q0 W| Sd S(   sb  Return as a string a set of input history slices.

        Inputs:

          - slices: the set of slices is given as a list of strings (like
          ['1','4:8','9'], since this function is for use by magic functions
          which get their arguments as strings.

        Optional inputs:

          - raw(False): by default, the processed input is used.  If this is
          true, the raw input history is used instead.

        Note that slices can be called with two notations:

        N:M -> standard python form, means including items N...(M-1).

        N-M -> include items N..M (closed endpoint).s   :s   -i   N(   s   raws   selfs   shells   input_hist_raws   hists
   input_hists   cmdss   slicess   chunks   maps   ints   splits   inis   fins   append(   s   selfs   slicess   raws   cmdss   hists   inis   fins   chunk(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   extract_input_slices›   s       "
c         C   s?  | i ƒ  } t }
 | t j oO d |  i i f d |  i i f d t	 i
 f d |  i i f g } |  i i }
 n d } t } t } t } d } d } t }	 | i d ƒ } | d | d f \ } } x” | D]Œ \ } } y | | } Wn t j
 o
 qÈ qÈ XxV | D]* } y | }	 t | | ƒ } WqPqXqWd } | } | |
 j o
 d } n PqÈ W| oa | i |  i i ƒ o | d } n t |  d | t ƒ } | t j	 o d } d } d } qÁn | o | d	 d
 d d d g j o t | ƒ } d } d } n h  d | <d | <d | <d | <d | <d |	 <Sd S(   s±   Find an object in the available namespaces.

        self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic

        Has special code to detect magic functions.
        s   Interactives   IPython internals   Python builtins   Aliasi    s   .i   s   magic_s   ''s   ""s   []s   {}s   ()s   founds   objs	   namespaces   ismagics   isaliass   parentN(   s   onames   strips   Nones   alias_nss
   namespacess   selfs   shells   user_nss   internal_nss   __builtin__s   __dict__s   alias_tables   founds   objs   ospaces   dss   ismagics   isaliass   parents   splits   oname_partss
   oname_heads
   oname_rests   nsnames   nss   KeyErrors   parts   getattrs
   startswiths	   ESC_MAGICs   eval(   s   selfs   onames
   namespacess   isaliass   nsnames   ismagics   dss
   oname_heads   nss   parents   alias_nss   parts   founds
   oname_rests   objs   oname_partss   ospace(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   _ofindÁ   sR     ?  	
$
c         C   s   d GHt  i | ƒ GHd S(   s2   Print docstring if incorrect arguments were passeds   Error in arguments:N(   s   OInspects   getdocs   func(   s   selfs   func(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   arg_err  s     c         C   sÙ   t  i d t  i ƒ } t  i d |  i i t  i ƒ } t  i d |  i i t  i ƒ } t  i d t  i ƒ } t  i d ƒ } | i d | ƒ } | i d | ƒ } | i d | ƒ } | i d	 | ƒ } | i d
 | ƒ } | Sd S(   s$   Format a string for latex inclusion.s   (%|_|\$|#|&)s	   ^(%s.*?):s   (?P<cmd>%s.+?\b)(?!\}\}:)s   \\$s   \\ns%   \n\\bigskip\n\\texttt{\\textbf{ \1}}:s   \\texttt{\g<cmd>}s   \\\\s   \\\1s   \\textbackslash{}nN(   s   res   compiles	   MULTILINEs	   escape_res   selfs   shells	   ESC_MAGICs   cmd_name_res   cmd_res   par_res
   newline_res   subs   strng(   s   selfs   strngs
   newline_res   par_res	   escape_res   cmd_name_res   cmd_re(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   format_latex  s     		c         C   s/   t  i d t  i ƒ } | i d | ƒ } | Sd S(   sX   Format a string for screen printing.

        This removes some latex-type format codes.s   \\$s    N(   s   res   compiles	   MULTILINEs   par_res   subs   strng(   s   selfs   strngs   par_re(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   format_screen+  s     c         O   s  t  i d ƒ i i i d d ƒ } d |  i i | d ƒ | f } | i d d ƒ } | d d g j o t d | ‚ n | i d	 d
 ƒ } | i d t ƒ } h  } | i ƒ  } t | ƒ d j ot | | ƒ } y t | | | Œ \ } } Wn: t j
 o. }
 t d |
 i | d i | ƒ f ƒ ‚ n Xx³ | D]§ \ } }	 | i! d ƒ o | d } n | d } y | | i" |	 ƒ Wq.t# j
 o | | |	 g | | <q.t$ j
 o) | o |	 g | | <qÕ|	 | | <q.Xq.Wn t% | ƒ } | d j o d i | ƒ } n | | f Sd S(   sa  Parse options passed to an argument string.

        The interface is similar to that of getopt(), but it returns back a
        Struct with the options as keys and the stripped argument string still
        as a string.

        arg_str is quoted as a true sys.argv vector by using shlex.split.
        This allows us to easily expand variables, glob files, quote
        arguments, etc.

        Options:
          -mode: default 'string'. If given as 'list', the argument string is
          returned as a list (split on whitespace) instead of a string.

          -list_all: put all option values in lists. Normally only options
          appearing more than once are put in a list.

          -posix (True): whether to split the input line in POSIX mode or not,
          as per the conventions outlined in the shlex module from the
          standard library.i   s   magic_s    s   %s %ss   modes   strings   lists   incorrect mode given: %ss   list_alli    s   posixs   %s ( allowed: "%s" %s)s    s   --i   N(&   s   syss	   _getframes   f_codes   co_names   replaces   callers   selfs   options_tables   gets   arg_strs   kws   modes
   ValueErrors   list_alls   Trues   posixs   odicts   splits   argss   lens	   arg_splits   argvs   getopts   opt_strs	   long_optss   optss   GetoptErrors   es
   UsageErrors   msgs   joins   os   as
   startswiths   appends   AttributeErrors   KeyErrors   Struct(   s   selfs   arg_strs   opt_strs	   long_optss   kws   list_alls   argss   odicts   argvs   as   es   callers   os   modes   posixs   opts(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   parse_options4  sB     !* 
s    c         C   sM   |  i i } d | d | i |  i ƒ  ƒ GHd t i |  i i i	 GHt
 Sd S(   s)   List currently available magic functions.s   Available magic functions:
s     s   
N(   s   selfs   shells	   ESC_MAGICs   mescs   joins   lsmagics   Magics   auto_statuss   rcs	   automagics   None(   s   selfs   parameter_ss   mesc(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_lsmagic|  s
      c         C   si  d } ym | i ƒ  d d j o
 d } n | i ƒ  d d j o
 d } n | i ƒ  d d j o d } g  }
 n Wn n Xg  } x|  i ƒ  D]ó } d	 | } xB t	 |  |  i
 f D]. } y | i | } Wn t j
 o q³ XPq³ W| d j o1 | i o | i i d
 d ƒ d }	 q2d }	 n | i i ƒ  }	 | d j o$ |
 i d |  i i | |	 f ƒ q | i d |  i i | |	 f ƒ q Wd i | ƒ } | d j o d i |
 ƒ Sn | d j o |  i | ƒ GHd Sn |  i | ƒ } | d j o | Sn d } |  i i } d | | | | d | i |  i ƒ  ƒ t	 i |  i i i f } t | d |  i i i ƒd S(   s}   Print information about the magic function system.
        
        Supported formats: -latex, -brief, -rest        
        s    i    s   -latexs   latexs   -briefs   briefs   -rests   rests   magic_s   
i   s   No documentations   **%s%s**::

	%s

s
   %s%s:
	%s
Ns„  
IPython's 'magic' functions
===========================

The magic function system provides a series of functions which allow you to
control the behavior of IPython itself, plus a lot of system-type
features. All these functions are prefixed with a % character, but parameters
are given without parentheses or quotes.

NOTE: If you have 'automagic' enabled (via the command line option or with the
%automagic function), you don't need to type in the % explicitly.  By default,
IPython ships with automagic on, so you should only rarely need the % escape.

Example: typing '%cd mydir' (without the quotes) changes you working directory
to 'mydir', if it exists.

You can define your own magic functions to extend the system. See the supplied
ipythonrc and example-magic.py files for details (in your ipython
configuration directory, typically $HOME/.ipython/).

You can also define your own aliased names for magic functions. In your
ipythonrc file, placing a line like:

  execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile

will define %pf as a new name for %profile.

You can also call magics in code using the ipmagic() function, which IPython
automatically adds to the builtin namespace.  Type 'ipmagic?' for details.

For a list of the available magic functions, use %lsmagic. For a description
of any of them, type %magic_name?, e.g. '%cd?'.

Currently the magic system has the following functions:
s=   %s
%s

Summary of magic functions (from %slsmagic):

%s%s

%ss     s   screen_lines(   s   modes   parameter_ss   splits	   rest_docss
   magic_docss   selfs   lsmagics   fnames   mnames   Magics	   __class__s   spaces   __dict__s   fns   KeyErrors   __doc__s   fndocs   rstrips   appends   shells	   ESC_MAGICs   joins   format_latexs   format_screens   outmsgs   mescs   auto_statuss   rcs	   automagics   pages   screen_length(   s   selfs   parameter_ss
   magic_docss   spaces   mnames   mescs   modes   fnames   outmsgs   fndocs	   rest_docss   fn(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_magic„  sX     

 
 

$$#?c         C   s*   |  i i ƒ  d Gd d g |  i i GHd S(   s(   Toggle autoindent on/off (if available).s   Automatic indentation is:s   OFFs   ONN(   s   selfs   shells   set_autoindents
   autoindent(   s   selfs   parameter_s(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_autoindentë  s     c         C   s‚   |  i i } | i ƒ  } | d d d f j o t | _ n1 | d d d f j o t | _ n | i | _ d t	 i
 | i GHd S(	   s®  Make magic functions callable without having to type the initial %.

        Without argumentsl toggles on/off (when off, you must call it as
        %automagic, of course).  With arguments it sets the value, and you can
        use any of (case insensitive):

         - on,1,True: to activate

         - off,0,False: to deactivate.

        Note that magic functions have lowest priority, so if there's a
        variable whose name collides with that of a magic fn, automagic won't
        work for that function (you get the variable instead). However, if you
        delete the variable (del var), the previously shadowed magic function
        becomes visible to automagic again.s   ons   1s   trues   offs   0s   falses   
N(   s   selfs   shells   rcs   parameter_ss   lowers   args   Trues	   automagics   Falses   Magics   auto_status(   s   selfs   parameter_ss   rcs   arg(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_automagicò  s     c         C   s÷   |  i i } | o t | ƒ } n d } | d d d d f j o t d ƒ d Sn | d d d f j o | | _ nc | i o | i |  i _	 d | _ n= y |  i i	 | _ Wn& t
 j
 o d | _ |  i _	 n Xd Gd d	 d
 g | i GHd S(   s  Make functions callable without having to type parentheses.

        Usage:

           %autocall [mode]

        The mode can be one of: 0->Off, 1->Smart, 2->Full.  If not given, the
        value is toggled on and off (remembering the previous state).

        In more detail, these values mean:

        0 -> fully disabled

        1 -> active, but do not apply if there are no arguments on the line.

        In this mode, you get:

        In [1]: callable
        Out[1]: <built-in function callable>

        In [2]: callable 'hello'
        ------> callable('hello')
        Out[2]: False

        2 -> Active always.  Even if no arguments are present, the callable
        object is called:

        In [4]: callable
        ------> callable()

        Note that even with autocall off, you can still use '/' at the start of
        a line to treat the first argument on the command line as a function
        and add parentheses to it:

        In [8]: /str 43
        ------> str(43)
        Out[8]: '43'
        s   togglei    i   i   s'   Valid modes: (0->Off, 1->Smart, 2->FullNs   Automatic calling is:s   OFFs   Smarts   Full(   s   selfs   shells   rcs   parameter_ss   ints   args   errors   autocalls   _magic_states   autocall_saves   AttributeError(   s   selfs   parameter_ss   rcs   arg(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_autocall  s$    & 

c         C   sV   | o t t | ƒ ƒ } n t } |  i i d | ƒ d Gd d g |  i i i	 GHd S(   s]   Set verbose printing of system calls.

        If called without an argument, act as a toggles   system_verboses   System verbose printing is:s   OFFs   ONN(
   s   parameter_ss   bools   evals   vals   Nones   selfs   shells   rc_set_toggles   rcs   system_verbose(   s   selfs   parameter_ss   val(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_system_verboseO  s     c         C   s‹   |  i | d ƒ \ } } d | j } | o | p d } |  i | ƒ } | d o, | o t	 p t
 | d ƒ } t | ƒ n
 d | GHd S(   sæ   Pretty print the object and display it through a pager.
        
        %page [options] OBJECT

        If no object is given, use _ (last output).
        
        Options:

          -r: page str(object), don't pretty-print it.s   rs   _s   founds   objs   Object `%s` not foundN(   s   selfs   parse_optionss   parameter_ss   optss   argss   raws   onames   _ofinds   infos   strs   pformats   txts   page(   s   selfs   parameter_ss   infos   argss   raws   txts   optss   oname(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys
   magic_page^  s    	 c         C   s'   |  i i i o t d ƒ n d GHd S(   s,   Print your currently active IPyhton profile.s0   Current IPython profile: $self.shell.rc.profile.s   No profile active.N(   s   selfs   shells   rcs   profiles   printpl(   s   selfs   parameter_s(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_profilew  s     c         C   s‡   d } t i d | ƒ i ƒ  \ } } } } | p | p | o
 d } n d | j o |  i
 | ƒ n |  i d | d | d | ƒd S(	   st   Provide detailed information about an object.
    
        '%pinfo object' is just a synonym for object? or ?object.i    s   (pinfo )?(\?*)(.*?)(\??$)i   s   *s   pinfos   detail_levels
   namespacesN(   s   detail_levels   res   matchs   parameter_ss   groupss   pinfos   qmark1s   onames   qmark2s   selfs   magic_psearchs   _inspects
   namespaces(   s   selfs   parameter_ss
   namespacess   detail_levels   qmark1s   pinfos   qmark2s   oname(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_pinfo~  s     $
c         C   s   |  i d | | ƒ d S(   sz   Print the definition header for any callable object.

        If the object is a class, print the constructor information.s   pdefN(   s   selfs   _inspects   parameter_ss
   namespaces(   s   selfs   parameter_ss
   namespaces(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys
   magic_pdef”  s     c         C   s   |  i d | | ƒ d S(   s   Print the docstring for an object.

        If the given object is a class, it will print both the class and the
        constructor docstrings.s   pdocN(   s   selfs   _inspects   parameter_ss
   namespaces(   s   selfs   parameter_ss
   namespaces(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys
   magic_pdocš  s     c         C   s   |  i d | | ƒ d S(   s;   Print (or run through pager) the source code for an object.s   psourceN(   s   selfs   _inspects   parameter_ss
   namespaces(   s   selfs   parameter_ss
   namespaces(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_psource¡  s     c         C   s}   |  i d | ƒ } | d j oZ y t | ƒ } Wn t j
 o } | GHd Sn Xt |  i	 i
 i t | ƒ i ƒ  ƒ ƒ n d S(   s  Print (or run through pager) the file where an object is defined.

        The file opens at the line where the object definition begins. IPython
        will honor the environment variable PAGER if set, and otherwise will
        do its best to print the file in a convenient form.

        If the given argument is not an object currently defined, IPython will
        try to interpret it as a filename (automatically adding a .py extension
        if needed). You can thus use %pfile as a syntax highlighting code
        viewer.s   pfiles	   not foundN(   s   selfs   _inspects   parameter_ss   outs   get_py_filenames   filenames   IOErrors   msgs   pages   shells	   inspectors   formats   files   read(   s   selfs   parameter_ss   filenames   msgs   out(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_pfile¥  s    
 	c         K   sý  y | i ƒ  i d ƒ } Wn t j
 o d GHd Sn Xt |  i | | ƒ ƒ } | i	 o’y t
 i i | i ƒ d SWn t
 i i j
 o n X| i d ƒ }	 d i |	 d  ƒ }
 | i t j	 o˜ y~ t | i d ƒ } yR t | |	 d ƒ } t | t ƒ o+ |
 d |	 d } t |  i | ƒ ƒ } n Wn t j
 o n XWq[t j
 o q[Xn t |  i i | ƒ } | i o |  i  p t } | d	 j o | | i | | ƒ qù| d
 j o | | i | | | |  qù| | i | ƒ n d | GHd Sd S(   sp   Generic interface to the inspector system.

        This function is meant to be called by pdef, pdoc & friends.s   asciis5   Python identifiers can only contain ascii characters.s	   not foundNs   .iÿÿÿÿs	   __class__s   .__class__.s   pdocs   pinfos   Object `%s` not found.(#   s   onames   strips   encodes   UnicodeEncodeErrors   Structs   selfs   _ofinds
   namespacess   infos   founds   IPythons   genericss   inspect_objects   objs   ipapis   TryNexts   splits   paths   joins   roots   parents   Nones   getattrs   targets
   isinstances   propertys   AttributeErrors   shells	   inspectors   meths   pmethods   ismagics   format_screens	   formatters   kw(   s   selfs   meths   onames
   namespacess   kws   infos	   formatters   pmethods   targets   paths   root(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   _inspect¼  sH     	
 	 		c         C   s]  y | i d ƒ } Wn t j
 o d GHd Sn Xd d g }
 |  i | d d t ƒ\ } } | i	 } |  i } | i i }	 | i d ƒ o
 t } n( | i d	 ƒ o
 t } n | i i } |
 i | d
 g  ƒ ƒ | d g  ƒ } } g  i } |
 D]! } | | j o | | ƒ qò qò ~ } y) |	 | | i | d | d ƒ d | ƒWn | i ƒ  n Xd S(   s  Search for object in namespaces by wildcard.

        %psearch [options] PATTERN [OBJECT TYPE]

        Note: ? can be used as a synonym for %psearch, at the beginning or at
        the end: both a*? and ?a* are equivalent to '%psearch a*'.  Still, the
        rest of the command line must be unchanged (options come first), so
        for example the following forms are equivalent

        %psearch -i a* function
        -i a* function?
        ?-i a* function

        Arguments:
        
          PATTERN

          where PATTERN is a string containing * as a wildcard similar to its
          use in a shell.  The pattern is matched in all namespaces on the
          search path. By default objects starting with a single _ are not
          matched, many IPython generated objects have a single
          underscore. The default is case insensitive matching. Matching is
          also done on the attributes of objects and not only on the objects
          in a module.

          [OBJECT TYPE]

          Is the name of a python type from the types module. The name is
          given in lowercase without the ending type, ex. StringType is
          written string. By adding a type here only objects matching the
          given type are matched. Using all here makes the pattern match all
          types (this is the default).

        Options:

          -a: makes the pattern match even objects whose names start with a
          single underscore.  These names are normally ommitted from the
          search.

          -i/-c: make the pattern case insensitive/sensitive.  If neither of
          these options is given, the default is read from your ipythonrc
          file.  The option name which sets this value is
          'wildcards_case_sensitive'.  If this option is not specified in your
          ipythonrc file, IPython's internal default is to do a case sensitive
          search.

          -e/-s NAMESPACE: exclude/search a given namespace.  The pattern you
          specifiy can be searched in any of the following namespaces:
          'builtin', 'user', 'user_global','internal', 'alias', where
          'builtin' and 'user' are the search defaults.  Note that you should
          not use quotes when specifying namespaces.

          'Builtin' contains the python module builtin, 'user' contains all
          user data, 'alias' only contain the shell aliases and no python
          objects, 'internal' contains objects used by IPython.  The
          'user_global' namespace is only used by embedded IPython instances,
          and it contains module-level globals.  You can add namespaces to the
          search with -s or exclude them with -e (these options can be given
          more than once).
    
        Examples:
       
        %psearch a*            -> objects beginning with an a
        %psearch -e builtin a* -> objects NOT in the builtin space starting in a
        %psearch a* function   -> all functions beginning with an a
        %psearch re.e*         -> objects beginning with an e in module re
        %psearch r*.e*         -> objects that start with e in modules starting in r
        %psearch r*.* string   -> all strings in modules beginning with r

        Case sensitve search:
       
        %psearch -c a*         list all object beginning with lower case a

        Show objects beginning with a single _:
       
        %psearch -a _*         list objects beginning with a single underscores   asciis5   Python identifiers can only contain ascii characters.Ns   users   builtins   cias:e:s   list_alls   is   cs   ss   es   show_alls   as   ignore_case(   s   parameter_ss   encodes   UnicodeEncodeErrors
   def_searchs   selfs   parse_optionss   Trues   optss   argss   gets   opts   shells	   inspectors   psearchs   has_keys   ignore_cases   Falses   rcs   wildcards_case_sensitives   extends
   ns_excludes   appends   _[1]s   nms	   ns_searchs   ns_tables   showtraceback(   s   selfs   parameter_ss   opts   ignore_cases   shells   nms   argss   _[1]s
   ns_excludes   psearchs
   def_searchs	   ns_searchs   opts(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_psearchî  s0    L 			

8c         C   sÜ   |  i i } |  i i } |  i i } g  } | i ƒ  } x‘ | D]‰ } | i
 d ƒ p | i
 d ƒ o | | j p
 | | j oG | o/ t | | ƒ i | j o | i | ƒ qÂ qÆ | i | ƒ q= q= W| i ƒ  | Sd S(   sš   Return a sorted list of all interactive variables.

        If arguments are given, only variables of types matching these
        arguments are returned.s   _s   _iN(   s   selfs   shells   user_nss   internal_nss   user_config_nss   outs   parameter_ss   splits   typelists   is
   startswiths   types   __name__s   appends   sort(   s   selfs   parameter_ss   typelists   is   internal_nss   user_config_nss   user_nss   out(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_who_ls^  s      <
c         C   sz   |  i | ƒ } | o | o	 d GHn d GHd Sn d } x8 | D]0 } | d G| d 7} | d j o d } HqA qA WHd S(   sL  Print all interactive variables, with some minimal formatting.

        If any arguments are given, only variables whose type matches one of
        these are printed.  For example:

          %who function str

        will only list functions and strings, excluding all other types of
        variables.  To find the proper type names, simply use type(var) at a
        command line to see how python prints type names.  For example:

          In [1]: type('hello')\
          Out[1]: <type 'str'>

        indicates that the type name for strings is 'str'.

        %who always excludes executed names loaded through your configuration
        file and things which are internal to IPython.

        This is deliberate, as typically you may load many modules and the
        purpose of %who is to show you only what you've manually defined.s'   No variables match your requested type.s   Interactive namespace is empty.Ni    s   	i   i   (   s   selfs   magic_who_lss   parameter_ss   varlists   counts   i(   s   selfs   parameter_ss   varlists   is   count(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys	   magic_whou  s      	 
	c   "         sö  ˆ  i | ƒ } | o | o	 d GHn d GHd Sn t i t i t i g } y d k	 } Wn t
 j
 o t } n X| i i } y d k } Wn t
 j
 o t } n X| i i } ‡  d †  } h  d d <‰ ‡ d †  }
 t | | ƒ } g  } xc | D][ } |
 | ƒ }! |! d j o/ | i ˆ i t | i ƒ t | i ƒ ƒ ƒ qù | i |! ƒ qù Wd	 } d
 } d } d } d } d } d } t% t% t t& | ƒ ƒ t& | ƒ ƒ | } t% t% t t& | ƒ ƒ t& | ƒ ƒ | } | i) | ƒ | i) | ƒ d | d d | | t& | ƒ d GHd } d } xÐt, | | | ƒ D]¼\ } } } t0 | ƒ G| | j o t& | ƒ GHq2| | | g j oø t | i1 ƒ i2 d d ƒ i2 d d ƒ d d !} | | j o# | i4 }  |  | i6 } | i8 } n, | i4 | ƒ }  |  | i6 ƒ  } | i: ƒ  } | d j  o | | |  | | f GHqî| | |  | | f G| | j  o d | | f GHqîd | | f GHq2y t | ƒ } Wn1 t< j
 o% t= | ƒ i> t? i@ ƒ  d ƒ } n X| i2 d d ƒ } t& | ƒ d j  o	 | GHq2tA | ƒ q2Wd S(    sØ  Like %who, but gives some extra information about each variable.

        The same type filtering of %who can be applied here.

        For all variables, the type is printed. Additionally it prints:
        
          - For {},[],(): their length.

          - For numpy and Numeric arrays, a summary with shape, number of
          elements, typecode and size in memory.

          - Everything else: a string representation, snipping their middle if
          too long.s'   No variables match your requested type.s   Interactive namespace is empty.Nc            s   ˆ  i i |  Sd  S(   N(   s   selfs   shells   user_nss   i(   s   i(   s   self(    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   get_varsÉ  s    s   IPython.macro.Macros   Macroc            s#   t  |  ƒ i } ˆ  i | | ƒ Sd  S(   N(   s   types   vs   __name__s   tns   abbrevss   get(   s   vs   tn(   s   abbrevs(    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys	   type_nameÎ  s    s   instances   Variables   Types	   Data/Infoi   s-   $vname.ljust(varwidth)$vtype.ljust(typewidth)s   $vstr[:25]<...>$vstr[-25:]s!   %s: %s elems, type `%s`, %s bytess    s   
s   -i   i   i   s   ,s    s   xiÿÿÿÿi † s   (%s kb)s   (%s Mb)s   backslashreplaces   \ni2   (B   s   selfs   magic_who_lss   parameter_ss   varnamess   typess   DictTypes   ListTypes	   TupleTypes	   seq_typess   numpys   ImportErrors   Nones   ndarray_types   ndarrays   __name__s   Numerics
   array_types	   ArrayTypes   get_varss   abbrevss	   type_names   maps   varlists   typelists   vvs   tts   appends   gets   strs	   __class__s   varlabels	   typelabels	   datalabels   colseps   vformats
   vfmt_shorts   aformats   maxs   lens   varwidths	   typewidths   ljusts   kbs   Mbs   zips   vnames   vars   vtypes   itpls   shapes   replaces   vshapes   sizes   vsizes   itemsizes   vbytess   dtypes   vdtypes   typecodes   vstrs   UnicodeEncodeErrors   unicodes   encodes   syss   getdefaultencodings   printpl("   s   selfs   parameter_ss	   seq_typess   vshapes   varwidths   varlabels   vformats   vvs   vtypes   abbrevss	   type_names   varnamess	   typewidths   vars	   typelabels   numpys   vdtypes   vnames   Mbs   colseps   ndarray_types
   vfmt_shorts   vstrs
   array_types	   datalabels   vbytess   kbs   aformats   typelists   Numerics   varlists   get_varss   vsizes   tt(    (   s   selfs   abbrevss=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys
   magic_whosž  sŽ     	 ((A 
.		c         C   sb   |  i i d ƒ } | o d GHd Sn |  i i } x |  i ƒ  D] } | | =q@ Wg  |  i i (d S(   s„   Resets the namespace by removing all names defined by the user.

        Input/Output history are left around in case you need them.s>   Once deleted, variables cannot be recovered. Proceed (y/[n])? s   Nothing done.N(   s   selfs   shells
   ask_yes_nos   anss   user_nss   magic_who_lss   is   _user_main_modules(   s   selfs   parameter_ss   is   user_nss   ans(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_reset  s      c         C   s6  |  i | d ƒ \ } } d | j } d | j }
 d | j } |  i i	 } |  i i
 } | o0 y | i ƒ  \ } } Wq | } d } q Xn | i } | i } | i i d d ƒ } | o t i i | ƒ } n | | i _ |  i i | i | i f } y" | i | | | | | |
 ƒ }	 Wn+ | | i _ t d t i ƒ  d	 ƒ nì X| o t | _ n |
 o |  i i } n |  i i } | oy | i } |  i i  } xr t! d	 t" | ƒ d	 ƒ D]B } | | | i$ ƒ  ƒ | | j o | t% | | ƒ d
 ƒ q´q´Wn | i | d	 ƒ | o t& | _ n d GH| i' ƒ  d S(   s  Start logging anywhere in a session.

        %logstart [-o|-r|-t] [log_name [log_mode]]

        If no name is given, it defaults to a file named 'ipython_log.py' in your
        current directory, in 'rotate' mode (see below).

        '%logstart name' saves to file 'name' in 'backup' mode.  It saves your
        history up to that point and then continues logging.

        %logstart takes a second optional parameter: logging mode. This can be one
        of (note that the modes are given unquoted):\
          append: well, that says it.\
          backup: rename (if exists) to name~ and start name.\
          global: single logfile in your home dir, appended to.\
          over  : overwrite existing log.\
          rotate: create rotating logs name.1~, name.2~, etc.

        Options:

          -o: log also IPython's output.  In this mode, all commands which
          generate an Out[NN] prompt are recorded to the logfile, right after
          their corresponding input line.  The output lines are always
          prepended with a '#[Out]# ' marker, so that the log remains valid
          Python code.

          Since this marker is always the same, filtering only the output from
          a log is very easy, using for example a simple awk call:

            awk -F'#\[Out\]# ' '{if($2) {print $2}}' ipython_log.py

          -r: log 'raw' input.  Normally, IPython's logs contain the processed
          input, so that user lines are logged in their final form, converted
          into valid Python.  For example, %Exit is logged as
          '_ip.magic("Exit").  If the -r flag is given, all input is logged
          exactly as typed, with no transformations applied.

          -t: put timestamps before each input line logged (these are put in
          comments).s   orts   os   rs   ts   backups   logfiles    s   Couldn't start log: %si   s   outputsG   Activating auto-logging. Current session state plus future input saved.N((   s   selfs   parse_optionss   parameter_ss   optss   pars
   log_outputs   log_raw_inputs	   timestamps   shells   rcs   loggers   splits   logfnames   logmodes   gets   old_logfiles   oss   paths
   expandusers   logfiles   loghead_tpls   argss   logheads   logstarts   starteds   warns   syss   exc_infos   Falses   input_hist_raws
   input_hists	   log_writes   output_hists   ranges   lens   ns   rstrips   reprs   Trues   logstate(   s   selfs   parameter_ss   logheads   pars	   timestamps	   log_writes   rcs   logmodes   loggers   starteds   log_raw_inputs   old_logfiles   output_hists   logfnames   ns
   input_hists
   log_outputs   opts(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_logstart'  sX    ' 			 #c         C   s   |  i i ƒ  d S(   sÖ   Fully stop logging and close log file.

        In order to start logging again, a new %logstart call needs to be made,
        possibly (though not necessarily) with a new filename, mode and other
        options.N(   s   selfs   loggers   logstop(   s   selfs   parameter_s(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_logstop  s     c         C   s   |  i i i d ƒ d S(   sL   Temporarily stop logging.

        You must have previously started logging.i    N(   s   selfs   shells   loggers
   switch_log(   s   selfs   parameter_s(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_logoff˜  s     c         C   s   |  i i i d ƒ d S(   s  Restart logging.

        This function is for restarting logging which you've temporarily
        stopped with %logoff. For starting logging for the first time, you
        must use the %logstart function, which allows you to specify an
        optional log filename.i   N(   s   selfs   shells   loggers
   switch_log(   s   selfs   parameter_s(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_logonž  s     c         C   s   |  i i i ƒ  d S(   s'   Print the status of the logging system.N(   s   selfs   shells   loggers   logstate(   s   selfs   parameter_s(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_logstate¨  s     c         C   sš   | i ƒ  i ƒ  } | oU y2 h  d d <d d <d d <d d <| } Wq{ t j
 o d GHd Sq{ Xn |  i i } | |  i _ d	 Gt	 | ƒ GHd S(
   s£  Control the automatic calling of the pdb interactive debugger.

        Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
        argument it works as a toggle.

        When an exception is triggered, IPython can optionally call the
        interactive pdb debugger after the traceback printout. %pdb toggles
        this feature on and off.

        The initial state of this feature is set in your ipythonrc
        configuration file (the variable is called 'pdb').

        If you want to just activate the debugger AFTER an exception has fired,
        without having to type '%pdb on' and rerunning your code, you can use
        the %debug magic.s   offi    s   0s   oni   s   1s=   Incorrect argument. Use on/1, off/0, or nothing for a toggle.Ns%   Automatic pdb calling has been turned(
   s   parameter_ss   strips   lowers   pars   new_pdbs   KeyErrors   selfs   shells   call_pdbs   on_off(   s   selfs   parameter_ss   pars   new_pdb(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys	   magic_pdb­  s     2c         C   s   |  i i d t ƒ d S(   s  Activate the interactive debugger in post-mortem mode.

        If an exception has just occurred, this lets you inspect its stack
        frames interactively.  Note that this will always work only on the last
        traceback that occurred, so you must call this quickly after an
        exception that you wish to inspect has fired, because if another one
        occurs, it clobbers the previous one.

        If you want IPython to automatically do this on every exception, see
        the %pdb magic for more details.
        s   forceN(   s   selfs   shells   debuggers   True(   s   selfs   parameter_s(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_debugÏ  s     i   c      	   C   s  t  d d g d g  d d g d d g ƒ } | i d d ƒ i d	 d
 ƒ } | o. |  i | d d d ƒ\ } } |  i	 i
 } nJ y t | d ƒ } Wn# t j
 o } t | ƒ d Sn Xd } t ƒ  } | i | ƒ t i ƒ  } y | i | | | ƒ } d } Wn t j
 o d } n Xt i | ƒ i ƒ  i | i Œ  } | i  } | o… g  } x| | i  D]m }
 y | i# t$ |
 ƒ ƒ Wq[t% j
 oA y | i# t& |
 ƒ ƒ WqÈt% j
 o | i# |
 ƒ qÈXq[Xq[Wn t' ƒ  } t) | d ƒ o | | _* | i+ | Œ  n1 t, i- } z | t, _- | i+ | Œ  Wd | t, _- X| i/ ƒ  }	 |	 i1 ƒ  }	 t2 |	 d |  i	 i3 i4 ƒ| G| i5 d } | i7 d } | o# | i9 | ƒ d G| d G| GHn | o< t: | d ƒ } | i< |	 ƒ | i= ƒ  d G| d G| GHn | i> d ƒ o | Sn t? Sd S(   sh  Run a statement through the python code profiler.

        Usage:\
          %prun [options] statement

        The given statement (which doesn't require quote marks) is run via the
        python profiler in a manner similar to the profile.run() function.
        Namespaces are internally managed to work correctly; profile.run
        cannot be used in IPython because it makes certain assumptions about
        namespaces which do not hold under IPython.

        Options:

        -l <limit>: you can place restrictions on what or how much of the
        profile gets printed. The limit value can be:

          * A string: only information for function names containing this string
          is printed.

          * An integer: only these many lines are printed.

          * A float (between 0 and 1): this fraction of the report is printed
          (for example, use a limit of 0.4 to see the topmost 40% only).

        You can combine several limits with repeated use of the option. For
        example, '-l __init__ -l 5' will print only the topmost 5 lines of
        information about class constructors.

        -r: return the pstats.Stats object generated by the profiling. This
        object has all the information about the profile in it, and you can
        later use it for further analysis or in other functions.

       -s <key>: sort profile by given key. You can provide more than one key
        by using the option several times: '-s key1 -s key2 -s key3...'. The
        default sorting key is 'time'.

        The following is copied verbatim from the profile documentation
        referenced below:

        When more than one key is provided, additional keys are used as
        secondary criteria when the there is equality in all keys selected
        before them.
        
        Abbreviations can be used for any key names, as long as the
        abbreviation is unambiguous.  The following are the keys currently
        defined:

                Valid Arg       Meaning\
                  "calls"      call count\
                  "cumulative" cumulative time\
                  "file"       file name\
                  "module"     file name\
                  "pcalls"     primitive call count\
                  "line"       line number\
                  "name"       function name\
                  "nfl"        name/file/line\
                  "stdname"    standard name\
                  "time"       internal time

        Note that all sorts on statistics are in descending order (placing
        most time consuming items first), where as name, file, and line number
        searches are in ascending order (i.e., alphabetical). The subtle
        distinction between "nfl" and "stdname" is that the standard name is a
        sort of the name as printed, which means that the embedded line
        numbers get compared in an odd way.  For example, lines 3, 20, and 40
        would (if the file names were the same) appear in the string order
        "20" "3" and "40".  In contrast, "nfl" does a numeric compare of the
        line numbers.  In fact, sort_stats("nfl") is the same as
        sort_stats("name", "file", "line").

        -T <filename>: save profile results as shown on screen to a text
        file. The profile is still shown on screen.

        -D <filename>: save (via dump_stats) profile statistics to given
        filename. This data is in a format understod by the pstats module, and
        is generated by a call to the dump_stats() method of profile
        objects. The profile is still shown on screen.

        If you want to run complete programs under the profiler's control, use
        '%run -p [prof_opts] filename.py [args to program]' where prof_opts
        contains profiler specific options as described here.
        
        You can read the complete documentation for the profile module with:\
          In [1]: import profile; profile.help() s   Ds    s   ls   ss   times   Ts   "s   \"s   's   \'s	   D:l:rs:T:s   list_alli   i    Ns   execfile(filename,prog_ns)s7   *** SystemExit exception caught in code being profiled.s   streams   screen_liness%   
*** Profile stats marshalled to files   .s   ws(   
*** Profile printout saved to text files   r(@   s   Structs   opts_defs   parameter_ss   replaces	   user_modes   selfs   parse_optionss   optss   arg_strs   shells   user_nss	   namespaces   get_py_filenames   arg_lsts   filenames   IOErrors   msgs   errors   localss   merges   profiles   Profiles   profs   runctxs   sys_exits
   SystemExits   pstatss   Statss
   strip_dirss
   sort_statss   ss   statss   ls   limss   lims   appends   ints
   ValueErrors   floats   StringIOs   stdout_traps   hasattrs   streams   print_statss   syss   stdouts
   sys_stdouts   getvalues   outputs   rstrips   pages   rcs   screen_lengths   Ds	   dump_files   Ts	   text_files
   dump_statss   files   pfiles   writes   closes   has_keys   None(   s   selfs   parameter_ss	   user_modes   optss   arg_lsts   prog_nss   limss   statss   sys_exits   outputs   lims   pfiles	   namespaces
   sys_stdouts   filenames	   dump_files   msgs   profs   stdout_traps	   text_files   arg_strs   opts_def(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys
   magic_prunÞ  sz    V *
		
!	
 				 

c         C   sË  |  i | d d d d d ƒ\ } } y t | d ƒ } WnX t j
 o* t d ƒ d Gt	 i
 |  i ƒ GHd	 Sn$ t j
 o }	 t |	 ƒ d	 Sn X| i ƒ  i d
 ƒ o$ |  i i t | ƒ i ƒ  ƒ d	 Sn | i d ƒ } t i } | g | d t _ | i d ƒ o6 |  i i } |  i i d } d | d <t | ƒ } nl | i d ƒ o& t  i! i" t  i! i# | ƒ ƒ d } n d } t ƒ  } | i% } | | d <|  i i& i' | ƒ | | d <| d d j o t i( d } n t* } | t i( | d <t+ } zž|  i i- ƒ  | i d ƒ o |  i. d d | | | ƒ } n_| i d ƒ oVt/ i0 |  i i1 i2 ƒ } d t4 i5 _6 h  t4 i5 _7 t+ g t4 i5 _8 d } t: | i; d d g ƒ d ƒ } | i= | | ƒ } | oZ xW t> | d | | d ƒ D] } | i= | | ƒ o PqÜqÜWd | }	 t |	 ƒ d	 Sn | i? d | | f ƒ d Gd | i@ GHy | iA d | | ƒ WqRt iB ƒ  \ } } } |  i iF | | | d d ƒqRXn»| t+ j o |  i iH } n | i d ƒ owy7 t: | d d ƒ } | d j  o t d ƒ d	 Sn Wn tJ j
 o d } n X| d j og tK ƒ  } | | | | d  | ƒtK ƒ  } | d | d } | d | d } d! GHd" | GHd# | GHqRt> | ƒ } tK ƒ  } x$ | D] }
 | | | | d  | ƒq¨WtK ƒ  } | d | d } | d | d } d! GHd$ G| GHd% d& d' f GHd( | | | f GHd) | | | f GHn | | | | d  | ƒ| i d ƒ o | |  i i d <n | d =|  i i iR | ƒ Wd	 | t _ | o | t i( d <n |  i iS ƒ  X| Sd	 S(*   s  Run the named file inside IPython as a program.

        Usage:\
          %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
        
        Parameters after the filename are passed as command-line arguments to
        the program (put in sys.argv). Then, control returns to IPython's
        prompt.

        This is similar to running at a system prompt:\
          $ python file args\
        but with the advantage of giving you IPython's tracebacks, and of
        loading all variables into your interactive namespace for further use
        (unless -p is used, see below).

        The file is executed in a namespace initially consisting only of
        __name__=='__main__' and sys.argv constructed as indicated. It thus
        sees its environment as if it were being run as a stand-alone program
        (except for sharing global objects such as previously imported
        modules). But after execution, the IPython interactive namespace gets
        updated with all variables defined in the program (except for __name__
        and sys.argv). This allows for very convenient loading of code for
        interactive work, while giving each program a 'clean sheet' to run in.

        Options:
        
        -n: __name__ is NOT set to '__main__', but to the running file's name
        without extension (as python does under import).  This allows running
        scripts and reloading the definitions in them without calling code
        protected by an ' if __name__ == "__main__" ' clause.

        -i: run the file in IPython's namespace instead of an empty one. This
        is useful if you are experimenting with code written in a text editor
        which depends on variables defined interactively.

        -e: ignore sys.exit() calls or SystemExit exceptions in the script
        being run.  This is particularly useful if IPython is being used to
        run unittests, which always exit with a sys.exit() call.  In such
        cases you are interested in the output of the test results, not in
        seeing a traceback of the unittest module.

        -t: print timing information at the end of the run.  IPython will give
        you an estimated CPU time consumption for your script, which under
        Unix uses the resource module to avoid the wraparound problems of
        time.clock().  Under Unix, an estimate of time spent on system tasks
        is also given (for Windows platforms this is reported as 0.0).

        If -t is given, an additional -N<N> option can be given, where <N>
        must be an integer indicating how many times you want the script to
        run.  The final timing report will include total and per run results.

        For example (testing the script uniq_stable.py):

            In [1]: run -t uniq_stable

            IPython CPU timings (estimated):\
              User  :    0.19597 s.\
              System:        0.0 s.\

            In [2]: run -t -N5 uniq_stable

            IPython CPU timings (estimated):\
            Total runs performed: 5\
              Times :      Total       Per run\
              User  :   0.910862 s,  0.1821724 s.\
              System:        0.0 s,        0.0 s.

        -d: run your program under the control of pdb, the Python debugger.
        This allows you to execute your program step by step, watch variables,
        etc.  Internally, what IPython does is similar to calling:
        
          pdb.run('execfile("YOURFILENAME")')

        with a breakpoint set on line 1 of your file.  You can change the line
        number for this automatic breakpoint to be <N> by using the -bN option
        (where N must be an integer).  For example:

          %run -d -b40 myscript

        will set the first breakpoint at line 40 in myscript.py.  Note that
        the first breakpoint must be set on a line which actually does
        something (not a comment or docstring) for it to stop execution.

        When the pdb debugger starts, you will see a (Pdb) prompt.  You must
        first enter 'c' (without qoutes) to start execution up to the first
        breakpoint.

        Entering 'help' gives information about the use of the debugger.  You
        can easily see pdb's full documentation with "import pdb;pdb.help()"
        at a prompt.

        -p: run program under the control of the Python profiler module (which
        prints a detailed report of execution times, function calls, etc).

        You can pass other options after -p which affect the behavior of the
        profiler itself. See the docs for %prun for details.

        In this mode, the program's variables do NOT propagate back to the
        IPython interactive namespace (because they remain in the namespace
        where the profiler executes them).

        Internally this triggers a call to %prun, see its documentation for
        details on the options available specifically for profiling.

        There is one special usage for which the text above doesn't apply:
        if the filename ends with .ipy, the file is run as ipython script,
        just as if the commands were written on IPython prompt.
        s   nidtN:b:pD:l:rs:T:es   modes   lists   list_alli   i    s%   you must provide at least a filename.s   
%run:
Ns   .ipys   es   is   __name__s   __main__s   ns   __file__s   ps    s   di
   s   bsŠ   
I failed to find a valid line to set a breakpoint
after trying up to line: %s.
Please set a valid breakpoint manually with the -b option.s   %s:%ss   NOTE: Enter 'c' at thes   %s prompt to start your script.s   execfile("%s")s	   tb_offseti   s   ts   Ns   Number of runs must be >=1s   exit_ignores!   
IPython CPU timings (estimated):s     User  : %10s s.s     System: %10s s.s   Total runs performed:s     Times : %10s    %10ss   Totals   Per runs     User  : %10s s, %10s s.s     System: %10s s, %10s s.(T   s   selfs   parse_optionss   parameter_ss   optss   arg_lsts   get_py_filenames   filenames
   IndexErrors   warns   OInspects   getdocs	   magic_runs   IOErrors   msgs   errors   lowers   endswiths   apis   runliness   opens   reads   has_keys   exit_ignores   syss   argvs	   save_argvs   shells   user_nss   prog_nss   _Magic__name__saves
   FakeModules   main_mods   oss   paths   splitexts   basenames   names   __dict__s   _user_main_moduless   appends   moduless   restore_mains   Falses   Nones   statss   savehists
   magic_pruns   Debuggers   Pdbs   rcs   colorss   debs   bdbs
   Breakpoints   nexts   bplists
   bpbynumbers   maxtriess   ints   gets   bps	   checklines   ranges   do_breaks   prompts   runs   exc_infos   etypes   values   tbs   InteractiveTBs   runners   safe_execfiles   nrunss   KeyErrors   clock2s   t0s   t1s   t_usrs   t_syss   runss   nrs   updates
   reloadhist(   s   selfs   parameter_ss   runners	   save_argvs   t0s   nrunss   statss   filenames   t_syss   msgs   nrs   tbs   maxtriess   main_mods   arg_lsts   _Magic__name__saves   runss	   checklines   etypes   exit_ignores   bps   restore_mains   t_usrs   names   values   t1s   prog_nss   debs   opts(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys	   magic_runˆ  sÚ    l 

		
&		

 	

$
	
			 		 	c         C   sC   x< | i ƒ  D]. } |  i i | |  i i |  i i d d ƒq Wd S(   s4  Run files as logs.

        Usage:\
          %runlog file1 file2 ...

        Run the named files (treating them as log files) in sequence inside
        the interpreter, and return to the prompt.  This is much slower than
        %run because each line is executed in a try/except block, but it
        allows running files with syntax errors in them.

        Normally IPython will guess when a file is one of its own logfiles, so
        you can typically use %run even for logs. This shorthand allows you to
        force any file to be treated as a log file.s   islogi   N(   s   parameter_ss   splits   fs   selfs   shells   safe_execfiles   user_ns(   s   selfs   parameter_ss   f(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_runlog“  s
      c         B   sy  d k  } d k }
 d d d d g } d d d d	 g } |  i | d
 d e ƒ\ } } | d j o d Sn | i
 } e e | d d ƒ ƒ } e e | d | i ƒ ƒ } e e | d d ƒ ƒ } e | d ƒ o e i } n e | d ƒ o
 e } n | i d | ƒ } | i h  d | i | d ƒ <d d <} d } e ƒ  } e | d d ƒ } e ƒ  | }	 h  } | |  i  i! | U| d | _" | d j oI d } x@ e# d d ƒ D]+ } | d 9} | i  | ƒ d j o Pq¥q¥Wn e% | i | | ƒ ƒ | } | d j o0 e% e |
 i' |
 i( | ƒ ƒ d ƒ d ƒ } n d } d  | | | | | | | | f GH|	 | j o d! |	 GHn d S("   s%  Time execution of a Python statement or expression

        Usage:\
          %timeit [-n<N> -r<R> [-t|-c]] statement

        Time execution of a Python statement or expression using the timeit
        module.

        Options:
        -n<N>: execute the given statement <N> times in a loop. If this value
        is not given, a fitting value is chosen. 
        
        -r<R>: repeat the loop iteration <R> times and take the best result.
        Default: 3
        
        -t: use time.time to measure the time, which is the default on Unix.
        This function measures wall time.
        
        -c: use time.clock to measure the time, which is the default on
        Windows and measures wall time. On Unix, resource.getrusage is used
        instead and returns the CPU user time.

        -p<P>: use a precision of <P> digits to display the timing result.
        Default: 3

        
        Examples:\
          In [1]: %timeit pass
          10000000 loops, best of 3: 53.3 ns per loop

          In [2]: u = None

          In [3]: %timeit u is None
          10000000 loops, best of 3: 184 ns per loop

          In [4]: %timeit -r 4 u == None
          1000000 loops, best of 4: 242 ns per loop

          In [5]: import time

          In [6]: %timeit -n1 time.sleep(2)
          1 loops, best of 3: 2 s per loop
          

        The times reported by %timeit will be slightly higher than those
        reported by the timeit.py script when variables are accessed. This is
        due to the fact that %timeit executes the statement in the namespace
        of the shell, compared with timeit.py, which uses a single setup
        statement to import function or create variables. Generally, the bias
        does not matter as long as results from timeit.py are not mixed with
        those from %timeit.Ns   ss   mss   Âµss   nsi   f1000.0f	1000000.0f1000000000.0s   n:r:tcp:s   posixs    s   ni    s   rs   pi   s   ts   cs   timers   stmti   s   setups   passf0.10000000000000001s   <magic-timeit>s   execs   inneri
   f0.20000000000000001f0.0s&   %d loops, best of %d: %.*g %s per loops   Compiler time: %.2f s(*   s   timeits   maths   unitss   scalings   selfs   parse_optionss   parameter_ss   Falses   optss   stmts   default_timers   timefuncs   ints   getattrs   numbers   default_repeats   repeats	   precisions   hasattrs   times   clocks   Timers   timers   templates   reindents   srcs   tc_mins   t0s   compiles   codes   tcs   nss   shells   user_nss   inners   ranges   is   mins   bests   floors   log10s   order(   s   selfs   parameter_ss   codes   numbers   t0s   bests   timeits   unitss   nss   tcs   maths   repeats   timefuncs	   precisions   stmts   scalings   srcs   is   timers   tc_mins   orders   opts(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_timeit¦  sP    3 			
+	 
0$c         B   s…  |  i i | e ƒ } d } y2 d } e ƒ  } e
 | d | ƒ } e ƒ  | }
 WnA e j
 o5 d } e ƒ  } e
 | d | ƒ } e ƒ  | }
 n X|  i i } e } e i } | ƒ  }	 | d j o% | ƒ  } e | | ƒ } | ƒ  } n! | ƒ  } | | U| ƒ  } e } | ƒ  } | |	 } | d | d } | d | d } | | } d | | | f GHd	 | GH|
 | j o d
 |
 GHn | Sd S(   s†  Time execution of a Python statement or expression.

        The CPU and wall clock times are printed, and the value of the
        expression (if any) is returned.  Note that under Win32, system time
        is always reported as 0, since it can not be measured.

        This function provides very basic timing functionality.  In Python
        2.3, the timeit module offers more control and sophistication, so this
        could be rewritten to use it (patches welcome).
        
        Some examples:

          In [1]: time 2**128
          CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
          Wall time: 0.00
          Out[1]: 340282366920938463463374607431768211456L

          In [2]: n = 1000000

          In [3]: time sum(range(n))
          CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
          Wall time: 1.37
          Out[3]: 499999500000L

          In [4]: time print 'hello world'
          hello world
          CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
          Wall time: 0.00

          Note that the time needed by Python to compile the given expression
          will be reported if it is more than 0.1s.  In this example, the
          actual exponentiation is done by Python at compilation time, so while
          the expression can take a noticeable amount of time to compute, that
          time is purely due to the compilation:

          In [5]: time 3**9999;
          CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
          Wall time: 0.00 s

          In [6]: time 3**999999;
          CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
          Wall time: 0.00 s
          Compiler : 0.78 s
          f0.10000000000000001s   evals   <timed eval>s   execs   <timed exec>i    i   s2   CPU times: user %.2f s, sys: %.2f s, total: %.2f ss   Wall time: %.2f ss   Compiler : %.2f sN(   s   selfs   shells	   prefilters   parameter_ss   Falses   exprs   tc_mins   modes   clocks   t0s   compiles   codes   tcs   SyntaxErrors   user_nss   globs   clock2s   clks   times   wtimes   wall_sts   sts   evals   outs   ends   Nones   wall_ends	   wall_times   cpu_users   cpu_syss   cpu_tot(   s   selfs   parameter_ss   codes   wtimes   cpu_users   outs   tc_mins   ends	   wall_times   wall_sts   tcs   cpu_tots   globs   wall_ends   exprs   clks   t0s   sts   cpu_syss   mode(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys
   magic_time  sF    , 								

	c         C   s  |  i | d d d ƒ\ } } | o_ g  i } |  i i i	 ƒ  D]* \ }
 }	 t |	 t ƒ o | |
 ƒ q@ q@ ~ } | i ƒ  | Sn t | ƒ d j o t d ƒ ‚ n | d | d f \ } } |  i | | i d ƒ ƒ } t | ƒ } |  i i i h  | | <ƒ d | GHd GH| Gd	 S(
   sT	  Define a set of input lines as a macro for future re-execution.

        Usage:\
          %macro [options] name n1-n2 n3-n4 ... n5 .. n6 ...

        Options:
        
          -r: use 'raw' input.  By default, the 'processed' history is used,
          so that magics are loaded in their transformed version to valid
          Python.  If this option is given, the raw input as typed as the
          command line is used instead.

        This will define a global variable called `name` which is a string
        made of joining the slices and lines you specify (n1,n2,... numbers
        above) from your input history into a single string. This variable
        acts like an automatic function which re-executes those lines as if
        you had typed them. You just type 'name' at the prompt and the code
        executes.

        The notation for indicating number ranges is: n1-n2 means 'use line
        numbers n1,...n2' (the endpoint is included).  That is, '5-7' means
        using the lines numbered 5,6 and 7.

        Note: as a 'hidden' feature, you can also use traditional python slice
        notation, where N:M means numbers N through M-1.

        For example, if your history contains (%hist prints it):
        
          44: x=1\
          45: y=3\
          46: z=x+y\
          47: print x\
          48: a=5\
          49: print 'x',x,'y',y\

        you can create a macro with lines 44 through 47 (included) and line 49
        called my_macro with:

          In [51]: %macro my_macro 44-47 49

        Now, typing `my_macro` (without quotes) will re-execute all this code
        in one pass.

        You don't need to give the line-numbers in order, and any given line
        number can appear multiple times. You can assemble macros with any
        lines from your input history in any order.

        The macro is a simple object which holds its value in an attribute,
        but IPython's display system checks for macros and executes them as
        code instead of printing them when you type their name.

        You can view a macro's contents by explicitly printing it with:
        
          'print macro_name'.

        For one-off cases which DON'T contain magic function calls in them you
        can obtain similar results by explicitly executing slices from your
        input history with:

          In [60]: exec In[44:48]+In[49]s   rs   modes   listi   s:   %macro insufficient args; usage '%macro name n1-n2 n3-4...i    s?   Macro `%s` created. To execute, type its name (without quotes).s   Macro contents:N(   s   selfs   parse_optionss   parameter_ss   optss   argss   appends   _[1]s   shells   user_nss   itemss   ks   vs
   isinstances   Macros   macss   sorts   lens
   UsageErrors   names   rangess   extract_input_slicess   has_keys   liness   macros   update(   s   selfs   parameter_ss   rangess   macros   macss   names   argss   liness   _[1]s   vs   ks   opts(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_macroq  s    < M
	c   	      C   s   |  i | d d d ƒ\ } } | d | d f \ } } | i d ƒ o | d 7} n t i	 i
 | ƒ o: t d | ƒ } | i ƒ  d d	 g j o d
 GHd Sq¤ n d i |  i | | i d ƒ ƒ ƒ } t | d ƒ } | i | ƒ | i ƒ  d | GH| GHd S(   sç  Save a set of lines to a given filename.

        Usage:\
          %save [options] filename n1-n2 n3-n4 ... n5 .. n6 ...

        Options:
        
          -r: use 'raw' input.  By default, the 'processed' history is used,
          so that magics are loaded in their transformed version to valid
          Python.  If this option is given, the raw input as typed as the
          command line is used instead.

        This function uses the same syntax as %macro for line extraction, but
        instead of creating a macro it saves the resulting string to the
        filename you specify.

        It adds a '.py' extension to the file if you don't do so yourself, and
        it asks for confirmation before overwriting existing files.s   rs   modes   listi    i   s   .pys%   File `%s` exists. Overwrite (y/[N])? s   ys   yess   Operation cancelled.Ns    s   ws1   The following commands were written to file `%s`:(   s   selfs   parse_optionss   parameter_ss   optss   argss   fnames   rangess   endswiths   oss   paths   isfiles	   raw_inputs   anss   lowers   joins   extract_input_slicess   has_keys   cmdss   files   fs   writes   close(	   s   selfs   parameter_ss   fs   argss   cmdss   rangess   fnames   anss   opts(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys
   magic_saveÁ  s      $
	c         C   sd   |  i i | i ƒ } |  i i i | ƒ t | ƒ } | i
 ƒ  } | i ƒ  t | ƒ |  i i | <d S(   s,   open an editor with the macro data in a fileN(   s   selfs   shells
   mktempfiles   macros   values   filenames   hookss   editors   opens   mfiles   reads   mvalues   closes   Macros   user_nss   mname(   s   selfs   mnames   macros   filenames   mvalues   mfile(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   _edit_macroå  s     
c         C   s   |  i | ƒ Sd S(   s   Alias to %edit.N(   s   selfs
   magic_edits   parameter_s(   s   selfs   parameter_s(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_edð  s     c            sÏ  ‡  d †  } d t f d „  ƒ  Y} |  i | d ƒ \ } ‰  | i d ƒ } | i d ƒ } | i d t ƒ }	 | o7 d | d	 ‰  |  i i i ˆ  ƒ o | d
 ‰  q¨ n y- |  i i i | d	 <| o | | d
 <n Wn n Xd
 } t i d ˆ  ƒ o+ ˆ  i ƒ  } d i |  i | | ƒ ƒ } n™ˆ  i d ƒ o | ˆ  ƒ } d } d	 } nmˆ  o_y7 t ˆ  |  i i ƒ } t | ƒ t j o
 | ‚ n Wq»t  t! f j
 oB | ˆ  ƒ } | t j o t" d ˆ  ƒ d Sn d } d	 } q»| j
 oÂt# | t$ ƒ o |  i% ˆ  | ƒ d Sn yÓ t& i' | ƒ } d | i( ƒ  j o t& i) | ƒ o— g  i* } t, | ƒ D] } | t. | | ƒ ƒ qb~ } x^ | D]R } t& i1 | ƒ o q‹n t& i' | ƒ } | o d | i( ƒ  j o | } Pq‹q‹Wn d
 } Wn9 t3 j
 o- | ˆ  ƒ } d
 } t" d ˆ  | f ƒ n X| ow y( |	 t j o t& i4 | ƒ d
 }	 n Wq¦t5 j
 o< | ˆ  ƒ } | t j o t" d | | f ƒ d Sq¢q¦Xn d	 } q»Xn d } | o |  i i6 | ƒ } d G| GHn d Gt7 i8 i9 ƒ  |  i i: i; | |	 ƒ | i d ƒ o HnI d GH| o |  i i< t= | ƒ ƒ n# |  i i> | |  i i |  i i ƒ | o_ y t? | ƒ i@ ƒ  SWqËt5 j
 o8 }
 |
 i | j o t" d ƒ d SqÇ|  i iB ƒ  qËXn d S(   sk  Bring up an editor and execute the resulting code.

        Usage:
          %edit [options] [args]

        %edit runs IPython's editor hook.  The default version of this hook is
        set to call the __IPYTHON__.rc.editor command.  This is read from your
        environment variable $EDITOR.  If this isn't found, it will default to
        vi under Linux/Unix and to notepad under Windows.  See the end of this
        docstring for how to change the editor hook.

        You can also set the value of this editor via the command line option
        '-editor' or in your ipythonrc file. This is useful if you wish to use
        specifically for IPython an editor different from your typical default
        (and for Windows users who typically don't set environment variables).

        This command allows you to conveniently edit multi-line code right in
        your IPython session.
        
        If called without arguments, %edit opens up an empty editor with a
        temporary file and will execute the contents of this file when you
        close it (don't forget to save it!).


        Options:

        -n <number>: open the editor at a specified line number.  By default,
        the IPython editor hook uses the unix syntax 'editor +N filename', but
        you can configure this by providing your own modified hook if your
        favorite editor supports line-number specifications with a different
        syntax.
        
        -p: this will call the editor with the same data as the previous time
        it was used, regardless of how long ago (in your current session) it
        was.

        -r: use 'raw' input.  This option only applies to input taken from the
        user's history.  By default, the 'processed' history is used, so that
        magics are loaded in their transformed version to valid Python.  If
        this option is given, the raw input as typed as the command line is
        used instead.  When you exit the editor, it will be executed by
        IPython's own processor.
        
        -x: do not execute the edited code immediately upon exit. This is
        mainly useful if you are editing programs which need to be called with
        command line arguments, which you can then do using %run.


        Arguments:

        If arguments are given, the following possibilites exist:

        - The arguments are numbers or pairs of colon-separated numbers (like
        1 4:8 9). These are interpreted as lines of previous input to be
        loaded into the editor. The syntax is the same of the %macro command.

        - If the argument doesn't start with a number, it is evaluated as a
        variable and its contents loaded into the editor. You can thus edit
        any string which contains python code (including the result of
        previous edits).

        - If the argument is the name of an object (other than a string),
        IPython will try to locate the file where it was defined and open the
        editor at the point where it is defined. You can use `%edit function`
        to load an editor exactly at the point where 'function' is defined,
        edit it and have the file be executed automatically.

        If the object is a macro (see %macro for details), this opens up your
        specified editor with a temporary file containing the macro's data.
        Upon exit, the macro is reloaded with the contents of the file.

        Note: opening at an exact line is only supported under Unix, and some
        editors (like kedit and gedit up to Gnome 2.8) do not understand the
        '+NUMBER' parameter necessary for this feature. Good editors like
        (X)Emacs, vi, jed, pico and joe all do.

        - If the argument is not found as a variable, IPython will look for a
        file with that name (adding .py if necessary) and load it into the
        editor. It will execute its contents with execfile() when you exit,
        loading any code in the file into your interactive namespace.

        After executing your code, %edit will return as output the code you
        typed in the editor (except when it was an existing file). This way
        you can reload the code in further invocations of %edit as a variable,
        via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
        the output.

        Note that %edit is also available through the alias %ed.

        This is an example of creating a simple function inside the editor and
        then modifying it. First, start up the editor:

        In [1]: ed\
        Editing... done. Executing edited code...\
        Out[1]: 'def foo():\n    print "foo() was defined in an editing session"\n'

        We can then call the function foo():
        
        In [2]: foo()\
        foo() was defined in an editing session

        Now we edit foo.  IPython automatically loads the editor with the
        (temporary) file where foo() was previously defined:
        
        In [3]: ed foo\
        Editing... done. Executing edited code...

        And if we call foo() again we get the modified version:
        
        In [4]: foo()\
        foo() has now been changed!

        Here is an example of how to edit a code snippet successive
        times. First we call the editor:

        In [8]: ed\
        Editing... done. Executing edited code...\
        hello\
        Out[8]: "print 'hello'\n"

        Now we call it again with the previous output (stored in _):

        In [9]: ed _\
        Editing... done. Executing edited code...\
        hello world\
        Out[9]: "print 'hello world'\n"

        Now we call it with the output #8 (stored in _8, also as Out[8]):

        In [10]: ed _8\
        Editing... done. Executing edited code...\
        hello again\
        Out[10]: "print 'hello again'\n"


        Changing the default editor hook:

        If you wish to write your own editor hook, you can put it in a
        configuration file which you load at startup time.  The default hook
        is defined in the IPython.hooks module, and you can use that as a
        starting example for further modifications.  That file also has
        general instructions on how to set a new hook for use once you've
        defined it.c            sN   y t  |  ƒ } Wn3 t j
 o' ˆ  i d ƒ o
 |  } qF t } n X| Sd S(   s#   Make a filename from the given argss   .pyN(   s   get_py_filenames   args   filenames   IOErrors   argss   endswiths   None(   s   args   filename(   s   args(    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   make_filenameˆ  s     
s   DataIsObjectc           B   s   t  Z RS(   N(   s   __name__s
   __module__(    (    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   DataIsObject”  s    s   prxn:s   ps   rs   ns   _%si    i   s   \ds    s   .pysB   Argument given (%s) can't be found as a variable or as a filename.Ns
   fakemodulesD   Could not find file where `%s` is defined.
Opening a file named `%s`s4   The file `%s` where `%s` was defined cannot be read.s)   IPython will make a temporary file named:s
   Editing...s   xs   done. Executing edited code...s'   File not found. Did you forget to save?(C   s   make_filenames	   Exceptions   DataIsObjects   selfs   parse_optionss   parameter_ss   optss   argss   has_keys   opts_ps   opts_rs   gets   Nones   linenos	   last_calls   shells   user_nss   outputcaches   prompt_counts   use_temps   res   matchs   splits   rangess   joins   extract_input_slicess   datas   endswiths   filenames   evals   types   StringTypess	   NameErrors   SyntaxErrors   warns
   isinstances   Macros   _edit_macros   inspects
   getabsfiles   lowers   isclasss   appends   _[1]s   dirs   anames   getattrs   attrss   attrs   ismethods   datafiles	   TypeErrors   getsourceliness   IOErrors
   mktempfiles   syss   stdouts   flushs   hookss   editors   runliness	   file_reads   safe_execfiles   opens   reads   msgs   showtraceback(   s   selfs   parameter_ss	   last_calls   DataIsObjects   attrss   make_filenames   opts_ps   opts_rs   filenames   linenos   msgs   argss   rangess   datas   anames   datafiles   attrs   _[1]s   optss   use_temp(    (   s   argss=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys
   magic_editô  s´     

#6 

c         C   s›   d „  } |  i } | i ƒ  i ƒ  } y& | i i d | ƒ d G| i i	 GHWn | d ƒ n X| i
 o/ y | i i d | ƒ Wq— | d ƒ q— Xn d S(   s’   Switch modes for the exception handlers.

        Valid modes: Plain, Context and Verbose.

        If called without arguments, acts as a toggle.c         C   s"   t  d |  t i ƒ  d f ƒ d  S(   Ns%   Error changing %s exception modes.
%si   (   s   warns   names   syss   exc_info(   s   name(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   xmode_switch_err	  s    s   modes   Exception reporting mode:s   users   threadedN(   s   xmode_switch_errs   selfs   shells   parameter_ss   strips
   capitalizes   new_modes   InteractiveTBs   set_modes   modes
   isthreadeds   sys_excepthook(   s   selfs   parameter_ss   new_modes   shells   xmode_switch_err(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_xmode	  s     		
c         C   s‘  d „  } | i ƒ  } | o t d ƒ ‚ d Sn |  i } d k i } | i
 o t i d j o d } d } t | ƒ n | i o
 d } n y | i i | ƒ Wn | d ƒ n X| i i i | i _ y* | i i d | ƒ | i i d | ƒ Wn | d	 ƒ n X| i o/ y | i i d | ƒ WqD| d
 ƒ qDXn | i i o, y | i i | ƒ Wq| d ƒ qXn | i i d ƒ d S(   s¹   Switch color scheme for prompts, info system and exception handlers.

        Currently implemented schemes: NoColor, Linux, LightBG.

        Color scheme names are not case-sensitive.c         C   s"   t  d |  t i ƒ  d f ƒ d  S(   Ns#   Error changing %s color schemes.
%si   (   s   warns   names   syss   exc_info(   s   name(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   color_switch_err8	  s    s8   %colors: you must specify a color scheme. See '%colors?'Ns   win32sR  Proper color support under MS Windows requires the pyreadline library.
You can find it at:
http://ipython.scipy.org/moin/PyReadline/Intro
Gary's readline needs the ctypes module, from:
http://starship.python.net/crew/theller/ctypes
(Note that ctypes is already part of Python versions 2.5 and newer).

Defaulting color scheme to 'NoColor's   NoColors   prompts   schemes	   exceptions   system exception handlers   object inspector(   s   color_switch_errs   parameter_ss   strips
   new_schemes
   UsageErrors   selfs   shells   IPython.rlineimpls	   rlineimpls   readlines   have_readlines   syss   platforms   msgs   warns   has_readlines   outputcaches
   set_colorss   color_tables   active_scheme_names   rcs   colorss   InteractiveTBs   SyntaxTBs
   isthreadeds   sys_excepthooks
   color_infos	   inspectors   set_active_scheme(   s   selfs   parameter_ss   shells   color_switch_errs   msgs
   new_schemes   readline(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_colors1	  sF     			

c         C   sR   d |  i i i |  i i _ |  i |  i i i ƒ d Gd d g |  i i i GHd S(   sÁ  Toggle color_info.

        The color_info configuration parameter controls whether colors are
        used for displaying object details (by things like %psource, %pfile or
        the '?' system). This function toggles this value with each call.

        Note that unless you have a fairly recent pager (less works better
        than more) in your system, using colored object information displays
        will not work properly. Test it and see.i   s1   Object introspection functions have now coloring:s   OFFs   ONN(   s   selfs   shells   rcs
   color_infos   magic_colorss   colors(   s   selfs   parameter_s(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_color_infow	  s
    	 c         C   s<   d |  i i i |  i i _ d Gd d g |  i i i GHd S(   s   Toggle pretty printing on/off.i   s   Pretty printing has been turneds   OFFs   ONN(   s   selfs   shells   rcs   pprint(   s   selfs   parameter_s(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_Pprint‡	  s     c         C   s   |  i i ƒ  d S(   s»   Exit IPython, confirming if configured to do so.

        You can configure whether IPython asks for confirmation upon exit by
        setting the confirm_exit flag in the ipythonrc file.N(   s   selfs   shells   exit(   s   selfs   parameter_s(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys
   magic_exitŽ	  s     c         C   s   |  i i ƒ  d S(   s<   Exit IPython, confirming if configured to do so (like %exit)N(   s   selfs   shells   exit(   s   selfs   parameter_s(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys
   magic_quit–	  s     c         C   s   t  |  i _ d S(   s"   Exit IPython without confirmation.N(   s   Trues   selfs   shells   exit_now(   s   selfs   parameter_s(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys
   magic_Exit›	  s     c         C   sè  | i ƒ  } | o0|  i i d h  ƒ } |  i i } | i
 ƒ  } | i ƒ  g  } g  }	 xÆ | D]¾ } t } y | | d } Wn) t t f j
 o | | } t } n X| | j p: | p3 | i ƒ  t i i | ƒ d i ƒ  j p
 d | j o |	 i | | f ƒ q^ | i | | f ƒ q^ W| i |	 ƒ d Gt | ƒ GH| Sn y | i t d ƒ \ } } Wn t  i! |  i" ƒ GHnj X| i# d ƒ }
 |
 d j o | i% d ƒ d j o t& d ƒ n* |
 | f |  i i | <|  i i' d	 d ƒ d
 S(   sl  Define an alias for a system command.

        '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'

        Then, typing 'alias_name params' will execute the system command 'cmd
        params' (from your underlying operating system).

        Aliases have lower precedence than magic functions and Python normal
        variables, so if 'foo' is both a Python variable and an alias, the
        alias can not be executed until 'del foo' removes the Python variable.

        You can use the %l specifier in an alias definition to represent the
        whole line when the alias is called.  For example:

          In [2]: alias all echo "Input in brackets: <%l>"\
          In [3]: all hello world\
          Input in brackets: <hello world>

        You can also define aliases with parameters using %s specifiers (one
        per parameter):
        
          In [1]: alias parts echo first %s second %s\
          In [2]: %parts A B\
          first A second B\
          In [3]: %parts A\
          Incorrect number of arguments: 2 expected.\
          parts is an alias to: 'echo first %s second %s'

        Note that %l and %s are mutually exclusive.  You can only use one or
        the other in your aliases.

        Aliases expand Python variables just like system calls using ! or !! 
        do: all expressions prefixed with '$' get expanded.  For details of
        the semantic rules, see PEP-215:
        http://www.python.org/peps/pep-0215.html.  This is the library used by
        IPython for variable expansion.  If you want to access a true shell
        variable, an extra $ is necessary to prevent its expansion by IPython:

        In [6]: alias show echo\
        In [7]: PATH='A Python string'\
        In [8]: show $PATH\
        A Python string\
        In [9]: show $$PATH\
        /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...

        You can use the alias facility to acess all of $PATH.  See the %rehash
        and %rehashx functions, which automatically create aliases for the
        contents of your $PATH.

        If called with no parameters, %alias prints the current alias table.s   stored_aliasesi   i    s    s   Total number of aliases:s   %ss   %lsE   The %s and %l specifiers are mutually exclusive in alias definitions.s   verboseN((   s   parameter_ss   strips   pars   selfs   dbs   gets   storeds   shells   alias_tables   atabs   keyss   aliasess   sorts   ress   showlasts   aliass   Falses   specials   tgts	   TypeErrors   AttributeErrors   Trues   lowers   oss   paths   splitexts   appends   extends   lens   splits   Nones   cmds   OInspects   getdocs   magic_aliass   counts   nargss   finds   errors   alias_table_validate(   s   selfs   parameter_ss   tgts   storeds   specials   aliasess   pars   ress   atabs   showlasts   nargss   cmds   alias(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_alias£	  s@    2 
 
J#c         C   sw   | i ƒ  } | |  i i j o |  i i | =n |  i i d h  ƒ } | | j o! d G| GH| | =| |  i d <n d S(   s   Remove an aliass   stored_aliasess   Removing %stored aliasN(	   s   parameter_ss   strips   anames   selfs   shells   alias_tables   dbs   gets   stored(   s   selfs   parameter_ss   storeds   aname(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_unalias
  s     	c            sÂ  |  i } | i d =g  i } t i i d d ƒ i	 t i
 ƒ D]( } | t i i t i i | ƒ ƒ ƒ q< ~ } t t i i | ƒ } |  i i } g  } t i d j o d „  } n† y) t i d i d d ƒ i d	 d ƒ } Wn t j
 o d
 } n Xd | j o | d 7} n t i d | t i ƒ ‰  ‡  d †  } t i ƒ  }	 zkt i d j o} x4| D]n } t i  | ƒ xX t i! | ƒ D]G }
 | |
 ƒ o |
 |  i i# j o! d |
 f | |
 <| i |
 ƒ qqWq\Wn» x· | D]¯ } t i  | ƒ x™ t i! | ƒ D]ˆ }
 t i i$ |
 ƒ \ } } | |
 ƒ o | i' ƒ  |  i i# j oD | i' ƒ  d j o
 | }
 n d |
 f | | i' ƒ  <| i |
 ƒ qüqüWqÙW|  i i( ƒ  | i } | | d <Wd t i  |	 ƒ Xd S(   s  Update the alias table with all executable files in $PATH.

        This version explicitly checks that every entry in $PATH is a file
        with execute access (os.X_OK), so it is much slower than %rehash.

        Under Windows, it checks executability as a match agains a
        '|'-separated string of extensions, stored in the IPython config
        variable win_exec_ext.  This defaults to 'exe|com|bat'.
        
        This function also resets the root module cache of module completer,
        used on slow filesystems.
        s   rootmoduless   PATHs    s   posixc         C   s&   t  i i |  ƒ o t  i |  t  i ƒ S(   N(   s   oss   paths   isfiles   fnames   accesss   X_OK(   s   fname(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   <lambda>*
  s    s   pathexts   ;s   |s   .s   exe|com|bat|pys   pys   |pys   (.*)\.(%s)$c            s    t  i i |  ƒ o ˆ  i |  ƒ S(   N(   s   oss   paths   isfiles   fnames   execres   match(   s   fname(   s   execre(    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   <lambda>5
  s    i    s   .exes
   syscmdlistN()   s   selfs   apis   ips   dbs   appends   _[1]s   oss   environs   gets   splits   pathseps   ps   paths   abspaths
   expandusers   filters   isdirs   shells   alias_tables
   syscmdlists   names   isexecs   replaces   winexts   KeyErrors   res   compiles
   IGNORECASEs   execres   getcwds   savedirs   pdirs   chdirs   listdirs   ffs   no_aliass   splitexts   bases   exts   lowers   alias_table_validate(   s   selfs   parameter_ss   exts   ips   pdirs   isexecs   _[1]s   ps   execres   savedirs   ffs   winexts   paths   dbs   bases   alias_tables
   syscmdlist(    (   s   execres=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_rehashx
  sX     	
Z)     &
	 c         C   s   t  i ƒ  Sd S(   s*   Return the current working directory path.N(   s   oss   getcwd(   s   selfs   parameter_s(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys	   magic_pwd[
  s     c         C   s$  | i ƒ  } t i ƒ  } t i d | ƒ } | oV t | i	 d ƒ ƒ } y |  i i d | } Wn t j
 o d GHd Sqº Xh  } n4 t i d d | ƒ } |  i | d d	 d
 ƒ\ } } | d j o> y |  i i d d } Wq™t j
 o t d ƒ ‚ q™Xn• t i i | ƒ p | i d ƒ op |  i i d h  ƒ } | i | ƒ o# | | }
 d | |
 f GH|
 } q™| i d ƒ o t d | ƒ ‚ q™n | oÅ yK t i t i i | ƒ ƒ |  i i i o d t ƒ  } t! i" | ƒ n Wn" t# j
 o t$ i% ƒ  d GHqêXt i ƒ  } |  i i d }	 | | j o( |	 i( | ƒ t) |	 ƒ d |  i d <qên† t i |  i i* ƒ |  i i i o t! i" d ƒ n t i ƒ  } |  i i d }	 | | j o( |	 i( | ƒ t) |	 ƒ d |  i d <n d | j o |  i i d o |  i i d d GHn d S(   s¶  Change the current working directory.

        This command automatically maintains an internal list of directories
        you visit during your IPython session, in the variable _dh. The
        command %dhist shows this history nicely formatted. You can also
        do 'cd -<tab>' to see directory history conveniently.

        Usage:

          cd 'dir': changes to directory 'dir'.

          cd -: changes to the last visited directory.

          cd -<n>: changes to the n-th directory in the directory history.

          cd -b <bookmark_name>: jump to a bookmark set by %bookmark
             (note: cd <bookmark_name> is enough if there is no
              directory <bookmark_name>, but a bookmark with the name exists.)
              'cd -b <tab>' allows you to tab-complete bookmark names. 

        Options:

        -q: quiet.  Do not print the working directory after the cd command is
        executed.  By default IPython's cd command does print this directory,
        since the default prompts do not display path information.
        
        Note that !cd doesn't work for this purpose because the shell where
        !command runs is immediately discarded after executing 'command'.s	   (-)(\d+)$i   s   _dhs2   The requested directory does not exist in history.Ns   \\(?! )s   /s   qbs   modes   strings   -iþÿÿÿs*   %cd -: No previous directory to change to.s   bs	   bookmarkss   (bookmark:%s) -> %ssD   Bookmark '%s' not found.  Use '%%bookmark -l' to see your bookmarks.s   IPy i   iœÿÿÿs   dhists   IPy ~s   qiÿÿÿÿ(+   s   parameter_ss   strips   oss   getcwds   oldcwds   res   matchs   numcds   ints   groups   nns   selfs   shells   user_nss   pss
   IndexErrors   optss   subs   parse_optionss
   UsageErrors   paths   isdirs   has_keys   dbs   gets   bkmss   targets   chdirs
   expandusers   rcs
   term_titles
   abbrev_cwds   ttitles	   platutilss   set_term_titles   OSErrors   syss   exc_infos   cwds   dhists   appends   compress_dhists   home_dir(   s   selfs   parameter_ss   ttitles   pss   nns   bkmss   cwds   numcds   oldcwds   dhists   targets   opts(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_cd_
  sd     	
$

c         C   s   t  i i Sd S(   s   List environment variables.N(   s   oss   environs   data(   s   selfs   parameter_s(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys	   magic_envÄ
  s     c         C   so   |  i i } t i i | ƒ } t i	 ƒ  i
 |  i d ƒ } | o |  i | ƒ n | i d | ƒ |  i ƒ  Sd S(   ss   Place the current dir on stack and change directory.
        
        Usage:\
          %pushd ['dirname']
        s   ~i    N(   s   selfs   shells	   dir_stacks   dir_ss   oss   paths
   expandusers   parameter_ss   tgts   getcwds   replaces   home_dirs   cwds   magic_cds   inserts
   magic_dirs(   s   selfs   parameter_ss   tgts   dir_ss   cwd(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_pushdÉ
  s     c         C   sM   |  i i o t d ƒ ‚ n |  i i i d ƒ } |  i | ƒ d G| GHd S(   s=   Change to directory popped off the top of the stack.
        s   %popd on empty stacki    s   popd ->N(   s   selfs   shells	   dir_stacks
   UsageErrors   pops   tops   magic_cd(   s   selfs   parameter_ss   top(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys
   magic_popdØ
  s     c         C   s   |  i i Sd S(   s#   Return the current directory stack.N(   s   selfs   shells	   dir_stack(   s   selfs   parameter_s(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys
   magic_dirsá
  s     c         C   s  |  i i d } | o¸ y t t | i ƒ  ƒ } Wn |  i	 t
 i ƒ d Sn Xt | ƒ d j o3 t t | ƒ | d d ƒ t | ƒ f \ } } qç t | ƒ d j o | \ } } qç |  i	 t
 i ƒ d Sn d t | ƒ f \ } } t | d d d | d	 | ƒd S(
   s  Print your history of visited directories.

        %dhist       -> print full history\
        %dhist n     -> print last n entries only\
        %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\

        This history is automatically maintained by the %cd command, and
        always available as the global list variable _dh. You can use %cd -<n>
        to go to directory number <n>.
        
        Note that most of time, you should view directory history by entering
        cd -<TAB>.
        
        s   _dhNi   i    i   s   headers   Directory history (kept in _dh)s   starts   stop(   s   selfs   shells   user_nss   dhs   parameter_ss   maps   ints   splits   argss   arg_errs   Magics   magic_dhists   lens   maxs   inis   fins   nlprint(   s   selfs   parameter_ss   dhs   argss   inis   fin(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_dhistæ
  s$     3c   	      C   s=  |  i | d ƒ \ } } y@ | i d d ƒ \ } } | i ƒ  } | i d d ƒ \ } } Wn% t
 j
 o d d f \ } } n X|  i i | ƒ \ } } | o t i | IJn | i d ƒ o t | i d ƒ ƒ } n t | ƒ } | i d ƒ o d | t | ƒ f GHn | o  |  i i i h  | | <ƒ n | Sd	 S(
   s³  Shell capture - execute a shell command and capture its output.

        DEPRECATED. Suboptimal, retained for backwards compatibility.
        
        You should use the form 'var = !command' instead. Example:
         
         "%sc -l myfiles = ls ~" should now be written as
            
         "myfiles = !ls ~"
         
        myfiles.s, myfiles.l and myfiles.n still apply as documented
        below.

        --
        %sc [options] varname=command

        IPython will run the given command using commands.getoutput(), and
        will then update the user's interactive namespace with a variable
        called varname, containing the value of the call.  Your command can
        contain shell wildcards, pipes, etc.

        The '=' sign in the syntax is mandatory, and the variable name you
        supply must follow Python's standard conventions for valid names.
        
        (A special format without variable name exists for internal use)

        Options:

          -l: list output.  Split the output on newlines into a list before
          assigning it to the given variable.  By default the output is stored
          as a single string.

          -v: verbose.  Print the contents of the variable.

        In most cases you should not need to split as a list, because the
        returned value is a special type of string which can automatically
        provide its contents either as a list (split on newlines) or as a
        space-separated string.  These are convenient, respectively, either
        for sequential processing or to be passed to a shell command.

        For example:

            # Capture into variable a
            In [9]: sc a=ls *py

            # a is a string with embedded newlines
            In [10]: a
            Out[10]: 'setup.py
win32_manual_post_install.py'

            # which can be seen as a list:
            In [11]: a.l
            Out[11]: ['setup.py', 'win32_manual_post_install.py']

            # or as a whitespace-separated string:
            In [12]: a.s
            Out[12]: 'setup.py win32_manual_post_install.py'

            # a.s is useful to pass as a single command line:
            In [13]: !wc -l $a.s
              146 setup.py
              130 win32_manual_post_install.py
              276 total

            # while the list form is useful to loop over:
            In [14]: for f in a.l:
               ....:      !wc -l $f
               ....:
            146 setup.py
            130 win32_manual_post_install.py

        Similiarly, the lists returned by the -l option are also special, in
        the sense that you can equally invoke the .s attribute on them to
        automatically get a whitespace-separated string from their contents:

            In [1]: sc -l b=ls *py

            In [2]: b
            Out[2]: ['setup.py', 'win32_manual_post_install.py']

            In [3]: b.s
            Out[3]: 'setup.py win32_manual_post_install.py'

        In summary, both the lists and strings used for ouptut capture have
        the following special attributes:

            .l (or .list) : value as list.
            .n (or .nlstr): value as newline-separated string.
            .s (or .spstr): value as space-separated string.
        s   lvs   =i   s    s   ls   
s   vs   %s ==
%sN(   s   selfs   parse_optionss   parameter_ss   optss   argss   splits   vars   _s   strips   cmds
   ValueErrors   shells   getoutputerrors   outs   errs   Terms   cerrs   has_keys   SLists   LSStrings   pformats   user_nss   update(	   s   selfs   parameter_ss   cmds   errs   argss   vars   optss   _s   out(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_sc  s&    Y  c         C   sR   | oG |  i i | ƒ \ } } | o t i | IJn t | i	 d ƒ ƒ Sn d S(   s  Shell execute - run a shell command and capture its output.

        %sx command

        IPython will run the given command using commands.getoutput(), and
        return the result formatted as a list (split on '\n').  Since the
        output is _returned_, it will be stored in ipython's regular output
        cache Out[N] and in the '_N' automatic variables.

        Notes:

        1) If an input line begins with '!!', then %sx is automatically
        invoked.  That is, while:
          !ls
        causes ipython to simply issue system('ls'), typing
          !!ls
        is a shorthand equivalent to:
          %sx ls
        
        2) %sx differs from %sc in that %sx automatically splits into a list,
        like '%sc -l'.  The reason for this is to make it as easy as possible
        to process line-oriented shell output via further python commands.
        %sc is meant to provide much finer control, but requires more
        typing.

        3) Just like %sc -l, this is a list with special attributes:

          .l (or .list) : value as list.
          .n (or .nlstr): value as newline-separated string.
          .s (or .spstr): value as whitespace-separated string.

        This is very useful when trying to use such lists as arguments to
        system commands.s   
N(
   s   parameter_ss   selfs   shells   getoutputerrors   outs   errs   Terms   cerrs   SLists   split(   s   selfs   parameter_ss   errs   out(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_sx‚  s    ! c         C   s    |  i i i | |  i i ƒ d S(   sØ  Run a job in the background, in a separate thread.

        For example,

          %bg myfunc(x,y,z=1)

        will execute 'myfunc(x,y,z=1)' in a background thread.  As soon as the
        execution starts, a message will be printed indicating the job
        number.  If your job number is 5, you can use

          myvar = jobs.result(5)  or  myvar = jobs[5].result

        to assign this result to variable 'myvar'.

        IPython has a job manager, accessible via the 'jobs' object.  You can
        type jobs? to get more information about it, and use jobs.<TAB> to see
        its attributes.  All attributes not starting with an underscore are
        meant for public use.

        In particular, look at the jobs.new() method, which is used to create
        new jobs.  This magic %bg function is just a convenience wrapper
        around jobs.new(), for expression-based jobs.  If you want to create a
        new job with an explicit function object and arguments, you must call
        jobs.new() directly.

        The jobs.new docstring also describes in detail several important
        caveats associated with a thread-based model for background job
        execution.  Type jobs.new? for details.

        You can check the status of all jobs with jobs.status().

        The jobs variable is set by IPython into the Python builtin namespace.
        If you ever declare a variable named 'jobs', you will shadow this
        name.  You can either delete your global jobs variable to regain
        access to the job manager, or make a new name and assign it manually
        to the manager (stored in IPython's namespace).  For example, to
        assign the job manager to the Jobs name, use:

          Jobs = __builtins__.jobsN(   s   selfs   shells   jobss   news   parameter_ss   user_ns(   s   selfs   parameter_s(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_bg«  s    ' c         C   sÓ   | i ƒ  } |  i i } |  i i i o | | } n | } x‡ t
 t |  i i ƒ d d d ƒ D]c } |  i i | } | d j o | i | ƒ p | i | ƒ o  d G| G|  i i | ƒ d Sq_ q_ Wd | GHd S(   sŒ  Repeat previous input.

        Note: Consider using the more powerfull %rep instead!
        
        If given an argument, repeats the previous command which starts with
        the same string, otherwise it just repeats the previous input.

        Shell escaped commands (with ! as first character) are not recognized
        by this system, only pure python code and magic commands.
        i   i    iÿÿÿÿs   _ip.magic("r")
s
   Executing:Ns&   No previous input matching `%s` found.(   s   parameter_ss   strips   starts   selfs   shells	   ESC_MAGICs	   esc_magics   rcs	   automagics   start_magics   ranges   lens
   input_hists   ns   inputs
   startswiths   runlines(   s   selfs   parameter_ss   ns   starts   start_magics	   esc_magics   input(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_rÖ  s    
 # -c   
      C   sï  |  i | d d d ƒ\ } } t | ƒ d j o t d ƒ ‚ n |  i i d h  ƒ } | i
 d ƒ oe y | d }	 Wn t j
 o t d	 ƒ ‚ qÞXy | |	 =WqÞt j
 o t d
 |	 ƒ ‚ qÞXn| i
 d ƒ o
 h  } nú | i
 d ƒ o} | i ƒ  } | i ƒ  | o t t t | ƒ ƒ } n d } d t | ƒ d } d GHx‘ | D] } | | | | f GHqQWnm | o t d ƒ ‚ nU t | ƒ d j o t i ƒ  | | d <n* t | ƒ d j o | d | | d <n | |  i d <d S(   se  Manage IPython's bookmark system.

        %bookmark <name>       - set bookmark to current dir
        %bookmark <name> <dir> - set bookmark to <dir>
        %bookmark -l           - list all bookmarks
        %bookmark -d <name>    - remove bookmark
        %bookmark -r           - remove all bookmarks

        You can later on access a bookmarked folder with:
          %cd -b <name>
        or simply '%cd <name>' if there is no directory called <name> AND
        there is such a bookmark defined.

        Your bookmarks persist through IPython sessions, but they are
        associated with each profile.s   drls   modes   listi   s   %bookmark: too many argumentss	   bookmarkss   di    s/   %bookmark -d: must provide a bookmark to deletes)   %%bookmark -d: Can't delete bookmark '%s's   rs   ls   %-s   s -> %ss   Current bookmarks:s-   %bookmark: You must specify the bookmark namei   N(   s   selfs   parse_optionss   parameter_ss   optss   argss   lens
   UsageErrors   dbs   gets   bkmss   has_keys   todels
   IndexErrors   KeyErrors   keyss   bkss   sorts   maxs   maps   sizes   strs   fmts   bks   oss   getcwd(
   s   selfs   parameter_ss   bkmss   argss   bks   bkss   sizes   fmts   optss   todel(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_bookmark÷  sD     

 c         C   s§   y t  | ƒ } t | ƒ } WnE t j
 o9 y t | |  i ƒ } Wqd t	 j
 o t
 } qd Xn X| t
 j o d GHd Sn t |  i i | ƒ d |  i i i ƒd S(   sÆ   Show a syntax-highlighted file through a pager.

        This magic is similar to the cat utility, but it will assume the file
        to be Python source and will show it with syntax highlighting. s   Error: no such file or variableNs   screen_lines(   s   get_py_filenames   parameter_ss   filenames	   file_reads   conts   IOErrors   evals   selfs   user_nss	   NameErrors   Nones   pages   shells
   pycolorizes   rcs   screen_length(   s   selfs   parameter_ss   conts   filename(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_pycat1  s     c         B   s<  |  i | d d d ƒ\ } } | i ƒ  } | i d d ƒ }
 d d d d	 g } e
 e i | ƒ } d
 k l } g  } d |
 GHx] n oU | i d ƒ }	 |	 |
 j o Pn x  | D] } | i d |	 ƒ }	 q® W| i |	 ƒ q† Wd i | ƒ d } | o+ e i | ƒ } | |  i U| |  i d <n | |  i | <d | GHd S(   så  Allows you to paste & execute a pre-formatted code block from clipboard.
        
        You must terminate the block with '--' (two minus-signs) alone on the
        line. You can also provide your own sentinel with '%paste -s %%' ('%%' 
        is the new sentinel for this operation)
        
        The block is dedented prior to execution to enable execution of method
        definitions. '>' and '+' characters at the beginning of a line are
        ignored, to allow pasting directly from e-mails, diff files and
        doctests (the '...' continuation prompt is also stripped).  The
        executed block is also assigned to variable named 'pasted_block' for
        later editing with '%edit pasted_block'.
        
        You can also pass a variable name as an argument, e.g. '%cpaste foo'.
        This assigns the pasted block to variable 'foo' as string, without 
        dedenting or executing it (preceding >>> and + is still stripped)
        
        Do not be alarmed by garbled output on Windows (it's a readline bug). 
        Just press enter and type -- (and press enter again) and the block 
        will be what was just pasted.
        
        IPython statements (magics, shell escapes) are not supported (yet).
        s   s:s   modes   strings   ss   --s   ^\s*In \[\d+\]:s   ^\s*(\s?>)+s
   ^\s*\.{3,}s   ^\++(   s   iplibs3   Pasting code; enter '%s' alone on the line to stop.i   s   :s    s   
s   pasted_blocks   Block assigned to '%s'N(   s   selfs   parse_optionss   parameter_ss   optss   argss   strips   pars   gets   sentinels   strip_res   maps   res   compiles   strip_from_starts   IPythons   iplibs   liness   raw_input_originals   ls   pats   subs   appends   joins   blocks   textwraps   dedents   bs   user_ns(   s   selfs   parameter_ss   pars   bs   pats   liness   argss   strip_from_starts   iplibs   ls   sentinels   blocks   strip_res   opts(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_cpasteF  s2     	  c         C   s0   d k  } | i i |  i d ƒ } t | ƒ d S(   s    Show a quick reference sheet Ns   -brief(   s   IPython.usages   IPythons   usages   quick_references   selfs   magic_magics   qrs   page(   s   selfs   args   IPythons   qr(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_quickref  s     	c         C   s  |  i ƒ  } t t i ƒ i ƒ  } d t i	 | d f }
 | d } t | i i ƒ } d |
 | | f } d G| GHt | ƒ | d j oy | i d ƒ }	 d G|	 GHg  i } |	 D] } | | i ƒ  ƒ q­ ~ t i d	 j o d
 p d } | d | i d ƒ n d S(   sd   Upgrade your IPython installation
        
        This will copy the config files that don't yet exist in your 
        ipython dir from the system config dir. Use this after upgrading 
        IPython if you don't wish to delete your .ipython dir.

        Call with -nolegacy to get rid of ipythonrc* files (recommended for
        new users)

        s   %s "%s"s   upgrade_dir.pys
   UserConfigs   %s "%s" "%s"s   >s	   -nolegacys
   ipythonrc*s   Nuking legacy files:s   win32s   .inis    s	   ipythonrcs   # Empty, see ipy_user_conf.py
N(   s   selfs   getapis   ips   paths   IPythons   __file__s   dirnames   ipinstallations   syss
   executables   upgrade_scripts
   src_configs   optionss
   ipythondirs   userdirs   cmds   shells   args   filess   legacys   appends   _[1]s   ps   removes   platforms   suffixs
   write_text(   s   selfs   args   _[1]s   ipinstallations
   src_configs   ps   ips   cmds   userdirs   legacys   upgrade_scripts   suffix(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_upgradeˆ  s    
 
	
	+c         C   s  d k  l } d k l } |  i } | i } | i	 }
 | i
 } | i d | ƒ  ƒ } | i } | d t ƒ }	 | d |
 i ƒ | d | i i ƒ | d |
 i ƒ | d |
 i ƒ | d	 |
 i ƒ |	 t j oz | i ƒ  d
 | i _ d | i _ d | i _ d | _ d | _ t | i _ | i _ | i _ t |
 _ | i d ƒ n | i ƒ  |
 i | i _ |
 i  | i _ |
 i | i _ | i! | _ | i" | _ | i# | i _ | i _ | i _ | i$ |
 _ | i | i% ƒ t& d t' |	 ƒ ƒ | _ d Gd d g | i GHd S(   sŸ  Toggle doctest mode on and off.

        This mode allows you to toggle the prompt behavior between normal
        IPython prompts and ones that are as similar to the default IPython
        interpreter as possible.

        It also supports the pasting of code snippets that have leading '>>>'
        and '...' prompts in them.  This means that you can paste doctests from
        files or docstrings (even if they have leading whitespace), and the
        code will execute correctly.  You can then use '%history -tn' to see
        the translated history without line numbers; this will give you the
        input after removal of all the leading prompts and whitespace, which
        can be pasted back into an editor.

        With these features, you can switch into this mode easily whenever you
        need to do testing and changes to doctests, without having to leave
        your existing IPython session.
        (   s   InterpreterPasteInput(   s   Structs   doctest_modes   modes	   rc_pprints   xmodes   rc_separate_outs   rc_separate_out2s   rc_prompts_pad_lefts   >>> s   ... s    s   Plaini   s   Doctest mode is:s   OFFs   ONN((   s   IPython.Extensionss   InterpreterPasteInputs   ipastes   IPython.ipstructs   Structs   selfs   shells   outputcaches   ocs   rcs   metas
   setdefaults   dstores   save_dstores   Falses   modes   pprints   InteractiveTBs   separate_outs   separate_out2s   prompts_pad_lefts   activate_prefilters   prompt1s
   p_templates   prompt2s
   prompt_outs
   output_seps   output_sep2s   pad_lefts   magic_xmodes   deactivate_prefilters
   prompt_in1s
   prompt_in2s   rc_separate_outs   rc_separate_out2s   rc_prompts_pad_lefts	   rc_pprints   xmodes   bools   int(   s   selfs   parameter_ss   shells   ipastes   Structs   save_dstores   dstores   ocs   metas   modes   rc(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   magic_doctest_mode¤  sJ     					
		 	
#(O   s   __name__s
   __module__s   __doc__s   auto_statuss   __init__s   profile_missing_notices   default_options   lsmagics   Falses   extract_input_slicess   Nones   _ofinds   arg_errs   format_latexs   format_screens   parse_optionss   magic_lsmagics   magic_magics   magic_autoindents   magic_automagics   magic_autocalls   magic_system_verboses
   magic_pages   magic_profiles   magic_pinfos
   magic_pdefs
   magic_pdocs   magic_psources   magic_pfiles   _inspects   magic_psearchs   magic_who_lss	   magic_whos
   magic_whoss   magic_resets   magic_logstarts   magic_logstops   magic_logoffs   magic_logons   magic_logstates	   magic_pdbs   magic_debugs
   magic_pruns	   magic_runs   magic_runlogs   magic_timeits
   magic_times   magic_macros
   magic_saves   _edit_macros   magic_eds
   magic_edits   magic_xmodes   magic_colorss   magic_color_infos   magic_Pprints
   magic_exits
   magic_quits
   magic_Exits   magic_aliass   magic_unaliass   magic_rehashxs	   magic_pwds   magic_cds	   magic_envs   magic_pushds
   magic_popds
   magic_dirss   magic_dhists   magic_scs   magic_sxs   magic_bgs   magic_rs   magic_bookmarks   magic_pycats   magic_cpastes   magic_quickrefs   magic_upgrades   magic_doctest_mode(    (    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   MagicX   sš   	 	
			&J					HgA2p)wi
"ªÿ p[P$	ÿ $F_Le	%w)+!:;		(:   s   __doc__s   IPythons   Releases   authorss
   __author__s   licenses   __license__s   __builtin__s   bdbs   inspects   oss   pdbs   pydocs   syss   res   tempfiles   times   cPickles   pickles   textwraps	   cStringIOs   StringIOs   getopts   GetoptErrors   pprints   pformats   setss   Sets   cProfiles   profiles   pstatss   ImportErrors   Nones   Debuggers   OInspects   wildcards   IPython.FakeModules
   FakeModules   IPython.Itpls   Itpls   itpls   printpls   itplnss   IPython.PyColorizes   Parsers   IPython.ipstructs   Structs   IPython.macros   Macros   IPython.genutilss	   platutilss   IPython.genericss   IPython.ipapis
   UsageErrors   on_offs   Bunchs   compress_dhists   Magic()   s   Structs
   UsageErrors   GetoptErrors   __builtin__s   compress_dhists   IPythons   bdbs   tempfiles   pprints
   FakeModules   res   getopts   Itpls   printpls   profiles   Magics   wildcards   __license__s	   platutilss   Macros   inspects   textwraps
   __author__s   syss   on_offs   Releases   pstatss   Sets   Debuggers   StringIOs   oss   Parsers   OInspects   pydocs   itplnss   pformats   times   Bunchs   pickles   pdbs   itpl(    (    s=   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/Magic.pys   ?   sV   																			