Ë
    ¤ehº(  ã                  ó†  — d dl mZ d dlZd dlmZmZ d dlZd dlm	Z	m
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 d d	lmZ d d
lmZ d dlmZ d dlmZ d dlm Z  d dl!m"Z" d dl#m$Z$ erd dl%m&Z&  ejN                  d«      Z(g d¢Z)	 	 	 	 d	 	 	 	 	 	 	 	 	 dd„Z*dd„Z+	 	 	 d	 	 	 	 	 	 	 	 	 dd„Z,d d„Z-d!d"d„Z.d„ Z/d#d„Z0d$d„Z1y)%é    )ÚannotationsN)ÚTYPE_CHECKINGÚcast)ÚNaTÚlib)ÚInvalidIndexError)Úfind_common_type)Ú	safe_sort)ÚIndexÚ
_new_IndexÚensure_indexÚensure_index_from_sequencesÚget_unanimous_names)ÚCategoricalIndex)ÚDatetimeIndex)ÚIntervalIndex)Ú
MultiIndex)ÚPeriodIndex)Ú
RangeIndex)ÚTimedeltaIndex)ÚAxiszôSorting because non-concatenation axis is not aligned. A future version
of pandas will change to not sort by default.

To accept the future behavior, pass 'sort=False'.

To retain the current behavior and silence the warning, pass 'sort=True'.
)r   r   r   r   r   r   r   r   r   r   r   r   r   Úget_objs_combined_axisÚunion_indexesr   Úall_indexes_sameÚdefault_indexÚsafe_sort_indexc                óf   — | D �cg c]  }|j                  |«      ‘Œ }}t        ||||¬«      S c c}w )añ  
    Extract combined index: return intersection or union (depending on the
    value of "intersect") of indexes on given axis, or None if all objects
    lack indexes (e.g. they are numpy arrays).

    Parameters
    ----------
    objs : list
        Series or DataFrame objects, may be mix of the two.
    intersect : bool, default False
        If True, calculate the intersection between indexes. Otherwise,
        calculate the union.
    axis : {0 or 'index', 1 or 'outer'}, default 0
        The axis to extract indexes from.
    sort : bool, default True
        Whether the result index should come out sorted or not.
    copy : bool, default False
        If True, return a copy of the combined index.

    Returns
    -------
    Index
    )Ú	intersectÚsortÚcopy)Ú	_get_axisÚ_get_combined_index)Úobjsr   Úaxisr   r    ÚobjÚ	obs_idxess          úU/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/pandas/core/indexes/api.pyr   r   H   s6   € ð< 15Ö5¨�—‘˜tÕ$Ð5€IÐ5Ü˜y°IÀDÈtÔTÐTùò 6s   ….c                óž   — t        «       }g }| D ];  }t        |«      |vsŒ|j                  t        |«      «       |j                  |«       Œ= |S )z^
    Return a list with distinct elements of "objs" (different ids).
    Preserves order.
    )ÚsetÚidÚaddÚappend)r#   ÚidsÚresr%   s       r'   Ú_get_distinct_objsr/   j   sM   € ô
 “E€CØ
€CØò ˆÜˆc‹7˜#ÒØ�G‰G”B�s“GÔØ�J‰J�s�Oðð €Jó    c                ó,  — t        | «      } t        | «      dk(  rt        g «      }nOt        | «      dk(  r| d   }n;|r!| d   }| dd D ]  }|j                  |«      }Œ nt	        | d¬«      }t        |«      }|rt        |«      }|r|j                  «       }|S )a  
    Return the union or intersection of indexes.

    Parameters
    ----------
    indexes : list of Index or list objects
        When intersect=True, do not accept list of lists.
    intersect : bool, default False
        If True, calculate the intersection between indexes. Otherwise,
        calculate the union.
    sort : bool, default False
        Whether the result index should come out sorted or not.
    copy : bool, default False
        If True, return a copy of the combined index.

    Returns
    -------
    Index
    r   é   NF©r   )r/   Úlenr   Úintersectionr   r   r   r    )Úindexesr   r   r    ÚindexÚothers         r'   r"   r"   x   s¡   € ô4 ! Ó)€GÜ
ˆ7ƒ|�qÒÜ�b“	‰Ü	ˆW‹˜Ò	Ø˜‘
‰Ù	Ø˜‘
ˆØ˜Q˜R�[ò 	.ˆEØ×&Ñ& uÓ-‰Eñ	.ô ˜g¨EÔ2ˆÜ˜UÓ#ˆáÜ Ó&ˆáØ—
‘
“ˆà€Lr0   c                ó\  — | j                   r| S 	 t        | «      }t        |t        «      r|S t	        t
        j                  |«      }t        | t        «      r#t        j                  || j                  ¬«      } | S t        || j                  | j                  ¬«      } | S # t        $ r Y | S w xY w)zª
    Returns the sorted index

    We keep the dtypes and the name attributes.

    Parameters
    ----------
    index : an Index

    Returns
    -------
    Index
    )Únames)ÚnameÚdtype)Úis_monotonic_increasingr
   Ú
isinstancer   r   ÚnpÚndarrayr   Úfrom_tuplesr:   r;   r<   Ú	TypeError)r7   Úarray_sorteds     r'   r   r   ¨   s£   € ð ×$Ò$ØˆðLÜ  Ó'ˆô �l¤EÔ*ØÐäœBŸJ™J¨Ó5ˆÜ�eœZÔ(Ü×*Ñ*¨<¸u¿{¹{ÔKˆEð €Lô ˜,¨U¯Z©Z¸u¿{¹{ÔKˆEà€Løô ò Øð €Lðús   �B Â	B+Â*B+c                óÄ  ‡ ‡‡— t        ‰ «      dk(  rt        d«      ‚t        ‰ «      dk(  r:‰ d   }t        |t        «      r#‰st	        |«      }|S t	        t        |«      «      }|S t        ‰ «      \  Š }dˆfd„}ˆ fd„}|dk(  rà‰ d   }‰ D �cg c]  }t        |t        «      sŒ|‘Œ }}|D �cg c]  }|j                  €Œ|‘Œ }}t        |«      dt        |«      fvrt        d«      ‚t        |«      t        ‰ «      k(  rd	Š‰ d   }n:t        |«      dkD  r,d
Š‰ D �cg c]  }|j                  t        d
¬«      ‘Œ c}Š ‰ d   }‰ dd D ]  }	|j                  |	‰rdnd
¬«      }Œ |S |dk(  rZ |‰ «      }
‰ d   Št        ˆfd„‰ dd D «       «      s	 |‰ |
«      Št        ‰ Ž d   }|‰j                  k7  r‰j!                  |«      Š‰S  |‰ «      }
 |‰ |
«      S c c}w c c}w c c}w )a)  
    Return the union of indexes.

    The behavior of sort and names is not consistent.

    Parameters
    ----------
    indexes : list of Index or list objects
    sort : bool, default True
        Whether the result index should come out sorted or not.

    Returns
    -------
    Index
    r   z#Must have at least 1 Index to unionr2   c           
     óì  •— t        d„ | D «       «      rŸ| D �cg c]  }|j                  |d¬«      ‘Œ } }| d   j                  «       }| d   j                  | dd «      }||j	                  |«      dk(     }t        |«      r|j                  |j                  «       «      }‰r|j                  «       }|S d	„ }t        t        j                  | D �cg c]
  } ||«      ‘Œ c}‰¬
«      |¬«      S c c}w c c}w )zô
        Concatenate indices and remove duplicates.

        Parameters
        ----------
        inds : list of Index or list objects
        dtype : dtype to set for the resulting Index

        Returns
        -------
        Index
        c              3  ó<   K  — | ]  }t        |t        «      –— Œ y ­w©N)r>   r   )Ú.0Úinds     r'   ú	<genexpr>z9union_indexes.<locals>._unique_indices.<locals>.<genexpr>ô   s   è ø€ Ò6¨#Œz˜#œu×%Ñ6ùs   ‚F©r    r   r2   é   Néÿÿÿÿc                óF   — t        | t        «      r| j                  «       } | S rG   )r>   r   Útolist)Úis    r'   Úconvz4union_indexes.<locals>._unique_indices.<locals>.convÿ   s   € Ü˜!œUÔ#Ø—H‘H“J�ØˆHr0   r3   )r<   )
ÚallÚastypeÚuniquer,   Úget_indexer_forr4   Úsort_valuesr   r   Úfast_unique_multiple_list)	Úindsr<   rI   Úresultr8   ÚdiffrQ   rP   r   s	           €r'   Ú_unique_indicesz&union_indexes.<locals>._unique_indicesç   sè   ø€ ô Ñ6°Ô6Ô6Ø=AÖB°c�C—J‘J˜u¨5�JÕ1ÐBˆDÐBØ˜!‘W—^‘^Ó%ˆFØ˜‘G—N‘N 4¨¨ 8Ó,ˆEØ˜×/Ñ/°Ó6¸"Ñ<Ñ=ˆDÜ�4ŒyØŸ™ t§{¡{£}Ó5�ÙØ×+Ñ+Ó-�ØˆMò	ô
 Ü×)Ñ)¸DÖ*A°q©4°­7Ò*AÈÔMØô
ð 	
ùò Cùò  +Bs   ˜C,ÃC1c                óˆ   •— ‰D �cg c]  }t        |t        «      sŒ|j                  ‘Œ! }}|rt        |«      }|S d}|S c c}w )a  
        Finds a common type for the indexes to pass through to resulting index.

        Parameters
        ----------
        inds: list of Index or list objects

        Returns
        -------
        The common type or None if no indexes were given
        N)r>   r   r<   r	   )rX   ÚidxÚdtypesr<   r6   s       €r'   Ú_find_common_index_dtypez/union_indexes.<locals>._find_common_index_dtype	  sK   ø€ ð (/ÖI ´*¸SÄ%Õ2H�#—)“)ÐIˆÐIÙÜ$ VÓ,ˆEð ˆð ˆEàˆùò Js   †?œ?ÚspecialNz0Cannot join tz-naive with tz-aware DatetimeIndexTFrK   r3   Úarrayc              3  ó@   •K  — | ]  }‰j                  |«      –— Œ y ­wrG   ©Úequals)rH   r8   r7   s     €r'   rJ   z union_indexes.<locals>.<genexpr>>  s   øè ø€ Ò@¨5�5—<‘< ×&Ñ@ùó   ƒ)Úreturnr   )r4   ÚAssertionErrorr>   Úlistr   ÚsortedÚ_sanitize_and_checkr   ÚtzrB   rS   ÚobjectÚunionrR   r   r;   Úrename)r6   r   rY   Úkindr[   r_   ÚxÚdtisÚdti_tzsr8   r<   r;   r7   s   ``          @r'   r   r   Ê   s  ú€ ô  ˆ7ƒ|�qÒÜÐBÓCÐCÜ
ˆ7ƒ|�qÒØ˜‘ˆÜ�fœdÔ#ÙÜ˜v›�ð ˆô œv f›~Ó.�Øˆä'¨Ó0�M€GˆTõ 
ôDð( ˆyÒØ˜‘ˆà"ÖC�a¤j°´MÕ&B’ÐCˆÐCØ"Ö7˜ a§d¡dÑ&6’1Ð7ˆÐ7Üˆw‹< ¤3 t£9˜~Ñ-ô
 ÐNÓOÐOäˆt‹9œ˜G›Ò$ØˆDØ˜Q‘Z‰Fä�‹Y˜Š]ð ˆDð >EÖE¸�q—x‘x¤¨U�xÕ3ÒEˆGØ˜Q‘ZˆFà˜Q˜R�[ò 	GˆEØ—\‘\ %±d©dÀ�\ÓF‰Fð	Gàˆà	�ŠÙ(¨Ó1ˆØ˜‘
ˆÜÓ@°G¸A¸B°KÔ@Ô@Ù# G¨UÓ3ˆEä" GÐ,¨QÑ/ˆØ�5—:‘:ÒØ—L‘L Ó&ˆEØˆá(¨Ó1ˆÙ˜w¨Ó.Ð.ùòO DùÚ7ùò& Fs   ÂGÂ"GÂ,GÂ>GÄGc                ó\  — t        | D �ch c]  }t        |«      ’Œ c}«      }t         |v r[t        |«      dkD  rI| D �cg c](  }t        |t        «      st	        t        |«      «      n|‘Œ* } }|j                  t         «       n| dfS t        |«      dkD  st        |vr| dfS | dfS c c}w c c}w )aN  
    Verify the type of indexes and convert lists to Index.

    Cases:

    - [list, list, ...]: Return ([list, list, ...], 'list')
    - [list, Index, ...]: Return _sanitize_and_check([Index, Index, ...])
        Lists are sorted and converted to Index.
    - [Index, Index, ...]: Return ([Index, Index, ...], TYPE)
        TYPE = 'special' if at least one special type, 'array' otherwise.

    Parameters
    ----------
    indexes : list of Index or list objects

    Returns
    -------
    sanitized_indexes : list of Index or list objects
    type : {'list', 'array', 'special'}
    r2   rh   r`   ra   )rh   Útyper4   r>   r   Úremove)r6   r7   Úkindsrp   s       r'   rj   rj   J  s©   € ô* ¨7Ö3 %”$�u•+Ò3Ó4€Eäˆu�}Üˆu‹:˜Š>àKRöØFG¤j°´EÔ&:””d˜1“g”ÀÑAðˆGð ð �L‰LœÕà˜F�?Ð"ä
ˆ5ƒz�A‚~œ eÑ+Ø˜	Ð!Ð!à˜ÐÐùò 4ùòs
   ŠB$½-B)c                óX   ‡— t        | «      }t        |«      Št        ˆfd„|D «       «      S )zî
    Determine if all indexes contain the same elements.

    Parameters
    ----------
    indexes : iterable of Index objects

    Returns
    -------
    bool
        True if all indexes contain the same elements, False otherwise.
    c              3  ó@   •K  — | ]  }‰j                  |«      –— Œ y ­wrG   rc   )rH   r7   Úfirsts     €r'   rJ   z#all_indexes_same.<locals>.<genexpr>  s   øè ø€ Ò4 uˆu�|‰|˜E×"Ñ4ùre   )ÚiterÚnextrR   )r6   Úitrry   s     @r'   r   r   p  s(   ø€ ô ˆw‹-€CÜ�‹I€EÜÓ4°Ô4Ó4Ð4r0   c                óF   — t        | «      }t        j                  |d ¬«      S )N)r;   )Úranger   Ú_simple_new)ÚnÚrngs     r'   r   r   ‚  s   € Ü
�‹(€CÜ×!Ñ! #¨DÔ1Ð1r0   )Fr   TF)
r   Úboolr$   r   r   r‚   r    r‚   rf   r   )r#   úlist[Index]rf   rƒ   )FFF)
r6   rƒ   r   r‚   r   r‚   r    r‚   rf   r   )r7   r   rf   r   )T)r   zbool | Nonerf   r   )rf   r‚   )r€   Úintrf   r   )2Ú
__future__r   ÚtextwrapÚtypingr   r   Únumpyr?   Úpandas._libsr   r   Úpandas.errorsr   Úpandas.core.dtypes.castr	   Úpandas.core.algorithmsr
   Úpandas.core.indexes.baser   r   r   r   r   Úpandas.core.indexes.categoryr   Úpandas.core.indexes.datetimesr   Úpandas.core.indexes.intervalr   Úpandas.core.indexes.multir   Úpandas.core.indexes.periodr   Úpandas.core.indexes.ranger   Úpandas.core.indexes.timedeltasr   Úpandas._typingr   ÚdedentÚ	_sort_msgÚ__all__r   r/   r"   r   r   rj   r   r   © r0   r'   ú<module>rš      s  ðÝ "ã ÷ó
 ÷õ ,å 4å ,÷õ õ :Ý 7Ý 6Ý 0Ý 2Ý 0Ý 9áÝ#ØˆH�O‰Oðó	€	ò€ð2 ØØØðUàðUð ðUð ð	Uð
 ðUð óUóDð  ØØð	-Øð-àð-ð ð-ð ð	-ð
 ó-ó`ôD}/ò@# óL5ô$2r0   