Skip to content

Commit d354002

Browse files
authored
chore: Add type for Containers and window methods. (#660)
``` def add_plot( plot_obj: GraphicsContainer, ``` ``` def add_graphics( graphics_obj: GraphicsContainer, ``` '''_GraphicsContainer -> GraphicsContainer```
1 parent eff1397 commit d354002

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/ansys/fluent/visualization/containers.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
)
3636

3737

38-
class _GraphicsContainer:
38+
class GraphicsObject:
3939
"""Base class for graphics containers."""
4040

4141
def __init__(self, solver, **kwargs):
@@ -64,7 +64,7 @@ def __dir__(self):
6464
return sorted(set(super().__dir__()) | set(dir(self._obj)))
6565

6666

67-
class Mesh(_GraphicsContainer):
67+
class Mesh(GraphicsObject):
6868
"""Mesh visualization object.
6969
7070
Creates a Fluent mesh graphic object on the specified surfaces.
@@ -111,7 +111,7 @@ def __init__(
111111
)
112112

113113

114-
class Surface(_GraphicsContainer):
114+
class Surface(GraphicsObject):
115115
"""Surface definition for Fluent post-processing.
116116
117117
The ``Surface`` class represents any Fluent surface generated for
@@ -371,7 +371,7 @@ def __init__(
371371
)
372372

373373

374-
class Contour(_GraphicsContainer):
374+
class Contour(GraphicsObject):
375375
"""
376376
Contour visualization object.
377377
@@ -426,7 +426,7 @@ def __init__(
426426
)
427427

428428

429-
class Vector(_GraphicsContainer):
429+
class Vector(GraphicsObject):
430430
"""Vector visualization object.
431431
432432
Parameters
@@ -513,7 +513,7 @@ def __setattr__(self, attr, value):
513513
setattr(self._obj, attr, value)
514514

515515

516-
class Pathline(_GraphicsContainer):
516+
class Pathline(GraphicsObject):
517517
"""Pathline visualization object.
518518
519519
The ``Pathline`` class generates pathlines, which represent the trajectories
@@ -569,7 +569,7 @@ def __init__(
569569
)
570570

571571

572-
class XYPlot(_GraphicsContainer):
572+
class XYPlot(GraphicsObject):
573573
"""XY plot visualization object.
574574
575575
The ``XYPlot`` class creates a Fluent XY plot of a scalar field evaluated
@@ -633,7 +633,7 @@ def get_field_data(self):
633633
return XYPlotDataExtractor(self._obj).fetch_data()
634634

635635

636-
class Monitor(_GraphicsContainer):
636+
class Monitor(GraphicsObject):
637637
"""Monitor visualization object.
638638
639639
The ``Monitor`` class provides access to Fluent monitor data for plotting,

src/ansys/fluent/visualization/renderer.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
PlotDefn,
2929
)
3030
import ansys.fluent.visualization as pyviz
31+
from ansys.fluent.visualization.containers import GraphicsObject
3132
from ansys.fluent.visualization.graphics import graphics_windows_manager
3233
from ansys.fluent.visualization.graphics.graphics_windows import _GraphicsWindow
3334
from ansys.fluent.visualization.plotter.plotter_windows import _PlotterWindow
@@ -58,7 +59,7 @@ class GraphicsWindow:
5859
>>> graphics_window.show()
5960
"""
6061

61-
def __init__(self, renderer=None):
62+
def __init__(self, renderer: str = None):
6263
"""__init__ method of GraphicsWindow class."""
6364
self._graphics_objs = []
6465
self.window_id = None
@@ -68,7 +69,7 @@ def __init__(self, renderer=None):
6869

6970
def add_graphics(
7071
self,
71-
graphics_obj,
72+
graphics_obj: GraphicsObject,
7273
position: tuple = (0, 0),
7374
opacity: float = 1,
7475
title: str | None = None,
@@ -96,7 +97,7 @@ def add_graphics(
9697

9798
def add_plot(
9899
self,
99-
plot_obj,
100+
plot_obj: GraphicsObject,
100101
position: tuple = (0, 0),
101102
title: str | None = None,
102103
**kwargs,

0 commit comments

Comments
 (0)