flake8 in pre-commit(#1583)
parent
bd06434243
commit
29aaa44740
|
@ -6,6 +6,13 @@ repos:
|
||||||
- id: check-json
|
- id: check-json
|
||||||
- id: check-xml
|
- id: check-xml
|
||||||
- id: check-yaml
|
- id: check-yaml
|
||||||
|
- repo: https://gitlab.com/PyCQA/flake8
|
||||||
|
rev: master
|
||||||
|
hooks:
|
||||||
|
- id: flake8
|
||||||
|
exclude: '^(pyextra)|(external)/'
|
||||||
|
args:
|
||||||
|
- --select=F
|
||||||
- repo: local
|
- repo: local
|
||||||
hooks:
|
hooks:
|
||||||
- id: pylint
|
- id: pylint
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import unittest
|
import unittest
|
||||||
import timeit
|
|
||||||
|
|
||||||
from common.numpy_fast import interp
|
from common.numpy_fast import interp
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import time
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import cereal.messaging as messaging
|
import cereal.messaging as messaging
|
||||||
from PIL import ImageFont, ImageDraw, Image
|
from PIL import ImageFont, ImageDraw, Image
|
||||||
|
@ -36,4 +35,3 @@ if __name__ == "__main__":
|
||||||
idx += 1
|
idx += 1
|
||||||
rk.keep_time()
|
rk.keep_time()
|
||||||
#time.sleep(1.0)
|
#time.sleep(1.0)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import os
|
import os
|
||||||
from common.basedir import BASEDIR
|
|
||||||
|
|
||||||
from cffi import FFI
|
from cffi import FFI
|
||||||
|
|
||||||
|
|
|
@ -340,7 +340,7 @@ class LocKalman():
|
||||||
|
|
||||||
for n in range(N):
|
for n in range(N):
|
||||||
idx = dim_main + n * dim_augment
|
idx = dim_main + n * dim_augment
|
||||||
err_idx = dim_main_err + n * dim_augment_err # FIXME: Why is this not used?
|
# err_idx = dim_main_err + n * dim_augment_err # FIXME: Why is this not used?
|
||||||
x, y, z = state[idx:idx + 3]
|
x, y, z = state[idx:idx + 3]
|
||||||
q = state[idx + 3:idx + 7]
|
q = state[idx + 3:idx + 7]
|
||||||
quat_rot = quat_rotate(*q)
|
quat_rot = quat_rotate(*q)
|
||||||
|
|
|
@ -36,11 +36,11 @@ def get_workdir():
|
||||||
|
|
||||||
def heartbeat():
|
def heartbeat():
|
||||||
work_dir = get_workdir()
|
work_dir = get_workdir()
|
||||||
env = {
|
# env = {
|
||||||
"LD_LIBRARY_PATH": "",
|
# "LD_LIBRARY_PATH": "",
|
||||||
"ANDROID_DATA": "/data",
|
# "ANDROID_DATA": "/data",
|
||||||
"ANDROID_ROOT": "/system",
|
# "ANDROID_ROOT": "/system",
|
||||||
}
|
# }
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
@ -53,7 +53,7 @@ def heartbeat():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
tmux = os.popen('tail -n 100 /tmp/tmux_out').read()
|
tmux = os.popen('tail -n 100 /tmp/tmux_out').read()
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
params = Params()
|
params = Params()
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import os
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
|
import selfdrive.manager as manager
|
||||||
from cereal.messaging import PubMaster, recv_one, sub_sock
|
from cereal.messaging import PubMaster, recv_one, sub_sock
|
||||||
from tools.lib.framereader import FrameReader
|
from tools.lib.framereader import FrameReader
|
||||||
import subprocess
|
|
||||||
import selfdrive.manager as manager
|
|
||||||
|
|
||||||
|
|
||||||
def rreplace(s, old, new, occurrence):
|
def rreplace(s, old, new, occurrence):
|
||||||
|
@ -22,7 +20,6 @@ def regen_model(msgs, pm, frame_reader, model_sock):
|
||||||
if msg.which() == 'liveCalibration':
|
if msg.which() == 'liveCalibration':
|
||||||
pm.send('liveCalibration', msg.as_builder())
|
pm.send('liveCalibration', msg.as_builder())
|
||||||
|
|
||||||
|
|
||||||
out_msgs = []
|
out_msgs = []
|
||||||
fidx = 0
|
fidx = 0
|
||||||
for msg in tqdm(msgs):
|
for msg in tqdm(msgs):
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
|
||||||
import cProfile
|
import cProfile
|
||||||
import pprofile
|
import pprofile
|
||||||
import pyprof2calltree
|
import pyprof2calltree
|
||||||
|
|
|
@ -11,10 +11,10 @@ def setup_leon_fan():
|
||||||
for i in [0,1,2,3]:
|
for i in [0,1,2,3]:
|
||||||
print("FAN SPEED", i)
|
print("FAN SPEED", i)
|
||||||
if i == 0:
|
if i == 0:
|
||||||
ret = bus.write_i2c_block_data(0x67, 0xa, [0])
|
bus.write_i2c_block_data(0x67, 0xa, [0])
|
||||||
else:
|
else:
|
||||||
ret = bus.write_i2c_block_data(0x67, 0xa, [0x20])
|
bus.write_i2c_block_data(0x67, 0xa, [0x20])
|
||||||
ret = bus.write_i2c_block_data(0x67, 0x8, [(i-1)<<6])
|
bus.write_i2c_block_data(0x67, 0x8, [(i-1)<<6])
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
bus.close()
|
bus.close()
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import tempfile
|
|
||||||
import shutil
|
|
||||||
import subprocess
|
import subprocess
|
||||||
from common.basedir import BASEDIR
|
from common.basedir import BASEDIR
|
||||||
from azure.storage.blob import BlockBlobService
|
from azure.storage.blob import BlockBlobService
|
||||||
|
@ -8,8 +6,7 @@ from azure.storage.blob import BlockBlobService
|
||||||
from selfdrive.test.test_car_models import routes as test_car_models_routes
|
from selfdrive.test.test_car_models import routes as test_car_models_routes
|
||||||
from selfdrive.test.process_replay.test_processes import segments as replay_segments
|
from selfdrive.test.process_replay.test_processes import segments as replay_segments
|
||||||
from xx.chffr.lib import azureutil
|
from xx.chffr.lib import azureutil
|
||||||
from xx.chffr.lib.storage import upload_dir_serial, download_dir_tpe
|
from xx.chffr.lib.storage import _DATA_ACCOUNT_PRODUCTION, _DATA_ACCOUNT_CI, _DATA_BUCKET_PRODUCTION
|
||||||
from xx.chffr.lib.storage import _DATA_ACCOUNT_PRODUCTION, _DATA_ACCOUNT_CI, _DATA_BUCKET_PRODUCTION, _DATA_BUCKET_CI
|
|
||||||
|
|
||||||
SOURCES = [
|
SOURCES = [
|
||||||
(_DATA_ACCOUNT_PRODUCTION, _DATA_BUCKET_PRODUCTION),
|
(_DATA_ACCOUNT_PRODUCTION, _DATA_BUCKET_PRODUCTION),
|
||||||
|
|
|
@ -8,6 +8,7 @@ import tempfile
|
||||||
import threading
|
import threading
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import _io
|
||||||
if sys.version_info >= (3,0):
|
if sys.version_info >= (3,0):
|
||||||
import queue
|
import queue
|
||||||
import pickle
|
import pickle
|
||||||
|
@ -83,7 +84,7 @@ def ffprobe(fn, fmt=None):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ffprobe_output = subprocess.check_output(cmd)
|
ffprobe_output = subprocess.check_output(cmd)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError:
|
||||||
raise DataUnreadableError(fn)
|
raise DataUnreadableError(fn)
|
||||||
|
|
||||||
return json.loads(ffprobe_output)
|
return json.loads(ffprobe_output)
|
||||||
|
@ -99,7 +100,7 @@ def vidindex(fn, typ):
|
||||||
tempfile.NamedTemporaryFile() as index_f:
|
tempfile.NamedTemporaryFile() as index_f:
|
||||||
try:
|
try:
|
||||||
subprocess.check_call([vidindex, typ, fn, prefix_f.name, index_f.name])
|
subprocess.check_call([vidindex, typ, fn, prefix_f.name, index_f.name])
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError:
|
||||||
raise DataUnreadableError("vidindex failed on file %s" % fn)
|
raise DataUnreadableError("vidindex failed on file %s" % fn)
|
||||||
with open(index_f.name, "rb") as f:
|
with open(index_f.name, "rb") as f:
|
||||||
index = f.read()
|
index = f.read()
|
||||||
|
@ -388,8 +389,6 @@ def index_pstream(fns, typ, cache_prefix=None):
|
||||||
assert frame_b >= 0
|
assert frame_b >= 0
|
||||||
assert index[frame_b, 0] == H264_SLICE_I
|
assert index[frame_b, 0] == H264_SLICE_I
|
||||||
|
|
||||||
end_len = len(index)-frame_b
|
|
||||||
|
|
||||||
with FileReader(fns[i]) as vid:
|
with FileReader(fns[i]) as vid:
|
||||||
vid.seek(index[frame_b, 1])
|
vid.seek(index[frame_b, 1])
|
||||||
end_data = vid.read()
|
end_data = vid.read()
|
||||||
|
@ -433,7 +432,7 @@ def _set_pdeathsig(sig=signal.SIGTERM):
|
||||||
def vidindex_mp4(fn):
|
def vidindex_mp4(fn):
|
||||||
try:
|
try:
|
||||||
xmls = subprocess.check_output(["MP4Box", fn, "-diso", "-out", "/dev/stdout"])
|
xmls = subprocess.check_output(["MP4Box", fn, "-diso", "-out", "/dev/stdout"])
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError:
|
||||||
raise DataUnreadableError(fn)
|
raise DataUnreadableError(fn)
|
||||||
|
|
||||||
tree = ET.fromstring(xmls)
|
tree = ET.fromstring(xmls)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import sys
|
import sys
|
||||||
import random
|
import random
|
||||||
import math
|
|
||||||
|
|
||||||
# Simple hacky Matroska generator
|
# Simple hacky Matroska generator
|
||||||
# Reads mp3 file "q.mp3" and jpeg images from img/0.jpg, img/1.jpg and so on and
|
# Reads mp3 file "q.mp3" and jpeg images from img/0.jpg, img/1.jpg and so on and
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
# See "mkvuser.py" for the example
|
# See "mkvuser.py" for the example
|
||||||
# pylint: skip-file
|
# pylint: skip-file
|
||||||
|
# flake8: noqa
|
||||||
|
|
||||||
import traceback
|
import traceback
|
||||||
from struct import unpack
|
from struct import unpack
|
||||||
|
|
|
@ -63,7 +63,6 @@ def ui_thread(addr, frame_address):
|
||||||
|
|
||||||
camera_surface = pygame.surface.Surface((640, 480), 0, 24).convert()
|
camera_surface = pygame.surface.Surface((640, 480), 0, 24).convert()
|
||||||
cameraw_surface = pygame.surface.Surface(MODEL_INPUT_SIZE, 0, 24).convert()
|
cameraw_surface = pygame.surface.Surface(MODEL_INPUT_SIZE, 0, 24).convert()
|
||||||
cameraw_test_surface = pygame.surface.Surface(MODEL_INPUT_SIZE, 0, 24)
|
|
||||||
top_down_surface = pygame.surface.Surface((UP.lidar_x, UP.lidar_y),0,8)
|
top_down_surface = pygame.surface.Surface((UP.lidar_x, UP.lidar_y),0,8)
|
||||||
|
|
||||||
frame = messaging.sub_sock('frame', addr=addr, conflate=True)
|
frame = messaging.sub_sock('frame', addr=addr, conflate=True)
|
||||||
|
|
|
@ -79,7 +79,6 @@ def go(q):
|
||||||
threading.Thread(target=health_function).start()
|
threading.Thread(target=health_function).start()
|
||||||
threading.Thread(target=fake_driver_monitoring).start()
|
threading.Thread(target=fake_driver_monitoring).start()
|
||||||
|
|
||||||
import carla # pylint: disable=import-error
|
|
||||||
client = carla.Client("127.0.0.1", 2000)
|
client = carla.Client("127.0.0.1", 2000)
|
||||||
client.set_timeout(5.0)
|
client.set_timeout(5.0)
|
||||||
world = client.load_world('Town04')
|
world = client.load_world('Town04')
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import time
|
|
||||||
import sys
|
import sys
|
||||||
import termios
|
import termios
|
||||||
from termios import *
|
import time
|
||||||
|
from termios import (BRKINT, VMIN, CS8, CSIZE, ECHO, ICANON, ICRNL, IEXTEN,
|
||||||
|
INPCK, ISIG, ISTRIP, IXON, PARENB, VTIME)
|
||||||
|
|
||||||
# Indexes for termios list.
|
# Indexes for termios list.
|
||||||
IFLAG = 0
|
IFLAG = 0
|
||||||
|
@ -58,4 +59,3 @@ if __name__ == '__main__':
|
||||||
p.start()
|
p.start()
|
||||||
|
|
||||||
keyboard_poll_thread(q)
|
keyboard_poll_thread(q)
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ def wheel_poll_thread(q):
|
||||||
|
|
||||||
# Enable FF
|
# Enable FF
|
||||||
import evdev # pylint: disable=import-error
|
import evdev # pylint: disable=import-error
|
||||||
from evdev import ecodes, InputDevice, ff # pylint: disable=import-error
|
from evdev import ecodes, InputDevice # pylint: disable=import-error
|
||||||
device = evdev.list_devices()[0]
|
device = evdev.list_devices()[0]
|
||||||
evtdev = InputDevice(device)
|
evtdev = InputDevice(device)
|
||||||
val = 24000
|
val = 24000
|
||||||
|
|
|
@ -40,12 +40,12 @@ def receiver_thread():
|
||||||
ctx = av.codec.codec.Codec('hevc', 'r').create()
|
ctx = av.codec.codec.Codec('hevc', 'r').create()
|
||||||
ctx.decode(av.packet.Packet(start.decode("hex")))
|
ctx.decode(av.packet.Packet(start.decode("hex")))
|
||||||
|
|
||||||
import time
|
# import time
|
||||||
while 1:
|
while 1:
|
||||||
t1 = time.time()
|
# t1 = time.time()
|
||||||
ts, raw = s.recv_multipart()
|
ts, raw = s.recv_multipart()
|
||||||
ts = struct.unpack('q', ts)[0] * 1000
|
ts = struct.unpack('q', ts)[0] * 1000
|
||||||
t1, t2 = time.time(), t1
|
# t1, t2 = time.time(), t1
|
||||||
#print 'ms to get frame:', (t1-t2)*1000
|
#print 'ms to get frame:', (t1-t2)*1000
|
||||||
|
|
||||||
pkt = av.packet.Packet(raw)
|
pkt = av.packet.Packet(raw)
|
||||||
|
@ -53,14 +53,14 @@ def receiver_thread():
|
||||||
if not f:
|
if not f:
|
||||||
continue
|
continue
|
||||||
f = f[0]
|
f = f[0]
|
||||||
t1, t2 = time.time(), t1
|
# t1, t2 = time.time(), t1
|
||||||
#print 'ms to decode:', (t1-t2)*1000
|
#print 'ms to decode:', (t1-t2)*1000
|
||||||
|
|
||||||
y_plane = np.frombuffer(f.planes[0], np.uint8).reshape((874, 1216))[:, 0:1164]
|
y_plane = np.frombuffer(f.planes[0], np.uint8).reshape((874, 1216))[:, 0:1164]
|
||||||
u_plane = np.frombuffer(f.planes[1], np.uint8).reshape((437, 608))[:, 0:582]
|
u_plane = np.frombuffer(f.planes[1], np.uint8).reshape((437, 608))[:, 0:582]
|
||||||
v_plane = np.frombuffer(f.planes[2], np.uint8).reshape((437, 608))[:, 0:582]
|
v_plane = np.frombuffer(f.planes[2], np.uint8).reshape((437, 608))[:, 0:582]
|
||||||
yuv_img = y_plane.tobytes() + u_plane.tobytes() + v_plane.tobytes()
|
yuv_img = y_plane.tobytes() + u_plane.tobytes() + v_plane.tobytes()
|
||||||
t1, t2 = time.time(), t1
|
# t1, t2 = time.time(), t1
|
||||||
#print 'ms to make yuv:', (t1-t2)*1000
|
#print 'ms to make yuv:', (t1-t2)*1000
|
||||||
#print 'tsEof:', ts
|
#print 'tsEof:', ts
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue