§
    º¦-e†$  ã                  ó¼   — U d Z ddlmZ ddlZ ej        e¦  «        ZddlmZm	Z	m
Z
 ddlZddlmZ ddlmZ ddlmZ erdd	lmZ i Zd
ed<   dZ G d„ d¦  «        ZdS )z\ Provide a ``Theme`` class for specifying new default values for Bokeh
|Model| properties.

é    )ÚannotationsN)ÚTYPE_CHECKINGÚAnyÚoverloadé   )ÚHasProps)ÚPathLike)Ú
deprecated)ÚModelúdict[str, Any]Ú_empty_dict)ÚThemec                  ó˜   — e Zd ZU dZded<   ded<   ded<   ded<   ded<   edd„¦   «         Zedd„¦   «         Zdd d„Zd!d„Zd"d„Zd#d„Z	dS )$r   aV   Provide new default values for Bokeh models.

    Bokeh Model properties all have some built-in default value. If a property
    has not been explicitly set (e.g. ``m.foo = 10``), accessing the
    property will return the default value. It may be useful for users to be
    able to specify a different set of default values than the built-in
    default. The ``Theme`` class allows collections of custom default values
    to be easily applied to Bokeh documents.

    The ``Theme`` class can be constructed either from a YAML file or from a
    JSON dict (but not both). Examples of both formats are shown below.

    The plotting API's defaults override some theme properties. Namely:
    `fill_alpha`, `fill_color`, `line_alpha`, `line_color`, `text_alpha` and
    `text_color`. Those properties should therefore be set explicitly when
    using the plotting API.

    Args:
        filename (str, optional) : path to a YAML theme file
        json (str, optional) : a JSON dictionary specifying theme values

    Raises:
        ValueError
            If neither ``filename`` or ``json`` is supplied.

    Examples:

        Themes are specified by providing a top-level key ``attrs`` which
        has blocks for Model types to be themed. Each block has keys and
        values that specify the new property defaults for that type.

        Take note of the fact that YAML interprets the value `None` as
        a string, which is not usually what you want. To give `None` as a
        value in YAML, use `!!null`. To give 'None' as a value in json,
        use `null`.

        Here is an example theme in YAML format that sets various visual
        properties for all figures, grids, and titles:

        .. code-block:: yaml

            attrs:
                Plot:
                    background_fill_color: '#2F2F2F'
                    border_fill_color: '#2F2F2F'
                    outline_line_color: '#444444'
                Axis:
                    axis_line_color: !!null
                Grid:
                    grid_line_dash: [6, 4]
                    grid_line_alpha: .3
                Title:
                    text_color: "white"

        Here is the same theme, in JSON format:

        .. code-block:: python

            {
                'attrs' : {
                    'Plot': {
                        'background_fill_color': '#2F2F2F',
                        'border_fill_color': '#2F2F2F',
                        'outline_line_color': '#444444',
                    },
                    'Axis': {
                        'axis_line_color': None,
                    },
                    'Grid': {
                        'grid_line_dash': [6, 4],
                        'grid_line_alpha': .3,
                    },
                    'Title': {
                        'text_color': 'white'
                    }
                }
            }

    zdict[str, dict[str, Any]]Ú_by_class_cacher   Ú_line_defaultsÚ_fill_defaultsÚ_text_defaultsÚ_jsonÚfilenamer	   ÚreturnÚNonec                ó   — d S ©N© )Úselfr   s     ú2lib/python3.11/site-packages/bokeh/themes/theme.pyÚ__init__zTheme.__init__—   s   € Ø47°Có    Újsonc                ó   — d S r   r   )r   r   s     r   r   zTheme.__init__™   s   € Ø69°cr   NúPathLike | Noneúdict[str, Any] | Nonec                ó¨  — ||t          d¦  «        ‚|@t          |d¦  «        5 }t          j        |¦  «        }|€i }d d d ¦  «         n# 1 swxY w Y   |€t          d¦  «        ‚|| _        d| j        vr
i | j        d<   t          | j        d         t          ¦  «        st          d| j        d         ›¦  «        ‚| j        d                              ¦   «         D ]/\  }}t          |t          ¦  «        st          d|› d|›¦  «        ‚Œ0d| j        d         v r@| j        d         d         | j        d         d	<   | j        d         d= t          d
dd¦  «         | j         	                    dt          ¦  «        | _        | j         	                    dt          ¦  «        | _        | j         	                    dt          ¦  «        | _        i | _        d S )Nz=Theme should be constructed from a file or from json not bothÚrbz.Theme requires json or a filename to constructÚattrszFtheme problem: attrs field should be a dictionary of class names, not ztheme problem: attrs.z+ should be a dictionary of properties, not ÚFigureÚfigure)é   r   r   z,Use of 'Figure' as a key in Theme attributesz'figure' (lower-case) as a keyÚline_defaultsÚfill_defaultsÚtext_defaults)Ú
ValueErrorÚopenÚyamlÚ	safe_loadr   Ú
isinstanceÚdictÚitemsr
   Úgetr   r   r   r   r   )r   r   r   ÚfÚkeyÚvalues         r   r   zTheme.__init__œ   s  € ØÐ  tÐ'7ÝÐ\Ñ]Ô]Ð]àÐÝh Ñ%Ô%ð ¨Ý”~ aÑ(Ô(à<ØDð	ð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð ð ˆ<ÝÐMÑNÔNÐNàˆŒ
à˜$œ*Ð$Ð$Ø"$ˆDŒJwÑå˜$œ* WÔ-­tÑ4Ô4ð 	ÝÐ}ÐfjÔfpÐqxÔfyÐ}Ð}Ñ~Ô~Ð~àœ* WÔ-×3Ò3Ñ5Ô5ð 	tð 	t‰JˆCÝ˜e¥TÑ*Ô*ð tÝ Ð!r¸Ð!rÐ!rÐinÐ!rÐ!rÑsÔsÐsðtð t”z 'Ô*Ð*Ð*Ø,0¬J°wÔ,?ÀÔ,IˆDŒJwÔ Ñ)Ø”
˜7Ô# HÐ-ÝyÐ"PÐRrÑsÔsÐsà"œjŸnšn¨_½kÑJÔJˆÔØ"œjŸnšn¨_½kÑJÔJˆÔØ"œjŸnšn¨_½kÑJÔJˆÔð
  "ˆÔÐÐs   ¦AÁAÁAÚclsútype[HasProps]Úpropsc                ó6  — ddl m} t          ||¦  «        r€t          |d¦  «        r|                     | j        ¦  «         t          |d¦  «        r|                     | j        ¦  «         t          |d¦  «        r|                     | j        ¦  «         d S d S d S )Nr   )ÚGlyphÚ
line_alphaÚ
fill_alphaÚ
text_alpha)Úmodels.glyphsr;   Ú
issubclassÚhasattrÚupdater   r   r   )r   r7   r9   r;   s       r   Ú_add_glyph_defaultszTheme._add_glyph_defaultsÅ   sµ   € Ø)Ð)Ð)Ð)Ð)Ð)Ýc˜5Ñ!Ô!ð 	2Ýs˜LÑ)Ô)ð 2Ø—’˜TÔ0Ñ1Ô1Ð1Ýs˜LÑ)Ô)ð 2Ø—’˜TÔ0Ñ1Ô1Ð1Ýs˜LÑ)Ô)ð 2Ø—’˜TÔ0Ñ1Ô1Ð1Ð1Ð1ð	2ð 	2ð
2ð 2r   útype[Model]c                ó–  — |j         | j        vrª| j        d         }i }|j        dd d…         D ]a}t	          |t
          ¦  «        sŒ|                      ||¦  «         |                     |                     |j         t          ¦  «        ¦  «         Œbt          |¦  «        dk    rt          }|| j        |j         <   | j        |j                  S )Nr%   éþÿÿÿéÿÿÿÿr   )Ú__name__r   r   Ú__mro__r@   r   rC   rB   r3   r   Úlen)r   r7   r%   ÚcombinedÚbases        r   Ú
_for_classzTheme._for_classÏ   sÆ   € ØŒ<˜tÔ3Ð3Ð3Ø”J˜wÔ'ˆEØ')ˆHàœ B F¨ FÔ+ð Gð GÝ! $­Ñ1Ô1ð ØØ×(Ò(¨¨xÑ8Ô8Ð8Ø—’ §	¢	¨$¬-½Ñ EÔ EÑFÔFÐFÐFÝ8‰}Œ} Ò!Ð!Ý&Ø19ˆDÔ  ¤Ñ.ØÔ# C¤LÔ1Ð1r   Úmodelr   c                ó®   — |                      |                      |j        ¦  «        ¦  «         t          t          ¦  «        dk    rt          d¦  «        ‚dS )zÂ Apply this theme to a model.

        .. warning::
            Typically, don't call this method directly. Instead, set the theme
            on the |Document| the model is a part of.

        r   z!Somebody put stuff in _empty_dictN)Úapply_themerM   Ú	__class__rJ   r   ÚRuntimeError)r   rN   s     r   Úapply_to_modelzTheme.apply_to_modelÞ   sR   € ð 	×Ò˜$Ÿ/š/¨%¬/Ñ:Ô:Ñ;Ô;Ð;õ
 {ÑÔ˜aÒÐÝÐBÑCÔCÐCð  Ðr   )r   r	   r   r   )r   r   r   r   )NN)r   r!   r   r"   r   r   )r7   r8   r9   r   r   r   )r7   rD   r   r   )rN   r   r   r   )
rH   Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r   r   rC   rM   rS   r   r   r   r   r   >   sé   € € € € € € ðNð Nð` /Ð.Ð.Ñ.à"Ð"Ð"Ñ"Ø"Ð"Ð"Ñ"Ø"Ð"Ð"Ñ"àÐÐÑàØ7Ð7Ð7ñ „XØ7ØØ9Ð9Ð9ñ „XØ9ð'"ð '"ð '"ð '"ð '"ðR2ð 2ð 2ð 2ð2ð 2ð 2ð 2ðDð Dð Dð Dð Dð Dr   r   )rV   Ú
__future__r   ÚloggingÚ	getLoggerrH   ÚlogÚtypingr   r   r   r.   Úcore.has_propsr   Ú
core.typesr	   Úutil.deprecationr
   rN   r   r   rW   Ú__all__r   r   r   r   ú<module>ra      s   ððð ð ð #Ð "Ð "Ð "Ð "Ð "à €€€Ø€gÔ˜Ñ!Ô!€ð 0Ð /Ð /Ð /Ð /Ð /Ð /Ð /Ð /Ð /ð €€€ð &Ð %Ð %Ð %Ð %Ð %Ø !Ð !Ð !Ð !Ð !Ð !Ø )Ð )Ð )Ð )Ð )Ð )àð ØÐÐÐÐÐð !€Ð  Ð  Ð  Ñ  ð€ð nDð nDð nDð nDð nDñ nDô nDð nDð nDð nDr   