Skip to content

Commit 892d219

Browse files
MNT: fix pylint failures in flight animation methods
Reference vedo classes directly instead of capitalized local aliases (invalid-name), drop useless returns, and silence too-many-statements on the animate methods to match the file convention. Lint now scores 10/10 and ruff is clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent dee11d1 commit 892d219

1 file changed

Lines changed: 10 additions & 22 deletions

File tree

rocketpy/plots/flight_plots.py

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -225,16 +225,15 @@ def _create_animation_box(self, start, scale=1.0):
225225
center_z = max(center_z, 0.5 * min_box_dim)
226226

227227
vedo = import_optional_dependency("vedo")
228-
Box = vedo.Box
229228

230-
return Box(
229+
return vedo.Box(
231230
pos=[center_x, center_y, center_z],
232231
length=length,
233232
width=width,
234233
height=height,
235234
).wireframe()
236235

237-
def animate_trajectory(
236+
def animate_trajectory( # pylint: disable=too-many-statements
238237
self, file_name=None, start=0, stop=None, time_step=0.1, **kwargs
239238
):
240239
"""Animate 6-DOF trajectory and attitude using vedo.
@@ -259,25 +258,20 @@ def animate_trajectory(
259258

260259
vedo = import_optional_dependency("vedo")
261260

262-
Line = vedo.Line
263-
Mesh = vedo.Mesh
264-
Plotter = vedo.Plotter
265-
settings = vedo.settings
266-
267261
file_name = self._resolve_animation_model_path(file_name)
268262
stop = self._validate_animation_inputs(file_name, start, stop, time_step)
269263

270264
try:
271-
settings.allow_interaction = True
265+
vedo.settings.allow_interaction = True
272266
except AttributeError:
273267
pass
274268

275269
world = self._create_animation_box(start, scale=1.2)
276-
base_rocket = Mesh(file_name).c("green")
270+
base_rocket = vedo.Mesh(file_name).c("green")
277271
time_steps = np.arange(start, stop, time_step)
278272
trajectory_points = []
279273

280-
plt = Plotter(axes=1, interactive=False)
274+
plt = vedo.Plotter(axes=1, interactive=False)
281275
plt.show(world, "Rocket Trajectory Animation", viewup="z", **kwargs)
282276

283277
for t in time_steps:
@@ -300,7 +294,7 @@ def animate_trajectory(
300294
trajectory_points.append([x_position, y_position, z_position])
301295
actors = [world, rocket]
302296
if len(trajectory_points) > 1:
303-
actors.append(Line(trajectory_points, c="k", alpha=0.5))
297+
actors.append(vedo.Line(trajectory_points, c="k", alpha=0.5))
304298

305299
plt.show(*actors, resetcam=False)
306300

@@ -312,9 +306,8 @@ def animate_trajectory(
312306
break
313307

314308
plt.interactive().close()
315-
return None
316309

317-
def animate_rotate(
310+
def animate_rotate( # pylint: disable=too-many-statements
318311
self, file_name=None, start=0, stop=None, time_step=0.1, **kwargs
319312
):
320313
"""Animate rocket attitude (rotation-only view) using vedo.
@@ -339,27 +332,23 @@ def animate_rotate(
339332

340333
vedo = import_optional_dependency("vedo")
341334

342-
Mesh = vedo.Mesh
343-
Plotter = vedo.Plotter
344-
settings = vedo.settings
345-
346335
file_name = self._resolve_animation_model_path(file_name)
347336
stop = self._validate_animation_inputs(file_name, start, stop, time_step)
348337

349338
try:
350-
settings.allow_interaction = True
339+
vedo.settings.allow_interaction = True
351340
except AttributeError:
352341
pass
353342

354343
world = self._create_animation_box(start, scale=0.3)
355-
base_rocket = Mesh(file_name).c("green")
344+
base_rocket = vedo.Mesh(file_name).c("green")
356345
time_steps = np.arange(start, stop, time_step)
357346

358347
x_start = self.flight.x(start)
359348
y_start = self.flight.y(start)
360349
z_start = self.flight.z(start) - self.flight.env.elevation
361350

362-
plt = Plotter(axes=1, interactive=False)
351+
plt = vedo.Plotter(axes=1, interactive=False)
363352
plt.show(world, "Rocket Rotation Animation", viewup="z", **kwargs)
364353

365354
for t in time_steps:
@@ -385,7 +374,6 @@ def animate_rotate(
385374
break
386375

387376
plt.interactive().close()
388-
return None
389377

390378
def linear_kinematics_data(self, *, filename=None): # pylint: disable=too-many-statements
391379
"""Prints out all Kinematics graphs available about the Flight

0 commit comments

Comments
 (0)