diff --git a/pyfrc/mains/cli_create_physics.py b/pyfrc/mains/cli_create_physics.py index 92d484a..27c6921 100644 --- a/pyfrc/mains/cli_create_physics.py +++ b/pyfrc/mains/cli_create_physics.py @@ -94,7 +94,6 @@ def __init__(self, parser=None): pass def run(self, options, robot_class, **static_options): - robot_file = abspath(inspect.getfile(robot_class)) robot_path = dirname(robot_file) sim_path = join(robot_path, "sim") diff --git a/pyfrc/mains/cli_deploy.py b/pyfrc/mains/cli_deploy.py index b914bdc..34e92f6 100644 --- a/pyfrc/mains/cli_deploy.py +++ b/pyfrc/mains/cli_deploy.py @@ -130,7 +130,6 @@ def __init__(self, parser: argparse.ArgumentParser): ) def run(self, options, robot_class, **static_options): - from .. import config config.mode = "upload" @@ -193,7 +192,6 @@ def run(self, options, robot_class, **static_options): hostname=hostname_or_team, no_resolve=options.no_resolve, ) as ssh: - if not self._check_requirements(ssh, options.no_version_check): return 1 @@ -260,7 +258,6 @@ def _generate_build_data(self, robot_path) -> dict: return deploy_data def _check_large_files(self, robot_path): - large_sz = 250000 large_files = [] @@ -282,7 +279,6 @@ def _check_large_files(self, robot_path): def _check_requirements( self, ssh: sshcontroller.SshController, no_wpilib_version_check: bool ) -> bool: - # does python exist with wrap_ssh_error("checking if python exists"): if ssh.exec_cmd("[ -x /usr/local/bin/python3 ]").returncode != 0: @@ -508,7 +504,6 @@ def _start_nc(self, ssh, options): return nc_thread def _copy_to_tmpdir(self, tmp_dir, robot_path, dry_run=False): - upload_files = [] ignore_exts = frozenset({".pyc", ".whl", ".ipk", ".zip", ".gz", ".wpilog"}) @@ -524,7 +519,6 @@ def _copy_to_tmpdir(self, tmp_dir, robot_path, dry_run=False): # skip .pyc files for filename in files: - r, ext = splitext(filename) if ext in ignore_exts or r.startswith("."): continue diff --git a/pyfrc/mains/cli_deploy_info.py b/pyfrc/mains/cli_deploy_info.py index 3ab60de..c027ee0 100644 --- a/pyfrc/mains/cli_deploy_info.py +++ b/pyfrc/mains/cli_deploy_info.py @@ -15,7 +15,6 @@ class PyFrcDeployInfo: """ def __init__(self, parser: argparse.ArgumentParser): - robot_args = parser.add_mutually_exclusive_group() robot_args.add_argument( @@ -53,7 +52,6 @@ def run(self, options, robot_class, **static_options): hostname=hostname_or_team, no_resolve=options.no_resolve, ) as ssh: - result = ssh.exec_cmd( "cat /home/lvuser/py/deploy.json", get_output=True ) diff --git a/pyfrc/mains/cli_profiler.py b/pyfrc/mains/cli_profiler.py index 2ed04c8..d448cf1 100644 --- a/pyfrc/mains/cli_profiler.py +++ b/pyfrc/mains/cli_profiler.py @@ -21,7 +21,6 @@ def __init__(self, parser): ) def run(self, options, robot_class, **static_options): - print("profiling is not yet implemented for RobotPy 2020") return 1 diff --git a/pyfrc/mains/cli_sim.py b/pyfrc/mains/cli_sim.py index 811bd82..7784311 100644 --- a/pyfrc/mains/cli_sim.py +++ b/pyfrc/mains/cli_sim.py @@ -48,7 +48,6 @@ def __init__(self, parser: argparse.ArgumentParser): ) def run(self, options, robot_class, **static_options): - if not options.nogui: try: import halsim_gui diff --git a/pyfrc/mains/cli_test.py b/pyfrc/mains/cli_test.py index 3d68024..1f19221 100644 --- a/pyfrc/mains/cli_test.py +++ b/pyfrc/mains/cli_test.py @@ -66,7 +66,6 @@ def run_test(self, *a, **k): return self._run_test(*a, **k) def _run_test(self, pytest_args, robot_class, use_builtin, **static_options): - # find test directory, change current directory so pytest can find the tests # -> assume that tests reside in tests or ../tests diff --git a/pyfrc/mains/cli_undeploy.py b/pyfrc/mains/cli_undeploy.py index a23d10b..e4cd2aa 100644 --- a/pyfrc/mains/cli_undeploy.py +++ b/pyfrc/mains/cli_undeploy.py @@ -14,7 +14,6 @@ class PyFrcUndeploy: """ def __init__(self, parser: argparse.ArgumentParser): - robot_args = parser.add_mutually_exclusive_group() robot_args.add_argument( @@ -58,7 +57,6 @@ def run(self, options, robot_class, **static_options): hostname=hostname_or_team, no_resolve=options.no_resolve, ) as ssh: - # first, turn off the running program ssh.exec_cmd("/usr/local/frc/bin/frcKillRobot.sh -t") diff --git a/pyfrc/physics/core.py b/pyfrc/physics/core.py index 5f7b388..b92537d 100644 --- a/pyfrc/physics/core.py +++ b/pyfrc/physics/core.py @@ -101,7 +101,6 @@ def _create_and_attach( interface: typing.Optional["PhysicsInterface"] = None physics_module_path = robot_path / "physics.py" if physics_module_path.exists(): - # Load the user's physics module if it exists try: physics_module = imp.load_source("physics", str(physics_module_path)) @@ -139,7 +138,6 @@ def _simulationInit(self): return interface, robot_class def __init__(self, physics_module): - self.last_tm = None self.module = physics_module self.engine = None @@ -148,7 +146,6 @@ def __init__(self, physics_module): self.log_init_errors = True def _simulationInit(self, robot): - # reset state first so that the PhysicsEngine constructor can use it self.field = wpilib.Field2d() wpilib.SmartDashboard.putData("Field", self.field) @@ -185,7 +182,6 @@ def _simulationPeriodic(self): if last_tm is None: self.last_tm = now else: - # When using time, always do it based on a differential! You may # not always be called at a constant rate tm_diff = now - last_tm diff --git a/pyfrc/physics/units.py b/pyfrc/physics/units.py index 5a61606..328bd6a 100644 --- a/pyfrc/physics/units.py +++ b/pyfrc/physics/units.py @@ -43,6 +43,7 @@ units.define("tm_kv = volt / (foot / second)") units.define("tm_ka = volt / (foot / second ** 2)") + # Helper functions class Helpers: ensure_mass = units.check("[mass]")(lambda u: u) diff --git a/pyfrc/physics/visionsim.py b/pyfrc/physics/visionsim.py index da9315e..8a05d63 100644 --- a/pyfrc/physics/visionsim.py +++ b/pyfrc/physics/visionsim.py @@ -39,7 +39,6 @@ def __init__(self, x, y, view_angle_start, view_angle_end): self.view_angle_end = math.radians(view_angle_end) def compute(self, now, x, y, angle): - # incoming angle must be normalized to -180,180 (done in VisionSim) # note: the position tracking of the robot has Y incrementing @@ -225,7 +224,6 @@ def compute(self, now, x, y, angle): # Only store stuff every once in awhile if now - self.last_compute_time > self.update_period: - self.last_compute_time = now self.send_queue.appendleft(output) diff --git a/pyfrc/test_support/controller.py b/pyfrc/test_support/controller.py index 7bf18ca..e16e99f 100644 --- a/pyfrc/test_support/controller.py +++ b/pyfrc/test_support/controller.py @@ -25,7 +25,6 @@ def _on_robot_initialized(self): self._cond.notify_all() def _robot_thread(self, robot): - with self._cond: self._robot_started = True self._cond.notify_all() diff --git a/pyfrc/test_support/pytest_plugin.py b/pyfrc/test_support/pytest_plugin.py index a480aaf..0724319 100644 --- a/pyfrc/test_support/pytest_plugin.py +++ b/pyfrc/test_support/pytest_plugin.py @@ -32,7 +32,6 @@ class PyFrcPlugin: """ def __init__(self, robot_class: Type[wpilib.RobotBase], robot_file: pathlib.Path): - # attach physics physics, robot_class = PhysicsInterface._create_and_attach( robot_class, diff --git a/pyfrc/tests/basic.py b/pyfrc/tests/basic.py index e721750..b2b3767 100644 --- a/pyfrc/tests/basic.py +++ b/pyfrc/tests/basic.py @@ -21,7 +21,6 @@ def test_autonomous(control: "TestController"): """Runs autonomous mode by itself""" with control.run_robot(): - # Run disabled for a short period control.step_timing(seconds=0.5, autonomous=True, enabled=False) @@ -37,7 +36,6 @@ def test_disabled(control: "TestController", robot): """Runs disabled mode by itself""" with control.run_robot(): - # Run disabled + autonomous for a short period control.step_timing(seconds=5, autonomous=True, enabled=False) @@ -50,7 +48,6 @@ def test_operator_control(control: "TestController"): """Runs operator control mode by itself""" with control.run_robot(): - # Run disabled for a short period control.step_timing(seconds=0.5, autonomous=False, enabled=False) @@ -66,7 +63,6 @@ def test_practice(control: "TestController"): """Runs through the entire span of a practice match""" with control.run_robot(): - # Run disabled for a short period control.step_timing(seconds=0.5, autonomous=True, enabled=False) diff --git a/pyfrc/tests/docstring_test.py b/pyfrc/tests/docstring_test.py index 3b8eeaf..91dc80c 100644 --- a/pyfrc/tests/docstring_test.py +++ b/pyfrc/tests/docstring_test.py @@ -71,7 +71,6 @@ def check_function(parent, fn, errors): # :param arg: stuff match = param_re.match(line) if match: - arg = match.group(1) if arg not in args: print_fn_err( @@ -135,7 +134,6 @@ def check_function(parent, fn, errors): params.insert(args.index(param), param) if len(params) != len(args): - diff = set(args).difference(params) if len(diff) == 1: @@ -177,7 +175,6 @@ def check_object(o, robot_path, errors): errors.append(err) for name, value in inspect.getmembers(o): - if ignore_object(value, robot_path): continue @@ -205,7 +202,6 @@ def test_docstrings(robot, robot_path): errors = [] for module in sys.modules.values(): - if ignore_object(module, robot_path): continue diff --git a/tests/old_test_tests.py b/tests/old_test_tests.py index bac8ab0..cf4569c 100644 --- a/tests/old_test_tests.py +++ b/tests/old_test_tests.py @@ -11,7 +11,6 @@ @contextlib.contextmanager def get_plugin(cls): - wpilib.DriverStation._reset() plugin = PyFrcPlugin(cls, None, None) diff --git a/tests/run_tests.py b/tests/run_tests.py index 3a9db6e..930a370 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_visionsim.py b/tests/test_visionsim.py index 56683c3..1135c19 100644 --- a/tests/test_visionsim.py +++ b/tests/test_visionsim.py @@ -4,7 +4,6 @@ def test_visionsim_target1(): - # target is facing east, 90 degree viewing angle target = VisionSimTarget(0, 0, 315, 45) target.view_dst_start = 2 @@ -54,7 +53,6 @@ def test_visionsim_target1(): def test_visionsim_target2(): - # normalization function used by vision sim def _norm(angle): return ((rad(angle) + pi) % (pi * 2)) - pi