add_alias

Contents

add_alias#

penzai.treescope.canonical_aliases.add_alias(the_object: Any, path: ModuleAttributePath, on_conflict: Literal['ignore', 'overwrite', 'warn', 'error'] = 'warn')[source]#

Adds an alias to this object.

Parameters:
  • the_object – Object to add an alias to.

  • path – The path where we expect to find this object.

  • on_conflict – What to do if we try to add an alias for an object that already has one.

Raises:

ValueError – If overwrite is False and this object already has an alias, or if this object is not accessible at this path.