forked from tableau/document-api-python
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstyle_encoding.py
More file actions
29 lines (21 loc) · 976 Bytes
/
style_encoding.py
File metadata and controls
29 lines (21 loc) · 976 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
class StyleMap(object):
"""This class represents bucket in the style XML element."""
def __init__(self, styleMapXmlElement):
self._style_map_xml_element = styleMapXmlElement
self._bucket_text = styleMapXmlElement.find('bucket').text
@property
def bucket_text(self):
return self._bucket_text
@bucket_text.setter
def bucket_text(self, value):
self._bucket_text = value
self._style_map_xml_element.find('bucket').text = value
class StyleEncoding(object):
"""This class represents enconding XML element in the datasource/style/style-rule/encoding XML path."""
def __init__(self, styleEncodingXmlElement):
self._style_encoding_xml_element = styleEncodingXmlElement
self._style_maps = list(StyleMap(sm) for sm in styleEncodingXmlElement.findall('map')) if \
styleEncodingXmlElement else []
@property
def style_maps(self):
return self._style_maps