Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
code.cpython-314.pyc192 linesDownload Raw Back to __pycache__
1+
2��i�4���Rt^RIt^RIt^RIt^RIHtHt.ROt!RR4t!RR]4t	!RR4t3RR	lt]R48Xdy^RI
t
]
P!RR7t]P!R
RRR7]P#4t]P&'g]P(P*'dRtMRt]!]4R#R#)z?Utilities needed to emulate Python's interactive interpreter.5 6N)�CommandCompiler�compile_command�InteractiveInterpreter�InteractiveConsolec�`a�]tRt^toRtRRltR
RltRtRRltRt	Rt7R	tR8tRt
VtR#)rz�Base class for InteractiveConsole.9 10This class deals with parsing and interpreter state (the user's11namespace); it doesn't deal with input buffering or prompting or12input file naming (the filename is always passed in explicitly).13 14Nc�D�VfRRRR/pWn\4VnR#)z�Constructor.15 16The optional 'locals' argument specifies a mapping to use as the17namespace in which code will be executed; it defaults to a newly18created dictionary with key "__name__" set to "__console__" and19key "__doc__" set to None.20 21N�__name__�__console__�__doc__)�localsr�compile)�selfrs&&�Lib\code.py�__init__�InteractiveInterpreter.__init__s&���>� �-��D�A�F���&�(���c��VPWV4pTfR#TPT4R# \\\3dTP	Y!R7R#i;i)aCompile and run some source in the interpreter.22 23Arguments are as for compile_command().24 25One of several things can happen:26 271) The input is incorrect; compile_command() raised an28exception (SyntaxError or OverflowError).  A syntax traceback29will be printed by calling the showsyntaxerror() method.30 312) The input is incomplete, and more input is required;32compile_command() returned None.  Nothing happens.33 343) The input is complete; compile_command() returned a code35object.  The code is executed by calling self.runcode() (which36also handles run-time exceptions, except for SystemExit).37 38The return value is True in case 2, False in the other cases (unless39an exception is raised).  The return value can be used to40decide whether to use sys.ps1 or sys.ps2 to prompt the next41line.42 43)�sourceFT)r�
OverflowError�SyntaxError�44ValueError�showsyntaxerror�runcode)r
r�filename�symbol�codes&&&& r�	runsource� InteractiveInterpreter.runsource's^��0	��<�<��&�9�D��<��	
���T�����{�J�7�	�� � �� �9��	�s�-�(A�Ac�x�\WP4R# \dhTP4R#;i)aKExecute a code object.45 46When an exception occurs, self.showtraceback() is called to47display a traceback.  All exceptions are caught except48SystemExit, which is reraised.49 50A note about KeyboardInterrupt: this exception may occur51elsewhere in this code, and may not always be caught.  The52caller should be prepared to deal with it.53 54N)�execr�55SystemExit�
showtraceback�r
rs&&rr�InteractiveInterpreter.runcodeNs1��	!���{�{�#���	��	!���� �s��9c���\P!4wr4pV'd\V\4'dWnVPRR4pVP
W4RV4R;p;rER# R;p;rEi;i)a@Display the syntax error that just occurred.56 57This doesn't display a stack trace because there isn't one.58 59If a filename is given, it is stuffed in the exception instead60of what was there before (because Python's parser always uses61"<string>" when reading from a string).62 63The output is written by self.write(), below.64 65r�N)�sys�exc_info�66issubclassrr�pop�_showtraceback)r
r�kwargs�typ�value�tbrs&&,    rr�&InteractiveInterpreter.showsyntaxerrorask��	$� �\�\�^�N�C���J�s�K�8�8�!)���Z�Z��"�-�F�����D�&�9�#�#�C�#�%�"��t�#�C�#�%�"�s�A!A*�*A1c��\P!4wrpVPWVPR4R;p;r#R# R;p;r#i;i)z�Display the exception that just occurred.67 68We remove the first stack item because it is our own code.69 70The output is written by self.write(), below.71 72r%N)r&r'r*�tb_next)r
r,r-r.s&   rr!�$InteractiveInterpreter.showtracebackvsK��	$� �\�\�^�N�C������B�J�J��;�#�#�C�#�%�"��t�#�C�#�%�"�s	�5>�Ac���V\nV\nVPV4pVP	4pV'dcV\73JdYVP'gGVPe9\V4VP8�dWRP^,74,VnV;\n	\n75\P\PJdVPWV4R#\P!WV4R# \dh\d�pRTnTPTP"P$4p\'R\P(R7\P!\+T4YfP"4\'\P(R7\'R\P(R7\P!YT4Rp?R#Rp?ii;i)NzError in sys.excepthook:)�filezOriginal exception was:)r&�	last_type�last_traceback�with_traceback�76splitlinesr�text�lineno�len�last_exc�77last_value�78excepthook�__excepthook__�_excepthookr �
BaseException�__context__�
__traceback__r1�print�stderr�type)r
r,r-r.r�lines�es&&&&&  rr*�%InteractiveInterpreter._showtraceback�sB����
�����$�$�R�(���!�!�#���s�k�)��79�80�81�u�|�|�'?���J�%�,�,�.��|�|�a�/�0�E�J�(-�-���s�~��>�>�S�/�/�/����S��,�
3����s�2�.���
�� �
3� $��
��$�$�Q�_�_�%<�%<�=���0�s�z�z�B��"�"�4��7�A���?��3�:�:�&��/�c�j�j�A��"�"�3�r�2�2��
3�s�/D�G&�G&�B=G!�!G&c�t�\P!WV4pVPRPV44R#)r%N)�	traceback�format_exception�write�join)r
r,r-r.rGs&&&& rr@�"InteractiveInterpreter._excepthook�s*���*�*�3�r�:���82�83�2�7�7�5�>�"rc�D�\PPV4R#)z}Write a string.84 85The base implementation writes to sys.stderr; a subclass may86replace this with a different implementation.87 88N)r&rErM)r
�datas&&rrM�InteractiveInterpreter.write�s��	�89�90����r)rr�N)z<input>�single)r�91__module__�__qualname__�__firstlineno__r92rrrrr!r*r@rM�__static_attributes__�__classdictcell__��
__classdict__s@rrrs8�����)�%�N!�&$�*$�3�:#��rc�Za�]tRt^�toRtRRR/RlltRtRRltR
RltRR	lt	R93t94VtR#)rz�Closely emulate the behavior of the interactive Python interpreter.95 96This class builds on InteractiveInterpreter and adds prompting97using the familiar sys.ps1 and sys.ps2, and input buffering.98 99N�100local_exitFc�h�\PW4W nW0nVP	4R#)z�Constructor.101 102The optional locals argument will be passed to the103InteractiveInterpreter base class.104 105The optional filename argument should specify the (file)name106of the input stream; it will show up in tracebacks.107 108N)rrrr]�resetbuffer)r
rrr]s&&&$rr�InteractiveConsole.__init__�s(��	�'�'��5� �
�$�����rc��.VnR#)zReset the input buffer.N)�buffer�r
s&rr_�InteractiveConsole.resetbuffer�s	����rc���\PRp\PpRpRpVfTVP	R\P109:R\P:R	V:R110VPP:R2	4M)V'd"VP	R\V4,4^pRpRp	VP'du\\R
4'd%\Pp\R
4\n
\\R4'd%\Pp	\R4\nV'd\Pp111M\Pp112VP!V1134pVP#V4pKP \dR\nRpEL�i;i \dR\nRpEL�i;i \$dTP	R	4Mqi;i \&d(TP	R4TP)4^pK�\*d0pTP'dTP	R	4Rp?M114ThRp?ii;iTeT\n
T	eT	\nT'd\=T'd\=Tf/TP	RTPP,4R#TR8wdTP	RT,4R#R# TeT\n
T	eT	\nT'd\=T'd\=Tf.TP	RTPP,4iTR8wdTP	RT,4ii;i)a0Closely emulate the interactive Python console.115 116The optional banner argument specifies the banner to print117before the first interaction; by default it prints a banner118similar to the one printed by the real Python interpreter,119followed by the current class name in parentheses (so as not120to confuse this with the real interpreter -- since it's so121close!).122 123The optional exitmsg argument specifies the exit message124printed when exiting. Pass the empty string to suppress125printing an exit message. If exitmsg is not given or None,126a default message is printed.127 128Fz>>> Tz... zFType "help", "copyright", "credits" or "license" for more information.NzPython z on �129z130(z)131z%s132�exit�quitz133KeyboardInterrupt134znow exiting %s...135r%)r&�ps1�AttributeError�ps2rM�version�platform�	__class__r�strr]�hasattr�builtinsrg�Quitterrh�	raw_input�push�EOFError�KeyboardInterruptr_r )
r
�banner�exitmsg�delete_ps1_after�_ps2�delete_ps2_after�cprt�more�_exit�_quit�prompt�linerHs
&&&          r�interact�InteractiveConsole.interact�s��� 	$��G�G�$��	$��7�7�D�$��136X���>��J�J����S�\�\�4����/�/�1�
2���J�J�v��F��+�,��������?�?�?��x��(�(� �
�
�� '����
��x��(�(� �
�
�� '����
�)	-�� ��!$����!$����/�#�~�~�f�5��137 $�y�y�����k�	$��C�G�#��	$���	$��C�G�#��	$��V$���138�139�4�(����140)���J�J�6�7��$�$�&��D�!� ������141�142�4�(����� ��� � %��
�� � %��
���G���G����143�144�0�4�>�>�3J�3J�J�K��B���145�146�6�G�+�,���� � %��
�� � %��
���G���G����147�148�0�4�>�>�3J�3J�J�K��B���149�150�6�G�+�,��s��F�F%�6K"�8G&�!G&�"G�3G&�K"�F"�!F"�%G�G�G#� G&�!K"�"G#�#G&�&.I�K"�I� I�!#I�K"�	I�I�K"�"&M/�	
M/�AM/c���VPPV4RPVP4pVf
VPpVP	WBVR7pV'gVP4V#)a/Push a line to the interpreter.151 152The line should not have a trailing newline; it may have153internal newlines.  The line is appended to a buffer and the154interpreter's runsource() method is called with the155concatenated contents of the buffer as source.  If this156indicates that the command was executed or invalid, the buffer157is reset; otherwise, the command is incomplete, and the buffer158is left as it was after the line was appended.  The return159value is 1 if more input is required, 0 if the line was dealt160with in some way (this is the same as runsource()).161 162rf)r)rb�appendrNrrr_)r
r�r�_symbolrr}s&&&&  rrt�InteractiveConsole.push2s]��	
�����4� ����4�;�;�'�����}�}�H��~�~�f�w�~�?��������rc��\V4#)aWrite a prompt and read a line.163 164The returned line does not include the trailing newline.165When the user enters the EOF key sequence, EOFError is raised.166 167The base implementation uses the built-in function168input(); a subclass may replace this with a different169implementation.170 171)�input)r
r�s&&rrs�InteractiveConsole.raw_inputIs���V�}�r)rbrr])Nz	<console>)NN)NrT)r%)rrUrVrWr172rr_r�rtrsrXrYrZs@rrr�s1�����
��
��d-�L�.�rc�6a�]tRtRtoRtRtRRltRtVtR#)rriWc�\�Wn\PR8Xd173RVnR#RVnR#)�win32zCtrl-Z plus ReturnzCtrl-D (i.e. EOF)N)�namer&rm�eof)r
r�s&&rr�Quitter.__init__Xs!���	��<�<�7�"�+�D�H�*�D�Hrc�<�RVPRVPR2#)zUse z or z to exit)r�r�rcs&r�__repr__�Quitter.__repr___s���d�i�i�[��T�X�X�J�h�7�7rNc��\V4hrS)r r"s&&r�__call__�Quitter.__call__bs
�����r)r�r�rS)	rrUrVrWrr�r�rXrYrZs@rrrrrWs����+�8��rrrc��\W$R7pVeWnM^RIpVP	W4R# \dL i;i)a8Closely emulate the interactive Python interpreter.174 175This is a backwards compatible interface to the InteractiveConsole176class.  When readfunc is not specified, it attempts to import the177readline module to enable GNU readline if it is available.178 179Arguments (all optional, all default to None):180 181banner -- passed to InteractiveConsole.interact()182readfunc -- if not None, replaces InteractiveConsole.raw_input()183local -- passed to InteractiveInterpreter.__init__()184exitmsg -- passed to InteractiveConsole.interact()185local_exit -- passed to InteractiveConsole.__init__()186 187)r]N)rrs�readline�ImportErrorr�)rw�readfunc�localrxr]�consoler�s&&&&&  rr�r�fsF�� !��>�G���$��	�����V�%���	��	�s�0�>�>�__main__T)�colorz-q�188store_truez*don't print version and copyright messages)�action�helpr%)rrr�r)NNNNF)r189rqr&rK�codeoprr�__all__rrrrr�r�argparse�ArgumentParser�parser�add_argument�190parse_args�args�q�flags�quietrw�rr�<module>r�s�����191��3���^�^�Bc�/�c�L��&�6�z���
�
$�
$�4�
0�F�192����\�H��J�����D��v�v�v������������V��r
codekingpro/portable-devtools · Team Ai