"""Stub file for common directory."""
from typing import Any, Callable, Optional

# Constants
logger: Any = ...  # From device
ModelLoaderCallable: Any = ...  # From model_loading

# Functions
# From device
def move_to_device(model: Any, device: Any.Any) -> Any.Any:
    """
    Move a model to the target device.
    
        Args:
            model: Torch model or wrapper object with ``.model`` attribute.
            device: Target device.
    
        Returns:
            The device used for placement.
    """
    ...

# From device
def prepare_torch_model_for_inference(model: Any.Any.Any, device: Any.Any | None = None) -> Any.Any.Any:
    """
    Move model to device and set eval mode for inference.
    
        Args:
            model: Torch module to prepare.
            device: Optional explicit target device.
    
        Returns:
            Inference-ready model on the resolved device.
    """
    ...

# From device
def resolve_device(preferred: str = 'cuda') -> Any.Any:
    """
    Select the best available compute device.
    
        Args:
            preferred: Requested device key (``cuda``, ``mps``, or ``cpu``).
    
        Returns:
            Resolved ``torch.device`` value.
    """
    ...

# From device
def resolve_torch_device() -> Any.Any:
    """
    Resolve the best available torch inference device.
    
        Args:
            None.
    
        Returns:
            ``torch.device("cuda")`` when available, otherwise CPU.
    """
    ...

# From model_loading
def load_model_with_runtime(action_tracker: Any, runtime_framework: str, loaders: dict[str, Any], default_key: str = 'pytorch') -> Any:
    """
    Load model using runtime descriptor with alias and fallback support.
    
        Args:
            action_tracker: Tracker-like object passed to selected loader.
            runtime_framework: Runtime descriptor string requested by caller.
            loaders: Mapping of runtime keys to loader callables.
            default_key: Default loader key used when runtime is ambiguous.
    
        Returns:
            Loaded model artifact from selected loader.
    """
    ...

# From model_loading
def load_model_with_strategies(action_tracker: Any, strategies: Any) -> Any:
    """
    Load model using checkpoint, predefined, then scratch fallback order.
    
        Args:
            action_tracker: Tracker-like object exposing ``get_checkpoint_path``.
            strategies: Strategy callbacks for each loading branch.
    
        Returns:
            Loaded model artifact from the first available strategy.
    """
    ...

# From splits
def build_split_loader_map(requested_splits: Any[str], train_loader: Any | None, val_loader: Any | None, test_loader: Any | None) -> dict[str, Any]:
    """
    Build split-to-loader map while skipping unavailable loaders.
    
        Args:
            requested_splits: Ordered split names requested by caller.
            train_loader: Optional loader for ``train`` split.
            val_loader: Optional loader for ``val`` split.
            test_loader: Optional loader for ``test`` split.
    
        Returns:
            Dictionary of requested splits that have non-``None`` loaders.
    """
    ...

# From splits
def evaluate_available_splits(requested_splits: Any[str], split_to_loader: Any[str, Any], evaluate_split: Callable[[str, Any], list[dict]]) -> list[dict]:
    """
    Evaluate all available requested splits and aggregate payload items.
    
        Args:
            requested_splits: Ordered split names to evaluate.
            split_to_loader: Mapping from split name to loader object.
            evaluate_split: Callable that evaluates one split and returns payload.
    
        Returns:
            Concatenated list of payload dictionaries from available splits.
    """
    ...

# From status
def safe_log_error(action_tracker: Any, file_path: str, location: str, message: str) -> None:
    """
    Log an error entry without propagating tracker exceptions.
    
        Args:
            action_tracker: Tracker-like object implementing ``log_error``.
            file_path: Source file associated with the error event.
            location: Logical module or location string.
            message: Error detail to persist in tracking backend.
    
        Returns:
            None.
    """
    ...

# From status
def safe_update_status(action_tracker: Any, step_code: str, status: str, description: str) -> None:
    """
    Submit status updates without propagating tracker exceptions.
    
        Args:
            action_tracker: Tracker-like object implementing ``update_status``.
            step_code: Lifecycle step identifier.
            status: Status level string such as ``OK`` or ``ERROR``.
            description: Human-readable status description.
    
        Returns:
            None.
    """
    ...

# Classes
# From model_loading
class ModelLoadStrategies:
    # Strategy callbacks for checkpoint/predefined/scratch model loading.
    #
    #     Args:
    #         from_checkpoint: Callback to load model from checkpoint path.
    #         from_predefined: Callback to load model from predefined model value.
    #         from_scratch: Optional callback to create model from scratch.

    ...

# From model_loading
class ModelLoaderRegistry:
    # Runtime-keyed model loader registry.
    #
    #     Args:
    #         loaders: Mapping from runtime key to loader callable.
    #         default_key: Default runtime key used when no direct match is found.

    def register(self: Any, runtime_key: str, loader: Any) -> None:
        """
        Register a model loader for a runtime key.
        
                Args:
                    runtime_key: Runtime key used during loader resolution.
                    loader: Loader callable for the runtime key.
        
                Returns:
                    None.
        """
        ...

    def resolve(self: Any, runtime_framework: str) -> Any:
        """
        Resolve a model loader for a runtime descriptor string.
        
                Args:
                    runtime_framework: Runtime descriptor requested by caller.
        
                Returns:
                    Resolved model loader callable.
        """
        ...


from . import device, model_loading, splits, status