-
Notifications
You must be signed in to change notification settings - Fork 0
Enhancement to allow paths with directories. #96
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
Conversation
paulsaxe
commented
Jun 1, 2025
- As in reading/writing structures, paths beginning with '/' are relative to the root of the job, and relative paths are relative to the directory where the table step is invoked.
* As in reading/writing structures, paths beginning with '/' are relative to the root of the job, and relative paths are relative to the directory where the table step is invoked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances file path handling for the Table step so that absolute paths (starting with /
) are resolved relative to the job root and other paths are relative to the invocation directory.
- Update module docstring in
table_parameters.py
. - Refactor imports and implement new logic in
table.py
to resolve absolute vs. relative filenames. - Add a HISTORY entry documenting the change.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
table_step/table_parameters.py | Corrected module docstring to reference tables instead of loops |
table_step/table.py | Swapped to pathlib.Path , added logic for absolute vs. relative paths, removed os.path |
HISTORY.rst | Recorded version 2025.6.1 with path-handling enhancement |
@@ -3,8 +3,7 @@ | |||
"""Non-graphical part of the Table step in SEAMM""" | |||
|
|||
import logging | |||
import os.path | |||
from pathlib import PurePath | |||
from pathlib import Path, PurePath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The import of PurePath
is unused in this file; consider removing it to keep imports clean.
from pathlib import Path, PurePath | |
from pathlib import Path |
Copilot uses AI. Check for mistakes.
# Pathnames are relative to current working directory | ||
wd = Path(self.directory).parent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The variable name wd
and the comment are vague. Consider renaming wd
to base_dir
or invocation_dir
and update the comment to specify that it's the directory where the table step is invoked.
# Pathnames are relative to current working directory | |
wd = Path(self.directory).parent | |
# Base directory where the table step is invoked | |
base_dir = Path(self.directory).parent |
Copilot uses AI. Check for mistakes.
if filename.startswith("/"): | ||
filename = str( | ||
Path(self.flowchart.root_directory) / filename[1:] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking startswith("/")
only covers POSIX-style paths. Use Path(filename).is_absolute()
to handle absolute paths in a platform-independent way.
if filename.startswith("/"): | |
filename = str( | |
Path(self.flowchart.root_directory) / filename[1:] | |
if Path(filename).is_absolute(): | |
filename = str( | |
Path(self.flowchart.root_directory) / Path(filename).relative_to("/") |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM