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
5 changes: 4 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
exclude: ^(buildspec.yml|.pre-commit-config.yaml)$
fail_fast: true
repos:
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.17
hooks:
- id: isort
# language_version: python3.6
- repo: https://github.com/ambv/black
rev: stable
rev: 20.8b1
hooks:
- id: black
exclude: templates/
Expand Down
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,23 @@ jobs:
- python: "3.6"
- python: "3.7"
- python: "3.8"
- stage: "integ python 3.6"
language: python
python: "3.6"
script:
- DIR=$(mktemp -d)
- cd "$DIR"
- ls -la
- printf "AWS::Foo::Bar\n1\ny" | cfn init -vv
- ls -la
- mypy src/aws_foo_bar/ --strict --implicit-reexport
- stage: "integ python 3.7"
language: python
python: "3.7"
script:
- DIR=$(mktemp -d)
- cd "$DIR"
- ls -la
- printf "AWS::Foo::Bar\n2\ny" | cfn init -vv
- ls -la
- mypy src/aws_foo_bar/ --strict --implicit-reexport
27 changes: 0 additions & 27 deletions buildspec.yml

This file was deleted.

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 python/rpdk/python/templates/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{ support_lib_name }}==2.0.0
{{ support_lib_name }}==2.1.0
2 changes: 1 addition & 1 deletion src/cloudformation_cli_python_lib/boto3_proxy.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# boto3 doesn't have stub files
from typing import Optional

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

from .utils import Credentials
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
6 changes: 4 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,10 @@ 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 attribute_error:
raise InvalidRequest(
f"Cannot process type {field} for field {key}"
) from attribute_error
# Assuming that the union is generated from typing.Optional, so only
# contains one type and None
# pylint: disable=unidiomatic-typecheck
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/interface_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
ProgressEvent,
)

import hypothesis.strategies as s
from hypothesis import given
import hypothesis.strategies as s # pylint: disable=C0411
from hypothesis import given # pylint: disable=C0411


@pytest.fixture(scope="module")
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/metrics_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
format_dimensions,
)

from botocore.stub import Stubber
from botocore.stub import Stubber # pylint: disable=C0411

RESOURCE_TYPE = "Aa::Bb::Cc"
NAMESPACE = MetricsPublisherProxy._make_namespace( # pylint: disable=protected-access
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
deserialize_list,
)

import hypothesis.strategies as s
from hypothesis import given
import hypothesis.strategies as s # pylint: disable=C0411
from hypothesis import given # pylint: disable=C0411


def roundtrip(value):
Expand Down
4 changes: 4 additions & 0 deletions tests/plugin/codegen_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ def test_initialize(project):
"README.md",
"foo-bar-baz.json",
"requirements.txt",
"inputs/inputs_1_invalid.json",
"inputs/inputs_1_update.json",
"inputs/inputs_1_create.json",
"inputs",
"src",
"src/foo_bar_baz",
"src/foo_bar_baz/__init__.py",
Expand Down