/usr/lib/python3/dist-packages/ufoLib/plistFromETree.py is in python3-ufolib 2.1.1-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 29 30 | from ufoLib.plistlib import PlistParser
__all__ = ["readPlistFromTree"]
def readPlistFromTree(tree):
"""
Given an ElementTree Element *tree*, parse Plist data and return the root
object.
"""
parser = PlistTreeParser()
return parser.parseTree(tree)
class PlistTreeParser(PlistParser):
def parseTree(self, tree):
self.parseElement(tree)
return self.root
def parseElement(self, element):
self.handleBeginElement(element.tag, element.attrib)
# if there are children, recurse
for child in element:
self.parseElement(child)
# otherwise, parse the leaf's data
if not len(element):
# always pass str, not None
self.handleData(element.text or "")
self.handleEndElement(element.tag)
|