Skip to content

Commit 6425411

Browse files
Docmentation fix + small changes
1 parent b4a1cba commit 6425411

File tree

11 files changed

+37
-36
lines changed

11 files changed

+37
-36
lines changed

aws_lambda_powertools/shared/types.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from typing import Any, Callable, Dict, List, TypeVar, Union
1+
from typing import Any, Callable, TypeVar
22

33
AnyCallableT = TypeVar("AnyCallableT", bound=Callable[..., Any]) # noqa: VNE001
4-
# JSON primitives only, mypy doesn't support recursive tho
5-
JSONType = Union[str, int, float, bool, None, Dict[str, Any], List[Any]]

aws_lambda_powertools/utilities/feature_flags/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""Advanced feature flags utility"""
22

3-
from .appconfig import AppConfigStore
4-
from .base import StoreProvider
5-
from .exceptions import ConfigurationStoreError
6-
from .feature_flags import FeatureFlags
7-
from .schema import RuleAction, SchemaValidator
3+
from aws_lambda_powertools.utilities.feature_flags.appconfig import AppConfigStore
4+
from aws_lambda_powertools.utilities.feature_flags.base import StoreProvider
5+
from aws_lambda_powertools.utilities.feature_flags.exceptions import ConfigurationStoreError
6+
from aws_lambda_powertools.utilities.feature_flags.feature_flags import FeatureFlags
7+
from aws_lambda_powertools.utilities.feature_flags.schema import RuleAction, SchemaValidator
88

99
__all__ = [
1010
"ConfigurationStoreError",

aws_lambda_powertools/utilities/feature_flags/appconfig.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@
44

55
from botocore.config import Config
66

7+
from aws_lambda_powertools.logging import Logger
78
from aws_lambda_powertools.utilities import jmespath_utils
9+
from aws_lambda_powertools.utilities.feature_flags.base import StoreProvider
10+
from aws_lambda_powertools.utilities.feature_flags.exceptions import ConfigurationStoreError, StoreClientError
811
from aws_lambda_powertools.utilities.parameters import (
912
AppConfigProvider,
1013
GetParameterError,
1114
TransformParameterError,
1215
)
1316

14-
from ... import Logger
15-
from .base import StoreProvider
16-
from .exceptions import ConfigurationStoreError, StoreClientError
17-
1817

1918
class AppConfigStore(StoreProvider):
2019
def __init__(

aws_lambda_powertools/utilities/feature_flags/comparators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from dateutil.tz import gettz
77

8-
from .schema import HOUR_MIN_SEPARATOR, ModuloRangeValues, TimeValues
8+
from aws_lambda_powertools.utilities.feature_flags.schema import HOUR_MIN_SEPARATOR, ModuloRangeValues, TimeValues
99

1010

1111
def _get_now_from_timezone(timezone: Optional[tzinfo]) -> datetime:

aws_lambda_powertools/utilities/feature_flags/feature_flags.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55

66
from typing_extensions import ParamSpec
77

8-
from ... import Logger
9-
from ...shared.types import JSONType
10-
from . import schema
11-
from .base import StoreProvider
12-
from .comparators import (
8+
from aws_lambda_powertools.logging import Logger
9+
from aws_lambda_powertools.utilities.feature_flags import schema
10+
from aws_lambda_powertools.utilities.feature_flags.base import StoreProvider
11+
from aws_lambda_powertools.utilities.feature_flags.comparators import (
1312
compare_all_in_list,
1413
compare_any_in_list,
1514
compare_datetime_range,
@@ -18,7 +17,8 @@
1817
compare_none_in_list,
1918
compare_time_range,
2019
)
21-
from .exceptions import ConfigurationStoreError
20+
from aws_lambda_powertools.utilities.feature_flags.exceptions import ConfigurationStoreError
21+
from aws_lambda_powertools.utilities.feature_flags.types import JSONType
2222

2323
T = TypeVar("T")
2424
P = ParamSpec("P")

aws_lambda_powertools/utilities/feature_flags/schema.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
from dateutil import tz
1111

12-
from ... import Logger
13-
from .base import BaseValidator
14-
from .exceptions import SchemaValidationError
12+
from aws_lambda_powertools.logging import Logger
13+
from aws_lambda_powertools.utilities.feature_flags.base import BaseValidator
14+
from aws_lambda_powertools.utilities.feature_flags.exceptions import SchemaValidationError
1515

1616
RULES_KEY = "rules"
1717
FEATURE_DEFAULT_VAL_KEY = "default"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from typing import Any, Dict, List, Union
2+
3+
# JSON primitives only, mypy doesn't support recursive tho
4+
JSONType = Union[str, int, float, bool, None, Dict[str, Any], List[Any]]

docs/core/event_handler/api_gateway.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ In the following example, we use a new `Query` OpenAPI type to add [one out of m
380380

381381
=== "validating_query_strings.py"
382382

383-
```python hl_lines="8 10 27"
383+
```python hl_lines="8 9 27"
384384
--8<-- "examples/event_handler_rest/src/validating_query_strings.py"
385385
```
386386

@@ -418,7 +418,7 @@ Just like we learned in [query string validation](#validating-query-strings), we
418418

419419
For example, we could validate that `<todo_id>` dynamic path should be no greater than three digits.
420420

421-
```python hl_lines="8 10 27" title="validating_path.py"
421+
```python hl_lines="8 9 27" title="validating_path.py"
422422
--8<-- "examples/event_handler_rest/src/validating_path.py"
423423
```
424424

@@ -440,7 +440,7 @@ In the following example, we use a new `Header` OpenAPI type to add [one out of
440440

441441
=== "validating_headers.py"
442442

443-
```python hl_lines="8 10 27"
443+
```python hl_lines="5 9 27"
444444
--8<-- "examples/event_handler_rest/src/validating_headers.py"
445445
```
446446

docs/core/event_handler/appsync.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Here's an example with two separate functions to resolve `getTodo` and `listTodo
6161

6262
=== "getting_started_graphql_api_resolver.py"
6363

64-
```python hl_lines="7 15 25 27 28 37 39 47 49 60"
64+
```python hl_lines="7 14 24 26 27 36 38 46 48 59"
6565
--8<-- "examples/event_handler_graphql/src/getting_started_graphql_api_resolver.py"
6666
```
6767

@@ -123,7 +123,7 @@ You can nest `app.resolver()` decorator multiple times when resolving fields wit
123123

124124
=== "nested_mappings.py"
125125

126-
```python hl_lines="4 11 21 22 24 31"
126+
```python hl_lines="4 10 20 21 23 30"
127127
--8<-- "examples/event_handler_graphql/src/nested_mappings.py"
128128
```
129129

@@ -137,7 +137,7 @@ You can nest `app.resolver()` decorator multiple times when resolving fields wit
137137

138138
For Lambda Python3.8+ runtime, this utility supports async functions when you use in conjunction with `asyncio.run`.
139139

140-
```python hl_lines="6 15 25 26 35 37" title="Resolving GraphQL resolvers async"
140+
```python hl_lines="7 14 24 25 34 36" title="Resolving GraphQL resolvers async"
141141
--8<-- "examples/event_handler_graphql/src/async_resolvers.py"
142142
```
143143

@@ -162,13 +162,13 @@ Use the following code for `merchantInfo` and `searchMerchant` functions respect
162162

163163
=== "graphql_transformer_merchant_info.py"
164164

165-
```python hl_lines="4 7 23 24 29 30 37"
165+
```python hl_lines="4 6 23 24 29 30 36"
166166
--8<-- "examples/event_handler_graphql/src/graphql_transformer_merchant_info.py"
167167
```
168168

169169
=== "graphql_transformer_search_merchant.py"
170170

171-
```python hl_lines="4 7 22 23 37 43"
171+
```python hl_lines="4 6 21 22 36 42"
172172
--8<-- "examples/event_handler_graphql/src/graphql_transformer_search_merchant.py"
173173
```
174174

@@ -196,7 +196,7 @@ You can subclass [AppSyncResolverEvent](../../utilities/data_classes.md#appsync-
196196

197197
=== "custom_models.py.py"
198198

199-
```python hl_lines="4 8-10 26-28 31 32 39 46"
199+
```python hl_lines="4 7-9 25-27 31 32 39 45"
200200
--8<-- "examples/event_handler_graphql/src/custom_models.py"
201201
```
202202

@@ -225,7 +225,7 @@ Let's assume you have `split_operation.py` as your Lambda function entrypoint an
225225

226226
We import **Router** instead of **AppSyncResolver**; syntax wise is exactly the same.
227227

228-
```python hl_lines="4 9 19 20"
228+
```python hl_lines="4 8 18 19"
229229
--8<-- "examples/event_handler_graphql/src/split_operation_module.py"
230230
```
231231

@@ -255,7 +255,7 @@ You can use `append_context` when you want to share data between your App and Ro
255255

256256
=== "split_route_append_context_module.py"
257257

258-
```python hl_lines="23"
258+
```python hl_lines="22"
259259
--8<-- "examples/event_handler_graphql/src/split_operation_append_context_module.py"
260260
```
261261

@@ -298,7 +298,7 @@ And an example for testing asynchronous resolvers. Note that this requires the `
298298

299299
=== "assert_async_graphql_response_module.py"
300300

301-
```python hl_lines="15"
301+
```python hl_lines="14"
302302
--8<-- "examples/event_handler_graphql/src/assert_async_graphql_response_module.py"
303303
```
304304

examples/middleware_factory/src/combining_powertools_utilities_function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
from aws_lambda_powertools.event_handler import APIGatewayRestResolver
1010
from aws_lambda_powertools.event_handler.exceptions import InternalServerError
1111
from aws_lambda_powertools.middleware_factory import lambda_handler_decorator
12-
from aws_lambda_powertools.shared.types import JSONType
1312
from aws_lambda_powertools.utilities.feature_flags import AppConfigStore, FeatureFlags
13+
from aws_lambda_powertools.utilities.feature_flags.types import JSONType
1414
from aws_lambda_powertools.utilities.jmespath_utils import extract_data_from_envelope
1515
from aws_lambda_powertools.utilities.typing import LambdaContext
1616
from aws_lambda_powertools.utilities.validation import SchemaValidationError, validate

tests/functional/feature_flags/test_time_based_actions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from botocore.config import Config
55
from dateutil.tz import gettz
66

7-
from aws_lambda_powertools.shared.types import JSONType
87
from aws_lambda_powertools.utilities.feature_flags.appconfig import AppConfigStore
98
from aws_lambda_powertools.utilities.feature_flags.feature_flags import FeatureFlags
109
from aws_lambda_powertools.utilities.feature_flags.schema import (
@@ -19,6 +18,7 @@
1918
TimeKeys,
2019
TimeValues,
2120
)
21+
from aws_lambda_powertools.utilities.feature_flags.types import JSONType
2222

2323

2424
def evaluate_mocked_schema(

0 commit comments

Comments
 (0)