Skip to content

[requests] Replace Incomplete in HTTPAdapter and type cert_verify - #16667

Open
huuan26 wants to merge 5 commits into
python:mainfrom
huuan26:fix/requests-adapter-types
Open

huuan26 wants to merge 5 commits into
python:mainfrom
huuan26:fix/requests-adapter-types

Conversation

@huuan26

@huuan26 huuan26 commented Oct 31, 2026

Copy link
Copy Markdown

Summary

This PR improves type annotations in requests.adapters:

  1. Replaced all Incomplete occurrences in HTTPAdapter:
    • __attrs__: list[str] (runtime: list of attribute names).
    • config: dict[str, Any] (runtime: configuration dictionary).
    • proxy_manager: dict[str, ProxyManager | SOCKSProxyManager] (runtime: dict mapping proxy URLs to proxy managers).
    • poolmanager: PoolManager (runtime: urllib3.poolmanager.PoolManager instance).
  2. Clarified HTTPAdapter.proxy_manager_for return type from Any to ProxyManager | SOCKSProxyManager.
  3. Fully typed untyped parameters and return type for HTTPAdapter.cert_verify.
  4. Removed unused from _typeshed import Incomplete.
  5. Added assert_type tests in stubs/requests/@tests/test_cases/check_adapters.py.

Verification

  • flake8 --config .flake8 stubs/requests: passed (0 errors)
  • ruff check stubs/requests: passed (0 errors)
  • tests/regr_test.py requests: passed across test cases with mypy
  • tests/stubtest_third_party.py requests: passed (success against installed requests 2.34.2)
  • tests/check_typeshed_structure.py: passed

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

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.

1 participant