Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: 📝 update example in create_resource_structure() #1121

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 22 additions & 20 deletions src/seedcase_sprout/core/create_resource_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,35 @@ 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.

Raises:
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)
Comment on lines +50 to +53
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
resource_path = Path(temp_path / "resources")
resource_path.mkdir()
# Create a resource structure
sp.create_resource_structure(path=resource_path)
resources_path = Path(temp_path / "resources")
resources_path.mkdir()
# Create a resource structure
sp.create_resource_structure(path=resources_path)

To avoid confusion between the path to the "resources" folder and the path to a resource

```
"""
check_is_dir(path)

Expand Down