Module:core.alias

System command aliases.

Authors:

  • Fernando Perez

  • Brian Granger

4 Classes

classIPython.core.alias.AliasError

Bases:Exception

classIPython.core.alias.InvalidAliasError

Bases:AliasError

classIPython.core.alias.Alias(shell,name,cmd)

Bases:object

Callable object storing the details of one alias.

Instances are registered as magic functions to allow use of aliases.

__init__(shell,name,cmd)
validate()

Validate the alias, and return the number of arguments.

classIPython.core.alias.AliasManager(**kwargs:Any)

Bases:Configurable

__init__(shell=None,**kwargs)

Create a configurable given a config config.

Parameters:
  • config (Config) – If this is empty, default values are used. If config is aConfig instance, it will be used to configure theinstance.

  • parent (Configurable instance,optional) – The parent Configurable instance of this object.

Notes

Subclasses of Configurable must call the__init__() method ofConfigurablebefore doing anything else and usingsuper():

classMyConfigurable(Configurable):def__init__(self,config=None):super(MyConfigurable,self).__init__(config=config)# Then any other code you need to finish initialization.

This ensures that instances will be configured properly.

define_alias(name,cmd)

Define a new alias after validating it.

This will raise anAliasError if there are validationproblems.

get_alias(name)

Return an alias, or None if no alias by that name exists.

is_alias(name)

Return whether or not a given name has been defined as an alias

retrieve_alias(name)

Retrieve the command to which an alias expands.

soft_define_alias(name,cmd)

Define an alias, but don’t raise on an AliasError.

1 Function

IPython.core.alias.default_aliases()List[Tuple[str,str]]

Return list of shell aliases to auto-define.