
    `Vg>                    ,    d dl mZ d dlZ G d d      Zy)    )annotationsNc                  r    e Zd ZdZdhZddZedd       Zej                  dd       Zd Z	ddZ
ddZd	 Zy
)Flagsa)  
    Flags that apply to pandas objects.

    .. versionadded:: 1.2.0

    Parameters
    ----------
    obj : Series or DataFrame
        The object these flags are associated with.
    allows_duplicate_labels : bool, default True
        Whether to allow duplicate labels in this object. By default,
        duplicate labels are permitted. Setting this to ``False`` will
        cause an :class:`errors.DuplicateLabelError` to be raised when
        `index` (or columns for DataFrame) is not unique, or any
        subsequent operation on introduces duplicates.
        See :ref:`duplicates.disallow` for more.

        .. warning::

           This is an experimental feature. Currently, many methods fail to
           propagate the ``allows_duplicate_labels`` value. In future versions
           it is expected that every method taking or returning one or more
           DataFrame or Series objects will propagate ``allows_duplicate_labels``.

    Notes
    -----
    Attributes can be set in two ways

    >>> df = pd.DataFrame()
    >>> df.flags
    <Flags(allows_duplicate_labels=True)>
    >>> df.flags.allows_duplicate_labels = False
    >>> df.flags
    <Flags(allows_duplicate_labels=False)>

    >>> df.flags['allows_duplicate_labels'] = True
    >>> df.flags
    <Flags(allows_duplicate_labels=True)>
    allows_duplicate_labelsc               F    || _         t        j                  |      | _        y N)_allows_duplicate_labelsweakrefref_obj)selfobjr   s      R/var/www/html/hubwallet-dev/venv/lib/python3.12/site-packages/pandas/core/flags.py__init__zFlags.__init__1   s    (?%KK$	    c                    | j                   S )a  
        Whether this object allows duplicate labels.

        Setting ``allows_duplicate_labels=False`` ensures that the
        index (and columns of a DataFrame) are unique. Most methods
        that accept and return a Series or DataFrame will propagate
        the value of ``allows_duplicate_labels``.

        See :ref:`duplicates` for more.

        See Also
        --------
        DataFrame.attrs : Set global metadata on this object.
        DataFrame.set_flags : Set global flags on this object.

        Examples
        --------
        >>> df = pd.DataFrame({"A": [1, 2]}, index=['a', 'a'])
        >>> df.flags.allows_duplicate_labels
        True
        >>> df.flags.allows_duplicate_labels = False
        Traceback (most recent call last):
            ...
        pandas.errors.DuplicateLabelError: Index has duplicates.
              positions
        label
        a        [0, 1]
        )r	   r   s    r   r   zFlags.allows_duplicate_labels5   s    < ,,,r   c                    t        |      }| j                         }|t        d      |s!|j                  D ]  }|j	                           || _        y )Nz$This flag's object has been deleted.)boolr   
ValueErroraxes_maybe_check_uniquer	   )r   valuer   axs       r   r   zFlags.allows_duplicate_labelsU   sS    Uiik;CDDhh )&&() ).%r   c                L    || j                   vrt        |      t        | |      S r   )_keysKeyErrorgetattr)r   keys     r   __getitem__zFlags.__getitem__b   s%    djj 3-tS!!r   c                p    || j                   vrt        d| d| j                          t        | ||       y )NzUnknown flag z. Must be one of )r   r   setattr)r   r   r   s      r   __setitem__zFlags.__setitem__h   s7    djj }SE1B4::,OPPc5!r   c                "    d| j                    dS )Nz<Flags(allows_duplicate_labels=z)>)r   r   s    r   __repr__zFlags.__repr__m   s    01M1M0NbQQr   c                `    t        |t        |             r| j                  |j                  k(  S y)NF)
isinstancetyper   )r   others     r   __eq__zFlags.__eq__p   s*    eT$Z(//53P3PPPr   N)returnNone)r+   r   )r   r   r+   r,   )r+   str)__name__
__module____qualname____doc__r   r   propertyr   setterr    r#   r%   r*    r   r   r   r      sZ    &P ''E% - -> ##
. $
.""
Rr   r   )
__future__r   r
   r   r4   r   r   <module>r6      s    " m mr   