Skip to content

Commit a0fec2e

Browse files
committed
[SPARK-2470] PEP8 fixes to mllib
1 parent c85e1e5 commit a0fec2e

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

python/pyspark/mllib/_common.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def _deserialize_double_vector(ba, offset=0):
164164
nb = len(ba) - offset
165165
if nb < 5:
166166
raise TypeError("_deserialize_double_vector called on a %d-byte array, "
167-
"which is too short" % nb)
167+
"which is too short" % nb)
168168
if ba[offset] == DENSE_VECTOR_MAGIC:
169169
return _deserialize_dense_vector(ba, offset)
170170
elif ba[offset] == SPARSE_VECTOR_MAGIC:
@@ -272,6 +272,7 @@ def _serialize_labeled_point(p):
272272
header_float[0] = p.label
273273
return header + serialized_features
274274

275+
275276
def _deserialize_labeled_point(ba, offset=0):
276277
"""Deserialize a LabeledPoint from a mutually understood format."""
277278
from pyspark.mllib.regression import LabeledPoint
@@ -283,6 +284,7 @@ def _deserialize_labeled_point(ba, offset=0):
283284
features = _deserialize_double_vector(ba, offset + 9)
284285
return LabeledPoint(label, features)
285286

287+
286288
def _copyto(array, buffer, offset, shape, dtype):
287289
"""
288290
Copy the contents of a vector to a destination bytearray at the

python/pyspark/mllib/linalg.py

+1
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ def stringify(vector):
247247
else:
248248
return "[" + ",".join([str(v) for v in vector]) + "]"
249249

250+
250251
def _test():
251252
import doctest
252253
(failure_count, test_count) = doctest.testmod(optionflags=doctest.ELLIPSIS)

python/pyspark/mllib/util.py

-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from pyspark.serializers import NoOpSerializer
2525

2626

27-
2827
class MLUtils:
2928
"""
3029
Helper methods to load, save and pre-process data used in MLlib.
@@ -154,7 +153,6 @@ def saveAsLibSVMFile(data, dir):
154153
lines = data.map(lambda p: MLUtils._convert_labeled_point_to_libsvm(p))
155154
lines.saveAsTextFile(dir)
156155

157-
158156
@staticmethod
159157
def loadLabeledPoints(sc, path, minPartitions=None):
160158
"""

0 commit comments

Comments
 (0)