-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNode.py
More file actions
254 lines (153 loc) · 4.58 KB
/
Copy pathNode.py
File metadata and controls
254 lines (153 loc) · 4.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
import xml.dom.minidom
def nodeTypeIndex(node: xml.dom.minidom.Element):
return node.nodeType
def nodeName(node: xml.dom.minidom.Element):
return node.nodeName
def baseURI(node: xml.dom.minidom.Element):
def _1():
raise Exception("cannot get baseURI in python")
return _1
def ownerDocument(node: xml.dom.minidom.Element):
def _1():
return node.ownerDocument
return _1
def _parentNode(node: xml.dom.minidom.Element):
def _1():
return node.parentNode
return _1
def _parentElement(node: xml.dom.minidom.Element):
def _1():
return node.parentNode
return _1
def hasChildNodes(node: xml.dom.minidom.Element):
def _1():
return node.hasChildNodes()
return _1
def childNodes(node: xml.dom.minidom.Element):
def _1():
return node.childNodes
return _1
def _firstChild(node: xml.dom.minidom.Element):
def _1():
return node._get_firstChild()
return _1
def _lastChild(node: xml.dom.minidom.Element):
def _1():
return node._get_lastChild()
return _1
def _previousSibling(node: xml.dom.minidom.Element):
def _1():
return node.previousSibling
return _1
def _nextSibling(node: xml.dom.minidom.Element):
def _1():
return node.nextSibling
return _1
def _nodeValue(node: xml.dom.minidom.Element):
def _1():
return node.nodeValue
return _1
def setNodeValue(v):
def _1(node: xml.dom.minidom.Element):
def _2():
node.nodeValue = v
return {}
return _2
return _1
def textContent(node: xml.dom.minidom.Element):
def _1():
raise Exception("Cannot (yet) get text content of python nodes. Make a PR!")
return _1
def setTextContent(a):
def _1(b):
def _2():
raise Exception("Cannot (yet) set text content of python nodes. Make a PR!")
return _2
return _1
def noramlize(n: xml.dom.minidom.Element):
def _1():
return n.normalize()
return _1
def clone(n: xml.dom.minidom.Element):
def _1():
return n.cloneNode(False)
return _1
def deepClone(n: xml.dom.minidom.Element):
def _1():
return n.cloneNode(True)
return _1
def isEqualNode(n0: xml.dom.minidom.Element):
def _1(n1: xml.dom.minidom.Element):
def _2():
return n0.isSameNode(n1)
return _2
return _1
def compareDocumentPositionBits(n0: xml.dom.minidom.Element):
def _1(n1: xml.dom.minidom.Element):
def _2():
raise Exception("Cannot compare document precision bits")
return _2
return _1
def _contains_recurser(needle, n: List[xml.dom.minidom.Element]):
return (
False
if len(n) == 0
else needle is n[0]
or (
_contains_recurser(needle, n[0].childNodes)
if n[0].childNodes
else _contains_recurser(needle, n[1:])
)
)
def contains(n0: xml.dom.minidom.Element):
def _1(n1: xml.dom.minidom.Element):
def _2():
return _contains_recurser(n1, [n0])
return _2
return _1
def _lookupPrefix(prefix):
def _1(n0: xml.dom.minidom.Element):
def _2():
raise Exception("Cannot lookup prefix in python")
return _2
return _1
def _lookupNamespaceURI(prefix):
def _1(n0: xml.dom.minidom.Element):
def _2():
raise Exception("Cannot lookup namespace uri in python")
return _2
return _1
def isDefaultNamespace(prefix):
def _1(n0: xml.dom.minidom.Element):
def _2():
raise Exception("Cannot isDefaultNamespace in python")
return _2
return _1
def insertBefore(node1: xml.dom.minidom.Node):
def _1(node2: xml.dom.minidom.Node):
def _2(parent: xml.dom.minidom.Node):
def _3():
return parent.insertBefore(node1, node2)
return _3
return _2
return _1
def appendChild(node1: xml.dom.minidom.Node):
def _1(parent: xml.dom.minidom.Node):
def _2():
return parent.appendChild(node1)
return _2
return _1
def replaceChild(newChild: xml.dom.minidom.Node):
def _1(oldChild: xml.dom.minidom.Node):
def _2(parent: xml.dom.minidom.Node):
def _3():
return parent.insertBefore(newChild, oldChild=oldChild)
return _3
return _2
return _1
def removeChild(node1: xml.dom.minidom.Node):
def _1(parent: xml.dom.minidom.Node):
def _2():
return parent.removeChild(node1)
return _2
return _1