MCPcopy Index your code
hub / github.com/KhronosGroup/Vulkan-Docs / stripNonmatchingAPIs

Function stripNonmatchingAPIs

scripts/reg.py:274–298  ·  view source on GitHub ↗

Remove tree Elements with 'api' attributes matching apiName. tree - Element at the root of the hierarchy to strip. Only its children can actually be removed, not the tree itself. apiName - string which much match a command-separated component of the 'api' att

(tree, apiName, actuallyDelete = True)

Source from the content-addressed store, hash-verified

272
273
274def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True):
275 """Remove tree Elements with 'api' attributes matching apiName.
276
277 tree - Element at the root of the hierarchy to strip. Only its
278 children can actually be removed, not the tree itself.
279 apiName - string which much match a command-separated component of
280 the 'api' attribute.
281 actuallyDelete - only delete matching elements if True."""
282
283 stack = deque()
284 stack.append(tree)
285
286 while len(stack) > 0:
287 parent = stack.pop()
288
289 for child in parent.findall('*'):
290 api = child.get('api')
291
292 if apiNameMatch(apiName, api):
293 # Add child to the queue
294 stack.append(child)
295 elif not apiNameMatch(apiName, api):
296 # Child does not match requested api. Remove it.
297 if actuallyDelete:
298 parent.remove(child)
299
300
301class BaseInfo:

Callers 2

stripAPI.pyFile · 0.90
parseTreeMethod · 0.85

Calls 3

apiNameMatchFunction · 0.85
appendMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected