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

Method __call__

IPython/core/hooks.py:103–117  ·  view source on GitHub ↗

Command chain is called just like normal func. This will call all funcs in chain with the same args as were given to this function, and return the result of first func that didn't raise TryNext

(self,*args, **kw)

Source from the content-addressed store, hash-verified

101
102
103 def __call__(self,*args, **kw):
104 """ Command chain is called just like normal func.
105
106 This will call all funcs in chain with the same args as were given to
107 this function, and return the result of first func that didn't raise
108 TryNext"""
109 last_exc = TryNext()
110 for prio,cmd in self.chain:
111 #print "prio",prio,"cmd",cmd #dbg
112 try:
113 return cmd(*args, **kw)
114 except TryNext as exc:
115 last_exc = exc
116 # if no function will accept it, raise TryNext up to the caller
117 raise last_exc
118
119 def __str__(self):
120 return str(self.chain)

Callers

nothing calls this directly

Calls 1

TryNextClass · 0.85

Tested by

no test coverage detected