aboutsummaryrefslogtreecommitdiff
path: root/src/ee/xml
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-10-16 06:12:09 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2019-10-16 08:49:48 +0200
commit038152393727bfafc26f25e3e5c14e6f1219e07a (patch)
tree131c6ade35a4278eb40d787cb421bf74e4532026 /src/ee/xml
parent73f151ec1da4ca78d4b9326f7efc81e0fad05159 (diff)
downloadee-python-038152393727bfafc26f25e3e5c14e6f1219e07a.tar.gz
ee-python-038152393727bfafc26f25e3e5c14e6f1219e07a.tar.bz2
ee-python-038152393727bfafc26f25e3e5c14e6f1219e07a.tar.xz
ee-python-038152393727bfafc26f25e3e5c14e6f1219e07a.zip
part: Adding category concept.
Useful for later classifiying components.
Diffstat (limited to 'src/ee/xml')
-rw-r--r--src/ee/xml/types.py231
1 files changed, 227 insertions, 4 deletions
diff --git a/src/ee/xml/types.py b/src/ee/xml/types.py
index afc7e72..2a806e5 100644
--- a/src/ee/xml/types.py
+++ b/src/ee/xml/types.py
@@ -3,7 +3,7 @@
#
# Generated by generateDS.py.
-# Python 3.7.3 (default, Apr 3 2019, 05:39:12) [GCC 8.3.0]
+# Python 3.7.5rc1 (default, Oct 8 2019, 16:47:45) [GCC 9.2.1 20190909]
#
# Command line options:
# ('-f', '')
@@ -822,11 +822,12 @@ def _cast(typ, value):
class PartDb(GeneratedsSuper):
subclass = None
superclass = None
- def __init__(self, parts=None, assembly=None, **kwargs_):
+ def __init__(self, parts=None, assembly=None, categories=None, **kwargs_):
self.original_tagname_ = None
self.parent_object_ = kwargs_.get('parent_object_')
self.parts = parts
self.assembly = assembly
+ self.categories = categories
def factory(*args_, **kwargs_):
if CurrentSubclassModule_ is not None:
subclass = getSubclassFromModule_(
@@ -848,10 +849,16 @@ class PartDb(GeneratedsSuper):
def set_assembly(self, assembly):
self.assembly = assembly
assemblyProp = property(get_assembly, set_assembly)
+ def get_categories(self):
+ return self.categories
+ def set_categories(self, categories):
+ self.categories = categories
+ categoriesProp = property(get_categories, set_categories)
def hasContent_(self):
if (
self.parts is not None or
- self.assembly is not None
+ self.assembly is not None or
+ self.categories is not None
):
return True
else:
@@ -888,6 +895,8 @@ class PartDb(GeneratedsSuper):
self.parts.export(outfile, level, namespaceprefix_, namespacedef_='', name_='parts', pretty_print=pretty_print)
if self.assembly is not None:
self.assembly.export(outfile, level, namespaceprefix_, namespacedef_='', name_='assembly', pretty_print=pretty_print)
+ if self.categories is not None:
+ self.categories.export(outfile, level, namespaceprefix_, namespacedef_='', name_='categories', pretty_print=pretty_print)
def build(self, node):
already_processed = set()
self.buildAttributes(node, node.attrib, already_processed)
@@ -908,18 +917,24 @@ class PartDb(GeneratedsSuper):
obj_.build(child_)
self.assembly = obj_
obj_.original_tagname_ = 'assembly'
+ elif nodeName_ == 'categories':
+ obj_ = CategoryList.factory(parent_object_=self)
+ obj_.build(child_)
+ self.categories = obj_
+ obj_.original_tagname_ = 'categories'
# end class PartDb
class Part(GeneratedsSuper):
subclass = None
superclass = None
- def __init__(self, uri=None, supplier=None, description=None, links=None, references=None, facts=None, price_breaks=None, **kwargs_):
+ def __init__(self, uri=None, supplier=None, description=None, category=None, links=None, references=None, facts=None, price_breaks=None, **kwargs_):
self.original_tagname_ = None
self.parent_object_ = kwargs_.get('parent_object_')
self.uri = _cast(None, uri)
self.supplier = supplier
self.description = description
+ self.category = category
self.links = links
self.references = references
self.facts = facts
@@ -945,6 +960,11 @@ class Part(GeneratedsSuper):
def set_description(self, description):
self.description = description
descriptionProp = property(get_description, set_description)
+ def get_category(self):
+ return self.category
+ def set_category(self, category):
+ self.category = category
+ categoryProp = property(get_category, set_category)
def get_links(self):
return self.links
def set_links(self, links):
@@ -974,6 +994,7 @@ class Part(GeneratedsSuper):
if (
self.supplier is not None or
self.description is not None or
+ self.category is not None or
self.links is not None or
self.references is not None or
self.facts is not None or
@@ -1018,6 +1039,9 @@ class Part(GeneratedsSuper):
if self.description is not None:
showIndent(outfile, level, pretty_print)
outfile.write('<%sdescription>%s</%sdescription>%s' % (namespaceprefix_ , self.gds_encode(self.gds_format_string(quote_xml(self.description), input_name='description')), namespaceprefix_ , eol_))
+ if self.category is not None:
+ showIndent(outfile, level, pretty_print)
+ outfile.write('<%scategory>%s</%scategory>%s' % (namespaceprefix_ , self.gds_encode(self.gds_format_string(quote_xml(self.category), input_name='category')), namespaceprefix_ , eol_))
if self.links is not None:
self.links.export(outfile, level, namespaceprefix_, namespacedef_='', name_='links', pretty_print=pretty_print)
if self.references is not None:
@@ -1049,6 +1073,11 @@ class Part(GeneratedsSuper):
value_ = self.gds_parse_string(value_, node, 'description')
value_ = self.gds_validate_string(value_, node, 'description')
self.description = value_
+ elif nodeName_ == 'category':
+ value_ = child_.text
+ value_ = self.gds_parse_string(value_, node, 'category')
+ value_ = self.gds_validate_string(value_, node, 'category')
+ self.category = value_
elif nodeName_ == 'links':
obj_ = LinkList.factory(parent_object_=self)
obj_.build(child_)
@@ -1159,6 +1188,197 @@ class PartList(GeneratedsSuper):
# end class PartList
+class Category(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, uri=None, name=None, links=None, **kwargs_):
+ self.original_tagname_ = None
+ self.parent_object_ = kwargs_.get('parent_object_')
+ self.uri = _cast(None, uri)
+ self.name = name
+ self.links = links
+ def factory(*args_, **kwargs_):
+ if CurrentSubclassModule_ is not None:
+ subclass = getSubclassFromModule_(
+ CurrentSubclassModule_, Category)
+ if subclass is not None:
+ return subclass(*args_, **kwargs_)
+ if Category.subclass:
+ return Category.subclass(*args_, **kwargs_)
+ else:
+ return Category(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_name(self):
+ return self.name
+ def set_name(self, name):
+ self.name = name
+ nameProp = property(get_name, set_name)
+ def get_links(self):
+ return self.links
+ def set_links(self, links):
+ self.links = links
+ linksProp = property(get_links, set_links)
+ def get_uri(self):
+ return self.uri
+ def set_uri(self, uri):
+ self.uri = uri
+ uriProp = property(get_uri, set_uri)
+ def hasContent_(self):
+ if (
+ self.name is not None or
+ self.links is not None
+ ):
+ return True
+ else:
+ return False
+ def export(self, outfile, level, namespaceprefix_='', namespacedef_='', name_='Category', pretty_print=True):
+ imported_ns_def_ = GenerateDSNamespaceDefs_.get('Category')
+ 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_='Category')
+ if self.hasContent_():
+ outfile.write('>%s' % (eol_, ))
+ self.exportChildren(outfile, level + 1, '', namespacedef_, name_='Category', 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_='Category'):
+ if self.uri is not None and 'uri' not in already_processed:
+ already_processed.add('uri')
+ outfile.write(' uri=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.uri), input_name='uri')), ))
+ def exportChildren(self, outfile, level, namespaceprefix_='', namespacedef_='', name_='Category', fromsubclass_=False, pretty_print=True):
+ if pretty_print:
+ eol_ = '\n'
+ else:
+ eol_ = ''
+ if self.name is not None:
+ showIndent(outfile, level, pretty_print)
+ outfile.write('<%sname>%s</%sname>%s' % (namespaceprefix_ , self.gds_encode(self.gds_format_string(quote_xml(self.name), input_name='name')), namespaceprefix_ , eol_))
+ if self.links is not None:
+ self.links.export(outfile, level, namespaceprefix_, namespacedef_='', name_='links', 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):
+ value = find_attr_value_('uri', node)
+ if value is not None and 'uri' not in already_processed:
+ already_processed.add('uri')
+ self.uri = value
+ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
+ if nodeName_ == 'name':
+ value_ = child_.text
+ value_ = self.gds_parse_string(value_, node, 'name')
+ value_ = self.gds_validate_string(value_, node, 'name')
+ self.name = value_
+ elif nodeName_ == 'links':
+ obj_ = LinkList.factory(parent_object_=self)
+ obj_.build(child_)
+ self.links = obj_
+ obj_.original_tagname_ = 'links'
+# end class Category
+
+
+class CategoryList(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, category=None, **kwargs_):
+ self.original_tagname_ = None
+ self.parent_object_ = kwargs_.get('parent_object_')
+ if category is None:
+ self.category = []
+ else:
+ self.category = category
+ def factory(*args_, **kwargs_):
+ if CurrentSubclassModule_ is not None:
+ subclass = getSubclassFromModule_(
+ CurrentSubclassModule_, CategoryList)
+ if subclass is not None:
+ return subclass(*args_, **kwargs_)
+ if CategoryList.subclass:
+ return CategoryList.subclass(*args_, **kwargs_)
+ else:
+ return CategoryList(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_category(self):
+ return self.category
+ def set_category(self, category):
+ self.category = category
+ def add_category(self, value):
+ self.category.append(value)
+ def insert_category_at(self, index, value):
+ self.category.insert(index, value)
+ def replace_category_at(self, index, value):
+ self.category[index] = value
+ categoryProp = property(get_category, set_category)
+ def hasContent_(self):
+ if (
+ self.category
+ ):
+ return True
+ else:
+ return False
+ def export(self, outfile, level, namespaceprefix_='', namespacedef_='', name_='CategoryList', pretty_print=True):
+ imported_ns_def_ = GenerateDSNamespaceDefs_.get('CategoryList')
+ 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_='CategoryList')
+ if self.hasContent_():
+ outfile.write('>%s' % (eol_, ))
+ self.exportChildren(outfile, level + 1, '', namespacedef_, name_='CategoryList', 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_='CategoryList'):
+ pass
+ def exportChildren(self, outfile, level, namespaceprefix_='', namespacedef_='', name_='CategoryList', fromsubclass_=False, pretty_print=True):
+ if pretty_print:
+ eol_ = '\n'
+ else:
+ eol_ = ''
+ for category_ in self.category:
+ category_.export(outfile, level, namespaceprefix_, namespacedef_='', name_='category', 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_ == 'category':
+ obj_ = Category.factory(parent_object_=self)
+ obj_.build(child_)
+ self.category.append(obj_)
+ obj_.original_tagname_ = 'category'
+# end class CategoryList
+
+
class PartReference(GeneratedsSuper):
subclass = None
superclass = None
@@ -2602,6 +2822,7 @@ class Assembly(GeneratedsSuper):
GDSClassesMapping = {
+ 'categories': CategoryList,
'part': Part,
'part-db': PartDb,
}
@@ -2737,6 +2958,8 @@ __all__ = [
"Assembly",
"AssemblyPart",
"AssemblyPartList",
+ "Category",
+ "CategoryList",
"Fact",
"FactList",
"Link",