chore(dataclass): use default_factory

Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
This commit is contained in:
raito 2024-07-19 15:48:07 +02:00
parent 4ad5459da8
commit 7cafac3125

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
@ -47,9 +47,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 "-"