Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/test_action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v3
Expand All @@ -20,7 +20,7 @@ jobs:
run: |
python -m pip install -U pip .
- name: Static checks
if: "matrix.python-version == '3.9'"
if: "matrix.python-version == '3.10'"
run: |
python -m pip install -U black flake8
make check
Expand All @@ -29,12 +29,12 @@ jobs:
python -m pip install -U coverage
make coverage
- name: Build docs
if: "matrix.python-version == '3.9'"
if: "matrix.python-version == '3.10'"
run: |
python -m pip install -U sphinx
make docs
- name: Build package
if: "matrix.python-version == '3.9'"
if: "matrix.python-version == '3.10'"
run: |
python -m pip install -U twine wheel
make package
17 changes: 16 additions & 1 deletion boto3_helpers/dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,24 @@ def load_dynamodb_json(text, use_decimal=False):
``decimal.Decimal`` objects. This matches the ``boto3`` client behavior, but
is often inconvenient.
"""
return parse_dynamodb_resp(loads(text), use_decimal=use_decimal)


def parse_dynamodb_resp(data, use_decimal=False):
"""Just like :func:`load_dynamodb_json`, but takes already-parsed ``data`` rather
than serialized JSON.

.. code-block:: python

from boto3 import resource as parse_dynamodb_resp

text = {'Item': {'some_number': {'N': '100'}}}
info = load_dynamodb_json(text)
assert info['Item']['some_number'] == 100
"""
d = _CustomTypeDeserializer(use_decimal=use_decimal, decode_binary=True).deserialize
ret = {}
for key, value in loads(text).items():
for key, value in data.items():
if key == 'Item':
ret['Item'] = {k: d(v) for k, v in value.items()}
elif key == 'Items':
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = boto3-helpers
version = 2.5.0
version = 2.6.0
description = Helper utilities for boto3
long_description = file: README.rst
long_description_content_type = text/x-rst
Expand All @@ -18,7 +18,7 @@ project_urls =

[options]
packages = find:
python_requires = >=3.8
python_requires = >=3.10
install_requires =
boto3
botocore
Expand Down
5 changes: 4 additions & 1 deletion tests/test_mediatailor.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ def test_update_playback_configuration(self):
'Tags': {},
'TranscodeProfileName': '',
'VideoContentSourceUrl': 'https://localhost/origin/hls/',
'LogConfiguration': {'PercentEnabled': 1},
'LogConfiguration': {
'PercentEnabled': 1,
'EnabledLoggingStrategies': ['LEGACY_CLOUDWATCH'],
},
}
get_params = {'Name': 'TestConfiguration'}
stubber.add_response('get_playback_configuration', get_resp, get_params)
Expand Down