Format: application/x-python-code
⬇ Download File (13.0 KB)
   1  o
   2  
   3  ��h�4�@sZdZddlZddlmZdZdZdZdZdej�	d	�dd
   4  dj
   5  ejd�gZd
   6  �e�Z
   7  dS)z5Usage information for the main IPython applications.
   8  �N)�releasea}=========
   9   IPython
  10  =========
  11  
  12  Tools for Interactive Computing in Python
  13  =========================================
  14  
  15      A Python shell with automatic history (input and output), dynamic object
  16      introspection, easier configuration, command completion, access to the
  17      system shell and more.  IPython can also be embedded in running programs.
  18  
  19  
  20  Usage
  21  
  22      ipython [subcommand] [options] [-c cmd | -m mod | file] [--] [arg] ...
  23  
  24      If invoked with no options, it executes the file and exits, passing the
  25      remaining arguments to the script, just as if you had specified the same
  26      command with python. You may need to specify `--` before args to be passed
  27      to the script, to prevent IPython from attempting to parse them. If you
  28      specify the option `-i` before the filename, it will enter an interactive
  29      IPython session after running the script, rather than exiting. Files ending
  30      in .py will be treated as normal Python, but files ending in .ipy can
  31      contain special IPython syntax (magic commands, shell expansions, etc.).
  32  
  33      Almost all configuration in IPython is available via the command-line. Do
  34      `ipython --help-all` to see all available options.  For persistent
  35      configuration, look into your `ipython_config.py` configuration file for
  36      details.
  37  
  38      This file is typically installed in the `IPYTHONDIR` directory, and there
  39      is a separate configuration directory for each profile. The default profile
  40      directory will be located in $IPYTHONDIR/profile_default. IPYTHONDIR
  41      defaults to to `$HOME/.ipython`.  For Windows users, $HOME resolves to
  42      C:\Users\YourUserName in most instances.
  43  
  44      To initialize a profile with the default configuration file, do::
  45  
  46        $> ipython profile create
  47  
  48      and start editing `IPYTHONDIR/profile_default/ipython_config.py`
  49  
  50      In IPython's documentation, we will refer to this directory as
  51      `IPYTHONDIR`, you can change its default location by creating an
  52      environment variable with this name and setting it to the desired path.
  53  
  54      For more information, see the manual available in HTML and PDF in your
  55      installation, or online at https://ipython.org/documentation.html.
  56  a�
  57  IPython -- An enhanced Interactive Python
  58  =========================================
  59  
  60  IPython offers a fully compatible replacement for the standard Python
  61  interpreter, with convenient shell features, special commands, command
  62  history mechanism and output results caching.
  63  
  64  At your system command line, type 'ipython -h' to see the command line
  65  options available. This document only describes interactive features.
  66  
  67  GETTING HELP
  68  ------------
  69  
  70  Within IPython you have various way to access help:
  71  
  72    ?         -> Introduction and overview of IPython's features (this screen).
  73    object?   -> Details about 'object'.
  74    object??  -> More detailed, verbose information about 'object'.
  75    %quickref -> Quick reference of all IPython specific syntax and magics.
  76    help      -> Access Python's own help system.
  77  
  78  If you are in terminal IPython you can quit this screen by pressing `q`.
  79  
  80  
  81  MAIN FEATURES
  82  -------------
  83  
  84  * Access to the standard Python help with object docstrings and the Python
  85    manuals. Simply type 'help' (no quotes) to invoke it.
  86  
  87  * Magic commands: type %magic for information on the magic subsystem.
  88  
  89  * System command aliases, via the %alias command or the configuration file(s).
  90  
  91  * Dynamic object information:
  92  
  93    Typing ?word or word? prints detailed information about an object. Certain
  94    long strings (code, etc.) get snipped in the center for brevity.
  95  
  96    Typing ??word or word?? gives access to the full information without
  97    snipping long strings. Strings that are longer than the screen are printed
  98    through the less pager.
  99  
 100    The ?/?? system gives access to the full source code for any object (if
 101    available), shows function prototypes and other useful information.
 102  
 103    If you just want to see an object's docstring, type '%pdoc object' (without
 104    quotes, and without % if you have automagic on).
 105  
 106  * Tab completion in the local namespace:
 107  
 108    At any time, hitting tab will complete any available python commands or
 109    variable names, and show you a list of the possible completions if there's
 110    no unambiguous one. It will also complete filenames in the current directory.
 111  
 112  * Search previous command history in multiple ways:
 113  
 114    - Start typing, and then use arrow keys up/down or (Ctrl-p/Ctrl-n) to search
 115      through the history items that match what you've typed so far.
 116  
 117    - Hit Ctrl-r: opens a search prompt. Begin typing and the system searches
 118      your history for lines that match what you've typed so far, completing as
 119      much as it can.
 120  
 121    - %hist: search history by index.
 122  
 123  * Persistent command history across sessions.
 124  
 125  * Logging of input with the ability to save and restore a working session.
 126  
 127  * System shell with !. Typing !ls will run 'ls' in the current directory.
 128  
 129  * The reload command does a 'deep' reload of a module: changes made to the
 130    module since you imported will actually be available without having to exit.
 131  
 132  * Verbose and colored exception traceback printouts. See the magic xmode and
 133    xcolor functions for details (just type %magic).
 134  
 135  * Input caching system:
 136  
 137    IPython offers numbered prompts (In/Out) with input and output caching. All
 138    input is saved and can be retrieved as variables (besides the usual arrow
 139    key recall).
 140  
 141    The following GLOBAL variables always exist (so don't overwrite them!):
 142    _i: stores previous input.
 143    _ii: next previous.
 144    _iii: next-next previous.
 145    _ih : a list of all input _ih[n] is the input from line n.
 146  
 147    Additionally, global variables named _i<n> are dynamically created (<n>
 148    being the prompt counter), such that _i<n> == _ih[<n>]
 149  
 150    For example, what you typed at prompt 14 is available as _i14 and _ih[14].
 151  
 152    You can create macros which contain multiple input lines from this history,
 153    for later re-execution, with the %macro function.
 154  
 155    The history function %hist allows you to see any part of your input history
 156    by printing a range of the _i variables. Note that inputs which contain
 157    magic functions (%) appear in the history with a prepended comment. This is
 158    because they aren't really valid Python code, so you can't exec them.
 159  
 160  * Output caching system:
 161  
 162    For output that is returned from actions, a system similar to the input
 163    cache exists but using _ instead of _i. Only actions that produce a result
 164    (NOT assignments, for example) are cached. If you are familiar with
 165    Mathematica, IPython's _ variables behave exactly like Mathematica's %
 166    variables.
 167  
 168    The following GLOBAL variables always exist (so don't overwrite them!):
 169    _ (one underscore): previous output.
 170    __ (two underscores): next previous.
 171    ___ (three underscores): next-next previous.
 172  
 173    Global variables named _<n> are dynamically created (<n> being the prompt
 174    counter), such that the result of output <n> is always available as _<n>.
 175  
 176    Finally, a global dictionary named _oh exists with entries for all lines
 177    which generated output.
 178  
 179  * Directory history:
 180  
 181    Your history of visited directories is kept in the global list _dh, and the
 182    magic %cd command can be used to go to any entry in that list.
 183  
 184  * Auto-parentheses and auto-quotes (adapted from Nathan Gray's LazyPython)
 185  
 186    1. Auto-parentheses
 187          
 188       Callable objects (i.e. functions, methods, etc) can be invoked like
 189       this (notice the commas between the arguments)::
 190         
 191           In [1]: callable_ob arg1, arg2, arg3
 192         
 193       and the input will be translated to this::
 194         
 195           callable_ob(arg1, arg2, arg3)
 196         
 197       This feature is off by default (in rare cases it can produce
 198       undesirable side-effects), but you can activate it at the command-line
 199       by starting IPython with `--autocall 1`, set it permanently in your
 200       configuration file, or turn on at runtime with `%autocall 1`.
 201  
 202       You can force auto-parentheses by using '/' as the first character
 203       of a line.  For example::
 204         
 205            In [1]: /globals             # becomes 'globals()'
 206         
 207       Note that the '/' MUST be the first character on the line!  This
 208       won't work::
 209         
 210            In [2]: print /globals    # syntax error
 211  
 212       In most cases the automatic algorithm should work, so you should
 213       rarely need to explicitly invoke /. One notable exception is if you
 214       are trying to call a function with a list of tuples as arguments (the
 215       parenthesis will confuse IPython)::
 216         
 217            In [1]: zip (1,2,3),(4,5,6)  # won't work
 218         
 219       but this will work::
 220         
 221            In [2]: /zip (1,2,3),(4,5,6)
 222            ------> zip ((1,2,3),(4,5,6))
 223            Out[2]= [(1, 4), (2, 5), (3, 6)]
 224  
 225       IPython tells you that it has altered your command line by
 226       displaying the new command line preceded by -->.  e.g.::
 227         
 228            In [18]: callable list
 229            -------> callable (list)
 230  
 231    2. Auto-Quoting
 232      
 233       You can force auto-quoting of a function's arguments by using ',' as
 234       the first character of a line.  For example::
 235         
 236            In [1]: ,my_function /home/me   # becomes my_function("/home/me")
 237  
 238       If you use ';' instead, the whole argument is quoted as a single
 239       string (while ',' splits on whitespace)::
 240         
 241            In [2]: ,my_function a b c   # becomes my_function("a","b","c")
 242            In [3]: ;my_function a b c   # becomes my_function("a b c")
 243  
 244       Note that the ',' MUST be the first character on the line!  This
 245       won't work::
 246         
 247            In [4]: x = ,my_function /home/me    # syntax error
 248  azAn enhanced console for Python.
 249  Some of its features are:
 250  - Tab completion in the local namespace.
 251  - Logging of input, see command-line options.
 252  - System shell escape via ! , eg !ls.
 253  - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
 254  - Keeps track of locally defined variables via %who, %whos.
 255  - Show object information with a ? eg ?x or x? (use ?? for more info).
 256  ay
 257  
 258  IPython -- An enhanced Interactive Python - Quick Reference Card
 259  ================================================================
 260  
 261  obj?, obj??      : Get help, or more help for object (also works as
 262                     ?obj, ??obj).
 263  ?foo.*abc*       : List names in 'foo' containing 'abc' in them.
 264  %magic           : Information about IPython's 'magic' % functions.
 265  
 266  Magic functions are prefixed by % or %%, and typically take their arguments
 267  without parentheses, quotes or even commas for convenience.  Line magics take a
 268  single % and cell magics are prefixed with two %%.
 269  
 270  Example magic function calls:
 271  
 272  %alias d ls -F   : 'd' is now an alias for 'ls -F'
 273  alias d ls -F    : Works if 'alias' not a python name
 274  alist = %alias   : Get list of aliases to 'alist'
 275  cd /usr/share    : Obvious. cd -<tab> to choose from visited dirs.
 276  %cd??            : See help AND source for magic %cd
 277  %timeit x=10     : time the 'x=10' statement with high precision.
 278  %%timeit x=2**100
 279  x**100           : time 'x**100' with a setup of 'x=2**100'; setup code is not
 280                     counted.  This is an example of a cell magic.
 281  
 282  System commands:
 283  
 284  !cp a.txt b/     : System command escape, calls os.system()
 285  cp a.txt b/      : after %rehashx, most system commands work without !
 286  cp ${f}.txt $bar : Variable expansion in magics and system commands
 287  files = !ls /usr : Capture system command output
 288  files.s, files.l, files.n: "a b c", ['a','b','c'], 'a\nb\nc'
 289  
 290  History:
 291  
 292  _i, _ii, _iii    : Previous, next previous, next next previous input
 293  _i4, _ih[2:5]    : Input history line 4, lines 2-4
 294  exec(_i81)       : Execute input history line #81 again
 295  %rep 81          : Edit input history line #81
 296  _, __, ___       : previous, next previous, next next previous output
 297  _dh              : Directory history
 298  _oh              : Output history
 299  %hist            : Command history of current session.
 300  %hist -g foo     : Search command history of (almost) all sessions for 'foo'.
 301  %hist -g         : Command history of (almost) all sessions.
 302  %hist 1/2-8      : Command history containing lines 2-8 of session 1.
 303  %hist 1/ ~2/     : Command history of session 1 and 2 sessions before current.
 304  %hist ~8/1-~6/5  : Command history from line 1 of 8 sessions ago to
 305                     line 5 of 6 sessions ago.
 306  %edit 0/         : Open editor to execute code with history of current session.
 307  
 308  Autocall:
 309  
 310  f 1,2            : f(1,2)  # Off by default, enable with %autocall magic.
 311  /f 1,2           : f(1,2) (forced autoparen)
 312  ,f 1 2           : f("1","2")
 313  ;f 1 2           : f("1 2")
 314  
 315  Remember: TAB completion works in many contexts, not just file names
 316  or python names.
 317  
 318  The following magic functions are currently available:
 319  
 320  z
 321  Python %s
 322  �
 323  z>Type 'copyright', 'credits' or 'license' for more information
 324  zHIPython {version} -- An enhanced Interactive Python. Type '?' for help.
 325  )�version�)�__doc__�sysZIPython.corerZcl_usageZinteractive_usageZinteractive_usage_minZquick_referencer�split�formatZdefault_banner_parts�joinZdefault_banner�rr�Hc:\Users\shubh\Videos\agent\nova\Lib\site-packages\IPython/core/usage.py�<module>s
 326  3CA�