MCPcopy Create free account
hub / github.com/celery/celery / _get_annotations

Function _get_annotations

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

Source from the content-addressed store, hash-verified

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

Callers 1

_task_from_funMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected