-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add adapter interface and memory adapter
- Loading branch information
Showing
4 changed files
with
28 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
from rltk.io.reader import Reader | ||
from rltk.io.csv_reader import CSVReader | ||
from rltk.io.jsonlines_reader import JsonLinesReader | ||
from rltk.io.adapter import Adapter | ||
from rltk.io.memory_adapter import MemoryAdapter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from rltk.record import Record | ||
|
||
|
||
class Adapter(object): | ||
def __init__(self): | ||
pass | ||
|
||
def __del__(self): | ||
pass | ||
|
||
def get(self, record_id) -> Record: | ||
raise NotImplementedError | ||
|
||
def set(self, record_id, record: Record): | ||
raise NotImplementedError | ||
|
||
def __iter__(self): | ||
return self.__next__() | ||
|
||
def __next__(self): | ||
"""iterator is not required in adapter""" | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters