Skip to content

Commit 1cb0bb4

Browse files
MateusStanoclaude
andcommitted
MNT: lint sweep for the solution refactor
Move the Solution import in _encoders to module scope (no import cycle) and document the unused NumPy-protocol argument on Solution.__array__. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent db10e08 commit 1cb0bb4

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

rocketpy/_encoders.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from rocketpy.mathutils.function import Function
1010
from rocketpy.plots.flight_plots import _FlightPlots
1111
from rocketpy.prints.flight_prints import _FlightPrints
12+
from rocketpy.simulation.solution import Solution
1213

1314

1415
class RocketPyEncoder(json.JSONEncoder):
@@ -199,8 +200,6 @@ def set_minimal_flight_attributes(flight, obj):
199200

200201
# The solution is stored either as the new segment-based dict or, for older
201202
# saved flights, as a flat list of canonical rows.
202-
from rocketpy.simulation.solution import Solution
203-
204203
raw_solution = obj["solution"]
205204
if isinstance(raw_solution, dict):
206205
flight.solution = Solution.from_dict(raw_solution)

rocketpy/simulation/solution.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,9 @@ def pop(self, index=-1):
594594
self._version += 1
595595
return row
596596

597-
def __array__(self, dtype=None, copy=None):
597+
def __array__(self, dtype=None, copy=None): # pylint: disable=unused-argument
598+
# `copy` is part of the NumPy array protocol; the array is always freshly
599+
# built here, so it is accepted for compatibility and not acted on.
598600
widths = {segment.width for segment in self._segments if segment.rows}
599601
if len(widths) > 1:
600602
raise TypeError(

0 commit comments

Comments
 (0)