Normal
     =ˆÕÔß516ÓÂÜ     =‹      Å•QoÚ0…ßû+<?ì�\B i­ã‰¤¢Q@4Ó4M{pbC¬'²ÝQúëgH¶¦lÝ„ØS®“ã“ó][6yÍ†ñ—ù]Ç74ÿôa2"Üø¢8ª>t½¶0šb„3kËK€Ífãm¯Ð+ˆ�ÙuÞcµL­Ç-Çô‚ìÞÑD2Á¸{"b¥Í+.P±DPÜ[#¹èB.X€‘V´\©™ÞB|íqfd"/	T3�Ôf$)øv÷ÿŸüÜ´} –ìmw¥¦Äfè;ËåJ…Ø%¦D®WÈè4Ä ÓBHr¦î¼•\bÄrâ¯ãáì›Ó�Ív³)a(Óbâ÷Ãpz5#L§l-°Ãš§`:aÆ¢uÁåR
~T|[‰oåãqÃ¨ÒDÂ¤Z–VêI
±‰š¹)™cí9‚L7U•„ÿ©,}ÖŒù`1šÆÑxQµ„ï,žÒ½ju0�3-”E‘Ô"µ…ÞÖù+³·*1åÕÏ!ªÓi¹Ê,¦µÐAå_ Ý«;UlT“Êuì Ï@í7¦uÑú"Y§Ýé´ÚÝVÐF~ï2è#tDèw;çD¨»îiž`ÚœþÇÿ‚òÐD9Éªýwç\çÃŒ0.½Á´18ÉëçD)™Íj�_å)0:~ÿ7¯<ã >ý	ìïÕ}õì®«#    8   ?ˆl–Ðz¾”ê_)%‚fãaS�ÿ�þ[N,Ü qº)üÿá„@à¿àÚÃÝ ?÷     ?"""Exceptions used throughout package.

This module MUST NOT try to import from anything within `pipenv.patched.pip._internal` to
operate. This is expected to be importable from any/all files within the
subpackage and, thus, should not depend on them.
"""

import configparser
import re
from itertools import chain, groupby, repeat
from typing import TYPE_CHECKING, Dict, List, Optional, Union

from pipenv.patched.pip._vendor.requests.models import Request, Response
from pipenv.patched.pip._vendor.rich.console import Console, ConsoleOptions, RenderResult
from pipenv.patched.pip._vendor.rich.markup import escape
from pipenv.patched.pip._vendor.rich.text import Text

if TYPE_CHECKING:
    from hashlib import _Hash
    from typing import Literal

    from pipenv.patched.pip._internal.metadata import BaseDistribution
    from pipenv.patched.pip._internal.req.req_install import InstallRequirement


#
# Scaffolding
#
def _is_kebab_case(s: str) -> bool:
    return re.match(r"^[a-z]+(-[a-z]+)*$", s) is not None


def _prefix_with_indent(
    s: Union[Text, str],
    console: Console,
    *,
    prefix: str,
    indent: str,
) -> Text:
    if isinstance(s, Text):
        text = s
    else:
        text = console.render_str(s)

    return console.render_str(prefix, overflow="ignore") + console.render_str(
        f"\n{indent}", overflow="ignore"
    ).join(text.split(allow_blank=True))


class PipError(Exception):
    """The base pip error."""


class DiagnosticPipError(PipError):
    """An error, that presents diagnostic information to the user.

    This contains a bunch of logic, to enable pretty presentation of our error
    messages. Each error gets a unique reference. Each error can also include
    additional context, a hint and/or a note -- which are presented with the
    main error message in a consistent style.

    This is adapted from the error output styling in `sphinx-theme-builder`.
    """

    reference: str

    def __init__(
        self,
        *,
        kind: 'Literal["error", "warning"]' = "error",
        reference: Optional[str] = None,
        message: Union[str, Text],
        context: Optional[Union[str, Text]],
        hint_stmt: Optional[Union[str, Text]],
        note_stmt: Optional[Union[str, Text]] = None,
        link: Optional[str] = None,
    ) -> None:
        # Ensure a proper reference is provided.
        if reference is None:
            assert hasattr(self, "reference"), "error reference not provided!"
            reference = self.reference
        assert _is_kebab_case(reference), "error reference must be kebab-case!"

        self.kind = kind
        self.reference = reference

        self.message = message
        self.context = context

        self.note_stmt = note_stmt
        self.hint_stmt = hint_stmt

        self.link = link

        super().__init__(f"<{self.__class__.__name__}: {self.reference}>")

    def __repr__(self) -> str:
        return (
            f"<{self.__class__.__name__}("
            f"reference={self.reference!r}, "
            f"message={self.message!r}, "
            f"context={self.context!r}, "
            f"note_stmt={self.note_stmt!r}, "
            f"hint_stmt={self.hint_stmt!r}"
            ")>"
        )

    def __rich_console__(
        self,
        console: Console,
        options: ConsoleOptions,
    ) -> RenderResult:
        colour = "red" if self.kind == "error" else "yellow"

        yield f"[{colour} bold]{self.kind}[/]: [bol