Bump importlib-metadata from 8.2.0 to 8.5.0 (#2397)

* Bump importlib-metadata from 8.2.0 to 8.5.0

Bumps [importlib-metadata](https://github.com/python/importlib_metadata) from 8.2.0 to 8.5.0.
- [Release notes](https://github.com/python/importlib_metadata/releases)
- [Changelog](https://github.com/python/importlib_metadata/blob/main/NEWS.rst)
- [Commits](https://github.com/python/importlib_metadata/compare/v8.2.0...v8.5.0)

---
updated-dependencies:
- dependency-name: importlib-metadata
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update importlib-metadata==8.5.0

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>

[skip ci]
This commit is contained in:
dependabot[bot] 2024-11-16 14:48:53 -08:00 committed by GitHub
parent 01589cb8b0
commit e69852fa0e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 82 additions and 37 deletions

View file

@ -1,24 +1,34 @@
"""
APIs exposing metadata from third-party Python packages.
This codebase is shared between importlib.metadata in the stdlib
and importlib_metadata in PyPI. See
https://github.com/python/importlib_metadata/wiki/Development-Methodology
for more detail.
"""
from __future__ import annotations from __future__ import annotations
import os
import re
import abc import abc
import sys import collections
import json
import zipp
import email import email
import types
import inspect
import pathlib
import operator
import textwrap
import functools import functools
import itertools import itertools
import operator
import os
import pathlib
import posixpath import posixpath
import collections import re
import sys
import textwrap
import types
from contextlib import suppress
from importlib import import_module
from importlib.abc import MetaPathFinder
from itertools import starmap
from typing import Any, Iterable, List, Mapping, Match, Optional, Set, cast
from . import _meta from . import _meta
from .compat import py39, py311
from ._collections import FreezableDefaultDict, Pair from ._collections import FreezableDefaultDict, Pair
from ._compat import ( from ._compat import (
NullFinder, NullFinder,
@ -27,12 +37,7 @@ from ._compat import (
from ._functools import method_cache, pass_none from ._functools import method_cache, pass_none
from ._itertools import always_iterable, bucket, unique_everseen from ._itertools import always_iterable, bucket, unique_everseen
from ._meta import PackageMetadata, SimplePath from ._meta import PackageMetadata, SimplePath
from .compat import py39, py311
from contextlib import suppress
from importlib import import_module
from importlib.abc import MetaPathFinder
from itertools import starmap
from typing import Any, Iterable, List, Mapping, Match, Optional, Set, cast
__all__ = [ __all__ = [
'Distribution', 'Distribution',
@ -58,7 +63,7 @@ class PackageNotFoundError(ModuleNotFoundError):
return f"No package metadata was found for {self.name}" return f"No package metadata was found for {self.name}"
@property @property
def name(self) -> str: # type: ignore[override] def name(self) -> str: # type: ignore[override] # make readonly
(name,) = self.args (name,) = self.args
return name return name
@ -227,9 +232,26 @@ class EntryPoint:
>>> ep.matches(attr='bong') >>> ep.matches(attr='bong')
True True
""" """
self._disallow_dist(params)
attrs = (getattr(self, param) for param in params) attrs = (getattr(self, param) for param in params)
return all(map(operator.eq, params.values(), attrs)) return all(map(operator.eq, params.values(), attrs))
@staticmethod
def _disallow_dist(params):
"""
Querying by dist is not allowed (dist objects are not comparable).
>>> EntryPoint(name='fan', value='fav', group='fag').matches(dist='foo')
Traceback (most recent call last):
...
ValueError: "dist" is not suitable for matching...
"""
if "dist" in params:
raise ValueError(
'"dist" is not suitable for matching. '
"Instead, use Distribution.entry_points.select() on a "
"located distribution."
)
def _key(self): def _key(self):
return self.name, self.value, self.group return self.name, self.value, self.group
@ -259,7 +281,7 @@ class EntryPoints(tuple):
__slots__ = () __slots__ = ()
def __getitem__(self, name: str) -> EntryPoint: # type: ignore[override] def __getitem__(self, name: str) -> EntryPoint: # type: ignore[override] # Work with str instead of int
""" """
Get the EntryPoint in self matching name. Get the EntryPoint in self matching name.
""" """
@ -315,7 +337,7 @@ class PackagePath(pathlib.PurePosixPath):
size: int size: int
dist: Distribution dist: Distribution
def read_text(self, encoding: str = 'utf-8') -> str: # type: ignore[override] def read_text(self, encoding: str = 'utf-8') -> str:
return self.locate().read_text(encoding=encoding) return self.locate().read_text(encoding=encoding)
def read_binary(self) -> bytes: def read_binary(self) -> bytes:
@ -373,6 +395,17 @@ class Distribution(metaclass=abc.ABCMeta):
""" """
Given a path to a file in this distribution, return a SimplePath Given a path to a file in this distribution, return a SimplePath
to it. to it.
This method is used by callers of ``Distribution.files()`` to
locate files within the distribution. If it's possible for a
Distribution to represent files in the distribution as
``SimplePath`` objects, it should implement this method
to resolve such objects.
Some Distribution providers may elect not to resolve SimplePath
objects within the distribution by raising a
NotImplementedError, but consumers of such a Distribution would
be unable to invoke ``Distribution.files()``.
""" """
@classmethod @classmethod
@ -639,6 +672,9 @@ class Distribution(metaclass=abc.ABCMeta):
return self._load_json('direct_url.json') return self._load_json('direct_url.json')
def _load_json(self, filename): def _load_json(self, filename):
# Deferred for performance (python/importlib_metadata#503)
import json
return pass_none(json.loads)( return pass_none(json.loads)(
self.read_text(filename), self.read_text(filename),
object_hook=lambda data: types.SimpleNamespace(**data), object_hook=lambda data: types.SimpleNamespace(**data),
@ -723,7 +759,7 @@ class FastPath:
True True
""" """
@functools.lru_cache() # type: ignore @functools.lru_cache() # type: ignore[misc]
def __new__(cls, root): def __new__(cls, root):
return super().__new__(cls) return super().__new__(cls)
@ -741,7 +777,10 @@ class FastPath:
return [] return []
def zip_children(self): def zip_children(self):
zip_path = zipp.Path(self.root) # deferred for performance (python/importlib_metadata#502)
from zipp.compat.overlay import zipfile
zip_path = zipfile.Path(self.root)
names = zip_path.root.namelist() names = zip_path.root.namelist()
self.joinpath = zip_path.joinpath self.joinpath = zip_path.joinpath
@ -1078,11 +1117,10 @@ def _get_toplevel_name(name: PackagePath) -> str:
>>> _get_toplevel_name(PackagePath('foo.dist-info')) >>> _get_toplevel_name(PackagePath('foo.dist-info'))
'foo.dist-info' 'foo.dist-info'
""" """
return _topmost(name) or ( # Defer import of inspect for performance (python/cpython#118761)
# python/typeshed#10328 import inspect
inspect.getmodulename(name) # type: ignore
or str(name) return _topmost(name) or inspect.getmodulename(name) or str(name)
)
def _top_level_inferred(dist): def _top_level_inferred(dist):

View file

@ -1,6 +1,6 @@
import email.message
import re import re
import textwrap import textwrap
import email.message
from ._text import FoldedCase from ._text import FoldedCase

View file

@ -1,6 +1,5 @@
import sys
import platform import platform
import sys
__all__ = ['install', 'NullFinder'] __all__ = ['install', 'NullFinder']

View file

@ -1,5 +1,5 @@
import types
import functools import functools
import types
# from jaraco.functools 3.3 # from jaraco.functools 3.3

View file

@ -1,9 +1,17 @@
from __future__ import annotations from __future__ import annotations
import os import os
from typing import Protocol from typing import (
from typing import Any, Dict, Iterator, List, Optional, TypeVar, Union, overload Any,
Dict,
Iterator,
List,
Optional,
Protocol,
TypeVar,
Union,
overload,
)
_T = TypeVar("_T") _T = TypeVar("_T")

View file

@ -1,6 +1,6 @@
apscheduler==3.10.1 apscheduler==3.10.1
cryptography==43.0.0 cryptography==43.0.0
importlib-metadata==8.2.0 importlib-metadata==8.5.0
importlib-resources==6.4.5 importlib-resources==6.4.5
pyinstaller==6.8.0 pyinstaller==6.8.0
pyopenssl==24.2.1 pyopenssl==24.2.1

View file

@ -16,7 +16,7 @@ gntp==1.0.3
html5lib==1.1 html5lib==1.1
httpagentparser==1.9.5 httpagentparser==1.9.5
idna==3.7 idna==3.7
importlib-metadata==8.2.0 importlib-metadata==8.5.0
importlib-resources==6.4.5 importlib-resources==6.4.5
git+https://github.com/Tautulli/ipwhois.git@master#egg=ipwhois git+https://github.com/Tautulli/ipwhois.git@master#egg=ipwhois
IPy==1.01 IPy==1.01