author | Edouard Tisserant <edouard.tisserant@gmail.com> |
Mon, 31 May 2021 16:06:00 +0200 | |
branch | svghmi |
changeset 3250 | 22da8e0b07b8 |
parent 2457 | 9deec258ab1a |
child 3750 | f62625418bff |
permissions | -rw-r--r-- |
814 | 1 |
#!/usr/bin/env python |
2 |
# -*- coding: utf-8 -*- |
|
3 |
||
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1375
diff
changeset
|
4 |
# This file is part of Beremiz, a Integrated Development Environment for |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1375
diff
changeset
|
5 |
# programming IEC 61131-3 automates supporting plcopen standard and CanFestival. |
814 | 6 |
# |
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1375
diff
changeset
|
7 |
# Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD |
814 | 8 |
# |
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1375
diff
changeset
|
9 |
# See COPYING file for copyrights details. |
814 | 10 |
# |
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1375
diff
changeset
|
11 |
# This program is free software; you can redistribute it and/or |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1375
diff
changeset
|
12 |
# modify it under the terms of the GNU General Public License |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1375
diff
changeset
|
13 |
# as published by the Free Software Foundation; either version 2 |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1375
diff
changeset
|
14 |
# of the License, or (at your option) any later version. |
814 | 15 |
# |
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1375
diff
changeset
|
16 |
# This program is distributed in the hope that it will be useful, |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1375
diff
changeset
|
17 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1375
diff
changeset
|
18 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1375
diff
changeset
|
19 |
# GNU General Public License for more details. |
814 | 20 |
# |
1571
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1375
diff
changeset
|
21 |
# You should have received a copy of the GNU General Public License |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1375
diff
changeset
|
22 |
# along with this program; if not, write to the Free Software |
486f94a8032c
fix license notices in source files and license files under GPLv2+
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1375
diff
changeset
|
23 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
814 | 24 |
|
1826
91796f408540
fix usage of python2-only print statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1782
diff
changeset
|
25 |
|
1853
47a3f39bead0
fix pylint warning "(relative-import) Relative import 'Y', should be 'X.Y'"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1852
diff
changeset
|
26 |
from __future__ import absolute_import |
1826
91796f408540
fix usage of python2-only print statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1782
diff
changeset
|
27 |
from __future__ import print_function |
1732
94ffe74e6895
clean-up: fix PEP8 E401 multiple imports on one line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1730
diff
changeset
|
28 |
import os |
94ffe74e6895
clean-up: fix PEP8 E401 multiple imports on one line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1730
diff
changeset
|
29 |
import re |
814 | 30 |
import datetime |
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
31 |
from types import FunctionType |
814 | 32 |
from xml.dom import minidom |
2457
9deec258ab1a
python3 support: pylint, W1633 # (round-builtin) round built-in referenced
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2450
diff
changeset
|
33 |
from future.builtins import round |
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
34 |
from six import string_types |
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
35 |
from past.builtins import long |
814 | 36 |
|
1853
47a3f39bead0
fix pylint warning "(relative-import) Relative import 'Y', should be 'X.Y'"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1852
diff
changeset
|
37 |
from xmlclass.xmlclass import * |
814 | 38 |
|
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
39 |
|
814 | 40 |
def GenerateDictFacets(facets): |
41 |
return dict([(name, (None, False)) for name in facets]) |
|
42 |
||
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
43 |
|
814 | 44 |
def GenerateSimpleTypeXMLText(function): |
45 |
def generateXMLTextMethod(value, name=None, indent=0): |
|
46 |
text = "" |
|
47 |
if name is not None: |
|
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
48 |
ind1, _ind2 = getIndent(indent, name) |
814 | 49 |
text += ind1 + "<%s>" % name |
50 |
text += function(value) |
|
51 |
if name is not None: |
|
52 |
text += "</%s>\n" % name |
|
53 |
return text |
|
54 |
return generateXMLTextMethod |
|
55 |
||
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
56 |
|
1852
70c1cc354a8f
fix pylint warning '(dangerous-default-value) Dangerous default value {} as argument'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1849
diff
changeset
|
57 |
def GenerateFloatXMLText(extra_values=None, decimal=None): |
1374
1eefc427419f
Fixed bug with decimal value string formatting
Laurent Bessard
parents:
1373
diff
changeset
|
58 |
float_format = (lambda x: "{:.{width}f}".format(x, width=decimal).rstrip('0') |
1eefc427419f
Fixed bug with decimal value string formatting
Laurent Bessard
parents:
1373
diff
changeset
|
59 |
if decimal is not None else str) |
1852
70c1cc354a8f
fix pylint warning '(dangerous-default-value) Dangerous default value {} as argument'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1849
diff
changeset
|
60 |
extra_values = [] if extra_values is None else extra_values |
1750
acf02488f37f
clean-up: fix PEP8 E306 expected 1 blank line before a nested definition, found X
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1749
diff
changeset
|
61 |
|
814 | 62 |
def generateXMLTextMethod(value, name=None, indent=0): |
63 |
text = "" |
|
64 |
if name is not None: |
|
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
65 |
ind1, _ind2 = getIndent(indent, name) |
814 | 66 |
text += ind1 + "<%s>" % name |
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
67 |
if isinstance(value, int): |
1375
dc94c71a2f25
Fixed bug with decimal value string formatting
Laurent Bessard
parents:
1374
diff
changeset
|
68 |
text += str(value) |
dc94c71a2f25
Fixed bug with decimal value string formatting
Laurent Bessard
parents:
1374
diff
changeset
|
69 |
elif value in extra_values or value % 1 != 0: |
1373
4278d5c1e414
Fixed bug when graphic element position and size and connection points are decimal
Laurent Bessard
parents:
1322
diff
changeset
|
70 |
text += float_format(value) |
814 | 71 |
else: |
1375
dc94c71a2f25
Fixed bug with decimal value string formatting
Laurent Bessard
parents:
1374
diff
changeset
|
72 |
text += "{:.0f}".format(value) |
814 | 73 |
if name is not None: |
74 |
text += "</%s>\n" % name |
|
75 |
return text |
|
76 |
return generateXMLTextMethod |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
77 |
|
1749
d73b64672238
clean-up: fix PEP8 E305 expected 2 blank lines after class or function definition
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1744
diff
changeset
|
78 |
|
814 | 79 |
DEFAULT_FACETS = GenerateDictFacets(["pattern", "whiteSpace", "enumeration"]) |
80 |
NUMBER_FACETS = GenerateDictFacets(DEFAULT_FACETS.keys() + ["maxInclusive", "maxExclusive", "minInclusive", "minExclusive"]) |
|
81 |
DECIMAL_FACETS = GenerateDictFacets(NUMBER_FACETS.keys() + ["totalDigits", "fractionDigits"]) |
|
82 |
STRING_FACETS = GenerateDictFacets(DEFAULT_FACETS.keys() + ["length", "minLength", "maxLength"]) |
|
83 |
||
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
84 |
ALL_FACETS = ["pattern", "whiteSpace", "enumeration", "maxInclusive", |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
85 |
"maxExclusive", "minInclusive", "minExclusive", "totalDigits", |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
86 |
"fractionDigits", "length", "minLength", "maxLength"] |
814 | 87 |
|
88 |
||
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1780
diff
changeset
|
89 |
# ------------------------------------------------------------------------------- |
814 | 90 |
# Structure reducing functions |
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1780
diff
changeset
|
91 |
# ------------------------------------------------------------------------------- |
814 | 92 |
|
93 |
||
94 |
# Documentation elements |
|
95 |
||
96 |
def ReduceAppInfo(factory, attributes, elements): |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
97 |
return {"type": "appinfo", "source": attributes.get("source", None), |
814 | 98 |
"content": "\n".join(elements)} |
99 |
||
100 |
||
101 |
def ReduceDocumentation(factory, attributes, elements): |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
102 |
return {"type": "documentation", "source": attributes.get("source", None), |
814 | 103 |
"language": attributes.get("lang", "any"), "content": "\n".join(elements)} |
104 |
||
105 |
||
106 |
def ReduceAnnotation(factory, attributes, elements): |
|
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
107 |
_annotations, children = factory.ReduceElements(elements) |
814 | 108 |
annotation = {"type": "annotation", "appinfo": [], "documentation": {}} |
109 |
for child in children: |
|
110 |
if child["type"] == "appinfo": |
|
111 |
annotation["appinfo"].append((child["source"], child["content"])) |
|
112 |
elif child["type"] == "documentation": |
|
113 |
if child["source"] is not None: |
|
1734
750eeb7230a1
clean-up: fix some PEP8 E228 missing whitespace around modulo operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1732
diff
changeset
|
114 |
text = "(source: %(source)s):\n%(content)s\n\n" % child |
814 | 115 |
else: |
116 |
text = child["content"] + "\n\n" |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
117 |
if not child["language"] in annotation["documentation"]: |
814 | 118 |
annotation["documentation"] = text |
119 |
else: |
|
120 |
annotation["documentation"] += text |
|
121 |
return annotation |
|
122 |
||
123 |
# Simple type elements |
|
124 |
||
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
125 |
|
814 | 126 |
def GenerateFacetReducing(facetname, canbefixed): |
127 |
def ReduceFacet(factory, attributes, elements): |
|
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
128 |
annotations, _children = factory.ReduceElements(elements) |
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
129 |
if "value" in attributes: |
814 | 130 |
facet = {"type": facetname, "value": attributes["value"], "doc": annotations} |
131 |
if canbefixed: |
|
132 |
facet["fixed"] = attributes.get("fixed", False) |
|
133 |
return facet |
|
134 |
raise ValueError("A value must be defined for the \"%s\" facet!" % facetname) |
|
135 |
return ReduceFacet |
|
136 |
||
137 |
||
138 |
def ReduceList(factory, attributes, elements): |
|
139 |
annotations, children = factory.ReduceElements(elements) |
|
140 |
list = {"type": "list", "itemType": attributes.get("itemType", None), "doc": annotations} |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
141 |
|
814 | 142 |
if len(children) > 0 and children[0]["type"] == SIMPLETYPE: |
143 |
if list["itemType"] is None: |
|
144 |
list["itemType"] = children[0] |
|
145 |
else: |
|
146 |
raise ValueError("Only one base type can be defined for restriction!") |
|
147 |
if list["itemType"] is None: |
|
148 |
raise ValueError("No base type has been defined for list!") |
|
149 |
return list |
|
150 |
||
151 |
||
152 |
def ReduceUnion(factory, attributes, elements): |
|
153 |
annotations, children = factory.ReduceElements(elements) |
|
154 |
union = {"type": "union", "memberTypes": attributes.get("memberTypes", []), "doc": annotations} |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
155 |
|
814 | 156 |
for child in children: |
157 |
if child["type"] == SIMPLETYPE: |
|
1856
c2cba67145eb
fix error found by pylint 'W0104(pointless-statement) Statement seems to have no effect'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1853
diff
changeset
|
158 |
union["memberTypes"].append(child) |
814 | 159 |
if len(union["memberTypes"]) == 0: |
160 |
raise ValueError("No base type has been defined for union!") |
|
161 |
return union |
|
162 |
||
163 |
||
164 |
def CreateSimpleType(factory, attributes, typeinfos): |
|
165 |
# Initialize type informations |
|
166 |
facets = {} |
|
167 |
simpleType = {"type": SIMPLETYPE, "final": attributes.get("final", [])} |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
168 |
if "name" in attributes: |
814 | 169 |
simpleType["name"] = attributes["name"] |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
170 |
|
814 | 171 |
if typeinfos["type"] in ["restriction", "extension"]: |
172 |
# Search for base type definition |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
173 |
if isinstance(typeinfos["base"], string_types): |
814 | 174 |
basetypeinfos = factory.FindSchemaElement(typeinfos["base"], SIMPLETYPE) |
175 |
if basetypeinfos is None: |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
176 |
raise "\"%s\" isn't defined!" % typeinfos["base"] |
814 | 177 |
else: |
178 |
basetypeinfos = typeinfos["base"] |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
179 |
|
814 | 180 |
# Check that base type is a simple type |
181 |
if basetypeinfos["type"] != SIMPLETYPE: |
|
182 |
raise ValueError("Base type given isn't a simpleType!") |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
183 |
|
814 | 184 |
simpleType["basename"] = basetypeinfos["basename"] |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
185 |
|
814 | 186 |
# Check that derivation is allowed |
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
187 |
if "final" in basetypeinfos: |
814 | 188 |
if "#all" in basetypeinfos["final"]: |
189 |
raise ValueError("Base type can't be derivated!") |
|
190 |
if "restriction" in basetypeinfos["final"] and typeinfos["type"] == "restriction": |
|
191 |
raise ValueError("Base type can't be derivated by restriction!") |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
192 |
|
814 | 193 |
# Extract simple type facets |
194 |
for facet in typeinfos.get("facets", []): |
|
195 |
facettype = facet["type"] |
|
1775
b45f2768fab1
clean-up: fix PEP8 E713 test for membership should be 'not in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1774
diff
changeset
|
196 |
if facettype not in basetypeinfos["facets"]: |
814 | 197 |
raise ValueError("\"%s\" facet can't be defined for \"%s\" type!" % (facettype, type)) |
198 |
elif basetypeinfos["facets"][facettype][1]: |
|
199 |
raise ValueError("\"%s\" facet is fixed on base type!" % facettype) |
|
200 |
value = facet["value"] |
|
201 |
basevalue = basetypeinfos["facets"][facettype][0] |
|
202 |
if facettype in ["enumeration", "pattern"]: |
|
203 |
value = basetypeinfos["extract"](value, False) |
|
204 |
if len(facets) == 0: |
|
205 |
facets[facettype] = ([value], False) |
|
206 |
continue |
|
207 |
elif facets.keys() == [facettype]: |
|
208 |
facets[facettype][0].append(value) |
|
209 |
continue |
|
210 |
else: |
|
211 |
raise ValueError("\"%s\" facet can't be defined with another facet type!" % facettype) |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
212 |
elif "enumeration" in facets: |
814 | 213 |
raise ValueError("\"enumeration\" facet can't be defined with another facet type!") |
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
214 |
elif "pattern" in facets: |
814 | 215 |
raise ValueError("\"pattern\" facet can't be defined with another facet type!") |
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
216 |
elif facettype in facets: |
814 | 217 |
raise ValueError("\"%s\" facet can't be defined two times!" % facettype) |
218 |
elif facettype == "length": |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
219 |
if "minLength" in facets: |
814 | 220 |
raise ValueError("\"length\" and \"minLength\" facets can't be defined at the same time!") |
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
221 |
if "maxLength" in facets: |
814 | 222 |
raise ValueError("\"length\" and \"maxLength\" facets can't be defined at the same time!") |
223 |
try: |
|
224 |
value = int(value) |
|
1780
c52d1460cea8
clean-up: fix PEP8 E722 do not use bare except'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1776
diff
changeset
|
225 |
except Exception: |
814 | 226 |
raise ValueError("\"length\" must be an integer!") |
227 |
if value < 0: |
|
228 |
raise ValueError("\"length\" can't be negative!") |
|
229 |
elif basevalue is not None and basevalue != value: |
|
230 |
raise ValueError("\"length\" can't be different from \"length\" defined in base type!") |
|
231 |
elif facettype == "minLength": |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
232 |
if "length" in facets: |
814 | 233 |
raise ValueError("\"length\" and \"minLength\" facets can't be defined at the same time!") |
234 |
try: |
|
235 |
value = int(value) |
|
1780
c52d1460cea8
clean-up: fix PEP8 E722 do not use bare except'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1776
diff
changeset
|
236 |
except Exception: |
814 | 237 |
raise ValueError("\"minLength\" must be an integer!") |
238 |
if value < 0: |
|
239 |
raise ValueError("\"minLength\" can't be negative!") |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
240 |
elif "maxLength" in facets and value > facets["maxLength"]: |
814 | 241 |
raise ValueError("\"minLength\" must be lesser than or equal to \"maxLength\"!") |
242 |
elif basevalue is not None and basevalue < value: |
|
243 |
raise ValueError("\"minLength\" can't be lesser than \"minLength\" defined in base type!") |
|
244 |
elif facettype == "maxLength": |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
245 |
if "length" in facets: |
814 | 246 |
raise ValueError("\"length\" and \"maxLength\" facets can't be defined at the same time!") |
247 |
try: |
|
248 |
value = int(value) |
|
1780
c52d1460cea8
clean-up: fix PEP8 E722 do not use bare except'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1776
diff
changeset
|
249 |
except Exception: |
814 | 250 |
raise ValueError("\"maxLength\" must be an integer!") |
251 |
if value < 0: |
|
252 |
raise ValueError("\"maxLength\" can't be negative!") |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
253 |
elif "minLength" in facets and value < facets["minLength"]: |
814 | 254 |
raise ValueError("\"minLength\" must be lesser than or equal to \"maxLength\"!") |
255 |
elif basevalue is not None and basevalue > value: |
|
256 |
raise ValueError("\"maxLength\" can't be greater than \"maxLength\" defined in base type!") |
|
257 |
elif facettype == "minInclusive": |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
258 |
if "minExclusive" in facets: |
814 | 259 |
raise ValueError("\"minExclusive\" and \"minInclusive\" facets can't be defined at the same time!") |
260 |
value = basetypeinfos["extract"](facet["value"], False) |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
261 |
if "maxInclusive" in facets and value > facets["maxInclusive"][0]: |
814 | 262 |
raise ValueError("\"minInclusive\" must be lesser than or equal to \"maxInclusive\"!") |
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
263 |
elif "maxExclusive" in facets and value >= facets["maxExclusive"][0]: |
814 | 264 |
raise ValueError("\"minInclusive\" must be lesser than \"maxExclusive\"!") |
265 |
elif facettype == "minExclusive": |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
266 |
if "minInclusive" in facets: |
814 | 267 |
raise ValueError("\"minExclusive\" and \"minInclusive\" facets can't be defined at the same time!") |
268 |
value = basetypeinfos["extract"](facet["value"], False) |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
269 |
if "maxInclusive" in facets and value >= facets["maxInclusive"][0]: |
814 | 270 |
raise ValueError("\"minExclusive\" must be lesser than \"maxInclusive\"!") |
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
271 |
elif "maxExclusive" in facets and value >= facets["maxExclusive"][0]: |
814 | 272 |
raise ValueError("\"minExclusive\" must be lesser than \"maxExclusive\"!") |
273 |
elif facettype == "maxInclusive": |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
274 |
if "maxExclusive" in facets: |
814 | 275 |
raise ValueError("\"maxExclusive\" and \"maxInclusive\" facets can't be defined at the same time!") |
276 |
value = basetypeinfos["extract"](facet["value"], False) |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
277 |
if "minInclusive" in facets and value < facets["minInclusive"][0]: |
814 | 278 |
raise ValueError("\"minInclusive\" must be lesser than or equal to \"maxInclusive\"!") |
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
279 |
elif "minExclusive" in facets and value <= facets["minExclusive"][0]: |
814 | 280 |
raise ValueError("\"minExclusive\" must be lesser than \"maxInclusive\"!") |
281 |
elif facettype == "maxExclusive": |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
282 |
if "maxInclusive" in facets: |
814 | 283 |
raise ValueError("\"maxExclusive\" and \"maxInclusive\" facets can't be defined at the same time!") |
284 |
value = basetypeinfos["extract"](facet["value"], False) |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
285 |
if "minInclusive" in facets and value <= facets["minInclusive"][0]: |
814 | 286 |
raise ValueError("\"minInclusive\" must be lesser than \"maxExclusive\"!") |
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
287 |
elif "minExclusive" in facets and value <= facets["minExclusive"][0]: |
814 | 288 |
raise ValueError("\"minExclusive\" must be lesser than \"maxExclusive\"!") |
289 |
elif facettype == "whiteSpace": |
|
290 |
if basevalue == "collapse" and value in ["preserve", "replace"] or basevalue == "replace" and value == "preserve": |
|
1757
0de89da92ee0
clean-up: fix PEP8 E111 indentation is not a multiple of four
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1750
diff
changeset
|
291 |
raise ValueError("\"whiteSpace\" is incompatible with \"whiteSpace\" defined in base type!") |
814 | 292 |
elif facettype == "totalDigits": |
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
293 |
if "fractionDigits" in facets and value <= facets["fractionDigits"][0]: |
814 | 294 |
raise ValueError("\"fractionDigits\" must be lesser than or equal to \"totalDigits\"!") |
295 |
elif basevalue is not None and value > basevalue: |
|
296 |
raise ValueError("\"totalDigits\" can't be greater than \"totalDigits\" defined in base type!") |
|
297 |
elif facettype == "fractionDigits": |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
298 |
if "totalDigits" in facets and value <= facets["totalDigits"][0]: |
814 | 299 |
raise ValueError("\"fractionDigits\" must be lesser than or equal to \"totalDigits\"!") |
300 |
elif basevalue is not None and value > basevalue: |
|
301 |
raise ValueError("\"totalDigits\" can't be greater than \"totalDigits\" defined in base type!") |
|
302 |
facets[facettype] = (value, facet.get("fixed", False)) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
303 |
|
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
304 |
# Report not redefined facet from base type to new created type |
814 | 305 |
for facettype, facetvalue in basetypeinfos["facets"].items(): |
1775
b45f2768fab1
clean-up: fix PEP8 E713 test for membership should be 'not in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1774
diff
changeset
|
306 |
if facettype not in facets: |
814 | 307 |
facets[facettype] = facetvalue |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
308 |
|
814 | 309 |
# Generate extract value for new created type |
310 |
def ExtractSimpleTypeValue(attr, extract=True): |
|
311 |
value = basetypeinfos["extract"](attr, extract) |
|
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
312 |
for facetname, (facetvalue, _facetfixed) in facets.items(): |
814 | 313 |
if facetvalue is not None: |
314 |
if facetname == "enumeration" and value not in facetvalue: |
|
315 |
raise ValueError("\"%s\" not in enumerated values" % value) |
|
316 |
elif facetname == "length" and len(value) != facetvalue: |
|
317 |
raise ValueError("value must have a length of %d" % facetvalue) |
|
318 |
elif facetname == "minLength" and len(value) < facetvalue: |
|
319 |
raise ValueError("value must have a length of %d at least" % facetvalue) |
|
320 |
elif facetname == "maxLength" and len(value) > facetvalue: |
|
321 |
raise ValueError("value must have a length of %d at most" % facetvalue) |
|
322 |
elif facetname == "minInclusive" and value < facetvalue: |
|
323 |
raise ValueError("value must be greater than or equal to %s" % str(facetvalue)) |
|
324 |
elif facetname == "minExclusive" and value <= facetvalue: |
|
325 |
raise ValueError("value must be greater than %s" % str(facetvalue)) |
|
326 |
elif facetname == "maxInclusive" and value > facetvalue: |
|
327 |
raise ValueError("value must be lesser than or equal to %s" % str(facetvalue)) |
|
1774
ac0fe8aabb5e
clean-up: fix PEP8 E272 multiple spaces before keyword
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1768
diff
changeset
|
328 |
elif facetname == "maxExclusive" and value >= facetvalue: |
814 | 329 |
raise ValueError("value must be lesser than %s" % str(facetvalue)) |
330 |
elif facetname == "pattern": |
|
331 |
model = re.compile("(?:%s)?$" % "|".join(map(lambda x: "(?:%s)" % x, facetvalue))) |
|
332 |
result = model.match(value) |
|
333 |
if result is None: |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
334 |
if len(facetvalue) > 1: |
814 | 335 |
raise ValueError("value doesn't follow any of the patterns %s" % ",".join(facetvalue)) |
336 |
else: |
|
337 |
raise ValueError("value doesn't follow the pattern %s" % facetvalue[0]) |
|
338 |
elif facetname == "whiteSpace": |
|
339 |
if facetvalue == "replace": |
|
340 |
value = GetNormalizedString(value, False) |
|
341 |
elif facetvalue == "collapse": |
|
342 |
value = GetToken(value, False) |
|
343 |
return value |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
344 |
|
814 | 345 |
def CheckSimpleTypeValue(value): |
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
346 |
for facetname, (facetvalue, _facetfixed) in facets.items(): |
814 | 347 |
if facetvalue is not None: |
348 |
if facetname == "enumeration" and value not in facetvalue: |
|
349 |
return False |
|
350 |
elif facetname == "length" and len(value) != facetvalue: |
|
351 |
return False |
|
352 |
elif facetname == "minLength" and len(value) < facetvalue: |
|
353 |
return False |
|
354 |
elif facetname == "maxLength" and len(value) > facetvalue: |
|
355 |
return False |
|
356 |
elif facetname == "minInclusive" and value < facetvalue: |
|
357 |
return False |
|
358 |
elif facetname == "minExclusive" and value <= facetvalue: |
|
359 |
return False |
|
360 |
elif facetname == "maxInclusive" and value > facetvalue: |
|
361 |
return False |
|
1774
ac0fe8aabb5e
clean-up: fix PEP8 E272 multiple spaces before keyword
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1768
diff
changeset
|
362 |
elif facetname == "maxExclusive" and value >= facetvalue: |
814 | 363 |
return False |
364 |
elif facetname == "pattern": |
|
365 |
model = re.compile("(?:%s)?$" % "|".join(map(lambda x: "(?:%s)" % x, facetvalue))) |
|
366 |
result = model.match(value) |
|
367 |
if result is None: |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
368 |
if len(facetvalue) > 1: |
814 | 369 |
raise ValueError("value doesn't follow any of the patterns %s" % ",".join(facetvalue)) |
370 |
else: |
|
371 |
raise ValueError("value doesn't follow the pattern %s" % facetvalue[0]) |
|
372 |
return True |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
373 |
|
814 | 374 |
def SimpleTypeInitialValue(): |
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
375 |
for facetname, (facetvalue, _facetfixed) in facets.items(): |
814 | 376 |
if facetvalue is not None: |
377 |
if facetname == "enumeration": |
|
378 |
return facetvalue[0] |
|
379 |
elif facetname == "length": |
|
380 |
return " "*facetvalue |
|
381 |
elif facetname == "minLength": |
|
1872
866fb3ab8778
fix pylint error "(undefined-variable) Undefined variable 'X'"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1856
diff
changeset
|
382 |
return " "*facetvalue |
814 | 383 |
elif facetname == "minInclusive" and facetvalue > 0: |
384 |
return facetvalue |
|
385 |
elif facetname == "minExclusive" and facetvalue >= 0: |
|
386 |
return facetvalue + 1 |
|
387 |
elif facetname == "maxInclusive" and facetvalue < 0: |
|
388 |
return facetvalue |
|
1774
ac0fe8aabb5e
clean-up: fix PEP8 E272 multiple spaces before keyword
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1768
diff
changeset
|
389 |
elif facetname == "maxExclusive" and facetvalue <= 0: |
814 | 390 |
return facetvalue - 1 |
391 |
return basetypeinfos["initial"]() |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
392 |
|
814 | 393 |
GenerateSimpleType = basetypeinfos["generate"] |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
394 |
|
814 | 395 |
elif typeinfos["type"] == "list": |
396 |
# Search for item type definition |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
397 |
if isinstance(typeinfos["itemType"], string_types): |
814 | 398 |
itemtypeinfos = factory.FindSchemaElement(typeinfos["itemType"], SIMPLETYPE) |
399 |
if itemtypeinfos is None: |
|
400 |
raise "\"%s\" isn't defined!" % typeinfos["itemType"] |
|
401 |
else: |
|
402 |
itemtypeinfos = typeinfos["itemType"] |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
403 |
|
814 | 404 |
# Check that item type is a simple type |
405 |
if itemtypeinfos["type"] != SIMPLETYPE: |
|
1765
ccf59c1f0b45
clean-up: fix PEP8 W602 deprecated form of raising exception
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1763
diff
changeset
|
406 |
raise ValueError("Item type given isn't a simpleType!") |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
407 |
|
814 | 408 |
simpleType["basename"] = "list" |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
409 |
|
814 | 410 |
# Check that derivation is allowed |
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
411 |
if "final" in itemtypeinfos: |
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
412 |
if "#all" in itemtypeinfos["final"]: |
814 | 413 |
raise ValueError("Item type can't be derivated!") |
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
414 |
if "list" in itemtypeinfos["final"]: |
814 | 415 |
raise ValueError("Item type can't be derivated by list!") |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
416 |
|
814 | 417 |
# Generate extract value for new created type |
1744
69dfdb26f600
clean-up: fix PEP8 E251 unexpected spaces around keyword / parameter equals
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1743
diff
changeset
|
418 |
def ExtractSimpleTypeValue(attr, extract=True): |
814 | 419 |
values = [] |
420 |
for value in GetToken(attr, extract).split(" "): |
|
421 |
values.append(itemtypeinfos["extract"](value, False)) |
|
422 |
return values |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
423 |
|
814 | 424 |
def CheckSimpleTypeValue(value): |
425 |
for item in value: |
|
426 |
result = itemtypeinfos["check"](item) |
|
427 |
if not result: |
|
428 |
return result |
|
429 |
return True |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
430 |
|
1762
fcc406143e5b
clean-up: fix PEP8 E731 do not assign a lambda expression, use a def
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1757
diff
changeset
|
431 |
def SimpleTypeInitialValue(): |
fcc406143e5b
clean-up: fix PEP8 E731 do not assign a lambda expression, use a def
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1757
diff
changeset
|
432 |
return [] |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
433 |
|
814 | 434 |
GenerateSimpleType = GenerateSimpleTypeXMLText(lambda x: " ".join(map(itemtypeinfos["generate"], x))) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
435 |
|
814 | 436 |
facets = GenerateDictFacets(["length", "maxLength", "minLength", "enumeration", "pattern"]) |
437 |
facets["whiteSpace"] = ("collapse", False) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
438 |
|
814 | 439 |
elif typeinfos["type"] == "union": |
440 |
# Search for member types definition |
|
441 |
membertypesinfos = [] |
|
442 |
for membertype in typeinfos["memberTypes"]: |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
443 |
if isinstance(membertype, string_types): |
814 | 444 |
infos = factory.FindSchemaElement(membertype, SIMPLETYPE) |
445 |
if infos is None: |
|
446 |
raise ValueError("\"%s\" isn't defined!" % membertype) |
|
447 |
else: |
|
448 |
infos = membertype |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
449 |
|
814 | 450 |
# Check that member type is a simple type |
451 |
if infos["type"] != SIMPLETYPE: |
|
452 |
raise ValueError("Member type given isn't a simpleType!") |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
453 |
|
814 | 454 |
# Check that derivation is allowed |
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
455 |
if "final" in infos: |
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
456 |
if "#all" in infos["final"]: |
814 | 457 |
raise ValueError("Item type can't be derivated!") |
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
458 |
if "union" in infos["final"]: |
814 | 459 |
raise ValueError("Member type can't be derivated by union!") |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
460 |
|
814 | 461 |
membertypesinfos.append(infos) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
462 |
|
814 | 463 |
simpleType["basename"] = "union" |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
464 |
|
814 | 465 |
# Generate extract value for new created type |
1744
69dfdb26f600
clean-up: fix PEP8 E251 unexpected spaces around keyword / parameter equals
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1743
diff
changeset
|
466 |
def ExtractSimpleTypeValue(attr, extract=True): |
814 | 467 |
for infos in membertypesinfos: |
468 |
try: |
|
469 |
return infos["extract"](attr, False) |
|
1780
c52d1460cea8
clean-up: fix PEP8 E722 do not use bare except'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1776
diff
changeset
|
470 |
except Exception: |
814 | 471 |
pass |
472 |
raise ValueError("\"%s\" isn't valid for type defined for union!") |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
473 |
|
814 | 474 |
def CheckSimpleTypeValue(value): |
475 |
for infos in membertypesinfos: |
|
476 |
result = infos["check"](value) |
|
477 |
if result: |
|
478 |
return result |
|
479 |
return False |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
480 |
|
814 | 481 |
SimpleTypeInitialValue = membertypesinfos[0]["initial"] |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
482 |
|
814 | 483 |
def GenerateSimpleTypeFunction(value): |
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
484 |
if isinstance(value, bool): |
814 | 485 |
return {True: "true", False: "false"}[value] |
486 |
else: |
|
487 |
return str(value) |
|
488 |
GenerateSimpleType = GenerateSimpleTypeXMLText(GenerateSimpleTypeFunction) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
489 |
|
814 | 490 |
facets = GenerateDictFacets(["pattern", "enumeration"]) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
491 |
|
814 | 492 |
simpleType["facets"] = facets |
493 |
simpleType["extract"] = ExtractSimpleTypeValue |
|
494 |
simpleType["initial"] = SimpleTypeInitialValue |
|
495 |
simpleType["check"] = CheckSimpleTypeValue |
|
496 |
simpleType["generate"] = GenerateSimpleType |
|
497 |
return simpleType |
|
498 |
||
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
499 |
|
814 | 500 |
def ReduceSimpleType(factory, attributes, elements): |
501 |
# Reduce all the simple type children |
|
502 |
annotations, children = factory.ReduceElements(elements) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
503 |
|
814 | 504 |
simpleType = CreateSimpleType(factory, attributes, children[0]) |
505 |
simpleType["doc"] = annotations |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
506 |
|
814 | 507 |
return simpleType |
508 |
||
509 |
# Complex type |
|
510 |
||
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
511 |
|
814 | 512 |
def ExtractAttributes(factory, elements, base=None): |
513 |
attrs = [] |
|
514 |
attrnames = {} |
|
515 |
if base is not None: |
|
516 |
basetypeinfos = factory.FindSchemaElement(base) |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
517 |
if not isinstance(basetypeinfos, string_types) and basetypeinfos["type"] == COMPLEXTYPE: |
1740
b789b695b5c6
clean-up: fix PEP8 E231 missing whitespace after ':' or ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1739
diff
changeset
|
518 |
attrnames = dict(map(lambda x: (x["name"], True), basetypeinfos["attributes"])) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
519 |
|
814 | 520 |
for element in elements: |
521 |
if element["type"] == ATTRIBUTE: |
|
522 |
if attrnames.get(element["name"], False): |
|
523 |
raise ValueError("\"%s\" attribute has been defined two times!" % element["name"]) |
|
524 |
else: |
|
525 |
attrnames[element["name"]] = True |
|
526 |
attrs.append(element) |
|
527 |
elif element["type"] == "attributeGroup": |
|
528 |
attrgroup = factory.FindSchemaElement(element["ref"], ATTRIBUTESGROUP) |
|
529 |
for attr in attrgroup["attributes"]: |
|
530 |
if attrnames.get(attr["name"], False): |
|
531 |
raise ValueError("\"%s\" attribute has been defined two times!" % attr["name"]) |
|
532 |
else: |
|
533 |
attrnames[attr["name"]] = True |
|
534 |
attrs.append(attr) |
|
535 |
elif element["type"] == "anyAttribute": |
|
536 |
raise ValueError("\"anyAttribute\" element isn't supported yet!") |
|
537 |
return attrs |
|
538 |
||
539 |
||
540 |
def ReduceRestriction(factory, attributes, elements): |
|
541 |
annotations, children = factory.ReduceElements(elements) |
|
542 |
restriction = {"type": "restriction", "base": attributes.get("base", None), "facets": [], "doc": annotations} |
|
543 |
if len(children) > 0 and children[0]["type"] == SIMPLETYPE: |
|
544 |
if restriction["base"] is None: |
|
545 |
restriction["base"] = children.pop(0) |
|
546 |
else: |
|
547 |
raise ValueError("Only one base type can be defined for restriction!") |
|
548 |
if restriction["base"] is None: |
|
549 |
raise ValueError("No base type has been defined for restriction!") |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
550 |
|
814 | 551 |
while len(children) > 0 and children[0]["type"] in ALL_FACETS: |
552 |
restriction["facets"].append(children.pop(0)) |
|
553 |
restriction["attributes"] = ExtractAttributes(factory, children, restriction["base"]) |
|
554 |
return restriction |
|
555 |
||
556 |
||
557 |
def ReduceExtension(factory, attributes, elements): |
|
558 |
annotations, children = factory.ReduceElements(elements) |
|
1775
b45f2768fab1
clean-up: fix PEP8 E713 test for membership should be 'not in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1774
diff
changeset
|
559 |
if "base" not in attributes: |
814 | 560 |
raise ValueError("No base type has been defined for extension!") |
561 |
extension = {"type": "extension", "attributes": [], "elements": [], "base": attributes["base"], "doc": annotations} |
|
562 |
if len(children) > 0: |
|
563 |
if children[0]["type"] in ["group", "all", CHOICE, "sequence"]: |
|
564 |
group = children.pop(0) |
|
565 |
if group["type"] in ["all", "sequence"]: |
|
566 |
extension["elements"] = group["elements"] |
|
567 |
extension["order"] = group["order"] |
|
568 |
elif group["type"] == CHOICE: |
|
569 |
content = group.copy() |
|
570 |
content["name"] = "content" |
|
571 |
extension["elements"].append(content) |
|
572 |
elif group["type"] == "group": |
|
1872
866fb3ab8778
fix pylint error "(undefined-variable) Undefined variable 'X'"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1856
diff
changeset
|
573 |
elmtgroup = factory.FindSchemaElement(group["ref"], ELEMENTSGROUP) |
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
574 |
if "elements" in elmtgroup: |
814 | 575 |
extension["elements"] = elmtgroup["elements"] |
576 |
extension["order"] = elmtgroup["order"] |
|
577 |
else: |
|
578 |
content = elmtgroup.copy() |
|
579 |
content["name"] = "content" |
|
580 |
extension["elements"].append(content) |
|
581 |
extension["attributes"] = ExtractAttributes(factory, children) |
|
582 |
return extension |
|
583 |
||
584 |
||
585 |
def ReduceSimpleContent(factory, attributes, elements): |
|
586 |
annotations, children = factory.ReduceElements(elements) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
587 |
|
814 | 588 |
simpleContent = children[0].copy() |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
589 |
|
814 | 590 |
basetypeinfos = factory.FindSchemaElement(simpleContent["base"]) |
591 |
if basetypeinfos["type"] == SIMPLETYPE: |
|
592 |
contenttypeinfos = simpleContent.copy() |
|
593 |
simpleContent.pop("base") |
|
1767
c74815729afd
clean-up: fix PEP8 E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1765
diff
changeset
|
594 |
elif (basetypeinfos["type"] == COMPLEXTYPE and |
c74815729afd
clean-up: fix PEP8 E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1765
diff
changeset
|
595 |
len(basetypeinfos["elements"]) == 1 and |
c74815729afd
clean-up: fix PEP8 E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1765
diff
changeset
|
596 |
basetypeinfos["elements"][0]["name"] == "content" and |
c74815729afd
clean-up: fix PEP8 E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1765
diff
changeset
|
597 |
"elmt_type" in basetypeinfos["elements"][0] and |
c74815729afd
clean-up: fix PEP8 E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1765
diff
changeset
|
598 |
basetypeinfos["elements"][0]["elmt_type"]["type"] == SIMPLETYPE): |
814 | 599 |
contenttypeinfos = simpleContent.copy() |
600 |
contenttypeinfos["base"] = basetypeinfos["elements"][0]["elmt_type"] |
|
601 |
else: |
|
602 |
raise ValueError("No compatible base type defined for simpleContent!") |
|
603 |
contenttypeinfos = CreateSimpleType(factory, attributes, contenttypeinfos) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
604 |
|
814 | 605 |
simpleContent["elements"] = [{"name": "content", "type": ELEMENT, |
606 |
"elmt_type": contenttypeinfos, "doc": annotations, |
|
607 |
"minOccurs": 1, "maxOccurs": 1}] |
|
608 |
simpleContent["type"] = "simpleContent" |
|
609 |
return simpleContent |
|
610 |
||
611 |
||
612 |
def ReduceComplexContent(factory, attributes, elements): |
|
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
613 |
_annotations, children = factory.ReduceElements(elements) |
814 | 614 |
complexContent = children[0].copy() |
615 |
complexContent["type"] = "complexContent" |
|
616 |
return complexContent |
|
617 |
||
618 |
||
619 |
def ReduceComplexType(factory, attributes, elements): |
|
620 |
annotations, children = factory.ReduceElements(elements) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
621 |
|
814 | 622 |
if len(children) > 0: |
623 |
if children[0]["type"] in ["simpleContent", "complexContent"]: |
|
624 |
complexType = children[0].copy() |
|
625 |
complexType.update(attributes) |
|
626 |
complexType["type"] = COMPLEXTYPE |
|
627 |
return complexType |
|
628 |
elif children[0]["type"] in ["group", "all", CHOICE, "sequence"]: |
|
629 |
complexType = {"type": COMPLEXTYPE, "elements": [], "order": True, "doc": annotations} |
|
630 |
complexType.update(attributes) |
|
631 |
group = children.pop(0) |
|
632 |
if group["type"] in ["all", "sequence"]: |
|
633 |
choice_number = 0 |
|
634 |
for element in group["elements"]: |
|
635 |
if element["type"] == CHOICE: |
|
636 |
choice_number += 1 |
|
637 |
if (group["minOccurs"] == 0 or group["maxOccurs"] != 1) and len(group["elements"]) > 1 or choice_number > 1: |
|
638 |
content = {"type": CHOICE, "name": "content", "choices": [group], "minOccurs": 1, "maxOccurs": 1} |
|
639 |
complexType["elements"].append(content) |
|
640 |
else: |
|
641 |
if len(group["elements"]) == 1: |
|
642 |
if group["minOccurs"] == 0: |
|
643 |
group["elements"][0]["minOccurs"] = group["minOccurs"] |
|
644 |
if group["maxOccurs"] != 1: |
|
645 |
group["elements"][0]["maxOccurs"] = group["maxOccurs"] |
|
646 |
for element in group["elements"]: |
|
647 |
if element["type"] == CHOICE: |
|
648 |
element["name"] = "content" |
|
649 |
complexType["elements"] = group["elements"] |
|
650 |
complexType["order"] = group["order"] |
|
651 |
elif group["type"] == CHOICE: |
|
652 |
content = group.copy() |
|
653 |
content["name"] = "content" |
|
654 |
complexType["elements"].append(content) |
|
655 |
elif group["type"] == "group": |
|
1872
866fb3ab8778
fix pylint error "(undefined-variable) Undefined variable 'X'"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1856
diff
changeset
|
656 |
elmtgroup = factory.FindSchemaElement(group["ref"], ELEMENTSGROUP) |
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
657 |
if "elements" in elmtgroup: |
814 | 658 |
complexType["elements"] = elmtgroup["elements"] |
659 |
complexType["order"] = elmtgroup["order"] |
|
660 |
else: |
|
661 |
content = elmtgroup.copy() |
|
662 |
content["name"] = "content" |
|
663 |
complexType["elements"].append(content) |
|
664 |
else: |
|
665 |
complexType = {"elements": [], "order": True, "doc": annotations} |
|
666 |
complexType.update(attributes) |
|
667 |
complexType["type"] = COMPLEXTYPE |
|
668 |
complexType["attributes"] = ExtractAttributes(factory, children) |
|
669 |
return complexType |
|
670 |
else: |
|
671 |
raise ValueError("\"ComplexType\" can't be empty!") |
|
672 |
||
673 |
||
674 |
# Attribute elements |
|
675 |
||
676 |
def ReduceAnyAttribute(factory, attributes, elements): |
|
1739
ec153828ded2
clean-up: fix PEP8 E203 whitespace before ':' and whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1736
diff
changeset
|
677 |
return {"type": "anyAttribute"} |
814 | 678 |
|
679 |
||
680 |
def ReduceAttribute(factory, attributes, elements): |
|
681 |
annotations, children = factory.ReduceElements(elements) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
682 |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
683 |
if "default" in attributes: |
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
684 |
if "fixed" in attributes: |
814 | 685 |
raise ValueError("\"default\" and \"fixed\" can't be defined at the same time!") |
686 |
elif attributes.get("use", "optional") != "optional": |
|
687 |
raise ValueError("if \"default\" present, \"use\" can only have the value \"optional\"!") |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
688 |
|
814 | 689 |
attribute = {"type": ATTRIBUTE, "attr_type": attributes.get("type", None), "doc": annotations} |
690 |
if len(children) > 0: |
|
691 |
if attribute["attr_type"] is None: |
|
692 |
attribute["attr_type"] = children[0] |
|
693 |
else: |
|
694 |
raise ValueError("Only one type can be defined for attribute!") |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
695 |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
696 |
if "ref" in attributes: |
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
697 |
if "name" in attributes: |
814 | 698 |
raise ValueError("\"ref\" and \"name\" can't be defined at the same time!") |
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
699 |
elif "form" in attributes: |
814 | 700 |
raise ValueError("\"ref\" and \"form\" can't be defined at the same time!") |
701 |
elif attribute["attr_type"] is not None: |
|
702 |
raise ValueError("if \"ref\" is present, no type can be defined!") |
|
703 |
elif attribute["attr_type"] is None: |
|
704 |
raise ValueError("No type has been defined for attribute \"%s\"!" % attributes["name"]) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
705 |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
706 |
if "type" in attributes: |
814 | 707 |
tmp_attrs = attributes.copy() |
708 |
tmp_attrs.pop("type") |
|
709 |
attribute.update(tmp_attrs) |
|
710 |
else: |
|
711 |
attribute.update(attributes) |
|
712 |
return attribute |
|
713 |
||
714 |
||
715 |
def ReduceAttributeGroup(factory, attributes, elements): |
|
716 |
annotations, children = factory.ReduceElements(elements) |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
717 |
if "ref" in attributes: |
814 | 718 |
return {"type": "attributeGroup", "ref": attributes["ref"], "doc": annotations} |
719 |
else: |
|
720 |
return {"type": ATTRIBUTESGROUP, "attributes": ExtractAttributes(factory, children), "doc": annotations} |
|
721 |
||
722 |
||
723 |
# Elements groups |
|
724 |
||
725 |
def ReduceAny(factory, attributes, elements): |
|
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
726 |
annotations, _children = factory.ReduceElements(elements) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
727 |
|
814 | 728 |
any = {"type": ANY, "doc": annotations} |
729 |
any.update(attributes) |
|
730 |
return any |
|
731 |
||
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
732 |
|
814 | 733 |
def ReduceElement(factory, attributes, elements): |
734 |
annotations, children = factory.ReduceElements(elements) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
735 |
|
814 | 736 |
types = [] |
737 |
constraints = [] |
|
738 |
for child in children: |
|
739 |
if child["type"] == CONSTRAINT: |
|
740 |
constraints.append(child) |
|
741 |
else: |
|
742 |
types.append(child) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
743 |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
744 |
if "default" in attributes and "fixed" in attributes: |
814 | 745 |
raise ValueError("\"default\" and \"fixed\" can't be defined at the same time!") |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
746 |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
747 |
if "ref" in attributes: |
814 | 748 |
for attr in ["name", "default", "fixed", "form", "block", "type"]: |
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
749 |
if attr in attributes: |
814 | 750 |
raise ValueError("\"ref\" and \"%s\" can't be defined at the same time!" % attr) |
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
751 |
if "nillable" in attributes: |
814 | 752 |
raise ValueError("\"ref\" and \"nillable\" can't be defined at the same time!") |
753 |
if len(types) > 0: |
|
754 |
raise ValueError("No type and no constraints can be defined where \"ref\" is defined!") |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
755 |
|
814 | 756 |
infos = factory.FindSchemaElement(attributes["ref"], ELEMENT) |
757 |
if infos is not None: |
|
758 |
element = infos.copy() |
|
759 |
element["constraints"] = constraints |
|
760 |
element["minOccurs"] = attributes["minOccurs"] |
|
761 |
element["maxOccurs"] = attributes["maxOccurs"] |
|
762 |
return element |
|
763 |
else: |
|
1872
866fb3ab8778
fix pylint error "(undefined-variable) Undefined variable 'X'"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1856
diff
changeset
|
764 |
raise ValueError("\"%s\" base type isn't defined or circular referenced!" % attributes["ref"]) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
765 |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
766 |
elif "name" in attributes: |
814 | 767 |
element = {"type": ELEMENT, "elmt_type": attributes.get("type", None), "constraints": constraints, "doc": annotations} |
768 |
if len(types) > 0: |
|
769 |
if element["elmt_type"] is None: |
|
770 |
element["elmt_type"] = types[0] |
|
771 |
else: |
|
772 |
raise ValueError("Only one type can be defined for attribute!") |
|
773 |
elif element["elmt_type"] is None: |
|
774 |
element["elmt_type"] = "tag" |
|
775 |
element["type"] = TAG |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
776 |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
777 |
if "type" in attributes: |
814 | 778 |
tmp_attrs = attributes.copy() |
779 |
tmp_attrs.pop("type") |
|
780 |
element.update(tmp_attrs) |
|
781 |
else: |
|
782 |
element.update(attributes) |
|
783 |
return element |
|
784 |
else: |
|
785 |
raise ValueError("\"Element\" must have at least a \"ref\" or a \"name\" defined!") |
|
786 |
||
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
787 |
|
814 | 788 |
def ReduceAll(factory, attributes, elements): |
789 |
annotations, children = factory.ReduceElements(elements) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
790 |
|
814 | 791 |
for child in children: |
1849 | 792 |
if child["maxOccurs"] == "unbounded" or child["maxOccurs"] > 1: |
814 | 793 |
raise ValueError("\"all\" item can't have \"maxOccurs\" attribute greater than 1!") |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
794 |
|
814 | 795 |
return {"type": "all", "elements": children, "minOccurs": attributes["minOccurs"], |
796 |
"maxOccurs": attributes["maxOccurs"], "order": False, "doc": annotations} |
|
797 |
||
798 |
||
799 |
def ReduceChoice(factory, attributes, elements): |
|
800 |
annotations, children = factory.ReduceElements(elements) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
801 |
|
814 | 802 |
choices = [] |
803 |
for child in children: |
|
804 |
if child["type"] in [ELEMENT, ANY, TAG]: |
|
805 |
choices.append(child) |
|
806 |
elif child["type"] == "sequence": |
|
807 |
child["minOccurs"] = child["maxOccurs"] = 1 |
|
808 |
choices.append(child) |
|
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1780
diff
changeset
|
809 |
# raise ValueError("\"sequence\" in \"choice\" is not supported. Create instead a new complex type!") |
814 | 810 |
elif child["type"] == CHOICE: |
811 |
choices.extend(child["choices"]) |
|
812 |
elif child["type"] == "group": |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
813 |
elmtgroup = factory.FindSchemaElement(child["ref"], ELEMENTSGROUP) |
1775
b45f2768fab1
clean-up: fix PEP8 E713 test for membership should be 'not in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1774
diff
changeset
|
814 |
if "choices" not in elmtgroup: |
814 | 815 |
raise ValueError("Only group composed of \"choice\" can be referenced in \"choice\" element!") |
816 |
choices_tmp = [] |
|
817 |
for choice in elmtgroup["choices"]: |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
818 |
if not isinstance(choice["elmt_type"], string_types) and choice["elmt_type"]["type"] == COMPLEXTYPE: |
814 | 819 |
elmt_type = "%s_%s" % (elmtgroup["name"], choice["name"]) |
820 |
if factory.TargetNamespace is not None: |
|
821 |
elmt_type = "%s:%s" % (factory.TargetNamespace, elmt_type) |
|
822 |
new_choice = choice.copy() |
|
823 |
new_choice["elmt_type"] = elmt_type |
|
824 |
choices_tmp.append(new_choice) |
|
825 |
else: |
|
826 |
choices_tmp.append(choice) |
|
827 |
choices.extend(choices_tmp) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
828 |
|
814 | 829 |
for choice in choices: |
830 |
attributes["minOccurs"] = min(attributes["minOccurs"], choice["minOccurs"]) |
|
831 |
choice["minOccurs"] = 1 |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
832 |
|
814 | 833 |
return {"type": CHOICE, "choices": choices, "minOccurs": attributes["minOccurs"], |
834 |
"maxOccurs": attributes["maxOccurs"], "doc": annotations} |
|
835 |
||
836 |
||
837 |
def ReduceSequence(factory, attributes, elements): |
|
838 |
annotations, children = factory.ReduceElements(elements) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
839 |
|
814 | 840 |
sequence = [] |
841 |
for child in children: |
|
842 |
if child["type"] in [ELEMENT, ANY, TAG, CHOICE]: |
|
843 |
sequence.append(child) |
|
844 |
elif child["type"] == "sequence": |
|
845 |
sequence.extend(child["elements"]) |
|
846 |
elif child["type"] == "group": |
|
847 |
elmtgroup = factory.FindSchemaElement(child["ref"], ELEMENTSGROUP) |
|
1775
b45f2768fab1
clean-up: fix PEP8 E713 test for membership should be 'not in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1774
diff
changeset
|
848 |
if "elements" not in elmtgroup or not elmtgroup["order"]: |
814 | 849 |
raise ValueError("Only group composed of \"sequence\" can be referenced in \"sequence\" element!") |
850 |
elements_tmp = [] |
|
851 |
for element in elmtgroup["elements"]: |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
852 |
if not isinstance(element["elmt_type"], string_types) and element["elmt_type"]["type"] == COMPLEXTYPE: |
1734
750eeb7230a1
clean-up: fix some PEP8 E228 missing whitespace around modulo operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1732
diff
changeset
|
853 |
elmt_type = "%s_%s" % (elmtgroup["name"], element["name"]) |
814 | 854 |
if factory.TargetNamespace is not None: |
855 |
elmt_type = "%s:%s" % (factory.TargetNamespace, elmt_type) |
|
856 |
new_element = element.copy() |
|
857 |
new_element["elmt_type"] = elmt_type |
|
858 |
elements_tmp.append(new_element) |
|
859 |
else: |
|
860 |
elements_tmp.append(element) |
|
861 |
sequence.extend(elements_tmp) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
862 |
|
814 | 863 |
return {"type": "sequence", "elements": sequence, "minOccurs": attributes["minOccurs"], |
864 |
"maxOccurs": attributes["maxOccurs"], "order": True, "doc": annotations} |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
865 |
|
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
866 |
|
814 | 867 |
def ReduceGroup(factory, attributes, elements): |
868 |
annotations, children = factory.ReduceElements(elements) |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
869 |
|
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
870 |
if "ref" in attributes: |
814 | 871 |
return {"type": "group", "ref": attributes["ref"], "doc": annotations} |
872 |
else: |
|
873 |
element = children[0] |
|
874 |
group = {"type": ELEMENTSGROUP, "doc": annotations} |
|
875 |
if element["type"] == CHOICE: |
|
876 |
group["choices"] = element["choices"] |
|
877 |
else: |
|
1683
57b4ac796dcb
fix reducing groups with ordered elements
Surkov Sergey <surkovsv93@gmail.com>
parents:
1571
diff
changeset
|
878 |
group.update({"elements": element["elements"], "order": element["order"]}) |
814 | 879 |
group.update(attributes) |
880 |
return group |
|
881 |
||
882 |
# Constraint elements |
|
883 |
||
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
884 |
|
814 | 885 |
def ReduceUnique(factory, attributes, elements): |
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
886 |
_annotations, children = factory.ReduceElements(elements) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
887 |
|
814 | 888 |
unique = {"type": CONSTRAINT, "const_type": "unique", "selector": children[0], "fields": children[1:]} |
889 |
unique.update(attributes) |
|
890 |
return unique |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
891 |
|
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
892 |
|
814 | 893 |
def ReduceKey(factory, attributes, elements): |
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
894 |
_annotations, children = factory.ReduceElements(elements) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
895 |
|
814 | 896 |
key = {"type": CONSTRAINT, "const_type": "key", "selector": children[0], "fields": children[1:]} |
897 |
key.update(attributes) |
|
898 |
return key |
|
899 |
||
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
900 |
|
814 | 901 |
def ReduceKeyRef(factory, attributes, elements): |
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
902 |
_annotations, children = factory.ReduceElements(elements) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
903 |
|
814 | 904 |
keyref = {"type": CONSTRAINT, "const_type": "keyref", "selector": children[0], "fields": children[1:]} |
905 |
keyref.update(attributes) |
|
906 |
return keyref |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
907 |
|
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
908 |
|
814 | 909 |
def ReduceSelector(factory, attributes, elements): |
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
910 |
factory.ReduceElements(elements) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
911 |
|
814 | 912 |
selector = {"type": CONSTRAINT, "const_type": "selector"} |
913 |
selector.update(attributes) |
|
914 |
return selector |
|
915 |
||
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
916 |
|
814 | 917 |
def ReduceField(factory, attributes, elements): |
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
918 |
factory.ReduceElements(elements) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
919 |
|
814 | 920 |
field = {"type": CONSTRAINT, "const_type": "field"} |
921 |
field.update(attributes) |
|
922 |
return field |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
923 |
|
814 | 924 |
|
925 |
# Inclusion elements |
|
926 |
||
927 |
def ReduceImport(factory, attributes, elements): |
|
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
928 |
factory.ReduceElements(elements) |
814 | 929 |
raise ValueError("\"import\" element isn't supported yet!") |
930 |
||
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
931 |
|
814 | 932 |
def ReduceInclude(factory, attributes, elements): |
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
933 |
factory.ReduceElements(elements) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
934 |
|
814 | 935 |
if factory.FileName is None: |
936 |
raise ValueError("Include in XSD string not yet supported") |
|
937 |
filepath = attributes["schemaLocation"] |
|
938 |
if filepath is not None and not os.path.exists(filepath): |
|
939 |
filepath = os.path.join(factory.BaseFolder, filepath) |
|
940 |
if not os.path.exists(filepath): |
|
941 |
raise ValueError("No file '%s' found for include" % attributes["schemaLocation"]) |
|
942 |
xsdfile = open(filepath, 'r') |
|
943 |
include_factory = XSDClassFactory(minidom.parse(xsdfile), filepath) |
|
944 |
xsdfile.close() |
|
945 |
include_factory.CreateClasses() |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
946 |
|
814 | 947 |
if factory.TargetNamespace == include_factory.TargetNamespace: |
948 |
factory.Namespaces[factory.TargetNamespace].update(include_factory.Namespaces[include_factory.TargetNamespace]) |
|
949 |
else: |
|
950 |
factory.Namespaces[include_factory.TargetNamespace] = include_factory.Namespaces[include_factory.TargetNamespace] |
|
951 |
factory.ComputedClasses.update(include_factory.ComputedClasses) |
|
1322
0a9227f743b3
Fixed xmlclass for working with included files, adding support for SimpleType elements and solving ambiguity in extension class when different elements share the same name and parent name
Laurent Bessard
parents:
1315
diff
changeset
|
952 |
factory.ComputedClassesLookUp.update(include_factory.ComputedClassesLookUp) |
0a9227f743b3
Fixed xmlclass for working with included files, adding support for SimpleType elements and solving ambiguity in extension class when different elements share the same name and parent name
Laurent Bessard
parents:
1315
diff
changeset
|
953 |
factory.EquivalentClassesParent.update(include_factory.EquivalentClassesParent) |
814 | 954 |
return None |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
955 |
|
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
956 |
|
814 | 957 |
def ReduceRedefine(factory, attributes, elements): |
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
958 |
factory.ReduceElements(elements) |
814 | 959 |
raise ValueError("\"redefine\" element isn't supported yet!") |
960 |
||
961 |
||
962 |
# Schema element |
|
963 |
||
964 |
def ReduceSchema(factory, attributes, elements): |
|
965 |
factory.AttributeFormDefault = attributes["attributeFormDefault"] |
|
966 |
factory.ElementFormDefault = attributes["elementFormDefault"] |
|
967 |
factory.BlockDefault = attributes["blockDefault"] |
|
968 |
factory.FinalDefault = attributes["finalDefault"] |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
969 |
|
1315
ff14a66bbd12
Fixed Beremiz for working with new xmlclass support using lxml
Laurent Bessard
parents:
1290
diff
changeset
|
970 |
targetNamespace = attributes.get("targetNamespace", None) |
ff14a66bbd12
Fixed Beremiz for working with new xmlclass support using lxml
Laurent Bessard
parents:
1290
diff
changeset
|
971 |
factory.TargetNamespace = factory.DefinedNamespaces.get(targetNamespace, None) |
1290
13ee5f4ab612
First stage of xmlclass refactoring using lxml
Laurent Bessard
parents:
1078
diff
changeset
|
972 |
if factory.TargetNamespace is not None: |
1315
ff14a66bbd12
Fixed Beremiz for working with new xmlclass support using lxml
Laurent Bessard
parents:
1290
diff
changeset
|
973 |
factory.etreeNamespaceFormat = "{%s}%%s" % targetNamespace |
814 | 974 |
factory.Namespaces[factory.TargetNamespace] = {} |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
975 |
|
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
976 |
_annotations, children = factory.ReduceElements(elements, True) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
977 |
|
814 | 978 |
for child in children: |
1763
bcc07ff2362c
clean-up: fix PEP8 W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1762
diff
changeset
|
979 |
if "name" in child: |
814 | 980 |
infos = factory.GetQualifiedNameInfos(child["name"], factory.TargetNamespace, True) |
981 |
if infos is None: |
|
982 |
factory.Namespaces[factory.TargetNamespace][child["name"]] = child |
|
983 |
elif not CompareSchema(infos, child): |
|
984 |
raise ValueError("\"%s\" is defined twice in targetNamespace!" % child["name"]) |
|
985 |
||
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
986 |
|
814 | 987 |
def CompareSchema(schema, reference): |
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
988 |
if isinstance(schema, list): |
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
989 |
if not isinstance(reference, list) or len(schema) != len(reference): |
814 | 990 |
return False |
991 |
for i, value in enumerate(schema): |
|
992 |
result = CompareSchema(value, reference[i]) |
|
993 |
if not result: |
|
994 |
return result |
|
995 |
return True |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
996 |
elif isinstance(schema, dict): |
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
997 |
if not isinstance(reference, dict) or len(schema) != len(reference): |
814 | 998 |
return False |
999 |
for name, value in schema.items(): |
|
1000 |
ref_value = reference.get(name, None) |
|
1743
c3c3d1318130
clean-up: fix PEP8 E711 comparison to None should be 'if cond is not None:'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1740
diff
changeset
|
1001 |
if ref_value is None and value is not None: |
814 | 1002 |
return False |
1003 |
result = CompareSchema(value, ref_value) |
|
1004 |
if not result: |
|
1005 |
return result |
|
1006 |
return True |
|
1007 |
elif isinstance(schema, FunctionType): |
|
1008 |
if not isinstance(reference, FunctionType) or schema.__name__ != reference.__name__: |
|
1009 |
return False |
|
1010 |
else: |
|
1011 |
return True |
|
1012 |
return schema == reference |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1013 |
|
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1780
diff
changeset
|
1014 |
|
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1780
diff
changeset
|
1015 |
# ------------------------------------------------------------------------------- |
814 | 1016 |
# Base class for XSD schema extraction |
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1780
diff
changeset
|
1017 |
# ------------------------------------------------------------------------------- |
814 | 1018 |
|
1019 |
||
1020 |
class XSDClassFactory(ClassFactory): |
|
1021 |
||
1022 |
def __init__(self, document, filepath=None, debug=False): |
|
1023 |
ClassFactory.__init__(self, document, filepath, debug) |
|
1024 |
self.Namespaces["xml"] = { |
|
1025 |
"lang": { |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1026 |
"type": SYNTAXATTRIBUTE, |
814 | 1027 |
"extract": { |
1028 |
"default": GenerateModelNameExtraction("lang", LANGUAGE_model) |
|
1029 |
} |
|
1030 |
} |
|
1031 |
} |
|
1032 |
self.Namespaces["xsi"] = { |
|
1033 |
"noNamespaceSchemaLocation": { |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1034 |
"type": SYNTAXATTRIBUTE, |
814 | 1035 |
"extract": { |
1036 |
"default": NotSupportedYet("noNamespaceSchemaLocation") |
|
1037 |
} |
|
1038 |
}, |
|
1039 |
"nil": { |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1040 |
"type": SYNTAXATTRIBUTE, |
814 | 1041 |
"extract": { |
1042 |
"default": NotSupportedYet("nil") |
|
1043 |
} |
|
1044 |
}, |
|
1045 |
"schemaLocation": { |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1046 |
"type": SYNTAXATTRIBUTE, |
814 | 1047 |
"extract": { |
1048 |
"default": NotSupportedYet("schemaLocation") |
|
1049 |
} |
|
1050 |
}, |
|
1051 |
"type": { |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1052 |
"type": SYNTAXATTRIBUTE, |
814 | 1053 |
"extract": { |
1054 |
"default": NotSupportedYet("type") |
|
1055 |
} |
|
1056 |
} |
|
1057 |
} |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1058 |
|
814 | 1059 |
def ParseSchema(self): |
1060 |
for child in self.Document.childNodes: |
|
1061 |
if child.nodeType == self.Document.ELEMENT_NODE: |
|
1062 |
schema = child |
|
1063 |
break |
|
1064 |
for qualified_name, attr in schema._attrs.items(): |
|
1290
13ee5f4ab612
First stage of xmlclass refactoring using lxml
Laurent Bessard
parents:
1078
diff
changeset
|
1065 |
namespace, name = DecomposeQualifiedName(qualified_name) |
13ee5f4ab612
First stage of xmlclass refactoring using lxml
Laurent Bessard
parents:
1078
diff
changeset
|
1066 |
if namespace == "xmlns": |
13ee5f4ab612
First stage of xmlclass refactoring using lxml
Laurent Bessard
parents:
1078
diff
changeset
|
1067 |
value = GetAttributeValue(attr) |
13ee5f4ab612
First stage of xmlclass refactoring using lxml
Laurent Bessard
parents:
1078
diff
changeset
|
1068 |
self.DefinedNamespaces[value] = name |
13ee5f4ab612
First stage of xmlclass refactoring using lxml
Laurent Bessard
parents:
1078
diff
changeset
|
1069 |
self.NSMAP[name] = value |
13ee5f4ab612
First stage of xmlclass refactoring using lxml
Laurent Bessard
parents:
1078
diff
changeset
|
1070 |
if value == "http://www.w3.org/2001/XMLSchema": |
814 | 1071 |
self.SchemaNamespace = name |
1290
13ee5f4ab612
First stage of xmlclass refactoring using lxml
Laurent Bessard
parents:
1078
diff
changeset
|
1072 |
self.Namespaces[self.SchemaNamespace] = XSD_NAMESPACE |
814 | 1073 |
self.Schema = XSD_NAMESPACE["schema"]["extract"]["default"](self, schema) |
1074 |
ReduceSchema(self, self.Schema[1], self.Schema[2]) |
|
1075 |
||
1076 |
def FindSchemaElement(self, element_name, element_type=None): |
|
1077 |
namespace, name = DecomposeQualifiedName(element_name) |
|
1078 |
element = self.GetQualifiedNameInfos(name, namespace, True) |
|
1079 |
if element is None and namespace == self.TargetNamespace and name not in self.CurrentCompilations: |
|
1080 |
self.CurrentCompilations.append(name) |
|
1081 |
element = self.CreateSchemaElement(name, element_type) |
|
1082 |
self.CurrentCompilations.pop(-1) |
|
1083 |
if element is not None: |
|
1084 |
self.Namespaces[self.TargetNamespace][name] = element |
|
1085 |
if element is None: |
|
1086 |
if name in self.CurrentCompilations: |
|
1087 |
if self.Debug: |
|
1826
91796f408540
fix usage of python2-only print statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1782
diff
changeset
|
1088 |
print("Warning : \"%s\" is circular referenced!" % element_name) |
814 | 1089 |
else: |
1090 |
raise ValueError("\"%s\" isn't defined!" % element_name) |
|
1091 |
if element_type is not None and element["type"] != element_type: |
|
1092 |
raise ValueError("\"%s\" isn't of the expected type!" % element_name) |
|
1093 |
return element |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1094 |
|
814 | 1095 |
def CreateSchemaElement(self, element_name, element_type): |
1096 |
for type, attributes, elements in self.Schema[2]: |
|
1847
6198190bc121
explicitly mark unused variables found by pylint with _ or dummy
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1846
diff
changeset
|
1097 |
_namespace, name = DecomposeQualifiedName(type) |
814 | 1098 |
if attributes.get("name", None) == element_name: |
1099 |
element_infos = None |
|
1100 |
if element_type in (ATTRIBUTE, None) and name == "attribute": |
|
1101 |
element_infos = ReduceAttribute(self, attributes, elements) |
|
1102 |
elif element_type in (ELEMENT, None) and name == "element": |
|
1103 |
element_infos = ReduceElement(self, attributes, elements) |
|
1104 |
elif element_type in (ATTRIBUTESGROUP, None) and name == "attributeGroup": |
|
1105 |
element_infos = ReduceAttributeGroup(self, attributes, elements) |
|
1106 |
elif element_type in (ELEMENTSGROUP, None) and name == "group": |
|
1107 |
element_infos = ReduceGroup(self, attributes, elements) |
|
1108 |
elif element_type in (SIMPLETYPE, None) and name == "simpleType": |
|
1109 |
element_infos = ReduceSimpleType(self, attributes, elements) |
|
1110 |
elif element_type in (COMPLEXTYPE, None) and name == "complexType": |
|
1111 |
element_infos = ReduceComplexType(self, attributes, elements) |
|
1112 |
if element_infos is not None: |
|
1113 |
self.Namespaces[self.TargetNamespace][element_name] = element_infos |
|
1114 |
return element_infos |
|
1115 |
return None |
|
1116 |
||
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
1117 |
|
1290
13ee5f4ab612
First stage of xmlclass refactoring using lxml
Laurent Bessard
parents:
1078
diff
changeset
|
1118 |
def GenerateParserFromXSD(filepath): |
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
1119 |
""" |
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
1120 |
This function opens the xsd file and generate a xml parser with class lookup from |
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
1121 |
the xml tree |
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
1122 |
""" |
814 | 1123 |
xsdfile = open(filepath, 'r') |
1290
13ee5f4ab612
First stage of xmlclass refactoring using lxml
Laurent Bessard
parents:
1078
diff
changeset
|
1124 |
xsdstring = xsdfile.read() |
814 | 1125 |
xsdfile.close() |
1322
0a9227f743b3
Fixed xmlclass for working with included files, adding support for SimpleType elements and solving ambiguity in extension class when different elements share the same name and parent name
Laurent Bessard
parents:
1315
diff
changeset
|
1126 |
cwd = os.getcwd() |
0a9227f743b3
Fixed xmlclass for working with included files, adding support for SimpleType elements and solving ambiguity in extension class when different elements share the same name and parent name
Laurent Bessard
parents:
1315
diff
changeset
|
1127 |
os.chdir(os.path.dirname(filepath)) |
0a9227f743b3
Fixed xmlclass for working with included files, adding support for SimpleType elements and solving ambiguity in extension class when different elements share the same name and parent name
Laurent Bessard
parents:
1315
diff
changeset
|
1128 |
parser = GenerateParser(XSDClassFactory(minidom.parseString(xsdstring), filepath), xsdstring) |
0a9227f743b3
Fixed xmlclass for working with included files, adding support for SimpleType elements and solving ambiguity in extension class when different elements share the same name and parent name
Laurent Bessard
parents:
1315
diff
changeset
|
1129 |
os.chdir(cwd) |
0a9227f743b3
Fixed xmlclass for working with included files, adding support for SimpleType elements and solving ambiguity in extension class when different elements share the same name and parent name
Laurent Bessard
parents:
1315
diff
changeset
|
1130 |
return parser |
814 | 1131 |
|
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
1132 |
|
1290
13ee5f4ab612
First stage of xmlclass refactoring using lxml
Laurent Bessard
parents:
1078
diff
changeset
|
1133 |
def GenerateParserFromXSDstring(xsdstring): |
1736
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
1134 |
""" |
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
1135 |
This function generate a xml from the xsd given as a string |
7e61baa047f0
clean-up: fix PEP8 E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1734
diff
changeset
|
1136 |
""" |
1315
ff14a66bbd12
Fixed Beremiz for working with new xmlclass support using lxml
Laurent Bessard
parents:
1290
diff
changeset
|
1137 |
return GenerateParser(XSDClassFactory(minidom.parseString(xsdstring)), xsdstring) |
814 | 1138 |
|
1139 |
||
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1780
diff
changeset
|
1140 |
# ------------------------------------------------------------------------------- |
814 | 1141 |
# XSD schema syntax elements |
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1780
diff
changeset
|
1142 |
# ------------------------------------------------------------------------------- |
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1780
diff
changeset
|
1143 |
|
814 | 1144 |
|
1145 |
XSD_NAMESPACE = { |
|
1146 |
||
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1780
diff
changeset
|
1147 |
# ------------------------------------------------------------------------------- |
1776
81aa8aaccdd4
clean-up: fix PEP8 E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1775
diff
changeset
|
1148 |
# Syntax elements definition |
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1780
diff
changeset
|
1149 |
# ------------------------------------------------------------------------------- |
814 | 1150 |
|
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1151 |
"all": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1152 |
"struct": """ |
814 | 1153 |
<all |
1154 |
id = ID |
|
1155 |
maxOccurs = 1 : 1 |
|
1156 |
minOccurs = (0 | 1) : 1 |
|
1157 |
{any attributes with non-schema namespace . . .}> |
|
1158 |
Content: (annotation?, element*) |
|
1159 |
</all>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1160 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1161 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1162 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1163 |
"all", ["id", "maxOccurs", "minOccurs"], |
814 | 1164 |
re.compile("((?:annotation )?(?:element )*)")) |
1165 |
}, |
|
1166 |
"reduce": ReduceAll |
|
1167 |
}, |
|
1168 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1169 |
"annotation": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1170 |
"struct": """ |
814 | 1171 |
<annotation |
1172 |
id = ID |
|
1173 |
{any attributes with non-schema namespace . . .}> |
|
1174 |
Content: (appinfo | documentation)* |
|
1175 |
</annotation>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1176 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1177 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1178 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1179 |
"annotation", ["id"], |
814 | 1180 |
re.compile("((?:app_info |documentation )*)")) |
1181 |
}, |
|
1182 |
"reduce": ReduceAnnotation |
|
1183 |
}, |
|
1184 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1185 |
"any": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1186 |
"struct": """ |
814 | 1187 |
<any |
1188 |
id = ID |
|
1189 |
maxOccurs = (nonNegativeInteger | unbounded) : 1 |
|
1190 |
minOccurs = nonNegativeInteger : 1 |
|
1191 |
namespace = ((##any | ##other) | List of (anyURI | (##targetNamespace | ##local)) ) : ##any |
|
1192 |
processContents = (lax | skip | strict) : strict |
|
1193 |
{any attributes with non-schema namespace . . .}> |
|
1194 |
Content: (annotation?) |
|
1195 |
</any>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1196 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1197 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1198 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1199 |
"any", |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1200 |
["id", "maxOccurs", "minOccurs", "namespace", "processContents"], |
814 | 1201 |
re.compile("((?:annotation )?(?:simpleType )*)")) |
1202 |
}, |
|
1203 |
"reduce": ReduceAny |
|
1204 |
}, |
|
1205 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1206 |
"anyAttribute": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1207 |
"struct": """ |
814 | 1208 |
<anyAttribute |
1209 |
id = ID |
|
1210 |
namespace = ((##any | ##other) | List of (anyURI | (##targetNamespace | ##local)) ) : ##any |
|
1211 |
processContents = (lax | skip | strict) : strict |
|
1212 |
{any attributes with non-schema namespace . . .}> |
|
1213 |
Content: (annotation?) |
|
1214 |
</anyAttribute>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1215 |
"type": SYNTAXELEMENT, |
814 | 1216 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1217 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1218 |
"anyAttribute", ["id", "namespace", "processContents"], ONLY_ANNOTATION) |
814 | 1219 |
}, |
1220 |
"reduce": ReduceAnyAttribute |
|
1221 |
}, |
|
1222 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1223 |
"appinfo": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1224 |
"struct": """ |
814 | 1225 |
<appinfo |
1226 |
source = anyURI |
|
1227 |
{any attributes with non-schema namespace . . .}> |
|
1228 |
Content: ({any})* |
|
1229 |
</appinfo>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1230 |
"type": SYNTAXELEMENT, |
814 | 1231 |
"extract": { |
1232 |
"default": GenerateElement("appinfo", ["source"], re.compile("(.*)"), True) |
|
1233 |
}, |
|
1234 |
"reduce": ReduceAppInfo |
|
1235 |
}, |
|
1236 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1237 |
"attribute": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1238 |
"struct": """ |
814 | 1239 |
<attribute |
1240 |
default = string |
|
1241 |
fixed = string |
|
1242 |
form = (qualified | unqualified) |
|
1243 |
id = ID |
|
1244 |
name = NCName |
|
1245 |
ref = QName |
|
1246 |
type = QName |
|
1247 |
use = (optional | prohibited | required) : optional |
|
1248 |
{any attributes with non-schema namespace . . .}> |
|
1249 |
Content: (annotation?, simpleType?) |
|
1250 |
</attribute>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1251 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1252 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1253 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1254 |
"attribute", |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1255 |
["default", "fixed", "form", "id", "name", "ref", "type", "use"], |
814 | 1256 |
re.compile("((?:annotation )?(?:simpleType )?)")), |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1257 |
"schema": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1258 |
"attribute", |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1259 |
["default", "fixed", "form", "id", "name", "type"], |
814 | 1260 |
re.compile("((?:annotation )?(?:simpleType )?)")) |
1261 |
}, |
|
1262 |
"reduce": ReduceAttribute |
|
1263 |
}, |
|
1264 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1265 |
"attributeGroup": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1266 |
"struct": """ |
814 | 1267 |
<attributeGroup |
1268 |
id = ID |
|
1269 |
name = NCName |
|
1270 |
ref = QName |
|
1271 |
{any attributes with non-schema namespace . . .}> |
|
1272 |
Content: (annotation?, ((attribute | attributeGroup)*, anyAttribute?)) |
|
1273 |
</attributeGroup>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1274 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1275 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1276 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1277 |
"attributeGroup", |
814 | 1278 |
["id", "ref"], ONLY_ANNOTATION), |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1279 |
"schema": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1280 |
"attributeGroup", |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1281 |
["id", "name"], |
814 | 1282 |
re.compile("((?:annotation )?(?:(?:attribute |attributeGroup )*(?:anyAttribute )?))")) |
1283 |
}, |
|
1284 |
"reduce": ReduceAttributeGroup |
|
1285 |
}, |
|
1286 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1287 |
"choice": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1288 |
"struct": """ |
814 | 1289 |
<choice |
1290 |
id = ID |
|
1291 |
maxOccurs = (nonNegativeInteger | unbounded) : 1 |
|
1292 |
minOccurs = nonNegativeInteger : 1 |
|
1293 |
{any attributes with non-schema namespace . . .}> |
|
1294 |
Content: (annotation?, (element | group | choice | sequence | any)*) |
|
1295 |
</choice>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1296 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1297 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1298 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1299 |
"choice", |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1300 |
["id", "maxOccurs", "minOccurs"], |
814 | 1301 |
re.compile("((?:annotation )?(?:element |group |choice |sequence |any )*)")) |
1302 |
}, |
|
1303 |
"reduce": ReduceChoice |
|
1304 |
}, |
|
1305 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1306 |
"complexContent": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1307 |
"struct": """ |
814 | 1308 |
<complexContent |
1309 |
id = ID |
|
1310 |
mixed = boolean |
|
1311 |
{any attributes with non-schema namespace . . .}> |
|
1312 |
Content: (annotation?, (restriction | extension)) |
|
1313 |
</complexContent>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1314 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1315 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1316 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1317 |
"complexContent", |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1318 |
["id", "mixed"], |
814 | 1319 |
re.compile("((?:annotation )?(?:restriction |extension ))")) |
1320 |
}, |
|
1321 |
"reduce": ReduceComplexContent |
|
1322 |
}, |
|
1323 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1324 |
"complexType": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1325 |
"struct": """ |
814 | 1326 |
<complexType |
1327 |
abstract = boolean : false |
|
1328 |
block = (#all | List of (extension | restriction)) |
|
1329 |
final = (#all | List of (extension | restriction)) |
|
1330 |
id = ID |
|
1331 |
mixed = boolean : false |
|
1332 |
name = NCName |
|
1333 |
{any attributes with non-schema namespace . . .}> |
|
1334 |
Content: (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)))) |
|
1335 |
</complexType>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1336 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1337 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1338 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1339 |
"complexType", |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1340 |
["abstract", "block", "final", "id", "mixed", "name"], |
814 | 1341 |
re.compile("((?:annotation )?(?:simpleContent |complexContent |(?:(?:group |all |choice |sequence )?(?:(?:attribute |attributeGroup )*(?:anyAttribute )?))))")) |
1342 |
}, |
|
1343 |
"reduce": ReduceComplexType |
|
1344 |
}, |
|
1345 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1346 |
"documentation": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1347 |
"struct": """ |
814 | 1348 |
<documentation |
1349 |
source = anyURI |
|
1350 |
xml:lang = language |
|
1351 |
{any attributes with non-schema namespace . . .}> |
|
1352 |
Content: ({any})* |
|
1353 |
</documentation>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1354 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1355 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1356 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1357 |
"documentation", |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1358 |
["source", "lang"], |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1359 |
re.compile("(.*)"), True) |
814 | 1360 |
}, |
1361 |
"reduce": ReduceDocumentation |
|
1362 |
}, |
|
1363 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1364 |
"element": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1365 |
"struct": """ |
814 | 1366 |
<element |
1367 |
abstract = boolean : false |
|
1368 |
block = (#all | List of (extension | restriction | substitution)) |
|
1369 |
default = string |
|
1370 |
final = (#all | List of (extension | restriction)) |
|
1371 |
fixed = string |
|
1372 |
form = (qualified | unqualified) |
|
1373 |
id = ID |
|
1374 |
maxOccurs = (nonNegativeInteger | unbounded) : 1 |
|
1375 |
minOccurs = nonNegativeInteger : 1 |
|
1376 |
name = NCName |
|
1377 |
nillable = boolean : false |
|
1378 |
ref = QName |
|
1379 |
substitutionGroup = QName |
|
1380 |
type = QName |
|
1381 |
{any attributes with non-schema namespace . . .}> |
|
1382 |
Content: (annotation?, ((simpleType | complexType)?, (unique | key | keyref)*)) |
|
1383 |
</element>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1384 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1385 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1386 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1387 |
"element", |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1388 |
["abstract", "block", "default", "final", "fixed", "form", "id", "maxOccurs", "minOccurs", "name", "nillable", "ref", "substitutionGroup", "type"], |
814 | 1389 |
re.compile("((?:annotation )?(?:simpleType |complexType )?(?:unique |key |keyref )*)")), |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1390 |
"schema": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1391 |
"element", |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1392 |
["abstract", "block", "default", "final", "fixed", "form", "id", "name", "nillable", "substitutionGroup", "type"], |
814 | 1393 |
re.compile("((?:annotation )?(?:simpleType |complexType )?(?:unique |key |keyref )*)")) |
1394 |
}, |
|
1395 |
"reduce": ReduceElement |
|
1396 |
}, |
|
1397 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1398 |
"enumeration": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1399 |
"struct": """ |
814 | 1400 |
<enumeration |
1401 |
id = ID |
|
1402 |
value = anySimpleType |
|
1403 |
{any attributes with non-schema namespace . . .}> |
|
1404 |
Content: (annotation?) |
|
1405 |
</enumeration>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1406 |
"type": SYNTAXELEMENT, |
814 | 1407 |
"extract": { |
1408 |
"default": GenerateElement("enumeration", ["id", "value"], ONLY_ANNOTATION) |
|
1409 |
}, |
|
1410 |
"reduce": GenerateFacetReducing("enumeration", False) |
|
1411 |
}, |
|
1412 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1413 |
"extension": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1414 |
"struct": """ |
814 | 1415 |
<extension |
1416 |
base = QName |
|
1417 |
id = ID |
|
1418 |
{any attributes with non-schema namespace . . .}> |
|
1419 |
Content: (annotation?, ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?))) |
|
1420 |
</extension>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1421 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1422 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1423 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1424 |
"extension", |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1425 |
["base", "id"], |
814 | 1426 |
re.compile("((?:annotation )?(?:(?:attribute |attributeGroup )*(?:anyAttribute )?))")), |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1427 |
"complexContent": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1428 |
"extension", |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1429 |
["base", "id"], |
814 | 1430 |
re.compile("((?:annotation )?(?:group |all |choice |sequence )?(?:(?:attribute |attributeGroup )*(?:anyAttribute )?))")) |
1431 |
}, |
|
1432 |
"reduce": ReduceExtension |
|
1433 |
}, |
|
1434 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1435 |
"field": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1436 |
"struct": """ |
814 | 1437 |
<field |
1438 |
id = ID |
|
1439 |
xpath = a subset of XPath expression, see below |
|
1440 |
{any attributes with non-schema namespace . . .}> |
|
1441 |
Content: (annotation?) |
|
1442 |
</field>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1443 |
"type": SYNTAXELEMENT, |
814 | 1444 |
"extract": { |
1445 |
"default": GenerateElement("field", ["id", "xpath"], ONLY_ANNOTATION) |
|
1446 |
}, |
|
1447 |
"reduce": ReduceField |
|
1448 |
}, |
|
1449 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1450 |
"fractionDigits": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1451 |
"struct": """ |
814 | 1452 |
<fractionDigits |
1453 |
fixed = boolean : false |
|
1454 |
id = ID |
|
1455 |
value = nonNegativeInteger |
|
1456 |
{any attributes with non-schema namespace . . .}> |
|
1457 |
Content: (annotation?) |
|
1458 |
</fractionDigits>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1459 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1460 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1461 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1462 |
"fractionDigits", |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1463 |
["fixed", "id", "value"], |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1464 |
ONLY_ANNOTATION) |
814 | 1465 |
}, |
1466 |
"reduce": GenerateFacetReducing("fractionDigits", True) |
|
1467 |
}, |
|
1468 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1469 |
"group": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1470 |
"struct": """ |
814 | 1471 |
<group |
1472 |
id = ID |
|
1473 |
maxOccurs = (nonNegativeInteger | unbounded) : 1 |
|
1474 |
minOccurs = nonNegativeInteger : 1 |
|
1475 |
name = NCName |
|
1476 |
ref = QName |
|
1477 |
{any attributes with non-schema namespace . . .}> |
|
1478 |
Content: (annotation?, (all | choice | sequence)?) |
|
1479 |
</group>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1480 |
"type": SYNTAXELEMENT, |
814 | 1481 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1482 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1483 |
"group", |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1484 |
["id", "maxOccurs", "minOccurs", "ref"], |
814 | 1485 |
re.compile("((?:annotation )?(?:all |choice |sequence )?)")), |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1486 |
"schema": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1487 |
"group", |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1488 |
["id", "name"], |
814 | 1489 |
re.compile("((?:annotation )?(?:all |choice |sequence )?)")) |
1490 |
}, |
|
1491 |
"reduce": ReduceGroup |
|
1492 |
}, |
|
1493 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1494 |
"import": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1495 |
"struct": """ |
814 | 1496 |
<import |
1497 |
id = ID |
|
1498 |
namespace = anyURI |
|
1499 |
schemaLocation = anyURI |
|
1500 |
{any attributes with non-schema namespace . . .}> |
|
1501 |
Content: (annotation?) |
|
1502 |
</import>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1503 |
"type": SYNTAXELEMENT, |
814 | 1504 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1505 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1506 |
"import", |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1507 |
["id", "namespace", "schemaLocation"], |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1508 |
ONLY_ANNOTATION) |
814 | 1509 |
}, |
1510 |
"reduce": ReduceImport |
|
1511 |
}, |
|
1512 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1513 |
"include": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1514 |
"struct": """ |
814 | 1515 |
<include |
1516 |
id = ID |
|
1517 |
schemaLocation = anyURI |
|
1518 |
{any attributes with non-schema namespace . . .}> |
|
1519 |
Content: (annotation?) |
|
1520 |
</include>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1521 |
"type": SYNTAXELEMENT, |
814 | 1522 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1523 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1524 |
"include", |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1525 |
["id", "schemaLocation"], |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1526 |
ONLY_ANNOTATION) |
814 | 1527 |
}, |
1528 |
"reduce": ReduceInclude |
|
1529 |
}, |
|
1530 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1531 |
"key": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1532 |
"struct": """ |
814 | 1533 |
<key |
1534 |
id = ID |
|
1535 |
name = NCName |
|
1536 |
{any attributes with non-schema namespace . . .}> |
|
1537 |
Content: (annotation?, (selector, field+)) |
|
1538 |
</key>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1539 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1540 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1541 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1542 |
"key", ["id", "name"], |
814 | 1543 |
re.compile("((?:annotation )?(?:selector (?:field )+))")) |
1544 |
}, |
|
1545 |
"reduce": ReduceKey |
|
1546 |
}, |
|
1547 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1548 |
"keyref": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1549 |
"struct": """ |
814 | 1550 |
<keyref |
1551 |
id = ID |
|
1552 |
name = NCName |
|
1553 |
refer = QName |
|
1554 |
{any attributes with non-schema namespace . . .}> |
|
1555 |
Content: (annotation?, (selector, field+)) |
|
1556 |
</keyref>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1557 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1558 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1559 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1560 |
"keyref", ["id", "name", "refer"], |
814 | 1561 |
re.compile("((?:annotation )?(?:selector (?:field )+))")) |
1562 |
}, |
|
1563 |
"reduce": ReduceKeyRef |
|
1564 |
}, |
|
1565 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1566 |
"length": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1567 |
"struct": """ |
814 | 1568 |
<length |
1569 |
fixed = boolean : false |
|
1570 |
id = ID |
|
1571 |
value = nonNegativeInteger |
|
1572 |
{any attributes with non-schema namespace . . .}> |
|
1573 |
Content: (annotation?) |
|
1574 |
</length>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1575 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1576 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1577 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1578 |
"length", ["fixed", "id", "value"], ONLY_ANNOTATION) |
814 | 1579 |
}, |
1580 |
"reduce": GenerateFacetReducing("length", True) |
|
1581 |
}, |
|
1582 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1583 |
"list": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1584 |
"struct": """ |
814 | 1585 |
<list |
1586 |
id = ID |
|
1587 |
itemType = QName |
|
1588 |
{any attributes with non-schema namespace . . .}> |
|
1589 |
Content: (annotation?, simpleType?) |
|
1590 |
</list>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1591 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1592 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1593 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1594 |
"list", ["id", "itemType"], |
814 | 1595 |
re.compile("((?:annotation )?(?:simpleType )?)$")) |
1596 |
}, |
|
1597 |
"reduce": ReduceList |
|
1598 |
}, |
|
1599 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1600 |
"maxExclusive": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1601 |
"struct": """ |
814 | 1602 |
<maxInclusive |
1603 |
fixed = boolean : false |
|
1604 |
id = ID |
|
1605 |
value = anySimpleType |
|
1606 |
{any attributes with non-schema namespace . . .}> |
|
1607 |
Content: (annotation?) |
|
1608 |
</maxInclusive>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1609 |
"type": SYNTAXELEMENT, |
814 | 1610 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1611 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1612 |
"maxExclusive", ["fixed", "id", "value"], ONLY_ANNOTATION) |
814 | 1613 |
}, |
1614 |
"reduce": GenerateFacetReducing("maxExclusive", True) |
|
1615 |
}, |
|
1616 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1617 |
"maxInclusive": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1618 |
"struct": """ |
814 | 1619 |
<maxExclusive |
1620 |
fixed = boolean : false |
|
1621 |
id = ID |
|
1622 |
value = anySimpleType |
|
1623 |
{any attributes with non-schema namespace . . .}> |
|
1624 |
Content: (annotation?) |
|
1625 |
</maxExclusive>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1626 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1627 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1628 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1629 |
"maxInclusive", ["fixed", "id", "value"], ONLY_ANNOTATION) |
814 | 1630 |
}, |
1631 |
"reduce": GenerateFacetReducing("maxInclusive", True) |
|
1632 |
}, |
|
1633 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1634 |
"maxLength": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1635 |
"struct": """ |
814 | 1636 |
<maxLength |
1637 |
fixed = boolean : false |
|
1638 |
id = ID |
|
1639 |
value = nonNegativeInteger |
|
1640 |
{any attributes with non-schema namespace . . .}> |
|
1641 |
Content: (annotation?) |
|
1642 |
</maxLength>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1643 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1644 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1645 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1646 |
"maxLength", ["fixed", "id", "value"], ONLY_ANNOTATION) |
814 | 1647 |
}, |
1648 |
"reduce": GenerateFacetReducing("maxLength", True) |
|
1649 |
}, |
|
1650 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1651 |
"minExclusive": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1652 |
"struct": """ |
814 | 1653 |
<minExclusive |
1654 |
fixed = boolean : false |
|
1655 |
id = ID |
|
1656 |
value = anySimpleType |
|
1657 |
{any attributes with non-schema namespace . . .}> |
|
1658 |
Content: (annotation?) |
|
1659 |
</minExclusive>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1660 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1661 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1662 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1663 |
"minExclusive", ["fixed", "id", "value"], ONLY_ANNOTATION) |
814 | 1664 |
}, |
1665 |
"reduce": GenerateFacetReducing("minExclusive", True) |
|
1666 |
}, |
|
1667 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1668 |
"minInclusive": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1669 |
"struct": """ |
814 | 1670 |
<minInclusive |
1671 |
fixed = boolean : false |
|
1672 |
id = ID |
|
1673 |
value = anySimpleType |
|
1674 |
{any attributes with non-schema namespace . . .}> |
|
1675 |
Content: (annotation?) |
|
1676 |
</minInclusive>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1677 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1678 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1679 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1680 |
"minInclusive", ["fixed", "id", "value"], ONLY_ANNOTATION) |
814 | 1681 |
}, |
1682 |
"reduce": GenerateFacetReducing("minInclusive", True) |
|
1683 |
}, |
|
1684 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1685 |
"minLength": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1686 |
"struct": """ |
814 | 1687 |
<minLength |
1688 |
fixed = boolean : false |
|
1689 |
id = ID |
|
1690 |
value = nonNegativeInteger |
|
1691 |
{any attributes with non-schema namespace . . .}> |
|
1692 |
Content: (annotation?) |
|
1693 |
</minLength>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1694 |
"type": SYNTAXELEMENT, |
814 | 1695 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1696 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1697 |
"minLength", ["fixed", "id", "value"], ONLY_ANNOTATION) |
814 | 1698 |
}, |
1699 |
"reduce": GenerateFacetReducing("minLength", True) |
|
1700 |
}, |
|
1701 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1702 |
"pattern": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1703 |
"struct": """ |
814 | 1704 |
<pattern |
1705 |
id = ID |
|
1706 |
value = string |
|
1707 |
{any attributes with non-schema namespace . . .}> |
|
1708 |
Content: (annotation?) |
|
1709 |
</pattern>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1710 |
"type": SYNTAXELEMENT, |
814 | 1711 |
"extract": { |
1712 |
"default": GenerateElement("pattern", ["id", "value"], ONLY_ANNOTATION) |
|
1713 |
}, |
|
1714 |
"reduce": GenerateFacetReducing("pattern", False) |
|
1715 |
}, |
|
1716 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1717 |
"redefine": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1718 |
"struct": """ |
814 | 1719 |
<redefine |
1720 |
id = ID |
|
1721 |
schemaLocation = anyURI |
|
1722 |
{any attributes with non-schema namespace . . .}> |
|
1723 |
Content: (annotation | (simpleType | complexType | group | attributeGroup))* |
|
1724 |
</redefine>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1725 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1726 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1727 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1728 |
"refine", ["id", "schemaLocation"], |
814 | 1729 |
re.compile("((?:annotation |(?:simpleType |complexType |group |attributeGroup ))*)")) |
1730 |
}, |
|
1731 |
"reduce": ReduceRedefine |
|
1732 |
}, |
|
1733 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1734 |
"restriction": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1735 |
"struct": """ |
814 | 1736 |
<restriction |
1737 |
base = QName |
|
1738 |
id = ID |
|
1739 |
{any attributes with non-schema namespace . . .}> |
|
1740 |
Content: (annotation?, (group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)) |
|
1741 |
</restriction>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1742 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1743 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1744 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1745 |
"restriction", |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1746 |
["base", "id"], |
814 | 1747 |
re.compile("((?:annotation )?(?:(?:simpleType )?(?:(?:minExclusive |minInclusive |maxExclusive |maxInclusive |totalDigits |fractionDigits |length |minLength |maxLength |enumeration |whiteSpace |pattern )*)))")), |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1748 |
"simpleContent": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1749 |
"restriction", |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1750 |
["base", "id"], |
814 | 1751 |
re.compile("((?:annotation )?(?:(?:simpleType )?(?:(?:minExclusive |minInclusive |maxExclusive |maxInclusive |totalDigits |fractionDigits |length |minLength |maxLength |enumeration |whiteSpace |pattern )*)?(?:(?:attribute |attributeGroup )*(?:anyAttribute )?)))")), |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1752 |
"complexContent": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1753 |
"restriction", |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1754 |
["base", "id"], |
814 | 1755 |
re.compile("((?:annotation )?(?:(?:simpleType )?(?:group |all |choice |sequence )?(?:(?:attribute |attributeGroup )*(?:anyAttribute )?)))")), |
1756 |
}, |
|
1757 |
"reduce": ReduceRestriction |
|
1758 |
}, |
|
1759 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1760 |
"schema": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1761 |
"struct": """ |
814 | 1762 |
<schema |
1763 |
attributeFormDefault = (qualified | unqualified) : unqualified |
|
1764 |
blockDefault = (#all | List of (extension | restriction | substitution)) : '' |
|
1765 |
elementFormDefault = (qualified | unqualified) : unqualified |
|
1766 |
finalDefault = (#all | List of (extension | restriction | list | union)) : '' |
|
1767 |
id = ID |
|
1768 |
targetNamespace = anyURI |
|
1769 |
version = token |
|
1770 |
xml:lang = language |
|
1771 |
{any attributes with non-schema namespace . . .}> |
|
1772 |
Content: ((include | import | redefine | annotation)*, (((simpleType | complexType | group | attributeGroup) | element | attribute | notation), annotation*)*) |
|
1773 |
</schema>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1774 |
"type": SYNTAXELEMENT, |
814 | 1775 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1776 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1777 |
"schema", |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1778 |
["attributeFormDefault", |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1779 |
"blockDefault", |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1780 |
"elementFormDefault", |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1781 |
"finalDefault", |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1782 |
"id", |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1783 |
"targetNamespace", |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1784 |
"version", |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1785 |
"lang"], |
814 | 1786 |
re.compile("((?:include |import |redefine |annotation )*(?:(?:(?:simpleType |complexType |group |attributeGroup )|element |attribute |annotation )(?:annotation )*)*)")) |
1787 |
} |
|
1788 |
}, |
|
1789 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1790 |
"selector": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1791 |
"struct": """ |
814 | 1792 |
<selector |
1793 |
id = ID |
|
1794 |
xpath = a subset of XPath expression, see below |
|
1795 |
{any attributes with non-schema namespace . . .}> |
|
1796 |
Content: (annotation?) |
|
1797 |
</selector>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1798 |
"type": SYNTAXELEMENT, |
814 | 1799 |
"extract": { |
1800 |
"default": GenerateElement("selector", ["id", "xpath"], ONLY_ANNOTATION) |
|
1801 |
}, |
|
1802 |
"reduce": ReduceSelector |
|
1803 |
}, |
|
1804 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1805 |
"sequence": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1806 |
"struct": """ |
814 | 1807 |
<sequence |
1808 |
id = ID |
|
1809 |
maxOccurs = (nonNegativeInteger | unbounded) : 1 |
|
1810 |
minOccurs = nonNegativeInteger : 1 |
|
1811 |
{any attributes with non-schema namespace . . .}> |
|
1812 |
Content: (annotation?, (element | group | choice | sequence | any)*) |
|
1813 |
</sequence>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1814 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1815 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1816 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1817 |
"sequence", ["id", "maxOccurs", "minOccurs"], |
814 | 1818 |
re.compile("((?:annotation )?(?:element |group |choice |sequence |any )*)")) |
1819 |
}, |
|
1820 |
"reduce": ReduceSequence |
|
1821 |
}, |
|
1822 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1823 |
"simpleContent": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1824 |
"struct": """ |
814 | 1825 |
<simpleContent |
1826 |
id = ID |
|
1827 |
{any attributes with non-schema namespace . . .}> |
|
1828 |
Content: (annotation?, (restriction | extension)) |
|
1829 |
</simpleContent>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1830 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1831 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1832 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1833 |
"simpleContent", ["id"], |
814 | 1834 |
re.compile("((?:annotation )?(?:restriction |extension ))")) |
1835 |
}, |
|
1836 |
"reduce": ReduceSimpleContent |
|
1837 |
}, |
|
1838 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1839 |
"simpleType": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1840 |
"struct": """ |
814 | 1841 |
<simpleType |
1842 |
final = (#all | List of (list | union | restriction)) |
|
1843 |
id = ID |
|
1844 |
name = NCName |
|
1845 |
{any attributes with non-schema namespace . . .}> |
|
1846 |
Content: (annotation?, (restriction | list | union)) |
|
1847 |
</simpleType>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1848 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1849 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1850 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1851 |
"simpleType", ["final", "id", "name"], |
814 | 1852 |
re.compile("((?:annotation )?(?:restriction |list |union ))")) |
1853 |
}, |
|
1854 |
"reduce": ReduceSimpleType |
|
1855 |
}, |
|
1856 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1857 |
"totalDigits": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1858 |
"struct": """ |
814 | 1859 |
<totalDigits |
1860 |
fixed = boolean : false |
|
1861 |
id = ID |
|
1862 |
value = positiveInteger |
|
1863 |
{any attributes with non-schema namespace . . .}> |
|
1864 |
Content: (annotation?) |
|
1865 |
</totalDigits>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1866 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1867 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1868 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1869 |
"totalDigits", ["fixed", "id", "value"], ONLY_ANNOTATION), |
814 | 1870 |
}, |
1871 |
"reduce": GenerateFacetReducing("totalDigits", True) |
|
1872 |
}, |
|
1873 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1874 |
"union": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1875 |
"struct": """ |
814 | 1876 |
<union |
1877 |
id = ID |
|
1878 |
memberTypes = List of QName |
|
1879 |
{any attributes with non-schema namespace . . .}> |
|
1880 |
Content: (annotation?, simpleType*) |
|
1881 |
</union>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1882 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1883 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1884 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1885 |
"union", ["id", "memberTypes"], |
814 | 1886 |
re.compile("((?:annotation )?(?:simpleType )*)")) |
1887 |
}, |
|
1888 |
"reduce": ReduceUnion |
|
1889 |
}, |
|
1890 |
||
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1891 |
"unique": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1892 |
"struct": """ |
814 | 1893 |
<unique |
1894 |
id = ID |
|
1895 |
name = NCName |
|
1896 |
{any attributes with non-schema namespace . . .}> |
|
1897 |
Content: (annotation?, (selector, field+)) |
|
1898 |
</unique>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1899 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1900 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1901 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1902 |
"unique", ["id", "name"], |
814 | 1903 |
re.compile("((?:annotation )?(?:selector |(?:field )+))")) |
1904 |
}, |
|
1905 |
"reduce": ReduceUnique |
|
1906 |
}, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1907 |
|
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1908 |
"whiteSpace": { |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1909 |
"struct": """ |
814 | 1910 |
<whiteSpace |
1911 |
fixed = boolean : false |
|
1912 |
id = ID |
|
1913 |
value = (collapse | preserve | replace) |
|
1914 |
{any attributes with non-schema namespace . . .}> |
|
1915 |
Content: (annotation?) |
|
1916 |
</whiteSpace>""", |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1917 |
"type": SYNTAXELEMENT, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1918 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1919 |
"default": GenerateElement( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1920 |
"whiteSpace", ["fixed", "id", "value"], ONLY_ANNOTATION) |
814 | 1921 |
}, |
1922 |
"reduce": GenerateFacetReducing("whiteSpace", True) |
|
1923 |
}, |
|
1924 |
||
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1780
diff
changeset
|
1925 |
# ------------------------------------------------------------------------------- |
1776
81aa8aaccdd4
clean-up: fix PEP8 E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1775
diff
changeset
|
1926 |
# Syntax attributes definition |
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1780
diff
changeset
|
1927 |
# ------------------------------------------------------------------------------- |
814 | 1928 |
|
1929 |
"abstract": { |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1930 |
"type": SYNTAXATTRIBUTE, |
814 | 1931 |
"extract": { |
1932 |
"default": GetBoolean |
|
1933 |
}, |
|
1934 |
"default": { |
|
1935 |
"default": False |
|
1936 |
} |
|
1937 |
}, |
|
1938 |
||
1939 |
"attributeFormDefault": { |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1940 |
"type": SYNTAXATTRIBUTE, |
814 | 1941 |
"extract": { |
1768
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1942 |
"default": GenerateEnumeratedExtraction( |
691083b5682a
clean-up: fix PEP8 E128 continuation line under-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1767
diff
changeset
|
1943 |
"member attributeFormDefault", ["qualified", "unqualified"]) |
814 | 1944 |
}, |
1945 |
"default": { |
|
1946 |
"default": "unqualified" |
|
1947 |
} |
|
1948 |
}, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1949 |
|
814 | 1950 |
"base": { |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1951 |
"type": SYNTAXATTRIBUTE, |
814 | 1952 |
"extract": { |
1953 |
"default": GenerateModelNameExtraction("member base", QName_model) |
|
1954 |
} |
|
1955 |
}, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1956 |
|
814 | 1957 |
"block": { |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1958 |
"type": SYNTAXATTRIBUTE, |
814 | 1959 |
"extract": { |
1960 |
"default": GenerateGetList("block", ["restriction", "extension", "substitution"]) |
|
1961 |
} |
|
1962 |
}, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1963 |
|
814 | 1964 |
"blockDefault": { |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1965 |
"type": SYNTAXATTRIBUTE, |
814 | 1966 |
"extract": { |
1967 |
"default": GenerateGetList("block", ["restriction", "extension", "substitution"]) |
|
1968 |
}, |
|
1969 |
"default": { |
|
1970 |
"default": "" |
|
1971 |
} |
|
1972 |
}, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1973 |
|
814 | 1974 |
"default": { |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1975 |
"type": SYNTAXATTRIBUTE, |
814 | 1976 |
"extract": { |
1977 |
"default": GetAttributeValue |
|
1978 |
} |
|
1979 |
}, |
|
1980 |
||
1981 |
"elementFormDefault": { |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1982 |
"type": SYNTAXATTRIBUTE, |
814 | 1983 |
"extract": { |
1984 |
"default": GenerateEnumeratedExtraction("member elementFormDefault", ["qualified", "unqualified"]) |
|
1985 |
}, |
|
1986 |
"default": { |
|
1987 |
"default": "unqualified" |
|
1988 |
} |
|
1989 |
}, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1990 |
|
814 | 1991 |
"final": { |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
1992 |
"type": SYNTAXATTRIBUTE, |
814 | 1993 |
"extract": { |
1994 |
"default": GenerateGetList("final", ["restriction", "extension", "substitution"]), |
|
1995 |
"simpleType": GenerateGetList("final", ["list", "union", "restriction"]) |
|
1996 |
} |
|
1997 |
}, |
|
1998 |
||
1999 |
"finalDefault": { |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2000 |
"type": SYNTAXATTRIBUTE, |
814 | 2001 |
"extract": { |
2002 |
"default": GenerateGetList("finalDefault", ["restriction", "extension", "list", "union"]) |
|
2003 |
}, |
|
2004 |
"default": { |
|
2005 |
"default": "" |
|
2006 |
} |
|
2007 |
}, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2008 |
|
814 | 2009 |
"fixed": { |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2010 |
"type": SYNTAXATTRIBUTE, |
814 | 2011 |
"extract": { |
2012 |
"default": GetBoolean, |
|
2013 |
"attribute": GetAttributeValue, |
|
2014 |
"element": GetAttributeValue |
|
2015 |
}, |
|
2016 |
"default": { |
|
2017 |
"default": False, |
|
2018 |
"attribute": None, |
|
2019 |
"element": None |
|
2020 |
} |
|
2021 |
}, |
|
2022 |
||
2023 |
"form": { |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2024 |
"type": SYNTAXATTRIBUTE, |
814 | 2025 |
"extract": { |
2026 |
"default": GenerateEnumeratedExtraction("member form", ["qualified", "unqualified"]) |
|
2027 |
} |
|
2028 |
}, |
|
2029 |
||
2030 |
"id": { |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2031 |
"type": SYNTAXATTRIBUTE, |
814 | 2032 |
"extract": { |
2033 |
"default": GenerateModelNameExtraction("member id", NCName_model) |
|
2034 |
} |
|
2035 |
}, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2036 |
|
814 | 2037 |
"itemType": { |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2038 |
"type": SYNTAXATTRIBUTE, |
814 | 2039 |
"extract": { |
2040 |
"default": GenerateModelNameExtraction("member itemType", QName_model) |
|
2041 |
} |
|
2042 |
}, |
|
2043 |
||
2044 |
"memberTypes": { |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2045 |
"type": SYNTAXATTRIBUTE, |
814 | 2046 |
"extract": { |
2047 |
"default": GenerateModelNameListExtraction("member memberTypes", QNames_model) |
|
2048 |
}, |
|
2049 |
}, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2050 |
|
814 | 2051 |
"maxOccurs": { |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2052 |
"type": SYNTAXATTRIBUTE, |
814 | 2053 |
"extract": { |
2054 |
"default": GenerateLimitExtraction(), |
|
2055 |
"all": GenerateLimitExtraction(1, 1, False) |
|
2056 |
}, |
|
2057 |
"default": { |
|
2058 |
"default": 1 |
|
2059 |
} |
|
2060 |
}, |
|
2061 |
||
2062 |
"minOccurs": { |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2063 |
"type": SYNTAXATTRIBUTE, |
814 | 2064 |
"extract": { |
1744
69dfdb26f600
clean-up: fix PEP8 E251 unexpected spaces around keyword / parameter equals
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1743
diff
changeset
|
2065 |
"default": GenerateLimitExtraction(unbounded=False), |
814 | 2066 |
"all": GenerateLimitExtraction(0, 1, False) |
2067 |
}, |
|
2068 |
"default": { |
|
2069 |
"default": 1 |
|
2070 |
} |
|
2071 |
}, |
|
2072 |
||
2073 |
"mixed": { |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2074 |
"type": SYNTAXATTRIBUTE, |
814 | 2075 |
"extract": { |
2076 |
"default": GetBoolean |
|
2077 |
}, |
|
2078 |
"default": { |
|
2079 |
"default": None, |
|
2080 |
"complexType": False |
|
2081 |
} |
|
2082 |
}, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2083 |
|
814 | 2084 |
"name": { |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2085 |
"type": SYNTAXATTRIBUTE, |
814 | 2086 |
"extract": { |
2087 |
"default": GenerateModelNameExtraction("member name", NCName_model) |
|
2088 |
} |
|
2089 |
}, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2090 |
|
814 | 2091 |
"namespace": { |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2092 |
"type": SYNTAXATTRIBUTE, |
814 | 2093 |
"extract": { |
2094 |
"default": GenerateModelNameExtraction("member namespace", URI_model), |
|
2095 |
"any": GetNamespaces |
|
2096 |
}, |
|
2097 |
"default": { |
|
2098 |
"default": None, |
|
2099 |
"any": "##any" |
|
2100 |
} |
|
2101 |
}, |
|
2102 |
||
2103 |
"nillable": { |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2104 |
"type": SYNTAXATTRIBUTE, |
814 | 2105 |
"extract": { |
2106 |
"default": GetBoolean |
|
2107 |
}, |
|
2108 |
}, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2109 |
|
814 | 2110 |
"processContents": { |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2111 |
"type": SYNTAXATTRIBUTE, |
814 | 2112 |
"extract": { |
2113 |
"default": GenerateEnumeratedExtraction("member processContents", ["lax", "skip", "strict"]) |
|
2114 |
}, |
|
2115 |
"default": { |
|
2116 |
"default": "strict" |
|
2117 |
} |
|
2118 |
}, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2119 |
|
814 | 2120 |
"ref": { |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2121 |
"type": SYNTAXATTRIBUTE, |
814 | 2122 |
"extract": { |
2123 |
"default": GenerateModelNameExtraction("member ref", QName_model) |
|
2124 |
} |
|
2125 |
}, |
|
2126 |
||
2127 |
"refer": { |
|
2128 |
"type": SYNTAXATTRIBUTE, |
|
2129 |
"extract": { |
|
2130 |
"default": GenerateModelNameExtraction("member refer", QName_model) |
|
2131 |
} |
|
2132 |
}, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2133 |
|
814 | 2134 |
"schemaLocation": { |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2135 |
"type": SYNTAXATTRIBUTE, |
814 | 2136 |
"extract": { |
2137 |
"default": GenerateModelNameExtraction("member schemaLocation", URI_model) |
|
2138 |
} |
|
2139 |
}, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2140 |
|
814 | 2141 |
"source": { |
2142 |
"type": SYNTAXATTRIBUTE, |
|
2143 |
"extract": { |
|
2144 |
"default": GenerateModelNameExtraction("member source", URI_model) |
|
2145 |
} |
|
2146 |
}, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2147 |
|
814 | 2148 |
"substitutionGroup": { |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2149 |
"type": SYNTAXATTRIBUTE, |
814 | 2150 |
"extract": { |
2151 |
"default": GenerateModelNameExtraction("member substitutionGroup", QName_model) |
|
2152 |
} |
|
2153 |
}, |
|
2154 |
||
2155 |
"targetNamespace": { |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2156 |
"type": SYNTAXATTRIBUTE, |
814 | 2157 |
"extract": { |
2158 |
"default": GenerateModelNameExtraction("member targetNamespace", URI_model) |
|
2159 |
} |
|
2160 |
}, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2161 |
|
814 | 2162 |
"type": { |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2163 |
"type": SYNTAXATTRIBUTE, |
814 | 2164 |
"extract": { |
2165 |
"default": GenerateModelNameExtraction("member type", QName_model) |
|
2166 |
} |
|
2167 |
}, |
|
2168 |
||
2169 |
"use": { |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2170 |
"type": SYNTAXATTRIBUTE, |
814 | 2171 |
"extract": { |
2172 |
"default": GenerateEnumeratedExtraction("member usage", ["required", "optional", "prohibited"]) |
|
2173 |
}, |
|
2174 |
"default": { |
|
2175 |
"default": "optional" |
|
2176 |
} |
|
2177 |
}, |
|
2178 |
||
2179 |
"value": { |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2180 |
"type": SYNTAXATTRIBUTE, |
814 | 2181 |
"extract": { |
2182 |
"default": GetAttributeValue, |
|
2183 |
"fractionDigits": GenerateIntegerExtraction(minInclusive=0), |
|
2184 |
"length": GenerateIntegerExtraction(minInclusive=0), |
|
2185 |
"maxLength": GenerateIntegerExtraction(minInclusive=0), |
|
2186 |
"minLength": GenerateIntegerExtraction(minInclusive=0), |
|
2187 |
"totalDigits": GenerateIntegerExtraction(minExclusive=0), |
|
2188 |
"whiteSpace": GenerateEnumeratedExtraction("value", ["collapse", "preserve", "replace"]) |
|
2189 |
} |
|
2190 |
}, |
|
2191 |
||
2192 |
"version": { |
|
2193 |
"type": SYNTAXATTRIBUTE, |
|
2194 |
"extract": { |
|
2195 |
"default": GetToken |
|
2196 |
} |
|
2197 |
}, |
|
2198 |
||
2199 |
"xpath": { |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2200 |
"type": SYNTAXATTRIBUTE, |
814 | 2201 |
"extract": { |
1776
81aa8aaccdd4
clean-up: fix PEP8 E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1775
diff
changeset
|
2202 |
# "default": NotSupportedYet("xpath") |
814 | 2203 |
"default": GetAttributeValue |
2204 |
} |
|
2205 |
}, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2206 |
|
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1780
diff
changeset
|
2207 |
# ------------------------------------------------------------------------------- |
1776
81aa8aaccdd4
clean-up: fix PEP8 E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1775
diff
changeset
|
2208 |
# Simple types definition |
1782
5b6ad7a7fd9d
clean-up: fix PEP8 E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1780
diff
changeset
|
2209 |
# ------------------------------------------------------------------------------- |
814 | 2210 |
|
2211 |
"string": { |
|
2212 |
"type": SIMPLETYPE, |
|
2213 |
"basename": "string", |
|
2214 |
"extract": GetAttributeValue, |
|
2215 |
"facets": STRING_FACETS, |
|
1739
ec153828ded2
clean-up: fix PEP8 E203 whitespace before ':' and whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1736
diff
changeset
|
2216 |
"generate": GenerateSimpleTypeXMLText(lambda x: x), |
814 | 2217 |
"initial": lambda: "", |
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2218 |
"check": lambda x: isinstance(x, string_types)}, |
814 | 2219 |
|
2220 |
"normalizedString": { |
|
2221 |
"type": SIMPLETYPE, |
|
2222 |
"basename": "normalizedString", |
|
2223 |
"extract": GetNormalizedString, |
|
2224 |
"facets": STRING_FACETS, |
|
1739
ec153828ded2
clean-up: fix PEP8 E203 whitespace before ':' and whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1736
diff
changeset
|
2225 |
"generate": GenerateSimpleTypeXMLText(lambda x: x), |
814 | 2226 |
"initial": lambda: "", |
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2227 |
"check": lambda x: isinstance(x, string_types) |
814 | 2228 |
}, |
2229 |
||
2230 |
"token": { |
|
2231 |
"type": SIMPLETYPE, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2232 |
"basename": "token", |
814 | 2233 |
"extract": GetToken, |
2234 |
"facets": STRING_FACETS, |
|
1739
ec153828ded2
clean-up: fix PEP8 E203 whitespace before ':' and whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1736
diff
changeset
|
2235 |
"generate": GenerateSimpleTypeXMLText(lambda x: x), |
814 | 2236 |
"initial": lambda: "", |
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2237 |
"check": lambda x: isinstance(x, string_types) |
814 | 2238 |
}, |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2239 |
|
814 | 2240 |
"base64Binary": { |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2241 |
"type": SIMPLETYPE, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2242 |
"basename": "base64Binary", |
814 | 2243 |
"extract": NotSupportedYet("base64Binary"), |
2244 |
"facets": STRING_FACETS, |
|
2245 |
"generate": GenerateSimpleTypeXMLText(str), |
|
2246 |
"initial": lambda: 0, |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2247 |
"check": lambda x: isinstance(x, (int, long)) |
814 | 2248 |
}, |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2249 |
|
814 | 2250 |
"hexBinary": { |
2251 |
"type": SIMPLETYPE, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2252 |
"basename": "hexBinary", |
814 | 2253 |
"extract": GetHexInteger, |
2254 |
"facets": STRING_FACETS, |
|
1734
750eeb7230a1
clean-up: fix some PEP8 E228 missing whitespace around modulo operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1732
diff
changeset
|
2255 |
"generate": GenerateSimpleTypeXMLText(lambda x: ("%."+str(int(round(len("%X" % x)/2.)*2))+"X") % x), |
814 | 2256 |
"initial": lambda: 0, |
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2257 |
"check": lambda x: isinstance(x, (int, long)) |
814 | 2258 |
}, |
2259 |
||
2260 |
"integer": { |
|
2261 |
"type": SIMPLETYPE, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2262 |
"basename": "integer", |
814 | 2263 |
"extract": GenerateIntegerExtraction(), |
2264 |
"facets": DECIMAL_FACETS, |
|
2265 |
"generate": GenerateSimpleTypeXMLText(str), |
|
2266 |
"initial": lambda: 0, |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2267 |
"check": lambda x: isinstance(x, int) |
814 | 2268 |
}, |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2269 |
|
814 | 2270 |
"positiveInteger": { |
2271 |
"type": SIMPLETYPE, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2272 |
"basename": "positiveInteger", |
814 | 2273 |
"extract": GenerateIntegerExtraction(minExclusive=0), |
2274 |
"facets": DECIMAL_FACETS, |
|
2275 |
"generate": GenerateSimpleTypeXMLText(str), |
|
1078
f0ea86d830ed
Fixed wrong default value for xsd:positiveInteger and xsd:negativeInteger in xmlclass
Laurent Bessard
parents:
814
diff
changeset
|
2276 |
"initial": lambda: 1, |
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2277 |
"check": lambda x: isinstance(x, int) |
814 | 2278 |
}, |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2279 |
|
814 | 2280 |
"negativeInteger": { |
2281 |
"type": SIMPLETYPE, |
|
2282 |
"basename": "negativeInteger", |
|
2283 |
"extract": GenerateIntegerExtraction(maxExclusive=0), |
|
2284 |
"facets": DECIMAL_FACETS, |
|
2285 |
"generate": GenerateSimpleTypeXMLText(str), |
|
1078
f0ea86d830ed
Fixed wrong default value for xsd:positiveInteger and xsd:negativeInteger in xmlclass
Laurent Bessard
parents:
814
diff
changeset
|
2286 |
"initial": lambda: -1, |
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2287 |
"check": lambda x: isinstance(x, int) |
814 | 2288 |
}, |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2289 |
|
814 | 2290 |
"nonNegativeInteger": { |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2291 |
"type": SIMPLETYPE, |
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2292 |
"basename": "nonNegativeInteger", |
814 | 2293 |
"extract": GenerateIntegerExtraction(minInclusive=0), |
2294 |
"facets": DECIMAL_FACETS, |
|
2295 |
"generate": GenerateSimpleTypeXMLText(str), |
|
2296 |
"initial": lambda: 0, |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2297 |
"check": lambda x: isinstance(x, int) |
814 | 2298 |
}, |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2299 |
|
814 | 2300 |
"nonPositiveInteger": { |
2301 |
"type": SIMPLETYPE, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2302 |
"basename": "nonPositiveInteger", |
814 | 2303 |
"extract": GenerateIntegerExtraction(maxInclusive=0), |
2304 |
"facets": DECIMAL_FACETS, |
|
2305 |
"generate": GenerateSimpleTypeXMLText(str), |
|
2306 |
"initial": lambda: 0, |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2307 |
"check": lambda x: isinstance(x, int) |
814 | 2308 |
}, |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2309 |
|
814 | 2310 |
"long": { |
2311 |
"type": SIMPLETYPE, |
|
2312 |
"basename": "long", |
|
1740
b789b695b5c6
clean-up: fix PEP8 E231 missing whitespace after ':' or ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1739
diff
changeset
|
2313 |
"extract": GenerateIntegerExtraction(minInclusive=-2**63, maxExclusive=2**63), |
814 | 2314 |
"facets": DECIMAL_FACETS, |
2315 |
"generate": GenerateSimpleTypeXMLText(str), |
|
2316 |
"initial": lambda: 0, |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2317 |
"check": lambda x: isinstance(x, int) |
814 | 2318 |
}, |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2319 |
|
814 | 2320 |
"unsignedLong": { |
2321 |
"type": SIMPLETYPE, |
|
2322 |
"basename": "unsignedLong", |
|
1740
b789b695b5c6
clean-up: fix PEP8 E231 missing whitespace after ':' or ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1739
diff
changeset
|
2323 |
"extract": GenerateIntegerExtraction(minInclusive=0, maxExclusive=2**64), |
814 | 2324 |
"facets": DECIMAL_FACETS, |
2325 |
"generate": GenerateSimpleTypeXMLText(str), |
|
2326 |
"initial": lambda: 0, |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2327 |
"check": lambda x: isinstance(x, int) |
814 | 2328 |
}, |
2329 |
||
2330 |
"int": { |
|
2331 |
"type": SIMPLETYPE, |
|
2332 |
"basename": "int", |
|
1740
b789b695b5c6
clean-up: fix PEP8 E231 missing whitespace after ':' or ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1739
diff
changeset
|
2333 |
"extract": GenerateIntegerExtraction(minInclusive=-2**31, maxExclusive=2**31), |
814 | 2334 |
"facets": DECIMAL_FACETS, |
2335 |
"generate": GenerateSimpleTypeXMLText(str), |
|
2336 |
"initial": lambda: 0, |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2337 |
"check": lambda x: isinstance(x, int) |
814 | 2338 |
}, |
2339 |
||
2340 |
"unsignedInt": { |
|
2341 |
"type": SIMPLETYPE, |
|
2342 |
"basename": "unsignedInt", |
|
1740
b789b695b5c6
clean-up: fix PEP8 E231 missing whitespace after ':' or ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1739
diff
changeset
|
2343 |
"extract": GenerateIntegerExtraction(minInclusive=0, maxExclusive=2**32), |
814 | 2344 |
"facets": DECIMAL_FACETS, |
2345 |
"generate": GenerateSimpleTypeXMLText(str), |
|
2346 |
"initial": lambda: 0, |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2347 |
"check": lambda x: isinstance(x, int) |
814 | 2348 |
}, |
2349 |
||
2350 |
"short": { |
|
2351 |
"type": SIMPLETYPE, |
|
2352 |
"basename": "short", |
|
1740
b789b695b5c6
clean-up: fix PEP8 E231 missing whitespace after ':' or ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1739
diff
changeset
|
2353 |
"extract": GenerateIntegerExtraction(minInclusive=-2**15, maxExclusive=2**15), |
814 | 2354 |
"facets": DECIMAL_FACETS, |
2355 |
"generate": GenerateSimpleTypeXMLText(str), |
|
2356 |
"initial": lambda: 0, |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2357 |
"check": lambda x: isinstance(x, int) |
814 | 2358 |
}, |
2359 |
||
2360 |
"unsignedShort": { |
|
2361 |
"type": SIMPLETYPE, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2362 |
"basename": "unsignedShort", |
1740
b789b695b5c6
clean-up: fix PEP8 E231 missing whitespace after ':' or ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1739
diff
changeset
|
2363 |
"extract": GenerateIntegerExtraction(minInclusive=0, maxExclusive=2**16), |
814 | 2364 |
"facets": DECIMAL_FACETS, |
2365 |
"generate": GenerateSimpleTypeXMLText(str), |
|
2366 |
"initial": lambda: 0, |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2367 |
"check": lambda x: isinstance(x, int) |
814 | 2368 |
}, |
2369 |
||
2370 |
"byte": { |
|
2371 |
"type": SIMPLETYPE, |
|
2372 |
"basename": "byte", |
|
1740
b789b695b5c6
clean-up: fix PEP8 E231 missing whitespace after ':' or ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1739
diff
changeset
|
2373 |
"extract": GenerateIntegerExtraction(minInclusive=-2**7, maxExclusive=2**7), |
814 | 2374 |
"facets": DECIMAL_FACETS, |
2375 |
"generate": GenerateSimpleTypeXMLText(str), |
|
2376 |
"initial": lambda: 0, |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2377 |
"check": lambda x: isinstance(x, int) |
814 | 2378 |
}, |
2379 |
||
2380 |
"unsignedByte": { |
|
2381 |
"type": SIMPLETYPE, |
|
2382 |
"basename": "unsignedByte", |
|
1740
b789b695b5c6
clean-up: fix PEP8 E231 missing whitespace after ':' or ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1739
diff
changeset
|
2383 |
"extract": GenerateIntegerExtraction(minInclusive=0, maxExclusive=2**8), |
814 | 2384 |
"facets": DECIMAL_FACETS, |
2385 |
"generate": GenerateSimpleTypeXMLText(str), |
|
2386 |
"initial": lambda: 0, |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2387 |
"check": lambda x: isinstance(x, int) |
814 | 2388 |
}, |
2389 |
||
2390 |
"decimal": { |
|
2391 |
"type": SIMPLETYPE, |
|
2392 |
"basename": "decimal", |
|
2393 |
"extract": GenerateFloatExtraction("decimal"), |
|
2394 |
"facets": DECIMAL_FACETS, |
|
1373
4278d5c1e414
Fixed bug when graphic element position and size and connection points are decimal
Laurent Bessard
parents:
1322
diff
changeset
|
2395 |
"generate": GenerateFloatXMLText(decimal=3), |
814 | 2396 |
"initial": lambda: 0., |
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2397 |
"check": lambda x: isinstance(x, (int, float)) |
814 | 2398 |
}, |
2399 |
||
2400 |
"float": { |
|
2401 |
"type": SIMPLETYPE, |
|
2402 |
"basename": "float", |
|
2403 |
"extract": GenerateFloatExtraction("float", ["INF", "-INF", "NaN"]), |
|
2404 |
"facets": NUMBER_FACETS, |
|
2405 |
"generate": GenerateFloatXMLText(["INF", "-INF", "NaN"]), |
|
2406 |
"initial": lambda: 0., |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2407 |
"check": lambda x: {"INF": True, "-INF": True, "NaN": True}.get(x, isinstance(x, (int, float))) |
814 | 2408 |
}, |
2409 |
||
2410 |
"double": { |
|
2411 |
"type": SIMPLETYPE, |
|
2412 |
"basename": "double", |
|
2413 |
"extract": GenerateFloatExtraction("double", ["INF", "-INF", "NaN"]), |
|
2414 |
"facets": NUMBER_FACETS, |
|
2415 |
"generate": GenerateFloatXMLText(["INF", "-INF", "NaN"]), |
|
2416 |
"initial": lambda: 0., |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2417 |
"check": lambda x: {"INF": True, "-INF": True, "NaN": True}.get(x, isinstance(x, (int, float))) |
814 | 2418 |
}, |
2419 |
||
2420 |
"boolean": { |
|
2421 |
"type": SIMPLETYPE, |
|
2422 |
"basename": "boolean", |
|
2423 |
"extract": GetBoolean, |
|
2424 |
"facets": GenerateDictFacets(["pattern", "whiteSpace"]), |
|
1740
b789b695b5c6
clean-up: fix PEP8 E231 missing whitespace after ':' or ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1739
diff
changeset
|
2425 |
"generate": GenerateSimpleTypeXMLText(lambda x: {True: "true", False: "false"}[x]), |
814 | 2426 |
"initial": lambda: False, |
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2427 |
"check": lambda x: isinstance(x, bool) |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2428 |
}, |
814 | 2429 |
|
2430 |
"duration": { |
|
2431 |
"type": SIMPLETYPE, |
|
2432 |
"basename": "duration", |
|
2433 |
"extract": NotSupportedYet("duration"), |
|
2434 |
"facets": NUMBER_FACETS, |
|
2435 |
"generate": GenerateSimpleTypeXMLText(str), |
|
2436 |
"initial": lambda: "", |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2437 |
"check": lambda x: isinstance(x, string_types) |
814 | 2438 |
}, |
2439 |
||
2440 |
"dateTime": { |
|
2441 |
"type": SIMPLETYPE, |
|
2442 |
"basename": "dateTime", |
|
2443 |
"extract": GetDateTime, |
|
2444 |
"facets": NUMBER_FACETS, |
|
2445 |
"generate": GenerateSimpleTypeXMLText(datetime.datetime.isoformat), |
|
1740
b789b695b5c6
clean-up: fix PEP8 E231 missing whitespace after ':' or ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1739
diff
changeset
|
2446 |
"initial": lambda: datetime.datetime(1, 1, 1, 0, 0, 0, 0), |
814 | 2447 |
"check": lambda x: isinstance(x, datetime.datetime) |
2448 |
}, |
|
2449 |
||
2450 |
"date": { |
|
2451 |
"type": SIMPLETYPE, |
|
2452 |
"basename": "date", |
|
2453 |
"extract": GetDate, |
|
2454 |
"facets": NUMBER_FACETS, |
|
2455 |
"generate": GenerateSimpleTypeXMLText(datetime.date.isoformat), |
|
1740
b789b695b5c6
clean-up: fix PEP8 E231 missing whitespace after ':' or ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1739
diff
changeset
|
2456 |
"initial": lambda: datetime.date(1, 1, 1), |
814 | 2457 |
"check": lambda x: isinstance(x, datetime.date) |
2458 |
}, |
|
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2459 |
|
814 | 2460 |
"time": { |
2461 |
"type": SIMPLETYPE, |
|
2462 |
"basename": "time", |
|
2463 |
"extract": GetTime, |
|
2464 |
"facets": NUMBER_FACETS, |
|
2465 |
"generate": GenerateSimpleTypeXMLText(datetime.time.isoformat), |
|
1740
b789b695b5c6
clean-up: fix PEP8 E231 missing whitespace after ':' or ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1739
diff
changeset
|
2466 |
"initial": lambda: datetime.time(0, 0, 0, 0), |
814 | 2467 |
"check": lambda x: isinstance(x, datetime.time) |
2468 |
}, |
|
2469 |
||
2470 |
"gYear": { |
|
2471 |
"type": SIMPLETYPE, |
|
2472 |
"basename": "gYear", |
|
2473 |
"extract": NotSupportedYet("gYear"), |
|
2474 |
"facets": NUMBER_FACETS, |
|
2475 |
"generate": GenerateSimpleTypeXMLText(str), |
|
2476 |
"initial": lambda: "", |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2477 |
"check": lambda x: isinstance(x, string_types) |
814 | 2478 |
}, |
2479 |
||
2480 |
"gYearMonth": { |
|
2481 |
"type": SIMPLETYPE, |
|
2482 |
"basename": "gYearMonth", |
|
2483 |
"extract": NotSupportedYet("gYearMonth"), |
|
2484 |
"facets": NUMBER_FACETS, |
|
2485 |
"generate": GenerateSimpleTypeXMLText(str), |
|
2486 |
"initial": lambda: "", |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2487 |
"check": lambda x: isinstance(x, string_types) |
814 | 2488 |
}, |
2489 |
||
2490 |
"gMonth": { |
|
2491 |
"type": SIMPLETYPE, |
|
2492 |
"basename": "gMonth", |
|
2493 |
"extract": NotSupportedYet("gMonth"), |
|
2494 |
"facets": NUMBER_FACETS, |
|
2495 |
"generate": GenerateSimpleTypeXMLText(str), |
|
2496 |
"initial": lambda: "", |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2497 |
"check": lambda x: isinstance(x, string_types) |
814 | 2498 |
}, |
2499 |
||
2500 |
"gMonthDay": { |
|
2501 |
"type": SIMPLETYPE, |
|
2502 |
"basename": "gMonthDay", |
|
2503 |
"extract": NotSupportedYet("gMonthDay"), |
|
2504 |
"facets": NUMBER_FACETS, |
|
2505 |
"generate": GenerateSimpleTypeXMLText(str), |
|
2506 |
"initial": lambda: "", |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2507 |
"check": lambda x: isinstance(x, string_types) |
814 | 2508 |
}, |
2509 |
||
2510 |
"gDay": { |
|
2511 |
"type": SIMPLETYPE, |
|
2512 |
"basename": "gDay", |
|
2513 |
"extract": NotSupportedYet("gDay"), |
|
2514 |
"facets": NUMBER_FACETS, |
|
2515 |
"generate": GenerateSimpleTypeXMLText(str), |
|
2516 |
"initial": lambda: "", |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2517 |
"check": lambda x: isinstance(x, string_types) |
814 | 2518 |
}, |
2519 |
||
2520 |
"Name": { |
|
2521 |
"type": SIMPLETYPE, |
|
2522 |
"basename": "Name", |
|
2523 |
"extract": GenerateModelNameExtraction("Name", Name_model), |
|
2524 |
"facets": STRING_FACETS, |
|
2525 |
"generate": GenerateSimpleTypeXMLText(lambda x: x), |
|
2526 |
"initial": lambda: "", |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2527 |
"check": lambda x: isinstance(x, string_types) |
814 | 2528 |
}, |
1730
64d8f52bc8c8
clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1683
diff
changeset
|
2529 |
|
814 | 2530 |
"QName": { |
2531 |
"type": SIMPLETYPE, |
|
2532 |
"basename": "QName", |
|
2533 |
"extract": GenerateModelNameExtraction("QName", QName_model), |
|
2534 |
"facets": STRING_FACETS, |
|
2535 |
"generate": GenerateSimpleTypeXMLText(lambda x: x), |
|
2536 |
"initial": lambda: "", |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2537 |
"check": lambda x: isinstance(x, string_types) |
814 | 2538 |
}, |
2539 |
||
2540 |
"NCName": { |
|
2541 |
"type": SIMPLETYPE, |
|
2542 |
"basename": "NCName", |
|
2543 |
"extract": GenerateModelNameExtraction("NCName", NCName_model), |
|
2544 |
"facets": STRING_FACETS, |
|
2545 |
"generate": GenerateSimpleTypeXMLText(lambda x: x), |
|
2546 |
"initial": lambda: "", |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2547 |
"check": lambda x: isinstance(x, string_types) |
814 | 2548 |
}, |
2549 |
||
2550 |
"anyURI": { |
|
2551 |
"type": SIMPLETYPE, |
|
2552 |
"basename": "anyURI", |
|
2553 |
"extract": GenerateModelNameExtraction("anyURI", URI_model), |
|
2554 |
"facets": STRING_FACETS, |
|
2555 |
"generate": GenerateSimpleTypeXMLText(lambda x: x), |
|
2556 |
"initial": lambda: "", |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2557 |
"check": lambda x: isinstance(x, string_types) |
814 | 2558 |
}, |
2559 |
||
2560 |
"language": { |
|
2561 |
"type": SIMPLETYPE, |
|
2562 |
"basename": "language", |
|
2563 |
"extract": GenerateModelNameExtraction("language", LANGUAGE_model), |
|
2564 |
"facets": STRING_FACETS, |
|
2565 |
"generate": GenerateSimpleTypeXMLText(lambda x: x), |
|
2566 |
"initial": lambda: "en", |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2567 |
"check": lambda x: isinstance(x, string_types) |
814 | 2568 |
}, |
2569 |
||
2570 |
"ID": { |
|
2571 |
"type": SIMPLETYPE, |
|
2572 |
"basename": "ID", |
|
2573 |
"extract": GenerateModelNameExtraction("ID", Name_model), |
|
2574 |
"facets": STRING_FACETS, |
|
2575 |
"generate": GenerateSimpleTypeXMLText(lambda x: x), |
|
2576 |
"initial": lambda: "", |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2577 |
"check": lambda x: isinstance(x, string_types) |
814 | 2578 |
}, |
2579 |
||
2580 |
"IDREF": { |
|
2581 |
"type": SIMPLETYPE, |
|
2582 |
"basename": "IDREF", |
|
2583 |
"extract": GenerateModelNameExtraction("IDREF", Name_model), |
|
2584 |
"facets": STRING_FACETS, |
|
2585 |
"generate": GenerateSimpleTypeXMLText(lambda x: x), |
|
2586 |
"initial": lambda: "", |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2587 |
"check": lambda x: isinstance(x, string_types) |
814 | 2588 |
}, |
2589 |
||
2590 |
"IDREFS": { |
|
2591 |
"type": SIMPLETYPE, |
|
2592 |
"basename": "IDREFS", |
|
2593 |
"extract": GenerateModelNameExtraction("IDREFS", Names_model), |
|
2594 |
"facets": STRING_FACETS, |
|
2595 |
"generate": GenerateSimpleTypeXMLText(lambda x: x), |
|
2596 |
"initial": lambda: "", |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2597 |
"check": lambda x: isinstance(x, string_types) |
814 | 2598 |
}, |
2599 |
||
2600 |
"ENTITY": { |
|
2601 |
"type": SIMPLETYPE, |
|
2602 |
"basename": "ENTITY", |
|
2603 |
"extract": GenerateModelNameExtraction("ENTITY", Name_model), |
|
2604 |
"facets": STRING_FACETS, |
|
2605 |
"generate": GenerateSimpleTypeXMLText(lambda x: x), |
|
2606 |
"initial": lambda: "", |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2607 |
"check": lambda x: isinstance(x, string_types) |
814 | 2608 |
}, |
2609 |
||
2610 |
"ENTITIES": { |
|
2611 |
"type": SIMPLETYPE, |
|
2612 |
"basename": "ENTITIES", |
|
2613 |
"extract": GenerateModelNameExtraction("ENTITIES", Names_model), |
|
2614 |
"facets": STRING_FACETS, |
|
2615 |
"generate": GenerateSimpleTypeXMLText(lambda x: x), |
|
2616 |
"initial": lambda: "", |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2617 |
"check": lambda x: isinstance(x, string_types) |
814 | 2618 |
}, |
2619 |
||
2620 |
"NOTATION": { |
|
2621 |
"type": SIMPLETYPE, |
|
2622 |
"basename": "NOTATION", |
|
2623 |
"extract": GenerateModelNameExtraction("NOTATION", Name_model), |
|
2624 |
"facets": STRING_FACETS, |
|
2625 |
"generate": GenerateSimpleTypeXMLText(lambda x: x), |
|
2626 |
"initial": lambda: "", |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2627 |
"check": lambda x: isinstance(x, string_types) |
814 | 2628 |
}, |
2629 |
||
2630 |
"NMTOKEN": { |
|
2631 |
"type": SIMPLETYPE, |
|
2632 |
"basename": "NMTOKEN", |
|
2633 |
"extract": GenerateModelNameExtraction("NMTOKEN", NMToken_model), |
|
2634 |
"facets": STRING_FACETS, |
|
2635 |
"generate": GenerateSimpleTypeXMLText(lambda x: x), |
|
2636 |
"initial": lambda: "", |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2637 |
"check": lambda x: isinstance(x, string_types) |
814 | 2638 |
}, |
2639 |
||
2640 |
"NMTOKENS": { |
|
2641 |
"type": SIMPLETYPE, |
|
2642 |
"basename": "NMTOKENS", |
|
2643 |
"extract": GenerateModelNameExtraction("NMTOKENS", NMTokens_model), |
|
2644 |
"facets": STRING_FACETS, |
|
2645 |
"generate": GenerateSimpleTypeXMLText(lambda x: x), |
|
2646 |
"initial": lambda: "", |
|
2450
5024c19ca8f0
python3 support: pylint, W1652 # (deprecated-types-field) Accessing a deprecated fields on the types module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1872
diff
changeset
|
2647 |
"check": lambda x: isinstance(x, string_types) |
814 | 2648 |
}, |
2649 |
||
2650 |
# Complex Types |
|
1740
b789b695b5c6
clean-up: fix PEP8 E231 missing whitespace after ':' or ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1739
diff
changeset
|
2651 |
"anyType": {"type": COMPLEXTYPE, "extract": lambda x: None}, |
814 | 2652 |
} |