$81 GRAYBYTE WORDPRESS FILE MANAGER $77

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.180
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/opt/imunify360/venv/lib/python3.11/site-packages/pip/_internal/models/

HOME
Current File : /opt/imunify360/venv/lib/python3.11/site-packages/pip/_internal/models//format_control.py
from __future__ import annotations

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: set[str] | None = None,
        only_binary: set[str] | None = 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 f"{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,
        )


Current_dir [ NOT WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
3 Mar 2026 8.59 AM
root / root
0755
__pycache__
--
3 Mar 2026 8.59 AM
root / root
0755
__init__.py
0.061 KB
13 Feb 2026 12.40 PM
root / root
0644
candidate.py
0.735 KB
13 Feb 2026 12.40 PM
root / root
0644
direct_url.py
6.401 KB
13 Feb 2026 12.40 PM
root / root
0644
format_control.py
2.413 KB
13 Feb 2026 12.40 PM
root / root
0644
index.py
1.006 KB
13 Feb 2026 12.40 PM
root / root
0644
installation_report.py
2.772 KB
13 Feb 2026 12.40 PM
root / root
0644
link.py
21.477 KB
13 Feb 2026 12.40 PM
root / root
0644
release_control.py
3.323 KB
13 Feb 2026 12.40 PM
root / root
0644
scheme.py
0.562 KB
13 Feb 2026 12.40 PM
root / root
0644
search_scope.py
4.401 KB
13 Feb 2026 12.40 PM
root / root
0644
selection_prefs.py
2.169 KB
13 Feb 2026 12.40 PM
root / root
0644
target_python.py
4.144 KB
13 Feb 2026 12.40 PM
root / root
0644
wheel.py
2.852 KB
13 Feb 2026 12.40 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF