a
    b                     @   sb   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
 G dd deZG dd deeZd	S )
    )BoolStringAliasInteger)Serialisable)Base64Binary)hash_passwordc                   @   s4   e Zd ZdZd	ddZedd Zejdd ZdS )

_ProtectedN Fc                 C   s   |st |}|| _dS )zSet a password on this sheet.N)r   	_passwordselfvalueZalready_hashed r   m/Users/vegardjervell/Documents/master/model/venv/lib/python3.9/site-packages/openpyxl/worksheet/protection.pyset_password   s    z_Protected.set_passwordc                 C   s   | j S )z.Return the password value, regardless of hash.)r   r   r   r   r   password   s    z_Protected.passwordc                 C   s   |  | dS )z-Set a password directly, forcing a hash step.N)r   )r   r   r   r   r   r      s    )r
   F)__name__
__module____qualname__r   r   propertyr   setterr   r   r   r   r	      s   

r	   c                       s   e Zd ZdZdZe ZedZe Z	e Z
e Ze Ze Ze Ze Ze Ze Ze Ze Ze Ze Ze Ze ZeddZeddZeddZeddZdZdd	d
Z d fdd	Z!dd Z"dd Z#dd Z$  Z%S )SheetProtectionz
    Information about protection of various aspects of a sheet. True values
    mean that protection for the object or action is active This is the
    **default** when protection is active, ie. users cannot do something
    ZsheetProtectionsheetT)
allow_none)selectLockedCellsselectUnlockedCellsalgorithmNamer   objects
insertRowsinsertHyperlinks
autoFilter	scenariosformatColumnsdeleteColumnsinsertColumnspivotTables
deleteRowsformatCells	saltValue
formatRowssort	spinCountr   	hashValueFNc                 C   s   || _ || _|| _|| _|| _|| _|| _|| _|	| _|
| _	|| _
|| _|| _|| _|| _|| _|d urn|| _|| _|| _|| _|| _d S N)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(   r   r   r,   r"   r'   r   r   r*   r-   r.   r   r   r   __init__K   s,    zSheetProtection.__init__r
   c                    s   t t| || |   d S r/   )superr   r   enabler   	__class__r   r   r   i   s    zSheetProtection.set_passwordc                 C   s
   d| _ d S )NTr   r   r   r   r   r2   n   s    zSheetProtection.enablec                 C   s
   d| _ d S )NFr5   r   r   r   r   disabler   s    zSheetProtection.disablec                 C   s   | j S r/   r5   r   r   r   r   __bool__v   s    zSheetProtection.__bool__)FFFTTTTTTTTFFTTTNNNNN)r
   F)&r   r   r   __doc__tagnamer   r   r   enabledr   r#   r)   r$   r+   r&   r    r!   r%   r(   r   r   r,   r"   r'   r   r*   r   r-   r   r   r.   	__attrs__r0   r   r2   r6   r7   __classcell__r   r   r3   r   r   $   sF   



      
r   N)Zopenpyxl.descriptorsr   r   r   r   Z!openpyxl.descriptors.serialisabler   Zopenpyxl.descriptors.excelr   Zopenpyxl.utils.protectionr   objectr	   r   r   r   r   r   <module>   s
   