Params: python-like interface (#20506)

* rebase master

* delete outdated test_params.c

* putBool & more robust getBool

* putBool(SshEnabled)
old-commit-hash: 98e55996f67aaaf715c941d417ae4d3b0187f388
This commit is contained in:
Dean Lee
2021-03-30 18:54:59 +08:00
committed by GitHub
parent 60b3018b96
commit 405df8b165
22 changed files with 111 additions and 252 deletions

View File

@@ -12,5 +12,5 @@ cdef extern from "selfdrive/common/params.h":
Params(bool)
Params(string)
string get(string, bool) nogil
int delete_db_value(string)
int write_db_value(string, string)
int remove(string)
int put(string, string)

View File

@@ -157,11 +157,11 @@ cdef class Params:
if key not in keys:
raise UnknownKeyName(key)
self.p.write_db_value(key, dat)
self.p.put(key, dat)
def delete(self, key):
key = ensure_bytes(key)
self.p.delete_db_value(key)
self.p.remove(key)
def put_nonblocking(key, val, d=None):