This is a development version (latest) and may be unstable.Go to latest (9.17.0)
{ } Raw JSON

bundles / IPython latest / IPython / core / guarded_eval / _collect_annotations

function

IPython.core.guarded_eval:_collect_annotations

source: /dev/ipython/IPython/core/guarded_eval.py:1280

Signature

def _collect_annotations(cls: type) → dict

Summary

Collect annotations of a class and its bases without resolving them.

Extended Summary

typing.get_type_hints() is not usable here because it resolves stringized annotations with eval(); under PEP 563 every annotation of a module is a string, so that would run arbitrary code from __annotations__. Strings are left as-is and later resolved by _eval_annotation under the policy.

Aliases

  • IPython.core.guarded_eval._collect_annotations