Your IP : 18.118.144.50
U
e5d~) � @ s� d Z ddlZddlZddlmZmZ ddddgZG dd� d�ZG d d� de�Zdd
d�Z e
dkr�ddlZe�� Z
e
jdd
dd� e
�� Zejs�ejjr�dZndZe e� dS )z?Utilities needed to emulate Python's interactive interpreter.
� N)�CommandCompiler�compile_command�InteractiveInterpreter�InteractiveConsole�interactr c @ sF e Zd ZdZddd�Zddd�Zd d
� Zddd�Zd
d� Zdd� Z dS )r z�Base class for InteractiveConsole.
This class deals with parsing and interpreter state (the user's
namespace); it doesn't deal with input buffering or prompting or
input file naming (the filename is always passed in explicitly).
Nc C s$ |dkrddd�}|| _ t� | _dS )a Constructor.
The optional 'locals' argument specifies the dictionary in
which code will be executed; it defaults to a newly created
dictionary with key "__name__" set to "__console__" and key
"__doc__" set to None.
NZ__console__)�__name__�__doc__)�localsr �compile)�selfr � r �/usr/lib64/python3.8/code.py�__init__ s
zInteractiveInterpreter.__init__�<input>�singlec
C sT z| � |||�}W n& tttfk
r8 | �|� Y dS X |dkrFdS | �|� dS )a� Compile and run some source in the interpreter.
Arguments are as for compile_command().
One of several things can happen:
1) The input is incorrect; compile_command() raised an
exception (SyntaxError or OverflowError). A syntax traceback
will be printed by calling the showsyntaxerror() method.
2) The input is incomplete, and more input is required;
compile_command() returned None. Nothing happens.
3) The input is complete; compile_command() returned a code
object. The code is executed by calling self.runcode() (which
also handles run-time exceptions, except for SystemExit).
The return value is True in case 2, False in the other cases (unless
an exception is raised). The return value can be used to
decide whether to use sys.ps1 or sys.ps2 to prompt the next
line.
FNT)r
�
OverflowError�SyntaxError�
ValueError�showsyntaxerror�runcode)r �source�filenameZsymbol�coder r r
� runsource&