File: testernesto.py

package info (click to toggle)
egenix-mx-base 3.2.1-1.1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 8,496 kB
  • sloc: ansic: 21,976; python: 17,192; sh: 137; makefile: 116
file content (41 lines) | stat: -rw-r--r-- 751 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/local/bin/python

from mx.BeeBase import BeeStorage, BeeDict

BeeStorage._debug = 1
BeeDict._debug = 1

def part1():

    # Fill initial version of the dictionary
    d = BeeDict.BeeDict('testernesto', autocommit=1)
    for i in range(1000):
        d[i] = "A"*i
    d.commit()
    #d.free_cache()
    d.close()


def part2():

    # Update a few values
    d = BeeDict.BeeDict('testernesto', autocommit=1)
    for i in range(100,300):
        d[i] = "C" * i
    d.commit()

import sys
if sys.argv[1] == 'init':
    import os
    for filename in ('testernesto.dat',
                     'testernesto.idx',
                     ):
      try:
        os.remove(filename)
      except:
        pass
    part1()

else:
    part2()