Skip to content

docs(api): migrating the batch utility to mkdocstrings #6016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions aws_lambda_powertools/logging/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Logging utility
"""
"""Logging utility"""

from .logger import Logger

Expand Down
3 changes: 1 addition & 2 deletions aws_lambda_powertools/metrics/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""CloudWatch Embedded Metric Format utility
"""
"""CloudWatch Embedded Metric Format utility"""

from aws_lambda_powertools.metrics.base import MetricResolution, MetricUnit, single_metric
from aws_lambda_powertools.metrics.exceptions import (
Expand Down
2 changes: 1 addition & 1 deletion aws_lambda_powertools/middleware_factory/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Utilities to enhance middlewares """
"""Utilities to enhance middlewares"""

from .factory import lambda_handler_decorator

Expand Down
3 changes: 1 addition & 2 deletions aws_lambda_powertools/tracing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Tracing utility
"""
"""Tracing utility"""

from .extensions import aiohttp_trace_config
from .tracer import Tracer
Expand Down
2 changes: 2 additions & 0 deletions aws_lambda_powertools/utilities/batch/base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""
Batch processing utilities
!!! abstract "Usage Documentation"
[`Batch processing`](../../utilities/batch.md)
"""

from __future__ import annotations
Expand Down
9 changes: 4 additions & 5 deletions aws_lambda_powertools/utilities/batch/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ def async_batch_processor(
processor: AsyncBatchProcessor
Batch Processor to handle partial failure cases

Examples
Example
--------
**Processes Lambda's event with a BasePartialProcessor**
>>> from aws_lambda_powertools.utilities.batch import async_batch_processor, AsyncBatchProcessor
>>> from aws_lambda_powertools.utilities.data_classes.sqs_event import SQSRecord
>>>
Expand Down Expand Up @@ -119,7 +118,7 @@ def batch_processor(
processor: BatchProcessor
Batch Processor to handle partial failure cases

Examples
Example
--------
**Processes Lambda's event with a BatchProcessor**

Expand Down Expand Up @@ -180,7 +179,7 @@ def process_partial_response(
result: PartialItemFailureResponse
Lambda Partial Batch Response

Examples
Example
--------
**Processes Lambda's SQS event**

Expand Down Expand Up @@ -244,7 +243,7 @@ def async_process_partial_response(
result: PartialItemFailureResponse
Lambda Partial Batch Response

Examples
Example
--------
**Processes Lambda's SQS event**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SqsFifoPartialProcessor(BatchProcessor):
Stops processing records when the first record fails. The remaining records are reported as failed items.

Example
_______
-------

## Process batch triggered by a FIFO SQS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,17 @@ def encrypt(self, data: Any, provider_options: dict | None = None, **encryption_

Parameters
-------
data : Any
The data to be encrypted.
provider_options : dict
Additional options for the aws_encryption_sdk.EncryptionSDKClient
**encryption_context : str
Additional keyword arguments collected into a dictionary.
data: Any
The data to be encrypted.
provider_options: dict
Additional options for the aws_encryption_sdk.EncryptionSDKClient
**encryption_context: str
Additional keyword arguments collected into a dictionary.

Returns
-------
ciphertext : str
The encrypted data, as a base64-encoded string.
ciphertext: str
The encrypted data, as a base64-encoded string.
"""
provider_options = provider_options or {}
self._validate_encryption_context(encryption_context)
Expand All @@ -179,15 +179,15 @@ def decrypt(self, data: str, provider_options: dict | None = None, **encryption_

Parameters
-------
data : str
The encrypted data, as a base64-encoded string
provider_options
Additional options for the aws_encryption_sdk.EncryptionSDKClient
data: str
The encrypted data, as a base64-encoded string
provider_options
Additional options for the aws_encryption_sdk.EncryptionSDKClient

Returns
-------
ciphertext : bytes
The decrypted data in bytes
ciphertext: bytes
The decrypted data in bytes
"""
provider_options = provider_options or {}
self._validate_encryption_context(encryption_context)
Expand Down
3 changes: 1 addition & 2 deletions aws_lambda_powertools/utilities/parser/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Advanced event_parser utility
"""
"""Advanced event_parser utility"""

from pydantic import BaseModel, Field, ValidationError, field_validator, model_validator

Expand Down
2 changes: 2 additions & 0 deletions docs/api_doc/batch/base.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!-- markdownlint-disable MD043 MD041 -->
::: aws_lambda_powertools.utilities.batch.base
3 changes: 3 additions & 0 deletions docs/api_doc/batch/decorators.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!-- markdownlint-disable MD043 MD041 -->
::: aws_lambda_powertools.utilities.batch.decorators
::: aws_lambda_powertools.utilities.batch.sqs_fifo_partial_processor
2 changes: 2 additions & 0 deletions docs/api_doc/batch/exceptions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!-- markdownlint-disable MD043 MD041 -->
::: aws_lambda_powertools.utilities.batch.exceptions
4 changes: 4 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ nav:
# - Casual to regular contributor: contributing/tracks/casual_regular_contributor.md
# - Customer to advocate: contributing/tracks/customer_advocate.md
- API Documentation:
- Batch Processing:
- Base: api_doc/batch/base.md
- Decorators: api_doc/batch/decorators.md
- Exceptions: api_doc/batch/exceptions.md
- Event Source Data Classes: api_doc/data_classes.md
- Data Masking:
- Base: api_doc/data_masking/base.md
Expand Down
Loading