MCPcopy Create free account
hub / github.com/google-deepmind/dm_control / collect_namespaces

Function collect_namespaces

dm_control/mjcf/schema.py:174–191  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

172
173
174def 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
194MUJOCO = parse_schema(_SCHEMA_XML_PATH)

Callers 2

schema.pyFile · 0.85
override_schemaFunction · 0.85

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…