diff --git a/MANIFEST.in b/MANIFEST.in index 268eaddedc0f4bda16cd333a4b5775447c7770f1..849b1685468fd814d603be0d5a65b16e79c1e656 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -81,7 +81,7 @@ include tests/abstract_type.xsd include tests/abstract_type1_sup.py tests/abstract_type1_sub.py include tests/abstract_type2_sup.py tests/abstract_type2_sub.py include tests/simpletypes_other.xsd -include tests/simpletypes_other1_sub.py tests/simpletypes1_other_sup.py +include tests/simpletypes_other1_sub.py tests/simpletypes_other1_sup.py include tests/simpletypes_other2_sub.py tests/simpletypes_other2_sup.py include tests/attr_groups.xsd include tests/attr_groups1_sup.py tests/attr_groups1_sub.py @@ -121,6 +121,17 @@ include tests/validate_simpletypes1_sub.py tests/validate_simpletypes1_sup.py include tests/validate_simpletypes1_warnings.txt include tests/validate_simpletypes2_sub.py tests/validate_simpletypes2_sup.py include tests/validate_simpletypes.xml tests/validate_simpletypes.xsd +include tests/disable_xml_super.xsd +include tests/disable_xml_super1_sup.py +include tests/disable_xml_super1_sub.py +include tests/rem_dup_elems.xsd +include tests/rem_dup_elems.xml +include tests/rem_dup_elems1_out.xml +include tests/rem_dup_elems1_sup.py +include tests/rem_dup_elems1_sub.py +include tests/reference_simpletype.xsd +include tests/reference_simpletype1_sup.py +include tests/reference_simpletype1_sub.py include gui/generateds_gui.py include gui/generateds_gui.glade @@ -146,4 +157,7 @@ include tutorial/Code/people_appl1.py include tutorial/Code/upcase_names.py include tutorial/Code/upcase_names_appl.py - +include utils/batch_generate.py* +include utils/collect_schema_locations.py* +include utils/README.txt +include utils/show_schema_hierarchy.py* diff --git a/README.rst b/README.rst index 95532ba5477df4cfb97ce9ad0d22b4dfc5a62e93..8c9435bf427b89ae7551e1c51b9a721186bc4f3d 100644 --- a/README.rst +++ b/README.rst @@ -141,6 +141,37 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Change history -------------- +Version 2.28a (06/23/2017) + +Significant work by Alim Gokkaya. Thank you, Alim. + +Here's a summary of what's been changed: + +- Added new command-line options: + + - ``--disable-xml``: Toggles the generation of XML serialization + related code + - ``--disable-generatedssuper-lookup``: Disables generation of the + try-except lookup for a `generatedssuper` module + - ``--use-source-file-as-module-name``: Sets the source XSD file name as + the target module name in the one file per XSD mode + +- Retained ``xsd:choice`` related information in the generated class + ``MemberSpec``. +- Retained the original XML schema attribute definitions in the generated + class members. +- Fixed generation of ``import`` statements for the base classes. +- Fixed class not being generated when parent class is defined in + another XML schema file. +- Fixed fqn-module mapping being unavailable for the classes defined + in imported XML schema files. +- Fixed attribute names are sometimes not cleaned-up from the prefix +- Fixed ``xsd:simpleType`` validations methods are not being generated in + ``one-file-per-xsd`` mode. +- Fixed equality check against objects defining extra attributes. +- Added unit test for command line options ``--disable-xml`` and + ``--disable-generatedssuper-lookup``. + Version 2.27b (06/09/2017) - Fixed a bug that occurred when an element definition contains a @@ -329,7 +360,7 @@ Version 2.21a (04/01/2016) The GUI front end must be run under Python 3, and you must install Python support for Gtk. Aleksandr has also provided a Russian translation of the labels - etc in the user interface. You can run that with: + etc in the user interface. You can run that with:: $ cd /path/to/generateds/gui $ python3 generateds_gui.py --impl-gui=generateds_gui_ru.glade diff --git a/generateDS.html b/generateDS.html index 49a5d292ce7c6c101d3dba018b4ab8e36b84bd1b..bc11789108182fa086ebb84bc61753dfde2645d8 100644 --- a/generateDS.html +++ b/generateDS.html @@ -3,7 +3,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<meta name="generator" content="Docutils 0.13.2a: http://docutils.sourceforge.net/" /> +<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" /> <title>generateDS -- Generate Data Structures from XML Schema</title> <meta name="author" content="Dave Kuhlman" /> <style type="text/css"> @@ -220,7 +220,7 @@ They are used by updateversion.py. --> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.27a</td> +<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.28a</td> </tr> </tbody> </table> @@ -229,7 +229,7 @@ They are used by updateversion.py. --> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">date:</th><td class="field-body">June 01, 2017</td> +<tr class="field"><th class="field-name">date:</th><td class="field-body">June 23, 2017</td> </tr> </tbody> </table> @@ -580,6 +580,10 @@ Options: "new" - Name getters/setters get_var()/set_var(). "none" - Do not generate getter/setter methods. Default is "new". + --use-source-file-as-module-name + Used in conjunction with --one-file-per-xsd to + use the source XSD file names to determine the + module name of the generated classes. --user-methods= <module>, -u <module> Optional module containing user methods. See section "User Methods" in the documentation. @@ -639,6 +643,12 @@ Options: to XML) Example: "write etree" Default: "write" + --disable-generatedssuper-lookup + Disables the generatetion of the lookup logic for + presence of an external module from which to load + a custom `GeneratedsSuper` base-class definition. + --disable-xml Disables generation of all XML build/export + methods and command line interface --preserve-cdata-tags Preserve CDATA tags. Default: False --cleanup-name-list=<replacement-map> Specifies list of 2-tuples used for cleaning @@ -807,6 +817,12 @@ methods. Possible values are:</p> </ul> <p class="last">The default is "new".</p> </dd> +<dt>use-source-file-as-module-name</dt> +<dd>Used in conjunction with and only has an effect when used with +<tt class="docutils literal"><span class="pre">--one-file-per-xsd</span></tt>. The effect of this option is to use the +source XML schema file names to determine the module name of the +generated classes. Without this option, the first root element +is used to construct module names. The default is False.</dd> <dt>u, user-methods=<module></dt> <dd>If specified, <tt class="docutils literal">generateDS.py</tt> will add methods to generated classes as specified in the indicated module. For more @@ -906,6 +922,27 @@ and use any of lxml's other capabilities.</li> <p class="last">For example: <tt class="docutils literal"><span class="pre">--export="write</span> etree"</tt> and <tt class="docutils literal"><span class="pre">--export="write"</span></tt>. The default is: <tt class="docutils literal"><span class="pre">--export="write"</span></tt>.</p> </dd> +<dt>disable-generatedssuper-lookup</dt> +<dd>Disables the generation of code implementing the lookup for +presence of an external module from which to load a custom +replacement for the default <tt class="docutils literal">GeneratedsSuper</tt> base-class. +With this flag, unconditionally uses the built-in implementation +of <tt class="docutils literal">GeneratedsSuper</tt>. (Suggestion: In order to get a picture +of what difference this option makes, you might consider +generating modules both with and without it, and then comparing +the results with <tt class="docutils literal">diff</tt>.) The default is False.</dd> +<dt>disable-xml</dt> +<dd>Disables generation of code that enables XML build/export +methods and command line interface. Actually, the code is +there, but is commented out. If you enable this option, the +generated modules will <em>not</em> contain code for the following: (1) +run as a script without explicitly running <tt class="docutils literal">python</tt> (the +<tt class="docutils literal"><span class="pre">#!/usr/bin/env</span> python</tt> line is omitted); (2) import +<tt class="docutils literal">lxml.etree</tt>; (3) parse an XML file; (4) export an XML file. +(Suggestion: In order to get a picture of what difference this +option makes, you might consider generating modules both with +and without it, and then comparing the results with <tt class="docutils literal">diff</tt>.) +The default is False.</dd> <dt>preserve-cdata-tags</dt> <dd>Preserve CDATA tags. Normally, CDATA tags ("<![CDATA[ ... ]]>") are dropped while parsing an XML instance document. If this @@ -3343,7 +3380,7 @@ following among others:</p> <div class="footer"> <hr class="footer" /> <a class="reference external" href="generateDS.txt">View document source</a>. -Generated on: 2017-06-01 16:04 UTC. +Generated on: 2017-06-23 23:12 UTC. Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source. </div> diff --git a/generateDS.py b/generateDS.py index 061d136fb82803fe2dd45446ce8ba57b9bbbdb89..9b591ec594ee12a88c21110385dc4de632a3b006 100755 --- a/generateDS.py +++ b/generateDS.py @@ -109,10 +109,9 @@ Options: Example: "write etree" Default: "write" --disable-generatedssuper-lookup - Disables the generatetion of the lookup logic for - presence of an external module to load a custom - `GeneratedsSuper` base-class definition from. - be generated. + Disables the generatetion of the lookup logic for + presence of an external module from which to load + a custom `GeneratedsSuper` base-class definition. --disable-xml Disables generation of all XML build/export methods and command line interface --preserve-cdata-tags Preserve CDATA tags. Default: False @@ -228,7 +227,7 @@ logging.disable(logging.INFO) # Do not modify the following VERSION comments. # Used by updateversion.py. ##VERSION## -VERSION = '2.27a' +VERSION = '2.28a' ##VERSION## if sys.version_info.major == 2: @@ -1805,7 +1804,7 @@ class XschemaHandler(handler.ContentHandler): self.stack[-1].setSimpleType(1) element = SimpleTypeElement(stName) SimpleTypeDict[stName] = element - SimpleTypeDict[Targetnamespace+":"+stName] = element + SimpleTypeDict[Targetnamespace + ":" + stName] = element self.stack.append(element) self.inSimpleType += 1 elif name == RestrictionType: @@ -4797,10 +4796,12 @@ def generateMemberSpec(wrt, element): item4 = 1 if attrDef.getUse() == 'optional' else 0 if generateDict: item = " '%s': MemberSpec_('%s', '%s', %d, %d, %s)," % ( - item1, item1, item2, item3, item4, repr({'use':attrDef.getUse()})) + item1, item1, item2, item3, item4, repr( + {'use': attrDef.getUse()})) else: item = " MemberSpec_('%s', '%s', %d, %d, %s)," % ( - item1, item2, item3, item4, repr({'use':attrDef.getUse()})) + item1, item2, item3, item4, repr( + {'use': attrDef.getUse()})) add(item) for child in element.getChildren(): name = cleanupName(child.getCleanName()) @@ -5260,7 +5261,8 @@ class MixedContainer: return self.value def getName(self): return self.name -#xmldisable# def export(self, outfile, level, name, namespace, pretty_print=True): +#xmldisable# def export(self, outfile, level, name, namespace, +#xmldisable# pretty_print=True): #xmldisable# if self.category == MixedContainer.CategoryText: #xmldisable# # Prevent exporting empty content as empty lines. #xmldisable# if self.value.strip(): @@ -5269,7 +5271,8 @@ class MixedContainer: #xmldisable# self.exportSimple(outfile, level, name) #xmldisable# else: # category == MixedContainer.CategoryComplex #xmldisable# self.value.export( -#xmldisable# outfile, level, namespace, name, pretty_print=pretty_print) +#xmldisable# outfile, level, namespace, name, +#xmldisable# pretty_print=pretty_print) #xmldisable# def exportSimple(self, outfile, level, name): #xmldisable# if self.content_type == MixedContainer.TypeString: #xmldisable# outfile.write('<%s>%s</%s>' % ( @@ -5287,7 +5290,9 @@ class MixedContainer: #xmldisable# self.name, self.value, self.name)) #xmldisable# elif self.content_type == MixedContainer.TypeBase64: #xmldisable# outfile.write('<%s>%s</%s>' % ( -#xmldisable# self.name, base64.b64encode(self.value), self.name)) +#xmldisable# self.name, +#xmldisable# base64.b64encode(self.value), +#xmldisable# self.name)) #xmldisable# def to_etree(self, element): #xmldisable# if self.category == MixedContainer.CategoryText: #xmldisable# # Prevent exporting empty content as empty lines. @@ -5303,7 +5308,8 @@ class MixedContainer: #xmldisable# else: #xmldisable# element.text += self.value #xmldisable# elif self.category == MixedContainer.CategorySimple: -#xmldisable# subelement = etree_.SubElement(element, '%s' % self.name) +#xmldisable# subelement = etree_.SubElement( +#xmldisable# element, '%s' % self.name) #xmldisable# subelement.text = self.to_etree_simple() #xmldisable# else: # category == MixedContainer.CategoryComplex #xmldisable# self.value.to_etree(element) @@ -5326,12 +5332,14 @@ class MixedContainer: #xmldisable# showIndent(outfile, level) #xmldisable# outfile.write( #xmldisable# 'model_.MixedContainer(%d, %d, "%s", "%s"),\\n' % ( -#xmldisable# self.category, self.content_type, self.name, self.value)) +#xmldisable# self.category, self.content_type, +#xmldisable# self.name, self.value)) #xmldisable# elif self.category == MixedContainer.CategorySimple: #xmldisable# showIndent(outfile, level) #xmldisable# outfile.write( #xmldisable# 'model_.MixedContainer(%d, %d, "%s", "%s"),\\n' % ( -#xmldisable# self.category, self.content_type, self.name, self.value)) +#xmldisable# self.category, self.content_type, +#xmldisable# self.name, self.value)) #xmldisable# else: # category == MixedContainer.CategoryComplex #xmldisable# showIndent(outfile, level) #xmldisable# outfile.write( @@ -5343,7 +5351,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container @@ -5801,8 +5810,12 @@ def generateHeader(wrt, prefix, options, args, externalImports): from generatedssuper import GeneratedsSuper except ImportError as exp: """ - for line in StringIO.StringIO(import_string).readlines(): - s0 += " "+line + if sys.version_info.major == 2: + outfile = StringIO.StringIO + else: + outfile = io.StringIO + for line in outfile(import_string).readlines(): + s0 += " " + line import_string = s0 s1 = TEMPLATE_HEADER.format( @@ -6617,9 +6630,9 @@ def getImportsForExternalXsds(root): type = schemaElement.getType() if type == "xs:string": type = schemaElement.getName() - externalImports.add("from %s%s import %s" % - (moduleName, ModuleSuffix, - type)) + externalImports.add( + "from %s%s import %s" % ( + moduleName, ModuleSuffix, type)) if child.getBase(): parentName, parentObj = getParentName(child) if parentObj.targetNamespace and \ @@ -7048,6 +7061,7 @@ def fixXmlDisable(txt, disabled): txt = txt.replace('#xmldisable#', '') return txt + def capture_cleanup_name_list(option): cleanupNameList = [] if not option: diff --git a/generateDS.txt b/generateDS.txt index fba874220d7e2d5bb5320b4bcfc8465e65f156d6..c4cb9b845fd4c5baeec9a080890ffeacab4d4f63 100644 --- a/generateDS.txt +++ b/generateDS.txt @@ -12,7 +12,7 @@ generateDS -- Generate Data Structures from XML Schema .. version -:revision: 2.27a +:revision: 2.28a .. version @@ -267,6 +267,10 @@ Here is the usage message displayed by ``generateDS.py``:: "new" - Name getters/setters get_var()/set_var(). "none" - Do not generate getter/setter methods. Default is "new". + --use-source-file-as-module-name + Used in conjunction with --one-file-per-xsd to + use the source XSD file names to determine the + module name of the generated classes. --user-methods= <module>, -u <module> Optional module containing user methods. See section "User Methods" in the documentation. @@ -326,6 +330,12 @@ Here is the usage message displayed by ``generateDS.py``:: to XML) Example: "write etree" Default: "write" + --disable-generatedssuper-lookup + Disables the generatetion of the lookup logic for + presence of an external module from which to load + a custom `GeneratedsSuper` base-class definition. + --disable-xml Disables generation of all XML build/export + methods and command line interface --preserve-cdata-tags Preserve CDATA tags. Default: False --cleanup-name-list=<replacement-map> Specifies list of 2-tuples used for cleaning @@ -508,6 +518,13 @@ use-getter-setter The default is "new". +use-source-file-as-module-name + Used in conjunction with and only has an effect when used with + ``--one-file-per-xsd``. The effect of this option is to use the + source XML schema file names to determine the module name of the + generated classes. Without this option, the first root element + is used to construct module names. The default is False. + u, user-methods=<module> If specified, ``generateDS.py`` will add methods to generated classes as specified in the indicated module. For more @@ -620,6 +637,29 @@ export For example: ``--export="write etree"`` and ``--export="write"``. The default is: ``--export="write"``. +disable-generatedssuper-lookup + Disables the generation of code implementing the lookup for + presence of an external module from which to load a custom + replacement for the default ``GeneratedsSuper`` base-class. + With this flag, unconditionally uses the built-in implementation + of ``GeneratedsSuper``. (Suggestion: In order to get a picture + of what difference this option makes, you might consider + generating modules both with and without it, and then comparing + the results with ``diff``.) The default is False. + +disable-xml + Disables generation of code that enables XML build/export + methods and command line interface. Actually, the code is + there, but is commented out. If you enable this option, the + generated modules will *not* contain code for the following: (1) + run as a script without explicitly running ``python`` (the + ``#!/usr/bin/env python`` line is omitted); (2) import + ``lxml.etree``; (3) parse an XML file; (4) export an XML file. + (Suggestion: In order to get a picture of what difference this + option makes, you might consider generating modules both with + and without it, and then comparing the results with ``diff``.) + The default is False. + preserve-cdata-tags Preserve CDATA tags. Normally, CDATA tags ("<![CDATA[ ... ]]>") are dropped while parsing an XML instance document. If this diff --git a/generateds_gui_notes.html b/generateds_gui_notes.html index 41fd9cf8b7f73fb554beee1e64fd2c3a03965a09..e0e7cd23defaff30c1dad1909e12b92d203ae69c 100644 --- a/generateds_gui_notes.html +++ b/generateds_gui_notes.html @@ -3,7 +3,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<meta name="generator" content="Docutils 0.13.2a: http://docutils.sourceforge.net/" /> +<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" /> <title>GenerateDS GUI Notes</title> <meta name="author" content="Dave Kuhlman" /> <style type="text/css"> @@ -220,7 +220,7 @@ They are used by updateversion.py. --> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.27a</td> +<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.28a</td> </tr> </tbody> </table> @@ -229,7 +229,7 @@ They are used by updateversion.py. --> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">date:</th><td class="field-body">June 01, 2017</td> +<tr class="field"><th class="field-name">date:</th><td class="field-body">June 23, 2017</td> </tr> </tbody> </table> @@ -401,7 +401,7 @@ $ mv generateds_gui.mo locale/ru/LC_MESSAGES/ <div class="footer"> <hr class="footer" /> <a class="reference external" href="generateds_gui_notes.txt">View document source</a>. -Generated on: 2017-06-01 16:04 UTC. +Generated on: 2017-06-23 23:12 UTC. Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source. </div> diff --git a/generateds_gui_notes.txt b/generateds_gui_notes.txt index ac0da3a85968c8489d4cea7a31cf249379a5ca5a..4830511a831a0810974d1385d2710e628d59c92d 100644 --- a/generateds_gui_notes.txt +++ b/generateds_gui_notes.txt @@ -12,7 +12,7 @@ GenerateDS GUI Notes .. version -:revision: 2.27a +:revision: 2.28a .. version diff --git a/gui/generateds_gui.py b/gui/generateds_gui.py index a7e35417f5f4f9af60150f706dd9c13029d79e00..fc1e734b0a9f5f6d844097b8d3f54e0299e727fd 100644 --- a/gui/generateds_gui.py +++ b/gui/generateds_gui.py @@ -41,7 +41,7 @@ from libgenerateDS.gui import generateds_gui_session # Do not modify the following VERSION comments. # Used by updateversion.py. ##VERSION## -VERSION = '2.27a' +VERSION = '2.28a' ##VERSION## diff --git a/librarytemplate_howto.html b/librarytemplate_howto.html index 8a4f0a10b071bf5063e8460e05e413bb5691004b..cb45e025f5b4d0ae1bc45511347cc41cef199fac 100644 --- a/librarytemplate_howto.html +++ b/librarytemplate_howto.html @@ -3,7 +3,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<meta name="generator" content="Docutils 0.13.2a: http://docutils.sourceforge.net/" /> +<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" /> <title>How to package a generateDS.py generated library</title> <meta name="author" content="Dave Kuhlman" /> <style type="text/css"> @@ -217,7 +217,7 @@ dkuhlman (at) davekuhlman (dot) org <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.27a</td> +<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.28a</td> </tr> </tbody> </table> @@ -226,7 +226,7 @@ dkuhlman (at) davekuhlman (dot) org <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">date:</th><td class="field-body">June 01, 2017</td> +<tr class="field"><th class="field-name">date:</th><td class="field-body">June 23, 2017</td> </tr> </tbody> </table> @@ -380,7 +380,7 @@ this command for your needs. For example, you may need to use <div class="footer"> <hr class="footer" /> <a class="reference external" href="librarytemplate_howto.txt">View document source</a>. -Generated on: 2017-06-01 16:04 UTC. +Generated on: 2017-06-23 23:12 UTC. Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source. </div> diff --git a/librarytemplate_howto.txt b/librarytemplate_howto.txt index 808eeb8b0efbb1b202a35cfb545cb2c1526e7802..6e2f82680ffa65bc39af338d65c79ff30c40bfcf 100644 --- a/librarytemplate_howto.txt +++ b/librarytemplate_howto.txt @@ -8,7 +8,7 @@ How to package a generateDS.py generated library .. version -:revision: 2.27a +:revision: 2.28a .. version diff --git a/process_includes.py b/process_includes.py index 43aa474d7a7cd5b1af299d995dca29af1b5a7cb4..1fe384b4c05062262378b48501db369bd53cf7d6 100644 --- a/process_includes.py +++ b/process_includes.py @@ -40,7 +40,7 @@ except ImportError: # Do not modify the following VERSION comments. # Used by updateversion.py. ##VERSION## -VERSION = '2.27a' +VERSION = '2.28a' ##VERSION## CatalogDict = {} diff --git a/setup.py b/setup.py index 0e959618a68d50ef3d9e63323435220894fc5626..145feeb0c23116f1c19b94da1cb7c96e0a1c15a8 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup(name="generateDS", # Do not modify the following VERSION comments. # Used by updateversion.py. ##VERSION## - version="2.27a", + version="2.28a", ##VERSION## author="Dave Kuhlman", author_email="dkuhlman@davekuhlman.org", diff --git a/tests/OnePer/oneperType00_2One.py b/tests/OnePer/oneperType00_2One.py index 9799e13230401dcfcde82042299595029dfe777b..6a9383a228afa725a55350e57132708e9c766b35 100644 --- a/tests/OnePer/oneperType00_2One.py +++ b/tests/OnePer/oneperType00_2One.py @@ -580,7 +580,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -589,7 +590,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -607,7 +609,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -623,7 +627,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -646,12 +651,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -663,7 +670,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/OnePer/oneperType01_2One.py b/tests/OnePer/oneperType01_2One.py index 6caef49a86dd03820abc136d1c1d1dcad2831c70..9cb957bfcf5058cf897b2d0cdb582a18c19b8946 100644 --- a/tests/OnePer/oneperType01_2One.py +++ b/tests/OnePer/oneperType01_2One.py @@ -580,7 +580,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -589,7 +590,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -607,7 +609,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -623,7 +627,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -646,12 +651,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -663,7 +670,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/OnePer/oneperType02_2One.py b/tests/OnePer/oneperType02_2One.py index d4c54a91d49f82938ca6b219b3cac5ecfc49b6e7..2cc43fddfb7dee88a3f184e5fa846a59e90675cc 100644 --- a/tests/OnePer/oneperType02_2One.py +++ b/tests/OnePer/oneperType02_2One.py @@ -580,7 +580,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -589,7 +590,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -607,7 +609,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -623,7 +627,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -646,12 +651,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -663,7 +670,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/OnePer/oneperType03_2One.py b/tests/OnePer/oneperType03_2One.py index c59d06a735c35c5a6c48324a1463c0c66a47c88d..cf8139e7d632ca99006258e7d9ed5647b27a9bed 100644 --- a/tests/OnePer/oneperType03_2One.py +++ b/tests/OnePer/oneperType03_2One.py @@ -580,7 +580,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -589,7 +590,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -607,7 +609,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -623,7 +627,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -646,12 +651,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -663,7 +670,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/abstract_type1_sup.py b/tests/abstract_type1_sup.py index 2b58825f238a005190c35fdbb293989f6d66a386..72181e6f6ec704700423a5225e203fcb597fb25f 100644 --- a/tests/abstract_type1_sup.py +++ b/tests/abstract_type1_sup.py @@ -579,7 +579,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -588,7 +589,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -606,7 +608,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -622,7 +626,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -645,12 +650,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -662,7 +669,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/annotations1_sup.py b/tests/annotations1_sup.py index 6c9582affd1415fd262aa395e3f893afff8bf581..784711b2d090f3c8a8f4eb62e9d42962857d1019 100644 --- a/tests/annotations1_sup.py +++ b/tests/annotations1_sup.py @@ -579,7 +579,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -588,7 +589,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -606,7 +608,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -622,7 +626,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -645,12 +650,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -662,7 +669,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/anonymous_type1_sup.py b/tests/anonymous_type1_sup.py index 3f740cb476abfd069e8cb7fc577a7b64b8cdf1b7..757d76b9c1d1c4721dcbed5f5edf05b0cce1c80b 100644 --- a/tests/anonymous_type1_sup.py +++ b/tests/anonymous_type1_sup.py @@ -579,7 +579,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -588,7 +589,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -606,7 +608,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -622,7 +626,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -645,12 +650,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -662,7 +669,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/anysimpletype1_sup.py b/tests/anysimpletype1_sup.py index af82c11cf31daad5c8867ad1c6d211f64bf10b6a..a42b892540e08eae4d516de89ab0643b5186c3a4 100644 --- a/tests/anysimpletype1_sup.py +++ b/tests/anysimpletype1_sup.py @@ -579,7 +579,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -588,7 +589,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -606,7 +608,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -622,7 +626,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -645,12 +650,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -662,7 +669,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/anywildcard1_sup.py b/tests/anywildcard1_sup.py index 8b67cf3a7684f710150952d333256066c94ae490..863dd057d08b1a27af24b51a0d900e7c098141a0 100644 --- a/tests/anywildcard1_sup.py +++ b/tests/anywildcard1_sup.py @@ -579,7 +579,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -588,7 +589,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -606,7 +608,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -622,7 +626,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -645,12 +650,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -662,7 +669,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/attr_groups1_sup.py b/tests/attr_groups1_sup.py index 6ebc2137ee457c1d6a475275bb1697be17ceea8f..1e8f030f16e02795dc1d295098206711ed35969e 100644 --- a/tests/attr_groups1_sup.py +++ b/tests/attr_groups1_sup.py @@ -579,7 +579,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -588,7 +589,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -606,7 +608,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -622,7 +626,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -645,12 +650,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -662,7 +669,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/catalogtest1_sup.py b/tests/catalogtest1_sup.py index 0695675ea99d7ce26a1321d1e3a44f08624e48b7..b63985eb975201f0ad9357578c9bfacac0ff497c 100644 --- a/tests/catalogtest1_sup.py +++ b/tests/catalogtest1_sup.py @@ -580,7 +580,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -589,7 +590,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -607,7 +609,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -623,7 +627,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -646,12 +651,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -663,7 +670,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/cdata1_sup.py b/tests/cdata1_sup.py index 9b7146cb8ad2f621bc618710ccdf085144c5935f..60589866d522e6e8b0e5d3c3e7d3687c10fb90a3 100644 --- a/tests/cdata1_sup.py +++ b/tests/cdata1_sup.py @@ -580,7 +580,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -589,7 +590,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -607,7 +609,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -623,7 +627,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -646,12 +651,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -663,7 +670,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/check_results.rb b/tests/check_results.rb old mode 100644 new mode 100755 diff --git a/tests/cleanupname1_sup.py b/tests/cleanupname1_sup.py index 053a39cfd2e9b1ae7eec40309a2efda16b2cdd53..dcdd1aae3399fdcd77d1eca1759f48992bab7e50 100644 --- a/tests/cleanupname1_sup.py +++ b/tests/cleanupname1_sup.py @@ -580,7 +580,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -589,7 +590,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -607,7 +609,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -623,7 +627,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -646,12 +651,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -663,7 +670,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/defaults_cases1_sup.py b/tests/defaults_cases1_sup.py index 0c5f722d7b867ab33753ab20898209a86da9361a..119f2dc9bb97f0a27244dbfe5eaed3d192305b50 100644 --- a/tests/defaults_cases1_sup.py +++ b/tests/defaults_cases1_sup.py @@ -578,7 +578,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -587,7 +588,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -605,7 +607,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -621,7 +625,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -644,12 +649,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -661,7 +668,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/defaults_coverage1_sup.py b/tests/defaults_coverage1_sup.py index 22f7fe3020d487ad74e9335ec53622829a21819b..7bd6d4f777fa364ddcbc73cfe8b81c2fa7ed027e 100644 --- a/tests/defaults_coverage1_sup.py +++ b/tests/defaults_coverage1_sup.py @@ -579,7 +579,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -588,7 +589,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -606,7 +608,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -622,7 +626,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -645,12 +650,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -662,7 +669,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/disable_xml_super.xsd b/tests/disable_xml_super.xsd new file mode 100644 index 0000000000000000000000000000000000000000..3d08fa93d4e910bccac09f31ecd0be7941ebb258 --- /dev/null +++ b/tests/disable_xml_super.xsd @@ -0,0 +1,16 @@ +<xs:schema + xmlns:xs="http://www.w3.org/2001/XMLSchema" + > + + + <xs:element name="Package" type="PackageType"/> + + <xs:complexType name="PackageType"> + <xs:sequence> + <xs:element name="Address" type="xs:string" + minOccurs="0" maxOccurs="unbounded"> + </xs:element> + </xs:sequence> + </xs:complexType> + +</xs:schema> diff --git a/tests/disable_xml_super1_sub.py b/tests/disable_xml_super1_sub.py new file mode 100644 index 0000000000000000000000000000000000000000..4f116e8ca21bbf05a72de1b6a9f49a15cc78a5b4 --- /dev/null +++ b/tests/disable_xml_super1_sub.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python + +# +# Generated by generateDS.py. +# +# Command line options: +# ('--no-dates', '') +# ('--no-versions', '') +# ('--disable-xml', '') +# ('--disable-generatedssuper-lookup', '') +# ('--member-specs', 'list') +# ('-f', '') +# ('-a', 'xsd:') +# ('-o', 'tests/disable_xml_super2_sup.py') +# ('-s', 'tests/disable_xml_super2_sub.py') +# ('--super', 'disable_xml_super2_sup') +# ('--no-warnings', '') +# +# Command line arguments: +# tests/disable_xml_super.xsd +# +# Command line: +# generateDS.py --no-dates --no-versions --disable-xml --disable-generatedssuper-lookup --member-specs="list" -f -a "xsd:" -o "tests/disable_xml_super2_sup.py" -s "tests/disable_xml_super2_sub.py" --super="disable_xml_super2_sup" --no-warnings tests/disable_xml_super.xsd +# +# Current working directory (os.getcwd()): +# generateds +# + +import sys +## from lxml import etree as etree_ + +import disable_xml_super2_sup as supermod + +## def parsexml_(infile, parser=None, **kwargs): +## if parser is None: +## # Use the lxml ElementTree compatible parser so that, e.g., +## # we ignore comments. +## parser = etree_.ETCompatXMLParser() +## doc = etree_.parse(infile, parser=parser, **kwargs) +## return doc + +# +# Globals +# + +ExternalEncoding = 'ascii' + +# +# Data representation classes +# + + +class PackageTypeSub(supermod.PackageType): + def __init__(self, Address=None): + super(PackageTypeSub, self).__init__(Address, ) +supermod.PackageType.subclass = PackageTypeSub +# end class PackageTypeSub + + diff --git a/tests/disable_xml_super1_sup.py b/tests/disable_xml_super1_sup.py new file mode 100644 index 0000000000000000000000000000000000000000..9ad8be9415f5270135727e710805428f15f26e56 --- /dev/null +++ b/tests/disable_xml_super1_sup.py @@ -0,0 +1,758 @@ +## #!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Generated by generateDS.py. +# +# Command line options: +# ('--no-dates', '') +# ('--no-versions', '') +# ('--disable-xml', '') +# ('--disable-generatedssuper-lookup', '') +# ('--member-specs', 'list') +# ('-f', '') +# ('-a', 'xsd:') +# ('-o', 'tests/disable_xml_super2_sup.py') +# ('-s', 'tests/disable_xml_super2_sub.py') +# ('--super', 'disable_xml_super2_sup') +# ('--no-warnings', '') +# +# Command line arguments: +# tests/disable_xml_super.xsd +# +# Command line: +# generateDS.py --no-dates --no-versions --disable-xml --disable-generatedssuper-lookup --member-specs="list" -f -a "xsd:" -o "tests/disable_xml_super2_sup.py" -s "tests/disable_xml_super2_sub.py" --super="disable_xml_super2_sup" --no-warnings tests/disable_xml_super.xsd +# +# Current working directory (os.getcwd()): +# generateds +# + +import sys +import re as re_ +import base64 +import datetime as datetime_ +import warnings as warnings_ +## try: +## from lxml import etree as etree_ +## except ImportError: +## from xml.etree import ElementTree as etree_ + + +Validate_simpletypes_ = True +if sys.version_info.major == 2: + BaseStrType_ = basestring +else: + BaseStrType_ = str + + +## def parsexml_(infile, parser=None, **kwargs): +## if parser is None: +## # Use the lxml ElementTree compatible parser so that, e.g., +## # we ignore comments. +## try: +## parser = etree_.ETCompatXMLParser() +## except AttributeError: +## # fallback to xml.etree +## parser = etree_.XMLParser() +## doc = etree_.parse(infile, parser=parser, **kwargs) +## return doc + +# +# Namespace prefix definition table (and other attributes, too) +# +# The module generatedsnamespaces, if it is importable, must contain +# a dictionary named GeneratedsNamespaceDefs. This Python dictionary +# should map element type names (strings) to XML schema namespace prefix +# definitions. The export method for any class for which there is +# a namespace prefix definition, will export that definition in the +# XML representation of that element. See the export method of +# any generated element type class for a example of the use of this +# table. +# A sample table is: +# +# # File: generatedsnamespaces.py +# +# GenerateDSNamespaceDefs = { +# "ElementtypeA": "http://www.xxx.com/namespaceA", +# "ElementtypeB": "http://www.xxx.com/namespaceB", +# } +# + +try: + from generatedsnamespaces import GenerateDSNamespaceDefs as GenerateDSNamespaceDefs_ +except ImportError: + GenerateDSNamespaceDefs_ = {} + +# +# The root super-class for element type classes +# +# Calls to the methods in these classes are generated by generateDS.py. +# You can replace these methods by re-implementing the following class +# in a module named generatedssuper.py. + + +class GeneratedsSuper(object): + tzoff_pattern = re_.compile(r'(\+|-)((0\d|1[0-3]):[0-5]\d|14:00)$') + class _FixedOffsetTZ(datetime_.tzinfo): + def __init__(self, offset, name): + self.__offset = datetime_.timedelta(minutes=offset) + self.__name = name + def utcoffset(self, dt): + return self.__offset + def tzname(self, dt): + return self.__name + def dst(self, dt): + return None + def gds_format_string(self, input_data, input_name=''): + return input_data + def gds_validate_string(self, input_data, node=None, input_name=''): + if not input_data: + return '' + else: + return input_data + def gds_format_base64(self, input_data, input_name=''): + return base64.b64encode(input_data) + def gds_validate_base64(self, input_data, node=None, input_name=''): + return input_data + def gds_format_integer(self, input_data, input_name=''): + return '%d' % input_data + def gds_validate_integer(self, input_data, node=None, input_name=''): + return input_data + def gds_format_integer_list(self, input_data, input_name=''): + return '%s' % ' '.join(input_data) + def gds_validate_integer_list( + self, input_data, node=None, input_name=''): + values = input_data.split() + for value in values: + try: + int(value) + except (TypeError, ValueError): + raise_parse_error(node, 'Requires sequence of integers') + return values + def gds_format_float(self, input_data, input_name=''): + return ('%.15f' % input_data).rstrip('0') + def gds_validate_float(self, input_data, node=None, input_name=''): + return input_data + def gds_format_float_list(self, input_data, input_name=''): + return '%s' % ' '.join(input_data) + def gds_validate_float_list( + self, input_data, node=None, input_name=''): + values = input_data.split() + for value in values: + try: + float(value) + except (TypeError, ValueError): + raise_parse_error(node, 'Requires sequence of floats') + return values + def gds_format_double(self, input_data, input_name=''): + return '%e' % input_data + def gds_validate_double(self, input_data, node=None, input_name=''): + return input_data + def gds_format_double_list(self, input_data, input_name=''): + return '%s' % ' '.join(input_data) + def gds_validate_double_list( + self, input_data, node=None, input_name=''): + values = input_data.split() + for value in values: + try: + float(value) + except (TypeError, ValueError): + raise_parse_error(node, 'Requires sequence of doubles') + return values + def gds_format_boolean(self, input_data, input_name=''): + return ('%s' % input_data).lower() + def gds_validate_boolean(self, input_data, node=None, input_name=''): + return input_data + def gds_format_boolean_list(self, input_data, input_name=''): + return '%s' % ' '.join(input_data) + def gds_validate_boolean_list( + self, input_data, node=None, input_name=''): + values = input_data.split() + for value in values: + if value not in ('true', '1', 'false', '0', ): + raise_parse_error( + node, + 'Requires sequence of booleans ' + '("true", "1", "false", "0")') + return values + def gds_validate_datetime(self, input_data, node=None, input_name=''): + return input_data + def gds_format_datetime(self, input_data, input_name=''): + if input_data.microsecond == 0: + _svalue = '%04d-%02d-%02dT%02d:%02d:%02d' % ( + input_data.year, + input_data.month, + input_data.day, + input_data.hour, + input_data.minute, + input_data.second, + ) + else: + _svalue = '%04d-%02d-%02dT%02d:%02d:%02d.%s' % ( + input_data.year, + input_data.month, + input_data.day, + input_data.hour, + input_data.minute, + input_data.second, + ('%f' % (float(input_data.microsecond) / 1000000))[2:], + ) + if input_data.tzinfo is not None: + tzoff = input_data.tzinfo.utcoffset(input_data) + if tzoff is not None: + total_seconds = tzoff.seconds + (86400 * tzoff.days) + if total_seconds == 0: + _svalue += 'Z' + else: + if total_seconds < 0: + _svalue += '-' + total_seconds *= -1 + else: + _svalue += '+' + hours = total_seconds // 3600 + minutes = (total_seconds - (hours * 3600)) // 60 + _svalue += '{0:02d}:{1:02d}'.format(hours, minutes) + return _svalue + @classmethod + def gds_parse_datetime(cls, input_data): + tz = None + if input_data[-1] == 'Z': + tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC') + input_data = input_data[:-1] + else: + results = GeneratedsSuper.tzoff_pattern.search(input_data) + if results is not None: + tzoff_parts = results.group(2).split(':') + tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1]) + if results.group(1) == '-': + tzoff *= -1 + tz = GeneratedsSuper._FixedOffsetTZ( + tzoff, results.group(0)) + input_data = input_data[:-6] + time_parts = input_data.split('.') + if len(time_parts) > 1: + micro_seconds = int(float('0.' + time_parts[1]) * 1000000) + input_data = '%s.%s' % (time_parts[0], micro_seconds, ) + dt = datetime_.datetime.strptime( + input_data, '%Y-%m-%dT%H:%M:%S.%f') + else: + dt = datetime_.datetime.strptime( + input_data, '%Y-%m-%dT%H:%M:%S') + dt = dt.replace(tzinfo=tz) + return dt + def gds_validate_date(self, input_data, node=None, input_name=''): + return input_data + def gds_format_date(self, input_data, input_name=''): + _svalue = '%04d-%02d-%02d' % ( + input_data.year, + input_data.month, + input_data.day, + ) + try: + if input_data.tzinfo is not None: + tzoff = input_data.tzinfo.utcoffset(input_data) + if tzoff is not None: + total_seconds = tzoff.seconds + (86400 * tzoff.days) + if total_seconds == 0: + _svalue += 'Z' + else: + if total_seconds < 0: + _svalue += '-' + total_seconds *= -1 + else: + _svalue += '+' + hours = total_seconds // 3600 + minutes = (total_seconds - (hours * 3600)) // 60 + _svalue += '{0:02d}:{1:02d}'.format( + hours, minutes) + except AttributeError: + pass + return _svalue + @classmethod + def gds_parse_date(cls, input_data): + tz = None + if input_data[-1] == 'Z': + tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC') + input_data = input_data[:-1] + else: + results = GeneratedsSuper.tzoff_pattern.search(input_data) + if results is not None: + tzoff_parts = results.group(2).split(':') + tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1]) + if results.group(1) == '-': + tzoff *= -1 + tz = GeneratedsSuper._FixedOffsetTZ( + tzoff, results.group(0)) + input_data = input_data[:-6] + dt = datetime_.datetime.strptime(input_data, '%Y-%m-%d') + dt = dt.replace(tzinfo=tz) + return dt.date() + def gds_validate_time(self, input_data, node=None, input_name=''): + return input_data + def gds_format_time(self, input_data, input_name=''): + if input_data.microsecond == 0: + _svalue = '%02d:%02d:%02d' % ( + input_data.hour, + input_data.minute, + input_data.second, + ) + else: + _svalue = '%02d:%02d:%02d.%s' % ( + input_data.hour, + input_data.minute, + input_data.second, + ('%f' % (float(input_data.microsecond) / 1000000))[2:], + ) + if input_data.tzinfo is not None: + tzoff = input_data.tzinfo.utcoffset(input_data) + if tzoff is not None: + total_seconds = tzoff.seconds + (86400 * tzoff.days) + if total_seconds == 0: + _svalue += 'Z' + else: + if total_seconds < 0: + _svalue += '-' + total_seconds *= -1 + else: + _svalue += '+' + hours = total_seconds // 3600 + minutes = (total_seconds - (hours * 3600)) // 60 + _svalue += '{0:02d}:{1:02d}'.format(hours, minutes) + return _svalue + def gds_validate_simple_patterns(self, patterns, target): + # pat is a list of lists of strings/patterns. We should: + # - AND the outer elements + # - OR the inner elements + found1 = True + for patterns1 in patterns: + found2 = False + for patterns2 in patterns1: + if re_.search(patterns2, target) is not None: + found2 = True + break + if not found2: + found1 = False + break + return found1 + @classmethod + def gds_parse_time(cls, input_data): + tz = None + if input_data[-1] == 'Z': + tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC') + input_data = input_data[:-1] + else: + results = GeneratedsSuper.tzoff_pattern.search(input_data) + if results is not None: + tzoff_parts = results.group(2).split(':') + tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1]) + if results.group(1) == '-': + tzoff *= -1 + tz = GeneratedsSuper._FixedOffsetTZ( + tzoff, results.group(0)) + input_data = input_data[:-6] + if len(input_data.split('.')) > 1: + dt = datetime_.datetime.strptime(input_data, '%H:%M:%S.%f') + else: + dt = datetime_.datetime.strptime(input_data, '%H:%M:%S') + dt = dt.replace(tzinfo=tz) + return dt.time() + def gds_str_lower(self, instring): + return instring.lower() + def get_path_(self, node): + path_list = [] + self.get_path_list_(node, path_list) + path_list.reverse() + path = '/'.join(path_list) + return path + Tag_strip_pattern_ = re_.compile(r'\{.*\}') + def get_path_list_(self, node, path_list): + if node is None: + return + tag = GeneratedsSuper.Tag_strip_pattern_.sub('', node.tag) + if tag: + path_list.append(tag) + self.get_path_list_(node.getparent(), path_list) + def get_class_obj_(self, node, default_class=None): + class_obj1 = default_class + if 'xsi' in node.nsmap: + classname = node.get('{%s}type' % node.nsmap['xsi']) + if classname is not None: + names = classname.split(':') + if len(names) == 2: + classname = names[1] + class_obj2 = globals().get(classname) + if class_obj2 is not None: + class_obj1 = class_obj2 + return class_obj1 + def gds_build_any(self, node, type_name=None): + return None + @classmethod + def gds_reverse_node_mapping(cls, mapping): + return dict(((v, k) for k, v in mapping.iteritems())) + @staticmethod + def gds_encode(instring): + if sys.version_info.major == 2: + return instring.encode(ExternalEncoding) + else: + return instring + @staticmethod + def convert_unicode(instring): + if isinstance(instring, str): + result = quote_xml(instring) + elif sys.version_info.major == 2 and isinstance(instring, unicode): + result = quote_xml(instring).encode('utf8') + else: + result = GeneratedsSuper.gds_encode(str(instring)) + return result + def __eq__(self, other): + if type(self) != type(other): + return False + return self.__dict__ == other.__dict__ + def __ne__(self, other): + return not self.__eq__(other) + +def getSubclassFromModule_(module, class_): + '''Get the subclass of a class from a specific module.''' + name = class_.__name__ + 'Sub' + if hasattr(module, name): + return getattr(module, name) + else: + return None + + +# +# If you have installed IPython you can uncomment and use the following. +# IPython is available from http://ipython.scipy.org/. +# + +## from IPython.Shell import IPShellEmbed +## args = '' +## ipshell = IPShellEmbed(args, +## banner = 'Dropping into IPython', +## exit_msg = 'Leaving Interpreter, back to program.') + +# Then use the following line where and when you want to drop into the +# IPython shell: +# ipshell('<some message> -- Entering ipshell.\nHit Ctrl-D to exit') + +# +# Globals +# + +ExternalEncoding = 'ascii' +Tag_pattern_ = re_.compile(r'({.*})?(.*)') +String_cleanup_pat_ = re_.compile(r"[\n\r\s]+") +Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)') +CDATA_pattern_ = re_.compile(r"<!\[CDATA\[.*?\]\]>", re_.DOTALL) + +# Change this to redirect the generated superclass module to use a +# specific subclass module. +CurrentSubclassModule_ = None + +# +# Support/utility functions. +# + + +def showIndent(outfile, level, pretty_print=True): + if pretty_print: + for idx in range(level): + outfile.write(' ') + + +def quote_xml(inStr): + "Escape markup chars, but do not modify CDATA sections." + if not inStr: + return '' + s1 = (isinstance(inStr, BaseStrType_) and inStr or '%s' % inStr) + s2 = '' + pos = 0 + matchobjects = CDATA_pattern_.finditer(s1) + for mo in matchobjects: + s3 = s1[pos:mo.start()] + s2 += quote_xml_aux(s3) + s2 += s1[mo.start():mo.end()] + pos = mo.end() + s3 = s1[pos:] + s2 += quote_xml_aux(s3) + return s2 + + +def quote_xml_aux(inStr): + s1 = inStr.replace('&', '&') + s1 = s1.replace('<', '<') + s1 = s1.replace('>', '>') + return s1 + + +def quote_attrib(inStr): + s1 = (isinstance(inStr, BaseStrType_) and inStr or '%s' % inStr) + s1 = s1.replace('&', '&') + s1 = s1.replace('<', '<') + s1 = s1.replace('>', '>') + if '"' in s1: + if "'" in s1: + s1 = '"%s"' % s1.replace('"', """) + else: + s1 = "'%s'" % s1 + else: + s1 = '"%s"' % s1 + return s1 + + +def quote_python(inStr): + s1 = inStr + if s1.find("'") == -1: + if s1.find('\n') == -1: + return "'%s'" % s1 + else: + return "'''%s'''" % s1 + else: + if s1.find('"') != -1: + s1 = s1.replace('"', '\\"') + if s1.find('\n') == -1: + return '"%s"' % s1 + else: + return '"""%s"""' % s1 + + +def get_all_text_(node): + if node.text is not None: + text = node.text + else: + text = '' + for child in node: + if child.tail is not None: + text += child.tail + return text + + +def find_attr_value_(attr_name, node): + attrs = node.attrib + attr_parts = attr_name.split(':') + value = None + if len(attr_parts) == 1: + value = attrs.get(attr_name) + elif len(attr_parts) == 2: + prefix, name = attr_parts + namespace = node.nsmap.get(prefix) + if namespace is not None: + value = attrs.get('{%s}%s' % (namespace, name, )) + return value + + +class GDSParseError(Exception): + pass + + +def raise_parse_error(node, msg): + msg = '%s (element %s/line %d)' % (msg, node.tag, node.sourceline, ) + raise GDSParseError(msg) + + +class MixedContainer: + # Constants for category: + CategoryNone = 0 + CategoryText = 1 + CategorySimple = 2 + CategoryComplex = 3 + # Constants for content_type: + TypeNone = 0 + TypeText = 1 + TypeString = 2 + TypeInteger = 3 + TypeFloat = 4 + TypeDecimal = 5 + TypeDouble = 6 + TypeBoolean = 7 + TypeBase64 = 8 + def __init__(self, category, content_type, name, value): + self.category = category + self.content_type = content_type + self.name = name + self.value = value + def getCategory(self): + return self.category + def getContenttype(self, content_type): + return self.content_type + def getValue(self): + return self.value + def getName(self): + return self.name +## def export(self, outfile, level, name, namespace, +## pretty_print=True): +## if self.category == MixedContainer.CategoryText: +## # Prevent exporting empty content as empty lines. +## if self.value.strip(): +## outfile.write(self.value) +## elif self.category == MixedContainer.CategorySimple: +## self.exportSimple(outfile, level, name) +## else: # category == MixedContainer.CategoryComplex +## self.value.export( +## outfile, level, namespace, name, +## pretty_print=pretty_print) +## def exportSimple(self, outfile, level, name): +## if self.content_type == MixedContainer.TypeString: +## outfile.write('<%s>%s</%s>' % ( +## self.name, self.value, self.name)) +## elif self.content_type == MixedContainer.TypeInteger or \ +## self.content_type == MixedContainer.TypeBoolean: +## outfile.write('<%s>%d</%s>' % ( +## self.name, self.value, self.name)) +## elif self.content_type == MixedContainer.TypeFloat or \ +## self.content_type == MixedContainer.TypeDecimal: +## outfile.write('<%s>%f</%s>' % ( +## self.name, self.value, self.name)) +## elif self.content_type == MixedContainer.TypeDouble: +## outfile.write('<%s>%g</%s>' % ( +## self.name, self.value, self.name)) +## elif self.content_type == MixedContainer.TypeBase64: +## outfile.write('<%s>%s</%s>' % ( +## self.name, +## base64.b64encode(self.value), +## self.name)) +## def to_etree(self, element): +## if self.category == MixedContainer.CategoryText: +## # Prevent exporting empty content as empty lines. +## if self.value.strip(): +## if len(element) > 0: +## if element[-1].tail is None: +## element[-1].tail = self.value +## else: +## element[-1].tail += self.value +## else: +## if element.text is None: +## element.text = self.value +## else: +## element.text += self.value +## elif self.category == MixedContainer.CategorySimple: +## subelement = etree_.SubElement( +## element, '%s' % self.name) +## subelement.text = self.to_etree_simple() +## else: # category == MixedContainer.CategoryComplex +## self.value.to_etree(element) +## def to_etree_simple(self): +## if self.content_type == MixedContainer.TypeString: +## text = self.value +## elif (self.content_type == MixedContainer.TypeInteger or +## self.content_type == MixedContainer.TypeBoolean): +## text = '%d' % self.value +## elif (self.content_type == MixedContainer.TypeFloat or +## self.content_type == MixedContainer.TypeDecimal): +## text = '%f' % self.value +## elif self.content_type == MixedContainer.TypeDouble: +## text = '%g' % self.value +## elif self.content_type == MixedContainer.TypeBase64: +## text = '%s' % base64.b64encode(self.value) +## return text +## def exportLiteral(self, outfile, level, name): +## if self.category == MixedContainer.CategoryText: +## showIndent(outfile, level) +## outfile.write( +## 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( +## self.category, self.content_type, +## self.name, self.value)) +## elif self.category == MixedContainer.CategorySimple: +## showIndent(outfile, level) +## outfile.write( +## 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( +## self.category, self.content_type, +## self.name, self.value)) +## else: # category == MixedContainer.CategoryComplex +## showIndent(outfile, level) +## outfile.write( +## 'model_.MixedContainer(%d, %d, "%s",\n' % ( +## self.category, self.content_type, self.name,)) +## self.value.exportLiteral(outfile, level + 1) +## showIndent(outfile, level) +## outfile.write(')\n') + + +class MemberSpec_(object): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): + self.name = name + self.data_type = data_type + self.container = container + self.child_attrs = child_attrs + self.choice = choice + self.optional = optional + def set_name(self, name): self.name = name + def get_name(self): return self.name + def set_data_type(self, data_type): self.data_type = data_type + def get_data_type_chain(self): return self.data_type + def get_data_type(self): + if isinstance(self.data_type, list): + if len(self.data_type) > 0: + return self.data_type[-1] + else: + return 'xs:string' + else: + return self.data_type + def set_container(self, container): self.container = container + def get_container(self): return self.container + def set_child_attrs(self, child_attrs): self.child_attrs = child_attrs + def get_child_attrs(self): return self.child_attrs + def set_choice(self, choice): self.choice = choice + def get_choice(self): return self.choice + def set_optional(self, optional): self.optional = optional + def get_optional(self): return self.optional + + +def _cast(typ, value): + if typ is None or value is None: + return value + return typ(value) + +# +# Data representation classes. +# + + +class PackageType(GeneratedsSuper): + member_data_items_ = [ + MemberSpec_('Address', 'xs:string', 1, 1, {u'maxOccurs': u'unbounded', u'type': u'xs:string', u'name': u'Address', u'minOccurs': u'0'}, None), + ] + subclass = None + superclass = None + def __init__(self, Address=None): + self.original_tagname_ = None + if Address is None: + self.Address = [] + else: + self.Address = Address + def factory(*args_, **kwargs_): + if CurrentSubclassModule_ is not None: + subclass = getSubclassFromModule_( + CurrentSubclassModule_, PackageType) + if subclass is not None: + return subclass(*args_, **kwargs_) + if PackageType.subclass: + return PackageType.subclass(*args_, **kwargs_) + else: + return PackageType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_Address(self): return self.Address + def set_Address(self, Address): self.Address = Address + def add_Address(self, value): self.Address.append(value) + def insert_Address_at(self, index, value): self.Address.insert(index, value) + def replace_Address_at(self, index, value): self.Address[index] = value + def hasContent_(self): + if ( + self.Address + ): + return True + else: + return False +# end class PackageType + + +GDSClassesMapping = { + 'Package': PackageType, +} + + + +__all__ = [ + "PackageType" +] diff --git a/tests/extensions1_sup.py b/tests/extensions1_sup.py index bd04c017c41398e7d1e0ac68695fba75c38eeefa..dd9b80a8b2837a42ee3fb42cc8b8d1ca25d8b7ba 100644 --- a/tests/extensions1_sup.py +++ b/tests/extensions1_sup.py @@ -579,7 +579,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -588,7 +589,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -606,7 +608,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -622,7 +626,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -645,12 +650,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -662,7 +669,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/ipo1_sup.py b/tests/ipo1_sup.py index 8757c5db02f98ce80644365886b20896077dbccc..9828532c65ed2a7497a51a0b3865b0d241fad994 100644 --- a/tests/ipo1_sup.py +++ b/tests/ipo1_sup.py @@ -578,7 +578,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -587,7 +588,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -605,7 +607,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -621,7 +625,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -644,12 +649,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -661,7 +668,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/ipo2_sup.py b/tests/ipo2_sup.py index 8757c5db02f98ce80644365886b20896077dbccc..9828532c65ed2a7497a51a0b3865b0d241fad994 100644 --- a/tests/ipo2_sup.py +++ b/tests/ipo2_sup.py @@ -578,7 +578,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -587,7 +588,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -605,7 +607,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -621,7 +625,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -644,12 +649,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -661,7 +668,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/mapcleanname1_sup.py b/tests/mapcleanname1_sup.py index 997f1105a17fe70894526e874dde821d54dd9cbd..b93a409b66d143ab3f75aa3c0220954a359ff467 100644 --- a/tests/mapcleanname1_sup.py +++ b/tests/mapcleanname1_sup.py @@ -579,7 +579,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -588,7 +589,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -606,7 +608,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -622,7 +626,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -645,12 +650,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -662,7 +669,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/nested_def1_sup.py b/tests/nested_def1_sup.py index c5da762d24eb5653f13a2e0a9df0f2e4f432f3db..0032b18ee3c07f0905c47188e2d3382716655cb5 100644 --- a/tests/nested_def1_sup.py +++ b/tests/nested_def1_sup.py @@ -578,7 +578,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -587,7 +588,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -605,7 +607,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -621,7 +625,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -644,12 +649,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -661,7 +668,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/out1_sup.py b/tests/out1_sup.py index 159a3fef3f4b7e7a6251831e965a0018c97be5ff..26c019085563e7ca684e583f5906697ee3277eda 100644 --- a/tests/out1_sup.py +++ b/tests/out1_sup.py @@ -579,7 +579,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -588,7 +589,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -606,7 +608,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -622,7 +626,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -645,12 +650,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -662,7 +669,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/people_procincl1_sup.py b/tests/people_procincl1_sup.py index c36f6cbf7ac6ad4ff20030208462757ded4f54d5..9689e83b6bbe9533bbd9711f07976a9b180a594b 100644 --- a/tests/people_procincl1_sup.py +++ b/tests/people_procincl1_sup.py @@ -579,7 +579,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -588,7 +589,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -606,7 +608,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -622,7 +626,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -645,12 +650,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -662,7 +669,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/prefix_classname1_sup.py b/tests/prefix_classname1_sup.py index 17b686e19dfcf0f964c95906376583b74afc801b..e4db412cb75eb6a9f99e537b0d038ce9ef1b51a8 100644 --- a/tests/prefix_classname1_sup.py +++ b/tests/prefix_classname1_sup.py @@ -579,7 +579,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -588,7 +589,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -606,7 +608,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -622,7 +626,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -645,12 +650,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -662,7 +669,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/recursive_simpletype1_sup.py b/tests/recursive_simpletype1_sup.py index ab4dea2c9da5460c1f634b8c3a5292556c2e79ba..45de91df6e20254be62ef7cb5849fb030e17e6ed 100644 --- a/tests/recursive_simpletype1_sup.py +++ b/tests/recursive_simpletype1_sup.py @@ -579,7 +579,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -588,7 +589,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -606,7 +608,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -622,7 +626,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -645,12 +650,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -662,7 +669,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/reference_simpletype1_sup.py b/tests/reference_simpletype1_sup.py index 103b10ec06bd6764e920fc69b53728547831ec48..cc8178a4954cd7f6fce23008164067428d7c0fa0 100644 --- a/tests/reference_simpletype1_sup.py +++ b/tests/reference_simpletype1_sup.py @@ -579,7 +579,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -588,7 +589,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -606,7 +608,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -622,7 +626,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -645,12 +650,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -662,7 +669,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/rem_dup_elems1_sup.py b/tests/rem_dup_elems1_sup.py index c2771cb45d477124e50d667f21a2784fa6e164c3..c21b87f8fd10c384c05bb18ac7db54294e85a16a 100644 --- a/tests/rem_dup_elems1_sup.py +++ b/tests/rem_dup_elems1_sup.py @@ -580,7 +580,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -589,7 +590,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -607,7 +609,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -623,7 +627,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -646,12 +651,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -663,7 +670,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/simplecontent_restriction1_sup.py b/tests/simplecontent_restriction1_sup.py index 7ebc8e9ec0ea182d736886c9fe6dea6f7e25f71d..ae5f74a8ec9f348e26ce466018bef80e60f9dc01 100644 --- a/tests/simplecontent_restriction1_sup.py +++ b/tests/simplecontent_restriction1_sup.py @@ -579,7 +579,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -588,7 +589,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -606,7 +608,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -622,7 +626,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -645,12 +650,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -662,7 +669,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/simpletype_memberspecs1_sup.py b/tests/simpletype_memberspecs1_sup.py index fc90e22721f5d1522735b631d2b5ffacb35a6f5e..ec34c2ab8e81d22cdf8fd2be544b31b5370ec557 100644 --- a/tests/simpletype_memberspecs1_sup.py +++ b/tests/simpletype_memberspecs1_sup.py @@ -579,7 +579,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -588,7 +589,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -606,7 +608,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -622,7 +626,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -645,12 +650,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -662,7 +669,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/simpletypes_other1_sup.py b/tests/simpletypes_other1_sup.py index ab855a6b7c2cb86117ee7e41f90f2b629c006600..1c58d5c7f7db21882802da83ad2b682cacac70d2 100644 --- a/tests/simpletypes_other1_sup.py +++ b/tests/simpletypes_other1_sup.py @@ -579,7 +579,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -588,7 +589,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -606,7 +608,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -622,7 +626,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -645,12 +650,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -662,7 +669,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/test.py b/tests/test.py old mode 100644 new mode 100755 index dea1aea507dd7513ca0795bbe727eee59db07af5..5a93f7795eca0bb76f35462e8956cdde7c229607 --- a/tests/test.py +++ b/tests/test.py @@ -823,6 +823,29 @@ class GenTest(unittest.TestCase): self.remove('{}2_sub.py'.format(t_)) self.remove('{}2_out.xml'.format(t_)) + def test_033_disable_xml_super(self): + cmdTempl = ( + 'python generateDS.py --no-dates --no-versions ' + '--disable-xml --disable-generatedssuper-lookup ' + '--member-specs=list -f -a "xsd:" ' + '-o tests/%s2_sup.py -s tests/%s2_sub.py ' + '--super=%s2_sup --no-warnings ' + 'tests/%s.xsd' + ) + t_ = 'disable_xml_super' + cmd = cmdTempl % (t_, t_, t_, t_, ) + self.executeClean(cmd, cwd='..') + self.compareFiles( + '{}1_sup.py'.format(t_), + '{}2_sup.py'.format(t_), + ('sys.stdout.write',)) + self.compareFiles('{}1_sub.py'.format(t_), '{}2_sub.py'.format(t_)) + # Need to preserve generated files for next command, cleanup at end + # cleanup generated files + #self.remove('{}2_sup.py'.format(t_)) + #self.remove('{}2_sub.py'.format(t_)) + #self.remove('{}2_out.xml'.format(t_)) + def compareFiles(self, left, right, ignore=None): with open(left) as left_file: with open(right) as right_file: diff --git a/tests/to_etree1_sup.py b/tests/to_etree1_sup.py index f3308697863bec79c729afeba0ce109843e67faf..09ba4c360dc14d4dae2ecfb176c5bfc8590bc89f 100644 --- a/tests/to_etree1_sup.py +++ b/tests/to_etree1_sup.py @@ -581,7 +581,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -590,7 +591,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -608,7 +610,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -624,7 +628,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -647,12 +652,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -664,7 +671,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/validate_simpletypes1_sup.py b/tests/validate_simpletypes1_sup.py index 84a01e9793248858eb715dc214ee7656292fad05..03af44f4d19e30dc2aa054209132237796a83164 100644 --- a/tests/validate_simpletypes1_sup.py +++ b/tests/validate_simpletypes1_sup.py @@ -578,7 +578,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -587,7 +588,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -605,7 +607,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -621,7 +625,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -644,12 +649,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -661,7 +668,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tests/validate_simpletypes1_warnings.txt b/tests/validate_simpletypes1_warnings.txt index 913f3756a0e112bfabefffd6c2180022f44e8ad1..c166f0e92e2c4fed2dde1ad39a1e0d89993e39ac 100644 --- a/tests/validate_simpletypes1_warnings.txt +++ b/tests/validate_simpletypes1_warnings.txt @@ -1,60 +1,60 @@ -tests/validate_simpletypes2_sup.py:1034: UserWarning: Value "2" does not match xsd minExclusive restriction on integer_range_1_st +tests/validate_simpletypes2_sup.py:1042: UserWarning: Value "2" does not match xsd minExclusive restriction on integer_range_1_st warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on integer_range_1_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1044: UserWarning: Value "mmaaa1234mnopzzz" does not match xsd pattern restrictions: [['^aaa.*zzz$', '^bbb.*xxx$'], ['^.*123.*$', '^.*456.*$']] +tests/validate_simpletypes2_sup.py:1052: UserWarning: Value "mmaaa1234mnopzzz" does not match xsd pattern restrictions: [['^aaa.*zzz$', '^bbb.*xxx$'], ['^.*123.*$', '^.*456.*$']] warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_pattern_st_patterns_, )) -tests/validate_simpletypes2_sup.py:1057: UserWarning: Value "floatxx" does not match xsd enumeration restriction on token_enum_st +tests/validate_simpletypes2_sup.py:1065: UserWarning: Value "floatxx" does not match xsd enumeration restriction on token_enum_st warnings_.warn('Value "%(value)s" does not match xsd enumeration restriction on token_enum_st' % {"value" : value.encode("utf-8")} ) -tests/validate_simpletypes2_sup.py:1064: UserWarning: Value "22" does not match xsd maxInclusive restriction on integer_range_incl_st +tests/validate_simpletypes2_sup.py:1072: UserWarning: Value "22" does not match xsd maxInclusive restriction on integer_range_incl_st warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on integer_range_incl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1069: UserWarning: Value "-40" does not match xsd minExclusive restriction on integer_range_excl_st +tests/validate_simpletypes2_sup.py:1077: UserWarning: Value "-40" does not match xsd minExclusive restriction on integer_range_excl_st warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on integer_range_excl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1078: UserWarning: Value "mno pqr" does not match xsd minLength restriction on min_max_length_st +tests/validate_simpletypes2_sup.py:1086: UserWarning: Value "mno pqr" does not match xsd minLength restriction on min_max_length_st warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on min_max_length_st' % {"value" : value.encode("utf-8")} ) -tests/validate_simpletypes2_sup.py:1083: UserWarning: Value "012345" does not match xsd length restriction on length_st +tests/validate_simpletypes2_sup.py:1091: UserWarning: Value "012345" does not match xsd length restriction on length_st warnings_.warn('Value "%(value)s" does not match xsd length restriction on length_st' % {"value" : value.encode("utf-8")} ) -tests/validate_simpletypes2_sup.py:1160: UserWarning: Value "0.2" does not match xsd minInclusive restriction on anonymous_float_valueType +tests/validate_simpletypes2_sup.py:1168: UserWarning: Value "0.2" does not match xsd minInclusive restriction on anonymous_float_valueType warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on anonymous_float_valueType' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1154: UserWarning: Value "efgh" does not match xsd pattern restrictions: [['^abcd$|^ef\\|gh$']] +tests/validate_simpletypes2_sup.py:1162: UserWarning: Value "efgh" does not match xsd pattern restrictions: [['^abcd$|^ef\\|gh$']] warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_vbar_pattern_st_patterns_, )) -tests/validate_simpletypes2_sup.py:1036: UserWarning: Value "9" does not match xsd maxExclusive restriction on integer_range_1_st +tests/validate_simpletypes2_sup.py:1044: UserWarning: Value "9" does not match xsd maxExclusive restriction on integer_range_1_st warnings_.warn('Value "%(value)s" does not match xsd maxExclusive restriction on integer_range_1_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1044: UserWarning: Value "aaa1234mnopzzzbcd" does not match xsd pattern restrictions: [['^aaa.*zzz$', '^bbb.*xxx$'], ['^.*123.*$', '^.*456.*$']] +tests/validate_simpletypes2_sup.py:1052: UserWarning: Value "aaa1234mnopzzzbcd" does not match xsd pattern restrictions: [['^aaa.*zzz$', '^bbb.*xxx$'], ['^.*123.*$', '^.*456.*$']] warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_pattern_st_patterns_, )) -tests/validate_simpletypes2_sup.py:1062: UserWarning: Value "-50" does not match xsd minInclusive restriction on integer_range_incl_st +tests/validate_simpletypes2_sup.py:1070: UserWarning: Value "-50" does not match xsd minInclusive restriction on integer_range_incl_st warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on integer_range_incl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1076: UserWarning: Value "asdf asdf asdf asdf asdf asdf" does not match xsd maxLength restriction on min_max_length_st +tests/validate_simpletypes2_sup.py:1084: UserWarning: Value "asdf asdf asdf asdf asdf asdf" does not match xsd maxLength restriction on min_max_length_st warnings_.warn('Value "%(value)s" does not match xsd maxLength restriction on min_max_length_st' % {"value" : value.encode("utf-8")} ) -tests/validate_simpletypes2_sup.py:1083: UserWarning: Value "01234567890" does not match xsd length restriction on length_st +tests/validate_simpletypes2_sup.py:1091: UserWarning: Value "01234567890" does not match xsd length restriction on length_st warnings_.warn('Value "%(value)s" does not match xsd length restriction on length_st' % {"value" : value.encode("utf-8")} ) -tests/validate_simpletypes2_sup.py:1093: UserWarning: Value "2015-05-01" does not match xsd minInclusive restriction on date_minincl_st +tests/validate_simpletypes2_sup.py:1101: UserWarning: Value "2015-05-01" does not match xsd minInclusive restriction on date_minincl_st warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on date_minincl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1098: UserWarning: Value "2015-11-01" does not match xsd maxInclusive restriction on date_maxincl_st +tests/validate_simpletypes2_sup.py:1106: UserWarning: Value "2015-11-01" does not match xsd maxInclusive restriction on date_maxincl_st warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on date_maxincl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1103: UserWarning: Value "2015-05-01" does not match xsd minExclusive restriction on date_minexcl_st +tests/validate_simpletypes2_sup.py:1111: UserWarning: Value "2015-05-01" does not match xsd minExclusive restriction on date_minexcl_st warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on date_minexcl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1108: UserWarning: Value "2015-11-01" does not match xsd maxExclusive restriction on date_maxexcl_st +tests/validate_simpletypes2_sup.py:1116: UserWarning: Value "2015-11-01" does not match xsd maxExclusive restriction on date_maxexcl_st warnings_.warn('Value "%(value)s" does not match xsd maxExclusive restriction on date_maxexcl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1113: UserWarning: Value "13:30:00" does not match xsd minInclusive restriction on time_minincl_st +tests/validate_simpletypes2_sup.py:1121: UserWarning: Value "13:30:00" does not match xsd minInclusive restriction on time_minincl_st warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on time_minincl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1118: UserWarning: Value "17:00:00" does not match xsd maxInclusive restriction on time_maxincl_st +tests/validate_simpletypes2_sup.py:1126: UserWarning: Value "17:00:00" does not match xsd maxInclusive restriction on time_maxincl_st warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on time_maxincl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1123: UserWarning: Value "13:30:00" does not match xsd minExclusive restriction on time_minexcl_st +tests/validate_simpletypes2_sup.py:1131: UserWarning: Value "13:30:00" does not match xsd minExclusive restriction on time_minexcl_st warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on time_minexcl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1128: UserWarning: Value "17:00:00" does not match xsd maxExclusive restriction on time_maxexcl_st +tests/validate_simpletypes2_sup.py:1136: UserWarning: Value "17:00:00" does not match xsd maxExclusive restriction on time_maxexcl_st warnings_.warn('Value "%(value)s" does not match xsd maxExclusive restriction on time_maxexcl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1133: UserWarning: Value "2015-06-01 13:20:10" does not match xsd minInclusive restriction on datetime_minincl_st +tests/validate_simpletypes2_sup.py:1141: UserWarning: Value "2015-06-01 13:20:10" does not match xsd minInclusive restriction on datetime_minincl_st warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on datetime_minincl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1138: UserWarning: Value "2015-11-01 14:20:10" does not match xsd maxInclusive restriction on datetime_maxincl_st +tests/validate_simpletypes2_sup.py:1146: UserWarning: Value "2015-11-01 14:20:10" does not match xsd maxInclusive restriction on datetime_maxincl_st warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on datetime_maxincl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1143: UserWarning: Value "2015-06-01 13:20:10" does not match xsd minExclusive restriction on datetime_minexcl_st +tests/validate_simpletypes2_sup.py:1151: UserWarning: Value "2015-06-01 13:20:10" does not match xsd minExclusive restriction on datetime_minexcl_st warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on datetime_minexcl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1148: UserWarning: Value "2015-11-01 14:20:10" does not match xsd maxExclusive restriction on datetime_maxexcl_st +tests/validate_simpletypes2_sup.py:1156: UserWarning: Value "2015-11-01 14:20:10" does not match xsd maxExclusive restriction on datetime_maxexcl_st warnings_.warn('Value "%(value)s" does not match xsd maxExclusive restriction on datetime_maxexcl_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1162: UserWarning: Value "6.6" does not match xsd maxInclusive restriction on anonymous_float_valueType +tests/validate_simpletypes2_sup.py:1170: UserWarning: Value "6.6" does not match xsd maxInclusive restriction on anonymous_float_valueType warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on anonymous_float_valueType' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1041: UserWarning: Value "aaa12zzz" does not match xsd minLength restriction on pattern_st +tests/validate_simpletypes2_sup.py:1049: UserWarning: Value "aaa12zzz" does not match xsd minLength restriction on pattern_st warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on pattern_st' % {"value" : value} ) -tests/validate_simpletypes2_sup.py:1044: UserWarning: Value "aaa12zzz" does not match xsd pattern restrictions: [['^aaa.*zzz$', '^bbb.*xxx$'], ['^.*123.*$', '^.*456.*$']] +tests/validate_simpletypes2_sup.py:1052: UserWarning: Value "aaa12zzz" does not match xsd pattern restrictions: [['^aaa.*zzz$', '^bbb.*xxx$'], ['^.*123.*$', '^.*456.*$']] warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_pattern_st_patterns_, )) -tests/validate_simpletypes2_sup.py:1580: UserWarning: Value "pqrst" does not match xsd minLength restriction on simpleTwoElementTwoType +tests/validate_simpletypes2_sup.py:1588: UserWarning: Value "pqrst" does not match xsd minLength restriction on simpleTwoElementTwoType warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on simpleTwoElementTwoType' % {"value" : value.encode("utf-8")} ) diff --git a/tests/validate_simpletypes2_sup.py b/tests/validate_simpletypes2_sup.py index 84a01e9793248858eb715dc214ee7656292fad05..03af44f4d19e30dc2aa054209132237796a83164 100644 --- a/tests/validate_simpletypes2_sup.py +++ b/tests/validate_simpletypes2_sup.py @@ -578,7 +578,8 @@ class MixedContainer: return self.value def getName(self): return self.name - def export(self, outfile, level, name, namespace, pretty_print=True): + def export(self, outfile, level, name, namespace, + pretty_print=True): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. if self.value.strip(): @@ -587,7 +588,8 @@ class MixedContainer: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex self.value.export( - outfile, level, namespace, name, pretty_print=pretty_print) + outfile, level, namespace, name, + pretty_print=pretty_print) def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % ( @@ -605,7 +607,9 @@ class MixedContainer: self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeBase64: outfile.write('<%s>%s</%s>' % ( - self.name, base64.b64encode(self.value), self.name)) + self.name, + base64.b64encode(self.value), + self.name)) def to_etree(self, element): if self.category == MixedContainer.CategoryText: # Prevent exporting empty content as empty lines. @@ -621,7 +625,8 @@ class MixedContainer: else: element.text += self.value elif self.category == MixedContainer.CategorySimple: - subelement = etree_.SubElement(element, '%s' % self.name) + subelement = etree_.SubElement( + element, '%s' % self.name) subelement.text = self.to_etree_simple() else: # category == MixedContainer.CategoryComplex self.value.to_etree(element) @@ -644,12 +649,14 @@ class MixedContainer: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) outfile.write( 'model_.MixedContainer(%d, %d, "%s", "%s"),\n' % ( - self.category, self.content_type, self.name, self.value)) + self.category, self.content_type, + self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) outfile.write( @@ -661,7 +668,8 @@ class MixedContainer: class MemberSpec_(object): - def __init__(self, name='', data_type='', container=0, optional=0, child_attrs=None, choice=None): + def __init__(self, name='', data_type='', container=0, + optional=0, child_attrs=None, choice=None): self.name = name self.data_type = data_type self.container = container diff --git a/tutorial/generateds_tutorial.html b/tutorial/generateds_tutorial.html index 01aaa3dfba7a79a90867d46e5afc70396a2c29b2..648e52e28ae33d9fe30503e557ee5fb0be24e4cd 100644 --- a/tutorial/generateds_tutorial.html +++ b/tutorial/generateds_tutorial.html @@ -3,7 +3,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<meta name="generator" content="Docutils 0.13.2a: http://docutils.sourceforge.net/" /> +<meta name="generator" content="Docutils 0.13.1: http://docutils.sourceforge.net/" /> <title>generateDS -- Introduction and Tutorial</title> <meta name="author" content="Dave Kuhlman" /> <style type="text/css"> @@ -219,7 +219,7 @@ They are used by updateversion.py. --> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.27a</td> +<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.28a</td> </tr> </tbody> </table> @@ -228,7 +228,7 @@ They are used by updateversion.py. --> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">date:</th><td class="field-body">June 01, 2017</td> +<tr class="field"><th class="field-name">date:</th><td class="field-body">June 23, 2017</td> </tr> </tbody> </table> @@ -1210,7 +1210,7 @@ named <tt class="docutils literal">garden_api.py</tt>, you can create an instanc <div class="footer"> <hr class="footer" /> <a class="reference external" href="generateds_tutorial.txt">View document source</a>. -Generated on: 2017-06-01 16:04 UTC. +Generated on: 2017-06-23 23:12 UTC. Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source. </div> diff --git a/tutorial/generateds_tutorial.txt b/tutorial/generateds_tutorial.txt index 7bab582e533e01283dd44da712a20217daac1325..69e9efde971c0816e4f72cd9f6e750ddd61d647b 100644 --- a/tutorial/generateds_tutorial.txt +++ b/tutorial/generateds_tutorial.txt @@ -11,7 +11,7 @@ generateDS -- Introduction and Tutorial .. version -:revision: 2.27a +:revision: 2.28a .. version diff --git a/tutorial/generateds_tutorial.zip b/tutorial/generateds_tutorial.zip index 1b2323353b8fcd5873483ee1ad4054286c6aef18..f103919d46c6d0eb3cb7128d9d41e5a87326d436 100644 Binary files a/tutorial/generateds_tutorial.zip and b/tutorial/generateds_tutorial.zip differ diff --git a/updateversion.py b/updateversion.py old mode 100644 new mode 100755