MCPcopy Index your code
hub / github.com/ipython/ipython / CallExpression

Class CallExpression

IPython/lib/pretty.py:542–579  ·  view source on GitHub ↗

Object which emits a line-wrapped call expression in the form `__name(*args, **kwargs)`

Source from the content-addressed store, hash-verified

540
541
542class CallExpression:
543 """ Object which emits a line-wrapped call expression in the form `__name(*args, **kwargs)` """
544 def __init__(__self, __name, *args, **kwargs):
545 # dunders are to avoid clashes with kwargs, as python's name managing
546 # will kick in.
547 self = __self
548 self.name = __name
549 self.args = args
550 self.kwargs = kwargs
551
552 @classmethod
553 def factory(cls, name):
554 def inner(*args, **kwargs):
555 return cls(name, *args, **kwargs)
556 return inner
557
558 def _repr_pretty_(self, p, cycle):
559 # dunders are to avoid clashes with kwargs, as python's name managing
560 # will kick in.
561
562 started = False
563 def new_item():
564 nonlocal started
565 if started:
566 p.text(",")
567 p.breakable()
568 started = True
569
570 prefix = self.name + "("
571 with p.group(len(prefix), prefix, ")"):
572 for arg in self.args:
573 new_item()
574 p.pretty(arg)
575 for arg_name, arg in self.kwargs.items():
576 new_item()
577 arg_prefix = arg_name + "="
578 with p.group(len(arg_prefix), arg_prefix):
579 p.pretty(arg)
580
581
582class RawStringLiteral:

Callers 1

_exception_pprintFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…