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

Method full_prefix

dm_control/mjcf/namescope.py:117–142  ·  view source on GitHub ↗

The prefix for identifiers belonging to this scope. Args: prefix_root: (optional) A `NameScope` object to be treated as root for the purpose of calculating the prefix. If `None` then no prefix is produced. as_list: (optional) A boolean, if `True` return the list of p

(self, prefix_root=None, as_list=False)

Source from the content-addressed store, hash-verified

115 return self._parent.root
116
117 def full_prefix(self, prefix_root=None, as_list=False):
118 """The prefix for identifiers belonging to this scope.
119
120 Args:
121 prefix_root: (optional) A `NameScope` object to be treated as root
122 for the purpose of calculating the prefix. If `None` then no prefix
123 is produced.
124 as_list: (optional) A boolean, if `True` return the list of prefix
125 components. If `False`, return the full prefix string separated by
126 `mjcf.constants.PREFIX_SEPARATOR`.
127
128 Returns:
129 The prefix string.
130 """
131 prefix_root = prefix_root or self
132 if prefix_root != self and self._parent:
133 prefix_list = self._parent.full_prefix(prefix_root, as_list=True)
134 prefix_list.append(self._name)
135 else:
136 prefix_list = []
137 if as_list:
138 return prefix_list
139 else:
140 if prefix_list:
141 prefix_list.append('')
142 return constants.PREFIX_SEPARATOR.join(prefix_list)
143
144 def _assign(self, namespace, identifier, obj):
145 """Checks a proposed identifier's validity before assigning to an object."""

Callers 9

prefixed_identifierMethod · 0.80
prefixed_identifierMethod · 0.80
full_identifierMethod · 0.80
_defaults_stringMethod · 0.80
to_xml_stringMethod · 0.80
_defaults_stringMethod · 0.80
to_xml_stringMethod · 0.80

Calls

no outgoing calls