Skip to content
Closed
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
6 changes: 3 additions & 3 deletions python/rpdk/python/templates/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ def _deserialize(
{% set container = type.container %}
{% set resolved_type = type.type %}
{% if container == ContainerType.MODEL %}
{{ name }}={{ resolved_type }}._deserialize(json_data.get("{{ resolved_type }}")),
{{ name }}={{ resolved_type }}._deserialize(json_data.get("{{ name }}")),
{% elif container == ContainerType.SET %}
{{ name }}=set_or_none(json_data.get("{{ resolved_type.type }}")),
{{ name }}=set_or_none(json_data.get("{{ name }}")),
{% elif container == ContainerType.LIST %}
{% if type | contains_model %}
{{name}}=deserialize_list(json_data.get("{{ resolved_type.type }}"), {{resolved_type.type}}),
{{name}}=deserialize_list(json_data.get("{{ name }}"), {{resolved_type.type}}),
{% else %}
{{ name }}=json_data.get("{{ name }}"),
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion src/cloudformation_cli_python_lib/log_delivery.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ProviderLogHandler(logging.Handler):
def __init__(
self, group: str, stream: str, session: SessionProxy, *args: Any, **kwargs: Any
):
super(ProviderLogHandler, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
self.group = group
self.stream = stream.replace(":", "__")
self.client = session.client("logs")
Expand Down
4 changes: 2 additions & 2 deletions src/cloudformation_cli_python_lib/recast.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ def _field_to_type(field: Any, key: str, classes: Dict[str, Any]) -> Any: # noq
possible_types = field.__args__
if not possible_types:
raise InvalidRequest(f"Cannot process type {field} for field {key}")
except AttributeError:
raise InvalidRequest(f"Cannot process type {field} for field {key}")
except AttributeError as ae:
raise InvalidRequest(f"Cannot process type {field} for field {key}") from ae
# Assuming that the union is generated from typing.Optional, so only
# contains one type and None
# pylint: disable=unidiomatic-typecheck
Expand Down
5 changes: 2 additions & 3 deletions tests/lib/interface_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@

import boto3
import pytest
import hypothesis.strategies as s
from hypothesis import given
from cloudformation_cli_python_lib.interface import (
BaseModel,
HandlerErrorCode,
OperationStatus,
ProgressEvent,
)

import hypothesis.strategies as s
from hypothesis import given


@pytest.fixture(scope="module")
def client():
Expand Down
3 changes: 1 addition & 2 deletions tests/lib/metrics_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@

import boto3
import pytest
from botocore.stub import Stubber
from cloudformation_cli_python_lib.interface import Action, MetricTypes, StandardUnit
from cloudformation_cli_python_lib.metrics import (
MetricPublisher,
MetricsPublisherProxy,
format_dimensions,
)

from botocore.stub import Stubber

RESOURCE_TYPE = "Aa::Bb::Cc"
NAMESPACE = MetricsPublisherProxy._make_namespace( # pylint: disable=protected-access
RESOURCE_TYPE
Expand Down
5 changes: 2 additions & 3 deletions tests/lib/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from unittest.mock import Mock, call, sentinel

import pytest
import hypothesis.strategies as s
from hypothesis import given
from cloudformation_cli_python_lib.exceptions import InvalidRequest
from cloudformation_cli_python_lib.interface import BaseModel
from cloudformation_cli_python_lib.utils import (
Expand All @@ -12,9 +14,6 @@
deserialize_list,
)

import hypothesis.strategies as s
from hypothesis import given


def roundtrip(value):
return json.loads(json.dumps(value, cls=KitchenSinkEncoder))
Expand Down