Skip to content

Commit 2dae970

Browse files
MNT: fixes pylint code after Stano's review
1 parent 45be434 commit 2dae970

File tree

5 files changed

+17
-18
lines changed

5 files changed

+17
-18
lines changed

.pylintrc

+2
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ good-names=FlightPhases,
227227
M3_damping,
228228
CM_to_CDM,
229229
CM_to_CPM,
230+
center_of_mass_without_motor_to_CDM,
231+
motor_center_of_dry_mass_to_CDM,
230232

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

rocketpy/rocket/aero_surface.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ def lift_source(mach):
901901
# Lift coefficient derivative for n fins corrected with Fin-Body interference
902902
self.clalpha_multiple_fins = (
903903
self.lift_interference_factor
904-
* self.__fin_num_correction(self.n)
904+
* self.fin_num_correction(self.n)
905905
* self.clalpha_single_fin
906906
) # Function of mach number
907907
self.clalpha_multiple_fins.set_inputs("Mach")
@@ -957,7 +957,7 @@ def evaluate_roll_parameters(self):
957957
return self.roll_parameters
958958

959959
@staticmethod
960-
def __fin_num_correction(n):
960+
def fin_num_correction(n):
961961
"""Calculates a correction factor for the lift coefficient of multiple
962962
fins.
963963
The specifics values are documented at:
@@ -975,7 +975,7 @@ def __fin_num_correction(n):
975975
Factor that accounts for the number of fins.
976976
"""
977977
corrector_factor = [2.37, 2.74, 2.99, 3.24]
978-
if n >= 5 and n <= 8: # pylint: disable=chained-comparison
978+
if 5 <= n <= 8:
979979
return corrector_factor[n - 5]
980980
else:
981981
return n / 2

rocketpy/rocket/rocket.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -644,25 +644,25 @@ def evaluate_dry_inertias(self):
644644
motor_dry_mass = self.motor.dry_mass
645645
mass = self.mass
646646

647-
# Compute axes distances
648-
noMCM_to_CDM = ( # pylint: disable=invalid-name
647+
# Compute axes distances (CDM: Center of Dry Mass)
648+
center_of_mass_without_motor_to_CDM = (
649649
self.center_of_mass_without_motor - self.center_of_dry_mass_position
650650
)
651-
motorCDM_to_CDM = ( # pylint: disable=invalid-name
651+
motor_center_of_dry_mass_to_CDM = (
652652
self.motor_center_of_dry_mass_position - self.center_of_dry_mass_position
653653
)
654654

655655
# Compute dry inertias
656656
self.dry_I_11 = parallel_axis_theorem_from_com(
657-
self.I_11_without_motor, mass, noMCM_to_CDM
657+
self.I_11_without_motor, mass, center_of_mass_without_motor_to_CDM
658658
) + parallel_axis_theorem_from_com(
659-
self.motor.dry_I_11, motor_dry_mass, motorCDM_to_CDM
659+
self.motor.dry_I_11, motor_dry_mass, motor_center_of_dry_mass_to_CDM
660660
)
661661

662662
self.dry_I_22 = parallel_axis_theorem_from_com(
663-
self.I_22_without_motor, mass, noMCM_to_CDM
663+
self.I_22_without_motor, mass, center_of_mass_without_motor_to_CDM
664664
) + parallel_axis_theorem_from_com(
665-
self.motor.dry_I_22, motor_dry_mass, motorCDM_to_CDM
665+
self.motor.dry_I_22, motor_dry_mass, motor_center_of_dry_mass_to_CDM
666666
)
667667

668668
self.dry_I_33 = self.I_33_without_motor + self.motor.dry_I_33

rocketpy/simulation/flight.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -1716,7 +1716,7 @@ def u_dot_generalized(
17161716
else:
17171717
R3 += air_brakes_force
17181718
# Get rocket velocity in body frame
1719-
velocity_vector_in_body_frame = Kt @ v
1719+
velocity_in_body_frame = Kt @ v
17201720
# Calculate lift and moment for each component of the rocket
17211721
for aero_surface, position in self.rocket.aerodynamic_surfaces:
17221722
comp_cpz = (
@@ -1726,7 +1726,7 @@ def u_dot_generalized(
17261726
surface_radius = aero_surface.rocket_radius
17271727
reference_area = np.pi * surface_radius**2
17281728
# Component absolute velocity in body frame
1729-
comp_vb = velocity_vector_in_body_frame + (w ^ comp_cp)
1729+
comp_vb = velocity_in_body_frame + (w ^ comp_cp)
17301730
# Wind velocity at component altitude
17311731
comp_z = z + (K @ comp_cp).z
17321732
comp_wind_vx = self.env.wind_velocity_x.get_value_opt(comp_z)
@@ -1797,7 +1797,7 @@ def u_dot_generalized(
17971797
)
17981798
M3 += self.rocket.cp_eccentricity_x * R2 - self.rocket.cp_eccentricity_y * R1
17991799

1800-
weight_vector_in_body_frame = Kt @ Vector(
1800+
weight_in_body_frame = Kt @ Vector(
18011801
[0, 0, -total_mass * self.env.gravity.get_value_opt(z)]
18021802
)
18031803

@@ -1815,14 +1815,14 @@ def u_dot_generalized(
18151815
((w ^ T00) ^ w)
18161816
+ (w ^ T03)
18171817
+ T04
1818-
+ weight_vector_in_body_frame
1818+
+ weight_in_body_frame
18191819
+ Vector([R1, R2, R3])
18201820
)
18211821

18221822
T21 = (
18231823
((I @ w) ^ w)
18241824
+ T05 @ w
1825-
- (weight_vector_in_body_frame ^ r_CM)
1825+
- (weight_in_body_frame ^ r_CM)
18261826
+ Vector([M1, M2, M3])
18271827
)
18281828

@@ -3434,8 +3434,6 @@ class TimeNodes:
34343434
TimeNodes object are instances of the TimeNode class.
34353435
"""
34363436

3437-
# pylint: disable=missing-function-docstring
3438-
34393437
def __init__(self, init_list=None):
34403438
if not init_list:
34413439
init_list = []

rocketpy/tools.py

-1
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,6 @@ def check_requirement_version(module_name, version):
820820

821821

822822
def exponential_backoff(max_attempts, base_delay=1, max_delay=60):
823-
# pylint: disable=missing-function-docstring
824823
def decorator(func):
825824
@functools.wraps(func)
826825
def wrapper(*args, **kwargs):

0 commit comments

Comments
 (0)