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

Method add_builtin

IPython/core/builtin_trap.py:53–63  ·  view source on GitHub ↗

Add a builtin and save the original.

(self, key, value)

Source from the content-addressed store, hash-verified

51 return False
52
53 def add_builtin(self, key, value):
54 """Add a builtin and save the original."""
55 bdict = builtin_mod.__dict__
56 orig = bdict.get(key, BuiltinUndefined)
57 if value is HideBuiltin:
58 if orig is not BuiltinUndefined: #same as 'key in bdict'
59 self._orig_builtins[key] = orig
60 del bdict[key]
61 else:
62 self._orig_builtins[key] = orig
63 bdict[key] = value
64
65 def remove_builtin(self, key, orig):
66 """Remove an added builtin and re-set the original."""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected