pre-commit pylint (#1580)
* "The commit-hook project sounds interesting though. I would definitely merge something that runs flake8 and pylint on the modified files!"
- pd0wm, https://github.com/commaai/openpilot/pull/1575#issuecomment-634974344
* add pylint to pre-commit and make everything pass
* Remove uncommented stuff
Co-authored-by: J <user@4800.lan>
old-commit-hash: bd06434243
vw-mqb-aeb
parent
834f6c383a
commit
c0866d9edb
28 changed files with 97 additions and 140 deletions
@ -0,0 +1,18 @@ |
||||
repos: |
||||
- repo: https://github.com/pre-commit/pre-commit-hooks |
||||
rev: master |
||||
hooks: |
||||
- id: check-ast |
||||
- id: check-json |
||||
- id: check-xml |
||||
- id: check-yaml |
||||
- repo: local |
||||
hooks: |
||||
- id: pylint |
||||
name: pylint |
||||
entry: pylint |
||||
language: system |
||||
types: [python] |
||||
exclude: '^(pyextra)|(external)/' |
||||
args: |
||||
- --disable=R,C,W |
@ -1,3 +1,3 @@ |
||||
version https://git-lfs.github.com/spec/v1 |
||||
oid sha256:48daf8ab5c86410503faaec54272993937b8dc2fd6793243689e91872f53136f |
||||
size 2026 |
||||
oid sha256:c4ea33acc8b1f639f0719f436989886263a67271decbcf29ab8907208161da03 |
||||
size 2043 |
||||
|
@ -1,3 +1,3 @@ |
||||
version https://git-lfs.github.com/spec/v1 |
||||
oid sha256:6268aff3b5943f5f279e1c0c89f17914309d6245cfe5de3c64c8cd75c3acadda |
||||
size 156137 |
||||
oid sha256:34b9162abbc667c0b14f418f43668422491613c32bfe8a7d8da86b3fc256350f |
||||
size 165941 |
||||
|
@ -1,50 +0,0 @@ |
||||
# USAGE: python cycle_alerts.py [duration_millis=1000] |
||||
# Then start manager |
||||
|
||||
import argparse |
||||
import time |
||||
|
||||
import cereal.messaging as messaging |
||||
from selfdrive.controls.lib.alerts import ALERTS |
||||
|
||||
def now_millis(): return time.time() * 1000 |
||||
|
||||
default_alerts = sorted(ALERTS, key=lambda alert: (alert.alert_size, len(alert.alert_text_2))) |
||||
|
||||
def cycle_alerts(duration_millis, alerts=None): |
||||
if alerts is None: |
||||
alerts = default_alerts |
||||
|
||||
controls_state = messaging.pub_sock('controlsState') |
||||
|
||||
last_pop_millis = now_millis() |
||||
alert = alerts.pop() |
||||
while 1: |
||||
if (now_millis() - last_pop_millis) > duration_millis: |
||||
alerts.insert(0, alert) |
||||
alert = alerts.pop() |
||||
last_pop_millis = now_millis() |
||||
print('sending {}'.format(str(alert))) |
||||
|
||||
dat = messaging.new_message('controlsState') |
||||
|
||||
dat.controlsState.alertType = alert.alert_type |
||||
dat.controlsState.alertText1 = alert.alert_text_1 |
||||
dat.controlsState.alertText2 = alert.alert_text_2 |
||||
dat.controlsState.alertSize = alert.alert_size |
||||
dat.controlsState.alertStatus = alert.alert_status |
||||
dat.controlsState.alertSound = alert.audible_alert |
||||
controls_state.send(dat.to_bytes()) |
||||
|
||||
time.sleep(0.01) |
||||
|
||||
if __name__ == '__main__': |
||||
parser = argparse.ArgumentParser() |
||||
parser.add_argument('--duration', type=int, default=1000) |
||||
parser.add_argument('--alert-types', nargs='+') |
||||
args = parser.parse_args() |
||||
alerts = None |
||||
if args.alert_types: |
||||
alerts = [next(a for a in ALERTS if a.alert_type==alert_type) for alert_type in args.alert_types] |
||||
|
||||
cycle_alerts(args.duration, alerts=alerts) |
Loading…
Reference in new issue