QfdZddlZddlZejDcgc] }ee| c}ZgdZdZdZdZ dZ ddZ dd Z Gd d Z Gd d Zycc}w)aAUtilities to compile possibly incomplete Python source code. This module provides two interfaces, broadly similar to the builtin function compile(), which take program text, a filename and a 'mode' and: - Return code object if the command is complete and valid - Return None if the command is incomplete - Raise SyntaxError, ValueError or OverflowError if the command is a syntax error (OverflowError and ValueError can be produced by malformed literals). The two interfaces are: compile_command(source, filename, symbol): Compiles a single command in the manner described above. CommandCompiler(): Instances of this class have __call__ methods identical in signature to compile_command; the difference is that if the instance compiles program text containing a __future__ statement, the instance 'remembers' and compiles all subsequent program texts with the statement in force. The module also provides another class: Compile(): Instances of this class act like the built-in function compile, but with 'memory' in the sense described above. N)compile_commandCompileCommandCompilerii@c|jdD]}|j}|s|ddk7sn|dk7rd}tj5tjdt t f ||||ddd||||d S#t$rL ||dz||Ydddy#t$r%}dt|vrYd}~YdddyYd}~nd}~wwxYwYhwxYw#1swYmxYw) N r#evalpassignorezincomplete inputF)incomplete_input) splitstripwarningscatch_warnings simplefilter SyntaxWarningDeprecationWarning SyntaxErrorstr)compilersourcefilenamesymbollinees -/opt/alt/python312/lib64/python3.12/codeop.py_maybe_compiler1s T"zz| DGsN # V F  "h8J(KL VXv . # FHfu EE  $&9    %Q/   0 /  # "s`!C'1 B C$ B0&C'0 C9 CC$ C'C$CC$!C'#C$$C''C0cNt|}t|}d|vrd|vry||k(ryy)Nzwas never closedFT)repr)err1err2rep1rep2s r_is_syntax_errorr$Ks4 :D :DT!&8D&@ t| cJd}|r|tz}|tz}t||||S)Nr)PyCF_ALLOW_INCOMPLETE_INPUTPyCF_DONT_IMPLY_DEDENTcompile)rrrr flagss r_compiler+Ts1 E ,, '' 68VU 33r%c&tt|||S)aCompile a command and determine whether it is incomplete. Arguments: source -- the source string; may contain \n characters filename -- optional filename from which source was read; default "" symbol -- optional grammar start symbol; "single" (default), "exec" or "eval" Return value / exceptions raised: - Return a code object if the command is complete and valid - Return None if the command is incomplete - Raise SyntaxError, ValueError or OverflowError if the command is a syntax error (OverflowError and ValueError can be produced by malformed literals). )rr+)rrrs rrr\s& (FHf ==r%ceZdZdZdZdZy)rzInstances of this class behave much like the built-in compile function, but if one is used to compile text containing a future statement, it "remembers" and compiles all subsequent program texts with the statement in force.c(ttz|_yN)r(r'r*selfs r__init__zCompile.__init__vs+.II r%c |j}|jdddur|tz}|tz}t ||||d}t D];}|j |jzs|xj|jzc_=|S)Nr TF)r*getr(r'r) _featuresco_flags compiler_flag)r1rrrkwargsr*codeobfeatures r__call__zCompile.__call__ys  ::($ /5 8 ,, ,E 11 1E65$? G!6!66 g333 ! r%N__name__ __module__ __qualname____doc__r2r;r%rrrqs$J r%rceZdZdZdZddZy)ra(Instances of this class have __call__ methods identical in signature to compile_command; the difference is that if the instance compiles program text containing a __future__ statement, the instance 'remembers' and compiles all subsequent program texts with the statement in force.c"t|_yr/)rrr0s rr2zCommandCompiler.__init__s   r%c2t|j|||S)aCompile a command and determine whether it is incomplete. Arguments: source -- the source string; may contain \n characters filename -- optional filename from which source was read; default "" symbol -- optional grammar start symbol; "single" (default) or "eval" Return value / exceptions raised: - Return a code object if the command is complete and valid - Return None if the command is incomplete - Raise SyntaxError, ValueError or OverflowError if the command is a syntax error (OverflowError and ValueError can be produced by malformed literals). )rr)r1rrrs rr;zCommandCompiler.__call__s&dmmVXvFFr%Nzsingler<rAr%rrrs$ "Gr%r)TrE)r@ __future__rall_feature_namesgetattrr5__all__r(r'rr$r+rrr)fnames0rrLs D%66 86Z '6 8  < $F44>*&GG} 8sA