rL idZddlmZmZddlmZddlZddlmZGddejejZ dZ d Z d d Z d d Zd Zy)a- Custom roles for the Matplotlib documentation. .. warning:: These roles are considered semi-public. They are only intended to be used in the Matplotlib documentation. However, it can happen that downstream packages end up pulling these roles into their documentation, which will result in documentation build errors. The following describes the exact mechanism and how to fix the errors. There are two ways, Matplotlib docstrings can end up in downstream documentation. You have to subclass a Matplotlib class and either use the ``:inherited-members:`` option in your autodoc configuration, or you have to override a method without specifying a new docstring; the new method will inherit the original docstring and still render in your autodoc. If the docstring contains one of the custom sphinx roles, you'll see one of the following error messages: .. code-block:: none Unknown interpreted text role "mpltype". Unknown interpreted text role "rc". To fix this, you can add this module as extension to your sphinx :file:`conf.py`:: extensions = [ 'matplotlib.sphinxext.roles', # Other extensions. ] .. warning:: Direct use of these roles in other packages is not officially supported. We reserve the right to modify or remove these roles without prior notification. )urlsplit urlunsplit)nodesN)rcParamsDefaultceZdZdZdZy)_QueryReferencez Wraps a reference or pending reference to add a query string. The query string is generated from the attributes added to this node. Also equivalent to a `~docutils.nodes.literal` node. cNdjd|jDS)z+Generate query string from node attributes.&c30K|]\}}|d|yw)=N).0namevalues `/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/matplotlib/sphinxext/roles.py z2_QueryReference.to_query_string..9sLkdE4&%)Ls)joinattlist)selfs rto_query_stringz_QueryReference.to_query_string7sxxLT\\^LLLN)__name__ __module__ __qualname____doc__rr rrrr.s Mrrc|j}|jtjD].}t |dj |}t ||d<0|j|y)z Resolve *node* into query strings on its ``reference`` children. Then act as if this is a `~docutils.nodes.literal`. refuri)queryN)rfindallr referencer_replacer visit_literal)rnoderrefnodeuris r_visit_query_reference_noder&<si  "E<<0,wx()222?&sO, trc&|j|y)z8 Act as if this is a `~docutils.nodes.literal`. N)depart_literal)rr#s r_depart_query_reference_noder)Js rc Td|d}d}|j||d|dd|\} } t||} | | z } | g} |tvrc|dk7r^| jt j d t j d tt|t j d g| | fS) z Sphinx role ``:rc:`` to highlight and link ``rcParams`` entries. Usage: Give the desired ``rcParams`` key as parameter. :code:`:rc:`figure.dpi`` will render as: :rc:`figure.dpi` z rcParams["z"]zmatplotlibrc-sample <>ref) highlightbackendz (default: )) interpretedrrextendrTextliteralrepr) rrawtexttextlinenoinlineroptionscontenttitletarget ref_nodesmessagesqr node_lists r _rcparam_rolerCQsb !E "F!--ewb5J.3V=Ix D 1B)OBI 49#4 JJ} % MM"d?4#89 : JJsO  h rcz|}ddi}||vrtd||j||d||dd|\} } | | fS)a} Sphinx role ``:mpltype:`` for custom matplotlib types. In Matplotlib, there are a number of type-like concepts that do not have a direct type representation; example: color. This role allows to properly highlight them in the docs and link to their definition. Currently supported values: - :code:`:mpltype:`color`` will render as: :mpltype:`color` color colors_defzUnknown mpltype: r+r,r-) ValueErrorr2) rr7r8r9r:r;r<mpltypetype_to_link_targetrBr@s r _mpltype_rolerJpsrG)),WK899!--G9B27;vOIx h rc|jdt|jdt|jtt t ft t ft t ftjdddS)NrcrH)htmllatexr8T)versionparallel_read_safeparallel_write_safe) add_rolerCrJadd_noderr&r) matplotlib __version__)apps rsetuprWsiLL}%LLM*LL)+G H*,HI)+G H  "--"&t EEr)NN)r urllib.parserrdocutilsrrTrInline TextElementrr&r)rCrJrWr rrr\sM#J.& MellE$5$5 M >2 Er