From b3f97759f5b9e7e2ecdb7794ee0884591f261d07 Mon Sep 17 00:00:00 2001 From: Daniel Chen Date: Sun, 27 Oct 2024 16:36:53 -0400 Subject: [PATCH 1/8] Added withDeadline modifier --- .../edu/wpi/first/wpilibj2/command/Commands.java | 6 +++--- .../first/wpilibj2/command/ParallelCommandGroup.java | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Commands.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Commands.java index c53409a033d..06df7fb1da8 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Commands.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Commands.java @@ -242,7 +242,7 @@ public static Command repeatingSequence(Command... commands) { * @return the command * @see ParallelCommandGroup */ - public static Command parallel(Command... commands) { + public static ParallelCommandGroup parallel(Command... commands) { return new ParallelCommandGroup(commands); } @@ -254,7 +254,7 @@ public static Command parallel(Command... commands) { * @return the command group * @see ParallelRaceGroup */ - public static Command race(Command... commands) { + public static ParallelRaceGroup race(Command... commands) { return new ParallelRaceGroup(commands); } @@ -268,7 +268,7 @@ public static Command race(Command... commands) { * @see ParallelDeadlineGroup * @throws IllegalArgumentException if the deadline command is also in the otherCommands argument */ - public static Command deadline(Command deadline, Command... otherCommands) { + public static ParallelDeadlineGroup deadline(Command deadline, Command... otherCommands) { return new ParallelDeadlineGroup(deadline, otherCommands); } diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelCommandGroup.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelCommandGroup.java index 0fc31876ce4..93ea5b80629 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelCommandGroup.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelCommandGroup.java @@ -37,6 +37,18 @@ public ParallelCommandGroup(Command... commands) { addCommands(commands); } + /** + * Creates a new command that runs the commands of this parallel group + * and the deadline in parallel, stopping all when the deadline finishes. + * + * @param deadline the command deadline; once this finishes, the other commands will be interrupted. + * @return the command group + * @see ParallelDeadlineGroup + */ + public Command withDeadline(Command deadline) { + return new ParallelDeadlineGroup(deadline, this); + } + /** * Adds the given commands to the group. * From 74b22eafa745aa4a0d8e3538ff41c38ae241bd1f Mon Sep 17 00:00:00 2001 From: Daniel Chen Date: Sun, 27 Oct 2024 16:55:08 -0400 Subject: [PATCH 2/8] docs changes --- .../wpi/first/wpilibj2/command/ParallelCommandGroup.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelCommandGroup.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelCommandGroup.java index 93ea5b80629..79bf861ea9e 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelCommandGroup.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelCommandGroup.java @@ -38,10 +38,11 @@ public ParallelCommandGroup(Command... commands) { } /** - * Creates a new command that runs the commands of this parallel group - * and the deadline in parallel, stopping all when the deadline finishes. + * Creates a new command that runs this parallel group + * and the deadline in parallel, finishing when + * the deadline finishes. * - * @param deadline the command deadline; once this finishes, the other commands will be interrupted. + * @param deadline the deadline of the command group * @return the command group * @see ParallelDeadlineGroup */ From b53f8c3b57ea213b1725ecf121a5f63a0fa27dad Mon Sep 17 00:00:00 2001 From: Daniel Chen Date: Mon, 28 Oct 2024 20:31:08 -0400 Subject: [PATCH 3/8] Added WithDeadline to c++, made it a general command instance method(for java) --- .../edu/wpi/first/wpilibj2/command/Command.java | 12 ++++++++++++ .../wpilibj2/command/ParallelCommandGroup.java | 13 ------------- .../src/main/native/cpp/frc2/command/Command.cpp | 4 ++++ .../src/main/native/cpp/frc2/command/CommandPtr.cpp | 5 +++++ .../src/main/native/include/frc2/command/Command.h | 11 +++++++++++ .../main/native/include/frc2/command/CommandPtr.h | 10 ++++++++++ 6 files changed, 42 insertions(+), 13 deletions(-) diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java index a53d792d0e4..ec69a33b878 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java @@ -287,6 +287,18 @@ public SequentialCommandGroup andThen(Command... next) { return group; } + /** + * Creates a new command that runs this command + * and the deadline in parallel, finishing when + * the deadline finishes. + * + * @param deadline the deadline of the command group + * @return the decorated command + */ + public ParallelDeadlineGroup withDeadline(Command deadline) { + return new ParallelDeadlineGroup(deadline, this); + } + /** * Decorates this command with a set of commands to run parallel to it, ending when the calling * command ends and interrupting all the others. Often more convenient/less-verbose than diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelCommandGroup.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelCommandGroup.java index 79bf861ea9e..0fc31876ce4 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelCommandGroup.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelCommandGroup.java @@ -37,19 +37,6 @@ public ParallelCommandGroup(Command... commands) { addCommands(commands); } - /** - * Creates a new command that runs this parallel group - * and the deadline in parallel, finishing when - * the deadline finishes. - * - * @param deadline the deadline of the command group - * @return the command group - * @see ParallelDeadlineGroup - */ - public Command withDeadline(Command deadline) { - return new ParallelDeadlineGroup(deadline, this); - } - /** * Adds the given commands to the group. * diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/Command.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/Command.cpp index 365cf80a4ea..af8e30a33a5 100644 --- a/wpilibNewCommands/src/main/native/cpp/frc2/command/Command.cpp +++ b/wpilibNewCommands/src/main/native/cpp/frc2/command/Command.cpp @@ -121,6 +121,10 @@ CommandPtr Command::OnlyIf(std::function condition) && { return std::move(*this).ToPtr().OnlyIf(std::move(condition)); } +CommandPtr Command::WithDeadline(CommandPtr&& deadline) && { + return std::move(*this).ToPtr().WithDeadline(std::move(deadline)); +} + CommandPtr Command::DeadlineFor(CommandPtr&& parallel) && { return std::move(*this).ToPtr().DeadlineFor(std::move(parallel)); } diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandPtr.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandPtr.cpp index 298cc2e50ca..27dd09797ae 100644 --- a/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandPtr.cpp +++ b/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandPtr.cpp @@ -168,6 +168,11 @@ CommandPtr CommandPtr::OnlyIf(std::function condition) && { return std::move(*this).Unless(std::not_fn(std::move(condition))); } +CommandPtr CommandPtr::WithDeadline(CommandPtr&& deadline) && { + AssertValid(); + return std::move(deadline).DeadlineFor(std::move(*this)); +} + CommandPtr CommandPtr::DeadlineWith(CommandPtr&& parallel) && { AssertValid(); std::vector> vec; diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/Command.h b/wpilibNewCommands/src/main/native/include/frc2/command/Command.h index c4af1afe81b..018b15717cf 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/Command.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/Command.h @@ -309,6 +309,16 @@ class Command : public wpi::Sendable, public wpi::SendableHelper { [[nodiscard]] CommandPtr OnlyIf(std::function condition) &&; + /** + * Creates a new command that runs this command + * and the deadline in parallel, finishing when + * the deadline finishes. + * + * @param deadline the deadline of the command group + * @return the decorated command + */ + CommandPtr WithDeadline(CommandPtr&& deadline) &&; + /** * Decorates this command with a set of commands to run parallel to it, ending * when the calling command ends and interrupting all the others. Often more @@ -321,6 +331,7 @@ class Command : public wpi::Sendable, public wpi::SendableHelper { */ [[nodiscard]] CommandPtr DeadlineFor(CommandPtr&& parallel) &&; + /** * Decorates this command with a set of commands to run parallel to it, ending * when the last command ends. Often more convenient/less-verbose than diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/CommandPtr.h b/wpilibNewCommands/src/main/native/include/frc2/command/CommandPtr.h index e2f534f7547..0900ac00d38 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/CommandPtr.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/CommandPtr.h @@ -182,6 +182,16 @@ class CommandPtr final { [[nodiscard]] CommandPtr OnlyIf(std::function condition) &&; + /** + * Creates a new command that runs this command + * and the deadline in parallel, finishing when + * the deadline finishes. + * + * @param deadline the deadline of the command group + * @return the decorated command + */ + CommandPtr WithDeadline(CommandPtr&& deadline) &&; + /** * Decorates this command with a set of commands to run parallel to it, ending * when the calling command ends and interrupting all the others. Often more From 928945a0adbc017889c3e8d2713328ee502ed28d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 29 Oct 2024 00:56:04 +0000 Subject: [PATCH 4/8] Formatting fixes --- .../main/java/edu/wpi/first/wpilibj2/command/Command.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java index ec69a33b878..23146c00da2 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java @@ -288,9 +288,8 @@ public SequentialCommandGroup andThen(Command... next) { } /** - * Creates a new command that runs this command - * and the deadline in parallel, finishing when - * the deadline finishes. + * Creates a new command that runs this command and the deadline in parallel, finishing when the + * deadline finishes. * * @param deadline the deadline of the command group * @return the decorated command From b903bfe4935ba51ffb707dc8ed5abf514d00ee17 Mon Sep 17 00:00:00 2001 From: Daniel Chen Date: Thu, 31 Oct 2024 13:34:29 -0400 Subject: [PATCH 5/8] Reverted previous changes and revised docs --- .../main/java/edu/wpi/first/wpilibj2/command/Command.java | 6 ++++++ .../main/java/edu/wpi/first/wpilibj2/command/Commands.java | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java index ec69a33b878..bef09f5cf76 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Command.java @@ -292,6 +292,12 @@ public SequentialCommandGroup andThen(Command... next) { * and the deadline in parallel, finishing when * the deadline finishes. * + *

Note: This decorator works by adding this command to a composition. The command the + * decorator was called on cannot be scheduled independently or be added to a different + * composition (namely, decorators), unless it is manually cleared from the list of composed + * commands with {@link CommandScheduler#removeComposedCommand(Command)}. The command composition + * returned from this method can be further decorated without issue. + * * @param deadline the deadline of the command group * @return the decorated command */ diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Commands.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Commands.java index 06df7fb1da8..c53409a033d 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Commands.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Commands.java @@ -242,7 +242,7 @@ public static Command repeatingSequence(Command... commands) { * @return the command * @see ParallelCommandGroup */ - public static ParallelCommandGroup parallel(Command... commands) { + public static Command parallel(Command... commands) { return new ParallelCommandGroup(commands); } @@ -254,7 +254,7 @@ public static ParallelCommandGroup parallel(Command... commands) { * @return the command group * @see ParallelRaceGroup */ - public static ParallelRaceGroup race(Command... commands) { + public static Command race(Command... commands) { return new ParallelRaceGroup(commands); } @@ -268,7 +268,7 @@ public static ParallelRaceGroup race(Command... commands) { * @see ParallelDeadlineGroup * @throws IllegalArgumentException if the deadline command is also in the otherCommands argument */ - public static ParallelDeadlineGroup deadline(Command deadline, Command... otherCommands) { + public static Command deadline(Command deadline, Command... otherCommands) { return new ParallelDeadlineGroup(deadline, otherCommands); } From 010155272952cf715c2f1b4f35542d3ff46dfea9 Mon Sep 17 00:00:00 2001 From: Daniel Chen Date: Tue, 5 Nov 2024 08:36:31 -0500 Subject: [PATCH 6/8] Changed cpp WithDeadline implementation --- .../src/main/native/cpp/frc2/command/CommandPtr.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandPtr.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandPtr.cpp index 27dd09797ae..9b9c45591fd 100644 --- a/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandPtr.cpp +++ b/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandPtr.cpp @@ -170,7 +170,11 @@ CommandPtr CommandPtr::OnlyIf(std::function condition) && { CommandPtr CommandPtr::WithDeadline(CommandPtr&& deadline) && { AssertValid(); - return std::move(deadline).DeadlineFor(std::move(*this)); + std::vector> vec; + vec.emplace_back(std::move(m_ptr)); + m_ptr = + std::make_unique(std::move(deadline).Unwrap(), std::move(vec)); + return std::move(*this); } CommandPtr CommandPtr::DeadlineWith(CommandPtr&& parallel) && { From f98f3278fa4dc0daa9ac73b790ee85ca60c0ac23 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 13:58:03 +0000 Subject: [PATCH 7/8] Formatting fixes --- hal/generate_usage_reporting.py | 4 ++-- shared/bazel/rules/gen/gen_resources.py | 2 +- upstream_utils/apriltag.py | 6 +----- upstream_utils/eigen.py | 6 +----- upstream_utils/fmt.py | 5 +---- upstream_utils/gcem.py | 5 +---- upstream_utils/gl3w.py | 5 +---- upstream_utils/glfw.py | 5 +---- upstream_utils/googletest.py | 6 +----- upstream_utils/imgui.py | 5 +---- upstream_utils/implot.py | 5 +---- upstream_utils/json.py | 5 +---- upstream_utils/libuv.py | 5 +---- upstream_utils/memory.py | 6 +----- upstream_utils/mpack.py | 5 +---- upstream_utils/protobuf.py | 6 +----- upstream_utils/sleipnir.py | 5 +---- upstream_utils/stb.py | 5 +---- wpilibNewCommands/generate_hids.py | 2 +- .../src/main/native/cpp/frc2/command/CommandPtr.cpp | 4 ++-- wpilibc/generate_hids.py | 2 +- wpilibc/generate_pwm_motor_controllers.py | 4 ++-- wpilibj/generate_hids.py | 2 +- wpilibj/generate_pwm_motor_controllers.py | 2 +- wpimath/generate_numbers.py | 5 +++-- wpimath/generate_quickbuf.py | 3 +-- wpiutil/examples/printlog/datalog.py | 5 +++-- 27 files changed, 34 insertions(+), 86 deletions(-) diff --git a/hal/generate_usage_reporting.py b/hal/generate_usage_reporting.py index 955be4f1101..9953be3745d 100755 --- a/hal/generate_usage_reporting.py +++ b/hal/generate_usage_reporting.py @@ -3,9 +3,9 @@ # Copyright (c) FIRST and other WPILib contributors. # Open Source Software; you can modify and/or share it under the terms of # the WPILib BSD license file in the root directory of this project. -from pathlib import Path -import sys import argparse +import sys +from pathlib import Path def generate_usage_reporting(output_directory: Path, template_directory: Path): diff --git a/shared/bazel/rules/gen/gen_resources.py b/shared/bazel/rules/gen/gen_resources.py index 869ff1d5914..af0e6a2c071 100644 --- a/shared/bazel/rules/gen/gen_resources.py +++ b/shared/bazel/rules/gen/gen_resources.py @@ -1,6 +1,6 @@ -import os import argparse import binascii +import os def generate_file(resource_file, output_file, prefix, namespace): diff --git a/upstream_utils/apriltag.py b/upstream_utils/apriltag.py index 7fb5f673f29..ea959194175 100755 --- a/upstream_utils/apriltag.py +++ b/upstream_utils/apriltag.py @@ -3,11 +3,7 @@ import os import shutil -from upstream_utils import ( - comment_out_invalid_includes, - walk_cwd_and_copy_if, - Lib, -) +from upstream_utils import Lib, comment_out_invalid_includes, walk_cwd_and_copy_if def remove_tag(f: str): diff --git a/upstream_utils/eigen.py b/upstream_utils/eigen.py index 70e21549bc0..cc4b102144d 100755 --- a/upstream_utils/eigen.py +++ b/upstream_utils/eigen.py @@ -4,11 +4,7 @@ import re import shutil -from upstream_utils import ( - comment_out_invalid_includes, - walk_cwd_and_copy_if, - Lib, -) +from upstream_utils import Lib, comment_out_invalid_includes, walk_cwd_and_copy_if def eigen_inclusions(dp, f): diff --git a/upstream_utils/fmt.py b/upstream_utils/fmt.py index 947a1750fd0..adf83d1bf0c 100755 --- a/upstream_utils/fmt.py +++ b/upstream_utils/fmt.py @@ -3,10 +3,7 @@ import os import shutil -from upstream_utils import ( - walk_cwd_and_copy_if, - Lib, -) +from upstream_utils import Lib, walk_cwd_and_copy_if def copy_upstream_src(wpilib_root): diff --git a/upstream_utils/gcem.py b/upstream_utils/gcem.py index 05a1b7a859d..1b4f2d1e447 100755 --- a/upstream_utils/gcem.py +++ b/upstream_utils/gcem.py @@ -3,10 +3,7 @@ import os import shutil -from upstream_utils import ( - walk_cwd_and_copy_if, - Lib, -) +from upstream_utils import Lib, walk_cwd_and_copy_if def copy_upstream_src(wpilib_root): diff --git a/upstream_utils/gl3w.py b/upstream_utils/gl3w.py index 8855fd9d4c7..1858d675a60 100755 --- a/upstream_utils/gl3w.py +++ b/upstream_utils/gl3w.py @@ -2,10 +2,7 @@ import os -from upstream_utils import ( - walk_cwd_and_copy_if, - Lib, -) +from upstream_utils import Lib, walk_cwd_and_copy_if def copy_upstream_src(wpilib_root): diff --git a/upstream_utils/glfw.py b/upstream_utils/glfw.py index 6a4c77a315d..a2d7e84540e 100755 --- a/upstream_utils/glfw.py +++ b/upstream_utils/glfw.py @@ -3,10 +3,7 @@ import os import shutil -from upstream_utils import ( - walk_cwd_and_copy_if, - Lib, -) +from upstream_utils import Lib, walk_cwd_and_copy_if def matches(dp, f, allowed_files): diff --git a/upstream_utils/googletest.py b/upstream_utils/googletest.py index b164228328d..60613ee5350 100755 --- a/upstream_utils/googletest.py +++ b/upstream_utils/googletest.py @@ -3,11 +3,7 @@ import os import shutil -from upstream_utils import ( - walk_cwd_and_copy_if, - walk_if, - Lib, -) +from upstream_utils import Lib, walk_cwd_and_copy_if, walk_if EXCLUDED_FILES = [ "gtest_main.cc", diff --git a/upstream_utils/imgui.py b/upstream_utils/imgui.py index d6828480711..170cf419917 100755 --- a/upstream_utils/imgui.py +++ b/upstream_utils/imgui.py @@ -3,10 +3,7 @@ import os import shutil -from upstream_utils import ( - walk_cwd_and_copy_if, - Lib, -) +from upstream_utils import Lib, walk_cwd_and_copy_if def matches(dp, f, allowed_files): diff --git a/upstream_utils/implot.py b/upstream_utils/implot.py index 00bf796e769..73101e84d9c 100755 --- a/upstream_utils/implot.py +++ b/upstream_utils/implot.py @@ -3,10 +3,7 @@ import os import shutil -from upstream_utils import ( - walk_cwd_and_copy_if, - Lib, -) +from upstream_utils import Lib, walk_cwd_and_copy_if def matches(dp, f, allowed_files): diff --git a/upstream_utils/json.py b/upstream_utils/json.py index 46b49a39035..050e4dd66e5 100755 --- a/upstream_utils/json.py +++ b/upstream_utils/json.py @@ -3,10 +3,7 @@ import os import shutil -from upstream_utils import ( - walk_if, - Lib, -) +from upstream_utils import Lib, walk_if def copy_upstream_src(wpilib_root): diff --git a/upstream_utils/libuv.py b/upstream_utils/libuv.py index 0c48d0f90d3..c837fe96bef 100755 --- a/upstream_utils/libuv.py +++ b/upstream_utils/libuv.py @@ -3,10 +3,7 @@ import os import shutil -from upstream_utils import ( - walk_cwd_and_copy_if, - Lib, -) +from upstream_utils import Lib, walk_cwd_and_copy_if def copy_upstream_src(wpilib_root): diff --git a/upstream_utils/memory.py b/upstream_utils/memory.py index 85b69dfaf84..0099de5ea91 100755 --- a/upstream_utils/memory.py +++ b/upstream_utils/memory.py @@ -3,11 +3,7 @@ import os import shutil -from upstream_utils import ( - walk_if, - copy_to, - Lib, -) +from upstream_utils import Lib, copy_to, walk_if def run_source_replacements(memory_files): diff --git a/upstream_utils/mpack.py b/upstream_utils/mpack.py index 103c67be9e9..1acff50a371 100755 --- a/upstream_utils/mpack.py +++ b/upstream_utils/mpack.py @@ -4,10 +4,7 @@ import shutil import subprocess -from upstream_utils import ( - walk_cwd_and_copy_if, - Lib, -) +from upstream_utils import Lib, walk_cwd_and_copy_if def copy_upstream_src(wpilib_root): diff --git a/upstream_utils/protobuf.py b/upstream_utils/protobuf.py index cb2e5f09e9d..fc7055f524e 100755 --- a/upstream_utils/protobuf.py +++ b/upstream_utils/protobuf.py @@ -3,11 +3,7 @@ import os import shutil -from upstream_utils import ( - copy_to, - walk_if, - Lib, -) +from upstream_utils import Lib, copy_to, walk_if protobuf_lite_sources = set( [ diff --git a/upstream_utils/sleipnir.py b/upstream_utils/sleipnir.py index 28d2fb38e5a..9b5d3e6aae0 100755 --- a/upstream_utils/sleipnir.py +++ b/upstream_utils/sleipnir.py @@ -3,10 +3,7 @@ import os import shutil -from upstream_utils import ( - copy_to, - Lib, -) +from upstream_utils import Lib, copy_to def copy_upstream_src(wpilib_root): diff --git a/upstream_utils/stb.py b/upstream_utils/stb.py index 72a0b8811cc..06fb69a396a 100755 --- a/upstream_utils/stb.py +++ b/upstream_utils/stb.py @@ -3,10 +3,7 @@ import os import shutil -from upstream_utils import ( - walk_cwd_and_copy_if, - Lib, -) +from upstream_utils import Lib, walk_cwd_and_copy_if def copy_upstream_src(wpilib_root): diff --git a/wpilibNewCommands/generate_hids.py b/wpilibNewCommands/generate_hids.py index 6e349d94b42..51093191fa0 100755 --- a/wpilibNewCommands/generate_hids.py +++ b/wpilibNewCommands/generate_hids.py @@ -3,9 +3,9 @@ # Copyright (c) FIRST and other WPILib contributors. # Open Source Software; you can modify and/or share it under the terms of # the WPILib BSD license file in the root directory of this project. +import argparse import json import sys -import argparse from pathlib import Path from jinja2 import Environment, FileSystemLoader diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandPtr.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandPtr.cpp index 9b9c45591fd..d4125fdceb8 100644 --- a/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandPtr.cpp +++ b/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandPtr.cpp @@ -172,8 +172,8 @@ CommandPtr CommandPtr::WithDeadline(CommandPtr&& deadline) && { AssertValid(); std::vector> vec; vec.emplace_back(std::move(m_ptr)); - m_ptr = - std::make_unique(std::move(deadline).Unwrap(), std::move(vec)); + m_ptr = std::make_unique(std::move(deadline).Unwrap(), + std::move(vec)); return std::move(*this); } diff --git a/wpilibc/generate_hids.py b/wpilibc/generate_hids.py index 76a879c1238..bd8e2cf338c 100755 --- a/wpilibc/generate_hids.py +++ b/wpilibc/generate_hids.py @@ -3,9 +3,9 @@ # Copyright (c) FIRST and other WPILib contributors. # Open Source Software; you can modify and/or share it under the terms of # the WPILib BSD license file in the root directory of this project. +import argparse import json import sys -import argparse from pathlib import Path from jinja2 import Environment, FileSystemLoader diff --git a/wpilibc/generate_pwm_motor_controllers.py b/wpilibc/generate_pwm_motor_controllers.py index a04b918cc4f..1741b71a914 100755 --- a/wpilibc/generate_pwm_motor_controllers.py +++ b/wpilibc/generate_pwm_motor_controllers.py @@ -5,10 +5,10 @@ # the WPILib BSD license file in the root directory of this project. import argparse import json -import sys import os -from typing import Dict, Any +import sys from pathlib import Path +from typing import Any, Dict from jinja2 import Environment, FileSystemLoader from jinja2.environment import Template diff --git a/wpilibj/generate_hids.py b/wpilibj/generate_hids.py index aaa13bf7cf1..f8391a9ec38 100755 --- a/wpilibj/generate_hids.py +++ b/wpilibj/generate_hids.py @@ -3,9 +3,9 @@ # Copyright (c) FIRST and other WPILib contributors. # Open Source Software; you can modify and/or share it under the terms of # the WPILib BSD license file in the root directory of this project. +import argparse import json import sys -import argparse from pathlib import Path from jinja2 import Environment, FileSystemLoader diff --git a/wpilibj/generate_pwm_motor_controllers.py b/wpilibj/generate_pwm_motor_controllers.py index a8dd780207a..b5af130bd51 100755 --- a/wpilibj/generate_pwm_motor_controllers.py +++ b/wpilibj/generate_pwm_motor_controllers.py @@ -7,7 +7,7 @@ import json import sys from pathlib import Path -from typing import Dict, Any +from typing import Any, Dict from jinja2 import Environment, FileSystemLoader from jinja2.environment import Template diff --git a/wpimath/generate_numbers.py b/wpimath/generate_numbers.py index b95800e4d4d..dd0eb80251b 100755 --- a/wpimath/generate_numbers.py +++ b/wpimath/generate_numbers.py @@ -4,11 +4,12 @@ # Open Source Software; you can modify and/or share it under the terms of # the WPILib BSD license file in the root directory of this project. -import sys import argparse -from jinja2 import Environment, FileSystemLoader +import sys from pathlib import Path +from jinja2 import Environment, FileSystemLoader + def output(output_dir: Path, outfn: str, contents: str): output_dir.mkdir(parents=True, exist_ok=True) diff --git a/wpimath/generate_quickbuf.py b/wpimath/generate_quickbuf.py index 944cc34d5d3..98f2789ef04 100755 --- a/wpimath/generate_quickbuf.py +++ b/wpimath/generate_quickbuf.py @@ -3,9 +3,8 @@ # Copyright (c) FIRST and other WPILib contributors. # Open Source Software; you can modify and/or share it under the terms of # the WPILib BSD license file in the root directory of this project. -import subprocess -import sys import argparse +import subprocess import sys from pathlib import Path diff --git a/wpiutil/examples/printlog/datalog.py b/wpiutil/examples/printlog/datalog.py index 5bc50cc5b23..649212575cb 100755 --- a/wpiutil/examples/printlog/datalog.py +++ b/wpiutil/examples/printlog/datalog.py @@ -5,9 +5,10 @@ import array import struct -import msgpack from typing import List, SupportsBytes +import msgpack + __all__ = ["StartRecordData", "MetadataRecordData", "DataLogRecord", "DataLogReader"] floatStruct = struct.Struct(" DataLogIterator: if __name__ == "__main__": - from datetime import datetime import mmap import sys + from datetime import datetime if len(sys.argv) != 2: print("Usage: datalog.py ", file=sys.stderr) From 730e1146c9d51f331c26a87db9db460e188b0b04 Mon Sep 17 00:00:00 2001 From: Daniel Chen <108989218+Daniel1464@users.noreply.github.com> Date: Wed, 6 Nov 2024 22:02:14 -0500 Subject: [PATCH 8/8] Revert merge errors --- hal/generate_usage_reporting.py | 1 + 1 file changed, 1 insertion(+) diff --git a/hal/generate_usage_reporting.py b/hal/generate_usage_reporting.py index 88a3ba70351..39764c9711a 100755 --- a/hal/generate_usage_reporting.py +++ b/hal/generate_usage_reporting.py @@ -3,6 +3,7 @@ # Copyright (c) FIRST and other WPILib contributors. # Open Source Software; you can modify and/or share it under the terms of # the WPILib BSD license file in the root directory of this project. + import argparse from pathlib import Path