@@ -504,19 +504,19 @@ to see the types of all local variables at once. Example:
504504 # a: builtins.int
505505 # b: builtins.str
506506 .. note ::
507- `` reveal_type `` and `` reveal_locals `` are understood by mypy during
508- typechecking, and don't have to be imported as functions. However,
509- if you don't import them, then they don't exist at runtime! Therefore,
510- you'll have to remove any `` reveal_type `` and `` reveal_locals `` calls
511- from your program or else Python will give you an error at runtime about
512- those names being undefined. Alternatively, you can import `` reveal_type ``
513- from `` typing_extensions `` (or, in more recent versions of python, from
514- `` typing ``) so its name will be defined at runtime. There is no analogous
515- fix for `` reveal_locals ``. It simply must be removed from the code before
516- the code is run. (Although, technically, if you really didn't want to
517- remove those calls, you could use `` if not typing.TYPE_CHECKING:
518- reveal_locals = lambda: None `` or similar to define the function to
519- something else at runtime.)
507+
508+ `` reveal_type `` and `` reveal_locals `` are understood by mypy during
509+ typechecking, and don't have to be imported as functions. However, if you
510+ don't import them, then they don't exist at runtime! Therefore, you'll have
511+ to remove any `` reveal_type `` and `` reveal_locals `` calls from your program
512+ or else Python will give you an error at runtime about those names being
513+ undefined. Alternatively, you can import `` reveal_type `` from `` typing ``
514+ (or, in versions of python older than 3.11, from `` typing_extensions ``) so
515+ its name will be defined at runtime. There is no analogous fix for
516+ `` reveal_locals ``. It simply must be removed from the code before the code
517+ is run. (Although, technically, if you really didn't want to remove those
518+ calls, you could use `` if not typing.TYPE_CHECKING: reveal_locals = lambda:
519+ None `` or similar to define the function to something else at runtime.)
520520
521521.. _silencing-linters :
522522
0 commit comments