Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vendoring bumps for 25.0 #13074

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/CacheControl.vendor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrade CacheControl to 0.14.1
1 change: 1 addition & 0 deletions news/idna.vendor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrade idna to 3.10
1 change: 1 addition & 0 deletions news/msgpack.vendor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrade msgpack to 1.1.0
1 change: 1 addition & 0 deletions news/packaging.vendor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrade packaging to 24.2
1 change: 1 addition & 0 deletions news/platformdirs.vendor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrade platformdirs to 4.3.6
1 change: 1 addition & 0 deletions news/pyproject-hooks.vendor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrade pyproject-hooks to 1.2.0
1 change: 1 addition & 0 deletions news/rich.vendor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrade rich to 13.9.4
1 change: 1 addition & 0 deletions news/tomli.vendor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrade tomli to 2.0.2
3 changes: 2 additions & 1 deletion src/pip/_vendor/cachecontrol/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

Make it easy to import from cachecontrol without long namespaces.
"""

__author__ = "Eric Larson"
__email__ = "[email protected]"
__version__ = "0.14.0"
__version__ = "0.14.1"

from pip._vendor.cachecontrol.adapter import CacheControlAdapter
from pip._vendor.cachecontrol.controller import CacheController
Expand Down
4 changes: 2 additions & 2 deletions src/pip/_vendor/cachecontrol/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def send(

return resp

def build_response(
def build_response( # type: ignore[override]
self,
request: PreparedRequest,
response: HTTPResponse,
Expand Down Expand Up @@ -143,7 +143,7 @@ def _update_chunk_length(self: HTTPResponse) -> None:
_update_chunk_length, response
)

resp: Response = super().build_response(request, response) # type: ignore[no-untyped-call]
resp: Response = super().build_response(request, response)

# See if we should invalidate the cache.
if request.method in self.invalidating_methods and resp.ok:
Expand Down
1 change: 1 addition & 0 deletions src/pip/_vendor/cachecontrol/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
The cache object API for implementing caches. The default is a thread
safe in-memory dictionary.
"""

from __future__ import annotations

from threading import Lock
Expand Down
2 changes: 1 addition & 1 deletion src/pip/_vendor/cachecontrol/caches/file_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import hashlib
import os
from textwrap import dedent
from typing import IO, TYPE_CHECKING, Union
from typing import IO, TYPE_CHECKING
from pathlib import Path

from pip._vendor.cachecontrol.cache import BaseCache, SeparateBodyBaseCache
Expand Down
1 change: 1 addition & 0 deletions src/pip/_vendor/cachecontrol/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""
The httplib2 algorithms ported for use with requests.
"""

from __future__ import annotations

import calendar
Expand Down
4 changes: 2 additions & 2 deletions src/pip/_vendor/cachecontrol/filewrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ def __init__(
self.__callback = callback

def __getattr__(self, name: str) -> Any:
# The vaguaries of garbage collection means that self.__fp is
# The vagaries of garbage collection means that self.__fp is
# not always set. By using __getattribute__ and the private
# name[0] allows looking up the attribute value and raising an
# AttributeError when it doesn't exist. This stop thigns from
# AttributeError when it doesn't exist. This stop things from
# infinitely recursing calls to getattr in the case where
# self.__fp hasn't been set.
#
Expand Down
5 changes: 4 additions & 1 deletion src/pip/_vendor/cachecontrol/heuristics.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ def update_headers(self, response: HTTPResponse) -> dict[str, str]:

if "expires" not in response.headers:
date = parsedate(response.headers["date"])
expires = expire_after(timedelta(days=1), date=datetime(*date[:6], tzinfo=timezone.utc)) # type: ignore[index,misc]
expires = expire_after(
timedelta(days=1),
date=datetime(*date[:6], tzinfo=timezone.utc), # type: ignore[index,misc]
)
headers["expires"] = datetime_to_header(expires)
headers["cache-control"] = "public"
return headers
Expand Down
3 changes: 2 additions & 1 deletion src/pip/_vendor/idna/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from .package_data import __version__
from .core import (
IDNABidiError,
IDNAError,
Expand All @@ -20,8 +19,10 @@
valid_string_length,
)
from .intranges import intranges_contain
from .package_data import __version__

__all__ = [
"__version__",
"IDNABidiError",
"IDNAError",
"InvalidCodepoint",
Expand Down
58 changes: 31 additions & 27 deletions src/pip/_vendor/idna/codec.py
Original file line number Diff line number Diff line change
@@ -1,49 +1,51 @@
from .core import encode, decode, alabel, ulabel, IDNAError
import codecs
import re
from typing import Any, Tuple, Optional
from typing import Any, Optional, Tuple

_unicode_dots_re = re.compile('[\u002e\u3002\uff0e\uff61]')
from .core import IDNAError, alabel, decode, encode, ulabel

_unicode_dots_re = re.compile("[\u002e\u3002\uff0e\uff61]")

class Codec(codecs.Codec):

def encode(self, data: str, errors: str = 'strict') -> Tuple[bytes, int]:
if errors != 'strict':
raise IDNAError('Unsupported error handling \"{}\"'.format(errors))
class Codec(codecs.Codec):
def encode(self, data: str, errors: str = "strict") -> Tuple[bytes, int]:
if errors != "strict":
raise IDNAError('Unsupported error handling "{}"'.format(errors))

if not data:
return b"", 0

return encode(data), len(data)

def decode(self, data: bytes, errors: str = 'strict') -> Tuple[str, int]:
if errors != 'strict':
raise IDNAError('Unsupported error handling \"{}\"'.format(errors))
def decode(self, data: bytes, errors: str = "strict") -> Tuple[str, int]:
if errors != "strict":
raise IDNAError('Unsupported error handling "{}"'.format(errors))

if not data:
return '', 0
return "", 0

return decode(data), len(data)


class IncrementalEncoder(codecs.BufferedIncrementalEncoder):
def _buffer_encode(self, data: str, errors: str, final: bool) -> Tuple[bytes, int]:
if errors != 'strict':
raise IDNAError('Unsupported error handling \"{}\"'.format(errors))
if errors != "strict":
raise IDNAError('Unsupported error handling "{}"'.format(errors))

if not data:
return b'', 0
return b"", 0

labels = _unicode_dots_re.split(data)
trailing_dot = b''
trailing_dot = b""
if labels:
if not labels[-1]:
trailing_dot = b'.'
trailing_dot = b"."
del labels[-1]
elif not final:
# Keep potentially unfinished label until the next call
del labels[-1]
if labels:
trailing_dot = b'.'
trailing_dot = b"."

result = []
size = 0
Expand All @@ -54,32 +56,33 @@ def _buffer_encode(self, data: str, errors: str, final: bool) -> Tuple[bytes, in
size += len(label)

# Join with U+002E
result_bytes = b'.'.join(result) + trailing_dot
result_bytes = b".".join(result) + trailing_dot
size += len(trailing_dot)
return result_bytes, size


class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
def _buffer_decode(self, data: Any, errors: str, final: bool) -> Tuple[str, int]:
if errors != 'strict':
raise IDNAError('Unsupported error handling \"{}\"'.format(errors))
if errors != "strict":
raise IDNAError('Unsupported error handling "{}"'.format(errors))

if not data:
return ('', 0)
return ("", 0)

if not isinstance(data, str):
data = str(data, 'ascii')
data = str(data, "ascii")

labels = _unicode_dots_re.split(data)
trailing_dot = ''
trailing_dot = ""
if labels:
if not labels[-1]:
trailing_dot = '.'
trailing_dot = "."
del labels[-1]
elif not final:
# Keep potentially unfinished label until the next call
del labels[-1]
if labels:
trailing_dot = '.'
trailing_dot = "."

result = []
size = 0
Expand All @@ -89,7 +92,7 @@ def _buffer_decode(self, data: Any, errors: str, final: bool) -> Tuple[str, int]
size += 1
size += len(label)

result_str = '.'.join(result) + trailing_dot
result_str = ".".join(result) + trailing_dot
size += len(trailing_dot)
return (result_str, size)

Expand All @@ -103,7 +106,7 @@ class StreamReader(Codec, codecs.StreamReader):


def search_function(name: str) -> Optional[codecs.CodecInfo]:
if name != 'idna2008':
if name != "idna2008":
return None
return codecs.CodecInfo(
name=name,
Expand All @@ -115,4 +118,5 @@ def search_function(name: str) -> Optional[codecs.CodecInfo]:
streamreader=StreamReader,
)


codecs.register(search_function)
10 changes: 6 additions & 4 deletions src/pip/_vendor/idna/compat.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
from .core import *
from .codec import *
from typing import Any, Union

from .core import decode, encode


def ToASCII(label: str) -> bytes:
return encode(label)


def ToUnicode(label: Union[bytes, bytearray]) -> str:
return decode(label)

def nameprep(s: Any) -> None:
raise NotImplementedError('IDNA 2008 does not utilise nameprep protocol')

def nameprep(s: Any) -> None:
raise NotImplementedError("IDNA 2008 does not utilise nameprep protocol")
Loading
Loading