o
    ^i                     @   sB   d dl mZ d dlZd dlmZ d dlZddiZG dd dZdS )    )OptionalN)StrOrURLzContent-Typeztext/plain; charset=utf-8c                   @   sz   e Zd Z										ddedee dededed	ed
edee dedeeeef  fddZ	dedefd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                 C   s   || _ t | _|durt|| jd< |rd| jd< |r!d| jd< |r(d| jd< |r/d| jd< |r6d| jd	< |dur?|| jd
< |	rFd| jd< |
durR| 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    r   R/var/www/html/stock_analysis/be/venv/lib/python3.10/site-packages/blackd/client.py__init__   s*   $







zBlackDClient.__init__unformatted_codereturnc              
      sL  t  4 I d H }|j| j| j|dd4 I d H h}|jdkr7|W  d   I d H  W  d   I d H  S |jdkrW| I d H W  d   I d H  W  d   I d H  S |jdkrh| I d H }t	||jdkr{| I d H }t
d| t
d|j 1 I d H sw   Y  W d   I d H  d S 1 I d H sw   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_messager   r   r   format_codeG   s2   






.zBlackDClient.format_code)
r   NFFFFFNFN)__name__
__module____qualname__r   r   intboolr   dictr   r*   r   r   r   r   r      sB    	

;r   )typingr   r   aiohttp.typedefsr   r$   r   r   r   r   r   r   <module>   s    