
    dd                         d Z g dZdZdZdZdZ	 ddlmZmZ n# e	$ r dZdZY nw xY wd	 Z
d
 ZddZddZddZddZd Zd Zd Zedk    r e             dS dS )zHConversions to/from quoted-printable transport encoding as per RFC 1521.)encodedecodeencodestringdecodestring   =L   s   0123456789ABCDEF        )a2b_qpb2a_qpNc                     t          | t                    sJ | dv r|S | dk    r|S | t          k    pd| cxk    odk    nc  S )zDecide whether a particular byte ordinal needs to be quoted.

    The 'quotetabs' flag indicates whether embedded tabs and spaces should be
    quoted.  Note that line-ending tabs and spaces are always encoded, as per
    RFC 1521.
        	   _       ~)
isinstancebytesESCAPE)c	quotetabsheaders        /croot/python-split_1694437901252/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac/lib/python3.11/quopri.pyneedsquotingr      se     aF{{Dyy;1tq0000D000011r   c                     t          | t                    rt          |           dk    sJ t          |           } t          t          t
          | dz           t
          | dz           f          z   S )zQuote a single character.      )r   r   lenordr   HEXr   s    r   quoter    $   sW    a-CFFAIIIIAAE3q"u:s1R4y12222r   Fc                    t           =|                                 }t          |||          }|                    |           dS |dfd}d}	 |                                 }|sng }	d}
|dd         dk    r|dd         }d}
|D ]e}t	          |f          }t          |||          rt          |          }|r|dk    r|	                    d	           P|	                    |           f| ||           t          	                    |	          }t          |          t          k    rG ||dt          dz
           d
           |t          dz
  d         }t          |          t          k    G|}(| |||
           dS dS )av  Read 'input', apply quoted-printable encoding, and write to 'output'.

    'input' and 'output' are binary file objects. The 'quotetabs' flag
    indicates whether embedded tabs and spaces should be quoted. Note that
    line-ending tabs and spaces are always encoded, as per RFC 1521.
    The 'header' flag indicates whether we are encoding spaces as _ as per RFC
    1522.Nr   r      
c                     | rF| dd          dv r:|                     | d d         t          | dd                    z   |z              d S | dk    r'|                     t          |           |z              d S |                     | |z              d S )Nr      .)writer    )soutputlineEnds      r   r'   zencode.<locals>.write;   s      	&2336!!LL3B3%"##--/'9:::::$YYLLqG+,,,,,LLW%%%%%r   r   r   r%   r   r   s   =
)r*   )r   readr'   readliner   r   r    appendEMPTYSTRINGjoinr   MAXLINESIZE)inputr)   r   r   dataodatar'   prevlinelineoutlinestrippedr   thislines                r   r   r   ,   s    zz||ty@@@U & & & & H~~ 	99DH 	" 	"AqdAAy&11 !HH "!t))t$$$$q!!!!E(OOO ##G,,(mmk)) E(>KM>*F;;;;A/H	 (mmk)) ?B h)))))) r   c                     t           t          | ||          S ddlm}  ||           } |            }t          ||||           |                                S )Nr"   r	   BytesIO)r   ior;   r   getvalue)r(   r   r   r;   infpoutfps         r   r   r   j   sk    a9V<<<<71::DGIIE
4	6***>>r   c           	         t           <|                                 }t          ||          }|                    |           dS d}	 |                                 }|sndt	          |          }}|dk    rH||dz
  |         dk    r7d}	|dz
  }|dk    r)||dz
  |         dv r|dz
  }|dk    r||dz
  |         dv nd}	||k     r|||dz            }
|
dk    r|r|d	z   }|dz   }n|
t
          k    r||
z   }|dz   }n|dz   |k    r|	sd}	n|dz   |k     r)||dz   |d
z            t
          k    r|t
          z   }|d
z   }n|d
z   |k     rnt          ||dz   |d
z                      rQt          ||d
z   |dz                      r4|t          t          ||dz   |dz                      f          z   }|dz   }n
||
z   }|dz   }||k     |	s|                    |dz              d}|r|                    |           dS dS )zRead 'input', apply quoted-printable decoding, and write to 'output'.
    'input' and 'output' are binary file objects.
    If 'header' is true, decode underscore as space (per RFC 1522).Nr   r   r   r	   r#   s    	r   r         )	r
   r+   r'   r,   r   r   ishexr   unhex)r1   r)   r   r2   r3   newr5   inpartialr   s              r   r   r   u   s   
 zz||tF+++U
C~~U#d))1q55T!A#a%[E))GQqSa%%D1QK833aC a%%D1QK833 G!eeQqsUADyyVyDjac!!fAg1Q3qq1'U1qT!A#ac']f44Fl!AA1qU4!AaC=11eD1QqSM6J6JE5ac!A#g#7#7"9:::!AAAg1Q3q !ee  	LLu%%%C78  S r   c                     t           t          | |          S ddlm}  ||           } |            }t          |||           |                                S )NrA   r	   r:   )r
   r<   r;   r   r=   )r(   r   r;   r>   r?   s        r   r   r      sj    a''''71::DGIIE
4v&&&&>>r   c                     t          | t                    sJ d| cxk    odk    nc pd| cxk    odk    nc pd| cxk    odk    nc S )zDReturn true if the byte ordinal 'c' is a hexadecimal digit in ASCII.   0   9   a   f   A   F)r   r   r   s    r   rD   rD      s|    a1F 1 1 1 1T 1 1 1 1FTQ5F5F5F5F$5F5F5F5FFr   c                 d   d}| D ]}t          |f          }d|cxk    rdk    rn nt          d          }n`d|cxk    rdk    rn nt          d          dz
  }n=d	|cxk    rd
k    rn nt          d	          dz
  }nJ dt          |          z               |dz  t          |          |z
  z   }|S )z.Get the integer value of a hexadecimal number.r	   rL   rM   0rN   rO   a
   rP   rQ   Fznon-hex digit r   )r   r   repr)r(   bitsr   rG   s       r   rE   rE      s    D 
& 
&1$KK1CAAQ$CAAQ$D		"AA2*4772222Bw#a&&1*%Kr   c                     dd l } dd l}	 |                    | j        dd          d          \  }}nt# |j        $ rg}| j        | _        t          |           t          d           t          d           t          d           |                     d           Y d }~nd }~ww xY wd}d}|D ]\  }}|d	k    rd
}|dk    rd
}|r2|r0| j        | _        t          d           |                     d           |sdg}d}	|D ]}
|
dk    r| j        j	        }nK	 t          |
d          }n9# t          $ r,}| j                            |
d|d           d}	Y d }~Xd }~ww xY w	 |rt          || j        j	                   nt          || j        j	        |           |
dk    r|                                 # |
dk    r|                                 w w xY w|	r|                     |	           d S d S )Nr	   r   tdz"usage: quopri [-t | -d] [file] ...z-t: quote tabsz-d: decode; default encoderB   Fz-tTz-dz -t and -d are mutually exclusive-rbz: can't open (z)
)sysgetoptargverrorstderrstdoutprintexitstdinbufferopenOSErrorr'   r   r   close)r\   r]   optsargsmsgdecotabsorT   stsfilefps               r   mainrr      s_   JJJMMM]]38ABB<66
dd<   Z
c


2333*+++ DD " "199Td99Td  Z
0111
C  3;;!BB$%%   
  DDD###!FGGG	 4r3:,----r3:,d333s{{


 s{{



 
  s9   &1 
B"ABB"D%%
E/"EE8F22G__main__)F)FF)__doc____all__r   r0   r   r.   binasciir
   r   ImportErrorr   r    r   r   r   r   rD   rE   rr   __name__ r   r   <module>rz      s=   O N ?
>
>	'''''''''   FFFF
2 2 23 3 3<* <* <* <*|   ) ) ) )V   G G G
  $* * *\ zDFFFFF s    	%%