Skip to content

Commit b55ed6a

Browse files
authored
corrected list resolved types (aws-cloudformation#115)
1 parent d00dd26 commit b55ed6a

File tree

12 files changed

+43
-41
lines changed

12 files changed

+43
-41
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
exclude: ^(buildspec.yml|.pre-commit-config.yaml)$
2+
fail_fast: true
13
repos:
24
- repo: https://github.com/pre-commit/mirrors-isort
35
rev: v4.3.17
46
hooks:
57
- id: isort
8+
# language_version: python3.6
69
- repo: https://github.com/ambv/black
7-
rev: stable
10+
rev: 20.8b1
811
hooks:
912
- id: black
1013
exclude: templates/

.travis.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,23 @@ jobs:
2121
- python: "3.6"
2222
- python: "3.7"
2323
- python: "3.8"
24+
- stage: "integ python 3.6"
25+
language: python
26+
python: "3.6"
27+
script:
28+
- DIR=$(mktemp -d)
29+
- cd "$DIR"
30+
- ls -la
31+
- printf "AWS::Foo::Bar\n1\ny" | cfn init -vv
32+
- ls -la
33+
- mypy src/aws_foo_bar/ --strict --implicit-reexport
34+
- stage: "integ python 3.7"
35+
language: python
36+
python: "3.7"
37+
script:
38+
- DIR=$(mktemp -d)
39+
- cd "$DIR"
40+
- ls -la
41+
- printf "AWS::Foo::Bar\n2\ny" | cfn init -vv
42+
- ls -la
43+
- mypy src/aws_foo_bar/ --strict --implicit-reexport

buildspec.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

python/rpdk/python/templates/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ def _deserialize(
6060
{% set container = type.container %}
6161
{% set resolved_type = type.type %}
6262
{% if container == ContainerType.MODEL %}
63-
{{ name }}={{ resolved_type }}._deserialize(json_data.get("{{ resolved_type }}")),
63+
{{ name }}={{ resolved_type }}._deserialize(json_data.get("{{ name }}")),
6464
{% elif container == ContainerType.SET %}
65-
{{ name }}=set_or_none(json_data.get("{{ resolved_type.type }}")),
65+
{{ name }}=set_or_none(json_data.get("{{ name }}")),
6666
{% elif container == ContainerType.LIST %}
6767
{% if type | contains_model %}
68-
{{name}}=deserialize_list(json_data.get("{{ resolved_type.type }}"), {{resolved_type.type}}),
68+
{{name}}=deserialize_list(json_data.get("{{ name }}"), {{resolved_type.type}}),
6969
{% else %}
7070
{{ name }}=json_data.get("{{ name }}"),
7171
{% endif %}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{ support_lib_name }}==2.0.0
1+
{{ support_lib_name }}==2.1.0

src/cloudformation_cli_python_lib/boto3_proxy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
# boto3 doesn't have stub files
12
from typing import Optional
23

3-
# boto3 doesn't have stub files
44
from boto3.session import Session # type: ignore
55

66
from .utils import Credentials

src/cloudformation_cli_python_lib/log_delivery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class ProviderLogHandler(logging.Handler):
1919
def __init__(
2020
self, group: str, stream: str, session: SessionProxy, *args: Any, **kwargs: Any
2121
):
22-
super(ProviderLogHandler, self).__init__(*args, **kwargs)
22+
super().__init__(*args, **kwargs)
2323
self.group = group
2424
self.stream = stream.replace(":", "__")
2525
self.client = session.client("logs")

src/cloudformation_cli_python_lib/recast.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,10 @@ def _field_to_type(field: Any, key: str, classes: Dict[str, Any]) -> Any: # noq
8989
possible_types = field.__args__
9090
if not possible_types:
9191
raise InvalidRequest(f"Cannot process type {field} for field {key}")
92-
except AttributeError:
93-
raise InvalidRequest(f"Cannot process type {field} for field {key}")
92+
except AttributeError as attribute_error:
93+
raise InvalidRequest(
94+
f"Cannot process type {field} for field {key}"
95+
) from attribute_error
9496
# Assuming that the union is generated from typing.Optional, so only
9597
# contains one type and None
9698
# pylint: disable=unidiomatic-typecheck

tests/lib/interface_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
ProgressEvent,
1313
)
1414

15-
import hypothesis.strategies as s
16-
from hypothesis import given
15+
import hypothesis.strategies as s # pylint: disable=C0411
16+
from hypothesis import given # pylint: disable=C0411
1717

1818

1919
@pytest.fixture(scope="module")

tests/lib/metrics_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
format_dimensions,
1313
)
1414

15-
from botocore.stub import Stubber
15+
from botocore.stub import Stubber # pylint: disable=C0411
1616

1717
RESOURCE_TYPE = "Aa::Bb::Cc"
1818
NAMESPACE = MetricsPublisherProxy._make_namespace( # pylint: disable=protected-access

tests/lib/utils_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
deserialize_list,
1313
)
1414

15-
import hypothesis.strategies as s
16-
from hypothesis import given
15+
import hypothesis.strategies as s # pylint: disable=C0411
16+
from hypothesis import given # pylint: disable=C0411
1717

1818

1919
def roundtrip(value):

tests/plugin/codegen_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ def test_initialize(project):
9494
"README.md",
9595
"foo-bar-baz.json",
9696
"requirements.txt",
97+
"inputs/inputs_1_invalid.json",
98+
"inputs/inputs_1_update.json",
99+
"inputs/inputs_1_create.json",
100+
"inputs",
97101
"src",
98102
"src/foo_bar_baz",
99103
"src/foo_bar_baz/__init__.py",

0 commit comments

Comments
 (0)