Skip to content

Conversation

JackAshwell11
Copy link
Contributor

No description provided.

@JackAshwell11 JackAshwell11 force-pushed the resolve_create branch 2 times, most recently from 969fc71 to a86233f Compare July 6, 2025 16:19
Copy link
Collaborator

@DragonMoffon DragonMoffon left a comment

Choose a reason for hiding this comment

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

Looks good otherwise.

Since this PR modifies this code already, could we add an additional check. importlib.resources.Traversable is also a common type passed into this method, and it doesn't have a consistent interface with pathlib.Path. See the docs.

We should either have the function work perfectly with either a Path or Traversable or check for and change a Traversable to a Path

Create a file or directory at the given path.
If the path has a suffix, it's treated as a file, otherwise, as a directory.
"""
if path.suffix:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Path objects have an is_dir method, which is probably a safer check.

Comment on lines +124 to +125
if create:
create_path(path)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this not also check if the path exists?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants