From cd5b6630ada9da10fc9e6dae62548ce68da1d0dd Mon Sep 17 00:00:00 2001 From: David Vo Date: Thu, 2 Feb 2023 00:15:08 +1100 Subject: [PATCH] Run black 23.1.0 --- magicbot/magicrobot.py | 1 - magicbot/state_machine.py | 1 - robotpy_ext/autonomous/selector.py | 4 ---- robotpy_ext/autonomous/selector_tests.py | 2 -- robotpy_ext/autonomous/stateful_autonomous.py | 2 -- tests/run_tests.py | 1 - tests/test_magicbot_sm.py | 2 -- tests/test_xl_max_sonar_ez.py | 2 -- 8 files changed, 15 deletions(-) diff --git a/magicbot/magicrobot.py b/magicbot/magicrobot.py index 2b1bc30..69e34e2 100644 --- a/magicbot/magicrobot.py +++ b/magicbot/magicrobot.py @@ -576,7 +576,6 @@ def _on_mode_disable_components(self) -> None: self.onException(forceReport=True) def _create_components(self) -> None: - # # TODO: Will need to inject into any autonomous mode component # too, as they're a bit different diff --git a/magicbot/state_machine.py b/magicbot/state_machine.py index 0e1fdaf..3018a7a 100644 --- a/magicbot/state_machine.py +++ b/magicbot/state_machine.py @@ -184,7 +184,6 @@ def timed_state( """ def decorator(f: StateMethod) -> _State: - wrapper = _State(f, first, must_finish, duration=duration) wrapper.next_state = next_state diff --git a/robotpy_ext/autonomous/selector.py b/robotpy_ext/autonomous/selector.py index f899360..2f34fa6 100644 --- a/robotpy_ext/autonomous/selector.py +++ b/robotpy_ext/autonomous/selector.py @@ -111,7 +111,6 @@ def __init__(self, autonomous_pkgname, *args, **kwargs): modules.extend(glob(os.path.join(pkgdir, "*.py"))) for module_filename in modules: - module = None module_name = os.path.basename(module_filename[:-3]) @@ -134,7 +133,6 @@ def __init__(self, autonomous_pkgname, *args, **kwargs): for name, obj in inspect.getmembers(module, inspect.isclass): mode_name = getattr(obj, "MODE_NAME", None) if mode_name is not None: - # don't allow the driver to select this mode if getattr(obj, "DISABLED", False): logger.warning( @@ -145,7 +143,6 @@ def __init__(self, autonomous_pkgname, *args, **kwargs): try: instance = obj(*args, **kwargs) except: - if not wpilib.DriverStation.isFMSAttached(): raise else: @@ -178,7 +175,6 @@ def __init__(self, autonomous_pkgname, *args, **kwargs): logger.info("Loaded autonomous modes:") for k, v in sorted(self.modes.items()): - if getattr(v, "DEFAULT", False): logger.info(" -> %s [Default]", k) self.chooser.setDefaultOption(k, v) diff --git a/robotpy_ext/autonomous/selector_tests.py b/robotpy_ext/autonomous/selector_tests.py index fe06269..70422fe 100644 --- a/robotpy_ext/autonomous/selector_tests.py +++ b/robotpy_ext/autonomous/selector_tests.py @@ -19,7 +19,6 @@ def test_all_autonomous(control: PyfrcTestController): logger = logging.getLogger("test-all-autonomous") with control.run_robot(): - # Run disabled for a short period, chooser needs to be # initialized in robotInit control.step_timing(seconds=0.5, autonomous=True, enabled=False) @@ -31,7 +30,6 @@ def test_all_autonomous(control: PyfrcTestController): return for choice in choices: - chooser.setSelected(choice) logger.info(f"{'='*10} Testing '{choice}' {'='*10}") diff --git a/robotpy_ext/autonomous/stateful_autonomous.py b/robotpy_ext/autonomous/stateful_autonomous.py index cd5163a..f944201 100644 --- a/robotpy_ext/autonomous/stateful_autonomous.py +++ b/robotpy_ext/autonomous/stateful_autonomous.py @@ -277,7 +277,6 @@ def register_sd_var(self, name, default, add_prefix=True, vmin=-1, vmax=1): self.__table.putStringArray(self.MODE_NAME + "_tunables", self.__tunables) def __register_sd_var_internal(self, name, default, add_prefix, readback): - if " " in name: raise ValueError( "ERROR: Cannot use spaces in a tunable variable name (%s)" % name @@ -310,7 +309,6 @@ def __register_sd_var_internal(self, name, default, add_prefix, readback): return is_number def __build_states(self): - has_first = False states = {} diff --git a/tests/run_tests.py b/tests/run_tests.py index ad62d89..2ffc659 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -6,7 +6,6 @@ import subprocess if __name__ == "__main__": - root = abspath(dirname(__file__)) os.chdir(root) diff --git a/tests/test_magicbot_sm.py b/tests/test_magicbot_sm.py index ead2985..65da692 100644 --- a/tests/test_magicbot_sm.py +++ b/tests/test_magicbot_sm.py @@ -239,7 +239,6 @@ def timed_must_finish(self): def test_autonomous_sm(): class _TM(AutonomousStateMachine): - i = 0 VERBOSE_LOGGING = False @@ -270,7 +269,6 @@ def something(self): def test_autonomous_sm_end_timed_state(wpitime): class _TM(AutonomousStateMachine): - i = 0 j = 0 VERBOSE_LOGGING = False diff --git a/tests/test_xl_max_sonar_ez.py b/tests/test_xl_max_sonar_ez.py index 975b734..8faa188 100644 --- a/tests/test_xl_max_sonar_ez.py +++ b/tests/test_xl_max_sonar_ez.py @@ -1,5 +1,4 @@ def test_digital_sensor(wpimock): - wpimock.Counter().getPeriod.return_value = 1 * 0.000147 from robotpy_ext.common_drivers import xl_max_sonar_ez @@ -9,7 +8,6 @@ def test_digital_sensor(wpimock): def test_analog_sensor(wpimock): - from robotpy_ext.common_drivers import xl_max_sonar_ez analog = xl_max_sonar_ez.MaxSonarEZAnalog(1)