Coverage for src/local_deep_research/content_fetcher/__init__.py: 100%
10 statements
« prev ^ index » next coverage.py v7.15.1, created at 2026-07-19 23:35 +0000
« prev ^ index » next coverage.py v7.15.1, created at 2026-07-19 23:35 +0000
1"""
2Content Fetcher Module.
4Provides unified content fetching from various sources:
5- Academic papers (arXiv, PubMed, Semantic Scholar, bioRxiv)
6- Web pages (HTML)
7- Direct PDF links
9Usage:
10 from local_deep_research.content_fetcher import ContentFetcher
12 fetcher = ContentFetcher()
13 result = fetcher.fetch("https://arxiv.org/abs/2301.12345")
14 print(result["content"])
15"""
17from .url_classifier import URLClassifier, URLType
19__all__ = ["ContentFetcher", "URLClassifier", "URLType"]
22def __getattr__(name):
23 """Lazily resolve ``ContentFetcher`` on first attribute access.
25 ``fetcher`` transitively pulls in the full web/DB stack
26 (requests, playwright, … via ``research_library.downloaders``).
27 Deferring the import lets
28 ``from ...content_fetcher.url_classifier import URLClassifier``
29 stay cheap and lets minimal test setups import the package
30 without that dependency tree. See issue #4992.
31 """
32 if name == "ContentFetcher":
33 from .fetcher import ContentFetcher as _ContentFetcher
35 globals()["ContentFetcher"] = _ContentFetcher
36 return _ContentFetcher
37 raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
40def __dir__():
41 """Expose lazily-resolved names to ``dir()`` and tab completion."""
42 return sorted(set(globals()) | {"ContentFetcher"})