Skip to content

Commit

Permalink
Test not using __name__ in continue
Browse files Browse the repository at this point in the history
  • Loading branch information
antonymilne committed Dec 2, 2024
1 parent f875501 commit 2ec1864
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!--
A new scriv changelog fragment.
Uncomment the section that is right (remove the HTML comment wrapper).
-->

<!--
### Highlights ✨
- A bullet item for the Highlights ✨ category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Removed
- A bullet item for the Removed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Added
- A bullet item for the Added category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Changed
- A bullet item for the Changed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Deprecated
- A bullet item for the Deprecated category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Fixed
- A bullet item for the Fixed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Security
- A bullet item for the Security category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
9 changes: 1 addition & 8 deletions vizro-core/src/vizro/actions/_actions_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,7 @@ def _apply_filter_controls(
selector_actions = _get_component_actions(model_manager[ctd["id"]])

for action in selector_actions:
if (
action.function._function.__name__ != "_filter"
or target not in action.function["targets"]
or ALL_OPTION in selector_value
):
if target not in action.function["targets"] or ALL_OPTION in selector_value:
continue

_filter_function = action.function["filter_function"]
Expand Down Expand Up @@ -198,9 +194,6 @@ def _get_parametrized_config(
parameter_value = _validate_selector_value_none(parameter_value)

for action in _get_component_actions(selector):
if action.function._function.__name__ != "_parameter":
continue

for dot_separated_string in _get_target_dot_separated_strings(
action.function["targets"], target, data_frame
):
Expand Down
2 changes: 1 addition & 1 deletion vizro-core/src/vizro/models/_components/ag_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def _filter_interaction(
source_table_actions = _get_component_actions(_get_parent_model(ctd_cellClicked["id"]))

for action in source_table_actions:
if action.function._function.__name__ != "filter_interaction" or target not in action.function["targets"]:
if target not in action.function["targets"]:
continue
column = ctd_cellClicked["value"]["colId"]
clicked_data = ctd_cellClicked["value"]["value"]
Expand Down
2 changes: 1 addition & 1 deletion vizro-core/src/vizro/models/_components/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def _filter_interaction(
customdata = ctd_click_data["value"]["points"][0]["customdata"]

for action in source_graph_actions:
if action.function._function.__name__ != "filter_interaction" or target not in action.function["targets"]:
if target not in action.function["targets"]:
continue
for custom_data_idx, column in enumerate(custom_data_columns):
data_frame = data_frame[data_frame[column].isin([customdata[custom_data_idx]])]
Expand Down
2 changes: 1 addition & 1 deletion vizro-core/src/vizro/models/_components/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def _filter_interaction(
source_table_actions = _get_component_actions(_get_parent_model(ctd_active_cell["id"]))

for action in source_table_actions:
if action.function._function.__name__ != "filter_interaction" or target not in action.function["targets"]:
if target not in action.function["targets"]:
continue
column = ctd_active_cell["value"]["column_id"]
derived_viewport_data_row = ctd_active_cell["value"]["row"]
Expand Down

0 comments on commit 2ec1864

Please sign in to comment.