From fa95d5de4edba32f40c854b56658a3e54bbbac89 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Feb 2025 20:49:23 +0000 Subject: [PATCH 1/3] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/codespell-project/codespell: v2.3.0 → v2.4.1](https://github.com/codespell-project/codespell/compare/v2.3.0...v2.4.1) - [github.com/astral-sh/ruff-pre-commit: v0.8.6 → v0.9.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.8.6...v0.9.4) - [github.com/PyCQA/bandit: 1.8.0 → 1.8.2](https://github.com/PyCQA/bandit/compare/1.8.0...1.8.2) - [github.com/executablebooks/mdformat: 0.7.21 → 0.7.22](https://github.com/executablebooks/mdformat/compare/0.7.21...0.7.22) --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a4cdbbf40..046c2faa1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,7 +21,7 @@ repos: pass_filenames: false - repo: https://github.com/codespell-project/codespell - rev: v2.3.0 + rev: v2.4.1 hooks: - id: codespell additional_dependencies: @@ -45,7 +45,7 @@ repos: args: [--autofix] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.6 + rev: v0.9.4 hooks: - id: ruff args: [--fix] @@ -53,7 +53,7 @@ repos: - id: ruff-format - repo: https://github.com/PyCQA/bandit - rev: 1.8.0 + rev: 1.8.2 hooks: - id: bandit args: [-c, pyproject.toml, -ll] @@ -83,7 +83,7 @@ repos: exclude: ^vizro-core/src/vizro/static/css/.+\.min.*|^vizro-core/src/vizro/static/css/mantine_dates.css - repo: https://github.com/executablebooks/mdformat - rev: 0.7.21 + rev: 0.7.22 hooks: - id: mdformat args: From 5f3e230fe7652a97718f8aae58e9c5cd093aa5ae Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Feb 2025 20:50:00 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tools/check_for_datafiles.py | 6 +++--- vizro-ai/src/vizro_ai/plot/_response_models.py | 6 +++--- vizro-ai/src/vizro_ai/plot/_utils/_constants.py | 2 +- vizro-ai/tests/e2e/test_dashboard.py | 6 +++--- .../tests/unit/vizro/actions/test_parameter_action.py | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tools/check_for_datafiles.py b/tools/check_for_datafiles.py index c34114ff6..7dcbb5738 100644 --- a/tools/check_for_datafiles.py +++ b/tools/check_for_datafiles.py @@ -39,9 +39,9 @@ def check_for_data_files(): whitelisted_files = {files for dir in whitelist_dir for files in found_files if files.startswith(dir)} to_be_removed_files = found_files - whitelisted_files - assert ( - len(to_be_removed_files) == 0 - ), f"Caution! Please remove your data files {to_be_removed_files} before merging!" + assert len(to_be_removed_files) == 0, ( + f"Caution! Please remove your data files {to_be_removed_files} before merging!" + ) if __name__ == "__main__": diff --git a/vizro-ai/src/vizro_ai/plot/_response_models.py b/vizro-ai/src/vizro_ai/plot/_response_models.py index 8daa0f4de..0921bf6d3 100644 --- a/vizro-ai/src/vizro_ai/plot/_response_models.py +++ b/vizro-ai/src/vizro_ai/plot/_response_models.py @@ -199,9 +199,9 @@ def _test_execute_chart_code(v, values): f"Produced code execution failed the following error: <{e}>. Please check the code and try again, " f"alternatively try with a more powerful model." ) - assert isinstance( - fig, go.Figure - ), f"Expected chart code to return a plotly go.Figure object, but got {type(fig)}" + assert isinstance(fig, go.Figure), ( + f"Expected chart code to return a plotly go.Figure object, but got {type(fig)}" + ) return v return create_model( diff --git a/vizro-ai/src/vizro_ai/plot/_utils/_constants.py b/vizro-ai/src/vizro_ai/plot/_utils/_constants.py index 30db3eaf8..b4e617c29 100644 --- a/vizro-ai/src/vizro_ai/plot/_utils/_constants.py +++ b/vizro-ai/src/vizro_ai/plot/_utils/_constants.py @@ -239,7 +239,7 @@ ".loadtxt", ".genfromtxt", ".load", - ".fromfile" ".save", + ".fromfile.save", ".savetxt", ".tofile", ".loadmat", diff --git a/vizro-ai/tests/e2e/test_dashboard.py b/vizro-ai/tests/e2e/test_dashboard.py index 53786f451..4b82cd2fa 100644 --- a/vizro-ai/tests/e2e/test_dashboard.py +++ b/vizro-ai/tests/e2e/test_dashboard.py @@ -92,7 +92,7 @@ def logic( # noqa: PLR0912, PLR0915 pages_exist = [1 if dashboard.pages else 0] pages_exist_report = bool(pages_exist[0]) pages_num = [1 if len(dashboard.pages) == len(config["pages"]) else 0] - pages_num_report = [f'{len(config["pages"])} page(s) for dashboard is {bool(pages_num[0])}'] + pages_num_report = [f"{len(config['pages'])} page(s) for dashboard is {bool(pages_num[0])}"] components_num = [] components_num_report = [] @@ -105,7 +105,7 @@ def logic( # noqa: PLR0912, PLR0915 components = 0 components_num.append(components) components_num_report.append( - f'{len(config["pages"][page]["components"])} component(s) for page {page} is {bool(components)}' + f"{len(config['pages'][page]['components'])} component(s) for page {page} is {bool(components)}" ) controls_num = [] @@ -117,7 +117,7 @@ def logic( # noqa: PLR0912, PLR0915 controls = 0 controls_num.append(controls) controls_num_report.append( - f'{len(config["pages"][page]["controls"])} control(s) for page {page} is {bool(controls)}' + f"{len(config['pages'][page]['controls'])} control(s) for page {page} is {bool(controls)}" ) components_types_names = [] diff --git a/vizro-core/tests/unit/vizro/actions/test_parameter_action.py b/vizro-core/tests/unit/vizro/actions/test_parameter_action.py index 97e9ff3f7..c6ad1d734 100644 --- a/vizro-core/tests/unit/vizro/actions/test_parameter_action.py +++ b/vizro-core/tests/unit/vizro/actions/test_parameter_action.py @@ -401,7 +401,7 @@ def test_one_parameter_per_target_multiple_attributes( @pytest.mark.usefixtures("managers_one_page_two_graphs_with_dynamic_data") @pytest.mark.parametrize( - "ctx_parameter_data_frame_argument, " "target_scatter_parameter_data_frame_first_n_last_n", + "ctx_parameter_data_frame_argument, target_scatter_parameter_data_frame_first_n_last_n", [ ((["scatter_chart"], {"first_n": 50}), {"first_n": 50}), ((["scatter_chart"], {"first_n": 50, "last_n": 50}), {"first_n": 50, "last_n": 50}), From 50f897f2b05a4c701b8a399653018bbb7389f223 Mon Sep 17 00:00:00 2001 From: huong-li-nguyen Date: Tue, 4 Feb 2025 08:48:11 +0100 Subject: [PATCH 3/3] Lint --- ...g_li_nguyen_pre_commit_ci_update_config.md | 48 +++++++++++++++++++ ...g_li_nguyen_pre_commit_ci_update_config.md | 48 +++++++++++++++++++ .../models/_components/form/_text_area.py | 2 +- .../models/_components/form/checklist.py | 2 +- .../vizro/models/_components/form/dropdown.py | 2 +- .../models/_components/form/radio_items.py | 2 +- 6 files changed, 100 insertions(+), 4 deletions(-) create mode 100644 vizro-ai/changelog.d/20250204_084800_huong_li_nguyen_pre_commit_ci_update_config.md create mode 100644 vizro-core/changelog.d/20250204_084746_huong_li_nguyen_pre_commit_ci_update_config.md diff --git a/vizro-ai/changelog.d/20250204_084800_huong_li_nguyen_pre_commit_ci_update_config.md b/vizro-ai/changelog.d/20250204_084800_huong_li_nguyen_pre_commit_ci_update_config.md new file mode 100644 index 000000000..7c0d58d4f --- /dev/null +++ b/vizro-ai/changelog.d/20250204_084800_huong_li_nguyen_pre_commit_ci_update_config.md @@ -0,0 +1,48 @@ + + + + + + + + + diff --git a/vizro-core/changelog.d/20250204_084746_huong_li_nguyen_pre_commit_ci_update_config.md b/vizro-core/changelog.d/20250204_084746_huong_li_nguyen_pre_commit_ci_update_config.md new file mode 100644 index 000000000..7c0d58d4f --- /dev/null +++ b/vizro-core/changelog.d/20250204_084746_huong_li_nguyen_pre_commit_ci_update_config.md @@ -0,0 +1,48 @@ + + + + + + + + + diff --git a/vizro-core/src/vizro/models/_components/form/_text_area.py b/vizro-core/src/vizro/models/_components/form/_text_area.py index c44e6c688..019dd4fbc 100644 --- a/vizro-core/src/vizro/models/_components/form/_text_area.py +++ b/vizro-core/src/vizro/models/_components/form/_text_area.py @@ -31,7 +31,7 @@ class TextArea(VizroBaseModel): # Component properties for actions and interactions _input_property: str = PrivateAttr("value") - # Re-used validators + # Reused validators # TODO: Before making public, consider how actions should be triggered and what the default property should be # See comment thread: https://github.com/mckinsey/vizro/pull/298#discussion_r1478137654 _set_actions = _action_validator_factory("value") diff --git a/vizro-core/src/vizro/models/_components/form/checklist.py b/vizro-core/src/vizro/models/_components/form/checklist.py index 957ada8ff..cb4f1c138 100644 --- a/vizro-core/src/vizro/models/_components/form/checklist.py +++ b/vizro-core/src/vizro/models/_components/form/checklist.py @@ -46,7 +46,7 @@ class Checklist(VizroBaseModel): # Component properties for actions and interactions _input_property: str = PrivateAttr("value") - # Re-used validators + # Reused validators _validate_options = model_validator(mode="before")(validate_options_dict) def __call__(self, options): diff --git a/vizro-core/src/vizro/models/_components/form/dropdown.py b/vizro-core/src/vizro/models/_components/form/dropdown.py index 069ceab68..3073829e6 100755 --- a/vizro-core/src/vizro/models/_components/form/dropdown.py +++ b/vizro-core/src/vizro/models/_components/form/dropdown.py @@ -102,7 +102,7 @@ class Dropdown(VizroBaseModel): # Component properties for actions and interactions _input_property: str = PrivateAttr("value") - # Re-used validators + # Reused validators _validate_options = model_validator(mode="before")(validate_options_dict) def __call__(self, options): diff --git a/vizro-core/src/vizro/models/_components/form/radio_items.py b/vizro-core/src/vizro/models/_components/form/radio_items.py index ff03056f6..bdc53cfa4 100644 --- a/vizro-core/src/vizro/models/_components/form/radio_items.py +++ b/vizro-core/src/vizro/models/_components/form/radio_items.py @@ -47,7 +47,7 @@ class RadioItems(VizroBaseModel): # Component properties for actions and interactions _input_property: str = PrivateAttr("value") - # Re-used validators + # Reused validators _validate_options = model_validator(mode="before")(validate_options_dict) def __call__(self, options):