aboutsummaryrefslogtreecommitdiff
path: root/src/ee/xml
diff options
context:
space:
mode:
Diffstat (limited to 'src/ee/xml')
-rw-r--r--src/ee/xml/types.py288
1 files changed, 22 insertions, 266 deletions
diff --git a/src/ee/xml/types.py b/src/ee/xml/types.py
index 356b520..fec6884 100644
--- a/src/ee/xml/types.py
+++ b/src/ee/xml/types.py
@@ -726,7 +726,7 @@ def _cast(typ, value):
#
-class PartCollection(GeneratedsSuper):
+class PartDb(GeneratedsSuper):
subclass = None
superclass = None
def __init__(self, parts=None, **kwargs_):
@@ -736,13 +736,13 @@ class PartCollection(GeneratedsSuper):
def factory(*args_, **kwargs_):
if CurrentSubclassModule_ is not None:
subclass = getSubclassFromModule_(
- CurrentSubclassModule_, PartCollection)
+ CurrentSubclassModule_, PartDb)
if subclass is not None:
return subclass(*args_, **kwargs_)
- if PartCollection.subclass:
- return PartCollection.subclass(*args_, **kwargs_)
+ if PartDb.subclass:
+ return PartDb.subclass(*args_, **kwargs_)
else:
- return PartCollection(*args_, **kwargs_)
+ return PartDb(*args_, **kwargs_)
factory = staticmethod(factory)
def get_parts(self):
return self.parts
@@ -756,8 +756,8 @@ class PartCollection(GeneratedsSuper):
return True
else:
return False
- def export(self, outfile, level, namespaceprefix_='', namespacedef_='', name_='PartCollection', pretty_print=True):
- imported_ns_def_ = GenerateDSNamespaceDefs_.get('PartCollection')
+ def export(self, outfile, level, namespaceprefix_='', namespacedef_='', name_='PartDb', pretty_print=True):
+ imported_ns_def_ = GenerateDSNamespaceDefs_.get('PartDb')
if imported_ns_def_ is not None:
namespacedef_ = imported_ns_def_
if pretty_print:
@@ -769,17 +769,17 @@ class PartCollection(GeneratedsSuper):
showIndent(outfile, level, pretty_print)
outfile.write('<%s%s%s' % (namespaceprefix_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
already_processed = set()
- self.exportAttributes(outfile, level, already_processed, namespaceprefix_, name_='PartCollection')
+ self.exportAttributes(outfile, level, already_processed, namespaceprefix_, name_='PartDb')
if self.hasContent_():
outfile.write('>%s' % (eol_, ))
- self.exportChildren(outfile, level + 1, namespaceprefix_, namespacedef_, name_='PartCollection', pretty_print=pretty_print)
+ self.exportChildren(outfile, level + 1, namespaceprefix_, namespacedef_, name_='PartDb', pretty_print=pretty_print)
showIndent(outfile, level, pretty_print)
outfile.write('</%s%s>%s' % (namespaceprefix_, name_, eol_))
else:
outfile.write('/>%s' % (eol_, ))
- def exportAttributes(self, outfile, level, already_processed, namespaceprefix_='', name_='PartCollection'):
+ def exportAttributes(self, outfile, level, already_processed, namespaceprefix_='', name_='PartDb'):
pass
- def exportChildren(self, outfile, level, namespaceprefix_='', namespacedef_='', name_='PartCollection', fromsubclass_=False, pretty_print=True):
+ def exportChildren(self, outfile, level, namespaceprefix_='', namespacedef_='', name_='PartDb', fromsubclass_=False, pretty_print=True):
if pretty_print:
eol_ = '\n'
else:
@@ -801,7 +801,7 @@ class PartCollection(GeneratedsSuper):
obj_.build(child_)
self.parts = obj_
obj_.original_tagname_ = 'parts'
-# end class PartCollection
+# end class PartDb
class Part(GeneratedsSuper):
@@ -1773,250 +1773,9 @@ class PriceBreakList(GeneratedsSuper):
# end class PriceBreakList
-class IndexFile(GeneratedsSuper):
- subclass = None
- superclass = None
- def __init__(self, files=None, **kwargs_):
- self.original_tagname_ = None
- self.parent_object_ = kwargs_.get('parent_object_')
- self.files = files
- def factory(*args_, **kwargs_):
- if CurrentSubclassModule_ is not None:
- subclass = getSubclassFromModule_(
- CurrentSubclassModule_, IndexFile)
- if subclass is not None:
- return subclass(*args_, **kwargs_)
- if IndexFile.subclass:
- return IndexFile.subclass(*args_, **kwargs_)
- else:
- return IndexFile(*args_, **kwargs_)
- factory = staticmethod(factory)
- def get_files(self):
- return self.files
- def set_files(self, files):
- self.files = files
- filesProp = property(get_files, set_files)
- def hasContent_(self):
- if (
- self.files is not None
- ):
- return True
- else:
- return False
- def export(self, outfile, level, namespaceprefix_='', namespacedef_='', name_='IndexFile', pretty_print=True):
- imported_ns_def_ = GenerateDSNamespaceDefs_.get('IndexFile')
- if imported_ns_def_ is not None:
- namespacedef_ = imported_ns_def_
- if pretty_print:
- eol_ = '\n'
- else:
- eol_ = ''
- if self.original_tagname_ is not None:
- name_ = self.original_tagname_
- showIndent(outfile, level, pretty_print)
- outfile.write('<%s%s%s' % (namespaceprefix_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
- already_processed = set()
- self.exportAttributes(outfile, level, already_processed, namespaceprefix_, name_='IndexFile')
- if self.hasContent_():
- outfile.write('>%s' % (eol_, ))
- self.exportChildren(outfile, level + 1, namespaceprefix_, namespacedef_, name_='IndexFile', pretty_print=pretty_print)
- showIndent(outfile, level, pretty_print)
- outfile.write('</%s%s>%s' % (namespaceprefix_, name_, eol_))
- else:
- outfile.write('/>%s' % (eol_, ))
- def exportAttributes(self, outfile, level, already_processed, namespaceprefix_='', name_='IndexFile'):
- pass
- def exportChildren(self, outfile, level, namespaceprefix_='', namespacedef_='', name_='IndexFile', fromsubclass_=False, pretty_print=True):
- if pretty_print:
- eol_ = '\n'
- else:
- eol_ = ''
- if self.files is not None:
- self.files.export(outfile, level, namespaceprefix_, namespacedef_='', name_='files', pretty_print=pretty_print)
- def build(self, node):
- already_processed = set()
- self.buildAttributes(node, node.attrib, already_processed)
- for child in node:
- nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
- self.buildChildren(child, node, nodeName_)
- return self
- def buildAttributes(self, node, attrs, already_processed):
- pass
- def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
- if nodeName_ == 'files':
- obj_ = FileList.factory(parent_object_=self)
- obj_.build(child_)
- self.files = obj_
- obj_.original_tagname_ = 'files'
-# end class IndexFile
-
-
-class File(GeneratedsSuper):
- subclass = None
- superclass = None
- def __init__(self, path=None, **kwargs_):
- self.original_tagname_ = None
- self.parent_object_ = kwargs_.get('parent_object_')
- self.path = _cast(None, path)
- def factory(*args_, **kwargs_):
- if CurrentSubclassModule_ is not None:
- subclass = getSubclassFromModule_(
- CurrentSubclassModule_, File)
- if subclass is not None:
- return subclass(*args_, **kwargs_)
- if File.subclass:
- return File.subclass(*args_, **kwargs_)
- else:
- return File(*args_, **kwargs_)
- factory = staticmethod(factory)
- def get_path(self):
- return self.path
- def set_path(self, path):
- self.path = path
- pathProp = property(get_path, set_path)
- def hasContent_(self):
- if (
-
- ):
- return True
- else:
- return False
- def export(self, outfile, level, namespaceprefix_='', namespacedef_='', name_='File', pretty_print=True):
- imported_ns_def_ = GenerateDSNamespaceDefs_.get('File')
- if imported_ns_def_ is not None:
- namespacedef_ = imported_ns_def_
- if pretty_print:
- eol_ = '\n'
- else:
- eol_ = ''
- if self.original_tagname_ is not None:
- name_ = self.original_tagname_
- showIndent(outfile, level, pretty_print)
- outfile.write('<%s%s%s' % (namespaceprefix_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
- already_processed = set()
- self.exportAttributes(outfile, level, already_processed, namespaceprefix_, name_='File')
- if self.hasContent_():
- outfile.write('>%s' % (eol_, ))
- self.exportChildren(outfile, level + 1, namespaceprefix_, namespacedef_, name_='File', pretty_print=pretty_print)
- outfile.write('</%s%s>%s' % (namespaceprefix_, name_, eol_))
- else:
- outfile.write('/>%s' % (eol_, ))
- def exportAttributes(self, outfile, level, already_processed, namespaceprefix_='', name_='File'):
- if self.path is not None and 'path' not in already_processed:
- already_processed.add('path')
- outfile.write(' path=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.path), input_name='path')), ))
- def exportChildren(self, outfile, level, namespaceprefix_='', namespacedef_='', name_='File', fromsubclass_=False, pretty_print=True):
- pass
- def build(self, node):
- already_processed = set()
- self.buildAttributes(node, node.attrib, already_processed)
- for child in node:
- nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
- self.buildChildren(child, node, nodeName_)
- return self
- def buildAttributes(self, node, attrs, already_processed):
- value = find_attr_value_('path', node)
- if value is not None and 'path' not in already_processed:
- already_processed.add('path')
- self.path = value
- def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
- pass
-# end class File
-
-
-class FileList(GeneratedsSuper):
- subclass = None
- superclass = None
- def __init__(self, file=None, **kwargs_):
- self.original_tagname_ = None
- self.parent_object_ = kwargs_.get('parent_object_')
- if file is None:
- self.file = []
- else:
- self.file = file
- def factory(*args_, **kwargs_):
- if CurrentSubclassModule_ is not None:
- subclass = getSubclassFromModule_(
- CurrentSubclassModule_, FileList)
- if subclass is not None:
- return subclass(*args_, **kwargs_)
- if FileList.subclass:
- return FileList.subclass(*args_, **kwargs_)
- else:
- return FileList(*args_, **kwargs_)
- factory = staticmethod(factory)
- def get_file(self):
- return self.file
- def set_file(self, file):
- self.file = file
- def add_file(self, value):
- self.file.append(value)
- def add_file(self, value):
- self.file.append(value)
- def insert_file_at(self, index, value):
- self.file.insert(index, value)
- def replace_file_at(self, index, value):
- self.file[index] = value
- fileProp = property(get_file, set_file)
- def hasContent_(self):
- if (
- self.file
- ):
- return True
- else:
- return False
- def export(self, outfile, level, namespaceprefix_='', namespacedef_='', name_='FileList', pretty_print=True):
- imported_ns_def_ = GenerateDSNamespaceDefs_.get('FileList')
- if imported_ns_def_ is not None:
- namespacedef_ = imported_ns_def_
- if pretty_print:
- eol_ = '\n'
- else:
- eol_ = ''
- if self.original_tagname_ is not None:
- name_ = self.original_tagname_
- showIndent(outfile, level, pretty_print)
- outfile.write('<%s%s%s' % (namespaceprefix_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
- already_processed = set()
- self.exportAttributes(outfile, level, already_processed, namespaceprefix_, name_='FileList')
- if self.hasContent_():
- outfile.write('>%s' % (eol_, ))
- self.exportChildren(outfile, level + 1, namespaceprefix_, namespacedef_, name_='FileList', pretty_print=pretty_print)
- showIndent(outfile, level, pretty_print)
- outfile.write('</%s%s>%s' % (namespaceprefix_, name_, eol_))
- else:
- outfile.write('/>%s' % (eol_, ))
- def exportAttributes(self, outfile, level, already_processed, namespaceprefix_='', name_='FileList'):
- pass
- def exportChildren(self, outfile, level, namespaceprefix_='', namespacedef_='', name_='FileList', fromsubclass_=False, pretty_print=True):
- if pretty_print:
- eol_ = '\n'
- else:
- eol_ = ''
- for file_ in self.file:
- file_.export(outfile, level, namespaceprefix_, namespacedef_='', name_='file', pretty_print=pretty_print)
- def build(self, node):
- already_processed = set()
- self.buildAttributes(node, node.attrib, already_processed)
- for child in node:
- nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
- self.buildChildren(child, node, nodeName_)
- return self
- def buildAttributes(self, node, attrs, already_processed):
- pass
- def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
- if nodeName_ == 'file':
- obj_ = File.factory(parent_object_=self)
- obj_.build(child_)
- self.file.append(obj_)
- obj_.original_tagname_ = 'file'
-# end class FileList
-
-
GDSClassesMapping = {
- 'file-index': IndexFile,
'part': Part,
- 'part-collection': PartCollection,
+ 'part-db': PartDb,
}
@@ -2044,8 +1803,8 @@ def parse(inFileName, silence=False):
rootNode = doc.getroot()
rootTag, rootClass = get_root_tag(rootNode)
if rootClass is None:
- rootTag = 'PartCollection'
- rootClass = PartCollection
+ rootTag = 'PartDb'
+ rootClass = PartDb
rootObj = rootClass.factory()
rootObj.build(rootNode)
# Enable Python to collect the space used by the DOM.
@@ -2065,8 +1824,8 @@ def parseEtree(inFileName, silence=False):
rootNode = doc.getroot()
rootTag, rootClass = get_root_tag(rootNode)
if rootClass is None:
- rootTag = 'PartCollection'
- rootClass = PartCollection
+ rootTag = 'PartDb'
+ rootClass = PartDb
rootObj = rootClass.factory()
rootObj.build(rootNode)
# Enable Python to collect the space used by the DOM.
@@ -2096,8 +1855,8 @@ def parseString(inString, silence=False):
rootNode= parsexmlstring_(inString, parser)
rootTag, rootClass = get_root_tag(rootNode)
if rootClass is None:
- rootTag = 'PartCollection'
- rootClass = PartCollection
+ rootTag = 'PartDb'
+ rootClass = PartDb
rootObj = rootClass.factory()
rootObj.build(rootNode)
# Enable Python to collect the space used by the DOM.
@@ -2115,8 +1874,8 @@ def parseLiteral(inFileName, silence=False):
rootNode = doc.getroot()
rootTag, rootClass = get_root_tag(rootNode)
if rootClass is None:
- rootTag = 'PartCollection'
- rootClass = PartCollection
+ rootTag = 'PartDb'
+ rootClass = PartDb
rootObj = rootClass.factory()
rootObj.build(rootNode)
# Enable Python to collect the space used by the DOM.
@@ -2148,11 +1907,8 @@ __all__ = [
"DistributorInfo",
"Fact",
"FactList",
- "File",
- "FileList",
- "IndexFile",
"Part",
- "PartCollection",
+ "PartDb",
"PartList",
"PartNumber",
"PartNumberList",