Constructs a set of namespaces in a given ElementSpec. Args: root_spec: An `ElementSpec` for the root element in the schema. Returns: A set of strings specifying the names of all the namespaces that are present in the spec.
(root_spec)
| 172 | |
| 173 | |
| 174 | def collect_namespaces(root_spec): |
| 175 | """Constructs a set of namespaces in a given ElementSpec. |
| 176 | |
| 177 | Args: |
| 178 | root_spec: An `ElementSpec` for the root element in the schema. |
| 179 | |
| 180 | Returns: |
| 181 | A set of strings specifying the names of all the namespaces that are present |
| 182 | in the spec. |
| 183 | """ |
| 184 | findable_namespaces = set() |
| 185 | def update_namespaces_from_spec(spec): |
| 186 | findable_namespaces.add(spec.namespace) |
| 187 | for child_spec in spec.children.values(): |
| 188 | if child_spec is not spec: |
| 189 | update_namespaces_from_spec(child_spec) |
| 190 | update_namespaces_from_spec(root_spec) |
| 191 | return findable_namespaces |
| 192 | |
| 193 | |
| 194 | MUJOCO = parse_schema(_SCHEMA_XML_PATH) |
no test coverage detected
searching dependent graphs…