add Cython static analysis (#31491)

* Adding pre-commit hook for cython static analysis

* Adding changes to cython files to pass static analysis

* Revert "Adding changes to cython files to pass static analysis"

This reverts commit 9a0eb733199abd9eef1eac3d024ef2760348d67c.

* Adding ignore rule for indentation of 4 spaces (E111)

* Fixes for cython-lint static analysis

* Revert "Fixes for cython-lint static analysis"

This reverts commit 972741735b2bdc73460d65a4d7ea167dfc0f4644.

* Adding two new rules into ignore list (2 new lines after difinition of class)

* Adding fixes for cython static analysis
old-commit-hash: 69fb3c2ed5b41858545461466004339325e413a1
This commit is contained in:
Milan Medić
2024-02-19 21:11:56 +01:00
committed by GitHub
parent 342a84c84b
commit 284450400e
6 changed files with 14 additions and 8 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
#cython: language_level=3
# cython: language_level=3
from libcpp cimport bool
cdef extern from "orientation.cc":
+3 -4
View File
@@ -17,7 +17,6 @@ from openpilot.common.transformations.transformations cimport ecef2geodetic as e
from openpilot.common.transformations.transformations cimport LocalCoord_c
import cython
import numpy as np
cimport numpy as np
@@ -34,14 +33,14 @@ cdef Matrix3 numpy2matrix(np.ndarray[double, ndim=2, mode="fortran"] m):
return Matrix3(<double*>m.data)
cdef ECEF list2ecef(ecef):
cdef ECEF e;
cdef ECEF e
e.x = ecef[0]
e.y = ecef[1]
e.z = ecef[2]
return e
cdef NED list2ned(ned):
cdef NED n;
cdef NED n
n.n = ned[0]
n.e = ned[1]
n.d = ned[2]
@@ -61,7 +60,7 @@ def euler2quat_single(euler):
def quat2euler_single(quat):
cdef Quaternion q = Quaternion(quat[0], quat[1], quat[2], quat[3])
cdef Vector3 e = quat2euler_c(q);
cdef Vector3 e = quat2euler_c(q)
return [e(0), e(1), e(2)]
def quat2rot_single(quat):