Skip to content

Commit

Permalink
Ignore them for now
Browse files Browse the repository at this point in the history
There is an open issue:
python/mypy#7778
  • Loading branch information
Fokko committed Jul 24, 2020
1 parent 4cf5a54 commit 726791a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ python/docs/_site/
python/test_coverage/coverage_data
python/test_coverage/htmlcov
python/pyspark/python
.mypy_cache/
reports/
scalastyle-on-compile.generated.xml
scalastyle-output.xml
Expand Down
16 changes: 8 additions & 8 deletions python/pyspark/ml/linalg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,6 @@
_have_scipy = False


def _delegate(op: str):
def func(self, other) -> DenseVector:
if isinstance(other, DenseVector):
other = other.array
return DenseVector(getattr(self.array, op)(other))
return func


def _convert_to_vector(l):
if isinstance(l, Vector):
return l
Expand Down Expand Up @@ -432,6 +424,14 @@ def __getattr__(self, item):
def __neg__(self):
return DenseVector(-self.array)

def _delegate(op: str): # type: ignore
def func(self, other) -> DenseVector:
if isinstance(other, DenseVector):
other = other.array
return DenseVector(getattr(self.array, op)(other))

return func

__add__ = _delegate("__add__")
__sub__ = _delegate("__sub__")
__mul__ = _delegate("__mul__")
Expand Down
16 changes: 8 additions & 8 deletions python/pyspark/mllib/linalg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,6 @@
_have_scipy = False


def _delegate(op: str):
def func(self, other) -> DenseVector:
if isinstance(other, DenseVector):
other = other.array
return DenseVector(getattr(self.array, op)(other))
return func


def _convert_to_vector(l):
if isinstance(l, Vector):
return l
Expand Down Expand Up @@ -477,6 +469,14 @@ def __getattr__(self, item):
def __neg__(self):
return DenseVector(-self.array)

def _delegate(op: str): # type: ignore
def func(self, other) -> DenseVector:
if isinstance(other, DenseVector):
other = other.array
return DenseVector(getattr(self.array, op)(other))

return func

__add__ = _delegate("__add__")
__sub__ = _delegate("__sub__")
__mul__ = _delegate("__mul__")
Expand Down

0 comments on commit 726791a

Please sign in to comment.