
    ^h                         S r SSKrSSKrSSKJr  SSKJr  SSKJr  \R                  " S\R                  5      rS
S jr " S S	\5      rg)z
Simple utility for splitting user input. This is used by both inputsplitter and
prefilter.

Authors:

* Brian Granger
* Fernando Perez
    N)	py3compat)get_stream_enc)OInfoaV  
             ^(\s*)               # any leading space
             ([,;/%]|!!?|\?\??)?  # escape character or characters
             \s*(%{0,2}[\w\.\*]*)     # function/method, possibly with leading %
                                  # to correctly treat things like '?%magic'
             (.*?$|$)             # rest of line
             c                    [        [        R                  S5      n[        R                  " X5      n Uc  [
        nUR                  U 5      nU(       d@   U R                  SS5      u  pE[        R                  " SU 5      R                  5       S   nSnOUR                  5       u  pgpEXg=(       d    SUR                  5       UR                  5       4$ ! [         a    U SpT Nwf = f)zXSplit user input into initial whitespace, escape character, function part
and the rest.
zutf-8N    z
^(\s*)(.*)r   )r   sysstdinr   cast_unicode
line_splitmatchsplit
ValueErrorregroupsstriplstrip)linepatternencodingr   ifunthe_restpreescs           Q/home/james-whalen/.local/lib/python3.13/site-packages/IPython/core/splitinput.pysplit_user_inputr   6   s    
 cii1H!!$1DMM$E	'!ZZQ/ND hh}T*113A6#(<<> $ 	r4::<):::  	'!3(	's   C CCc                   6    \ rS rSrSrS	S jrS\4S jrS rSr	g)
LineInfoR   a  A single line of input and associated info.

Includes the following as properties:

line
  The original, raw line

continue_prompt
  Is this line a continuation in a sequence of multiline input?

pre
  Any leading whitespace.

esc
  The escape character(s) in pre or the empty string if there isn't one.
  Note that '!!' and '??' are possible values for esc. Otherwise it will
  always be a single character.

ifun
  The 'function part', which is basically the maximal initial sequence
  of valid python identifiers and the '.' character. This is what is
  checked for alias and magic transformations, used for auto-calling,
  etc. In contrast to Python identifiers, it may start with "%" and contain
  "*".

the_rest
  Everything else on the line.
c                     Xl         X l        [        U5      u  U l        U l        U l        U l        U R                  R                  5       U l        U R                  (       a  SU l	        g U R                  U l	        g )Nr   )
r   continue_promptr   r   r   r   r   r   pre_charpre_whitespace)selfr   r!   s      r   __init__LineInfo.__init__o   sU    #	.7G7M4$(DIt}"hhnn.=="$D"&((D    returnc                 8    UR                  U R                  5      $ )a  Do a full, attribute-walking lookup of the ifun in the various
namespaces for the given IPython InteractiveShell instance.

Return a dict with keys: {found, obj, ospace, ismagic}

Note: can cause state changes because of calling getattr, but should
only be run if autocall is on and if the line hasn't matched any
other, less dangerous handlers.

Does cache the results of the call, so can be called multiple times
without worrying about *further* damaging state.
)_ofindr   )r$   ips     r   ofindLineInfo.ofindz   s     yy##r'   c           	      x    SU R                   < SU R                  < SU R                  < SU R                  < S3	$ )Nz
LineInfo [|])r   r   r   r   )r$   s    r   __str__LineInfo.__str__   s!    *.((DHHdiiWWr'   )r!   r   r   r   r   r"   r#   r   N)F)
__name__
__module____qualname____firstlineno____doc__r%   r   r,   r1   __static_attributes__ r'   r   r   r   R   s    8	+$5 $Xr'   r   )N)r7   r   r	   IPython.utilsr   IPython.utils.encodingr   IPython.core.oinspectr   compileVERBOSEr   r   objectr   r9   r'   r   <module>r@      sL   * 
 
 # 1 '" ZZ  **
;88Xv 8Xr'   