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 4848from .waituntilcommand import WaitUntilCommand
4949from .wrappercommand import WrapperCommand
5050
51+ from typing import TYPE_CHECKING
52+
5153__all__ = [
5254 "cmd" ,
5355 "Command" ,
98100 "Trigger" , # was here in 2023
99101]
100102
103+ if not TYPE_CHECKING :
101104
102- def __getattr__ (attr ):
103- if attr == "SubsystemBase" :
104- import warnings
105+ def __getattr__ (attr ):
106+ if attr == "SubsystemBase" :
107+ import warnings
105108
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
108113
109- if attr == "CommandBase" :
110- import warnings
114+ if attr == "CommandBase" :
115+ import warnings
111116
112- warnings .warn ("CommandBase is deprecated" , DeprecationWarning , stacklevel = 2 )
113- return Command
117+ warnings .warn ("CommandBase is deprecated" , DeprecationWarning , stacklevel = 2 )
118+ return Command
114119
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 33from __future__ import annotations
44
55from typing import TYPE_CHECKING , Callable , Optional
6+ from typing_extensions import Self
67
78if TYPE_CHECKING :
89 from .command import Command
@@ -28,7 +29,7 @@ class Subsystem(Sendable):
2829 base for user implementations that handles this.
2930 """
3031
31- def __new__ (cls , * arg , ** kwargs ) -> "Subsystem" :
32+ def __new__ (cls , * arg , ** kwargs ) -> Self :
3233 instance = super ().__new__ (cls )
3334 super ().__init__ (instance )
3435 SendableRegistry .addLW (instance , cls .__name__ , cls .__name__ )
You can’t perform that action at this time.
0 commit comments