/usr/lib/python2.7/dist-packages/openpyxl/writer/strings.py is in python-openpyxl 2.4.9-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | from __future__ import absolute_import
# Copyright (c) 2010-2017 openpyxl
"""Write the shared string table."""
from io import BytesIO
# package imports
from openpyxl.xml.constants import SHEET_MAIN_NS
from openpyxl.xml.functions import Element, xmlfile, SubElement
PRESERVE_SPACE = '{%s}space' % "http://www.w3.org/XML/1998/namespace"
def write_string_table(string_table):
"""Write the string table xml."""
out = BytesIO()
with xmlfile(out) as xf:
with xf.element("sst", xmlns=SHEET_MAIN_NS, uniqueCount="%d" % len(string_table)):
for key in string_table:
el = Element('si')
text = SubElement(el, 't')
text.text = key
if key.strip() != key:
text.set(PRESERVE_SPACE, 'preserve')
xf.write(el)
return out.getvalue()
|