Skip to content

Commit 475da2b

Browse files
committed
Remove deprecated classes and aliases
- CommandGroup - PerpetualCommand - ProxyScheduleCommand
1 parent e49f4db commit 475da2b

24 files changed

+20
-228
lines changed

commands2/__init__.py

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,21 @@
1-
from .button import Trigger
21
from .command import Command, InterruptionBehavior
32

3+
from . import button
44
from . import cmd
55

6-
# from .cmd import (
7-
# deadline,
8-
# either,
9-
# none,
10-
# parallel,
11-
# print_,
12-
# race,
13-
# repeatingSequence,
14-
# run,
15-
# runEnd,
16-
# runOnce,
17-
# select,
18-
# sequence,
19-
# startEnd,
20-
# waitSeconds,
21-
# waitUntil,
22-
# )
23-
from .commandgroup import CommandGroup, IllegalCommandUse
246
from .commandscheduler import CommandScheduler
257
from .conditionalcommand import ConditionalCommand
8+
from .exceptions import IllegalCommandUse
269
from .functionalcommand import FunctionalCommand
2710
from .instantcommand import InstantCommand
2811
from .notifiercommand import NotifierCommand
2912
from .parallelcommandgroup import ParallelCommandGroup
3013
from .paralleldeadlinegroup import ParallelDeadlineGroup
3114
from .parallelracegroup import ParallelRaceGroup
32-
from .perpetualcommand import PerpetualCommand
3315
from .pidcommand import PIDCommand
3416
from .pidsubsystem import PIDSubsystem
3517
from .printcommand import PrintCommand
3618
from .proxycommand import ProxyCommand
37-
from .proxyschedulecommand import ProxyScheduleCommand
3819
from .repeatcommand import RepeatCommand
3920
from .runcommand import RunCommand
4021
from .schedulecommand import ScheduleCommand
@@ -52,9 +33,9 @@
5233
from typing import TYPE_CHECKING
5334

5435
__all__ = [
36+
"button",
5537
"cmd",
5638
"Command",
57-
"CommandGroup",
5839
"CommandScheduler",
5940
"ConditionalCommand",
6041
"FunctionalCommand",
@@ -65,12 +46,10 @@
6546
"ParallelCommandGroup",
6647
"ParallelDeadlineGroup",
6748
"ParallelRaceGroup",
68-
"PerpetualCommand",
6949
"PIDCommand",
7050
"PIDSubsystem",
7151
"PrintCommand",
7252
"ProxyCommand",
73-
"ProxyScheduleCommand",
7453
"RepeatCommand",
7554
"RunCommand",
7655
"ScheduleCommand",
@@ -84,21 +63,6 @@
8463
"WaitCommand",
8564
"WaitUntilCommand",
8665
"WrapperCommand",
87-
# "none",
88-
# "runOnce",
89-
# "run",
90-
# "startEnd",
91-
# "runEnd",
92-
# "print_",
93-
# "waitSeconds",
94-
# "waitUntil",
95-
# "either",
96-
# "select",
97-
# "sequence",
98-
# "repeatingSequence",
99-
# "parallel",
100-
# "race",
101-
# "deadline",
10266
"Trigger", # was here in 2023
10367
]
10468

commands2/command.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from .sequentialcommandgroup import SequentialCommandGroup
1616
from .paralleldeadlinegroup import ParallelDeadlineGroup
1717
from .parallelcommandgroup import ParallelCommandGroup
18-
from .perpetualcommand import PerpetualCommand
1918
from .repeatcommand import RepeatCommand
2019
from .proxycommand import ProxyCommand
2120
from .conditionalcommand import ConditionalCommand
@@ -341,27 +340,6 @@ def raceWith(self, *parallel: Command) -> ParallelRaceGroup:
341340

342341
return ParallelRaceGroup(self, *parallel)
343342

344-
def perpetually(self) -> PerpetualCommand:
345-
"""
346-
Decorates this command to run perpetually, ignoring its ordinary end conditions. The decorated
347-
command can still be interrupted or canceled.
348-
349-
Note: This decorator works by adding this command to a composition. The command the
350-
decorator was called on cannot be scheduled independently or be added to a different
351-
composition (namely, decorators), unless it is manually cleared from the list of composed
352-
commands with CommandScheduler#removeComposedCommand(Command). The command composition
353-
returned from this method can be further decorated without issue.
354-
355-
:returns: the decorated command
356-
@deprecated PerpetualCommand violates the assumption that execute() doesn't get called after
357-
isFinished() returns true -- an assumption that should be valid. This was unsafe/undefined
358-
behavior from the start, and RepeatCommand provides an easy way to achieve similar end
359-
results with slightly different (and safe) semantics.
360-
"""
361-
from .perpetualcommand import PerpetualCommand
362-
363-
return PerpetualCommand(self)
364-
365343
def repeatedly(self) -> RepeatCommand:
366344
"""
367345
Decorates this command to run repeatedly, restarting it when it ends, until this command is

commands2/commandgroup.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

commands2/commandscheduler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from wpilib.event import EventLoop
99

1010
from .command import Command, InterruptionBehavior
11-
from .commandgroup import *
11+
from .exceptions import IllegalCommandUse
1212
from .subsystem import Subsystem
1313

1414

commands2/conditionalcommand.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from typing import Callable
44

55
from .command import Command
6-
from .commandgroup import *
76
from .commandscheduler import CommandScheduler
87

98

commands2/exceptions.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class IllegalCommandUse(Exception):
2+
"""
3+
This exception is raised when a command is used in a way that it shouldn't be.
4+
5+
You shouldn't try to catch this exception, if it occurs it means your code is
6+
doing something it probably shouldn't be doing
7+
"""

commands2/functionalcommand.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from typing import Any, Callable
44

55
from .command import Command
6-
from .commandgroup import *
76
from .subsystem import Subsystem
87

98

commands2/notifiercommand.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from wpilib import Notifier
66

77
from .command import Command
8-
from .commandgroup import *
98
from .subsystem import Subsystem
109

1110

commands2/parallelcommandgroup.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22

33
from typing import Dict
44

5-
from commands2.command import Command, InterruptionBehavior
6-
75
from .command import Command, InterruptionBehavior
8-
from .commandgroup import *
96
from .commandscheduler import CommandScheduler
7+
from .exceptions import IllegalCommandUse
108
from .util import flatten_args_commands
119

1210

13-
class ParallelCommandGroup(CommandGroup):
11+
class ParallelCommandGroup(Command):
1412
"""
1513
A command composition that runs a set of commands in parallel, ending when the last command ends.
1614

commands2/paralleldeadlinegroup.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22

33
from typing import Dict
44

5-
from commands2.command import Command, InterruptionBehavior
6-
75
from .command import Command, InterruptionBehavior
8-
from .commandgroup import *
96
from .commandscheduler import CommandScheduler
7+
from .exceptions import IllegalCommandUse
108
from .util import flatten_args_commands
119

1210

13-
class ParallelDeadlineGroup(CommandGroup):
11+
class ParallelDeadlineGroup(Command):
1412
"""
1513
A command composition that runs one of a selection of commands, either using a selector and a key
1614
to command mapping, or a supplier that returns the command directly at runtime.

0 commit comments

Comments
 (0)