diff --git a/.github/workflows/test_action.yml b/.github/workflows/test_action.yml index 396971a..641e1cb 100644 --- a/.github/workflows/test_action.yml +++ b/.github/workflows/test_action.yml @@ -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 @@ -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 @@ -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 diff --git a/boto3_helpers/dynamodb.py b/boto3_helpers/dynamodb.py index aa2b0be..cf4add1 100644 --- a/boto3_helpers/dynamodb.py +++ b/boto3_helpers/dynamodb.py @@ -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': diff --git a/setup.cfg b/setup.cfg index a4b55b9..697bb4d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 @@ -18,7 +18,7 @@ project_urls = [options] packages = find: -python_requires = >=3.8 +python_requires = >=3.10 install_requires = boto3 botocore diff --git a/tests/test_mediatailor.py b/tests/test_mediatailor.py index a79ee5d..120deac 100644 --- a/tests/test_mediatailor.py +++ b/tests/test_mediatailor.py @@ -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)