hc99 commited on
Commit
4021124
·
verified ·
1 Parent(s): 476455e

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. testbed/aws-powertools__powertools-lambda-python/.flake8 +17 -0
  2. testbed/aws-powertools__powertools-lambda-python/.gitignore +317 -0
  3. testbed/aws-powertools__powertools-lambda-python/.gitleaks.toml +15 -0
  4. testbed/aws-powertools__powertools-lambda-python/.gitleaksignore +3 -0
  5. testbed/aws-powertools__powertools-lambda-python/.gitpod.Dockerfile +11 -0
  6. testbed/aws-powertools__powertools-lambda-python/.gitpod.yml +19 -0
  7. testbed/aws-powertools__powertools-lambda-python/.gitpod_requirements.in +1 -0
  8. testbed/aws-powertools__powertools-lambda-python/.gitpod_requirements.txt +85 -0
  9. testbed/aws-powertools__powertools-lambda-python/.markdownlint.yaml +240 -0
  10. testbed/aws-powertools__powertools-lambda-python/.markdownlintignore +2 -0
  11. testbed/aws-powertools__powertools-lambda-python/.pre-commit-config.yaml +53 -0
  12. testbed/aws-powertools__powertools-lambda-python/.pylintrc +12 -0
  13. testbed/aws-powertools__powertools-lambda-python/404.html +20 -0
  14. testbed/aws-powertools__powertools-lambda-python/CHANGELOG.md +0 -0
  15. testbed/aws-powertools__powertools-lambda-python/CODE_OF_CONDUCT.md +4 -0
  16. testbed/aws-powertools__powertools-lambda-python/CONTRIBUTING.md +185 -0
  17. testbed/aws-powertools__powertools-lambda-python/LICENSE +16 -0
  18. testbed/aws-powertools__powertools-lambda-python/MAINTAINERS.md +3 -0
  19. testbed/aws-powertools__powertools-lambda-python/MANIFEST.in +6 -0
  20. testbed/aws-powertools__powertools-lambda-python/Makefile +118 -0
  21. testbed/aws-powertools__powertools-lambda-python/README.md +103 -0
  22. testbed/aws-powertools__powertools-lambda-python/SECURITY.md +7 -0
  23. testbed/aws-powertools__powertools-lambda-python/THIRD-PARTY-LICENSES +200 -0
  24. testbed/aws-powertools__powertools-lambda-python/bandit.baseline +1769 -0
  25. testbed/aws-powertools__powertools-lambda-python/codecov.yml +2 -0
  26. testbed/aws-powertools__powertools-lambda-python/layer/.gitignore +10 -0
  27. testbed/aws-powertools__powertools-lambda-python/layer/README.md +27 -0
  28. testbed/aws-powertools__powertools-lambda-python/layer/app.py +36 -0
  29. testbed/aws-powertools__powertools-lambda-python/layer/cdk.json +35 -0
  30. testbed/aws-powertools__powertools-lambda-python/layer/layer/__init__.py +0 -0
  31. testbed/aws-powertools__powertools-lambda-python/layer/layer/canary/app.py +132 -0
  32. testbed/aws-powertools__powertools-lambda-python/layer/layer/canary_stack.py +176 -0
  33. testbed/aws-powertools__powertools-lambda-python/layer/layer/layer_stack.py +175 -0
  34. testbed/aws-powertools__powertools-lambda-python/layer/poetry.lock +446 -0
  35. testbed/aws-powertools__powertools-lambda-python/layer/pyproject.toml +18 -0
  36. testbed/aws-powertools__powertools-lambda-python/layer/sar/template.txt +41 -0
  37. testbed/aws-powertools__powertools-lambda-python/layer/scripts/update_layer_arn.sh +78 -0
  38. testbed/aws-powertools__powertools-lambda-python/mkdocs.yml +160 -0
  39. testbed/aws-powertools__powertools-lambda-python/mypy.ini +61 -0
  40. testbed/aws-powertools__powertools-lambda-python/noxfile.py +194 -0
  41. testbed/aws-powertools__powertools-lambda-python/package-lock.json +52 -0
  42. testbed/aws-powertools__powertools-lambda-python/package.json +10 -0
  43. testbed/aws-powertools__powertools-lambda-python/parallel_run_e2e.py +17 -0
  44. testbed/aws-powertools__powertools-lambda-python/poetry.lock +0 -0
  45. testbed/aws-powertools__powertools-lambda-python/pyproject.toml +211 -0
  46. testbed/aws-powertools__powertools-lambda-python/ruff.toml +100 -0
  47. testbed/aws-powertools__powertools-lambda-python/tests/__init__.py +0 -0
  48. testbed/aws-powertools__powertools-lambda-python/tests/functional/__init__.py +0 -0
  49. testbed/aws-powertools__powertools-lambda-python/tests/functional/data_masking/__init__.py +0 -0
  50. testbed/aws-powertools__powertools-lambda-python/tests/functional/data_masking/_aws_encryption_sdk/test_aws_encryption_sdk.py +474 -0
testbed/aws-powertools__powertools-lambda-python/.flake8 ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [flake8]
2
+ exclude = docs, .eggs, setup.py, example, .aws-sam, .git, dist, *.md, *.yaml, example/samconfig.toml, *.txt, *.ini
3
+ ignore = E203, E266, W503, BLK100, W291, I004
4
+ max-line-length = 120
5
+ max-complexity = 15
6
+ ; flake8-builtins isn't honouring inline ignore (A003)
7
+ per-file-ignores =
8
+ tests/e2e/utils/data_builder/__init__.py:F401
9
+ tests/e2e/utils/data_fetcher/__init__.py:F401
10
+ aws_lambda_powertools/utilities/data_classes/s3_event.py:A003
11
+
12
+ [isort]
13
+ multi_line_output = 3
14
+ include_trailing_comma = true
15
+ force_grid_wrap = 0
16
+ use_parentheses = true
17
+ line_length = 120
testbed/aws-powertools__powertools-lambda-python/.gitignore ADDED
@@ -0,0 +1,317 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Created by https://www.gitignore.io/api/osx,linux,python,windows,pycharm,visualstudiocode
2
+ # Edit at https://www.gitignore.io/?templates=osx,linux,python,windows,pycharm,visualstudiocode
3
+
4
+ ### Linux ###
5
+ *~
6
+
7
+ # temporary files which can be created if a process still has a handle open of a deleted file
8
+ .fuse_hidden*
9
+
10
+ # KDE directory preferences
11
+ .directory
12
+
13
+ # Linux trash folder which might appear on any partition or disk
14
+ .Trash-*
15
+
16
+ # .nfs files are created when an open file is removed but is still being accessed
17
+ .nfs*
18
+
19
+ ### OSX ###
20
+ # General
21
+ .DS_Store
22
+ .AppleDouble
23
+ .LSOverride
24
+
25
+ # Icon must end with two \r
26
+ Icon
27
+
28
+ # Thumbnails
29
+ ._*
30
+
31
+ # Files that might appear in the root of a volume
32
+ .DocumentRevisions-V100
33
+ .fseventsd
34
+ .Spotlight-V100
35
+ .TemporaryItems
36
+ .Trashes
37
+ .VolumeIcon.icns
38
+ .com.apple.timemachine.donotpresent
39
+
40
+ # Directories potentially created on remote AFP share
41
+ .AppleDB
42
+ .AppleDesktop
43
+ Network Trash Folder
44
+ Temporary Items
45
+ .apdisk
46
+
47
+ ### PyCharm ###
48
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
49
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
50
+
51
+ # User-specific stuff
52
+ .idea/**/workspace.xml
53
+ .idea/**/tasks.xml
54
+ .idea/**/usage.statistics.xml
55
+ .idea/**/dictionaries
56
+ .idea/**/shelf
57
+
58
+ # Generated files
59
+ .idea/**/contentModel.xml
60
+
61
+ # Sensitive or high-churn files
62
+ .idea/**/dataSources/
63
+ .idea/**/dataSources.ids
64
+ .idea/**/dataSources.local.xml
65
+ .idea/**/sqlDataSources.xml
66
+ .idea/**/dynamic.xml
67
+ .idea/**/uiDesigner.xml
68
+ .idea/**/dbnavigator.xml
69
+
70
+ # Gradle
71
+ .idea/**/gradle.xml
72
+ .idea/**/libraries
73
+
74
+ # Gradle and Maven with auto-import
75
+ # When using Gradle or Maven with auto-import, you should exclude module files,
76
+ # since they will be recreated, and may cause churn. Uncomment if using
77
+ # auto-import.
78
+ # .idea/modules.xml
79
+ # .idea/*.iml
80
+ # .idea/modules
81
+ # *.iml
82
+ # *.ipr
83
+
84
+ # CMake
85
+ cmake-build-*/
86
+
87
+ # Mongo Explorer plugin
88
+ .idea/**/mongoSettings.xml
89
+
90
+ # File-based project format
91
+ *.iws
92
+
93
+ # IntelliJ
94
+ out/
95
+
96
+ # mpeltonen/sbt-idea plugin
97
+ .idea_modules/
98
+
99
+ # JIRA plugin
100
+ atlassian-ide-plugin.xml
101
+
102
+ # Cursive Clojure plugin
103
+ .idea/replstate.xml
104
+
105
+ # Crashlytics plugin (for Android Studio and IntelliJ)
106
+ com_crashlytics_export_strings.xml
107
+ crashlytics.properties
108
+ crashlytics-build.properties
109
+ fabric.properties
110
+
111
+ # Editor-based Rest Client
112
+ .idea/httpRequests
113
+
114
+ # Android studio 3.1+ serialized cache file
115
+ .idea/caches/build_file_checksums.ser
116
+
117
+ ### PyCharm Patch ###
118
+ # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
119
+
120
+ # *.iml
121
+ # modules.xml
122
+ # .idea/misc.xml
123
+ # *.ipr
124
+
125
+ # Sonarlint plugin
126
+ .idea/sonarlint
127
+
128
+ ### Python ###
129
+ # Byte-compiled / optimized / DLL files
130
+ __pycache__/
131
+ *.py[cod]
132
+ *$py.class
133
+
134
+ # C extensions
135
+ *.so
136
+
137
+ # Distribution / packaging
138
+ .Python
139
+ build/
140
+ develop-eggs/
141
+ dist/
142
+ downloads/
143
+ eggs/
144
+ .eggs/
145
+ lib/
146
+ lib64/
147
+ parts/
148
+ sdist/
149
+ var/
150
+ wheels/
151
+ pip-wheel-metadata/
152
+ share/python-wheels/
153
+ *.egg-info/
154
+ .installed.cfg
155
+ *.egg
156
+ MANIFEST
157
+
158
+ # PyInstaller
159
+ # Usually these files are written by a python script from a template
160
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
161
+ *.manifest
162
+ *.spec
163
+
164
+ # Installer logs
165
+ pip-log.txt
166
+ pip-delete-this-directory.txt
167
+
168
+ # Unit test / coverage reports
169
+ htmlcov/
170
+ .tox/
171
+ .nox/
172
+ .coverage
173
+ .coverage.*
174
+ .cache
175
+ nosetests.xml
176
+ coverage.xml
177
+ *.cover
178
+ .hypothesis/
179
+ .pytest_cache/
180
+
181
+ # Translations
182
+ *.mo
183
+ *.pot
184
+
185
+ # Django stuff:
186
+ *.log
187
+ local_settings.py
188
+ db.sqlite3
189
+ db.sqlite3-journal
190
+
191
+ # Flask stuff:
192
+ instance/
193
+ .webassets-cache
194
+
195
+ # Scrapy stuff:
196
+ .scrapy
197
+
198
+ # Sphinx documentation
199
+ docs/_build/
200
+
201
+ # PyBuilder
202
+ target/
203
+
204
+ # Jupyter Notebook
205
+ .ipynb_checkpoints
206
+
207
+ # IPython
208
+ profile_default/
209
+ ipython_config.py
210
+
211
+ # pyenv
212
+ .python-version
213
+
214
+ # pipenv
215
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
216
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
217
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
218
+ # install all needed dependencies.
219
+ #Pipfile.lock
220
+
221
+ # celery beat schedule file
222
+ celerybeat-schedule
223
+
224
+ # SageMath parsed files
225
+ *.sage.py
226
+
227
+ # Environments
228
+ .env
229
+ .venv
230
+ env/
231
+ venv/
232
+ ENV/
233
+ env.bak/
234
+ venv.bak/
235
+
236
+ # Spyder project settings
237
+ .spyderproject
238
+ .spyproject
239
+
240
+ # Rope project settings
241
+ .ropeproject
242
+
243
+ # mkdocs documentation
244
+ /site
245
+
246
+ # mypy
247
+ .mypy_cache/
248
+ .dmypy.json
249
+ dmypy.json
250
+
251
+ # Pyre type checker
252
+ .pyre/
253
+
254
+ ### VisualStudioCode ###
255
+ .vscode
256
+ .vscode/*
257
+ !.vscode/tasks.json
258
+ !.vscode/launch.json
259
+ !.vscode/extensions.json
260
+
261
+ ### VisualStudioCode Patch ###
262
+ # Ignore all local history of files
263
+ .history
264
+
265
+ ### Windows ###
266
+ # Windows thumbnail cache files
267
+ Thumbs.db
268
+ Thumbs.db:encryptable
269
+ ehthumbs.db
270
+ ehthumbs_vista.db
271
+
272
+ # Dump file
273
+ *.stackdump
274
+
275
+ # Folder config file
276
+ [Dd]esktop.ini
277
+
278
+ # Recycle Bin used on file shares
279
+ $RECYCLE.BIN/
280
+
281
+ # Windows Installer files
282
+ *.cab
283
+ *.msi
284
+ *.msix
285
+ *.msm
286
+ *.msp
287
+
288
+ # Windows shortcuts
289
+ *.lnk
290
+
291
+ # End of https://www.gitignore.io/api/osx,linux,python,windows,pycharm,visualstudiocode
292
+
293
+ # Misc
294
+ test_report
295
+ wheelhouse
296
+ /.idea/*
297
+ *.html
298
+ TMP_CHANGELOG.md
299
+
300
+ # Docs files
301
+ docs/.cache/
302
+ docs/public
303
+ node_modules
304
+ api/
305
+ site/
306
+ !404.html
307
+ !docs/overrides/*.html
308
+
309
+ # CDK
310
+ .cdk
311
+
312
+ !.github/workflows/lib
313
+ examples/**/sam/.aws-sam
314
+
315
+ cdk.out
316
+ # NOTE: different accounts will be used for E2E thus creating unnecessary git clutter
317
+ cdk.context.json
testbed/aws-powertools__powertools-lambda-python/.gitleaks.toml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Title for the gitleaks configuration file.
2
+ title = "Gitleaks"
3
+
4
+ [extend]
5
+ # useDefault will extend the base configuration with the default gitleaks config:
6
+ # https://github.com/zricethezav/gitleaks/blob/master/config/gitleaks.toml
7
+ useDefault = true
8
+
9
+ [allowlist]
10
+ description = "Allow list false positive"
11
+
12
+ # Allow list paths to ignore due to false positives.
13
+ paths = [
14
+ '''tests/unit/parser/test_kinesis_firehose\.py''',
15
+ ]
testbed/aws-powertools__powertools-lambda-python/.gitleaksignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ examples/batch_processing/src/context_manager_access_output_pydantic.txt:aws-access-token:10
2
+ examples/batch_processing/src/context_manager_access_output_pydantic.txt:aws-access-token:15
3
+ examples/batch_processing/src/context_manager_access_output.txt:aws-access-token:10
testbed/aws-powertools__powertools-lambda-python/.gitpod.Dockerfile ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # See here all gitpod images available: https://hub.docker.com/r/gitpod/workspace-python-3.11/tags
2
+ # Current python version: 3.11.9
3
+ FROM gitpod/workspace-python-3.11@sha256:2d9a242844bef5710ab4622899a5254a0c59f0ac58c0d3ac998f749323f43951
4
+
5
+ WORKDIR /app
6
+ ADD . /app
7
+
8
+ # Installing pre-commit as system package and not user package. Git needs this to execute pre-commit hooks.
9
+ RUN export PIP_USER=no
10
+ # pre-commit v3.7.1
11
+ RUN python3 -m pip install --require-hashes -r .gitpod_requirements.txt
testbed/aws-powertools__powertools-lambda-python/.gitpod.yml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ image:
2
+ file: .gitpod.Dockerfile
3
+ tasks:
4
+ - init: make dev-gitpod
5
+ vscode:
6
+ extensions:
7
+ - ms-python.python # IntelliSense (Pylance), Linting, Debugging (multi-threaded, remote), Jupyter Notebooks, code formatting, refactoring, unit tests, and more.
8
+ - littlefoxteam.vscode-python-test-adapter # Run your Python tests in the Sidebar of Visual Studio Code
9
+ - ms-azuretools.vscode-docker # Makes it easy to create, manage, and debug containerized applications.
10
+ - davidanson.vscode-markdownlint # Markdown linting and style checking for Visual Studio Code
11
+ - bungcip.better-toml # Better TOML Language support
12
+ - oderwat.indent-rainbow # Makes indentation easier to read
13
+ - yzhang.markdown-all-in-one # Autoformat, better visualization, snippets, and markdown export to multiple fmts
14
+ - bierner.markdown-mermaid # Previews mermaid diagrams when previewing markdown
15
+ - matangover.mypy # Highlight mypy issues
16
+ - njpwerner.autodocstring # Auto-generate docsstrings in numpy format that we use
17
+ - netcorext.uuid-generator # For those helping create code snippets for docs
18
+ - streetsidesoftware.code-spell-checker # Spell checker that works with camel case too
19
+ - bungcip.better-toml # In case GitPod doesn't have support for TOML pyproject.toml
testbed/aws-powertools__powertools-lambda-python/.gitpod_requirements.in ADDED
@@ -0,0 +1 @@
 
 
1
+ pre-commit==3.7.1
testbed/aws-powertools__powertools-lambda-python/.gitpod_requirements.txt ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # This file is autogenerated by pip-compile with Python 3.11
3
+ # by the following command:
4
+ #
5
+ # pip-compile --generate-hashes --output-file=.gitpod_requirements.txt .gitpod_requirements.in
6
+ #
7
+ cfgv==3.3.1 \
8
+ --hash=sha256:c6a0883f3917a037485059700b9e75da2464e6c27051014ad85ba6aaa5884426 \
9
+ --hash=sha256:f5a830efb9ce7a445376bb66ec94c638a9787422f96264c98edc6bdeed8ab736
10
+ # via pre-commit
11
+ distlib==0.3.6 \
12
+ --hash=sha256:14bad2d9b04d3a36127ac97f30b12a19268f211063d8f8ee4f47108896e11b46 \
13
+ --hash=sha256:f35c4b692542ca110de7ef0bea44d73981caeb34ca0b9b6b2e6d7790dda8f80e
14
+ # via virtualenv
15
+ filelock==3.12.2 \
16
+ --hash=sha256:002740518d8aa59a26b0c76e10fb8c6e15eae825d34b6fdf670333fd7b938d81 \
17
+ --hash=sha256:cbb791cdea2a72f23da6ac5b5269ab0a0d161e9ef0100e653b69049a7706d1ec
18
+ # via virtualenv
19
+ identify==2.5.24 \
20
+ --hash=sha256:0aac67d5b4812498056d28a9a512a483f5085cc28640b02b258a59dac34301d4 \
21
+ --hash=sha256:986dbfb38b1140e763e413e6feb44cd731faf72d1909543178aa79b0e258265d
22
+ # via pre-commit
23
+ nodeenv==1.8.0 \
24
+ --hash=sha256:d51e0c37e64fbf47d017feac3145cdbb58836d7eee8c6f6d3b6880c5456227d2 \
25
+ --hash=sha256:df865724bb3c3adc86b3876fa209771517b0cfe596beff01a92700e0e8be4cec
26
+ # via pre-commit
27
+ platformdirs==3.8.0 \
28
+ --hash=sha256:b0cabcb11063d21a0b261d557acb0a9d2126350e63b70cdf7db6347baea456dc \
29
+ --hash=sha256:ca9ed98ce73076ba72e092b23d3c93ea6c4e186b3f1c3dad6edd98ff6ffcca2e
30
+ # via virtualenv
31
+ pre-commit==3.7.1 \
32
+ --hash=sha256:8ca3ad567bc78a4972a3f1a477e94a79d4597e8140a6e0b651c5e33899c3654a \
33
+ --hash=sha256:fae36fd1d7ad7d6a5a1c0b0d5adb2ed1a3bda5a21bf6c3e5372073d7a11cd4c5
34
+ # via -r .gitpod_requirements.in
35
+ pyyaml==6.0 \
36
+ --hash=sha256:01b45c0191e6d66c470b6cf1b9531a771a83c1c4208272ead47a3ae4f2f603bf \
37
+ --hash=sha256:0283c35a6a9fbf047493e3a0ce8d79ef5030852c51e9d911a27badfde0605293 \
38
+ --hash=sha256:055d937d65826939cb044fc8c9b08889e8c743fdc6a32b33e2390f66013e449b \
39
+ --hash=sha256:07751360502caac1c067a8132d150cf3d61339af5691fe9e87803040dbc5db57 \
40
+ --hash=sha256:0b4624f379dab24d3725ffde76559cff63d9ec94e1736b556dacdfebe5ab6d4b \
41
+ --hash=sha256:0ce82d761c532fe4ec3f87fc45688bdd3a4c1dc5e0b4a19814b9009a29baefd4 \
42
+ --hash=sha256:1e4747bc279b4f613a09eb64bba2ba602d8a6664c6ce6396a4d0cd413a50ce07 \
43
+ --hash=sha256:213c60cd50106436cc818accf5baa1aba61c0189ff610f64f4a3e8c6726218ba \
44
+ --hash=sha256:231710d57adfd809ef5d34183b8ed1eeae3f76459c18fb4a0b373ad56bedcdd9 \
45
+ --hash=sha256:277a0ef2981ca40581a47093e9e2d13b3f1fbbeffae064c1d21bfceba2030287 \
46
+ --hash=sha256:2cd5df3de48857ed0544b34e2d40e9fac445930039f3cfe4bcc592a1f836d513 \
47
+ --hash=sha256:40527857252b61eacd1d9af500c3337ba8deb8fc298940291486c465c8b46ec0 \
48
+ --hash=sha256:432557aa2c09802be39460360ddffd48156e30721f5e8d917f01d31694216782 \
49
+ --hash=sha256:473f9edb243cb1935ab5a084eb238d842fb8f404ed2193a915d1784b5a6b5fc0 \
50
+ --hash=sha256:48c346915c114f5fdb3ead70312bd042a953a8ce5c7106d5bfb1a5254e47da92 \
51
+ --hash=sha256:50602afada6d6cbfad699b0c7bb50d5ccffa7e46a3d738092afddc1f9758427f \
52
+ --hash=sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2 \
53
+ --hash=sha256:77f396e6ef4c73fdc33a9157446466f1cff553d979bd00ecb64385760c6babdc \
54
+ --hash=sha256:81957921f441d50af23654aa6c5e5eaf9b06aba7f0a19c18a538dc7ef291c5a1 \
55
+ --hash=sha256:819b3830a1543db06c4d4b865e70ded25be52a2e0631ccd2f6a47a2822f2fd7c \
56
+ --hash=sha256:897b80890765f037df3403d22bab41627ca8811ae55e9a722fd0392850ec4d86 \
57
+ --hash=sha256:98c4d36e99714e55cfbaaee6dd5badbc9a1ec339ebfc3b1f52e293aee6bb71a4 \
58
+ --hash=sha256:9df7ed3b3d2e0ecfe09e14741b857df43adb5a3ddadc919a2d94fbdf78fea53c \
59
+ --hash=sha256:9fa600030013c4de8165339db93d182b9431076eb98eb40ee068700c9c813e34 \
60
+ --hash=sha256:a80a78046a72361de73f8f395f1f1e49f956c6be882eed58505a15f3e430962b \
61
+ --hash=sha256:afa17f5bc4d1b10afd4466fd3a44dc0e245382deca5b3c353d8b757f9e3ecb8d \
62
+ --hash=sha256:b3d267842bf12586ba6c734f89d1f5b871df0273157918b0ccefa29deb05c21c \
63
+ --hash=sha256:b5b9eccad747aabaaffbc6064800670f0c297e52c12754eb1d976c57e4f74dcb \
64
+ --hash=sha256:bfaef573a63ba8923503d27530362590ff4f576c626d86a9fed95822a8255fd7 \
65
+ --hash=sha256:c5687b8d43cf58545ade1fe3e055f70eac7a5a1a0bf42824308d868289a95737 \
66
+ --hash=sha256:cba8c411ef271aa037d7357a2bc8f9ee8b58b9965831d9e51baf703280dc73d3 \
67
+ --hash=sha256:d15a181d1ecd0d4270dc32edb46f7cb7733c7c508857278d3d378d14d606db2d \
68
+ --hash=sha256:d4b0ba9512519522b118090257be113b9468d804b19d63c71dbcf4a48fa32358 \
69
+ --hash=sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53 \
70
+ --hash=sha256:d4eccecf9adf6fbcc6861a38015c2a64f38b9d94838ac1810a9023a0609e1b78 \
71
+ --hash=sha256:d67d839ede4ed1b28a4e8909735fc992a923cdb84e618544973d7dfc71540803 \
72
+ --hash=sha256:daf496c58a8c52083df09b80c860005194014c3698698d1a57cbcfa182142a3a \
73
+ --hash=sha256:dbad0e9d368bb989f4515da330b88a057617d16b6a8245084f1b05400f24609f \
74
+ --hash=sha256:e61ceaab6f49fb8bdfaa0f92c4b57bcfbea54c09277b1b4f7ac376bfb7a7c174 \
75
+ --hash=sha256:f84fbc98b019fef2ee9a1cb3ce93e3187a6df0b2538a651bfb890254ba9f90b5
76
+ # via pre-commit
77
+ virtualenv==20.23.1 \
78
+ --hash=sha256:34da10f14fea9be20e0fd7f04aba9732f84e593dac291b757ce42e3368a39419 \
79
+ --hash=sha256:8ff19a38c1021c742148edc4f81cb43d7f8c6816d2ede2ab72af5b84c749ade1
80
+ # via pre-commit
81
+
82
+ # WARNING: The following packages were not pinned, but pip requires them to be
83
+ # pinned when the requirements file includes hashes and the requirement is not
84
+ # satisfied by a package already installed. Consider using the --allow-unsafe flag.
85
+ # setuptools
testbed/aws-powertools__powertools-lambda-python/.markdownlint.yaml ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Rules: https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
2
+
3
+ # Default state for all rules
4
+ default: true
5
+
6
+ # Path to configuration file to extend
7
+ extends: null
8
+
9
+ # MD001/heading-increment/header-increment - Heading levels should only increment by one level at a time
10
+ MD001: true
11
+
12
+ # MD002/first-heading-h1/first-header-h1 - First heading should be a top-level heading
13
+ # NOTE: We use h2 due to font size
14
+ MD002: false
15
+
16
+ # MD003/heading-style/header-style - Heading style
17
+ MD003:
18
+ # Heading style
19
+ style: "consistent"
20
+
21
+ # MD004/ul-style - Unordered list style
22
+ MD004:
23
+ # List style
24
+ style: "consistent"
25
+
26
+ # MD005/list-indent - Inconsistent indentation for list items at the same level
27
+ MD005: true
28
+
29
+ # MD006/ul-start-left - Consider starting bulleted lists at the beginning of the line
30
+ MD006: true
31
+
32
+ # MD007/ul-indent - Unordered list indentation
33
+ MD007:
34
+ # Spaces for indent
35
+ indent: 4
36
+ # Whether to indent the first level of the list
37
+ start_indented: false
38
+ # Spaces for first level indent (when start_indented is set)
39
+ start_indent: 2
40
+
41
+ # MD009/no-trailing-spaces - Trailing spaces
42
+ MD009:
43
+ # Spaces for line break
44
+ br_spaces: 2
45
+ # Allow spaces for empty lines in list items
46
+ list_item_empty_lines: false
47
+ # Include unnecessary breaks
48
+ strict: false
49
+
50
+ # MD010/no-hard-tabs - Hard tabs
51
+ # NOTE: Mkdocs Material theme features like code annotations, tabbed content require it
52
+ MD010: false
53
+
54
+ # MD011/no-reversed-links - Reversed link syntax
55
+ MD011: true
56
+
57
+ # MD012/no-multiple-blanks - Multiple consecutive blank lines
58
+ MD012:
59
+ # Consecutive blank lines
60
+ maximum: 1
61
+
62
+ # MD013/line-length - Line length
63
+ MD013:
64
+ # Number of characters
65
+ line_length: 380
66
+ # Number of characters for headings
67
+ heading_line_length: 80
68
+ # Number of characters for code blocks
69
+ code_block_line_length: 265
70
+ # Include code blocks
71
+ code_blocks: true
72
+ # Include tables
73
+ tables: false
74
+ # Include headings
75
+ headings: true
76
+ # Strict length checking
77
+ strict: false
78
+ # Stern length checking
79
+ stern: false
80
+
81
+ # MD014/commands-show-output - Dollar signs used before commands without showing output
82
+ MD014: true
83
+
84
+ # MD018/no-missing-space-atx - No space after hash on atx style heading
85
+ MD018: true
86
+
87
+ # MD019/no-multiple-space-atx - Multiple spaces after hash on atx style heading
88
+ MD019: true
89
+
90
+ # MD020/no-missing-space-closed-atx - No space inside hashes on closed atx style heading
91
+ MD020: true
92
+
93
+ # MD021/no-multiple-space-closed-atx - Multiple spaces inside hashes on closed atx style heading
94
+ MD021: true
95
+
96
+ # MD022/blanks-around-headings/blanks-around-headers - Headings should be surrounded by blank lines
97
+ MD022:
98
+ # Blank lines above heading
99
+ lines_above: 1
100
+ # Blank lines below heading
101
+ lines_below: 1
102
+
103
+ # MD023/heading-start-left/header-start-left - Headings must start at the beginning of the line
104
+ MD023: true
105
+
106
+ # MD024/no-duplicate-heading/no-duplicate-header - Multiple headings with the same content
107
+ MD024:
108
+ # Only check sibling headings
109
+ siblings_only: false
110
+
111
+ # MD025/single-title/single-h1 - Multiple top-level headings in the same document
112
+ MD025:
113
+ # Heading level
114
+ level: 1
115
+ # RegExp for matching title in front matter
116
+ front_matter_title: "^\\s*title\\s*[:=]"
117
+
118
+ # MD026/no-trailing-punctuation - Trailing punctuation in heading
119
+ MD026:
120
+ # Punctuation characters
121
+ punctuation: ".,;:!。,;:!"
122
+
123
+ # MD027/no-multiple-space-blockquote - Multiple spaces after blockquote symbol
124
+ MD027: true
125
+
126
+ # MD028/no-blanks-blockquote - Blank line inside blockquote
127
+ MD028: true
128
+
129
+ # MD029/ol-prefix - Ordered list item prefix
130
+ MD029:
131
+ # List style
132
+ style: "one_or_ordered"
133
+
134
+ # MD030/list-marker-space - Spaces after list markers
135
+ MD030:
136
+ # Spaces for single-line unordered list items
137
+ ul_single: 1
138
+ # Spaces for single-line ordered list items
139
+ ol_single: 1
140
+ # Spaces for multi-line unordered list items
141
+ ul_multi: 1
142
+ # Spaces for multi-line ordered list items
143
+ ol_multi: 1
144
+
145
+ # MD031/blanks-around-fences - Fenced code blocks should be surrounded by blank lines
146
+ MD031:
147
+ # Include list items
148
+ list_items: true
149
+
150
+ # MD032/blanks-around-lists - Lists should be surrounded by blank lines
151
+ MD032: true
152
+
153
+ # MD033/no-inline-html - Inline HTML
154
+ # NOTE: Some content like Logger '<module>' triggers false positives
155
+ MD033: false
156
+
157
+ # MD034/no-bare-urls - Bare URL used
158
+ MD034: true
159
+
160
+ # MD035/hr-style - Horizontal rule style
161
+ MD035:
162
+ # Horizontal rule style
163
+ style: "consistent"
164
+
165
+ # MD036/no-emphasis-as-heading/no-emphasis-as-header - Emphasis used instead of a heading
166
+ # NOTE: We use **<topic>** instead of yet another sub-heading that might not appear in the navigation.
167
+ # this is a trade-off we make to not a gigantic right-navigation
168
+ MD036: false
169
+
170
+ # MD037/no-space-in-emphasis - Spaces inside emphasis markers
171
+ MD037: true
172
+
173
+ # MD038/no-space-in-code - Spaces inside code span elements
174
+ # mkdocs-material requires these in tab content
175
+ MD038: false
176
+
177
+ # MD039/no-space-in-links - Spaces inside link text
178
+ MD039: true
179
+
180
+ # MD040/fenced-code-language - Fenced code blocks should have a language specified
181
+ MD040: true
182
+
183
+ # MD041/first-line-heading/first-line-h1 - First line in a file should be a top-level heading
184
+ MD041:
185
+ # Heading level
186
+ level: 2
187
+ # RegExp for matching title in front matter
188
+ front_matter_title: "^\\s*title\\s*[:=]"
189
+
190
+ # MD042/no-empty-links - No empty links
191
+ # NOTE: Clipboard links like Lambda Layers use empty links
192
+ MD042: false
193
+
194
+ # MD043/required-headings/required-headers - Required heading structure
195
+ # NOTE: Enforce our minimum headers across the docs
196
+ MD043:
197
+ # List of headings
198
+ headings:
199
+ [
200
+ "*",
201
+ "## Key features",
202
+ "*",
203
+ "## Getting started",
204
+ "*",
205
+ "## Advanced",
206
+ "*",
207
+ "## Testing your code",
208
+ "*",
209
+ ]
210
+
211
+ # MD044/proper-names - Proper names should have the correct capitalization
212
+ MD044:
213
+ # List of proper names
214
+ names: []
215
+ # Include code blocks
216
+ code_blocks: true
217
+ # Include HTML elements
218
+ html_elements: true
219
+
220
+ # MD045/no-alt-text - Images should have alternate text (alt text)
221
+ MD045: true
222
+
223
+ # MD046/code-block-style - Code block style
224
+ # Material theme tabbed content feature use indented and simple use fenced; can't support both
225
+ MD046: false
226
+
227
+ # MD047/single-trailing-newline - Files should end with a single newline character
228
+ MD047: true
229
+
230
+ # MD048/code-fence-style - Code fence style
231
+ MD048: false
232
+
233
+ # MD051/link-fragments - Link fragments should be valid
234
+ MD051: true
235
+
236
+ # MD052/reference-links-images - Reference links and images should use a label that is defined
237
+ MD052: true
238
+
239
+ # MD053/link-image-reference-definitions - Link and image reference definitions should be needed
240
+ MD053: true
testbed/aws-powertools__powertools-lambda-python/.markdownlintignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ docs/core/metrics/index.md
2
+ includes/abbreviations.md
testbed/aws-powertools__powertools-lambda-python/.pre-commit-config.yaml ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # We use poetry to run formatting and linting before commit/push
2
+ # Longer checks such as tests, security and complexity baseline
3
+ # are run as part of CI to prevent slower feedback loop
4
+ # All checks can be run locally via `make pr`
5
+
6
+ repos:
7
+ - repo: https://github.com/pre-commit/pre-commit-hooks
8
+ rev: "f71fa2c1f9cf5cb705f73dffe4b21f7c61470ba9" # v4.4.0
9
+ hooks:
10
+ - id: check-merge-conflict
11
+ - id: trailing-whitespace
12
+ - id: check-toml
13
+ - repo: local
14
+ hooks:
15
+ - id: black
16
+ name: formatting::black
17
+ entry: poetry run black
18
+ language: system
19
+ types: [python]
20
+ - id: ruff
21
+ name: linting-format::ruff
22
+ entry: poetry run ruff check
23
+ language: system
24
+ types: [python]
25
+ - repo: https://github.com/igorshubovych/markdownlint-cli
26
+ rev: "ce0d77ac47dc921b62429804fe763d4d35f66a76" # v0.34.0
27
+ hooks:
28
+ - id: markdownlint-docker
29
+ args: ["--fix"]
30
+ - repo: local
31
+ hooks:
32
+ - id: cloudformation
33
+ name: linting::cloudformation
34
+ entry: poetry run cfn-lint
35
+ language: system
36
+ types: [yaml]
37
+ exclude: examples/homepage/install/.*?/serverless\.yml$
38
+ files: examples/.*
39
+ - repo: https://github.com/rhysd/actionlint
40
+ rev: "fd7ba3c382e13dcc0248e425b4cbc3f1185fa3ee" # v1.6.24
41
+ hooks:
42
+ - id: actionlint-docker
43
+ args: [-pyflakes=]
44
+ - repo: https://github.com/antonbabenko/pre-commit-terraform
45
+ rev: 3420134c37197c21edffc7e6093b14ffae8402f2 # v1.81.0
46
+ hooks:
47
+ - id: terraform_fmt
48
+ args:
49
+ - --args=-recursive
50
+ - repo: https://github.com/gitleaks/gitleaks
51
+ rev: "7804d652c0460f0b61ea9bb2c1f202bfcdbbf144" # v8.16.3
52
+ hooks:
53
+ - id: gitleaks
testbed/aws-powertools__powertools-lambda-python/.pylintrc ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [MESSAGES CONTROL]
2
+ disable=
3
+ too-many-arguments,
4
+ too-many-instance-attributes,
5
+ too-few-public-methods,
6
+ anomalous-backslash-in-string,
7
+ missing-class-docstring,
8
+ missing-module-docstring,
9
+ missing-function-docstring,
10
+
11
+ [FORMAT]
12
+ max-line-length=120
testbed/aws-powertools__powertools-lambda-python/404.html ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
+ <script>
9
+ const websitePath = window.location.pathname;
10
+ const versionRegex = /(\w.+)\/(latest|([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?)/;
11
+
12
+ if (websitePath.search(versionRegex) === -1) {
13
+ let projectName = "powertools-lambda-python"
14
+ // redirect old links to latest version alias
15
+ window.location = websitePath.replace(projectName, `${projectName}/latest`)
16
+ }
17
+ </script>
18
+ </head>
19
+
20
+ </html>
testbed/aws-powertools__powertools-lambda-python/CHANGELOG.md ADDED
The diff for this file is too large to render. See raw diff
 
testbed/aws-powertools__powertools-lambda-python/CODE_OF_CONDUCT.md ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ ## Code of Conduct
2
+ This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
3
+ For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
4
+ opensource-codeofconduct@amazon.com with any additional questions or comments.
testbed/aws-powertools__powertools-lambda-python/CONTRIBUTING.md ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!-- markdownlint-disable MD043 MD041 -->
2
+ # Table of contents <!-- omit in toc -->
3
+
4
+ - [Contributing Guidelines](#contributing-guidelines)
5
+ - [Reporting Bugs/Feature Requests](#reporting-bugsfeature-requests)
6
+ - [Contributing via Pull Requests](#contributing-via-pull-requests)
7
+ - [Dev setup](#dev-setup)
8
+ - [Local documentation](#local-documentation)
9
+ - [Conventions](#conventions)
10
+ - [General terminology and practices](#general-terminology-and-practices)
11
+ - [Testing definition](#testing-definition)
12
+ - [Finding contributions to work on](#finding-contributions-to-work-on)
13
+ - [Code of Conduct](#code-of-conduct)
14
+ - [Security issue notifications](#security-issue-notifications)
15
+ - [Troubleshooting](#troubleshooting)
16
+ - [API reference documentation](#api-reference-documentation)
17
+ - [Licensing](#licensing)
18
+
19
+ # Contributing Guidelines
20
+
21
+ <!-- markdownlint-disable MD013 -->
22
+ Thank you for your interest in contributing to our project. Whether it's a [bug report](https://github.com/aws-powertools/powertools-lambda-python/issues/new?assignees=&labels=bug%2Ctriage&projects=&template=bug_report.yml&title=Bug%3A+TITLE), [new feature](https://github.com/aws-powertools/powertools-lambda-python/issues/new?assignees=&labels=feature-request%2Ctriage&projects=&template=feature_request.yml&title=Feature+request%3A+TITLE), [correction](https://github.com/aws-powertools/powertools-lambda-python/issues/new/choose), or [additional documentation](https://github.com/aws-powertools/powertools-lambda-python/issues/new?assignees=&labels=documentation%2Ctriage&projects=&template=documentation_improvements.yml&title=Docs%3A+TITLE), we greatly value feedback and contributions from our community.
23
+ <!-- markdownlint-enable MD013 -->
24
+
25
+ Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
26
+ information to effectively respond to your bug report or contribution.
27
+
28
+ ## Reporting Bugs/Feature Requests
29
+
30
+ We welcome you to use the GitHub issue tracker to report bugs, suggest features, or documentation improvements.
31
+
32
+ <!-- markdownlint-disable MD013 -->
33
+ [When filing an issue](https://github.com/aws-powertools/powertools-lambda-python/issues/new/choose), please check [existing open](https://github.com/aws-powertools/powertools-lambda-python/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc), or [recently closed](https://github.com/aws-powertools/powertools-lambda-python/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aclosed), issues to make sure somebody else hasn't already reported the issue. Please try to include as much information as you can.
34
+ <!-- markdownlint-enable MD013 -->
35
+
36
+ ## Contributing via Pull Requests
37
+
38
+ Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
39
+
40
+ 1. You are working against the latest source on the **develop** branch.
41
+ 2. You check existing open, and recently merged pull requests to make sure someone else hasn't addressed the problem already.
42
+ 3. You open an [issue](https://github.com/aws-powertools/powertools-lambda-python/issues/new/choose) before you begin any implementation. We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.
43
+
44
+ At a high level, these are the steps to get code merged in the repository - don't worry, nearly all of them are automated.
45
+
46
+ ```mermaid
47
+ timeline
48
+ title Code integration journey (CI)
49
+ Project setup <br> (make dev) : Code checkout
50
+ : Virtual environment
51
+ : Dependencies
52
+ : Git pre-commit hooks
53
+ : Local branch
54
+ : Local changes
55
+ : Local tests
56
+
57
+ Pre-commit checks <br> (git commit) : Merge conflict check
58
+ : Trailing whitespaces
59
+ : TOML checks
60
+ : Code linting (standards)
61
+ : Markdown linting
62
+ : CloudFormation linting
63
+ : GitHub Actions linting
64
+ : Terraform linting
65
+ : Secrets linting
66
+
67
+ Pre-Pull Request <br> (make pr) : Code linting
68
+ : Docs linting
69
+ : Static typing analysis
70
+ : Tests (unit|functional|perf|dependencies)
71
+ : Security baseline
72
+ : Complexity baseline
73
+ : +pre-commit checks
74
+
75
+ Pull Request <br> (CI checks) : Semantic PR title check
76
+ : Related issue check
77
+ : Acknowledgment check
78
+ : Code coverage diff
79
+ : Contribution size check
80
+ : Contribution category check
81
+ : Dependency vulnerability check
82
+ : GitHub Actions security check
83
+ : +pre-pull request checks
84
+
85
+ After merge <br> (CI checks) : End-to-end tests
86
+ : Longer SAST check
87
+ : Security posture check (scorecard)
88
+ : GitHub Actions security check
89
+ : Rebuild Changelog
90
+ : Deploy staging docs
91
+ : Update draft release
92
+ ```
93
+
94
+ ### Dev setup
95
+
96
+ [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/from-referrer/)
97
+
98
+ Firstly, [fork the repository](https://github.com/aws-powertools/powertools-lambda-python/fork).
99
+
100
+ To setup your development environment, we recommend using our pre-configured Cloud environment: <https://gitpod.io/#https://github.com/YOUR_USERNAME/aws-lambda-powertools-python>. Replace YOUR_USERNAME with your GitHub username or organization so the Cloud environment can target your fork accordingly.
101
+
102
+ Alternatively, you can use `make dev` within your local virtual environment.
103
+
104
+ To send us a pull request, please follow these steps:
105
+
106
+ 1. Create a new branch to focus on the specific change you are contributing e.g. `improv/logger-debug-sampling`
107
+ 2. Run all tests, and code baseline checks: `make pr`
108
+ - Git hooks will run linting and formatting while `make pr` run deep checks that also run in the CI process
109
+ 3. Commit to your fork using clear commit messages.
110
+ 4. Send us a pull request with a [conventional semantic title](https://github.com/aws-powertools/powertools-lambda-python/pull/67), and answering any default questions in the pull request interface.
111
+ 5. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
112
+
113
+ GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
114
+ [creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
115
+
116
+ ### Local documentation
117
+
118
+ You might find useful to run both the documentation website and the API reference locally while contributing:
119
+
120
+ - **API reference**: `make docs-api-local`
121
+ - **Docs website**: `make docs-local`
122
+ - If you prefer using Docker: `make docs-local-docker`
123
+
124
+ ## Conventions
125
+
126
+ ### General terminology and practices
127
+
128
+ | Category | Convention |
129
+ | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
130
+ | **Docstring** | We use a slight variation of Numpy convention with markdown to help generate more readable API references. |
131
+ | **Style guide** | We use black as well as [Ruff](https://beta.ruff.rs/docs/) to enforce beyond good practices [PEP8](https://pep8.org/). We use type annotations and enforce static type checking at CI (mypy). |
132
+ | **Core utilities** | Core utilities use a Class, always accept `service` as a constructor parameter, can work in isolation, and are also available in other languages implementation. |
133
+ | **Utilities** | Utilities are not as strict as core and focus on solving a developer experience problem while following the project [Tenets](https://docs.powertools.aws.dev/lambda/python/#tenets). |
134
+ | **Exceptions** | Specific exceptions live within utilities themselves and use `Error` suffix e.g. `MetricUnitError`. |
135
+ | **Git commits** | We follow [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/). We do not enforce conventional commits on contributors to lower the entry bar. Instead, we enforce a conventional PR title so our label automation and changelog are generated correctly. |
136
+ | **API documentation** | API reference docs are generated from docstrings which should have Examples section to allow developers to have what they need within their own IDE. Documentation website covers the wider usage, tips, and strive to be concise. |
137
+ | **Documentation** | We treat it like a product. We sub-divide content aimed at getting started (80% of customers) vs advanced usage (20%). We also ensure customers know how to unit test their code when using our features. |
138
+
139
+ ### Testing definition
140
+
141
+ We group tests in different categories
142
+
143
+ | Test | When to write | Notes | Speed |
144
+ | ----------------- | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
145
+ | Unit tests | Verify the smallest possible unit works. | Networking access is prohibited. Prefer Functional tests given our complexity. | Lightning fast (nsec to ms) |
146
+ | Functional tests | Guarantee functionality works as expected. It's a subset of integration test covering multiple units. | No external dependency. Prefer Fake implementations (in-memory) over Mocks and Stubs. | Fast (ms to few seconds at worst) |
147
+ | Integration tests | Gain confidence that code works with one or more external dependencies. | No need for a Lambda function. Use our code base against an external dependency _e.g., fetch an existing SSM parameter_. | Moderate to slow (a few minutes) |
148
+ | End-to-end tests | Gain confidence that a Lambda function with our code operates as expected. | It simulates how customers configure, deploy, and run their Lambda function - Event Source configuration, IAM permissions, etc. | Slow (minutes) |
149
+ | Performance tests | Ensure critical operations won't increase latency and costs to customers. | CI arbitrary hardware can make it flaky. We'll resume writing perf test after our new Integ/End have significant coverage. | Fast to moderate (a few seconds to a few minutes) |
150
+
151
+ **NOTE**: Functional tests are mandatory. We have plans to create a guide on how to create these different tests. Maintainers will help indicate whether additional tests are necessary and provide assistance as required.
152
+
153
+ ## Finding contributions to work on
154
+
155
+ Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/help wanted/invalid/question/documentation), [looking at any 'help wanted' issues is a great place to start](https://github.com/orgs/aws-powertools/projects/3/views/5?query=is%3Aopen+sort%3Aupdated-desc).
156
+
157
+ ## Code of Conduct
158
+
159
+ This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
160
+ For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
161
+ <opensource-codeofconduct@amazon.com> with any additional questions or comments.
162
+
163
+ ## Security issue notifications
164
+
165
+ If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue.
166
+
167
+ ## Troubleshooting
168
+
169
+ ### API reference documentation
170
+
171
+ When you are working on the codebase and you use the local API reference documentation to preview your changes, you might see the following message: `Module aws_lambda_powertools not found`.
172
+
173
+ This happens when:
174
+
175
+ - You did not install the local dev environment yet
176
+ - You can install dev deps with `make dev` command
177
+ - The code in the repository is raising an exception while the `pdoc` is scanning the codebase
178
+ - Unfortunately, this exception is not shown to you, but if you run, `poetry run pdoc --pdf aws_lambda_powertools`, the exception is shown and you can prevent the exception from being raised
179
+ - Once resolved the documentation should load correctly again
180
+
181
+ ## Licensing
182
+
183
+ See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
184
+
185
+ We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes.
testbed/aws-powertools__powertools-lambda-python/LICENSE ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT No Attribution
2
+
3
+ Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
13
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
15
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
16
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
testbed/aws-powertools__powertools-lambda-python/MAINTAINERS.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ <!-- markdownlint-disable -->
2
+
3
+ Maintainers' playbook moved: https://docs.powertools.aws.dev/lambda/python/latest/maintainers/
testbed/aws-powertools__powertools-lambda-python/MANIFEST.in ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ include LICENSE
2
+ include README.md
3
+ include THIRD-PARTY-LICENSES
4
+
5
+ recursive-exclude * __pycache__
6
+ recursive-exclude * *.py[co]
testbed/aws-powertools__powertools-lambda-python/Makefile ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .PHONY: target dev format lint test coverage-html pr build build-docs build-docs-api build-docs-website
2
+ .PHONY: docs-local docs-api-local security-baseline complexity-baseline release-prod release-test release
3
+
4
+ target:
5
+ @$(MAKE) pr
6
+
7
+ dev:
8
+ pip install --upgrade pip pre-commit poetry
9
+ @$(MAKE) dev-version-plugin
10
+ poetry install --extras "all redis datamasking"
11
+ pre-commit install
12
+
13
+ dev-gitpod:
14
+ pip install --upgrade pip poetry
15
+ poetry install --extras "all redis datamasking"
16
+ pre-commit install
17
+
18
+ format:
19
+ poetry run black aws_lambda_powertools tests examples
20
+
21
+ lint: format
22
+ poetry run ruff check aws_lambda_powertools tests examples
23
+
24
+ lint-docs:
25
+ docker run -v ${PWD}:/markdown 06kellyjac/markdownlint-cli "docs"
26
+
27
+ lint-docs-fix:
28
+ docker run -v ${PWD}:/markdown 06kellyjac/markdownlint-cli --fix "docs"
29
+
30
+ test:
31
+ poetry run pytest -m "not perf" --ignore tests/e2e --cov=aws_lambda_powertools --cov-report=xml
32
+ poetry run pytest --cache-clear tests/performance
33
+
34
+ test-dependencies:
35
+ poetry run nox --error-on-external-run --reuse-venv=yes --non-interactive
36
+
37
+ test-pydanticv2:
38
+ poetry run pytest -m "not perf" --ignore tests/e2e
39
+
40
+ unit-test:
41
+ poetry run pytest tests/unit
42
+
43
+ e2e-test:
44
+ poetry run pytest tests/e2e
45
+
46
+ coverage-html:
47
+ poetry run pytest -m "not perf" --ignore tests/e2e --cov=aws_lambda_powertools --cov-report=html
48
+
49
+ pre-commit:
50
+ pre-commit run --show-diff-on-failure
51
+
52
+ pr: lint lint-docs mypy pre-commit test security-baseline complexity-baseline
53
+
54
+ build: pr
55
+ poetry build
56
+
57
+ release-docs:
58
+ @echo "Rebuilding docs"
59
+ rm -rf site api
60
+ @echo "Updating website docs"
61
+ poetry run mike deploy --push --update-aliases ${VERSION} ${ALIAS}
62
+ @echo "Building API docs"
63
+ @$(MAKE) build-docs-api VERSION=${VERSION}
64
+
65
+ build-docs-api:
66
+ poetry run pdoc --html --output-dir ./api/ ./aws_lambda_powertools --force
67
+ mv -f ./api/aws_lambda_powertools/* ./api/
68
+ rm -rf ./api/aws_lambda_powertools
69
+ mkdir ${VERSION} && cp -R api ${VERSION}
70
+
71
+ docs-local:
72
+ poetry run mkdocs serve
73
+
74
+ docs-local-docker:
75
+ docker build -t squidfunk/mkdocs-material ./docs/
76
+ docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material
77
+
78
+ docs-api-local:
79
+ poetry run pdoc --http : aws_lambda_powertools
80
+
81
+ security-baseline:
82
+ poetry run bandit --baseline bandit.baseline -r aws_lambda_powertools
83
+
84
+ complexity-baseline:
85
+ $(info Maintenability index)
86
+ poetry run radon mi aws_lambda_powertools
87
+ $(info Cyclomatic complexity index)
88
+ poetry run xenon --max-absolute C --max-modules A --max-average A aws_lambda_powertools --exclude aws_lambda_powertools/shared/json_encoder.py,aws_lambda_powertools/utilities/validation/base.py
89
+
90
+ #
91
+ # Use `poetry version <major>/<minor></patch>` for version bump
92
+ #
93
+ release-prod:
94
+ poetry config pypi-token.pypi ${PYPI_TOKEN}
95
+ poetry publish -n
96
+
97
+ release-test:
98
+ poetry config repositories.testpypi https://test.pypi.org/legacy
99
+ poetry config pypi-token.pypi ${PYPI_TEST_TOKEN}
100
+ poetry publish --repository testpypi -n
101
+
102
+ release: pr
103
+ poetry build
104
+ $(MAKE) release-test
105
+ $(MAKE) release-prod
106
+
107
+ changelog:
108
+ git fetch --tags origin
109
+ CURRENT_VERSION=$(shell git describe --abbrev=0 --tag) ;\
110
+ echo "[+] Pre-generating CHANGELOG for tag: $$CURRENT_VERSION" ;\
111
+ docker run -v "${PWD}":/workdir quay.io/git-chglog/git-chglog:0.15.1 > CHANGELOG.md
112
+
113
+ mypy:
114
+ poetry run mypy --pretty aws_lambda_powertools examples
115
+
116
+
117
+ dev-version-plugin:
118
+ poetry self add git+https://github.com/monim67/poetry-bumpversion@315fe3324a699fa12ec20e202eb7375d4327d1c4
testbed/aws-powertools__powertools-lambda-python/README.md ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!-- markdownlint-disable MD013 MD041 MD043 -->
2
+ # Powertools for AWS Lambda (Python)
3
+
4
+ [![Build](https://github.com/aws-powertools/powertools-lambda-python/actions/workflows/quality_check.yml/badge.svg)](https://github.com/aws-powertools/powertools-lambda-python/actions/workflows/python_build.yml)
5
+ [![codecov.io](https://codecov.io/github/aws-powertools/powertools-lambda-python/branch/develop/graphs/badge.svg)](https://app.codecov.io/gh/aws-powertools/powertools-lambda-python)
6
+ ![PythonSupport](https://img.shields.io/static/v1?label=python&message=%203.8|%203.9|%203.10|%203.11|%203.12&color=blue?style=flat-square&logo=python) ![PyPI version](https://badge.fury.io/py/aws-lambda-powertools.svg) ![PyPi monthly downloads](https://img.shields.io/pypi/dm/aws-lambda-powertools) [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/aws-powertools/powertools-lambda-python/badge)](https://api.securityscorecards.dev/projects/github.com/aws-powertools/powertools-lambda-python) [![Join our Discord](https://dcbadge.vercel.app/api/server/B8zZKbbyET?style=flat-square)](https://discord.gg/B8zZKbbyET)
7
+
8
+ Powertools for AWS Lambda (Python) is a developer toolkit to implement Serverless [best practices and increase developer velocity](https://docs.powertools.aws.dev/lambda/python/latest/#features).
9
+
10
+ > Also available in [Java](https://github.com/aws-powertools/powertools-lambda-java), [Typescript](https://github.com/aws-powertools/powertools-lambda-typescript), and [.NET](https://github.com/aws-powertools/powertools-lambda-dotnet).
11
+
12
+ **[📜Documentation](https://docs.powertools.aws.dev/lambda/python/)** | **[🐍PyPi](https://pypi.org/project/aws-lambda-powertools/)** | **[Roadmap](https://docs.powertools.aws.dev/lambda/python/latest/roadmap/)** | **[Detailed blog post](https://aws.amazon.com/blogs/opensource/simplifying-serverless-best-practices-with-lambda-powertools/)**
13
+
14
+ ![hero-image](https://user-images.githubusercontent.com/3340292/198254617-d0fdb672-86a6-4988-8a40-adf437135e0a.png)
15
+
16
+ ## Features
17
+
18
+ * **[Tracing](https://docs.powertools.aws.dev/lambda/python/latest/core/tracer/)** - Decorators and utilities to trace Lambda function handlers, and both synchronous and asynchronous functions
19
+ * **[Logging](https://docs.powertools.aws.dev/lambda/python/latest/core/logger/)** - Structured logging made easier, and decorator to enrich structured logging with key Lambda context details
20
+ * **[Metrics](https://docs.powertools.aws.dev/lambda/python/latest/core/metrics/)** - Custom Metrics created asynchronously via CloudWatch Embedded Metric Format (EMF)
21
+ * **[Event handler: AppSync](https://docs.powertools.aws.dev/lambda/python/latest/core/event_handler/appsync/)** - AWS AppSync event handler for Lambda Direct Resolver and Amplify GraphQL Transformer function
22
+ * **[Event handler: API Gateway and ALB](https://docs.powertools.aws.dev/lambda/python/latest/core/event_handler/api_gateway/)** - Amazon API Gateway REST/HTTP API and ALB event handler for Lambda functions invoked using Proxy integration
23
+ * **[Event handler: Agents for Amazon Bedrock](https://docs.powertools.aws.dev/lambda/python/latest/core/event_handler/bedrock_agents/)** - Create Agents for Amazon Bedrock, automatically generating OpenAPI schemas
24
+ * **[Bring your own middleware](https://docs.powertools.aws.dev/lambda/python/latest/utilities/middleware_factory/)** - Decorator factory to create your own middleware to run logic before, and after each Lambda invocation
25
+ * **[Parameters utility](https://docs.powertools.aws.dev/lambda/python/latest/utilities/parameters/)** - Retrieve and cache parameter values from Parameter Store, Secrets Manager, or DynamoDB
26
+ * **[Batch processing](https://docs.powertools.aws.dev/lambda/python/latest/utilities/batch/)** - Handle partial failures for AWS SQS batch processing
27
+ * **[Typing](https://docs.powertools.aws.dev/lambda/python/latest/utilities/typing/)** - Static typing classes to speedup development in your IDE
28
+ * **[Validation](https://docs.powertools.aws.dev/lambda/python/latest/utilities/validation/)** - JSON Schema validator for inbound events and responses
29
+ * **[Event source data classes](https://docs.powertools.aws.dev/lambda/python/latest/utilities/data_classes/)** - Data classes describing the schema of common Lambda event triggers
30
+ * **[Parser](https://docs.powertools.aws.dev/lambda/python/latest/utilities/parser/)** - Data parsing and deep validation using Pydantic
31
+ * **[Idempotency](https://docs.powertools.aws.dev/lambda/python/latest/utilities/idempotency/)** - Convert your Lambda functions into idempotent operations which are safe to retry
32
+ * **[Data Masking](https://docs.powertools.aws.dev/lambda/python/latest/utilities/data_masking/)** - Protect confidential data with easy removal or encryption
33
+ * **[Feature Flags](https://docs.powertools.aws.dev/lambda/python/latest/utilities/feature_flags/)** - A simple rule engine to evaluate when one or multiple features should be enabled depending on the input
34
+ * **[Streaming](https://docs.powertools.aws.dev/lambda/python/latest/utilities/streaming/)** - Streams datasets larger than the available memory as streaming data.
35
+
36
+ ### Installation
37
+
38
+ With [pip](https://pip.pypa.io/en/latest/index.html) installed, run: ``pip install aws-lambda-powertools``
39
+
40
+ ## Tutorial and Examples
41
+
42
+ * [Tutorial](https://docs.powertools.aws.dev/lambda/python/latest/tutorial)
43
+ * [Serverless Shopping cart](https://github.com/aws-samples/aws-serverless-shopping-cart)
44
+ * [Serverless Airline](https://github.com/aws-samples/aws-serverless-airline-booking)
45
+ * [Serverless E-commerce platform](https://github.com/aws-samples/aws-serverless-ecommerce-platform)
46
+ * [Serverless GraphQL Nanny Booking Api](https://github.com/trey-rosius/babysitter_api)
47
+
48
+ ## How to support Powertools for AWS Lambda (Python)?
49
+
50
+ ### Becoming a reference customer
51
+
52
+ Knowing which companies are using this library is important to help prioritize the project internally. If your company is using Powertools for AWS Lambda (Python), you can request to have your name and logo added to the README file by raising a [Support Powertools for AWS Lambda (Python) (become a reference)](https://github.com/aws-powertools/powertools-lambda-python/issues/new?assignees=&labels=customer-reference&template=support_powertools.yml&title=%5BSupport+Lambda+Powertools%5D%3A+%3Cyour+organization+name%3E) issue.
53
+
54
+ The following companies, among others, use Powertools:
55
+
56
+ * [Alma Media](https://www.almamedia.fi/en/)
57
+ * [Banxware](https://www.banxware.com/)
58
+ * [Brsk](https://www.brsk.co.uk/)
59
+ * [BusPatrol](https://buspatrol.com/)
60
+ * [Capital One](https://www.capitalone.com/)
61
+ * [Caylent](https://caylent.com/)
62
+ * [CHS Inc.](https://www.chsinc.com/)
63
+ * [CPQi (Exadel Financial Services)](https://cpqi.com/)
64
+ * [CloudZero](https://www.cloudzero.com/)
65
+ * [CyberArk](https://www.cyberark.com/)
66
+ * [Flyweight](https://flyweight.io/)
67
+ * [globaldatanet](https://globaldatanet.com/)
68
+ * [IMS](https://ims.tech/)
69
+ * [Jit Security](https://www.jit.io/)
70
+ * [LocalStack](https://www.localstack.cloud/)
71
+ * [Propellor.ai](https://www.propellor.ai/)
72
+ * [Pushpay](https://pushpay.com/)
73
+ * [Recast](https://getrecast.com/)
74
+ * [TopSport](https://www.topsport.com.au/)
75
+ * [Transformity](https://transformity.tech/)
76
+ * [Trek10](https://www.trek10.com/)
77
+ * [Vertex Pharmaceuticals](https://www.vrtx.com/)
78
+
79
+ ### Sharing your work
80
+
81
+ Share what you did with Powertools for AWS Lambda (Python) 💞💞. Blog post, workshops, presentation, sample apps and others. Check out what the community has already shared about Powertools for AWS Lambda (Python) [here](https://docs.powertools.aws.dev/lambda/python/latest/we_made_this/).
82
+
83
+ ### Using Lambda Layer or SAR
84
+
85
+ This helps us understand who uses Powertools for AWS Lambda (Python) in a non-intrusive way, and helps us gain future investments for other Powertools for AWS Lambda languages. When [using Layers](https://docs.powertools.aws.dev/lambda/python/latest/#lambda-layer), you can add Powertools for AWS Lambda (Python) as a dev dependency (or as part of your virtual env) to not impact the development process.
86
+
87
+ ## Credits
88
+
89
+ * Structured logging initial implementation from [aws-lambda-logging](https://gitlab.com/hadrien/aws_lambda_logging)
90
+ * Powertools for AWS Lambda (Python) idea [DAZN Powertools](https://github.com/getndazn/dazn-lambda-powertools/)
91
+
92
+ ## Connect
93
+
94
+ * **Powertools for AWS Lambda on Discord**: `#python` - **[Invite link](https://discord.gg/B8zZKbbyET)**
95
+ * **Email**: <aws-powertools-maintainers@amazon.com>
96
+
97
+ ## Security disclosures
98
+
99
+ If you think you’ve found a potential security issue, please do not post it in the Issues. Instead, please follow the instructions [here](https://aws.amazon.com/security/vulnerability-reporting/) or [email AWS security directly](mailto:aws-security@amazon.com).
100
+
101
+ ## License
102
+
103
+ This library is licensed under the MIT-0 License. See the LICENSE file.
testbed/aws-powertools__powertools-lambda-python/SECURITY.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ <!-- markdownlint-disable MD043 -->
2
+
3
+ ## Reporting a vulnerability
4
+
5
+ If you discover a potential security issue in this project, we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/) or directly via email to <aws-security@amazon.com>.
6
+
7
+ Please do **not** create a public GitHub issue.
testbed/aws-powertools__powertools-lambda-python/THIRD-PARTY-LICENSES ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ** FastAPI - https://github.com/tiangolo/fastapi/ - Used in the OpenAPI feature
2
+
3
+ The MIT License (MIT)
4
+
5
+ Copyright (c) 2018 Sebastián Ramírez
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
24
+
25
+ ** Tensorflow - https://github.com/tensorflow/tensorflow/
26
+
27
+ Apache License
28
+ Version 2.0, January 2004
29
+ http://www.apache.org/licenses/
30
+
31
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
32
+
33
+ 1. Definitions.
34
+
35
+ "License" shall mean the terms and conditions for use, reproduction,
36
+ and distribution as defined by Sections 1 through 9 of this document.
37
+
38
+ "Licensor" shall mean the copyright owner or entity authorized by
39
+ the copyright owner that is granting the License.
40
+
41
+ "Legal Entity" shall mean the union of the acting entity and all
42
+ other entities that control, are controlled by, or are under common
43
+ control with that entity. For the purposes of this definition,
44
+ "control" means (i) the power, direct or indirect, to cause the
45
+ direction or management of such entity, whether by contract or
46
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
47
+ outstanding shares, or (iii) beneficial ownership of such entity.
48
+
49
+ "You" (or "Your") shall mean an individual or Legal Entity
50
+ exercising permissions granted by this License.
51
+
52
+ "Source" form shall mean the preferred form for making modifications,
53
+ including but not limited to software source code, documentation
54
+ source, and configuration files.
55
+
56
+ "Object" form shall mean any form resulting from mechanical
57
+ transformation or translation of a Source form, including but
58
+ not limited to compiled object code, generated documentation,
59
+ and conversions to other media types.
60
+
61
+ "Work" shall mean the work of authorship, whether in Source or
62
+ Object form, made available under the License, as indicated by a
63
+ copyright notice that is included in or attached to the work
64
+ (an example is provided in the Appendix below).
65
+
66
+ "Derivative Works" shall mean any work, whether in Source or Object
67
+ form, that is based on (or derived from) the Work and for which the
68
+ editorial revisions, annotations, elaborations, or other modifications
69
+ represent, as a whole, an original work of authorship. For the purposes
70
+ of this License, Derivative Works shall not include works that remain
71
+ separable from, or merely link (or bind by name) to the interfaces of,
72
+ the Work and Derivative Works thereof.
73
+
74
+ "Contribution" shall mean any work of authorship, including
75
+ the original version of the Work and any modifications or additions
76
+ to that Work or Derivative Works thereof, that is intentionally
77
+ submitted to Licensor for inclusion in the Work by the copyright owner
78
+ or by an individual or Legal Entity authorized to submit on behalf of
79
+ the copyright owner. For the purposes of this definition, "submitted"
80
+ means any form of electronic, verbal, or written communication sent
81
+ to the Licensor or its representatives, including but not limited to
82
+ communication on electronic mailing lists, source code control systems,
83
+ and issue tracking systems that are managed by, or on behalf of, the
84
+ Licensor for the purpose of discussing and improving the Work, but
85
+ excluding communication that is conspicuously marked or otherwise
86
+ designated in writing by the copyright owner as "Not a Contribution."
87
+
88
+ "Contributor" shall mean Licensor and any individual or Legal Entity
89
+ on behalf of whom a Contribution has been received by Licensor and
90
+ subsequently incorporated within the Work.
91
+
92
+ 2. Grant of Copyright License. Subject to the terms and conditions of
93
+ this License, each Contributor hereby grants to You a perpetual,
94
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
95
+ copyright license to reproduce, prepare Derivative Works of,
96
+ publicly display, publicly perform, sublicense, and distribute the
97
+ Work and such Derivative Works in Source or Object form.
98
+
99
+ 3. Grant of Patent License. Subject to the terms and conditions of
100
+ this License, each Contributor hereby grants to You a perpetual,
101
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
102
+ (except as stated in this section) patent license to make, have made,
103
+ use, offer to sell, sell, import, and otherwise transfer the Work,
104
+ where such license applies only to those patent claims licensable
105
+ by such Contributor that are necessarily infringed by their
106
+ Contribution(s) alone or by combination of their Contribution(s)
107
+ with the Work to which such Contribution(s) was submitted. If You
108
+ institute patent litigation against any entity (including a
109
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
110
+ or a Contribution incorporated within the Work constitutes direct
111
+ or contributory patent infringement, then any patent licenses
112
+ granted to You under this License for that Work shall terminate
113
+ as of the date such litigation is filed.
114
+
115
+ 4. Redistribution. You may reproduce and distribute copies of the
116
+ Work or Derivative Works thereof in any medium, with or without
117
+ modifications, and in Source or Object form, provided that You
118
+ meet the following conditions:
119
+
120
+ (a) You must give any other recipients of the Work or
121
+ Derivative Works a copy of this License; and
122
+
123
+ (b) You must cause any modified files to carry prominent notices
124
+ stating that You changed the files; and
125
+
126
+ (c) You must retain, in the Source form of any Derivative Works
127
+ that You distribute, all copyright, patent, trademark, and
128
+ attribution notices from the Source form of the Work,
129
+ excluding those notices that do not pertain to any part of
130
+ the Derivative Works; and
131
+
132
+ (d) If the Work includes a "NOTICE" text file as part of its
133
+ distribution, then any Derivative Works that You distribute must
134
+ include a readable copy of the attribution notices contained
135
+ within such NOTICE file, excluding those notices that do not
136
+ pertain to any part of the Derivative Works, in at least one
137
+ of the following places: within a NOTICE text file distributed
138
+ as part of the Derivative Works; within the Source form or
139
+ documentation, if provided along with the Derivative Works; or,
140
+ within a display generated by the Derivative Works, if and
141
+ wherever such third-party notices normally appear. The contents
142
+ of the NOTICE file are for informational purposes only and
143
+ do not modify the License. You may add Your own attribution
144
+ notices within Derivative Works that You distribute, alongside
145
+ or as an addendum to the NOTICE text from the Work, provided
146
+ that such additional attribution notices cannot be construed
147
+ as modifying the License.
148
+
149
+ You may add Your own copyright statement to Your modifications and
150
+ may provide additional or different license terms and conditions
151
+ for use, reproduction, or distribution of Your modifications, or
152
+ for any such Derivative Works as a whole, provided Your use,
153
+ reproduction, and distribution of the Work otherwise complies with
154
+ the conditions stated in this License.
155
+
156
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
157
+ any Contribution intentionally submitted for inclusion in the Work
158
+ by You to the Licensor shall be under the terms and conditions of
159
+ this License, without any additional terms or conditions.
160
+ Notwithstanding the above, nothing herein shall supersede or modify
161
+ the terms of any separate license agreement you may have executed
162
+ with Licensor regarding such Contributions.
163
+
164
+ 6. Trademarks. This License does not grant permission to use the trade
165
+ names, trademarks, service marks, or product names of the Licensor,
166
+ except as required for reasonable and customary use in describing the
167
+ origin of the Work and reproducing the content of the NOTICE file.
168
+
169
+ 7. Disclaimer of Warranty. Unless required by applicable law or
170
+ agreed to in writing, Licensor provides the Work (and each
171
+ Contributor provides its Contributions) on an "AS IS" BASIS,
172
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
173
+ implied, including, without limitation, any warranties or conditions
174
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
175
+ PARTICULAR PURPOSE. You are solely responsible for determining the
176
+ appropriateness of using or redistributing the Work and assume any
177
+ risks associated with Your exercise of permissions under this License.
178
+
179
+ 8. Limitation of Liability. In no event and under no legal theory,
180
+ whether in tort (including negligence), contract, or otherwise,
181
+ unless required by applicable law (such as deliberate and grossly
182
+ negligent acts) or agreed to in writing, shall any Contributor be
183
+ liable to You for damages, including any direct, indirect, special,
184
+ incidental, or consequential damages of any character arising as a
185
+ result of this License or out of the use or inability to use the
186
+ Work (including but not limited to damages for loss of goodwill,
187
+ work stoppage, computer failure or malfunction, or any and all
188
+ other commercial damages or losses), even if such Contributor
189
+ has been advised of the possibility of such damages.
190
+
191
+ 9. Accepting Warranty or Additional Liability. While redistributing
192
+ the Work or Derivative Works thereof, You may choose to offer,
193
+ and charge a fee for, acceptance of support, warranty, indemnity,
194
+ or other liability obligations and/or rights consistent with this
195
+ License. However, in accepting such obligations, You may act only
196
+ on Your own behalf and on Your sole responsibility, not on behalf
197
+ of any other Contributor, and only if You agree to indemnify,
198
+ defend, and hold each Contributor harmless for any liability
199
+ incurred by, or claims asserted against, such Contributor by reason
200
+ of your accepting any such warranty or additional liability.
testbed/aws-powertools__powertools-lambda-python/bandit.baseline ADDED
@@ -0,0 +1,1769 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "errors": [],
3
+ "generated_at": "2022-09-13T10:44:42Z",
4
+ "metrics": {
5
+ "_totals": {
6
+ "CONFIDENCE.HIGH": 1,
7
+ "CONFIDENCE.LOW": 0,
8
+ "CONFIDENCE.MEDIUM": 0,
9
+ "CONFIDENCE.UNDEFINED": 0,
10
+ "SEVERITY.HIGH": 0,
11
+ "SEVERITY.LOW": 1,
12
+ "SEVERITY.MEDIUM": 0,
13
+ "SEVERITY.UNDEFINED": 0,
14
+ "loc": 12060,
15
+ "nosec": 0,
16
+ "skipped_tests": 0
17
+ },
18
+ "aws_lambda_powertools/__init__.py": {
19
+ "CONFIDENCE.HIGH": 0,
20
+ "CONFIDENCE.LOW": 0,
21
+ "CONFIDENCE.MEDIUM": 0,
22
+ "CONFIDENCE.UNDEFINED": 0,
23
+ "SEVERITY.HIGH": 0,
24
+ "SEVERITY.LOW": 0,
25
+ "SEVERITY.MEDIUM": 0,
26
+ "SEVERITY.UNDEFINED": 0,
27
+ "loc": 7,
28
+ "nosec": 0,
29
+ "skipped_tests": 0
30
+ },
31
+ "aws_lambda_powertools/event_handler/__init__.py": {
32
+ "CONFIDENCE.HIGH": 0,
33
+ "CONFIDENCE.LOW": 0,
34
+ "CONFIDENCE.MEDIUM": 0,
35
+ "CONFIDENCE.UNDEFINED": 0,
36
+ "SEVERITY.HIGH": 0,
37
+ "SEVERITY.LOW": 0,
38
+ "SEVERITY.MEDIUM": 0,
39
+ "SEVERITY.UNDEFINED": 0,
40
+ "loc": 23,
41
+ "nosec": 0,
42
+ "skipped_tests": 0
43
+ },
44
+ "aws_lambda_powertools/event_handler/api_gateway.py": {
45
+ "CONFIDENCE.HIGH": 0,
46
+ "CONFIDENCE.LOW": 0,
47
+ "CONFIDENCE.MEDIUM": 0,
48
+ "CONFIDENCE.UNDEFINED": 0,
49
+ "SEVERITY.HIGH": 0,
50
+ "SEVERITY.LOW": 0,
51
+ "SEVERITY.MEDIUM": 0,
52
+ "SEVERITY.UNDEFINED": 0,
53
+ "loc": 639,
54
+ "nosec": 0,
55
+ "skipped_tests": 0
56
+ },
57
+ "aws_lambda_powertools/event_handler/appsync.py": {
58
+ "CONFIDENCE.HIGH": 0,
59
+ "CONFIDENCE.LOW": 0,
60
+ "CONFIDENCE.MEDIUM": 0,
61
+ "CONFIDENCE.UNDEFINED": 0,
62
+ "SEVERITY.HIGH": 0,
63
+ "SEVERITY.LOW": 0,
64
+ "SEVERITY.MEDIUM": 0,
65
+ "SEVERITY.UNDEFINED": 0,
66
+ "loc": 140,
67
+ "nosec": 0,
68
+ "skipped_tests": 0
69
+ },
70
+ "aws_lambda_powertools/event_handler/content_types.py": {
71
+ "CONFIDENCE.HIGH": 0,
72
+ "CONFIDENCE.LOW": 0,
73
+ "CONFIDENCE.MEDIUM": 0,
74
+ "CONFIDENCE.UNDEFINED": 0,
75
+ "SEVERITY.HIGH": 0,
76
+ "SEVERITY.LOW": 0,
77
+ "SEVERITY.MEDIUM": 0,
78
+ "SEVERITY.UNDEFINED": 0,
79
+ "loc": 3,
80
+ "nosec": 0,
81
+ "skipped_tests": 0
82
+ },
83
+ "aws_lambda_powertools/event_handler/exceptions.py": {
84
+ "CONFIDENCE.HIGH": 0,
85
+ "CONFIDENCE.LOW": 0,
86
+ "CONFIDENCE.MEDIUM": 0,
87
+ "CONFIDENCE.UNDEFINED": 0,
88
+ "SEVERITY.HIGH": 0,
89
+ "SEVERITY.LOW": 0,
90
+ "SEVERITY.MEDIUM": 0,
91
+ "SEVERITY.UNDEFINED": 0,
92
+ "loc": 30,
93
+ "nosec": 0,
94
+ "skipped_tests": 0
95
+ },
96
+ "aws_lambda_powertools/event_handler/lambda_function_url.py": {
97
+ "CONFIDENCE.HIGH": 0,
98
+ "CONFIDENCE.LOW": 0,
99
+ "CONFIDENCE.MEDIUM": 0,
100
+ "CONFIDENCE.UNDEFINED": 0,
101
+ "SEVERITY.HIGH": 0,
102
+ "SEVERITY.LOW": 0,
103
+ "SEVERITY.MEDIUM": 0,
104
+ "SEVERITY.UNDEFINED": 0,
105
+ "loc": 40,
106
+ "nosec": 0,
107
+ "skipped_tests": 0
108
+ },
109
+ "aws_lambda_powertools/exceptions/__init__.py": {
110
+ "CONFIDENCE.HIGH": 0,
111
+ "CONFIDENCE.LOW": 0,
112
+ "CONFIDENCE.MEDIUM": 0,
113
+ "CONFIDENCE.UNDEFINED": 0,
114
+ "SEVERITY.HIGH": 0,
115
+ "SEVERITY.LOW": 0,
116
+ "SEVERITY.MEDIUM": 0,
117
+ "SEVERITY.UNDEFINED": 0,
118
+ "loc": 3,
119
+ "nosec": 0,
120
+ "skipped_tests": 0
121
+ },
122
+ "aws_lambda_powertools/logging/__init__.py": {
123
+ "CONFIDENCE.HIGH": 0,
124
+ "CONFIDENCE.LOW": 0,
125
+ "CONFIDENCE.MEDIUM": 0,
126
+ "CONFIDENCE.UNDEFINED": 0,
127
+ "SEVERITY.HIGH": 0,
128
+ "SEVERITY.LOW": 0,
129
+ "SEVERITY.MEDIUM": 0,
130
+ "SEVERITY.UNDEFINED": 0,
131
+ "loc": 4,
132
+ "nosec": 0,
133
+ "skipped_tests": 0
134
+ },
135
+ "aws_lambda_powertools/logging/correlation_paths.py": {
136
+ "CONFIDENCE.HIGH": 0,
137
+ "CONFIDENCE.LOW": 0,
138
+ "CONFIDENCE.MEDIUM": 0,
139
+ "CONFIDENCE.UNDEFINED": 0,
140
+ "SEVERITY.HIGH": 0,
141
+ "SEVERITY.LOW": 0,
142
+ "SEVERITY.MEDIUM": 0,
143
+ "SEVERITY.UNDEFINED": 0,
144
+ "loc": 9,
145
+ "nosec": 0,
146
+ "skipped_tests": 0
147
+ },
148
+ "aws_lambda_powertools/logging/exceptions.py": {
149
+ "CONFIDENCE.HIGH": 0,
150
+ "CONFIDENCE.LOW": 0,
151
+ "CONFIDENCE.MEDIUM": 0,
152
+ "CONFIDENCE.UNDEFINED": 0,
153
+ "SEVERITY.HIGH": 0,
154
+ "SEVERITY.LOW": 0,
155
+ "SEVERITY.MEDIUM": 0,
156
+ "SEVERITY.UNDEFINED": 0,
157
+ "loc": 2,
158
+ "nosec": 0,
159
+ "skipped_tests": 0
160
+ },
161
+ "aws_lambda_powertools/logging/filters.py": {
162
+ "CONFIDENCE.HIGH": 0,
163
+ "CONFIDENCE.LOW": 0,
164
+ "CONFIDENCE.MEDIUM": 0,
165
+ "CONFIDENCE.UNDEFINED": 0,
166
+ "SEVERITY.HIGH": 0,
167
+ "SEVERITY.LOW": 0,
168
+ "SEVERITY.MEDIUM": 0,
169
+ "SEVERITY.UNDEFINED": 0,
170
+ "loc": 12,
171
+ "nosec": 0,
172
+ "skipped_tests": 0
173
+ },
174
+ "aws_lambda_powertools/logging/formatter.py": {
175
+ "CONFIDENCE.HIGH": 0,
176
+ "CONFIDENCE.LOW": 0,
177
+ "CONFIDENCE.MEDIUM": 0,
178
+ "CONFIDENCE.UNDEFINED": 0,
179
+ "SEVERITY.HIGH": 0,
180
+ "SEVERITY.LOW": 0,
181
+ "SEVERITY.MEDIUM": 0,
182
+ "SEVERITY.UNDEFINED": 0,
183
+ "loc": 220,
184
+ "nosec": 0,
185
+ "skipped_tests": 0
186
+ },
187
+ "aws_lambda_powertools/logging/lambda_context.py": {
188
+ "CONFIDENCE.HIGH": 0,
189
+ "CONFIDENCE.LOW": 0,
190
+ "CONFIDENCE.MEDIUM": 0,
191
+ "CONFIDENCE.UNDEFINED": 0,
192
+ "SEVERITY.HIGH": 0,
193
+ "SEVERITY.LOW": 0,
194
+ "SEVERITY.MEDIUM": 0,
195
+ "SEVERITY.UNDEFINED": 0,
196
+ "loc": 47,
197
+ "nosec": 0,
198
+ "skipped_tests": 0
199
+ },
200
+ "aws_lambda_powertools/logging/logger.py": {
201
+ "CONFIDENCE.HIGH": 1,
202
+ "CONFIDENCE.LOW": 0,
203
+ "CONFIDENCE.MEDIUM": 0,
204
+ "CONFIDENCE.UNDEFINED": 0,
205
+ "SEVERITY.HIGH": 0,
206
+ "SEVERITY.LOW": 1,
207
+ "SEVERITY.MEDIUM": 0,
208
+ "SEVERITY.UNDEFINED": 0,
209
+ "loc": 366,
210
+ "nosec": 0,
211
+ "skipped_tests": 0
212
+ },
213
+ "aws_lambda_powertools/logging/utils.py": {
214
+ "CONFIDENCE.HIGH": 0,
215
+ "CONFIDENCE.LOW": 0,
216
+ "CONFIDENCE.MEDIUM": 0,
217
+ "CONFIDENCE.UNDEFINED": 0,
218
+ "SEVERITY.HIGH": 0,
219
+ "SEVERITY.LOW": 0,
220
+ "SEVERITY.MEDIUM": 0,
221
+ "SEVERITY.UNDEFINED": 0,
222
+ "loc": 58,
223
+ "nosec": 0,
224
+ "skipped_tests": 0
225
+ },
226
+ "aws_lambda_powertools/metrics/__init__.py": {
227
+ "CONFIDENCE.HIGH": 0,
228
+ "CONFIDENCE.LOW": 0,
229
+ "CONFIDENCE.MEDIUM": 0,
230
+ "CONFIDENCE.UNDEFINED": 0,
231
+ "SEVERITY.HIGH": 0,
232
+ "SEVERITY.LOW": 0,
233
+ "SEVERITY.MEDIUM": 0,
234
+ "SEVERITY.UNDEFINED": 0,
235
+ "loc": 14,
236
+ "nosec": 0,
237
+ "skipped_tests": 0
238
+ },
239
+ "aws_lambda_powertools/metrics/base.py": {
240
+ "CONFIDENCE.HIGH": 0,
241
+ "CONFIDENCE.LOW": 0,
242
+ "CONFIDENCE.MEDIUM": 0,
243
+ "CONFIDENCE.UNDEFINED": 0,
244
+ "SEVERITY.HIGH": 0,
245
+ "SEVERITY.LOW": 0,
246
+ "SEVERITY.MEDIUM": 0,
247
+ "SEVERITY.UNDEFINED": 0,
248
+ "loc": 241,
249
+ "nosec": 0,
250
+ "skipped_tests": 0
251
+ },
252
+ "aws_lambda_powertools/metrics/exceptions.py": {
253
+ "CONFIDENCE.HIGH": 0,
254
+ "CONFIDENCE.LOW": 0,
255
+ "CONFIDENCE.MEDIUM": 0,
256
+ "CONFIDENCE.UNDEFINED": 0,
257
+ "SEVERITY.HIGH": 0,
258
+ "SEVERITY.LOW": 0,
259
+ "SEVERITY.MEDIUM": 0,
260
+ "SEVERITY.UNDEFINED": 0,
261
+ "loc": 9,
262
+ "nosec": 0,
263
+ "skipped_tests": 0
264
+ },
265
+ "aws_lambda_powertools/metrics/metric.py": {
266
+ "CONFIDENCE.HIGH": 0,
267
+ "CONFIDENCE.LOW": 0,
268
+ "CONFIDENCE.MEDIUM": 0,
269
+ "CONFIDENCE.UNDEFINED": 0,
270
+ "SEVERITY.HIGH": 0,
271
+ "SEVERITY.LOW": 0,
272
+ "SEVERITY.MEDIUM": 0,
273
+ "SEVERITY.UNDEFINED": 0,
274
+ "loc": 95,
275
+ "nosec": 0,
276
+ "skipped_tests": 0
277
+ },
278
+ "aws_lambda_powertools/metrics/metrics.py": {
279
+ "CONFIDENCE.HIGH": 0,
280
+ "CONFIDENCE.LOW": 0,
281
+ "CONFIDENCE.MEDIUM": 0,
282
+ "CONFIDENCE.UNDEFINED": 0,
283
+ "SEVERITY.HIGH": 0,
284
+ "SEVERITY.LOW": 0,
285
+ "SEVERITY.MEDIUM": 0,
286
+ "SEVERITY.UNDEFINED": 0,
287
+ "loc": 170,
288
+ "nosec": 0,
289
+ "skipped_tests": 0
290
+ },
291
+ "aws_lambda_powertools/middleware_factory/__init__.py": {
292
+ "CONFIDENCE.HIGH": 0,
293
+ "CONFIDENCE.LOW": 0,
294
+ "CONFIDENCE.MEDIUM": 0,
295
+ "CONFIDENCE.UNDEFINED": 0,
296
+ "SEVERITY.HIGH": 0,
297
+ "SEVERITY.LOW": 0,
298
+ "SEVERITY.MEDIUM": 0,
299
+ "SEVERITY.UNDEFINED": 0,
300
+ "loc": 3,
301
+ "nosec": 0,
302
+ "skipped_tests": 0
303
+ },
304
+ "aws_lambda_powertools/middleware_factory/exceptions.py": {
305
+ "CONFIDENCE.HIGH": 0,
306
+ "CONFIDENCE.LOW": 0,
307
+ "CONFIDENCE.MEDIUM": 0,
308
+ "CONFIDENCE.UNDEFINED": 0,
309
+ "SEVERITY.HIGH": 0,
310
+ "SEVERITY.LOW": 0,
311
+ "SEVERITY.MEDIUM": 0,
312
+ "SEVERITY.UNDEFINED": 0,
313
+ "loc": 2,
314
+ "nosec": 0,
315
+ "skipped_tests": 0
316
+ },
317
+ "aws_lambda_powertools/middleware_factory/factory.py": {
318
+ "CONFIDENCE.HIGH": 0,
319
+ "CONFIDENCE.LOW": 0,
320
+ "CONFIDENCE.MEDIUM": 0,
321
+ "CONFIDENCE.UNDEFINED": 0,
322
+ "SEVERITY.HIGH": 0,
323
+ "SEVERITY.LOW": 0,
324
+ "SEVERITY.MEDIUM": 0,
325
+ "SEVERITY.UNDEFINED": 0,
326
+ "loc": 106,
327
+ "nosec": 0,
328
+ "skipped_tests": 0
329
+ },
330
+ "aws_lambda_powertools/package_logger.py": {
331
+ "CONFIDENCE.HIGH": 0,
332
+ "CONFIDENCE.LOW": 0,
333
+ "CONFIDENCE.MEDIUM": 0,
334
+ "CONFIDENCE.UNDEFINED": 0,
335
+ "SEVERITY.HIGH": 0,
336
+ "SEVERITY.LOW": 0,
337
+ "SEVERITY.MEDIUM": 0,
338
+ "SEVERITY.UNDEFINED": 0,
339
+ "loc": 5,
340
+ "nosec": 0,
341
+ "skipped_tests": 0
342
+ },
343
+ "aws_lambda_powertools/shared/__init__.py": {
344
+ "CONFIDENCE.HIGH": 0,
345
+ "CONFIDENCE.LOW": 0,
346
+ "CONFIDENCE.MEDIUM": 0,
347
+ "CONFIDENCE.UNDEFINED": 0,
348
+ "SEVERITY.HIGH": 0,
349
+ "SEVERITY.LOW": 0,
350
+ "SEVERITY.MEDIUM": 0,
351
+ "SEVERITY.UNDEFINED": 0,
352
+ "loc": 0,
353
+ "nosec": 0,
354
+ "skipped_tests": 0
355
+ },
356
+ "aws_lambda_powertools/shared/cache_dict.py": {
357
+ "CONFIDENCE.HIGH": 0,
358
+ "CONFIDENCE.LOW": 0,
359
+ "CONFIDENCE.MEDIUM": 0,
360
+ "CONFIDENCE.UNDEFINED": 0,
361
+ "SEVERITY.HIGH": 0,
362
+ "SEVERITY.LOW": 0,
363
+ "SEVERITY.MEDIUM": 0,
364
+ "SEVERITY.UNDEFINED": 0,
365
+ "loc": 25,
366
+ "nosec": 0,
367
+ "skipped_tests": 0
368
+ },
369
+ "aws_lambda_powertools/shared/constants.py": {
370
+ "CONFIDENCE.HIGH": 0,
371
+ "CONFIDENCE.LOW": 0,
372
+ "CONFIDENCE.MEDIUM": 0,
373
+ "CONFIDENCE.UNDEFINED": 0,
374
+ "SEVERITY.HIGH": 0,
375
+ "SEVERITY.LOW": 0,
376
+ "SEVERITY.MEDIUM": 0,
377
+ "SEVERITY.UNDEFINED": 0,
378
+ "loc": 24,
379
+ "nosec": 0,
380
+ "skipped_tests": 0
381
+ },
382
+ "aws_lambda_powertools/shared/functions.py": {
383
+ "CONFIDENCE.HIGH": 0,
384
+ "CONFIDENCE.LOW": 0,
385
+ "CONFIDENCE.MEDIUM": 0,
386
+ "CONFIDENCE.UNDEFINED": 0,
387
+ "SEVERITY.HIGH": 0,
388
+ "SEVERITY.LOW": 0,
389
+ "SEVERITY.MEDIUM": 0,
390
+ "SEVERITY.UNDEFINED": 0,
391
+ "loc": 61,
392
+ "nosec": 0,
393
+ "skipped_tests": 0
394
+ },
395
+ "aws_lambda_powertools/shared/json_encoder.py": {
396
+ "CONFIDENCE.HIGH": 0,
397
+ "CONFIDENCE.LOW": 0,
398
+ "CONFIDENCE.MEDIUM": 0,
399
+ "CONFIDENCE.UNDEFINED": 0,
400
+ "SEVERITY.HIGH": 0,
401
+ "SEVERITY.LOW": 0,
402
+ "SEVERITY.MEDIUM": 0,
403
+ "SEVERITY.UNDEFINED": 0,
404
+ "loc": 13,
405
+ "nosec": 0,
406
+ "skipped_tests": 0
407
+ },
408
+ "aws_lambda_powertools/shared/lazy_import.py": {
409
+ "CONFIDENCE.HIGH": 0,
410
+ "CONFIDENCE.LOW": 0,
411
+ "CONFIDENCE.MEDIUM": 0,
412
+ "CONFIDENCE.UNDEFINED": 0,
413
+ "SEVERITY.HIGH": 0,
414
+ "SEVERITY.LOW": 0,
415
+ "SEVERITY.MEDIUM": 0,
416
+ "SEVERITY.UNDEFINED": 0,
417
+ "loc": 24,
418
+ "nosec": 0,
419
+ "skipped_tests": 0
420
+ },
421
+ "aws_lambda_powertools/shared/types.py": {
422
+ "CONFIDENCE.HIGH": 0,
423
+ "CONFIDENCE.LOW": 0,
424
+ "CONFIDENCE.MEDIUM": 0,
425
+ "CONFIDENCE.UNDEFINED": 0,
426
+ "SEVERITY.HIGH": 0,
427
+ "SEVERITY.LOW": 0,
428
+ "SEVERITY.MEDIUM": 0,
429
+ "SEVERITY.UNDEFINED": 0,
430
+ "loc": 3,
431
+ "nosec": 0,
432
+ "skipped_tests": 0
433
+ },
434
+ "aws_lambda_powertools/tracing/__init__.py": {
435
+ "CONFIDENCE.HIGH": 0,
436
+ "CONFIDENCE.LOW": 0,
437
+ "CONFIDENCE.MEDIUM": 0,
438
+ "CONFIDENCE.UNDEFINED": 0,
439
+ "SEVERITY.HIGH": 0,
440
+ "SEVERITY.LOW": 0,
441
+ "SEVERITY.MEDIUM": 0,
442
+ "SEVERITY.UNDEFINED": 0,
443
+ "loc": 5,
444
+ "nosec": 0,
445
+ "skipped_tests": 0
446
+ },
447
+ "aws_lambda_powertools/tracing/base.py": {
448
+ "CONFIDENCE.HIGH": 0,
449
+ "CONFIDENCE.LOW": 0,
450
+ "CONFIDENCE.MEDIUM": 0,
451
+ "CONFIDENCE.UNDEFINED": 0,
452
+ "SEVERITY.HIGH": 0,
453
+ "SEVERITY.LOW": 0,
454
+ "SEVERITY.MEDIUM": 0,
455
+ "SEVERITY.UNDEFINED": 0,
456
+ "loc": 117,
457
+ "nosec": 0,
458
+ "skipped_tests": 0
459
+ },
460
+ "aws_lambda_powertools/tracing/extensions.py": {
461
+ "CONFIDENCE.HIGH": 0,
462
+ "CONFIDENCE.LOW": 0,
463
+ "CONFIDENCE.MEDIUM": 0,
464
+ "CONFIDENCE.UNDEFINED": 0,
465
+ "SEVERITY.HIGH": 0,
466
+ "SEVERITY.LOW": 0,
467
+ "SEVERITY.MEDIUM": 0,
468
+ "SEVERITY.UNDEFINED": 0,
469
+ "loc": 11,
470
+ "nosec": 0,
471
+ "skipped_tests": 0
472
+ },
473
+ "aws_lambda_powertools/tracing/tracer.py": {
474
+ "CONFIDENCE.HIGH": 0,
475
+ "CONFIDENCE.LOW": 0,
476
+ "CONFIDENCE.MEDIUM": 0,
477
+ "CONFIDENCE.UNDEFINED": 0,
478
+ "SEVERITY.HIGH": 0,
479
+ "SEVERITY.LOW": 0,
480
+ "SEVERITY.MEDIUM": 0,
481
+ "SEVERITY.UNDEFINED": 0,
482
+ "loc": 641,
483
+ "nosec": 0,
484
+ "skipped_tests": 0
485
+ },
486
+ "aws_lambda_powertools/utilities/__init__.py": {
487
+ "CONFIDENCE.HIGH": 0,
488
+ "CONFIDENCE.LOW": 0,
489
+ "CONFIDENCE.MEDIUM": 0,
490
+ "CONFIDENCE.UNDEFINED": 0,
491
+ "SEVERITY.HIGH": 0,
492
+ "SEVERITY.LOW": 0,
493
+ "SEVERITY.MEDIUM": 0,
494
+ "SEVERITY.UNDEFINED": 0,
495
+ "loc": 1,
496
+ "nosec": 0,
497
+ "skipped_tests": 0
498
+ },
499
+ "aws_lambda_powertools/utilities/batch/__init__.py": {
500
+ "CONFIDENCE.HIGH": 0,
501
+ "CONFIDENCE.LOW": 0,
502
+ "CONFIDENCE.MEDIUM": 0,
503
+ "CONFIDENCE.UNDEFINED": 0,
504
+ "SEVERITY.HIGH": 0,
505
+ "SEVERITY.LOW": 0,
506
+ "SEVERITY.MEDIUM": 0,
507
+ "SEVERITY.UNDEFINED": 0,
508
+ "loc": 24,
509
+ "nosec": 0,
510
+ "skipped_tests": 0
511
+ },
512
+ "aws_lambda_powertools/utilities/batch/base.py": {
513
+ "CONFIDENCE.HIGH": 0,
514
+ "CONFIDENCE.LOW": 0,
515
+ "CONFIDENCE.MEDIUM": 0,
516
+ "CONFIDENCE.UNDEFINED": 0,
517
+ "SEVERITY.HIGH": 0,
518
+ "SEVERITY.LOW": 0,
519
+ "SEVERITY.MEDIUM": 0,
520
+ "SEVERITY.UNDEFINED": 0,
521
+ "loc": 333,
522
+ "nosec": 0,
523
+ "skipped_tests": 0
524
+ },
525
+ "aws_lambda_powertools/utilities/batch/exceptions.py": {
526
+ "CONFIDENCE.HIGH": 0,
527
+ "CONFIDENCE.LOW": 0,
528
+ "CONFIDENCE.MEDIUM": 0,
529
+ "CONFIDENCE.UNDEFINED": 0,
530
+ "SEVERITY.HIGH": 0,
531
+ "SEVERITY.LOW": 0,
532
+ "SEVERITY.MEDIUM": 0,
533
+ "SEVERITY.UNDEFINED": 0,
534
+ "loc": 33,
535
+ "nosec": 0,
536
+ "skipped_tests": 0
537
+ },
538
+ "aws_lambda_powertools/utilities/batch/sqs.py": {
539
+ "CONFIDENCE.HIGH": 0,
540
+ "CONFIDENCE.LOW": 0,
541
+ "CONFIDENCE.MEDIUM": 0,
542
+ "CONFIDENCE.UNDEFINED": 0,
543
+ "SEVERITY.HIGH": 0,
544
+ "SEVERITY.LOW": 0,
545
+ "SEVERITY.MEDIUM": 0,
546
+ "SEVERITY.UNDEFINED": 0,
547
+ "loc": 204,
548
+ "nosec": 0,
549
+ "skipped_tests": 0
550
+ },
551
+ "aws_lambda_powertools/utilities/data_classes/__init__.py": {
552
+ "CONFIDENCE.HIGH": 0,
553
+ "CONFIDENCE.LOW": 0,
554
+ "CONFIDENCE.MEDIUM": 0,
555
+ "CONFIDENCE.UNDEFINED": 0,
556
+ "SEVERITY.HIGH": 0,
557
+ "SEVERITY.LOW": 0,
558
+ "SEVERITY.MEDIUM": 0,
559
+ "SEVERITY.UNDEFINED": 0,
560
+ "loc": 40,
561
+ "nosec": 0,
562
+ "skipped_tests": 0
563
+ },
564
+ "aws_lambda_powertools/utilities/data_classes/active_mq_event.py": {
565
+ "CONFIDENCE.HIGH": 0,
566
+ "CONFIDENCE.LOW": 0,
567
+ "CONFIDENCE.MEDIUM": 0,
568
+ "CONFIDENCE.UNDEFINED": 0,
569
+ "SEVERITY.HIGH": 0,
570
+ "SEVERITY.LOW": 0,
571
+ "SEVERITY.MEDIUM": 0,
572
+ "SEVERITY.UNDEFINED": 0,
573
+ "loc": 100,
574
+ "nosec": 0,
575
+ "skipped_tests": 0
576
+ },
577
+ "aws_lambda_powertools/utilities/data_classes/alb_event.py": {
578
+ "CONFIDENCE.HIGH": 0,
579
+ "CONFIDENCE.LOW": 0,
580
+ "CONFIDENCE.MEDIUM": 0,
581
+ "CONFIDENCE.UNDEFINED": 0,
582
+ "SEVERITY.HIGH": 0,
583
+ "SEVERITY.LOW": 0,
584
+ "SEVERITY.MEDIUM": 0,
585
+ "SEVERITY.UNDEFINED": 0,
586
+ "loc": 23,
587
+ "nosec": 0,
588
+ "skipped_tests": 0
589
+ },
590
+ "aws_lambda_powertools/utilities/data_classes/api_gateway_authorizer_event.py": {
591
+ "CONFIDENCE.HIGH": 0,
592
+ "CONFIDENCE.LOW": 0,
593
+ "CONFIDENCE.MEDIUM": 0,
594
+ "CONFIDENCE.UNDEFINED": 0,
595
+ "SEVERITY.HIGH": 0,
596
+ "SEVERITY.LOW": 0,
597
+ "SEVERITY.MEDIUM": 0,
598
+ "SEVERITY.UNDEFINED": 0,
599
+ "loc": 439,
600
+ "nosec": 0,
601
+ "skipped_tests": 0
602
+ },
603
+ "aws_lambda_powertools/utilities/data_classes/api_gateway_proxy_event.py": {
604
+ "CONFIDENCE.HIGH": 0,
605
+ "CONFIDENCE.LOW": 0,
606
+ "CONFIDENCE.MEDIUM": 0,
607
+ "CONFIDENCE.UNDEFINED": 0,
608
+ "SEVERITY.HIGH": 0,
609
+ "SEVERITY.LOW": 0,
610
+ "SEVERITY.MEDIUM": 0,
611
+ "SEVERITY.UNDEFINED": 0,
612
+ "loc": 194,
613
+ "nosec": 0,
614
+ "skipped_tests": 0
615
+ },
616
+ "aws_lambda_powertools/utilities/data_classes/appsync/__init__.py": {
617
+ "CONFIDENCE.HIGH": 0,
618
+ "CONFIDENCE.LOW": 0,
619
+ "CONFIDENCE.MEDIUM": 0,
620
+ "CONFIDENCE.UNDEFINED": 0,
621
+ "SEVERITY.HIGH": 0,
622
+ "SEVERITY.LOW": 0,
623
+ "SEVERITY.MEDIUM": 0,
624
+ "SEVERITY.UNDEFINED": 0,
625
+ "loc": 0,
626
+ "nosec": 0,
627
+ "skipped_tests": 0
628
+ },
629
+ "aws_lambda_powertools/utilities/data_classes/appsync/scalar_types_utils.py": {
630
+ "CONFIDENCE.HIGH": 0,
631
+ "CONFIDENCE.LOW": 0,
632
+ "CONFIDENCE.MEDIUM": 0,
633
+ "CONFIDENCE.UNDEFINED": 0,
634
+ "SEVERITY.HIGH": 0,
635
+ "SEVERITY.LOW": 0,
636
+ "SEVERITY.MEDIUM": 0,
637
+ "SEVERITY.UNDEFINED": 0,
638
+ "loc": 73,
639
+ "nosec": 0,
640
+ "skipped_tests": 0
641
+ },
642
+ "aws_lambda_powertools/utilities/data_classes/appsync_authorizer_event.py": {
643
+ "CONFIDENCE.HIGH": 0,
644
+ "CONFIDENCE.LOW": 0,
645
+ "CONFIDENCE.MEDIUM": 0,
646
+ "CONFIDENCE.UNDEFINED": 0,
647
+ "SEVERITY.HIGH": 0,
648
+ "SEVERITY.LOW": 0,
649
+ "SEVERITY.MEDIUM": 0,
650
+ "SEVERITY.UNDEFINED": 0,
651
+ "loc": 89,
652
+ "nosec": 0,
653
+ "skipped_tests": 0
654
+ },
655
+ "aws_lambda_powertools/utilities/data_classes/appsync_resolver_event.py": {
656
+ "CONFIDENCE.HIGH": 0,
657
+ "CONFIDENCE.LOW": 0,
658
+ "CONFIDENCE.MEDIUM": 0,
659
+ "CONFIDENCE.UNDEFINED": 0,
660
+ "SEVERITY.HIGH": 0,
661
+ "SEVERITY.LOW": 0,
662
+ "SEVERITY.MEDIUM": 0,
663
+ "SEVERITY.UNDEFINED": 0,
664
+ "loc": 178,
665
+ "nosec": 0,
666
+ "skipped_tests": 0
667
+ },
668
+ "aws_lambda_powertools/utilities/data_classes/cloud_watch_custom_widget_event.py": {
669
+ "CONFIDENCE.HIGH": 0,
670
+ "CONFIDENCE.LOW": 0,
671
+ "CONFIDENCE.MEDIUM": 0,
672
+ "CONFIDENCE.UNDEFINED": 0,
673
+ "SEVERITY.HIGH": 0,
674
+ "SEVERITY.LOW": 0,
675
+ "SEVERITY.MEDIUM": 0,
676
+ "SEVERITY.UNDEFINED": 0,
677
+ "loc": 122,
678
+ "nosec": 0,
679
+ "skipped_tests": 0
680
+ },
681
+ "aws_lambda_powertools/utilities/data_classes/cloud_watch_logs_event.py": {
682
+ "CONFIDENCE.HIGH": 0,
683
+ "CONFIDENCE.LOW": 0,
684
+ "CONFIDENCE.MEDIUM": 0,
685
+ "CONFIDENCE.UNDEFINED": 0,
686
+ "SEVERITY.HIGH": 0,
687
+ "SEVERITY.LOW": 0,
688
+ "SEVERITY.MEDIUM": 0,
689
+ "SEVERITY.UNDEFINED": 0,
690
+ "loc": 77,
691
+ "nosec": 0,
692
+ "skipped_tests": 0
693
+ },
694
+ "aws_lambda_powertools/utilities/data_classes/code_pipeline_job_event.py": {
695
+ "CONFIDENCE.HIGH": 0,
696
+ "CONFIDENCE.LOW": 0,
697
+ "CONFIDENCE.MEDIUM": 0,
698
+ "CONFIDENCE.UNDEFINED": 0,
699
+ "SEVERITY.HIGH": 0,
700
+ "SEVERITY.LOW": 0,
701
+ "SEVERITY.MEDIUM": 0,
702
+ "SEVERITY.UNDEFINED": 0,
703
+ "loc": 185,
704
+ "nosec": 0,
705
+ "skipped_tests": 0
706
+ },
707
+ "aws_lambda_powertools/utilities/data_classes/cognito_user_pool_event.py": {
708
+ "CONFIDENCE.HIGH": 0,
709
+ "CONFIDENCE.LOW": 0,
710
+ "CONFIDENCE.MEDIUM": 0,
711
+ "CONFIDENCE.UNDEFINED": 0,
712
+ "SEVERITY.HIGH": 0,
713
+ "SEVERITY.LOW": 0,
714
+ "SEVERITY.MEDIUM": 0,
715
+ "SEVERITY.UNDEFINED": 0,
716
+ "loc": 624,
717
+ "nosec": 0,
718
+ "skipped_tests": 0
719
+ },
720
+ "aws_lambda_powertools/utilities/data_classes/common.py": {
721
+ "CONFIDENCE.HIGH": 0,
722
+ "CONFIDENCE.LOW": 0,
723
+ "CONFIDENCE.MEDIUM": 0,
724
+ "CONFIDENCE.UNDEFINED": 0,
725
+ "SEVERITY.HIGH": 0,
726
+ "SEVERITY.LOW": 0,
727
+ "SEVERITY.MEDIUM": 0,
728
+ "SEVERITY.UNDEFINED": 0,
729
+ "loc": 313,
730
+ "nosec": 0,
731
+ "skipped_tests": 0
732
+ },
733
+ "aws_lambda_powertools/utilities/data_classes/connect_contact_flow_event.py": {
734
+ "CONFIDENCE.HIGH": 0,
735
+ "CONFIDENCE.LOW": 0,
736
+ "CONFIDENCE.MEDIUM": 0,
737
+ "CONFIDENCE.UNDEFINED": 0,
738
+ "SEVERITY.HIGH": 0,
739
+ "SEVERITY.LOW": 0,
740
+ "SEVERITY.MEDIUM": 0,
741
+ "SEVERITY.UNDEFINED": 0,
742
+ "loc": 128,
743
+ "nosec": 0,
744
+ "skipped_tests": 0
745
+ },
746
+ "aws_lambda_powertools/utilities/data_classes/dynamo_db_stream_event.py": {
747
+ "CONFIDENCE.HIGH": 0,
748
+ "CONFIDENCE.LOW": 0,
749
+ "CONFIDENCE.MEDIUM": 0,
750
+ "CONFIDENCE.UNDEFINED": 0,
751
+ "SEVERITY.HIGH": 0,
752
+ "SEVERITY.LOW": 0,
753
+ "SEVERITY.MEDIUM": 0,
754
+ "SEVERITY.UNDEFINED": 0,
755
+ "loc": 237,
756
+ "nosec": 0,
757
+ "skipped_tests": 0
758
+ },
759
+ "aws_lambda_powertools/utilities/data_classes/event_bridge_event.py": {
760
+ "CONFIDENCE.HIGH": 0,
761
+ "CONFIDENCE.LOW": 0,
762
+ "CONFIDENCE.MEDIUM": 0,
763
+ "CONFIDENCE.UNDEFINED": 0,
764
+ "SEVERITY.HIGH": 0,
765
+ "SEVERITY.LOW": 0,
766
+ "SEVERITY.MEDIUM": 0,
767
+ "SEVERITY.UNDEFINED": 0,
768
+ "loc": 53,
769
+ "nosec": 0,
770
+ "skipped_tests": 0
771
+ },
772
+ "aws_lambda_powertools/utilities/data_classes/event_source.py": {
773
+ "CONFIDENCE.HIGH": 0,
774
+ "CONFIDENCE.LOW": 0,
775
+ "CONFIDENCE.MEDIUM": 0,
776
+ "CONFIDENCE.UNDEFINED": 0,
777
+ "SEVERITY.HIGH": 0,
778
+ "SEVERITY.LOW": 0,
779
+ "SEVERITY.MEDIUM": 0,
780
+ "SEVERITY.UNDEFINED": 0,
781
+ "loc": 31,
782
+ "nosec": 0,
783
+ "skipped_tests": 0
784
+ },
785
+ "aws_lambda_powertools/utilities/data_classes/kafka_event.py": {
786
+ "CONFIDENCE.HIGH": 0,
787
+ "CONFIDENCE.LOW": 0,
788
+ "CONFIDENCE.MEDIUM": 0,
789
+ "CONFIDENCE.UNDEFINED": 0,
790
+ "SEVERITY.HIGH": 0,
791
+ "SEVERITY.LOW": 0,
792
+ "SEVERITY.MEDIUM": 0,
793
+ "SEVERITY.UNDEFINED": 0,
794
+ "loc": 99,
795
+ "nosec": 0,
796
+ "skipped_tests": 0
797
+ },
798
+ "aws_lambda_powertools/utilities/data_classes/kinesis_stream_event.py": {
799
+ "CONFIDENCE.HIGH": 0,
800
+ "CONFIDENCE.LOW": 0,
801
+ "CONFIDENCE.MEDIUM": 0,
802
+ "CONFIDENCE.UNDEFINED": 0,
803
+ "SEVERITY.HIGH": 0,
804
+ "SEVERITY.LOW": 0,
805
+ "SEVERITY.MEDIUM": 0,
806
+ "SEVERITY.UNDEFINED": 0,
807
+ "loc": 77,
808
+ "nosec": 0,
809
+ "skipped_tests": 0
810
+ },
811
+ "aws_lambda_powertools/utilities/data_classes/lambda_function_url_event.py": {
812
+ "CONFIDENCE.HIGH": 0,
813
+ "CONFIDENCE.LOW": 0,
814
+ "CONFIDENCE.MEDIUM": 0,
815
+ "CONFIDENCE.UNDEFINED": 0,
816
+ "SEVERITY.HIGH": 0,
817
+ "SEVERITY.LOW": 0,
818
+ "SEVERITY.MEDIUM": 0,
819
+ "SEVERITY.UNDEFINED": 0,
820
+ "loc": 12,
821
+ "nosec": 0,
822
+ "skipped_tests": 0
823
+ },
824
+ "aws_lambda_powertools/utilities/data_classes/rabbit_mq_event.py": {
825
+ "CONFIDENCE.HIGH": 0,
826
+ "CONFIDENCE.LOW": 0,
827
+ "CONFIDENCE.MEDIUM": 0,
828
+ "CONFIDENCE.UNDEFINED": 0,
829
+ "SEVERITY.HIGH": 0,
830
+ "SEVERITY.LOW": 0,
831
+ "SEVERITY.MEDIUM": 0,
832
+ "SEVERITY.UNDEFINED": 0,
833
+ "loc": 93,
834
+ "nosec": 0,
835
+ "skipped_tests": 0
836
+ },
837
+ "aws_lambda_powertools/utilities/data_classes/s3_event.py": {
838
+ "CONFIDENCE.HIGH": 0,
839
+ "CONFIDENCE.LOW": 0,
840
+ "CONFIDENCE.MEDIUM": 0,
841
+ "CONFIDENCE.UNDEFINED": 0,
842
+ "SEVERITY.HIGH": 0,
843
+ "SEVERITY.LOW": 0,
844
+ "SEVERITY.MEDIUM": 0,
845
+ "SEVERITY.UNDEFINED": 0,
846
+ "loc": 143,
847
+ "nosec": 0,
848
+ "skipped_tests": 0
849
+ },
850
+ "aws_lambda_powertools/utilities/data_classes/s3_object_event.py": {
851
+ "CONFIDENCE.HIGH": 0,
852
+ "CONFIDENCE.LOW": 0,
853
+ "CONFIDENCE.MEDIUM": 0,
854
+ "CONFIDENCE.UNDEFINED": 0,
855
+ "SEVERITY.HIGH": 0,
856
+ "SEVERITY.LOW": 0,
857
+ "SEVERITY.MEDIUM": 0,
858
+ "SEVERITY.UNDEFINED": 0,
859
+ "loc": 256,
860
+ "nosec": 0,
861
+ "skipped_tests": 0
862
+ },
863
+ "aws_lambda_powertools/utilities/data_classes/ses_event.py": {
864
+ "CONFIDENCE.HIGH": 0,
865
+ "CONFIDENCE.LOW": 0,
866
+ "CONFIDENCE.MEDIUM": 0,
867
+ "CONFIDENCE.UNDEFINED": 0,
868
+ "SEVERITY.HIGH": 0,
869
+ "SEVERITY.LOW": 0,
870
+ "SEVERITY.MEDIUM": 0,
871
+ "SEVERITY.UNDEFINED": 0,
872
+ "loc": 202,
873
+ "nosec": 0,
874
+ "skipped_tests": 0
875
+ },
876
+ "aws_lambda_powertools/utilities/data_classes/sns_event.py": {
877
+ "CONFIDENCE.HIGH": 0,
878
+ "CONFIDENCE.LOW": 0,
879
+ "CONFIDENCE.MEDIUM": 0,
880
+ "CONFIDENCE.UNDEFINED": 0,
881
+ "SEVERITY.HIGH": 0,
882
+ "SEVERITY.LOW": 0,
883
+ "SEVERITY.MEDIUM": 0,
884
+ "SEVERITY.UNDEFINED": 0,
885
+ "loc": 91,
886
+ "nosec": 0,
887
+ "skipped_tests": 0
888
+ },
889
+ "aws_lambda_powertools/utilities/data_classes/sqs_event.py": {
890
+ "CONFIDENCE.HIGH": 0,
891
+ "CONFIDENCE.LOW": 0,
892
+ "CONFIDENCE.MEDIUM": 0,
893
+ "CONFIDENCE.UNDEFINED": 0,
894
+ "SEVERITY.HIGH": 0,
895
+ "SEVERITY.LOW": 0,
896
+ "SEVERITY.MEDIUM": 0,
897
+ "SEVERITY.UNDEFINED": 0,
898
+ "loc": 111,
899
+ "nosec": 0,
900
+ "skipped_tests": 0
901
+ },
902
+ "aws_lambda_powertools/utilities/feature_flags/__init__.py": {
903
+ "CONFIDENCE.HIGH": 0,
904
+ "CONFIDENCE.LOW": 0,
905
+ "CONFIDENCE.MEDIUM": 0,
906
+ "CONFIDENCE.UNDEFINED": 0,
907
+ "SEVERITY.HIGH": 0,
908
+ "SEVERITY.LOW": 0,
909
+ "SEVERITY.MEDIUM": 0,
910
+ "SEVERITY.UNDEFINED": 0,
911
+ "loc": 14,
912
+ "nosec": 0,
913
+ "skipped_tests": 0
914
+ },
915
+ "aws_lambda_powertools/utilities/feature_flags/appconfig.py": {
916
+ "CONFIDENCE.HIGH": 0,
917
+ "CONFIDENCE.LOW": 0,
918
+ "CONFIDENCE.MEDIUM": 0,
919
+ "CONFIDENCE.UNDEFINED": 0,
920
+ "SEVERITY.HIGH": 0,
921
+ "SEVERITY.LOW": 0,
922
+ "SEVERITY.MEDIUM": 0,
923
+ "SEVERITY.UNDEFINED": 0,
924
+ "loc": 92,
925
+ "nosec": 0,
926
+ "skipped_tests": 0
927
+ },
928
+ "aws_lambda_powertools/utilities/feature_flags/base.py": {
929
+ "CONFIDENCE.HIGH": 0,
930
+ "CONFIDENCE.LOW": 0,
931
+ "CONFIDENCE.MEDIUM": 0,
932
+ "CONFIDENCE.UNDEFINED": 0,
933
+ "SEVERITY.HIGH": 0,
934
+ "SEVERITY.LOW": 0,
935
+ "SEVERITY.MEDIUM": 0,
936
+ "SEVERITY.UNDEFINED": 0,
937
+ "loc": 50,
938
+ "nosec": 0,
939
+ "skipped_tests": 0
940
+ },
941
+ "aws_lambda_powertools/utilities/feature_flags/exceptions.py": {
942
+ "CONFIDENCE.HIGH": 0,
943
+ "CONFIDENCE.LOW": 0,
944
+ "CONFIDENCE.MEDIUM": 0,
945
+ "CONFIDENCE.UNDEFINED": 0,
946
+ "SEVERITY.HIGH": 0,
947
+ "SEVERITY.LOW": 0,
948
+ "SEVERITY.MEDIUM": 0,
949
+ "SEVERITY.UNDEFINED": 0,
950
+ "loc": 8,
951
+ "nosec": 0,
952
+ "skipped_tests": 0
953
+ },
954
+ "aws_lambda_powertools/utilities/feature_flags/feature_flags.py": {
955
+ "CONFIDENCE.HIGH": 0,
956
+ "CONFIDENCE.LOW": 0,
957
+ "CONFIDENCE.MEDIUM": 0,
958
+ "CONFIDENCE.UNDEFINED": 0,
959
+ "SEVERITY.HIGH": 0,
960
+ "SEVERITY.LOW": 0,
961
+ "SEVERITY.MEDIUM": 0,
962
+ "SEVERITY.UNDEFINED": 0,
963
+ "loc": 247,
964
+ "nosec": 0,
965
+ "skipped_tests": 0
966
+ },
967
+ "aws_lambda_powertools/utilities/feature_flags/schema.py": {
968
+ "CONFIDENCE.HIGH": 0,
969
+ "CONFIDENCE.LOW": 0,
970
+ "CONFIDENCE.MEDIUM": 0,
971
+ "CONFIDENCE.UNDEFINED": 0,
972
+ "SEVERITY.HIGH": 0,
973
+ "SEVERITY.LOW": 0,
974
+ "SEVERITY.MEDIUM": 0,
975
+ "SEVERITY.UNDEFINED": 0,
976
+ "loc": 216,
977
+ "nosec": 0,
978
+ "skipped_tests": 0
979
+ },
980
+ "aws_lambda_powertools/utilities/idempotency/__init__.py": {
981
+ "CONFIDENCE.HIGH": 0,
982
+ "CONFIDENCE.LOW": 0,
983
+ "CONFIDENCE.MEDIUM": 0,
984
+ "CONFIDENCE.UNDEFINED": 0,
985
+ "SEVERITY.HIGH": 0,
986
+ "SEVERITY.LOW": 0,
987
+ "SEVERITY.MEDIUM": 0,
988
+ "SEVERITY.UNDEFINED": 0,
989
+ "loc": 7,
990
+ "nosec": 0,
991
+ "skipped_tests": 0
992
+ },
993
+ "aws_lambda_powertools/utilities/idempotency/base.py": {
994
+ "CONFIDENCE.HIGH": 0,
995
+ "CONFIDENCE.LOW": 0,
996
+ "CONFIDENCE.MEDIUM": 0,
997
+ "CONFIDENCE.UNDEFINED": 0,
998
+ "SEVERITY.HIGH": 0,
999
+ "SEVERITY.LOW": 0,
1000
+ "SEVERITY.MEDIUM": 0,
1001
+ "SEVERITY.UNDEFINED": 0,
1002
+ "loc": 177,
1003
+ "nosec": 0,
1004
+ "skipped_tests": 0
1005
+ },
1006
+ "aws_lambda_powertools/utilities/idempotency/config.py": {
1007
+ "CONFIDENCE.HIGH": 0,
1008
+ "CONFIDENCE.LOW": 0,
1009
+ "CONFIDENCE.MEDIUM": 0,
1010
+ "CONFIDENCE.UNDEFINED": 0,
1011
+ "SEVERITY.HIGH": 0,
1012
+ "SEVERITY.LOW": 0,
1013
+ "SEVERITY.MEDIUM": 0,
1014
+ "SEVERITY.UNDEFINED": 0,
1015
+ "loc": 48,
1016
+ "nosec": 0,
1017
+ "skipped_tests": 0
1018
+ },
1019
+ "aws_lambda_powertools/utilities/idempotency/exceptions.py": {
1020
+ "CONFIDENCE.HIGH": 0,
1021
+ "CONFIDENCE.LOW": 0,
1022
+ "CONFIDENCE.MEDIUM": 0,
1023
+ "CONFIDENCE.UNDEFINED": 0,
1024
+ "SEVERITY.HIGH": 0,
1025
+ "SEVERITY.LOW": 0,
1026
+ "SEVERITY.MEDIUM": 0,
1027
+ "SEVERITY.UNDEFINED": 0,
1028
+ "loc": 35,
1029
+ "nosec": 0,
1030
+ "skipped_tests": 0
1031
+ },
1032
+ "aws_lambda_powertools/utilities/idempotency/idempotency.py": {
1033
+ "CONFIDENCE.HIGH": 0,
1034
+ "CONFIDENCE.LOW": 0,
1035
+ "CONFIDENCE.MEDIUM": 0,
1036
+ "CONFIDENCE.UNDEFINED": 0,
1037
+ "SEVERITY.HIGH": 0,
1038
+ "SEVERITY.LOW": 0,
1039
+ "SEVERITY.MEDIUM": 0,
1040
+ "SEVERITY.UNDEFINED": 0,
1041
+ "loc": 128,
1042
+ "nosec": 0,
1043
+ "skipped_tests": 0
1044
+ },
1045
+ "aws_lambda_powertools/utilities/idempotency/persistence/__init__.py": {
1046
+ "CONFIDENCE.HIGH": 0,
1047
+ "CONFIDENCE.LOW": 0,
1048
+ "CONFIDENCE.MEDIUM": 0,
1049
+ "CONFIDENCE.UNDEFINED": 0,
1050
+ "SEVERITY.HIGH": 0,
1051
+ "SEVERITY.LOW": 0,
1052
+ "SEVERITY.MEDIUM": 0,
1053
+ "SEVERITY.UNDEFINED": 0,
1054
+ "loc": 0,
1055
+ "nosec": 0,
1056
+ "skipped_tests": 0
1057
+ },
1058
+ "aws_lambda_powertools/utilities/idempotency/persistence/base.py": {
1059
+ "CONFIDENCE.HIGH": 0,
1060
+ "CONFIDENCE.LOW": 0,
1061
+ "CONFIDENCE.MEDIUM": 0,
1062
+ "CONFIDENCE.UNDEFINED": 0,
1063
+ "SEVERITY.HIGH": 0,
1064
+ "SEVERITY.LOW": 0,
1065
+ "SEVERITY.MEDIUM": 0,
1066
+ "SEVERITY.UNDEFINED": 0,
1067
+ "loc": 401,
1068
+ "nosec": 0,
1069
+ "skipped_tests": 0
1070
+ },
1071
+ "aws_lambda_powertools/utilities/idempotency/persistence/dynamodb.py": {
1072
+ "CONFIDENCE.HIGH": 0,
1073
+ "CONFIDENCE.LOW": 0,
1074
+ "CONFIDENCE.MEDIUM": 0,
1075
+ "CONFIDENCE.UNDEFINED": 0,
1076
+ "SEVERITY.HIGH": 0,
1077
+ "SEVERITY.LOW": 0,
1078
+ "SEVERITY.MEDIUM": 0,
1079
+ "SEVERITY.UNDEFINED": 0,
1080
+ "loc": 201,
1081
+ "nosec": 0,
1082
+ "skipped_tests": 0
1083
+ },
1084
+ "aws_lambda_powertools/utilities/jmespath_utils/__init__.py": {
1085
+ "CONFIDENCE.HIGH": 0,
1086
+ "CONFIDENCE.LOW": 0,
1087
+ "CONFIDENCE.MEDIUM": 0,
1088
+ "CONFIDENCE.UNDEFINED": 0,
1089
+ "SEVERITY.HIGH": 0,
1090
+ "SEVERITY.LOW": 0,
1091
+ "SEVERITY.MEDIUM": 0,
1092
+ "SEVERITY.UNDEFINED": 0,
1093
+ "loc": 56,
1094
+ "nosec": 0,
1095
+ "skipped_tests": 0
1096
+ },
1097
+ "aws_lambda_powertools/utilities/jmespath_utils/envelopes.py": {
1098
+ "CONFIDENCE.HIGH": 0,
1099
+ "CONFIDENCE.LOW": 0,
1100
+ "CONFIDENCE.MEDIUM": 0,
1101
+ "CONFIDENCE.UNDEFINED": 0,
1102
+ "SEVERITY.HIGH": 0,
1103
+ "SEVERITY.LOW": 0,
1104
+ "SEVERITY.MEDIUM": 0,
1105
+ "SEVERITY.UNDEFINED": 0,
1106
+ "loc": 8,
1107
+ "nosec": 0,
1108
+ "skipped_tests": 0
1109
+ },
1110
+ "aws_lambda_powertools/utilities/parameters/__init__.py": {
1111
+ "CONFIDENCE.HIGH": 0,
1112
+ "CONFIDENCE.LOW": 0,
1113
+ "CONFIDENCE.MEDIUM": 0,
1114
+ "CONFIDENCE.UNDEFINED": 0,
1115
+ "SEVERITY.HIGH": 0,
1116
+ "SEVERITY.LOW": 0,
1117
+ "SEVERITY.MEDIUM": 0,
1118
+ "SEVERITY.UNDEFINED": 0,
1119
+ "loc": 23,
1120
+ "nosec": 0,
1121
+ "skipped_tests": 0
1122
+ },
1123
+ "aws_lambda_powertools/utilities/parameters/appconfig.py": {
1124
+ "CONFIDENCE.HIGH": 0,
1125
+ "CONFIDENCE.LOW": 0,
1126
+ "CONFIDENCE.MEDIUM": 0,
1127
+ "CONFIDENCE.UNDEFINED": 0,
1128
+ "SEVERITY.HIGH": 0,
1129
+ "SEVERITY.LOW": 0,
1130
+ "SEVERITY.MEDIUM": 0,
1131
+ "SEVERITY.UNDEFINED": 0,
1132
+ "loc": 151,
1133
+ "nosec": 0,
1134
+ "skipped_tests": 0
1135
+ },
1136
+ "aws_lambda_powertools/utilities/parameters/base.py": {
1137
+ "CONFIDENCE.HIGH": 0,
1138
+ "CONFIDENCE.LOW": 0,
1139
+ "CONFIDENCE.MEDIUM": 0,
1140
+ "CONFIDENCE.UNDEFINED": 0,
1141
+ "SEVERITY.HIGH": 0,
1142
+ "SEVERITY.LOW": 0,
1143
+ "SEVERITY.MEDIUM": 0,
1144
+ "SEVERITY.UNDEFINED": 0,
1145
+ "loc": 272,
1146
+ "nosec": 0,
1147
+ "skipped_tests": 0
1148
+ },
1149
+ "aws_lambda_powertools/utilities/parameters/dynamodb.py": {
1150
+ "CONFIDENCE.HIGH": 0,
1151
+ "CONFIDENCE.LOW": 0,
1152
+ "CONFIDENCE.MEDIUM": 0,
1153
+ "CONFIDENCE.UNDEFINED": 0,
1154
+ "SEVERITY.HIGH": 0,
1155
+ "SEVERITY.LOW": 0,
1156
+ "SEVERITY.MEDIUM": 0,
1157
+ "SEVERITY.UNDEFINED": 0,
1158
+ "loc": 178,
1159
+ "nosec": 0,
1160
+ "skipped_tests": 0
1161
+ },
1162
+ "aws_lambda_powertools/utilities/parameters/exceptions.py": {
1163
+ "CONFIDENCE.HIGH": 0,
1164
+ "CONFIDENCE.LOW": 0,
1165
+ "CONFIDENCE.MEDIUM": 0,
1166
+ "CONFIDENCE.UNDEFINED": 0,
1167
+ "SEVERITY.HIGH": 0,
1168
+ "SEVERITY.LOW": 0,
1169
+ "SEVERITY.MEDIUM": 0,
1170
+ "SEVERITY.UNDEFINED": 0,
1171
+ "loc": 7,
1172
+ "nosec": 0,
1173
+ "skipped_tests": 0
1174
+ },
1175
+ "aws_lambda_powertools/utilities/parameters/secrets.py": {
1176
+ "CONFIDENCE.HIGH": 0,
1177
+ "CONFIDENCE.LOW": 0,
1178
+ "CONFIDENCE.MEDIUM": 0,
1179
+ "CONFIDENCE.UNDEFINED": 0,
1180
+ "SEVERITY.HIGH": 0,
1181
+ "SEVERITY.LOW": 0,
1182
+ "SEVERITY.MEDIUM": 0,
1183
+ "SEVERITY.UNDEFINED": 0,
1184
+ "loc": 129,
1185
+ "nosec": 0,
1186
+ "skipped_tests": 0
1187
+ },
1188
+ "aws_lambda_powertools/utilities/parameters/ssm.py": {
1189
+ "CONFIDENCE.HIGH": 0,
1190
+ "CONFIDENCE.LOW": 0,
1191
+ "CONFIDENCE.MEDIUM": 0,
1192
+ "CONFIDENCE.UNDEFINED": 0,
1193
+ "SEVERITY.HIGH": 0,
1194
+ "SEVERITY.LOW": 0,
1195
+ "SEVERITY.MEDIUM": 0,
1196
+ "SEVERITY.UNDEFINED": 0,
1197
+ "loc": 277,
1198
+ "nosec": 0,
1199
+ "skipped_tests": 0
1200
+ },
1201
+ "aws_lambda_powertools/utilities/parser/__init__.py": {
1202
+ "CONFIDENCE.HIGH": 0,
1203
+ "CONFIDENCE.LOW": 0,
1204
+ "CONFIDENCE.MEDIUM": 0,
1205
+ "CONFIDENCE.UNDEFINED": 0,
1206
+ "SEVERITY.HIGH": 0,
1207
+ "SEVERITY.LOW": 0,
1208
+ "SEVERITY.MEDIUM": 0,
1209
+ "SEVERITY.UNDEFINED": 0,
1210
+ "loc": 17,
1211
+ "nosec": 0,
1212
+ "skipped_tests": 0
1213
+ },
1214
+ "aws_lambda_powertools/utilities/parser/envelopes/__init__.py": {
1215
+ "CONFIDENCE.HIGH": 0,
1216
+ "CONFIDENCE.LOW": 0,
1217
+ "CONFIDENCE.MEDIUM": 0,
1218
+ "CONFIDENCE.UNDEFINED": 0,
1219
+ "SEVERITY.HIGH": 0,
1220
+ "SEVERITY.LOW": 0,
1221
+ "SEVERITY.MEDIUM": 0,
1222
+ "SEVERITY.UNDEFINED": 0,
1223
+ "loc": 25,
1224
+ "nosec": 0,
1225
+ "skipped_tests": 0
1226
+ },
1227
+ "aws_lambda_powertools/utilities/parser/envelopes/apigw.py": {
1228
+ "CONFIDENCE.HIGH": 0,
1229
+ "CONFIDENCE.LOW": 0,
1230
+ "CONFIDENCE.MEDIUM": 0,
1231
+ "CONFIDENCE.UNDEFINED": 0,
1232
+ "SEVERITY.HIGH": 0,
1233
+ "SEVERITY.LOW": 0,
1234
+ "SEVERITY.MEDIUM": 0,
1235
+ "SEVERITY.UNDEFINED": 0,
1236
+ "loc": 25,
1237
+ "nosec": 0,
1238
+ "skipped_tests": 0
1239
+ },
1240
+ "aws_lambda_powertools/utilities/parser/envelopes/apigwv2.py": {
1241
+ "CONFIDENCE.HIGH": 0,
1242
+ "CONFIDENCE.LOW": 0,
1243
+ "CONFIDENCE.MEDIUM": 0,
1244
+ "CONFIDENCE.UNDEFINED": 0,
1245
+ "SEVERITY.HIGH": 0,
1246
+ "SEVERITY.LOW": 0,
1247
+ "SEVERITY.MEDIUM": 0,
1248
+ "SEVERITY.UNDEFINED": 0,
1249
+ "loc": 25,
1250
+ "nosec": 0,
1251
+ "skipped_tests": 0
1252
+ },
1253
+ "aws_lambda_powertools/utilities/parser/envelopes/base.py": {
1254
+ "CONFIDENCE.HIGH": 0,
1255
+ "CONFIDENCE.LOW": 0,
1256
+ "CONFIDENCE.MEDIUM": 0,
1257
+ "CONFIDENCE.UNDEFINED": 0,
1258
+ "SEVERITY.HIGH": 0,
1259
+ "SEVERITY.LOW": 0,
1260
+ "SEVERITY.MEDIUM": 0,
1261
+ "SEVERITY.UNDEFINED": 0,
1262
+ "loc": 42,
1263
+ "nosec": 0,
1264
+ "skipped_tests": 0
1265
+ },
1266
+ "aws_lambda_powertools/utilities/parser/envelopes/cloudwatch.py": {
1267
+ "CONFIDENCE.HIGH": 0,
1268
+ "CONFIDENCE.LOW": 0,
1269
+ "CONFIDENCE.MEDIUM": 0,
1270
+ "CONFIDENCE.UNDEFINED": 0,
1271
+ "SEVERITY.HIGH": 0,
1272
+ "SEVERITY.LOW": 0,
1273
+ "SEVERITY.MEDIUM": 0,
1274
+ "SEVERITY.UNDEFINED": 0,
1275
+ "loc": 32,
1276
+ "nosec": 0,
1277
+ "skipped_tests": 0
1278
+ },
1279
+ "aws_lambda_powertools/utilities/parser/envelopes/dynamodb.py": {
1280
+ "CONFIDENCE.HIGH": 0,
1281
+ "CONFIDENCE.LOW": 0,
1282
+ "CONFIDENCE.MEDIUM": 0,
1283
+ "CONFIDENCE.UNDEFINED": 0,
1284
+ "SEVERITY.HIGH": 0,
1285
+ "SEVERITY.LOW": 0,
1286
+ "SEVERITY.MEDIUM": 0,
1287
+ "SEVERITY.UNDEFINED": 0,
1288
+ "loc": 34,
1289
+ "nosec": 0,
1290
+ "skipped_tests": 0
1291
+ },
1292
+ "aws_lambda_powertools/utilities/parser/envelopes/event_bridge.py": {
1293
+ "CONFIDENCE.HIGH": 0,
1294
+ "CONFIDENCE.LOW": 0,
1295
+ "CONFIDENCE.MEDIUM": 0,
1296
+ "CONFIDENCE.UNDEFINED": 0,
1297
+ "SEVERITY.HIGH": 0,
1298
+ "SEVERITY.LOW": 0,
1299
+ "SEVERITY.MEDIUM": 0,
1300
+ "SEVERITY.UNDEFINED": 0,
1301
+ "loc": 25,
1302
+ "nosec": 0,
1303
+ "skipped_tests": 0
1304
+ },
1305
+ "aws_lambda_powertools/utilities/parser/envelopes/kafka.py": {
1306
+ "CONFIDENCE.HIGH": 0,
1307
+ "CONFIDENCE.LOW": 0,
1308
+ "CONFIDENCE.MEDIUM": 0,
1309
+ "CONFIDENCE.UNDEFINED": 0,
1310
+ "SEVERITY.HIGH": 0,
1311
+ "SEVERITY.LOW": 0,
1312
+ "SEVERITY.MEDIUM": 0,
1313
+ "SEVERITY.UNDEFINED": 0,
1314
+ "loc": 35,
1315
+ "nosec": 0,
1316
+ "skipped_tests": 0
1317
+ },
1318
+ "aws_lambda_powertools/utilities/parser/envelopes/kinesis.py": {
1319
+ "CONFIDENCE.HIGH": 0,
1320
+ "CONFIDENCE.LOW": 0,
1321
+ "CONFIDENCE.MEDIUM": 0,
1322
+ "CONFIDENCE.UNDEFINED": 0,
1323
+ "SEVERITY.HIGH": 0,
1324
+ "SEVERITY.LOW": 0,
1325
+ "SEVERITY.MEDIUM": 0,
1326
+ "SEVERITY.UNDEFINED": 0,
1327
+ "loc": 35,
1328
+ "nosec": 0,
1329
+ "skipped_tests": 0
1330
+ },
1331
+ "aws_lambda_powertools/utilities/parser/envelopes/lambda_function_url.py": {
1332
+ "CONFIDENCE.HIGH": 0,
1333
+ "CONFIDENCE.LOW": 0,
1334
+ "CONFIDENCE.MEDIUM": 0,
1335
+ "CONFIDENCE.UNDEFINED": 0,
1336
+ "SEVERITY.HIGH": 0,
1337
+ "SEVERITY.LOW": 0,
1338
+ "SEVERITY.MEDIUM": 0,
1339
+ "SEVERITY.UNDEFINED": 0,
1340
+ "loc": 25,
1341
+ "nosec": 0,
1342
+ "skipped_tests": 0
1343
+ },
1344
+ "aws_lambda_powertools/utilities/parser/envelopes/sns.py": {
1345
+ "CONFIDENCE.HIGH": 0,
1346
+ "CONFIDENCE.LOW": 0,
1347
+ "CONFIDENCE.MEDIUM": 0,
1348
+ "CONFIDENCE.UNDEFINED": 0,
1349
+ "SEVERITY.HIGH": 0,
1350
+ "SEVERITY.LOW": 0,
1351
+ "SEVERITY.MEDIUM": 0,
1352
+ "SEVERITY.UNDEFINED": 0,
1353
+ "loc": 59,
1354
+ "nosec": 0,
1355
+ "skipped_tests": 0
1356
+ },
1357
+ "aws_lambda_powertools/utilities/parser/envelopes/sqs.py": {
1358
+ "CONFIDENCE.HIGH": 0,
1359
+ "CONFIDENCE.LOW": 0,
1360
+ "CONFIDENCE.MEDIUM": 0,
1361
+ "CONFIDENCE.UNDEFINED": 0,
1362
+ "SEVERITY.HIGH": 0,
1363
+ "SEVERITY.LOW": 0,
1364
+ "SEVERITY.MEDIUM": 0,
1365
+ "SEVERITY.UNDEFINED": 0,
1366
+ "loc": 30,
1367
+ "nosec": 0,
1368
+ "skipped_tests": 0
1369
+ },
1370
+ "aws_lambda_powertools/utilities/parser/exceptions.py": {
1371
+ "CONFIDENCE.HIGH": 0,
1372
+ "CONFIDENCE.LOW": 0,
1373
+ "CONFIDENCE.MEDIUM": 0,
1374
+ "CONFIDENCE.UNDEFINED": 0,
1375
+ "SEVERITY.HIGH": 0,
1376
+ "SEVERITY.LOW": 0,
1377
+ "SEVERITY.MEDIUM": 0,
1378
+ "SEVERITY.UNDEFINED": 0,
1379
+ "loc": 4,
1380
+ "nosec": 0,
1381
+ "skipped_tests": 0
1382
+ },
1383
+ "aws_lambda_powertools/utilities/parser/models/__init__.py": {
1384
+ "CONFIDENCE.HIGH": 0,
1385
+ "CONFIDENCE.LOW": 0,
1386
+ "CONFIDENCE.MEDIUM": 0,
1387
+ "CONFIDENCE.UNDEFINED": 0,
1388
+ "SEVERITY.HIGH": 0,
1389
+ "SEVERITY.LOW": 0,
1390
+ "SEVERITY.MEDIUM": 0,
1391
+ "SEVERITY.UNDEFINED": 0,
1392
+ "loc": 105,
1393
+ "nosec": 0,
1394
+ "skipped_tests": 0
1395
+ },
1396
+ "aws_lambda_powertools/utilities/parser/models/alb.py": {
1397
+ "CONFIDENCE.HIGH": 0,
1398
+ "CONFIDENCE.LOW": 0,
1399
+ "CONFIDENCE.MEDIUM": 0,
1400
+ "CONFIDENCE.UNDEFINED": 0,
1401
+ "SEVERITY.HIGH": 0,
1402
+ "SEVERITY.LOW": 0,
1403
+ "SEVERITY.MEDIUM": 0,
1404
+ "SEVERITY.UNDEFINED": 0,
1405
+ "loc": 14,
1406
+ "nosec": 0,
1407
+ "skipped_tests": 0
1408
+ },
1409
+ "aws_lambda_powertools/utilities/parser/models/apigw.py": {
1410
+ "CONFIDENCE.HIGH": 0,
1411
+ "CONFIDENCE.LOW": 0,
1412
+ "CONFIDENCE.MEDIUM": 0,
1413
+ "CONFIDENCE.UNDEFINED": 0,
1414
+ "SEVERITY.HIGH": 0,
1415
+ "SEVERITY.LOW": 0,
1416
+ "SEVERITY.MEDIUM": 0,
1417
+ "SEVERITY.UNDEFINED": 0,
1418
+ "loc": 77,
1419
+ "nosec": 0,
1420
+ "skipped_tests": 0
1421
+ },
1422
+ "aws_lambda_powertools/utilities/parser/models/apigwv2.py": {
1423
+ "CONFIDENCE.HIGH": 0,
1424
+ "CONFIDENCE.LOW": 0,
1425
+ "CONFIDENCE.MEDIUM": 0,
1426
+ "CONFIDENCE.UNDEFINED": 0,
1427
+ "SEVERITY.HIGH": 0,
1428
+ "SEVERITY.LOW": 0,
1429
+ "SEVERITY.MEDIUM": 0,
1430
+ "SEVERITY.UNDEFINED": 0,
1431
+ "loc": 55,
1432
+ "nosec": 0,
1433
+ "skipped_tests": 0
1434
+ },
1435
+ "aws_lambda_powertools/utilities/parser/models/cloudwatch.py": {
1436
+ "CONFIDENCE.HIGH": 0,
1437
+ "CONFIDENCE.LOW": 0,
1438
+ "CONFIDENCE.MEDIUM": 0,
1439
+ "CONFIDENCE.UNDEFINED": 0,
1440
+ "SEVERITY.HIGH": 0,
1441
+ "SEVERITY.LOW": 0,
1442
+ "SEVERITY.MEDIUM": 0,
1443
+ "SEVERITY.UNDEFINED": 0,
1444
+ "loc": 33,
1445
+ "nosec": 0,
1446
+ "skipped_tests": 0
1447
+ },
1448
+ "aws_lambda_powertools/utilities/parser/models/dynamodb.py": {
1449
+ "CONFIDENCE.HIGH": 0,
1450
+ "CONFIDENCE.LOW": 0,
1451
+ "CONFIDENCE.MEDIUM": 0,
1452
+ "CONFIDENCE.UNDEFINED": 0,
1453
+ "SEVERITY.HIGH": 0,
1454
+ "SEVERITY.LOW": 0,
1455
+ "SEVERITY.MEDIUM": 0,
1456
+ "SEVERITY.UNDEFINED": 0,
1457
+ "loc": 26,
1458
+ "nosec": 0,
1459
+ "skipped_tests": 0
1460
+ },
1461
+ "aws_lambda_powertools/utilities/parser/models/event_bridge.py": {
1462
+ "CONFIDENCE.HIGH": 0,
1463
+ "CONFIDENCE.LOW": 0,
1464
+ "CONFIDENCE.MEDIUM": 0,
1465
+ "CONFIDENCE.UNDEFINED": 0,
1466
+ "SEVERITY.HIGH": 0,
1467
+ "SEVERITY.LOW": 0,
1468
+ "SEVERITY.MEDIUM": 0,
1469
+ "SEVERITY.UNDEFINED": 0,
1470
+ "loc": 14,
1471
+ "nosec": 0,
1472
+ "skipped_tests": 0
1473
+ },
1474
+ "aws_lambda_powertools/utilities/parser/models/kafka.py": {
1475
+ "CONFIDENCE.HIGH": 0,
1476
+ "CONFIDENCE.LOW": 0,
1477
+ "CONFIDENCE.MEDIUM": 0,
1478
+ "CONFIDENCE.UNDEFINED": 0,
1479
+ "SEVERITY.HIGH": 0,
1480
+ "SEVERITY.LOW": 0,
1481
+ "SEVERITY.MEDIUM": 0,
1482
+ "SEVERITY.UNDEFINED": 0,
1483
+ "loc": 47,
1484
+ "nosec": 0,
1485
+ "skipped_tests": 0
1486
+ },
1487
+ "aws_lambda_powertools/utilities/parser/models/kinesis.py": {
1488
+ "CONFIDENCE.HIGH": 0,
1489
+ "CONFIDENCE.LOW": 0,
1490
+ "CONFIDENCE.MEDIUM": 0,
1491
+ "CONFIDENCE.UNDEFINED": 0,
1492
+ "SEVERITY.HIGH": 0,
1493
+ "SEVERITY.LOW": 0,
1494
+ "SEVERITY.MEDIUM": 0,
1495
+ "SEVERITY.UNDEFINED": 0,
1496
+ "loc": 31,
1497
+ "nosec": 0,
1498
+ "skipped_tests": 0
1499
+ },
1500
+ "aws_lambda_powertools/utilities/parser/models/lambda_function_url.py": {
1501
+ "CONFIDENCE.HIGH": 0,
1502
+ "CONFIDENCE.LOW": 0,
1503
+ "CONFIDENCE.MEDIUM": 0,
1504
+ "CONFIDENCE.UNDEFINED": 0,
1505
+ "SEVERITY.HIGH": 0,
1506
+ "SEVERITY.LOW": 0,
1507
+ "SEVERITY.MEDIUM": 0,
1508
+ "SEVERITY.UNDEFINED": 0,
1509
+ "loc": 12,
1510
+ "nosec": 0,
1511
+ "skipped_tests": 0
1512
+ },
1513
+ "aws_lambda_powertools/utilities/parser/models/s3.py": {
1514
+ "CONFIDENCE.HIGH": 0,
1515
+ "CONFIDENCE.LOW": 0,
1516
+ "CONFIDENCE.MEDIUM": 0,
1517
+ "CONFIDENCE.UNDEFINED": 0,
1518
+ "SEVERITY.HIGH": 0,
1519
+ "SEVERITY.LOW": 0,
1520
+ "SEVERITY.MEDIUM": 0,
1521
+ "SEVERITY.UNDEFINED": 0,
1522
+ "loc": 49,
1523
+ "nosec": 0,
1524
+ "skipped_tests": 0
1525
+ },
1526
+ "aws_lambda_powertools/utilities/parser/models/s3_object_event.py": {
1527
+ "CONFIDENCE.HIGH": 0,
1528
+ "CONFIDENCE.LOW": 0,
1529
+ "CONFIDENCE.MEDIUM": 0,
1530
+ "CONFIDENCE.UNDEFINED": 0,
1531
+ "SEVERITY.HIGH": 0,
1532
+ "SEVERITY.LOW": 0,
1533
+ "SEVERITY.MEDIUM": 0,
1534
+ "SEVERITY.UNDEFINED": 0,
1535
+ "loc": 40,
1536
+ "nosec": 0,
1537
+ "skipped_tests": 0
1538
+ },
1539
+ "aws_lambda_powertools/utilities/parser/models/ses.py": {
1540
+ "CONFIDENCE.HIGH": 0,
1541
+ "CONFIDENCE.LOW": 0,
1542
+ "CONFIDENCE.MEDIUM": 0,
1543
+ "CONFIDENCE.UNDEFINED": 0,
1544
+ "SEVERITY.HIGH": 0,
1545
+ "SEVERITY.LOW": 0,
1546
+ "SEVERITY.MEDIUM": 0,
1547
+ "SEVERITY.UNDEFINED": 0,
1548
+ "loc": 52,
1549
+ "nosec": 0,
1550
+ "skipped_tests": 0
1551
+ },
1552
+ "aws_lambda_powertools/utilities/parser/models/sns.py": {
1553
+ "CONFIDENCE.HIGH": 0,
1554
+ "CONFIDENCE.LOW": 0,
1555
+ "CONFIDENCE.MEDIUM": 0,
1556
+ "CONFIDENCE.UNDEFINED": 0,
1557
+ "SEVERITY.HIGH": 0,
1558
+ "SEVERITY.LOW": 0,
1559
+ "SEVERITY.MEDIUM": 0,
1560
+ "SEVERITY.UNDEFINED": 0,
1561
+ "loc": 36,
1562
+ "nosec": 0,
1563
+ "skipped_tests": 0
1564
+ },
1565
+ "aws_lambda_powertools/utilities/parser/models/sqs.py": {
1566
+ "CONFIDENCE.HIGH": 0,
1567
+ "CONFIDENCE.LOW": 0,
1568
+ "CONFIDENCE.MEDIUM": 0,
1569
+ "CONFIDENCE.UNDEFINED": 0,
1570
+ "SEVERITY.HIGH": 0,
1571
+ "SEVERITY.LOW": 0,
1572
+ "SEVERITY.MEDIUM": 0,
1573
+ "SEVERITY.UNDEFINED": 0,
1574
+ "loc": 32,
1575
+ "nosec": 0,
1576
+ "skipped_tests": 0
1577
+ },
1578
+ "aws_lambda_powertools/utilities/parser/parser.py": {
1579
+ "CONFIDENCE.HIGH": 0,
1580
+ "CONFIDENCE.LOW": 0,
1581
+ "CONFIDENCE.MEDIUM": 0,
1582
+ "CONFIDENCE.UNDEFINED": 0,
1583
+ "SEVERITY.HIGH": 0,
1584
+ "SEVERITY.LOW": 0,
1585
+ "SEVERITY.MEDIUM": 0,
1586
+ "SEVERITY.UNDEFINED": 0,
1587
+ "loc": 128,
1588
+ "nosec": 0,
1589
+ "skipped_tests": 0
1590
+ },
1591
+ "aws_lambda_powertools/utilities/parser/pydantic.py": {
1592
+ "CONFIDENCE.HIGH": 0,
1593
+ "CONFIDENCE.LOW": 0,
1594
+ "CONFIDENCE.MEDIUM": 0,
1595
+ "CONFIDENCE.UNDEFINED": 0,
1596
+ "SEVERITY.HIGH": 0,
1597
+ "SEVERITY.LOW": 0,
1598
+ "SEVERITY.MEDIUM": 0,
1599
+ "SEVERITY.UNDEFINED": 0,
1600
+ "loc": 1,
1601
+ "nosec": 0,
1602
+ "skipped_tests": 0
1603
+ },
1604
+ "aws_lambda_powertools/utilities/parser/types.py": {
1605
+ "CONFIDENCE.HIGH": 0,
1606
+ "CONFIDENCE.LOW": 0,
1607
+ "CONFIDENCE.MEDIUM": 0,
1608
+ "CONFIDENCE.UNDEFINED": 0,
1609
+ "SEVERITY.HIGH": 0,
1610
+ "SEVERITY.LOW": 0,
1611
+ "SEVERITY.MEDIUM": 0,
1612
+ "SEVERITY.UNDEFINED": 0,
1613
+ "loc": 11,
1614
+ "nosec": 0,
1615
+ "skipped_tests": 0
1616
+ },
1617
+ "aws_lambda_powertools/utilities/typing/__init__.py": {
1618
+ "CONFIDENCE.HIGH": 0,
1619
+ "CONFIDENCE.LOW": 0,
1620
+ "CONFIDENCE.MEDIUM": 0,
1621
+ "CONFIDENCE.UNDEFINED": 0,
1622
+ "SEVERITY.HIGH": 0,
1623
+ "SEVERITY.LOW": 0,
1624
+ "SEVERITY.MEDIUM": 0,
1625
+ "SEVERITY.UNDEFINED": 0,
1626
+ "loc": 5,
1627
+ "nosec": 0,
1628
+ "skipped_tests": 0
1629
+ },
1630
+ "aws_lambda_powertools/utilities/typing/lambda_client_context.py": {
1631
+ "CONFIDENCE.HIGH": 0,
1632
+ "CONFIDENCE.LOW": 0,
1633
+ "CONFIDENCE.MEDIUM": 0,
1634
+ "CONFIDENCE.UNDEFINED": 0,
1635
+ "SEVERITY.HIGH": 0,
1636
+ "SEVERITY.LOW": 0,
1637
+ "SEVERITY.MEDIUM": 0,
1638
+ "SEVERITY.UNDEFINED": 0,
1639
+ "loc": 18,
1640
+ "nosec": 0,
1641
+ "skipped_tests": 0
1642
+ },
1643
+ "aws_lambda_powertools/utilities/typing/lambda_client_context_mobile_client.py": {
1644
+ "CONFIDENCE.HIGH": 0,
1645
+ "CONFIDENCE.LOW": 0,
1646
+ "CONFIDENCE.MEDIUM": 0,
1647
+ "CONFIDENCE.UNDEFINED": 0,
1648
+ "SEVERITY.HIGH": 0,
1649
+ "SEVERITY.LOW": 0,
1650
+ "SEVERITY.MEDIUM": 0,
1651
+ "SEVERITY.UNDEFINED": 0,
1652
+ "loc": 22,
1653
+ "nosec": 0,
1654
+ "skipped_tests": 0
1655
+ },
1656
+ "aws_lambda_powertools/utilities/typing/lambda_cognito_identity.py": {
1657
+ "CONFIDENCE.HIGH": 0,
1658
+ "CONFIDENCE.LOW": 0,
1659
+ "CONFIDENCE.MEDIUM": 0,
1660
+ "CONFIDENCE.UNDEFINED": 0,
1661
+ "SEVERITY.HIGH": 0,
1662
+ "SEVERITY.LOW": 0,
1663
+ "SEVERITY.MEDIUM": 0,
1664
+ "SEVERITY.UNDEFINED": 0,
1665
+ "loc": 12,
1666
+ "nosec": 0,
1667
+ "skipped_tests": 0
1668
+ },
1669
+ "aws_lambda_powertools/utilities/typing/lambda_context.py": {
1670
+ "CONFIDENCE.HIGH": 0,
1671
+ "CONFIDENCE.LOW": 0,
1672
+ "CONFIDENCE.MEDIUM": 0,
1673
+ "CONFIDENCE.UNDEFINED": 0,
1674
+ "SEVERITY.HIGH": 0,
1675
+ "SEVERITY.LOW": 0,
1676
+ "SEVERITY.MEDIUM": 0,
1677
+ "SEVERITY.UNDEFINED": 0,
1678
+ "loc": 64,
1679
+ "nosec": 0,
1680
+ "skipped_tests": 0
1681
+ },
1682
+ "aws_lambda_powertools/utilities/validation/__init__.py": {
1683
+ "CONFIDENCE.HIGH": 0,
1684
+ "CONFIDENCE.LOW": 0,
1685
+ "CONFIDENCE.MEDIUM": 0,
1686
+ "CONFIDENCE.UNDEFINED": 0,
1687
+ "SEVERITY.HIGH": 0,
1688
+ "SEVERITY.LOW": 0,
1689
+ "SEVERITY.MEDIUM": 0,
1690
+ "SEVERITY.UNDEFINED": 0,
1691
+ "loc": 12,
1692
+ "nosec": 0,
1693
+ "skipped_tests": 0
1694
+ },
1695
+ "aws_lambda_powertools/utilities/validation/base.py": {
1696
+ "CONFIDENCE.HIGH": 0,
1697
+ "CONFIDENCE.LOW": 0,
1698
+ "CONFIDENCE.MEDIUM": 0,
1699
+ "CONFIDENCE.UNDEFINED": 0,
1700
+ "SEVERITY.HIGH": 0,
1701
+ "SEVERITY.LOW": 0,
1702
+ "SEVERITY.MEDIUM": 0,
1703
+ "SEVERITY.UNDEFINED": 0,
1704
+ "loc": 39,
1705
+ "nosec": 0,
1706
+ "skipped_tests": 0
1707
+ },
1708
+ "aws_lambda_powertools/utilities/validation/envelopes.py": {
1709
+ "CONFIDENCE.HIGH": 0,
1710
+ "CONFIDENCE.LOW": 0,
1711
+ "CONFIDENCE.MEDIUM": 0,
1712
+ "CONFIDENCE.UNDEFINED": 0,
1713
+ "SEVERITY.HIGH": 0,
1714
+ "SEVERITY.LOW": 0,
1715
+ "SEVERITY.MEDIUM": 0,
1716
+ "SEVERITY.UNDEFINED": 0,
1717
+ "loc": 9,
1718
+ "nosec": 0,
1719
+ "skipped_tests": 0
1720
+ },
1721
+ "aws_lambda_powertools/utilities/validation/exceptions.py": {
1722
+ "CONFIDENCE.HIGH": 0,
1723
+ "CONFIDENCE.LOW": 0,
1724
+ "CONFIDENCE.MEDIUM": 0,
1725
+ "CONFIDENCE.UNDEFINED": 0,
1726
+ "SEVERITY.HIGH": 0,
1727
+ "SEVERITY.LOW": 0,
1728
+ "SEVERITY.MEDIUM": 0,
1729
+ "SEVERITY.UNDEFINED": 0,
1730
+ "loc": 53,
1731
+ "nosec": 0,
1732
+ "skipped_tests": 0
1733
+ },
1734
+ "aws_lambda_powertools/utilities/validation/validator.py": {
1735
+ "CONFIDENCE.HIGH": 0,
1736
+ "CONFIDENCE.LOW": 0,
1737
+ "CONFIDENCE.MEDIUM": 0,
1738
+ "CONFIDENCE.UNDEFINED": 0,
1739
+ "SEVERITY.HIGH": 0,
1740
+ "SEVERITY.LOW": 0,
1741
+ "SEVERITY.MEDIUM": 0,
1742
+ "SEVERITY.UNDEFINED": 0,
1743
+ "loc": 168,
1744
+ "nosec": 0,
1745
+ "skipped_tests": 0
1746
+ }
1747
+ },
1748
+ "results": [
1749
+ {
1750
+ "code": "259 try:\n260 if self.sampling_rate and random.random() <= float(self.sampling_rate):\n261 logger.debug(\"Setting log level to Debug due to sampling rate\")\n",
1751
+ "col_offset": 38,
1752
+ "filename": "aws_lambda_powertools/logging/logger.py",
1753
+ "issue_confidence": "HIGH",
1754
+ "issue_cwe": {
1755
+ "id": 330,
1756
+ "link": "https://cwe.mitre.org/data/definitions/330.html"
1757
+ },
1758
+ "issue_severity": "LOW",
1759
+ "issue_text": "Standard pseudo-random generators are not suitable for security/cryptographic purposes.",
1760
+ "line_number": 260,
1761
+ "line_range": [
1762
+ 260
1763
+ ],
1764
+ "more_info": "https://bandit.readthedocs.io/en/1.7.4/blacklists/blacklist_calls.html#b311-random",
1765
+ "test_id": "B311",
1766
+ "test_name": "blacklist"
1767
+ }
1768
+ ]
1769
+ }
testbed/aws-powertools__powertools-lambda-python/codecov.yml ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ ignore:
2
+ - "aws_lambda_powertools/event_handler/openapi/compat.py"
testbed/aws-powertools__powertools-lambda-python/layer/.gitignore ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ *.swp
2
+ package-lock.json
3
+ __pycache__
4
+ .pytest_cache
5
+ .venv
6
+ *.egg-info
7
+
8
+ # CDK asset staging directory
9
+ .cdk.staging
10
+ cdk.out
testbed/aws-powertools__powertools-lambda-python/layer/README.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!-- markdownlint-disable MD041 MD043-->
2
+ # CDK Powertools for AWS Lambda (Python) layer
3
+
4
+ This is a CDK project to build and deploy Powertools for AWS Lambda (Python) [Lambda layer](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-concepts.html#gettingstarted-concepts-layer) to multiple commercial regions.
5
+
6
+ ## Build the layer
7
+
8
+ To build the layer construct you need to provide the Powertools for AWS Lambda (Python) version that is [available in PyPi](https://pypi.org/project/aws-lambda-powertools/).
9
+ You can pass it as a context variable when running `synth` or `deploy`,
10
+
11
+ ```shell
12
+ cdk synth --context version=1.25.1
13
+ ```
14
+
15
+ ## Canary stack
16
+
17
+ We use a canary stack to verify that the deployment is successful and we can use the layer by adding it to a newly created Lambda function.
18
+ The canary is deployed after the layer construct. Because the layer ARN is created during the deploy we need to pass this information async via SSM parameter.
19
+ To achieve that we use SSM parameter store to pass the layer ARN to the canary.
20
+ The layer stack writes the layer ARN after the deployment as SSM parameter and the canary stacks reads this information and adds the layer to the function.
21
+
22
+ ## Version tracking
23
+
24
+ AWS Lambda versions Lambda layers by incrementing a number at the end of the ARN.
25
+ This makes it challenging to know which Powertools for AWS Lambda (Python) version a layer contains.
26
+ For better tracking of the ARNs and the corresponding version we need to keep track which Powertools for AWS Lambda (Python) version was deployed to which layer.
27
+ To achieve that we created two components. First, we created a version tracking app which receives events via EventBridge. Second, after a successful canary deployment we send the layer ARN, Powertools for AWS Lambda (Python) version, and the region to this EventBridge.
testbed/aws-powertools__powertools-lambda-python/layer/app.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+
3
+ import aws_cdk as cdk
4
+
5
+ from layer.canary_stack import CanaryStack
6
+ from layer.layer_stack import LayerStack
7
+
8
+ app = cdk.App()
9
+
10
+ POWERTOOLS_VERSION: str = app.node.try_get_context("version")
11
+ SSM_PARAM_LAYER_ARN: str = "/layers/powertools-layer-v2-arn"
12
+ SSM_PARAM_LAYER_ARM64_ARN: str = "/layers/powertools-layer-v2-arm64-arn"
13
+
14
+ if not POWERTOOLS_VERSION:
15
+ raise ValueError(
16
+ "Please set the version for Powertools for AWS Lambda (Python) by passing the '--context version=<version>' parameter to the CDK "
17
+ "synth step."
18
+ )
19
+
20
+ LayerStack(
21
+ app,
22
+ "LayerV2Stack",
23
+ powertools_version=POWERTOOLS_VERSION,
24
+ ssm_parameter_layer_arn=SSM_PARAM_LAYER_ARN,
25
+ ssm_parameter_layer_arm64_arn=SSM_PARAM_LAYER_ARM64_ARN,
26
+ )
27
+
28
+ CanaryStack(
29
+ app,
30
+ "CanaryV2Stack",
31
+ powertools_version=POWERTOOLS_VERSION,
32
+ ssm_paramter_layer_arn=SSM_PARAM_LAYER_ARN,
33
+ ssm_parameter_layer_arm64_arn=SSM_PARAM_LAYER_ARM64_ARN,
34
+ )
35
+
36
+ app.synth()
testbed/aws-powertools__powertools-lambda-python/layer/cdk.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "app": "python3 app.py",
3
+ "watch": {
4
+ "include": [
5
+ "**"
6
+ ],
7
+ "exclude": [
8
+ "README.md",
9
+ "cdk*.json",
10
+ "requirements*.txt",
11
+ "source.bat",
12
+ "**/__init__.py",
13
+ "python/__pycache__",
14
+ "tests"
15
+ ]
16
+ },
17
+ "context": {
18
+ "@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true,
19
+ "@aws-cdk/core:stackRelativeExports": true,
20
+ "@aws-cdk/aws-rds:lowercaseDbIdentifier": true,
21
+ "@aws-cdk/aws-lambda:recognizeVersionProps": true,
22
+ "@aws-cdk/aws-lambda:recognizeLayerVersion": true,
23
+ "@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": true,
24
+ "@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true,
25
+ "@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true,
26
+ "@aws-cdk/core:checkSecretUsage": true,
27
+ "@aws-cdk/aws-iam:minimizePolicies": true,
28
+ "@aws-cdk/core:validateSnapshotRemovalPolicy": true,
29
+ "@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true,
30
+ "@aws-cdk/core:target-partitions": [
31
+ "aws",
32
+ "aws-cn"
33
+ ]
34
+ }
35
+ }
testbed/aws-powertools__powertools-lambda-python/layer/layer/__init__.py ADDED
File without changes
testbed/aws-powertools__powertools-lambda-python/layer/layer/canary/app.py ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import datetime
2
+ import json
3
+ import os
4
+ import platform
5
+ from importlib.metadata import version
6
+
7
+ import boto3
8
+ from pydantic import HttpUrl
9
+
10
+ from aws_lambda_powertools import Logger, Metrics, Tracer
11
+ from aws_lambda_powertools.utilities.parser import BaseModel, envelopes, event_parser
12
+ from aws_lambda_powertools.utilities.typing import LambdaContext
13
+ from aws_lambda_powertools.utilities.validation import validator
14
+
15
+ logger = Logger(service="version-track")
16
+ tracer = Tracer() # this checks for aws-xray-sdk presence
17
+ metrics = Metrics(namespace="powertools-layer-canary", service="PowertoolsLayerCanary")
18
+
19
+ layer_arn = os.getenv("POWERTOOLS_LAYER_ARN")
20
+ powertools_version = os.getenv("POWERTOOLS_VERSION")
21
+ stage = os.getenv("LAYER_PIPELINE_STAGE")
22
+ event_bus_arn = os.getenv("VERSION_TRACKING_EVENT_BUS_ARN")
23
+
24
+
25
+ # Model to check parser imports correctly, tests for pydantic
26
+ class OrderItem(BaseModel):
27
+ order_id: int
28
+ quantity: int
29
+ description: str
30
+ url: HttpUrl
31
+
32
+
33
+ # Tests for jmespath presence
34
+ @event_parser(model=OrderItem, envelope=envelopes.EventBridgeEnvelope)
35
+ def envelope_handler(event: OrderItem, context: LambdaContext):
36
+ assert event.order_id != 1
37
+
38
+
39
+ # Tests for fastjsonschema presence
40
+ @validator(inbound_schema={}, envelope="detail")
41
+ def validator_handler(event, context: LambdaContext):
42
+ pass
43
+
44
+
45
+ def handler(event):
46
+ logger.info("Running checks")
47
+ check_envs()
48
+ verify_powertools_version()
49
+ send_notification()
50
+ return True
51
+
52
+
53
+ @logger.inject_lambda_context(log_event=True)
54
+ def on_event(event, context):
55
+ request_type = event["RequestType"]
56
+ # we handle only create events, because we recreate the canary on each run
57
+ if request_type == "Create":
58
+ return on_create(event)
59
+
60
+ return "Nothing to be processed"
61
+
62
+
63
+ def on_create(event):
64
+ props = event["ResourceProperties"]
65
+ logger.info("create new resource with properties %s" % props)
66
+ handler(event)
67
+
68
+
69
+ def check_envs():
70
+ logger.info('Checking required envs ["POWERTOOLS_LAYER_ARN", "AWS_REGION", "STAGE"]')
71
+ if not layer_arn:
72
+ raise ValueError("POWERTOOLS_LAYER_ARN is not set. Aborting...")
73
+ if not powertools_version:
74
+ raise ValueError("POWERTOOLS_VERSION is not set. Aborting...")
75
+ if not stage:
76
+ raise ValueError("LAYER_PIPELINE_STAGE is not set. Aborting...")
77
+ if not event_bus_arn:
78
+ raise ValueError("VERSION_TRACKING_EVENT_BUS_ARN is not set. Aborting...")
79
+ logger.info("All envs configured, continue...")
80
+
81
+
82
+ def verify_powertools_version() -> None:
83
+ """
84
+ fetches the version that we import from the Powertools for AWS Lambda (Python) layer and compares
85
+ it with expected version set in environment variable, which we pass during deployment.
86
+ :raise ValueError if the expected version is not the same as the version we get from the layer
87
+ """
88
+ logger.info("Checking Powertools for AWS Lambda (Python) version in library...")
89
+ current_version = version("aws_lambda_powertools")
90
+ if powertools_version != current_version:
91
+ raise ValueError(
92
+ f'Expected Powertools for AWS Lambda (Python) version is "{powertools_version}", but layer contains version "{current_version}"'
93
+ )
94
+ logger.info(f"Current Powertools for AWS Lambda (Python) version is: {current_version} [{_get_architecture()}]")
95
+
96
+
97
+ def send_notification():
98
+ """
99
+ sends an event to version tracking event bridge
100
+ """
101
+ if stage != "PROD":
102
+ logger.info("Not sending notification to event bus, because this is not the PROD stage")
103
+ return
104
+
105
+ event = {
106
+ "Time": datetime.datetime.now(),
107
+ "Source": "powertools.layer.canary",
108
+ "EventBusName": event_bus_arn,
109
+ "DetailType": "deployment",
110
+ "Detail": json.dumps(
111
+ {
112
+ "version": powertools_version,
113
+ "region": os.environ["AWS_REGION"],
114
+ "layerArn": layer_arn,
115
+ "architecture": _get_architecture(),
116
+ }
117
+ ),
118
+ }
119
+
120
+ logger.info(f"sending notification event: {event}")
121
+
122
+ client = boto3.client("events", region_name="eu-central-1")
123
+ resp = client.put_events(Entries=[event])
124
+ logger.info(resp)
125
+ if resp["FailedEntryCount"] != 0:
126
+ logger.error(resp)
127
+ raise ValueError("Failed to send deployment notification to version tracking")
128
+
129
+
130
+ def _get_architecture() -> str:
131
+ """Returns aarch64, x86_64"""
132
+ return platform.uname()[4]
testbed/aws-powertools__powertools-lambda-python/layer/layer/canary_stack.py ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import uuid
2
+
3
+ import jsii
4
+ from aws_cdk import (
5
+ Aspects,
6
+ CfnCondition,
7
+ CfnParameter,
8
+ CfnResource,
9
+ CustomResource,
10
+ Duration,
11
+ Fn,
12
+ IAspect,
13
+ Stack,
14
+ )
15
+ from aws_cdk.aws_iam import (
16
+ Effect,
17
+ ManagedPolicy,
18
+ PolicyStatement,
19
+ Role,
20
+ ServicePrincipal,
21
+ )
22
+ from aws_cdk.aws_lambda import Architecture, Code, Function, LayerVersion, Runtime
23
+ from aws_cdk.aws_logs import RetentionDays
24
+ from aws_cdk.aws_ssm import StringParameter
25
+ from aws_cdk.custom_resources import Provider
26
+ from constructs import Construct
27
+
28
+ VERSION_TRACKING_EVENT_BUS_ARN: str = (
29
+ "arn:aws:events:eu-central-1:027876851704:event-bus/VersionTrackingEventBus"
30
+ )
31
+
32
+
33
+ @jsii.implements(IAspect)
34
+ class ApplyCondition:
35
+ def __init__(self, condition: CfnCondition):
36
+ self.condition = condition
37
+
38
+ def visit(self, node):
39
+ if isinstance(node, CfnResource):
40
+ node.cfn_options.condition = self.condition
41
+
42
+
43
+ class CanaryStack(Stack):
44
+ def __init__(
45
+ self,
46
+ scope: Construct,
47
+ construct_id: str,
48
+ powertools_version: str,
49
+ ssm_paramter_layer_arn: str,
50
+ ssm_parameter_layer_arm64_arn: str,
51
+ **kwargs,
52
+ ) -> None:
53
+ super().__init__(scope, construct_id, **kwargs)
54
+
55
+ deploy_stage = CfnParameter(
56
+ self, "DeployStage", description="Deployment stage for canary"
57
+ ).value_as_string
58
+
59
+ has_arm64_support = CfnParameter(
60
+ self,
61
+ "HasARM64Support",
62
+ description="Has ARM64 Support Condition",
63
+ type="String",
64
+ allowed_values=["true", "false"],
65
+ )
66
+
67
+ has_arm64_condition = CfnCondition(
68
+ self,
69
+ "HasARM64SupportCondition",
70
+ expression=Fn.condition_equals(has_arm64_support, "true"),
71
+ )
72
+
73
+ layer_arn = StringParameter.from_string_parameter_attributes(
74
+ self, "LayerVersionArnParam", parameter_name=ssm_paramter_layer_arn
75
+ ).string_value
76
+ Canary(
77
+ self,
78
+ "Canary-x86-64",
79
+ layer_arn=layer_arn,
80
+ powertools_version=powertools_version,
81
+ architecture=Architecture.X86_64,
82
+ stage=deploy_stage,
83
+ )
84
+
85
+ layer_arm64_arn = StringParameter.from_string_parameter_attributes(
86
+ self,
87
+ "LayerArm64VersionArnParam",
88
+ parameter_name=ssm_parameter_layer_arm64_arn,
89
+ ).string_value
90
+
91
+ arm64_canary = Canary(
92
+ self,
93
+ "Canary-arm64",
94
+ layer_arn=layer_arm64_arn,
95
+ powertools_version=powertools_version,
96
+ architecture=Architecture.ARM_64,
97
+ stage=deploy_stage,
98
+ )
99
+ Aspects.of(arm64_canary).add(ApplyCondition(has_arm64_condition))
100
+
101
+
102
+ class Canary(Construct):
103
+ def __init__(
104
+ self,
105
+ scope: Construct,
106
+ construct_id: str,
107
+ layer_arn: str,
108
+ powertools_version: str,
109
+ architecture: Architecture,
110
+ stage: str,
111
+ ):
112
+ super().__init__(scope, construct_id)
113
+
114
+ layer = LayerVersion.from_layer_version_arn(
115
+ self, "PowertoolsLayer", layer_version_arn=layer_arn
116
+ )
117
+
118
+ execution_role = Role(
119
+ self,
120
+ "LambdaExecutionRole",
121
+ assumed_by=ServicePrincipal("lambda.amazonaws.com"),
122
+ )
123
+
124
+ execution_role.add_managed_policy(
125
+ ManagedPolicy.from_aws_managed_policy_name(
126
+ "service-role/AWSLambdaBasicExecutionRole"
127
+ )
128
+ )
129
+
130
+ execution_role.add_to_policy(
131
+ PolicyStatement(
132
+ effect=Effect.ALLOW, actions=["lambda:GetFunction"], resources=["*"]
133
+ )
134
+ )
135
+
136
+ canary_lambda = Function(
137
+ self,
138
+ "CanaryLambdaFunction",
139
+ code=Code.from_asset("layer/canary"),
140
+ handler="app.on_event",
141
+ layers=[layer],
142
+ memory_size=512,
143
+ timeout=Duration.seconds(10),
144
+ runtime=Runtime.PYTHON_3_9,
145
+ architecture=architecture,
146
+ log_retention=RetentionDays.TEN_YEARS,
147
+ role=execution_role,
148
+ environment={
149
+ "POWERTOOLS_VERSION": powertools_version,
150
+ "POWERTOOLS_LAYER_ARN": layer_arn,
151
+ "VERSION_TRACKING_EVENT_BUS_ARN": VERSION_TRACKING_EVENT_BUS_ARN,
152
+ "LAYER_PIPELINE_STAGE": stage,
153
+ },
154
+ )
155
+
156
+ canary_lambda.add_to_role_policy(
157
+ PolicyStatement(
158
+ effect=Effect.ALLOW,
159
+ actions=["events:PutEvents"],
160
+ resources=[VERSION_TRACKING_EVENT_BUS_ARN],
161
+ )
162
+ )
163
+
164
+ # custom resource provider configuration
165
+ provider = Provider(
166
+ self,
167
+ "CanaryCustomResource",
168
+ on_event_handler=canary_lambda,
169
+ log_retention=RetentionDays.TEN_YEARS,
170
+ )
171
+ # force to recreate resource on each deployment with randomized name
172
+ CustomResource(
173
+ self,
174
+ f"CanaryTrigger-{str(uuid.uuid4())[0:7]}",
175
+ service_token=provider.service_token,
176
+ )
testbed/aws-powertools__powertools-lambda-python/layer/layer/layer_stack.py ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Optional
2
+
3
+ import jsii
4
+ from aws_cdk import (
5
+ Aspects,
6
+ CfnCondition,
7
+ CfnOutput,
8
+ CfnParameter,
9
+ CfnResource,
10
+ Fn,
11
+ IAspect,
12
+ RemovalPolicy,
13
+ Stack,
14
+ )
15
+ from aws_cdk.aws_lambda import Architecture, CfnLayerVersionPermission
16
+ from aws_cdk.aws_ssm import StringParameter
17
+ from cdk_aws_lambda_powertools_layer import LambdaPowertoolsLayer
18
+ from constructs import Construct
19
+
20
+
21
+ @jsii.implements(IAspect)
22
+ class ApplyCondition:
23
+ def __init__(self, condition: CfnCondition):
24
+ self.condition = condition
25
+
26
+ def visit(self, node):
27
+ if isinstance(node, CfnResource):
28
+ node.cfn_options.condition = self.condition
29
+ if isinstance(node, CfnOutput):
30
+ node.condition = self.condition
31
+
32
+
33
+ class Layer(Construct):
34
+ def __init__(
35
+ self,
36
+ scope: Construct,
37
+ construct_id: str,
38
+ layer_version_name: str,
39
+ powertools_version: str,
40
+ architecture: Optional[Architecture] = None,
41
+ **kwargs
42
+ ) -> None:
43
+ super().__init__(scope, construct_id, **kwargs)
44
+
45
+ layer = LambdaPowertoolsLayer(
46
+ self,
47
+ "Layer",
48
+ layer_version_name=layer_version_name,
49
+ version=powertools_version,
50
+ include_extras=True,
51
+ compatible_architectures=[architecture] if architecture else [],
52
+ )
53
+ layer.apply_removal_policy(RemovalPolicy.RETAIN)
54
+
55
+ self.layer_version_arn = layer.layer_version_arn
56
+
57
+ layer_permission = CfnLayerVersionPermission(
58
+ self,
59
+ "PublicLayerAccess",
60
+ action="lambda:GetLayerVersion",
61
+ layer_version_arn=layer.layer_version_arn,
62
+ principal="*",
63
+ )
64
+ layer_permission.apply_removal_policy(RemovalPolicy.RETAIN)
65
+
66
+
67
+ class LayerStack(Stack):
68
+ def __init__(
69
+ self,
70
+ scope: Construct,
71
+ construct_id: str,
72
+ powertools_version: str,
73
+ ssm_parameter_layer_arn: str,
74
+ ssm_parameter_layer_arm64_arn: str,
75
+ **kwargs
76
+ ) -> None:
77
+ super().__init__(scope, construct_id, **kwargs)
78
+
79
+ has_arm64_support = CfnParameter(
80
+ self,
81
+ "HasARM64Support",
82
+ description="Has ARM64 Support Condition",
83
+ type="String",
84
+ allowed_values=["true", "false"],
85
+ )
86
+
87
+ has_arm64_condition = CfnCondition(
88
+ self,
89
+ "HasARM64SupportCondition",
90
+ expression=Fn.condition_equals(has_arm64_support, "true"),
91
+ )
92
+ has_no_arm64_condition = CfnCondition(
93
+ self,
94
+ "HasNOArm64SupportCondition",
95
+ expression=Fn.condition_equals(has_arm64_support, "false"),
96
+ )
97
+
98
+ # The following code is used when the region does not support ARM64 Lambdas. We make sure to only create the
99
+ # X86_64 Layer without specifying any compatible architecture, which would result in a CloudFormation error.
100
+
101
+ layer_single = Layer(
102
+ self,
103
+ "LayerSingle",
104
+ layer_version_name="AWSLambdaPowertoolsPythonV2",
105
+ powertools_version=powertools_version,
106
+ )
107
+ Aspects.of(layer_single).add(ApplyCondition(has_no_arm64_condition))
108
+
109
+ Aspects.of(
110
+ StringParameter(
111
+ self,
112
+ "SingleVersionArn",
113
+ parameter_name=ssm_parameter_layer_arn,
114
+ string_value=layer_single.layer_version_arn,
115
+ )
116
+ ).add(ApplyCondition(has_no_arm64_condition))
117
+
118
+ # The following code is used when the region has support for ARM64 Lambdas. In this case, we explicitly
119
+ # create a Layer for both X86_64 and ARM64, specifying the compatible architectures.
120
+
121
+ # X86_64 layer
122
+
123
+ layer = Layer(
124
+ self,
125
+ "Layer",
126
+ layer_version_name="AWSLambdaPowertoolsPythonV2",
127
+ powertools_version=powertools_version,
128
+ architecture=Architecture.X86_64,
129
+ )
130
+ Aspects.of(layer).add(ApplyCondition(has_arm64_condition))
131
+
132
+ Aspects.of(
133
+ StringParameter(
134
+ self,
135
+ "VersionArn",
136
+ parameter_name=ssm_parameter_layer_arn,
137
+ string_value=layer.layer_version_arn,
138
+ )
139
+ ).add(ApplyCondition(has_arm64_condition))
140
+
141
+ CfnOutput(
142
+ self,
143
+ "LatestLayerArn",
144
+ value=Fn.condition_if(
145
+ has_arm64_condition.logical_id,
146
+ layer.layer_version_arn,
147
+ layer_single.layer_version_arn,
148
+ ).to_string(),
149
+ )
150
+
151
+ # ARM64 layer
152
+
153
+ layer_arm64 = Layer(
154
+ self,
155
+ "Layer-ARM64",
156
+ layer_version_name="AWSLambdaPowertoolsPythonV2-Arm64",
157
+ powertools_version=powertools_version,
158
+ architecture=Architecture.ARM_64,
159
+ )
160
+ Aspects.of(layer_arm64).add(ApplyCondition(has_arm64_condition))
161
+
162
+ StringParameter(
163
+ self,
164
+ "Arm64VersionArn",
165
+ parameter_name=ssm_parameter_layer_arm64_arn,
166
+ string_value=Fn.condition_if(
167
+ has_arm64_condition.logical_id,
168
+ layer_arm64.layer_version_arn,
169
+ "none",
170
+ ).to_string(),
171
+ )
172
+
173
+ Aspects.of(
174
+ CfnOutput(self, "LatestLayerArm64Arn", value=layer_arm64.layer_version_arn)
175
+ ).add(ApplyCondition(has_arm64_condition))
testbed/aws-powertools__powertools-lambda-python/layer/poetry.lock ADDED
@@ -0,0 +1,446 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.
2
+
3
+ [[package]]
4
+ name = "attrs"
5
+ version = "23.1.0"
6
+ description = "Classes Without Boilerplate"
7
+ optional = false
8
+ python-versions = ">=3.7"
9
+ files = [
10
+ {file = "attrs-23.1.0-py3-none-any.whl", hash = "sha256:1f28b4522cdc2fb4256ac1a020c78acf9cba2c6b461ccd2c126f3aa8e8335d04"},
11
+ {file = "attrs-23.1.0.tar.gz", hash = "sha256:6279836d581513a26f1bf235f9acd333bc9115683f14f7e8fae46c98fc50e015"},
12
+ ]
13
+
14
+ [package.extras]
15
+ cov = ["attrs[tests]", "coverage[toml] (>=5.3)"]
16
+ dev = ["attrs[docs,tests]", "pre-commit"]
17
+ docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier", "zope-interface"]
18
+ tests = ["attrs[tests-no-zope]", "zope-interface"]
19
+ tests-no-zope = ["cloudpickle", "hypothesis", "mypy (>=1.1.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"]
20
+
21
+ [[package]]
22
+ name = "aws-cdk-asset-awscli-v1"
23
+ version = "2.2.201"
24
+ description = "A library that contains the AWS CLI for use in Lambda Layers"
25
+ optional = false
26
+ python-versions = "~=3.7"
27
+ files = [
28
+ {file = "aws-cdk.asset-awscli-v1-2.2.201.tar.gz", hash = "sha256:88d1c269fd5cf8c9f6e0464ed22e2d4f269dfd5b36b8c4d37687bdba9c269839"},
29
+ {file = "aws_cdk.asset_awscli_v1-2.2.201-py3-none-any.whl", hash = "sha256:56fe2ef91d3c8d33559aa32d2130e5f35f23af1fb82f06648ebbc82ffe0a5879"},
30
+ ]
31
+
32
+ [package.dependencies]
33
+ jsii = ">=1.91.0,<2.0.0"
34
+ publication = ">=0.0.3"
35
+ typeguard = ">=2.13.3,<2.14.0"
36
+
37
+ [[package]]
38
+ name = "aws-cdk-asset-kubectl-v20"
39
+ version = "2.1.2"
40
+ description = "A library that contains kubectl for use in Lambda Layers"
41
+ optional = false
42
+ python-versions = "~=3.7"
43
+ files = [
44
+ {file = "aws-cdk.asset-kubectl-v20-2.1.2.tar.gz", hash = "sha256:346283e43018a43e3b3ca571de3f44e85d49c038dc20851894cb8f9b2052b164"},
45
+ {file = "aws_cdk.asset_kubectl_v20-2.1.2-py3-none-any.whl", hash = "sha256:7f0617ab6cb942b066bd7174bf3e1f377e57878c3e1cddc21d6b2d13c92d0cc1"},
46
+ ]
47
+
48
+ [package.dependencies]
49
+ jsii = ">=1.70.0,<2.0.0"
50
+ publication = ">=0.0.3"
51
+ typeguard = ">=2.13.3,<2.14.0"
52
+
53
+ [[package]]
54
+ name = "aws-cdk-asset-node-proxy-agent-v6"
55
+ version = "2.0.1"
56
+ description = "@aws-cdk/asset-node-proxy-agent-v6"
57
+ optional = false
58
+ python-versions = "~=3.7"
59
+ files = [
60
+ {file = "aws-cdk.asset-node-proxy-agent-v6-2.0.1.tar.gz", hash = "sha256:42cdbc1de2ed3f845e3eb883a72f58fc7e5554c2e0b6fcdb366c159778dce74d"},
61
+ {file = "aws_cdk.asset_node_proxy_agent_v6-2.0.1-py3-none-any.whl", hash = "sha256:e442673d4f93137ab165b75386761b1d46eea25fc5015e5145ae3afa9da06b6e"},
62
+ ]
63
+
64
+ [package.dependencies]
65
+ jsii = ">=1.86.1,<2.0.0"
66
+ publication = ">=0.0.3"
67
+ typeguard = ">=2.13.3,<2.14.0"
68
+
69
+ [[package]]
70
+ name = "aws-cdk-lib"
71
+ version = "2.108.1"
72
+ description = "Version 2 of the AWS Cloud Development Kit library"
73
+ optional = false
74
+ python-versions = "~=3.7"
75
+ files = [
76
+ {file = "aws-cdk-lib-2.108.1.tar.gz", hash = "sha256:86bb6488de1830d8212d33f09eea494bca138182bc4db1a151fc7925598554b7"},
77
+ {file = "aws_cdk_lib-2.108.1-py3-none-any.whl", hash = "sha256:0c0ffa0e129782c3e69cc320297b338bbc6c994025f31d3ce310badd662e44be"},
78
+ ]
79
+
80
+ [package.dependencies]
81
+ "aws-cdk.asset-awscli-v1" = ">=2.2.201,<3.0.0"
82
+ "aws-cdk.asset-kubectl-v20" = ">=2.1.2,<3.0.0"
83
+ "aws-cdk.asset-node-proxy-agent-v6" = ">=2.0.1,<3.0.0"
84
+ constructs = ">=10.0.0,<11.0.0"
85
+ jsii = ">=1.91.0,<2.0.0"
86
+ publication = ">=0.0.3"
87
+ typeguard = ">=2.13.3,<2.14.0"
88
+
89
+ [[package]]
90
+ name = "boto3"
91
+ version = "1.29.0"
92
+ description = "The AWS SDK for Python"
93
+ optional = false
94
+ python-versions = ">= 3.7"
95
+ files = [
96
+ {file = "boto3-1.29.0-py3-none-any.whl", hash = "sha256:91c72fa4848eda9311c273db667946bd9d953285ae8d54b7bbad541b74adc254"},
97
+ {file = "boto3-1.29.0.tar.gz", hash = "sha256:3e90ea2faa3e9892b9140f857911f9ef0013192a106f50d0ec7b71e8d1afc90a"},
98
+ ]
99
+
100
+ [package.dependencies]
101
+ botocore = ">=1.32.0,<1.33.0"
102
+ jmespath = ">=0.7.1,<2.0.0"
103
+ s3transfer = ">=0.7.0,<0.8.0"
104
+
105
+ [package.extras]
106
+ crt = ["botocore[crt] (>=1.21.0,<2.0a0)"]
107
+
108
+ [[package]]
109
+ name = "botocore"
110
+ version = "1.32.0"
111
+ description = "Low-level, data-driven core of boto 3."
112
+ optional = false
113
+ python-versions = ">= 3.7"
114
+ files = [
115
+ {file = "botocore-1.32.0-py3-none-any.whl", hash = "sha256:9c1e143feb6a04235cec342d2acb31a0f44df3c89f309f839e03e38a75f3f44e"},
116
+ {file = "botocore-1.32.0.tar.gz", hash = "sha256:95fe3357b9ddc4559941dbea0f0a6b8fc043305f013b7ae2a85dff0c3b36ee92"},
117
+ ]
118
+
119
+ [package.dependencies]
120
+ jmespath = ">=0.7.1,<2.0.0"
121
+ python-dateutil = ">=2.1,<3.0.0"
122
+ urllib3 = [
123
+ {version = ">=1.25.4,<1.27", markers = "python_version < \"3.10\""},
124
+ {version = ">=1.25.4,<2.1", markers = "python_version >= \"3.10\""},
125
+ ]
126
+
127
+ [package.extras]
128
+ crt = ["awscrt (==0.19.12)"]
129
+
130
+ [[package]]
131
+ name = "cattrs"
132
+ version = "23.1.2"
133
+ description = "Composable complex class support for attrs and dataclasses."
134
+ optional = false
135
+ python-versions = ">=3.7"
136
+ files = [
137
+ {file = "cattrs-23.1.2-py3-none-any.whl", hash = "sha256:b2bb14311ac17bed0d58785e5a60f022e5431aca3932e3fc5cc8ed8639de50a4"},
138
+ {file = "cattrs-23.1.2.tar.gz", hash = "sha256:db1c821b8c537382b2c7c66678c3790091ca0275ac486c76f3c8f3920e83c657"},
139
+ ]
140
+
141
+ [package.dependencies]
142
+ attrs = ">=20"
143
+ exceptiongroup = {version = "*", markers = "python_version < \"3.11\""}
144
+ typing_extensions = {version = ">=4.1.0", markers = "python_version < \"3.11\""}
145
+
146
+ [package.extras]
147
+ bson = ["pymongo (>=4.2.0,<5.0.0)"]
148
+ cbor2 = ["cbor2 (>=5.4.6,<6.0.0)"]
149
+ msgpack = ["msgpack (>=1.0.2,<2.0.0)"]
150
+ orjson = ["orjson (>=3.5.2,<4.0.0)"]
151
+ pyyaml = ["PyYAML (>=6.0,<7.0)"]
152
+ tomlkit = ["tomlkit (>=0.11.4,<0.12.0)"]
153
+ ujson = ["ujson (>=5.4.0,<6.0.0)"]
154
+
155
+ [[package]]
156
+ name = "cdk-aws-lambda-powertools-layer"
157
+ version = "3.7.0"
158
+ description = "Powertools for AWS Lambda layer for python and typescript"
159
+ optional = false
160
+ python-versions = "~=3.7"
161
+ files = [
162
+ {file = "cdk-aws-lambda-powertools-layer-3.7.0.tar.gz", hash = "sha256:1225f8f9086412a620fb27fe59de5537456d636b435b496bffc76e544b1fda1f"},
163
+ {file = "cdk_aws_lambda_powertools_layer-3.7.0-py3-none-any.whl", hash = "sha256:353b010f0681a6d626721ce8f934fe17a649f845fefb276ea7451cfa1932b19e"},
164
+ ]
165
+
166
+ [package.dependencies]
167
+ aws-cdk-lib = ">=2.108.1,<3.0.0"
168
+ constructs = ">=10.0.5,<11.0.0"
169
+ jsii = ">=1.90.0,<2.0.0"
170
+ publication = ">=0.0.3"
171
+ typeguard = ">=2.13.3,<2.14.0"
172
+
173
+ [[package]]
174
+ name = "colorama"
175
+ version = "0.4.6"
176
+ description = "Cross-platform colored terminal text."
177
+ optional = false
178
+ python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
179
+ files = [
180
+ {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
181
+ {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
182
+ ]
183
+
184
+ [[package]]
185
+ name = "constructs"
186
+ version = "10.3.0"
187
+ description = "A programming model for software-defined state"
188
+ optional = false
189
+ python-versions = "~=3.7"
190
+ files = [
191
+ {file = "constructs-10.3.0-py3-none-any.whl", hash = "sha256:2972f514837565ff5b09171cfba50c0159dfa75ee86a42921ea8c86f2941b3d2"},
192
+ {file = "constructs-10.3.0.tar.gz", hash = "sha256:518551135ec236f9cc6b86500f4fbbe83b803ccdc6c2cb7684e0b7c4d234e7b1"},
193
+ ]
194
+
195
+ [package.dependencies]
196
+ jsii = ">=1.90.0,<2.0.0"
197
+ publication = ">=0.0.3"
198
+ typeguard = ">=2.13.3,<2.14.0"
199
+
200
+ [[package]]
201
+ name = "exceptiongroup"
202
+ version = "1.1.3"
203
+ description = "Backport of PEP 654 (exception groups)"
204
+ optional = false
205
+ python-versions = ">=3.7"
206
+ files = [
207
+ {file = "exceptiongroup-1.1.3-py3-none-any.whl", hash = "sha256:343280667a4585d195ca1cf9cef84a4e178c4b6cf2274caef9859782b567d5e3"},
208
+ {file = "exceptiongroup-1.1.3.tar.gz", hash = "sha256:097acd85d473d75af5bb98e41b61ff7fe35efe6675e4f9370ec6ec5126d160e9"},
209
+ ]
210
+
211
+ [package.extras]
212
+ test = ["pytest (>=6)"]
213
+
214
+ [[package]]
215
+ name = "importlib-resources"
216
+ version = "6.1.1"
217
+ description = "Read resources from Python packages"
218
+ optional = false
219
+ python-versions = ">=3.8"
220
+ files = [
221
+ {file = "importlib_resources-6.1.1-py3-none-any.whl", hash = "sha256:e8bf90d8213b486f428c9c39714b920041cb02c184686a3dee24905aaa8105d6"},
222
+ {file = "importlib_resources-6.1.1.tar.gz", hash = "sha256:3893a00122eafde6894c59914446a512f728a0c1a45f9bb9b63721b6bacf0b4a"},
223
+ ]
224
+
225
+ [package.dependencies]
226
+ zipp = {version = ">=3.1.0", markers = "python_version < \"3.10\""}
227
+
228
+ [package.extras]
229
+ docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (<7.2.5)", "sphinx (>=3.5)", "sphinx-lint"]
230
+ testing = ["pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy (>=0.9.1)", "pytest-ruff", "zipp (>=3.17)"]
231
+
232
+ [[package]]
233
+ name = "iniconfig"
234
+ version = "2.0.0"
235
+ description = "brain-dead simple config-ini parsing"
236
+ optional = false
237
+ python-versions = ">=3.7"
238
+ files = [
239
+ {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"},
240
+ {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"},
241
+ ]
242
+
243
+ [[package]]
244
+ name = "jmespath"
245
+ version = "1.0.1"
246
+ description = "JSON Matching Expressions"
247
+ optional = false
248
+ python-versions = ">=3.7"
249
+ files = [
250
+ {file = "jmespath-1.0.1-py3-none-any.whl", hash = "sha256:02e2e4cc71b5bcab88332eebf907519190dd9e6e82107fa7f83b1003a6252980"},
251
+ {file = "jmespath-1.0.1.tar.gz", hash = "sha256:90261b206d6defd58fdd5e85f478bf633a2901798906be2ad389150c5c60edbe"},
252
+ ]
253
+
254
+ [[package]]
255
+ name = "jsii"
256
+ version = "1.91.0"
257
+ description = "Python client for jsii runtime"
258
+ optional = false
259
+ python-versions = "~=3.7"
260
+ files = [
261
+ {file = "jsii-1.91.0-py3-none-any.whl", hash = "sha256:2905a4ea030ae7289b859e97003c01f4569650b4865c51e7f83d975b95c5b20a"},
262
+ {file = "jsii-1.91.0.tar.gz", hash = "sha256:9600ac7d04b237ee229c74ffde65ece27202ceec5df5e7eebd88a532d2cb28d6"},
263
+ ]
264
+
265
+ [package.dependencies]
266
+ attrs = ">=21.2,<24.0"
267
+ cattrs = ">=1.8,<23.2"
268
+ importlib-resources = ">=5.2.0"
269
+ publication = ">=0.0.3"
270
+ python-dateutil = "*"
271
+ typeguard = ">=2.13.3,<2.14.0"
272
+ typing-extensions = ">=3.7,<5.0"
273
+
274
+ [[package]]
275
+ name = "packaging"
276
+ version = "23.2"
277
+ description = "Core utilities for Python packages"
278
+ optional = false
279
+ python-versions = ">=3.7"
280
+ files = [
281
+ {file = "packaging-23.2-py3-none-any.whl", hash = "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7"},
282
+ {file = "packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5"},
283
+ ]
284
+
285
+ [[package]]
286
+ name = "pluggy"
287
+ version = "1.3.0"
288
+ description = "plugin and hook calling mechanisms for python"
289
+ optional = false
290
+ python-versions = ">=3.8"
291
+ files = [
292
+ {file = "pluggy-1.3.0-py3-none-any.whl", hash = "sha256:d89c696a773f8bd377d18e5ecda92b7a3793cbe66c87060a6fb58c7b6e1061f7"},
293
+ {file = "pluggy-1.3.0.tar.gz", hash = "sha256:cf61ae8f126ac6f7c451172cf30e3e43d3ca77615509771b3a984a0730651e12"},
294
+ ]
295
+
296
+ [package.extras]
297
+ dev = ["pre-commit", "tox"]
298
+ testing = ["pytest", "pytest-benchmark"]
299
+
300
+ [[package]]
301
+ name = "publication"
302
+ version = "0.0.3"
303
+ description = "Publication helps you maintain public-api-friendly modules by preventing unintentional access to private implementation details via introspection."
304
+ optional = false
305
+ python-versions = "*"
306
+ files = [
307
+ {file = "publication-0.0.3-py2.py3-none-any.whl", hash = "sha256:0248885351febc11d8a1098d5c8e3ab2dabcf3e8c0c96db1e17ecd12b53afbe6"},
308
+ {file = "publication-0.0.3.tar.gz", hash = "sha256:68416a0de76dddcdd2930d1c8ef853a743cc96c82416c4e4d3b5d901c6276dc4"},
309
+ ]
310
+
311
+ [[package]]
312
+ name = "pytest"
313
+ version = "7.4.3"
314
+ description = "pytest: simple powerful testing with Python"
315
+ optional = false
316
+ python-versions = ">=3.7"
317
+ files = [
318
+ {file = "pytest-7.4.3-py3-none-any.whl", hash = "sha256:0d009c083ea859a71b76adf7c1d502e4bc170b80a8ef002da5806527b9591fac"},
319
+ {file = "pytest-7.4.3.tar.gz", hash = "sha256:d989d136982de4e3b29dabcc838ad581c64e8ed52c11fbe86ddebd9da0818cd5"},
320
+ ]
321
+
322
+ [package.dependencies]
323
+ colorama = {version = "*", markers = "sys_platform == \"win32\""}
324
+ exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""}
325
+ iniconfig = "*"
326
+ packaging = "*"
327
+ pluggy = ">=0.12,<2.0"
328
+ tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""}
329
+
330
+ [package.extras]
331
+ testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"]
332
+
333
+ [[package]]
334
+ name = "python-dateutil"
335
+ version = "2.8.2"
336
+ description = "Extensions to the standard Python datetime module"
337
+ optional = false
338
+ python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7"
339
+ files = [
340
+ {file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"},
341
+ {file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"},
342
+ ]
343
+
344
+ [package.dependencies]
345
+ six = ">=1.5"
346
+
347
+ [[package]]
348
+ name = "s3transfer"
349
+ version = "0.7.0"
350
+ description = "An Amazon S3 Transfer Manager"
351
+ optional = false
352
+ python-versions = ">= 3.7"
353
+ files = [
354
+ {file = "s3transfer-0.7.0-py3-none-any.whl", hash = "sha256:10d6923c6359175f264811ef4bf6161a3156ce8e350e705396a7557d6293c33a"},
355
+ {file = "s3transfer-0.7.0.tar.gz", hash = "sha256:fd3889a66f5fe17299fe75b82eae6cf722554edca744ca5d5fe308b104883d2e"},
356
+ ]
357
+
358
+ [package.dependencies]
359
+ botocore = ">=1.12.36,<2.0a.0"
360
+
361
+ [package.extras]
362
+ crt = ["botocore[crt] (>=1.20.29,<2.0a.0)"]
363
+
364
+ [[package]]
365
+ name = "six"
366
+ version = "1.16.0"
367
+ description = "Python 2 and 3 compatibility utilities"
368
+ optional = false
369
+ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
370
+ files = [
371
+ {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"},
372
+ {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"},
373
+ ]
374
+
375
+ [[package]]
376
+ name = "tomli"
377
+ version = "2.0.1"
378
+ description = "A lil' TOML parser"
379
+ optional = false
380
+ python-versions = ">=3.7"
381
+ files = [
382
+ {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"},
383
+ {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"},
384
+ ]
385
+
386
+ [[package]]
387
+ name = "typeguard"
388
+ version = "2.13.3"
389
+ description = "Run-time type checker for Python"
390
+ optional = false
391
+ python-versions = ">=3.5.3"
392
+ files = [
393
+ {file = "typeguard-2.13.3-py3-none-any.whl", hash = "sha256:5e3e3be01e887e7eafae5af63d1f36c849aaa94e3a0112097312aabfa16284f1"},
394
+ {file = "typeguard-2.13.3.tar.gz", hash = "sha256:00edaa8da3a133674796cf5ea87d9f4b4c367d77476e185e80251cc13dfbb8c4"},
395
+ ]
396
+
397
+ [package.extras]
398
+ doc = ["sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"]
399
+ test = ["mypy", "pytest", "typing-extensions"]
400
+
401
+ [[package]]
402
+ name = "typing-extensions"
403
+ version = "4.8.0"
404
+ description = "Backported and Experimental Type Hints for Python 3.8+"
405
+ optional = false
406
+ python-versions = ">=3.8"
407
+ files = [
408
+ {file = "typing_extensions-4.8.0-py3-none-any.whl", hash = "sha256:8f92fc8806f9a6b641eaa5318da32b44d401efaac0f6678c9bc448ba3605faa0"},
409
+ {file = "typing_extensions-4.8.0.tar.gz", hash = "sha256:df8e4339e9cb77357558cbdbceca33c303714cf861d1eef15e1070055ae8b7ef"},
410
+ ]
411
+
412
+ [[package]]
413
+ name = "urllib3"
414
+ version = "1.26.19"
415
+ description = "HTTP library with thread-safe connection pooling, file post, and more."
416
+ optional = false
417
+ python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7"
418
+ files = [
419
+ {file = "urllib3-1.26.19-py2.py3-none-any.whl", hash = "sha256:37a0344459b199fce0e80b0d3569837ec6b6937435c5244e7fd73fa6006830f3"},
420
+ {file = "urllib3-1.26.19.tar.gz", hash = "sha256:3e3d753a8618b86d7de333b4223005f68720bcd6a7d2bcb9fbd2229ec7c1e429"},
421
+ ]
422
+
423
+ [package.extras]
424
+ brotli = ["brotli (==1.0.9)", "brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"]
425
+ secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "ipaddress", "pyOpenSSL (>=0.14)", "urllib3-secure-extra"]
426
+ socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]
427
+
428
+ [[package]]
429
+ name = "zipp"
430
+ version = "3.19.1"
431
+ description = "Backport of pathlib-compatible object wrapper for zip files"
432
+ optional = false
433
+ python-versions = ">=3.8"
434
+ files = [
435
+ {file = "zipp-3.19.1-py3-none-any.whl", hash = "sha256:2828e64edb5386ea6a52e7ba7cdb17bb30a73a858f5eb6eb93d8d36f5ea26091"},
436
+ {file = "zipp-3.19.1.tar.gz", hash = "sha256:35427f6d5594f4acf82d25541438348c26736fa9b3afa2754bcd63cdb99d8e8f"},
437
+ ]
438
+
439
+ [package.extras]
440
+ doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"]
441
+ test = ["big-O", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more-itertools", "pytest (>=6,!=8.1.*)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-ignore-flaky", "pytest-mypy", "pytest-ruff (>=0.2.1)"]
442
+
443
+ [metadata]
444
+ lock-version = "2.0"
445
+ python-versions = "^3.9"
446
+ content-hash = "1ce9cd0461793bbd8c624f9baf2a0118a148df95441269538efa50a7c72d19f0"
testbed/aws-powertools__powertools-lambda-python/layer/pyproject.toml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [tool.poetry]
2
+ name = "aws-lambda-powertools-python-layer"
3
+ version = "1.1.0"
4
+ description = "Powertools for AWS Lambda (Python) Lambda Layers"
5
+ authors = ["Powertools for AWS Maintainers <aws-powertools-maintainers@amazon.com>"]
6
+
7
+ license = "MIT"
8
+ [tool.poetry.dependencies]
9
+ python = "^3.9"
10
+ cdk-aws-lambda-powertools-layer = "^3.7.0"
11
+
12
+ [tool.poetry.dev-dependencies]
13
+ pytest = "^7.1.2"
14
+ boto3 = "^1.24.46"
15
+
16
+ [build-system]
17
+ requires = ["poetry-core>=1.0.0"]
18
+ build-backend = "poetry.core.masonry.api"
testbed/aws-powertools__powertools-lambda-python/layer/sar/template.txt ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ AWSTemplateFormatVersion: '2010-09-09'
2
+
3
+ Metadata:
4
+ AWS::ServerlessRepo::Application:
5
+ Name: <SAR_APP_NAME>
6
+ Description: "AWS Lambda Layer for aws-lambda-powertools"
7
+ Author: AWS
8
+ SpdxLicenseId: Apache-2.0
9
+ LicenseUrl: <LAYER_CONTENT_PATH>/LICENSE
10
+ ReadmeUrl: <LAYER_CONTENT_PATH>/README.md
11
+ Labels: ['layer','lambda','powertools','python', 'aws']
12
+ HomePageUrl: https://github.com/aws-powertools/powertools-lambda-python
13
+ SemanticVersion: <VERSION>
14
+ SourceCodeUrl: https://github.com/aws-powertools/powertools-lambda-python
15
+
16
+ Transform: AWS::Serverless-2016-10-31
17
+ Description: AWS Lambda Layer for aws-lambda-powertools with python 3.13, 3.12, 3.11, 3.10, 3.9 or 3.8
18
+
19
+ Resources:
20
+ LambdaLayer:
21
+ Type: AWS::Serverless::LayerVersion
22
+ Properties:
23
+ Description: "AWS Lambda Layer for aws-lambda-powertools version <VERSION>"
24
+ LayerName: <SAR_APP_NAME>
25
+ ContentUri: <LAYER_CONTENT_PATH>
26
+ CompatibleRuntimes:
27
+ - python3.13
28
+ - python3.12
29
+ - python3.11
30
+ - python3.10
31
+ - python3.9
32
+ - python3.8
33
+ LicenseInfo: 'Available under the Apache-2.0 license.'
34
+ RetentionPolicy: Retain
35
+
36
+ Outputs:
37
+ LayerVersionArn:
38
+ Description: ARN for the published Layer version
39
+ Value: !Ref LambdaLayer
40
+ Export:
41
+ Name: !Sub 'LayerVersionArn-${AWS::StackName}'
testbed/aws-powertools__powertools-lambda-python/layer/scripts/update_layer_arn.sh ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # This script is run during the publish_v2_layer.yml CI job,
4
+ # and it is responsible for replacing the layer ARN in our documentation,
5
+ # based on the output files generated by CDK when deploying to each pseudo_region.
6
+ #
7
+ # see .github/workflows/reusable_deploy_v2_layer_stack.yml
8
+
9
+ set -eo pipefail
10
+ set -x
11
+
12
+ if [[ $# -ne 1 ]]; then
13
+ cat <<EOM
14
+ Usage: $(basename $0) cdk-output-dir
15
+
16
+ cdk-output-dir: directory containing the cdk output files generated when deploying the Layer
17
+ EOM
18
+ exit 1
19
+ fi
20
+
21
+ CDK_OUTPUT_DIR=$1
22
+
23
+ # Check if CDK output dir is a directory
24
+ if [ ! -d "$CDK_OUTPUT_DIR" ]; then
25
+ echo "No $CDK_OUTPUT_DIR directory found, not replacing lambda layer versions"
26
+ exit 1
27
+ fi
28
+
29
+ # Process each file inside the directory
30
+ files="$CDK_OUTPUT_DIR/*"
31
+ for file in $files; do
32
+ echo "[+] Processing: $file"
33
+
34
+ # Process each line inside the file
35
+ lines=$(cat "$file")
36
+ for line in $lines; do
37
+ echo -e "\t[*] ARN: $line"
38
+ # line = arn:aws:lambda:eu-central-1:017000801446:layer:AWSLambdaPowertoolsPython:49
39
+
40
+ # From the full ARN, extract everything but the version at the end. This prefix
41
+ # will later be used to find/replace the ARN on the documentation file.
42
+ prefix=$(echo "$line" | cut -d ':' -f 1-7)
43
+ # prefix = arn:aws:lambda:eu-central-1:017000801446:layer:AWSLambdaPowertoolsPython
44
+
45
+ # Now replace the all "prefix"s in the file with the full new Layer ARN (line)
46
+ # prefix:\d+ ==> line
47
+ # sed doesn't support \d+ in a portable way, so we cheat with (:digit: :digit: *)
48
+ sed -i -e "s/$prefix:[[:digit:]][[:digit:]]*/$line/g" docs/index.md
49
+
50
+ # We use the eu-central-1 layer as the version for all the frameworks (SAM, CDK, SLS, etc)
51
+ # We could have used any other region. What's important is the version at the end.
52
+
53
+ # Examples of strings found in the documentation with pseudo regions:
54
+ # arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPython:39
55
+ # arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPython:39
56
+ # arn:aws:lambda:${aws:region}:017000801446:layer:AWSLambdaPowertoolsPython:39
57
+ # arn:aws:lambda:{env.region}:017000801446:layer:AWSLambdaPowertoolsPython:39
58
+ if [[ "$line" == *"eu-central-1"* ]]; then
59
+ # These are all the framework pseudo parameters currently found in the docs
60
+ for pseudo_region in '{region}' '${AWS::Region}' '${aws:region}' '{env.region}'; do
61
+ prefix_pseudo_region=$(echo "$prefix" | sed "s/eu-central-1/${pseudo_region}/")
62
+ # prefix_pseudo_region = arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPython
63
+
64
+ line_pseudo_region=$(echo "$line" | sed "s/eu-central-1/${pseudo_region}/")
65
+ # line_pseudo_region = arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPython:49
66
+
67
+ # Replace all the "prefix_pseudo_region"'s in the file
68
+ # prefix_pseudo_region:\d+ ==> line_pseudo_region
69
+ sed -i -e "s/$prefix_pseudo_region:[[:digit:]][[:digit:]]*/$line_pseudo_region/g" docs/index.md
70
+
71
+ # The same strings can also be found in examples on Logger, Tracer and Metrics
72
+ sed -i -e "s/$prefix_pseudo_region:[[:digit:]][[:digit:]]*/$line_pseudo_region/g" examples/logger/sam/template.yaml
73
+ sed -i -e "s/$prefix_pseudo_region:[[:digit:]][[:digit:]]*/$line_pseudo_region/g" examples/metrics/sam/template.yaml
74
+ sed -i -e "s/$prefix_pseudo_region:[[:digit:]][[:digit:]]*/$line_pseudo_region/g" examples/tracer/sam/template.yaml
75
+ done
76
+ fi
77
+ done
78
+ done
testbed/aws-powertools__powertools-lambda-python/mkdocs.yml ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ site_name: Powertools for AWS Lambda (Python)
2
+ site_description: Powertools for AWS Lambda (Python)
3
+ site_author: Amazon Web Services
4
+ repo_url: https://github.com/aws-powertools/powertools-lambda-python
5
+ edit_uri: edit/develop/docs
6
+
7
+ nav:
8
+ - Homepage:
9
+ - index.md
10
+ - Changelog: changelog.md
11
+ - API reference: api/" target="_blank
12
+ - Upgrade guide: upgrade.md
13
+ - We Made This (Community): we_made_this.md
14
+ - Workshop 🆕: https://s12d.com/powertools-for-aws-lambda-workshop" target="_blank
15
+ - Roadmap: roadmap.md
16
+ - Features:
17
+ - core/tracer.md
18
+ - core/logger.md
19
+ - Metrics:
20
+ - core/metrics/index.md
21
+ - Amazon CloudWatch EMF: core/metrics.md
22
+ - Datadog: core/metrics/datadog.md
23
+ - Event Handler:
24
+ - core/event_handler/api_gateway.md
25
+ - core/event_handler/appsync.md
26
+ - core/event_handler/bedrock_agents.md
27
+ - utilities/parameters.md
28
+ - utilities/batch.md
29
+ - utilities/typing.md
30
+ - utilities/validation.md
31
+ - utilities/data_classes.md
32
+ - utilities/parser.md
33
+ - utilities/idempotency.md
34
+ - utilities/data_masking.md
35
+ - utilities/feature_flags.md
36
+ - utilities/streaming.md
37
+ - utilities/middleware_factory.md
38
+ - utilities/jmespath_functions.md
39
+ - CloudFormation Custom Resources: https://github.com/aws-cloudformation/custom-resource-helper" target="_blank
40
+ - Tutorial: tutorial/index.md
41
+ - Processes:
42
+ - Security: security.md
43
+ - Automation: automation.md
44
+ - Versioning policy: versioning.md
45
+ - Roadmap: roadmap.md
46
+ - Maintainers: maintainers.md
47
+ - Contributing:
48
+ # - contributing/index.md
49
+ - Development environment: contributing/setup.md
50
+ - Your first contribution: contributing/getting_started.md
51
+ - Conventions: contributing/conventions.md
52
+ # - Testing:
53
+ # - Unit tests: contributing/testing/unit_tests.md
54
+ # - Functional tests: contributing/testing/functional_tests.md
55
+ # - End-to-end tests: contributing/testing/e2e_tests.md
56
+ # - Documentation:
57
+ # - User guide: contributing/documentation/user_guide.md
58
+ # - API guide: contributing/documentation/api_guide.md
59
+ # - Tutorials: contributing/documentation/tutorials.md
60
+ # - Request For Comments (RFC): contributing/documentation/rfc.md
61
+ # - Tracks:
62
+ # - Overview: contributing/tracks/overview.md
63
+ # - Casual to regular contributor: contributing/tracks/casual_regular_contributor.md
64
+ # - Customer to advocate: contributing/tracks/customer_advocate.md
65
+
66
+ theme:
67
+ name: material
68
+ font:
69
+ text: Ubuntu
70
+ palette:
71
+ - scheme: default
72
+ primary: deep purple
73
+ toggle:
74
+ icon: material/lightbulb
75
+ name: Switch to dark mode
76
+ - scheme: slate
77
+ primary: indigo
78
+ accent: teal
79
+ toggle:
80
+ icon: material/lightbulb-outline
81
+ name: Switch to light mode
82
+ features:
83
+ - header.autohide
84
+ - navigation.sections
85
+ - navigation.top
86
+ - navigation.instant
87
+ - navigation.indexes
88
+ - navigation.tracking
89
+ - navigation.tabs
90
+ - content.code.annotate
91
+ - content.code.copy
92
+ - content.tabs.link
93
+ icon:
94
+ repo: fontawesome/brands/github
95
+ logo: media/aws-logo-light.svg
96
+ favicon: media/aws-logo-light.svg
97
+ custom_dir: docs/overrides
98
+
99
+ markdown_extensions:
100
+ - admonition
101
+ - abbr
102
+ - pymdownx.tabbed:
103
+ alternate_style: true
104
+ slugify: !!python/object/apply:pymdownx.slugs.slugify
105
+ kwds:
106
+ case: lower
107
+ - pymdownx.highlight:
108
+ linenums: true
109
+ - pymdownx.details
110
+ - pymdownx.snippets:
111
+ base_path: "."
112
+ check_paths: true
113
+ restrict_base_path: false
114
+ auto_append:
115
+ - includes/abbreviations.md
116
+ - meta
117
+ - toc:
118
+ permalink: true
119
+ toc_depth: 5
120
+ - attr_list
121
+ - md_in_html
122
+ - pymdownx.emoji:
123
+ emoji_index: !!python/name:material.extensions.emoji.twemoji
124
+ emoji_generator: !!python/name:material.extensions.emoji.to_svg
125
+ - pymdownx.inlinehilite
126
+ - pymdownx.superfences:
127
+ custom_fences:
128
+ - name: mermaid
129
+ class: mermaid
130
+ format: !!python/name:pymdownx.superfences.fence_code_format
131
+ - pymdownx.tasklist:
132
+ custom_checkbox: true
133
+
134
+ copyright: Copyright &copy; 2023 Amazon Web Services
135
+
136
+ plugins:
137
+ - git-revision-date
138
+ - search
139
+
140
+ extra_css:
141
+ - stylesheets/extra.css
142
+ extra_javascript:
143
+ - javascript/aws-amplify.min.js
144
+ - javascript/extra.js
145
+ - https://docs.powertools.aws.dev/shared/mermaid.min.js
146
+
147
+ extra:
148
+ version:
149
+ provider: mike
150
+ default: latest
151
+ social:
152
+ - icon: fontawesome/brands/discord
153
+ link: https://discord.gg/B8zZKbbyET
154
+ name: Discord Server for Powertools for AWS
155
+ - icon: material/web
156
+ link: https://powertools.aws.dev/
157
+ name: Official website for Powertools for AWS
158
+ - icon: simple/python
159
+ link: https://pypi.org/project/aws-lambda-powertools/
160
+ name: PyPi package
testbed/aws-powertools__powertools-lambda-python/mypy.ini ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [mypy]
2
+ warn_return_any=False
3
+ warn_unused_configs=True
4
+ no_implicit_optional=True
5
+ warn_redundant_casts=True
6
+ warn_unused_ignores=False
7
+ show_column_numbers = True
8
+ show_error_codes = True
9
+ show_error_context = True
10
+ disable_error_code = annotation-unchecked
11
+
12
+ [mypy-jmespath]
13
+ ignore_missing_imports=True
14
+
15
+ [mypy-pulumi.*]
16
+ ignore_missing_imports=True
17
+
18
+ [mypy-pulumi_aws.*]
19
+ ignore_missing_imports=True
20
+
21
+ [mypy-aws_encryption_sdk.*]
22
+ ignore_missing_imports=True
23
+
24
+ [mypy-sentry_sdk]
25
+ ignore_missing_imports=True
26
+
27
+ [mypy-jsonpath_ng.*]
28
+ ignore_missing_imports=True
29
+
30
+ [mypy-jmespath.exceptions]
31
+ ignore_missing_imports=True
32
+
33
+ [mypy-jmespath.functions]
34
+ ignore_missing_imports=True
35
+
36
+ [mypy-aws_xray_sdk.ext.aiohttp.client]
37
+ ignore_missing_imports = True
38
+
39
+ [mypy-dataclasses]
40
+ ignore_missing_imports = True
41
+
42
+ [mypy-orjson]
43
+ ignore_missing_imports = True
44
+
45
+ [mypy-aiohttp]
46
+ ignore_missing_imports = True
47
+
48
+ [mypy-snappy]
49
+ ignore_missing_imports = True
50
+
51
+ [mypy-hvac]
52
+ ignore_missing_imports = True
53
+
54
+ [mypy-ijson]
55
+ ignore_missing_imports = True
56
+
57
+ [mypy-importlib.metadata]
58
+ ignore_missing_imports = True
59
+
60
+ [mypy-ujson]
61
+ ignore_missing_imports = True
testbed/aws-powertools__powertools-lambda-python/noxfile.py ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Run nox tests
2
+ #
3
+ # usage:
4
+ # poetry run nox --error-on-external-run --reuse-venv=yes --non-interactive
5
+ #
6
+ # If you want to target a specific Python version, add -p parameter
7
+ from __future__ import annotations
8
+
9
+ import nox
10
+
11
+ PREFIX_TESTS_FUNCTIONAL = "tests/functional"
12
+ PREFIX_TESTS_UNIT = "tests/unit"
13
+
14
+
15
+ def build_and_run_test(session: nox.Session, folders: list, extras: str = "") -> None:
16
+ """
17
+ This function is responsible for setting up the testing environment and running the test suite for specific feature.
18
+
19
+ The function performs the following tasks:
20
+ 1. Installs the required dependencies for executing any test
21
+ 2. If the `extras` parameter is provided, the function installs the additional dependencies
22
+ 3. the function runs the pytest command with the specified folders as arguments, executing the test suite.
23
+
24
+ Parameters
25
+ ----------
26
+ session: nox.Session
27
+ The current Nox session object, which is used to manage the virtual environment and execute commands.
28
+ folders: List
29
+ A list of folder paths that contain the test files to be executed.
30
+ extras: Optional[str]
31
+ A string representing additional dependencies that should be installed for the test environment.
32
+ If not provided, the function will install the project with basic dependencies
33
+ """
34
+
35
+ # Required install to execute any test
36
+ session.install("poetry", "pytest", "pytest-mock", "pytest_socket")
37
+
38
+ # Powertools project folder is in the root
39
+ if extras:
40
+ session.install(f"./[{extras}]")
41
+ else:
42
+ session.install("./")
43
+
44
+ # Execute test in specific folders
45
+ session.run("pytest", *folders)
46
+
47
+
48
+ @nox.session()
49
+ def test_with_only_required_packages(session: nox.Session):
50
+ """Tests that only depends for required libraries"""
51
+ # Logger
52
+ # Metrics - Amazon CloudWatch EMF
53
+ # Metrics - Base provider
54
+ # Middleware factory without tracer
55
+ # Typing
56
+ # Data Class - without codepipeline dataclass
57
+ # Event Handler without OpenAPI
58
+ # Batch processor - without pydantic integration
59
+ build_and_run_test(
60
+ session,
61
+ folders=[
62
+ f"{PREFIX_TESTS_FUNCTIONAL}/logger/required_dependencies/",
63
+ f"{PREFIX_TESTS_FUNCTIONAL}/metrics/required_dependencies/",
64
+ f"{PREFIX_TESTS_FUNCTIONAL}/middleware_factory/required_dependencies/",
65
+ f"{PREFIX_TESTS_FUNCTIONAL}/typing/required_dependencies/",
66
+ f"{PREFIX_TESTS_UNIT}/data_classes/required_dependencies/",
67
+ f"{PREFIX_TESTS_FUNCTIONAL}/event_handler/required_dependencies/",
68
+ f"{PREFIX_TESTS_FUNCTIONAL}/batch/required_dependencies/",
69
+ ],
70
+ )
71
+
72
+
73
+ @nox.session()
74
+ def test_with_datadog_as_required_package(session: nox.Session):
75
+ """Tests that depends on Datadog library"""
76
+ # Metrics - Datadog
77
+ build_and_run_test(
78
+ session,
79
+ folders=[
80
+ f"{PREFIX_TESTS_FUNCTIONAL}/metrics/datadog/",
81
+ ],
82
+ )
83
+
84
+
85
+ @nox.session()
86
+ def test_with_xray_sdk_as_required_package(session: nox.Session):
87
+ """Tests that depends on AWS XRAY SDK library"""
88
+ # Tracer
89
+ # Middleware factory with tracer
90
+ build_and_run_test(
91
+ session,
92
+ folders=[
93
+ f"{PREFIX_TESTS_FUNCTIONAL}/tracer/_aws_xray_sdk/",
94
+ f"{PREFIX_TESTS_FUNCTIONAL}/middleware_factory/_aws_xray_sdk/",
95
+ ],
96
+ extras="tracer",
97
+ )
98
+
99
+
100
+ @nox.session()
101
+ def test_with_boto3_sdk_as_required_package(session: nox.Session):
102
+ """Tests that depends on boto3/botocore library"""
103
+ # Parameters
104
+ # Feature Flags
105
+ # Data Class - only codepipeline dataclass
106
+ # Streaming
107
+ # Idempotency - DynamoDB persistent layer
108
+ build_and_run_test(
109
+ session,
110
+ folders=[
111
+ f"{PREFIX_TESTS_FUNCTIONAL}/parameters/_boto3/",
112
+ f"{PREFIX_TESTS_FUNCTIONAL}/feature_flags/_boto3/",
113
+ f"{PREFIX_TESTS_UNIT}/data_classes/_boto3/",
114
+ f"{PREFIX_TESTS_FUNCTIONAL}/streaming/_boto3/",
115
+ f"{PREFIX_TESTS_FUNCTIONAL}/idempotency/_boto3/",
116
+ ],
117
+ extras="aws-sdk",
118
+ )
119
+
120
+
121
+ @nox.session()
122
+ def test_with_fastjsonschema_as_required_package(session: nox.Session):
123
+ """Tests that depends on fastjsonschema library"""
124
+ # Validation
125
+ build_and_run_test(
126
+ session,
127
+ folders=[
128
+ f"{PREFIX_TESTS_FUNCTIONAL}/validator/_fastjsonschema/",
129
+ ],
130
+ extras="validation",
131
+ )
132
+
133
+
134
+ @nox.session()
135
+ def test_with_aws_encryption_sdk_as_required_package(session: nox.Session):
136
+ """Tests that depends on aws_encryption_sdk library"""
137
+ # Data Masking
138
+ build_and_run_test(
139
+ session,
140
+ folders=[
141
+ f"{PREFIX_TESTS_FUNCTIONAL}/data_masking/_aws_encryption_sdk/",
142
+ f"{PREFIX_TESTS_UNIT}/data_masking/_aws_encryption_sdk/",
143
+ ],
144
+ extras="datamasking",
145
+ )
146
+
147
+
148
+ @nox.session()
149
+ def test_with_pydantic_required_package(session: nox.Session):
150
+ """Tests that only depends for Pydantic library v2"""
151
+ # Event Handler OpenAPI
152
+ # Parser
153
+ # Batch Processor with pydantic integration
154
+ build_and_run_test(
155
+ session,
156
+ folders=[
157
+ f"{PREFIX_TESTS_FUNCTIONAL}/event_handler/_pydantic/",
158
+ f"{PREFIX_TESTS_FUNCTIONAL}/batch/_pydantic/",
159
+ f"{PREFIX_TESTS_UNIT}/parser/_pydantic/",
160
+ f"{PREFIX_TESTS_UNIT}/event_handler/_pydantic/",
161
+ ],
162
+ extras="parser",
163
+ )
164
+
165
+
166
+ @nox.session()
167
+ def test_with_boto3_and_pydantic_required_package(session: nox.Session):
168
+ """Tests that only depends for Boto3 + Pydantic library v2"""
169
+ # Idempotency with custom serializer
170
+
171
+ build_and_run_test(
172
+ session,
173
+ folders=[
174
+ f"{PREFIX_TESTS_FUNCTIONAL}/idempotency/_pydantic/",
175
+ ],
176
+ extras="aws-sdk,parser",
177
+ )
178
+
179
+
180
+ @nox.session()
181
+ def test_with_redis_and_boto3_sdk_as_required_package(session: nox.Session):
182
+ """Tests that depends on Redis library"""
183
+ # Idempotency - Redis backend
184
+
185
+ # Our Redis tests requires multiprocess library to simulate Race Condition
186
+ session.run("pip", "install", "multiprocess")
187
+
188
+ build_and_run_test(
189
+ session,
190
+ folders=[
191
+ f"{PREFIX_TESTS_FUNCTIONAL}/idempotency/_redis/",
192
+ ],
193
+ extras="redis,aws-sdk",
194
+ )
testbed/aws-powertools__powertools-lambda-python/package-lock.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "aws-lambda-powertools-python-e2e",
3
+ "version": "1.0.0",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "aws-lambda-powertools-python-e2e",
9
+ "version": "1.0.0",
10
+ "dependencies": {
11
+ "package-lock.json": "^1.0.0"
12
+ },
13
+ "devDependencies": {
14
+ "aws-cdk": "^2.167.1"
15
+ }
16
+ },
17
+ "node_modules/aws-cdk": {
18
+ "version": "2.167.1",
19
+ "resolved": "https://registry.npmjs.org/aws-cdk/-/aws-cdk-2.167.1.tgz",
20
+ "integrity": "sha512-GOFe5hj7xi7i7aqkaQ2PT1jmar+Ip+qNpA7hJoH4anz98rthcl4N2X01CdHiEc61/0urobwl5358xAZIhMd21g==",
21
+ "dev": true,
22
+ "bin": {
23
+ "cdk": "bin/cdk"
24
+ },
25
+ "engines": {
26
+ "node": ">= 14.15.0"
27
+ },
28
+ "optionalDependencies": {
29
+ "fsevents": "2.3.2"
30
+ }
31
+ },
32
+ "node_modules/fsevents": {
33
+ "version": "2.3.2",
34
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
35
+ "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
36
+ "dev": true,
37
+ "hasInstallScript": true,
38
+ "optional": true,
39
+ "os": [
40
+ "darwin"
41
+ ],
42
+ "engines": {
43
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
44
+ }
45
+ },
46
+ "node_modules/package-lock.json": {
47
+ "version": "1.0.0",
48
+ "resolved": "https://registry.npmjs.org/package-lock.json/-/package-lock.json-1.0.0.tgz",
49
+ "integrity": "sha512-+yEXtNdlCs5N0Zy/9uvkifgf/RqnGu0WqP4j9Wu1Us4YReFe1YNBh2Krmf8B1xGxjpYnta63K55QP8bkafnOzA=="
50
+ }
51
+ }
52
+ }
testbed/aws-powertools__powertools-lambda-python/package.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "aws-lambda-powertools-python-e2e",
3
+ "version": "1.0.0",
4
+ "devDependencies": {
5
+ "aws-cdk": "^2.167.1"
6
+ },
7
+ "dependencies": {
8
+ "package-lock.json": "^1.0.0"
9
+ }
10
+ }
testbed/aws-powertools__powertools-lambda-python/parallel_run_e2e.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """ Calculate how many parallel workers are needed to complete E2E infrastructure jobs across available CPU Cores """
2
+ import subprocess
3
+ import sys
4
+ from pathlib import Path
5
+
6
+
7
+ def main():
8
+ features = Path("tests/e2e").rglob("infrastructure.py")
9
+ workers = len(list(features)) - 1
10
+
11
+ command = f"poetry run pytest -n {workers} -o log_cli=true tests/e2e"
12
+ result = subprocess.run(command.split(), shell=False)
13
+ sys.exit(result.returncode)
14
+
15
+
16
+ if __name__ == "__main__":
17
+ main()
testbed/aws-powertools__powertools-lambda-python/poetry.lock ADDED
The diff for this file is too large to render. See raw diff
 
testbed/aws-powertools__powertools-lambda-python/pyproject.toml ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [tool.poetry]
2
+ name = "aws_lambda_powertools"
3
+ version = "3.3.1a2"
4
+ description = "Powertools for AWS Lambda (Python) is a developer toolkit to implement Serverless best practices and increase developer velocity."
5
+ authors = ["Amazon Web Services"]
6
+ include = ["aws_lambda_powertools/py.typed", "THIRD-PARTY-LICENSES"]
7
+ classifiers = [
8
+ "Development Status :: 5 - Production/Stable",
9
+ "Intended Audience :: Developers",
10
+ "License :: OSI Approved :: MIT No Attribution License (MIT-0)",
11
+ "Natural Language :: English",
12
+ "Programming Language :: Python :: 3.8",
13
+ "Programming Language :: Python :: 3.9",
14
+ "Programming Language :: Python :: 3.10",
15
+ "Programming Language :: Python :: 3.11",
16
+ "Programming Language :: Python :: 3.12",
17
+ "Programming Language :: Python :: 3.13",
18
+ ]
19
+ repository = "https://github.com/aws-powertools/powertools-lambda-python"
20
+ documentation = "https://docs.powertools.aws.dev/lambda/python/"
21
+ readme = "README.md"
22
+ keywords = [
23
+ "aws_lambda_powertools",
24
+ "aws",
25
+ "tracing",
26
+ "logging",
27
+ "lambda",
28
+ "powertools",
29
+ "feature_flags",
30
+ "idempotency",
31
+ "middleware",
32
+ ]
33
+ # MIT-0 is not recognized as an existing license from poetry.
34
+ # By using `MIT` as a license value, a `License :: OSI Approved :: MIT License` classifier is added to the classifiers list.
35
+ license = "MIT"
36
+
37
+ [tool.poetry.urls]
38
+ "Issue tracker" = "https://github.com/aws-powertools/powertools-lambda-python/issues"
39
+ "Releases" = "https://github.com/aws-powertools/powertools-lambda-python/releases"
40
+
41
+ [tool.poetry.dependencies]
42
+ python = ">=3.8,<4.0.0"
43
+
44
+ # Required libraries installed by default
45
+ jmespath = "^1.0.1"
46
+ typing-extensions = "^4.11.0"
47
+
48
+ # Optional libraries installed with extras
49
+ aws-xray-sdk = { version = "^2.8.0", optional = true }
50
+ fastjsonschema = { version = "^2.14.5", optional = true }
51
+ pydantic = { version = "^2.4.0", optional = true }
52
+ pydantic-settings = {version = "^2.6.1", optional = true}
53
+ boto3 = { version = "^1.34.32", optional = true }
54
+ redis = { version = ">=4.4,<6.0", optional = true }
55
+ datadog-lambda = { version = ">=4.77,<7.0", optional = true }
56
+ aws-encryption-sdk = { version = ">=3.1.1,<5.0.0", optional = true }
57
+ jsonpath-ng = { version = "^1.6.0", optional = true }
58
+
59
+ [tool.poetry.dev-dependencies]
60
+ coverage = { extras = ["toml"], version = "^7.6" }
61
+ pytest = "^8.3.3"
62
+ black = "^24.8"
63
+ boto3 = "^1.26.164"
64
+ isort = "^5.13.2"
65
+ pytest-cov = "^5.0.0"
66
+ pytest-mock = "^3.14.0"
67
+ pdoc3 = "^0.11.0"
68
+ pytest-asyncio = "^0.24.0"
69
+ bandit = "^1.7.10"
70
+ radon = "^6.0.1"
71
+ xenon = "^0.9.3"
72
+ mkdocs-git-revision-date-plugin = "^0.3.2"
73
+ mike = "^2.1.2"
74
+ pytest-xdist = "^3.6.1"
75
+ aws-cdk-lib = "^2.167.1"
76
+ "aws-cdk.aws-apigatewayv2-alpha" = "^2.38.1-alpha.0"
77
+ "aws-cdk.aws-apigatewayv2-integrations-alpha" = "^2.38.1-alpha.0"
78
+ "aws-cdk.aws-apigatewayv2-authorizers-alpha" = "^2.38.1-alpha.0"
79
+ "aws-cdk.aws-lambda-python-alpha" = "^2.167.1a0"
80
+ "cdklabs.generative-ai-cdk-constructs" = "^0.1.281"
81
+ pytest-benchmark = "^4.0.0"
82
+ types-requests = "^2.31.0"
83
+ typing-extensions = "^4.12.2"
84
+ mkdocs-material = "^9.5.44"
85
+ filelock = "^3.16.0"
86
+ dirhash = "^0.5.0"
87
+ mypy-boto3-appconfigdata = "^1.35.0"
88
+ ijson = "^3.3.0"
89
+ typed-ast = { version = "^1.5.5", python = "< 3.8" }
90
+ hvac = "^2.3.0"
91
+ aws-requests-auth = "^0.4.3"
92
+
93
+ [tool.poetry.extras]
94
+ parser = ["pydantic"]
95
+ validation = ["fastjsonschema"]
96
+ tracer = ["aws-xray-sdk"]
97
+ redis = ["redis"]
98
+ all = [
99
+ "pydantic",
100
+ "pydantic-settings",
101
+ "aws-xray-sdk",
102
+ "fastjsonschema",
103
+ "aws-encryption-sdk",
104
+ "jsonpath-ng"
105
+ ]
106
+ # allow customers to run code locally without emulators (SAM CLI, etc.)
107
+ aws-sdk = ["boto3"]
108
+ datadog = ["datadog-lambda"]
109
+ datamasking = ["aws-encryption-sdk", "jsonpath-ng"]
110
+
111
+ [tool.poetry.group.dev.dependencies]
112
+ cfn-lint = "1.19.0"
113
+ mypy = "^1.1.1"
114
+ types-python-dateutil = "^2.8.19.6"
115
+ aws-cdk-aws-appsync-alpha = "^2.59.0a0"
116
+ httpx = ">=0.23.3,<0.28.0"
117
+ sentry-sdk = ">=1.22.2,<3.0.0"
118
+ ruff = ">=0.5.1,<0.7.5"
119
+ retry2 = "^0.9.5"
120
+ pytest-socket = ">=0.6,<0.8"
121
+ types-redis = "^4.6.0.7"
122
+ testcontainers = { extras = ["redis"], version = "^3.7.1" }
123
+ multiprocess = "^0.70.16"
124
+ boto3-stubs = {extras = ["appconfig", "appconfigdata", "cloudformation", "cloudwatch", "dynamodb", "lambda", "logs", "s3", "secretsmanager", "ssm", "xray"], version = "^1.34.139"}
125
+ nox = "^2024.4.15"
126
+
127
+ [tool.coverage.run]
128
+ source = ["aws_lambda_powertools"]
129
+ omit = [
130
+ "tests/*",
131
+ "aws_lambda_powertools/exceptions/*",
132
+ "aws_lambda_powertools/utilities/parser/types.py",
133
+ "aws_lambda_powertools/utilities/jmespath_utils/envelopes.py",
134
+ "aws_lambda_powertools/metrics/metric.py" # barrel import (export-only)
135
+ ]
136
+ branch = true
137
+
138
+ [tool.coverage.html]
139
+ directory = "test_report"
140
+ title = "Powertools for AWS Lambda (Python) Test Coverage"
141
+
142
+ [tool.coverage.report]
143
+ fail_under = 90
144
+ exclude_lines = [
145
+ # Have to re-enable the standard pragma
146
+ "pragma: no cover",
147
+
148
+ # Don't complain about missing debug-only code:
149
+ "def __repr__",
150
+ "if self.debug",
151
+
152
+ # Don't complain if tests don't hit defensive assertion code:
153
+ "raise AssertionError",
154
+ "raise NotImplementedError",
155
+
156
+ # Don't complain if non-runnable code isn't run:
157
+ "if 0:",
158
+ "if __name__ == .__main__.:",
159
+
160
+ # Ignore runtime type checking
161
+ "if TYPE_CHECKING:",
162
+
163
+ # Ignore type function overload
164
+ "@overload",
165
+ ]
166
+
167
+ [tool.isort]
168
+ profile = "black" # resolves conflict with black
169
+ skip = "example"
170
+
171
+ [tool.black]
172
+ line-length = 120
173
+ exclude = '''
174
+
175
+ (
176
+ /(
177
+ \.eggs # exclude a few common directories in the
178
+ | \.git # root of the project
179
+ | \.hg
180
+ | \.mypy_cache
181
+ | \.tox
182
+ | \.venv
183
+ | _build
184
+ | buck-out
185
+ | build
186
+ | dist
187
+ | aws_lambda_powertools/event_handler/openapi/compat.py
188
+ )/
189
+ | example
190
+ )
191
+ '''
192
+
193
+ [tool.pytest.ini_options]
194
+ minversion = "6.0"
195
+ addopts = "-ra -vv"
196
+ testpaths = "./tests"
197
+ markers = [
198
+ "perf: marks perf tests to be deselected (deselect with '-m \"not perf\"')",
199
+ ]
200
+
201
+ [build-system]
202
+ requires = ["poetry-core>=1.3.2"]
203
+ build-backend = "poetry.core.masonry.api"
204
+
205
+ # poetry-core (PR #318) stopped generating setup.py by default, this enables it again.
206
+ [tool.poetry.build]
207
+ generate-setup-file = true
208
+
209
+ [tool.poetry_bumpversion.file."aws_lambda_powertools/shared/version.py"]
210
+ search = 'VERSION = "{current_version}"'
211
+ replace = 'VERSION = "{new_version}"'
testbed/aws-powertools__powertools-lambda-python/ruff.toml ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Enable rules.
2
+ lint.select = [
3
+ "A", # flake8-builtins - https://beta.ruff.rs/docs/rules/#flake8-builtins-a
4
+ "B", # flake8-bugbear-b - https://beta.ruff.rs/docs/rules/#flake8-bugbear-b
5
+ "C4", # flake8-comprehensions - https://beta.ruff.rs/docs/rules/#flake8-comprehensions-c4
6
+ "C90", # mccabe - https://beta.ruff.rs/docs/rules/#mccabe-c90
7
+ "COM", # flak8-commas - https://beta.ruff.rs/docs/rules/#flake8-commas-com
8
+ #"D", # pydocstyle - not enabled temporarily
9
+ "E", # pycodestyle error - https://beta.ruff.rs/docs/rules/#error-e
10
+ "ERA", # flake8-eradicate - https://beta.ruff.rs/docs/rules/#eradicate-era
11
+ "FA", # flake8-future-annotations - https://beta.ruff.rs/docs/rules/#flake8-future-annotations-fa
12
+ "FIX", # flake8-fixme - https://beta.ruff.rs/docs/rules/#flake8-fixme-fix
13
+ "F", # pyflakes - https://beta.ruff.rs/docs/rules/#pyflakes-f
14
+ "I", # isort - https://beta.ruff.rs/docs/rules/#isort-i
15
+ "ICN", # flake8-import-conventions - https://beta.ruff.rs/docs/rules/#flake8-import-conventions-icn
16
+ "ISC", # flake8-implicit-str-concat - https://beta.ruff.rs/docs/rules/#flake8-implicit-str-concat-isc
17
+ "PLE", # pylint error - https://beta.ruff.rs/docs/rules/#error-ple
18
+ "PLC", # pylint convention - https://beta.ruff.rs/docs/rules/#convention-plc
19
+ "PLR", # pylint refactoring - https://beta.ruff.rs/docs/rules/#refactor-plr
20
+ "PLW", # pylint warning - https://beta.ruff.rs/docs/rules/#warning-plw
21
+ "PL", # pylint - https://beta.ruff.rs/docs/rules/#pylint-pl
22
+ "PYI", # flake8-pyi - https://beta.ruff.rs/docs/rules/#flake8-pyi-pyi
23
+ "Q", # flake8-quotes - https://beta.ruff.rs/docs/rules/#flake8-quotes-q
24
+ "PTH", # flake8-use-pathlib - https://beta.ruff.rs/docs/rules/#flake8-use-pathlib-pth
25
+ "T10", # flake8-debugger https://beta.ruff.rs/docs/rules/#flake8-debugger-t10
26
+ "TCH", # flake8-type-checking - https://docs.astral.sh/ruff/rules/#flake8-type-checking-tch
27
+ "TD", # flake8-todo - https://beta.ruff.rs/docs/rules/#flake8-todos-td
28
+ "UP", # pyupgrade - https://docs.astral.sh/ruff/rules/#pyupgrade-up
29
+ "W", # pycodestyle warning - https://beta.ruff.rs/docs/rules/#warning-w
30
+ ]
31
+
32
+ # Ignore specific rules
33
+ lint.ignore = [
34
+ "W291", # https://beta.ruff.rs/docs/rules/trailing-whitespace/
35
+ "PLR0913", # https://beta.ruff.rs/docs/rules/too-many-arguments/
36
+ "PLR2004", #https://beta.ruff.rs/docs/rules/magic-value-comparison/
37
+ "PLW0603", #https://beta.ruff.rs/docs/rules/global-statement/
38
+ "B904", # raise-without-from-inside-except - disabled temporarily
39
+ "PLC1901", # Compare-to-empty-string - disabled temporarily
40
+ "PYI024",
41
+ ]
42
+
43
+ # Exclude files and directories
44
+ exclude = [
45
+ "docs",
46
+ ".eggs",
47
+ "setup.py",
48
+ "example",
49
+ ".aws-sam",
50
+ ".git",
51
+ "dist",
52
+ ".md",
53
+ ".yaml",
54
+ "example/samconfig.toml",
55
+ ".txt",
56
+ ".ini",
57
+ ]
58
+
59
+ # Maximum line length
60
+ line-length = 120
61
+
62
+ target-version = "py38"
63
+
64
+ fix = true
65
+ lint.fixable = ["I", "COM812", "W"]
66
+
67
+ # See: https://github.com/astral-sh/ruff/issues/128
68
+ lint.typing-modules = [
69
+ "aws_lambda_powertools.utilities.parser.types",
70
+ "aws_lambda_powertools.shared.types",
71
+ ]
72
+
73
+ [lint.mccabe]
74
+ # Maximum cyclomatic complexity
75
+ max-complexity = 15
76
+
77
+ [lint.pylint]
78
+ # Maximum number of nested blocks
79
+ max-branches = 15
80
+ # Maximum number of if statements in a function
81
+ max-statements = 70
82
+
83
+ [lint.isort]
84
+ split-on-trailing-comma = true
85
+
86
+ [lint.flake8-type-checking]
87
+ runtime-evaluated-base-classes = ["pydantic.BaseModel"]
88
+
89
+ [lint.per-file-ignores]
90
+ # Ignore specific rules for specific files
91
+ "tests/e2e/utils/data_builder/__init__.py" = ["F401"]
92
+ "tests/e2e/utils/data_fetcher/__init__.py" = ["F401"]
93
+ "aws_lambda_powertools/utilities/data_classes/s3_event.py" = ["A003"]
94
+ "aws_lambda_powertools/utilities/parser/models/__init__.py" = ["E402"]
95
+ "aws_lambda_powertools/event_handler/openapi/compat.py" = ["F401"]
96
+ # Maintenance: we're keeping EphemeralMetrics code in case of Hyrum's law so we can quickly revert it
97
+ "aws_lambda_powertools/metrics/metrics.py" = ["ERA001"]
98
+ "examples/*" = ["FA100", "TCH"]
99
+ "tests/*" = ["FA100", "TCH"]
100
+ "aws_lambda_powertools/utilities/parser/models/*" = ["FA100"]
testbed/aws-powertools__powertools-lambda-python/tests/__init__.py ADDED
File without changes
testbed/aws-powertools__powertools-lambda-python/tests/functional/__init__.py ADDED
File without changes
testbed/aws-powertools__powertools-lambda-python/tests/functional/data_masking/__init__.py ADDED
File without changes
testbed/aws-powertools__powertools-lambda-python/tests/functional/data_masking/_aws_encryption_sdk/test_aws_encryption_sdk.py ADDED
@@ -0,0 +1,474 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import base64
2
+ import functools
3
+ import json
4
+ from typing import Any, Callable, Union
5
+
6
+ import pytest
7
+ from aws_encryption_sdk.identifiers import Algorithm
8
+
9
+ from aws_lambda_powertools.utilities.data_masking import DataMasking
10
+ from aws_lambda_powertools.utilities.data_masking.constants import DATA_MASKING_STRING
11
+ from aws_lambda_powertools.utilities.data_masking.provider import BaseProvider
12
+ from aws_lambda_powertools.utilities.data_masking.provider.kms import (
13
+ AWSEncryptionSDKProvider,
14
+ )
15
+
16
+
17
+ class FakeEncryptionKeyProvider(BaseProvider):
18
+ def __init__(
19
+ self,
20
+ json_serializer: Callable = functools.partial(json.dumps, ensure_ascii=False),
21
+ json_deserializer: Callable = json.loads,
22
+ ) -> None:
23
+ super().__init__(json_serializer, json_deserializer)
24
+
25
+ def encrypt(self, data: Union[bytes, str], **kwargs) -> str:
26
+ encoded_data: str = self.json_serializer(data)
27
+ ciphertext = base64.b64encode(encoded_data.encode("utf-8")).decode()
28
+ return ciphertext
29
+
30
+ def decrypt(self, data: bytes, **kwargs) -> Any:
31
+ ciphertext_decoded = base64.b64decode(data).decode("utf-8")
32
+ ciphertext = self.json_deserializer(ciphertext_decoded)
33
+ return ciphertext
34
+
35
+
36
+ @pytest.fixture
37
+ def data_masker(monkeypatch) -> DataMasking:
38
+ """DataMasking using AWS Encryption SDK Provider with a fake client"""
39
+ fake_key_provider = FakeEncryptionKeyProvider()
40
+ provider = AWSEncryptionSDKProvider(
41
+ keys=["dummy"],
42
+ key_provider=fake_key_provider,
43
+ )
44
+ return DataMasking(provider=provider)
45
+
46
+
47
+ def test_erase_int(data_masker):
48
+ # GIVEN an int data type
49
+
50
+ # WHEN erase is called with no fields argument
51
+ erased_string = data_masker.erase(42)
52
+
53
+ # THEN the result is the data masked
54
+ assert erased_string == DATA_MASKING_STRING
55
+
56
+
57
+ def test_erase_float(data_masker):
58
+ # GIVEN a float data type
59
+
60
+ # WHEN erase is called with no fields argument
61
+ erased_string = data_masker.erase(4.2)
62
+
63
+ # THEN the result is the data masked
64
+ assert erased_string == DATA_MASKING_STRING
65
+
66
+
67
+ def test_erase_bool(data_masker):
68
+ # GIVEN a bool data type
69
+
70
+ # WHEN erase is called with no fields argument
71
+ erased_string = data_masker.erase(True)
72
+
73
+ # THEN the result is the data masked
74
+ assert erased_string == DATA_MASKING_STRING
75
+
76
+
77
+ def test_erase_none(data_masker):
78
+ # GIVEN a None data type
79
+
80
+ # WHEN erase is called with no fields argument
81
+ erased_string = data_masker.erase(None)
82
+
83
+ # THEN the result is the data masked
84
+ assert erased_string == DATA_MASKING_STRING
85
+
86
+
87
+ def test_erase_str(data_masker):
88
+ # GIVEN a str data type
89
+
90
+ # WHEN erase is called with no fields argument
91
+ erased_string = data_masker.erase("this is a string")
92
+
93
+ # THEN the result is the data masked
94
+ assert erased_string == DATA_MASKING_STRING
95
+
96
+
97
+ def test_erase_list(data_masker):
98
+ # GIVEN a list data type
99
+
100
+ # WHEN erase is called with no fields argument
101
+ erased_string = data_masker.erase([1, 2, "string", 3])
102
+
103
+ # THEN the result is the data masked, while maintaining type list
104
+ assert erased_string == [DATA_MASKING_STRING, DATA_MASKING_STRING, DATA_MASKING_STRING, DATA_MASKING_STRING]
105
+
106
+
107
+ def test_erase_dict(data_masker):
108
+ # GIVEN a dict data type
109
+ data = {
110
+ "a": {
111
+ "1": {"None": "hello", "four": "world"},
112
+ "b": {"3": {"4": "goodbye", "e": "world"}},
113
+ },
114
+ }
115
+
116
+ # WHEN erase is called with no fields argument
117
+ erased_string = data_masker.erase(data)
118
+
119
+ # THEN the result is the data masked
120
+ assert erased_string == DATA_MASKING_STRING
121
+
122
+
123
+ def test_erase_dict_with_fields(data_masker):
124
+ # GIVEN a dict data type
125
+ data = {
126
+ "a": {
127
+ "1": {"None": "hello", "four": "world"},
128
+ "b": {"3": {"4": "goodbye", "e": "world"}},
129
+ },
130
+ }
131
+
132
+ # WHEN erase is called with a list of fields specified
133
+ erased_string = data_masker.erase(data, fields=["a.'1'.None", "a..'4'"])
134
+
135
+ # THEN the result is only the specified fields are masked
136
+ assert erased_string == {
137
+ "a": {
138
+ "1": {"None": DATA_MASKING_STRING, "four": "world"},
139
+ "b": {"3": {"4": DATA_MASKING_STRING, "e": "world"}},
140
+ },
141
+ }
142
+
143
+
144
+ def test_erase_json_dict_with_fields(data_masker):
145
+ # GIVEN the data type is a json representation of a dictionary
146
+ data = json.dumps(
147
+ {
148
+ "a": {
149
+ "1": {"None": "hello", "four": "world"},
150
+ "b": {"3": {"4": "goodbye", "e": "world"}},
151
+ },
152
+ },
153
+ )
154
+
155
+ # WHEN erase is called with a list of fields specified
156
+ masked_json_string = data_masker.erase(data, fields=["a.'1'.None", "a..'4'"])
157
+
158
+ # THEN the result is only the specified fields are masked
159
+ assert masked_json_string == {
160
+ "a": {
161
+ "1": {"None": DATA_MASKING_STRING, "four": "world"},
162
+ "b": {"3": {"4": DATA_MASKING_STRING, "e": "world"}},
163
+ },
164
+ }
165
+
166
+
167
+ def test_encrypt_int(data_masker):
168
+ # GIVEN an int data type
169
+
170
+ # WHEN encrypting and then decrypting the encrypted data
171
+ encrypted_data = data_masker.encrypt(-1)
172
+ decrypted_data = data_masker.decrypt(encrypted_data)
173
+
174
+ # THEN the result is the original input data
175
+ assert decrypted_data == -1
176
+
177
+
178
+ def test_encrypt_float(data_masker):
179
+ # GIVEN an float data type
180
+
181
+ # WHEN encrypting and then decrypting the encrypted data
182
+ encrypted_data = data_masker.encrypt(-1.11)
183
+ decrypted_data = data_masker.decrypt(encrypted_data)
184
+
185
+ # THEN the result is the original input data
186
+ assert decrypted_data == -1.11
187
+
188
+
189
+ def test_encrypt_bool(data_masker):
190
+ # GIVEN an bool data type
191
+
192
+ # WHEN encrypting and then decrypting the encrypted data
193
+ encrypted_data = data_masker.encrypt(True)
194
+ decrypted_data = data_masker.decrypt(encrypted_data)
195
+
196
+ # THEN the result is the original input data
197
+ assert decrypted_data is True
198
+
199
+
200
+ def test_encrypt_none(data_masker):
201
+ # GIVEN an none data type
202
+
203
+ # WHEN encrypting and then decrypting the encrypted data
204
+ encrypted_data = data_masker.encrypt(None)
205
+ decrypted_data = data_masker.decrypt(encrypted_data)
206
+
207
+ # THEN the result is the original input data
208
+ assert decrypted_data is None
209
+
210
+
211
+ def test_encrypt_str(data_masker):
212
+ # GIVEN an str data type
213
+
214
+ # WHEN encrypting and then decrypting the encrypted data
215
+ encrypted_data = data_masker.encrypt("this is a string")
216
+ decrypted_data = data_masker.decrypt(encrypted_data)
217
+
218
+ # THEN the result is the original input data
219
+ assert decrypted_data == "this is a string"
220
+
221
+
222
+ def test_encrypt_list(data_masker):
223
+ # GIVEN an list data type
224
+
225
+ # WHEN encrypting and then decrypting the encrypted data
226
+ encrypted_data = data_masker.encrypt([1, 2, "a string", 3.4])
227
+ decrypted_data = data_masker.decrypt(encrypted_data)
228
+
229
+ # THEN the result is the original input data
230
+ assert decrypted_data == [1, 2, "a string", 3.4]
231
+
232
+
233
+ def test_encrypt_dict(data_masker):
234
+ # GIVEN an dict data type
235
+ data = {
236
+ "a": {
237
+ "1": {"None": "hello", "four": "world"},
238
+ "b": {"3": {"4": "goodbye", "e": "world"}},
239
+ },
240
+ }
241
+
242
+ # WHEN encrypting and then decrypting the encrypted data
243
+ encrypted_data = data_masker.encrypt(data)
244
+ decrypted_data = data_masker.decrypt(encrypted_data)
245
+
246
+ # THEN the result is the original input data
247
+ assert decrypted_data == data
248
+
249
+
250
+ def test_encrypt_dict_with_fields(data_masker):
251
+ # GIVEN the data type is a dictionary
252
+ data = {
253
+ "a": {
254
+ "1": {"None": "hello", "four": "world"},
255
+ "b": {"3": {"4": "goodbye", "e": "world"}},
256
+ },
257
+ }
258
+
259
+ # WHEN encrypting and then decrypting the encrypted data
260
+ encrypted_data = data_masker.encrypt(data)
261
+ decrypted_data = data_masker.decrypt(encrypted_data)
262
+
263
+ # THEN the result is only the specified fields are masked
264
+ assert decrypted_data == data
265
+
266
+
267
+ def test_encrypt_json_dict_with_fields(data_masker):
268
+ # GIVEN the data type is a json representation of a dictionary
269
+ data = json.dumps(
270
+ {
271
+ "a": {
272
+ "1": {"None": "hello", "four": "world"},
273
+ "b": {"3": {"4": "goodbye", "e": "world"}},
274
+ },
275
+ },
276
+ )
277
+
278
+ # WHEN encrypting and then decrypting the encrypted data
279
+ encrypted_data = data_masker.encrypt(data)
280
+ decrypted_data = data_masker.decrypt(encrypted_data)
281
+
282
+ # THEN the result is only the specified fields are masked
283
+ assert decrypted_data == data
284
+
285
+
286
+ def test_encrypt_json_with_list_fields(data_masker):
287
+ # GIVEN the data type is a json representation of a dictionary with a list inside
288
+ data = json.dumps(
289
+ {
290
+ "payload": {
291
+ "first": ["value1", "value2"],
292
+ "second": [{"key1": [0, 1]}],
293
+ },
294
+ },
295
+ )
296
+
297
+ # WHEN encrypting and then decrypting the encrypted data
298
+ encrypted_data = data_masker.encrypt(data)
299
+ decrypted_data = data_masker.decrypt(encrypted_data)
300
+
301
+ # THEN the result is only the specified fields are masked
302
+ assert decrypted_data == data
303
+
304
+
305
+ def test_encrypt_json_with_tuple_fields(data_masker):
306
+ # GIVEN the data type is a json representation of a dictionary with a list inside
307
+ data = json.dumps(
308
+ {
309
+ "payload": {
310
+ "first": ["value1", "value2"],
311
+ "second": (0, 1),
312
+ },
313
+ },
314
+ )
315
+
316
+ # WHEN encrypting and then decrypting the encrypted data
317
+ encrypted_data = data_masker.encrypt(data)
318
+ decrypted_data = data_masker.decrypt(encrypted_data)
319
+
320
+ # THEN the result is only the specified fields are masked
321
+ assert decrypted_data == data
322
+
323
+
324
+ def test_encrypt_with_encryption_context(data_masker):
325
+ # GIVEN the data type is a json representation of a dictionary with a list inside
326
+ data = json.dumps(
327
+ {
328
+ "payload": {
329
+ "first": ["value1", "value2"],
330
+ "second": (0, 1),
331
+ },
332
+ },
333
+ )
334
+
335
+ # WHEN encrypting and then decrypting the encrypted data
336
+ encrypted_data = data_masker.encrypt(data, data_classification="confidential")
337
+ decrypted_data = data_masker.decrypt(encrypted_data, data_classification="confidential")
338
+
339
+ # THEN the result is only the specified fields are masked
340
+ assert decrypted_data == data
341
+
342
+
343
+ def test_encrypt_with_complex_dict(data_masker):
344
+ # GIVEN the data type is a json representation of a dictionary with a list inside
345
+ data = json.dumps(
346
+ {
347
+ "name": "Leandro",
348
+ "operation": "non sensitive",
349
+ "card_number": "1000 4444 333 2222",
350
+ "address": [
351
+ {
352
+ "postcode": 81847,
353
+ "street": "38986 Joanne Stravenue",
354
+ "country": "United States",
355
+ "timezone": "America/La_Paz",
356
+ },
357
+ {
358
+ "postcode": 94400,
359
+ "street": "623 Kraig Mall",
360
+ "country": "United States",
361
+ "timezone": "America/Mazatlan",
362
+ },
363
+ {
364
+ "postcode": 94480,
365
+ "street": "123 Kraig Mall",
366
+ "country": "United States",
367
+ "timezone": "America/Mazatlan",
368
+ },
369
+ ],
370
+ },
371
+ )
372
+
373
+ # WHEN encrypting and then decrypting the encrypted data
374
+ encrypted_data = data_masker.encrypt(data)
375
+ decrypted_data = data_masker.decrypt(encrypted_data)
376
+
377
+ # THEN the result is only the specified fields are masked
378
+ assert decrypted_data == data
379
+
380
+
381
+ def test_encrypt_with_slice(data_masker):
382
+ # GIVEN the data type is a json representation of a dictionary with a list inside
383
+ data = json.dumps(
384
+ {
385
+ "name": "Leandro",
386
+ "operation": "non sensitive",
387
+ "card_number": "1000 4444 333 2222",
388
+ "address": [
389
+ {
390
+ "postcode": 81847,
391
+ "street": "38986 Joanne Stravenue",
392
+ "country": "United States",
393
+ "timezone": "America/La_Paz",
394
+ },
395
+ {
396
+ "postcode": 94400,
397
+ "street": "623 Kraig Mall",
398
+ "country": "United States",
399
+ "timezone": "America/Mazatlan",
400
+ },
401
+ {
402
+ "postcode": 94480,
403
+ "street": "123 Kraig Mall",
404
+ "country": "United States",
405
+ "timezone": "America/Mazatlan",
406
+ },
407
+ ],
408
+ },
409
+ )
410
+
411
+ # WHEN encrypting and then decrypting the encrypted data
412
+ encrypted_data = data_masker.encrypt(data)
413
+ decrypted_data = data_masker.decrypt(encrypted_data)
414
+
415
+ # THEN the result is only the specified fields are masked
416
+ assert decrypted_data == data
417
+
418
+
419
+ def test_encrypt_with_complex_search(data_masker):
420
+ # GIVEN the data type is a json representation of a dictionary with a list inside
421
+ data = json.dumps(
422
+ {
423
+ "name": "Leandro",
424
+ "operation": "non sensitive",
425
+ "card_number": "1000 4444 333 2222",
426
+ "address": [
427
+ {
428
+ "postcode": 81847,
429
+ "street": "38986 Joanne Stravenue",
430
+ "country": "United States",
431
+ "timezone": "America/La_Paz",
432
+ },
433
+ {
434
+ "postcode": 94400,
435
+ "street": "623 Kraig Mall",
436
+ "country": "United States",
437
+ "timezone": "America/Mazatlan",
438
+ },
439
+ {
440
+ "postcode": 94480,
441
+ "street": "123 Kraig Mall",
442
+ "country": "United States",
443
+ "timezone": "America/Mazatlan",
444
+ },
445
+ ],
446
+ },
447
+ )
448
+
449
+ # WHEN encrypting and then decrypting the encrypted data
450
+ encrypted_data = data_masker.encrypt(data)
451
+ decrypted_data = data_masker.decrypt(encrypted_data)
452
+
453
+ # THEN the result is only the specified fields are masked
454
+ assert decrypted_data == data
455
+
456
+
457
+ def test_encrypt_with_provider_options(data_masker):
458
+ # GIVEN the data type is a json representation of a dictionary with a list inside
459
+ data = json.dumps(
460
+ {
461
+ "payload": {
462
+ "first": ["value1", "value2"],
463
+ "second": (0, 1),
464
+ },
465
+ },
466
+ )
467
+
468
+ provider_options = {"algorithm": Algorithm.AES_256_GCM_HKDF_SHA512_COMMIT_KEY}
469
+ # WHEN encrypting and then decrypting the encrypted data
470
+ encrypted_data = data_masker.encrypt(data, provider_options=provider_options)
471
+ decrypted_data = data_masker.decrypt(encrypted_data)
472
+
473
+ # THEN the result is only the specified fields are masked
474
+ assert decrypted_data == data