MCPcopy Index your code
hub / github.com/SourceCode-AI/aura / from_cached

Method from_cached

aura/package.py:53–72  ·  view source on GitHub ↗
(cls, name: str, *args, **kwargs)

Source from the content-addressed store, hash-verified

51
52 @classmethod
53 def from_cached(cls, name: str, *args, **kwargs):
54 name = canonicalize_name(name)
55
56 if cls.mirror.get_mirror_path():
57 try:
58 kwargs["info"] = cls.mirror.get_json(name)
59 kwargs["source"] = "local_mirror"
60 return cls(name, *args, **kwargs)
61 except NoSuchPackage:
62 pass
63
64 try:
65 resp = cache.URLCache.proxy(url=f"https://pypi.org/pypi/{name}/json", tags=["pypi_json"])
66 except requests.exceptions.HTTPError as exc:
67 raise NoSuchPackage(f"`{name}` on PyPI repository") from exc
68
69 kwargs["info"] = loads(resp)
70 kwargs["source"] = "pypi"
71
72 return cls(name, *args, **kwargs)
73
74 @classmethod
75 def list_packages(cls):

Callers 11

test_package_infoFunction · 0.80
test_package_retrievalFunction · 0.80
__init__Method · 0.80
enumeratorFunction · 0.80
check_outdatedFunction · 0.80
analyzeFunction · 0.80
analyzer_poetry_lockFunction · 0.80
__init__Method · 0.80
__init__Method · 0.80

Calls 4

NoSuchPackageClass · 0.85
get_mirror_pathMethod · 0.80
get_jsonMethod · 0.80
proxyMethod · 0.45

Tested by 4

test_package_infoFunction · 0.64
test_package_retrievalFunction · 0.64