K i|ddlmZddlZddlZddlZddlmZ d d dZd dZd dZ d ddZ ddZ y)) annotationsN)Anyct|tr|j}tj|st |j }n |j }|rt||z}|dk(s|?tj|s)||d|}| t|d|S|Sd}tj|r |j }nt|tjr|j }d}nt|tjr|jj }d}n\t |jtjt jfvrdtt!|z}d}n t#|}d}|rt||z}|r|j%d}t'|||||S|dvs|||St|d|St)d |z) aReturn 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' the TFzat '%s'z'')nameverbosecapital)aanzAThe 'article' argument should be 'the', 'a', 'an', or None not %r) isinstancestrlowerinspectisclasstype__name___prefix add_articletypes FunctionType MethodType__func____repr__objecthexidreprjoindescribe ValueError)articlevaluerr r typenameresult tick_wraps b/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/traitlets/utils/descriptions.pyr r s|'3--/ ??5 !;''>>5>H,%GOGOOE4J   z4&)F""6499 Iu%~~E5#5#56~~ E5#3#34~~.. e%% *!3r%y>1E{u~,yyGUwPWX X K 7? ?O8UG44 ORY Y  ct|tjrtd|jddz}|St j |}| |jdk7r|jdz}|Sd}|S)NT)r .builtins)r rrr __self__r getmoduler)r#rmodules r'rrzst%))*ennd;cA K ""5)  &//Z"???S(D KD Kr(c~tj|rt|jSt t |S)zsReturns a string of the value's type with an indefinite article. For example 'an Image' or 'a PlotValue'. )rrrrclass_ofr)r#s r'r1r1s. u5>>**U $$r(c|rd|z}nEtjdjd|}|ddjdvrd|z}nd|z}|r|d j |ddzS|S) aReturns 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. zthe z[\W_]+r,Naeiouzan za r)recompilesubrupper)rdefiniter r% first_letterss r'rrsy"$ 9-11"d; !  " " $ /T\FD[Fay 6!":-- r(c&t|}|d|S)z]Return a string representation of a value and its type for readable error messages. r)r)objthe_types r' repr_typer>s CyHWAh\ ""r()NFF) r" str | Noner#rrr?r boolr r@returnr)r#rrAr)r#rrAr)FF)rrr9r@r r@rAr)r<rrAr) __future__rrr5rtypingrr rr1rr>r(r'rEsx"   n n n  n  n  n  n b %>#r(