Will f9d846a704 [V3 Config] Driver code initial cleanup (#1315)
* Remove get_driver

* Rename self.driver to self._driver

* Do not unnecessarily pass the cog identifier

* Remove unused import

* Fix type annotation

* Missed a keyword rename

* Modify signature of get/set methods in drivers
2018-02-18 18:30:32 -09:00

42 lines
1.1 KiB
Python

from typing import Tuple
__all__ = ["BaseDriver"]
class BaseDriver:
def __init__(self, cog_name):
self.cog_name = cog_name
self.unique_cog_identifier = None # This is set by Config's init method
async def get(self, *identifiers: Tuple[str]):
"""
Finds the value indicate by the given identifiers.
:param identifiers:
A list of identifiers that correspond to nested dict accesses.
:return:
Stored value.
"""
raise NotImplementedError
def get_config_details(self):
"""
Asks users for additional configuration information necessary
to use this config driver.
:return:
Dict of configuration details.
"""
raise NotImplementedError
async def set(self, *identifiers: Tuple[str], value=None):
"""
Sets the value of the key indicated by the given identifiers.
:param identifiers:
A list of identifiers that correspond to nested dict accesses.
:param value:
Any JSON serializable python object.
"""
raise NotImplementedError