[V3 Config] Require custom group initialization before usage (#2545)

* Require custom group initialization before usage and write that data to disk

* Style

* add tests

* remove custom info update method from drivers

* clean up remnant

* Turn config objects into a singleton to deal with custom group identifiers

* Fix dumbassery

* Stupid stupid stupid
This commit is contained in:
Will
2019-04-04 21:47:08 -04:00
committed by GitHub
parent fb722c79be
commit 0852d1be9f
6 changed files with 86 additions and 5 deletions

View File

@@ -4,11 +4,21 @@ __all__ = ["BaseDriver", "IdentifierData"]
class IdentifierData:
def __init__(self, uuid: str, category: str, primary_key: Tuple[str], identifiers: Tuple[str]):
def __init__(
self,
uuid: str,
category: str,
primary_key: Tuple[str],
identifiers: Tuple[str],
custom_group_data: dict,
is_custom: bool = False,
):
self._uuid = uuid
self._category = category
self._primary_key = primary_key
self._identifiers = identifiers
self.custom_group_data = custom_group_data
self._is_custom = is_custom
@property
def uuid(self):
@@ -26,6 +36,10 @@ class IdentifierData:
def identifiers(self):
return self._identifiers
@property
def is_custom(self):
return self._is_custom
def __repr__(self):
return (
f"<IdentifierData uuid={self.uuid} category={self.category} primary_key={self.primary_key}"
@@ -37,7 +51,12 @@ class IdentifierData:
raise ValueError("Identifiers must be strings.")
return IdentifierData(
self.uuid, self.category, self.primary_key, self.identifiers + identifier
self.uuid,
self.category,
self.primary_key,
self.identifiers + identifier,
self.custom_group_data,
is_custom=self.is_custom,
)
def to_tuple(self):