"""Common ResourceGetter patterns.""" from __future__ import annotations from typing import Any from python_pdp_sdk.protocols import ResourceGetter class ForwardKwargsGetter(ResourceGetter): """Forwards any kwargs as attributes.""" def __init__(self) -> None: """Create ForwardKwargsGetter.""" pass def get_attributes( self, *args: Any, **kwargs: Any, ) -> dict[str, Any]: """Return kwargs as attributes.""" return kwargs class MockResourceGetter(ResourceGetter): """Returns constructor attributes as attributes.""" def __init__(self, attributes: dict[str, Any]) -> None: """Create MockResourceGetter. Args: attributes: these will be passed back """ self.attributes = attributes def get_attributes( self, *args: Any, **kwargs: Any, ) -> dict[str, Any]: """Return constructor's attributes.""" return self.attributes