Skip to content

Commit

Permalink
Apply ruff pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobkoziej committed Oct 20, 2023
1 parent bf1d8bc commit be1bf01
Show file tree
Hide file tree
Showing 26 changed files with 80 additions and 253 deletions.
8 changes: 6 additions & 2 deletions common/igvcutils/src/igvcutils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
from . import can
from . import ctrl
# ruff: noqa: F401

from . import (
can,
ctrl,
)
72 changes: 0 additions & 72 deletions dbw/cmd/cmd.py

This file was deleted.

54 changes: 0 additions & 54 deletions dbw/cmd/cmd_can.py

This file was deleted.

68 changes: 0 additions & 68 deletions dbw/cmd/node.py

This file was deleted.

1 change: 1 addition & 0 deletions dbw/ember_bl/ember_identity.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ruff: noqa: F821
# Simple script to add a #define for EMBER_NODE_IDENTITY.

Import('env')
Expand Down
2 changes: 1 addition & 1 deletion dbw/ember_bl/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def main():

sleep(SLEEP_WAIT)

log.info(f"Waiting for node to be in RECV_CHUNK....")
log.info("Waiting for node to be in RECV_CHUNK....")
while node.state() != 'RECV_CHUNK':
sleep(SLEEP_WAIT)

Expand Down
1 change: 1 addition & 0 deletions dbw/node_fw/ember_identity.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ruff: noqa: F821
# Simple script to add a #define for EMBER_NODE_IDENTITY.

Import('env')
Expand Down
2 changes: 2 additions & 0 deletions dbw/node_fw/ember_update_pio.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# ruff: noqa: F821

Import("env")

identity = env.GetProjectOption('board_node_identity', default=None)
Expand Down
4 changes: 3 additions & 1 deletion dbw/node_fw/opencan-pio.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# ruff: noqa: F821

Import("env")

node = env.GetProjectOption("board_can_node")
Expand All @@ -11,7 +13,7 @@
# These Execute calls call opencan-cli every time.
# They could be replaced with a proper Command, but it was tricky getting
# PlatformIO to reliably execute them. You could ask them on GitHub or similar.
if 0 != env.Execute(f'scons -QD deps-opencan'):
if 0 != env.Execute('scons -QD deps-opencan'):
print("Error making sure opencan-cli is installed; stopping build.")
exit(-1)

Expand Down
2 changes: 0 additions & 2 deletions dbw/node_fw/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import argparse
import can
import cantools
import re

from pprint import pprint
from time import sleep
from tqdm import trange

Expand Down
1 change: 0 additions & 1 deletion dbw/node_sim/node.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import logging
import time

from cand.client import Bus
Expand Down
3 changes: 0 additions & 3 deletions dbw/node_sim/node_sim.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#!/usr/bin/env python3
# node simulator

import logging
import multiprocessing as mp

from cand.client import Bus

from node import Node


Expand Down
6 changes: 3 additions & 3 deletions dbw/safed/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def test(self):
data_time, data_data = data_rec
cmd_time, cmd_data = cmd_rec

if cur_time - data_time >= THROTTLE_ACCELDATA_TIMEOUT_NS:
if cur_time - data_time >= DBWNODE_ACCEL_DATA_TIMEOUT_NS:
return self.abort('TIMEOUT')
if cur_time - cmd_time >= DBW_VELCMD_TIMEOUT_NS:
if cur_time - cmd_time >= DBWNODE_VEL_CMD_TIMEOUT_NS:
return self.abort('TIMEOUT')

perc_diff = abs(data_data['percent'] - cmd_data['throttlePercent'])
Expand Down Expand Up @@ -76,7 +76,7 @@ def test(self):

encoder_time, encoder_data = encoder_rec

if cur_time - encoder_time >= ENCF_ENCODERDATA_TIMEOUT_NS:
if cur_time - encoder_time >= DBWNODE_ENCODER_DATA_TIMEOUT_NS:
return self.abort('TIMEOUT')

encoder_max = max(
Expand Down
12 changes: 6 additions & 6 deletions ros/docker/detection/src/detection.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env python3

import cv2 as cv
from cv_bridge import CvBridge, CvBridgeError
import numpy as np
import rospy
import os


from cv_bridge import CvBridge
from sensor_msgs.msg import Image
from std_msgs.msg import Bool
import numpy as np
from matplotlib import pyplot as plt


# DEFINES
Expand Down Expand Up @@ -142,7 +142,7 @@ def detection(self):
)

hsv = cv.cvtColor(barrel_jpg, cv.COLOR_BGR2HSV)
# frame_thresh = cv2.inRange(hsv,orange_min,orange_max)
# frame_thresh = cv.inRange(hsv,orange_min,orange_max)

orange_min = (0, 97, 4)
orange_max = (18, 255, 255)
Expand All @@ -156,7 +156,7 @@ def detection(self):
keypoints,
np.zeros((1, 1)),
(0, 0, 255),
cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS,
cv.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS,
)
cv.imshow("Keypoints", im_with_keypoints)
cv.waitKey(0)
Expand Down
22 changes: 14 additions & 8 deletions ros/docker/encoder_odom/src/encoder_arduino.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
#!/usr/bin/env python3

import pyfirmata
import rospy
import tf2_ros
import math
from math import sin, cos, pi

# Used for Arudino
import pyfirmata
import time

from geometry_msgs.msg import Point, Pose, Quaternion, Vector3, Twist
from std_msgs.msg import Float32
from math import (
cos,
sin,
)

from geometry_msgs.msg import (
Point,
Pose,
Quaternion,
Twist,
Vector3,
)
from nav_msgs.msg import Odometry


Expand All @@ -35,7 +41,7 @@ def publish(self, data):
# vy might always be zero
class Encoder_Odom:
def __init__(self):
self.sub = Subscribe()
self.sub = Subscribe() # noqa: F821
self.broadcaster = tf2_ros.TransformBroadcaster()

self.x = 0.0
Expand Down
Loading

0 comments on commit be1bf01

Please sign in to comment.