
    h                     n    S SK r S SKrS SKrS SKrS SKJrJr  S rS rS rS r	S r
\S:X  a  \
" 5         gg)	    N)FileStrc                     [         R                  " SS9n U R                  SSS/SS9  U R                  SS	S
SS9  U R                  SSS
SS9  U R                  SSS
SS9  U R                  SSS
SS9  U R                  SSS
SS9  U R                  SSSS9  U R                  SS[        R                  S9  U R                  5       $ ) NzPrint newline, word, and byte counts for each FILE, and a total line if more than one FILE is         specified. A word is a non-zero-length sequence of acters delimited by white space.)descriptionfiles*-zFiles to process)nargsdefaulthelpz-cz--bytes
store_truezprint the byte counts)actionr   z-mz--charszprint the character countsz-lz--lineszprint the newline countsz-Lz--max-line-lengthzprint the maximum display widthz-wz--wordszprint the word countsz--files0-fromfilenameztRead input from the files specified by NUL-terminated names in file F; If F is - then read names from standard input)metavarr   z	--versionversion)r   r   )argparseArgumentParseradd_argumentstringzilla__version__
parse_args)parsers    @/var/www/fran/franai/venv/lib/python3.13/site-packages/cli/wc.pyparse_argumentsr   	   s   $$]F sSE@RS
i3J   i3O   i3M   .	   i3J   9   I{?V?VW    c                    U S:X  a*  [         R                  R                  5       n[        U5      nO [	        U 5      n[        U5      n0 nUR                  (       a  UR                  S5      US'   UR                  (       a  UR                  S5      S-   US'   UR                  (       a  UR                  5       US	'   UR                  (       a%  [        S
 UR                  S5       5       5      nXeS'   UR                  (       a0  UR                  (       a  US	   US'   US4$ UR                  5       US'   US4$ ! [
         a
    SU  3S4s $ f = f)Nr	   zNo such file: F

line_count    
word_count
char_countc              3   8   #    U  H  n[        U5      v   M     g 7fN)len).0lines     r   	<genexpr>wc.<locals>.<genexpr>@   s     M4LDc$ii4Ls   max_line_length
byte_countT)sysstdinreadr   r   RuntimeErrorlinescountwordschars__len__r*   maxsplitbytes)	file_pathargscontentmapped_bytesmapped_filecountsr*   s          r   wcr>   ,   s1   C)).."7|	7y/K{+L Fzz+11$7|zz+11#6:|zz+335|ML4F4Ft4LMM$3 !zz::#),#7F<  4< $0#7#7#9F< 4<+  	7#I;/66	7s   D6 6E
	E
c                   ^ / nUR                   (       a  UR                  U S   5        UR                  (       a  UR                  U S   5        UR                  (       a  UR                  U S   5        UR                  (       a  UR                  U S   5        UR
                  (       a!  UR                  U R                  SS5      5        SR                  U4S jU 5       5      $ )	Nr   r!   r"   r+   r*   r   r   c              3   X   >#    U  H  n[        U5      R                  T5      v   M!     g 7fr$   )strrjust)r&   r1   justs     r   r(    format_output.<locals>.<genexpr>Y   s#     HuCJ$$T**s   '*)r0   appendr2   r3   r7   r*   getjoin)r=   r9   rC   selected_countss     ` r   format_outputrI   L   s    Ozzvl34zzvl34zzvl34zzvl34vzz*;Q?@88HHHHr   c                     [        U S5      nUR                  5       nUR                  5         UR                  S5       Vs/ s H+  n[        R
                  R                  U5      (       d  M)  UPM-     sn$ s  snf )Nr )openr.   closer6   ospathisfile)fnfsxs       r   get_files_fromrV   \   sP    RA	AGGIwwt}:}!q(9A}:::s    (A5,A5c            	      L   [        5       n SSSSSS.n[        U R                  U R                  U R                  U R
                  U R                  /5      (       d  SU l        SU l        SU l        U R                  (       aQ  U R                  S   S:X  a>  [        U R                  5      U l        [        U R                  5      S:X  a  [        S5        [        S U R                   5       5      nU R                   Ht  n[        X05      u  pEU(       aR  UR                  5        H  nX==   UR                  US5      -  ss'   M!     [!        X@U5      SU 3-   n[#        U5        Mi  [#        U5        Mv     [        U R                  5      S:  a  [!        XU5      S-   n[#        U5        g g )Nr   )r   r!   r"   r*   r+   r    r	   c              3      #    U  H7  n[        [        [        R                  " U5      R                  5      5      v   M9     g 7fr$   )r%   rA   rO   statst_size)r&   rR   s     r   r(   main.<locals>.<genexpr>y   s+     Bzs3rwwr{**+,,zs   ?Ar   z total)r   anyr0   r2   r3   r7   r*   files0_fromr   rV   r%   exitr5   r>   keysrF   rI   print)	r9   total_countsrC   r8   r=   successkeyoutputtotal_outputs	            r   mainrf   c   sY   DL 

DJJ

DJJ@T@TUVV


 ::a=C'(8(89DJ4::!#QBtzzBBDZZ	Y-#((*!VZZQ%77! +"661YKHF&M&M   4::$\>Il r   __main__)r,   rO   r   r   r   r   r   r>   rI   rV   rf   __name__ r   r   <module>rj      sD       ! F@I ;$N zF r   