Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
pip._vendor.packaging.specifiers Namespace Reference

Data Structures

class  _IndividualSpecifier
 
class  BaseSpecifier
 
class  InvalidSpecifier
 
class  LegacySpecifier
 
class  Specifier
 
class  SpecifierSet
 

Functions

Callable[["Specifier", ParsedVersion, str], bool] _require_version_compare (Callable[["Specifier", ParsedVersion, str], bool] fn)
 
List[str] _version_split (str version)
 
bool _is_not_suffix (str segment)
 
Tuple[List[str], List[str]] _pad_version (List[str] left, List[str] right)
 

Variables

 ParsedVersion = Union[Version, LegacyVersion]
 
 UnparsedVersion = Union[Version, LegacyVersion, str]
 
 VersionTypeVar = TypeVar("VersionTypeVar", bound=UnparsedVersion)
 
 CallableOperator = Callable[[ParsedVersion, str], bool]
 
 _prefix_regex = re.compile(r"^([0-9]+)((?:a|b|c|rc)[0-9]+)$")
 

Function Documentation

◆ _is_not_suffix()

bool _is_not_suffix ( str  segment)
protected

Definition at line 596 of file specifiers.py.

596def _is_not_suffix(segment: str) -> bool:
597 return not any(
598 segment.startswith(prefix) for prefix in ("dev", "a", "b", "rc", "post")
599 )
600
601
for i

References i.

◆ _pad_version()

Tuple[List[str], List[str]] _pad_version ( List[str]  left,
List[str]  right 
)
protected

Definition at line 602 of file specifiers.py.

602def _pad_version(left: List[str], right: List[str]) -> Tuple[List[str], List[str]]:
603 left_split, right_split = [], []
604
605 # Get the release segment of our versions
606 left_split.append(list(itertools.takewhile(lambda x: x.isdigit(), left)))
607 right_split.append(list(itertools.takewhile(lambda x: x.isdigit(), right)))
608
609 # Get the rest of our versions
610 left_split.append(left[len(left_split[0]) :])
611 right_split.append(right[len(right_split[0]) :])
612
613 # Insert our padding
614 left_split.insert(1, ["0"] * max(0, len(right_split[0]) - len(left_split[0])))
615 right_split.insert(1, ["0"] * max(0, len(left_split[0]) - len(right_split[0])))
616
617 return (list(itertools.chain(*left_split)), list(itertools.chain(*right_split)))
618
619

References i.

Referenced by Specifier._compare_equal().

Here is the caller graph for this function:

◆ _require_version_compare()

Callable[["Specifier", ParsedVersion, str], bool] _require_version_compare ( Callable[["Specifier", ParsedVersion, str], bool]   fn)
protected

Definition at line 287 of file specifiers.py.

289) -> Callable[["Specifier", ParsedVersion, str], bool]:
290 @functools.wraps(fn)
291 def wrapped(self: "Specifier", prospective: ParsedVersion, spec: str) -> bool:
292 if not isinstance(prospective, Version):
293 return False
294 return fn(self, prospective, spec)
295
296 return wrapped
297
298

References i.

◆ _version_split()

List[str] _version_split ( str  version)
protected

Definition at line 585 of file specifiers.py.

585def _version_split(version: str) -> List[str]:
586 result: List[str] = []
587 for item in version.split("."):
588 match = _prefix_regex.search(item)
589 if match:
591 else:
592 result.append(item)
593 return result
594
595

References i.

Referenced by Specifier._compare_compatible(), and Specifier._compare_equal().

Here is the caller graph for this function:

Variable Documentation

◆ _prefix_regex

_prefix_regex = re.compile(r"^([0-9]+)((?:a|b|c|rc)[0-9]+)$")
protected

Definition at line 582 of file specifiers.py.

◆ CallableOperator

CallableOperator = Callable[[ParsedVersion, str], bool]

Definition at line 30 of file specifiers.py.

◆ ParsedVersion

ParsedVersion = Union[Version, LegacyVersion]

Definition at line 27 of file specifiers.py.

◆ UnparsedVersion

UnparsedVersion = Union[Version, LegacyVersion, str]

Definition at line 28 of file specifiers.py.

◆ VersionTypeVar

VersionTypeVar = TypeVar("VersionTypeVar", bound=UnparsedVersion)

Definition at line 29 of file specifiers.py.