Vc,cs dZddlZddlZddlZeeds edgdZdadadZ dZ Gdd e Z d Z Gd d Zd ZdZedkr e dSdS)Z6NNLz4tokenize.NL doesn't exist -- tokenize module too old)checkNannyNagprocess_tokenscsd}|D]3}tj|t|zd}4tjddS)N z )sysZstderrZwritestr)argsZseparg !/usr/lib64/python3.11/tabnanny.pyerrprintr "sY C s3xx(((JTcsxddl} |tjddd\}}n'#|j$r}t |Yd}~dSd}~wwxYw|D]%\}}|dkr t dza|dkr t dza&|s#t dtjdddS|D]}t|dS)NrZqvz-qz-vzUsage:z[-v] file_or_directory ...)getoptrZargvZerrorr filename_onlyverboser)rZoptsr msgZoar s r mainr)sMMM]]38ABB<66 dd < ""1 9 .)A-M 9 "kG 38A;(DEEE c s+2 AAAcs(eZdZ dZdZdZdZdS)rcs2|||c|_|_|_dSN)linenorline)selfrrr r __init__zNannyNag.__init__Bs+13( TXtyyyrc|jSr)rr r get_linenozNannyNag.get_linenoDs {rcrr)rrrr get_msgzNannyNag.get_msgFs xrcrr)rrrr get_linezNannyNag.get_lineHs yrN)__name__ __module__ __qualname__rrr r!rr rr=sU===rrcs~ tj|rtj|strt |dtj|}|D]}tj||}tj|rtj|r+tj|dddkrt|dS tj |}n,#t$r}t|d|Yd}~dSd}~wwxYwtdkrt d|z ttj|jn_#tj$r3}t|d|Yd}~|dSd}~wt&$r3}t|d|Yd}~|dSd}~wt($r}|}|}trHt d ||fzt d |t |nAd |vrd |zd z}t0rt |nt ||t3|Yd}~|dSd}~wwxYw |n#|wxYwtrt |d dSdS)Nz: listing directoryiz.pyz : I/O Error: rzchecking %r ...z: Token Error: z: Indentation Error: z)%r: *** Line %d: trouble in tab city! ***zoffending line: rz"z: Clean bill of health.)osZpathZisdirZislinkrZprintZlistdirjoinZnormcasertokenizeZopenZOSErrorr rZgenerate_tokensZreadlineZ TokenErrorZcloseZIndentationErrorrrr!r rZrepr) ZfileZnamesZnameZfullnameZfrZnagZbadliner r rrKsb w}}T 27>>$#7#7   5 TTT3 4 4 4 4    Dw||D$//H h'' GNN8,,   bcc++u4 h M$   cc2333{( $&'''x/ ;;<<<<  $$$4555(  % cc:;;;      ..""||~~  3 =wO P P P E$$0 1 1 1 #++-- d{ 33:#3D 3eDkkkkgtDzz222    =0   5 TTT34444455sm D"" E ,EE ,&FL K0#G7L  K0H 2L K0B8K+L +K00L LcsBeZdZd\ZZdZdZdZdZdZ dZ dZ d S) Whitespacez cs||_tjtj}}g}dx}x}}|jD]c}||kr |dz}|dz}||krJ|dz}|dz}|t |kr|dg|t |z dzzz}||dz||<d}c||_||_t||f|_t |dk|_ dS)Nrr) Zrawr*STlennntZtuplenorm is_simple) rZwsr+r,countZbr.r/Zchr)r rzWhitespace.__init__s|Z\1A(  BQw EEq E!VE ??!QC1s5zz>A+=$>>E 8a<a%LL!O UqrcsV|j\}}tt|dz |SNr)r0maxr-)rr2trailingr r longest_run_of_spacesz Whitespace.longest_run_of_spacess')x3u::a<***rcs|j\}}d}t|t|D]}|||z||zz}||||jzzzS)Nr)r0ranger-r/)rZtabsizer2r5ZilZis r indent_levelzWhitespace.indent_levelsb)x wE ++ , ,Aaj58++BB'R$'\222rcs"|j|jkSr)r0)rother r equalzWhitespace.equalsyEJ&&rcsxt||dz}g}td|dzD]l}||||kr>||||||fm|Sr3r4r6r7r8appendrr9r.rts r not_equal_witnesszWhitespace.not_equal_witness **,,++-- / /12 3 1Q3-- 5 5B  $$(:(:2(>(>> 52,,R00 --b113555rcs^|j|jkrdS|jr|jr|j|jkSt||dz}t d|dzD]1}||||krdS2dS)NFriT)r.r1r/r4r6r7r8)rr9r.r?rr lesszWhitespace.lesss 6UW  5 > 'eo '7eh& & **,,++-- / /12 31Q3--  B  $$(:(:2(>(>> uu trcsxt||dz}g}td|dzD]l}||||kr>||||||fm|Sr3r<r>r@r not_less_witnesszWhitespace.not_less_witnessrBrN) r"r#r$r+r,rr6r8r;rArCrDr%rr r*r*s DAq*)))2+++333.'''   0   "     rr*csd|D}d}t|dkr|dz}|dzd|zS)Nc3s@K|]}t|dVdS)rN)r)Z.0Ztupr:r z z#format_witnesses..s, ' 'cc#a&kk ' ' ' ' ' 'rz at tab sizerZsrz, )r-r')ZwZfirstsZprefixr r format_witnessesrEsP ' 'Q ' ' 'F F 1vvz# C<$))F++ ++rcstj}tj}tj}tjtjf}t dg}d}|D] \}}} } } ||krd}||krd}t |} |d| sD|d| } dt| z}t| d|| | | ||krd}|d=|rt||vrpd}t | } |d | sD|d | } dt| z}t| d|| "dS)Nrrrizindent not greater e.g. zindent not equal e.g. )r(INDENTDEDENTNEWLINEZCOMMENTrr*rCrDrErr=r;rA)ZtokensrFrGrHZJUNKZindentsZ check_equalZtypeZtokenZstartZendrZthisguyZwitnessrs r rrs _F _FG  X[ (D"~~GK+1,4,4'ueS$ 7?+ 4 KK V^# 4K ''G2;##G,, 4!"+66w??03CG3L3LLuQxd333 NN7 # # # # V^ 4K  4T- 4K &&G2;$$W-- 4!"+77@@.1A'1J1JJuQxd333Y,4,4rZ__main__)Z __version__r&rr(ZhasattrZ ValueErrorZ__all__rrr rZ Exceptionrrr*rErr"r%rr rIs7 $ wxM *K L LL 1 1 1  (     y   ;5;5;5zDDDDDDDDL,,,444444n z DFFFFF  r