Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

Conversation

@flopeters1337
Copy link

What does this PR do?

This PR fixes an issue with inclusion and exclusion lists not being taken into account correctly for directories on Windows machines due to a hard-coded separator character.
Replaced the hard-coded "/" with a os.sep to make the filepath separator OS-independent.

…ts checks

This change fixes an issue with inclusion and exclusion lists not being taken into account correctly for directories on Windows machines due to a hard-coded separator character.
extension = extension.lower()
file_name = os.path.basename(file_path)
dirs = os.path.dirname(file_path).split("/")
dirs = os.path.dirname(file_path).split(os.sep)
Copy link
Contributor

Choose a reason for hiding this comment

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

That's a very good idea. For consistency, would you mind making this update in other places in the codebase?

grep -nr '.split("/")' sage
sage/sage/retriever.py:244:                items = path.split("/")
sage/sage/retriever.py:256:        root_path = "/" + repo_metadata[0]["file_path"].split("/")[0]
sage/sage/retriever.py:278:        org_name, repo_name = repo_id.split("/") <--- this one shouldn't be updated
sage/sage/retriever.py:279:        items = filename.split("/")
sage/sage/data_manager.py:166:        dirs = os.path.dirname(file_path).split("/")

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants