
    ni                     D    d dl Z d dlmZ d dlZddiZ G d d          ZdS )    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	dS )BlackDClienthttp://localhost:9090NFurlline_lengthskip_source_first_lineskip_string_normalizationskip_magic_trailing_commapreviewfastpython_variantdiffheadersc                 f   || _         t                                          | _        |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                            |
           dS dS )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              J/var/www/html/gpu-tools/venv/lib/python3.11/site-packages/blackd/client.py__init__zBlackDClient.__init__
   s    H ',,..",/,<,<DL)! 	=7<DL34$ 	@:?DL67$ 	@:?DL67 	.(-DL% 	4-3DL)*%/=DL+, 	+%*DL"L(((((     unformatted_codereturnc                 &  K   t          j                    4 d {V }|                    | j        | j        |                    d                    4 d {V 	 }|j        dk    r&|cd d d           d {V  cd d d           d {V  S |j        dk    r>|                                 d {V cd d d           d {V  cd d d           d {V  S |j        dk    r.|                                 d {V }t          j	        |          |j        dk    r,|                                 d {V }t          d|           t          d|j                   # 1 d {V swxY w Y   	 d d d           d {V  d S # 1 d {V swxY w Y   d S )	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   sf     (** 	 	 	 	 	 	 	g||$,5E5L5LW5U5U $          ?c))+            	 	 	 	 	 	 	 	 	 	 	 	 	 	 _++!)000000            	 	 	 	 	 	 	 	 	 	 	 	 	 	 _++*2--//$9$9$9$9$9$9M,];;;_++*2--//$9$9$9$9$9$9M&'Q-'Q'QRRR 'MHOMM  '              	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	sH   <F E&F $E/F BE
E%	%F (E%	)F  
F
F
)
r   NFFFFFNFN)
__name__
__module____qualname__r   intboolr   dictr   r-    r   r   r   r   	   s         0"&',*/*/%))-9) 9)9) 4Z9) !%	9)
 $(9) $(9) 9) 9) d
9) 9) c3h$&9) 9) 9) 9)v# #      r   r   )r!   aiohttp.typedefsr   r'   r   r   r4   r   r   <module>r6      sq     % % % % % % "$?@ S S S S S S S S S Sr   