
    Mh                    h    d dl mZ d dlZd dlZd dlZd dlmZ 	 	 	 dddZddZddZ	dddZ
ddZdS )    )annotationsN)AnyFarticle
str | Nonevaluer   nameverboseboolcapitalreturnstrc                   t          | t                    r|                                 } t          j        |          st          |          j        }n|j        }|rt          |          |z   }| dk    s| <t          j        |          s'|| d| }| t          |d|          S |S d}t          j        |          r|j        }nt          |t          j
                  r
|j        }d}nt          |t          j                  r|j        j        }d}n_t          |          j        t          j        t
          j        fv r"dt          t!          |                    z  }d}nt#          |          }d}|rt          |          |z   }|r|                    d          }t'          | ||||          S | d	v s| | |S t          |d|          S t)          d
| z            )a  Return string that describes a value

    Parameters
    ----------
    article : str or None
        A definite or indefinite article. If the article is
        indefinite (i.e. "a" or "an") the appropriate one
        will be inferred. Thus, the arguments of ``describe``
        can themselves represent what the resulting string
        will actually look like. If None, then no article
        will be prepended to the result. For non-articled
        description, values that are instances are treated
        definitely, while classes are handled indefinitely.
    value : any
        The value which will be named.
    name : str or None (default: None)
        Only applies when ``article`` is "the" - this
        ``name`` is a definite reference to the value.
        By default one will be inferred from the value's
        type and repr methods.
    verbose : bool (default: False)
        Whether the name should be concise or verbose. When
        possible, verbose names include the module, and/or
        class name where an object was defined.
    capital : bool (default: False)
        Whether the first letter of the article should
        be capitalized or not. By default it is not.

    Examples
    --------
    Indefinite description:

    >>> describe("a", object())
    'an object'
    >>> describe("a", object)
    'an object'
    >>> describe("a", type(object))
    'a type'

    Definite description:

    >>> describe("the", object())
    "the object at '...'"
    >>> describe("the", object)
    'the object object'
    >>> describe("the", type(object))
    'the type type'

    Definitely named description:

    >>> describe("the", object(), "I made")
    'the object I made'
    >>> describe("the", object, "I will use")
    'the object I will use'
    theN TFzat '%s'z'')r   r	   r   )aanzAThe 'article' argument should be 'the', 'a', 'an', or None not %r)
isinstancer   lowerinspectisclasstype__name___prefixadd_articletypesFunctionType
MethodType__func____repr__objecthexidreprjoindescribe
ValueError)r   r   r   r	   r   typenameresult	tick_wraps           \/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/traitlets/utils/descriptions.pyr%   r%   	   s   | '3 "--//?5!! ";;'> -5>>H,%GOGOE4J4JO ))4))F""64999Iu%%  ~E5#566  ~ 		E5#344  ~. 		e%*   !3r%yy>>1E{{ -u~~, 'yyGUwPWXXXX	K		7??O8UG444ORYY
 
 	
    c                    t          | t          j                  rt          d | j        d          dz   }n.t          j        |           }||j        dk    r|j        dz   }nd}|S )NT)r	   .builtins )r   r   r   r%   __self__r   	getmoduler   )r   r   modules      r*   r   r   z   sn    %)** end;;;cA"5))&/Z"?"??S(DDDKr+   c                    t          j        |           rt          | j                  S t	          t          |                     S )zsReturns a string of the value's type with an indefinite article.

    For example 'an Image' or 'a PlotValue'.
    )r   r   r   r   class_ofr   )r   s    r*   r4   r4      s:    
 u %5>***U$$$r+   definitec                   |rd| z   }nQt          j        d                              d|           }|dd                                         dv rd| z   }nd| z   }|r%|d	                                         |dd         z   S |S )
a  Returns the string with a prepended article.

    The input does not need to begin with a character.

    Parameters
    ----------
    name : str
        Name to which to prepend an article
    definite : bool (default: False)
        Whether the article is definite or not.
        Indefinite articles being 'a' and 'an',
        while 'the' is definite.
    capital : bool (default: False)
        Whether the added article should have
        its first letter capitalized or not.
    zthe z[\W_]+r/   N   aeiouzan za r   )recompilesubr   upper)r   r5   r   r(   first_letterss        r*   r   r      s    "  !$
9--11"d;;!""$$//T\FFD[F ay  6!"":--r+   objc                .    t          |           }| d|S )z]Return a string representation of a value and its type for readable

    error messages.
    r   )r   )r>   the_types     r*   	repr_typerA      s#    
 CyyH""h"""r+   )NFF)r   r   r   r   r   r   r	   r
   r   r
   r   r   )r   r   r   r   )r   r   r   r   )FF)r   r   r5   r
   r   r
   r   r   )r>   r   r   r   )
__future__r   r   r9   r   typingr   r%   r   r4   r   rA    r+   r*   <module>rE      s    " " " " " "  				        n
 n
 n
 n
 n
b	 	 	 	% % % %    ># # # # # #r+   