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

Use pathlib instead of os.path #249

Merged
merged 5 commits into from
Oct 11, 2024
Merged

Use pathlib instead of os.path #249

merged 5 commits into from
Oct 11, 2024

Conversation

NicolasHug
Copy link
Member

pathlib is cleaner and more powerful. This PR isn't super useful on its own but I want to avoid spreading uses of os.path caused by copy/pasting existing code.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 8, 2024

import torchcodec
from torchvision.io.image import write_png

decoder = torchcodec.decoders._core.create_from_file(
os.path.dirname(__file__) + "/../resources/nasa_13013.mp4"
str(Path(__file__) / parent / "../resources/nasa_13013.mp4")
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is supposed to be .parent; see the failing tests.

@NicolasHug NicolasHug merged commit 6cec00c into main Oct 11, 2024
22 checks passed
@NicolasHug NicolasHug deleted the ospath branch October 11, 2024 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants