You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Function and variable annotations aren't evaluated at definition time when from __future__ import annotations is used (PEP 563). This is why --no-eval-annotations is on by default (since v1.1.1, #66). If annotations are being evaluated at runtime, like using typing.get_type_hints or evaluating __annotations__ of an object, --eval-annotations should be used for best results.
Evaluation of annotations can be forced by using --eval-annotations if code uses typing.get_type_hints or eval(obj.__annotations__) or similar.
The default behavior (--no-eval-annotations) thus instructs the parser that annotations will be manually evaluated in code, which changes minimum versions in certain cases. Otherwise, function and variable annotations are not evaluated at definition time.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The caveat section explains:
Evaluation of annotations can be forced by using
--eval-annotations
if code usestyping.get_type_hints
oreval(obj.__annotations__)
or similar.The default behavior (
--no-eval-annotations
) thus instructs the parser that annotations will be manually evaluated in code, which changes minimum versions in certain cases. Otherwise, function and variable annotations are not evaluated at definition time.Beta Was this translation helpful? Give feedback.
All reactions