flake8 in pre-commit(#1583)

This commit is contained in:
Willem Melching
2020-05-27 20:33:05 -07:00
committed by GitHub
parent bd06434243
commit 29aaa44740
18 changed files with 34 additions and 41 deletions
+4 -5
View File
@@ -8,6 +8,7 @@ import tempfile
import threading
import xml.etree.ElementTree as ET
import numpy as np
import _io
if sys.version_info >= (3,0):
import queue
import pickle
@@ -83,7 +84,7 @@ def ffprobe(fn, fmt=None):
try:
ffprobe_output = subprocess.check_output(cmd)
except subprocess.CalledProcessError as e:
except subprocess.CalledProcessError:
raise DataUnreadableError(fn)
return json.loads(ffprobe_output)
@@ -99,7 +100,7 @@ def vidindex(fn, typ):
tempfile.NamedTemporaryFile() as index_f:
try:
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)
with open(index_f.name, "rb") as f:
index = f.read()
@@ -388,8 +389,6 @@ def index_pstream(fns, typ, cache_prefix=None):
assert frame_b >= 0
assert index[frame_b, 0] == H264_SLICE_I
end_len = len(index)-frame_b
with FileReader(fns[i]) as vid:
vid.seek(index[frame_b, 1])
end_data = vid.read()
@@ -433,7 +432,7 @@ def _set_pdeathsig(sig=signal.SIGTERM):
def vidindex_mp4(fn):
try:
xmls = subprocess.check_output(["MP4Box", fn, "-diso", "-out", "/dev/stdout"])
except subprocess.CalledProcessError as e:
except subprocess.CalledProcessError:
raise DataUnreadableError(fn)
tree = ET.fromstring(xmls)
-1
View File
@@ -1,7 +1,6 @@
#!/usr/bin/env python
import sys
import random
import math
# Simple hacky Matroska generator
# Reads mp3 file "q.mp3" and jpeg images from img/0.jpg, img/1.jpg and so on and
+1
View File
@@ -8,6 +8,7 @@
# See "mkvuser.py" for the example
# pylint: skip-file
# flake8: noqa
import traceback
from struct import unpack
-1
View File
@@ -63,7 +63,6 @@ def ui_thread(addr, frame_address):
camera_surface = pygame.surface.Surface((640, 480), 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)
frame = messaging.sub_sock('frame', addr=addr, conflate=True)
-1
View File
@@ -79,7 +79,6 @@ def go(q):
threading.Thread(target=health_function).start()
threading.Thread(target=fake_driver_monitoring).start()
import carla # pylint: disable=import-error
client = carla.Client("127.0.0.1", 2000)
client.set_timeout(5.0)
world = client.load_world('Town04')
+3 -3
View File
@@ -1,7 +1,8 @@
import time
import sys
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.
IFLAG = 0
@@ -58,4 +59,3 @@ if __name__ == '__main__':
p.start()
keyboard_poll_thread(q)
+1 -1
View File
@@ -133,7 +133,7 @@ def wheel_poll_thread(q):
# Enable FF
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]
evtdev = InputDevice(device)
val = 24000
+5 -5
View File
@@ -40,12 +40,12 @@ def receiver_thread():
ctx = av.codec.codec.Codec('hevc', 'r').create()
ctx.decode(av.packet.Packet(start.decode("hex")))
import time
# import time
while 1:
t1 = time.time()
# t1 = time.time()
ts, raw = s.recv_multipart()
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
pkt = av.packet.Packet(raw)
@@ -53,14 +53,14 @@ def receiver_thread():
if not f:
continue
f = f[0]
t1, t2 = time.time(), t1
# t1, t2 = time.time(), t1
#print 'ms to decode:', (t1-t2)*1000
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]
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()
t1, t2 = time.time(), t1
# t1, t2 = time.time(), t1
#print 'ms to make yuv:', (t1-t2)*1000
#print 'tsEof:', ts