Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Classes | Functions | Variables
pip._internal.index.collector Namespace Reference

Classes

class  _NotAPIContent
 
class  _NotHTTP
 
class  CacheablePageContent
 
class  CollectedSources
 
class  HTMLLinkParser
 
class  IndexContent
 
class  LinkCollector
 
class  ParseLinks
 

Functions

Optional[str] _match_vcs_scheme (str url)
 
None _ensure_api_header (Response response)
 
None _ensure_api_response (str url, PipSession session)
 
Response _get_simple_response (str url, PipSession session)
 
Optional[str] _get_encoding_from_headers (ResponseHeaders headers)
 
ParseLinks with_cached_index_content (ParseLinks fn)
 
Iterable[Linkparse_links ("IndexContent" page)
 
None _handle_get_simple_fail (Link link, Union[str, Exception] reason, Optional[Callable[..., None]] meth=None)
 
IndexContent _make_index_content (Response response, bool cache_link_parsing=True)
 
Optional["IndexContent"] _get_index_content (Link link, *PipSession session)
 

Variables

 Protocol = object
 
 logger = logging.getLogger(__name__)
 
 ResponseHeaders = MutableMapping[str, str]
 

Detailed Description

The main purpose of this module is to expose LinkCollector.collect_sources().

Function Documentation

◆ _ensure_api_header()

None pip._internal.index.collector._ensure_api_header ( Response  response)
protected
Check the Content-Type header to ensure the response contains a Simple
API Response.

Raises `_NotAPIContent` if the content type is not a valid content-type.

◆ _ensure_api_response()

None pip._internal.index.collector._ensure_api_response ( str  url,
PipSession  session 
)
protected
Send a HEAD request to the URL, and ensure the response contains a simple
API Response.

Raises `_NotHTTP` if the URL is not available for a HEAD request, or
`_NotAPIContent` if the content type is not a valid content type.

◆ _get_encoding_from_headers()

Optional[str] pip._internal.index.collector._get_encoding_from_headers ( ResponseHeaders  headers)
protected
Determine if we have any encoding information in our headers.

◆ _get_simple_response()

Response pip._internal.index.collector._get_simple_response ( str  url,
PipSession  session 
)
protected
Access an Simple API response with GET, and return the response.

This consists of three parts:

1. If the URL looks suspiciously like an archive, send a HEAD first to
   check the Content-Type is HTML or Simple API, to avoid downloading a
   large file. Raise `_NotHTTP` if the content type cannot be determined, or
   `_NotAPIContent` if it is not HTML or a Simple API.
2. Actually perform the request. Raise HTTP exceptions on network failures.
3. Check the Content-Type header to make sure we got a Simple API response,
   and raise `_NotAPIContent` otherwise.

◆ _match_vcs_scheme()

Optional[str] pip._internal.index.collector._match_vcs_scheme ( str  url)
protected
Look for VCS schemes in the URL.

Returns the matched VCS scheme, or None if there's no match.

◆ parse_links()

Iterable[Link] pip._internal.index.collector.parse_links ( "IndexContent"  page)
Parse a Simple API's Index Content, and yield its anchor elements as Link objects.

◆ with_cached_index_content()

ParseLinks pip._internal.index.collector.with_cached_index_content ( ParseLinks  fn)
Given a function that parses an Iterable[Link] from an IndexContent, cache the
function's result (keyed by CacheablePageContent), unless the IndexContent
`page` has `page.cache_link_parsing == False`.