B
    P\                 @   sn   d dl mZ 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 )    )absolute_import)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valuealready_hashed r   <lib/python3.7/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$e$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)Z
allow_none)selectLockedCellsselectUnlockedCellsalgorithmNamer   objects
insertRowsinsertHyperlinks
autoFilter	scenariosformatColumnsdeleteColumnsinsertColumnspivotTables
deleteRowsformatCells	saltValue
formatRowssort	spinCountr   	hashValueFNc             C   s   || _ || _|| _|| _|| _|| _|| _|| _|	| _|
| _	|| _
|| _|| _|| _|| _|| _|d k	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__L   s,    zSheetProtection.__init__r   c                s   t t| || |   d S )N)superr   r   enable)r   r   r   )	__class__r   r   r   j   s    zSheetProtection.set_passwordc             C   s
   d| _ d S )NT)r   )r   r   r   r   r0   o   s    zSheetProtection.enablec             C   s
   d| _ d S )NF)r   )r   r   r   r   disables   s    zSheetProtection.disablec             C   s   | j S )N)r   )r   r   r   r   __bool__w   s    zSheetProtection.__bool__)FFFTTTTTTTTFFTTTNNNNN)r   F)'r   r   r   __doc__Ztagnamer   r   r   Zenabledr   r"   r(   r#   r*   r%   r   r    r$   r'   r   r   r+   r!   r&   r   r)   r   r,   r   r   r-   Z	__attrs__r.   r   r0   r2   r3   Z__nonzero____classcell__r   r   )r1   r   r   %   sF   



     
r   N)Z
__future__r   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   