Skip to content

Commit

Permalink
Run black 23.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
auscompgeek committed Feb 19, 2023
1 parent 771f23f commit fbe9447
Show file tree
Hide file tree
Showing 17 changed files with 1 addition and 34 deletions.
1 change: 0 additions & 1 deletion pyfrc/mains/cli_create_physics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
6 changes: 0 additions & 6 deletions pyfrc/mains/cli_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ def __init__(self, parser: argparse.ArgumentParser):
)

def run(self, options, robot_class, **static_options):

from .. import config

config.mode = "upload"
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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 = []
Expand All @@ -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:
Expand Down Expand Up @@ -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"})

Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions pyfrc/mains/cli_deploy_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class PyFrcDeployInfo:
"""

def __init__(self, parser: argparse.ArgumentParser):

robot_args = parser.add_mutually_exclusive_group()

robot_args.add_argument(
Expand Down Expand Up @@ -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
)
Expand Down
1 change: 0 additions & 1 deletion pyfrc/mains/cli_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion pyfrc/mains/cli_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion pyfrc/mains/cli_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions pyfrc/mains/cli_undeploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class PyFrcUndeploy:
"""

def __init__(self, parser: argparse.ArgumentParser):

robot_args = parser.add_mutually_exclusive_group()

robot_args.add_argument(
Expand Down Expand Up @@ -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")

Expand Down
4 changes: 0 additions & 4 deletions pyfrc/physics/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions pyfrc/physics/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions pyfrc/physics/visionsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
1 change: 0 additions & 1 deletion pyfrc/test_support/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 0 additions & 1 deletion pyfrc/test_support/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 0 additions & 4 deletions pyfrc/tests/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)

Expand All @@ -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)

Expand All @@ -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)

Expand Down
4 changes: 0 additions & 4 deletions pyfrc/tests/docstring_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -205,7 +202,6 @@ def test_docstrings(robot, robot_path):
errors = []

for module in sys.modules.values():

if ignore_object(module, robot_path):
continue

Expand Down
1 change: 0 additions & 1 deletion tests/old_test_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

@contextlib.contextmanager
def get_plugin(cls):

wpilib.DriverStation._reset()

plugin = PyFrcPlugin(cls, None, None)
Expand Down
1 change: 0 additions & 1 deletion tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import subprocess

if __name__ == "__main__":

root = abspath(dirname(__file__))
os.chdir(root)

Expand Down
2 changes: 0 additions & 2 deletions tests/test_visionsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fbe9447

Please sign in to comment.