Source code for rail_pz_service.client.model

"""python for client API for managing Model tables"""

from __future__ import annotations

from typing import TYPE_CHECKING

import httpx

from .. import models
from . import wrappers

if TYPE_CHECKING:
    from .client import PZRailClient

# Template specialization
# Specify the pydantic model for Step
ResponseModelClass = models.Model

# Construct derived templates
router_string = "model"


[docs] class PZRailModelClient: """Interface for accessing remote pz-rail-service to manipulate Model Tables""" def __init__(self, parent: PZRailClient) -> None: self._client = parent.client @property def client(self) -> httpx.Client: """Return the httpx.Client""" return self._client # Add functions to the client class get_rows = wrappers.get_rows_function(ResponseModelClass, f"{router_string}/list") get_row = wrappers.get_row_function(ResponseModelClass, f"{router_string}/get") get_row_by_name = wrappers.get_row_by_name_function( ResponseModelClass, f"{router_string}/get_row_by_name" ) get_estimators = wrappers.get_row_attribute_list_function( ResponseModelClass, f"{router_string}/get/estimators" ) download = wrappers.download_file_function(f"{router_string}/download")