diff --git a/.pylintrc b/.pylintrc index c76a6d459..02565f092 100644 --- a/.pylintrc +++ b/.pylintrc @@ -476,7 +476,6 @@ disable=raw-checker-failed, locally-disabled, file-ignored, suppressed-message, - useless-suppression, deprecated-pragma, # because we have some pending deprecations in the code. use-symbolic-message-instead, use-implicit-booleaness-not-comparison-to-string, @@ -510,6 +509,7 @@ disable=raw-checker-failed, # multiple time (only on the command line, not in the configuration file where # it should appear only once). See also the "--disable" option for examples. enable= + useless-suppression [METHOD_ARGS] diff --git a/CHANGELOG.md b/CHANGELOG.md index b32e1307a..a7db3ef56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,8 @@ Attention: The newest changes should be on top --> - ENH: MNT: remove duplicate and merge-sync entries from Unreleased changelog [#1062](https://github.com/RocketPy-Team/RocketPy/pull/1062) ### Changed +- MNT: MNT: Remove Unused pylint Disable Statements. [#1067](https://github.com/RocketPy-Team/RocketPy/pull/1067) + ### Fixed ## [v1.13.0] - 2026-07-04 diff --git a/rocketpy/mathutils/function.py b/rocketpy/mathutils/function.py index f01c37652..207cdef49 100644 --- a/rocketpy/mathutils/function.py +++ b/rocketpy/mathutils/function.py @@ -2531,8 +2531,7 @@ def __lt__(self, other): return ~self.__ge__(other) # Define all possible algebraic operations - def __arithmetic_operation(self, other, op): - # pylint: disable=too-many-statements + def __arithmetic_operation(self, other, op): # pylint: disable=too-many-statements """Generic handler for arithmetic operations between a Function and another operand. @@ -3902,7 +3901,7 @@ def __validate_extrapolation(self, extrapolation): extrapolation = "natural" return extrapolation - def to_dict(self, **kwargs): # pylint: disable=unused-argument + def to_dict(self, **kwargs): """Serializes the Function instance to a dictionary. Returns @@ -4327,7 +4326,7 @@ class funcify_method_decorator: class. """ - # pylint: disable=C0103,R0903 + # pylint: disable=C0103 def __init__(self, func): self.func = func self.attrname = None @@ -4359,7 +4358,6 @@ def source_function(*_): source = source_function val = Function(source, *args, **kwargs) - # pylint: disable=W0201 val.__doc__ = self.__doc__ val.__cached__ = True cache[self.attrname] = val diff --git a/rocketpy/motors/fluid.py b/rocketpy/motors/fluid.py index 2397545d1..e18f31f41 100644 --- a/rocketpy/motors/fluid.py +++ b/rocketpy/motors/fluid.py @@ -164,7 +164,7 @@ def __str__(self): return f"Fluid: {self.name}" - def to_dict(self, **kwargs): # pylint: disable=unused-argument + def to_dict(self, **kwargs): discretize = kwargs.get("discretize", False) density = self.density diff --git a/rocketpy/motors/hybrid_motor.py b/rocketpy/motors/hybrid_motor.py index efee47867..eb63a3a3b 100644 --- a/rocketpy/motors/hybrid_motor.py +++ b/rocketpy/motors/hybrid_motor.py @@ -198,7 +198,6 @@ class HybridMotor(Motor): Grain length remains constant throughout the burn. Default is True. """ - # pylint: disable=too-many-arguments def __init__( # pylint: disable=too-many-arguments self, thrust_source, diff --git a/rocketpy/motors/solid_motor.py b/rocketpy/motors/solid_motor.py index 590a02511..6d1582109 100644 --- a/rocketpy/motors/solid_motor.py +++ b/rocketpy/motors/solid_motor.py @@ -483,7 +483,7 @@ def center_of_propellant_mass(self): center_of_mass = np.full_like(time_source, self.grains_center_of_mass_position) return np.column_stack((time_source, center_of_mass)) - # pylint: disable=too-many-arguments, too-many-statements + # pylint: disable=too-many-statements def evaluate_geometry(self): """Calculates grain inner radius and grain height as a function of time by assuming that every propellant mass burnt is exhausted. In order to diff --git a/rocketpy/plots/compare/compare_flights.py b/rocketpy/plots/compare/compare_flights.py index 0694d333c..20a613eec 100644 --- a/rocketpy/plots/compare/compare_flights.py +++ b/rocketpy/plots/compare/compare_flights.py @@ -13,7 +13,7 @@ # TODO: needs to refactor this class to use the show_or_save_plot -class CompareFlights(Compare): # pylint: disable=too-many-public-methods +class CompareFlights(Compare): """A class to compare the results of multiple flights. Parameters @@ -1343,7 +1343,7 @@ def trajectories_2d(self, plane="xy", figsize=(7, 7), legend=None, filename=None func(flights, names_list, figsize, legend, filename) - def __plot_xy( # pylint: disable=too-many-statements + def __plot_xy( self, flights, names_list, figsize=(7, 7), legend=None, filename=None ): """Creates a 2D trajectory plot in the X-Y plane that is the combination @@ -1404,7 +1404,7 @@ def __plot_xy( # pylint: disable=too-many-statements # Save figure self.__process_savefig(filename, fig) - def __plot_xz( # pylint: disable=too-many-statements + def __plot_xz( self, flights, names_list, figsize=(7, 7), legend=None, filename=None ): """Creates a 2D trajectory plot in the X-Z plane that is the combination @@ -1470,7 +1470,7 @@ def __plot_xz( # pylint: disable=too-many-statements # Save figure show_or_save_plot(filename) - def __plot_yz( # pylint: disable=too-many-statements + def __plot_yz( self, flights, names_list, figsize=(7, 7), legend=None, filename=None ): """Creates a 2D trajectory plot in the Y-Z plane that is the combination diff --git a/rocketpy/plots/environment_analysis_plots.py b/rocketpy/plots/environment_analysis_plots.py index 743e6b443..f043fa491 100644 --- a/rocketpy/plots/environment_analysis_plots.py +++ b/rocketpy/plots/environment_analysis_plots.py @@ -194,7 +194,7 @@ def average_surface_temperature_evolution( self, *, filename=None, - ): # pylint: disable=too-many-statements + ): """Plots average temperature progression throughout the day, including sigma contours. @@ -269,7 +269,7 @@ def average_surface_temperature_evolution( def average_surface10m_wind_speed_evolution( self, wind_speed_limit=False, *, filename=None - ): # pylint: disable=too-many-statements + ): """Plots average surface wind speed progression throughout the day, including sigma contours. @@ -371,7 +371,7 @@ def average_surface100m_wind_speed_evolution( self, *, filename=None, - ): # pylint: disable=too-many-statements + ): """Plots average surface wind speed progression throughout the day, including sigma contours. @@ -957,7 +957,7 @@ def average_wind_rose_specific_hour(self, hour, fig=None, *, filename=None): ) show_or_save_plot(filename) - def average_wind_rose_grid(self, *, filename=None): # pylint: disable=too-many-statements + def average_wind_rose_grid(self, *, filename=None): """Plot wind roses for all hours of a day, in a grid like plot. Parameters @@ -1683,7 +1683,7 @@ def wind_heading_profile_grid(self, clear_range_limits=False, *, filename=None): fig.supylabel(f"Altitude AGL ({self.env_analysis.unit_system['length']})") show_or_save_plot(filename) - def animate_wind_speed_profile(self, clear_range_limits=False): # pylint: disable=too-many-statements + def animate_wind_speed_profile(self, clear_range_limits=False): """Animation of how wind profile evolves throughout an average day. Parameters @@ -1763,7 +1763,7 @@ def update(frame): plt.close(fig) return HTML(animation.to_jshtml()) - def animate_wind_heading_profile(self, clear_range_limits=False): # pylint: disable=too-many-statements + def animate_wind_heading_profile(self, clear_range_limits=False): """Animation of how the wind heading profile evolves throughout an average day. Each frame is a different hour of the day. diff --git a/rocketpy/rocket/aero_surface/fins/_geometry.py b/rocketpy/rocket/aero_surface/fins/_geometry.py index 71b213909..bd9a0465a 100644 --- a/rocketpy/rocket/aero_surface/fins/_geometry.py +++ b/rocketpy/rocket/aero_surface/fins/_geometry.py @@ -142,7 +142,7 @@ def evaluate_geometrical_parameters(self): "roll_geometrical_constant": roll_geometrical_constant, "tau": tau, "lift_interference_factor": lift_interference_factor, - "λ": lambda_, # pylint: disable=non-ascii-name + "λ": lambda_, "roll_damping_interference_factor": roll_damping_interference_factor, "roll_forcing_interference_factor": roll_forcing_interference_factor, } @@ -204,7 +204,7 @@ def get_data(self, include_outputs=False): class _EllipticalGeometry(_FinGeometry): """Geometry strategy for elliptical fins.""" - def evaluate_geometrical_parameters(self): # pylint: disable=too-many-statements + def evaluate_geometrical_parameters(self): """Calculate elliptical fin geometric parameters.""" owner = self.owner diff --git a/rocketpy/rocket/aero_surface/generic_surface.py b/rocketpy/rocket/aero_surface/generic_surface.py index d1ae3a8f0..2047fe3e1 100644 --- a/rocketpy/rocket/aero_surface/generic_surface.py +++ b/rocketpy/rocket/aero_surface/generic_surface.py @@ -382,7 +382,7 @@ def _process_input(self, input_data, coeff_name): " or a callable." ) - def __load_generic_surface_csv(self, file_path, coeff_name): # pylint: disable=too-many-statements,import-outside-toplevel + def __load_generic_surface_csv(self, file_path, coeff_name): # pylint: disable=too-many-statements """Load GenericSurface coefficient CSV into a 7D Function. This loader expects header-based CSV data with one or more independent diff --git a/rocketpy/rocket/aero_surface/nose_cone.py b/rocketpy/rocket/aero_surface/nose_cone.py index fb2ac85d2..bebe63642 100644 --- a/rocketpy/rocket/aero_surface/nose_cone.py +++ b/rocketpy/rocket/aero_surface/nose_cone.py @@ -81,7 +81,7 @@ class NoseCone(AeroSurface): more about it. """ - def __init__( # pylint: disable=too-many-statements + def __init__( self, length, kind, @@ -222,7 +222,7 @@ def kind(self): return self._kind @kind.setter - def kind(self, value): # pylint: disable=too-many-statements + def kind(self, value): # Analyzes nosecone type # Sets the k for Cp calculation # Sets the function which creates the respective curve @@ -373,7 +373,7 @@ def evaluate_geometrical_parameters(self): self.fineness_ratio = self.length / (2 * self.base_radius) - def evaluate_nose_shape(self): # pylint: disable=too-many-statements + def evaluate_nose_shape(self): """Calculates and saves nose cone's shape as lists and re-evaluates the nose cone's length for a given bluffness ratio. The shape is saved as two vectors, one for the x coordinates and one for the y coordinates. diff --git a/rocketpy/rocket/parachute.py b/rocketpy/rocket/parachute.py index 47faeec95..00b56d8b5 100644 --- a/rocketpy/rocket/parachute.py +++ b/rocketpy/rocket/parachute.py @@ -294,9 +294,9 @@ def __evaluate_trigger_function(self, trigger): # pylint: disable=too-many-stat The resulting triggerfunc always has signature (p, h, y, sensors, u_dot) so Flight can pass both sensors and u_dot when needed. """ + # pylint: disable=function-redefined self._trigger_falling_only = False self._trigger_needs_height = True - # pylint: disable=unused-argument, function-redefined # Helper to wrap any callable to the internal (p, h, y, sensors, u_dot) API def _make_wrapper(fn): diff --git a/rocketpy/rocket/rocket.py b/rocketpy/rocket/rocket.py index 7667cae59..3f4748ac0 100644 --- a/rocketpy/rocket/rocket.py +++ b/rocketpy/rocket/rocket.py @@ -2453,7 +2453,7 @@ def _count_positional_args(callable_obj): "Function, or callable." ) - def __load_rocket_drag_csv(self, file_path, coeff_name): # pylint: disable=too-many-statements,import-outside-toplevel + def __load_rocket_drag_csv(self, file_path, coeff_name): # pylint: disable=too-many-statements """Load Rocket drag CSV into a 7D Function. Supports either headerless two-column (mach, coefficient) tables or diff --git a/rocketpy/simulation/flight.py b/rocketpy/simulation/flight.py index c413daad6..e026d166e 100644 --- a/rocketpy/simulation/flight.py +++ b/rocketpy/simulation/flight.py @@ -659,7 +659,7 @@ def __repr__(self): f"name= {self.name})>" ) - # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-locals,too-many-statements + # pylint: disable=too-many-locals,too-many-statements def __simulate(self, verbose): """Simulate the flight trajectory.""" for phase_index, phase in self.time_iterator(self.flight_phases): diff --git a/rocketpy/simulation/flight_comparator.py b/rocketpy/simulation/flight_comparator.py index 19785000a..e41e49f36 100644 --- a/rocketpy/simulation/flight_comparator.py +++ b/rocketpy/simulation/flight_comparator.py @@ -450,7 +450,7 @@ def _finalize_compare_figure( if filename: print(f"Plot saved to file: {filename}") - def compare( # pylint: disable=too-many-statements + def compare( self, attribute, time_range=None, @@ -730,7 +730,7 @@ def _format_key_events_table(self, results): return "\n".join(lines) - def summary(self): # pylint: disable=too-many-statements + def summary(self): """ Print comprehensive comparison summary including key events and metrics. diff --git a/rocketpy/simulation/flight_data_exporter.py b/rocketpy/simulation/flight_data_exporter.py index 80ee051c7..4065358ae 100644 --- a/rocketpy/simulation/flight_data_exporter.py +++ b/rocketpy/simulation/flight_data_exporter.py @@ -57,7 +57,7 @@ def export_pressures(self, file_name, time_step): """ f = self._flight time_points = np.arange(0, f.t_final, time_step) - # pylint: disable=W1514, E1121 + # pylint: disable=W1514 with open(file_name, "w") as file: if len(f.rocket.parachutes) == 0: logger.info("No parachutes in the rocket, saving static pressure.") diff --git a/rocketpy/simulation/monte_carlo.py b/rocketpy/simulation/monte_carlo.py index a7641595a..21c665d01 100644 --- a/rocketpy/simulation/monte_carlo.py +++ b/rocketpy/simulation/monte_carlo.py @@ -96,7 +96,7 @@ def __init__( flight, export_list=None, data_collector=None, - ): # pylint: disable=too-many-statements + ): """ Initialize a MonteCarlo object. @@ -171,7 +171,7 @@ def simulate( parallel=False, n_workers=None, **kwargs, - ): # pylint: disable=too-many-statements + ): """ Runs the Monte Carlo simulation and saves all data. diff --git a/tests/integration/simulation/test_monte_carlo.py b/tests/integration/simulation/test_monte_carlo.py index 98af2431d..bcfb59505 100644 --- a/tests/integration/simulation/test_monte_carlo.py +++ b/tests/integration/simulation/test_monte_carlo.py @@ -119,7 +119,7 @@ def test_monte_carlo_prints(monte_carlo_calisto): _post_test_file_cleanup() -@patch("matplotlib.pyplot.show") # pylint: disable=unused-argument +@patch("matplotlib.pyplot.show") def test_monte_carlo_plots(mock_show, monte_carlo_calisto_pre_loaded): """Tests the plots methods of the MonteCarlo class.""" try: diff --git a/tests/integration/test_encoding.py b/tests/integration/test_encoding.py index dc3be3432..0e3209aa9 100644 --- a/tests/integration/test_encoding.py +++ b/tests/integration/test_encoding.py @@ -100,7 +100,7 @@ def test_flight_save_load_resimulate(flight_name, include_outputs, request): assert np.isclose(flight_to_save.t_initial, flight_loaded.t_initial) assert np.isclose(flight_to_save.out_of_rail_time, flight_loaded.out_of_rail_time) - assert np.isclose(flight_to_save.apogee_time, flight_loaded.apogee_time) + assert np.isclose(flight_to_save.apogee_time, flight_loaded.apogee_time, rtol=1e-4) # Higher tolerance due to random parachute trigger assert np.isclose(flight_to_save.t_final, flight_loaded.t_final, rtol=5e-3) diff --git a/tests/unit/environment/test_environment.py b/tests/unit/environment/test_environment.py index db78e29e5..a7e50b392 100644 --- a/tests/unit/environment/test_environment.py +++ b/tests/unit/environment/test_environment.py @@ -814,7 +814,6 @@ def test_pressure_conversion_factor_autodetect_by_model( """Regression test for the GEFS/HIRESW pressure-unit bug: NOMADS-GrADS models report pressure in hPa (factor 100), THREDDS models in Pa (factor 1). A wrong factor silently corrupts the whole atmospheric profile (100x).""" - # pylint: disable=protected-access factor = example_plain_env._Environment__determine_pressure_conversion_factor( None, None, model ) diff --git a/tests/unit/mathutils/test_function.py b/tests/unit/mathutils/test_function.py index 2c25b6d0f..4243a4dbe 100644 --- a/tests/unit/mathutils/test_function.py +++ b/tests/unit/mathutils/test_function.py @@ -647,7 +647,7 @@ def test_set_discrete_based_on_model_non_mutator(linear_func): (source_array, cropped_array), ], ) -def test_crop_ndarray(array3dsource, array3dcropped): # pylint: disable=unused-argument +def test_crop_ndarray(array3dsource, array3dcropped): """Tests the functionality of crop method of the Function class. The source is initialized as a ndarray before cropping. """ @@ -795,7 +795,7 @@ def test_crop_invalid_input_raises(bad_x_lim, exc_type): (source_array, clipped_array), ], ) -def test_clip_ndarray(array3dsource, array3dclipped): # pylint: disable=unused-argument +def test_clip_ndarray(array3dsource, array3dclipped): """Tests the functionality of clip method of the Function class. The source is initialized as a ndarray before clipping. """ diff --git a/tests/unit/simulation/test_monte_carlo.py b/tests/unit/simulation/test_monte_carlo.py index 4e543505d..7e2e68804 100644 --- a/tests/unit/simulation/test_monte_carlo.py +++ b/tests/unit/simulation/test_monte_carlo.py @@ -469,7 +469,7 @@ def import_outputs(self, *args, **kwargs): # no-op, avoids file I/O pass def simulate(self, number_of_simulations, append=True, **kwargs): - # pylint: disable=arguments-differ,unused-argument + # pylint: disable=arguments-differ self.simulate_calls += 1 self.num_of_loaded_sims = number_of_simulations diff --git a/tests/unit/simulation/test_multivariate_rejection_sampler.py b/tests/unit/simulation/test_multivariate_rejection_sampler.py index af58b8fef..cf1851f07 100644 --- a/tests/unit/simulation/test_multivariate_rejection_sampler.py +++ b/tests/unit/simulation/test_multivariate_rejection_sampler.py @@ -8,7 +8,6 @@ from rocketpy._encoders import RocketPyEncoder -# pylint: disable=too-many-statements def test_mrs_initialization(): """Tests if the MultivariateRejectionSampler initialization opens input and output files correctly, and if it raises errors correctly when the files are problematic. diff --git a/tests/unit/test_utilities.py b/tests/unit/test_utilities.py index 6b2eb7d5a..146ff1be1 100644 --- a/tests/unit/test_utilities.py +++ b/tests/unit/test_utilities.py @@ -154,7 +154,7 @@ def test_fin_flutter_analysis_with_prints(flight_calisto_custom_wind): @patch("matplotlib.pyplot.show") -def test_fin_flutter_analysis_with_graphs(mock_show, flight_calisto_custom_wind): # pylint: disable=unused-argument +def test_fin_flutter_analysis_with_graphs(mock_show, flight_calisto_custom_wind): """Test fin_flutter_analysis with see_graphs=True to cover plotting branch. Parameters @@ -179,7 +179,7 @@ def test_fin_flutter_analysis_with_graphs(mock_show, flight_calisto_custom_wind) @patch("matplotlib.pyplot.show") -def test_fin_flutter_analysis_complete_output(mock_show, flight_calisto_custom_wind): # pylint: disable=unused-argument +def test_fin_flutter_analysis_complete_output(mock_show, flight_calisto_custom_wind): """Test fin_flutter_analysis with both prints and graphs enabled. Parameters @@ -217,7 +217,7 @@ def test_flutter_prints(flight_calisto_custom_wind): flutter_mach = Function("tests/fixtures/utilities/flutter_mach.txt") safety_factor = Function("tests/fixtures/utilities/flutter_safety_factor.txt") assert ( - utilities._flutter_prints( # pylint: disable=protected-access + utilities._flutter_prints( fin_thickness=2 / 1000, shear_modulus=10e9, surface_area=0.009899999999999999, @@ -247,7 +247,7 @@ def test_flutter_plots(mock_show, flight_calisto_custom_wind): # pylint: disabl flutter_mach = Function("tests/fixtures/utilities/flutter_mach.txt") safety_factor = Function("tests/fixtures/utilities/flutter_safety_factor.txt") assert ( - utilities._flutter_plots( # pylint: disable=protected-access + utilities._flutter_plots( flight_calisto_custom_wind, flutter_mach, safety_factor ) is None