diff --git a/stacks/makefile b/stacks/makefile index d8154e8..12bdb9d 100644 --- a/stacks/makefile +++ b/stacks/makefile @@ -20,5 +20,5 @@ venv: . ${VENV_NAME}/Scripts/activate echo "virtualenv prepared, please run 'source ${VENV_NAME}/bin/activate' if you wish to use it in your current shell" -pycodestyle: venv - . ${VENV_NAME}/Scripts/activate && pycodestyle --first src/template.py \ No newline at end of file +pycodestyle: + . ${VENV_NAME}/Scripts/activate && mypy --warn-unused-configs --disallow-any-generics --disallow-subclassing-any --disallow-untyped-calls --disallow-untyped-defs --disallow-incomplete-defs --check-untyped-defs --disallow-untyped-decorators --no-implicit-optional --warn-redundant-casts --warn-unused-ignores --warn-return-any --no-implicit-reexport --strict-equality --ignore-missing-imports --pretty src/*.py && pycodestyle --first src/*.py \ No newline at end of file diff --git a/stacks/requirements.txt b/stacks/requirements.txt index b4976f3..130967f 100644 --- a/stacks/requirements.txt +++ b/stacks/requirements.txt @@ -1,4 +1,5 @@ troposphere==3.0.2 awacs==2.0.0 -ydiff +ydiff==1.2 pycodestyle==2.7.0 +mypy==0.910 diff --git a/stacks/src/template.py b/stacks/src/template.py index 0ecc571..9082e11 100644 --- a/stacks/src/template.py +++ b/stacks/src/template.py @@ -1,18 +1,18 @@ from troposphere import Template +from troposphere.sqs import Queue from util import Util -PROJECT_NAME = "Tweeter" -S3_QUEUE_NAME = PROJECT_NAME + "S3Queue" -TWEETER_QUEUE_NAME = PROJECT_NAME + "Queue" -DYNAMO_DB_QUEUE_NAME = PROJECT_NAME + "DynamoDbQueue" -SHARED_CONFIG_BUCKET_NAME = PROJECT_NAME + "SharedConfig" +PROJECT_NAME: str = "Tweeter" +S3_QUEUE_NAME: str = "S3Queue" +TWEETER_QUEUE_NAME: str = "TwitterQueue" +DYNAMO_DB_QUEUE_NAME: str = "DynamoDbQueue" -template = Template(PROJECT_NAME + "Workflow") -templateUtil = Util(template) +template: Template = Template(PROJECT_NAME + "Workflow") +templateUtil: Util = Util(template) -s3_queue = templateUtil.create_queue(S3_QUEUE_NAME) -tweeter_queue = templateUtil.create_queue(TWEETER_QUEUE_NAME) -dynamo_db_queue = templateUtil.create_queue(DYNAMO_DB_QUEUE_NAME) +s3_queue: Queue = templateUtil.create_queue(S3_QUEUE_NAME) +tweeter_queue: Queue = templateUtil.create_queue(TWEETER_QUEUE_NAME) +dynamo_db_queue: Queue = templateUtil.create_queue(DYNAMO_DB_QUEUE_NAME) print(template.to_json()) diff --git a/stacks/src/util.py b/stacks/src/util.py index f8fe737..8f325d4 100644 --- a/stacks/src/util.py +++ b/stacks/src/util.py @@ -1,11 +1,12 @@ +from troposphere import Template from troposphere.sqs import Queue class Util: - def __init__(self, template): + def __init__(self, template: Template) -> None: self.template = template - def create_queue(self, queue_name): + def create_queue(self, queue_name: str) -> Queue: return self.template.add_resource( Queue( queue_name,