tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Z\¬Qc @sËdZddlZddlmZmZmZmZmZddlZddl    m
Z ddl m Z edddd    d
d d d dddg ƒZdZdZejdƒd„Zddd„ƒYZdS(sICodeContext - Extension to display the block context above the edit window
 
Once code has scrolled off the top of a window, it can be difficult to
determine which block you are in.  This extension implements a pane at the top
of each IDLE edit window which provides block structure hints.  These hints are
the lines which contain the block opening keywords, e.g. 'if', for the
enclosing block.  The number of hint lines is determined by the numlines
variable in the CodeContext section of config-extensions.def. Lines which do
not open blocks are not shown in the context hints pane.
 
iÿÿÿÿN(tTOPtLEFTtXtWtSUNKEN(tmaxint(tidleConftclasstdefteliftelsetexcepttfinallytfortifttrytwhiletwithidiès ^(\s*)(\w*)cCs|j|ƒjƒS(N(tmatchtgroups(tstc((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/CodeContext.pyt<lambda>st CodeContextcBsÅeZddgfgZejddddddd    ƒZejddd
dd dd ƒZejddd dd ddƒZd„Zdd„Z
d„Z ddd„Z d„Z d„Zd„ZRS(toptionss!Code Conte_xts<<toggle-code-context>>t
extensionsRtnumlinesttypetinttdefaultitbgcolortstrt    LightGraytfgcolortBlackcCsÆ||_|j|_|jd|_d|_dddtfg|_d|_tj    dddd    d
d tƒ}|r–|j
ƒ|jj d t ƒn|jj t|jƒ|jj t|jƒdS( NtfontiiÿÿÿÿtiRRtvisibleRtboolRs<<toggle-code-context>>(teditwinttextttextfonttNonetlabeltFalsetinfot
topvisibleRt    GetOptionttoggle_code_context_eventtsetvartTruetaftertUPDATEINTERVALt timer_eventtFONTUPDATEINTERVALtfont_timer_event(tselfR'R%((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/CodeContext.pyt__init__"s              
cCsŒ|jsC|jj|jjf}d}xM|D]E}|tt|jƒdƒƒ7}|tt|jdƒƒƒ7}q.Wd}x-|D]%}|tt|jdƒƒƒ7}q„Wtj    |jj
dd|j ddt dt d    |jd
|jd |jd dd|d|d tƒ
|_|jjdtdtdtd|jjƒn|jjƒd|_tjdddt|jdk    ƒƒtjƒdS(NitpadxtborderR(s
itanchortjustifyR#tbgtfgtwidthtrelieftsidetfilltexpandtbeforeRRR%(R+R'R(t
text_frameRRt    pack_infotcgettTkintertLabelttopt context_depthRRR)RR!RtpackRRR,tdestroyR*Rt    SetOptiontSaveUserCfgFiles(R8teventtwidgetsR:twidgetR;((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/CodeContext.pyR07s0      # #            cCs‘|jjd|d|ƒ}t|ƒ\}}|tko>|}t|ƒt|ƒkso|t|ƒdkrxt}n t|ƒ}|||fS(sÖGet the line indent value, text, and any block start keyword
 
        If the line does not start a block, the keyword value is False.
        The indentation of empty lines (or comment lines) is INFINITY.
 
        s%d.0s%d.endt#(R(tgettgetspacesfirstwordt BLOCKOPENERStlentINFINITY(R8tlinenumR(tspacest    firstwordtopenertindent((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/CodeContext.pyt get_line_info[s.     iic
Csã|dkst‚g}t}x®t||ddƒD]–}|j|ƒ\}}}    ||kr5|}|    dkr~|d7}n|    r¸||kr¸||kr¸|j||||    fƒn||krËPqËq5q5W|jƒ||fS(säGet context lines, starting at new_topvisible and working backwards.
 
        Stop when stopline or stopindent is reached. Return a tuple of context
        data and the indent level at the top of the region inspected.
 
        iiiÿÿÿÿR
R    (R
R    (tAssertionErrorRYtxrangeR_tappendtreverse(
R8tnew_topvisibletstoplinet
stopindenttlinest
lastindentRZR^R(R]((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/CodeContext.pyt get_contextks     
cCsœt|jjdƒjdƒdƒ}|j|kr8dS|j|kr|j||jƒ\}}x²|jdd|kr‰|jd=qeWnŠ|j|kr|jddd}x6|jdd|kré|jdd}|jd=q´W|j||jddd|ƒ\}}n|jj|ƒ||_dgtd|j    t
|jƒƒ}|g|j|j     D]}|d^qk7}d    j |ƒ|j d
<dS( sKUpdate context information and lines visible in the context pane.
 
        s@0,0t.iNiÿÿÿÿiR$is
R(( RR(tindextsplitR.RiR-textendtmaxRLRXtjoinR+(R8RdRgRhRftcontext_stringstx((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/CodeContext.pytupdate_code_context†s*%            &,cCs0|jr|jƒn|jjt|jƒdS(N(R+RrR(R3R4R5(R8((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/CodeContext.pyR5¦s     cCs[|jd}|jrA||jkrA||_|j|jd<n|jjt|jƒdS(NR#(R(R+R)R3R6R7(R8t newtextfont((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/CodeContext.pyR7«s
     (s!Code Conte_xts<<toggle-code-context>>N(t__name__t
__module__tmenudefsRR/RLRR!R9R*R0R_RiRrR5R7(((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/CodeContext.pyRs        $             ((t__doc__RIt TkconstantsRRRRRtretsysRRYtidlelib.configHandlerRtsetRWR4R6tcompileRVR(((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/CodeContext.pyt<module> s (