diff --git a/.github/workflows/lint-format.yml b/.github/workflows/lint-format.yml index c344b09d4c..e1dc37281b 100644 --- a/.github/workflows/lint-format.yml +++ b/.github/workflows/lint-format.yml @@ -36,7 +36,7 @@ jobs: - name: Install wpiformat run: | python -m venv ${{ runner.temp }}/wpiformat - ${{ runner.temp }}/wpiformat/bin/pip3 install wpiformat==2026.57 + ${{ runner.temp }}/wpiformat/bin/pip3 install wpiformat==2026.64 - name: Run run: ${{ runner.temp }}/wpiformat/bin/wpiformat - name: Check output @@ -78,7 +78,7 @@ jobs: - name: Install wpiformat run: | python -m venv ${{ runner.temp }}/wpiformat - ${{ runner.temp }}/wpiformat/bin/pip3 install wpiformat==2026.57 + ${{ runner.temp }}/wpiformat/bin/pip3 install wpiformat==2026.64 - name: Create compile_commands.json run: | ./gradlew generateCompileCommands -Ptoolchain-optional-roboRio diff --git a/shared/bazel/rules/robotpy/generate_pybind_build_file.py b/shared/bazel/rules/robotpy/generate_pybind_build_file.py index f1fd27344f..f7d912b3c7 100644 --- a/shared/bazel/rules/robotpy/generate_pybind_build_file.py +++ b/shared/bazel/rules/robotpy/generate_pybind_build_file.py @@ -70,7 +70,7 @@ class HeaderToDatConfig: include_root = str(args[3]).replace("\\", "/") root_dir = find_root_dir(include_root) if "native" in include_root: - base_include_root = pathlib.Path(*args[3].relative_to(root_dir).parts[3:]) + # base_include_root = pathlib.Path(*args[3].relative_to(root_dir).parts[3:]) base_include_file = args[2].relative_to(include_root) base_library = re.search("native/(.*?)/", include_root).groups(1)[0] @@ -205,7 +205,6 @@ class BazelExtensionModule: dynamic_dependencies = set() for dep_name in all_dependencies: if "native" in dep_name: - transitive_deps = set() self._get_transitive_native_dependencies(dep_name, transitive_deps) for d in transitive_deps: @@ -416,7 +415,7 @@ def generate_pybind_build_file( version_file = raw_config["tool"]["hatch"]["build"]["hooks"]["robotpy"][ "version_file" ] - except: + except KeyError: version_file = None # The entry points defined above are implicit to how the project is broken down in the toml files. diff --git a/shared/bazel/rules/robotpy/hatchlib_native_port/generate_native_lib_files.py b/shared/bazel/rules/robotpy/hatchlib_native_port/generate_native_lib_files.py index cf80f60c47..8baaac894f 100644 --- a/shared/bazel/rules/robotpy/hatchlib_native_port/generate_native_lib_files.py +++ b/shared/bazel/rules/robotpy/hatchlib_native_port/generate_native_lib_files.py @@ -282,7 +282,7 @@ def _write_libinit_py( contents += [ " except FileNotFoundError:", - f" if not exists(lib_path):", + " if not exists(lib_path):", f' raise FileNotFoundError("{lib.name} was not found on your system. Is this package correctly installed?")', ] diff --git a/shared/bazel/rules/robotpy/hatchlib_native_port/validate.py b/shared/bazel/rules/robotpy/hatchlib_native_port/validate.py index f1949ed166..cbd8e6f4fd 100644 --- a/shared/bazel/rules/robotpy/hatchlib_native_port/validate.py +++ b/shared/bazel/rules/robotpy/hatchlib_native_port/validate.py @@ -18,7 +18,6 @@ def _convert_validation_error( e: typing.Optional[BaseException] = ve while e is not None: - if isinstance(e, errors.WrongFieldError): locs.append(f".{e.wrong_field}") elif isinstance(e, errors.WrongListItemError): diff --git a/upstream_utils/apriltag.py b/upstream_utils/apriltag.py index 05ca40655e..5cb2942aa1 100755 --- a/upstream_utils/apriltag.py +++ b/upstream_utils/apriltag.py @@ -38,21 +38,25 @@ def copy_upstream_src(wpilib_root: Path): # Copy apriltag source files into allwpilib src_files = walk_cwd_and_copy_if( - lambda dp, f: (f.endswith(".c") or f.endswith(".cpp")) - and not has_prefix(dp, Path("example")) - and not has_prefix(dp, Path("test")) - and not f == "getopt.c" - and not "py" in f - and not remove_tag(f), + lambda dp, f: ( + (f.endswith(".c") or f.endswith(".cpp")) + and not has_prefix(dp, Path("example")) + and not has_prefix(dp, Path("test")) + and not f == "getopt.c" + and "py" not in f + and not remove_tag(f) + ), apriltag / "src/main/native/thirdparty/apriltag/src", ) # Copy apriltag header files into allwpilib walk_cwd_and_copy_if( - lambda dp, f: f.endswith(".h") - and not f == "getopt.h" - and not f == "postscript_utils.h" - and not remove_tag(f), + lambda dp, f: ( + f.endswith(".h") + and not f == "getopt.h" + and not f == "postscript_utils.h" + and not remove_tag(f) + ), apriltag / "src/main/native/thirdparty/apriltag/include", ) diff --git a/upstream_utils/argparse_lib.py b/upstream_utils/argparse_lib.py index 62668667ff..389d1f30e0 100755 --- a/upstream_utils/argparse_lib.py +++ b/upstream_utils/argparse_lib.py @@ -11,7 +11,7 @@ def copy_upstream_src(wpilib_root: Path): # Copy header into allwpilib dest_filename = ( - wpiutil / f"src/main/native/thirdparty/argparse/include/wpi/util/argparse.hpp" + wpiutil / "src/main/native/thirdparty/argparse/include/wpi/util/argparse.hpp" ) shutil.copyfile("include/argparse/argparse.hpp", dest_filename) # Rename namespace from argparse to wpi diff --git a/upstream_utils/catch2.py b/upstream_utils/catch2.py index 4692584e0a..517b4852b3 100755 --- a/upstream_utils/catch2.py +++ b/upstream_utils/catch2.py @@ -22,14 +22,15 @@ def copy_upstream_src(wpilib_root: Path): ) os.chdir(upstream_root / "src") walk_cwd_and_copy_if( - lambda dp, f: f.endswith(".cpp") - and "catch2" in dp.parts - and f != "catch_main.cpp", + lambda dp, f: ( + f.endswith(".cpp") and "catch2" in dp.parts and f != "catch_main.cpp" + ), catch2 / "src/main/native/cpp", ) walk_cwd_and_copy_if( - lambda dp, f: f.endswith(".hpp") - and ("third_party" in dp.parts or "catch2" in dp.parts), + lambda dp, f: ( + f.endswith(".hpp") and ("third_party" in dp.parts or "catch2" in dp.parts) + ), catch2 / "src/main/native/include", ) diff --git a/upstream_utils/fmt.py b/upstream_utils/fmt.py index 86c16b8da5..dfbe208890 100755 --- a/upstream_utils/fmt.py +++ b/upstream_utils/fmt.py @@ -18,9 +18,9 @@ def copy_upstream_src(wpilib_root: Path): # Copy fmt source files into allwpilib walk_cwd_and_copy_if( - lambda dp, f: has_prefix(dp, Path("src")) - and f.endswith(".cc") - and f != "fmt.cc", + lambda dp, f: ( + has_prefix(dp, Path("src")) and f.endswith(".cc") and f != "fmt.cc" + ), wpiutil / "src/main/native/thirdparty/fmtlib", ) diff --git a/upstream_utils/glfw.py b/upstream_utils/glfw.py index ddd65c0df4..351d22ebef 100755 --- a/upstream_utils/glfw.py +++ b/upstream_utils/glfw.py @@ -32,7 +32,7 @@ def copy_upstream_src(wpilib_root: Path): return False - src_files = walk_cwd_and_copy_if( + walk_cwd_and_copy_if( src_filter, glfw, ) diff --git a/upstream_utils/googletest.py b/upstream_utils/googletest.py index 50d38fbb07..0fb1ef2c22 100755 --- a/upstream_utils/googletest.py +++ b/upstream_utils/googletest.py @@ -27,14 +27,16 @@ def copy_upstream_src(wpilib_root: Path): shutil.rmtree(third_party_root / d, ignore_errors=True) walk_cwd_and_copy_if( - lambda dp, f: has_prefix(dp, Path("googlemock/src")) - and f not in EXCLUDED_FILES, + lambda dp, f: ( + has_prefix(dp, Path("googlemock/src")) and f not in EXCLUDED_FILES + ), third_party_root / "src", ) walk_cwd_and_copy_if( - lambda dp, f: has_prefix(dp, Path("googletest/src")) - and f not in EXCLUDED_FILES, + lambda dp, f: ( + has_prefix(dp, Path("googletest/src")) and f not in EXCLUDED_FILES + ), third_party_root / "src", ) diff --git a/upstream_utils/mrcal.py b/upstream_utils/mrcal.py index 2d490cb8d2..6f77d4131c 100755 --- a/upstream_utils/mrcal.py +++ b/upstream_utils/mrcal.py @@ -17,28 +17,32 @@ def copy_upstream_src(wpilib_root: Path): shutil.rmtree(wpical / d, ignore_errors=True) files = walk_cwd_and_copy_if( - lambda dp, f: (f.endswith(".h") or f.endswith(".hh")) - and not f == "heap.h" - and not f == "stereo-matching-libelas.h" - and not has_prefix(dp, Path("test")), + lambda dp, f: ( + (f.endswith(".h") or f.endswith(".hh")) + and not f == "heap.h" + and not f == "stereo-matching-libelas.h" + and not has_prefix(dp, Path("test")) + ), wpical / "src/main/native/thirdparty/mrcal/include", ) files = files + walk_cwd_and_copy_if( lambda dp, f: ( - f.endswith(".c") - or f.endswith(".cc") - or f.endswith(".cpp") - or f.endswith(".pl") - ) - and not f == "heap.cc" - and not f == "mrcal-pywrap.c" - and not f == "image.c" - and not f == "stereo.c" - and not f == "stereo-matching-libelas.cc" - and not f == "uncertainty.c" - and not f == "traverse-sensor-links.c" - and not has_prefix(dp, Path("doc")) - and not has_prefix(dp, Path("test")), + ( + f.endswith(".c") + or f.endswith(".cc") + or f.endswith(".cpp") + or f.endswith(".pl") + ) + and not f == "heap.cc" + and not f == "mrcal-pywrap.c" + and not f == "image.c" + and not f == "stereo.c" + and not f == "stereo-matching-libelas.cc" + and not f == "uncertainty.c" + and not f == "traverse-sensor-links.c" + and not has_prefix(dp, Path("doc")) + and not has_prefix(dp, Path("test")) + ), wpical / "src/main/native/thirdparty/mrcal/src", ) diff --git a/upstream_utils/nanopb.py b/upstream_utils/nanopb.py index 543b19befa..1ddefd5906 100755 --- a/upstream_utils/nanopb.py +++ b/upstream_utils/nanopb.py @@ -50,7 +50,7 @@ def copy_upstream_src(wpilib_root: Path): wpiutil / "src/main/native/thirdparty/nanopb/include", ) - generator_files = walk_cwd_and_copy_if( + walk_cwd_and_copy_if( lambda dp, f: has_prefix(dp, Path("generator")), wpiutil / "src/main/native/thirdparty/nanopb", ) diff --git a/upstream_utils/sleipnir.py b/upstream_utils/sleipnir.py index d05aa96aea..54e0c75099 100755 --- a/upstream_utils/sleipnir.py +++ b/upstream_utils/sleipnir.py @@ -18,7 +18,7 @@ def copy_upstream_src(wpilib_root: Path): # Copy Sleipnir files into allwpilib walk_cwd_and_copy_if( - lambda dp, f: (has_prefix(dp, Path("include")) or has_prefix(dp, Path("src"))), + lambda dp, f: has_prefix(dp, Path("include")) or has_prefix(dp, Path("src")), wpimath / "src/main/native/thirdparty/sleipnir", ) diff --git a/upstream_utils/upb.py b/upstream_utils/upb.py index 8d7b73ecee..56dc9d0b0b 100755 --- a/upstream_utils/upb.py +++ b/upstream_utils/upb.py @@ -40,32 +40,34 @@ def copy_upstream_src(wpilib_root: Path): os.chdir(upstream_root / "upb") include_files = walk_cwd_and_copy_if( lambda dp, f: ( - len(dp.parts) >= 1 - and ( - dp.parts[0] == "base" - or dp.parts[0] == "hash" - or dp.parts[0] == "mem" - or ( - dp.parts[0] == "message" - and "compare" not in f - and "promote" not in f - and "accessors_split64" not in f - ) - or dp.parts[0] == "mini_descriptor" - or (dp.parts[0] == "mini_table" and "compat" not in f) - or dp.parts[0] == "port" - or dp.parts[0] == "reflection" - or ( - dp.parts[0] == "wire" - and "byte_size" not in f - and "decode_fast" not in dp.parts - and "test_util" not in dp.parts + ( + len(dp.parts) >= 1 + and ( + dp.parts[0] == "base" + or dp.parts[0] == "hash" + or dp.parts[0] == "mem" + or ( + dp.parts[0] == "message" + and "compare" not in f + and "promote" not in f + and "accessors_split64" not in f + ) + or dp.parts[0] == "mini_descriptor" + or (dp.parts[0] == "mini_table" and "compat" not in f) + or dp.parts[0] == "port" + or dp.parts[0] == "reflection" + or ( + dp.parts[0] == "wire" + and "byte_size" not in f + and "decode_fast" not in dp.parts + and "test_util" not in dp.parts + ) ) + and "cmake" not in dp.parts ) - and "cmake" not in dp.parts - ) - and (f.endswith(".h") or f.endswith(".inc")) - or f == "generated_code_support.h", + and (f.endswith(".h") or f.endswith(".inc")) + or f == "generated_code_support.h" + ), wpiutil / "src/main/native/thirdparty/upb/include/upb", ) for f in include_files: @@ -75,29 +77,31 @@ def copy_upstream_src(wpilib_root: Path): walk_cwd_and_copy_if( lambda dp, f: ( - len(dp.parts) >= 1 - and ( - dp.parts[0] == "base" - or dp.parts[0] == "hash" - or dp.parts[0] == "mem" - or ( - dp.parts[0] == "message" - and "compare" not in f - and "promote" not in f - ) - or dp.parts[0] == "mini_descriptor" - or (dp.parts[0] == "mini_table" and "compat" not in f) - or dp.parts[0] == "port" - or dp.parts[0] == "reflection" - or ( - dp.parts[0] == "wire" - and "byte_size" not in f - and "decode_fast" not in dp.parts + ( + len(dp.parts) >= 1 + and ( + dp.parts[0] == "base" + or dp.parts[0] == "hash" + or dp.parts[0] == "mem" + or ( + dp.parts[0] == "message" + and "compare" not in f + and "promote" not in f + ) + or dp.parts[0] == "mini_descriptor" + or (dp.parts[0] == "mini_table" and "compat" not in f) + or dp.parts[0] == "port" + or dp.parts[0] == "reflection" + or ( + dp.parts[0] == "wire" + and "byte_size" not in f + and "decode_fast" not in dp.parts + ) ) ) - ) - and f.endswith(".c") - and not f == "descriptor.upb_minitable.c", + and f.endswith(".c") + and not f == "descriptor.upb_minitable.c" + ), wpiutil / "src/main/native/thirdparty/upb/src", ) diff --git a/wpimath/algorithms/ExponentialProfileModel.py b/wpimath/algorithms/ExponentialProfileModel.py old mode 100644 new mode 100755 index cc8fbc06cc..6d1978eb2e --- a/wpimath/algorithms/ExponentialProfileModel.py +++ b/wpimath/algorithms/ExponentialProfileModel.py @@ -1,5 +1,18 @@ -from sympy import * -from sympy.logic.boolalg import * +#!/usr/bin/env python3 + +from sympy import ( + Eq, + Function, + dsolve, + exp, + expand, + init_printing, + log, + simplify, + solve, + symbols, +) +from sympy.logic.boolalg import SOPform init_printing() diff --git a/wpiunits/generate_units.py b/wpiunits/generate_units.py index 3b7a8f0e2c..8eb4c26492 100755 --- a/wpiunits/generate_units.py +++ b/wpiunits/generate_units.py @@ -256,12 +256,16 @@ UNIT_CONFIGURATIONS = { "Velocity": { "base_unit": "unit()", "generics": {"D": {"extends": "Unit"}}, - "multiply": {"Time": {"implementation": inspect.cleandoc(""" + "multiply": { + "Time": { + "implementation": inspect.cleandoc(""" @Override public Measure times(Time multiplier) { return (Measure) unit().numerator().ofBaseUnits(baseUnitMagnitude() * multiplier.baseUnitMagnitude()); } - """)}}, + """) + } + }, "divide": {}, }, "Voltage": {