
    hz                     P    S r S\S\4S jrS\S\4S jrS\S\4S jrS\S\4S jrg)	z6
Tools for pedantically processing the HTTP protocol.
breturnc                 .    U  H  nUS;  d  M    g   U S:g  $ )z3
Is the string a token per RFC 9110 section 5.6.2?
sM   ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&'*+-.^_`|~F     r   cs     X/root/1688_scrapy/alibaba-scraper/venv/lib/python3.13/site-packages/twisted/web/_abnf.py_istokenr
   
   s+     

   8Or   datac                     U R                  S5      n U R                  5       (       d  [        SU < 35      e[        U 5      $ )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: )stripisdigit
ValueErrorint)r   s    r	   _decintr      s:     ::fD<<>>>thGHHt9r   c                 .    U  H  nUS;  d  M    g   U S:g  $ )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   r   r   s     r	   _ishexdigitsr   -   s%     --  8Or   c                 P    [        U 5      (       d  [        U 5      e[        U S5      $ )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.
   )r   r   r   )r   s    r	   _hexintr   :   s#     ??mq":r   N)__doc__bytesboolr
   r   r   r   r   r   r   r	   <module>r      sV   

 $ % C *
E 
d 

u 
 
r   