1import hashlib
2
3from openpyxl.descriptors import (Bool, Integer, String)
4from openpyxl.descriptors.excel import Base64Binary
5from openpyxl.descriptors.serialisable import Serialisable
6
7from openpyxl.worksheet.protection import (
8 hash_password,
9 _Protected
10)
11
12
13class ChartsheetProtection(Serialisable, _Protected):
14 tagname = "sheetProtection"
15
16 algorithmName = String(allow_none=True)
17 hashValue = Base64Binary(allow_none=True)
18 saltValue = Base64Binary(allow_none=True)
19 spinCount = Integer(allow_none=True)
20 content = Bool(allow_none=True)
21 objects = Bool(allow_none=True)
22
23 __attrs__ = ("content", "objects", "password", "hashValue", "spinCount", "saltValue", "algorithmName")
24
25 def __init__(self,
26 content=None,
27 objects=None,
28 hashValue=None,
29 spinCount=None,
30 saltValue=None,
31 algorithmName=None,
32 password=None,
33 ):
34 self.content = content
35 self.objects = objects
36 self.hashValue = hashValue
37 self.spinCount = spinCount
38 self.saltValue = saltValue
39 self.algorithmName = algorithmName
40 if password is not None:
41 self.password = password