55
66from __future__ import annotations
77
8+ import functools
89import re
910import urllib .parse
1011from collections .abc import Mapping
1920from packaging .specifiers import Specifier
2021
2122from .paths import PYPROJECT_PATH , STUBS_PATH , distribution_path
22- from .utils import cache
2323
2424__all__ = [
2525 "NoSuchStubError" ,
@@ -42,7 +42,7 @@ def _is_list_of_strings(obj: object) -> TypeGuard[list[str]]:
4242 return isinstance (obj , list ) and all (isinstance (item , str ) for item in obj )
4343
4444
45- @cache
45+ @functools . cache
4646def _get_oldest_supported_python () -> str :
4747 with PYPROJECT_PATH .open ("rb" ) as config :
4848 val = tomli .load (config )["tool" ]["typeshed" ]["oldest_supported_python" ]
@@ -79,7 +79,7 @@ def system_requirements_for_platform(self, platform: str) -> list[str]:
7979 return ret
8080
8181
82- @cache
82+ @functools . cache
8383def read_stubtest_settings (distribution : str ) -> StubtestSettings :
8484 """Return an object describing the stubtest settings for a single stubs distribution."""
8585 with metadata_path (distribution ).open ("rb" ) as f :
@@ -187,7 +187,7 @@ class NoSuchStubError(ValueError):
187187 """Raise NoSuchStubError to indicate that a stubs/{distribution} directory doesn't exist."""
188188
189189
190- @cache
190+ @functools . cache
191191def read_metadata (distribution : str ) -> StubMetadata :
192192 """Return an object describing the metadata of a stub as given in the METADATA.toml file.
193193
@@ -328,12 +328,12 @@ class PackageDependencies(NamedTuple):
328328 external_pkgs : tuple [Requirement , ...]
329329
330330
331- @cache
331+ @functools . cache
332332def get_pypi_name_to_typeshed_name_mapping () -> Mapping [str , str ]:
333333 return {read_metadata (stub_dir .name ).stub_distribution : stub_dir .name for stub_dir in STUBS_PATH .iterdir ()}
334334
335335
336- @cache
336+ @functools . cache
337337def read_dependencies (distribution : str ) -> PackageDependencies :
338338 """Read the dependencies listed in a METADATA.toml file for a stubs package.
339339
@@ -360,7 +360,7 @@ def read_dependencies(distribution: str) -> PackageDependencies:
360360 return PackageDependencies (tuple (typeshed ), tuple (external ))
361361
362362
363- @cache
363+ @functools . cache
364364def get_recursive_requirements (package_name : str ) -> PackageDependencies :
365365 """Recursively gather dependencies for a single stubs package.
366366
0 commit comments