
    ]j                     <    d dl Z d dlmZ d dlZddiZ G d d      Zy)    N)StrOrURLzContent-Typeztext/plain; charset=utf-8c                   ~    e Zd Z	 	 	 	 	 	 	 	 	 	 ddededz  dededededed	edz  d
edeeef   dz  fdZdedefdZ	y)BlackDClientNurlline_lengthskip_source_first_lineskip_string_normalizationskip_magic_trailing_commapreviewfastpython_variantdiffheadersc                    || _         t        j                         | _        |t	        |      | j                  d<   |rd| j                  d<   |rd| j                  d<   |rd| j                  d<   |rd| j                  d<   |rd| j                  d	<   ||| j                  d
<   |	rd| j                  d<   |
| j                  j                  |
       yy)a  
        Initialize a BlackDClient object.
        :param url: The URL of the BlackD server.
        :param line_length: The maximum line length.
            Corresponds to the ``--line-length`` CLI option.
        :param skip_source_first_line: True to skip the first line of the source.
            Corresponds to the ``--skip-source-first-line`` CLI option.
        :param skip_string_normalization: True to skip string normalization.
            Corresponds to the ``--skip-string-normalization`` CLI option.
        :param skip_magic_trailing_comma: True to skip magic trailing comma.
            Corresponds to the ``--skip-magic-trailing-comma`` CLI option.
        :param preview: True to enable experimental preview mode.
            Corresponds to the ``--preview`` CLI option.
        :param fast: True to enable fast mode.
            Corresponds to the ``--fast`` CLI option.
        :param python_variant: The Python variant to use.
            Corresponds to the ``--pyi`` CLI option if this is "pyi".
            Otherwise, corresponds to the ``--target-version`` CLI option.
        :param diff: True to enable diff mode.
            Corresponds to the ``--diff`` CLI option.
        :param headers: A dictionary of additional custom headers to send with
            the request.
        NzX-Line-LengthyeszX-Skip-Source-First-LinezX-Skip-String-NormalizationzX-Skip-Magic-Trailing-Commaz	X-Previewr   zX-Fast-Or-SafezX-Python-VariantzX-Diff)r   _DEFAULT_HEADERScopyr   strupdate)selfr   r   r   r	   r
   r   r   r   r   r   s              7/root/env/lib/python3.12/site-packages/blackd/client.py__init__zBlackDClient.__init__
   s    H ',,.",/,<DLL)!7<DLL34$:?DLL67$:?DLL67(-DLL%-3DLL)*%/=DLL+,%*DLL"LL(     unformatted_codereturnc                 n  K   t        j                         4 d {   }|j                  | j                  | j                  |j                  d            4 d {   }|j                  dk(  r$|cd d d       d {    cd d d       d {    S |j                  dk(  r:|j                          d {   cd d d       d {    cd d d       d {    S |j                  dk(  r-|j                          d {   }t        j                  |      |j                  dk(  r&|j                          d {   }t        d|       t        d|j                         7 J7 7 7 7 7 7 7 v7 <# 1 d {  7  sw Y   nxY wd d d       d {  7   y # 1 d {  7  sw Y   y xY ww)	Nzutf-8)r   data      i  i  zError while formatting: z!Unexpected response status code: )aiohttpClientSessionpostr   r   encodestatustextblackInvalidInputRuntimeError)r   r   sessionresponseerror_messages        r   format_codezBlackDClient.format_codeE   s    ((* 	 	g||$,,5E5L5LW5U $   ??c)+  	 	 	 __+!)0  	 	 	 __+*2--/$9M,,];;__+*2--/$9M&)A-'QRR ';HOO;LM )	 	 1	 %: %:  	 	 	 	 	s  F5E%F5<F E(F E90F <E+=F F5E-F5"E95E/6E99F E1F 
F5E3F5"E9>E5?;E9:E7;*E9%F5(F +F -F5/E91F 3F55E97E99F	?F F	F F5FF5 F2&F)'F2.F5)
zhttp://localhost:9090NFFFFFNFN)
__name__
__module____qualname__r   intboolr   dictr   r,    r   r   r   r   	   s     0"&',*/*/%))-9)9) 4Z9) !%	9)
 $(9) $(9) 9) 9) d
9) 9) c3h$&9)v# # r   r   )r    aiohttp.typedefsr   r&   r   r   r3   r   r   <module>r5      s&     % "$?@ S Sr   