diff --git a/common/params_pyx.pyx b/common/params_pyx.pyx index 36c8cf777a..8d52b8d3f6 100755 --- a/common/params_pyx.pyx +++ b/common/params_pyx.pyx @@ -90,7 +90,7 @@ cdef class Params: with nogil: self.p.putBool(k, val) - def delete(self, key): + def remove(self, key): cdef string k = self.check_key(key) with nogil: self.p.remove(k) diff --git a/common/tests/test_params.py b/common/tests/test_params.py index f99ac81a33..899a47fe34 100644 --- a/common/tests/test_params.py +++ b/common/tests/test_params.py @@ -59,13 +59,13 @@ class TestParams(unittest.TestCase): with self.assertRaises(UnknownKeyName): self.params.put_bool("swag", True) - def test_delete_not_there(self): + def test_remove_not_there(self): assert self.params.get("CarParams") is None - self.params.delete("CarParams") + self.params.remove("CarParams") assert self.params.get("CarParams") is None def test_get_bool(self): - self.params.delete("IsMetric") + self.params.remove("IsMetric") self.assertFalse(self.params.get_bool("IsMetric")) self.params.put_bool("IsMetric", True) diff --git a/selfdrive/athena/athenad.py b/selfdrive/athena/athenad.py index 6ccd6c3de1..5b351ca0f5 100755 --- a/selfdrive/athena/athenad.py +++ b/selfdrive/athena/athenad.py @@ -739,14 +739,14 @@ def main(): break except (ConnectionError, TimeoutError, WebSocketException): conn_retries += 1 - params.delete("LastAthenaPingTime") + params.remove("LastAthenaPingTime") except socket.timeout: - params.delete("LastAthenaPingTime") + params.remove("LastAthenaPingTime") except Exception: cloudlog.exception("athenad.main.exception") conn_retries += 1 - params.delete("LastAthenaPingTime") + params.remove("LastAthenaPingTime") time.sleep(backoff(conn_retries)) diff --git a/selfdrive/athena/manage_athenad.py b/selfdrive/athena/manage_athenad.py index 6bbb03a799..59ca2430ce 100755 --- a/selfdrive/athena/manage_athenad.py +++ b/selfdrive/athena/manage_athenad.py @@ -27,7 +27,7 @@ def main(): except Exception: cloudlog.exception("manage_athenad.exception") finally: - params.delete(ATHENA_MGR_PID_PARAM) + params.remove(ATHENA_MGR_PID_PARAM) if __name__ == '__main__': diff --git a/selfdrive/boardd/pandad.py b/selfdrive/boardd/pandad.py index 54a28a6782..971756002b 100755 --- a/selfdrive/boardd/pandad.py +++ b/selfdrive/boardd/pandad.py @@ -83,7 +83,7 @@ def main() -> NoReturn: while True: try: - params.delete("PandaSignatures") + params.remove("PandaSignatures") # Flash all Pandas in DFU mode for p in PandaDFU.list(): diff --git a/selfdrive/controls/lib/alertmanager.py b/selfdrive/controls/lib/alertmanager.py index 2dad05e214..cb878483de 100644 --- a/selfdrive/controls/lib/alertmanager.py +++ b/selfdrive/controls/lib/alertmanager.py @@ -22,7 +22,7 @@ def set_offroad_alert(alert: str, show_alert: bool, extra_text: Optional[str] = a['text'] += extra_text Params().put(alert, json.dumps(a)) else: - Params().delete(alert) + Params().remove(alert) @dataclass diff --git a/selfdrive/locationd/test/test_laikad.py b/selfdrive/locationd/test/test_laikad.py index 418625f9bc..198ecfe935 100755 --- a/selfdrive/locationd/test/test_laikad.py +++ b/selfdrive/locationd/test/test_laikad.py @@ -65,7 +65,7 @@ class TestLaikad(unittest.TestCase): cls.first_gps_time = first_gps_time def setUp(self): - Params().delete(EPHEMERIS_CACHE) + Params().remove(EPHEMERIS_CACHE) def test_fetch_orbits_non_blocking(self): gpstime = GPSTime.from_datetime(datetime(2021, month=3, day=1)) @@ -226,7 +226,7 @@ class TestLaikad(unittest.TestCase): # Test cache with no ephemeris laikad.cache_ephemeris(t=GPSTime(0, 0)) wait_for_cache() - Params().delete(EPHEMERIS_CACHE) + Params().remove(EPHEMERIS_CACHE) laikad.astro_dog.get_navs(self.first_gps_time) laikad.fetch_orbits(self.first_gps_time, block=True) diff --git a/selfdrive/locationd/test/test_locationd.py b/selfdrive/locationd/test/test_locationd.py index 29036b8387..e30331a460 100755 --- a/selfdrive/locationd/test/test_locationd.py +++ b/selfdrive/locationd/test/test_locationd.py @@ -62,7 +62,7 @@ class TestLocationdProc(unittest.TestCase): def test_params_gps(self): # first reset params - Params().delete('LastGPSPosition') + Params().remove('LastGPSPosition') self.lat = 30 + (random.random() * 10.0) self.lon = -70 + (random.random() * 10.0) diff --git a/selfdrive/manager/manager.py b/selfdrive/manager/manager.py index 9c370cb3d8..a065242bbf 100755 --- a/selfdrive/manager/manager.py +++ b/selfdrive/manager/manager.py @@ -49,7 +49,7 @@ def manager_init() -> None: params.put_bool("RecordFront", True) if not params.get_bool("DisableRadar_Allow"): - params.delete("DisableRadar") + params.remove("DisableRadar") # set unset params for k, v in default_params: diff --git a/selfdrive/navd/navd.py b/selfdrive/navd/navd.py index 89a1c9bdfb..3c2a7f555d 100755 --- a/selfdrive/navd/navd.py +++ b/selfdrive/navd/navd.py @@ -236,7 +236,7 @@ class RouteEngine: self.recompute_countdown = 0 else: cloudlog.warning("Destination reached") - Params().delete("NavDestination") + Params().remove("NavDestination") # Clear route if driving away from destination dist = self.nav_destination.distance_to(self.last_position) diff --git a/selfdrive/test/process_replay/process_replay.py b/selfdrive/test/process_replay/process_replay.py index 8b9c77625f..b4e3f62656 100755 --- a/selfdrive/test/process_replay/process_replay.py +++ b/selfdrive/test/process_replay/process_replay.py @@ -418,7 +418,7 @@ def setup_env(simulation=False, CP=None, cfg=None, controlsState=None): if controlsState is not None: params.put("ReplayControlsState", controlsState.as_builder().to_bytes()) else: - params.delete("ReplayControlsState") + params.remove("ReplayControlsState") # Regen or python process if CP is not None: diff --git a/selfdrive/test/test_updated.py b/selfdrive/test/test_updated.py index 4c0ed2fddf..aab8b256ac 100755 --- a/selfdrive/test/test_updated.py +++ b/selfdrive/test/test_updated.py @@ -113,7 +113,7 @@ class TestUpdated(unittest.TestCase): def _wait_for_update(self, timeout=30, clear_param=False): if clear_param: - self.params.delete("LastUpdateTime") + self.params.remove("LastUpdateTime") self._update_now() t = self._read_param("LastUpdateTime", timeout=timeout) @@ -166,7 +166,7 @@ class TestUpdated(unittest.TestCase): last_update_time = datetime.datetime.fromisoformat(t) td = datetime.datetime.utcnow() - last_update_time self.assertLess(td.total_seconds(), 10) - self.params.delete("LastUpdateTime") + self.params.remove("LastUpdateTime") # wait a bit for the rest of the params to be written time.sleep(0.1) @@ -232,7 +232,7 @@ class TestUpdated(unittest.TestCase): # run for a cycle with no update self._wait_for_update(clear_param=True) - self.params.delete("LastUpdateTime") + self.params.remove("LastUpdateTime") first_mtime = os.path.getmtime(overlay_init_fn) # touch a file in the basedir diff --git a/selfdrive/thermald/tests/test_power_monitoring.py b/selfdrive/thermald/tests/test_power_monitoring.py index efe607155a..adcdaf427d 100755 --- a/selfdrive/thermald/tests/test_power_monitoring.py +++ b/selfdrive/thermald/tests/test_power_monitoring.py @@ -31,8 +31,8 @@ def pm_patch(name, value, constant=False): class TestPowerMonitoring(unittest.TestCase): def setUp(self): # Clear stored capacity before each test - params.delete("CarBatteryCapacity") - params.delete("DisablePowerDown") + params.remove("CarBatteryCapacity") + params.remove("DisablePowerDown") def mock_peripheralState(self, hw_type, car_voltage=12): ps = messaging.new_message('peripheralState').peripheralState diff --git a/selfdrive/updated.py b/selfdrive/updated.py index e8905962b2..7278ef5a80 100755 --- a/selfdrive/updated.py +++ b/selfdrive/updated.py @@ -116,7 +116,7 @@ def set_params(new_version: bool, failed_count: int, exception: Optional[str]) - pass if exception is None: - params.delete("LastUpdateException") + params.remove("LastUpdateException") else: params.put("LastUpdateException", exception) diff --git a/system/camerad/snapshot/snapshot.py b/system/camerad/snapshot/snapshot.py index 946c220a77..48dfc9e02d 100755 --- a/system/camerad/snapshot/snapshot.py +++ b/system/camerad/snapshot/snapshot.py @@ -91,7 +91,7 @@ def snapshot(): subprocess.check_call(["pgrep", "camerad"]) print("Camerad already running") params.put_bool("IsTakingSnapshot", False) - params.delete("Offroad_IsTakingSnapshot") + params.remove("Offroad_IsTakingSnapshot") return None, None except subprocess.CalledProcessError: pass diff --git a/tools/sim/bridge.py b/tools/sim/bridge.py index f008b9e716..71a92ac771 100755 --- a/tools/sim/bridge.py +++ b/tools/sim/bridge.py @@ -548,4 +548,4 @@ if __name__ == "__main__": finally: # Try cleaning up the wide camera param # in case users want to use replay after - Params().delete("WideCameraOnly") + Params().remove("WideCameraOnly")