chore(dataclass): use default_factory

Signed-off-by: Raito Bezarius <raito@lix.systems>
This commit is contained in:
raito 2024-07-19 19:24:33 +02:00 committed by Jade Lovelace
parent 22b9d3f02a
commit bf7f5052c1

View file

@ -5,7 +5,7 @@ import sys
import graphlib
import base64
from collections.abc import Generator
from dataclasses import dataclass
from dataclasses import dataclass, field
from pathlib import Path
from typing import TYPE_CHECKING, Any
@ -49,9 +49,9 @@ class NixBuilder:
publicHostKey: str | None = None
sshUser: str | None = None
sshKey: str | None = None
systems: list[str] = ["-"]
supportedFeatures: list[str] = ["-"]
mandatoryFeatures: list[str] = ["-"]
systems: list[str] = field(default_factory=lambda: ["-"])
supportedFeatures: list[str] = field(default_factory=lambda: ["-"])
mandatoryFeatures: list[str] = field(default_factory=lambda: ["-"])
def to_nix_line(self):
encoded_public_key = base64.b64encode(self.publicHostKey.encode('ascii')).decode('ascii') if self.publicHostKey is not None else "-"