MCPcopy Create free account
hub / github.com/awslabs/gap-text2sql / IndexedFileWriter

Class IndexedFileWriter

rat-sql-gap/seq2struct/utils/indexed_file.py:17–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15
16
17class IndexedFileWriter(object):
18 def __init__(self, path):
19 self.f = open(path, 'wb')
20 self.index_f = open(path + '.index', 'wb')
21
22 def append(self, record):
23 offset = self.f.tell()
24 self.f.write(record)
25 self.index_f.write(struct.pack('<Q', offset))
26
27 def close(self):
28 self.f.close()
29 self.index_f.close()
30
31
32class IndexedFileReader(object):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected