src/requests/adapters.py
File adapters.py
has 488 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
"""
requests.adapters
~~~~~~~~~~~~~~~~~
This module contains the transport adapters that Requests uses to define
Function cert_verify
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
def cert_verify(self, conn, url, verify, cert):
"""Verify a SSL certificate. This method should not be called from user
code, and is only exposed for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function send
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def send(
Function send
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def send(
Function _get_connection
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _get_connection(self, request, verify, proxies=None, cert=None):
Function _urllib3_request_context
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def _urllib3_request_context(
request: "PreparedRequest",
verify: "bool | str | None",
client_cert: "typing.Tuple[str, str] | str | None",
) -> "(typing.Dict[str, typing.Any], typing.Dict[str, typing.Any])":
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"