zero323 commented on a change in pull request #35020:
URL: https://github.com/apache/spark/pull/35020#discussion_r775491046
##########
File path: python/pyspark/mllib/linalg/__init__.py
##########
@@ -1325,24 +1468,26 @@ def __repr__(self):
if len(self.colPtrs) > 16:
colPtrs = colPtrs[:8] + ["..."] + colPtrs[-8:]
- values = ", ".join(values)
- rowIndices = ", ".join([str(ind) for ind in rowIndices])
- colPtrs = ", ".join([str(ptr) for ptr in colPtrs])
return "SparseMatrix({0}, {1}, [{2}], [{3}], [{4}], {5})".format(
- self.numRows, self.numCols, colPtrs, rowIndices, values,
self.isTransposed
+ self.numRows,
+ self.numCols,
+ ", ".join([str(ptr) for ptr in colPtrs]),
+ ", ".join([str(ind) for ind in rowIndices]),
+ ", ".join(values),
+ self.isTransposed,
)
- def __reduce__(self):
+ def __reduce__(self) -> Tuple[Type["SparseMatrix"], Tuple[int, int, bytes,
bytes, bytes, int]]:
return SparseMatrix, (
self.numRows,
self.numCols,
- self.colPtrs.tostring(),
- self.rowIndices.tostring(),
- self.values.tostring(),
+ self.colPtrs.tostring(), # type: ignore[attr-defined]
+ self.rowIndices.tostring(), # type: ignore[attr-defined]
+ self.values.tostring(), # type: ignore[attr-defined]
Review comment:
For some reason, mypy doesn't recognize `ndarray.tostring`.
--
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]