Skip to content

Commit 98caeee

Browse files
AlejandroFernandezLucespyansys-ci-botRobPasMue
authored
fix: Rename built in shadowing variables (#1257)
Co-authored-by: pyansys-ci-bot <pyansys.github.bot@ansys.com> Co-authored-by: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com>
1 parent 57913a2 commit 98caeee

File tree

3 files changed

+30
-25
lines changed

3 files changed

+30
-25
lines changed

doc/changelog.d/1257.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fix: Rename built in shadowing variables

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ classifiers = [
2626
dependencies = [
2727
"ansys-api-geometry==0.4.4",
2828
"ansys-tools-path>=0.3,<1",
29-
"ansys-tools-visualization-interface>=0.2.4,<1",
29+
"ansys-tools-visualization-interface>=0.2.6,<1",
3030
"beartype>=0.11.0,<0.19",
3131
"grpcio>=1.35.0,<2",
3232
"grpcio-health-checking>=1.45.0,<2",
@@ -50,7 +50,7 @@ all = [
5050
tests = [
5151
"ansys-platform-instancemanagement==1.1.2",
5252
"ansys-tools-path==0.6.0",
53-
"ansys-tools-visualization-interface==0.2.4",
53+
"ansys-tools-visualization-interface==0.2.6",
5454
"beartype==0.18.5",
5555
"docker==7.1.0",
5656
"grpcio==1.64.1",
@@ -77,7 +77,7 @@ tests-minimal = [
7777
]
7878
doc = [
7979
"ansys-sphinx-theme[autoapi]==0.16.5",
80-
"ansys-tools-visualization-interface==0.2.4",
80+
"ansys-tools-visualization-interface==0.2.6",
8181
"beartype==0.18.5",
8282
"docker==7.1.0",
8383
"ipyvtklink==0.2.3",

src/ansys/geometry/core/plotting/plotter.py

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ def add_design_point(self, design_point: DesignPoint, **plotting_options) -> Non
301301
def plot_iter(
302302
self,
303303
plotting_list: List[Any],
304-
filter: str = None,
304+
name_filter: str = None,
305305
**plotting_options,
306306
) -> None:
307307
"""
@@ -314,25 +314,25 @@ def plot_iter(
314314
----------
315315
plotting_list : List[Any]
316316
List of objects you want to plot.
317-
filter : str, default: None
317+
name_filter : str, default: None
318318
Regular expression with the desired name or names you want to include in the plotter.
319319
**plotting_options : dict, default: None
320320
Keyword arguments. For allowable keyword arguments, see the
321321
:meth:`Plotter.add_mesh <pyvista.Plotter.add_mesh>` method.
322322
"""
323323
for object in plotting_list:
324-
_ = self.plot(object, filter, **plotting_options)
324+
_ = self.plot(object, name_filter, **plotting_options)
325325

326326
# Override add function from plotter
327-
def plot(self, object: Any, filter: str = None, **plotting_options) -> None:
327+
def plot(self, plottable_object: Any, name_filter: str = None, **plotting_options) -> None:
328328
"""
329329
Add a custom mesh to the plotter.
330330
331331
Parameters
332332
----------
333-
object : Any
334-
Object to add.
335-
filter : str, default: None
333+
plottable_object : str, default: None
334+
Regular expression with the desired name or names you want to include in the plotter.
335+
name_filter: str, default: None
336336
Regular expression with the desired name or names you want to include in the plotter.
337337
**plotting_options : dict, default: None
338338
Keyword arguments. For allowable keyword arguments, depend of the backend implementation
@@ -351,24 +351,28 @@ def plot(self, object: Any, filter: str = None, **plotting_options) -> None:
351351
else:
352352
merge_components = None
353353
# Add the custom object to the plotter
354-
if isinstance(object, DesignPoint):
355-
self.add_design_point(object, **plotting_options)
356-
elif isinstance(object, Sketch):
357-
self.add_sketch(object, **plotting_options)
358-
elif isinstance(object, Body) or isinstance(object, MasterBody):
359-
self.add_body(object, merge_bodies, **plotting_options)
360-
elif isinstance(object, Design) or isinstance(object, Component):
361-
self.add_component(object, merge_components, merge_bodies, **plotting_options)
362-
elif isinstance(object, List) and object != [] and isinstance(object[0], pv.PolyData):
363-
self.add_sketch_polydata(object, **plotting_options)
364-
elif isinstance(object, List):
365-
self.plot_iter(object, filter, **plotting_options)
366-
elif isinstance(object, MeshObjectPlot):
354+
if isinstance(plottable_object, DesignPoint):
355+
self.add_design_point(plottable_object, **plotting_options)
356+
elif isinstance(plottable_object, Sketch):
357+
self.add_sketch(plottable_object, **plotting_options)
358+
elif isinstance(plottable_object, Body) or isinstance(object, MasterBody):
359+
self.add_body(plottable_object, merge_bodies, **plotting_options)
360+
elif isinstance(plottable_object, Design) or isinstance(object, Component):
361+
self.add_component(plottable_object, merge_components, merge_bodies, **plotting_options)
362+
elif (
363+
isinstance(plottable_object, List)
364+
and plottable_object != []
365+
and isinstance(plottable_object[0], pv.PolyData)
366+
):
367+
self.add_sketch_polydata(plottable_object, **plotting_options)
368+
elif isinstance(plottable_object, List):
369+
self.plot_iter(plottable_object, name_filter, **plotting_options)
370+
elif isinstance(plottable_object, MeshObjectPlot):
367371
self._backend.pv_interface.set_add_mesh_defaults(plotting_options)
368-
self._backend.pv_interface.plot(object, filter, **plotting_options)
372+
self._backend.pv_interface.plot(plottable_object, name_filter, **plotting_options)
369373
else:
370374
# any left type should be a PyVista object
371-
self._backend.pv_interface.plot(object, filter, **plotting_options)
375+
self._backend.pv_interface.plot(plottable_object, name_filter, **plotting_options)
372376

373377
def show(
374378
self,

0 commit comments

Comments
 (0)