Browse Source

Rename bulkdata.append_string to bulkdata.append_data

tags/nilmdb-1.5.0
Jim Paris 11 years ago
parent
commit
41ec13ee17
3 changed files with 6 additions and 6 deletions
  1. +1
    -1
      nilmdb/server/bulkdata.py
  2. +1
    -1
      nilmdb/server/nilmdb.py
  3. +4
    -4
      tests/test_bulkdata.py

+ 1
- 1
nilmdb/server/bulkdata.py View File

@@ -413,7 +413,7 @@ class Table(object):
return rocket.Rocket(self.layout,
os.path.join(self.root, subdir, filename))

def append_string(self, data, start, end, binary = False):
def append_data(self, data, start, end, binary = False):
"""Parse the formatted string in 'data', according to the
current layout, and append it to the table. If any timestamps
are non-monotonic, or don't fall between 'start' and 'end',


+ 1
- 1
nilmdb/server/nilmdb.py View File

@@ -494,7 +494,7 @@ class NilmDB(object):
# there are any parse errors.
table = self.data.getnode(path)
row_start = table.nrows
table.append_string(data, start, end)
table.append_data(data, start, end)
row_end = table.nrows

# Insert the record into the sql database.


+ 4
- 4
tests/test_bulkdata.py View File

@@ -69,9 +69,9 @@ class TestBulkData(object):
raw = []
for i in range(1000):
raw.append("%d 1 2 3 4 5 6 7 8\n" % (10000 + i))
node.append_string("".join(raw[0:1]), 0, 50000)
node.append_string("".join(raw[1:100]), 0, 50000)
node.append_string("".join(raw[100:]), 0, 50000)
node.append_data("".join(raw[0:1]), 0, 50000)
node.append_data("".join(raw[1:100]), 0, 50000)
node.append_data("".join(raw[100:]), 0, 50000)

misc_slices = [ 0, 100, slice(None), slice(0), slice(10),
slice(5,10), slice(3,None), slice(3,-3),
@@ -85,7 +85,7 @@ class TestBulkData(object):
# Extract misc slices while appending, to make sure the
# data isn't being added in the middle of the file
for s in [2, slice(1,5), 2, slice(1,5)]:
node.append_string("0 0 0 0 0 0 0 0 0\n", 0, 50000)
node.append_data("0 0 0 0 0 0 0 0 0\n", 0, 50000)
raw.append("0 0 0 0 0 0 0 0 0\n")
eq_(get_node_slice(s), raw[s])



Loading…
Cancel
Save