Skip to content

Remove the positional detail argument of find() - #450

Draft
shcheklein wants to merge 2 commits into
mainfrom
find-positional-detail
Draft

shcheklein wants to merge 2 commits into
mainfrom
find-positional-detail

Conversation

@shcheklein

Copy link
Copy Markdown
Member

PyDrive2 1.x took detail as the second argument of find(). When the filesystem switched to fsspec's signature, find(path, maxdepth=None, withdirs=False, detail=False), a warning kept the old form working. This removes it.

Example

fs.find("root/data", True)

Before: a DeprecationWarning, then a detailed listing of the whole tree.

Without the warning, True would be read as maxdepth, which Python treats as 1: the call would quietly return only the top level of the tree. So a boolean in that position now raises:

TypeError: find() takes maxdepth as its second argument. Pass detail by keyword: find(path, detail=True).

fs.find(path, detail=True) and fs.find(path, 2) work as before. The upgrade guide gets one paragraph under "Removed names".

Validation

  • Offline, without a request: find() with True or False as the depth raises TypeError, and with 0 or -1 raises ValueError as before. No live test: the error is raised before any request.
  • The offline suite passes with -W error::DeprecationWarning (539 passed).

🤖 Generated with Claude Code

find(path, True) took True as detail, a form PyDrive2 1.x used, and
warned. The second argument is maxdepth, as in other fsspec
filesystems, and True would quietly mean a depth of 1, so a boolean
there now raises TypeError. The upgrade guide says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread pydrive2/fs/spec.py Resolved

@shcheklein shcheklein left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

[AI generated — Copilot]

5-pass review summary: clean, minimal, and well-scoped removal. No bugs, dead code, performance issues, or test issues found — just one minor message suggestion inline.

Comment thread pydrive2/fs/spec.py Resolved
@shcheklein shcheklein mentioned this pull request Dec 3, 2026
1 of 2 tasks
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No actionable issues were found in the reviewed changes.

No open issues 🎉

What changed in this PR

Removes legacy positional detail support from the filesystem’s find() method while preserving its fsspec-compatible signature.

Changes:

  • Rejects boolean maxdepth values with guidance to pass detail by keyword.
  • Tests invalid depths and confirms rejection occurs before network requests.
  • Documents the migration in the upgrade guide.
File Description
pydrive2/​test/​test_fs_unit.py Tests boolean and nonpositive depth rejection without requests.
pydrive2/​fs/​spec.py Replaces the deprecation warning with a TypeError.
docs/​upgrading.rst Explains how to migrate positional detail calls.

Review effort: Balanced

This branch has not been deployed

No deployments
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