Skip to content

Commit

Permalink
[SPARK-2470] PEP8 fixes to serializers.py
Browse files Browse the repository at this point in the history
  • Loading branch information
nchammas committed Jul 20, 2014
1 parent a0fec2e commit 95d1d95
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions python/pyspark/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def load_stream(self, stream):
"""
raise NotImplementedError


def _load_stream_without_unbatching(self, stream):
return self.load_stream(stream)

Expand Down Expand Up @@ -197,8 +196,8 @@ def _load_stream_without_unbatching(self, stream):
return self.serializer.load_stream(stream)

def __eq__(self, other):
return isinstance(other, BatchedSerializer) and \
other.serializer == self.serializer
return isinstance(other, BatchedSerializer) and
other.serializer == self.serializer

def __str__(self):
return "BatchedSerializer<%s>" % str(self.serializer)
Expand Down Expand Up @@ -229,8 +228,8 @@ def load_stream(self, stream):
yield pair

def __eq__(self, other):
return isinstance(other, CartesianDeserializer) and \
self.key_ser == other.key_ser and self.val_ser == other.val_ser
return isinstance(other, CartesianDeserializer) and
self.key_ser == other.key_ser and self.val_ser == other.val_ser

def __str__(self):
return "CartesianDeserializer<%s, %s>" % \
Expand All @@ -252,18 +251,20 @@ def load_stream(self, stream):
yield pair

def __eq__(self, other):
return isinstance(other, PairDeserializer) and \
self.key_ser == other.key_ser and self.val_ser == other.val_ser
return isinstance(other, PairDeserializer) and
self.key_ser == other.key_ser and self.val_ser == other.val_ser

def __str__(self):
return "PairDeserializer<%s, %s>" % \
(str(self.key_ser), str(self.val_ser))
return "PairDeserializer<%s, %s>" % (str(self.key_ser), str(self.val_ser))


class NoOpSerializer(FramedSerializer):

def loads(self, obj): return obj
def dumps(self, obj): return obj
def loads(self, obj):
return obj

def dumps(self, obj):
return obj


class PickleSerializer(FramedSerializer):
Expand All @@ -276,12 +277,16 @@ class PickleSerializer(FramedSerializer):
not be as fast as more specialized serializers.
"""

def dumps(self, obj): return cPickle.dumps(obj, 2)
def dumps(self, obj):
return cPickle.dumps(obj, 2)

loads = cPickle.loads


class CloudPickleSerializer(PickleSerializer):

def dumps(self, obj): return cloudpickle.dumps(obj, 2)
def dumps(self, obj):
return cloudpickle.dumps(obj, 2)


class MarshalSerializer(FramedSerializer):
Expand Down

0 comments on commit 95d1d95

Please sign in to comment.