From 531c44f692fdef079fb8a3ea489817a8d2ef710d Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Thu, 6 Mar 2025 20:48:57 +0100 Subject: [PATCH] docs: :memo: update example in `create_resource_structure()` --- .../core/create_resource_structure.py | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/seedcase_sprout/core/create_resource_structure.py b/src/seedcase_sprout/core/create_resource_structure.py index 48c53dd0..e8ac3e7f 100644 --- a/src/seedcase_sprout/core/create_resource_structure.py +++ b/src/seedcase_sprout/core/create_resource_structure.py @@ -23,6 +23,7 @@ def create_resource_structure(path: Path) -> list[Path]: Returns: A list of the two created directories: + - A path to the resource directory and - A path to the raw data directory. @@ -30,26 +31,27 @@ def create_resource_structure(path: Path) -> list[Path]: NotADirectoryError: If path is not an existing directory. Examples: - ```{python} - import tempfile - from pathlib import Path - - import seedcase_sprout.core as sp - - # Create a temporary directory for the example - with tempfile.TemporaryDirectory() as temp_dir: - temp_path = Path(temp_dir) - - # Create a package structure first - sp.create_package_properties( - properties=sp.example_package_properties(), - path=temp_path - ) - - # TODO: Update after converting to "local-first" - # Create a resource structure - # sp.create_resource_structure(path=temp_path / "1" / "resources") - ``` + ```{python} + import tempfile + from pathlib import Path + + import seedcase_sprout.core as sp + + # Create a temporary directory for the example + with tempfile.TemporaryDirectory() as temp_dir: + temp_path = Path(temp_dir) + + # Create a package structure first + sp.create_package_properties( + properties=sp.example_package_properties(), + path=temp_path + ) + + resource_path = Path(temp_path / "resources") + resource_path.mkdir() + # Create a resource structure + sp.create_resource_structure(path=resource_path) + ``` """ check_is_dir(path)