Using lgtm.com and fixing found alerts (#1452)

* lgtm in readme, and mac nui fixes

* call super inits in radars

* unused imports, dup lines

* more radars, more unused imports

* pass CP into RadarInterfaceBase

* more fixups

* unused imports

* delete unused lines

* ugh, new unused import

Co-authored-by: George Hotz <geohot@gmail.com>
This commit is contained in:
George Hotz
2020-05-02 12:07:34 -07:00
committed by GitHub
parent 846a58507f
commit 1295cfe06c
33 changed files with 27 additions and 164 deletions
-1
View File
@@ -21,7 +21,6 @@ import subprocess
from aenum import Enum
from lru import LRU
from functools import wraps
from concurrent.futures import ThreadPoolExecutor, as_completed
from tools.lib.cache import cache_path_for_file_path
from tools.lib.exceptions import DataUnreadableError
-2
View File
@@ -4,10 +4,8 @@ import sys
import json
import bz2
import tempfile
import requests
import subprocess
import urllib.parse
from aenum import Enum
import capnp
import numpy as np
-22
View File
@@ -1,7 +1,6 @@
#!/usr/bin/env python
# Copyright (c) 2016, Comma.ai, Inc.
import sys
import re
import binascii
@@ -64,24 +63,3 @@ def simple_gen(of, config_record, w, h, framedata):
# + ebml_element(0xA7, ben(0)) # Position, uint
+ ''.join(blocks)))
if __name__ == "__main__":
import random
if len(sys.argv) != 2:
print("usage: %s mkvpath" % sys.argv[0])
with open(sys.argv[1], "rb") as f:
cr, index = mkvindex(f)
# cr = "280000003002000030010000010018004646563100cb070000000000000000000000000000000000".decode("hex")
def geti(i):
pos, length = index[i]
with open(sys.argv[1], "rb") as f:
f.seek(pos)
return f.read(length)
dats = [geti(random.randrange(200)) for _ in xrange(30)]
with open("tmpout.mkv", "wb") as of:
simple_gen(of, cr, dats)
+1 -1
View File
@@ -23,7 +23,7 @@ if __name__ == "__main__":
poller = messaging.Poller()
m = 'driverMonitoring'
sock = messaging.sub_sock(m, poller, addr=args.addr)
messaging.sub_sock(m, poller, addr=args.addr)
pygame.init()
pygame.display.set_caption('livedm')
+1
View File
@@ -6,4 +6,5 @@ moc_*
.qmake.stash
nui.app/*
routes.json
_nui.app
+5 -1
View File
@@ -15,7 +15,11 @@
static inline uint64_t nanos_since_boot() {
struct timespec t;
clock_gettime(CLOCK_BOOTTIME, &t);
#ifdef __APPLE__
clock_gettime(CLOCK_REALTIME, &t);
#else
clock_gettime(CLOCK_BOOTTIME, &t);
#endif
return t.tv_sec * 1000000000ULL + t.tv_nsec;
}
-9
View File
@@ -6,18 +6,11 @@ os.environ['BASEDIR'] = BASEDIR
SCALE = float(os.getenv("SCALE", 1.0))
import argparse
import zmq
import pygame
import numpy as np
import cv2
import sys
import traceback
from collections import namedtuple
from cereal import car
from common.params import Params
from tools.lib.lazy_property import lazy_property
from cereal.messaging import sub_sock, recv_one_or_none, recv_one
from cereal.services import service_list
import cereal.messaging as messaging
_BB_OFFSET = 0, 0
@@ -33,8 +26,6 @@ def pygame_modules_have_loaded():
def ui_thread(addr, frame_address):
context = zmq.Context.instance()
pygame.init()
pygame.font.init()
assert pygame_modules_have_loaded()
-1
View File
@@ -1,4 +1,3 @@
import platform
from collections import namedtuple
import matplotlib
+1 -4
View File
@@ -1,7 +1,5 @@
#!/usr/bin/env python3
import carla
import os
import time, termios, tty, sys
import time
import math
import atexit
import numpy as np
@@ -9,7 +7,6 @@ import threading
import random
import cereal.messaging as messaging
import argparse
import queue
from common.params import Params
from common.realtime import Ratekeeper
from lib.can import can_function, sendcan_function
-11
View File
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
import time
import cereal.messaging as messaging
from opendbc.can.parser import CANParser
from opendbc.can.packer import CANPacker
@@ -92,13 +91,3 @@ def sendcan_function(sendcan):
return (gas, brake, steer_torque)
if __name__ == "__main__":
pm = messaging.PubMaster(['can'])
sendcan = messaging.sub_sock('sendcan')
idx = 0
while 1:
sendcan_function(sendcan)
can_function(pm, 10.0, idx)
time.sleep(0.01)
idx += 1