Format: application/x-python-code
⬇ Download File (3.8 KB)
   1  o
   2  
   3  ��h��@sddZddlZddlZddlmZddlmZddlmZe�	dej
   4  �Zddd�ZGd	d
   5  �d
   6  e
   7  �ZdS)z�
   8  Simple utility for splitting user input. This is used by both inputsplitter and
   9  prefilter.
  10  
  11  Authors:
  12  
  13  * Brian Granger
  14  * Fernando Perez
  15  �N)�	py3compat)�get_stream_enc)�OInfoaV
  16               ^(\s*)               # any leading space
  17               ([,;/%]|!!?|\?\??)?  # escape character or characters
  18               \s*(%{0,2}[\w\.\*]*)     # function/method, possibly with leading %
  19                                    # to correctly treat things like '?%magic'
  20               (.*?$|$)             # rest of line
  21               cCs�ttjd�}t�||�}|durt}|�|�}|s?z
  22  |�dd�\}}Wnty1|d}}Ynwt	�d|��
  23  �d}d}n|�
  24  �\}}}}||pKd|��|fS)z`Split user input into initial whitespace, escape character, function part
  25      and the rest.
  26      zutf-8N��z
  27  ^(\s*)(.*)r)r�sys�stdinrZcast_unicode�
  28  line_split�match�split�
  29  ValueError�re�groups�strip)�line�pattern�encodingr
  30  �ifun�the_rest�pre�esc�r�Mc:\Users\shubh\Videos\agent\nova\Lib\site-packages\IPython/core/splitinput.py�split_user_input6s
  31  �rc@s8eZdZdZd
  32  dd�Zdefdd�Zdd	�Zd
  33  d�ZdS)�LineInfoa{A single line of input and associated info.
  34  
  35      Includes the following as properties:
  36  
  37      line
  38        The original, raw line
  39  
  40      continue_prompt
  41        Is this line a continuation in a sequence of multiline input?
  42  
  43      pre
  44        Any leading whitespace.
  45  
  46      esc
  47        The escape character(s) in pre or the empty string if there isn't one.
  48        Note that '!!' and '??' are possible values for esc. Otherwise it will
  49        always be a single character.
  50  
  51      ifun
  52        The 'function part', which is basically the maximal initial sequence
  53        of valid python identifiers and the '.' character. This is what is
  54        checked for alias and magic transformations, used for auto-calling,
  55        etc. In contrast to Python identifiers, it may start with "%" and contain
  56        "*".
  57  
  58      the_rest
  59        Everything else on the line.
  60  
  61      raw_the_rest
  62        the_rest without whitespace stripped.
  63      FcCsX||_||_t|�\|_|_|_|_|j��|_|j�	�|_
  64  |j
  65  r&d|_dS|j|_dS)Nr)r�continue_promptrrrrZraw_the_rest�lstriprrZpre_charZpre_whitespace)�selfrrrrr�__init__rs
  66  zLineInfo.__init__�returncCs|�|j�S)aDo a full, attribute-walking lookup of the ifun in the various
  67          namespaces for the given IPython InteractiveShell instance.
  68  
  69          Return a dict with keys: {found, obj, ospace, ismagic}
  70  
  71          Note: can cause state changes because of calling getattr, but should
  72          only be run if autocall is on and if the line hasn't matched any
  73          other, less dangerous handlers.
  74  
  75          Does cache the results of the call, so can be called multiple times
  76          without worrying about *further* damaging state.
  77          )Z_ofindr)r�iprrr�ofind~s
  78  zLineInfo.ofindcCsd|j|j|j|jfS)NzLineInfo [%s|%s|%s|%s])rrrr�rrrr�__str__�szLineInfo.__str__cCsdt|�dS)N�<�>)�strr"rrr�__repr__�szLineInfo.__repr__N)F)	�__name__�
  79  __module__�__qualname__�__doc__rrr!r#r'rrrrrRs
  80  r)N)r+r
  81  rZ
  82  IPython.utilsrZIPython.utils.encodingrZIPython.core.oinspectr�compile�VERBOSEr	r�objectrrrrr�<module>s�
  83