Skip to content

Commit 45cebc4

Browse files
committed
MNT: lint
1 parent f1d89b0 commit 45cebc4

9 files changed

Lines changed: 15 additions & 26 deletions

File tree

.pylintrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,11 @@ good-names=FlightPhases,
229229
center_of_mass_without_motor_to_CDM,
230230
motor_center_of_dry_mass_to_CDM,
231231
generic_motor_cesaroni_M1520,
232+
R_phi,
233+
R_delta,
234+
R_pi,
235+
R_uncanted,
236+
R_body_to_fin,
232237

233238
# Good variable names regexes, separated by a comma. If names match any regex,
234239
# they will always be accepted

rocketpy/plots/aero_surface_plots.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# pylint: disable=too-many-statements
2+
13
from abc import ABC, abstractmethod
24

35
import matplotlib.pyplot as plt
@@ -139,10 +141,6 @@ class _FinsPlots(_AeroSurfacePlots):
139141
"""Abstract class that contains all fin plots. This class inherits from the
140142
_AeroSurfacePlots class."""
141143

142-
@abstractmethod
143-
def draw(self, *, filename=None):
144-
pass
145-
146144
def airfoil(self):
147145
"""Plots the airfoil information when the fin has an airfoil shape. If
148146
the fin does not have an airfoil shape, this method does nothing.
@@ -200,10 +198,6 @@ class _FinPlots(_AeroSurfacePlots):
200198
"""Abstract class that contains all fin plots. This class inherits from the
201199
_AeroSurfacePlots class."""
202200

203-
@abstractmethod
204-
def draw(self):
205-
pass
206-
207201
def airfoil(self):
208202
"""Plots the airfoil information when the fin has an airfoil shape. If
209203
the fin does not have an airfoil shape, this method does nothing.
@@ -259,7 +253,6 @@ def all(self):
259253
class _TrapezoidalFinsPlots(_FinsPlots):
260254
"""Class that contains all trapezoidal fin plots."""
261255

262-
# pylint: disable=too-many-statements
263256
def draw(self, *, filename=None):
264257
"""Draw the fin shape along with some important information, including
265258
the center line, the quarter line and the center of pressure position.
@@ -388,8 +381,7 @@ def draw(self, *, filename=None):
388381
class _TrapezoidalFinPlots(_FinPlots):
389382
"""Class that contains all trapezoidal fin plots."""
390383

391-
# pylint: disable=too-many-statements
392-
def draw(self):
384+
def draw(self, *, filename=None):
393385
"""Draw the fin shape along with some important information, including
394386
the center line, the quarter line and the center of pressure position.
395387
@@ -509,7 +501,6 @@ def draw(self):
509501
class _EllipticalFinsPlots(_FinsPlots):
510502
"""Class that contains all elliptical fin plots."""
511503

512-
# pylint: disable=too-many-statements
513504
def draw(self, *, filename=None):
514505
"""Draw the fin shape along with some important information.
515506
These being: the center line and the center of pressure position.
@@ -588,8 +579,7 @@ def draw(self, *, filename=None):
588579
class _EllipticalFinPlots(_FinPlots):
589580
"""Class that contains all elliptical fin plots."""
590581

591-
# pylint: disable=too-many-statements
592-
def draw(self):
582+
def draw(self, *, filename=None):
593583
"""Draw the fin shape along with some important information.
594584
These being: the center line and the center of pressure position.
595585
@@ -659,7 +649,6 @@ def draw(self):
659649
class _FreeFormFinsPlots(_FinsPlots):
660650
"""Class that contains all free form fin plots."""
661651

662-
# pylint: disable=too-many-statements
663652
def draw(self, *, filename=None):
664653
"""Draw the fin shape along with some important information.
665654
These being: the center line and the center of pressure position.
@@ -734,7 +723,6 @@ def draw(self, *, filename=None):
734723
class _FreeFormFinPlots(_FinPlots):
735724
"""Class that contains all free form fin plots."""
736725

737-
# pylint: disable=too-many-statements
738726
def draw(self, *, filename=None):
739727
"""Draw the fin shape along with some important information.
740728
These being: the center line and the center of pressure position.

rocketpy/plots/rocket_plots.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def __validate_aerodynamic_surfaces(self, plane):
221221
raise ValueError(
222222
"The rocket must have at least one aerodynamic surface to be drawn."
223223
)
224-
if plane != "xz" and plane != "yz":
224+
if plane not in ("xz", "yz"):
225225
raise ValueError("The plane must be 'xz' or 'yz'. The default is 'xz'.")
226226

227227
def _draw_aerodynamic_surfaces(self, ax, vis_args, plane, surfaces):
@@ -410,6 +410,8 @@ def _draw_generic_surface(
410410
x_pos = position[2]
411411
# y position of the surface is the y position in the plot
412412
y_pos = position[1]
413+
else:
414+
raise ValueError("Plane must be 'xz' or 'yz'.")
413415

414416
ax.scatter(
415417
x_pos,

rocketpy/rocket/aero_surface/fins/_base_fin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import math
2-
from abc import ABC, abstractmethod
2+
from abc import abstractmethod
33

44
import numpy as np
55

rocketpy/rocket/aero_surface/fins/elliptical_fins.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import numpy as np
2-
31
from rocketpy.plots.aero_surface_plots import _EllipticalFinsPlots
42
from rocketpy.prints.aero_surface_prints import _EllipticalFinsPrints
53
from rocketpy.rocket.aero_surface.fins._elliptical_mixin import _EllipticalMixin

rocketpy/rocket/aero_surface/fins/fin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ def compute_forces_and_moments(
381381
M3 += M3_damping
382382
return R1, R2, R3, M1, M2, M3
383383

384-
def __compute_leading_edge_position(self, position, _csys):
384+
def _compute_leading_edge_position(self, position, _csys):
385385
"""Computes the position of the fin leading edge in a rocket's user,
386386
given its position in a rocket."""
387387
# Point from deflection from cant angle in the plane perpendicular to

rocketpy/rocket/aero_surface/fins/fins.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
from rocketpy.mathutils.function import Function
44
from rocketpy.rocket.aero_surface.fins._base_fin import _BaseFin
55

6-
from ..aero_surface import AeroSurface
7-
86

97
class Fins(_BaseFin):
108
"""Abstract class that holds common methods for the fin classes.

rocketpy/rocket/aero_surface/fins/trapezoidal_fins.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import numpy as np
2-
31
from rocketpy.plots.aero_surface_plots import _TrapezoidalFinsPlots
42
from rocketpy.prints.aero_surface_prints import _TrapezoidalFinsPrints
53
from rocketpy.rocket.aero_surface.fins._trapezoidal_mixin import _TrapezoidalMixin

rocketpy/rocket/rocket.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ def __add_single_surface(self, surface, position):
10081008
if isinstance(surface, (TrapezoidalFin, EllipticalFin, FreeFormFin)):
10091009
# TODO: this depends on cant angle, so it should somehow be
10101010
# recalculated whenever the cant angle of the fin changes
1011-
position = surface._Fin__compute_leading_edge_position(position, self._csys)
1011+
position = surface._compute_leading_edge_position(position, self._csys)
10121012
else:
10131013
position = (
10141014
Vector([0, 0, position])

0 commit comments

Comments
 (0)