From 138c97cb7021fca5f6dab1b868ec4a0c2c710964 Mon Sep 17 00:00:00 2001 From: Shannon Zhu Date: Wed, 9 Feb 2022 15:42:10 -0800 Subject: [PATCH] Clean up lint errors in pyre infer apply annotations Summary: minor_lint_issues Reviewed By: dkgi Differential Revision: D34116053 fbshipit-source-id: 1df09d3ff6ad0e82d94664ed258072974f2d8732 --- .../_apply_type_annotations.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/client/libcst_vendored_visitors/_apply_type_annotations.py b/client/libcst_vendored_visitors/_apply_type_annotations.py index 2d1ebc2e815..f9643c0dea6 100644 --- a/client/libcst_vendored_visitors/_apply_type_annotations.py +++ b/client/libcst_vendored_visitors/_apply_type_annotations.py @@ -291,10 +291,11 @@ class ApplyTypeAnnotationsVisitor(ContextAwareTransformer): This is one of the transforms that is available automatically to you when running a codemod. To use it in this manner, import - :class:`~libcst.codemod.visitors.ApplyTypeAnnotationsVisitor` and then call the static - :meth:`~libcst.codemod.visitors.ApplyTypeAnnotationsVisitor.store_stub_in_context` method, - giving it the current context (found as ``self.context`` for all subclasses of - :class:`~libcst.codemod.Codemod`), the stub module from which you wish to add annotations. + :class:`~libcst.codemod.visitors.ApplyTypeAnnotationsVisitor`, then call the static + :meth:`~libcst.codemod.visitors.ApplyTypeAnnotationsVisitor.store_stub_in_context` + method, giving it the current context (found as ``self.context`` for all subclasses + of :class:`~libcst.codemod.Codemod`), the stub module from which you wish to add + annotations. For example, you can store the type annotation ``int`` for ``x`` using:: @@ -311,7 +312,8 @@ class ApplyTypeAnnotationsVisitor(ContextAwareTransformer): x: int = 1 - If the function or attribute already has a type annotation, it will not be overwritten. + If the function or attribute already has a type annotation, it will not be + overwritten. To overwrite existing annotations when applying annotations from a stub, use the keyword argument ``overwrite_existing_annotations=True`` when