Format: application/x-python-code
1 o
2
3 ��h�q � @ s� d Z ddlmZ ddlmZ ede� ddlZddlZddlZddl Z ddl
4 Z
5 ddlZddlZddlm
6 Z
7 mZmZmZmZ ddlmZ ddlmZmZmZmZmZmZmZmZmZmZ dd lm Z dd
8 lm!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z* er�ddl+m,Z, e �-d�.g d
9 ���Z/e �-d�Z0e �-d�Z1dd� Z2ej3Z4ej3d Z5G dd� d�Z6G dd� d�Z7dd� Z8d+dd�Z9dd� Z:e �-de j;�Z<e �-d e j;�Z=d!d"� Z>d#d$� Z?d%d&� Z@G d'd(� d(eA�ZBG d)d*� d*eB�ZCdS ),a6 DEPRECATED: Input handling and transformation machinery.
10
11 This module was deprecated in IPython 7.0, in favour of inputtransformer2.
12
13 The first class in this module, :class:`InputSplitter`, is designed to tell when
14 input from a line-oriented frontend is complete and should be executed, and when
15 the user should be prompted for another line of code instead. The name 'input
16 splitter' is largely for historical reasons.
17
18 A companion, :class:`IPythonInputSplitter`, provides the same functionality but
19 with full support for the extended IPython syntax (magics, system calls, etc).
20 The code to actually do these transformations is in :mod:`IPython.core.inputtransformer`.
21 :class:`IPythonInputSplitter` feeds the raw code to the transformers in order
22 and stores the results.
23
24 For more details, see the class docstrings below.
25 � )�annotations)�warnzeIPython.core.inputsplitter is deprecated since IPython 7 in favor of `IPython.core.inputtransformer2`N)�List�Tuple�Union�Optional�
26 TYPE_CHECKING)�CodeType)
27 �leading_indent�classic_prompt�
28 ipy_prompt� cellmagic�assemble_logical_lines�help_end�escaped_commands�assign_from_magic�assign_from_system�assemble_python_lines)� tokenutil)
29 � ESC_SHELL�
30 ESC_SH_CAP�ESC_HELP� ESC_HELP2� ESC_MAGIC�
31 ESC_MAGIC2� ESC_QUOTE�
32 ESC_QUOTE2� ESC_PAREN�
33 ESC_SEQUENCES)�Self�|)z^\s+raise(\s.*)?$z^\s+raise\([^\)]*\).*$z^\s+return(\s.*)?$z^\s+return\([^\)]*\).*$z^\s+pass\s*$z
34 ^\s+break\s*$z^\s+continue\s*$z^([ \t\r\f\v]+)z^\s*\#c C s* t jddtd� t�| �}|r|�� S dS )a Return the number of initial spaces in a string.
35
36 Note that tabs are counted as a single space. For now, we do *not* support
37 mixing of tabs and spaces in the user's input.
38
39 Parameters
40 ----------
41 s : string
42
43 Returns
44 -------
45 n : int
46 z�`num_ini_spaces` is Pending Deprecation since IPython 8.17.It is considered for removal in in future version. Please open an issue if you believe it should be kept.� )�
47 stacklevel�categoryr )�warningsr �PendingDeprecationWarning�
48 ini_spaces_re�match�end)�sZ
49 ini_spaces� r* �Pc:\Users\shubh\Videos\agent\nova\Lib\site-packages\IPython/core/inputsplitter.py�num_ini_spacesU s �
50 r, � c @ � e Zd Ze ZZdd� ZdS )�IncompleteStringc C s || _ || _|| _|| _d S �N�r) �startr( �line)�selfr) r2 r( r3 r* r* r+ �__init__x s
51 zIncompleteString.__init__N)�__name__�
52 __module__�__qualname__�INCOMPLETE_STRING�type�
53 exact_typer5 r* r* r* r+ r/ v � r/ c @ r. )�InMultilineStatementc C s d| _ | | _| _|| _d S �N� r1 )r4 �posr3 r* r* r+ r5 � s
54 zInMultilineStatement.__init__N)r6 r7 r8 �IN_MULTILINE_STATEMENTr: r; r5 r* r* r* r+ r= ~ r<