Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/models
diff options
context:
space:
mode:
authorDaniel Girtler <blackrabbit256@gmail.com>2023-09-24 18:14:02 +1000
committerGitHub <noreply@github.com>2023-09-24 10:14:02 +0200
commit360a1b4f337e45b2dc26c9af067e53fbd364231f (patch)
tree665a42dffec8c3b174e41f2e60d669d8dbe44351 /archinstall/lib/models
parent877e34de6353691fb9707828a5880c27655f1d1b (diff)
Unify json functions (#2102)
Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
Diffstat (limited to 'archinstall/lib/models')
-rw-r--r--archinstall/lib/models/audio_configuration.py2
-rw-r--r--archinstall/lib/models/bootloader.py8
-rw-r--r--archinstall/lib/models/network_configuration.py6
3 files changed, 8 insertions, 8 deletions
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