diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd89ec63c..99c68d939 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,13 @@ jobs: pip install ruff ruff check + typos: + name: Typos + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: crate-ci/typos@master + pylint: name: Pylint runs-on: ubuntu-latest diff --git a/contrib/fortran-to-opencl/translate.py b/contrib/fortran-to-opencl/translate.py index 1d144b01d..b023a4b20 100644 --- a/contrib/fortran-to-opencl/translate.py +++ b/contrib/fortran-to-opencl/translate.py @@ -624,7 +624,7 @@ def get_type(self, name): if self.implicit_types is None: raise TranslationError( - "no type for '%s' found in implict none routine" + "no type for '%s' found in implicit none routine" % name) return self.implicit_types.get(name[0], np.dtype(np.int32)) diff --git a/doc/subst.rst b/doc/subst.rst index b9603526f..782c7ea7f 100644 --- a/doc/subst.rst +++ b/doc/subst.rst @@ -8,7 +8,7 @@ (e.g. by being an :class:`numpy.ndarray`) .. |explain-waitfor| replace:: *wait_for* may either be *None* or a list of :class:`pyopencl.Event` instances for - whose completion this command waits before starting exeuction. + whose completion this command waits before starting execution. .. |std-enqueue-blurb| replace:: Returns a new :class:`pyopencl.Event`. |explain-waitfor| .. |copy-depr| replace:: **Note:** This function is deprecated as of PyOpenCL 2011.1. diff --git a/examples/n-body.py b/examples/n-body.py index f1969af70..b86832de9 100644 --- a/examples/n-body.py +++ b/examples/n-body.py @@ -317,7 +317,7 @@ def DictionariesAPI(): Heat=MWCfp; } -// More accurate distribution based on spherical coordonates +// More accurate distribution based on spherical coordinates // Disactivated because of AMD Oland GPU crash on launch // private MYFLOAT Radius,Theta,Phi,PosX,PosY,PosZ,SinTheta; // Radius=MWCfp*diameter/2.e0f; @@ -375,7 +375,7 @@ def DictionariesAPI(): } // cast to float for sin,cos are NEEDED by Mesa FP64 implementation! - // Implemention on AMD Oland are probably broken in float + // Implementation on AMD Oland are probably broken in float FromCoM=(MYFLOAT4)(clDataX[gid]-clCoM[0]); Length=length(FromCoM); @@ -387,7 +387,7 @@ def DictionariesAPI(): // Second tangential vector to sphere of length radius ThetaB=acos((float)(FromCoM.x/Length)); PhiB=atan((float)(FromCoM.y/FromCoM.z))+5.e-1f*PI; - // (x,y) random coordonates to plane tangential to sphere + // (x,y) random coordinates to plane tangential to sphere Polar=MWCfp*2.e0f*PI; tA=cos((float)Polar); tB=sin((float)Polar); @@ -781,7 +781,7 @@ class MyFloat(np.float32): Velocity = MyFloat(Velocity) Step = MyFloat(Step) - print("Device choosed : %s" % Device) + print("Device chosen : %s" % Device) print("Number of particules : %s" % Number) print("Size of Shape : %s" % SizeOfShape) print("Initial velocity : %s" % Velocity) diff --git a/pyproject.toml b/pyproject.toml index 37d35d153..34c15a934 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -205,3 +205,32 @@ skip = [ ] test-command = "" before-all = "bash {package}/scripts/build-ocl-windows.sh" + +[tool.typos.default] +extend-ignore-re = [ + "(?Rm)^.*(#|//)\\s*spellchecker:\\s*disable-line$" +] + +[tool.typos.default.extend-words] +# for ND Range +ND = "ND" +nd = "nd" + +# level-of-detail +LOD = "LOD" + +# short for 'series' + "ser" = "ser" + +# like the numpy function + "arange" = "arange" + +[tool.typos.files] +extend-exclude = [ +# No thanks, hex IDs in JSON should not be spellchecked. +"examples/*.ipynb", +# Copied from upstream +"pyopencl/cl/pyopencl-random123/*", +# This one has comments in French +"examples/black-hole-accretion.py" +] diff --git a/src/wrap_cl.hpp b/src/wrap_cl.hpp index 1423cd0ef..5b225d3cd 100644 --- a/src/wrap_cl.hpp +++ b/src/wrap_cl.hpp @@ -1893,7 +1893,7 @@ namespace pyopencl py::object m_py_event; py::object m_py_callback; - bool m_set_callback_suceeded; + bool m_set_callback_succeeded; bool m_notify_thread_wakeup_is_genuine; @@ -1901,7 +1901,7 @@ namespace pyopencl cl_int m_command_exec_status; event_callback_info_t(py::object py_event, py::object py_callback) - : m_py_event(py_event), m_py_callback(py_callback), m_set_callback_suceeded(true), + : m_py_event(py_event), m_py_callback(py_callback), m_set_callback_succeeded(true), m_notify_thread_wakeup_is_genuine(false) {} }; @@ -1945,7 +1945,7 @@ namespace pyopencl { py::gil_scoped_acquire acquire; - if (cb_info->m_set_callback_suceeded) + if (cb_info->m_set_callback_succeeded) { try { cb_info->m_py_callback( @@ -1982,7 +1982,7 @@ namespace pyopencl // be woken up. Wake it up to let it know that it can stop. { std::lock_guard lg(cb_info->m_mutex); - cb_info->m_set_callback_suceeded = false; + cb_info->m_set_callback_succeeded = false; cb_info->m_notify_thread_wakeup_is_genuine = true; } cb_info->m_condvar.notify_one(); @@ -3673,7 +3673,7 @@ namespace pyopencl #ifdef PYPY_VERSION // FIXME: get a read-only buffer // Not quite honest, but Pypy doesn't consider numpy arrays - // created from objects with the __aray_interface__ writeable. + // created from objects with the __array_interface__ writeable. ward->get(holder.ptr(), PyBUF_ANY_CONTIGUOUS); #else ward->get(holder.ptr(), PyBUF_ANY_CONTIGUOUS | PyBUF_WRITABLE); @@ -4508,7 +4508,7 @@ namespace pyopencl py::tuple name_hdr_tup = py::borrow(name_hdr_tup_py); if (py::len(name_hdr_tup) != 2) throw error("Program.compile", CL_INVALID_VALUE, - "epxected (name, header) tuple in headers list"); + "expected (name, header) tuple in headers list"); std::string name = py::cast(name_hdr_tup[0]); program &prg = py::cast(name_hdr_tup[1]); diff --git a/test/test_wrapper.py b/test/test_wrapper.py index 4704a37c6..c3329d8be 100644 --- a/test/test_wrapper.py +++ b/test/test_wrapper.py @@ -1402,7 +1402,7 @@ def test_empty_ndrange(ctx_factory, empty_shape): queue = cl.CommandQueue(ctx) if ctx._get_cl_version() < (1, 2) or cl.get_cl_header_version() < (1, 2): - pytest.skip("OpenCL 1.2 required for empty NDRange suuport") + pytest.skip("OpenCL 1.2 required for empty NDRange support") a = cl_array.zeros(queue, empty_shape, dtype=np.float32)