From 61bd086959c248e41d6b2c49d6e0eab36658a2e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Tue, 25 Apr 2023 08:43:57 +0200 Subject: [PATCH] partial cython-lint in plot folder --- src/sage/plot/complex_plot.pyx | 1 - src/sage/plot/plot3d/base.pyx | 1 - src/sage/plot/plot3d/implicit_surface.pyx | 2 -- src/sage/plot/plot3d/index_face_set.pyx | 10 +--------- src/sage/plot/plot3d/parametric_surface.pxd | 1 - src/sage/plot/plot3d/point_c.pxi | 1 - src/sage/plot/plot3d/shapes.pyx | 10 +++++----- 7 files changed, 6 insertions(+), 20 deletions(-) diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx index 0586a96ae55..efb923a2df7 100644 --- a/src/sage/plot/complex_plot.pyx +++ b/src/sage/plot/complex_plot.pyx @@ -578,7 +578,6 @@ def complex_to_cmap_rgb(z_values, cmap='turbo', contoured=False, tiled=False, cdef unsigned int i, j, imax, jmax cdef double x, y, mag, arg cdef double lightness_delta - cdef double r, g, b cdef ComplexDoubleElement z from sage.rings.complex_double import CDF diff --git a/src/sage/plot/plot3d/base.pyx b/src/sage/plot/plot3d/base.pyx index 77dabadc78e..84acb7f6c89 100644 --- a/src/sage/plot/plot3d/base.pyx +++ b/src/sage/plot/plot3d/base.pyx @@ -50,7 +50,6 @@ AUTHORS: # **************************************************************************** from cpython.list cimport * -from cpython.object cimport PyObject import os import sys diff --git a/src/sage/plot/plot3d/implicit_surface.pyx b/src/sage/plot/plot3d/implicit_surface.pyx index 1726f8f95a5..8a0f2c4aacb 100644 --- a/src/sage/plot/plot3d/implicit_surface.pyx +++ b/src/sage/plot/plot3d/implicit_surface.pyx @@ -81,8 +81,6 @@ cimport numpy as np import numpy as np from sage.plot.plot3d.transform cimport point_c, face_c, color_c, Transformation -from sage.plot.plot3d.base cimport PrimitiveObject -from sage.plot.plot3d.base import RenderParams, default_texture from sage.plot.plot3d.index_face_set cimport IndexFaceSet from sage.rings.real_double import RDF from sage.plot.misc import setup_for_eval_on_grid diff --git a/src/sage/plot/plot3d/index_face_set.pyx b/src/sage/plot/plot3d/index_face_set.pyx index f594652be28..56aa23277b2 100644 --- a/src/sage/plot/plot3d/index_face_set.pyx +++ b/src/sage/plot/plot3d/index_face_set.pyx @@ -32,9 +32,8 @@ AUTHORS: # **************************************************************************** from textwrap import dedent -from sage.misc.superseded import deprecation_cython as deprecation -from libc.math cimport isfinite, INFINITY +from libc.math cimport INFINITY from libc.string cimport memset, memcpy from cysignals.memory cimport check_calloc, check_allocarray, check_reallocarray, sig_free from cysignals.signals cimport sig_check, sig_on, sig_off @@ -53,15 +52,10 @@ from cpython.bytes cimport * include "point_c.pxi" - -from math import sin, cos, sqrt -from random import randint - from sage.cpython.string cimport bytes_to_str from sage.rings.real_double import RDF -from sage.matrix.constructor import matrix from sage.modules.free_module_element import vector from sage.plot.colors import Color, float_to_integer @@ -1637,9 +1631,7 @@ cdef class IndexFaceSet(PrimitiveObject): sage: T = S.dual() sage: len(T.vertex_list()) 6 - """ - cdef point_c P cdef face_c *face cdef Py_ssize_t i, j, ix, ff cdef IndexFaceSet dual = IndexFaceSet([], **kwds) diff --git a/src/sage/plot/plot3d/parametric_surface.pxd b/src/sage/plot/plot3d/parametric_surface.pxd index 9f5affa0cae..47265921622 100644 --- a/src/sage/plot/plot3d/parametric_surface.pxd +++ b/src/sage/plot/plot3d/parametric_surface.pxd @@ -8,4 +8,3 @@ cdef class ParametricSurface(IndexFaceSet): cdef object colormap cdef int eval_grid(self, urange, vrange) except -1 cdef int eval_c(self, point_c *res, double u, double v) except -1 - diff --git a/src/sage/plot/plot3d/point_c.pxi b/src/sage/plot/plot3d/point_c.pxi index c2763154fc8..aa6699d368e 100644 --- a/src/sage/plot/plot3d/point_c.pxi +++ b/src/sage/plot/plot3d/point_c.pxi @@ -145,4 +145,3 @@ cdef inline double sin_face_angle(face_c F, face_c E, point_c* vlist): face_c_normal(&nE, E, vlist) cdef double dot = point_c_dot(nF, nE) return math.sqrt(1-(dot*dot)/(point_c_dot(nF, nF)*point_c_dot(nE, nE))) - diff --git a/src/sage/plot/plot3d/shapes.pyx b/src/sage/plot/plot3d/shapes.pyx index 340f034c235..ef322d38260 100644 --- a/src/sage/plot/plot3d/shapes.pyx +++ b/src/sage/plot/plot3d/shapes.pyx @@ -50,11 +50,11 @@ EXAMPLES:: # https://www.gnu.org/licenses/ # **************************************************************************** -from libc.math cimport sqrt, sin, cos, tan, asin, acos, atan, M_PI +from libc.math cimport sqrt, sin, cos, acos, M_PI from sage.rings.real_double import RDF from sage.modules.free_module_element import vector from sage.misc.decorators import rename_keyword -from .base import Graphics3dGroup, Graphics3d +from .base import Graphics3dGroup from .index_face_set cimport IndexFaceSet, PrimitiveObject from .transform cimport point_c @@ -948,7 +948,7 @@ cdef class Sphere(ParametricSurface): ([-10.0, ..., 10.0], [0.0, ..., 3.141592653589793, ..., 0.0]) """ - cdef int K, u_res, v_res + cdef int u_res, v_res u_res = min(max(int(M_PI*self.radius/ds), 6), 20) v_res = min(max(int(2*M_PI * self.radius/ds), 6), 36) urange = [-10.0] + [M_PI * k/u_res - M_PI/2 for k in range(1, u_res)] + [10.0] @@ -961,8 +961,8 @@ cdef class Sphere(ParametricSurface): elif u == 10: res.x, res.y, res.z = 0, 0, self.radius else: - res.x = self.radius*cos(v) * cos(u) - res.y = self.radius*sin(v) * cos(u) + res.x = self.radius * cos(v) * cos(u) + res.y = self.radius * sin(v) * cos(u) res.z = self.radius * sin(u)