MCPcopy
hub / github.com/daviddrysdale/python-phonenumbers / _get_unique_child

Function _get_unique_child

tools/python/buildmetadatafromxml.py:121–132  ·  view source on GitHub ↗

Get the unique child element under xtag with name eltname

(xtag, eltname)

Source from the content-addressed store, hash-verified

119# XML processing utility functions that are useful for the particular
120# structure of the phone number metadata
121def _get_unique_child(xtag, eltname):
122 """Get the unique child element under xtag with name eltname"""
123 try:
124 results = xtag.findall(eltname)
125 if len(results) > 1:
126 raise Exception("Multiple elements found where 0/1 expected")
127 elif len(results) == 1:
128 return results[0]
129 else:
130 return None
131 except Exception:
132 return None
133
134
135def _get_unique_child_value(xtag, eltname):

Callers 4

_get_unique_child_valueFunction · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected