From fee2dd0bdaea736eedfe8b8e7591644fc891e28a Mon Sep 17 00:00:00 2001 From: dw-0 Date: Sun, 14 Jul 2024 14:44:08 +0200 Subject: [PATCH] refactor: use | instead of Union Signed-off-by: Dominik Willner --- .../klipper_firmware/flash_options.py | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/kiauh/components/klipper_firmware/flash_options.py b/kiauh/components/klipper_firmware/flash_options.py index 775fa9c..420a426 100644 --- a/kiauh/components/klipper_firmware/flash_options.py +++ b/kiauh/components/klipper_firmware/flash_options.py @@ -6,10 +6,11 @@ # # # This file may be distributed under the terms of the GNU GPLv3 license # # ======================================================================= # +from __future__ import annotations from dataclasses import field from enum import Enum -from typing import List, Union +from typing import List class FlashMethod(Enum): @@ -30,9 +31,9 @@ class ConnectionType(Enum): class FlashOptions: _instance = None - _flash_method: Union[FlashMethod, None] = None - _flash_command: Union[FlashCommand, None] = None - _connection_type: Union[ConnectionType, None] = None + _flash_method: FlashMethod | None = None + _flash_command: FlashCommand | None = None + _connection_type: ConnectionType | None = None _mcu_list: List[str] = field(default_factory=list) _selected_mcu: str = "" _selected_board: str = "" @@ -48,27 +49,27 @@ class FlashOptions: cls._instance = None @property - def flash_method(self) -> Union[FlashMethod, None]: + def flash_method(self) -> FlashMethod | None: return self._flash_method @flash_method.setter - def flash_method(self, value: Union[FlashMethod, None]): + def flash_method(self, value: FlashMethod | None): self._flash_method = value @property - def flash_command(self) -> Union[FlashCommand, None]: + def flash_command(self) -> FlashCommand | None: return self._flash_command @flash_command.setter - def flash_command(self, value: Union[FlashCommand, None]): + def flash_command(self, value: FlashCommand | None): self._flash_command = value @property - def connection_type(self) -> Union[ConnectionType, None]: + def connection_type(self) -> ConnectionType | None: return self._connection_type @connection_type.setter - def connection_type(self, value: Union[ConnectionType, None]): + def connection_type(self, value: ConnectionType | None): self._connection_type = value @property