
    -h
                        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	 d dl
mZ d dlmZ d dlmZ erd d	lmZ d d
lmZ e	j        fddZe	j        fddZdS )    )annotations)PyCF_ONLY_AST)suppress)TYPE_CHECKING)LogLevel)BuiltinModuleError)safe_get_annotation)logger)Expr)	Docstring	docstringr   offsetintmessagestr	log_levelr   returnNonec                B    t           j        fdd} || |||           dS )az  Log a warning when parsing a docstring.

    This function logs a warning message by prefixing it with the filepath and line number.

    Parameters:
        docstring: The docstring object.
        offset: The offset in the docstring lines.
        message: The message to log.

    Returns:
        A function used to log parsing warnings if `name` was passed, else none.
    r   r   r   r   r   r   r   r   r   r   c                   	 | j         j        }n9# t          t          f$ r d}Y n$t          $ r d| j         j        j         d}Y nw xY wt          t          |j	                  } || d| j
        pd|z    d|            d S )Nz<module>z	<module: >:r   z: )parentrelative_filepathAttributeError
ValueErrorr   modulenamegetattrr
   valuelineno)r   r   r   r   prefixlogs         U/var/www/FlaskApp/flask-venv/lib/python3.11/site-packages/_griffe/docstrings/utils.pywarnzdocstring_warning.<locals>.warn&   s    	A%7FF
+ 	  	  	 FFF! 	A 	A 	A@!1!8!=@@@FFF	Afio..vEE).Q&8EEGEEFFFFFs    AAAN
r   r   r   r   r   r   r   r   r   r   )r   warning)r   r   r   r   r%   s        r$   docstring_warningr(      sH    & U]Td G G G G G 	DFGY/////    
annotation
str | Exprc                   t          t          t                    5  t          | ddt          d          }|j        r,t          |j        |j        |          }|p| cddd           S 	 ddd           n# 1 swxY w Y   | S )a  Parse a string into a true name or expression that can be resolved later.

    Parameters:
        annotation: The annotation to parse.
        docstring: The docstring in which the annotation appears.
            The docstring's parent is accessed to bind a resolver to the resulting name/expression.
        log_level: Log level to use to log a message.

    Returns:
        The string unchanged, or a new name or expression.
    eval    )modefilenameflagsoptimize)r   r   N)r   r   SyntaxErrorcompiler   bodyr	   r   )r*   r   r   codename_or_exprs        r$   parse_docstring_annotationr9   3   s      

 
 . . z=[\]]]9 	..	 '#  L
  -:. . . . . . . .
	.. . . . . . . . . . . . . . . s   A A55A9<A9Nr&   )r*   r   r   r   r   r   r   r+   )
__future__r   astr   
contextlibr   typingr   _griffe.enumerationsr   _griffe.exceptionsr   _griffe.expressionsr	   _griffe.loggerr
   r   _griffe.modelsr   r'   r(   errorr9    r)   r$   <module>rE      s   # " " " " "                         ) ) ) ) ) ) 1 1 1 1 1 1 3 3 3 3 3 3 ! ! ! ! ! ! )(((((((((((( #*	0 0 0 0 0F #.      r)   