
    ~h                     H    d dl mZ d dlmZ dedee   fdZ G d de      Zy)	    )AuthlibHTTPError)add_params_to_uritextreturnc                 r    g d}t        |       D cg c]  t        fd|D              s c}S c c}w )zCheck whether the string only contains characters from the restricted ASCII set defined in RFC6749 for errors.

    https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2.1
    ))    !   )#   [   )]   ~   c              3   V   K   | ]   \  }}|t              cxk  xr |k  nc  " y wN)ord).0startendchars      O/opt/mcp/mcp-sentiment/venv/lib/python3.12/site-packages/authlib/oauth2/base.py	<genexpr>z+invalid_error_characters.<locals>.<genexpr>   s&     L5CI,,,Ls   &))setany)r   valid_rangesr   s     `r   invalid_error_charactersr      s>    
L IL|LL 	  s   4c                   D     e Zd Z	 	 	 	 	 	 	 d fd	Z fdZd fd	Z xZS )OAuth2Errorc                     |r+t        |      x}rt        ddj                  |       d      t        	|   ||||       || _        || _        || _        y )Nz1Error description contains forbidden characters: z, .)r   
ValueErrorjoinsuper__init__stateredirect_uriredirect_fragment)
selfdescriptionuristatus_coder#   r$   r%   errorchars	__class__s
            r   r"   zOAuth2Error.__init__   si     0==u= G		RWHXGYYZ[  	S+>
(!2    c                 v    t         |          }| j                  r|j                  d| j                  f       |S )zGet a list of body.r#   )r!   get_bodyr#   append)r&   r*   r,   s     r   r/   zOAuth2Error.get_body2   s1     "::LL'4::./r-   c                     | j                   r9| j                         }t        | j                   || j                        }ddd|fgfS t        |   |      S )Ni.   Location)r(   )r$   r/   r   r%   r!   __call__)r&   r(   paramslocr,   s       r   r4   zOAuth2Error.__call__9   sY    ]]_F#D$5$5vt?U?UVCj#.///wC((r-   )NNNNNFNr   )__name__
__module____qualname__r"   r/   r4   __classcell__)r,   s   @r   r   r      s.     34) )r-   r   N)authlib.common.errorsr   authlib.common.urlsr   strlistr   r    r-   r   <module>r@      s/    2 13 49 $')" ')r-   