File tree Expand file tree Collapse file tree 2 files changed +17
-11
lines changed Expand file tree Collapse file tree 2 files changed +17
-11
lines changed Original file line number Diff line number Diff line change 48
48
from .waituntilcommand import WaitUntilCommand
49
49
from .wrappercommand import WrapperCommand
50
50
51
+ from typing import TYPE_CHECKING
52
+
51
53
__all__ = [
52
54
"cmd" ,
53
55
"Command" ,
98
100
"Trigger" , # was here in 2023
99
101
]
100
102
103
+ if not TYPE_CHECKING :
101
104
102
- def __getattr__ (attr ):
103
- if attr == "SubsystemBase" :
104
- import warnings
105
+ def __getattr__ (attr ):
106
+ if attr == "SubsystemBase" :
107
+ import warnings
105
108
106
- warnings .warn ("SubsystemBase is deprecated" , DeprecationWarning , stacklevel = 2 )
107
- return Subsystem
109
+ warnings .warn (
110
+ "SubsystemBase is deprecated" , DeprecationWarning , stacklevel = 2
111
+ )
112
+ return Subsystem
108
113
109
- if attr == "CommandBase" :
110
- import warnings
114
+ if attr == "CommandBase" :
115
+ import warnings
111
116
112
- warnings .warn ("CommandBase is deprecated" , DeprecationWarning , stacklevel = 2 )
113
- return Command
117
+ warnings .warn ("CommandBase is deprecated" , DeprecationWarning , stacklevel = 2 )
118
+ return Command
114
119
115
- raise AttributeError ("module {!r} has no attribute " "{ !r}". format ( __name__ , attr ) )
120
+ raise AttributeError (f "module { __name__ !r} has no attribute { attr !r} " )
Original file line number Diff line number Diff line change 3
3
from __future__ import annotations
4
4
5
5
from typing import TYPE_CHECKING , Callable , Optional
6
+ from typing_extensions import Self
6
7
7
8
if TYPE_CHECKING :
8
9
from .command import Command
@@ -28,7 +29,7 @@ class Subsystem(Sendable):
28
29
base for user implementations that handles this.
29
30
"""
30
31
31
- def __new__ (cls , * arg , ** kwargs ) -> "Subsystem" :
32
+ def __new__ (cls , * arg , ** kwargs ) -> Self :
32
33
instance = super ().__new__ (cls )
33
34
super ().__init__ (instance )
34
35
SendableRegistry .addLW (instance , cls .__name__ , cls .__name__ )
You can’t perform that action at this time.
0 commit comments