Coverage for src/usaspending/resources/base_resource.py: 100%
11 statements
« prev ^ index » next coverage.py v7.10.6, created at 2025-09-03 17:15 -0700
« prev ^ index » next coverage.py v7.10.6, created at 2025-09-03 17:15 -0700
1from __future__ import annotations
2from typing import TYPE_CHECKING
4from ..logging_config import USASpendingLogger
6if TYPE_CHECKING:
7 from ..client import USASpending
9logger = USASpendingLogger.get_logger(__name__)
12class BaseResource:
13 """Base class for API resources.
15 Resources provide structured gateways to USASpending API endpoints
16 and return appropriate query builders or model instances.
17 """
19 def __init__(self, client: USASpending):
20 """Initialize resource with client reference.
22 Args:
23 client: USASpending client instance
24 """
25 self._client: USASpending = client
26 logger.debug(f"Initialized {self.__class__.__name__} resource")
28 @property
29 def client(self) -> USASpending:
30 """Get client instance."""
31 return self._client