Repository: pynamodb/PynamoDB

Issue:
The return-type of Index#scan method is not annotated.
I see that the return-type of `Index#query` method is properly annotated. Why not the `Index#scan` method?
I am not seeing the type hints because of this. And my linter (Pylance) flags the method call in strict mode.
https://github.com/pynamodb/PynamoDB/blob/fc51a1ec9ae941864211392a5c7ff17d8cc704b6/pynamodb/indexes.py#L80-L138


Discussion:
ikonst: Fixes 935.

Patch:
diff --git a/pynamodb/indexes.py b/pynamodb/indexes.py
index a108a57..6ee5508 100644
--- a/pynamodb/indexes.py
+++ b/pynamodb/indexes.py
@@ -120,7 +120,7 @@ class Index(Generic[_M], metaclass=IndexMeta):
         consistent_read: Optional[bool] = None,
         rate_limit: Optional[float] = None,
         attributes_to_get: Optional[List[str]] = None,
-    ):
+    ) -> ResultIterator[_M]:
         """
         Scans an index
         """


Test patch:
diff --git a/tests/test_mypy.py b/tests/test_mypy.py
index 23b5c0d..b337742 100644
--- a/tests/test_mypy.py
+++ b/tests/test_mypy.py
@@ -185,24 +185,24 @@ def test_index_query_scan(assert_mypy_output):
         typed_index = TypedIndex()
 
     # Ensure old code keeps working
-    untyped_result: ResultIterator = MyModel.untyped_index.query(123)
-    model: MyModel = next(untyped_result)
-    not_model: int = next(untyped_result)  # this is legacy behavior so it's "fine"
+    untyped_query_result: ResultIterator = MyModel.untyped_index.query(123)
+    model: MyModel = next(untyped_query_result)
+    not_model: int = next(untyped_query_result)  # this is legacy behavior so it's "fine"
 
     # Allow users to specify which model their indices return
-    typed_result: ResultIterator[MyModel] = MyModel.typed_index.query(123)
-    my_model = next(typed_result)
-    not_model = next(typed_result)  # E: Incompatible types in assignment (expression has type "MyModel", variable has type "int")  [assignment]
+    typed_query_result: ResultIterator[MyModel] = MyModel.typed_index.query(123)
+    my_model = next(typed_query_result)
+    not_model = next(typed_query_result)  # E: Incompatible types in assignment (expression has type "MyModel", variable has type "int")  [assignment]
 
     # Ensure old code keeps working
-    untyped_result = MyModel.untyped_index.scan()
-    model = next(untyped_result)
-    not_model = next(untyped_result)  # this is legacy behavior so it's "fine"
+    untyped_scan_result = MyModel.untyped_index.scan()
+    model = next(untyped_scan_result)
+    not_model = next(untyped_scan_result)  # this is legacy behavior so it's "fine"
 
     # Allow users to specify which model their indices return
-    typed_result = MyModel.typed_index.scan()
-    model = next(typed_result)
-    not_model = next(typed_result)  # E: Incompatible types in assignment (expression has type "MyModel", variable has type "int")  [assignment]
+    typed_scan_result = MyModel.typed_index.scan()
+    model = next(typed_scan_result)
+    not_model = next(typed_scan_result)  # E: Incompatible types in assignment (expression has type "MyModel", variable has type "int")  [assignment]
     """)