Ë
    u™ãjx1  ã                  óV  — d Z ddlmZ ddlZddlmZ ddlZddlm	Z	 ddl
mZ ddlmZ ddlmZmZmZmZmZ erdd	lmZmZmZ dd
lmZmZ ddlmZmZmZmZ dZ 	 d	 	 	 	 	 	 	 dd„Z!dde df	 	 	 	 	 	 	 	 	 	 	 dd„Z"de f	 	 	 	 	 	 	 dd„Z#de df	 	 	 	 	 	 	 	 	 dd„Z$de df	 	 	 	 	 	 	 	 	 dd„Z%y)z"
data hash pandas / numpy objects
é    )ÚannotationsN)ÚTYPE_CHECKING)Úhash_object_array)Úis_list_like)ÚCategoricalDtype)ÚABCDataFrameÚABCExtensionArrayÚABCIndexÚABCMultiIndexÚ	ABCSeries)ÚHashableÚIterableÚIterator)Ú	ArrayLikeÚnpt)Ú	DataFrameÚIndexÚ
MultiIndexÚSeriesÚ0123456789123456c                ó  — 	 t        | «      }t        j                  |g| «      } t        j                  d«      }t        j                  |«      t        j                  d«      z   }d}t        | «      D ]4  \  }}||z
  }	||z  }||z  }|t        j                  d|	z   |	z   «      z  }|}Œ6 |dz   |k(  sJ d«       ‚|t        j                  d	«      z  }|S # t        $ r) t        j                  |dt        j                  ¬«      cY S w xY w)
a  
    Parameters
    ----------
    arrays : Iterator[np.ndarray]
    num_items : int
    length : int, default 0
        Length of the result if ``arrays`` is empty.

    Returns
    -------
    np.ndarray[uint64]

    Should be the same as CPython's tupleobject.c
    isÓ5 ©ÚdtypeiCB ixV4 r   iXB é   zFed in wrong num_itemsiû| )	ÚnextÚStopIterationÚnpÚfullÚuint64Ú	itertoolsÚchainÚ
zeros_likeÚ	enumerate)
ÚarraysÚ	num_itemsÚlengthÚfirstÚmultÚoutÚlast_iÚiÚaÚ	inverse_is
             úc/var/www/html/python-recuperauto-other/env/lib/python3.12/site-packages/pandas/core/util/hashing.pyÚcombine_hash_arraysr/   0   s  € ð"BÜ�V“ˆô
 �_‰_˜e˜W fÓ-€Fä�9‰9�WÓ€DÜ
�-‰-˜Ó
¤§¡¨8Ó!4Ñ
4€CØ€FÜ˜&Ó!ò ‰ˆˆ1Ø ‘Mˆ	Øˆq‰ˆØˆt‰ˆØ”—	‘	˜% )Ñ+¨iÑ7Ó8Ñ8ˆØ‰ðð �A‰:˜Ò"Ð<Ð$<Ó<Ð"ØŒ2�9‰9�UÓÑ€CØ€Jøô# ò Bä�w‰w�vÐ/´r·y±yÔAÒAðBús   ‚C Ã/DÄDTÚutf8c                óz  ‡ ‡‡‡— ddl m} ‰€t        Št        ‰ t        «      r |t        ‰ ‰‰«      dd¬«      S t        ‰ t        «      r7t        ‰ j                  ‰‰‰«      j                  dd¬«      } ||‰ dd¬«      }|S t        ‰ t        «      rtt        ‰ j                  ‰‰‰«      j                  dd¬«      }|r1ˆˆˆˆ fd„d	D «       }t        j                  |g|«      }	t        |	d
«      } ||‰ j                  dd¬«      }|S t        ‰ t        «      r’ˆˆˆfd„‰ j!                  «       D «       }
t#        ‰ j$                  «      }|r2ˆˆˆˆ fd„d	D «       }|dz  }t        j                  |
|«      }d„ |D «       }
t        |
|t#        ‰ «      «      } ||‰ j                  dd¬«      }|S t'        dt)        ‰ «      › �«      ‚)a2	  
    Return a data hash of the Index/Series/DataFrame.

    The hash is computed element-wise using the underlying data values,
    and optionally includes the index when hashing a Series or DataFrame.

    Parameters
    ----------
    obj : Index, Series, or DataFrame
        The pandas object to hash.
    index : bool, default True
        Include the index in the hash (if Series/DataFrame). When True,
        the hash for each row depends on both the value and the index label,
        so the same value at a different index position will produce a
        different hash.
    encoding : str, default 'utf8'
        Encoding for data & key when strings.
    hash_key : str, default _default_hash_key
        Hash_key for string key to encode.
    categorize : bool, default True
        Whether to first categorize object arrays before hashing. This is more
        efficient when the array contains duplicate values.

    Returns
    -------
    Series of uint64
        Same length as the object.

    See Also
    --------
    util.hash_array : Return a hash of the given array.
    util.hash_tuples : Hash a MultiIndex or listlike-of-tuples efficiently.

    Examples
    --------
    >>> pd.util.hash_pandas_object(pd.Series([1, 2, 3]))
    0    14639053686158035780
    1     3869563279212530728
    2      393322362522515241
    dtype: uint64

    By default, the hash includes the index, so the same value at a
    different index position will produce a different hash:

    >>> df1 = pd.DataFrame({"a": ["a", "b", "c"]})
    >>> df2 = pd.DataFrame({"a": ["b", "a", "c"]})
    >>> pd.util.hash_pandas_object(df1)
    0     4578374827886788867
    1    17338122309987883691
    2     5473791562133574857
    dtype: uint64
    >>> pd.util.hash_pandas_object(df2)
    0     8168238220198793318
    1    14044658390916132862
    2     5473791562133574857
    dtype: uint64

    Set ``index=False`` to hash only the values. In this case, the same
    value always produces the same hash regardless of its position:

    >>> pd.util.hash_pandas_object(df1, index=False)
    0     5694802365760992243
    1     2797248057711234736
    2    18202460376300699891
    dtype: uint64
    >>> pd.util.hash_pandas_object(df2, index=False)
    0     2797248057711234736
    1     5694802365760992243
    2    18202460376300699891
    dtype: uint64
    r   )r   r   F)r   Úcopy©r2   )Úindexr   r2   c              3  óf   •K  — | ](  }t        ‰j                  d ‰‰‰¬«      j                  –— Œ* y­w©F)r4   ÚencodingÚhash_keyÚ
categorizeN©Úhash_pandas_objectr4   Ú_values©Ú.0Ú_r9   r7   r8   Úobjs     €€€€r.   ú	<genexpr>z%hash_pandas_object.<locals>.<genexpr>¸   s?   øè ø€ ò 	ð ô #Ø—I‘IØØ%Ø%Ø)ô÷ ‘'óñ	ùó   ƒ.1©Né   c              3  óT   •K  — | ]  \  }}t        |j                  ‰‰‰«      –— Œ! y ­wrC   )Ú
hash_arrayr<   )r>   r?   Úseriesr9   r7   r8   s      €€€r.   rA   z%hash_pandas_object.<locals>.<genexpr>È   s,   øè ø€ ò 
á��6ô �v—~‘~ x°¸:×Fñ
ùs   ƒ%(c              3  óf   •K  — | ](  }t        ‰j                  d ‰‰‰¬«      j                  –— Œ* y­wr6   r:   r=   s     €€€€r.   rA   z%hash_pandas_object.<locals>.<genexpr>Î   s?   øè ø€ ò 	$ð ô #Ø—I‘IØØ%Ø%Ø)ô÷ ‘'óñ	$ùrB   r   c              3  ó    K  — | ]  }|–— Œ y ­wrC   © )r>   Úxs     r.   rA   z%hash_pandas_object.<locals>.<genexpr>Ü   s   è ø€ Ò)˜A”aÑ)ùs   ‚zUnexpected type for hashing )Úpandasr   Ú_default_hash_keyÚ
isinstancer   Úhash_tuplesr
   rF   r<   Úastyper   r    r!   r/   r4   r   ÚitemsÚlenÚcolumnsÚ	TypeErrorÚtype)r@   r4   r7   r8   r9   r   ÚhÚserÚ
index_iterr$   Úhashesr%   Úindex_hash_generatorÚ_hashess   ` ```         r.   r;   r;   W   sÁ  û€ õ\ àÐÜ$ˆä�#”}Ô%Ù”k # x°Ó:À(ÐQVÔWÐWä	�CœÔ	"Ü�s—{‘{ H¨h¸
ÓC×JÑJØ˜5ð Kó 
ˆñ �Q˜c¨¸Ô>ˆðd €Jôa 
�CœÔ	#Ü�s—{‘{ H¨h¸
ÓC×JÑJØ˜5ð Kó 
ˆñ ö	ð  ô	ˆJô —_‘_ a S¨*Ó5ˆFÜ# F¨AÓ.ˆAá�Q˜cŸi™i¨x¸eÔDˆð< €Jô9 
�CœÔ	&õ
à ŸY™Y›[ô
ˆô ˜Ÿ™Ó$ˆ	Ùö	$ð  ô	$Ð ð ˜‰NˆIô  —o‘o fÐ.BÓCˆGÙ) Ô)ˆFÜ ¨	´3°s³8Ó<ˆá�Q˜cŸi™i¨x¸eÔDˆð €Jô Ð6´t¸C³y°kÐBÓCÐCó    c           
     óŠ  ‡‡— t        | «      st        d«      ‚ddlm}m} t        | t        «      s |j                  | «      }n| }t        |j                  «      D �cg c]9  }|j                  |j                  |   t        |j                  |   d¬«      «      ‘Œ; }}ˆˆfd„|D «       }t        |t        |«      «      }	|	S c c}w )a  
    Hash a MultiIndex / listlike-of-tuples efficiently.

    Parameters
    ----------
    vals : MultiIndex or listlike-of-tuples
    encoding : str, default 'utf8'
    hash_key : str, default _default_hash_key

    Returns
    -------
    ndarray[np.uint64] of hashed values
    z'must be convertible to a list-of-tuplesr   )ÚCategoricalr   F©Ú
categoriesÚorderedc              3  óF   •K  — | ]  }|j                  ‰‰d ¬«      –— Œ y­w)F©r7   r8   r9   N)Ú_hash_pandas_object)r>   Úcatr7   r8   s     €€r.   rA   zhash_tuples.<locals>.<genexpr>  s,   øè ø€ ò àð 	×Ñ¨¸HÐQVÐ×Wñùs   ƒ!)r   rT   rL   r^   r   rN   r   Úfrom_tuplesÚrangeÚnlevelsÚ_simple_newÚcodesr   Úlevelsr/   rR   )
Úvalsr7   r8   r^   r   ÚmiÚlevelÚcat_valsrY   rV   s
    ``       r.   rO   rO   æ   s¿   ù€ ô$ ˜ÔÜÐAÓBÐB÷ô
 �dœMÔ*Ø#ˆZ×#Ñ# DÓ)‰àˆô ˜2Ÿ:™:Ó&öð
 ð	 	×ÑØ�H‰H�U‰OÜ¨¯	©	°%Ñ(8À%ÔHõ	
ð€Hð ôàô€Fô 	˜F¤C¨£MÓ2€Aà€Hùòs   Á>C c                ó  — t        | d«      st        d«      ‚t        | t        «      r| j	                  |||¬«      S t        | t
        j                  «      s"t        dt        | «      j                  › d�«      ‚t        | |||«      S )a{  
    Given a 1d array, return an array of deterministic integers.

    This function applies a hash function to each element of the input
    array, producing a fixed set of uint64 values suitable for use in
    hashing-based algorithms.

    Parameters
    ----------
    vals : ndarray or ExtensionArray
        The input array to hash.
    encoding : str, default 'utf8'
        Encoding for data & key when strings.
    hash_key : str, default _default_hash_key
        Hash_key for string key to encode.
    categorize : bool, default True
        Whether to first categorize object arrays before hashing. This is more
        efficient when the array contains duplicate values.

    Returns
    -------
    ndarray[np.uint64, ndim=1]
        Hashed values, same length as the vals.

    See Also
    --------
    util.hash_pandas_object : Return a data hash of the Index/Series/DataFrame.
    util.hash_tuples : Hash a MultiIndex / listlike-of-tuples efficiently.

    Examples
    --------
    >>> pd.util.hash_array(np.array([1, 2, 3]))
    array([ 6238072747940578789, 15839785061582574730,  2185194620014831856],
      dtype=uint64)
    r   zmust pass an ndarray-likerc   z6hash_array requires np.ndarray or ExtensionArray, not z!. Use hash_pandas_object instead.)
ÚhasattrrT   rN   r	   rd   r   ÚndarrayrU   Ú__name__Ú_hash_ndarray)rl   r7   r8   r9   s       r.   rF   rF     s‘   € ôR �4˜Ô!ÜÐ3Ó4Ð4ä�$Ô)Ô*Ø×'Ñ'Ø¨¸Zð (ó 
ð 	
ô �dœBŸJ™JÔ'äØDÜ�D‹z×"Ñ"Ð#Ð#DðFó
ð 	
ô
 ˜˜x¨°:Ó>Ð>r\   c                ó¤  — | j                   }|j                  t        j                  t        j                  fv r8t        | j                  |||«      }t        | j                  |||«      }|d|z  z   S |t        k(  r| j                  d«      } �n¹t        |j                  t        j                  t        j                  f«      r$| j                  d«      j                  dd¬«      } �nat        |j                  t        j                  «      rÛ|j                  dk  rÌd|j                  › �}| j                  |«      j                  d«      }t        |j                  t        j                   «      rvt        j"                  t        j$                  |¬«      j                  |«      |t        j&                  | «      <   d	||t        j"                  d
|¬«      j                  |«      k(  <   |} nb|rRd	dlm}	m}
m}  || d¬«      \  }}t1         |
|d¬«      d¬«      }|	j3                  ||«      }|j5                  ||d¬«      S 	 t7        | ||«      } | | dz	  z  } | t        j>                  d«      z  } | | dz	  z  } | t        j>                  d«      z  } | | dz	  z  } | S # t8        $ r6 t7        | j                  t:        «      j                  t<        «      ||«      } Y Œˆw xY w)z!
    See hash_array.__doc__.
    é   Úu8Úi8Fr3   é   Úur   r   g       €)r^   r   Ú	factorize)Úsortr_   rc   é   l   ¹eÉ9´Âz é   l   ëb&ì&‚&	 é   ) r   rU   r   Ú	complex64Ú
complex128rt   ÚrealÚimagÚboolrP   Ú
issubclassÚ
datetime64Útimedelta64ÚviewÚnumberÚitemsizeÚfloatingÚarrayÚnanÚisnanrL   r^   r   r{   r   ri   rd   r   rT   ÚstrÚobjectr   )rl   r7   r8   r9   r   Ú	hash_realÚ	hash_imagÚ
uint_dtypeÚuintsr^   r   r{   rj   r`   Útdtypere   s                   r.   rt   rt   S  sn  € ð �J‰J€Eð
 ‡z�z”b—l‘l¤B§M¡MÐ2Ñ2Ü! $§)¡)¨X°xÀÓLˆ	Ü! $§)¡)¨X°xÀÓLˆ	Ø˜2 	™>Ñ)Ð)ð ”‚}Ø�{‰{˜4Ó ŠÜ	�E—J‘J¤§¡´·±Ð ?Ô	@Ø�y‰y˜‹×%Ñ% d°Ð%Ó7ŠÜ	�E—J‘J¤§	¡	Ô	*¨u¯~©~ÀÒ/BØ˜Ÿ™Ð(Ð)ˆ
Ø—	‘	˜*Ó%×,Ñ,¨TÓ2ˆÜ�e—j‘j¤"§+¡+Ô.ô %'§H¡H¬R¯V©V¸5Ô$A×$FÑ$FÀzÓ$RˆE”"—(‘(˜4“.Ñ!ØKLˆE�%œ2Ÿ8™8 D°Ô6×;Ñ;¸JÓGÑGÑHØ‰ñ
 ÷ñ ñ !*¨$°UÔ ;ÑˆE�:Ü%Ù  °%Ô8À%ôˆFð ×)Ñ)¨%°Ó8ˆCØ×*Ñ*Ø!¨HÀð +ó ð ð	Ü$ T¨8°XÓ>ˆDð 	ˆD�B‰JÑ€DØŒB�I‰IÐ(Ó)Ñ)€DØˆD�B‰JÑ€DØŒB�I‰IÐ(Ó)Ñ)€DØˆD�B‰JÑ€Dð €Køô ò 	ä$Ø—‘œCÓ ×'Ñ'¬Ó/°¸8óŠDð	ús   È9J Ê<KËK)r   )r$   zIterator[np.ndarray]r%   Úintr&   r–   Úreturnúnpt.NDArray[np.uint64])r@   zIndex | DataFrame | Seriesr4   r„   r7   r�   r8   z
str | Noner9   r„   r—   r   )rl   z+MultiIndex | Iterable[tuple[Hashable, ...]]r7   r�   r8   r�   r—   r˜   )
rl   r   r7   r�   r8   r�   r9   r„   r—   r˜   )
rl   z
np.ndarrayr7   r�   r8   r�   r9   r„   r—   r˜   )&Ú__doc__Ú
__future__r   r    Útypingr   Únumpyr   Úpandas._libs.hashingr   Úpandas.core.dtypes.commonr   Úpandas.core.dtypes.dtypesr   Úpandas.core.dtypes.genericr   r	   r
   r   r   Úcollections.abcr   r   r   Úpandas._typingr   r   rL   r   r   r   r   rM   r/   r;   rO   rF   rt   rJ   r\   r.   ú<module>r£      s†  ðñõ #ã Ý  ã å 2å 2Ý 6÷õ ñ ÷ñ ÷÷
ó ð 'Ð ð ABð$Ø ð$Ø-0ð$Ø:=ð$àó$ðR ØØ,ØðLØ	#ðLàðLð ðLð ð	Lð
 ðLð óLðb Ø%ð/Ø
5ð/àð/ð ð/ð ó	/ðh Ø%Øð	8?Ø
ð8?àð8?ð ð8?ð ð	8?ð
 ó8?ðz Ø%Øð	HØ
ðHàðHð ðHð ð	Hð
 ôHr\   