
    i                        d dl mZ d dlZd dlZd dlmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZmZ d dlmZ 	 	 dddZddZdS )     )annotationsN)
ReadBuffer)
errorcodes)read_int)Errors)FileRawDataMypyFile)OptionsFsourcestr | bytesfnamstrmodule
str | Noneerrorsr   optionsr
   raise_on_errorboolimports_onlyreturnr	   c                   |j         rt          j                            |          raddl}|j        p||j        v }|o|j         }	|                    |||           |j	        
                    |||	|          \  }
}}t          |          |
_        |                    d          |
_        |D ]}|d         }t          j        dd |          }|                    d	d
          }|                    d          }|t$          j        }n+t$          j                            |          pt$          j        }|                    |d         |d         |||           |r(|                                r|                                 |
S |rJ |j        |                    |           } ddl}|j                            | ||||          }
|r(|                                r|                                 |
S )a#  Parse a source file, without doing any semantic analysis.

    Return the parse tree. If errors is not provided, raise ParseError
    on failure. Otherwise, use the errors object to report parse errors.

    The python_version (major, minor) option determines the Python syntax variant.
    r   Nr   )skip_function_bodiesr   .pyimessage^(\s*\w)c                P    |                      d                                          S N   groupupperms    I/root/projects/qq-shell/venv/lib64/python3.11/site-packages/mypy/parse.py<lambda>zparse.<locals>.<lambda>;   s    

8H8H8J8J     blockerTcodelinecolumnr(   r)   )r   r   r   r   )native_parserospathexistsmypy.nativeparseignore_errorsignored_filespreserve_astsset_filenativeparsenative_parsedictignored_linesendswithis_stubresubgetcodesSYNTAXerror_codesreport	is_errorsraise_errortransform_sourcemypy.fastparse	fastparseparse)r   r   r   r   r   r   r   mypyr2   strip_function_bodiestreeparse_errorstype_ignoreserrorr   
is_blocker
error_codes                    r%   rH   rH      s<      * 7>>$ '	#####1QTV=Q5QM$1$O':O6O!OOD&'O:::/3/?/L/L%:)	 0M 0 0,D, "&l!3!3D==00DL
 &  	*&.J.JGTT"YYy$77
"YYv..
%!&JJ "'!2!6!6z!B!B!RelJ&M5?GZV`       %&"2"2"4"4 %""$$$K +))&11>T&Y`aaD &**,, Kr'   raw_datar   c                   ddl m}m}m} t	          |j                  }t          |          }	 ||          }
 ||
||	          } ||j                  }t          ||          }| |_	        |j
        |_
        |j        |_        |j        |_        |                     d          |_        |j        |
j        z   }|                    | ||           |D ]}|d         }t%          j        dd |          }|                    dd	          }|                    d
          }|t*          j        }n+t*          j                            |          pt*          j        }|                    |d         |d         |||           |S )zLoad AST from parsed binary data.

    This essentially replicates parse() above but expects FileRawData instead of actually
    parsing the source code in the file.
    r   )Statedeserialize_importsread_statementsr   r   r   r   c                P    |                      d                                          S r   r    r#   s    r%   r&   zload_from_raw.<locals>.<lambda>t   s    

0@0@0B0B r'   r(   Tr)   Nr*   r+   r,   )r1   rS   rT   rU   r   defsr   importsr	   r/   r9   is_partial_stub_packageuses_template_stringsr:   r;   
raw_errorsr   r5   r<   r=   r>   r?   r@   rA   rB   )r   r   rQ   r   r   rS   rT   rU   datanstaterW   rX   rK   
all_errorsrN   r   rO   rP   s                      r%   load_from_rawr`   W   s    MLLLLLLLLL hm$$DAE'NNE?5$**D!!("233GD'""DDI!/D#+#CD !)!?D==((DL $u|3J
OOD&'O222 
d 
d	"&&B&BGLLYYy$//
YYv&&
JJ*..z::JelJeFmU8_gzXbccccKr'   )FF)r   r   r   r   r   r   r   r   r   r
   r   r   r   r   r   r	   )r   r   r   r   rQ   r   r   r   r   r
   r   r	   )
__future__r   r.   r<   librt.internalr   rI   r   r?   
mypy.cacher   mypy.errorsr   
mypy.nodesr   r	   mypy.optionsr
   rH   r`    r'   r%   <module>rh      s    " " " " " " 				 				 % % % % % % $ $ $ $ $ $             , , , , , , , ,             !E E E E EP& & & & & &r'   