refactor: use | instead of Union

Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
dw-0
2024-07-14 14:44:08 +02:00
parent e5bcab5d85
commit fee2dd0bda

View File

@@ -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