zero323 commented on a change in pull request #34466:
URL: https://github.com/apache/spark/pull/34466#discussion_r762602061
##########
File path: python/pyspark/context.py
##########
@@ -590,13 +636,14 @@ def parallelize(self, c, numSlices=None):
size = len(c)
if size == 0:
return self.parallelize([], numSlices)
- step = c[1] - c[0] if size > 1 else 1
- start0 = c[0]
+ step = c[1] - c[0] if size > 1 else 1 # type: ignore[index]
+ start0 = c[0] # type: ignore[index]
- def getStart(split):
+ def getStart(split: int) -> int:
+ assert numSlices is not None
return start0 + int((split * size / numSlices)) * step
- def f(split, iterator):
+ def f(split: int, iterator: Iterable) -> Iterable:
Review comment:
We should fill the generic:
```python
def f(split: int, iterator: Iterable[T]) -> Iterable[T]:
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]