From 64811b779536b7bbc6f60acc74a99c82abc536a7 Mon Sep 17 00:00:00 2001 From: MapleCCC Date: Mon, 29 Aug 2022 23:46:08 +0800 Subject: [PATCH] Tighten the metadata type of `ExpressionContextProvider` (#760) --- libcst/metadata/expression_context_provider.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libcst/metadata/expression_context_provider.py b/libcst/metadata/expression_context_provider.py index beec959d..955c14ad 100644 --- a/libcst/metadata/expression_context_provider.py +++ b/libcst/metadata/expression_context_provider.py @@ -201,7 +201,7 @@ class ExpressionContextVisitor(cst.CSTVisitor): return False -class ExpressionContextProvider(BatchableMetadataProvider[Optional[ExpressionContext]]): +class ExpressionContextProvider(BatchableMetadataProvider[ExpressionContext]): """ Provides :class:`ExpressionContext` metadata (mimics the `expr_context `__ in ast) for the @@ -209,9 +209,9 @@ class ExpressionContextProvider(BatchableMetadataProvider[Optional[ExpressionCon :class:`~libcst.Attribute`, :class:`~libcst.Subscript`, :class:`~libcst.StarredElement` , :class:`~libcst.List`, :class:`~libcst.Tuple` and :class:`~libcst.Name`. - Not that a :class:`~libcst.Name` may not always has context because of the differences between + Note that a :class:`~libcst.Name` may not always have context because of the differences between ast and LibCST. E.g. :attr:`~libcst.Attribute.attr` is a :class:`~libcst.Name` in LibCST - but a str in ast. To honor ast implementation, we don't assignment context to + but a str in ast. To honor ast implementation, we don't assign context to :attr:`~libcst.Attribute.attr`.