Debian Codegraph @

gavo/stc/utypeast.py

raw symbols SCIP
1 """
2 Parse utype sets into ASTs.
3
4 The rough plan is to build an ElementTree from a sequence of
5 utype/value pairs (as returned by utypegen.getUtypes). This
6 ElementTree can then be used to build an AST using stcxast. The ElementTree
7 contains common.ColRefs and thus cannot be serialized to an XML string.
8
9 Most of the magic happens in utypeParseToTree, where the utypes are
10 dissected; it is important that the utypes sequence passed to this
11 is sorted such that utypes for things below an STC-X node are actually
12 immediately below the utype pair for their parent.
13 """
14
15 #c Copyright 2008-2025, the GAVO project <[email protected]>
16 #c
17 #c This program is free software, covered by the GNU GPL. See the
18 #c COPYING file in the source distribution.
19
20
21 from gavoscip-python python gavodachs 2.13 gavo/__init__: import utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:
22 from gavo.stcscip-python python gavodachs 2.13 `gavo.stc`/__init__: import commonscip-python python gavodachs 2.13 `gavo.stc.common`/__init__:
23 from gavo.stcscip-python python gavodachs 2.13 `gavo.stc`/__init__: import stcxastscip-python python gavodachs 2.13 `gavo.stc.stcxast`/__init__:
24 from gavo.utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__: import ElementTreescip-python python python-stdlib 3.11 `xml.etree.ElementTree`/__init__:
25
26
27 def parseUtypescip-python python gavodachs 2.13 `gavo.stc.utypeast`/parseUtype().(utypescip-python python gavodachs 2.13 `gavo.stc.utypeast`/parseUtype().(utype)):
28 if utypescip-python python gavodachs 2.13 `gavo.stc.utypeast`/parseUtype().(utype) is None:
29 return None
30 return tuplescip-python python python-stdlib 3.11 builtins/tuple#(utypescip-python python gavodachs 2.13 `gavo.stc.utypeast`/parseUtype().(utype).split(":")[-1].split("."))
31
32
33 class _Attributescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Attribute#(objectscip-python python python-stdlib 3.11 builtins/object#):
34 """a "value" for utypePairsToTree that causes an attribute to be set
35 on an element.
36
37 This is something a morph function would return.
38 """
39 def __init__scip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Attribute#__init__().(selfscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Attribute#__init__().(self), namescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Attribute#__init__().(name), valuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Attribute#__init__().(value)):
40 selfscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Attribute#__init__().(self).namescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Attribute#name., selfscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Attribute#__init__().(self).valuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Attribute#value. = namescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Attribute#__init__().(name), valuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Attribute#__init__().(value)
41
42
43 class _Childscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Child#(objectscip-python python python-stdlib 3.11 builtins/object#):
44 """a "value" for utypesParisToTree that causes a child to be appended
45
46 This is for morph functions on substitution groups.
47 """
48 def __init__scip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Child#__init__().(selfscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Child#__init__().(self), namescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Child#__init__().(name), valuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Child#__init__().(value)):
49 selfscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Child#__init__().(self).namescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Child#name., selfscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Child#__init__().(self).valuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Child#value. = namescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Child#__init__().(name), valuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Child#__init__().(value)
50
51
52 def _unifyTuplesscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_unifyTuples().(fromTuplescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_unifyTuples().(fromTuple), toTuplescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_unifyTuples().(toTuple)):
53 """returns a pair fromTail, toTail of tuples to bring fromTuple to toTuple.
54
55 This is done such that fromTuple-fromTuple+toTail=toTuple for "appending"
56 semantics.
57 """
58 if toTuplescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_unifyTuples().(toTuple) is None:
59 return (), ()
60 prefixLen = utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.commonPrefixLengthscip-python python gavodachs 2.13 `gavo.utils.algotricks`/commonPrefixLength().(fromTuplescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_unifyTuples().(fromTuple), toTuplescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_unifyTuples().(toTuple))
61 return fromTuplescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_unifyTuples().(fromTuple)[prefixLen:], toTuplescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_unifyTuples().(toTuple)[prefixLen:]
62
63
64 def _replaceLastWithValuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_replaceLastWithValue().(utypescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_replaceLastWithValue().(utype), valuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_replaceLastWithValue().(value)):
65 yield ".".joinscip-python python python-stdlib 3.11 builtins/str#join().(parseUtypescip-python python gavodachs 2.13 `gavo.stc.utypeast`/parseUtype().(utypescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_replaceLastWithValue().(utype))[:-1])+"."+valuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_replaceLastWithValue().(value), None
66
67 def _makeCoordFlavorscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeCoordFlavor().(utypescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeCoordFlavor().(utype), valuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeCoordFlavor().(value)):
68 # in addition to fixing syntax, we give a default for coord_naxis.
69 # User settings would overwrite that.
70 for pair in _replaceLastWithValuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_replaceLastWithValue().(utypescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeCoordFlavor().(utype), valuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeCoordFlavor().(value)):
71 yield pair
72 yield None, _Attributescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Attribute#("coord_naxes", "2")
73
74 def _makeAttributeMakerscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeAttributeMaker().(attNamescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeAttributeMaker().(attName)):
75 def makeAttributescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeAttributeMaker().makeAttribute().(utypescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeAttributeMaker().makeAttribute().(utype), valuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeAttributeMaker().makeAttribute().(value)):
76 yield None, _Attributescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Attribute#(attNamescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeAttributeMaker().(attName), valuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeAttributeMaker().makeAttribute().(value))
77 return makeAttributescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeAttributeMaker().makeAttribute().
78
79 def _makeParentAttributeMakerscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeParentAttributeMaker().(attNamescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeParentAttributeMaker().(attName)):
80 def makeAttributescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeParentAttributeMaker().makeAttribute().(utypescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeParentAttributeMaker().makeAttribute().(utype), valuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeParentAttributeMaker().makeAttribute().(value)):
81 yield ".".joinscip-python python python-stdlib 3.11 builtins/str#join().(parseUtypescip-python python gavodachs 2.13 `gavo.stc.utypeast`/parseUtype().(utypescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeParentAttributeMaker().makeAttribute().(utype))[:-1]), _Attributescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Attribute#(attNamescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeParentAttributeMaker().(attName), valuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeParentAttributeMaker().makeAttribute().(value))
82 return makeAttributescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeParentAttributeMaker().makeAttribute().
83
84 def _makeChildMakerscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeChildMaker().(childNamescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeChildMaker().(childName)):
85 def makeChildscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeChildMaker().makeChild().(utypescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeChildMaker().makeChild().(utype), valuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeChildMaker().makeChild().(value)):
86 yield None, _Childscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Child#(childNamescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeChildMaker().(childName), valuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeChildMaker().makeChild().(value))
87 return makeChildscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeChildMaker().makeChild().
88
89
90 def _replaceUtypescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_replaceUtype().(utypescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_replaceUtype().(utype)):
91 def replacerscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_replaceUtype().replacer().(_, valuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_replaceUtype().replacer().(value)):
92 yield utypescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_replaceUtype().(utype), valuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_replaceUtype().replacer().(value)
93 return replacerscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_replaceUtype().replacer().
94
95 def _appendFragmentscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_appendFragment().(fragscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_appendFragment().(frag)):
96 def appenderscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_appendFragment().appender().(origscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_appendFragment().appender().(orig), valuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_appendFragment().appender().(value)):
97 yield "%s.%s"%(origscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_appendFragment().appender().(orig), fragscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_appendFragment().(frag)), valuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_appendFragment().appender().(value)
98 return appenderscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_appendFragment().appender().
99
100 def _ignorescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_ignore().(utypescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_ignore().(utype), valuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_ignore().(value)):
101 if False:
102 yield None
103
104
105 _utypeMorphersscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_utypeMorphers. = {
106 'AstroCoordSystem.RedshiftFrame.ReferencePosition': _replaceLastWithValuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_replaceLastWithValue().,
107 'AstroCoordSystem.RedshiftFrame.value_type':
108 _makeParentAttributeMakerscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeParentAttributeMaker().("value_type"),
109 'AstroCoordSystem.SpaceFrame.CoordFlavor': _makeCoordFlavorscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeCoordFlavor().,
110 'AstroCoordSystem.SpaceFrame.CoordFlavor.coord_naxes':
111 _makeAttributeMakerscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeAttributeMaker().("coord_naxes"),
112 'AstroCoordSystem.SpaceFrame.CoordRefFrame': _replaceLastWithValuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_replaceLastWithValue().,
113 'AstroCoordSystem.SpaceFrame.CoordRefFrame.Equinox':
114 _replaceUtypescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_replaceUtype().('AstroCoordSystem.SpaceFrame.Equinox'),
115 'AstroCoordSystem.SpaceFrame.ReferencePosition': _replaceLastWithValuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_replaceLastWithValue().,
116 'AstroCoordSystem.SpectralFrame.ReferencePosition': _replaceLastWithValuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_replaceLastWithValue().,
117 'AstroCoordSystem.TimeFrame.ReferencePosition': _replaceLastWithValuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_replaceLastWithValue().,
118 'AstroCoordSystem.href': _makeParentAttributeMakerscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeParentAttributeMaker().(
119 utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.ElementTreescip-python python python-stdlib 3.11 `xml.etree.ElementTree`/__init__:.QName(commonscip-python python gavodachs 2.13 `gavo.stc.common`/__init__:.XlinkNamespacescip-python python gavodachs 2.13 `gavo.stc.common`/XlinkNamespace., "href")),
120 'AstroCoordSystem.SpaceFrame.ReferencePosition.PlanetaryEphem':
121 _makeChildMakerscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeChildMaker().("PlanetaryEphem"),
122 'AstroCoordSystem.TimeFrame.ReferencePosition.PlanetaryEphem':
123 _makeChildMakerscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeChildMaker().("PlanetaryEphem"),
124 'AstroCoordSystem.SpectralFrame.ReferencePosition.PlanetaryEphem':
125 _makeChildMakerscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeChildMaker().("PlanetaryEphem"),
126 'AstroCoordSystem.RedshiftFrame.ReferencePosition.PlanetaryEphem':
127 _makeChildMakerscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeChildMaker().("PlanetaryEphem"),
128 'AstroCoords.Time.TimeInstant': _appendFragmentscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_appendFragment().('ISOTime'),
129 'AstroCoords.TimeInterval.StartTime': _appendFragmentscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_appendFragment().('ISOTime'),
130 'AstroCoords.TimeInterval.EndTime': _appendFragmentscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_appendFragment().('ISOTime'),
131 'AstroCoords.Position1D.Epoch.yearDef': _makeParentAttributeMakerscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeParentAttributeMaker().("yearDef"),
132 'AstroCoords.Position2D.Epoch.yearDef': _makeParentAttributeMakerscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeParentAttributeMaker().("yearDef"),
133 'AstroCoords.Position3D.Epoch.yearDef': _makeParentAttributeMakerscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_makeParentAttributeMaker().("yearDef"),
134 'DataModel.Uri': _ignorescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_ignore().,
135 'DataModel.Name': _ignorescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_ignore().,
136 'DataModel.Version': _ignorescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_ignore().,
137 }
138
139 def utypePairsToTreescip-python python gavodachs 2.13 `gavo.stc.utypeast`/utypePairsToTree().(utypesscip-python python gavodachs 2.13 `gavo.stc.utypeast`/utypePairsToTree().(utypes), nameQualifierscip-python python gavodachs 2.13 `gavo.stc.utypeast`/utypePairsToTree().(nameQualifier)=stcxastscip-python python gavodachs 2.13 `gavo.stc.stcxast`/__init__:.STCElementscip-python python gavodachs 2.13 `gavo.stc.stcxast`/STCElement().):
140 """returns an ElementTree from a sequence of (utype, value) pairs.
141
142 nameQualifier(str) -> anything is a function producing element names.
143
144 The utypes are processed as they come in. In practice this means
145 you should sort them (or similar).
146
147 The utype can be none, meaning "Use last node".
148 """
149 utypesscip-python python gavodachs 2.13 `gavo.stc.utypeast`/utypePairsToTree().(utypes) = listscip-python python python-stdlib 3.11 builtins/list#(utypesscip-python python gavodachs 2.13 `gavo.stc.utypeast`/utypePairsToTree().(utypes))
150 root = ElementTreescip-python python python-stdlib 3.11 `xml.etree.ElementTree`/__init__:.Element(nameQualifierscip-python python gavodachs 2.13 `gavo.stc.utypeast`/utypePairsToTree().(nameQualifier)("STCSpec"))
151 curParts, elementStack = (), [root]
152 for parts, val in ((parseUtypescip-python python gavodachs 2.13 `gavo.stc.utypeast`/parseUtype().(u), v) for u, v in utypesscip-python python gavodachs 2.13 `gavo.stc.utypeast`/utypePairsToTree().(utypes)):
153 toClose, toOpen = _unifyTuplesscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_unifyTuples().(curParts, parts)
154 if toClose or toOpen: # move in utype tree
155 curParts = parts
156
157 for elName in toClose:
158 elementStack.popscip-python python python-stdlib 3.11 builtins/list#pop().()
159 for elName in toOpen:
160 elementStack.appendscip-python python python-stdlib 3.11 builtins/list#append().(
161 ElementTreescip-python python python-stdlib 3.11 `xml.etree.ElementTree`/__init__:.SubElement(elementStack[-1], nameQualifierscip-python python gavodachs 2.13 `gavo.stc.utypeast`/utypePairsToTree().(nameQualifier)(elName)))
162
163 # _Attributes get special handling
164 if isinstance(val, _Attributescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Attribute#):
165 elementStack[-1].attrib[val.namescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Attribute#name.] = val.valuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Attribute#value.
166 elif isinstance(val, _Childscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Child#):
167 ElementTreescip-python python python-stdlib 3.11 `xml.etree.ElementTree`/__init__:.SubElement(elementStack[-1],
168 nameQualifierscip-python python gavodachs 2.13 `gavo.stc.utypeast`/utypePairsToTree().(nameQualifier)(val.namescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Child#name.)).text = val.valuescip-python python gavodachs 2.13 `gavo.stc.utypeast`/_Child#value.
169
170
171 # All other values go to the element content; if nothing was
172 # opened or closed, add another node rather than clobber the
173 # last one.
174 else:
175 if not toClose and not toOpen:
176 elementStack.popscip-python python python-stdlib 3.11 builtins/list#pop().()
177 elementStack.appendscip-python python python-stdlib 3.11 builtins/list#append().(ElementTreescip-python python python-stdlib 3.11 `xml.etree.ElementTree`/__init__:.SubElement(
178 elementStack[-1], nameQualifierscip-python python gavodachs 2.13 `gavo.stc.utypeast`/utypePairsToTree().(nameQualifier)(curParts[-1])))
179 elementStack[-1].text = val
180 return root
181
182
183 def morphUtypesscip-python python gavodachs 2.13 `gavo.stc.utypeast`/morphUtypes().(morphersscip-python python gavodachs 2.13 `gavo.stc.utypeast`/morphUtypes().(morphers), utypeSeqscip-python python gavodachs 2.13 `gavo.stc.utypeast`/morphUtypes().(utypeSeq)):
184 """returns a morphed sequence of utype/value pairs.
185
186 morphers is a dictionary of utypes to handling generators. Each of
187 those most take a utype and a value and generate utype/value pairs.
188
189 This is used here to fix the abominations where system elements become
190 values in utype representation.
191 """
192 for index, (k, v) in enumeratescip-python python python-stdlib 3.11 builtins/enumerate#(utypeSeqscip-python python gavodachs 2.13 `gavo.stc.utypeast`/morphUtypes().(utypeSeq)):
193 if k in morphersscip-python python gavodachs 2.13 `gavo.stc.utypeast`/morphUtypes().(morphers):
194 for pair in morphersscip-python python gavodachs 2.13 `gavo.stc.utypeast`/morphUtypes().(morphers)[k](k, v):
195 yield pair
196 else:
197 yield (k, v)
198
199
200 def _iterSortedUtypesscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_iterSortedUtypes().(utypeSeqscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_iterSortedUtypes().(utypeSeq)):
201 """returns a sorted sequence of utype, value pairs from utypeSeq
202
203 The result also has the abominable "stc:" cut off.
204 """
205 return sortedscip-python python python-stdlib 3.11 builtins/sorted().((key.split(":")[-1], value)
206 for key, value in utypeSeqscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_iterSortedUtypes().(utypeSeq))
207
208
209 def parseFromUtypesscip-python python gavodachs 2.13 `gavo.stc.utypeast`/parseFromUtypes().(utypeSeqscip-python python gavodachs 2.13 `gavo.stc.utypeast`/parseFromUtypes().(utypeSeq)):
210 """returns an STC AST for a sequence of utype-value pairs.
211 """
212 eTree = utypePairsToTreescip-python python gavodachs 2.13 `gavo.stc.utypeast`/utypePairsToTree().(
213 morphUtypesscip-python python gavodachs 2.13 `gavo.stc.utypeast`/morphUtypes().(_utypeMorphersscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_utypeMorphers.,
214 _iterSortedUtypesscip-python python gavodachs 2.13 `gavo.stc.utypeast`/_iterSortedUtypes().(utypeSeqscip-python python gavodachs 2.13 `gavo.stc.utypeast`/parseFromUtypes().(utypeSeq))))
215 res = stcxastscip-python python gavodachs 2.13 `gavo.stc.stcxast`/__init__:.parseFromETreescip-python python gavodachs 2.13 `gavo.stc.stcxast`/parseFromETree().(eTree)[0][1]
216 return res