SILENT KILLERPanel

Current Path: > > opt > alt > python311 > lib > python3.11 > site-packages > pip > _internal > models


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: //opt/alt/python311/lib/python3.11/site-packages/pip/_internal/models

NameTypeSizeLast ModifiedActions
__pycache__ Directory - -
__init__.py File 63 bytes November 13 2023 22:00:31.
candidate.py File 990 bytes November 13 2023 22:00:31.
direct_url.py File 6350 bytes November 13 2023 22:00:31.
format_control.py File 2520 bytes November 13 2023 22:00:31.
index.py File 1030 bytes November 13 2023 22:00:31.
link.py File 9817 bytes November 13 2023 22:00:31.
scheme.py File 738 bytes November 13 2023 22:00:31.
search_scope.py File 4520 bytes November 13 2023 22:00:31.
selection_prefs.py File 1907 bytes November 13 2023 22:00:31.
target_python.py File 3858 bytes November 13 2023 22:00:31.
wheel.py File 3500 bytes November 13 2023 22:00:31.

Reading File: //opt/alt/python311/lib/python3.11/site-packages/pip/_internal/models/format_control.py

from typing import FrozenSet, Optional, Set

from pip._vendor.packaging.utils import canonicalize_name

from pip._internal.exceptions import CommandError


class FormatControl:
    """Helper for managing formats from which a package can be installed."""

    __slots__ = ["no_binary", "only_binary"]

    def __init__(
        self,
        no_binary: Optional[Set[str]] = None,
        only_binary: Optional[Set[str]] = None,
    ) -> None:
        if no_binary is None:
            no_binary = set()
        if only_binary is None:
            only_binary = set()

        self.no_binary = no_binary
        self.only_binary = only_binary

    def __eq__(self, other: object) -> bool:
        if not isinstance(other, self.__class__):
            return NotImplemented

        if self.__slots__ != other.__slots__:
            return False

        return all(getattr(self, k) == getattr(other, k) for k in self.__slots__)

    def __repr__(self) -> str:
        return "{}({}, {})".format(
            self.__class__.__name__, self.no_binary, self.only_binary
        )

    @staticmethod
    def handle_mutual_excludes(value: str, target: Set[str], other: Set[str]) -> None:
        if value.startswith("-"):
            raise CommandError(
                "--no-binary / --only-binary option requires 1 argument."
            )
        new = value.split(",")
        while ":all:" in new:
            other.clear()
            target.clear()
            target.add(":all:")
            del new[: new.index(":all:") + 1]
            # Without a none, we want to discard everything as :all: covers it
            if ":none:" not in new:
                return
        for name in new:
            if name == ":none:":
                target.clear()
                continue
            name = canonicalize_name(name)
            other.discard(name)
            target.add(name)

    def get_allowed_formats(self, canonical_name: str) -> FrozenSet[str]:
        result = {"binary", "source"}
        if canonical_name in self.only_binary:
            result.discard("source")
        elif canonical_name in self.no_binary:
            result.discard("binary")
        elif ":all:" in self.only_binary:
            result.discard("source")
        elif ":all:" in self.no_binary:
            result.discard("binary")
        return frozenset(result)

    def disallow_binaries(self) -> None:
        self.handle_mutual_excludes(
            ":all:",
            self.no_binary,
            self.only_binary,
        )

SILENT KILLER Tool