feat: implement maxdepth and withdirs options for S3FileSystem.find()#544
Merged
laughingman7743 merged 1 commit intomasterfrom Jul 19, 2025
Merged
feat: implement maxdepth and withdirs options for S3FileSystem.find()#544laughingman7743 merged 1 commit intomasterfrom
laughingman7743 merged 1 commit intomasterfrom
Conversation
ae45082 to
8a50dc4
Compare
Member
Author
|
TODO:
|
0dd38b4 to
983c4c7
Compare
4faf6c4 to
c8e9404
Compare
cb25fb4 to
980a17a
Compare
- Add maxdepth parameter to limit directory traversal depth - Uses recursive approach with delimiter="/" for efficiency - Compatible with s3fs behavior - Add withdirs parameter to include directories in results - Default is False (returns only files) - When True, includes directory entries - Improve cache management using (path, delimiter) tuple as key - Add comprehensive tests for both parameters Implementation details: - When maxdepth is specified, uses level-by-level traversal - When withdirs=True and delimiter="", derives directories from file paths - Ensures compatibility with s3fs conventions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
980a17a to
681e749
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements the
maxdepthandwithdirsoptions for theS3FileSystem.find()method, providing compatibility with s3fs behavior.Changes
(path, delimiter)tuple as cache key_extract_parent_directories()methodImplementation Details
maxdepth
delimiter="/"for efficiency (similar to s3fs)maxdepth=0: Returns only files directly in the specified pathmaxdepth=1: Returns files in the path and one level of subdirectorieswithdirs
False(returns only files, consistent with typical user expectations)True, includes directory entries in the resultsCode Quality Improvements
_extract_parent_directories()method to reduce_find()method complexityPerformance Improvements
maxdepthis specified, uses level-by-level traversal instead of fetching all filesCache Management
delimiterfield to S3Object(path, delimiter)as the cache keyTesting
All tests pass successfully:
test_find_maxdepth: Verifies correct depth limiting at multiple levelstest_find_withdirs: Verifies directory inclusion/exclusion behaviorDocumentation Updates
Updated CLAUDE.md with:
Compatibility
The implementation follows s3fs conventions for both parameters, ensuring drop-in compatibility for users migrating from s3fs.
🤖 Generated with Claude Code