src/a/l/alfanous-HEAD/trunk/src/alfanous/Support/whoosh/filedb/structfile.py alfanous(Download)
import mmap, os from cPickle import dump as dump_pickle from cPickle import load as load_pickle from struct import calcsize, unpack, Struct from alfanous.Support.whoosh.system import _INT_SIZE, _USHORT_SIZE, _ULONG_SIZE, _FLOAT_SIZE from alfanous.Support.whoosh.util import varint, read_varint, float_to_byte, byte_to_float
_types = (("sbyte", "b"), ("ushort", "H"), ("int", "i"),
("ulong", "L"), ("float", "f"))
_sbyte_struct = Struct("!b")
_ushort_struct = Struct("!H")
_int_struct = Struct("!i")
_uint_struct = Struct("!I")
_ulong_struct = Struct("!L")
_float_struct = Struct("!f")
src/c/h/changingsong-HEAD/changingsong/lib/whoosh/filedb/structfile.py changingsong(Download)
import mmap, os from cPickle import dump as dump_pickle from cPickle import load as load_pickle from struct import calcsize, unpack, Struct from whoosh.system import _INT_SIZE, _USHORT_SIZE, _ULONG_SIZE, _FLOAT_SIZE from whoosh.util import varint, read_varint, float_to_byte, byte_to_float
_types = (("sbyte", "b"), ("ushort", "H"), ("int", "i"),
("ulong", "L"), ("float", "f"))
_sbyte_struct = Struct("!b")
_ushort_struct = Struct("!H")
_int_struct = Struct("!i")
_uint_struct = Struct("!I")
_ulong_struct = Struct("!L")
_float_struct = Struct("!f")
src/w/h/Whoosh-1.0.0/src/whoosh/system.py Whoosh(Download)
#===============================================================================
from struct import Struct, calcsize
_INT_SIZE = calcsize("!i")
_SHORT_SIZE = calcsize("!H")
_LONG_SIZE = calcsize("!Q")
_FLOAT_SIZE = calcsize("!f")
_sbyte_struct = Struct("!b")
_ushort_struct = Struct("!H")
_int_struct = Struct("!i")
_uint_struct = Struct("!I")
_ushort_struct = Struct("!H")
_int_struct = Struct("!i")
_uint_struct = Struct("!I")
_long_struct = Struct("!q")
_float_struct = Struct("!f")
pack_sbyte = _sbyte_struct.pack
src/p/a/passover-HEAD/reader/filestructs.py passover(Download)
"""
passover filestructs: reading the codepoints file and the traces
"""
import os
from cStringIO import StringIO
from struct import Struct, error as StructError
UINT8 = Struct("=B")
UINT16 = Struct("=H")
UINT32 = Struct("=L")
UINT64 = Struct("=Q")
TIMEINDEX_RECORD = Struct("=QQ")
def read(self, count):
return self.file.read(count)
ROTREC_HEADER = UINT64
class RotdirReader(object):
__slots__ = ["path", "files", "min_offset", "max_offset", "curr_file", "curr_offset"]
src/e/l/Elements-HEAD/lib/elements/async/impl/fastcgi.py Elements(Download)
# ----------------------------------------------------------------------------------------------------------------------
HEADER_STRUCT = struct.Struct('>BBHHBx')
BEGIN_REQUEST_STRUCT = struct.Struct('>HBxxxxx')
END_REQUEST_STRUCT = struct.Struct('>IBxxx')
UNKNOWN_TYPE_STRUCT = struct.Struct('>Bxxxxxxx')
SINGLE_INTEGER_STRUCT = struct.Struct('>I')
NAME_VALUE_PAIR_STRUCTS = { 0x0 | 0x0: struct.Struct('>BB'),
0x0 | 0x2: struct.Struct('>BI'),
0x1 | 0x0: struct.Struct('>IB'),
0x1 | 0x2: struct.Struct('>II') }
src/a/l/alfanous-HEAD/trunk/src/alfanous/Support/whoosh/filedb/filetables.py alfanous(Download)
from bisect import bisect_right from collections import defaultdict from cPickle import dumps, loads from struct import Struct from alfanous.Support.whoosh.system import _USHORT_SIZE, _INT_SIZE from alfanous.Support.whoosh.util import utf8encode, utf8decode
# Read/write convenience functions
_2ints = Struct("!II")
pack2ints = _2ints.pack
def writeints(f, value1, value2):
f.write(pack2ints(value1, value2))
# Encoders and decoders for storing complex types in
# string -> string hash files.
_int_struct = Struct("!i")
packint = _int_struct.pack
_unpackint = _int_struct.unpack
def unpackint(s):
return _unpackint(s)[0]
_ushort_struct = Struct("!H")
def decode_termkey(key):
return unpackushort(key[:_USHORT_SIZE]), utf8decode(key[_USHORT_SIZE:])[0]
_vkey_struct = Struct("!Ii")
_pack_vkey = _vkey_struct.pack
def encode_vectorkey(docandfield):
return _pack_vkey(*docandfield)
decode_vectorkey = _vkey_struct.unpack
encode_docnum = packint
decode_docnum = unpackint
_terminfo_struct = Struct("!ILI")
def __init__(self, dbfile, format):
self.dbfile = dbfile
self.map = dbfile.map
self.format = format
struct = Struct(format)
self._unpack = struct.unpack
self.itemsize = struct.size
src/c/h/changingsong-HEAD/changingsong/lib/whoosh/filedb/filetables.py changingsong(Download)
from bisect import bisect_right from collections import defaultdict from cPickle import dumps, loads from struct import Struct from whoosh.system import _USHORT_SIZE, _INT_SIZE from whoosh.util import utf8encode, utf8decode
# Read/write convenience functions
_2ints = Struct("!II")
pack2ints = _2ints.pack
def writeints(f, value1, value2):
f.write(pack2ints(value1, value2))
# Encoders and decoders for storing complex types in
# string -> string hash files.
_int_struct = Struct("!i")
packint = _int_struct.pack
_unpackint = _int_struct.unpack
def unpackint(s):
return _unpackint(s)[0]
_ushort_struct = Struct("!H")
def decode_termkey(key):
return unpackushort(key[:_USHORT_SIZE]), utf8decode(key[_USHORT_SIZE:])[0]
_vkey_struct = Struct("!Ii")
_pack_vkey = _vkey_struct.pack
def encode_vectorkey(docandfield):
return _pack_vkey(*docandfield)
decode_vectorkey = _vkey_struct.unpack
encode_docnum = packint
decode_docnum = unpackint
_terminfo_struct = Struct("!ILI")
def __init__(self, dbfile, format):
self.dbfile = dbfile
self.map = dbfile.map
self.format = format
struct = Struct(format)
self._unpack = struct.unpack
self.itemsize = struct.size
src/p/y/py-postgresql-HEAD/postgresql/protocol/element3.py py-postgresql(Download)
import sys import os import pprint from struct import unpack, Struct from .message_types import message_types from ..python.structlib import ushort_pack, ushort_unpack, ulong_pack, ulong_unpack
class Message(object):
bytes_struct = Struct("!cL")
__slots__ = ()
def __repr__(self):
return '%s.%s(%s)' %(
type(self).__module__,
type(self).__name__,
class TupleDescriptor(TupleMessage):
"""Tuple description"""
type = message_types[b'T'[0]]
struct = Struct("!LhLhlh")
__slots__ = ()
def keys(self):
class KillInformation(Message):
'Backend cancellation information'
type = message_types[b'K'[0]]
struct = Struct("!LL")
__slots__ = ('pid', 'key')
def __init__(self, pid, key):
class CopyBegin(Message):
type = None
struct = Struct("!BH")
__slots__ = ('format', 'formats')
def __init__(self, format, formats):
self.format = format
src/p/y/pycassa-HEAD/pycassa/columnfamily.py pycassa(Download)
if hasattr(struct, 'Struct'): # new in Python 2.5
_have_struct = True
_long_packer = struct.Struct('>q')
_int_packer = struct.Struct('>i')
_uuid_packer = struct.Struct('>16s')
else:
src/a/r/ARCTool-HEAD/ARCTool.py ARCTool(Download)
def __init__(self): self._s = struct.Struct(self._structformat) def unpack(self, buf): s = self s.filesize, s.dataStartOffset, s.numNodes, s.fileEntriesOffset, s.stringTableOffset = s._s.unpack_from(buf) def size(self): #print self._s.size, "ohai"
def __init__(self): self._s = struct.Struct(self._structformat) def unpack(self, buf): s = self s.type, s.filenameOffset, s.numFileEntries, s.firstFileEntryOffset = s._s.unpack_from(buf) def size(self): #print self._s.size
def __init__(self): self._s = struct.Struct(self._structformat) def unpack(self, buf): s = self s.id, s.filenameOffset, s.dataOffset, s.dataSize = s._s.unpack_from(buf) def size(self): return self._s.size
def __init__(self): self._s = struct.Struct(self._structformat) def unpack(self, buf): s = self s.rootnode_offset, s.header_size, s.data_offset = s._s.unpack_from(buf) def size(self): return self._s.size
def __init__(self): self._s = struct.Struct(self._structformat) def unpack(self, buf): s = self s.type, s.name_offset, s.data_offset, s.fsize = s._s.unpack_from(buf) def size(self): return self._s.size
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next