o
    Óó·iz  ã                   @   sP   d Z dedefdd„Zdedefdd„Zdedefdd	„Zdedefd
d„ZdS )z6
Tools for pedantically processing the HTTP protocol.
ÚbÚreturnc                 C   ó    | D ]	}|dvr dS q| dkS )z;
    Is the string a token per RFC 9110 section 5.6.2?
    sM   ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&'*+-.^_`|~Fó    N© ©r   Úcr   r   úWC:\Users\psant\Downloads\PAF backend\school\venv\Lib\site-packages\twisted/web/_abnf.pyÚ_istoken
   s   ÿûr	   Údatac                 C   s(   |   d¡} |  ¡ std| ›�ƒ‚t| ƒS )a(  
    Parse a decimal integer of the form C{1*DIGIT}, i.e. consisting only of
    decimal digits. The integer may be embedded in whitespace (space and
    horizontal tab). This differs from the built-in L{int()} function by
    disallowing a leading C{+} character and various forms of whitespace
    (note that we sanitize linear whitespace in header values in
    L{twisted.web.http_headers.Headers}).

    @param data: Value to parse.

    @returns: A non-negative integer.

    @raises ValueError: When I{value} contains non-decimal characters.
    s    	z#Value contains non-decimal digits: N)ÚstripÚisdigitÚ
ValueErrorÚint)r
   r   r   r   Ú_decint   s   
r   c                 C   r   )zŽ
    Is the string case-insensitively hexidecimal?

    It must be composed of one or more characters in the ranges a-f, A-F
    and 0-9.
    s   0123456789abcdefABCDEFFr   Nr   r   r   r   r   Ú_ishexdigits-   s
   ÿr   c                 C   s   t | ƒst| ƒ‚t| dƒS )zÙ
    Decode a hexadecimal integer.

    Unlike L{int(b, 16)}, this raises L{ValueError} when the integer has
    a prefix like C{b'0x'}, C{b'+'}, or C{b'-'}, which is desirable when
    parsing network protocols.
    é   N)r   r   r   )r   r   r   r   Ú_hexint:   s   
r   N)Ú__doc__ÚbytesÚboolr	   r   r   r   r   r   r   r   r   Ú<module>   s
   