Skip to content

Commit 6ea03b7

Browse files
committed
MNT: fix pylint and cyclic imports again
1 parent da64562 commit 6ea03b7

2 files changed

Lines changed: 25 additions & 8 deletions

File tree

rocketpy/plots/plot_helpers.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,22 @@
33
import matplotlib.pyplot as plt
44
from matplotlib.figure import Figure
55

6-
from ..tools import get_matplotlib_supported_file_endings
7-
86
SAVEFIG_DPI = 300
97

108

9+
def get_matplotlib_supported_file_endings():
10+
"""Get file endings supported by matplotlib.
11+
12+
Returns
13+
-------
14+
list[str]
15+
List of file endings prepended with a dot.
16+
"""
17+
filetypes = plt.gcf().canvas.get_supported_filetypes().keys()
18+
filetypes = ["." + filetype for filetype in filetypes]
19+
return filetypes
20+
21+
1122
def show_or_save_plot(filename=None):
1223
"""Shows or saves the current matplotlib plot. If a filename is given, the
1324
plot will be saved, otherwise it will be shown.

rocketpy/tools.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def create_regular_grid_function(
122122
variable_names,
123123
coeff_name,
124124
extrapolation,
125-
):
125+
): # pylint: disable=import-outside-toplevel
126126
"""Create a regular-grid Function when CSV samples form a full grid.
127127
128128
Parameters
@@ -142,7 +142,9 @@ def create_regular_grid_function(
142142
A ``Function`` configured with ``regular_grid`` interpolation when the
143143
CSV data forms a strict Cartesian grid, otherwise ``None``.
144144
"""
145-
from rocketpy.mathutils.function import Function
145+
from rocketpy.mathutils.function import ( # pylint: disable=import-outside-toplevel
146+
Function, # pylint: disable=import-outside-toplevel
147+
)
146148

147149
return Function.from_regular_grid_csv(
148150
csv_source,
@@ -152,14 +154,16 @@ def create_regular_grid_function(
152154
)
153155

154156

155-
def load_generic_surface_csv(file_path, coeff_name): # pylint: disable=too-many-statements
157+
def load_generic_surface_csv(file_path, coeff_name): # pylint: disable=too-many-statements,import-outside-toplevel
156158
"""Load GenericSurface coefficient CSV into a 7D Function.
157159
158160
This loader expects header-based CSV data with one or more independent
159161
variables among: alpha, beta, mach, reynolds, pitch_rate, yaw_rate,
160162
roll_rate.
161163
"""
162-
from rocketpy.mathutils.function import Function
164+
from rocketpy.mathutils.function import ( # pylint: disable=import-outside-toplevel
165+
Function, # pylint: disable=import-outside-toplevel
166+
)
163167

164168
independent_vars = [
165169
"alpha",
@@ -239,13 +243,15 @@ def wrapper(alpha, beta, mach, reynolds, pitch_rate, yaw_rate, roll_rate):
239243
)
240244

241245

242-
def load_rocket_drag_csv(file_path, coeff_name): # pylint: disable=too-many-statements
246+
def load_rocket_drag_csv(file_path, coeff_name): # pylint: disable=too-many-statements,import-outside-toplevel
243247
"""Load Rocket drag CSV into a 7D Function.
244248
245249
Supports either headerless two-column (mach, coefficient) tables or
246250
header-based multi-variable CSV tables.
247251
"""
248-
from rocketpy.mathutils.function import Function
252+
from rocketpy.mathutils.function import ( # pylint: disable=import-outside-toplevel
253+
Function, # pylint: disable=import-outside-toplevel
254+
)
249255

250256
independent_vars = [
251257
"alpha",

0 commit comments

Comments
 (0)