
    e                    ~    d dl mZ d dlmZmZmZ d dlmZ d dlm	Z	m
Z
 d dlmZ d dlmZ ddZdZdd	ZdddZddZy
)    )annotations)contextinference_tipnodes)register_module_extender)_extract_single_nodeparse)	PY39_PLUS)AstroidManagerc                     t        d      S )zThe RegexFlag enum exposes all its entries by updating globals().

    We hard-code the flags for now.
    # pylint: disable-next=line-too-long
    See https://github.com/mrabarnett/mrab-regex/blob/2022.10.31/regex_3/regex.py#L200
    aA  
    A = ASCII = 0x80          # Assume ASCII locale.
    B = BESTMATCH = 0x1000    # Best fuzzy match.
    D = DEBUG = 0x200         # Print parsed pattern.
    E = ENHANCEMATCH = 0x8000 # Attempt to improve the fit after finding the first
                              # fuzzy match.
    F = FULLCASE = 0x4000     # Unicode full case-folding.
    I = IGNORECASE = 0x2      # Ignore case.
    L = LOCALE = 0x4          # Assume current 8-bit locale.
    M = MULTILINE = 0x8       # Make anchors look for newline.
    P = POSIX = 0x10000       # POSIX-style matching (leftmost longest).
    R = REVERSE = 0x400       # Search backwards.
    S = DOTALL = 0x10         # Make dot match newline.
    U = UNICODE = 0x20        # Assume Unicode locale.
    V0 = VERSION0 = 0x2000    # Old legacy behaviour.
    DEFAULT_VERSION = V0
    V1 = VERSION1 = 0x100     # New enhanced behaviour.
    W = WORD = 0x800          # Default Unicode word breaks.
    X = VERBOSE = 0x40        # Ignore whitespace and comments.
    T = TEMPLATE = 0x1        # Template (present because re module has it).
    )r	        ;/usr/lib/python3/dist-packages/astroid/brain/brain_regex.py_regex_transformr      s     	 r   z?
@classmethod
def __class_getitem__(cls, item):
    return cls
c                   | j                         j                  dk(  xr t        | j                  t        j
                        xr | j                  j                  dk(  xr t        | j                  t        j                        xr| t        | j                  j                        dk(  xrX t        | j                  j                  d   t        j                        xr% | j                  j                  d   j                  dv S )zCheck for regex.Pattern or regex.Match call in stdlib.

    Match these patterns from stdlib/re.py
    ```py
    Pattern = type(...)
    Match = type(...)
    ```
    zregex.regextype   r   >   MatchPattern)rootname
isinstancefuncr   NameparentAssignlentargets
AssignName)nodes    r   _looks_like_pattern_or_matchr!   5   s     			M) 	@tyy%**-	@IINNf$	@ t{{ELL1	@ ##$)		@
 t{{**1-u/?/?@	@ KK"''+??r   Nc                @   t        j                  | j                  j                  d   j                  | j
                  | j                  | j                  | j                  | j                        }t        rt        t              }|g|j                  d<   t        |g      S )z\Infer regex.Pattern and regex.Match as classes.

    For PY39+ add `__class_getitem__`.
    r   )r   lineno
col_offsetr   
end_linenoend_col_offset__class_getitem__)r   ClassDefr   r   r   r#   r$   r%   r&   r
   r   CLASS_GETITEM_TEMPLATElocalsiter)r    ctx	class_deffunc_to_adds       r   infer_pattern_matchr/   I   s    
 [[  #(({{??{{??**I *+AB1<	,-r   c                    t        | dt               | j                  t        j                  t        t              t               y )Nregex)r   r   register_transformr   Callr   r/   r!   )managers    r   registerr5   \   s/    Wg/?@

M"568Tr   )returnznodes.Module)r    
nodes.Callr6   bool)N)r    r7   r,   zcontext.InferenceContext | None)r4   r   r6   None)
__future__r   astroidr   r   r   astroid.brain.helpersr   astroid.builderr   r	   astroid.constr
   astroid.managerr   r   r)   r!   r/   r5   r   r   r   <module>r@      s9   
 # 1 1 : 7 # *@ (&r   