HOME


sh-3ll 1.0
DIR:/opt/cloudlinux/venv/lib64/python3.11/site-packages/pandas/core/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/pandas/core/__pycache__/flags.cpython-311.pyc
�

���h���P�ddlmZddlmZddlZerddlmZGd�d��ZdS)�)�annotations)�
TYPE_CHECKINGN)�NDFramec��eZdZUdZdhZded<dd
�Zedd���Zej	dd
���Zdd�Z
dd�Zdd�Zdd�Z
dS)�Flagsa
    Flags that apply to pandas objects.

    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``.

    Examples
    --------
    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_labelszset[str]�_keys�objr�bool�return�Nonec�F�||_tj|��|_dS�N)�_allows_duplicate_labels�weakref�ref�_obj)�selfr
rs   �H/opt/cloudlinux/venv/lib64/python3.11/site-packages/pandas/core/flags.py�__init__zFlags.__init__3s��(?��%��K��$�$��	�	�	�c��|jS)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�rs rrzFlags.allows_duplicate_labels7s
��<�,�,r�valuec��t|��}|���}|�td���|s|jD]}|����||_dS)Nz$This flag's object has been deleted.)rr�
ValueError�axes�_maybe_check_uniquer)rrr
�axs    rrzFlags.allows_duplicate_labelsWsj���U�����i�i�k�k���;��C�D�D�D��	)��h�
)�
)���&�&�(�(�(�(�(-��%�%�%r�key�strc�R�||jvrt|���t||��Sr)r	�KeyError�getattr)rr s  r�__getitem__zFlags.__getitem__ds+���d�j� � ��3�-�-���t�S�!�!�!rc�n�||jvrtd|�d|j�����t|||��dS)Nz
Unknown flag z. Must be one of )r	r�setattr)rr rs   r�__setitem__zFlags.__setitem__jsH���d�j� � ��O�S�O�O�4�:�O�O�P�P�P���c�5�!�!�!�!�!rc��d|j�d�S)Nz<Flags(allows_duplicate_labels=z)>)rrs r�__repr__zFlags.__repr__os��Q��1M�Q�Q�Q�Qrc�`�t|t|����r|j|jkSdS)NF)�
isinstance�typer)r�others  r�__eq__zFlags.__eq__rs1���e�T�$�Z�Z�(�(�	Q��/�5�3P�P�P��urN)r
rrrrr
)rr)rrrr
)r r!)r r!rr
)rr!)�__name__�
__module__�__qualname__�__doc__r	�__annotations__r�propertyr�setterr%r(r*r/�rrrr
s��������$�$�L1�1�E�1�1�1�1�%�%�%�%��-�-�-��X�-�>�#�
.�
.�
.�$�#�
.�"�"�"�"�"�"�"�"�
R�R�R�R������rr)�
__future__r�typingrr�pandas.core.genericrrr7rr�<module>r;s���"�"�"�"�"�"� � � � � � ������,�+�+�+�+�+�+�k�k�k�k�k�k�k�k�k�kr