move files into a package structure

This commit is contained in:
2022-02-06 16:16:31 +01:00
parent b45a952213
commit 1e3782aaa4
23 changed files with 32 additions and 31 deletions

View File

@@ -0,0 +1,22 @@
import os
import tempfile
from typing import Optional
from raven.util.int2intmap import Int2IntMap
class LineToLineMap:
def __init__(self):
(handle, self.tmpfilename) = tempfile.mkstemp()
os.close(handle)
self._int2intmap = Int2IntMap(self.tmpfilename)
def close(self):
self._int2intmap.close()
os.remove(self.tmpfilename)
def add_line(self, key_byte_start: int, value_byte_start):
self._int2intmap.add(key_byte_start, value_byte_start)
def get_line(self, key_byte_start: int) -> Optional[int]:
return self._int2intmap.find(key_byte_start)