
    g                       U d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dl	Z	d dl
mZ d dlmZmZmZmZ d dlmZ d dlmZ d dlmZmZ d dlmZ d d	lmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$ d d
l%m&Z& d dl'Z'd dl(Z'd dl)Z'd dl*m+c m,Z- d dl.m/Z/ d dl0m1Z1 ejd                  dk\  rd dlm3Z3m4Z4m5Z5 n
d dl%m3Z3m4Z4m5Z5 er[d dl6m7Z7 d dlm8Z8 d dl9m:Z: d dl;m<Z< ejd                  dk\  rd dlm=Z= nd dl%m=Z= ejd                  dk\  r	d dlm>Z>m?Z? nd dl%m>Z>m?Z? dZ@deAd<   eBe'j                  j                     ZEdeAd<   eFeGeEf   ZHdeAd<   dZIdeAd<   dZJdeAd <   d!aKd"eAd#<    ed$      ZLdld%ZMdld&ZNej                  dmd'       ZPe$	 dnd(d)	 	 	 	 	 	 	 	 	 dod*       ZQe$	 dn	 	 	 	 	 	 	 	 	 dpd+       ZQ	 dqd!d)	 	 	 	 	 	 	 drd,ZQ	 dq	 	 	 	 	 	 	 dsd-ZRdtd.ZSdud/ZTdvd0ZU	 dq	 	 	 	 	 dwd1ZVdxd2ZW	 	 	 	 dyd3ZX	 	 	 	 dzd4ZY	 	 	 	 d{d5ZZd|d6Z[	 	 	 	 d}d7Z\d~d8Z]dyd9Z^dzd:Z_	 	 	 	 dzd;Z`dzd<Zadd=Zbdd>Zcdd?Zddd@Ze	 dq	 	 	 	 	 ddAZf G dB dCe'j                        Zg e!dDe dE   e dF   e dG   d!H      Zh	  e4dIee dJ   ehf   ehfK      Zi	 e5 G dL dMeeh   e3             Zje5 G dN dOeje dF      e3             Zk G dP dQ      Zl el       Zm e!dR      Zne"enelf   ZodeAdS<   	 ddTZpe$ddV       Zqe$ddW       ZqddXZqe$ddY       Zre$ddZ       Zrdd[Zr G d\ d]      Zsdd^Zt	 	 	 	 	 	 dd_Zu e!d`esa      Zv e!dUeseFeef   eBe         Zw	 ddbZxddcZyeGezfdd	 	 	 	 	 ddeZ{ddfZ| G dg dh      Z} G di dj      Z~ddkZy)    )annotationsN)defaultdict)IterableIteratorMappingSequence)partial)version)chainzip_longest)ceil)	TYPE_CHECKINGAnyFinalGenericLiteralTypeVarUnioncastoverload)	TypeAlias)Version)vegalite)      )ProtocolTypeAliasTyperuntime_checkable)
ModuleType)ClassVar)Registry)	ChartType)r      )TypeIs)r      )NeverSelfzModuleType | Noner   _OptionalModuleValidationErrorListGroupedValidationErrorszurn:vega-lite-schemar   _VEGA_LITE_ROOT_URIz'http://json-schema.org/draft-07/schema#_DEFAULT_JSON_SCHEMA_DRAFT_URLTbool
DEBUG_MODE
jsonschemac                     da y )NTr.        J/var/www/openai/venv/lib/python3.12/site-packages/altair/utils/schemapi.pyenable_debug_moder5   ^   s    Jr3   c                     da y )NFr1   r2   r3   r4   disable_debug_moder7   c   s    Jr3   c              #  8   K   t         }| a 	 d  |a y # |a w xY wwNr1   )argoriginals     r4   
debug_moder<   h   s$      HJ
X
s   	 .)raise_errorc                    y r9   r2   specschema
rootschemar=   s       r4   validate_jsonschemarC   s   s     r3   c                    y r9   r2   r?   s       r4   rC   rC   }   s     47r3   c                   t        | ||      }|r^t        |      }t        |      }t        |      }t	        |      }t        t        |j                                     d   }||_        |r||S y)a'  
    Validates the passed in spec against the schema in the context of the rootschema.

    If any errors are found, they are deduplicated and prioritized
    and only the most relevant errors are kept. Errors are then either raised
    or returned, depending on the value of `raise_error`.
    rB   r   N)	_get_errors_from_spec_get_leaves_of_error_tree_group_errors_by_json_path#_subset_to_most_specific_json_paths_deduplicate_errorsnextitervalues_all_errors)r@   rA   rB   r=   errorsleaf_errorsgrouped_errors
main_errors           r4   rC   rC      sx     #4JGF/73K@<^L,^< tN$9$9$;<=a@
 "0
r3   c                   t        |xs |      }t        j                  j                  d|i      }i }t	        |d      r|j
                  |d<   t               rt        |      }t        |xs ||      |d<   n&|t        j                  j                  |      nd|d<    ||fi |}t        |j                  |             }|S )z
    Uses the relevant jsonschema validator to validate the passed in spec against the schema using the rootschema to resolve references.

    The schema and rootschema themselves are not validated but instead considered as valid.
    $schemaFORMAT_CHECKERformat_checkerregistryNresolver)_get_json_schema_draft_urlr/   
validatorsvalidator_forhasattrrV   _use_referencing_library_prepare_references_in_schema_get_referencing_registryRefResolverfrom_schemalistiter_errors)r@   rA   rB   json_schema_draft_urlvalidator_clsvalidator_kwargs	validatorrP   s           r4   rG   rG      s    ( 7z7KVL))77	)*M (*}./-:-I-I)*!.v6'@ &"7(
$ % ""..z: 	$ f9(89I)''-.FMr3   c                .    | j                  dt              S )NrU   )getr,   rA   s    r4   rZ   rZ      s    ::i!?@@r3   c                 8    t        t              t        d      k\  S )zeIn version 4.18.0, the jsonschema package deprecated RefResolver in favor of the referencing library.z4.18)r   jsonschema_version_strr2   r3   r4   r^   r^      s    )*gfo==r3   c                N    t        j                  |       } dfd |       } | S )Nc                *   | j                         D ]~  \  }}|dk(  rt        | |   z   | |<   t        |t              r |      | |<   7t        |t              sHg }|D ]+  }t        |t              r |      }|j                  |       - || |<    | S )a  
        Add _VEGA_LITE_ROOT_URI in front of all $ref values.

        This function recursively iterates through the whole dictionary.

        $ref values can only be nested in dictionaries or lists
        as the passed in `d` dictionary comes from the Vega-Lite json schema
        and in json we only have arrays (-> lists in Python) and objects
        (-> dictionaries in Python) which we need to iterate through.
        $ref)itemsr+   
isinstancedictrc   append)dkeyvalueprepared_valuesv_prepare_refss        r4   rz   z4_prepare_references_in_schema.<locals>._prepare_refs   s     '')JCf},qv5#E4(&u-#E4("$A!!T*)!,#**1-  )# $ r3   )ru   dict[str, Any]returnr{   )copydeepcopy)rA   rz   s    @r4   r_   r_      s)     ]]6"F2 6"FMr3   c                    dd l }dd l}|t        |       }|j                  j	                  |      }|j                  |       }|j                         j                  t        |      S )Nr   )uriresource)	referencingreferencing.jsonschemarZ   r/   specification_withcreate_resourcer!   with_resourcer+   )rB   re   r   specificationr   s        r4   r`   r`   
  sh     !$ :: F**==>STM,,Z8H!//( 0  r3   c                    d}| j                   D ]/  }t        |t              r|dt        |      z   dz   z  }(|d|z   z  }1 |S )z
    Drop in replacement for the .json_path property of the jsonschema ValidationError class.

    This is not available as property for ValidationError with jsonschema<4.0.1.

    More info, see https://github.com/vega/altair/issues/3038.
    $[].)absolute_pathrr   intstr)errpathelems      r4   
_json_pathr   !  sO     D!!dC C#d)Oc))DC$JD	 "
 Kr3   c                    t        t              }| D ],  }t        |dt        |            }||   j	                  |       . t        |      S )a%  
    Groups errors by the `json_path` attribute of the jsonschema ValidationError class.

    This attribute contains the path to the offending element within
    a chart specification and can therefore be considered as an identifier of an
    'issue' in the chart that needs to be fixed.
    	json_path)r   rc   getattrr   rt   rs   )rP   errors_by_json_pathr   err_keys       r4   rI   rI   2  sL     &d+#{JsO<G$++C0  #$$r3   c                    g }| D ]D  }|j                   r%|j                  t        |j                                4|j                  |       F |S )a0  
    For each error in `errors`, it traverses down the "error tree" that is generated by the jsonschema library to find and return all "leaf" errors.

    These are errors which have no further errors that caused it and so they are the most specific errors
    with the most specific error messages.
    )contextextendrH   rt   )rP   leavesr   s      r4   rH   rH   C  sE     #%F;; MM3CKK@AMM#  Mr3   c                    i }| j                         D ].  \  }}t        |t        | j                                     r*|||<   0 |S )a  
    Removes key (json path), value (errors) pairs where the json path is fully contained in another json path.

    For example if `errors_by_json_path` has two keys, `$.encoding.X` and `$.encoding.X.tooltip`,
    then the first one will be removed and only the second one is returned.

    This is done under the assumption that more specific json paths give more helpful error messages to the user.
    )rq   *_contained_at_start_of_one_of_other_valuesrc   keys)r   errors_by_json_path_specificr   rP   s       r4   rJ   rJ   X  sS     =? 0668	69t/4467
 7=(3	 9
 ('r3   c                ,     t         fd|D              S )Nc              3  L   K   | ]  }|k7  s	|j                          y wr9   )
startswith).0rw   xs     r4   	<genexpr>z=_contained_at_start_of_one_of_other_values.<locals>.<genexpr>o  s#     Eu!u*u"s   
$$)any)r   rN   s   ` r4   r   r   l  s     EEEEr3   c                R   i }| j                         D ]  \  }}t        |      }t        t        d}g }|j                         D ]:  \  }}|j	                  |      }	|	 |	|      }|j                  t        |             < |D 
cg c]  }
t        |
      r|
 }}
|||<    |S c c}
w )z
    Some errors have very similar error messages or are just in general not helpful for a user.

    This function removes as many of these cases as possible and
    can be extended over time to handle new cases that come up.
    )enumadditionalProperties)rq   _group_errors_by_validator_deduplicate_enum_errors)_deduplicate_additional_properties_errorsrj   r   _deduplicate_by_message_is_required_value_error)rR   grouped_errors_deduplicatedr   element_errorserrors_by_validatordeduplication_functionsdeduplicated_errorsrh   rP   deduplication_funcr   s              r4   rK   rK   r  s     <>%3%9%9%;!	>8H -$M#
 46!4!:!:!<Iv!8!<!<Y!G!-+F3&&'>v'FG	 "= /
.C6Ns6SC. 	 
 2E#I.3 &<4 '&
s   B$B$c                D    | j                   dk(  xr | j                  dgk(  S )Nrequiredrw   )rh   validator_value)r   s    r4   r   r     s#    ==J&K3+>+>7)+KKr3   c                    t        t              }| D ]   }||j                     j                  |       " t	        |      S )au  
    Groups the errors by the json schema "validator" that casued the error.

    For example if the error is that a value is not one of an enumeration in the json schema
    then the "validator" is `"enum"`, if the error is due to an unknown property that
    was set although no additional properties are allowed then "validator" is
    `"additionalProperties`, etc.
    )r   rc   rh   rt   rs   )rP   r   r   s      r4   r   r     sB     BMTAR 	CMM*11#6	 
 #$$r3   c                    t        |       dkD  r^| D cg c]  }dj                  |j                         }}g }t        ||       D ]#  \  }}t	        ||      r|j                  |       % |} | S c c}w )ap  
    Deduplicate enum errors by removing the errors where the allowed values are a subset of another error.

    For example, if `enum` contains two errors and one has `validator_value` (i.e. accepted values) ["A", "B"] and the
    other one ["A", "B", "C"] then the first one is removed and the final
    `enum` list only contains the error with ["A", "B", "C"].
       ,)lenjoinr   zipr   rt   )rP   r   value_stringslongest_enums	value_strs        r4   r   r     sz     6{Q CII&3#"5"56&I-/!-8NIs=iW$$S) 9 M Js   "A/c                    t        |       dkD  rF| d   j                  5j                  dk(  r&t        fd| dd D              rt	        | d       g} | S )a  
    If there are multiple additional property errors it usually means that the offending element was validated against multiple schemas and its parent is a common anyOf validator.

    The error messages produced from these cases are usually
    very similar and we just take the shortest one. For example,
    the following 3 errors are raised for the `unknown` channel option in
    `alt.X("variety", unknown=2)`:
    - "Additional properties are not allowed ('unknown' was unexpected)"
    - "Additional properties are not allowed ('field', 'unknown' were unexpected)"
    - "Additional properties are not allowed ('field', 'type', 'unknown' were unexpected)".
    r   r   NanyOfc              3  :   K   | ]  }|j                   u   y wr9   )parent)r   r   r   s     r4   r   z<_deduplicate_additional_properties_errors.<locals>.<genexpr>  s     ?JSCJJ&(Js   c                ,    t        | j                        S r9   )r   message)r   s    r4   <lambda>z;_deduplicate_additional_properties_errors.<locals>.<lambda>  s    AIIr3   )rv   )r   r   rh   allmin)rP   r   s    @r4   r   r     s`     6{Q !!  G+ ?F12J??&&>?@FMr3   c                p    t        | D ci c]  }|j                  | c}j                               S c c}w )zaDeduplicate errors by message. This keeps the original order in case it was chosen intentionally.)rc   r   rN   )rP   es     r4   r   r     s0    v.v!Av.55788.s   3c              #     K   t               }| h}|r0||z  }t        j                  d |D         }||z
  D ]  } |   |r/yyw)z=Breadth-first sequence of all classes which inherit from cls.c              3  N   K   | ]  }t        |j                                 y wr9   )set__subclasses__)r   clss     r4   r   z_subclasses.<locals>.<genexpr>  s     !S{#c&8&8&:";{s   #%N)r   union)r   seencurrent_sets      r4   _subclassesr     sN     5D%K
ii!S{!ST%CI & s   >AAc                   	 t        j                  | dd      }|j                         S # t        $ r t	        |       cY S w xY w)NT)strictseries_only)nwfrom_nativeto_list	TypeErrorrc   )objsers     r4   _from_array_liker     s>    nnS4@{{} Cys   '* A Ac                  | j                   | j                  | j                  d}t        | t        j
                        r| j                         t        j                  j                  k7  rK| j                  }|dk(  r|n|dz  }|j                  | j                  | j                  | j                  |       | j                  x}r4|t        j                  j                  u rd|d<   |S d|d}t!        |      |S )	z
    Parse native `datetime.(date|datetime)` into a `DateTime`_ schema.

    .. _DateTime:
        https://vega.github.io/vega-lite/docs/datetime.html
    )yearmonthdater   i  )hoursminutessecondsmillisecondsTutczUnsupported timezone z.
Only `'UTC'` or naive (local) datetimes are permitted.
See https://altair-viz.github.io/user_guide/generated/core/altair.DateTime.html)r   r   dayrr   dtdatetimetimer   microsecondupdatehourminutesecondtzinfotimezoner   r   )r   resultusmsr   msgs         r4   _from_date_datetimer     s     '*hhCGGTF#r{{#88:$BQwB%KBMMhh

CJJUW   ZZ6( $u M ,F: 6f f 
  n$Mr3   c                   ||}t        | |j                        r| D cg c]  }t        ||||       c}S t        | |j                        rt	        |       S t        | |j
                        rt        |       }d|vr|dz  }|S t        | t              r| j                  d|      S t        | t        t        f      r| D cg c]  }t        ||||       c}S t        | t              r8| j                         D ci c]  \  }}|t        ur|t        ||||       c}}S t        | t              r| j                         S |5t        | |j                        r|j                  |       j!                         S t#        | t        t$        f      rt        t'        |       |||      S t        | t(        j*                        rt-        |       S | S c c}w c c}w c c}}w )z+Convert an object to a dict representation.Tz	T00:00:00F)validater   exclude)rr   ndarray_todictnumberfloat
datetime64r   
SchemaBaseto_dictrc   tuplers   rq   	Undefined
SchemaLike	Timestamp	isoformat_is_iterablebytesr   r   r   r   )r   r   np_optpd_optnpry   r   ks           r4   r   r     s   c2::&ADEAGAw7EERYY':R]]+XF& +%M#z"{{E7{;;	C$	'=@AS7FF3SAA	C	 		
#1	! wq'6622#
 	

 
C	${{}		
30@0@ A$..00	cC<	0',gvvFF	C	!"3''
9 F B
s   GG<!Gc                f   t               rOt        |xs |       }|j                         }d| v r*|j                  t        | d   z         j
                  } d| v r*| S t        j                  j                  |xs |       }d| v r$|j                  | d         5 }|} ddd       d| v r$| S # 1 sw Y   xY w)z\Resolve schema references until there is no $ref anymore in the top-level of the dictionary.rp   N)
r^   r`   rY   lookupr+   contentsr/   ra   rb   	resolving)rA   rB   rX   referencing_resolverrY   resolveds         r4   _resolve_referencesr  :  s      !,Z-A6B  (002)00#fVn4h   M	 ))55j6JFK##F6N3x! 4  M 43s   B''B0c                       e Zd Zd	 fdZd
dZd
dZ	 	 	 	 ddZ	 	 	 	 ddZ	 	 	 	 ddZe	dd       Z
	 	 	 	 ddZ xZS )SchemaValidationErrorc                    t        |   di |j                          || _        t	        |dt	        |dt        |            |gi      | _        | j                  | _        | j                         | _        y)a-  
        A wrapper for ``jsonschema.ValidationError`` with friendlier traceback.

        Parameters
        ----------
        obj
            The instance that failed ``self.validate(...)``.
        err
            The original ``ValidationError``.

        Notes
        -----
        We do not raise `from err` as else the resulting traceback is very long
        as it contains part of the Vega-Lite schema.

        It would also first show the less helpful `ValidationError` instead of
        the more user friendly `SchemaValidationError`.
        rO   r   Nr2   )
super__init__	_contentsr   r   r   _errorsr   _original_message_get_message)selfr   r   	__class__s      r4   r  zSchemaValidationError.__init__Q  sg    & 	+3==?+07k:c?!KcU S1
 "&((*r3   c                    | j                   S r9   r   r!  s    r4   __str__zSchemaValidationError.__str__m  s    ||r3   c           
     ^   d
dd}g }t        | j                  j                               d d D ]"  }|j                  | j	                  |             $ d}t        |      dkD  r0t        |d      D cg c]  \  }} |d| d|        }}}|dz  }|d	j                  |      z  }|S c c}}w )Nc                    g }t        | j                  d            D ]1  \  }}|dkD  rt        |      dkD  rd|z  |z   }|j                  |       3 dj	                  |      S )N
r    )	enumeratesplitr   rt   r   )r   indentmodified_linesidxlines        r4   indent_second_line_onwardszFSchemaValidationError._get_message.<locals>.indent_second_line_onwardsq  sa    (*N&w}}T':;	T7s4y1}<$.D%%d+ < 99^,,r3   r    r   )startzError : zMultiple errors were found.



)   )r   r   r-  r   r|   r   )rc   r  rN   rt   _get_message_for_errors_groupr   r+  r   )r!  r1  error_messagesrP   r   error_idms          r4   r   z"SchemaValidationError._get_messagep  s    	- %' 4<<..01"15F!!$"D"DV"LM 6 ~" $-^1#E#EKHa +VH:Rs+CD#E   88G6;;~..s   3B)c                    |d   j                   dk(  r$| j                  |d         }|j                         S | j                  |      }|j                         S )Nr   r   )rP   )rh   (_get_additional_properties_error_message_get_default_error_messagestrip)r!  rP   r   s      r4   r7  z3SchemaValidationError._get_message_for_errors_group  s\     !9"88 CCF1ING }} 55V5DG}}r3   c           	     J   | j                  |      }t        j                  |      j                  j	                         }| j                  |      }|j                  j                  d      d   j                  d      d   }d|j                   d| d| d|j                   d		}|S )
zFOutput all existing parameters when an unknown parameter is specified.z(''r   `z` has no parameter named 'z!'

Existing parameter names are:
z
See the help for `z2` to read the full description of these parameters)	_get_altair_class_for_errorinspect	signature
parametersr   _format_params_as_tabler   r,  __name__)r!  error
altair_clsparam_dict_keysparam_names_tableparameter_namer   s          r4   r<  z>SchemaValidationError._get_additional_properties_error_message  s    
 55e<
!++J7BBGGI 88I
 ,,T226<<SA!D00@ A   &&''Y] r3   c                    t        |j                        D ]B  }t        |t              s|d   j	                         |dd z   }t        t        |d      }|A |S  | j                  j                  }|S )z
        Try to get the lowest class possible in the chart hierarchy so it can be displayed in the error message.

        This should lead to more informative error messages pointing the user closer to the source of the issue.
        r   r   N)	reversedr   rr   r   upperr   r   r   r"  )r!  rI  	prop_namepotential_class_namer   s        r4   rC  z1SchemaValidationError._get_altair_class_for_error  su     "%"5"56I)S)'0|'9'9';im'K$h(<dC? 
 7 (($$C
r3   c           	     z   t        | D cg c]  }|dvr|t        |      f c} \  }}t        |      }d}t        |      }t        t	        |dz              }t        ||z  |      }dd}	 |	||      }
g }g }d}|
D ]B  }|j                  ||||z           |j                  t        d |d   D                     ||z   }D g }t        |dd	iD ]  }|j                  |        d	}|D ]K  }t        |      D ];  \  }}||   }d
}|dj                  |||z         z  }|t        |      dz
  k(  s7|dz  }= M |S c c}w )z@Format param names into a table so that they are easier to read.>   kwdsr!  P   g      ?c                @    | |z  dz   g| |z  z  | |z  g|| |z  z
  z  z   S )Nr   r2   )nps     r4   split_into_equal_partszMSchemaValidationError._format_params_as_table.<locals>.split_into_equal_parts  s3    FQJ<1q5)Q!VHAE	,BBBr3   r   c              3  2   K   | ]  }t        |        y wr9   )r   )r   
param_names     r4   r   z@SchemaValidationError._format_params_as_table.<locals>.<genexpr>  s     N6M
C
O6Ms   r@  	fillvaluer2  r   z{:<{}}r   r)  )rW  r   rX  r   r|   z	list[int])
r   r   maxr   r   r   rt   r   r+  format)rK  nameparam_namesname_lengthsmax_name_lengthmax_column_widthnum_param_namessquare_columnscolumnsrY  column_heightsparam_names_columnscolumn_max_widthslast_end_idxchparam_names_rowslirL  param_names_rownumr[  max_name_length_column
column_pads                          r4   rG  z-SchemaValidationError._format_params_as_table  s   
 %( ,+D// s4y!+%
!\ l+k*T/3"678&/9>J	C 0I 68') B&&{<,QSBS'TU$$N6I"6MNN ,L ! 352AbAB##B' B "$/O#,_#=Z):3)?&
!X__ 6 C& ! 3/!34%-% $>  0 ! cs   D8c                |   g }t        |      }d|v r(|d   D ]   }|j                  d|j                          " d|v r|d   D cg c]  }d|j                   d }}d}t        |      dk(  r	||d   z  }n?t        |      dk(  r||d    d	|d    z  }n |d
j	                  |d d       d|d    z   z  }|j                  |       |d   }d|j
                   d}|j                  r|d|j                  d    dz  }t        |      dk(  r|dz  }npt        |      dk(  r|d|d    dz  }nU|D cg c]  }|d   j                         |dd  z    }}|dz  }|dj	                  |D cg c]  }d| 	 c}      z  }|dz  }d |j                         D        }	|dj	                  |	      z  }|S c c}w c c}w c c}w )Nr   zone of typerA  zof type r   r      z or z, r@  z, or z' is an invalid valuez for `rB  z.

z. Valid values are z. Valid values are:

r)  z- r5  c              3  Z   K   | ]#  \  }}|d vrdj                  d |D               % yw)>   r   rs  r)  c              3  4   K   | ]  }|j                     y wr9   r$  )r   r   s     r4   r   zMSchemaValidationError._get_default_error_message.<locals>.<genexpr>.<genexpr>-  s     0Aaiis   N)r   )r   rh   rP   s      r4   r   zCSchemaValidationError._get_default_error_message.<locals>.<genexpr>,  s5      
%@!	6 00 II000%@s   )+r2  )	r   rt   r   r   r   instancer   rP  rq   )
r!  rP   bullet_pointsr   rI  r   typespointr   its
             r4   r=  z0SchemaValidationError._get_default_error_message  s0    $&8@((,V4$$wu/D/D.E%FG 5 ((;Nv;VW;VCq,,-Q/;VEWE5zQq!UqE!H:T%(445":.5r1DDD  '
 q	 enn%%:; 3 3B 78::G }"wG1$,]1-=,>eDDG HUU}eU1X^^-ab	9}MU00GtyyM!JM5Bug,M!JKKGvG

%8%>%>%@

 	2772;U X8 V!Js   F/1 F4(F9
)r   r  r   zjsonschema.ValidationErrorr|   Noner|   r   )rP   r)   r|   r   )rI  %jsonschema.exceptions.ValidationErrorr|   r   )rI  r~  r|   ztype[SchemaBase])rK  zIterable[str]r|   r   )rH  
__module____qualname__r  r&  r   r7  r<  rC  staticmethodrG  r=  __classcell__r"  s   @r4   r  r  P  s    +82# 
 4 
*:	, 6! 6!p5#5 
5r3   r  _JSON_VT_costringobjectarray)	covariant_TypeMaprs  )type_paramsc                  $    e Zd ZU dZded<   ddZy)r  a  
    Represents ``altair`` classes which *may* not derive ``SchemaBase``.

    Attributes
    ----------
    _schema
        A single item JSON Schema using the `type`_ keyword.

    Notes
    -----
    Should be kept tightly defined to the **minimum** requirements for:
        - Converting into a form that can be validated by `jsonschema`_.
        - Avoiding calling ``.to_dict()`` on a class external to ``altair``.
    - ``_schema`` is more accurately described as a ``ClassVar``
        - See `discussion`_ for blocking issue.

    .. _jsonschema:
        https://github.com/python-jsonschema/jsonschema
    .. _type:
        https://json-schema.org/understanding-json-schema/reference/type
    .. _discussion:
        https://github.com/python/typing/discussions/1424
    z_TypeMap[_JSON_VT_co]_schemac                     y r9   r2   )r!  argsrT  s      r4   r  zSchemaLike.to_dictw  s    Sr3   N)r|   r   )rH  r  r  __doc____annotations__r  r2   r3   r4   r  r  [  s    0 #"0r3   r  c                  .    e Zd ZU dZded<   ddiZded<   y)	ConditionLikeaW  
    Represents the wrapped state of a conditional encoding or property.

    Attributes
    ----------
    condition
        One or more (predicate, statement) pairs which each form a condition.

    Notes
    -----
    - Can be extended with additional conditions.
    - *Does not* define a default value, but can be finalized with one.
    r   	conditionrs  r  z_TypeMap[Literal['object']]r  N)rH  r  r  r  r  r  r2   r3   r4   r  r  z  s     N,2H+=G(=r3   r  c                  $    e Zd ZdZdZddZddZy)UndefinedTypez4A singleton object for marking undefined parameters.Nc                    t        | j                  |       st        j                  | g|i || _        | j                  S r9   )rr   _UndefinedType__instancer  __new__)r   r  kwargss      r4   r  zUndefinedType.__new__  s4    #..#.#^^CA$A&ACN~~r3   c                     y)Nr  r2   r%  s    r4   __repr__zUndefinedType.__repr__  s    r3   )r|   r'   r}  )rH  r  r  r  r  r  r  r2   r3   r4   r  r    s    >J
r3   r  r   Optionalc                    | t         u S )a  
    Type-safe singleton check for `UndefinedType`.

    Notes
    -----
    - Using `obj is Undefined` does not narrow from `UndefinedType` in a union.
        - Due to the assumption that other `UndefinedType`'s could exist.
    - Current [typing spec advises](https://typing.readthedocs.io/en/latest/spec/concepts.html#support-for-singleton-types-in-unions) using an `Enum`.
        - Otherwise, requires an explicit guard to inform the type checker.
    r  r   s    r4   is_undefinedr    s     )r3   	_CopyImplc                     y r9   r2   r  s    r4   _shallow_copyr    s    03r3   c                     y r9   r2   r  s    r4   r  r    s    $'r3   c                    t        | t              r| j                  d      S t        | t        t        f      r| j                         S | S )NF)deep)rr   r  r}   rc   rs   r  s    r4   r  r    s<    #z"xxUx##	C$	&xxz
r3   c                     y r9   r2   r   by_refs     r4   
_deep_copyr    s    ?Br3   c                     y r9   r2   r  s     r4   r  r    s    36r3   c                   t        t        |      t        | t              rt	        | dd       x}rt        d      5   ||       cd d d        S fd| j                  D        }| j                  j                         D ci c]  \  }}|||vr |      n| }}}t        d      5   | j                  |i |cd d d        S t        | t              r| D cg c]
  } |       c}S t        | t              r0| j                         D ci c]  \  }}|||vr |      n| c}}S | S # 1 sw Y   xY wc c}}w # 1 sw Y   y xY wc c}w c c}}w )N)r  __deepcopy__Fc              3  .   K   | ]  } |        y wr9   r2   )r   r:   r}   s     r4   r   z_deep_copy.<locals>.<genexpr>  s     /YcS	Ys   )r	   r  rr   r  r   r<   _args_kwdsrq   r"  rc   rs   )r   r  copierr  r  ry   rT  r}   s          @r4   r  r    s)   :f-D#z"S.$7767E"c{ #"/SYY/CF99??CTUCT41aqDGA5CTU 3==$/$/ 	C	!$%AQ%%	C	CF99;O;41aqDGA5;OO
 #" V &Os)   D,D8(D>E
E,D5>Ec                      e Zd ZU dZdZded<   dZded<   dZded	<   dd
Z	 d	 	 	 	 	 ddZ	e
fdZ fdZd dZd Zd dZd!dZd"dZ	 d#ddd	 	 	 	 	 	 	 d$dZ	 	 	 d%ddd	 	 	 	 	 	 	 	 	 	 	 d&dZed'd       Ze	 d#	 	 	 	 	 	 	 d(d       Ze	 d#	 	 	 	 	 	 	 d)d       Ze	 d*	 	 	 	 	 d+d       Zed*d,d       Ze	 d*	 	 	 	 	 	 	 d-d       Zd. fdZ xZS )/r  z
    Base class for schema wrappers.

    Each derived class should set the _schema class attribute (and optionally
    the _rootschema class attribute) which is used for validation.
    NzClassVar[dict[str, Any] | Any]r  zClassVar[dict[str, Any] | None]_rootschemaTzClassVar[bool] _class_is_valid_at_instantiationc                <   | j                   d| j                   d}t        |      |rt        |      dk(  sJ t        |      dv sJ t        j                  | d|       t        j                  | d|       t        r | j                  r| j                  d       y y y )	Nz"Cannot instantiate object of type z): _schema class attribute is not defined.r   >   r   r   r  r  Tr   )	r  r"  
ValueErrorr   r  __setattr__r.   r  r  )r!  r  rT  r   s       r4   r  zSchemaBase.__init__  s    
 <<4T^^4D E  
 S/!t9>!>t9&&& 	4$/4$/$??LL$L' @:r3   c           	     `   |du r3t        dt        | |rt        |                  S t                           S t        d      5   | j                  | j
                  i | j                  }ddd       t        |      r%|D ]   }t         j                  |            ||<   " S # 1 sw Y   ;xY w)a  
        Return a copy of the object.

        Parameters
        ----------
        deep : boolean or list, optional
            If True (default) then return a deep copy of all dict, list, and
            SchemaBase objects within the object structure.
            If False, then only copy the top object.
            If a list or iterable, then only copy the listed attributes.
        ignore : list, optional
            A list of keys for which the contents should not be copied, but
            only stored by reference.
        Tr'   FN)
r   r  r   r<   r"  r  r  r  r  _get)r!  r  ignorer}   attrs        r4   r}   zSchemaBase.copy  s    " 4<
4V RSSCE RSS!4>>4::<<D *9499T?;T
  s   'B$$B-c                Z    | j                   j                  |t              }|t        u r|}|S )z3Get an attribute, returning default if not present.)r  rj   r  )r!  r  defaults      r4   r  zSchemaBase._get/  s(    zz~~dI.9Dr3   c                    |dk(  r
t               || j                  v r| j                  |   S 	 t        |   } ||      S # t         $ r t        |   }Y w xY w)Nr  )AttributeErrorr  r  __getattr____getattribute__)r!  r  _getattrr"  s      r4   r  zSchemaBase.__getattr__6  sd    7? ""4::::d##4 7. D>! " 4 734s   
A AAc                "    || j                   |<   y r9   r  r!  itemvals      r4   r  zSchemaBase.__setattr__C      

4r3   c                     | j                   |   S r9   r  )r!  r  s     r4   __getitem__zSchemaBase.__getitem__F  s    zz$r3   c                "    || j                   |<   y r9   r  r  s      r4   __setitem__zSchemaBase.__setitem__I  r  r3   c                   t        |       j                  }| j                  x}rTd t        |j	                               D        }dj                  |      j                  dd      }d\  }}| d| d| d| dS | d| j                  d   dS )	Nc              3  B   K   | ]  \  }}|t         us| d |  yw)r4  Nr  )r   r  ry   s      r4   r   z&SchemaBase.__repr__.<locals>.<genexpr>O  s(     W,@DAqAYDVQCr!-,@s   z,
r)  z
  ){}()r   )rs  rH  r  sortedrq   r   replacer  )r!  r_  rT  r{  r  LBRBs          r4   r  zSchemaBase.__repr__L  s    Dz""::4WF4::<,@WB::b>))$7DFBV1RDTF"RD22V1TZZ]-Q//r3   c                    t        |       t        |      u xr4 | j                  |j                  k(  xr | j                  |j                  k(  S r9   )rs  r  r  )r!  others     r4   __eq__zSchemaBase.__eq__V  sA    J$u+% *

ekk)*

ekk)	
r3   )r  r   c                  |xs i }|xs g }t        dd      }| j                  r| j                  s| j                  d   }n| j                  s| j                  j                         }h |d}|j	                  dd      x}rt        ||      }|j                         D 	ci c]  \  }}	||vs||	 }}}	|j                  d      x}
r1t        |
t              r!d	|
i|d<   nt        |        d
}t        |      t        |fd|i|}|r	 | j                  |       |S |S c c}	}w # t        j                  $ r}t!        | |      dd}~ww xY w)a  
        Return a dictionary representation of the object.

        Parameters
        ----------
        validate : bool, optional
            If True (default), then validate the result against the schema.
        ignore : list[str], optional
            A list of keys to ignore.
        context : dict[str, Any], optional
            A context dictionary.

        Raises
        ------
        SchemaValidationError :
            If ``validate`` and the result does not conform to the schema.

        Notes
        -----
        - ``ignore``, ``context`` are usually not needed to be specified as a user.
        - *Technical*: ``ignore`` will **not** be passed to child :meth:`.to_dict()`.
        numpypandasr  r  r   	shorthandparsed_shorthandNmarkrs  zD instance has both a value and properties : cannot serialize to dictr   )_get_optional_modulesr  r  r}   pop_replace_parsed_shorthandrq   rj   rr   r   rs  r  r   r   r/   ValidationErrorr  )r!  r   r  r   optsrT  r   parsedr  ry   r  r   r   r   s                 r4   r  zSchemaBase.to_dict]  sV   : -R2$GHE::djj::a=D::??$D,,,G %7>>v>0>%)ZZ\F\TQQg5EAqD\DF(((js.C &~V$ZL deCS/!7w7$7Af% v G -- A+D#6D@As$   !D .D D& &E9EEc               l    |g }|i }| j                  |||      }t        j                  |f||d|S )a  
        Emit the JSON representation for this object as a string.

        Parameters
        ----------
        validate : bool, optional
            If True (default), then validate the result against the schema.
        indent : int, optional
            The number of spaces of indentation to use. The default is 2.
        sort_keys : bool, optional
            If True (default), sort keys in the output.
        ignore : list[str], optional
            A list of keys to ignore.
        context : dict[str, Any], optional
            A context dictionary.
        **kwargs
            Additional keyword arguments are passed to ``json.dumps()``

        Raises
        ------
        SchemaValidationError :
            If ``validate`` and the result does not conform to the schema.

        Notes
        -----
        - ``ignore``, ``context`` are usually not needed to be specified as a user.
        - *Technical*: ``ignore`` will **not** be passed to child :meth:`.to_dict()`.
        )r   r  r   )r-  	sort_keys)r  jsondumps)r!  r   r-  r  r  r   r  dcts           r4   to_jsonzSchemaBase.to_json  sH    L >F?GllHVWlMzz#Lf	LVLLr3   c                     t        t              S )z6Return the set of classes used within cls.from_dict().)r   r  )r   s    r4   _default_wrapper_classesz#SchemaBase._default_wrapper_classes  s     :&&r3   c                ~    |r| j                  |       t        | j                               }|j                  ||       S )a  
        Construct class from a dictionary representation.

        Parameters
        ----------
        dct : dictionary
            The dict from which to construct the class
        validate : boolean
            If True (default), then validate the input against the schema.

        Raises
        ------
        jsonschema.ValidationError :
            If ``validate`` and ``dct`` does not conform to the schema
        )r   	_FromDictr  	from_dict)r   r  r   	converters       r4   r  zSchemaBase.from_dict  s9    & LLc::<=	""3,,r3   c                T    t        j                  |fi |}| j                  ||      S )a  
        Instantiate the object from a valid JSON string.

        Parameters
        ----------
        json_string : string
            The string containing a valid JSON chart specification.
        validate : boolean
            If True (default), then validate the input against the schema.
        **kwargs :
            Additional keyword arguments are passed to json.loads

        Returns
        -------
        chart : Chart object
            The altair Chart object built from the specification.
        r  )r  loadsr  )r   json_stringr   r  r  s        r4   	from_jsonzSchemaBase.from_json  s*    4 #jj??}}S8}44r3   c                t    || j                   }|J t        ||| j                  xs | j                          y)zPValidate the instance against the class schema in the context of the rootschema.NrF   )r  rC   r  )r   rw  rA   s      r4   r   zSchemaBase.validate  s7    
 >[[F!!!Hf9WCKKXr3   c                |    |xs | j                   }|J t        || j                  xs | j                   xs |      S )zIResolve references in the context of this object's schema or root schema.)rA   rB   )r  r  r  )r   rA   schema_to_passs      r4   resolve_referenceszSchemaBase.resolve_references  sC      .3;;)))"!@3;;@&
 	
r3   c                   t        dd      }t        |fdi i|}| j                  |xs | j                        j	                  di       }t        ||j	                  |i       | j                  xs | j                         y)zMValidate a property against property schema in the context of the rootschema.r  r  r  r   
propertiesrF   N)r  r   r  r  rj   rC   r  )r   r_  rw   rA   r  propss         r4   validate_propertyzSchemaBase.validate_property  sr    
 %GHE2r2T2&&v'<=AA,PRS599T2&3??3Qckk	
r3   c                Z    t        t        t        |          | j                              S r9   )r  r   r  __dir__r  )r!  r"  s    r4   r  zSchemaBase.__dir__  s     eEGO-tzz:;;r3   )r  r   rT  r   r|   r|  )TN)r  zbool | Iterable[Any]r  list[str] | Noner|   r'   r|   r|  r}  )r  r   r|   r-   T)r   r-   r  r  r   dict[str, Any] | Noner|   r{   )Trt  T)r   r-   r-  zint | str | Noner  r-   r  r  r   r  r|   r   )r|   zIterator[type[SchemaBase]])r   type[TSchemaBase]r  r{   r   r-   r|   TSchemaBase)r  r   r   r-   r  r   r|   r"   r9   )rw  r{   rA   r  r|   r|  )rA   r  r|   r{   )r_  r   rw   r   rA   r  r|   r|  )r|   z	list[str])rH  r  r  r  r  r  r  r  r  r}   r  r  r  r  r  r  r  r  r  r  classmethodr  r  r  r   r  r  r  r  r  s   @r4   r  r    s-    /3G+237K077;$n;(4 MQ(9I	4 "+ " 0
 5 $()-55 !	5
 '5 
5r #$	+M $()-+M+M !+M 	+M !+M '+M 
+MZ ' ' FJ--%3-?C-	- -.  55 5 	5 
5 58 GKY%Y/DY	Y Y 
 
 DH	
	
"	
,A	
		
 	
< <r3   r  c                     | j                         D ci c]%  \  }}|t        j                  j                  |      ' c}}S c c}}w )a  
    Returns packages only if they have already been imported - otherwise they return `None`.

    This is useful for `isinstance` checks.

    For example, if `pandas` has not been imported, then an object is
    definitely not a `pandas.Timestamp`.

    Parameters
    ----------
    **modules
        Keyword-only binding from `{alias: module_name}`.

    Examples
    --------
    >>> import pandas as pd  # doctest: +SKIP
    >>> import polars as pl  # doctest: +SKIP
    >>> from altair.utils.schemapi import _get_optional_modules  # doctest: +SKIP
    >>>
    >>> _get_optional_modules(pd="pandas", pl="polars", ibis="ibis")  # doctest: +SKIP
    {
        "pd": <module 'pandas' from '...'>,
        "pl": <module 'polars' from '...'>,
        "ibis": None,
    }

    If the user later imports ``ibis``, it would appear in subsequent calls.

    >>> import ibis  # doctest: +SKIP
    >>>
    >>> _get_optional_modules(ibis="ibis")  # doctest: +SKIP
    {
        "ibis": <module 'ibis' from '...'>,
    }
    )rq   sysmodulesrj   )r  r  ry   s      r4   r  r  !  s9    H /6mmo>odaAs{{q!!o>>>s   *Ac                    d| v r"dvsd   dt         hvr| j                  d       j                  fd| j                         D               S )a  
    `parsed_shorthand` is added by `FieldChannelMixin`.

    It's used below to replace shorthand with its long form equivalent
    `parsed_shorthand` is removed from `context` if it exists so that it is
    not passed to child `to_dict` function calls.
    sortrs  ordinalc              3  d   K   | ]'  \  }}j                  |t              t        u r||f ) y wr9   )rj   r  )r   r  ry   rT  s      r4   r   z,_replace_parsed_shorthand.<locals>.<genexpr>Z  s4      ,DAq88Ay!Y. 
A,s   -0)r  r  r   rq   )r  rT  s    `r4   r  r  H  s]     !!dd6l9i2HHV$KK $**, 
 Kr3   r  )boundc                "    t        | t              S r9   )rr   rs   r  s    r4   _is_dictr  l      c4  r3   c                "    t        | t              S r9   )rr   rc   r  s    r4   _is_listr  p  r  r3   r   c               @    t        | |       xr t        | t              S r9   )rr   r   )r   r   s     r4   r  r  t  s      #w''EJsH,EEr3   c                     | r| d   S |S Nr   r2   )r  rT  s     r4   _passthroughr  z  s    47$$r3   c                  L   e Zd ZdZdZddZeddd       Ze	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 dd       Z	e	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 dd       Z	e	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 dd       Z	e	 	 	 d	 	 	 	 	 	 	 	 	 	 	 dd       Z	e	 	 d	 	 	 	 	 	 	 	 	 	 	 dd	       Z	d
d
d
e
f	 	 	 	 	 	 	 	 	 	 	 ddZ	y
)r  a<  
    Class used to construct SchemaBase class hierarchies from a dict.

    The primary purpose of using this class is to be able to build a hash table
    that maps schemas to their wrapper classes. The candidate classes are
    specified in the ``wrapper_classes`` positional-only argument to the constructor.
    )definitionstitledescriptionrU   idc                   t        t              | _        |D ]F  }|j                  | j                  | j	                  |j                           j                  |       H y r9   )r   rc   
class_dictr  hash_schemart   )r!  wrapper_classestps      r4   r  z_FromDict.__init__  sK     >I=N!Bzz% 0 0 <=DDRH "r3   c                   | j                   rAt        |t              r1|j                         D ci c]  \  }}|| j                   vr|| }}}|r"t	        j
                  |d      }t        |      S fdt         |            S c c}}w )a  
        Compute a python hash for a nested dictionary which properly handles dicts, lists, sets, and tuples.

        At the top level, the function excludes from the hashed schema all keys
        listed in `exclude_keys`.

        This implements two methods: one based on conversion to JSON, and one based
        on recursive conversions of unhashable to hashable types; the former seems
        to be slightly faster in several benchmarks.
        T)r  c                   t        | t              r"t        fd| j                         D              S t        | t              rt        t        |             S t        | t        t        f      rt        t        |             S | S )Nc              3  8   K   | ]  \  }}| |      f  y wr9   r2   )r   r  ry   _freezes      r4   r   z9_FromDict.hash_schema.<locals>._freeze.<locals>.<genexpr>  s     $MAa_s   )rr   rs   	frozensetrq   r   maprc   r  )r  r'  s    r4   r'  z&_FromDict.hash_schema.<locals>._freeze  se    c4($$M$MMMS)$S#%677dE]3 Wc!233Jr3   )_hash_exclude_keysrr   rs   rq   r  r  hash)r   rA   use_jsonrv   r  sr'  s         @r4   r!  z_FromDict.hash_schema  s     !!j&> !' .HCc444 S .  
 

6T2A7N (()s   B	c                     y r9   r2   r!  r  r#  rA   rB   default_classs         r4   r  z_FromDict.from_dict       r3   c                     y r9   r2   r/  s         r4   r  z_FromDict.from_dict  r1  r3   c                     y r9   r2   r/  s         r4   r  z_FromDict.from_dict  s     r3   c                     y r9   r2   r/  s         r4   r  z_FromDict.from_dict  r1  r3   c                     y r9   r2   r/  s         r4   r  z_FromDict.from_dict  s     r3   Nc           
     R   t        |t              r|S |#|j                  }|xs |j                  xs |}|}n?|0|}|xs |}| j                  | j                  |         }	|	r|	d   n|}nd}
t        |
      t        | j                  |      }t        ||      }d|v sd|v rG|j                  dg       |j                  dg       z   }|D ]  }	 t        |||        ||||      c S  t        |      rN|j                  di       }|j                         D ci c]  \  }}|||v r ||||         n| }}} |d
i |S t!        |      r0|j                  d	i       } ||D cg c]  } |||       c}      S  ||      S # t        j                  $ r Y w xY wc c}}w c c}w )z/Construct an object from a dict representation.r   z3Must provide either `tp` or `schema`, but not both.rF   r   oneOf)rA   r0  r  rk   rq   r2   )rr   r  r  r  r   r!  r  r	   r  r  rj   rC   r/   r  r  rq   r  )r!  r  r#  rA   rB   r0  current_schemaroot_schema	target_tpmatchesr   r  r  schemaspossibler  r  ry   rT  item_schemas                       r4   r  z_FromDict.from_dict  s    c:&J^ZZN*4*X*X.KI $N$6Kood&6&6~&FGG&-
=IGCS/!DNN{C	&~{Ch'X"5ll7B/(,,w2KKG#T'X+N %SSS $ C=$,LLr$BE  IIK'DAq Q%ZIaa1QF'   $t$$c]*2,,w*CKL1i+>LMM S>!% "11  Ms   FF%F$FF)r"  zIterable[type[SchemaBase]]r|   r|  r  )rA   r{   r,  r-   r|   r   )....)r  r  r#  r|  rA   r|  rB   r|  r0  r   r|   r  )r  %dict[str, Any] | list[dict[str, Any]]r#  r   rA   r   rB   r   r0  r  r|   r  )r  r{   r#  r|  rA   r{   rB   r|  r0  r   r|   r  )...)r  r{   r#  r  rA   r|  rB   r|  r0  r   r|   r  )..)r  r?  r#  r  rA   r{   rB   r  r0  r   r|   r&   )r  z3dict[str, Any] | list[dict[str, Any]] | TSchemaBaser#  ztype[TSchemaBase] | NonerA   r  rB   r  r0  r   r|   zTSchemaBase | SchemaBase)rH  r  r  r  r*  r  r  r!  r   r  r  r2   r3   r4   r  r  ~  s;    RI  )  )D     	
   
   +.2  	
  ) 
   !$   	
   
  
    	
   
   -0 2  	
 *  
  (,(,,0)7"@7" %7" &	7"
 *7" 7" 
"7"r3   r  c                  "    e Zd ZddZd ZddZy)_PropertySetterc                     || _         || _        y r9   )proprA   )r!  rC  rA   s      r4   r  z_PropertySetter.__init__  s    	r3   c                   || _         || _        | j                  d   j                  dd      | _        | j
                   d   j                         | j
                   dd  z   }t        t        |      r t        t        |      }|j                  j                  d      }|dkD  rX|j                  d | j                  dd	      | j                  z   t        j                  d
|j                  |d         z   | _        n1|j                  j                  dd	      dz   | j                  z   | _        t        j                  |      | _        t        j                   |      | _        |j$                  | _        | S 	 | S )Nr  __z**r   r   zParameters
r@  z    r2  z

    r)  )r   r   rA   r  r  rC  rP  r]   r   r   findtextwrapdedentrD  rE  __signature__getfullargspec__wrapped__rH  )r!  r   r   property_namealtair_propparameter_indexs         r4   __get__z_PropertySetter.__get__   s^    {{=199$E99+q)//1tyyk124FF8]+!(M:K *1166~FO#''(89AA&"Mll#oo";#6#67G#H"IJ   ''//;dBT\\Q  ")!2!2;!?D&55kBD'00DM
  r3   c                f    | j                   j                         }|r|d   n||| j                  <   |S r  )r   r}   rC  )r!  r  r  r   s       r4   __call__z_PropertySetter.__call__D  s+    hhmmo$(afDII
r3   N)rC  r   rA   r{   r|   r|  )r  r   r  r   )rH  r  r  r  rO  rQ  r2   r3   r4   rA  rA    s    "Hr3   rA  c           	         | j                         }|j                  di       j                         D ]  \  }}t        | |t	        ||              | S )z4Decorator to add property setters to a Schema class.r  )r  rj   rq   setattrrA  )r   rA   rC  
propschemas       r4   with_property_settersrU  K  sL    ##%F"JJ|R8>>@jT?4<= AJr3   r  )r:   r-   r|   zIterator[None]).)
r@   r   rA   r{   rB   r  r=   zLiteral[True]r|   r&   )
r@   r   rA   r{   rB   r  r=   zLiteral[False]r|   ,jsonschema.exceptions.ValidationError | Noner9   )rA   r{   rB   r  r=   r-   r|   rV  )r@   r{   rA   r{   rB   r  r|   r)   )rA   r{   r|   r   )r|   r-   )rA   r{   r|   r{   )rB   r{   re   z
str | Noner|   r!   )r   r~  r|   r   )rP   r)   r|   r*   )rP   r)   r|   r)   )r   r*   r|   r*   )r   r   rN   zSequence[str]r|   r-   )rR   r*   r|   r*   )r   r~  r|   r-   )r   z	type[Any]r|   zIterator[type[Any]])r   zIterable[Any]r|   z	list[Any])r   zdt.date | dt.datetimer|   r{   )
r   r   r   r  r  r   r  r   r|   r   )rA   r{   rB   r  r|   r{   )r   r   r|   zTypeIs[UndefinedType])r   r  r|   r  )r   r   r|   r   )r   _CopyImpl | Anyr|   rW  )r   r  r  set[str]r|   r  )r   r   r  rX  r|   r   )r   rW  r  rX  r|   rW  )r  r   r|   zdict[str, _OptionalModule])r  r{   rT  r{   r|   r{   )r   zAny | dict[Any, Any]r|   zTypeIs[dict[Any, Any]])r   zAny | list[Any]r|   zTypeIs[list[Any]])r   r   r   ztype | tuple[type, ...]r|   zTypeIs[Iterable[Any]])r  r   rT  r   r|   zAny | dict[str, Any])r   r  r|   r  )
__future__r   
contextlibr}   r   r   rD  r  r
  rG  collectionsr   collections.abcr   r   r   r   	functoolsr	   importlib.metadatar
   importlib_version	itertoolsr   r   mathr   typingr   r   r   r   r   r   r   r   r   typing_extensionsr   r/   jsonschema.exceptionsjsonschema.validatorsnarwhals.stable.v1stablev1r   packaging.versionr   altairr   version_infor   r   r   ry  r   r    r   r!   altair.typingr"   r$   r&   r'   r(   r  rc   
exceptionsr  r)   rs   r   r*   r+   r,   r.   rm   r5   r7   contextmanagerr<   rC   rG   rZ   r^   r_   r`   r   rI   rH   rJ   r   rK   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r  r  r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  rA  rU  r2   r3   r4   <module>ro     s*   #      
  # A A  ; ( 
 
 
 (      %
 wAALL $'
7"!,
7"&&1!4OY4!%j&;&;&K&K!L Y L%)#/B*B%C  C
 4 U 3 )R  Q 
D *<8 

   
 ),
 "%
 &
   
 
 ),7
77 &7
  7 27 
7 )-#
 ## &#
 # 2#R )-,
,, &, 	,^A>
 L EI7A."%%%"*(0(((F$'+$'$'NL%$*<9
8!J AE(=,bJ66 bJ HHG 45K>& 1%x 1 1< >Jwx018 > >&  O	CLA},-) -@ 
 3 
 3	 ' 
 ' 
 B 
 B	 6 
 6$n< n<b	$?N$,:4 m:6KT#s(^T#YG	!!
 69%LF	F1FF%Z" Z"z- -`r3   