Skip to content

Commit 1025dfe

Browse files
committed
Fix mypy errors
1 parent 0a52d98 commit 1025dfe

7 files changed

+16
-7
lines changed

commands2/button/commandjoystick.py

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ class CommandJoystick(CommandGenericHID):
1313
A version of Joystick with Trigger factories for command-based.
1414
"""
1515

16+
_hid: Joystick
17+
1618
def __init__(self, port: int):
1719
"""
1820
Construct an instance of a controller.

commands2/button/commandps4controller.py

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ class CommandPS4Controller(CommandGenericHID):
1313
A version of PS4Controller with Trigger factories for command-based.
1414
"""
1515

16+
_hid: PS4Controller
17+
1618
def __init__(self, port: int):
1719
"""
1820
Construct an instance of a device.

commands2/button/commandxboxcontroller.py

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ class CommandXboxController(CommandGenericHID):
1313
A version of XboxController with Trigger factories for command-based.
1414
"""
1515

16+
_hid: XboxController
17+
1618
def __init__(self, port: int):
1719
"""
1820
Construct an instance of a controller.

commands2/command.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from enum import Enum
77
from typing import TYPE_CHECKING, Any, Callable, Set
88

9-
from typing_extensions import Self
9+
from typing_extensions import Self, TypeAlias
1010

1111
if TYPE_CHECKING:
1212
from .instantcommand import InstantCommand
@@ -54,7 +54,9 @@ class Command(Sendable):
5454
This class is provided by the NewCommands VendorDep
5555
"""
5656

57-
InterruptionBehavior = InterruptionBehavior # type alias for 2023 location
57+
InterruptionBehavior: TypeAlias = (
58+
InterruptionBehavior # type alias for 2023 location
59+
)
5860

5961
requirements: Set[Subsystem]
6062

commands2/commandscheduler.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ class CommandScheduler:
2121
methods to be called and for their default commands to be scheduled.
2222
"""
2323

24-
_instance: Optional[Self] = None
24+
_instance: Optional[CommandScheduler] = None
2525

26-
def __new__(cls) -> Self:
26+
def __new__(cls) -> CommandScheduler:
2727
if cls._instance is None:
2828
return super().__new__(cls)
2929
return cls._instance

commands2/util.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
from __future__ import annotations
22

3-
from typing import Iterable, Tuple, Union
3+
from typing import Iterable, List, Tuple, Union
44

55
from .command import Command
66

77

88
def flatten_args_commands(
99
*commands: Union[Command, Iterable[Command]]
10-
) -> Tuple[Command]:
11-
flattened_commands = []
10+
) -> Tuple[Command, ...]:
11+
flattened_commands: List[Command] = []
1212
for command in commands:
1313
if isinstance(command, Command):
1414
flattened_commands.append(command)

commands2/wrappercommand.py

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def __init__(self, command: Command):
2626

2727
CommandScheduler.getInstance().registerComposedCommands([command])
2828
self._command = command
29+
self.setName(self._command.getName())
2930

3031
def initialize(self):
3132
"""The initial subroutine of a command. Called once when the command is initially scheduled."""

0 commit comments

Comments
 (0)