From 367155168a0c9fb698c8248a5c28c66c2987ae65 Mon Sep 17 00:00:00 2001 From: Adeeb <8762862+adeebshihadeh@users.noreply.github.com> Date: Wed, 3 Jun 2020 16:13:34 -0700 Subject: [PATCH] Update Flake8 config (#1624) * update flake8 checks * add E502 * no whitespace warnings * fix violations * no W391 Co-authored-by: Jason Young --- .pre-commit-config.yaml | 5 +++-- selfdrive/athena/test_helpers.py | 2 +- selfdrive/car/chrysler/values.py | 2 ++ selfdrive/car/ford/values.py | 2 ++ selfdrive/car/gm/values.py | 2 ++ selfdrive/car/honda/carstate.py | 6 ++++-- selfdrive/car/honda/values.py | 2 ++ selfdrive/car/hyundai/carstate.py | 3 ++- selfdrive/car/hyundai/values.py | 2 ++ selfdrive/car/isotp_parallel_query.py | 3 ++- selfdrive/car/mazda/values.py | 2 ++ selfdrive/car/nissan/values.py | 2 ++ selfdrive/car/subaru/values.py | 2 ++ selfdrive/car/toyota/values.py | 2 ++ selfdrive/car/volkswagen/values.py | 2 ++ selfdrive/controls/tests/test_monitoring.py | 2 ++ selfdrive/debug/compare_fingerprints.py | 1 + selfdrive/locationd/locationd.py | 3 ++- selfdrive/locationd/models/gnss_kf.py | 3 ++- selfdrive/modeld/test/polyfit/test.py | 2 ++ selfdrive/test/longitudinal_maneuvers/plant.py | 3 ++- selfdrive/test/openpilotci_upload.py | 4 +++- selfdrive/test/test_car_models.py | 3 ++- selfdrive/thermald/thermald.py | 3 ++- selfdrive/updated.py | 3 ++- selfdrive/version.py | 3 ++- tools/lib/auth_config.py | 2 +- tools/lib/logreader.py | 3 ++- tools/replay/ui.py | 3 ++- tools/replay/unlog_segment.py | 2 +- 30 files changed, 60 insertions(+), 19 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 01b88ce1d..840b263ee 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,9 +20,10 @@ repos: rev: master hooks: - id: flake8 - exclude: '^(pyextra)|(external)|(cereal)|(rednose)|(panda)|(laika)|(opendbc)|(laika_repo)|(rednose_repo)/' + exclude: '^(pyextra)|(external)|(cereal)|(rednose)|(panda)|(laika)|(opendbc)|(laika_repo)|(rednose_repo)|(selfdrive/debug)/' args: - - --ignore=E111,E114,E121,E122,E123,E124,E126,E127,E128,E201,E202,E203,E226,E241,E265,E266,E302,E305,E402,E501,E722,E741,W504,W391 + - --select=E112,E113,E304,E501,E502,E701,E702,E703,E71,E72,E731,W191,W6 + - --max-line-length=240 - --statistics - repo: local hooks: diff --git a/selfdrive/athena/test_helpers.py b/selfdrive/athena/test_helpers.py index 2919de663..77a94c078 100644 --- a/selfdrive/athena/test_helpers.py +++ b/selfdrive/athena/test_helpers.py @@ -46,7 +46,7 @@ class MockParams(): def __init__(self): self.params = { "DongleId": b"0000000000000000", - "GithubSshKeys": b"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC307aE+nuHzTAgaJhzSf5v7ZZQW9gaperjhCmyPyl4PzY7T1mDGenTlVTN7yoVFZ9UfO9oMQqo0n1OwDIiqbIFxqnhrHU0cYfj88rI85m5BEKlNu5RdaVTj1tcbaPpQc5kZEolaI1nDDjzV0lwS7jo5VYDHseiJHlik3HH1SgtdtsuamGR2T80q1SyW+5rHoMOJG73IH2553NnWuikKiuikGHUYBd00K1ilVAK2xSiMWJp55tQfZ0ecr9QjEsJ+J/efL4HqGNXhffxvypCXvbUYAFSddOwXUPo5BTKevpxMtH+2YrkpSjocWA04VnTYFiPG6U4ItKmbLOTFZtPzoez private" + "GithubSshKeys": b"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC307aE+nuHzTAgaJhzSf5v7ZZQW9gaperjhCmyPyl4PzY7T1mDGenTlVTN7yoVFZ9UfO9oMQqo0n1OwDIiqbIFxqnhrHU0cYfj88rI85m5BEKlNu5RdaVTj1tcbaPpQc5kZEolaI1nDDjzV0lwS7jo5VYDHseiJHlik3HH1SgtdtsuamGR2T80q1SyW+5rHoMOJG73IH2553NnWuikKiuikGHUYBd00K1ilVAK2xSiMWJp55tQfZ0ecr9QjEsJ+J/efL4HqGNXhffxvypCXvbUYAFSddOwXUPo5BTKevpxMtH+2YrkpSjocWA04VnTYFiPG6U4ItKmbLOTFZtPzoez private" # noqa: E501 } def get(self, k, encoding=None): diff --git a/selfdrive/car/chrysler/values.py b/selfdrive/car/chrysler/values.py index 9af22c07a..5c91445da 100644 --- a/selfdrive/car/chrysler/values.py +++ b/selfdrive/car/chrysler/values.py @@ -1,3 +1,5 @@ +# flake8: noqa + from selfdrive.car import dbc_dict from cereal import car Ecu = car.CarParams.Ecu diff --git a/selfdrive/car/ford/values.py b/selfdrive/car/ford/values.py index 191f06cbc..7c4d0aed9 100644 --- a/selfdrive/car/ford/values.py +++ b/selfdrive/car/ford/values.py @@ -1,3 +1,5 @@ +# flake8: noqa + from selfdrive.car import dbc_dict from cereal import car Ecu = car.CarParams.Ecu diff --git a/selfdrive/car/gm/values.py b/selfdrive/car/gm/values.py index c2bc7e01e..cb77b0970 100644 --- a/selfdrive/car/gm/values.py +++ b/selfdrive/car/gm/values.py @@ -1,3 +1,5 @@ +# flake8: noqa + from cereal import car from selfdrive.car import dbc_dict Ecu = car.CarParams.Ecu diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 8635831db..c8360d756 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -184,7 +184,8 @@ class CarState(CarStateBase): self.prev_cruise_setting = self.cruise_setting # ******************* parse out can ******************* - if self.CP.carFingerprint in (CAR.ACCORD, CAR.ACCORD_15, CAR.ACCORDH, CAR.CIVIC_BOSCH, CAR.CIVIC_BOSCH_DIESEL, CAR.CRV_HYBRID, CAR.INSIGHT): # TODO: find wheels moving bit in dbc + # TODO: find wheels moving bit in dbc + if self.CP.carFingerprint in (CAR.ACCORD, CAR.ACCORD_15, CAR.ACCORDH, CAR.CIVIC_BOSCH, CAR.CIVIC_BOSCH_DIESEL, CAR.CRV_HYBRID, CAR.INSIGHT): ret.standstill = cp.vl["ENGINE_DATA"]['XMISSION_SPEED'] < 0.1 ret.doorOpen = bool(cp.vl["SCM_FEEDBACK"]['DRIVERS_DOOR_OPEN']) elif self.CP.carFingerprint == CAR.ODYSSEY_CHN: @@ -233,7 +234,8 @@ class CarState(CarStateBase): ret.rightBlinker = cp.vl["SCM_FEEDBACK"]['RIGHT_BLINKER'] != 0 self.brake_hold = cp.vl["VSA_STATUS"]['BRAKE_HOLD_ACTIVE'] - if self.CP.carFingerprint in (CAR.CIVIC, CAR.ODYSSEY, CAR.CRV_5G, CAR.ACCORD, CAR.ACCORD_15, CAR.ACCORDH, CAR.CIVIC_BOSCH, CAR.CIVIC_BOSCH_DIESEL, CAR.CRV_HYBRID, CAR.INSIGHT): + if self.CP.carFingerprint in (CAR.CIVIC, CAR.ODYSSEY, CAR.CRV_5G, CAR.ACCORD, CAR.ACCORD_15, CAR.ACCORDH, CAR.CIVIC_BOSCH, + CAR.CIVIC_BOSCH_DIESEL, CAR.CRV_HYBRID, CAR.INSIGHT): self.park_brake = cp.vl["EPB_STATUS"]['EPB_STATE'] != 0 main_on = cp.vl["SCM_FEEDBACK"]['MAIN_ON'] elif self.CP.carFingerprint == CAR.ODYSSEY_CHN: diff --git a/selfdrive/car/honda/values.py b/selfdrive/car/honda/values.py index 1901eaf57..2deed083a 100644 --- a/selfdrive/car/honda/values.py +++ b/selfdrive/car/honda/values.py @@ -1,3 +1,5 @@ +# flake8: noqa + from cereal import car from selfdrive.car import dbc_dict diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index 57435eadb..f252ce791 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -59,7 +59,8 @@ class CarState(CarStateBase): ret.gasPressed = bool(cp.vl["EMS16"]["CF_Ems_AclAct"]) # TODO: refactor gear parsing in function - # Gear Selection via Cluster - For those Kia/Hyundai which are not fully discovered, we can use the Cluster Indicator for Gear Selection, as this seems to be standard over all cars, but is not the preferred method. + # Gear Selection via Cluster - For those Kia/Hyundai which are not fully discovered, we can use the Cluster Indicator for Gear Selection, + # as this seems to be standard over all cars, but is not the preferred method. if self.CP.carFingerprint in FEATURES["use_cluster_gears"]: if cp.vl["CLU15"]["CF_Clu_InhibitD"] == 1: ret.gearShifter = GearShifter.drive diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index 777ddb39d..64b776685 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -1,3 +1,5 @@ +# flake8: noqa + from cereal import car from selfdrive.car import dbc_dict Ecu = car.CarParams.Ecu diff --git a/selfdrive/car/isotp_parallel_query.py b/selfdrive/car/isotp_parallel_query.py index cda36d50f..c5185dec5 100644 --- a/selfdrive/car/isotp_parallel_query.py +++ b/selfdrive/car/isotp_parallel_query.py @@ -82,7 +82,8 @@ class IsoTpParallelQuery(): id_addr = rx_addr or tx_addr[0] sub_addr = tx_addr[1] - can_client = CanClient(self._can_tx, partial(self._can_rx, id_addr, sub_addr=sub_addr), tx_addr[0], rx_addr, self.bus, sub_addr=sub_addr, debug=self.debug) + can_client = CanClient(self._can_tx, partial(self._can_rx, id_addr, sub_addr=sub_addr), tx_addr[0], rx_addr, + self.bus, sub_addr=sub_addr, debug=self.debug) max_len = 8 if sub_addr is None else 7 diff --git a/selfdrive/car/mazda/values.py b/selfdrive/car/mazda/values.py index 491fa72c8..c6268e95a 100644 --- a/selfdrive/car/mazda/values.py +++ b/selfdrive/car/mazda/values.py @@ -1,3 +1,5 @@ +# flake8: noqa + from selfdrive.car import dbc_dict from cereal import car Ecu = car.CarParams.Ecu diff --git a/selfdrive/car/nissan/values.py b/selfdrive/car/nissan/values.py index ccd88954c..0630a8cb9 100644 --- a/selfdrive/car/nissan/values.py +++ b/selfdrive/car/nissan/values.py @@ -1,3 +1,5 @@ +# flake8: noqa + from selfdrive.car import dbc_dict STEER_THRESHOLD = 1.0 diff --git a/selfdrive/car/subaru/values.py b/selfdrive/car/subaru/values.py index b75fa9c38..8d50b36ab 100644 --- a/selfdrive/car/subaru/values.py +++ b/selfdrive/car/subaru/values.py @@ -1,3 +1,5 @@ +# flake8: noqa + from selfdrive.car import dbc_dict from cereal import car Ecu = car.CarParams.Ecu diff --git a/selfdrive/car/toyota/values.py b/selfdrive/car/toyota/values.py index 25366774a..641c00e20 100644 --- a/selfdrive/car/toyota/values.py +++ b/selfdrive/car/toyota/values.py @@ -1,3 +1,5 @@ +# flake8: noqa + from selfdrive.car import dbc_dict from cereal import car Ecu = car.CarParams.Ecu diff --git a/selfdrive/car/volkswagen/values.py b/selfdrive/car/volkswagen/values.py index 30c32b608..3937a7c15 100644 --- a/selfdrive/car/volkswagen/values.py +++ b/selfdrive/car/volkswagen/values.py @@ -1,3 +1,5 @@ +# flake8: noqa + from selfdrive.car import dbc_dict class CarControllerParams: diff --git a/selfdrive/controls/tests/test_monitoring.py b/selfdrive/controls/tests/test_monitoring.py index 0753300bf..b653555f6 100644 --- a/selfdrive/controls/tests/test_monitoring.py +++ b/selfdrive/controls/tests/test_monitoring.py @@ -1,3 +1,5 @@ +# flake8: noqa + import unittest import numpy as np from cereal import car diff --git a/selfdrive/debug/compare_fingerprints.py b/selfdrive/debug/compare_fingerprints.py index a0c80a740..5b7ba58b1 100755 --- a/selfdrive/debug/compare_fingerprints.py +++ b/selfdrive/debug/compare_fingerprints.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +# flake8: noqa # put 2 fingeprints and print the diffs f1 = { diff --git a/selfdrive/locationd/locationd.py b/selfdrive/locationd/locationd.py index 959684e1b..3b78a0ca6 100755 --- a/selfdrive/locationd/locationd.py +++ b/selfdrive/locationd/locationd.py @@ -95,7 +95,8 @@ class Localizer(): device_from_ecef = rot_from_quat(predicted_state[States.ECEF_ORIENTATION]).T vel_device = device_from_ecef.dot(vel_ecef) device_from_ecef_eul = euler_from_quat(predicted_state[States.ECEF_ORIENTATION]).T - idxs = list(range(States.ECEF_ORIENTATION_ERR.start, States.ECEF_ORIENTATION_ERR.stop)) + list(range(States.ECEF_VELOCITY_ERR.start, States.ECEF_VELOCITY_ERR.stop)) + idxs = list(range(States.ECEF_ORIENTATION_ERR.start, States.ECEF_ORIENTATION_ERR.stop)) + \ + list(range(States.ECEF_VELOCITY_ERR.start, States.ECEF_VELOCITY_ERR.stop)) condensed_cov = predicted_cov[idxs][:, idxs] HH = H(*list(np.concatenate([device_from_ecef_eul, vel_ecef]))) vel_device_cov = HH.dot(condensed_cov).dot(HH.T) diff --git a/selfdrive/locationd/models/gnss_kf.py b/selfdrive/locationd/models/gnss_kf.py index db1a7e81a..3f4baab7b 100755 --- a/selfdrive/locationd/models/gnss_kf.py +++ b/selfdrive/locationd/models/gnss_kf.py @@ -119,7 +119,8 @@ class GNSSKalman(): self.dim_state = self.x_initial.shape[0] # init filter - self.filter = EKF_sym(generated_dir, self.name, self.Q, self.x_initial, self.P_initial, self.dim_state, self.dim_state, maha_test_kinds=self.maha_test_kinds) + self.filter = EKF_sym(generated_dir, self.name, self.Q, self.x_initial, self.P_initial, self.dim_state, + self.dim_state, maha_test_kinds=self.maha_test_kinds) self.init_state(GNSSKalman.x_initial, covs=GNSSKalman.P_initial) @property diff --git a/selfdrive/modeld/test/polyfit/test.py b/selfdrive/modeld/test/polyfit/test.py index 0caadf352..82776e81e 100644 --- a/selfdrive/modeld/test/polyfit/test.py +++ b/selfdrive/modeld/test/polyfit/test.py @@ -1,3 +1,5 @@ +# flake8: noqa + import numpy as np pts = np.array([3.1261718, 3.1642578, 3.0548828, 3.1125, 3.190625, 3.01875, 2.9816406, 3.1222656, 2.9728515, 2.9826171, 3.034375, 3.0392578, 3.1642578, 3.0792968, 3.0011718, 3.0705078, 2.9904296, 3.0089843, 3.0597656, 3.0978515, 2.9210937, 2.9992187, 2.9474609, 2.9621093, 2.9289062, 2.89375, 2.7975585, 2.9015625, 2.8175781, 2.9132812, 2.8175781, 2.7501953, 2.8332031, 2.8166015, 2.7638671, 2.8878906, 2.7599609, 2.6999023, 2.6720703, 2.6398437, 2.7243164, 2.6120117, 2.6588867, 2.5558593, 2.5978515, 2.5485351, 2.4269531, 2.5001953, 2.4855468, 2.4367187, 2.2973144, 2.2812011, 2.2890136, 2.39375, 2.2836425, 2.3815429, 2.2138183, 2.1964843, 2.1840332, 2.1759765, 2.0421875, 2.1034667, 2.0281494, 2.0880859, 1.9706542, 1.9276855, 1.8522155, 1.8991821, 1.7780273, 1.8180053, 1.8326843, 1.8270385, 1.7182128, 1.6439941, 1.5360839, 1.68385, 1.4584472, 1.5955322, 1.6002929, 1.4157226, 1.4704101, 1.2936523, 1.2990234, 1.4281738, 1.4357421, 1.409375, 1.2511718, 1.2194335, 1.1554687, 1.043164, 1.0954101, 1.0392578, 1.0895507, 1.0880859, 0.897168, 0.83369142, 0.86494142, 0.87763673, 0.85322267, 0.72968751, 0.57832032, 0.73066407, 0.78828126, 0.69160157, 0.64375, 0.5919922, 0.5529297, 0.52070314, 0.60957032, 0.51093751, 0.3576172, 0.49921876, 0.284375, 0.21992187, 0.25214845, 0.30683595, 0.30976564, 0.2716797, 0.22089843, 0.25507814, 0.084179685, 0.071484372, 0.1828125, 0.15644531, 0.13789062, 0.054882813, 0.021679688, -0.091601565, -0.0203125, -0.13359375, -0.037890624, -0.29765624, -0.15605469, -0.30351561, -0.055468749, -0.22148438, -0.246875, -0.31718749, -0.25468749, -0.35234374, -0.16484375, -0.56523436, -0.56523436, -0.39921874, -0.58671874, -0.45585936, -0.50859374, -0.44023436, -0.42656249, -0.56328124, -0.70195311, -0.403125, -0.76445311, -0.98710936, -0.7625, -0.75273436, -0.825, -0.996875, -0.86210936, -0.99492186, -0.85625, -0.88359374, -0.97148436, -1.0320313, -1.1609375, -1.1296875, -1.0203125, -1.0691407, -1.2371094, -1.1277344, -1.2214844, -1.1921875, -1.2996094, -1.2917969, -1.3699219, -1.434375, -1.3699219, -1.3601563, -1.5730469, -1.3152344, -1.4851563, -1.48125, -1.5925782, -1.746875, -1.5847657, -1.6003907, -1.5984375, -1.7703125, -1.8328125, -1.8152344, -1.9714844, -1.9421875]) diff --git a/selfdrive/test/longitudinal_maneuvers/plant.py b/selfdrive/test/longitudinal_maneuvers/plant.py index f8c265d07..3447f119f 100755 --- a/selfdrive/test/longitudinal_maneuvers/plant.py +++ b/selfdrive/test/longitudinal_maneuvers/plant.py @@ -239,7 +239,8 @@ class Plant(): # print at 5hz if (self.frame % (self.rate//5)) == 0: - print("%6.2f m %6.2f m/s %6.2f m/s2 %.2f ang gas: %.2f brake: %.2f steer: %5.2f lead_rel: %6.2f m %6.2f m/s" % (distance, speed, acceleration, self.angle_steer, gas, brake, steer_torque, d_rel, v_rel)) + print("%6.2f m %6.2f m/s %6.2f m/s2 %.2f ang gas: %.2f brake: %.2f steer: %5.2f lead_rel: %6.2f m %6.2f m/s" + % (distance, speed, acceleration, self.angle_steer, gas, brake, steer_torque, d_rel, v_rel)) # ******** publish the car ******** vls_tuple = namedtuple('vls', [ diff --git a/selfdrive/test/openpilotci_upload.py b/selfdrive/test/openpilotci_upload.py index 177f854bf..64391532f 100755 --- a/selfdrive/test/openpilotci_upload.py +++ b/selfdrive/test/openpilotci_upload.py @@ -8,7 +8,9 @@ def upload_file(path, name): from azure.storage.blob import BlockBlobService sas_token = os.getenv("TOKEN", None) if sas_token is None: - sas_token = subprocess.check_output("az storage container generate-sas --account-name commadataci --name openpilotci --https-only --permissions lrw --expiry $(date -u '+%Y-%m-%dT%H:%M:%SZ' -d '+1 hour') --auth-mode login --as-user --output tsv", shell=True).decode().strip("\n") + cmd = "az storage container generate-sas --account-name commadataci --name openpilotci --https-only --permissions \ + lrw --expiry $(date -u '+%Y-%m-%dT%H:%M:%SZ' -d '+1 hour') --auth-mode login --as-user --output tsv" + sas_token = subprocess.check_output(cmd, shell=True).decode().strip("\n") service = BlockBlobService(account_name="commadataci", sas_token=sas_token) service.create_blob_from_path("openpilotci", name, path) return "https://commadataci.blob.core.windows.net/openpilotci/" + name diff --git a/selfdrive/test/test_car_models.py b/selfdrive/test/test_car_models.py index eb01c41bc..5c8d90062 100755 --- a/selfdrive/test/test_car_models.py +++ b/selfdrive/test/test_car_models.py @@ -461,7 +461,8 @@ if __name__ == "__main__": # Start unlogger print("Start unlogger") unlogger_cmd = [os.path.join(BASEDIR, 'tools/replay/unlogger.py'), route, '/tmp'] - unlogger = subprocess.Popen(unlogger_cmd + ['--disable', 'frame,encodeIdx,plan,pathPlan,liveLongitudinalMpc,radarState,controlsState,liveTracks,liveMpc,sendcan,carState,carControl,carEvents,carParams', '--no-interactive'], preexec_fn=os.setsid) # pylint: disable=subprocess-popen-preexec-fn + disable_socks = 'frame,encodeIdx,plan,pathPlan,liveLongitudinalMpc,radarState,controlsState,liveTracks,liveMpc,sendcan,carState,carControl,carEvents,carParams' + unlogger = subprocess.Popen(unlogger_cmd + ['--disable', disable_socks, '--no-interactive'], preexec_fn=os.setsid) # pylint: disable=subprocess-popen-preexec-fn print("Check sockets") extra_socks = [] diff --git a/selfdrive/thermald/thermald.py b/selfdrive/thermald/thermald.py index 5d97141cb..4cbcc6fb4 100755 --- a/selfdrive/thermald/thermald.py +++ b/selfdrive/thermald/thermald.py @@ -17,7 +17,8 @@ from selfdrive.swaglog import cloudlog import cereal.messaging as messaging from selfdrive.loggerd.config import get_available_percent from selfdrive.pandad import get_expected_signature -from selfdrive.thermald.power_monitoring import PowerMonitoring, get_battery_capacity, get_battery_status, get_battery_current, get_battery_voltage, get_usb_present +from selfdrive.thermald.power_monitoring import PowerMonitoring, get_battery_capacity, get_battery_status, \ + get_battery_current, get_battery_voltage, get_usb_present FW_SIGNATURE = get_expected_signature() diff --git a/selfdrive/updated.py b/selfdrive/updated.py index 9775df027..47f2d55a5 100755 --- a/selfdrive/updated.py +++ b/selfdrive/updated.py @@ -280,7 +280,8 @@ def attempt_update(): upstream_hash = run(["git", "rev-parse", "@{u}"], OVERLAY_MERGED).rstrip() new_version = cur_hash != upstream_hash - git_fetch_result = len(git_fetch_output) > 0 and (git_fetch_output != "Failed to add the host to the list of known hosts (/data/data/com.termux/files/home/.ssh/known_hosts).\n") + err_msg = "Failed to add the host to the list of known hosts (/data/data/com.termux/files/home/.ssh/known_hosts).\n" + git_fetch_result = len(git_fetch_output) > 0 and (git_fetch_output != err_msg) cloudlog.info("comparing %s to %s" % (cur_hash, upstream_hash)) if new_version or git_fetch_result: diff --git a/selfdrive/version.py b/selfdrive/version.py index b45fe384b..13a16022a 100644 --- a/selfdrive/version.py +++ b/selfdrive/version.py @@ -67,7 +67,8 @@ try: dirty_files = subprocess.check_output(["git", "diff-index", branch, "--"], encoding='utf8') commit = subprocess.check_output(["git", "rev-parse", "--verify", "HEAD"], encoding='utf8').rstrip() origin_commit = subprocess.check_output(["git", "rev-parse", "--verify", branch], encoding='utf8').rstrip() - cloudlog.event("dirty comma branch", version=version, dirty=dirty, origin=origin, branch=branch, dirty_files=dirty_files, commit=commit, origin_commit=origin_commit) + cloudlog.event("dirty comma branch", version=version, dirty=dirty, origin=origin, branch=branch, + dirty_files=dirty_files, commit=commit, origin_commit=origin_commit) except subprocess.CalledProcessError: dirty = True diff --git a/tools/lib/auth_config.py b/tools/lib/auth_config.py index 68bd53599..1e604970a 100644 --- a/tools/lib/auth_config.py +++ b/tools/lib/auth_config.py @@ -13,7 +13,7 @@ def get_token(): with open(os.path.join(CONFIG_DIR, 'auth.json')) as f: auth = json.load(f) return auth['access_token'] - except: + except Exception: raise MissingAuthConfigError('Authenticate with tools/lib/auth.py') def set_token(token): diff --git a/tools/lib/logreader.py b/tools/lib/logreader.py index 3a25ef21b..4d08b8aae 100755 --- a/tools/lib/logreader.py +++ b/tools/lib/logreader.py @@ -73,7 +73,8 @@ class MultiLogIterator(object): self._idx += 1 else: self._idx = 0 - self._current_log = next(i for i in range(self._current_log + 1, len(self._log_readers) + 1) if i == len(self._log_readers) or self._log_paths[i] is not None) + self._current_log = next(i for i in range(self._current_log + 1, len(self._log_readers) + 1) + if i == len(self._log_readers) or self._log_paths[i] is not None) # wraparound if self._current_log == len(self._log_readers): if self._wraparound: diff --git a/tools/replay/ui.py b/tools/replay/ui.py index 438f86f91..f0058989a 100755 --- a/tools/replay/ui.py +++ b/tools/replay/ui.py @@ -66,7 +66,8 @@ def ui_thread(addr, frame_address): top_down_surface = pygame.surface.Surface((UP.lidar_x, UP.lidar_y), 0, 8) frame = messaging.sub_sock('frame', addr=addr, conflate=True) - sm = messaging.SubMaster(['carState', 'plan', 'carControl', 'radarState', 'liveCalibration', 'controlsState', 'liveTracks', 'model', 'liveMpc', 'liveParameters', 'pathPlan'], addr=addr) + sm = messaging.SubMaster(['carState', 'plan', 'carControl', 'radarState', 'liveCalibration', 'controlsState', + 'liveTracks', 'model', 'liveMpc', 'liveParameters', 'pathPlan'], addr=addr) calibration = None img = np.zeros((480, 640, 3), dtype='uint8') diff --git a/tools/replay/unlog_segment.py b/tools/replay/unlog_segment.py index 1c80cd047..94520b3ba 100755 --- a/tools/replay/unlog_segment.py +++ b/tools/replay/unlog_segment.py @@ -102,6 +102,6 @@ if __name__ == "__main__": try: replay(args.segment, args.loop) termios.tcsetattr(sys.stdin, termios.TCSADRAIN, orig_settings) - except: + except Exception: termios.tcsetattr(sys.stdin, termios.TCSADRAIN, orig_settings) raise