Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not access private _namedtuple member from pyvista #1219

Merged
merged 6 commits into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/geovista/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import warnings

import lazy_loader as lazy
import pyvista as pv

from .common import (
CENTRAL_MERIDIAN,
Expand Down Expand Up @@ -375,7 +376,9 @@ def combine(
common_point_data = set(first.point_data.keys())
common_cell_data = set(first.cell_data.keys())
common_field_data = set(first.field_data.keys())
active_scalars_info = {first.active_scalars_info._namedtuple} # noqa: SLF001
active_scalars_info = {
pv.core.dataset.ActiveArrayInfoTuple(*first.active_scalars_info)
Copy link
Contributor Author

@user27182 user27182 Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If pyvista/pyvista#6835 is accepted and the next GeoVista release pins pyvista>=0.45, then active_scalars_info is a named tuple and no unpacking is needed. Maybe this change could be made in a future PR?

Suggested change
pv.core.dataset.ActiveArrayInfoTuple(*first.active_scalars_info)
first.active_scalars_info

EDIT: if you don't want to pin PyVista you can branch this instead to support legacy behaviour

}

for i, mesh in enumerate(meshes):
if not isinstance(mesh, pv.PolyData):
Expand Down Expand Up @@ -425,7 +428,9 @@ def combine(
common_cell_data &= set(mesh.cell_data.keys())
common_field_data &= set(mesh.field_data.keys())
if mesh.active_scalars_name:
active_scalars_info &= {mesh.active_scalars_info._namedtuple} # noqa: SLF001
active_scalars_info &= {
pv.core.dataset.ActiveArrayInfoTuple(*mesh.active_scalars_info)
}

points = np.vstack(combined_points)
faces = np.hstack(combined_faces)
Expand Down
Loading