Пример #1
0
 def save(self, filename):
     if self.config['t'] == 'string':
         fastdict.save_compress_uint32_string(filename, self.storage)
     elif self.config['t'] == 'int8':
         fastdict.save_compress_uint32_int8(filename, self.storage)
     elif self.config['t'] == 'int32':
         fastdict.save_compress_uint32_int(filename, self.storage)
Пример #2
0
 def save(self, filename):
     if self.config['t'] == 'string':
         fastdict.save_compress_uint32_string(filename, self.storage)
     elif self.config['t'] == 'int8':
         fastdict.save_compress_uint32_int8(filename, self.storage)
     elif self.config['t'] == 'int32':
         fastdict.save_compress_uint32_int(filename, self.storage)
Пример #3
0
    def test_saveandload(self):
        f_dict = fastdict.FastCompressUInt32IntDict(self.dimension)    
        f_dict.set(123, 78912893, 0)
        f_dict.set(456, 789, 1)

        fastdict.save_compress_uint32_int("test.dict", f_dict)
        another_f_dict = fastdict.FastCompressUInt32IntDict(self.dimension)
        fastdict.load_compress_uint32_int("test.dict", another_f_dict)

        self.assertEqual(another_f_dict.size(), 2)
Пример #4
0
    def test_saveandload(self):
        f_dict = fastdict.FastCompressUInt32IntDict(self.dimension)
        f_dict.set(123, 78912893, 0)
        f_dict.set(456, 789, 1)

        fastdict.save_compress_uint32_int("test.dict", f_dict)
        another_f_dict = fastdict.FastCompressUInt32IntDict(self.dimension)
        fastdict.load_compress_uint32_int("test.dict", another_f_dict)

        self.assertEqual(another_f_dict.size(), 2)
Пример #5
0
    def test_keydimensions(self):
        f_dict = fastdict.FastCompressUInt32IntDict(self.dimension)
        f_dict.set_keydimensions([1, 2, 3])

        keydimensions = []
        f_dict.get_keydimensions(keydimensions)
        self.assertEqual(keydimensions, [1, 2, 3])

        fastdict.save_compress_uint32_int("test.dict", f_dict)
        another_f_dict = fastdict.FastCompressUInt32IntDict(self.dimension)
        fastdict.load_compress_uint32_int("test.dict", another_f_dict)

        keydimensions = []
        another_f_dict.get_keydimensions(keydimensions)
        self.assertEqual(keydimensions, [1, 2, 3])
Пример #6
0
    def test_keydimensions(self):
        f_dict = fastdict.FastCompressUInt32IntDict(self.dimension)
        f_dict.set_keydimensions([1, 2, 3])

        keydimensions = []
        f_dict.get_keydimensions(keydimensions)
        self.assertEqual(keydimensions, [1, 2, 3])

        fastdict.save_compress_uint32_int("test.dict", f_dict)
        another_f_dict = fastdict.FastCompressUInt32IntDict(self.dimension)
        fastdict.load_compress_uint32_int("test.dict", another_f_dict)

        keydimensions = []
        another_f_dict.get_keydimensions(keydimensions)
        self.assertEqual(keydimensions, [1, 2, 3])
    print ele.second

f_dict.set(456, 789, 2)

print f_dict.keys()

for key in f_dict.keys():
    print "key: " + str(key)

for key in f_dict.mget([123, 456]):
    print key.first
    print key.second

f_dict.set_keydimensions([1, 2, 3])

fastdict.save_compress_uint32_int("test.dict", f_dict)

f_dict = fastdict.FastCompressUInt32IntDict(8)

print f_dict.size()

fastdict.load_compress_uint32_int("test.dict", f_dict)

print f_dict.size()

f_dict_merge_source = fastdict.FastCompressUInt32IntDict(8)

f_dict_merge_source.set(789, 123, 3)

print f_dict_merge_source.size()
    print ele.second

f_dict.set(456, 789, 2)

print f_dict.keys()

for key in f_dict.keys():
    print "key: " + str(key)

for key in f_dict.mget([123, 456]):
    print key.first
    print key.second

f_dict.set_keydimensions([1, 2, 3])

fastdict.save_compress_uint32_int("test.dict", f_dict)

f_dict = fastdict.FastCompressUInt32IntDict(8)

print f_dict.size()

fastdict.load_compress_uint32_int("test.dict", f_dict)

print f_dict.size()
 
f_dict_merge_source = fastdict.FastCompressUInt32IntDict(8)

f_dict_merge_source.set(789, 123, 3)

print f_dict_merge_source.size()