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/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/w/h/Whoosh-1.0.0/src/whoosh/filedb/filetables.py Whoosh(Download)
from array import array from collections import defaultdict from cPickle import loads, dumps from struct import Struct from whoosh.filedb.misc import enpickle, depickle from whoosh.system import _INT_SIZE, _LONG_SIZE
# h = (h + (h << 5)) & 0xffffffffL ^ ord(c)
# return h
_header_entry_struct = Struct("!qI") # Position, number of slots
header_entry_size = _header_entry_struct.size
pack_header_entry = _header_entry_struct.pack
unpack_header_entry = _header_entry_struct.unpack
_lengths_struct = Struct("!II") # Length of key, length of data
lengths_size = _lengths_struct.size
pack_lengths = _lengths_struct.pack
unpack_lengths = _lengths_struct.unpack
_pointer_struct = Struct("!qq") # Hash value, position
return byte_to_length(byte)
_stored_pointer_struct = Struct("!qI") # offset, length
stored_pointer_size = _stored_pointer_struct.size
pack_stored_pointer = _stored_pointer_struct.pack
unpack_stored_pointer = _stored_pointer_struct.unpack
src/p/y/py-postgresql-1.0.2/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/a/l/alfanous-HEAD/trunk/src/alfanous/Support/whoosh/filedb/postpool.py alfanous(Download)
import os, tempfile
from heapq import heapify, heapreplace, heappop
from struct import Struct
from alfanous.Support.whoosh.filedb.structfile import StructFile, pack_ushort, unpack_ushort
from alfanous.Support.whoosh.system import _INT_SIZE, _USHORT_SIZE
from alfanous.Support.whoosh.util import utf8encode, utf8decode
# Utility functions
_2int_struct = Struct("!II")
1 | 2 | 3 | 4 Next