Remove Python 3.10 requirement

This commit is contained in:
2Shirt 2022-05-20 17:08:10 -07:00
parent fddd77e6fd
commit cf7ed909b3
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
5 changed files with 23 additions and 4 deletions

View file

@ -7,6 +7,7 @@ from . import log
from . import main
from . import music
from . import net
from . import python
from . import repairs
from . import setup
from . import sources

14
scripts/wk/cfg/python.py Normal file
View file

@ -0,0 +1,14 @@
"""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

View file

@ -10,6 +10,7 @@ from dataclasses import dataclass, field
from typing import Any, Union
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 (
@ -29,7 +30,7 @@ WK_LABEL_REGEX = re.compile(
# Classes
@dataclass(slots=True)
@dataclass(**DATACLASS_DECORATOR_KWARGS)
class Disk:
# pylint: disable=too-many-instance-attributes
"""Object for tracking disk specific data."""

View file

@ -9,6 +9,7 @@ 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 (
@ -23,7 +24,7 @@ from wk.std import (
LOG = logging.getLogger(__name__)
@dataclass(slots=True)
@dataclass(**DATACLASS_DECORATOR_KWARGS)
class System:
"""Object for tracking system specific hardware data."""
cpu_description: str = field(init=False)

View file

@ -4,7 +4,9 @@
from dataclasses import dataclass, field
from typing import Any, Callable
@dataclass(slots=True)
from wk.cfg.python import DATACLASS_DECORATOR_KWARGS
@dataclass(**DATACLASS_DECORATOR_KWARGS)
class Test:
# pylint: disable=too-many-instance-attributes
"""Object for tracking test specific data."""
@ -27,7 +29,7 @@ class Test:
self.status = status
@dataclass(slots=True)
@dataclass(**DATACLASS_DECORATOR_KWARGS)
class TestGroup:
"""Object for tracking groups of tests."""
name: str