Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Static Protected Attributes | List of all members
pip._internal.models.link.LinkHash Class Reference
Collaboration diagram for pip._internal.models.link.LinkHash:
Collaboration graph
[legend]

Public Member Functions

None __post_init__ (self)
 
Optional["LinkHash"] find_hash_url_fragment (cls, str url)
 
Dict[str, str] as_dict (self)
 
Hashes as_hashes (self)
 
bool is_hash_allowed (self, Optional[Hashes] hashes)
 

Public Attributes

 name
 

Static Public Attributes

str name
 
str value
 

Static Protected Attributes

 _hash_url_fragment_re
 

Detailed Description

Links to content may have embedded hash values. This class parses those.

`name` must be any member of `_SUPPORTED_HASHES`.

This class can be converted to and from `ArchiveInfo`. While ArchiveInfo intends to
be JSON-serializable to conform to PEP 610, this class contains the logic for
parsing a hash name and value for correctness, and then checking whether that hash
conforms to a schema with `.is_hash_allowed()`.

Member Function Documentation

◆ as_hashes()

Hashes pip._internal.models.link.LinkHash.as_hashes (   self)
Return a Hashes instance which checks only for the current hash.

◆ find_hash_url_fragment()

Optional["LinkHash"] pip._internal.models.link.LinkHash.find_hash_url_fragment (   cls,
str  url 
)
Search a string for a checksum algorithm name and encoded output value.

◆ is_hash_allowed()

bool pip._internal.models.link.LinkHash.is_hash_allowed (   self,
Optional[Hashes hashes 
)
Return True if the current hash is allowed by `hashes`.

Member Data Documentation

◆ _hash_url_fragment_re

pip._internal.models.link.LinkHash._hash_url_fragment_re
staticprotected
Initial value:
= re.compile(
# NB: we do not validate that the second group (.*) is a valid hex
# digest. Instead, we simply keep that string in this class, and then check it
# against Hashes when hash-checking is needed. This is easier to debug than
# proactively discarding an invalid hex digest, as we handle incorrect hashes
# and malformed hashes in the same place.
r"[#&]({choices})=([^&]*)".format(
choices="|".join(re.escape(hash_name) for hash_name in _SUPPORTED_HASHES)
),
)

The documentation for this class was generated from the following file: