More LGTM fixups (#1457)

* exclude lib dirs, fix 3 cpp errors

* fix more alerts, exclude mkvparse

Co-authored-by: George Hotz <geohot@gmail.com>
old-commit-hash: e568d3cadc
commatwo_master
George Hotz 5 years ago committed by GitHub
parent 0fcd08af91
commit d47b2ef576
  1. 6
      lgtm.yml
  2. 2
      selfdrive/common/visionipc.c
  3. 2
      selfdrive/debug/internal/cycle_alerts.py
  4. 4
      selfdrive/debug/internal/sensor_test_bootloop.py
  5. 2
      selfdrive/locationd/liblocationd_py.py
  6. 4
      selfdrive/modeld/runners/snpemodel.cc
  7. 1
      tools/carcontrols/debug_controls.py
  8. 2
      tools/carcontrols/joystickd.py
  9. 1
      tools/lib/api.py
  10. 4
      tools/lib/auth.py
  11. 2
      tools/lib/framereader.py
  12. 1
      tools/lib/logreader.py
  13. 1
      tools/nui/get_files_comma_api.py
  14. 1
      tools/replay/camera.py
  15. 2
      tools/replay/rqplot.py
  16. 4
      tools/replay/unlogger.py
  17. 5
      tools/streamer/streamerd.py

@ -1,3 +1,9 @@
path_classifiers:
library:
- external
- phonelibs
- pyextra
- tools/lib/mkvparse
extraction: extraction:
cpp: cpp:
after_prepare: after_prepare:

@ -99,7 +99,7 @@ int visionstream_init(VisionStream *s, VisionStreamType type, bool tbuffer, Visi
close(s->ipc_fd); close(s->ipc_fd);
return -1; return -1;
} }
assert(rp.type = VIPC_STREAM_BUFS); assert(rp.type == VIPC_STREAM_BUFS);
assert(rp.d.stream_bufs.type == type); assert(rp.d.stream_bufs.type == type);
s->bufs_info = rp.d.stream_bufs; s->bufs_info = rp.d.stream_bufs;

@ -3,10 +3,8 @@
import argparse import argparse
import time import time
import zmq
import cereal.messaging as messaging import cereal.messaging as messaging
from cereal.services import service_list
from selfdrive.controls.lib.alerts import ALERTS from selfdrive.controls.lib.alerts import ALERTS
def now_millis(): return time.time() * 1000 def now_millis(): return time.time() * 1000

@ -19,7 +19,7 @@ except PermissionError:
try: try:
with open('/tmp/test-results.json', 'r') as infile: with open('/tmp/test-results.json', 'r') as infile:
data = json.load(infile) data = json.load(infile)
except: except Exception:
data = {'sensor-pass': 0, 'sensor-fail': 0} data = {'sensor-pass': 0, 'sensor-fail': 0}
STARTUP_SCRIPT = "/data/data/com.termux/files/continue.sh" STARTUP_SCRIPT = "/data/data/com.termux/files/continue.sh"
@ -27,7 +27,7 @@ try:
with open(STARTUP_SCRIPT, 'w') as startup_script: with open(STARTUP_SCRIPT, 'w') as startup_script:
startup_script.write("#!/usr/bin/bash\n\n/data/openpilot/selfdrive/test/sensor_test_bootloop.py\n") startup_script.write("#!/usr/bin/bash\n\n/data/openpilot/selfdrive/test/sensor_test_bootloop.py\n")
os.chmod(STARTUP_SCRIPT, stat.S_IRWXU) os.chmod(STARTUP_SCRIPT, stat.S_IRWXU)
except: except Exception:
print("Failed to install new startup script -- aborting") print("Failed to install new startup script -- aborting")
sys.exit(-1) sys.exit(-1)

@ -1,9 +1,7 @@
import os import os
import subprocess
from common.basedir import BASEDIR from common.basedir import BASEDIR
from cffi import FFI from cffi import FFI
from ctypes import cdll
locationd_dir = os.path.dirname(os.path.abspath(__file__)) locationd_dir = os.path.dirname(os.path.abspath(__file__))
liblocationd_fn = os.path.join(locationd_dir, "liblocationd.so") liblocationd_fn = os.path.join(locationd_dir, "liblocationd.so")

@ -28,7 +28,7 @@ SNPEModel::SNPEModel(const char *path, float *output, size_t output_size, int ru
// load model // load model
std::unique_ptr<zdl::DlContainer::IDlContainer> container = zdl::DlContainer::IDlContainer::open(model_data, model_size); std::unique_ptr<zdl::DlContainer::IDlContainer> container = zdl::DlContainer::IDlContainer::open(model_data, model_size);
if (!container) { PrintErrorStringAndExit(); } if (!container) { PrintErrorStringAndExit(); }
printf("loaded model with size: %u\n", model_size); printf("loaded model with size: %lu\n", model_size);
// create model runner // create model runner
zdl::SNPE::SNPEBuilder snpeBuilder(container.get()); zdl::SNPE::SNPEBuilder snpeBuilder(container.get());
@ -79,7 +79,7 @@ SNPEModel::SNPEModel(const char *path, float *output, size_t output_size, int ru
stride *= bufferShape[i]; stride *= bufferShape[i];
strides[i-1] = stride; strides[i-1] = stride;
} }
printf("input product is %u\n", product); printf("input product is %lu\n", product);
inputBuffer = ubFactory.createUserBuffer(NULL, product*sizeof(float), strides, &userBufferEncodingFloat); inputBuffer = ubFactory.createUserBuffer(NULL, product*sizeof(float), strides, &userBufferEncodingFloat);
inputMap.add(input_tensor_name, inputBuffer.get()); inputMap.add(input_tensor_name, inputBuffer.get());

@ -1,5 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python
import struct
from common.numpy_fast import clip from common.numpy_fast import clip
from common.params import Params from common.params import Params
from copy import copy from copy import copy

@ -7,10 +7,8 @@
### this process needs pygame and can't run on the EON ### ### this process needs pygame and can't run on the EON ###
import pygame import pygame
import zmq
import cereal.messaging as messaging import cereal.messaging as messaging
def joystick_thread(): def joystick_thread():
joystick_sock = messaging.pub_sock('testJoystick') joystick_sock = messaging.pub_sock('testJoystick')

@ -1,4 +1,3 @@
import sys
import os import os
import requests import requests
from tools.lib.auth_config import clear_token from tools.lib.auth_config import clear_token

@ -1,12 +1,8 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import json
import os
import sys import sys
import webbrowser import webbrowser
from http.server import HTTPServer, BaseHTTPRequestHandler from http.server import HTTPServer, BaseHTTPRequestHandler
from urllib.parse import urlencode, parse_qs from urllib.parse import urlencode, parse_qs
from common.file_helpers import mkdirs_exists_ok
from tools.lib.api import CommaApi, APIError from tools.lib.api import CommaApi, APIError
from tools.lib.auth_config import set_token from tools.lib.auth_config import set_token

@ -1,8 +1,6 @@
import os import os
import sys import sys
import glob
import json import json
import time
import struct import struct
import tempfile import tempfile
import threading import threading

@ -1,7 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os import os
import sys import sys
import json
import bz2 import bz2
import tempfile import tempfile
import subprocess import subprocess

@ -1,5 +1,4 @@
import json import json
import os
import sys import sys
from tools.lib.route import Route from tools.lib.route import Route

@ -10,7 +10,6 @@ import pygame
import numpy as np import numpy as np
import cv2 import cv2
import sys import sys
from tools.lib.lazy_property import lazy_property
import cereal.messaging as messaging import cereal.messaging as messaging
_BB_OFFSET = 0, 0 _BB_OFFSET = 0, 0

@ -1,12 +1,10 @@
#!/usr/bin/env python #!/usr/bin/env python
import os
import sys import sys
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np import numpy as np
import cereal.messaging as messaging import cereal.messaging as messaging
import time import time
# tool to plot one or more signals live. Call ex: # tool to plot one or more signals live. Call ex:
#./rqplot.py log.carState.vEgo log.carState.aEgo #./rqplot.py log.carState.vEgo log.carState.aEgo

@ -4,10 +4,7 @@ import os
import sys import sys
import zmq import zmq
import time import time
import gc
import signal import signal
from threading import Thread
import numpy as np
from uuid import uuid4 from uuid import uuid4
from collections import namedtuple from collections import namedtuple
from collections import deque from collections import deque
@ -22,7 +19,6 @@ from cereal.services import service_list
from cereal.messaging import pub_sock, MultiplePublishersError from cereal.messaging import pub_sock, MultiplePublishersError
from common import realtime from common import realtime
from tools.lib.file_helpers import mkdirs_exists_ok
from tools.lib.kbhit import KBHit from tools.lib.kbhit import KBHit
from tools.lib.logreader import MultiLogIterator from tools.lib.logreader import MultiLogIterator
from tools.lib.route import Route from tools.lib.route import Route

@ -1,15 +1,10 @@
#!/usr/bin/env python #!/usr/bin/env python
import os import os
import sys import sys
import argparse
import zmq import zmq
import json
import cv2 import cv2
import numpy as np import numpy as np
from hexdump import hexdump
import scipy.misc
import struct import struct
from collections import deque
# sudo pip install git+git://github.com/mikeboers/PyAV.git # sudo pip install git+git://github.com/mikeboers/PyAV.git
import av import av

Loading…
Cancel
Save