Skip to content

Commit

Permalink
[SPARK-33002][PYTHON] Remove non-API annotations
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?

This PR:

- removes annotations for modules which are not part of the public API.
- removes `__init__.pyi` files, if no annotations, beyond exports, are present.

### Why are the changes needed?

Primarily to reduce maintenance overhead and as requested in the comments to #29591

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

Existing tests and additional MyPy checks:

```
mypy --no-incremental --config python/mypy.ini python/pyspark
MYPYPATH=python/ mypy --no-incremental --config python/mypy.ini examples/src/main/python/ml examples/src/main/python/sql examples/src/main/python/sql/streaming
```

Closes #29879 from zero323/SPARK-33002.

Authored-by: zero323 <mszymkiewicz@gmail.com>
Signed-off-by: HyukjinKwon <gurwls223@apache.org>
  • Loading branch information
zero323 authored and HyukjinKwon committed Oct 7, 2020
1 parent 4e1ded6 commit 72da6f8
Show file tree
Hide file tree
Showing 30 changed files with 14 additions and 1,039 deletions.
5 changes: 4 additions & 1 deletion python/mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@ ignore_missing_imports = True
[mypy-pandas.*]
ignore_missing_imports = True

[mypy-pyarrow]
[mypy-pyarrow.*]
ignore_missing_imports = True

[mypy-psutil.*]
ignore_missing_imports = True
27 changes: 0 additions & 27 deletions python/pyspark/_globals.pyi

This file was deleted.

4 changes: 3 additions & 1 deletion python/pyspark/accumulators.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# specific language governing permissions and limitations
# under the License.

from typing import Callable, Generic, Tuple, Type, TypeVar
from typing import Callable, Dict, Generic, Tuple, Type, TypeVar

import socketserver.BaseRequestHandler # type: ignore

Expand All @@ -27,6 +27,8 @@ U = TypeVar("U", bound=SupportsIAdd)

import socketserver as SocketServer

_accumulatorRegistry: Dict[int, Accumulator]

class Accumulator(Generic[T]):
aid: int
accum_param: AccumulatorParam[T]
Expand Down
4 changes: 3 additions & 1 deletion python/pyspark/broadcast.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
# under the License.

import threading
from typing import Any, Generic, Optional, TypeVar
from typing import Any, Dict, Generic, Optional, TypeVar

T = TypeVar("T")

_broadcastRegistry: Dict[int, Broadcast]

class Broadcast(Generic[T]):
def __init__(
self,
Expand Down
29 changes: 0 additions & 29 deletions python/pyspark/daemon.pyi

This file was deleted.

17 changes: 0 additions & 17 deletions python/pyspark/find_spark_home.pyi

This file was deleted.

24 changes: 0 additions & 24 deletions python/pyspark/java_gateway.pyi

This file was deleted.

50 changes: 0 additions & 50 deletions python/pyspark/join.pyi

This file was deleted.

45 changes: 0 additions & 45 deletions python/pyspark/ml/__init__.pyi

This file was deleted.

32 changes: 0 additions & 32 deletions python/pyspark/mllib/__init__.pyi

This file was deleted.

54 changes: 0 additions & 54 deletions python/pyspark/rddsampler.pyi

This file was deleted.

31 changes: 0 additions & 31 deletions python/pyspark/resource/__init__.pyi

This file was deleted.

2 changes: 1 addition & 1 deletion python/pyspark/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def dumps(self, obj):

# Hack namedtuple, make it picklable

__cls = {}
__cls = {} # type: ignore


def _restore(name, fields, value):
Expand Down
Loading

0 comments on commit 72da6f8

Please sign in to comment.