-
Notifications
You must be signed in to change notification settings - Fork 0
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
refactor: ♻️ major refactor of path functions to be local-first #1114
base: main
Are you sure you want to change the base?
Conversation
return check_is_file(path) | ||
|
||
|
||
def path_resource_raw(resource_id: int, path: Path = Path.cwd()) -> Path: |
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.
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.
Niiiice! 🎉 🎉 All my comments are very minor!
path=temp_path | ||
) | ||
|
||
sp.path_properties(path = temp_path) |
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.
sp.path_properties(path = temp_path) | |
sp.path_properties(path=temp_path) |
path=temp_path | ||
) | ||
|
||
sp.path_readme(path = temp_path) |
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.
sp.path_readme(path = temp_path) | |
sp.path_readme(path=temp_path) |
resource_path = Path(temp_path / "resources") | ||
resource_path.mkdir() | ||
sp.create_resource_structure(path=resource_path) |
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.
resource_path = Path(temp_path / "resources") | |
resource_path.mkdir() | |
sp.create_resource_structure(path=resource_path) | |
resources_path = Path(temp_path / "resources") | |
resources_path.mkdir() | |
sp.create_resource_structure(path=resources_path) |
To avoid confusion with path_resource
resource_path = Path(temp_path / "resources") | ||
resource_path.mkdir() | ||
sp.create_resource_structure(path=resource_path) |
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.
resource_path = Path(temp_path / "resources") | |
resource_path.mkdir() | |
sp.create_resource_structure(path=resource_path) | |
resources_path = Path(temp_path / "resources") | |
resources_path.mkdir() | |
sp.create_resource_structure(path=resources_path) |
resource_path = Path(temp_path / "resources") | ||
resource_path.mkdir() | ||
sp.create_resource_structure(path=resource_path) |
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.
resource_path = Path(temp_path / "resources") | |
resource_path.mkdir() | |
sp.create_resource_structure(path=resource_path) | |
resources_path = Path(temp_path / "resources") | |
resources_path.mkdir() | |
sp.create_resource_structure(path=resources_path) |
tmp_path, tmp_package, function, expected_path | ||
): | ||
path = function(path=tmp_path) | ||
# When, then |
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.
I think "when" is for executing the functionality we're testing (here path = function(path=tmp_path)
) and "then" is for the assertions.
(path_readme, "README.md"), | ||
], | ||
) | ||
def test_path_local_root_files_return_expected_path( |
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.
def test_path_local_root_files_return_expected_path( | |
def test_path_local_root_functions_return_expected_path( |
Or am I misunderstanding?
"function", | ||
[path_properties, path_readme], | ||
) | ||
def test_path_local_root_files_raise_error_if_files_not_exist(tmp_package, function): |
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.
def test_path_local_root_files_raise_error_if_files_not_exist(tmp_package, function): | |
def test_path_local_root_functions_raise_error_if_files_not_exist(tmp_package, function): |
Description
Converts all the path functions to be either local-first or multi-user. In the process I consolidated some of the functions into either "local" or "global" files.
I moved some of the smaller helper functions into the larger files, and appended with
_
. I'm not a huge fan of how it looks, but given it is a common Python practice and it helps visually separate external from internal functions, I'm ok if we start doing that too.Closes #1004
This PR needs an in-depth review.
Checklist
just run-all