Skip to content

Commit c42377c

Browse files
authored
chore: all docstrings in pipeline should be ReST (#97)
1 parent e43baaf commit c42377c

1 file changed

Lines changed: 33 additions & 26 deletions

File tree

src/deepset_mcp/api/pipeline/resource.py

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,20 @@ def __init__(
3030
client: "AsyncClientProtocol",
3131
workspace: str,
3232
) -> None:
33-
"""Initializes a PipelineResource instance."""
33+
"""Initializes a PipelineResource instance.
34+
35+
:param client: The async client protocol instance.
36+
:param workspace: The workspace identifier.
37+
"""
3438
self._client = client
3539
self._workspace = workspace
3640

3741
async def validate(self, yaml_config: str) -> PipelineValidationResult:
38-
"""
39-
Validate a pipeline's YAML configuration against the API.
40-
41-
Args:
42-
yaml_config: The YAML configuration string to validate
43-
44-
Returns:
45-
PipelineValidationResult containing validation status and any errors
42+
"""Validate a pipeline's YAML configuration against the API.
4643
47-
Raises:
48-
ValueError: If the YAML is not valid (422 error) or contains syntax errors
44+
:param yaml_config: The YAML configuration string to validate.
45+
:returns: PipelineValidationResult containing validation status and any errors.
46+
:raises ValueError: If the YAML is not valid (422 error) or contains syntax errors.
4947
"""
5048
data = {"query_yaml": yaml_config}
5149

@@ -76,12 +74,11 @@ async def list(
7674
page_number: int = 1,
7775
limit: int = 10,
7876
) -> list[DeepsetPipeline]:
79-
"""
80-
Retrieve pipeline in the configured workspace with optional pagination.
77+
"""Retrieve pipeline in the configured workspace with optional pagination.
8178
8279
:param page_number: Page number for paging.
8380
:param limit: Max number of items to return.
84-
:return: List of DeepsetPipeline instances.
81+
:returns: List of DeepsetPipeline instances.
8582
"""
8683
params: dict[str, Any] = {
8784
"page_number": page_number,
@@ -106,7 +103,12 @@ async def list(
106103
return pipelines
107104

108105
async def get(self, pipeline_name: str, include_yaml: bool = True) -> DeepsetPipeline:
109-
"""Fetch a single pipeline by its name."""
106+
"""Fetch a single pipeline by its name.
107+
108+
:param pipeline_name: Name of the pipeline to fetch.
109+
:param include_yaml: Whether to include YAML configuration in the response.
110+
:returns: DeepsetPipeline instance.
111+
"""
110112
resp = await self._client.request(endpoint=f"v1/workspaces/{self._workspace}/pipelines/{pipeline_name}")
111113
raise_for_status(resp)
112114

@@ -125,7 +127,12 @@ async def get(self, pipeline_name: str, include_yaml: bool = True) -> DeepsetPip
125127
return pipeline
126128

127129
async def create(self, name: str, yaml_config: str) -> NoContentResponse:
128-
"""Create a new pipeline with a name and YAML config."""
130+
"""Create a new pipeline with a name and YAML config.
131+
132+
:param name: Name of the new pipeline.
133+
:param yaml_config: YAML configuration for the pipeline.
134+
:returns: NoContentResponse indicating successful creation.
135+
"""
129136
data = {"name": name, "query_yaml": yaml_config}
130137
resp = await self._client.request(
131138
endpoint=f"v1/workspaces/{self._workspace}/pipelines",
@@ -143,7 +150,14 @@ async def update(
143150
updated_pipeline_name: str | None = None,
144151
yaml_config: str | None = None,
145152
) -> NoContentResponse:
146-
"""Update name and/or YAML config of an existing pipeline."""
153+
"""Update name and/or YAML config of an existing pipeline.
154+
155+
:param pipeline_name: Current name of the pipeline.
156+
:param updated_pipeline_name: New name for the pipeline (optional).
157+
:param yaml_config: New YAML configuration (optional).
158+
:returns: NoContentResponse indicating successful update.
159+
:raises ValueError: If neither updated_pipeline_name nor yaml_config is provided.
160+
"""
147161
# Handle name update first if any
148162
if updated_pipeline_name is not None:
149163
name_resp = await self._client.request(
@@ -188,7 +202,6 @@ async def get_logs(
188202
:param pipeline_name: Name of the pipeline to fetch logs for.
189203
:param limit: Maximum number of log entries to return.
190204
:param level: Filter logs by level. If None, returns all levels.
191-
192205
:returns: A PipelineLogList containing the log entries.
193206
"""
194207
params: dict[str, Any] = {
@@ -220,10 +233,8 @@ async def deploy(self, pipeline_name: str) -> PipelineValidationResult:
220233
"""Deploy a pipeline to production.
221234
222235
:param pipeline_name: Name of the pipeline to deploy.
223-
224236
:returns: PipelineValidationResult containing deployment status and any errors.
225-
226-
:raises: UnexpectedAPIError: If the API returns an unexpected status code.
237+
:raises UnexpectedAPIError: If the API returns an unexpected status code.
227238
"""
228239
resp = await self._client.request(
229240
endpoint=f"v1/workspaces/{self._workspace}/pipelines/{pipeline_name}/deploy",
@@ -252,10 +263,8 @@ async def delete(self, pipeline_name: str) -> NoContentResponse:
252263
"""Delete a pipeline.
253264
254265
:param pipeline_name: Name of the pipeline to delete.
255-
256266
:returns: NoContentResponse indicating successful deletion.
257-
258-
:raises: UnexpectedAPIError: If the API returns an unexpected status code.
267+
:raises UnexpectedAPIError: If the API returns an unexpected status code.
259268
"""
260269
resp = await self._client.request(
261270
endpoint=f"v1/workspaces/{self._workspace}/pipelines/{pipeline_name}",
@@ -283,7 +292,6 @@ async def search(
283292
:param view_prompts: Whether to include prompts in the response.
284293
:param params: Additional parameters for pipeline components.
285294
:param filters: Search filters to apply.
286-
287295
:returns: SearchResponse containing search results.
288296
"""
289297
# Prepare request data
@@ -331,7 +339,6 @@ async def search_stream(
331339
:param view_prompts: Whether to include prompts in the response.
332340
:param params: Additional parameters for pipeline components.
333341
:param filters: Search filters to apply.
334-
335342
:returns: AsyncIterator streaming the result.
336343
"""
337344
# For streaming, we need to add include_result flag

0 commit comments

Comments
 (0)