Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
pip._internal.models.direct_url Namespace Reference

Data Structures

class  ArchiveInfo
 
class  DirectUrl
 
class  DirectUrlValidationError
 
class  DirInfo
 
class  VcsInfo
 

Functions

Optional[T_get (Dict[str, Any] d, Type[T] expected_type, str key, Optional[T] default=None)
 
T _get_required (Dict[str, Any] d, Type[T] expected_type, str key, Optional[T] default=None)
 
"InfoType" _exactly_one_of (Iterable[Optional["InfoType"]] infos)
 
Dict[str, Any] _filter_none (**Any kwargs)
 

Variables

 T = TypeVar("T")
 
str DIRECT_URL_METADATA_NAME = "direct_url.json"
 
 ENV_VAR_RE = re.compile(r"^\$\{[A-Za-z0-9-_]+\}(:\$\{[A-Za-z0-9-_]+\})?$")
 
 InfoType = Union[ArchiveInfo, DirInfo, VcsInfo]
 

Detailed Description

 PEP 610 

Function Documentation

◆ _exactly_one_of()

"InfoType" _exactly_one_of ( Iterable[Optional["InfoType"]]  infos)
protected

Definition at line 50 of file direct_url.py.

50def _exactly_one_of(infos: Iterable[Optional["InfoType"]]) -> "InfoType":
51 infos = [info for info in infos if info is not None]
52 if not infos:
53 raise DirectUrlValidationError(
54 "missing one of archive_info, dir_info, vcs_info"
55 )
56 if len(infos) > 1:
57 raise DirectUrlValidationError(
58 "more than one of archive_info, dir_info, vcs_info"
59 )
60 assert infos[0] is not None
61 return infos[0]
62
63
for i

References i.

Referenced by DirectUrl.from_dict().

Here is the caller graph for this function:

◆ _filter_none()

Dict[str, Any] _filter_none ( **Any  kwargs)
protected
Make dict excluding None values.

Definition at line 64 of file direct_url.py.

64def _filter_none(**kwargs: Any) -> Dict[str, Any]:
65 """Make dict excluding None values."""
66 return {k: v for k, v in kwargs.items() if v is not None}
67
68

References i.

Referenced by VcsInfo._to_dict(), ArchiveInfo._to_dict(), DirInfo._to_dict(), and DirectUrl.to_dict().

Here is the caller graph for this function:

◆ _get()

Optional[T] _get ( Dict[str, Any]  d,
Type[T expected_type,
str  key,
Optional[T]   default = None 
)
protected
Get value from dictionary and verify expected type.

Definition at line 25 of file direct_url.py.

27) -> Optional[T]:
28 """Get value from dictionary and verify expected type."""
29 if key not in d:
30 return default
31 value = d[key]
32 if not isinstance(value, expected_type):
33 raise DirectUrlValidationError(
34 "{!r} has unexpected type for {} (expected {})".format(
35 value, key, expected_type
36 )
37 )
38 return value
39
40

Referenced by VcsInfo._from_dict(), ArchiveInfo._from_dict(), pip._internal.models.direct_url._get_required(), and DirectUrl.from_dict().

Here is the caller graph for this function:

◆ _get_required()

T _get_required ( Dict[str, Any]  d,
Type[T expected_type,
str  key,
Optional[T]   default = None 
)
protected

Definition at line 41 of file direct_url.py.

43) -> T:
44 value = _get(d, expected_type, key, default)
45 if value is None:
46 raise DirectUrlValidationError(f"{key} must have a value")
47 return value
48
49

References pip._internal.models.direct_url._get().

Referenced by VcsInfo._from_dict(), DirInfo._from_dict(), and DirectUrl.from_dict().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ DIRECT_URL_METADATA_NAME

str DIRECT_URL_METADATA_NAME = "direct_url.json"

Definition at line 17 of file direct_url.py.

◆ ENV_VAR_RE

ENV_VAR_RE = re.compile(r"^\$\{[A-Za-z0-9-_]+\}(:\$\{[A-Za-z0-9-_]+\})?$")

Definition at line 18 of file direct_url.py.

◆ InfoType

InfoType = Union[ArchiveInfo, DirInfo, VcsInfo]

Definition at line 163 of file direct_url.py.

◆ T

T = TypeVar("T")

Definition at line 15 of file direct_url.py.