|
5 | 5 | from datetime import date |
6 | 6 | from importlib.metadata import version |
7 | 7 | from pathlib import Path |
| 8 | +from typing import TYPE_CHECKING |
8 | 9 |
|
9 | 10 | import matplotlib.pyplot as plt |
10 | 11 | import numpy as np |
|
16 | 17 | from .mathutils.function import Function |
17 | 18 | from .plots.plot_helpers import show_or_save_plot |
18 | 19 | from .rocket.aero_surface import TrapezoidalFins |
19 | | -from .simulation.flight import Flight |
| 20 | + |
| 21 | +if TYPE_CHECKING: # pragma: no cover |
| 22 | + from .simulation.flight import Flight |
20 | 23 |
|
21 | 24 |
|
22 | 25 | def compute_cd_s_from_drop_test( |
@@ -524,6 +527,9 @@ def apogee_by_mass(flight, min_mass, max_mass, points=10, plot=True): |
524 | 527 | Function object containing the estimated apogee as a function of the |
525 | 528 | rocket's mass (without motor nor propellant). |
526 | 529 | """ |
| 530 | + # Imported lazily to avoid a circular import (Flight imports utilities). |
| 531 | + from .simulation.flight import Flight # pylint: disable=import-outside-toplevel |
| 532 | + |
527 | 533 | rocket = flight.rocket |
528 | 534 |
|
529 | 535 | def apogee(mass): |
@@ -594,6 +600,9 @@ def liftoff_speed_by_mass(flight, min_mass, max_mass, points=10, plot=True): |
594 | 600 | Function object containing the estimated liftoff speed as a function of |
595 | 601 | the rocket's mass (without motor nor propellant). |
596 | 602 | """ |
| 603 | + # Imported lazily to avoid a circular import (Flight imports utilities). |
| 604 | + from .simulation.flight import Flight # pylint: disable=import-outside-toplevel |
| 605 | + |
597 | 606 | rocket = flight.rocket |
598 | 607 |
|
599 | 608 | def liftoff_speed(mass): |
@@ -652,7 +661,7 @@ def get_instance_attributes(instance): |
652 | 661 | return attributes_dict |
653 | 662 |
|
654 | 663 |
|
655 | | -def save_to_rpy(flight: Flight, filename: str, include_outputs=False): |
| 664 | +def save_to_rpy(flight: "Flight", filename: str, include_outputs=False): |
656 | 665 | """Saves a .rpy file into the given path, containing key simulation |
657 | 666 | informations to reproduce the results. |
658 | 667 |
|
|
0 commit comments