From e1efbe60a2abf3c96af1e77c8537f4e8271aa8f3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 7 Nov 2024 13:38:52 +0000 Subject: [PATCH 1/5] Update dependency botocore to v1.35.55 (#369) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index 4e4139c..bdf7b7b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -128,13 +128,13 @@ crt = ["botocore[crt] (>=1.21.0,<2.0a0)"] [[package]] name = "botocore" -version = "1.35.54" +version = "1.35.55" description = "Low-level, data-driven core of boto 3." optional = false python-versions = ">=3.8" files = [ - {file = "botocore-1.35.54-py3-none-any.whl", hash = "sha256:9cca1811094b6cdc144c2c063a3ec2db6d7c88194b04d4277cd34fc8e3473aff"}, - {file = "botocore-1.35.54.tar.gz", hash = "sha256:131bb59ce59c8a939b31e8e647242d70cf11d32d4529fa4dca01feea1e891a76"}, + {file = "botocore-1.35.55-py3-none-any.whl", hash = "sha256:3d54739e498534c9d7a6e9732ae2d17ed29c7d5e29fe36c956d8488b859538b0"}, + {file = "botocore-1.35.55.tar.gz", hash = "sha256:61ae18f688250372d7b6046e35c86f8fd09a7c0f0064b52688f3490b4d6c9d6b"}, ] [package.dependencies] From 9cab651c300b20153c9a856f02b412d73dff3141 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 10:46:23 -0700 Subject: [PATCH 2/5] Update dependency botocore to v1.35.57 (#370) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index bdf7b7b..94e1234 100644 --- a/poetry.lock +++ b/poetry.lock @@ -128,13 +128,13 @@ crt = ["botocore[crt] (>=1.21.0,<2.0a0)"] [[package]] name = "botocore" -version = "1.35.55" +version = "1.35.57" description = "Low-level, data-driven core of boto 3." optional = false python-versions = ">=3.8" files = [ - {file = "botocore-1.35.55-py3-none-any.whl", hash = "sha256:3d54739e498534c9d7a6e9732ae2d17ed29c7d5e29fe36c956d8488b859538b0"}, - {file = "botocore-1.35.55.tar.gz", hash = "sha256:61ae18f688250372d7b6046e35c86f8fd09a7c0f0064b52688f3490b4d6c9d6b"}, + {file = "botocore-1.35.57-py3-none-any.whl", hash = "sha256:92ddd02469213766872cb2399269dd20948f90348b42bf08379881d5e946cc34"}, + {file = "botocore-1.35.57.tar.gz", hash = "sha256:d96306558085baf0bcb3b022d7a8c39c93494f031edb376694d2b2dcd0e81327"}, ] [package.dependencies] From 255b0b3a671ffc731ff66e8c8979dc0822f7da94 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 06:40:44 -0700 Subject: [PATCH 3/5] Update dependency botocore to v1.35.58 (#372) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index 94e1234..deb6035 100644 --- a/poetry.lock +++ b/poetry.lock @@ -128,13 +128,13 @@ crt = ["botocore[crt] (>=1.21.0,<2.0a0)"] [[package]] name = "botocore" -version = "1.35.57" +version = "1.35.58" description = "Low-level, data-driven core of boto 3." optional = false python-versions = ">=3.8" files = [ - {file = "botocore-1.35.57-py3-none-any.whl", hash = "sha256:92ddd02469213766872cb2399269dd20948f90348b42bf08379881d5e946cc34"}, - {file = "botocore-1.35.57.tar.gz", hash = "sha256:d96306558085baf0bcb3b022d7a8c39c93494f031edb376694d2b2dcd0e81327"}, + {file = "botocore-1.35.58-py3-none-any.whl", hash = "sha256:647b8706ae6484ee4c2208235f38976d9f0e52f80143e81d7941075215e96111"}, + {file = "botocore-1.35.58.tar.gz", hash = "sha256:8303309c7b59ddf04b11d79813530809d6b10b411ac9f93916d2032c283d6881"}, ] [package.dependencies] From 9d3b72dbf481f55ec9754f968ec83a7eb922d2ad Mon Sep 17 00:00:00 2001 From: Levi Date: Tue, 12 Nov 2024 13:45:19 +0000 Subject: [PATCH 4/5] add caching to _get_region_data This shouldn't be needed because the data is only requested once by get_region_az but im still getting rate limited by github at work. --- src/cloud_radar/cf/unit/functions.py | 6 ++++-- tests/test_cf/test_unit/test_functions.py | 17 +++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/cloud_radar/cf/unit/functions.py b/src/cloud_radar/cf/unit/functions.py index 139cc3a..cec6737 100644 --- a/src/cloud_radar/cf/unit/functions.py +++ b/src/cloud_radar/cf/unit/functions.py @@ -8,7 +8,8 @@ import ipaddress import json import re -from typing import TYPE_CHECKING, Any, Callable, Dict, List # noqa: I101 +from functools import cache +from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional # noqa: I101 import requests @@ -25,7 +26,7 @@ # The maps are a nested dictionary. Mapping = Dict[str, Dict[str, Dict[str, Any]]] -REGION_DATA = None +REGION_DATA: Optional[List[dict]] = None def base64(_t: "Template", value: Any) -> str: @@ -877,6 +878,7 @@ def get_region_azs(region_name: str) -> List[str]: raise Exception(f"Unable to find region {region_name}.") +@cache def _fetch_region_data() -> List[dict]: """Fetchs Region JSON from URL. diff --git a/tests/test_cf/test_unit/test_functions.py b/tests/test_cf/test_unit/test_functions.py index 1c91ad9..c4cef90 100644 --- a/tests/test_cf/test_unit/test_functions.py +++ b/tests/test_cf/test_unit/test_functions.py @@ -407,21 +407,22 @@ def test_fetch_region_data(mocker): mock_r = mock_post.return_value - mock_r.status_code = 200 + mock_r.status_code = 500 - result = functions._fetch_region_data() + functions._fetch_region_data() - assert result == "TestData" + mock_r.raise_for_status.assert_called() - mock_r.raise_for_status.assert_not_called() + # need to reset the mock + mock_r.reset_mock() - assert result == "TestData" + mock_r.status_code = 200 - mock_r.status_code = 500 + result = functions._fetch_region_data() - functions._fetch_region_data() + assert result == "TestData" - mock_r.raise_for_status.assert_called() + mock_r.raise_for_status.assert_not_called() def test_import_value(): From 4862f7e6aeaf9d2394b1c61f9ccc128da886a475 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 13:52:00 +0000 Subject: [PATCH 5/5] Update dependency setuptools to v75.4.0 --- poetry.lock | 18 +++++++++--------- pyproject.toml | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/poetry.lock b/poetry.lock index deb6035..da4eb9a 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1365,23 +1365,23 @@ crt = ["botocore[crt] (>=1.33.2,<2.0a.0)"] [[package]] name = "setuptools" -version = "75.3.0" +version = "75.4.0" description = "Easily download, build, install, upgrade, and uninstall Python packages" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" files = [ - {file = "setuptools-75.3.0-py3-none-any.whl", hash = "sha256:f2504966861356aa38616760c0f66568e535562374995367b4e69c7143cf6bcd"}, - {file = "setuptools-75.3.0.tar.gz", hash = "sha256:fba5dd4d766e97be1b1681d98712680ae8f2f26d7881245f2ce9e40714f1a686"}, + {file = "setuptools-75.4.0-py3-none-any.whl", hash = "sha256:b3c5d862f98500b06ffdf7cc4499b48c46c317d8d56cb30b5c8bce4d88f5c216"}, + {file = "setuptools-75.4.0.tar.gz", hash = "sha256:1dc484f5cf56fd3fe7216d7b8df820802e7246cfb534a1db2aa64f14fcb9cdcb"}, ] [package.extras] -check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1)", "ruff (>=0.5.2)"] -core = ["importlib-metadata (>=6)", "importlib-resources (>=5.10.2)", "jaraco.collections", "jaraco.functools", "jaraco.text (>=3.7)", "more-itertools", "more-itertools (>=8.8)", "packaging", "packaging (>=24)", "platformdirs (>=4.2.2)", "tomli (>=2.0.1)", "wheel (>=0.43.0)"] +check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1)", "ruff (>=0.7.0)"] +core = ["importlib-metadata (>=6)", "jaraco.collections", "jaraco.functools (>=4)", "jaraco.text (>=3.7)", "more-itertools", "more-itertools (>=8.8)", "packaging", "packaging (>=24.2)", "platformdirs (>=4.2.2)", "tomli (>=2.0.1)", "wheel (>=0.43.0)"] cover = ["pytest-cov"] doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "pyproject-hooks (!=1.1)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier", "towncrier (<24.7)"] enabler = ["pytest-enabler (>=2.2)"] -test = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "ini2toml[lite] (>=0.14)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "jaraco.test (>=5.5)", "packaging (>=23.2)", "pip (>=19.1)", "pyproject-hooks (!=1.1)", "pytest (>=6,!=8.1.*)", "pytest-home (>=0.5)", "pytest-perf", "pytest-subprocess", "pytest-timeout", "pytest-xdist (>=3)", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel (>=0.44.0)"] -type = ["importlib-metadata (>=7.0.2)", "jaraco.develop (>=7.21)", "mypy (==1.12.*)", "pytest-mypy"] +test = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "ini2toml[lite] (>=0.14)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "jaraco.test (>=5.5)", "packaging (>=24.2)", "pip (>=19.1)", "pyproject-hooks (!=1.1)", "pytest (>=6,!=8.1.*)", "pytest-home (>=0.5)", "pytest-perf", "pytest-subprocess", "pytest-timeout", "pytest-xdist (>=3)", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel (>=0.44.0)"] +type = ["importlib-metadata (>=7.0.2)", "jaraco.develop (>=7.21)", "mypy (>=1.12,<1.14)", "pytest-mypy"] [[package]] name = "six" @@ -1555,4 +1555,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.14" -content-hash = "09acccc87e57fdd79b9fc28714440db59f35376a4f4f11a9f4682c55fc48474f" +content-hash = "bcfa79a89dd8bd67417aa77a907e8cbf34b002811637fced449b1fc97d9c1422" diff --git a/pyproject.toml b/pyproject.toml index f961f3b..6185d44 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,7 @@ mypy = "^1.0.0" types-requests = "^2.28.11" types-PyYAML = "^6.0.12" cfn-lint = "1.18.4" -setuptools = {version = "75.3.0", python = ">=3.12"} +setuptools = {version = "75.4.0", python = ">=3.12"} [tool.coverage.paths] source = ["src", "*/site-packages"]