Skip to content

Commit

Permalink
Fix mypy issues; re-enable isort plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
dbernstein committed Sep 6, 2023
1 parent 6ae3e84 commit 6846e4c
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 11 deletions.
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ repos:
- id: black
name: Run black

# - repo: https://github.com/PyCQA/isort
# rev: 5.12.0
# hooks:
# - id: isort
# name: Run isort
#
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
name: Run isort

- repo: https://github.com/sirosen/check-jsonschema
rev: 0.22.0
hooks:
Expand Down
4 changes: 2 additions & 2 deletions core/operation/baseoperation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class BaseOperation:
A base class for AWS based operations.
"""

def __init__(self, qs_client: object, aws_account_id: str):
def __init__(self, qs_client, aws_account_id: str):
self._aws_account_id = aws_account_id
self._qs_client = qs_client
self._log = logging.getLogger(self.__class__.__name__)
Expand All @@ -23,7 +23,7 @@ def __init__(self, qs_client: object, aws_account_id: str):
def execute(self):
pass

def _create_or_update_template(self, template_data: dict) -> [str, str]:
def _create_or_update_template(self, template_data: dict) -> tuple[str, str, str]:
"""
Creates new or updates existing template.
:param template_data:
Expand Down
4 changes: 2 additions & 2 deletions core/operation/publish_dashboard_from_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def execute(self):

# extract the data source placeholders
dashboard_id = self._template_id
parameters = {
parameters: dict = {
"AwsAccountId": self._aws_account_id,
"Name": dashboard_id,
"DashboardId": dashboard_id,
Expand Down Expand Up @@ -107,7 +107,7 @@ def execute(self):

response = self._qs_client.update_dashboard_permissions(**permissions_params)

def _create_or_update_dashboard(self, dashboard_params: dict) -> [str, str]:
def _create_or_update_dashboard(self, dashboard_params: dict) -> tuple[str, str]:
"""
Creates new or updates existing template.
:param dashboard_params:
Expand Down
2 changes: 2 additions & 0 deletions core/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ def retry(func) -> bool:
sleep(1)
continue

return True


def recursively_replace_value(mydict: dict, key: str, val: str):
"""
Expand Down
54 changes: 53 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,29 @@ boto3 = "^1.18"
botocore = "^1.21"
click = "^8.1.3"
pytest= ">=7.2.0"
pydantic = "^1.10.9"

[tool.isort]
known_first_party = ["core" ]
profile = "black"

[tool.mypy]
check_untyped_defs = true
disable_error_code = "annotation-unchecked"
exclude = []
files = ["."]
plugins = ["pydantic.mypy",]
ignore_missing_imports = true


[[tool.mypy.overrides]]
# In our tests, we often overwrite methods on classes to mock out behavior.
# This is a common pattern in Python, but mypy doesn't like it. This override
# silences those errors, but only for the tests module.
# See discussion here:
# https://github.com/python/mypy/issues/2427
disable_error_code = "method-assign"
module = "tests.*"


[build-system]
Expand Down
Empty file added tests/__init__.py
Empty file.
Empty file added tests/core/__init__.py
Empty file.

0 comments on commit 6846e4c

Please sign in to comment.