MCPcopy
hub / github.com/celery/celery / _get_annotations

Function _get_annotations

celery/app/base.py:63–73  ·  view source on GitHub ↗
(fun)

Source from the content-addressed store, hash-verified

61 import annotationlib
62
63 def _get_annotations(fun):
64 # In Python 3.14+, annotations are deferred by default (PEP 649).
65 # Accessing fun.__annotations__ (or inspect.get_annotations without a
66 # format) evaluates them and may raise NameError for types only
67 # available under TYPE_CHECKING. To preserve previous behavior, first
68 # try to return evaluated annotations; if that fails with NameError,
69 # fall back to returning stringified annotations instead.
70 try:
71 return inspect.get_annotations(fun)
72 except NameError:
73 return inspect.get_annotations(fun, format=annotationlib.Format.STRING)
74else:
75 def _get_annotations(fun):
76 return fun.__annotations__

Callers 1

_task_from_funMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected