Skip to content

Commit 2d187ad

Browse files
committed
Refactor type annotations in plotting helper functions.
Replaced explicit `pv.Plotter` type annotations with string literals in multiple helper functions to prevent potential runtime issues with forward references. This ensures compatibility and adheres to best practices for type hinting.
1 parent d89e63e commit 2d187ad

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

gempy_engine/plugins/plotting/helper_functions_pyvista.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
plot_pyvista = False
1313

1414

15-
def plot_octree_pyvista(p: pv.Plotter, octree_list: List[OctreeLevel], n_octree: int):
15+
def plot_octree_pyvista(p: "pv.Plotter", octree_list: List[OctreeLevel], n_octree: int):
1616
n = n_octree
1717

1818
shape = octree_list[n].grid_centers.octree_grid_shape
@@ -28,7 +28,7 @@ def plot_octree_pyvista(p: pv.Plotter, octree_list: List[OctreeLevel], n_octree:
2828
p.add_axes()
2929

3030

31-
def plot_dc_meshes(p: pv.Plotter, dc_mesh: DualContouringMesh, plot_labels=False, color="green"):
31+
def plot_dc_meshes(p: "pv.Plotter", dc_mesh: DualContouringMesh, plot_labels=False, color="green"):
3232
vtk_edges = np.insert(dc_mesh.edges.reshape(-1, 3), 0, 3, axis=1).ravel()
3333
dual_mesh = pv.PolyData(dc_mesh.vertices, vtk_edges)
3434
p.add_mesh(dual_mesh, opacity=1, silhouette=False, color=color)
@@ -39,15 +39,15 @@ def plot_dc_meshes(p: pv.Plotter, dc_mesh: DualContouringMesh, plot_labels=False
3939
p.add_point_labels(vertex, list(range(dc_mesh.vertices.shape[0])), point_size=20, font_size=36)
4040

4141

42-
def plot_points(p: pv.Plotter, xyz: np.ndarray, plot_labels=False):
42+
def plot_points(p: "pv.Plotter", xyz: np.ndarray, plot_labels=False):
4343
coords = pv.PolyData(xyz)
4444
p.add_mesh(coords, color="w", point_size=10.0, render_points_as_spheres=True)
4545
if plot_labels:
4646
p.add_point_labels(coords, list(range(xyz.shape[0])), point_size=20,
4747
font_size=36)
4848

4949

50-
def plot_vector(p: pv.Plotter, xyz, gradients):
50+
def plot_vector(p: "pv.Plotter", xyz, gradients):
5151
poly = pv.PolyData(xyz)
5252
poly['vectors'] = gradients
5353

0 commit comments

Comments
 (0)