From 92682cb8e0396373c2ee82add96f70eb7d80964b Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Fri, 29 Oct 2021 01:10:55 +0800 Subject: [PATCH] params: remove params_pxd.pxd (#22723) --- common/params_pxd.pxd | 28 ---------------------------- common/params_pyx.pyx | 36 ++++++++++++++++++++---------------- release/files_common | 1 - 3 files changed, 20 insertions(+), 45 deletions(-) delete mode 100644 common/params_pxd.pxd diff --git a/common/params_pxd.pxd b/common/params_pxd.pxd deleted file mode 100644 index ecf520041..000000000 --- a/common/params_pxd.pxd +++ /dev/null @@ -1,28 +0,0 @@ -from libcpp.string cimport string -from libcpp cimport bool - -cdef extern from "selfdrive/common/params.cc": - pass - -cdef extern from "selfdrive/common/util.cc": - pass - -cdef extern from "selfdrive/common/params.h": - cpdef enum ParamKeyType: - PERSISTENT - CLEAR_ON_MANAGER_START - CLEAR_ON_PANDA_DISCONNECT - CLEAR_ON_IGNITION_ON - CLEAR_ON_IGNITION_OFF - ALL - - cdef cppclass Params: - Params() nogil - Params(string) nogil - string get(string, bool) nogil - bool getBool(string) nogil - int remove(string) nogil - int put(string, string) nogil - int putBool(string, bool) nogil - bool checkKey(string) nogil - void clearAll(ParamKeyType) diff --git a/common/params_pyx.pyx b/common/params_pyx.pyx index 198c69068..3204eacff 100755 --- a/common/params_pyx.pyx +++ b/common/params_pyx.pyx @@ -2,27 +2,31 @@ # cython: language_level = 3 from libcpp cimport bool from libcpp.string cimport string -from common.params_pxd cimport Params as c_Params, ParamKeyType as c_ParamKeyType - -import os import threading -from common.basedir import BASEDIR +cdef extern from "selfdrive/common/params.h": + cpdef enum ParamKeyType: + PERSISTENT + CLEAR_ON_MANAGER_START + CLEAR_ON_PANDA_DISCONNECT + CLEAR_ON_IGNITION_ON + CLEAR_ON_IGNITION_OFF + ALL + + cdef cppclass c_Params "Params": + c_Params() nogil + c_Params(string) nogil + string get(string, bool) nogil + bool getBool(string) nogil + int remove(string) nogil + int put(string, string) nogil + int putBool(string, bool) nogil + bool checkKey(string) nogil + void clearAll(ParamKeyType) -cdef class ParamKeyType: - PERSISTENT = c_ParamKeyType.PERSISTENT - CLEAR_ON_MANAGER_START = c_ParamKeyType.CLEAR_ON_MANAGER_START - CLEAR_ON_PANDA_DISCONNECT = c_ParamKeyType.CLEAR_ON_PANDA_DISCONNECT - CLEAR_ON_IGNITION_ON = c_ParamKeyType.CLEAR_ON_IGNITION_ON - CLEAR_ON_IGNITION_OFF = c_ParamKeyType.CLEAR_ON_IGNITION_OFF - ALL = c_ParamKeyType.ALL def ensure_bytes(v): - if isinstance(v, str): - return v.encode() - else: - return v - + return v.encode() if isinstance(v, str) else v; class UnknownKeyName(Exception): pass diff --git a/release/files_common b/release/files_common index 2214be309..ef7856e88 100644 --- a/release/files_common +++ b/release/files_common @@ -26,7 +26,6 @@ common/file_helpers.py common/logging_extra.py common/numpy_fast.py common/params.py -common/params_pxd.pxd common/params_pyx.pyx common/xattr.py common/profiler.py