21 lines
327 B
Python
21 lines
327 B
Python
import json
|
|
|
|
|
|
class Loader:
|
|
def load(self, file: str):
|
|
raise NotImplementedError()
|
|
|
|
def get_entry(self) -> object:
|
|
raise NotImplementedError()
|
|
|
|
|
|
class JSONLoader(Loader):
|
|
data = None
|
|
|
|
def load(self, file: str):
|
|
self.data = json.load(open(file))
|
|
|
|
def get_entry(self) -> dict:
|
|
for entry in self.data:
|
|
yield entry
|