Commit 5340af8
fix(event-handler): fix ruff lint violations in event_handler module (#8208)
* fix(event-handler): replace Optional[X] and List[X] with X | None and list[X] in openapi/models.py
Replace deprecated typing aliases with modern Python 3.10+ syntax:
- Optional[X] -> X | None
- List[X] -> list[X]
- Dict[X, Y] -> dict[X, Y]
- Set[X] -> set[X]
- Remove unused imports: Dict, List, Optional, Set from typing
Part of #8088
Signed-off-by: hirenkumar-n-dholariya <hirenkumarnd@gmail.com>
* fix(event-handler): replace Optional[X] and Dict[X] with modern syntax in swagger_ui/oauth2.py
- Optional[str] -> str | None
- Dict[str, str] -> dict[str, str]
- Remove unused imports: Dict, Optional from typing
Part of #8088
Signed-off-by: hirenkumar-n-dholariya <hirenkumarnd@gmail.com>
* fix(event-handler): replace Optional[list] with list | None in graphql_appsync/base.py docstrings
Update docstring code examples to use modern Python 3.10+ syntax:
- Optional[list] -> list | None
- Remove unused `from typing import Optional` from examples
Part of #8088
Signed-off-by: hirenkumar-n-dholariya <hirenkumarnd@gmail.com>
* fix(event-handler): fix ruff lint violations in util.py docstrings
Update docstring parameter type hints to use modern Python 3.10+ syntax:
- List[Dict[str, List[str]]] -> list[dict[str, list[str]]]
- Optional[Dict[str, Any]] -> dict[str, Any] | None
Part of #8088
Signed-off-by: hirenkumar-n-dholariya <hirenkumarnd@gmail.com>
* fix(event-handler): fix ruff lint violations in appsync.py docstrings
Update docstring parameter type hints to use modern Python 3.10+ syntax:
- Optional[str] -> str | None in field_name parameter descriptions
Part of #8088
Signed-off-by: hirenkumar-n-dholariya <hirenkumarnd@gmail.com>
* fix(event-handler): fix ruff lint violations in graphql_appsync/_registry.py docstrings
Update docstring return type hints to use modern Python 3.10+ syntax:
- Optional[Dict] -> dict | None in Returns section
Part of #8088
Signed-off-by: hirenkumar-n-dholariya <hirenkumarnd@gmail.com>
* fix(event-handler): fix ruff lint violations in middlewares/openapi_validation.py comments
Update inline comments to use modern Python 3.10+ syntax:
- List[Model] -> list[Model]
- Optional[List[Model]] -> list[Model] | None
- Optional[RootModel[List[Model]]] -> RootModel[list[Model]] | None
Part of #8088
Signed-off-by: hirenkumar-n-dholariya <hirenkumarnd@gmail.com>
* fix(event-handler): restore removed comment in OpenAPIExtensions class
Hi @svozza,
Thank you for catching that! The comment was accidentally
removed during the refactoring. I have restored it now. Also added the Acknowledgment section to the PR description. Sorry for the oversight!
Signed-off-by: hirenkumar-n-dholariya <hirenkumarnd@gmail.com>
* fix(event-handler): restore accidentally removed comments in openapi/models.py
fix(event-handler): restore accidentally removed comments in openapi/models.py
Signed-off-by: hirenkumar-n-dholariya <hirenkumarnd@gmail.com>
* fix(event-handler): restore accidentally removed comments in openapi/models.py
Restore all comments that were accidentally removed during the
Optional[X] -> X | None type annotation refactoring in openapi/models.py.
Restored comments include:
- swagger.io specification links before each class definition
e.g. # https://swagger.io/specification/#contact-object
- JSON Schema 2020-12 reference links and section headers inside Schema class
e.g. # Ref: JSON Schema 2020-12: https://json-schema.org/...
- MAINTENANCE notes for future Pydantic v1 deprecation
- Inline comments for serialization rules in ParameterBase
e.g. # Serialization rules for simple scenarios
- "Using Any for Specification Extensions" comments in Operation,
Components and OpenAPI classes
Part of #8088
Signed-off-by: hirenkumar-n-dholariya <hirenkumarnd@gmail.com>
* fix(event-handler): add missing from __future__ import annotations in oauth2.py
Add `from __future__ import annotations` to enable PEP 604 union syntax (X | None) for Python versions below 3.10.
Fixes FA102 ruff lint errors:
- aws_lambda_powertools/event_handler/openapi/swagger_ui/oauth2.py:50
Part of #8088
Signed-off-by: hirenkumar-n-dholariya <hirenkumarnd@gmail.com>
* fix(event-handler): revert validator signature to Optional in oauth2.py
Revert client_secret_only_on_dev validator signature from str | None back to Optional[str] to fix FA102 ruff lint error.
PEP 604 union syntax in function signatures requires `from __future__ import annotations` which conflicts with the existing FA100 noqa suppression in this file.
Part of #8088
Signed-off-by: hirenkumar-n-dholariya <hirenkumarnd@gmail.com>
* fix(event-handler): fix UP045 lint error in oauth2.py validator signature
With `from __future__ import annotations` present, ruff UP045 requires `str | None` instead of `Optional[str]` in the validator signature.
- Remove Optional from typing imports
- Convert validator signature to str | None syntax
Part of #8088
Signed-off-by: hirenkumar-n-dholariya <hirenkumarnd@gmail.com>
---------
Signed-off-by: hirenkumar-n-dholariya <hirenkumarnd@gmail.com>
Co-authored-by: Leandro Damascena <lcdama@amazon.pt>1 parent cf20700 commit 5340af8
7 files changed
Lines changed: 190 additions & 194 deletions
File tree
- aws_lambda_powertools/event_handler
- graphql_appsync
- middlewares
- openapi
- swagger_ui
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
395 | | - | |
| 395 | + | |
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
| |||
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
450 | | - | |
| 450 | + | |
451 | 451 | | |
452 | 452 | | |
453 | 453 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
Lines changed: 3 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | 28 | | |
31 | 29 | | |
32 | 30 | | |
33 | 31 | | |
34 | 32 | | |
35 | 33 | | |
36 | 34 | | |
37 | | - | |
| 35 | + | |
38 | 36 | | |
39 | 37 | | |
40 | 38 | | |
| |||
76 | 74 | | |
77 | 75 | | |
78 | 76 | | |
79 | | - | |
80 | | - | |
81 | 77 | | |
82 | 78 | | |
83 | 79 | | |
84 | 80 | | |
85 | 81 | | |
86 | 82 | | |
87 | 83 | | |
88 | | - | |
| 84 | + | |
89 | 85 | | |
90 | 86 | | |
91 | 87 | | |
| |||
127 | 123 | | |
128 | 124 | | |
129 | 125 | | |
130 | | - | |
131 | | - | |
132 | 126 | | |
133 | 127 | | |
134 | 128 | | |
135 | 129 | | |
136 | 130 | | |
137 | 131 | | |
138 | 132 | | |
139 | | - | |
| 133 | + | |
140 | 134 | | |
141 | 135 | | |
142 | 136 | | |
| |||
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
505 | 505 | | |
506 | 506 | | |
507 | 507 | | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
513 | 513 | | |
514 | 514 | | |
515 | 515 | | |
| |||
0 commit comments