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

Method _assign

dm_control/mjcf/attribute.py:504–516  ·  view source on GitHub ↗
(self, value)

Source from the content-addressed store, hash-verified

502 parent.namescope.files.add(self)
503
504 def _assign(self, value):
505 if not value:
506 self.clear()
507 else:
508 if isinstance(value, str):
509 asset = self._get_asset_from_path(value)
510 elif isinstance(value, Asset):
511 asset = value
512 else:
513 raise ValueError('Expect either a string or `Asset` value: got {}'
514 .format(value))
515 self._validate_extension(asset.extension)
516 self._value = asset
517
518 def _get_asset_from_path(self, path):
519 """Constructs a `Asset` given a file path."""

Callers

nothing calls this directly

Calls 3

_get_asset_from_pathMethod · 0.95
_validate_extensionMethod · 0.95
clearMethod · 0.45

Tested by

no test coverage detected