Skip to content

Commit 7f78b6a

Browse files
docs(api): migrating the AppConfig utility to mkdocstrings (#6008)
Mkdocstrings - AppConfig module
1 parent af13807 commit 7f78b6a

File tree

11 files changed

+35
-8
lines changed

11 files changed

+35
-8
lines changed

aws_lambda_powertools/utilities/feature_flags/appconfig.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
"""Advanced feature flags utility
2+
!!! abstract "Usage Documentation"
3+
[`Feature Flags`](../../utilities/feature_flags.md)
4+
"""
15
from __future__ import annotations
26

37
import logging

aws_lambda_powertools/utilities/feature_flags/base.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ def get_configuration(self) -> dict[str, Any]:
2828
dict[str, Any]
2929
parsed JSON dictionary
3030
31-
**Example**
31+
Example
32+
-------
3233
3334
```python
3435
{

aws_lambda_powertools/utilities/feature_flags/comparators.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ def compare_time_range(context_value: Any, condition_value: dict) -> bool:
5656
end_time = current_time.replace(hour=int(end_hour), minute=int(end_min))
5757

5858
if int(end_hour) < int(start_hour):
59+
# In normal circumstances, we need to assert **both** conditions
60+
"""
5961
# When the end hour is smaller than start hour, it means we are crossing a day's boundary.
6062
# In this case we need to assert that current_time is **either** on one side or the other side of the boundary
6163
#
@@ -69,10 +71,9 @@ def compare_time_range(context_value: Any, condition_value: dict) -> bool:
6971
# │ │ │
7072
# └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
7173
# │
72-
74+
"""
7375
return (start_time <= current_time) or (current_time <= end_time)
7476
else:
75-
# In normal circumstances, we need to assert **both** conditions
7677
return start_time <= current_time <= end_time
7778

7879

aws_lambda_powertools/utilities/feature_flags/feature_flags.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ def get_configuration(self) -> dict:
179179
dict[str, dict]
180180
parsed JSON dictionary
181181
182-
**Example**
182+
Example
183+
-------
183184
184185
```python
185186
{
@@ -251,7 +252,7 @@ def evaluate(self, *, name: str, context: dict[str, Any] | None = None, default:
251252
Can be boolean or any JSON values for non-boolean features.
252253
253254
254-
Examples
255+
Example
255256
--------
256257
257258
```python
@@ -343,7 +344,8 @@ def get_enabled_features(self, *, context: dict[str, Any] | None = None) -> list
343344
list[str]
344345
list of all feature names that either matches context or have True as default
345346
346-
**Example**
347+
Example
348+
-------
347349
348350
```python
349351
["premium_features", "my_feature_two", "always_true_feature"]
@@ -400,8 +402,8 @@ def validation_exception_handler(self, exc_class: Exception | list[Exception]):
400402
exc_class : Exception | list[Exception]
401403
One or more exceptions to catch
402404
403-
Examples
404-
--------
405+
Example
406+
-------
405407
406408
```python
407409
feature_flags = FeatureFlags(store=app_config)
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<!-- markdownlint-disable MD043 MD041 -->
2+
::: aws_lambda_powertools.utilities.feature_flags.appconfig

docs/api_doc/feature_flags/base.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<!-- markdownlint-disable MD043 MD041 -->
2+
::: aws_lambda_powertools.utilities.feature_flags.base
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<!-- markdownlint-disable MD043 MD041 -->
2+
::: aws_lambda_powertools.utilities.feature_flags.comparators
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<!-- markdownlint-disable MD043 MD041 -->
2+
::: aws_lambda_powertools.utilities.feature_flags.exceptions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<!-- markdownlint-disable MD043 MD041 -->
2+
::: aws_lambda_powertools.utilities.feature_flags.feature_flags

docs/api_doc/feature_flags/schema.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<!-- markdownlint-disable MD043 MD041 -->
2+
::: aws_lambda_powertools.utilities.feature_flags.schema

mkdocs.yml

+7
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ nav:
6363
# - Casual to regular contributor: contributing/tracks/casual_regular_contributor.md
6464
# - Customer to advocate: contributing/tracks/customer_advocate.md
6565
- API Documentation:
66+
- Feature Flags:
67+
- AppConfig: api_doc/feature_flags/appconfig.md
68+
- Base: api_doc/feature_flags/base.md
69+
- Comparators: api_doc/feature_flags/comparators.md
70+
- Exceptions: api_doc/feature_flags/exceptions.md
71+
- Feature flags: api_doc/feature_flags/feature_flags.md
72+
- Schema: api_doc/feature_flags/schema.md
6673
- Idempotency:
6774
- Base: api_doc/idempotency/base.md
6875
- Config: api_doc/idempotency/config.md

0 commit comments

Comments
 (0)