Skip to content

Conversation

@filipchristiansen
Copy link
Contributor

@filipchristiansen filipchristiansen commented Jan 6, 2025

This PR replaces all occurrences of os.path with the pathlib library to enhance code clarity, maintainability, and cross-platform consistency. Key changes include:

  • Converting string-based path manipulations to Path objects.
  • Using path.relative_to(...) to obtain relative paths instead of naive string replacements.
  • Replacing os.path.join(), os.path.exists(), os.path.abspath(...), os.path.basename(...), os.path.dirname(...), os.path.getctime(...), os.listdir(...), and similar functions with the equivalent Path methods.

By leveraging pathlib’s object-oriented approach, we ensure fewer edge cases in path handling, especially on different operating systems. The tests have been updated to reflect these changes and should pass as expected.

Copy link
Member

@cyclotruc cyclotruc left a comment

Choose a reason for hiding this comment

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

Very good thank you!
I tested in codespaces and everything seemed to work perfectly

@cyclotruc cyclotruc merged commit 123f0ef into coderamp-labs:main Jan 7, 2025
8 checks passed
@filipchristiansen filipchristiansen deleted the feature/refactor-pathlib branch January 7, 2025 10:46
FOLKS-Tech pushed a commit to FOLKS-Tech/gitingest that referenced this pull request Sep 5, 2025
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