o
    ^[2h                     @   sB   d dl mZ d dlmZ dedee fddZG dd deZd	S )
    )AuthlibHTTPError)add_params_to_uritextreturnc                    s   g d  fddt | D S )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                    s&   g | ] t  fd dD s qS )c                 3   s0    | ]\}}|t    ko|kn  V  qd S N)ord).0startendchar d/home/skpark/git/infrasmart_work/infrasmart/venv/lib/python3.10/site-packages/authlib/oauth2/base.py	<genexpr>   s   . z6invalid_error_characters.<locals>.<listcomp>.<genexpr>)any)r   valid_rangesr   r   
<listcomp>   s    z,invalid_error_characters.<locals>.<listcomp>)set)r   r   r   r   invalid_error_characters   s   
r   c                       sF   e Zd Z							d	 fdd	Z fddZd
 fdd	Z  ZS )OAuth2ErrorNFc           	         sN   |rt | }rtdd| dt |||| || _|| _|| _d S )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__r   r   r!      s   
zOAuth2Error.__init__c                    s$   t   }| jr|d| jf |S )zGet a list of body.r"   )r    get_bodyr"   append)r%   r)   r+   r   r   r-   2   s   
zOAuth2Error.get_bodyc                    s<   | j r|  }t| j || j}ddd|fgfS t j|dS )Ni.   Location)r'   )r#   r-   r   r$   r    __call__)r%   r'   paramslocr+   r   r   r1   9   s
   zOAuth2Error.__call__)NNNNNFNr   )__name__
__module____qualname__r!   r-   r1   __classcell__r   r   r+   r   r      s    r   N)authlib.common.errorsr   authlib.common.urlsr   strlistr   r   r   r   r   r   <module>   s    