Use slots for all dataclasses
The minimum Python version was bumped to 3.10 so this is now safe.
This commit is contained in:
parent
8e234ce0cd
commit
86203a4b86
5 changed files with 4 additions and 23 deletions
|
|
@ -7,7 +7,6 @@ from . import log
|
|||
from . import main
|
||||
from . import music
|
||||
from . import net
|
||||
from . import python
|
||||
from . import repairs
|
||||
from . import setup
|
||||
from . import sources
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
"""WizardKit: Config - Python"""
|
||||
# vim: sts=2 sw=2 ts=2
|
||||
|
||||
from sys import version_info
|
||||
|
||||
DATACLASS_DECORATOR_KWARGS = {}
|
||||
if version_info.major >= 3 and version_info.minor >= 10:
|
||||
DATACLASS_DECORATOR_KWARGS['slots'] = True
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print("This file is not meant to be called directly.")
|
||||
|
||||
# vim: sts=2 sw=2 ts=2
|
||||
|
|
@ -12,7 +12,6 @@ from dataclasses import dataclass, field
|
|||
from typing import Any
|
||||
|
||||
from wk.cfg.main import KIT_NAME_SHORT
|
||||
from wk.cfg.python import DATACLASS_DECORATOR_KWARGS
|
||||
from wk.exe import get_json_from_command, run_program
|
||||
from wk.hw.test import Test
|
||||
from wk.hw.smart import (
|
||||
|
|
@ -32,7 +31,7 @@ WK_LABEL_REGEX = re.compile(
|
|||
|
||||
|
||||
# Classes
|
||||
@dataclass(**DATACLASS_DECORATOR_KWARGS)
|
||||
@dataclass(slots=True)
|
||||
class Disk:
|
||||
"""Object for tracking disk specific data."""
|
||||
attributes: dict[Any, dict] = field(init=False, default_factory=dict)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ from dataclasses import dataclass, field
|
|||
from typing import Any
|
||||
|
||||
from wk.cfg.hw import KNOWN_RAM_VENDOR_IDS
|
||||
from wk.cfg.python import DATACLASS_DECORATOR_KWARGS
|
||||
from wk.exe import get_json_from_command, run_program
|
||||
from wk.hw.test import Test
|
||||
from wk.std import PLATFORM, bytes_to_string, string_to_bytes
|
||||
|
|
@ -20,7 +19,7 @@ from wk.ui import ansi
|
|||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_DECORATOR_KWARGS)
|
||||
@dataclass(slots=True)
|
||||
class System:
|
||||
"""Object for tracking system specific hardware data."""
|
||||
cpu_description: str = field(init=False)
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@
|
|||
from dataclasses import dataclass, field
|
||||
from typing import Any, Callable
|
||||
|
||||
from wk.cfg.python import DATACLASS_DECORATOR_KWARGS
|
||||
|
||||
@dataclass(**DATACLASS_DECORATOR_KWARGS)
|
||||
@dataclass(slots=True)
|
||||
class Test:
|
||||
"""Object for tracking test specific data."""
|
||||
dev: Any
|
||||
|
|
@ -28,7 +26,7 @@ class Test:
|
|||
self.status = status
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_DECORATOR_KWARGS)
|
||||
@dataclass(slots=True)
|
||||
class TestGroup:
|
||||
"""Object for tracking groups of tests."""
|
||||
name: str
|
||||
|
|
|
|||
Loading…
Reference in a new issue