Repository navigation
fix(tests): stop vulture failing on the fake transports' send signature - #220
Merged
Merged
Conversation
`make lint` has been exiting 2 since #218: vulture flags `stream`, `verify`, `cert` and `proxies` on both fake `BaseAdapter.send` overrides. The names cannot change. `requests.Session.send` calls `adapter.send(request, **kwargs)` with those exact keywords, so renaming them is a TypeError at runtime, and collapsing them into `**kwargs` fails basedpyright's override check (positional parameter count mismatch). So the signature stays and the body consumes them. `del` rather than a `vulture_ignorelist.py` entry: the whitelist matches by bare name across the whole tree, and `stream` / `verify` / `cert` / `proxies` are ordinary enough words that listing them would blind vulture to real dead code elsewhere. The existing `option_string` entry is safe there precisely because nothing else would ever be called that. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
make lintexits 2 ondevelopright now, and has since#218.
bin/lint-python.shrunsvulture .aftermake typecheck, and vulture flags eightinterface-mandated parameters on the two fake
BaseAdapter.sendoverrides I added:
My verification on #218 quoted basedpyright's "0 errors, 0 warnings"
line and grepped past the vulture step underneath it. That was my
mistake; this restores a green
make lint.Why the signature can't just drop them
_stream, …) breaks at runtime.requests.Session.senddoesadapter.send(request, **kwargs)(
sessions.py:784) with those exact keyword names, so a renamedparameter is a
TypeError, not just a checker complaint.**kwargsfails the type checker. basedpyright:Method "send" overrides class "BaseAdapter" in an incompatible manner — Positional parameter count mismatch; base method has 7, but override has 3 (reportIncompatibleMethodOverride).So the names stay, and the body consumes them with
delplus a commentsaying why they're there.
Why not
vulture_ignorelist.pyThe repo already whitelists one interface-mandated parameter
(
option_string, forargparse.Action.__call__), so the precedentexists and this would be a defensible one-line alternative.
The difference is blast radius. Vulture's whitelist matches by bare
name across the whole tree — the file works by referencing a name so
it looks used.
option_stringis safe there because nothing else incomicbox will ever be called that.
stream,verify,certandproxiesare ordinary words; whitelisting them would permanently blindvulture to a genuinely dead
verifyorstreamin production codelater, to spare two lines in two test doubles. (
timeoutis alreadyunflagged for exactly this reason — the name is used elsewhere, so
vulture assumes it's live.)
Happy to switch to the whitelist if you'd rather keep the test bodies
free of linter accommodations.
Verification
make lint→ exit 0 (was 2)make ty→ All checks passed!make complexity→ exit 0, nothing over 15🤖 Generated with Claude Code