Skip to content

Commit cd4cd41

Browse files
Merge branch 'develop' into dependabot/docker/docs/squidfunk/mkdocs-material-sha25695f2ff42251979c043d6cb5b1c82e6ae8189e57e02105813dd1ce124021a418b
2 parents 2cd45c8 + a48f9bf commit cd4cd41

File tree

64 files changed

+121
-176
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+121
-176
lines changed

.github/workflows/quality_check.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ jobs:
6363
run: make dev-quality-code
6464
- name: Checking third-party library licenses
6565
run: make check-licenses
66+
- name: Checking and enforcing format
67+
run: make format-check
6668
- name: Formatting and Linting
6769
run: make lint
6870
- name: Static type checking

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ repos:
1212
- id: check-toml
1313
- repo: local
1414
hooks:
15-
- id: black
16-
name: formatting::black
17-
entry: poetry run black
15+
- id: ruff
16+
name: formatting::ruff
17+
entry: poetry run ruff format
1818
language: system
1919
types: [python]
2020
- id: ruff
21-
name: linting-format::ruff
21+
name: linting::ruff
2222
entry: poetry run ruff check
2323
language: system
2424
types: [python]

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ dev-gitpod:
2525
check-licenses:
2626
poetry run licensecheck -u poetry:dev
2727

28+
format-check:
29+
poetry run ruff format aws_lambda_powertools tests examples --check
30+
2831
format:
29-
poetry run black aws_lambda_powertools tests examples
32+
poetry run ruff format aws_lambda_powertools tests examples
3033

3134
lint: format
3235
poetry run ruff check aws_lambda_powertools tests examples

aws_lambda_powertools/event_handler/api_gateway.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,7 +1604,6 @@ def _validate_response_validation_error_http_code(
16041604
response_validation_error_http_code: HTTPStatus | int | None,
16051605
enable_validation: bool,
16061606
) -> HTTPStatus:
1607-
16081607
if response_validation_error_http_code and not enable_validation:
16091608
msg = "'response_validation_error_http_code' cannot be set when enable_validation is False."
16101609
raise ValueError(msg)
@@ -1613,7 +1612,6 @@ def _validate_response_validation_error_http_code(
16131612
not isinstance(response_validation_error_http_code, HTTPStatus)
16141613
and response_validation_error_http_code is not None
16151614
):
1616-
16171615
try:
16181616
response_validation_error_http_code = HTTPStatus(response_validation_error_http_code)
16191617
except ValueError:

aws_lambda_powertools/event_handler/bedrock_agent.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ def get( # type: ignore[override]
110110
tags: list[str] | None = None,
111111
operation_id: str | None = None,
112112
include_in_schema: bool = True,
113+
openapi_extensions: dict[str, Any] | None = None,
113114
deprecated: bool = False,
114115
custom_response_validation_http_code: int | HTTPStatus | None = None,
115116
middlewares: list[Callable[..., Any]] | None = None,
116117
) -> Callable[[Callable[..., Any]], Callable[..., Any]]:
117-
openapi_extensions = None
118118
security = None
119119

120120
return super().get(
@@ -151,11 +151,11 @@ def post( # type: ignore[override]
151151
tags: list[str] | None = None,
152152
operation_id: str | None = None,
153153
include_in_schema: bool = True,
154+
openapi_extensions: dict[str, Any] | None = None,
154155
deprecated: bool = False,
155156
custom_response_validation_http_code: int | HTTPStatus | None = None,
156157
middlewares: list[Callable[..., Any]] | None = None,
157158
):
158-
openapi_extensions = None
159159
security = None
160160

161161
return super().post(
@@ -192,11 +192,11 @@ def put( # type: ignore[override]
192192
tags: list[str] | None = None,
193193
operation_id: str | None = None,
194194
include_in_schema: bool = True,
195+
openapi_extensions: dict[str, Any] | None = None,
195196
deprecated: bool = False,
196197
custom_response_validation_http_code: int | HTTPStatus | None = None,
197198
middlewares: list[Callable[..., Any]] | None = None,
198199
):
199-
openapi_extensions = None
200200
security = None
201201

202202
return super().put(
@@ -233,11 +233,11 @@ def patch( # type: ignore[override]
233233
tags: list[str] | None = None,
234234
operation_id: str | None = None,
235235
include_in_schema: bool = True,
236+
openapi_extensions: dict[str, Any] | None = None,
236237
deprecated: bool = False,
237238
custom_response_validation_http_code: int | HTTPStatus | None = None,
238239
middlewares: list[Callable] | None = None,
239240
):
240-
openapi_extensions = None
241241
security = None
242242

243243
return super().patch(
@@ -274,11 +274,11 @@ def delete( # type: ignore[override]
274274
tags: list[str] | None = None,
275275
operation_id: str | None = None,
276276
include_in_schema: bool = True,
277+
openapi_extensions: dict[str, Any] | None = None,
277278
deprecated: bool = False,
278279
custom_response_validation_http_code: int | HTTPStatus | None = None,
279280
middlewares: list[Callable[..., Any]] | None = None,
280281
):
281-
openapi_extensions = None
282282
security = None
283283

284284
return super().delete(
@@ -325,6 +325,7 @@ def get_openapi_json_schema( # type: ignore[override]
325325
license_info: License | None = None,
326326
security_schemes: dict[str, SecurityScheme] | None = None,
327327
security: list[dict[str, list[str]]] | None = None,
328+
openapi_extensions: dict[str, Any] | None = None,
328329
) -> str:
329330
"""
330331
Returns the OpenAPI schema as a JSON serializable dict.
@@ -365,8 +366,6 @@ def get_openapi_json_schema( # type: ignore[override]
365366
"""
366367
from aws_lambda_powertools.event_handler.openapi.compat import model_json
367368

368-
openapi_extensions = None
369-
370369
schema = super().get_openapi_schema(
371370
title=title,
372371
version=version,

aws_lambda_powertools/event_handler/openapi/models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class OpenAPIExtensions(BaseModel):
3636
@model_validator(mode="before")
3737
def serialize_openapi_extension_v2(self):
3838
if isinstance(self, dict) and self.get("openapi_extensions"):
39-
4039
openapi_extension_value = self.get("openapi_extensions")
4140

4241
for extension_key in openapi_extension_value:

aws_lambda_powertools/logging/logger.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,15 +1205,15 @@ def flush_buffer(self) -> None:
12051205
buffer = self._buffer_cache.get(tracer_id)
12061206
if not buffer:
12071207
return
1208-
1208+
12091209
if not self._buffer_config:
12101210
return
1211-
1211+
12121212
# Check ALC level against buffer level
12131213
lambda_log_level = self._get_aws_lambda_log_level()
12141214
if lambda_log_level:
12151215
# Check if buffer level is less verbose than ALC
1216-
if (logging.getLevelName(lambda_log_level) > logging.getLevelName(self._buffer_config.buffer_at_verbosity)):
1216+
if logging.getLevelName(lambda_log_level) > logging.getLevelName(self._buffer_config.buffer_at_verbosity):
12171217
warnings.warn(
12181218
"Advanced Logging Controls (ALC) Log Level is less verbose than Log Buffering Log Level. "
12191219
"Some logs might be missing",

aws_lambda_powertools/utilities/batch/base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,7 @@ def _clean(self):
296296

297297
if self._entire_batch_failed() and self.raise_on_entire_batch_failure:
298298
raise BatchProcessingError(
299-
msg=f"All records failed processing. {len(self.exceptions)} individual errors logged "
300-
f"separately below.",
299+
msg=f"All records failed processing. {len(self.exceptions)} individual errors logged separately below.",
301300
child_exceptions=self.exceptions,
302301
)
303302

aws_lambda_powertools/utilities/data_classes/code_pipeline_job_event.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ def put_artifact(self, artifact_name: str, body: Any, content_type: str) -> None
314314
# So we are using if/else instead.
315315

316316
if self.data.encryption_key:
317-
318317
encryption_key_id = self.data.encryption_key.get_id
319318
encryption_key_type = self.data.encryption_key.get_type
320319
if encryption_key_type == "KMS":

aws_lambda_powertools/utilities/data_classes/transfer_family_event.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ def source_ip(self) -> str:
3939

4040

4141
class TransferFamilyAuthorizerResponse:
42-
4342
def _build_authentication_response(
4443
self,
4544
role_arn: str,
@@ -51,7 +50,6 @@ def _build_authentication_response(
5150
user_uid: int | None = None,
5251
public_keys: str | None = None,
5352
) -> dict[str, Any]:
54-
5553
response: dict[str, Any] = {}
5654

5755
if home_directory_type == "PATH":

0 commit comments

Comments
 (0)