本文整理汇总了Python中pycassa.marshal.unpacker_for函数的典型用法代码示例。如果您正苦于以下问题:Python unpacker_for函数的具体用法?Python unpacker_for怎么用?Python unpacker_for使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了unpacker_for函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, reversed=False, default=None):
self.reversed = reversed
self.default = default
if not hasattr(self.__class__, 'pack'):
self.pack = marshal.packer_for(self.__class__.__name__)
if not hasattr(self.__class__, 'unpack'):
self.unpack = marshal.unpacker_for(self.__class__.__name__)
示例2: _set_default_validation_class
def _set_default_validation_class(self, t):
if isinstance(t, types.CassandraType):
self._default_validation_class = t
self._default_value_packer = t.pack
self._default_value_unpacker = t.unpack
have_counters = isinstance(t, types.CounterColumnType)
else:
self._default_validation_class = marshal.extract_type_name(t)
self._default_value_packer = marshal.packer_for(t)
self._default_value_unpacker = marshal.unpacker_for(t)
have_counters = self._default_validation_class == "CounterColumnType"
if not self.super:
if have_counters:
def _make_cosc(name, value, timestamp, ttl):
return ColumnOrSuperColumn(counter_column=CounterColumn(name, value))
else:
def _make_cosc(name, value, timestamp, ttl):
return ColumnOrSuperColumn(Column(name, value, timestamp, ttl))
self._make_cosc = _make_cosc
else:
if have_counters:
def _make_column(name, value, timestamp, ttl):
return CounterColumn(name, value)
self._make_column = _make_column
def _make_cosc(scol_name, subcols):
return ColumnOrSuperColumn(counter_super_column=(SuperColumn(scol_name, subcols)))
else:
self._make_column = Column
def _make_cosc(scol_name, subcols):
return ColumnOrSuperColumn(super_column=(SuperColumn(scol_name, subcols)))
self._make_cosc = _make_cosc
示例3: __setitem__
def __setitem__(self, item, value):
if isinstance(value, types.CassandraType):
self.type_map[item] = value
self.packers[item] = value.pack
self.unpackers[item] = value.unpack
else:
self.type_map[item] = marshal.extract_type_name(value)
self.packers[item] = marshal.packer_for(value)
self.unpackers[item] = marshal.unpacker_for(value)
示例4: _set_key_validation_class
def _set_key_validation_class(self, t):
if isinstance(t, types.CassandraType):
self._key_validation_class = t
self._key_packer = t.pack
self._key_unpacker = t.unpack
else:
self._key_validation_class = marshal.extract_type_name(t)
self._key_packer = marshal.packer_for(t)
self._key_unpacker = marshal.unpacker_for(t)
示例5: _set_super_column_name_class
def _set_super_column_name_class(self, t):
if isinstance(t, types.CassandraType):
self._super_column_name_class = t
self._super_name_packer = t.pack
self._super_name_unpacker = t.unpack
else:
self._super_column_name_class = marshal.extract_type_name(t)
self._super_name_packer = marshal.packer_for(t)
self._super_name_unpacker = marshal.unpacker_for(t)
示例6: __init__
def __init__(self, reversed=False, default=None):
"""
A data type that Cassandra is aware of and knows
how to validate and sort.
If `reversed` is true and this is used as a column comparator,
the columns will be sorted in reverse order.
This is also used to specify fields to be persisted when
a class is used with :class:`~.ColumnFamilyMap`.
The `default` parameter only applies to use of this
with ColumnFamilyMap, where `default` is used if a row
does not contain a column corresponding to this item.
.. versionadded:: 1.2.0
"""
self.reversed = reversed
self.default = default
self.pack = marshal.packer_for(self.__class__.__name__)
self.unpack = marshal.unpacker_for(self.__class__.__name__)
示例7: __init__
def __init__(self, reversed=False, default=None):
self.reversed = reversed
self.default = default
self.pack = marshal.packer_for(self.__class__.__name__)
self.unpack = marshal.unpacker_for(self.__class__.__name__)
示例8: __init__
def __init__(self, *args, **kwargs):
super(PickleType, self).__init__(*args, **kwargs)
self.pack_bytes = marshal.packer_for('BytesType')
self.unpack_bytes = marshal.unpacker_for('BytesType')
示例9: __init__
def __init__(self, *args, **kwargs):
super(MicrosecondTimestampType, self).__init__(*args, **kwargs)
self.pack_integer = marshal.packer_for('IntegerType')
self.unpack_integer = marshal.unpacker_for('IntegerType')
示例10: __init__
def __init__(self, *args, **kwargs):
super(RealType, self).__init__(*args, **kwargs)
self.pack_ascii = marshal.packer_for('AsciiType')
self.unpack_ascii = marshal.unpacker_for('AsciiType')