From 360a1b4f337e45b2dc26c9af067e53fbd364231f Mon Sep 17 00:00:00 2001 From: Daniel Girtler Date: Sun, 24 Sep 2023 18:14:02 +1000 Subject: Unify json functions (#2102) Co-authored-by: Daniel Girtler --- archinstall/lib/models/audio_configuration.py | 2 +- archinstall/lib/models/bootloader.py | 8 ++++---- archinstall/lib/models/network_configuration.py | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'archinstall/lib/models') diff --git a/archinstall/lib/models/audio_configuration.py b/archinstall/lib/models/audio_configuration.py index 3a4029db..88cd5d8e 100644 --- a/archinstall/lib/models/audio_configuration.py +++ b/archinstall/lib/models/audio_configuration.py @@ -24,7 +24,7 @@ class Audio(Enum): class AudioConfiguration: audio: Audio - def __dump__(self) -> Dict[str, Any]: + def json(self) -> Dict[str, Any]: return { 'audio': self.audio.value } diff --git a/archinstall/lib/models/bootloader.py b/archinstall/lib/models/bootloader.py index be9812a0..fa3f32c8 100644 --- a/archinstall/lib/models/bootloader.py +++ b/archinstall/lib/models/bootloader.py @@ -14,12 +14,12 @@ class Bootloader(Enum): Efistub = 'Efistub' Limine = 'Limine' - def json(self): + def json(self) -> str: return self.value - @classmethod - def values(cls) -> List[str]: - return [e.value for e in cls] + @staticmethod + def values() -> List[str]: + return [e.value for e in Bootloader] @classmethod def get_default(cls) -> Bootloader: diff --git a/archinstall/lib/models/network_configuration.py b/archinstall/lib/models/network_configuration.py index fac7bbef..1777df62 100644 --- a/archinstall/lib/models/network_configuration.py +++ b/archinstall/lib/models/network_configuration.py @@ -42,7 +42,7 @@ class Nic: 'dns': self.dns } - def __dump__(self) -> Dict[str, Any]: + def json(self) -> Dict[str, Any]: return { 'iface': self.iface, 'ip': self.ip, @@ -94,10 +94,10 @@ class NetworkConfiguration: type: NicType nics: List[Nic] = field(default_factory=list) - def __dump__(self) -> Dict[str, Any]: + def json(self) -> Dict[str, Any]: config: Dict[str, Any] = {'type': self.type.value} if self.nics: - config['nics'] = [n.__dump__() for n in self.nics] + config['nics'] = [n.json() for n in self.nics] return config -- cgit v1.2.3-70-g09d2