21 lines
688 B
Python
21 lines
688 B
Python
|
from .idatahandler import IDataHandler
|
||
|
|
||
|
|
||
|
def get_datahandlerclass(datatype: str) -> IDataHandler:
|
||
|
"""
|
||
|
Get datahandler class.
|
||
|
Could be done using Resolvers, but since this may be called often and resolvers
|
||
|
are rather expensive, doing this directly should improve performance.
|
||
|
:param datatype: datatype to use.
|
||
|
:return: Datahandler class
|
||
|
"""
|
||
|
|
||
|
if datatype == 'json':
|
||
|
from .jsondatahandler import JsonDataHandler
|
||
|
return JsonDataHandler
|
||
|
elif datatype == 'jsongz':
|
||
|
from .jsondatahandler import JsonGzDataHandler
|
||
|
return JsonGzDataHandler
|
||
|
else:
|
||
|
raise ValueError(f"No datahandler for datatype {datatype} available.")
|