|
1 | | -from .api import DomainClassifier, classify_domains |
2 | | -from .data_collector import DataCollector |
3 | | -from .image import ImageClassifier |
4 | | -from .llm.config import LLMConfig |
5 | | -from .llm_classifier import LLMClassifier |
6 | | -from .text import TextClassifier |
| 1 | +""" |
| 2 | +Piedomains: Domain content classification library. |
| 3 | +
|
| 4 | +This module provides lazy imports to avoid dependency issues when |
| 5 | +optional dependencies (like playwright) are not installed. |
| 6 | +""" |
| 7 | + |
| 8 | + |
| 9 | +def __getattr__(name): |
| 10 | + """Lazy import handler for piedomains modules.""" |
| 11 | + if name == "DomainClassifier": |
| 12 | + from .api import DomainClassifier |
| 13 | + |
| 14 | + return DomainClassifier |
| 15 | + elif name == "classify_domains": |
| 16 | + from .api import classify_domains |
| 17 | + |
| 18 | + return classify_domains |
| 19 | + elif name == "DataCollector": |
| 20 | + from .data_collector import DataCollector |
| 21 | + |
| 22 | + return DataCollector |
| 23 | + elif name == "TextClassifier": |
| 24 | + from .text import TextClassifier |
| 25 | + |
| 26 | + return TextClassifier |
| 27 | + elif name == "ImageClassifier": |
| 28 | + from .image import ImageClassifier |
| 29 | + |
| 30 | + return ImageClassifier |
| 31 | + elif name == "LLMClassifier": |
| 32 | + from .llm_classifier import LLMClassifier |
| 33 | + |
| 34 | + return LLMClassifier |
| 35 | + elif name == "LLMConfig": |
| 36 | + from .llm.config import LLMConfig |
| 37 | + |
| 38 | + return LLMConfig |
| 39 | + else: |
| 40 | + raise AttributeError(f"module '{__name__}' has no attribute '{name}'") |
| 41 | + |
7 | 42 |
|
8 | 43 | __all__ = [ |
9 | 44 | "DomainClassifier", |
|
0 commit comments