review fixes
This commit is contained in:
@@ -30,7 +30,7 @@ from uuid import UUID
|
|||||||
import six
|
import six
|
||||||
|
|
||||||
from cassandra.util import (OrderedDict, OrderedMap, OrderedMapSerializedKey,
|
from cassandra.util import (OrderedDict, OrderedMap, OrderedMapSerializedKey,
|
||||||
sortedset, Time, Date, Duration)
|
sortedset, Time, Date)
|
||||||
|
|
||||||
if six.PY3:
|
if six.PY3:
|
||||||
long = int
|
long = int
|
||||||
@@ -88,8 +88,7 @@ class Encoder(object):
|
|||||||
sortedset: self.cql_encode_set_collection,
|
sortedset: self.cql_encode_set_collection,
|
||||||
frozenset: self.cql_encode_set_collection,
|
frozenset: self.cql_encode_set_collection,
|
||||||
types.GeneratorType: self.cql_encode_list_collection,
|
types.GeneratorType: self.cql_encode_list_collection,
|
||||||
ValueSequence: self.cql_encode_sequence,
|
ValueSequence: self.cql_encode_sequence
|
||||||
Duration: self.cql_encode_duration
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if six.PY2:
|
if six.PY2:
|
||||||
@@ -226,9 +225,3 @@ class Encoder(object):
|
|||||||
if :attr:`~Encoder.mapping` does not contain an entry for the type.
|
if :attr:`~Encoder.mapping` does not contain an entry for the type.
|
||||||
"""
|
"""
|
||||||
return self.mapping.get(type(val), self.cql_encode_object)(val)
|
return self.mapping.get(type(val), self.cql_encode_object)(val)
|
||||||
|
|
||||||
def cql_encode_duration(self, val):
|
|
||||||
"""
|
|
||||||
Encodes a :class:`cassandra.util.Duration` object as a string.
|
|
||||||
"""
|
|
||||||
return str(val)
|
|
||||||
|
|||||||
@@ -1232,7 +1232,7 @@ class Duration(object):
|
|||||||
return "Duration({0}, {1}, {2})".format(self.months, self.days, self.nanoseconds)
|
return "Duration({0}, {1}, {2})".format(self.months, self.days, self.nanoseconds)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '{0}{1}mo{2}d{3}ns'.format(
|
return '%s%dmo%dd%dns' % (
|
||||||
'-' if self._has_negative_values else '',
|
'-' if self._has_negative_values else '',
|
||||||
abs(self.months),
|
abs(self.months),
|
||||||
abs(self.days),
|
abs(self.days),
|
||||||
|
|||||||
Reference in New Issue
Block a user