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

Function _eval_or_create_duck

IPython/core/guarded_eval.py:1466–1472  ·  view source on GitHub ↗
(duck_type, context: EvaluationContext)

Source from the content-addressed store, hash-verified

1464
1465
1466def _eval_or_create_duck(duck_type, context: EvaluationContext):
1467 policy = get_policy(context)
1468 # if allow-listed builtin is on type annotation, instantiate it
1469 if policy.can_call(duck_type):
1470 return duck_type()
1471 # if custom class is in type annotation, mock it
1472 return _create_duck_for_heap_type(duck_type)
1473
1474
1475def _create_duck_for_heap_type(duck_type):

Callers 1

_resolve_annotationFunction · 0.85

Calls 3

get_policyFunction · 0.85
can_callMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…