MCPcopy Create free account
hub / github.com/ipython/ipython / define_alias

Method define_alias

IPython/core/alias.py:223–231  ·  view source on GitHub ↗

Define a new alias after validating it. This will raise an :exc:`AliasError` if there are validation problems.

(self, name, cmd)

Source from the content-addressed store, hash-verified

221 error("Invalid alias: %s" % e)
222
223 def define_alias(self, name, cmd):
224 """Define a new alias after validating it.
225
226 This will raise an :exc:`AliasError` if there are validation
227 problems.
228 """
229 caller = Alias(shell=self.shell, name=name, cmd=cmd)
230 self.shell.magics_manager.register_function(caller, magic_kind='line',
231 magic_name=name)
232
233 def get_alias(self, name):
234 """Return an alias, or None if no alias by that name exists."""

Callers 7

soft_define_aliasMethod · 0.95
test_alias_lifecycleFunction · 0.80
test_alias_args_errorFunction · 0.80
aliasMethod · 0.80
rehashxMethod · 0.80
restore_aliasesFunction · 0.80

Calls 2

AliasClass · 0.85
register_functionMethod · 0.80

Tested by 3

test_alias_lifecycleFunction · 0.64
test_alias_args_errorFunction · 0.64