From 89c29b3325a82d775fd6a373351a1fafc8c1a215 Mon Sep 17 00:00:00 2001 From: Gobot1234 Date: Tue, 18 Nov 2025 09:03:40 +0000 Subject: [PATCH 01/20] types: begin --- doc/source/_ext/autodocclass.py | 4 +- pyproject.toml | 10 + .../post_objects/check_in_notebook.py | 6 +- .../fluent/interface/post_objects/meta.py | 216 +++++++++++------- .../interface/post_objects/post_helper.py | 18 +- .../post_objects/post_object_definitions.py | 14 +- .../interface/post_objects/singleton_meta.py | 2 +- src/ansys/fluent/visualization/__init__.py | 30 +-- src/ansys/fluent/visualization/contour.py | 4 +- .../graphics/graphics_objects.py | 11 +- .../graphics/graphics_windows_manager.py | 31 ++- .../plotter/matplotlib/renderer.py | 11 +- .../visualization/plotter/plotter_objects.py | 5 +- .../plotter/plotter_windows_manager.py | 24 +- .../visualization/plotter/pyvista/renderer.py | 11 +- .../visualization/post_data_extractor.py | 3 +- .../visualization_windows_manager.py | 24 +- tests/test_post.py | 19 +- 18 files changed, 252 insertions(+), 191 deletions(-) diff --git a/doc/source/_ext/autodocclass.py b/doc/source/_ext/autodocclass.py index 190970e2..9cd5ecb1 100644 --- a/doc/source/_ext/autodocclass.py +++ b/doc/source/_ext/autodocclass.py @@ -1,5 +1,5 @@ from enum import IntEnum -from typing import Any, Optional +from typing import Any from docutils.statemachine import StringList from sphinx.application import Sphinx @@ -28,7 +28,7 @@ def add_directive_header(self, sig: str) -> None: super().add_directive_header(sig) self.add_line(" ", self.get_sourcename()) - def add_content(self, more_content: Optional[StringList]) -> None: + def add_content(self, more_content: StringList | None) -> None: super().add_content(more_content) source_name = self.get_sourcename() diff --git a/pyproject.toml b/pyproject.toml index f424c288..0c0f619b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,7 @@ pyside6 = { version = "~=6.8.1", optional = true } [tool.poetry.extras] interactive = ["pyvistaqt"] single-window = ["pyvistaqt", "pyside6"] +ci_types = ["pyvistaqt", "pyside6", "ipython"] [tool.poetry.urls] "Documentation" = "https://visualization.fluent.docs.pyansys.com/" @@ -77,3 +78,12 @@ skips = [ "B604", "B607", ] + +[tool.basedpyright] +reportUnknownMemberType = false +reportExplicitAny = false +reportPrivateUsage = false +reportUnusedCallResult = false +reportUnannotatedClassAttribute = false +reportPrivateImportUsage = false +ignore = ["doc"] diff --git a/src/ansys/fluent/interface/post_objects/check_in_notebook.py b/src/ansys/fluent/interface/post_objects/check_in_notebook.py index 9014ed83..5e61b794 100644 --- a/src/ansys/fluent/interface/post_objects/check_in_notebook.py +++ b/src/ansys/fluent/interface/post_objects/check_in_notebook.py @@ -26,16 +26,16 @@ from ansys.fluent.core import PyFluentDeprecationWarning -def in_jupyter(): +def in_jupyter() -> bool: """Checks if the library is being used in a Jupyter environment.""" try: from IPython import get_ipython - return "IPKernelApp" in get_ipython().config + return "IPKernelApp" in get_ipython().config # pyright: ignore[reportOptionalMemberAccess] except (ImportError, AttributeError): return False -def in_notebook(): +def in_notebook() -> bool: warnings.warn("Please use 'in_jupyter' instead.", PyFluentDeprecationWarning) return in_jupyter() diff --git a/src/ansys/fluent/interface/post_objects/meta.py b/src/ansys/fluent/interface/post_objects/meta.py index f57a3292..add0e32e 100644 --- a/src/ansys/fluent/interface/post_objects/meta.py +++ b/src/ansys/fluent/interface/post_objects/meta.py @@ -23,17 +23,23 @@ """Metaclasses used in various explicit classes in PyFluent.""" from abc import ABCMeta -from collections.abc import MutableMapping +from collections.abc import Callable, MutableMapping import inspect -from typing import List +from typing import TYPE_CHECKING, Any, Concatenate, Generic, Never, Protocol, Self, overload +from typing_extensions import Self, TypeVar, ParamSpec from ansys.fluent.core.exceptions import DisallowedValuesError, InvalidArgument +if TYPE_CHECKING: + from ansys.fluent.interface.post_objects.post_objects_container import Container # pylint: disable=unused-private-member # pylint: disable=bad-mcs-classmethod-argument +_SelfT = TypeVar("_SelfT", covariant=True) +_T_co = TypeVar("_T_co", covariant=True) -class Attribute: + +class Attribute(Generic[_SelfT, _T_co]): """Attributes.""" VALID_NAMES = [ @@ -61,38 +67,54 @@ class Attribute: "extensions", ] - def __init__(self, function): + def __init__(self, function: Callable[[_SelfT], _T_co], /): self.function = function + self.__doc__: str | None = getattr(function, "__doc__", None) + self.name: str - def __set_name__(self, obj, name): + def __set_name__(self, owner: type, name: str): if name not in self.VALID_NAMES: raise DisallowedValuesError("attribute", name, self.VALID_NAMES) self.name = name - if not hasattr(obj, "attributes"): - obj.attributes = set() - obj.attributes.add(name) + if not hasattr(owner, "attributes"): + owner.attributes = set() + owner.attributes.add(name) - def __set__(self, obj, value): + def __set__(self, instance: _SelfT, value: _T_co) -> Never: # pyright: ignore[reportGeneralTypeIssues] raise AttributeError("Attributes are read only.") - def __get__(self, obj, objtype=None): - return self.function(obj) + @overload + def __get__(self, instance: None, _) -> Self: ... + + @overload + def __get__(self, instance: _SelfT, _) -> _T_co: # pyright: ignore[reportGeneralTypeIssues] + ... + + def __get__(self, instance: _SelfT | None, _) -> _T_co | Self: + if instance is None: + return self + return self.function(instance) + +P = ParamSpec("P") -class Command: + +class Command(Generic[_SelfT, P]): """Executes command.""" - def __init__(self, method): + def __init__(self, method: Callable[Concatenate[_SelfT, P], None]): self.arguments_attrs = {} + self.owner: type + cmd_args = inspect.signature(method).parameters for arg_name in cmd_args: if arg_name != "self": self.arguments_attrs[arg_name] = {} - def _init(_self, obj): + def _init(_self: _SelfT, obj): _self.obj = obj - def _execute(_self, *args, **kwargs): + def _execute(_self: _SelfT, *args: Any, **kwargs: Any): for arg, attr_data in self.arguments_attrs.items(): arg_value = None if arg in kwargs: @@ -137,34 +159,37 @@ def _execute(_self, *args, **kwargs): { "__init__": _init, "__call__": _execute, - "argument_attribute": lambda _self, argument_name, attr_name: self.arguments_attrs[ # noqa: E501 + "argument_attribute": lambda _self, + argument_name, + attr_name: self.arguments_attrs[ # noqa: E501 argument_name - ][ - attr_name - ]( - _self.obj - ), + ][attr_name](_self.obj), "arguments": lambda _self: list(self.arguments_attrs.keys()), }, ) - def __set_name__(self, obj, name): - self.obj = obj - if not hasattr(obj, "commands"): - obj.commands = {} - obj.commands[name] = {} + def __set_name__(self, owner: type, name: str) -> None: + self.owner = owner + if not hasattr(owner, "commands"): + owner.commands = {} + owner.commands[name] = {} - def __get__(self, obj, obj_type=None): + def __get__(self, instance: _SelfT, _): # pyright: ignore[reportGeneralTypeIssues] if hasattr(self, "command"): return self.command else: - return self.command_cls(obj) + return self.command_cls(instance) + +TT = TypeVar("TT", bound=type) -def CommandArgs(command_object, argument_name): + +def CommandArgs( + command_object: Command[object, ...], argument_name: str +) -> Callable[[TT], TT]: """Command arguments.""" - def wrapper(attribute): + def wrapper(attribute: TT) -> TT: if argument_name in command_object.arguments_attrs: command_object.arguments_attrs[argument_name].update( {attribute.__name__: attribute} @@ -176,66 +201,70 @@ def wrapper(attribute): return wrapper +class _Wrapper(Protocol): + def __call__(self, self_: type, instance: Any, owner: type, /) -> Any: ... + + class PyLocalBaseMeta(type): """Local base metaclass.""" @classmethod - def __create_get_ancestors_by_type(cls): - def wrapper(self, obj_type, obj=None): - obj = self if obj is None else obj + def __create_get_ancestors_by_type(cls) -> _Wrapper: + def wrapper(self: type, instance, owner: type | None = None): + owner = self if owner is None else owner parent = None - if getattr(obj, "_parent", None): - if isinstance(obj._parent, obj_type): - return obj._parent - parent = self.get_ancestors_by_type(obj_type, obj._parent) + if getattr(owner, "_parent", None): + if isinstance(owner._parent, instance): + return owner._parent + parent = self.get_ancestors_by_type(instance, owner._parent) return parent return wrapper @classmethod - def __create_get_ancestors_by_name(cls): - def wrapper(self, obj_type, obj=None): - obj = self if obj is None else obj + def __create_get_ancestors_by_name(cls) -> _Wrapper: + def wrapper(self: type, instance, owner: type | None = None): + instance = self if instance is None else instance parent = None - if getattr(obj, "_parent", None): - if obj._parent.__class__.__name__ == obj_type: - return obj._parent - if getattr(obj._parent, "PLURAL", None) == obj_type: - return obj._parent._parent - parent = self.get_ancestors_by_name(obj_type, obj._parent) + if getattr(instance, "_parent", None): + if instance._parent.__class__.__name__ == owner: + return instance._parent + if getattr(instance._parent, "PLURAL", None) == owner: + return instance._parent._parent + parent = self.get_ancestors_by_name(owner, instance._parent) return parent return wrapper @classmethod - def __create_get_root(cls): - def wrapper(self, obj=None): - obj = self if obj is None else obj - parent = obj - if getattr(obj, "_parent", None): - parent = self.get_root(obj._parent) + def __create_get_root(cls) -> _Wrapper: + def wrapper(self: type, instance, owner: type | None = None): + instance = self if instance is None else instance + parent = instance + if getattr(instance, "_parent", None): + parent = self.get_root(instance._parent) return parent return wrapper @classmethod - def __create_get_session(cls): - def wrapper(self, obj=None): - root = self.get_root(obj) + def __create_get_session(cls) -> _Wrapper: + def wrapper(self: type, instance, owner: type | None = None): + root = self.get_root(instance) return root.session return wrapper @classmethod - def __create_get_session_handle(cls): - def wrapper(self, obj=None): - root = self.get_root(obj) + def __create_get_session_handle(cls)-> _Wrapper: + def wrapper(self: type, instance, owner: type | None = None): + root = self.get_root(instance) return getattr(root, "session_handle", None) return wrapper @classmethod - def __create_get_path(cls): + def __create_get_path(cls) -> _Wrapper: def wrapper(self): if getattr(self, "_parent", None): return self._parent.get_path() + "/" + self._name @@ -243,7 +272,7 @@ def wrapper(self): return wrapper - def __new__(cls, name, bases, attrs): + def __new__(cls, name: str, bases: tuple[type, ...], attrs: dict[str, Any]) -> Self: attrs["get_ancestors_by_type"] = cls.__create_get_ancestors_by_type() attrs["get_ancestors_by_name"] = cls.__create_get_ancestors_by_name() attrs["get_root"] = cls.__create_get_root() @@ -257,7 +286,31 @@ def __new__(cls, name, bases, attrs): attrs["field_data"] = property(lambda self: self.get_session().field_data) attrs["monitors"] = property(lambda self: self.get_session().monitors) attrs["session_handle"] = property(lambda self: self.get_session_handle()) - return super(PyLocalBaseMeta, cls).__new__(cls, name, bases, attrs) + return super().__new__(cls, name, bases, attrs) + + def get_ancestors_by_type(self) -> str: ... + def get_ancestors_by_name(self) -> str: ... + def get_root(self) -> str: ... + def get_session(self) -> str: ... + def get_session_handle(self) -> str: ... + def get_path(self) -> str: ... + + @property + def root(self) -> str: ... + @property + def path(self) -> str: ... + @property + def session(self) -> str: ... + @property + def field_data(self) -> str: ... + @property + def monitors(self) -> str: ... + @property + def session_handle(self) -> str: ... + +class Foo(metaclass=PyLocalBaseMeta): + get_ancestors_by_type = PyLocalBaseMeta.get_ancestors_by_type + class PyLocalPropertyMeta(PyLocalBaseMeta): @@ -331,12 +384,12 @@ def wrapper(self, on_change_cb): return wrapper - def __new__(cls, name, bases, attrs): + def __new__(cls, name:str, bases: tuple[type, ...], attrs: dict[str, Any]): attrs["__init__"] = cls.__create_init() attrs["__call__"] = cls.__create_get_state() attrs["_register_on_change_cb"] = cls.__create_register_on_change() attrs["set_state"] = cls.__create_set_state() - return super(PyLocalPropertyMeta, cls).__new__(cls, name, bases, attrs) + return super().__new__(cls, name, bases, attrs) class PyReferenceObjectMeta(PyLocalBaseMeta): @@ -428,7 +481,7 @@ def __new__(cls, name, bases, attrs): attrs["__getattr__"] = attrs.get("__getattr__", cls.__create_getattr()) attrs["reset"] = cls.__create_reset() attrs["get_path"] = cls.__create_get_path() - return super(PyReferenceObjectMeta, cls).__new__(cls, name, bases, attrs) + return super().__new__(cls, name, bases, attrs) class PyLocalObjectMeta(PyLocalBaseMeta): @@ -483,7 +536,7 @@ def update(clss): @classmethod def __create_getattribute(cls): - def wrapper(self, name): + def wrapper(self, name: str): obj = object.__getattribute__(self, name) return obj @@ -588,14 +641,14 @@ def wrapper(self, name, value): return wrapper - def __new__(cls, name, bases, attrs): + def __new__(cls, name: str, bases: tuple[type, ...], attrs: dict[str, Any]): attrs["__getattribute__"] = cls.__create_getattribute() attrs["__init__"] = attrs.get("__init__", cls.__create_init()) if "__call__" not in attrs: attrs["__call__"] = cls.__create_get_state() attrs["__setattr__"] = cls.__create_setattr() attrs["update"] = cls.__create_updateitem() - return super(PyLocalObjectMeta, cls).__new__(cls, name, bases, attrs) + return super().__new__(cls, name, bases, attrs) class PyLocalCommandMeta(PyLocalObjectMeta): @@ -648,7 +701,7 @@ def wrapper(self, **kwargs): def __new__(cls, name, bases, attrs): attrs["__init__"] = cls.__create_init() attrs["__call__"] = cls.__execute_command() - return super(PyLocalCommandMeta, cls).__new__(cls, name, bases, attrs) + return super().__new__(cls, name, bases, attrs) class PyLocalNamedObjectMeta(PyLocalObjectMeta): @@ -704,7 +757,7 @@ def update(clss): def __new__(cls, name, bases, attrs): attrs["__init__"] = cls.__create_init() - return super(PyLocalNamedObjectMeta, cls).__new__(cls, name, bases, attrs) + return super().__new__(cls, name, bases, attrs) class PyLocalNamedObjectMetaAbstract(ABCMeta, PyLocalNamedObjectMeta): @@ -713,10 +766,13 @@ class PyLocalNamedObjectMetaAbstract(ABCMeta, PyLocalNamedObjectMeta): pass -class PyLocalContainer(MutableMapping): +T = TypeVar("T") + + +class PyLocalContainer(MutableMapping[str, T]): """Local container for named objects.""" - def __init__(self, parent, object_class, api_helper, name=""): + def __init__(self, parent: "Container", object_class: type[T], api_helper, name: str = ""): """Initialize the 'PyLocalContainer' object.""" self._parent = parent self._name = name @@ -766,7 +822,7 @@ def __init__(self, parent, object_class, api_helper, name=""): cls(self, api_helper, name), ) - def update(self, value): + def update(self, value) -> None: """Updates this object with the provided dictionary.""" for name, val in value.items(): o = self[name] @@ -785,14 +841,14 @@ def get_session(self, obj=None): root = self.get_root(obj) return root.session - def get_path(self): + def get_path(self) -> str: """Path to the current object.""" if getattr(self, "_parent", None): return self._parent.get_path() + "/" + self._name return self._name @property - def path(self): + def path(self) -> str: """Path to the current object.""" return self.get_path() @@ -814,7 +870,7 @@ def session_handle(self): def __iter__(self): return iter(self._local_collection) - def __len__(self): + def __len__(self) -> int: return len(self._local_collection) def __getitem__(self, name): @@ -828,17 +884,17 @@ def __getitem__(self, name): on_create(self, name) return o - def __setitem__(self, name, value): + def __setitem__(self, name, value) -> None: o = self[name] o.update(value) - def __delitem__(self, name): + def __delitem__(self, name) -> None: del self._local_collection[name] on_delete = getattr(self._PyLocalContainer__object_class, "on_delete", None) if on_delete: on_delete(self, name) - def _get_unique_chid_name(self): + def _get_unique_chid_name(self) -> str: children = list(self) index = 0 while True: @@ -853,14 +909,14 @@ def _get_unique_chid_name(self): class Delete(metaclass=PyLocalCommandMeta): """Local delete command.""" - def _exe_cmd(self, names): + def _exe_cmd(self, names) -> None: for item in names: self._parent.__delitem__(item) class names(metaclass=PyLocalPropertyMeta): """Local names property.""" - value: List[str] = [] + value: list[str] = [] @Attribute def allowed_values(self): diff --git a/src/ansys/fluent/interface/post_objects/post_helper.py b/src/ansys/fluent/interface/post_objects/post_helper.py index 48db651f..6b42f139 100644 --- a/src/ansys/fluent/interface/post_objects/post_helper.py +++ b/src/ansys/fluent/interface/post_objects/post_helper.py @@ -55,20 +55,20 @@ def __init__(self, obj): self._surface_name_on_server = self.surface_name_on_server(obj._name) @staticmethod - def surface_name_on_server(local_surface_name): + def surface_name_on_server(local_surface_name: str) -> str: """Return the surface name on server.""" return local_surface_name.lower() def _get_api_handle(self): return self.obj.get_root().session.results.surfaces - def _delete_if_exists_on_server(self): + def _delete_if_exists_on_server(self) -> None: field_data = self.obj._api_helper.field_data() surfaces_list = list(field_data.surfaces()) if self._surface_name_on_server in surfaces_list: self.delete_surface_on_server() - def create_surface_on_server(self): + def create_surface_on_server(self) -> None: """Create the surface on server. Raises @@ -135,21 +135,21 @@ def create_surface_on_server(self): if self._surface_name_on_server not in surfaces_list: raise SurfaceCreationError() - def delete_surface_on_server(self): + def delete_surface_on_server(self) -> None: """Deletes the surface on server.""" if self.obj.definition.type() == "iso-surface": del self._get_api_handle().iso_surface[self._surface_name_on_server] elif self.obj.definition.type() == "plane-surface": del self._get_api_handle().plane_surface[self._surface_name_on_server] - def __init__(self, obj): + def __init__(self, obj: Surface): """__init__ method of PostAPIHelper class.""" self.obj = obj self.field_data = lambda: obj.get_root().session.fields.field_data if obj.__class__.__name__ == "Surface": self.surface_api = PostAPIHelper._SurfaceAPI(obj) - def remote_surface_name(self, local_surface_name): + def remote_surface_name(self, local_surface_name: str): """Return the surface name.""" local_surfaces_provider = self.obj.get_root()._local_surfaces_provider() @@ -159,7 +159,7 @@ def remote_surface_name(self, local_surface_name): else: return local_surface_name - def get_field_unit(self, field): + def get_field_unit(self, field: str) -> str | None: """Return the unit of the field.""" session = self.obj.get_root().session if FluentVersion(session.scheme.version) < FluentVersion.v252: @@ -172,11 +172,11 @@ def get_field_unit(self, field): fields_info = self.field_data().scalar_fields() return get_si_unit_for_fluent_quantity(fields_info[field]["quantity_name"]) - def _field_unit_quantity(self, field): + def _field_unit_quantity(self, field: str) -> str: scheme_eval_str = f"(cdr (assq 'units (%fill-render-info '{field})))" return self._scheme_str_to_py_list(scheme_eval_str)[0] - def _scheme_str_to_py_list(self, scheme_eval_str): + def _scheme_str_to_py_list(self, scheme_eval_str: str) -> list[str]: session = self.obj.get_root().session if hasattr(session, "scheme_eval"): str_val = session.scheme.string_eval(scheme_eval_str) diff --git a/src/ansys/fluent/interface/post_objects/post_object_definitions.py b/src/ansys/fluent/interface/post_objects/post_object_definitions.py index 0d014df0..16d638ea 100644 --- a/src/ansys/fluent/interface/post_objects/post_object_definitions.py +++ b/src/ansys/fluent/interface/post_objects/post_object_definitions.py @@ -24,7 +24,7 @@ from abc import abstractmethod import logging -from typing import List, NamedTuple +from typing import NamedTuple from ansys.fluent.interface.post_objects.meta import ( Attribute, @@ -146,14 +146,14 @@ class x_axis_function(metaclass=PyLocalPropertyMeta): value: str = "direction-vector" @Attribute - def allowed_values(self): + def allowed_values(self) -> list[str]: """X axis function allowed values.""" return ["direction-vector"] class surfaces(metaclass=PyLocalPropertyMeta): """List of surfaces for plotting.""" - value: List[str] = [] + value: list[str] = [] @Attribute def allowed_values(self): @@ -171,7 +171,7 @@ class MeshDefn(GraphicsDefn): class surfaces(metaclass=PyLocalPropertyMeta): """List of surfaces for mesh graphics.""" - value: List[str] = [] + value: list[str] = [] @Attribute def allowed_values(self): @@ -214,7 +214,7 @@ def allowed_values(self): class surfaces(metaclass=PyLocalPropertyMeta): """List of surfaces for pathlines.""" - value: List[str] = [] + value: list[str] = [] @Attribute def allowed_values(self): @@ -474,7 +474,7 @@ def allowed_values(self): class surfaces(metaclass=PyLocalPropertyMeta): """Contour surfaces.""" - value: List[str] = [] + value: list[str] = [] @Attribute def allowed_values(self): @@ -664,7 +664,7 @@ def allowed_values(self): class surfaces(metaclass=PyLocalPropertyMeta): """List of surfaces for vector graphics.""" - value: List[str] = [] + value: list[str] = [] @Attribute def allowed_values(self): diff --git a/src/ansys/fluent/interface/post_objects/singleton_meta.py b/src/ansys/fluent/interface/post_objects/singleton_meta.py index 202fe251..8c5c4a6b 100644 --- a/src/ansys/fluent/interface/post_objects/singleton_meta.py +++ b/src/ansys/fluent/interface/post_objects/singleton_meta.py @@ -32,7 +32,7 @@ class SingletonMeta(type): def __call__(cls, *args, **kwargs): if not cls._single_instance: - cls._single_instance = super(SingletonMeta, cls).__call__(*args, **kwargs) + cls._single_instance = super().__call__(*args, **kwargs) return cls._single_instance diff --git a/src/ansys/fluent/visualization/__init__.py b/src/ansys/fluent/visualization/__init__.py index ee40503f..f7101d5d 100644 --- a/src/ansys/fluent/visualization/__init__.py +++ b/src/ansys/fluent/visualization/__init__.py @@ -46,19 +46,19 @@ def version_info() -> str: return _VERSION_INFO if _VERSION_INFO is not None else __version__ -from ansys.fluent.visualization.config import config, get_config, set_config -from ansys.fluent.visualization.containers import ( # noqa: F401 - Contour, - IsoSurface, - Mesh, - Monitor, - Pathline, - PlaneSurface, - Surface, - Vector, - XYPlot, +from ansys.fluent.visualization.config import config as config, get_config as get_config, set_config as set_config +from ansys.fluent.visualization.containers import ( + Contour as Contour, + IsoSurface as IsoSurface, + Mesh as Mesh, + Monitor as Monitor, + Pathline as Pathline, + PlaneSurface as PlaneSurface, + Surface as Surface, + Vector as Vector, + XYPlot as XYPlot, ) -from ansys.fluent.visualization.graphics import Graphics # noqa: F401 -from ansys.fluent.visualization.plotter import Plots # noqa: F401 -from ansys.fluent.visualization.registrar import register_renderer -from ansys.fluent.visualization.renderer import GraphicsWindow +from ansys.fluent.visualization.graphics import Graphics as Graphics +from ansys.fluent.visualization.plotter import Plots as Plots +from ansys.fluent.visualization.registrar import register_renderer as register_renderer +from ansys.fluent.visualization.renderer import GraphicsWindow as GraphicsWindow diff --git a/src/ansys/fluent/visualization/contour.py b/src/ansys/fluent/visualization/contour.py index d4fcb88a..8c52dfc3 100644 --- a/src/ansys/fluent/visualization/contour.py +++ b/src/ansys/fluent/visualization/contour.py @@ -22,7 +22,7 @@ """Contour objects based on field name and surfaces list.""" -from typing import List, Optional +from typing import Optional class Contour: @@ -57,7 +57,7 @@ def _error_check(self, solver): f"{surface} is not valid surface. Valid surfaces are {allowed_surfaces}" # noqa: E501 ) - def __init__(self, field: str, surfaces: List[str], solver: Optional = None): + def __init__(self, field: str, surfaces: list[str], solver: Optional = None): """Create contour using field name and surfaces list. Parameters diff --git a/src/ansys/fluent/visualization/graphics/graphics_objects.py b/src/ansys/fluent/visualization/graphics/graphics_objects.py index 9fc04472..f51bbde8 100644 --- a/src/ansys/fluent/visualization/graphics/graphics_objects.py +++ b/src/ansys/fluent/visualization/graphics/graphics_objects.py @@ -23,7 +23,6 @@ """Module providing visualization objects for PyVista.""" import sys -from typing import Optional from ansys.fluent.interface.post_objects.meta import Command from ansys.fluent.interface.post_objects.post_helper import PostAPIHelper @@ -80,7 +79,7 @@ class Mesh(MeshDefn): """ @Command - def display(self, window_id: Optional[str] = None, overlay: Optional[bool] = False): + def display(self, window_id: str | None = None, overlay: bool | None = False): """Display mesh graphics. Parameters @@ -112,7 +111,7 @@ class Pathlines(PathlinesDefn): """ @Command - def display(self, window_id: Optional[str] = None, overlay: Optional[bool] = False): + def display(self, window_id: str | None = None, overlay: bool | None = False): """Display mesh graphics. Parameters @@ -155,7 +154,7 @@ class Surface(SurfaceDefn): """ @Command - def display(self, window_id: Optional[str] = None, overlay: Optional[bool] = False): + def display(self, window_id: str | None = None, overlay: bool | None = False): """Display surface graphics. Parameters @@ -196,7 +195,7 @@ class Contour(ContourDefn): """ @Command - def display(self, window_id: Optional[str] = None, overlay: Optional[bool] = False): + def display(self, window_id: str | None = None, overlay: bool | None = False): """Display contour graphics. Parameters @@ -238,7 +237,7 @@ class Vector(VectorDefn): """ @Command - def display(self, window_id: Optional[str] = None, overlay: Optional[bool] = False): + def display(self, window_id: str | None = None, overlay: bool | None = False): """Display vector graphics. Parameters diff --git a/src/ansys/fluent/visualization/graphics/graphics_windows_manager.py b/src/ansys/fluent/visualization/graphics/graphics_windows_manager.py index bde31069..dcf66840 100644 --- a/src/ansys/fluent/visualization/graphics/graphics_windows_manager.py +++ b/src/ansys/fluent/visualization/graphics/graphics_windows_manager.py @@ -25,7 +25,6 @@ from enum import Enum import itertools import threading -from typing import Dict, List, Optional import numpy as np import pyvista as pv @@ -130,7 +129,7 @@ def _get_renderer(self, renderer_string=None): raise KeyError(error_message) from ex return renderer(self.id, in_jupyter(), not pyviz.config.interactive, self._grid) - def set_data(self, data_type: FieldDataType, data: Dict[int, Dict[str, np.array]]): + def set_data(self, data_type: FieldDataType, data: dict[int, dict[str, np.array]]): """Set data for graphics.""" self._data[data_type] = data @@ -653,10 +652,10 @@ class GraphicsWindowsManager(metaclass=AbstractSingletonMeta): def __init__(self): """Instantiate ``GraphicsWindow`` for Graphics.""" - self._post_windows: Dict[str:GraphicsWindow] = {} + self._post_windows: dict[str:GraphicsWindow] = {} self._plotter_thread: threading.Thread = None self._post_object: GraphicsDefn = None - self._window_id: Optional[str] = None + self._window_id: str | None = None self._exit_thread: bool = False self._app = None self._post_objects_list = [] @@ -753,9 +752,9 @@ def save_graphic( def refresh_windows( self, - session_id: Optional[str] = "", + session_id: str | None = "", windows_id=None, - overlay: Optional[bool] = False, + overlay: bool | None = False, ) -> None: """Refresh windows. @@ -784,7 +783,7 @@ def refresh_windows( def animate_windows( self, - session_id: Optional[str] = "", + session_id: str | None = "", windows_id=None, ) -> None: """Animate windows. @@ -816,7 +815,7 @@ def animate_windows( def close_windows( self, - session_id: Optional[str] = "", + session_id: str | None = "", windows_id=None, ) -> None: """Close windows. @@ -846,9 +845,9 @@ def close_windows( def _get_windows_id( self, - session_id: Optional[str] = "", + session_id: str | None = "", windows_id=None, - ) -> List[str]: + ) -> list[str]: if windows_id is None: windows_id = [] with self._condition: @@ -916,9 +915,9 @@ def open_window( def plot( self, graphics_object: GraphicsDefn, - window_id: Optional[str] = None, - fetch_data: Optional[bool] = False, - overlay: Optional[bool] = False, + window_id: str | None = None, + fetch_data: bool | None = False, + overlay: bool | None = False, ) -> None: """Draw a plot. @@ -1027,9 +1026,9 @@ def open_window( def plot( self, graphics_object: GraphicsDefn, - window_id: Optional[str] = None, - fetch_data: Optional[bool] = False, - overlay: Optional[bool] = False, + window_id: str | None = None, + fetch_data: bool | None = False, + overlay: bool | None = False, ) -> None: """Draw a plot. diff --git a/src/ansys/fluent/visualization/plotter/matplotlib/renderer.py b/src/ansys/fluent/visualization/plotter/matplotlib/renderer.py index 2e227def..ef378abd 100644 --- a/src/ansys/fluent/visualization/plotter/matplotlib/renderer.py +++ b/src/ansys/fluent/visualization/plotter/matplotlib/renderer.py @@ -22,7 +22,6 @@ """Module providing matplotlib plotter functionality.""" -from typing import List, Optional import matplotlib.pyplot as plt import numpy as np @@ -36,12 +35,12 @@ class Plotter(AbstractRenderer): def __init__( self, window_id: str, - curves: List[str] | None = None, + curves: list[str] | None = None, title: str | None = "XY Plot", xlabel: str | None = "position", ylabel: str | None = "", - remote_process: Optional[bool] = False, - grid: tuple | None = (1, 1), + remote_process: bool | None = False, + grid: tuple[int, int] | None = (1, 1), ): """Instantiate a matplotlib plotter. @@ -63,6 +62,8 @@ def __init__( Subplot indices. remote_process: bool, optional Is remote process. + grid: tuple[int, int], optional + Grid layout for subplots. """ self._curves = [] if curves is None else curves self._title = title @@ -249,7 +250,7 @@ class ProcessPlotter(Plotter): def __init__( self, window_id, - curves_name: List[str] | None = None, + curves_name: list[str] | None = None, title: str | None = "XY Plot", xlabel: str | None = "position", ylabel: str | None = "", diff --git a/src/ansys/fluent/visualization/plotter/plotter_objects.py b/src/ansys/fluent/visualization/plotter/plotter_objects.py index 8a60917a..baaa3d01 100644 --- a/src/ansys/fluent/visualization/plotter/plotter_objects.py +++ b/src/ansys/fluent/visualization/plotter/plotter_objects.py @@ -23,7 +23,6 @@ """Module providing visualization objects for Matplotlib.""" import sys -from typing import Optional from ansys.fluent.interface.post_objects.meta import Command from ansys.fluent.interface.post_objects.post_helper import PostAPIHelper @@ -77,7 +76,7 @@ class XYPlot(XYPlotDefn): """ @Command - def plot(self, window_id: Optional[str] = None): + def plot(self, window_id: str | None = None): """Draw XYPlot. Parameters @@ -112,7 +111,7 @@ class MonitorPlot(MonitorDefn): """ @Command - def plot(self, window_id: Optional[str] = None): + def plot(self, window_id: str | None = None): """Draw Monitor Plot. Parameters diff --git a/src/ansys/fluent/visualization/plotter/plotter_windows_manager.py b/src/ansys/fluent/visualization/plotter/plotter_windows_manager.py index 469d0552..2d066057 100644 --- a/src/ansys/fluent/visualization/plotter/plotter_windows_manager.py +++ b/src/ansys/fluent/visualization/plotter/plotter_windows_manager.py @@ -24,7 +24,7 @@ import itertools import multiprocessing as mp -from typing import Dict, List, Optional, Union +from typing import Union from ansys.fluent.core.fluent_connection import FluentConnection @@ -121,7 +121,7 @@ def __init__( self.id: str = id self.post_object = None self._grid = grid - self.plotter: Union[_ProcessPlotterHandle, "Plotter"] = self._get_plotter( + self.plotter: _ProcessPlotterHandle | Plotter = self._get_plotter( plotter_string=renderer ) self.close: bool = False @@ -226,7 +226,7 @@ def __init__( Plotter to plot the data. """ self.post_object: XYPlotDefn = post_object - self.plotter: Union[_ProcessPlotterHandle, "Plotter"] = plotter + self.plotter: _ProcessPlotterHandle | Plotter = plotter def __call__(self): """Draw an XY plot.""" @@ -258,7 +258,7 @@ def __init__( Plotter to plot the data. """ self.post_object: MonitorDefn = post_object - self.plotter: Union[_ProcessPlotterHandle, "Plotter"] = plotter + self.plotter: _ProcessPlotterHandle | Plotter = plotter def __call__(self): """Draw a monitor plot.""" @@ -300,7 +300,7 @@ class PlotterWindowsManager( def __init__(self): """Instantiate a windows manager for the plotter.""" - self._post_windows: Dict[str, PlotterWindow] = {} + self._post_windows: dict[str, PlotterWindow] = {} def open_window( self, @@ -354,7 +354,7 @@ def set_object_for_window(self, object: PlotDefn, window_id: str) -> None: def plot( self, object: PlotDefn, - window_id: Optional[str] = None, + window_id: str | None = None, grid=(1, 1), position=(0, 0), subplot_titles=None, @@ -424,9 +424,9 @@ def save_graphic( def refresh_windows( self, - session_id: Optional[str] = "", + session_id: str | None = "", windows_id=None, - overlay: Optional[bool] = None, + overlay: bool | None = None, ) -> None: """Refresh windows. @@ -451,7 +451,7 @@ def refresh_windows( def animate_windows( self, - session_id: Optional[str] = "", + session_id: str | None = "", windows_id=None, ) -> None: """Animate windows. @@ -476,7 +476,7 @@ def animate_windows( def close_windows( self, - session_id: Optional[str] = "", + session_id: str | None = "", windows_id=None, ) -> None: """Close windows. @@ -521,9 +521,9 @@ def _open_window( def _get_windows_id( self, - session_id: Optional[str] = "", + session_id: str | None = "", windows_id=None, - ) -> List[str]: + ) -> list[str]: if windows_id is None: windows_id = [] return [ diff --git a/src/ansys/fluent/visualization/plotter/pyvista/renderer.py b/src/ansys/fluent/visualization/plotter/pyvista/renderer.py index 19801c9f..33c4bb5a 100644 --- a/src/ansys/fluent/visualization/plotter/pyvista/renderer.py +++ b/src/ansys/fluent/visualization/plotter/pyvista/renderer.py @@ -20,7 +20,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from typing import List, Optional import numpy as np import pyvista as pv @@ -34,11 +33,11 @@ class Plotter(AbstractRenderer): def __init__( self, window_id: str, - curves: Optional[List[str]] = None, - title: Optional[str] = "XY Plot", - xlabel: Optional[str] = "position", - ylabel: Optional[str] = "", - remote_process: Optional[bool] = False, + curves: list[str] | None = None, + title: str | None = "XY Plot", + xlabel: str | None = "position", + ylabel: str | None = "", + remote_process: bool | None = False, grid: tuple | None = (1, 1), ): """Instantiate a pyvista chart 2D plotter. diff --git a/src/ansys/fluent/visualization/post_data_extractor.py b/src/ansys/fluent/visualization/post_data_extractor.py index c6c306aa..e8fcd438 100644 --- a/src/ansys/fluent/visualization/post_data_extractor.py +++ b/src/ansys/fluent/visualization/post_data_extractor.py @@ -23,7 +23,6 @@ """Module providing data extractor APIs.""" import itertools -from typing import Dict from ansys.fluent.core.field_data_interfaces import ( PathlinesFieldDataRequest, @@ -267,7 +266,7 @@ def __init__(self, post_object: PlotDefn): """ self._post_object: PlotDefn = post_object - def fetch_data(self) -> Dict[str, Dict[str, np.array]]: + def fetch_data(self) -> dict[str, dict[str, np.array]]: """Fetch data for visualization object. Parameters diff --git a/src/ansys/fluent/visualization/visualization_windows_manager.py b/src/ansys/fluent/visualization/visualization_windows_manager.py index 873b7d27..91d8a899 100644 --- a/src/ansys/fluent/visualization/visualization_windows_manager.py +++ b/src/ansys/fluent/visualization/visualization_windows_manager.py @@ -26,7 +26,7 @@ """ from abc import ABCMeta, abstractmethod -from typing import List, Optional, Union +from collections.abc import Sequence from ansys.fluent.interface.post_objects.post_object_definitions import ( GraphicsDefn, @@ -47,7 +47,7 @@ class VisualizationWindowsManager(metaclass=ABCMeta): """Abstract class for visualization windows management.""" @abstractmethod - def open_window(self, window_id: Optional[str] = None) -> str: + def open_window(self, window_id: str | None = None) -> str: """Open new window. Parameters @@ -64,7 +64,7 @@ def open_window(self, window_id: Optional[str] = None) -> str: @abstractmethod def set_object_for_window( - self, object: Union[GraphicsDefn, PlotDefn], window_id: str + self, object: GraphicsDefn | PlotDefn, window_id: str ) -> None: """Associate visualization object with running window instance. @@ -86,8 +86,8 @@ def set_object_for_window( @abstractmethod def plot( self, - object: Union[GraphicsDefn, PlotDefn], - window_id: Optional[str] = None, + object: GraphicsDefn | PlotDefn, + window_id: str | None = None, ) -> None: """Draw plot. @@ -131,9 +131,9 @@ def save_graphic( @abstractmethod def refresh_windows( self, - session_id: Optional[str] = "", - windows_id: Optional[List[str]] = [], - overlay: Optional[bool] = False, + session_id: str | None = "", + windows_id: list[str] | None = [], + overlay: bool | None = False, ) -> None: """Refresh windows. @@ -156,8 +156,8 @@ def refresh_windows( @abstractmethod def animate_windows( self, - session_id: Optional[str] = "", - windows_id: Optional[List[str]] = [], + session_id: str | None = "", + windows_id: Sequence[str] | None = [], ) -> None: """Animate windows. @@ -182,8 +182,8 @@ def animate_windows( @abstractmethod def close_windows( self, - session_id: Optional[str] = "", - windows_id: Optional[List[str]] = [], + session_id: str | None = "", + windows_id: Sequence[str] | None = [], ) -> None: """Close windows. diff --git a/tests/test_post.py b/tests/test_post.py index c6068b49..a8cc8b3a 100644 --- a/tests/test_post.py +++ b/tests/test_post.py @@ -23,7 +23,6 @@ from pathlib import Path import pickle import sys -from typing import Dict, List, Optional, Union from ansys.fluent.core.field_data_interfaces import SurfaceDataType import numpy as np @@ -47,7 +46,7 @@ def __init__(self, session_data, field_request): def add_surfaces_request( self, - surface_ids: List[int], + surface_ids: list[int], overset_mesh: bool = False, provide_vertices=True, provide_faces=True, @@ -67,10 +66,10 @@ def add_surfaces_request( def add_scalar_fields_request( self, - surface_ids: List[int], + surface_ids: list[int], field_name: str, - node_value: Optional[bool] = True, - boundary_value: Optional[bool] = False, + node_value: bool | None = True, + boundary_value: bool | None = False, ) -> None: self.fields_request["scalar"].append( (surface_ids, field_name, node_value, boundary_value) @@ -78,12 +77,12 @@ def add_scalar_fields_request( def add_vector_fields_request( self, - surface_ids: List[int], + surface_ids: list[int], field_name: str, ) -> None: self.fields_request["vector"].append((surface_ids, field_name)) - def get_fields(self) -> Dict[int, Dict]: + def get_fields(self) -> dict[int, dict]: fields = {} for request_type, requests in self.fields_request.items(): for request in requests: @@ -119,9 +118,9 @@ def new_transaction(self): def get_surface_data( self, surface_name: str, - data_type: Union[SurfaceDataType, int], - overset_mesh: Optional[bool] = False, - ) -> Dict: + data_type: SurfaceDataType | int, + overset_mesh: bool | None = False, + ) -> dict: surfaces_info = self.surfaces() surface_ids = surfaces_info[surface_name]["surface_id"] self._request_to_serve["surf"].append( From 2d47d6ec65b3bdd77ea5ef7c666d68d60f00a401 Mon Sep 17 00:00:00 2001 From: Gobot1234 Date: Thu, 27 Nov 2025 09:24:43 +0000 Subject: [PATCH 02/20] annotate singleton meta --- .../interface/post_objects/singleton_meta.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ansys/fluent/interface/post_objects/singleton_meta.py b/src/ansys/fluent/interface/post_objects/singleton_meta.py index 8c5c4a6b..5cd63410 100644 --- a/src/ansys/fluent/interface/post_objects/singleton_meta.py +++ b/src/ansys/fluent/interface/post_objects/singleton_meta.py @@ -23,20 +23,20 @@ """Provides a module for metaclasses.""" from abc import ABCMeta +from typing import TYPE_CHECKING, Any, Self class SingletonMeta(type): """Provides the metaclass for the singleton type.""" - _single_instance = None + _single_instance: Self | None = None # pyright: ignore[reportGeneralTypeIssues] - def __call__(cls, *args, **kwargs): - if not cls._single_instance: - cls._single_instance = super().__call__(*args, **kwargs) - return cls._single_instance + if not TYPE_CHECKING: # some type checkers may see this and erase the type otherwise + def __call__(cls, *args: Any, **kwargs: Any) -> Self: + if not cls._single_instance: + cls._single_instance = super().__call__(*args, **kwargs) + return cls._single_instance class AbstractSingletonMeta(ABCMeta, SingletonMeta): """Provides the metaclass for the abstract singleton type.""" - - pass From 06e5200670eaaeb019fa66c9e1f332a037f2736a Mon Sep 17 00:00:00 2001 From: Gobot1234 Date: Fri, 5 Dec 2025 09:49:53 +0000 Subject: [PATCH 03/20] more work --- .../fluent/interface/post_objects/meta.py | 974 ++++++++---------- .../post_objects/post_object_definitions.py | 129 +-- .../post_objects/post_objects_container.py | 28 +- .../fluent/visualization/base/renderer.py | 15 +- src/ansys/fluent/visualization/containers.py | 92 +- .../graphics/pyvista/renderer.py | 2 +- 6 files changed, 597 insertions(+), 643 deletions(-) diff --git a/src/ansys/fluent/interface/post_objects/meta.py b/src/ansys/fluent/interface/post_objects/meta.py index add0e32e..6ca2c190 100644 --- a/src/ansys/fluent/interface/post_objects/meta.py +++ b/src/ansys/fluent/interface/post_objects/meta.py @@ -22,14 +22,35 @@ """Metaclasses used in various explicit classes in PyFluent.""" -from abc import ABCMeta -from collections.abc import Callable, MutableMapping +from abc import ABC +from collections.abc import Callable, MutableMapping, Iterator import inspect -from typing import TYPE_CHECKING, Any, Concatenate, Generic, Never, Protocol, Self, overload -from typing_extensions import Self, TypeVar, ParamSpec +from typing import ( + TYPE_CHECKING, + Any, + Concatenate, + Generic, + Never, + Protocol, + Self, + cast, + overload, + override, +) +from ansys.fluent.core.session_solver import Solver +from typing_extensions import TypeVar, ParamSpec, get_args, get_original_bases from ansys.fluent.core.exceptions import DisallowedValuesError, InvalidArgument + +from ansys.fluent.interface.post_objects.post_object_definitions import BasePostObjectDefn + if TYPE_CHECKING: + from ansys.fluent.core.services.field_data import LiveFieldData + from ansys.fluent.interface.post_objects.post_object_definitions import ( + GraphicsDefn, + PlotDefn, + ) + from ansys.fluent.core.streaming_services.monitor_streaming import MonitorsManager from ansys.fluent.interface.post_objects.post_objects_container import Container # pylint: disable=unused-private-member @@ -205,498 +226,373 @@ class _Wrapper(Protocol): def __call__(self, self_: type, instance: Any, owner: type, /) -> Any: ... -class PyLocalBaseMeta(type): - """Local base metaclass.""" - - @classmethod - def __create_get_ancestors_by_type(cls) -> _Wrapper: - def wrapper(self: type, instance, owner: type | None = None): - owner = self if owner is None else owner - parent = None - if getattr(owner, "_parent", None): - if isinstance(owner._parent, instance): - return owner._parent - parent = self.get_ancestors_by_type(instance, owner._parent) - return parent - - return wrapper - - @classmethod - def __create_get_ancestors_by_name(cls) -> _Wrapper: - def wrapper(self: type, instance, owner: type | None = None): - instance = self if instance is None else instance - parent = None - if getattr(instance, "_parent", None): - if instance._parent.__class__.__name__ == owner: - return instance._parent - if getattr(instance._parent, "PLURAL", None) == owner: - return instance._parent._parent - parent = self.get_ancestors_by_name(owner, instance._parent) - return parent - - return wrapper - - @classmethod - def __create_get_root(cls) -> _Wrapper: - def wrapper(self: type, instance, owner: type | None = None): - instance = self if instance is None else instance - parent = instance - if getattr(instance, "_parent", None): - parent = self.get_root(instance._parent) - return parent - - return wrapper - - @classmethod - def __create_get_session(cls) -> _Wrapper: - def wrapper(self: type, instance, owner: type | None = None): - root = self.get_root(instance) - return root.session - - return wrapper - - @classmethod - def __create_get_session_handle(cls)-> _Wrapper: - def wrapper(self: type, instance, owner: type | None = None): - root = self.get_root(instance) - return getattr(root, "session_handle", None) - - return wrapper - - @classmethod - def __create_get_path(cls) -> _Wrapper: - def wrapper(self): - if getattr(self, "_parent", None): - return self._parent.get_path() + "/" + self._name - return self._name - - return wrapper - - def __new__(cls, name: str, bases: tuple[type, ...], attrs: dict[str, Any]) -> Self: - attrs["get_ancestors_by_type"] = cls.__create_get_ancestors_by_type() - attrs["get_ancestors_by_name"] = cls.__create_get_ancestors_by_name() - attrs["get_root"] = cls.__create_get_root() - attrs["get_session"] = cls.__create_get_session() - attrs["get_session_handle"] = cls.__create_get_session_handle() - if "get_path" not in attrs: - attrs["get_path"] = cls.__create_get_path() - attrs["root"] = property(lambda self: self.get_root()) - attrs["path"] = property(lambda self: self.get_path()) - attrs["session"] = property(lambda self: self.get_session()) - attrs["field_data"] = property(lambda self: self.get_session().field_data) - attrs["monitors"] = property(lambda self: self.get_session().monitors) - attrs["session_handle"] = property(lambda self: self.get_session_handle()) - return super().__new__(cls, name, bases, attrs) +class PyLocalBase: ... - def get_ancestors_by_type(self) -> str: ... - def get_ancestors_by_name(self) -> str: ... - def get_root(self) -> str: ... - def get_session(self) -> str: ... - def get_session_handle(self) -> str: ... - def get_path(self) -> str: ... - @property - def root(self) -> str: ... - @property - def path(self) -> str: ... - @property - def session(self) -> str: ... - @property - def field_data(self) -> str: ... - @property - def monitors(self) -> str: ... - @property - def session_handle(self) -> str: ... +T = TypeVar("T") -class Foo(metaclass=PyLocalBaseMeta): - get_ancestors_by_type = PyLocalBaseMeta.get_ancestors_by_type +class PyLocalBase: + """Local base.""" + def get_ancestors_by_type(self, instance: BasePostObjectDefn, owner: "PyLocalBase | None" = None): + owner = self if owner is None else owner + parent = None + if getattr(owner, "_parent", None): + if isinstance(owner._parent, instance): + return owner._parent + parent = self.get_ancestors_by_type(instance, owner._parent) + return parent -class PyLocalPropertyMeta(PyLocalBaseMeta): - """Metaclass for local property classes.""" + def get_ancestors_by_name(self, instance, owner: type | None = None): + instance = self if instance is None else instance + parent = None + if getattr(instance, "_parent", None): + if instance._parent.__class__.__name__ == owner: + return instance._parent + if getattr(instance._parent, "PLURAL", None) == owner: + return instance._parent._parent + parent = self.get_ancestors_by_name(owner, instance._parent) + return parent - @classmethod - def __create_init(cls): - def wrapper(self, parent, api_helper, name=""): - """Create the initialization method for 'PyLocalPropertyMeta'.""" - self._name = name - self._api_helper = api_helper(self) - self._parent = parent - self._on_change_cbs = [] - annotations = self.__class__.__dict__.get("__annotations__") - if isinstance(getattr(self.__class__, "value", None), property): - value_annotation = annotations.get("_value") - else: - value_annotation = annotations.get("value") - self.type = value_annotation - reset_on_change = ( - hasattr(self, "_reset_on_change") - and getattr(self, "_reset_on_change")() - ) + def get_root(self, instance) -> "PyLocalBase": + instance = self if instance is None else instance + parent = instance + if getattr(instance, "_parent", None): + parent = self.get_root(instance._parent) + return parent - on_change = getattr(self, "on_change", None) - if on_change is not None: - self._register_on_change_cb(on_change) - if reset_on_change: - for obj in reset_on_change: + def get_session(self, instance) -> Solver: + root = self.get_root(instance) + return root.session - def reset(): - setattr(self, "_value", None) - for on_change_cb in self._on_change_cbs: - on_change_cb() + def get_session_handle(self, instance): + root = self.get_root(instance) + return getattr(root, "session_handle", None) - obj._register_on_change_cb(reset) + def get_path(self) -> str: + if getattr(self, "_parent", None): + return self._parent.get_path() + "/" + self._name + return self._name - return wrapper + def __init_subclass__(cls) -> None: + if "get_path" not in attrs: + attrs["get_path"] = cls.__create_get_path() + return super().__init_subclass__() - @classmethod - def __create_get_state(cls, show_attributes=False): - def wrapper(self): - rv = self.value + @property + def root(self) -> "PyLocalBase": + """Top-most parent object.""" + return self.get_root(self) - if hasattr(self, "allowed_values"): - allowed_values = self.allowed_values - if len(allowed_values) > 0 and ( - rv is None - or (not isinstance(rv, list) and rv not in allowed_values) - ): - self.set_state(allowed_values[0]) - rv = self.value + @property + def path(self) -> str: + """Path to the current object.""" + return self.get_path() - return rv + @property + def session(self) -> "Solver": + """Session associated with the current object.""" + return self.get_session(self) - return wrapper + @property + def field_data(self) -> "LiveFieldData": + """Field data associated with the current object.""" + return self.session.fields.field_data - @classmethod - def __create_set_state(cls): - def wrapper(self, value): - self.value = value - for on_change_cb in self._on_change_cbs: - on_change_cb() + @property + def monitors(self) -> "MonitorsManager": + """Monitors associated with the current object.""" + return self.session.monitors - return wrapper + @property + def session_handle(self): + """Session handle associated with the current object.""" + return self.get_session_handle(self) - @classmethod - def __create_register_on_change(cls): - def wrapper(self, on_change_cb): - self._on_change_cbs.append(on_change_cb) - return wrapper +class PyLocalProperty(PyLocalBase, Generic[T]): + """Local property classes.""" - def __new__(cls, name:str, bases: tuple[type, ...], attrs: dict[str, Any]): - attrs["__init__"] = cls.__create_init() - attrs["__call__"] = cls.__create_get_state() - attrs["_register_on_change_cb"] = cls.__create_register_on_change() - attrs["set_state"] = cls.__create_set_state() - return super().__new__(cls, name, bases, attrs) + value: T # pyright: ignore[reportUninitializedInstanceVariable] + def __init__(self, parent, api_helper: Callable[[Self], APIHelper], name: str = ""): + self._name = name + self._api_helper = api_helper(self) + self._parent = parent + self._on_change_cbs = [] + self.type = get_args(get_original_bases(self.__class__)[0])[ + 0 + ] # T for the class + reset_on_change = ( + hasattr(self, "_reset_on_change") and getattr(self, "_reset_on_change")() + ) -class PyReferenceObjectMeta(PyLocalBaseMeta): - """Metaclass for local object classes.""" - - @classmethod - def __create_init(cls): - def wrapper(self, parent, path, location, session_id, name=""): - """Create the initialization method for 'PyReferenceObjectMeta'.""" - self._parent = parent - self.type = "object" - self.parent = parent - self._path = path - self.location = location - self.session_id = session_id - - def update(clss): - for name, cls in clss.__dict__.items(): - if cls.__class__.__name__ in ( - "PyLocalPropertyMeta", - "PyLocalObjectMeta", - ): - setattr( - self, - name, - cls(self, lambda arg: None, name), - ) - if ( - cls.__class__.__name__ == "PyLocalNamedObjectMeta" - or cls.__class__.__name__ == "PyLocalNamedObjectMetaAbstract" - ): - setattr( - self, - cls.PLURAL, - PyLocalContainer(self, cls, lambda arg: None, cls.PLURAL), - ) - for base_class in clss.__bases__: - update(base_class) - - update(self.__class__) - - return wrapper - - @classmethod - def __create_get_path(cls): - def wrapper(self): - return self._path - - return wrapper - - @classmethod - def __create_reset(cls): - def wrapper(self, path, location, session_id): - self._path = path - self.location = location - self.session_id = session_id - if hasattr(self, "_object"): - delattr(self, "_object") - - return wrapper - - @classmethod - def __create_getattr(cls): - def wrapper(self, item): - if item == "_object": - top_most_parent = self.get_root(self) - - if self.session_id is None: - self.session_id = top_most_parent.session.id - property_editor_data = top_most_parent.accessor( - "AnsysUser", self.session_id - ) - ( - obj, - cmd_data, - ) = property_editor_data.get_object_and_command_data_from_properties_info( # noqa: E501 - {"path": self.path, "properties": {}, "type": self.location} - ) - if obj is not None: - self._object = obj - return obj - if item == "ref": - return self._object._object + try: + on_change = self.on_change + except AttributeError: + pass + else: + self._register_on_change_cb(on_change) + if reset_on_change: + for obj in reset_on_change: - return wrapper + def reset() -> None: + setattr(self, "_value", None) + for on_change_cb in self._on_change_cbs: + on_change_cb() - def __new__(cls, name, bases, attrs): - attrs["__init__"] = attrs.get("__init__", cls.__create_init()) - attrs["__getattr__"] = attrs.get("__getattr__", cls.__create_getattr()) - attrs["reset"] = cls.__create_reset() - attrs["get_path"] = cls.__create_get_path() - return super().__new__(cls, name, bases, attrs) + obj._register_on_change_cb(reset) + def __call__(self) -> T | None: + rv = self.value -class PyLocalObjectMeta(PyLocalBaseMeta): - """Metaclass for local object classes.""" - - @classmethod - def __create_init(cls): - def wrapper(self, parent, api_helper, name=""): - """Create the initialization method for 'PyLocalObjectMeta'.""" - self._parent = parent - self._name = name - self._api_helper = api_helper(self) - self._command_names = [] - self.type = "object" - - def update(clss): - for name, cls in clss.__dict__.items(): - if cls.__class__.__name__ in ("PyLocalCommandMeta"): - self._command_names.append(name) - - if cls.__class__.__name__ in ( - "PyLocalPropertyMeta", - "PyLocalObjectMeta", - "PyLocalCommandMeta", - ): - setattr( - self, - name, - cls(self, api_helper, name), - ) - if ( - cls.__class__.__name__ == "PyLocalNamedObjectMeta" - or cls.__class__.__name__ == "PyLocalNamedObjectMetaAbstract" - ): - setattr( - self, - cls.PLURAL, - PyLocalContainer(self, cls, api_helper, cls.PLURAL), - ) - if cls.__class__.__name__ == "PyReferenceObjectMeta": - setattr( - self, - name, - cls(self, cls.PATH, cls.LOCATION, cls.SESSION, name), - ) - for base_class in clss.__bases__: - update(base_class) - - update(self.__class__) - - return wrapper - - @classmethod - def __create_getattribute(cls): - def wrapper(self, name: str): - obj = object.__getattribute__(self, name) - return obj - - return wrapper - - @classmethod - def __create_updateitem(cls): - def wrapper(self, value): - properties = value - sort_by = None - if hasattr(self, "sort_by"): - sort_by = self.sort_by - elif hasattr(self, "include"): - sort_by = self.include - if sort_by: - sorted_properties = { - prop: properties[prop] for prop in sort_by if prop in properties - } - sorted_properties.update( - {k: v for k, v in properties.items() if k not in sort_by} - ) - properties.clear() - properties.update(sorted_properties) - for name, val in properties.items(): - obj = getattr(self, name) - if obj.__class__.__class__.__name__ == "PyLocalPropertyMeta": - obj.set_state(val) - else: - if obj.__class__.__class__.__name__ == "PyReferenceObjectMeta": - obj = obj.ref - obj.update(val) + if allowed_values := cast( + list[T] | None, getattr(self, "allowed_values", None) + ): + if len(allowed_values) > 0 and ( + rv is None or (not isinstance(rv, list) and rv not in allowed_values) + ): + self.set_state(allowed_values[0]) + rv = self.value - wrapper.__doc__ = "Update object." - return wrapper + return rv - @classmethod - def __create_get_state(cls): - def wrapper(self, show_attributes=False): - state = {} + def set_state(self, value: T): + self.value = value + for on_change_cb in self._on_change_cbs: + on_change_cb() - if not getattr(self, "is_active", True): - return + def _register_on_change_cb(self, on_change_cb: Callable[[], None]): + self._on_change_cbs.append(on_change_cb) - def update_state(clss): - for name, cls in clss.__dict__.items(): - o = getattr(self, name) - if o is None or name.startswith("_") or name.startswith("__"): - continue + @Attribute + def allowed_values(self) -> list[T]: + """Get allowed values.""" + raise NotImplementedError("allowed_values not implemented.") - if cls.__class__.__name__ == "PyReferenceObjectMeta": - if o.LOCATION == "local": - o = o.ref - else: - continue - elif cls.__class__.__name__ == "PyLocalCommandMeta": - args = {} - for arg in o._args: - args[arg] = getattr(o, arg)() - state[name] = args - if ( - cls.__class__.__name__ == "PyLocalObjectMeta" - or cls.__class__.__name__ == "PyReferenceObjectMeta" - ): - if getattr(o, "is_active", True): - state[name] = o(show_attributes) - elif ( - cls.__class__.__name__ == "PyLocalNamedObjectMeta" - or cls.__class__.__name__ == "PyLocalNamedObjectMetaAbstract" - ): - container = getattr(self, cls.PLURAL) - if getattr(container, "is_active", True): - state[cls.PLURAL] = {} - for child_name in container: - o = container[child_name] - if getattr(o, "is_active", True): - state[cls.PLURAL][child_name] = o() - - elif cls.__class__.__name__ == "PyLocalPropertyMeta": - if getattr(o, "is_active", True): - state[name] = o() - attrs = show_attributes and getattr(o, "attributes", None) - if attrs: - for attr in attrs: - state[name + "." + attr] = getattr(o, attr) - - for base_class in clss.__bases__: - update_state(base_class) - - update_state(self.__class__) - return state - - return wrapper - - @classmethod - def __create_setattr(cls): - def wrapper(self, name, value): - attr = getattr(self, name, None) - if attr and attr.__class__.__class__.__name__ == "PyLocalPropertyMeta": - attr.set_state(value) - else: - object.__setattr__(self, name, value) - return wrapper +class PyReferenceObject: + """Local object classes.""" - def __new__(cls, name: str, bases: tuple[type, ...], attrs: dict[str, Any]): - attrs["__getattribute__"] = cls.__create_getattribute() - attrs["__init__"] = attrs.get("__init__", cls.__create_init()) - if "__call__" not in attrs: - attrs["__call__"] = cls.__create_get_state() - attrs["__setattr__"] = cls.__create_setattr() - attrs["update"] = cls.__create_updateitem() - return super().__new__(cls, name, bases, attrs) + def __init__(self, parent, path, location, session_id, name=""): + self._parent = parent + self.type = "object" + self.parent = parent + self._path = path + self.location = location + self.session_id = session_id + + def update(clss): + for name, cls in clss.__dict__.items(): + if cls.__class__.__name__ in ( + "PyLocalPropertyMeta", + "PyLocalObjectMeta", + ): + setattr( + self, + name, + cls(self, lambda arg: None, name), + ) + if cls.__class__.__name__ in { + "PyLocalNamedObjectMeta", + "PyLocalNamedObjectMetaAbstract", + }: + setattr( + self, + cls.PLURAL, + PyLocalContainer(self, cls, lambda arg: None, cls.PLURAL), + ) + for base_class in clss.__bases__: + update(base_class) + + update(self.__class__) + + def get_path(self): + return self._path + + def reset(self, path: str, location: str, session_id: str) -> None: + self._path = path + self.location = location + self.session_id = session_id + if hasattr(self, "_object"): + delattr(self, "_object") + + +class PyLocalObject(PyLocalBase): + """Local object classes.""" + + def __init__(self, parent, api_helper: Callable[[Self], APIHelper], name: str = ""): + """Create the initialization method for 'PyLocalObjectMeta'.""" + self._parent = parent + self._name = name + self._api_helper = api_helper(self) + self._command_names = [] + self.type = "object" + + def update(clss: type[PyLocalBase]): + for name, cls in clss.__dict__.items(): + if cls.__class__.__name__ in {"PyLocalCommandMeta"}: + self._command_names.append(name) + + if cls.__class__.__name__ in { + "PyLocalPropertyMeta", + "PyLocalObjectMeta", + "PyLocalCommandMeta", + }: + setattr( + self, + name, + cls(self, api_helper, name), + ) + if cls.__class__.__name__ in { + "PyLocalNamedObjectMeta", + "PyLocalNamedObjectMetaAbstract", + }: + setattr( + self, + cls.PLURAL, + PyLocalContainer(self, cls, api_helper, cls.PLURAL), + ) + if cls.__class__.__name__ == "PyReferenceObjectMeta": + setattr( + self, + name, + cls(self, cls.PATH, cls.LOCATION, cls.SESSION, name), + ) + for base_class in clss.__bases__: + update(base_class) + + update(self.__class__) + + __getattribute__ = object.__getattribute__ + + def update(self, value): + """Update object.""" + properties = value + sort_by = None + if hasattr(self, "sort_by"): + sort_by = self.sort_by + elif hasattr(self, "include"): + sort_by = self.include + if sort_by: + sorted_properties = { + prop: properties[prop] for prop in sort_by if prop in properties + } + sorted_properties.update( + {k: v for k, v in properties.items() if k not in sort_by} + ) + properties.clear() + properties.update(sorted_properties) + for name, val in properties.items(): + obj = getattr(self, name) + if obj.__class__.__class__.__name__ == "PyLocalPropertyMeta": + obj.set_state(val) + else: + if obj.__class__.__class__.__name__ == "PyReferenceObjectMeta": + obj = obj.ref + obj.update(val) + + def get_state(self, show_attributes: bool = False) -> dict[str, Any] | None: + state: dict[str, Any] = {} + + if not getattr(self, "is_active", True): + return + + def update_state(clss): + for name, cls in clss.__dict__.items(): + o = getattr(self, name) + if o is None or name.startswith("_") or name.startswith("__"): + continue + + if cls.__class__.__name__ == "PyReferenceObjectMeta": + if o.LOCATION == "local": + o = o.ref + else: + continue + elif cls.__class__.__name__ == "PyLocalCommandMeta": + args = {} + for arg in o._args: + args[arg] = getattr(o, arg)() + state[name] = args + if ( + cls.__class__.__name__ == "PyLocalObjectMeta" + or cls.__class__.__name__ == "PyReferenceObjectMeta" + ): + if getattr(o, "is_active", True): + state[name] = o(show_attributes) + elif ( + cls.__class__.__name__ == "PyLocalNamedObjectMeta" + or cls.__class__.__name__ == "PyLocalNamedObjectMetaAbstract" + ): + container = getattr(self, cls.PLURAL) + if getattr(container, "is_active", True): + state[cls.PLURAL] = {} + for child_name in container: + o = container[child_name] + if getattr(o, "is_active", True): + state[cls.PLURAL][child_name] = o() + + elif cls.__class__.__name__ == "PyLocalPropertyMeta": + if getattr(o, "is_active", True): + state[name] = o() + attrs = show_attributes and getattr(o, "attributes", None) + if attrs: + for attr in attrs: + state[name + "." + attr] = getattr(o, attr) + + for base_class in clss.__bases__: + update_state(base_class) + + update_state(self.__class__) + return state + + __call__ = get_state + + def __setattr__(self, name: str, value: Any): + attr = getattr(self, name, None) + if attr and attr.__class__.__class__.__name__ == "PyLocalPropertyMeta": + attr.set_state(value) + else: + object.__setattr__(self, name, value) -class PyLocalCommandMeta(PyLocalObjectMeta): +class PyLocalCommand(PyLocalObject): """Local object metaclass.""" - @classmethod - def __create_init(cls): - def wrapper(self, parent, api_helper, name=""): - """Create the initialization method for 'PyLocalObjectMeta'.""" - self._parent = parent - self._name = name - self._api_helper = api_helper(self) - self.type = "object" - self._args = [] - self._command_names = [] - self._exe_cmd = getattr(self, "_exe_cmd") - - def update(clss): - for name, cls in clss.__dict__.items(): - if cls.__class__.__name__ in ( - "PyLocalCommandArgMeta", - "PyLocalPropertyMeta", - ): - self._args.append(name) - setattr( - self, - name, - cls(self, api_helper, name), - ) - for base_class in clss.__bases__: - update(base_class) - - update(self.__class__) - - return wrapper - - @classmethod - def __execute_command(cls): - def wrapper(self, **kwargs): - for arg_name, arg_value in kwargs.items(): - getattr(self, arg_name).set_state(arg_value) - cmd_args = {} - for arg_name in self._args: - cmd_args[arg_name] = getattr(self, arg_name)() - rv = self._exe_cmd(**cmd_args) - return rv - - return wrapper + def __init__(self, parent, api_helper: Callable[[Self], APIHelper], name=""): + self._parent = parent + self._name = name + self._api_helper = api_helper(self) + self.type = "object" + self._args = [] + self._command_names = [] + self._exe_cmd = getattr(self, "_exe_cmd") + + def update(clss): + for name, cls in clss.__dict__.items(): + if cls.__class__.__name__ in ( + "PyLocalCommandArgMeta", + "PyLocalPropertyMeta", + ): + self._args.append(name) + setattr( + self, + name, + cls(self, api_helper, name), + ) + for base_class in clss.__bases__: + update(base_class) + + update(self.__class__) + + def __call__(self, **kwargs): + for arg_name, arg_value in kwargs.items(): + getattr(self, arg_name).set_state(arg_value) + cmd_args = {} + for arg_name in self._args: + cmd_args[arg_name] = getattr(self, arg_name)() + return self._exe_cmd(**cmd_args) def __new__(cls, name, bases, attrs): attrs["__init__"] = cls.__create_init() @@ -704,80 +600,79 @@ def __new__(cls, name, bases, attrs): return super().__new__(cls, name, bases, attrs) -class PyLocalNamedObjectMeta(PyLocalObjectMeta): +class PyLocalNamedObject(PyLocalObject): """Metaclass for local named object classes.""" - @classmethod - def __create_init(cls): - def wrapper(self, name, parent, api_helper): - """Create the initialization method for 'PyLocalNamedObjectMeta'.""" - self._name = name - self._api_helper = api_helper(self) - self._parent = parent - self._command_names = [] - self.type = "object" - - def update(clss): - for name, cls in clss.__dict__.items(): - if cls.__class__.__name__ in ("PyLocalCommandMeta"): - self._command_names.append(name) - - if cls.__class__.__name__ in ( - "PyLocalPropertyMeta", - "PyLocalObjectMeta", - "PyLocalCommandMeta", - ): - # delete old property if overridden - if getattr(self, name).__class__.__name__ == name: - delattr(self, name) - setattr( - self, - name, - cls(self, api_helper, name), - ) - elif ( - cls.__class__.__name__ == "PyLocalNamedObjectMeta" - or cls.__class__.__name__ == "PyLocalNamedObjectMetaAbstract" - ): - setattr( - self, - cls.PLURAL, - PyLocalContainer(self, cls, api_helper, cls.PLURAL), - ) - elif cls.__class__.__name__ == "PyReferenceObjectMeta": - setattr( - self, name, cls(self, cls.PATH, cls.LOCATION, cls.SESSION) - ) - for base_class in clss.__bases__: - update(base_class) - - update(self.__class__) - - return wrapper + def __init__(self, name: str, parent, api_helper: Callable[[Self], APIHelper]): + self._name = name + self._api_helper = api_helper(self) + self._parent = parent + self._command_names = [] + self.type = "object" - def __new__(cls, name, bases, attrs): - attrs["__init__"] = cls.__create_init() - return super().__new__(cls, name, bases, attrs) + def update(clss): + for name, cls in clss.__dict__.items(): + if cls.__class__.__name__ in ("PyLocalCommandMeta"): + self._command_names.append(name) + if cls.__class__.__name__ in ( + "PyLocalPropertyMeta", + "PyLocalObjectMeta", + "PyLocalCommandMeta", + ): + # delete old property if overridden + if getattr(self, name).__class__.__name__ == name: + delattr(self, name) + setattr( + self, + name, + cls(self, api_helper, name), + ) + elif ( + cls.__class__.__name__ == "PyLocalNamedObjectMeta" + or cls.__class__.__name__ == "PyLocalNamedObjectMetaAbstract" + ): + setattr( + self, + cls.PLURAL, + PyLocalContainer(self, cls, api_helper, cls.PLURAL), + ) + elif cls.__class__.__name__ == "PyReferenceObjectMeta": + setattr(self, name, cls(self, cls.PATH, cls.LOCATION, cls.SESSION)) + for base_class in clss.__bases__: + update(base_class) + + update(self.__class__) + + if TYPE_CHECKING: + + def create(cls) -> Self: ... -class PyLocalNamedObjectMetaAbstract(ABCMeta, PyLocalNamedObjectMeta): - """Local named object abstract metaclass.""" + +class PyLocalNamedObjectAbstract(ABC, PyLocalNamedObject): + """Local named object abstract class.""" pass -T = TypeVar("T") +DefnT = TypeVar("T", bound=GraphicsDefn | PlotDefn, default=GraphicsDefn | PlotDefn) -class PyLocalContainer(MutableMapping[str, T]): +class PyLocalContainer(MutableMapping[str, DefnT]): """Local container for named objects.""" - def __init__(self, parent: "Container", object_class: type[T], api_helper, name: str = ""): + def __init__( + self, + parent: "Container", + object_class: type[DefnT], + api_helper: Callable[[Self], APIHelper], + name: str = "", + ): """Initialize the 'PyLocalContainer' object.""" self._parent = parent self._name = name self.__object_class = object_class - self._local_collection = {} + self._local_collection: dict[str, DefnT] = {} self.__api_helper = api_helper self.type = "named-object" self._command_names = [] @@ -822,12 +717,6 @@ def __init__(self, parent: "Container", object_class: type[T], api_helper, name: cls(self, api_helper, name), ) - def update(self, value) -> None: - """Updates this object with the provided dictionary.""" - for name, val in value.items(): - o = self[name] - o.update(val) - def get_root(self, obj=None): """Returns the top-most parent object.""" obj = self if obj is None else obj @@ -836,7 +725,7 @@ def get_root(self, obj=None): parent = self.get_root(obj._parent) return parent - def get_session(self, obj=None): + def get_session(self, obj=None) -> "Solver": """Returns the session object.""" root = self.get_root(obj) return root.session @@ -853,7 +742,7 @@ def path(self) -> str: return self.get_path() @property - def session(self): + def session(self) -> "Solver": """Returns the session object.""" return self.get_session() @@ -867,30 +756,35 @@ def session_handle(self): """Returns the session-handle object.""" return self.get_session_handle() - def __iter__(self): + @override + def __iter__(self) -> Iterator[str]: return iter(self._local_collection) + @override def __len__(self) -> int: return len(self._local_collection) - def __getitem__(self, name): + @override + def __getitem__(self, name: str) -> DefnT: o = self._local_collection.get(name, None) if not o: o = self._local_collection[name] = self.__object_class( name, self, self.__api_helper ) - on_create = getattr(self._PyLocalContainer__object_class, "on_create", None) + on_create = getattr(self.__object_class, "on_create", None) if on_create: on_create(self, name) return o - def __setitem__(self, name, value) -> None: + @override + def __setitem__(self, name: str, value: DefnT) -> None: o = self[name] o.update(value) - def __delitem__(self, name) -> None: + @override + def __delitem__(self, name: str) -> None: del self._local_collection[name] - on_delete = getattr(self._PyLocalContainer__object_class, "on_delete", None) + on_delete = getattr(self.__object_class, "on_delete", None) if on_delete: on_delete(self, name) @@ -898,22 +792,20 @@ def _get_unique_chid_name(self) -> str: children = list(self) index = 0 while True: - unique_name = ( - f"{self._PyLocalContainer__object_class.__name__.lower()}-{index}" - ) + unique_name = f"{self.__object_class.__name__.lower()}-{index}" if unique_name not in children: break index += 1 return unique_name - class Delete(metaclass=PyLocalCommandMeta): + class Delete(PyLocalCommand): """Local delete command.""" - def _exe_cmd(self, names) -> None: + def _exe_cmd(self, names: list[str]) -> None: for item in names: self._parent.__delitem__(item) - class names(metaclass=PyLocalPropertyMeta): + class names(PyLocalProperty[list[str]]): """Local names property.""" value: list[str] = [] @@ -923,7 +815,7 @@ def allowed_values(self): """Get allowed values.""" return list(self._parent._parent) - class Create(metaclass=PyLocalCommandMeta): + class Create(PyLocalCommand): """Local create command.""" def _exe_cmd(self, name=None): @@ -932,7 +824,11 @@ def _exe_cmd(self, name=None): new_object = self._parent.__getitem__(name) return new_object._name - class name(metaclass=PyLocalPropertyMeta): + class name(PyLocalProperty[str | None]): """Local name property.""" - value: str = None + value = None + + # added by __init__ + delete: Delete + create: Create diff --git a/src/ansys/fluent/interface/post_objects/post_object_definitions.py b/src/ansys/fluent/interface/post_objects/post_object_definitions.py index 16d638ea..b1c2d135 100644 --- a/src/ansys/fluent/interface/post_objects/post_object_definitions.py +++ b/src/ansys/fluent/interface/post_objects/post_object_definitions.py @@ -22,23 +22,36 @@ """Module providing visualization objects definition.""" -from abc import abstractmethod +import abc import logging -from typing import NamedTuple +from abc import abstractmethod +from typing import TYPE_CHECKING, Literal, NamedTuple from ansys.fluent.interface.post_objects.meta import ( Attribute, - PyLocalNamedObjectMetaAbstract, + PyLocalNamedObjectAbstract, PyLocalObjectMeta, + PyLocalProperty, PyLocalPropertyMeta, ) +if TYPE_CHECKING: + from ansys.fluent.interface.post_objects.post_objects_container import Container + logger = logging.getLogger("pyfluent.post_objects") -class BasePostObjectDefn: +class BasePostObjectDefn(abc.ABC): """Base class for visualization objects.""" + @abc.abstractmethod + def get_root(self) -> Container: + raise NotImplementedError + + @abc.abstractmethod + def surfaces(self) -> list[str]: + raise NotImplementedError + def _pre_display(self): local_surfaces_provider = self.get_root()._local_surfaces_provider() for surf_name in self.surfaces(): @@ -56,7 +69,7 @@ def _post_display(self): surf_api.delete_surface_on_server() -class GraphicsDefn(BasePostObjectDefn, metaclass=PyLocalNamedObjectMetaAbstract): +class GraphicsDefn(BasePostObjectDefn, PyLocalNamedObjectAbstract): """Abstract base class for graphics objects.""" @abstractmethod @@ -71,7 +84,7 @@ def display(self, window_id: str | None = None): pass -class PlotDefn(BasePostObjectDefn, metaclass=PyLocalNamedObjectMetaAbstract): +class PlotDefn(BasePostObjectDefn, metaclass=PyLocalNamedObjectAbstract): """Abstract base class for plot objects.""" @abstractmethod @@ -99,7 +112,7 @@ class MonitorDefn(PlotDefn): PLURAL = "Monitors" - class monitor_set_name(metaclass=PyLocalPropertyMeta): + class monitor_set_name(PyLocalProperty): """Monitor set name.""" value: str = None @@ -115,22 +128,22 @@ class XYPlotDefn(PlotDefn): PLURAL = "XYPlots" - class node_values(metaclass=PyLocalPropertyMeta): + class node_values(PyLocalProperty): """Plot nodal values.""" value: bool = True - class boundary_values(metaclass=PyLocalPropertyMeta): + class boundary_values(PyLocalProperty): """Plot Boundary values.""" value: bool = True - class direction_vector(metaclass=PyLocalPropertyMeta): + class direction_vector(PyLocalProperty): """Direction Vector.""" value: Vector = [1, 0, 0] - class y_axis_function(metaclass=PyLocalPropertyMeta): + class y_axis_function(PyLocalProperty): """Y Axis Function.""" value: str = None @@ -140,7 +153,7 @@ def allowed_values(self): """Y axis function allowed values.""" return list(self.field_data.scalar_fields()) - class x_axis_function(metaclass=PyLocalPropertyMeta): + class x_axis_function(PyLocalProperty): """X Axis Function.""" value: str = "direction-vector" @@ -150,7 +163,7 @@ def allowed_values(self) -> list[str]: """X axis function allowed values.""" return ["direction-vector"] - class surfaces(metaclass=PyLocalPropertyMeta): + class surfaces(PyLocalProperty): """List of surfaces for plotting.""" value: list[str] = [] @@ -168,7 +181,7 @@ class MeshDefn(GraphicsDefn): PLURAL = "Meshes" - class surfaces(metaclass=PyLocalPropertyMeta): + class surfaces(PyLocalProperty): """List of surfaces for mesh graphics.""" value: list[str] = [] @@ -180,17 +193,17 @@ def allowed_values(self): self.get_root()._local_surfaces_provider() ) - class show_edges(metaclass=PyLocalPropertyMeta): + class show_edges(PyLocalProperty): """Show edges for mesh.""" value: bool = False - class show_nodes(metaclass=PyLocalPropertyMeta): + class show_nodes(PyLocalProperty): """Show nodes for mesh.""" value: bool = False - class show_faces(metaclass=PyLocalPropertyMeta): + class show_faces(PyLocalProperty): """Show faces for mesh.""" value: bool = True @@ -201,7 +214,7 @@ class PathlinesDefn(GraphicsDefn): PLURAL = "Pathlines" - class field(metaclass=PyLocalPropertyMeta): + class field(PyLocalProperty): """Pathlines field.""" value: str = None @@ -211,7 +224,7 @@ def allowed_values(self): """Field allowed values.""" return list(self.field_data.scalar_fields()) - class surfaces(metaclass=PyLocalPropertyMeta): + class surfaces(PyLocalProperty): """List of surfaces for pathlines.""" value: list[str] = [] @@ -234,7 +247,7 @@ def name(self) -> str: """Return name of the surface.""" return self._name - class show_edges(metaclass=PyLocalPropertyMeta): + class show_edges(PyLocalProperty[bool]): """Show edges for surface.""" value: bool = True @@ -242,10 +255,10 @@ class show_edges(metaclass=PyLocalPropertyMeta): class definition(metaclass=PyLocalObjectMeta): """Specify surface definition type.""" - class type(metaclass=PyLocalPropertyMeta): + class type(PyLocalProperty[Literal["plane-surface", "iso-surface"]]): """Surface type.""" - value: str = "iso-surface" + value = "iso-surface" @Attribute def allowed_values(self): @@ -260,7 +273,7 @@ def is_active(self): """Check whether current object is active or not.""" return self._parent.type() == "plane-surface" - class creation_method(metaclass=PyLocalPropertyMeta): + class creation_method(PyLocalProperty): """Creation Method.""" value: str = "xy-plane" @@ -278,7 +291,7 @@ def is_active(self): """Check whether current object is active or not.""" return self._parent.creation_method() == "point-and-normal" - class x(metaclass=PyLocalPropertyMeta): + class x(PyLocalProperty): """X value.""" value: float = 0 @@ -288,7 +301,7 @@ def range(self): """X value range.""" return self.field_data.scalar_fields.range("x-coordinate", True) - class y(metaclass=PyLocalPropertyMeta): + class y(PyLocalProperty): """Y value.""" value: float = 0 @@ -298,7 +311,7 @@ def range(self): """Y value range.""" return self.field_data.scalar_fields.range("y-coordinate", True) - class z(metaclass=PyLocalPropertyMeta): + class z(PyLocalProperty): """Z value.""" value: float = 0 @@ -316,7 +329,7 @@ def is_active(self): """Check whether current object is active or not.""" return self._parent.creation_method() == "point-and-normal" - class x(metaclass=PyLocalPropertyMeta): + class x(PyLocalProperty): """X value.""" value: float = 0 @@ -326,7 +339,7 @@ def range(self): """X value range.""" return [-1, 1] - class y(metaclass=PyLocalPropertyMeta): + class y(PyLocalProperty): """Y value.""" value: float = 0 @@ -336,7 +349,7 @@ def range(self): """Y value range.""" return [-1, 1] - class z(metaclass=PyLocalPropertyMeta): + class z(PyLocalProperty): """Z value.""" value: float = 0 @@ -354,7 +367,7 @@ def is_active(self): """Check whether current object is active or not.""" return self._parent.creation_method() == "xy-plane" - class z(metaclass=PyLocalPropertyMeta): + class z(PyLocalProperty): """Z value.""" value: float = 0 @@ -372,7 +385,7 @@ def is_active(self): """Check whether current object is active or not.""" return self._parent.creation_method() == "yz-plane" - class x(metaclass=PyLocalPropertyMeta): + class x(PyLocalProperty): """X value.""" value: float = 0 @@ -390,7 +403,7 @@ def is_active(self): """Check whether current object is active or not.""" return self._parent.creation_method() == "zx-plane" - class y(metaclass=PyLocalPropertyMeta): + class y(PyLocalProperty): """Y value.""" value: float = 0 @@ -408,7 +421,7 @@ def is_active(self): """Check whether current object is active or not.""" return self._parent.type() == "iso-surface" - class field(metaclass=PyLocalPropertyMeta): + class field(PyLocalProperty): """Iso surface field.""" value: str = None @@ -418,7 +431,7 @@ def allowed_values(self): """Field allowed values.""" return list(self.field_data.scalar_fields()) - class rendering(metaclass=PyLocalPropertyMeta): + class rendering(PyLocalProperty): """Iso surface rendering.""" value: str = "mesh" @@ -428,7 +441,7 @@ def allowed_values(self): """Surface rendering allowed values.""" return ["mesh", "contour"] - class iso_value(metaclass=PyLocalPropertyMeta): + class iso_value(PyLocalProperty): """Iso value for field.""" _value: float = None @@ -461,7 +474,7 @@ class ContourDefn(GraphicsDefn): PLURAL = "Contours" - class field(metaclass=PyLocalPropertyMeta): + class field(PyLocalProperty): """Contour field.""" value: str = None @@ -471,7 +484,7 @@ def allowed_values(self): """Field allowed values.""" return list(self.field_data.scalar_fields()) - class surfaces(metaclass=PyLocalPropertyMeta): + class surfaces(PyLocalProperty): """Contour surfaces.""" value: list[str] = [] @@ -483,12 +496,12 @@ def allowed_values(self): self.get_root()._local_surfaces_provider() ) - class filled(metaclass=PyLocalPropertyMeta): + class filled(PyLocalProperty): """Draw filled contour.""" value: bool = True - class node_values(metaclass=PyLocalPropertyMeta): + class node_values(PyLocalProperty): """Draw nodal data.""" _value: bool = True @@ -522,17 +535,17 @@ def value(self, value): ) self._value = value - class boundary_values(metaclass=PyLocalPropertyMeta): + class boundary_values(PyLocalProperty): """Draw boundary values.""" value: bool = False - class contour_lines(metaclass=PyLocalPropertyMeta): + class contour_lines(PyLocalProperty): """Draw contour lines.""" value: bool = False - class show_edges(metaclass=PyLocalPropertyMeta): + class show_edges(PyLocalProperty): """Show edges.""" value: bool = False @@ -540,7 +553,7 @@ class show_edges(metaclass=PyLocalPropertyMeta): class range(metaclass=PyLocalObjectMeta): """Range definition.""" - class option(metaclass=PyLocalPropertyMeta): + class option(PyLocalProperty): """Range option.""" value: str = "auto-range-on" @@ -558,7 +571,7 @@ def is_active(self): """Check whether current object is active or not.""" return self._parent.option() == "auto-range-on" - class global_range(metaclass=PyLocalPropertyMeta): + class global_range(PyLocalProperty): """Show global range.""" value: bool = False @@ -571,12 +584,12 @@ def is_active(self): """Check whether current object is active or not.""" return self._parent.option() == "auto-range-off" - class clip_to_range(metaclass=PyLocalPropertyMeta): + class clip_to_range(PyLocalProperty): """Clip contour within range.""" value: bool = False - class minimum(metaclass=PyLocalPropertyMeta): + class minimum(PyLocalProperty): """Range minimum.""" _value: float = None @@ -605,7 +618,7 @@ def value(self): def value(self, value): self._value = value - class maximum(metaclass=PyLocalPropertyMeta): + class maximum(PyLocalProperty): """Range maximum.""" _value: float = None @@ -641,7 +654,7 @@ class VectorDefn(GraphicsDefn): PLURAL = "Vectors" - class vectors_of(metaclass=PyLocalPropertyMeta): + class vectors_of(PyLocalProperty): """Vector type.""" value: str = "velocity" @@ -651,7 +664,7 @@ def allowed_values(self): """Vectors of allowed values.""" return list(self.field_data.vectors()) - class field(metaclass=PyLocalPropertyMeta): + class field(PyLocalProperty): """Vector color field.""" value: str = None @@ -661,7 +674,7 @@ def allowed_values(self): """Field allowed values.""" return list(self.field_data.scalar_fields()) - class surfaces(metaclass=PyLocalPropertyMeta): + class surfaces(PyLocalProperty): """List of surfaces for vector graphics.""" value: list[str] = [] @@ -673,17 +686,17 @@ def allowed_values(self): self.get_root()._local_surfaces_provider() ) - class scale(metaclass=PyLocalPropertyMeta): + class scale(PyLocalProperty): """Vector scale.""" value: float = 1.0 - class skip(metaclass=PyLocalPropertyMeta): + class skip(PyLocalProperty): """Vector skip.""" value: int = 0 - class show_edges(metaclass=PyLocalPropertyMeta): + class show_edges(PyLocalProperty): """Show edges.""" value: bool = False @@ -691,7 +704,7 @@ class show_edges(metaclass=PyLocalPropertyMeta): class range(metaclass=PyLocalObjectMeta): """Range definition.""" - class option(metaclass=PyLocalPropertyMeta): + class option(PyLocalProperty): """Range option.""" value: str = "auto-range-on" @@ -709,7 +722,7 @@ def is_active(self): """Check whether current object is active or not.""" return self._parent.option() == "auto-range-on" - class global_range(metaclass=PyLocalPropertyMeta): + class global_range(PyLocalProperty): """Show global range.""" value: bool = False @@ -722,12 +735,12 @@ def is_active(self): """Check whether current object is active or not.""" return self._parent.option() == "auto-range-off" - class clip_to_range(metaclass=PyLocalPropertyMeta): + class clip_to_range(PyLocalProperty): """Clip vector within range.""" value: bool = False - class minimum(metaclass=PyLocalPropertyMeta): + class minimum(PyLocalProperty): """Range minimum.""" _value: float = None @@ -748,7 +761,7 @@ def value(self): def value(self, value): self._value = value - class maximum(metaclass=PyLocalPropertyMeta): + class maximum(PyLocalProperty): """Range maximum.""" _value: float = None diff --git a/src/ansys/fluent/interface/post_objects/post_objects_container.py b/src/ansys/fluent/interface/post_objects/post_objects_container.py index 02d34ec7..4527b06c 100644 --- a/src/ansys/fluent/interface/post_objects/post_objects_container.py +++ b/src/ansys/fluent/interface/post_objects/post_objects_container.py @@ -24,7 +24,11 @@ import inspect +from ansys.fluent.core.session import BaseSession + from ansys.fluent.interface.post_objects.meta import PyLocalContainer +from ansys.fluent.visualization import Contour, Plots, Graphics, Surface, Vector +from ansys.fluent.visualization.graphics.graphics_objects import Mesh class Container: @@ -48,8 +52,8 @@ class Container: def __init__( self, - session, - container_type, + session: BaseSession, + container_type: type[Plots | Graphics], module, post_api_helper, local_surfaces_provider=None, @@ -218,6 +222,10 @@ class Graphics(Container): """ _sessions_state = {} + Meshes: PyLocalContainer[Mesh] + Surfaces: PyLocalContainer[Surface] + Contours: PyLocalContainer[Contour] + Vectors: PyLocalContainer[Vector] def __init__(self, session, module, post_api_helper, local_surfaces_provider=None): """__init__ method of Graphics class.""" @@ -225,19 +233,19 @@ def __init__(self, session, module, post_api_helper, local_surfaces_provider=Non session, self.__class__, module, post_api_helper, local_surfaces_provider ) - def add_outline_mesh(self): + def add_outline_mesh(self) -> Mesh | None: """Add a mesh outline. - Parameters - ---------- - None - Returns ------- - None + Mesh | None + The outline mesh object if it exists, otherwise ``None``. """ - meshes = getattr(self, "Meshes", None) - if meshes is not None: + try: + meshes = self.Meshes + except AttributeError: + return + else: outline_mesh_id = "mesh-outline" outline_mesh = meshes[outline_mesh_id] outline_mesh.surfaces = [ diff --git a/src/ansys/fluent/visualization/base/renderer.py b/src/ansys/fluent/visualization/base/renderer.py index 11652a98..bdb3b191 100644 --- a/src/ansys/fluent/visualization/base/renderer.py +++ b/src/ansys/fluent/visualization/base/renderer.py @@ -23,13 +23,24 @@ """Abstract module providing rendering functionality.""" from abc import ABC, abstractmethod +from typing import Any, TypedDict +class SurfaceToRender(TypedDict): + """TypedDict for mesh surface definition.""" + + data: object + position: tuple[int, int] + opacity: float + title: str + kwargs: dict[str, Any] + +SubPlot = list[SurfaceToRender] class AbstractRenderer(ABC): """Abstract class for rendering graphics and plots.""" @abstractmethod - def render(self, meshes: list[list[dict]]) -> None: + def render(self, meshes: list[SubPlot]) -> None: """Render graphics and plots in a window. Parameters @@ -49,7 +60,7 @@ def render(self, meshes: list[list[dict]]) -> None: - 'data': The mesh or 2d plot object to be plotted. - 'position': tuple(int, int), Location of subplot. Defaults to (0, 0). - - 'opacity': int, Sets the transparency of the subplot. Defaults to 1, + - 'opacity': float, Sets the transparency of the subplot. Defaults to 1, meaning fully opaque. - 'title': str, Title of the subplot. - 'kwargs': A dictionary of additional keyword arguments passed diff --git a/src/ansys/fluent/visualization/containers.py b/src/ansys/fluent/visualization/containers.py index a7b5998a..681a1097 100644 --- a/src/ansys/fluent/visualization/containers.py +++ b/src/ansys/fluent/visualization/containers.py @@ -21,6 +21,9 @@ # SOFTWARE. """Containers for graphics.""" + +from typing import TYPE_CHECKING, Any, Self, TypedDict, Unpack +from typing_extensions import override from ansys.fluent.core.field_data_interfaces import _to_field_name_str from ansys.fluent.core.utils.context_managers import _get_active_session from ansys.units import VariableDescriptor @@ -28,27 +31,32 @@ from ansys.fluent.visualization.graphics import Graphics from ansys.fluent.visualization.plotter import Plots +if TYPE_CHECKING: + from ansys.fluent.core.session import BaseSession + class _GraphicsContainer: """Base class for graphics containers.""" - def __init__(self, solver, **kwargs): + def __init__(self, solver: BaseSession | None, **kwargs: Any): self.__dict__["solver"] = solver or _get_active_session() self.__dict__["kwargs"] = kwargs if self.solver is None: raise RuntimeError("No solver session provided and none found in context.") if "field" in self.kwargs: - self.kwargs["field"] = _to_field_name_str(self.kwargs["field"]) + self.kwargs["field"] = kwargs["field"] = _to_field_name_str(self.kwargs["field"]) def __getattr__(self, attr): return getattr(self._obj, attr) + @override def __setattr__(self, attr, value): if attr == "surfaces": value = list(value) setattr(self._obj, attr, value) - def __dir__(self): + @override + def __dir__(self) -> list[str]: return sorted(set(super().__dir__()) | set(dir(self._obj))) @@ -67,13 +75,25 @@ class Mesh(_GraphicsContainer): >>> ) """ - def __init__(self, solver=None, **kwargs): + def __init__(self, solver: BaseSession | None = None, **kwargs: Any): """__init__ method of Mesh class.""" super().__init__(solver, **kwargs) self.__dict__["_obj"] = Graphics(session=self.solver).Meshes.create( **self.kwargs ) +class SurfaceKwargs(TypedDict, total=False): + type: str | None + creation_method: str | None + x: float | None + y: float | None + z: float | None + field: str | VariableDescriptor | None + iso_value: float | None + rendering: str | None + point: tuple[float, float, float] | None + normal: tuple[float, float, float] | None + class Surface(_GraphicsContainer): """Surface. @@ -98,24 +118,23 @@ class Surface(_GraphicsContainer): >>> surf_outlet_plane.field = "y-coordinate" >>> surf_outlet_plane.iso_value = -0.125017 """ + _obj: Any - def __init__(self, solver=None, **kwargs): + def __init__(self, solver:BaseSession | None=None, **kwargs: Unpack[SurfaceKwargs]): """__init__ method of Surface class.""" super().__init__(solver, **kwargs) self.__dict__.update( - dict( - type=self.kwargs.pop("type", None), - creation_method=self.kwargs.pop("creation_method", None), - x=self.kwargs.pop("x", None), - y=self.kwargs.pop("y", None), - z=self.kwargs.pop("z", None), - field=self.kwargs.pop("field", None), - iso_value=self.kwargs.pop("iso_value", None), - rendering=self.kwargs.pop("rendering", None), - point=self.kwargs.pop("point", None), - normal=self.kwargs.pop("normal", None), - _obj=Graphics(session=self.solver).Surfaces.create(**self.kwargs), - ) + type=kwargs.pop("type", None), + creation_method=kwargs.pop("creation_method", None), + x=kwargs.pop("x", None), + y=kwargs.pop("y", None), + z=kwargs.pop("z", None), + field=kwargs.pop("field", None), + iso_value=kwargs.pop("iso_value", None), + rendering=kwargs.pop("rendering", None), + point=kwargs.pop("point", None), + normal=kwargs.pop("normal", None), + _obj=Graphics(session=self.solver).Surfaces.create(**kwargs), ) for attr in [ "type", @@ -133,6 +152,8 @@ def __init__(self, solver=None, **kwargs): if val is not None: setattr(self, attr, val) + type: + def __setattr__(self, attr, value): if attr == "type": self._obj.definition.type = value @@ -169,9 +190,8 @@ def __setattr__(self, attr, value): self._obj.definition.plane_surface.point.y = value[1] self._obj.definition.plane_surface.point.z = value[2] elif attr == "normal": - self._obj.definition.plane_surface.normal.x = value[0] - self._obj.definition.plane_surface.normal.y = value[1] - self._obj.definition.plane_surface.normal.z = value[2] + norm = self._obj.definition.plane_surface.normal + norm.x, norm.y, norm.z = value else: setattr(self._obj, attr, value) @@ -191,17 +211,19 @@ class PlaneSurface(Surface): >>> solver=solver_session, >>> point=[0.0, 0.0, -0.0441921], >>> normal=[0.0, 0.0, 1.0], - >>> ) + >>> ) >>> # Create same plane using 'create_xy_plane' method >>> surf_xy_plane = PlaneSurface.create_xy_plane( >>> solver=solver_session, >>> z=-0.0441921, - >>> ) + >>> ) """ @classmethod - def create_xy_plane(cls, solver=None, z: float = 0.0, **kwargs): + def create_xy_plane( + cls, *, solver: BaseSession | None = None, z: float = 0.0, **kwargs: Any + ) -> Self: """Create a plane surface in the XY plane at a given Z value.""" return cls( solver=solver, @@ -212,7 +234,9 @@ def create_xy_plane(cls, solver=None, z: float = 0.0, **kwargs): ) @classmethod - def create_yz_plane(cls, solver=None, x=0.0, **kwargs): + def create_yz_plane( + cls, solver: BaseSession | None = None, x: float = 0.0, **kwargs: Any + ) -> Self: """Create a plane surface in the YZ plane at a given X value.""" return cls( solver=solver, @@ -223,7 +247,9 @@ def create_yz_plane(cls, solver=None, x=0.0, **kwargs): ) @classmethod - def create_zx_plane(cls, solver=None, y=0.0, **kwargs): + def create_zx_plane( + cls, solver: BaseSession | None = None, y: float = 0.0, **kwargs: Any + ): """Create a plane surface in the ZX plane at a given Y value.""" return cls( solver=solver, @@ -235,13 +261,13 @@ def create_zx_plane(cls, solver=None, y=0.0, **kwargs): @classmethod def create_from_point_and_normal( - cls, solver=None, point=None, normal=None, **kwargs + cls, + solver: BaseSession | None = None, + point: tuple[float, float, float] = (0, 0, 0), + normal: tuple[float, float, float] = (0, 0, 0), + **kwargs: Any, ): """Create a plane surface from a point and a normal vector.""" - if normal is None: - normal = [0.0, 0.0, 0.0] - if point is None: - point = [0.0, 0.0, 0.0] return cls( solver=solver, type="plane-surface", @@ -272,11 +298,11 @@ class IsoSurface(Surface): def __init__( self, - solver=None, + solver: BaseSession| None=None, field: str | VariableDescriptor | None = None, rendering: str | None = None, iso_value: float | None = None, - **kwargs + **kwargs:Any, ): """Create an iso-surface.""" super().__init__( diff --git a/src/ansys/fluent/visualization/graphics/pyvista/renderer.py b/src/ansys/fluent/visualization/graphics/pyvista/renderer.py index 2cd0dc74..efc3021e 100644 --- a/src/ansys/fluent/visualization/graphics/pyvista/renderer.py +++ b/src/ansys/fluent/visualization/graphics/pyvista/renderer.py @@ -44,7 +44,7 @@ def __init__( win_id: str, in_jupyter: bool, non_interactive: bool, - grid: tuple | None = (1, 1), + grid: tuple[int, int] | None = (1, 1), ): self.plotter: BackgroundPlotter | pv.Plotter = ( pv.Plotter(title=f"PyFluent ({win_id})", shape=grid) From 415033001574c984ffad53598263b09495821c8c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 22 Dec 2025 10:37:45 +0000 Subject: [PATCH 04/20] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../post_objects/check_in_notebook.py | 4 ++- .../fluent/interface/post_objects/meta.py | 35 ++++++++++++------- .../post_objects/post_object_definitions.py | 2 +- .../post_objects/post_objects_container.py | 2 +- .../interface/post_objects/singleton_meta.py | 7 ++-- src/ansys/fluent/visualization/__init__.py | 24 ++++++------- .../fluent/visualization/base/renderer.py | 3 ++ src/ansys/fluent/visualization/containers.py | 2 +- 8 files changed, 49 insertions(+), 30 deletions(-) diff --git a/src/ansys/fluent/interface/post_objects/check_in_notebook.py b/src/ansys/fluent/interface/post_objects/check_in_notebook.py index 5e61b794..894b77ff 100644 --- a/src/ansys/fluent/interface/post_objects/check_in_notebook.py +++ b/src/ansys/fluent/interface/post_objects/check_in_notebook.py @@ -31,7 +31,9 @@ def in_jupyter() -> bool: try: from IPython import get_ipython - return "IPKernelApp" in get_ipython().config # pyright: ignore[reportOptionalMemberAccess] + return ( + "IPKernelApp" in get_ipython().config + ) # pyright: ignore[reportOptionalMemberAccess] except (ImportError, AttributeError): return False diff --git a/src/ansys/fluent/interface/post_objects/meta.py b/src/ansys/fluent/interface/post_objects/meta.py index 6ca2c190..f79f4845 100644 --- a/src/ansys/fluent/interface/post_objects/meta.py +++ b/src/ansys/fluent/interface/post_objects/meta.py @@ -23,7 +23,7 @@ """Metaclasses used in various explicit classes in PyFluent.""" from abc import ABC -from collections.abc import Callable, MutableMapping, Iterator +from collections.abc import Callable, Iterator, MutableMapping import inspect from typing import ( TYPE_CHECKING, @@ -37,20 +37,23 @@ overload, override, ) -from ansys.fluent.core.session_solver import Solver -from typing_extensions import TypeVar, ParamSpec, get_args, get_original_bases from ansys.fluent.core.exceptions import DisallowedValuesError, InvalidArgument +from ansys.fluent.core.session_solver import Solver +from typing_extensions import ParamSpec, TypeVar, get_args, get_original_bases -from ansys.fluent.interface.post_objects.post_object_definitions import BasePostObjectDefn +from ansys.fluent.interface.post_objects.post_object_definitions import ( + BasePostObjectDefn, +) if TYPE_CHECKING: from ansys.fluent.core.services.field_data import LiveFieldData + from ansys.fluent.core.streaming_services.monitor_streaming import MonitorsManager + from ansys.fluent.interface.post_objects.post_object_definitions import ( GraphicsDefn, PlotDefn, ) - from ansys.fluent.core.streaming_services.monitor_streaming import MonitorsManager from ansys.fluent.interface.post_objects.post_objects_container import Container # pylint: disable=unused-private-member @@ -101,14 +104,18 @@ def __set_name__(self, owner: type, name: str): owner.attributes = set() owner.attributes.add(name) - def __set__(self, instance: _SelfT, value: _T_co) -> Never: # pyright: ignore[reportGeneralTypeIssues] + def __set__( + self, instance: _SelfT, value: _T_co + ) -> Never: # pyright: ignore[reportGeneralTypeIssues] raise AttributeError("Attributes are read only.") @overload def __get__(self, instance: None, _) -> Self: ... @overload - def __get__(self, instance: _SelfT, _) -> _T_co: # pyright: ignore[reportGeneralTypeIssues] + def __get__( + self, instance: _SelfT, _ + ) -> _T_co: # pyright: ignore[reportGeneralTypeIssues] ... def __get__(self, instance: _SelfT | None, _) -> _T_co | Self: @@ -180,11 +187,13 @@ def _execute(_self: _SelfT, *args: Any, **kwargs: Any): { "__init__": _init, "__call__": _execute, - "argument_attribute": lambda _self, - argument_name, - attr_name: self.arguments_attrs[ # noqa: E501 + "argument_attribute": lambda _self, argument_name, attr_name: self.arguments_attrs[ # noqa: E501 argument_name - ][attr_name](_self.obj), + ][ + attr_name + ]( + _self.obj + ), "arguments": lambda _self: list(self.arguments_attrs.keys()), }, ) @@ -235,7 +244,9 @@ class PyLocalBase: ... class PyLocalBase: """Local base.""" - def get_ancestors_by_type(self, instance: BasePostObjectDefn, owner: "PyLocalBase | None" = None): + def get_ancestors_by_type( + self, instance: BasePostObjectDefn, owner: "PyLocalBase | None" = None + ): owner = self if owner is None else owner parent = None if getattr(owner, "_parent", None): diff --git a/src/ansys/fluent/interface/post_objects/post_object_definitions.py b/src/ansys/fluent/interface/post_objects/post_object_definitions.py index 591684f3..18963a1b 100644 --- a/src/ansys/fluent/interface/post_objects/post_object_definitions.py +++ b/src/ansys/fluent/interface/post_objects/post_object_definitions.py @@ -23,8 +23,8 @@ """Module providing visualization objects definition.""" import abc -import logging from abc import abstractmethod +import logging from typing import TYPE_CHECKING, Literal, NamedTuple from ansys.fluent.interface.post_objects.meta import ( diff --git a/src/ansys/fluent/interface/post_objects/post_objects_container.py b/src/ansys/fluent/interface/post_objects/post_objects_container.py index 4527b06c..7334ae5c 100644 --- a/src/ansys/fluent/interface/post_objects/post_objects_container.py +++ b/src/ansys/fluent/interface/post_objects/post_objects_container.py @@ -27,7 +27,7 @@ from ansys.fluent.core.session import BaseSession from ansys.fluent.interface.post_objects.meta import PyLocalContainer -from ansys.fluent.visualization import Contour, Plots, Graphics, Surface, Vector +from ansys.fluent.visualization import Contour, Graphics, Plots, Surface, Vector from ansys.fluent.visualization.graphics.graphics_objects import Mesh diff --git a/src/ansys/fluent/interface/post_objects/singleton_meta.py b/src/ansys/fluent/interface/post_objects/singleton_meta.py index 5cd63410..ebbae4a8 100644 --- a/src/ansys/fluent/interface/post_objects/singleton_meta.py +++ b/src/ansys/fluent/interface/post_objects/singleton_meta.py @@ -29,9 +29,12 @@ class SingletonMeta(type): """Provides the metaclass for the singleton type.""" - _single_instance: Self | None = None # pyright: ignore[reportGeneralTypeIssues] + _single_instance: Self | None = None # pyright: ignore[reportGeneralTypeIssues] + + if ( + not TYPE_CHECKING + ): # some type checkers may see this and erase the type otherwise - if not TYPE_CHECKING: # some type checkers may see this and erase the type otherwise def __call__(cls, *args: Any, **kwargs: Any) -> Self: if not cls._single_instance: cls._single_instance = super().__call__(*args, **kwargs) diff --git a/src/ansys/fluent/visualization/__init__.py b/src/ansys/fluent/visualization/__init__.py index f7101d5d..e306d05c 100644 --- a/src/ansys/fluent/visualization/__init__.py +++ b/src/ansys/fluent/visualization/__init__.py @@ -46,18 +46,18 @@ def version_info() -> str: return _VERSION_INFO if _VERSION_INFO is not None else __version__ -from ansys.fluent.visualization.config import config as config, get_config as get_config, set_config as set_config -from ansys.fluent.visualization.containers import ( - Contour as Contour, - IsoSurface as IsoSurface, - Mesh as Mesh, - Monitor as Monitor, - Pathline as Pathline, - PlaneSurface as PlaneSurface, - Surface as Surface, - Vector as Vector, - XYPlot as XYPlot, -) +from ansys.fluent.visualization.config import config as config +from ansys.fluent.visualization.config import get_config as get_config +from ansys.fluent.visualization.config import set_config as set_config +from ansys.fluent.visualization.containers import Contour as Contour +from ansys.fluent.visualization.containers import IsoSurface as IsoSurface +from ansys.fluent.visualization.containers import Mesh as Mesh +from ansys.fluent.visualization.containers import Monitor as Monitor +from ansys.fluent.visualization.containers import Pathline as Pathline +from ansys.fluent.visualization.containers import PlaneSurface as PlaneSurface +from ansys.fluent.visualization.containers import Surface as Surface +from ansys.fluent.visualization.containers import Vector as Vector +from ansys.fluent.visualization.containers import XYPlot as XYPlot from ansys.fluent.visualization.graphics import Graphics as Graphics from ansys.fluent.visualization.plotter import Plots as Plots from ansys.fluent.visualization.registrar import register_renderer as register_renderer diff --git a/src/ansys/fluent/visualization/base/renderer.py b/src/ansys/fluent/visualization/base/renderer.py index bdb3b191..1673b496 100644 --- a/src/ansys/fluent/visualization/base/renderer.py +++ b/src/ansys/fluent/visualization/base/renderer.py @@ -25,6 +25,7 @@ from abc import ABC, abstractmethod from typing import Any, TypedDict + class SurfaceToRender(TypedDict): """TypedDict for mesh surface definition.""" @@ -34,8 +35,10 @@ class SurfaceToRender(TypedDict): title: str kwargs: dict[str, Any] + SubPlot = list[SurfaceToRender] + class AbstractRenderer(ABC): """Abstract class for rendering graphics and plots.""" diff --git a/src/ansys/fluent/visualization/containers.py b/src/ansys/fluent/visualization/containers.py index 8b02a230..509b9395 100644 --- a/src/ansys/fluent/visualization/containers.py +++ b/src/ansys/fluent/visualization/containers.py @@ -23,12 +23,12 @@ """Containers for graphics.""" from typing import TYPE_CHECKING, Any, Self, TypedDict, Unpack -from typing_extensions import override import warnings from ansys.fluent.core.field_data_interfaces import _to_field_name_str from ansys.fluent.core.utils.context_managers import _get_active_session from ansys.units import VariableDescriptor +from typing_extensions import override from ansys.fluent.visualization.graphics import Graphics from ansys.fluent.visualization.plotter import Plots From c09991ebbb3b4a3e0ef4f424e051aa7f891ffd7c Mon Sep 17 00:00:00 2001 From: Gobot1234 Date: Mon, 22 Dec 2025 17:51:18 +0000 Subject: [PATCH 05/20] more types --- .../fluent/interface/post_objects/meta.py | 229 ++++----- .../post_objects/post_object_definitions.py | 468 ++++++++++-------- src/ansys/fluent/visualization/containers.py | 234 +++++---- .../graphics/graphics_objects.py | 24 +- .../visualization/plotter/plotter_objects.py | 3 +- 5 files changed, 531 insertions(+), 427 deletions(-) diff --git a/src/ansys/fluent/interface/post_objects/meta.py b/src/ansys/fluent/interface/post_objects/meta.py index f79f4845..c08ef08f 100644 --- a/src/ansys/fluent/interface/post_objects/meta.py +++ b/src/ansys/fluent/interface/post_objects/meta.py @@ -23,7 +23,7 @@ """Metaclasses used in various explicit classes in PyFluent.""" from abc import ABC -from collections.abc import Callable, Iterator, MutableMapping +from collections.abc import Callable, Iterator, MutableMapping, Mapping, Sequence import inspect from typing import ( TYPE_CHECKING, @@ -34,13 +34,14 @@ Protocol, Self, cast, + dataclass_transform, overload, - override, + override, Unpack, ) -from ansys.fluent.core.exceptions import DisallowedValuesError, InvalidArgument +from ansys.fluent.core.exceptions import DisallowedValuesError from ansys.fluent.core.session_solver import Solver -from typing_extensions import ParamSpec, TypeVar, get_args, get_original_bases +from typing_extensions import ParamSpec, TypeVar, get_args, get_original_bases, NotRequired, TypedDict from ansys.fluent.interface.post_objects.post_object_definitions import ( BasePostObjectDefn, @@ -63,10 +64,15 @@ _T_co = TypeVar("_T_co", covariant=True) +class HasAttributes(Protocol): + # attributes: NotRequired[set[str]] # technically this but this is just object + attributes: set[str] + + class Attribute(Generic[_SelfT, _T_co]): """Attributes.""" - VALID_NAMES = [ + VALID_NAMES = ( "range", "allowed_values", "display_name_allowed_values", @@ -89,24 +95,25 @@ class Attribute(Generic[_SelfT, _T_co]): "widget", "dir_info", "extensions", - ] + ) def __init__(self, function: Callable[[_SelfT], _T_co], /): self.function = function self.__doc__: str | None = getattr(function, "__doc__", None) self.name: str - def __set_name__(self, owner: type, name: str): + def __set_name__(self, owner: HasAttributes, name: str): if name not in self.VALID_NAMES: raise DisallowedValuesError("attribute", name, self.VALID_NAMES) self.name = name if not hasattr(owner, "attributes"): - owner.attributes = set() + owner.attributes = set[str]() + assert isinstance(owner.attributes, set) owner.attributes.add(name) def __set__( - self, instance: _SelfT, value: _T_co - ) -> Never: # pyright: ignore[reportGeneralTypeIssues] + self, instance: _SelfT, value: _T_co # pyright: ignore[reportGeneralTypeIssues] + ) -> Never: raise AttributeError("Attributes are read only.") @overload @@ -114,8 +121,8 @@ def __get__(self, instance: None, _) -> Self: ... @overload def __get__( - self, instance: _SelfT, _ - ) -> _T_co: # pyright: ignore[reportGeneralTypeIssues] + self, instance: _SelfT, _ # pyright: ignore[reportGeneralTypeIssues] + ) -> _T_co: ... def __get__(self, instance: _SelfT | None, _) -> _T_co | Self: @@ -187,12 +194,10 @@ def _execute(_self: _SelfT, *args: Any, **kwargs: Any): { "__init__": _init, "__call__": _execute, - "argument_attribute": lambda _self, argument_name, attr_name: self.arguments_attrs[ # noqa: E501 - argument_name - ][ - attr_name - ]( - _self.obj + "argument_attribute": ( + lambda _self, argument_name, attr_name: self.arguments_attrs[ + argument_name + ][attr_name](_self.obj) ), "arguments": lambda _self: list(self.arguments_attrs.keys()), }, @@ -205,40 +210,12 @@ def __set_name__(self, owner: type, name: str) -> None: owner.commands[name] = {} def __get__(self, instance: _SelfT, _): # pyright: ignore[reportGeneralTypeIssues] - if hasattr(self, "command"): - return self.command - else: - return self.command_cls(instance) + return self.command_cls(instance) TT = TypeVar("TT", bound=type) - - -def CommandArgs( - command_object: Command[object, ...], argument_name: str -) -> Callable[[TT], TT]: - """Command arguments.""" - - def wrapper(attribute: TT) -> TT: - if argument_name in command_object.arguments_attrs: - command_object.arguments_attrs[argument_name].update( - {attribute.__name__: attribute} - ) - else: - raise InvalidArgument(f"{argument_name} not a valid argument.") - return attribute - - return wrapper - - -class _Wrapper(Protocol): - def __call__(self, self_: type, instance: Any, owner: type, /) -> Any: ... - - -class PyLocalBase: ... - - T = TypeVar("T") +T2 = TypeVar("T2") class PyLocalBase: @@ -266,7 +243,7 @@ def get_ancestors_by_name(self, instance, owner: type | None = None): parent = self.get_ancestors_by_name(owner, instance._parent) return parent - def get_root(self, instance) -> "PyLocalBase": + def get_root(self, instance = None) -> "PyLocalBase": instance = self if instance is None else instance parent = instance if getattr(instance, "_parent", None): @@ -277,20 +254,11 @@ def get_session(self, instance) -> Solver: root = self.get_root(instance) return root.session - def get_session_handle(self, instance): - root = self.get_root(instance) - return getattr(root, "session_handle", None) - def get_path(self) -> str: if getattr(self, "_parent", None): return self._parent.get_path() + "/" + self._name return self._name - def __init_subclass__(cls) -> None: - if "get_path" not in attrs: - attrs["get_path"] = cls.__create_get_path() - return super().__init_subclass__() - @property def root(self) -> "PyLocalBase": """Top-most parent object.""" @@ -316,11 +284,6 @@ def monitors(self) -> "MonitorsManager": """Monitors associated with the current object.""" return self.session.monitors - @property - def session_handle(self): - """Session handle associated with the current object.""" - return self.get_session_handle(self) - class PyLocalProperty(PyLocalBase, Generic[T]): """Local property classes.""" @@ -355,12 +318,14 @@ def reset() -> None: obj._register_on_change_cb(reset) - def __call__(self) -> T | None: + def __call__(self) -> T: rv = self.value - if allowed_values := cast( - list[T] | None, getattr(self, "allowed_values", None) - ): + try: + allowed_values = self.allowed_values + except AttributeError: + return rv + else: if len(allowed_values) > 0 and ( rv is None or (not isinstance(rv, list) and rv not in allowed_values) ): @@ -369,6 +334,9 @@ def __call__(self) -> T | None: return rv + if TYPE_CHECKING: # TODO double check this is on the right thing + def __set__(self, instance: object, value: T) -> None: ... + def set_state(self, value: T): self.value = value for on_change_cb in self._on_change_cbs: @@ -378,7 +346,13 @@ def _register_on_change_cb(self, on_change_cb: Callable[[], None]): self._on_change_cbs.append(on_change_cb) @Attribute - def allowed_values(self) -> list[T]: + @overload + def allowed_values(self: "PyLocalProperty[Sequence[T2]]") -> Sequence[T2]:... + @Attribute + @overload + def allowed_values(self: "PyLocalProperty[T2]") -> Sequence[T2]:... + @Attribute + def allowed_values(self) -> Sequence[object]: """Get allowed values.""" raise NotImplementedError("allowed_values not implemented.") @@ -430,10 +404,14 @@ def reset(self, path: str, location: str, session_id: str) -> None: delattr(self, "_object") -class PyLocalObject(PyLocalBase): +ParentT = TypeVar("ParentT") + +# TODO try poking around this more cause it is kinda what we are doing? +# @dataclass_transform(field_specifiers=(type,)) +class PyLocalObject(PyLocalBase, Generic[ParentT]): """Local object classes.""" - def __init__(self, parent, api_helper: Callable[[Self], APIHelper], name: str = ""): + def __init__(self, parent: ParentT, api_helper: Callable[[Self], APIHelper], name: str = ""): """Create the initialization method for 'PyLocalObjectMeta'.""" self._parent = parent self._name = name @@ -443,29 +421,29 @@ def __init__(self, parent, api_helper: Callable[[Self], APIHelper], name: str = def update(clss: type[PyLocalBase]): for name, cls in clss.__dict__.items(): - if cls.__class__.__name__ in {"PyLocalCommandMeta"}: + if cls.__name__ in {"PyLocalCommand"}: self._command_names.append(name) - if cls.__class__.__name__ in { - "PyLocalPropertyMeta", - "PyLocalObjectMeta", - "PyLocalCommandMeta", + if cls.__name__ in { + "PyLocalProperty", + "PyLocalObject", + "PyLocalCommand", }: setattr( self, name, cls(self, api_helper, name), ) - if cls.__class__.__name__ in { - "PyLocalNamedObjectMeta", - "PyLocalNamedObjectMetaAbstract", + if cls.__name__ in { + "PyLocalNamedObject", + "PyLocalNamedObjectAbstract", }: setattr( self, cls.PLURAL, PyLocalContainer(self, cls, api_helper, cls.PLURAL), ) - if cls.__class__.__name__ == "PyReferenceObjectMeta": + if cls.__class__.__name__ == "PyReferenceObject": setattr( self, name, @@ -476,9 +454,7 @@ def update(clss: type[PyLocalBase]): update(self.__class__) - __getattribute__ = object.__getattribute__ - - def update(self, value): + def update(self, value: dict[str, Any]): """Update object.""" properties = value sort_by = None @@ -497,10 +473,10 @@ def update(self, value): properties.update(sorted_properties) for name, val in properties.items(): obj = getattr(self, name) - if obj.__class__.__class__.__name__ == "PyLocalPropertyMeta": + if obj.__class__.__name__ == "PyLocalProperty": obj.set_state(val) else: - if obj.__class__.__class__.__name__ == "PyReferenceObjectMeta": + if obj.__class__.__name__ == "PyReferenceObject": obj = obj.ref obj.update(val) @@ -516,25 +492,25 @@ def update_state(clss): if o is None or name.startswith("_") or name.startswith("__"): continue - if cls.__class__.__name__ == "PyReferenceObjectMeta": + if cls.__name__ == "PyReferenceObject": if o.LOCATION == "local": o = o.ref else: continue - elif cls.__class__.__name__ == "PyLocalCommandMeta": + elif cls.__name__ == "PyLocalCommand": args = {} for arg in o._args: args[arg] = getattr(o, arg)() state[name] = args if ( - cls.__class__.__name__ == "PyLocalObjectMeta" - or cls.__class__.__name__ == "PyReferenceObjectMeta" + cls.__name__ == "PyLocalObject" + or cls.__name__ == "PyReferenceObject" ): if getattr(o, "is_active", True): state[name] = o(show_attributes) elif ( - cls.__class__.__name__ == "PyLocalNamedObjectMeta" - or cls.__class__.__name__ == "PyLocalNamedObjectMetaAbstract" + cls.__name__ == "PyLocalNamedObject" + or cls.__name__ == "PyLocalNamedObjectAbstract" ): container = getattr(self, cls.PLURAL) if getattr(container, "is_active", True): @@ -544,7 +520,7 @@ def update_state(clss): if getattr(o, "is_active", True): state[cls.PLURAL][child_name] = o() - elif cls.__class__.__name__ == "PyLocalPropertyMeta": + elif cls.__name__ == "PyLocalProperty": if getattr(o, "is_active", True): state[name] = o() attrs = show_attributes and getattr(o, "attributes", None) @@ -562,13 +538,15 @@ def update_state(clss): def __setattr__(self, name: str, value: Any): attr = getattr(self, name, None) - if attr and attr.__class__.__class__.__name__ == "PyLocalPropertyMeta": + if attr and attr.__class__.__name__ == "PyLocalProperty": attr.set_state(value) else: object.__setattr__(self, name, value) -class PyLocalCommand(PyLocalObject): +CallKwargs = TypeVar("CallKwargs", bound=TypedDict) + +class PyLocalCommand(PyLocalObject[ParentT], Generic[ParentT, CallKwargs]): """Local object metaclass.""" def __init__(self, parent, api_helper: Callable[[Self], APIHelper], name=""): @@ -597,7 +575,7 @@ def update(clss): update(self.__class__) - def __call__(self, **kwargs): + def __call__(self, **kwargs: Unpack[CallKwargs]): for arg_name, arg_value in kwargs.items(): getattr(self, arg_name).set_state(arg_value) cmd_args = {} @@ -605,14 +583,9 @@ def __call__(self, **kwargs): cmd_args[arg_name] = getattr(self, arg_name)() return self._exe_cmd(**cmd_args) - def __new__(cls, name, bases, attrs): - attrs["__init__"] = cls.__create_init() - attrs["__call__"] = cls.__execute_command() - return super().__new__(cls, name, bases, attrs) - class PyLocalNamedObject(PyLocalObject): - """Metaclass for local named object classes.""" + """Base class for local named object classes.""" def __init__(self, name: str, parent, api_helper: Callable[[Self], APIHelper]): self._name = name @@ -623,32 +596,32 @@ def __init__(self, name: str, parent, api_helper: Callable[[Self], APIHelper]): def update(clss): for name, cls in clss.__dict__.items(): - if cls.__class__.__name__ in ("PyLocalCommandMeta"): + if cls.__name__ in ("PyLocalCommand"): self._command_names.append(name) - if cls.__class__.__name__ in ( - "PyLocalPropertyMeta", - "PyLocalObjectMeta", - "PyLocalCommandMeta", + if cls.__name__ in ( + "PyLocalProperty", + "PyLocalObject", + "PyLocalCommand", ): # delete old property if overridden - if getattr(self, name).__class__.__name__ == name: + if getattr(self, name).__name__ == name: delattr(self, name) setattr( self, name, cls(self, api_helper, name), ) - elif ( - cls.__class__.__name__ == "PyLocalNamedObjectMeta" - or cls.__class__.__name__ == "PyLocalNamedObjectMetaAbstract" + elif ( # TODO these are gone, can we not use instance checks here? + cls.__name__ == "PyLocalNamedObject" + or cls.__name__ == "PyLocalNamedObjectAbstract" ): setattr( self, cls.PLURAL, PyLocalContainer(self, cls, api_helper, cls.PLURAL), ) - elif cls.__class__.__name__ == "PyReferenceObjectMeta": + elif cls.__name__ == "PyReferenceObject": setattr(self, name, cls(self, cls.PATH, cls.LOCATION, cls.SESSION)) for base_class in clss.__bases__: update(base_class) @@ -666,7 +639,18 @@ class PyLocalNamedObjectAbstract(ABC, PyLocalNamedObject): pass -DefnT = TypeVar("T", bound=GraphicsDefn | PlotDefn, default=GraphicsDefn | PlotDefn) +DefnT = TypeVar("DefnT", bound=GraphicsDefn | PlotDefn, default=GraphicsDefn | PlotDefn) + +def if_type_checking_instantiate(type: type[T]) -> T: + return cast(T, type) # this is hopefully obviously unsafe + + +class _DeleteKwargs(TypedDict, total=False): + names: list[str] + +class _CreateKwargs(TypedDict, total=False): + name: str | None + class PyLocalContainer(MutableMapping[str, DefnT]): @@ -696,7 +680,7 @@ def __init__( PyLocalContainer.exclude = property( lambda self: self.__object_class.EXCLUDE(self) ) - if hasattr(object_class, "INCLUDE"): + if hasattr(object_class, "INCLUDE"): # TODO sort_by? PyLocalContainer.include = property( lambda self: self.__object_class.INCLUDE(self) ) @@ -757,16 +741,6 @@ def session(self) -> "Solver": """Returns the session object.""" return self.get_session() - def get_session_handle(self, obj=None): - """Returns the session-handle object.""" - root = self.get_root(obj) - return getattr(root, "session_handle", None) - - @property - def session_handle(self): - """Returns the session-handle object.""" - return self.get_session_handle() - @override def __iter__(self) -> Iterator[str]: return iter(self._local_collection) @@ -809,32 +783,34 @@ def _get_unique_chid_name(self) -> str: index += 1 return unique_name - class Delete(PyLocalCommand): + class Delete(PyLocalCommand[Self, _DeleteKwargs]): """Local delete command.""" def _exe_cmd(self, names: list[str]) -> None: for item in names: self._parent.__delitem__(item) + @if_type_checking_instantiate class names(PyLocalProperty[list[str]]): """Local names property.""" - value: list[str] = [] + value = [] @Attribute def allowed_values(self): """Get allowed values.""" return list(self._parent._parent) - class Create(PyLocalCommand): + class Create(PyLocalCommand[Self, _CreateKwargs]): """Local create command.""" - def _exe_cmd(self, name=None): + def _exe_cmd(self, name: str | None = None): if name is None: name = self._parent._get_unique_chid_name() new_object = self._parent.__getitem__(name) return new_object._name + @if_type_checking_instantiate class name(PyLocalProperty[str | None]): """Local name property.""" @@ -843,3 +819,4 @@ class name(PyLocalProperty[str | None]): # added by __init__ delete: Delete create: Create + diff --git a/src/ansys/fluent/interface/post_objects/post_object_definitions.py b/src/ansys/fluent/interface/post_objects/post_object_definitions.py index 18963a1b..215a17b9 100644 --- a/src/ansys/fluent/interface/post_objects/post_object_definitions.py +++ b/src/ansys/fluent/interface/post_objects/post_object_definitions.py @@ -24,15 +24,16 @@ import abc from abc import abstractmethod +from collections.abc import Callable, Sequence import logging -from typing import TYPE_CHECKING, Literal, NamedTuple +from typing import TYPE_CHECKING, Literal, NamedTuple, Protocol, Self, cast, final from ansys.fluent.interface.post_objects.meta import ( Attribute, - PyLocalNamedObjectAbstract, - PyLocalObjectMeta, + PyLocalNamedObject, + PyLocalObject, PyLocalProperty, - PyLocalPropertyMeta, + if_type_checking_instantiate, ) if TYPE_CHECKING: @@ -41,18 +42,17 @@ logger = logging.getLogger("pyfluent.post_objects") -class BasePostObjectDefn(abc.ABC): + +class BasePostObjectDefn(Protocol, metaclass=abc.ABCMeta): """Base class for visualization objects.""" - @abc.abstractmethod - def get_root(self) -> Container: - raise NotImplementedError + # @abc.abstractmethod + # def get_root(self) -> Container: + # raise NotImplementedError - @abc.abstractmethod - def surfaces(self) -> list[str]: - raise NotImplementedError + surfaces: Callable[[], Sequence[str]] - def _pre_display(self): + def _pre_display(self) -> None: local_surfaces_provider = self.get_root()._local_surfaces_provider() for surf_name in self.surfaces(): if surf_name in list(local_surfaces_provider): @@ -60,7 +60,7 @@ def _pre_display(self): surf_api = surf_obj._api_helper.surface_api surf_api.create_surface_on_server() - def _post_display(self): + def _post_display(self) -> None: local_surfaces_provider = self.get_root()._local_surfaces_provider() for surf_name in self.surfaces(): if surf_name in list(local_surfaces_provider): @@ -69,11 +69,11 @@ def _post_display(self): surf_api.delete_surface_on_server() -class GraphicsDefn(BasePostObjectDefn, PyLocalNamedObjectAbstract): +class GraphicsDefn(BasePostObjectDefn, PyLocalNamedObject, abc.ABC): """Abstract base class for graphics objects.""" @abstractmethod - def display(self, window_id: str | None = None): + def display(self, window_id: str | None = None) -> None: """Display graphics. Parameters @@ -84,11 +84,11 @@ def display(self, window_id: str | None = None): pass -class PlotDefn(BasePostObjectDefn, metaclass=PyLocalNamedObjectAbstract): +class PlotDefn(BasePostObjectDefn, PyLocalNamedObject, abc.ABC): """Abstract base class for plot objects.""" @abstractmethod - def plot(self, window_id: str | None = None): + def plot(self, window_id: str | None = None) -> None: """Draw plot. Parameters @@ -99,77 +99,82 @@ def plot(self, window_id: str | None = None): pass -class Vector(NamedTuple): - """Class for vector definition.""" - - x: float - y: float - z: float - - -class MonitorDefn(PlotDefn): +class MonitorDefn(PlotDefn, abc.ABC): """Monitor Definition.""" PLURAL = "Monitors" - class monitor_set_name(PyLocalProperty): + @final + @if_type_checking_instantiate + class monitor_set_name(PyLocalProperty[str | None]): """Monitor set name.""" - value: str = None + value = None @Attribute - def allowed_values(self): + def allowed_values(self) -> list[str]: """Monitor set allowed values.""" return self.monitors.get_monitor_set_names() -class XYPlotDefn(PlotDefn): +class XYPlotDefn(PlotDefn, abc.ABC): """XYPlot Definition.""" PLURAL = "XYPlots" - class node_values(PyLocalProperty): + @final + @if_type_checking_instantiate + class node_values(PyLocalProperty[bool]): """Plot nodal values.""" - value: bool = True + value = True - class boundary_values(PyLocalProperty): + @final + @if_type_checking_instantiate + class boundary_values(PyLocalProperty[bool]): """Plot Boundary values.""" - value: bool = True + value = True - class direction_vector(PyLocalProperty): + @final + @if_type_checking_instantiate + class direction_vector(PyLocalProperty[tuple[int, int, int]]): """Direction Vector.""" - value: Vector = [1, 0, 0] + value = (1, 0, 0) - class y_axis_function(PyLocalProperty): + @final + @if_type_checking_instantiate + class y_axis_function(PyLocalProperty[str | None]): """Y Axis Function.""" - value: str = None + value = None @Attribute - def allowed_values(self): + def allowed_values(self) -> list[str]: """Y axis function allowed values.""" return list(self.field_data.scalar_fields()) - class x_axis_function(PyLocalProperty): + @final + @if_type_checking_instantiate + class x_axis_function(PyLocalProperty[Literal["direction-vector"]]): """X Axis Function.""" - value: str = "direction-vector" + value = "direction-vector" @Attribute - def allowed_values(self) -> list[str]: + def allowed_values(self) -> Sequence[Literal["direction-vector"]]: """X axis function allowed values.""" return ["direction-vector"] - class surfaces(PyLocalProperty): + @if_type_checking_instantiate + class surfaces(PyLocalProperty[list[str]]): """List of surfaces for plotting.""" - value: list[str] = [] + value = [] @Attribute - def allowed_values(self): + def allowed_values(self) -> list[str]: """Surface list allowed values.""" return list(self.field_data.surfaces()) + list( self.get_root()._local_surfaces_provider() @@ -181,32 +186,36 @@ class MeshDefn(GraphicsDefn): PLURAL = "Meshes" - class surfaces(PyLocalProperty): + @if_type_checking_instantiate + class surfaces(PyLocalProperty[list[str]]): """List of surfaces for mesh graphics.""" - value: list[str] = [] + value = [] @Attribute - def allowed_values(self): + def allowed_values(self) -> list[str]: """Surface list allowed values.""" return list(self.field_data.surfaces()) + list( self.get_root()._local_surfaces_provider() ) - class show_edges(PyLocalProperty): + @if_type_checking_instantiate + class show_edges(PyLocalProperty[bool]): """Show edges for mesh.""" - value: bool = False + value = False - class show_nodes(PyLocalProperty): + @if_type_checking_instantiate + class show_nodes(PyLocalProperty[bool]): """Show nodes for mesh.""" - value: bool = False + value = False - class show_faces(PyLocalProperty): + @if_type_checking_instantiate + class show_faces(PyLocalProperty[bool]): """Show faces for mesh.""" - value: bool = True + value = True class PathlinesDefn(GraphicsDefn): @@ -214,23 +223,25 @@ class PathlinesDefn(GraphicsDefn): PLURAL = "Pathlines" - class field(PyLocalProperty): + @if_type_checking_instantiate + class field(PyLocalProperty[str | None]): """Pathlines field.""" - value: str = None + value = None @Attribute - def allowed_values(self): + def allowed_values(self) -> list[str]: """Field allowed values.""" return list(self.field_data.scalar_fields()) - class surfaces(PyLocalProperty): + @if_type_checking_instantiate + class surfaces(PyLocalProperty[list[str]]): """List of surfaces for pathlines.""" - value: list[str] = [] + value = [] @Attribute - def allowed_values(self): + def allowed_values(self) -> list[str]: """Surface list allowed values.""" return list(self.field_data.surfaces()) + list( self.get_root()._local_surfaces_provider() @@ -247,222 +258,251 @@ def name(self) -> str: """Return name of the surface.""" return self._name + @if_type_checking_instantiate class show_edges(PyLocalProperty[bool]): """Show edges for surface.""" - value: bool = True + value = True - class definition(metaclass=PyLocalObjectMeta): + class definition(PyLocalObject[Self]): """Specify surface definition type.""" + @final + @if_type_checking_instantiate class type(PyLocalProperty[Literal["plane-surface", "iso-surface"]]): """Surface type.""" value = "iso-surface" @Attribute - def allowed_values(self): + def allowed_values(self) -> Sequence[Literal["plane-surface", "iso-surface"]]: """Surface type allowed values.""" return ["plane-surface", "iso-surface"] - class plane_surface(metaclass=PyLocalObjectMeta): + @if_type_checking_instantiate + class plane_surface(PyLocalObject[Self]): """Plane surface definition.""" @Attribute - def is_active(self): + def is_active(self) -> bool: """Check whether current object is active or not.""" return self._parent.type() == "plane-surface" - class creation_method(PyLocalProperty): + @final + @if_type_checking_instantiate + class creation_method( + PyLocalProperty[ + Literal["xy-plane", "yz-plane", "zx-plane", "point-and-normal"] + ] + ): """Creation Method.""" - value: str = "xy-plane" + value = "xy-plane" @Attribute - def allowed_values(self): + def allowed_values(self) -> Sequence[Literal["xy-plane", "yz-plane", "zx-plane", "point-and-normal"]]: """Surface type allowed values.""" return ["xy-plane", "yz-plane", "zx-plane", "point-and-normal"] - class point(metaclass=PyLocalObjectMeta): + @if_type_checking_instantiate + class point(PyLocalObject[Self]): """Point entry for point-and-normal surface.""" @Attribute - def is_active(self): + def is_active(self) -> bool: """Check whether current object is active or not.""" return self._parent.creation_method() == "point-and-normal" - class x(PyLocalProperty): + @if_type_checking_instantiate + class x(PyLocalProperty[float]): """X value.""" - value: float = 0 + value = 0 @Attribute - def range(self): + def range(self) -> tuple[float, float]: """X value range.""" - return self.field_data.scalar_fields.range("x-coordinate", True) + return cast(tuple[float, float], cast(object, self.field_data.scalar_fields.range("x-coordinate", True))) - class y(PyLocalProperty): + @if_type_checking_instantiate + class y(PyLocalProperty[float]): """Y value.""" - value: float = 0 + value = 0 @Attribute - def range(self): + def range(self) -> tuple[float, float]: """Y value range.""" - return self.field_data.scalar_fields.range("y-coordinate", True) + return cast(tuple[float, float], cast(object, self.field_data.scalar_fields.range("y-coordinate", True))) - class z(PyLocalProperty): + @if_type_checking_instantiate + class z(PyLocalProperty[float]): """Z value.""" - value: float = 0 + value = 0 @Attribute - def range(self): + def range(self) -> tuple[float, float]: """Z value range.""" - return self.field_data.scalar_fields.range("z-coordinate", True) + return cast(tuple[float, float], cast(object, self.field_data.scalar_fields.range("z-coordinate", True))) - class normal(metaclass=PyLocalObjectMeta): + @if_type_checking_instantiate + class normal(PyLocalObject[Self]): """Normal entry for point-and-normal surface.""" @Attribute - def is_active(self): + def is_active(self) -> bool: """Check whether current object is active or not.""" return self._parent.creation_method() == "point-and-normal" - class x(PyLocalProperty): + @if_type_checking_instantiate + class x(PyLocalProperty[float]): """X value.""" - value: float = 0 + value = 0 @Attribute - def range(self): + def range(self) -> list[int]: """X value range.""" return [-1, 1] - class y(PyLocalProperty): + @if_type_checking_instantiate + class y(PyLocalProperty[float]): """Y value.""" - value: float = 0 + value = 0 @Attribute - def range(self): + def range(self) -> list[int]: """Y value range.""" return [-1, 1] - class z(PyLocalProperty): + @if_type_checking_instantiate + class z(PyLocalProperty[float]): """Z value.""" - value: float = 0 + value = 0 @Attribute - def range(self): + def range(self) -> list[int]: """Z value range.""" return [-1, 1] - class xy_plane(metaclass=PyLocalObjectMeta): + @if_type_checking_instantiate + class xy_plane(PyLocalObject[Self]): """XY Plane definition.""" @Attribute - def is_active(self): + def is_active(self) -> bool: """Check whether current object is active or not.""" return self._parent.creation_method() == "xy-plane" - class z(PyLocalProperty): + @if_type_checking_instantiate + class z(PyLocalProperty[float]): """Z value.""" - value: float = 0 + value = 0 @Attribute - def range(self): + def range(self) -> tuple[float, float]: """Z value range.""" return self.field_data.scalar_fields.range("z-coordinate", True) - class yz_plane(metaclass=PyLocalObjectMeta): + @if_type_checking_instantiate + class yz_plane(PyLocalObject[Self]): """YZ Plane definition.""" @Attribute - def is_active(self): + def is_active(self) -> bool: """Check whether current object is active or not.""" return self._parent.creation_method() == "yz-plane" - class x(PyLocalProperty): + @if_type_checking_instantiate + class x(PyLocalProperty[float]): """X value.""" - value: float = 0 + value = 0 @Attribute - def range(self): + def range(self) -> tuple[float, float]: """X value range.""" return self.field_data.scalar_fields.range("x-coordinate", True) - class zx_plane(metaclass=PyLocalObjectMeta): + @if_type_checking_instantiate + class zx_plane(PyLocalObject[Self]): """ZX Plane definition.""" @Attribute - def is_active(self): + def is_active(self) -> bool: """Check whether current object is active or not.""" return self._parent.creation_method() == "zx-plane" - class y(PyLocalProperty): + @if_type_checking_instantiate + class y(PyLocalProperty[float]): """Y value.""" - value: float = 0 + value = 0 @Attribute - def range(self): + def range(self) -> tuple[float, float]: """Y value range.""" return self.field_data.scalar_fields.range("y-coordinate", True) - class iso_surface(metaclass=PyLocalObjectMeta): + @if_type_checking_instantiate + class iso_surface(PyLocalObject[Self]): """Iso surface definition.""" @Attribute - def is_active(self): + def is_active(self) -> bool: """Check whether current object is active or not.""" return self._parent.type() == "iso-surface" - class field(PyLocalProperty): + @if_type_checking_instantiate + class field(PyLocalProperty[str | None]): """Iso surface field.""" - value: str = None + value = None @Attribute - def allowed_values(self): + def allowed_values(self) -> list[str]: """Field allowed values.""" return list(self.field_data.scalar_fields()) - class rendering(PyLocalProperty): + @final + @if_type_checking_instantiate + class rendering(PyLocalProperty[Literal["mesh", "contour"]]): """Iso surface rendering.""" - value: str = "mesh" + value = "mesh" @Attribute - def allowed_values(self): + def allowed_values(self) -> Sequence[Literal["mesh", "contour"]]: """Surface rendering allowed values.""" return ["mesh", "contour"] - class iso_value(PyLocalProperty): + @if_type_checking_instantiate + class iso_value(PyLocalProperty[float | None]): """Iso value for field.""" - _value: float = None + _value = None - def _reset_on_change(self): + def _reset_on_change(self) -> list: return [self._parent.field] @property - def value(self): - """Iso value property setter.""" + def value(self) -> float | None: + """Iso value property.""" if getattr(self, "_value", None) is None: rnge = self.range self._value = (rnge[0] + rnge[1]) / 2.0 if rnge else None return self._value @value.setter - def value(self, value): + def value(self, value: float | None) -> None: self._value = value @Attribute - def range(self): + def range(self) -> tuple[float, float] | None: """Iso value range.""" field = self._parent.field() if field: @@ -474,40 +514,44 @@ class ContourDefn(GraphicsDefn): PLURAL = "Contours" - class field(PyLocalProperty): + @if_type_checking_instantiate + class field(PyLocalProperty[str | None]): """Contour field.""" - value: str = None + value = None @Attribute - def allowed_values(self): + def allowed_values(self) -> list[str]: """Field allowed values.""" return list(self.field_data.scalar_fields()) - class surfaces(PyLocalProperty): + @if_type_checking_instantiate + class surfaces(PyLocalProperty[list[str]]): """Contour surfaces.""" - value: list[str] = [] + value = [] @Attribute - def allowed_values(self): + def allowed_values(self) -> list[str]: """Surfaces list allowed values.""" return list(self.field_data.surfaces()) + list( self.get_root()._local_surfaces_provider() ) - class filled(PyLocalProperty): + @if_type_checking_instantiate + class filled(PyLocalProperty[bool]): """Draw filled contour.""" - value: bool = True + value = True - class node_values(PyLocalProperty): + @if_type_checking_instantiate + class node_values(PyLocalProperty[bool]): """Draw nodal data.""" - _value: bool = True + _value = True @Attribute - def is_active(self): + def is_active(self) -> bool: """Check whether current object is active or not.""" filled = self.get_ancestors_by_type(ContourDefn).filled() auto_range_off = self.get_ancestors_by_type( @@ -521,87 +565,97 @@ def is_active(self): return True @property - def value(self): + def value(self) -> bool: """Node value property setter.""" if self.is_active is False: return True return self._value @value.setter - def value(self, value): + def value(self, value: bool) -> None: if value is False and self.is_active is False: raise ValueError( "For unfilled and clipped contours, node values must be displayed. " ) self._value = value - class boundary_values(PyLocalProperty): + @if_type_checking_instantiate + class boundary_values(PyLocalProperty[bool]): """Draw boundary values.""" - value: bool = False + value = False - class contour_lines(PyLocalProperty): + @if_type_checking_instantiate + class contour_lines(PyLocalProperty[bool]): """Draw contour lines.""" - value: bool = False + value = False - class show_edges(PyLocalProperty): + @if_type_checking_instantiate + class show_edges(PyLocalProperty[bool]): """Show edges.""" - value: bool = False + value = False - class range(metaclass=PyLocalObjectMeta): + class range(PyLocalObject[Self]): """Range definition.""" - class option(PyLocalProperty): + @final + @if_type_checking_instantiate + class option(PyLocalProperty[Literal["auto-range-on", "auto-range-off"]]): """Range option.""" - value: str = "auto-range-on" + value = "auto-range-on" @Attribute - def allowed_values(self): + def allowed_values(self) -> Sequence[Literal["auto-range-on", "auto-range-off"]]: """Range option allowed values.""" return ["auto-range-on", "auto-range-off"] - class auto_range_on(metaclass=PyLocalObjectMeta): + @if_type_checking_instantiate + class auto_range_on(PyLocalObject[Self]): """Auto range on definition.""" @Attribute - def is_active(self): + def is_active(self) -> bool: """Check whether current object is active or not.""" return self._parent.option() == "auto-range-on" - class global_range(PyLocalProperty): + @if_type_checking_instantiate + class global_range(PyLocalProperty[bool]): """Show global range.""" - value: bool = False + value = False - class auto_range_off(metaclass=PyLocalObjectMeta): + @if_type_checking_instantiate + class auto_range_off(PyLocalObject[Self]): """Auto range off definition.""" @Attribute - def is_active(self): + def is_active(self) -> bool: """Check whether current object is active or not.""" return self._parent.option() == "auto-range-off" - class clip_to_range(PyLocalProperty): + @if_type_checking_instantiate + class clip_to_range(PyLocalProperty[bool]): """Clip contour within range.""" - value: bool = False + value = False - class minimum(PyLocalProperty): + @if_type_checking_instantiate + class minimum(PyLocalProperty[float | None]): """Range minimum.""" - _value: float = None + _value = None - def _reset_on_change(self): + def _reset_on_change(self) -> list: return [ self.get_ancestors_by_type(ContourDefn).field, self.get_ancestors_by_type(ContourDefn).node_values, ] @property - def value(self): + def value(self) -> float | None: """Range minimum property setter.""" if getattr(self, "_value", None) is None: field = self.get_ancestors_by_type(ContourDefn).field() @@ -615,22 +669,23 @@ def value(self): return self._value @value.setter - def value(self, value): + def value(self, value: float | None) -> None: self._value = value - class maximum(PyLocalProperty): + @if_type_checking_instantiate + class maximum(PyLocalProperty[float | None]): """Range maximum.""" - _value: float = None + _value = None - def _reset_on_change(self): + def _reset_on_change(self) -> list: return [ self.get_ancestors_by_type(ContourDefn).field, self.get_ancestors_by_type(ContourDefn).node_values, ] @property - def value(self): + def value(self) -> float | None: """Range maximum property setter.""" if getattr(self, "_value", None) is None: field = self.get_ancestors_by_type(ContourDefn).field() @@ -645,7 +700,7 @@ def value(self): return self._value @value.setter - def value(self, value): + def value(self, value: float | None) -> None: self._value = value @@ -654,99 +709,113 @@ class VectorDefn(GraphicsDefn): PLURAL = "Vectors" - class vectors_of(PyLocalProperty): + @if_type_checking_instantiate + class vectors_of(PyLocalProperty[str | None]): """Vector type.""" - value: str = None + value = None @Attribute - def allowed_values(self): + def allowed_values(self) -> list[str]: """Vectors of allowed values.""" return list(self.field_data.vector_fields()) - class field(PyLocalProperty): + @if_type_checking_instantiate + class field(PyLocalProperty[str | None]): """Vector color field.""" - value: str = None + value = None @Attribute - def allowed_values(self): + def allowed_values(self) -> list[str]: """Field allowed values.""" return list(self.field_data.scalar_fields()) - class surfaces(PyLocalProperty): + @if_type_checking_instantiate + class surfaces(PyLocalProperty[list[str]]): """List of surfaces for vector graphics.""" - value: list[str] = [] + value = [] @Attribute - def allowed_values(self): + def allowed_values(self) -> list[str]: """Surface list allowed values.""" return list(self.field_data.surfaces()) + list( self.get_root()._local_surfaces_provider() ) - class scale(PyLocalProperty): + @if_type_checking_instantiate + class scale(PyLocalProperty[float]): """Vector scale.""" - value: float = 1.0 + value = 1.0 - class skip(PyLocalProperty): + @if_type_checking_instantiate + class skip(PyLocalProperty[int]): """Vector skip.""" - value: int = 0 + value = 0 - class show_edges(PyLocalProperty): + @if_type_checking_instantiate + class show_edges(PyLocalProperty[bool]): """Show edges.""" - value: bool = False + value = False - class range(metaclass=PyLocalObjectMeta): + @if_type_checking_instantiate + class range(PyLocalObject[Self]): """Range definition.""" - class option(PyLocalProperty): + @final + @if_type_checking_instantiate + class option(PyLocalProperty[Literal["auto-range-on", "auto-range-off"]]): """Range option.""" - value: str = "auto-range-on" + value = "auto-range-on" @Attribute - def allowed_values(self): + def allowed_values(self) -> Sequence[Literal["auto-range-on", "auto-range-off"]]: """Range option allowed values.""" return ["auto-range-on", "auto-range-off"] - class auto_range_on(metaclass=PyLocalObjectMeta): + @if_type_checking_instantiate + class auto_range_on(PyLocalObject[Self]): """Auto range on definition.""" @Attribute - def is_active(self): + def is_active(self) -> bool: """Check whether current object is active or not.""" return self._parent.option() == "auto-range-on" - class global_range(PyLocalProperty): + @if_type_checking_instantiate + class global_range(PyLocalProperty[bool]): """Show global range.""" - value: bool = False + value = False - class auto_range_off(metaclass=PyLocalObjectMeta): + @if_type_checking_instantiate + class auto_range_off(PyLocalObject[Self]): """Auto range off definition.""" @Attribute - def is_active(self): + def is_active(self) -> bool: """Check whether current object is active or not.""" return self._parent.option() == "auto-range-off" - class clip_to_range(PyLocalProperty): + @if_type_checking_instantiate + class clip_to_range(PyLocalProperty[bool]): """Clip vector within range.""" - value: bool = False + value = False - class minimum(PyLocalProperty): + @if_type_checking_instantiate + class minimum(PyLocalProperty[float | None]): """Range minimum.""" - _value: float = None + _value = None @property - def value(self): + def value(self) -> float | None: """Range minimum property setter.""" if getattr(self, "_value", None) is None: field_data = self.field_data @@ -758,16 +827,17 @@ def value(self): return self._value @value.setter - def value(self, value): + def value(self, value: float | None) -> None: self._value = value - class maximum(PyLocalProperty): + @if_type_checking_instantiate + class maximum(PyLocalProperty[float | None]): """Range maximum.""" - _value: float = None + _value = None @property - def value(self): + def value(self) -> float | None: """Range maximum property setter.""" if getattr(self, "_value", None) is None: field_data = self.field_data @@ -779,5 +849,5 @@ def value(self): return self._value @value.setter - def value(self, value): + def value(self, value: float | None) -> None: self._value = value diff --git a/src/ansys/fluent/visualization/containers.py b/src/ansys/fluent/visualization/containers.py index 509b9395..92309e4a 100644 --- a/src/ansys/fluent/visualization/containers.py +++ b/src/ansys/fluent/visualization/containers.py @@ -22,7 +22,7 @@ """Containers for graphics.""" -from typing import TYPE_CHECKING, Any, Self, TypedDict, Unpack +from typing import TYPE_CHECKING, Any, Literal, Self, TypedDict, Unpack import warnings from ansys.fluent.core.field_data_interfaces import _to_field_name_str @@ -33,12 +33,18 @@ from ansys.fluent.visualization.graphics import Graphics from ansys.fluent.visualization.plotter import Plots + if TYPE_CHECKING: from ansys.fluent.core.session import BaseSession + from ansys.fluent.interface.post_objects.post_object_definitions import BasePostObjectDefn, SurfaceDefn, ContourDefn, GraphicsDefn, MonitorDefn, VectorDefn + from ansys.fluent.interface.post_objects.meta import _DeleteKwargs + class _GraphicsContainer: """Base class for graphics containers.""" + solver: BaseSession + _obj: BasePostObjectDefn def __init__(self, solver: BaseSession | None, **kwargs: Any): self.__dict__["solver"] = solver or _get_active_session() @@ -50,14 +56,15 @@ def __init__(self, solver: BaseSession | None, **kwargs: Any): if "vectors_of" in self.kwargs: self.kwargs["vectors_of"] = kwargs["vectors_of"] = _to_field_name_str(self.kwargs["vectors_of"]) - def __getattr__(self, attr): - return getattr(self._obj, attr) + if not TYPE_CHECKING: + def __getattr__(self, attr): + return getattr(self._obj, attr) - @override - def __setattr__(self, attr, value): - if attr == "surfaces": - value = list(value) - setattr(self._obj, attr, value) + @override + def __setattr__(self, attr, value): + if attr == "surfaces": # TODO typing? + value = list(value) + setattr(self._obj, attr, value) @override def __dir__(self) -> list[str]: @@ -95,8 +102,10 @@ class Mesh(_GraphicsContainer): >>> ) """ + _obj: GraphicsDefn + def __init__( - self, surfaces: list[str], show_edges: bool = False, solver: BaseSession | None = None, **kwargs: Any + self, surfaces: list[str], show_edges: bool = False, solver: BaseSession | None = None, **kwargs: Unpack[_DeleteKwargs] ): """__init__ method of Mesh class.""" kwargs.update( @@ -123,7 +132,7 @@ class SurfaceKwargs(TypedDict, total=False): normal: tuple[float, float, float] | None -class Surface(_GraphicsContainer): +class Surface(_GraphicsContainer, SurfaceDefn if TYPE_CHECKING else object): """Surface definition for Fluent post-processing. The ``Surface`` class represents any Fluent surface generated for @@ -171,89 +180,129 @@ class determines the session. >>> surf_outlet_plane.field = "y-coordinate" >>> surf_outlet_plane.iso_value = -0.125017 """ - _obj: Any + _obj: SurfaceDefn def __init__( self, type: str, solver: BaseSession | None = None, **kwargs: Unpack[SurfaceKwargs] ): """__init__ method of Surface class.""" - kwargs.update( - { - "type": type, - } - ) + kwargs.update({"type": type}) super().__init__(solver, **kwargs) - self.__dict__.update( - type=kwargs.pop("type", None), - creation_method=kwargs.pop("creation_method", None), - x=kwargs.pop("x", None), - y=kwargs.pop("y", None), - z=kwargs.pop("z", None), - field=kwargs.pop("field", None), - iso_value=kwargs.pop("iso_value", None), - rendering=kwargs.pop("rendering", None), - point=kwargs.pop("point", None), - normal=kwargs.pop("normal", None), - _obj=Graphics(session=self.solver).Surfaces.create(**kwargs), - ) - for attr in [ - "type", - "creation_method", - "x", - "y", - "z", - "field", - "iso_value", - "rendering", - "point", - "normal", - ]: - val = getattr(self, attr) - if val is not None: - setattr(self, attr, val) - - type: - - def __setattr__(self, attr, value): - if attr == "type": - self._obj.definition.type = value - elif attr == "creation_method": - self._obj.definition.plane_surface.creation_method = value - elif attr == "z": - if self._obj.definition.plane_surface.creation_method() != "xy-plane": - raise ValueError("Expected plane creation method to be 'xy-plane'") - self._obj.definition.plane_surface.xy_plane.z = value - elif attr == "y": - if self._obj.definition.plane_surface.creation_method() != "zx-plane": - raise ValueError("Expected plane creation method to be 'zx-plane'") - self._obj.definition.plane_surface.zx_plane.y = value - elif attr == "x": - if self._obj.definition.plane_surface.creation_method() != "yz-plane": - raise ValueError("Expected plane creation method to be 'yz-plane'") - self._obj.definition.plane_surface.yz_plane.x = value - elif attr == "field": - self._obj.definition.iso_surface.field = _to_field_name_str(value) - elif attr == "iso_value": - self._obj.definition.iso_surface.iso_value = value - elif attr == "rendering": - self._obj.definition.iso_surface.rendering = value - elif attr in ["point", "normal"]: - if ( - self._obj.definition.plane_surface.creation_method() - != "point-and-normal" - ): - raise ValueError( - "Expected plane creation method to be 'point-and-normal'" - ) - if attr == "point": - self._obj.definition.plane_surface.point.x = value[0] - self._obj.definition.plane_surface.point.y = value[1] - self._obj.definition.plane_surface.point.z = value[2] - elif attr == "normal": - norm = self._obj.definition.plane_surface.normal - norm.x, norm.y, norm.z = value - else: - setattr(self._obj, attr, value) + super().__setattr__("_obj", Graphics(session=self.solver).Surfaces.create(**kwargs)) + self.type = kwargs.get("type") + self.creation_method = kwargs.get("creation_method") + self.x = kwargs.get("x") + self.y = kwargs.get("y") + self.z = kwargs.get("z") + self.field = kwargs.get("field") + self.iso_value = kwargs.get("iso_value") + self.rendering = kwargs.get("rendering") + self.point = kwargs.get("point") + self.normal = kwargs.get("normal") + + @property + def type(self) -> Literal["plane-surface", "iso-surface"]: + """Surface definition type.""" + return self._obj.definition.type() + + @type.setter + def type(self, value: Literal["plane-surface", "iso-surface"]) -> None: + self._obj.definition.type = value + + @property + def creation_method(self) -> Literal["xy-plane", "yz-plane", "zx-plane", "point-and-normal"]: + """Plane surface creation method.""" + return self._obj.definition.plane_surface.creation_method() + + @creation_method.setter + def creation_method(self, value: Literal["xy-plane", "yz-plane", "zx-plane", "point-and-normal"]) -> None: + self._obj.definition.plane_surface.creation_method = value + + @property + def x(self) -> float: + """X coordinate for yz-plane.""" + return self._obj.definition.plane_surface.yz_plane.x() + + @x.setter + def x(self, value: float) -> None: + if self._obj.definition.plane_surface.creation_method() != "yz-plane": + raise ValueError("Expected plane creation method to be 'yz-plane'") + self._obj.definition.plane_surface.yz_plane.x = value + + @property + def y(self) -> float: + """Y coordinate for zx-plane.""" + return self._obj.definition.plane_surface.zx_plane.y() + + @y.setter + def y(self, value: float) -> None: + if self._obj.definition.plane_surface.creation_method() != "zx-plane": + raise ValueError("Expected plane creation method to be 'zx-plane'") + self._obj.definition.plane_surface.zx_plane.y = value + + @property + def z(self) -> float: + """Z coordinate for xy-plane.""" + return self._obj.definition.plane_surface.xy_plane.z() + + @z.setter + def z(self, value: float) -> None: + if self._obj.definition.plane_surface.creation_method() != "xy-plane": + raise ValueError("Expected plane creation method to be 'xy-plane'") + self._obj.definition.plane_surface.xy_plane.z = value + + @property + def field(self) -> str | None: + """Iso-surface field.""" + return self._obj.definition.iso_surface.field() + + @field.setter + def field(self, value: str | VariableDescriptor | None) -> None: + self._obj.definition.iso_surface.field = _to_field_name_str(value) + + @property + def iso_value(self) -> float | None: + """Iso-surface value.""" + return self._obj.definition.iso_surface.iso_value() + + @iso_value.setter + def iso_value(self, value: float | None) -> None: + self._obj.definition.iso_surface.iso_value = value + + @property + def rendering(self) -> Literal["mesh", "contour"]: + """Iso-surface rendering method.""" + return self._obj.definition.iso_surface.rendering() + + @rendering.setter + def rendering(self, value: Literal["mesh", "contour"]) -> None: + self._obj.definition.iso_surface.rendering = value + + @property + def point(self) -> tuple[float, float, float]: + """Point for point-and-normal surface.""" + pt = self._obj.definition.plane_surface.point + return (pt.x(), pt.y(), pt.z()) + + @point.setter + def point(self, value: tuple[float, float, float]) -> None: + if self._obj.definition.plane_surface.creation_method() != "point-and-normal": + raise ValueError("Expected plane creation method to be 'point-and-normal'") + pt = self._obj.definition.plane_surface.point + pt.x, pt.y, pt.z = value + + @property + def normal(self) -> tuple[float, float, float]: + """Normal vector for point-and-normal surface.""" + norm = self._obj.definition.plane_surface.normal + return (norm.x(), norm.y(), norm.z()) + + @normal.setter + def normal(self, value: tuple[float, float, float]) -> None: + if self._obj.definition.plane_surface.creation_method() != "point-and-normal": + raise ValueError("Expected plane creation method to be 'point-and-normal'") + norm = self._obj.definition.plane_surface.normal + norm.x, norm.y, norm.z = value class PlaneSurface(Surface): @@ -271,7 +320,7 @@ class PlaneSurface(Surface): >>> point=[0.0, 0.0, -0.0441921], >>> normal=[0.0, 0.0, 1.0], >>> ) - + >>> >>> # Create same plane using 'create_xy_plane' method >>> surf_xy_plane = PlaneSurface.create_xy_plane( >>> solver=solver_session, @@ -427,6 +476,8 @@ class Contour(_GraphicsContainer): >>> ) """ + _obj: ContourDefn + def __init__( self, field: str | VariableDescriptor, @@ -481,6 +532,8 @@ class Vector(_GraphicsContainer): >>> ) """ + _obj: VectorDefn + def __init__( self, field: str | VariableDescriptor, @@ -569,6 +622,7 @@ class Pathline(_GraphicsContainer): >>> surfaces = ["inlet", "inlet1", "inlet2"], >>> ) """ + _obj: GraphicsDefn def __init__( self, @@ -624,12 +678,13 @@ class XYPlot(_GraphicsContainer): >>> y_axis_function="temperature", >>> ) """ + _obj: GraphicsDefn def __init__( self, surfaces: list[str], y_axis_function: str | VariableDescriptor, - solver=None, + solver: BaseSession | None=None, local_surfaces_provider=None, **kwargs ): @@ -677,6 +732,7 @@ class Monitor(_GraphicsContainer): >>> from ansys.fluent.visualization import Monitor >>> residual = Monitor(solver=solver_session, monitor_set_name="residual") """ + _obj: MonitorDefn def __init__( self, monitor_set_name: str, solver=None, local_surfaces_provider=None, **kwargs diff --git a/src/ansys/fluent/visualization/graphics/graphics_objects.py b/src/ansys/fluent/visualization/graphics/graphics_objects.py index f51bbde8..e5375be3 100644 --- a/src/ansys/fluent/visualization/graphics/graphics_objects.py +++ b/src/ansys/fluent/visualization/graphics/graphics_objects.py @@ -142,19 +142,19 @@ class Surface(SurfaceDefn): .. code-block:: python - from ansys.fluent.visualization import Graphics - - graphics_session = Graphics(session) - surface1 = graphics_session.Surfaces["surface-1"] - surface1.definition.type = "iso-surface" - surface1.definition.iso_surface.field= "velocity-magnitude" - surface1.definition.iso_surface.rendering= "contour" - surface1.definition.iso_surface.iso_value = 0.0 - surface1.display("window-0") + >>> from ansys.fluent.visualization import Graphics + >>> + >>> graphics_session = Graphics(session) + >>> surface1 = graphics_session.Surfaces["surface-1"] + >>> surface1.type = "iso-surface" + >>> surface1.iso_surface.field= "velocity-magnitude" + >>> surface1.iso_surface.rendering= "contour" + >>> surface1.iso_surface.iso_value = 0.0 + >>> surface1.display("window-0") """ @Command - def display(self, window_id: str | None = None, overlay: bool | None = False): + def display(self, window_id: str | None = None, overlay: bool | None = False) -> None: """Display surface graphics. Parameters @@ -195,7 +195,7 @@ class Contour(ContourDefn): """ @Command - def display(self, window_id: str | None = None, overlay: bool | None = False): + def display(self, window_id: str | None = None, overlay: bool | None = False) -> None: """Display contour graphics. Parameters @@ -237,7 +237,7 @@ class Vector(VectorDefn): """ @Command - def display(self, window_id: str | None = None, overlay: bool | None = False): + def display(self, window_id: str | None = None, overlay: bool | None = False) -> None: """Display vector graphics. Parameters diff --git a/src/ansys/fluent/visualization/plotter/plotter_objects.py b/src/ansys/fluent/visualization/plotter/plotter_objects.py index baaa3d01..fd2e0d2c 100644 --- a/src/ansys/fluent/visualization/plotter/plotter_objects.py +++ b/src/ansys/fluent/visualization/plotter/plotter_objects.py @@ -28,6 +28,7 @@ from ansys.fluent.interface.post_objects.post_helper import PostAPIHelper from ansys.fluent.interface.post_objects.post_object_definitions import ( MonitorDefn, + SurfaceDefn, XYPlotDefn, ) from ansys.fluent.interface.post_objects.post_objects_container import ( @@ -45,7 +46,7 @@ class Plots(PlotsContainer): """ def __init__( - self, session, post_api_helper=PostAPIHelper, local_surfaces_provider=None + self, session, post_api_helper=PostAPIHelper, local_surfaces_provider: SurfaceDefn | None=None ): super().__init__( session, sys.modules[__name__], post_api_helper, local_surfaces_provider From b2c91f4c43cd9756360ad535a2c983ad17c5415c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 22 Dec 2025 17:51:34 +0000 Subject: [PATCH 06/20] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../fluent/interface/post_objects/meta.py | 34 ++++++---- .../post_objects/post_object_definitions.py | 49 ++++++++++++--- src/ansys/fluent/visualization/containers.py | 62 ++++++++++++++----- .../graphics/graphics_objects.py | 12 +++- .../visualization/plotter/plotter_objects.py | 5 +- 5 files changed, 123 insertions(+), 39 deletions(-) diff --git a/src/ansys/fluent/interface/post_objects/meta.py b/src/ansys/fluent/interface/post_objects/meta.py index c08ef08f..c80f2ac9 100644 --- a/src/ansys/fluent/interface/post_objects/meta.py +++ b/src/ansys/fluent/interface/post_objects/meta.py @@ -23,7 +23,7 @@ """Metaclasses used in various explicit classes in PyFluent.""" from abc import ABC -from collections.abc import Callable, Iterator, MutableMapping, Mapping, Sequence +from collections.abc import Callable, Iterator, Mapping, MutableMapping, Sequence import inspect from typing import ( TYPE_CHECKING, @@ -33,15 +33,23 @@ Never, Protocol, Self, + Unpack, cast, dataclass_transform, overload, - override, Unpack, + override, ) from ansys.fluent.core.exceptions import DisallowedValuesError from ansys.fluent.core.session_solver import Solver -from typing_extensions import ParamSpec, TypeVar, get_args, get_original_bases, NotRequired, TypedDict +from typing_extensions import ( + NotRequired, + ParamSpec, + TypedDict, + TypeVar, + get_args, + get_original_bases, +) from ansys.fluent.interface.post_objects.post_object_definitions import ( BasePostObjectDefn, @@ -122,8 +130,7 @@ def __get__(self, instance: None, _) -> Self: ... @overload def __get__( self, instance: _SelfT, _ # pyright: ignore[reportGeneralTypeIssues] - ) -> _T_co: - ... + ) -> _T_co: ... def __get__(self, instance: _SelfT | None, _) -> _T_co | Self: if instance is None: @@ -243,7 +250,7 @@ def get_ancestors_by_name(self, instance, owner: type | None = None): parent = self.get_ancestors_by_name(owner, instance._parent) return parent - def get_root(self, instance = None) -> "PyLocalBase": + def get_root(self, instance=None) -> "PyLocalBase": instance = self if instance is None else instance parent = instance if getattr(instance, "_parent", None): @@ -335,6 +342,7 @@ def __call__(self) -> T: return rv if TYPE_CHECKING: # TODO double check this is on the right thing + def __set__(self, instance: object, value: T) -> None: ... def set_state(self, value: T): @@ -347,10 +355,10 @@ def _register_on_change_cb(self, on_change_cb: Callable[[], None]): @Attribute @overload - def allowed_values(self: "PyLocalProperty[Sequence[T2]]") -> Sequence[T2]:... + def allowed_values(self: "PyLocalProperty[Sequence[T2]]") -> Sequence[T2]: ... @Attribute @overload - def allowed_values(self: "PyLocalProperty[T2]") -> Sequence[T2]:... + def allowed_values(self: "PyLocalProperty[T2]") -> Sequence[T2]: ... @Attribute def allowed_values(self) -> Sequence[object]: """Get allowed values.""" @@ -406,12 +414,15 @@ def reset(self, path: str, location: str, session_id: str) -> None: ParentT = TypeVar("ParentT") + # TODO try poking around this more cause it is kinda what we are doing? # @dataclass_transform(field_specifiers=(type,)) class PyLocalObject(PyLocalBase, Generic[ParentT]): """Local object classes.""" - def __init__(self, parent: ParentT, api_helper: Callable[[Self], APIHelper], name: str = ""): + def __init__( + self, parent: ParentT, api_helper: Callable[[Self], APIHelper], name: str = "" + ): """Create the initialization method for 'PyLocalObjectMeta'.""" self._parent = parent self._name = name @@ -546,6 +557,7 @@ def __setattr__(self, name: str, value: Any): CallKwargs = TypeVar("CallKwargs", bound=TypedDict) + class PyLocalCommand(PyLocalObject[ParentT], Generic[ParentT, CallKwargs]): """Local object metaclass.""" @@ -641,6 +653,7 @@ class PyLocalNamedObjectAbstract(ABC, PyLocalNamedObject): DefnT = TypeVar("DefnT", bound=GraphicsDefn | PlotDefn, default=GraphicsDefn | PlotDefn) + def if_type_checking_instantiate(type: type[T]) -> T: return cast(T, type) # this is hopefully obviously unsafe @@ -648,11 +661,11 @@ def if_type_checking_instantiate(type: type[T]) -> T: class _DeleteKwargs(TypedDict, total=False): names: list[str] + class _CreateKwargs(TypedDict, total=False): name: str | None - class PyLocalContainer(MutableMapping[str, DefnT]): """Local container for named objects.""" @@ -819,4 +832,3 @@ class name(PyLocalProperty[str | None]): # added by __init__ delete: Delete create: Create - diff --git a/src/ansys/fluent/interface/post_objects/post_object_definitions.py b/src/ansys/fluent/interface/post_objects/post_object_definitions.py index 215a17b9..bf78df60 100644 --- a/src/ansys/fluent/interface/post_objects/post_object_definitions.py +++ b/src/ansys/fluent/interface/post_objects/post_object_definitions.py @@ -42,7 +42,6 @@ logger = logging.getLogger("pyfluent.post_objects") - class BasePostObjectDefn(Protocol, metaclass=abc.ABCMeta): """Base class for visualization objects.""" @@ -275,7 +274,9 @@ class type(PyLocalProperty[Literal["plane-surface", "iso-surface"]]): value = "iso-surface" @Attribute - def allowed_values(self) -> Sequence[Literal["plane-surface", "iso-surface"]]: + def allowed_values( + self, + ) -> Sequence[Literal["plane-surface", "iso-surface"]]: """Surface type allowed values.""" return ["plane-surface", "iso-surface"] @@ -300,7 +301,11 @@ class creation_method( value = "xy-plane" @Attribute - def allowed_values(self) -> Sequence[Literal["xy-plane", "yz-plane", "zx-plane", "point-and-normal"]]: + def allowed_values( + self, + ) -> Sequence[ + Literal["xy-plane", "yz-plane", "zx-plane", "point-and-normal"] + ]: """Surface type allowed values.""" return ["xy-plane", "yz-plane", "zx-plane", "point-and-normal"] @@ -322,7 +327,15 @@ class x(PyLocalProperty[float]): @Attribute def range(self) -> tuple[float, float]: """X value range.""" - return cast(tuple[float, float], cast(object, self.field_data.scalar_fields.range("x-coordinate", True))) + return cast( + tuple[float, float], + cast( + object, + self.field_data.scalar_fields.range( + "x-coordinate", True + ), + ), + ) @if_type_checking_instantiate class y(PyLocalProperty[float]): @@ -333,7 +346,15 @@ class y(PyLocalProperty[float]): @Attribute def range(self) -> tuple[float, float]: """Y value range.""" - return cast(tuple[float, float], cast(object, self.field_data.scalar_fields.range("y-coordinate", True))) + return cast( + tuple[float, float], + cast( + object, + self.field_data.scalar_fields.range( + "y-coordinate", True + ), + ), + ) @if_type_checking_instantiate class z(PyLocalProperty[float]): @@ -344,7 +365,15 @@ class z(PyLocalProperty[float]): @Attribute def range(self) -> tuple[float, float]: """Z value range.""" - return cast(tuple[float, float], cast(object, self.field_data.scalar_fields.range("z-coordinate", True))) + return cast( + tuple[float, float], + cast( + object, + self.field_data.scalar_fields.range( + "z-coordinate", True + ), + ), + ) @if_type_checking_instantiate class normal(PyLocalObject[Self]): @@ -608,7 +637,9 @@ class option(PyLocalProperty[Literal["auto-range-on", "auto-range-off"]]): value = "auto-range-on" @Attribute - def allowed_values(self) -> Sequence[Literal["auto-range-on", "auto-range-off"]]: + def allowed_values( + self, + ) -> Sequence[Literal["auto-range-on", "auto-range-off"]]: """Range option allowed values.""" return ["auto-range-on", "auto-range-off"] @@ -774,7 +805,9 @@ class option(PyLocalProperty[Literal["auto-range-on", "auto-range-off"]]): value = "auto-range-on" @Attribute - def allowed_values(self) -> Sequence[Literal["auto-range-on", "auto-range-off"]]: + def allowed_values( + self, + ) -> Sequence[Literal["auto-range-on", "auto-range-off"]]: """Range option allowed values.""" return ["auto-range-on", "auto-range-off"] diff --git a/src/ansys/fluent/visualization/containers.py b/src/ansys/fluent/visualization/containers.py index 92309e4a..8a473e6e 100644 --- a/src/ansys/fluent/visualization/containers.py +++ b/src/ansys/fluent/visualization/containers.py @@ -33,16 +33,23 @@ from ansys.fluent.visualization.graphics import Graphics from ansys.fluent.visualization.plotter import Plots - if TYPE_CHECKING: from ansys.fluent.core.session import BaseSession - from ansys.fluent.interface.post_objects.post_object_definitions import BasePostObjectDefn, SurfaceDefn, ContourDefn, GraphicsDefn, MonitorDefn, VectorDefn from ansys.fluent.interface.post_objects.meta import _DeleteKwargs + from ansys.fluent.interface.post_objects.post_object_definitions import ( + BasePostObjectDefn, + ContourDefn, + GraphicsDefn, + MonitorDefn, + SurfaceDefn, + VectorDefn, + ) class _GraphicsContainer: """Base class for graphics containers.""" + solver: BaseSession _obj: BasePostObjectDefn @@ -52,11 +59,16 @@ def __init__(self, solver: BaseSession | None, **kwargs: Any): if self.solver is None: raise RuntimeError("No solver session provided and none found in context.") if "field" in self.kwargs: - self.kwargs["field"] = kwargs["field"] = _to_field_name_str(self.kwargs["field"]) + self.kwargs["field"] = kwargs["field"] = _to_field_name_str( + self.kwargs["field"] + ) if "vectors_of" in self.kwargs: - self.kwargs["vectors_of"] = kwargs["vectors_of"] = _to_field_name_str(self.kwargs["vectors_of"]) + self.kwargs["vectors_of"] = kwargs["vectors_of"] = _to_field_name_str( + self.kwargs["vectors_of"] + ) if not TYPE_CHECKING: + def __getattr__(self, attr): return getattr(self._obj, attr) @@ -105,7 +117,11 @@ class Mesh(_GraphicsContainer): _obj: GraphicsDefn def __init__( - self, surfaces: list[str], show_edges: bool = False, solver: BaseSession | None = None, **kwargs: Unpack[_DeleteKwargs] + self, + surfaces: list[str], + show_edges: bool = False, + solver: BaseSession | None = None, + **kwargs: Unpack[_DeleteKwargs], ): """__init__ method of Mesh class.""" kwargs.update( @@ -119,6 +135,7 @@ def __init__( **self.kwargs ) + class SurfaceKwargs(TypedDict, total=False): type: str | None creation_method: str | None @@ -180,15 +197,21 @@ class determines the session. >>> surf_outlet_plane.field = "y-coordinate" >>> surf_outlet_plane.iso_value = -0.125017 """ + _obj: SurfaceDefn def __init__( - self, type: str, solver: BaseSession | None = None, **kwargs: Unpack[SurfaceKwargs] + self, + type: str, + solver: BaseSession | None = None, + **kwargs: Unpack[SurfaceKwargs], ): """__init__ method of Surface class.""" kwargs.update({"type": type}) super().__init__(solver, **kwargs) - super().__setattr__("_obj", Graphics(session=self.solver).Surfaces.create(**kwargs)) + super().__setattr__( + "_obj", Graphics(session=self.solver).Surfaces.create(**kwargs) + ) self.type = kwargs.get("type") self.creation_method = kwargs.get("creation_method") self.x = kwargs.get("x") @@ -210,12 +233,16 @@ def type(self, value: Literal["plane-surface", "iso-surface"]) -> None: self._obj.definition.type = value @property - def creation_method(self) -> Literal["xy-plane", "yz-plane", "zx-plane", "point-and-normal"]: + def creation_method( + self, + ) -> Literal["xy-plane", "yz-plane", "zx-plane", "point-and-normal"]: """Plane surface creation method.""" return self._obj.definition.plane_surface.creation_method() @creation_method.setter - def creation_method(self, value: Literal["xy-plane", "yz-plane", "zx-plane", "point-and-normal"]) -> None: + def creation_method( + self, value: Literal["xy-plane", "yz-plane", "zx-plane", "point-and-normal"] + ) -> None: self._obj.definition.plane_surface.creation_method = value @property @@ -424,11 +451,11 @@ class IsoSurface(Surface): def __init__( self, - solver: BaseSession| None=None, + solver: BaseSession | None = None, field: str | VariableDescriptor | None = None, rendering: str | None = None, iso_value: float | None = None, - **kwargs:Any, + **kwargs: Any, ): """Create an iso-surface.""" super().__init__( @@ -483,7 +510,7 @@ def __init__( field: str | VariableDescriptor, surfaces: list[str], solver=None, - **kwargs + **kwargs, ): """__init__ method of Contour class.""" kwargs.update( @@ -541,7 +568,7 @@ def __init__( color_by: str | VariableDescriptor | None = None, scale: float = 1.0, solver=None, - **kwargs + **kwargs, ): """__init__ method of Vector class.""" if color_by is None: @@ -622,6 +649,7 @@ class Pathline(_GraphicsContainer): >>> surfaces = ["inlet", "inlet1", "inlet2"], >>> ) """ + _obj: GraphicsDefn def __init__( @@ -629,7 +657,7 @@ def __init__( field: str | VariableDescriptor, surfaces: list[str], solver=None, - **kwargs + **kwargs, ): """__init__ method of Pathline class.""" kwargs.update( @@ -678,15 +706,16 @@ class XYPlot(_GraphicsContainer): >>> y_axis_function="temperature", >>> ) """ + _obj: GraphicsDefn def __init__( self, surfaces: list[str], y_axis_function: str | VariableDescriptor, - solver: BaseSession | None=None, + solver: BaseSession | None = None, local_surfaces_provider=None, - **kwargs + **kwargs, ): """__init__ method of XYPlot class.""" kwargs.update( @@ -732,6 +761,7 @@ class Monitor(_GraphicsContainer): >>> from ansys.fluent.visualization import Monitor >>> residual = Monitor(solver=solver_session, monitor_set_name="residual") """ + _obj: MonitorDefn def __init__( diff --git a/src/ansys/fluent/visualization/graphics/graphics_objects.py b/src/ansys/fluent/visualization/graphics/graphics_objects.py index e5375be3..1504d443 100644 --- a/src/ansys/fluent/visualization/graphics/graphics_objects.py +++ b/src/ansys/fluent/visualization/graphics/graphics_objects.py @@ -154,7 +154,9 @@ class Surface(SurfaceDefn): """ @Command - def display(self, window_id: str | None = None, overlay: bool | None = False) -> None: + def display( + self, window_id: str | None = None, overlay: bool | None = False + ) -> None: """Display surface graphics. Parameters @@ -195,7 +197,9 @@ class Contour(ContourDefn): """ @Command - def display(self, window_id: str | None = None, overlay: bool | None = False) -> None: + def display( + self, window_id: str | None = None, overlay: bool | None = False + ) -> None: """Display contour graphics. Parameters @@ -237,7 +241,9 @@ class Vector(VectorDefn): """ @Command - def display(self, window_id: str | None = None, overlay: bool | None = False) -> None: + def display( + self, window_id: str | None = None, overlay: bool | None = False + ) -> None: """Display vector graphics. Parameters diff --git a/src/ansys/fluent/visualization/plotter/plotter_objects.py b/src/ansys/fluent/visualization/plotter/plotter_objects.py index fd2e0d2c..87bb9f06 100644 --- a/src/ansys/fluent/visualization/plotter/plotter_objects.py +++ b/src/ansys/fluent/visualization/plotter/plotter_objects.py @@ -46,7 +46,10 @@ class Plots(PlotsContainer): """ def __init__( - self, session, post_api_helper=PostAPIHelper, local_surfaces_provider: SurfaceDefn | None=None + self, + session, + post_api_helper=PostAPIHelper, + local_surfaces_provider: SurfaceDefn | None = None, ): super().__init__( session, sys.modules[__name__], post_api_helper, local_surfaces_provider From 0e658a11ae5dc59b184eeb1e58d086307e08acb1 Mon Sep 17 00:00:00 2001 From: Gobot1234 Date: Sat, 27 Dec 2025 20:03:52 +0000 Subject: [PATCH 07/20] types: more # Conflicts: # src/ansys/fluent/interface/post_objects/meta.py # src/ansys/fluent/visualization/containers.py --- .../post_processing_context_manager.py | 6 +- .../fluent/interface/post_objects/meta.py | 246 ++++++++---------- .../interface/post_objects/post_helper.py | 15 +- .../post_objects/post_object_definitions.py | 54 ++-- .../post_objects/post_objects_container.py | 67 ++--- src/ansys/fluent/visualization/containers.py | 115 ++++---- src/ansys/fluent/visualization/contour.py | 11 +- .../fluent/visualization/graphics/__init__.py | 6 +- .../graphics/graphics_objects.py | 4 +- .../graphics/graphics_windows_manager.py | 48 +++- .../graphics/pyvista/renderer.py | 2 +- .../plotter/plotter_windows_manager.py | 8 +- .../visualization/post_data_extractor.py | 21 +- src/ansys/fluent/visualization/renderer.py | 8 +- 14 files changed, 319 insertions(+), 292 deletions(-) diff --git a/examples/00-post_processing/post_processing_context_manager.py b/examples/00-post_processing/post_processing_context_manager.py index 9e24d3c1..405f0253 100644 --- a/examples/00-post_processing/post_processing_context_manager.py +++ b/examples/00-post_processing/post_processing_context_manager.py @@ -128,17 +128,17 @@ graphics_window = GraphicsWindow() surf_xy_plane = PlaneSurface.create_from_point_and_normal( - point=[0.0, 0.0, -0.0441921], normal=[0.0, 0.0, 1.0] + point=(0.0, 0.0, -0.0441921), normal=(0.0, 0.0, 1.0) ) graphics_window.add_graphics(surf_xy_plane, position=(0, 0)) surf_yz_plane = PlaneSurface.create_from_point_and_normal( - point=[-0.174628, 0.0, 0.0], normal=[1.0, 0.0, 0.0] + point=(-0.174628, 0.0, 0.0), normal=(1.0, 0.0, 0.0) ) graphics_window.add_graphics(surf_yz_plane, position=(0, 1)) surf_zx_plane = PlaneSurface.create_from_point_and_normal( - point=[0.0, -0.0627297, 0.0], normal=[0.0, 1.0, 0.0] + point=(0.0, -0.0627297, 0.0), normal=(0.0, 1.0, 0.0) ) graphics_window.add_graphics(surf_zx_plane, position=(0, 2)) diff --git a/src/ansys/fluent/interface/post_objects/meta.py b/src/ansys/fluent/interface/post_objects/meta.py index c80f2ac9..8e07453c 100644 --- a/src/ansys/fluent/interface/post_objects/meta.py +++ b/src/ansys/fluent/interface/post_objects/meta.py @@ -23,7 +23,7 @@ """Metaclasses used in various explicit classes in PyFluent.""" from abc import ABC -from collections.abc import Callable, Iterator, Mapping, MutableMapping, Sequence +from collections.abc import Callable, Iterator, MutableMapping, Sequence import inspect from typing import ( TYPE_CHECKING, @@ -35,7 +35,6 @@ Self, Unpack, cast, - dataclass_transform, overload, override, ) @@ -51,8 +50,13 @@ get_original_bases, ) +from ansys.fluent.interface.post_objects.post_helper import PostAPIHelper from ansys.fluent.interface.post_objects.post_object_definitions import ( BasePostObjectDefn, + ContourDefn, + Defns, + MonitorDefn, + VectorDefn, ) if TYPE_CHECKING: @@ -130,7 +134,8 @@ def __get__(self, instance: None, _) -> Self: ... @overload def __get__( self, instance: _SelfT, _ # pyright: ignore[reportGeneralTypeIssues] - ) -> _T_co: ... + ) -> _T_co: + ... def __get__(self, instance: _SelfT | None, _) -> _T_co | Self: if instance is None: @@ -224,13 +229,14 @@ def __get__(self, instance: _SelfT, _): # pyright: ignore[reportGeneralTypeIssu T = TypeVar("T") T2 = TypeVar("T2") +AccessorT = TypeVar("AccessorT", bound=BasePostObjectDefn) class PyLocalBase: """Local base.""" def get_ancestors_by_type( - self, instance: BasePostObjectDefn, owner: "PyLocalBase | None" = None - ): + self, instance: type[AccessorT], owner: "PyLocalBase | None" = None + ) -> AccessorT: owner = self if owner is None else owner parent = None if getattr(owner, "_parent", None): @@ -239,18 +245,7 @@ def get_ancestors_by_type( parent = self.get_ancestors_by_type(instance, owner._parent) return parent - def get_ancestors_by_name(self, instance, owner: type | None = None): - instance = self if instance is None else instance - parent = None - if getattr(instance, "_parent", None): - if instance._parent.__class__.__name__ == owner: - return instance._parent - if getattr(instance._parent, "PLURAL", None) == owner: - return instance._parent._parent - parent = self.get_ancestors_by_name(owner, instance._parent) - return parent - - def get_root(self, instance=None) -> "PyLocalBase": + def get_root(self, instance = None) -> Container: instance = self if instance is None else instance parent = instance if getattr(instance, "_parent", None): @@ -297,7 +292,7 @@ class PyLocalProperty(PyLocalBase, Generic[T]): value: T # pyright: ignore[reportUninitializedInstanceVariable] - def __init__(self, parent, api_helper: Callable[[Self], APIHelper], name: str = ""): + def __init__(self, parent, api_helper: type[PostAPIHelper], name: str = ""): self._name = name self._api_helper = api_helper(self) self._parent = parent @@ -341,8 +336,7 @@ def __call__(self) -> T: return rv - if TYPE_CHECKING: # TODO double check this is on the right thing - + if TYPE_CHECKING: def __set__(self, instance: object, value: T) -> None: ... def set_state(self, value: T): @@ -355,74 +349,65 @@ def _register_on_change_cb(self, on_change_cb: Callable[[], None]): @Attribute @overload - def allowed_values(self: "PyLocalProperty[Sequence[T2]]") -> Sequence[T2]: ... + def allowed_values(self: "PyLocalProperty[Sequence[T2]]") -> Sequence[T2]:... @Attribute @overload - def allowed_values(self: "PyLocalProperty[T2]") -> Sequence[T2]: ... + def allowed_values(self: "PyLocalProperty[T2]") -> Sequence[T2]:... @Attribute def allowed_values(self) -> Sequence[object]: """Get allowed values.""" raise NotImplementedError("allowed_values not implemented.") -class PyReferenceObject: - """Local object classes.""" - - def __init__(self, parent, path, location, session_id, name=""): - self._parent = parent - self.type = "object" - self.parent = parent - self._path = path - self.location = location - self.session_id = session_id - - def update(clss): - for name, cls in clss.__dict__.items(): - if cls.__class__.__name__ in ( - "PyLocalPropertyMeta", - "PyLocalObjectMeta", - ): - setattr( - self, - name, - cls(self, lambda arg: None, name), - ) - if cls.__class__.__name__ in { - "PyLocalNamedObjectMeta", - "PyLocalNamedObjectMetaAbstract", - }: - setattr( - self, - cls.PLURAL, - PyLocalContainer(self, cls, lambda arg: None, cls.PLURAL), - ) - for base_class in clss.__bases__: - update(base_class) - - update(self.__class__) - - def get_path(self): - return self._path - - def reset(self, path: str, location: str, session_id: str) -> None: - self._path = path - self.location = location - self.session_id = session_id - if hasattr(self, "_object"): - delattr(self, "_object") +# class PyReferenceObject: +# """Local object classes.""" + +# def __init__(self, parent, path, location, session_id, name: str = ""): +# self._parent = parent +# self.type = "object" +# self.parent = parent +# self._path = path +# self.location = location +# self.session_id = session_id + +# def update(clss): +# for name, cls in inspect.getmembers(clss, predicate=inspect.isclass): +# if issubclass(cls, (PyLocalProperty, PyLocalObject)): +# setattr( +# self, +# name, +# cls(self, lambda arg: None, name), +# ) +# if issubclass(cls, (PyLocalNamedObject, PyLocalNamedObjectAbstract)): +# setattr( +# self, +# cls.PLURAL, +# PyLocalContainer(self, cls, lambda arg: None, cls.PLURAL), +# ) +# for base_class in clss.__bases__: +# update(base_class) + +# update(self.__class__) + +# def get_path(self): +# return self._path + +# def reset(self, path: str, location: str, session_id: str) -> None: +# self._path = path +# self.location = location +# self.session_id = session_id +# if hasattr(self, "_object"): +# delattr(self, "_object") ParentT = TypeVar("ParentT") - # TODO try poking around this more cause it is kinda what we are doing? # @dataclass_transform(field_specifiers=(type,)) class PyLocalObject(PyLocalBase, Generic[ParentT]): """Local object classes.""" - def __init__( - self, parent: ParentT, api_helper: Callable[[Self], APIHelper], name: str = "" - ): + def __init__(self, parent: ParentT, api_helper: type[PostAPIHelper], name: str = ""): """Create the initialization method for 'PyLocalObjectMeta'.""" self._parent = parent self._name = name @@ -431,35 +416,28 @@ def __init__( self.type = "object" def update(clss: type[PyLocalBase]): - for name, cls in clss.__dict__.items(): - if cls.__name__ in {"PyLocalCommand"}: + for name, cls in inspect.getmembers(clss, predicate=inspect.isclass): + if issubclass(cls, PyLocalCommand): self._command_names.append(name) - if cls.__name__ in { - "PyLocalProperty", - "PyLocalObject", - "PyLocalCommand", - }: + if issubclass(cls, (PyLocalProperty, PyLocalObject, PyLocalCommand)): setattr( self, name, cls(self, api_helper, name), ) - if cls.__name__ in { - "PyLocalNamedObject", - "PyLocalNamedObjectAbstract", - }: + if issubclass(cls, (PyLocalNamedObject, PyLocalNamedObjectAbstract)): setattr( self, cls.PLURAL, PyLocalContainer(self, cls, api_helper, cls.PLURAL), ) - if cls.__class__.__name__ == "PyReferenceObject": - setattr( - self, - name, - cls(self, cls.PATH, cls.LOCATION, cls.SESSION, name), - ) + # if issubclass(cls, PyReferenceObject): + # setattr( + # self, + # name, + # cls(self, cls.PATH, cls.LOCATION, cls.SESSION, name), + # ) for base_class in clss.__bases__: update(base_class) @@ -484,11 +462,11 @@ def update(self, value: dict[str, Any]): properties.update(sorted_properties) for name, val in properties.items(): obj = getattr(self, name) - if obj.__class__.__name__ == "PyLocalProperty": + if isinstance(obj, PyLocalProperty): obj.set_state(val) else: - if obj.__class__.__name__ == "PyReferenceObject": - obj = obj.ref + # if isinstance(obj, PyReferenceObject): + # obj = obj.ref obj.update(val) def get_state(self, show_attributes: bool = False) -> dict[str, Any] | None: @@ -498,31 +476,25 @@ def get_state(self, show_attributes: bool = False) -> dict[str, Any] | None: return def update_state(clss): - for name, cls in clss.__dict__.items(): + for name, cls in inspect.getmembers(clss, predicate=inspect.isclass): o = getattr(self, name) if o is None or name.startswith("_") or name.startswith("__"): continue - if cls.__name__ == "PyReferenceObject": - if o.LOCATION == "local": - o = o.ref - else: - continue - elif cls.__name__ == "PyLocalCommand": + # if issubclass(cls, PyReferenceObject): + # if o.LOCATION == "local": + # o = o.ref + # else: + # continue + if issubclass(cls, PyLocalCommand): args = {} for arg in o._args: args[arg] = getattr(o, arg)() state[name] = args - if ( - cls.__name__ == "PyLocalObject" - or cls.__name__ == "PyReferenceObject" - ): + if issubclass(cls, PyLocalObject): if getattr(o, "is_active", True): state[name] = o(show_attributes) - elif ( - cls.__name__ == "PyLocalNamedObject" - or cls.__name__ == "PyLocalNamedObjectAbstract" - ): + elif issubclass(cls, (PyLocalNamedObject, PyLocalNamedObjectAbstract)): container = getattr(self, cls.PLURAL) if getattr(container, "is_active", True): state[cls.PLURAL] = {} @@ -531,7 +503,7 @@ def update_state(clss): if getattr(o, "is_active", True): state[cls.PLURAL][child_name] = o() - elif cls.__name__ == "PyLocalProperty": + elif issubclass(cls, PyLocalProperty): if getattr(o, "is_active", True): state[name] = o() attrs = show_attributes and getattr(o, "attributes", None) @@ -549,7 +521,7 @@ def update_state(clss): def __setattr__(self, name: str, value: Any): attr = getattr(self, name, None) - if attr and attr.__class__.__name__ == "PyLocalProperty": + if attr and isinstance(attr, PyLocalProperty): attr.set_state(value) else: object.__setattr__(self, name, value) @@ -557,11 +529,10 @@ def __setattr__(self, name: str, value: Any): CallKwargs = TypeVar("CallKwargs", bound=TypedDict) - class PyLocalCommand(PyLocalObject[ParentT], Generic[ParentT, CallKwargs]): """Local object metaclass.""" - def __init__(self, parent, api_helper: Callable[[Self], APIHelper], name=""): + def __init__(self, parent: ParentT, api_helper: type[PostAPIHelper], name=""): self._parent = parent self._name = name self._api_helper = api_helper(self) @@ -571,11 +542,8 @@ def __init__(self, parent, api_helper: Callable[[Self], APIHelper], name=""): self._exe_cmd = getattr(self, "_exe_cmd") def update(clss): - for name, cls in clss.__dict__.items(): - if cls.__class__.__name__ in ( - "PyLocalCommandArgMeta", - "PyLocalPropertyMeta", - ): + for name, cls in inspect.getmembers(clss, predicate=inspect.isclass): + if issubclass(cls, PyLocalProperty): self._args.append(name) setattr( self, @@ -596,10 +564,10 @@ def __call__(self, **kwargs: Unpack[CallKwargs]): return self._exe_cmd(**cmd_args) -class PyLocalNamedObject(PyLocalObject): +class PyLocalNamedObject(PyLocalObject[ParentT]): """Base class for local named object classes.""" - def __init__(self, name: str, parent, api_helper: Callable[[Self], APIHelper]): + def __init__(self, name: str, parent: ParentT, api_helper: type[PostAPIHelper]): self._name = name self._api_helper = api_helper(self) self._parent = parent @@ -607,15 +575,11 @@ def __init__(self, name: str, parent, api_helper: Callable[[Self], APIHelper]): self.type = "object" def update(clss): - for name, cls in clss.__dict__.items(): - if cls.__name__ in ("PyLocalCommand"): + for name, cls in inspect.getmembers(clss, predicate=inspect.isclass): + if issubclass(cls, PyLocalCommand): self._command_names.append(name) - if cls.__name__ in ( - "PyLocalProperty", - "PyLocalObject", - "PyLocalCommand", - ): + if issubclass(cls, (PyLocalProperty, PyLocalObject, PyLocalCommand)): # delete old property if overridden if getattr(self, name).__name__ == name: delattr(self, name) @@ -624,17 +588,14 @@ def update(clss): name, cls(self, api_helper, name), ) - elif ( # TODO these are gone, can we not use instance checks here? - cls.__name__ == "PyLocalNamedObject" - or cls.__name__ == "PyLocalNamedObjectAbstract" - ): + elif issubclass(cls, (PyLocalNamedObject, PyLocalNamedObjectAbstract)): setattr( self, cls.PLURAL, PyLocalContainer(self, cls, api_helper, cls.PLURAL), ) - elif cls.__name__ == "PyReferenceObject": - setattr(self, name, cls(self, cls.PATH, cls.LOCATION, cls.SESSION)) + # elif issubclass(cls, PyReferenceObject): + # setattr(self, name, cls(self, cls.PATH, cls.LOCATION, cls.SESSION)) for base_class in clss.__bases__: update(base_class) @@ -642,7 +603,7 @@ def update(clss): if TYPE_CHECKING: - def create(cls) -> Self: ... + def create(self) -> Self: ... class PyLocalNamedObjectAbstract(ABC, PyLocalNamedObject): @@ -651,29 +612,28 @@ class PyLocalNamedObjectAbstract(ABC, PyLocalNamedObject): pass -DefnT = TypeVar("DefnT", bound=GraphicsDefn | PlotDefn, default=GraphicsDefn | PlotDefn) - +DefnT = TypeVar("DefnT", bound=Defns, default=Defns) -def if_type_checking_instantiate(type: type[T]) -> T: +def if_type_checking_instantiate(type: type[T]) -> T: # the current behaviour has all of the classes that use this initialised in the XXX class return cast(T, type) # this is hopefully obviously unsafe class _DeleteKwargs(TypedDict, total=False): names: list[str] - class _CreateKwargs(TypedDict, total=False): name: str | None + class PyLocalContainer(MutableMapping[str, DefnT]): """Local container for named objects.""" def __init__( self, parent: "Container", - object_class: type[DefnT], - api_helper: Callable[[Self], APIHelper], + object_class: type[PyLocalNamedObject[object]], + api_helper: type[PostAPIHelper], name: str = "", ): """Initialize the 'PyLocalContainer' object.""" @@ -685,6 +645,7 @@ def __init__( self.type = "named-object" self._command_names = [] + if hasattr(object_class, "SHOW_AS_SEPARATE_OBJECT"): PyLocalContainer.show_as_separate_object = property( lambda self: self.__object_class.SHOW_AS_SEPARATE_OBJECT(self) @@ -714,11 +675,9 @@ def __init__( lambda self: self.__object_class.IS_ACTIVE(self) ) - for name, cls in self.__class__.__dict__.items(): - if cls.__class__.__name__ in ("PyLocalCommandMeta"): + for name, cls in inspect.getmembers(self.__class__, predicate=inspect.isclass): + if issubclass(cls, PyLocalCommand): self._command_names.append(name) - - if cls.__class__.__name__ in ("PyLocalCommandMeta"): setattr( self, name, @@ -796,7 +755,7 @@ def _get_unique_chid_name(self) -> str: index += 1 return unique_name - class Delete(PyLocalCommand[Self, _DeleteKwargs]): + class Delete(PyLocalCommand["PyLocalContainer", _DeleteKwargs]): """Local delete command.""" def _exe_cmd(self, names: list[str]) -> None: @@ -814,7 +773,7 @@ def allowed_values(self): """Get allowed values.""" return list(self._parent._parent) - class Create(PyLocalCommand[Self, _CreateKwargs]): + class Create(PyLocalCommand["PyLocalContainer", _CreateKwargs]): """Local create command.""" def _exe_cmd(self, name: str | None = None): @@ -832,3 +791,4 @@ class name(PyLocalProperty[str | None]): # added by __init__ delete: Delete create: Create + diff --git a/src/ansys/fluent/interface/post_objects/post_helper.py b/src/ansys/fluent/interface/post_objects/post_helper.py index 6b42f139..cb3cad6a 100644 --- a/src/ansys/fluent/interface/post_objects/post_helper.py +++ b/src/ansys/fluent/interface/post_objects/post_helper.py @@ -23,10 +23,15 @@ """Provides a module for post objects.""" import re +from typing import cast +from ansys.fluent.core.services import LiveFieldData from ansys.fluent.core.solver.flunits import get_si_unit_for_fluent_quantity from ansys.fluent.core.utils.fluent_version import FluentVersion +from ansys.fluent.interface.post_objects.meta import PyLocalBase +from ansys.fluent.visualization import Surface + class IncompleteISOSurfaceDefinition(RuntimeError): """Raised when iso-surface definition is incomplete.""" @@ -50,7 +55,7 @@ class PostAPIHelper: class _SurfaceAPI: """Class providing APIs for surface operations.""" - def __init__(self, obj): + def __init__(self, obj: Surface): self.obj = obj self._surface_name_on_server = self.surface_name_on_server(obj._name) @@ -142,14 +147,14 @@ def delete_surface_on_server(self) -> None: elif self.obj.definition.type() == "plane-surface": del self._get_api_handle().plane_surface[self._surface_name_on_server] - def __init__(self, obj: Surface): + def __init__(self, obj: PyLocalBase): """__init__ method of PostAPIHelper class.""" self.obj = obj - self.field_data = lambda: obj.get_root().session.fields.field_data - if obj.__class__.__name__ == "Surface": + self.field_data = lambda: cast("LiveFieldData", obj.get_root().session.fields.field_data) + if isinstance(obj, Surface): self.surface_api = PostAPIHelper._SurfaceAPI(obj) - def remote_surface_name(self, local_surface_name: str): + def remote_surface_name(self, local_surface_name: str) -> str: """Return the surface name.""" local_surfaces_provider = self.obj.get_root()._local_surfaces_provider() diff --git a/src/ansys/fluent/interface/post_objects/post_object_definitions.py b/src/ansys/fluent/interface/post_objects/post_object_definitions.py index bf78df60..c8b290b0 100644 --- a/src/ansys/fluent/interface/post_objects/post_object_definitions.py +++ b/src/ansys/fluent/interface/post_objects/post_object_definitions.py @@ -26,7 +26,7 @@ from abc import abstractmethod from collections.abc import Callable, Sequence import logging -from typing import TYPE_CHECKING, Literal, NamedTuple, Protocol, Self, cast, final +from typing import TYPE_CHECKING, Literal, NamedTuple, Protocol, Self, TypeAlias, cast, final, override from ansys.fluent.interface.post_objects.meta import ( Attribute, @@ -45,9 +45,9 @@ class BasePostObjectDefn(Protocol, metaclass=abc.ABCMeta): """Base class for visualization objects.""" - # @abc.abstractmethod - # def get_root(self) -> Container: - # raise NotImplementedError + @abc.abstractmethod + def get_root(self) -> Container: + raise NotImplementedError surfaces: Callable[[], Sequence[str]] @@ -180,7 +180,7 @@ def allowed_values(self) -> list[str]: ) -class MeshDefn(GraphicsDefn): +class MeshDefn(GraphicsDefn, abc.ABC): """Mesh graphics definition.""" PLURAL = "Meshes" @@ -217,7 +217,7 @@ class show_faces(PyLocalProperty[bool]): value = True -class PathlinesDefn(GraphicsDefn): +class PathlinesDefn(GraphicsDefn, abc.ABC): """Pathlines definition.""" PLURAL = "Pathlines" @@ -247,7 +247,7 @@ def allowed_values(self) -> list[str]: ) -class SurfaceDefn(GraphicsDefn): +class SurfaceDefn(GraphicsDefn, abc.ABC): """Surface graphics definition.""" PLURAL = "Surfaces" @@ -263,7 +263,7 @@ class show_edges(PyLocalProperty[bool]): value = True - class definition(PyLocalObject[Self]): + class definition(PyLocalObject["SurfaceDefn"]): """Specify surface definition type.""" @final @@ -281,7 +281,7 @@ def allowed_values( return ["plane-surface", "iso-surface"] @if_type_checking_instantiate - class plane_surface(PyLocalObject[Self]): + class plane_surface(PyLocalObject["definition"]): """Plane surface definition.""" @Attribute @@ -310,7 +310,7 @@ def allowed_values( return ["xy-plane", "yz-plane", "zx-plane", "point-and-normal"] @if_type_checking_instantiate - class point(PyLocalObject[Self]): + class point(PyLocalObject["plane_surface"]): """Point entry for point-and-normal surface.""" @Attribute @@ -376,7 +376,7 @@ def range(self) -> tuple[float, float]: ) @if_type_checking_instantiate - class normal(PyLocalObject[Self]): + class normal(PyLocalObject["plane_surface"]): """Normal entry for point-and-normal surface.""" @Attribute @@ -418,7 +418,7 @@ def range(self) -> list[int]: return [-1, 1] @if_type_checking_instantiate - class xy_plane(PyLocalObject[Self]): + class xy_plane(PyLocalObject["plane_surface"]): """XY Plane definition.""" @Attribute @@ -438,7 +438,7 @@ def range(self) -> tuple[float, float]: return self.field_data.scalar_fields.range("z-coordinate", True) @if_type_checking_instantiate - class yz_plane(PyLocalObject[Self]): + class yz_plane(PyLocalObject["plane_surface"]): """YZ Plane definition.""" @Attribute @@ -458,7 +458,7 @@ def range(self) -> tuple[float, float]: return self.field_data.scalar_fields.range("x-coordinate", True) @if_type_checking_instantiate - class zx_plane(PyLocalObject[Self]): + class zx_plane(PyLocalObject["plane_surface"]): """ZX Plane definition.""" @Attribute @@ -478,7 +478,7 @@ def range(self) -> tuple[float, float]: return self.field_data.scalar_fields.range("y-coordinate", True) @if_type_checking_instantiate - class iso_surface(PyLocalObject[Self]): + class iso_surface(PyLocalObject["definition"]): """Iso surface definition.""" @Attribute @@ -538,7 +538,7 @@ def range(self) -> tuple[float, float] | None: return self.field_data.scalar_fields.range(field, True) -class ContourDefn(GraphicsDefn): +class ContourDefn(GraphicsDefn, abc.ABC): """Contour graphics definition.""" PLURAL = "Contours" @@ -626,7 +626,7 @@ class show_edges(PyLocalProperty[bool]): value = False - class range(PyLocalObject[Self]): + class range(PyLocalObject["ContourDefn"]): """Range definition.""" @final @@ -644,7 +644,7 @@ def allowed_values( return ["auto-range-on", "auto-range-off"] @if_type_checking_instantiate - class auto_range_on(PyLocalObject[Self]): + class auto_range_on(PyLocalObject["range"]): """Auto range on definition.""" @Attribute @@ -659,7 +659,7 @@ class global_range(PyLocalProperty[bool]): value = False @if_type_checking_instantiate - class auto_range_off(PyLocalObject[Self]): + class auto_range_off(PyLocalObject["range"]): """Auto range off definition.""" @Attribute @@ -679,13 +679,14 @@ class minimum(PyLocalProperty[float | None]): _value = None - def _reset_on_change(self) -> list: + def _reset_on_change(self) -> list[Callable[[], object]]: return [ self.get_ancestors_by_type(ContourDefn).field, self.get_ancestors_by_type(ContourDefn).node_values, ] @property + @override def value(self) -> float | None: """Range minimum property setter.""" if getattr(self, "_value", None) is None: @@ -709,13 +710,14 @@ class maximum(PyLocalProperty[float | None]): _value = None - def _reset_on_change(self) -> list: + def _reset_on_change(self) -> list[Callable[[], object]]: return [ self.get_ancestors_by_type(ContourDefn).field, self.get_ancestors_by_type(ContourDefn).node_values, ] @property + @override def value(self) -> float | None: """Range maximum property setter.""" if getattr(self, "_value", None) is None: @@ -735,7 +737,7 @@ def value(self, value: float | None) -> None: self._value = value -class VectorDefn(GraphicsDefn): +class VectorDefn(GraphicsDefn, abc.ABC): """Vector graphics definition.""" PLURAL = "Vectors" @@ -794,7 +796,7 @@ class show_edges(PyLocalProperty[bool]): value = False @if_type_checking_instantiate - class range(PyLocalObject[Self]): + class range(PyLocalObject["VectorDefn"]): """Range definition.""" @final @@ -812,7 +814,7 @@ def allowed_values( return ["auto-range-on", "auto-range-off"] @if_type_checking_instantiate - class auto_range_on(PyLocalObject[Self]): + class auto_range_on(PyLocalObject["range"]): """Auto range on definition.""" @Attribute @@ -827,7 +829,7 @@ class global_range(PyLocalProperty[bool]): value = False @if_type_checking_instantiate - class auto_range_off(PyLocalObject[Self]): + class auto_range_off(PyLocalObject["range"]): """Auto range off definition.""" @Attribute @@ -884,3 +886,5 @@ def value(self) -> float | None: @value.setter def value(self, value: float | None) -> None: self._value = value + +Defns: TypeAlias = GraphicsDefn | PlotDefn | MonitorDefn | XYPlotDefn | MeshDefn | PathlinesDefn | SurfaceDefn | ContourDefn | VectorDefn \ No newline at end of file diff --git a/src/ansys/fluent/interface/post_objects/post_objects_container.py b/src/ansys/fluent/interface/post_objects/post_objects_container.py index 7334ae5c..b74d40ce 100644 --- a/src/ansys/fluent/interface/post_objects/post_objects_container.py +++ b/src/ansys/fluent/interface/post_objects/post_objects_container.py @@ -22,13 +22,19 @@ """Module providing visualization objects.""" +import builtins import inspect +import types +from typing import Any, ClassVar from ansys.fluent.core.session import BaseSession -from ansys.fluent.interface.post_objects.meta import PyLocalContainer -from ansys.fluent.visualization import Contour, Graphics, Plots, Surface, Vector +from ansys.fluent.interface.post_objects.meta import PyLocalContainer, PyLocalNamedObject +from ansys.fluent.interface.post_objects.post_helper import PostAPIHelper +from ansys.fluent.visualization import Contour, Surface, Vector +from ansys.fluent.visualization.containers import Pathline from ansys.fluent.visualization.graphics.graphics_objects import Mesh +from ansys.fluent.visualization.plotter.plotter_objects import MonitorPlot, XYPlot class Container: @@ -49,21 +55,21 @@ class Container: Provider of local surfaces, allowing access to surfaces created in external modules (e.g., PyVista). Defaults to ``None``. """ + _sessions_state: ClassVar[dict[BaseSession, dict[str, Any]]] def __init__( self, session: BaseSession, - container_type: type[Plots | Graphics], - module, - post_api_helper, + module: types.ModuleType, + post_api_helper: type[PostAPIHelper], local_surfaces_provider=None, ): """__init__ method of Container class.""" - session_state = container_type._sessions_state.get(session) - self._path = container_type.__name__ + session_state = self.__class__._sessions_state.get(session) + self._path = self.__class__.__name__ if not session_state: session_state = self.__dict__ - container_type._sessions_state[session] = session_state + self.__class__._sessions_state[session] = session_state self.session = session self._init_module(self, module, post_api_helper) else: @@ -72,7 +78,7 @@ def __init__( self, "Surfaces", [] ) - def get_path(self): + def get_path(self) -> str: """Get container path.""" return self._path @@ -81,20 +87,20 @@ def type(self): """Type.""" return "object" - def update(self, value): + def update(self, value: dict[str, Any]): """Update the value.""" for name, val in value.items(): o = getattr(self, name) o.update(val) - def __call__(self, show_attributes=False): + def __call__(self, show_attributes=False) -> dict[str, Any]: state = {} for name, cls in self.__dict__.items(): o = getattr(self, name) if o is None or name.startswith("_") or name.startswith("__"): continue - if cls.__class__.__name__ == "PyLocalContainer": + if isinstance(cls, type) and isinstance(o, PyLocalContainer): container = o if getattr(container, "is_active", True): state[name] = {} @@ -105,7 +111,7 @@ def __call__(self, show_attributes=False): return state - def _init_module(self, obj, mod, post_api_helper): + def _init_module(self, obj, mod: types.ModuleType, post_api_helper: builtins.type[PostAPIHelper]): """ Dynamically initializes and attaches containers for classes in a module. @@ -120,18 +126,15 @@ def _init_module(self, obj, mod, post_api_helper): dynamically added to each container for creating and initializing new objects. """ # Iterate through all attributes in the module's dictionary - for name, cls in mod.__dict__.items(): - if cls.__class__.__name__ in ( - "PyLocalNamedObjectMetaAbstract", - ) and not inspect.isabstract(cls): + for name, cls in inspect.getmembers(mod, predicate=inspect.isclass): + if issubclass(cls, PyLocalNamedObject) and not inspect.isabstract(cls): cont = PyLocalContainer(self, cls, post_api_helper, cls.PLURAL) # Define a method to add a "create" function to the container - def _add_create(py_cont): + def _add_create(py_cont: PyLocalContainer): def _create(**kwargs): - new_object = py_cont.__getitem__( - py_cont._get_unique_chid_name() - ) + new_object = py_cont[py_cont._get_unique_chid_name()] + new_object.__call__ # Validate that all kwargs are valid attributes for the object unexpected_args = set(kwargs) - set(new_object()) if unexpected_args: @@ -182,12 +185,14 @@ class Plots(Container): Container for monitor plot objects. """ - _sessions_state = {} + _sessions_state: ClassVar[dict[BaseSession, dict[str, Any]]] = {} + XYPlots: PyLocalContainer[XYPlot] # pyright: ignore[reportUninitializedInstanceVariable] + MonitorPlots: PyLocalContainer[MonitorPlot] # pyright: ignore[reportUninitializedInstanceVariable] def __init__(self, session, module, post_api_helper, local_surfaces_provider=None): """__init__ method of Plots class.""" super().__init__( - session, self.__class__, module, post_api_helper, local_surfaces_provider + session, module, post_api_helper, local_surfaces_provider ) @@ -221,16 +226,18 @@ class Graphics(Container): Container for vector objects. """ - _sessions_state = {} - Meshes: PyLocalContainer[Mesh] - Surfaces: PyLocalContainer[Surface] - Contours: PyLocalContainer[Contour] - Vectors: PyLocalContainer[Vector] + _sessions_state: ClassVar[dict[BaseSession, dict[str, Any]]] = {} + Meshes: PyLocalContainer[Mesh] # pyright: ignore[reportUninitializedInstanceVariable] + Surfaces: PyLocalContainer[Surface] # pyright: ignore[reportUninitializedInstanceVariable] + Contours: PyLocalContainer[Contour] # pyright: ignore[reportUninitializedInstanceVariable] + Vectors: PyLocalContainer[Vector] # pyright: ignore[reportUninitializedInstanceVariable] + Pathlines: PyLocalContainer[Pathline] # pyright: ignore[reportUninitializedInstanceVariable] - def __init__(self, session, module, post_api_helper, local_surfaces_provider=None): + + def __init__(self, session: BaseSession, module: types.ModuleType, post_api_helper: type[PostAPIHelper], local_surfaces_provider=None): """__init__ method of Graphics class.""" super().__init__( - session, self.__class__, module, post_api_helper, local_surfaces_provider + session, module, post_api_helper, local_surfaces_provider ) def add_outline_mesh(self) -> Mesh | None: diff --git a/src/ansys/fluent/visualization/containers.py b/src/ansys/fluent/visualization/containers.py index 8a473e6e..f47434cd 100644 --- a/src/ansys/fluent/visualization/containers.py +++ b/src/ansys/fluent/visualization/containers.py @@ -1,3 +1,5 @@ +# pyright: reportIncompatibleVariableOverride=false +# this cannot be enabled really and typing out the _obj as a property is annoying until ReadOnly[T] works on concrete classes # Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # @@ -22,7 +24,16 @@ """Containers for graphics.""" -from typing import TYPE_CHECKING, Any, Literal, Self, TypedDict, Unpack +import abc +from collections.abc import Callable +from typing import ( + TYPE_CHECKING, + Any, + Literal, + Self, + TypedDict, + Unpack, +) import warnings from ansys.fluent.core.field_data_interfaces import _to_field_name_str @@ -33,25 +44,28 @@ from ansys.fluent.visualization.graphics import Graphics from ansys.fluent.visualization.plotter import Plots + if TYPE_CHECKING: from ansys.fluent.core.session import BaseSession + from ansys.fluent.core.session_solver import Solver - from ansys.fluent.interface.post_objects.meta import _DeleteKwargs + from ansys.fluent.interface.post_objects.post_objects_container import Container from ansys.fluent.interface.post_objects.post_object_definitions import ( - BasePostObjectDefn, + Defns, + SurfaceDefn, ContourDefn, GraphicsDefn, MonitorDefn, - SurfaceDefn, VectorDefn, ) + from ansys.fluent.interface.post_objects.meta import _DeleteKwargs class _GraphicsContainer: """Base class for graphics containers.""" - solver: BaseSession - _obj: BasePostObjectDefn + solver: BaseSession # pyright: ignore[reportUninitializedInstanceVariable] + _obj: Defns # pyright: ignore[reportUninitializedInstanceVariable] def __init__(self, solver: BaseSession | None, **kwargs: Any): self.__dict__["solver"] = solver or _get_active_session() @@ -67,8 +81,14 @@ def __init__(self, solver: BaseSession | None, **kwargs: Any): self.kwargs["vectors_of"] ) - if not TYPE_CHECKING: + if TYPE_CHECKING: + # we have these due to inheriting from the ABCs at type time but the attributes coming from ._obj + # the type checker thinks they aren't valid to instantiate otherwise + def get_root(self) -> Container: ... + def display(self, window_id: str | None = None) -> None: ... + surfaces: Callable[[], list[str]] # pyright: ignore[reportUninitializedInstanceVariable] + else: def __getattr__(self, attr): return getattr(self._obj, attr) @@ -82,8 +102,7 @@ def __setattr__(self, attr, value): def __dir__(self) -> list[str]: return sorted(set(super().__dir__()) | set(dir(self._obj))) - -class Mesh(_GraphicsContainer): +class Mesh(_GraphicsContainer, GraphicsDefn if TYPE_CHECKING else object, abc.ABC): # pyright: ignore[reportUnsafeMultipleInheritance] """Mesh visualization object. Creates a Fluent mesh graphic object on the specified surfaces. @@ -118,19 +137,22 @@ class Mesh(_GraphicsContainer): def __init__( self, + *, surfaces: list[str], show_edges: bool = False, solver: BaseSession | None = None, **kwargs: Unpack[_DeleteKwargs], ): """__init__ method of Mesh class.""" - kwargs.update( - { - "show_edges": show_edges, + + super().__init__( + solver, + **kwargs + | { "surfaces": surfaces, - } + "show_edges": show_edges, + }, ) - super().__init__(solver, **kwargs) self.__dict__["_obj"] = Graphics(session=self.solver).Meshes.create( **self.kwargs ) @@ -149,7 +171,7 @@ class SurfaceKwargs(TypedDict, total=False): normal: tuple[float, float, float] | None -class Surface(_GraphicsContainer, SurfaceDefn if TYPE_CHECKING else object): +class Surface(_GraphicsContainer, SurfaceDefn if TYPE_CHECKING else object, abc.ABC): # pyright: ignore[reportUnsafeMultipleInheritance] """Surface definition for Fluent post-processing. The ``Surface`` class represents any Fluent surface generated for @@ -201,13 +223,9 @@ class determines the session. _obj: SurfaceDefn def __init__( - self, - type: str, - solver: BaseSession | None = None, - **kwargs: Unpack[SurfaceKwargs], + self, *, solver: BaseSession | None = None, **kwargs: Unpack[SurfaceKwargs] ): """__init__ method of Surface class.""" - kwargs.update({"type": type}) super().__init__(solver, **kwargs) super().__setattr__( "_obj", Graphics(session=self.solver).Surfaces.create(**kwargs) @@ -332,7 +350,7 @@ def normal(self, value: tuple[float, float, float]) -> None: norm.x, norm.y, norm.z = value -class PlaneSurface(Surface): +class PlaneSurface(Surface, abc.ABC): """PlaneSurface derived from Surface. Provides factory methods for creating plane surfaces like XY, YZ, and XZ planes. @@ -413,7 +431,7 @@ def create_from_point_and_normal( ) -class IsoSurface(Surface): +class IsoSurface(Surface, abc.ABC): """Iso-surface derived from :class:`Surface`. The ``IsoSurface`` class simplifies creation of iso-surfaces by providing @@ -468,7 +486,7 @@ def __init__( ) -class Contour(_GraphicsContainer): +class Contour(_GraphicsContainer, ContourDefn if TYPE_CHECKING else object, abc.ABC): # pyright: ignore[reportUnsafeMultipleInheritance] """ Contour visualization object. @@ -505,27 +523,18 @@ class Contour(_GraphicsContainer): _obj: ContourDefn - def __init__( - self, - field: str | VariableDescriptor, - surfaces: list[str], - solver=None, - **kwargs, - ): + def __init__(self, *, solver=None, **kwargs): """__init__ method of Contour class.""" - kwargs.update( - { - "field": field, - "surfaces": surfaces, - } + super().__init__( + solver, + **kwargs, ) - super().__init__(solver, **kwargs) self.__dict__["_obj"] = Graphics(session=self.solver).Contours.create( **self.kwargs ) -class Vector(_GraphicsContainer): +class Vector(_GraphicsContainer, VectorDefn if TYPE_CHECKING else object, abc.ABC): # pyright: ignore[reportUnsafeMultipleInheritance] """Vector visualization object. Parameters @@ -563,8 +572,8 @@ class Vector(_GraphicsContainer): def __init__( self, + *, field: str | VariableDescriptor, - surfaces: list[str], color_by: str | VariableDescriptor | None = None, scale: float = 1.0, solver=None, @@ -573,15 +582,16 @@ def __init__( """__init__ method of Vector class.""" if color_by is None: color_by = field - kwargs.update( - { + + super().__init__( + solver, + **kwargs + | { "vectors_of": field, "field": color_by, - "surfaces": surfaces, "scale": scale, - } + }, ) - super().__init__(solver, **kwargs) self.__dict__["_obj"] = Graphics(session=self.solver).Vectors.create( **self.kwargs ) @@ -596,14 +606,14 @@ def __init__( ) @staticmethod - def _get_mapped_attrs(attr): + def _get_mapped_attrs(attr: str) -> str | None: _attr_map = { "field": "vectors_of", "color_by": "field", } return _attr_map.get(attr) - def __getattr__(self, attr): + def __getattr__(self, attr: str) -> Any: attr = self._get_mapped_attrs(attr) or attr return getattr(self._obj, attr) @@ -614,7 +624,7 @@ def __setattr__(self, attr, value): setattr(self._obj, attr, value) -class Pathline(_GraphicsContainer): +class Pathline(_GraphicsContainer, GraphicsDefn if TYPE_CHECKING else object, abc.ABC): # pyright: ignore[reportUnsafeMultipleInheritance] """Pathline visualization object. The ``Pathline`` class generates pathlines, which represent the trajectories @@ -654,6 +664,7 @@ class Pathline(_GraphicsContainer): def __init__( self, + *, field: str | VariableDescriptor, surfaces: list[str], solver=None, @@ -672,7 +683,7 @@ def __init__( ) -class XYPlot(_GraphicsContainer): +class XYPlot(_GraphicsContainer, GraphicsDefn if TYPE_CHECKING else object, abc.ABC): # pyright: ignore[reportUnsafeMultipleInheritance] """XY plot visualization object. The ``XYPlot`` class creates a Fluent XY plot of a scalar field evaluated @@ -711,6 +722,7 @@ class XYPlot(_GraphicsContainer): def __init__( self, + *, surfaces: list[str], y_axis_function: str | VariableDescriptor, solver: BaseSession | None = None, @@ -734,7 +746,7 @@ def __init__( ).XYPlots.create(**self.kwargs) -class Monitor(_GraphicsContainer): +class Monitor(_GraphicsContainer, MonitorDefn if TYPE_CHECKING else object, abc.ABC): # pyright: ignore[reportUnsafeMultipleInheritance] """Monitor visualization object. The ``Monitor`` class provides access to Fluent monitor data for plotting, @@ -765,7 +777,12 @@ class Monitor(_GraphicsContainer): _obj: MonitorDefn def __init__( - self, monitor_set_name: str, solver=None, local_surfaces_provider=None, **kwargs + self, + *, + monitor_set_name: str, + solver=None, + local_surfaces_provider=None, + **kwargs, ): """__init__ method of Monitor class.""" kwargs.update( diff --git a/src/ansys/fluent/visualization/contour.py b/src/ansys/fluent/visualization/contour.py index 8c52dfc3..1e13f5bc 100644 --- a/src/ansys/fluent/visualization/contour.py +++ b/src/ansys/fluent/visualization/contour.py @@ -95,25 +95,30 @@ def draw(self, solver, target): ------- Graphics or solver-based contour object. """ + from ansys.fluent.core.session_solver import Solver + + from ansys.fluent.visualization.graphics import Graphics + self._error_check(solver) graphics_mode = target existing_contours = ( solver.results.graphics.contour.get_object_names() - if graphics_mode.__class__.__name__ == "Solver" + if isinstance(graphics_mode, Solver) else graphics_mode.Contours.allowed_values() ) contour_name = self._get_contour_name() if contour_name not in existing_contours: - if graphics_mode.__class__.__name__ == "Graphics": + if isinstance(graphics_mode, Graphics): contour = graphics_mode.Contours[contour_name] contour.field = self.field contour.surfaces = self.surfaces contour.display() return contour - elif graphics_mode.__class__.__name__ == "Solver": + elif isinstance(graphics_mode, Solver): solver.results.graphics.contour[contour_name] = { "field": self.field, "surfaces": self.surfaces, } solver.results.graphics.contour.display(object_name=contour_name) return solver.results.graphics.contour[contour_name] + return solver.results.graphics.contour[contour_name] diff --git a/src/ansys/fluent/visualization/graphics/__init__.py b/src/ansys/fluent/visualization/graphics/__init__.py index 664e1332..c288cfac 100644 --- a/src/ansys/fluent/visualization/graphics/__init__.py +++ b/src/ansys/fluent/visualization/graphics/__init__.py @@ -22,7 +22,7 @@ """A package that provides interfacing Fluent with graphics renderer (PyVista).""" -from ansys.fluent.visualization.graphics.graphics_objects import Graphics # noqa: F401 -from ansys.fluent.visualization.graphics.graphics_windows_manager import ( # noqa: F401 - graphics_windows_manager, +from ansys.fluent.visualization.graphics.graphics_objects import Graphics as Graphics +from ansys.fluent.visualization.graphics.graphics_windows_manager import ( + graphics_windows_manager as graphics_windows_manager, ) diff --git a/src/ansys/fluent/visualization/graphics/graphics_objects.py b/src/ansys/fluent/visualization/graphics/graphics_objects.py index 1504d443..6206c17d 100644 --- a/src/ansys/fluent/visualization/graphics/graphics_objects.py +++ b/src/ansys/fluent/visualization/graphics/graphics_objects.py @@ -24,7 +24,7 @@ import sys -from ansys.fluent.interface.post_objects.meta import Command +from ansys.fluent.interface.post_objects.meta import Command, PyLocalContainer from ansys.fluent.interface.post_objects.post_helper import PostAPIHelper from ansys.fluent.interface.post_objects.post_object_definitions import ( ContourDefn, @@ -48,7 +48,7 @@ class Graphics(GraphicsContainer): """ def __init__( - self, session, post_api_helper=PostAPIHelper, local_surfaces_provider=None + self, session, post_api_helper: type[PostAPIHelper]=PostAPIHelper, local_surfaces_provider=None ): super().__init__( session, sys.modules[__name__], post_api_helper, local_surfaces_provider diff --git a/src/ansys/fluent/visualization/graphics/graphics_windows_manager.py b/src/ansys/fluent/visualization/graphics/graphics_windows_manager.py index dcf66840..9f11374a 100644 --- a/src/ansys/fluent/visualization/graphics/graphics_windows_manager.py +++ b/src/ansys/fluent/visualization/graphics/graphics_windows_manager.py @@ -62,8 +62,8 @@ def __init__( self, id: str, post_object: GraphicsDefn, - grid: tuple | None = (1, 1), - renderer: str = None, + grid: tuple[int, int] | None = (1, 1), + renderer: str | None = None, ): """Instantiate a Graphics window. @@ -129,23 +129,25 @@ def _get_renderer(self, renderer_string=None): raise KeyError(error_message) from ex return renderer(self.id, in_jupyter(), not pyviz.config.interactive, self._grid) - def set_data(self, data_type: FieldDataType, data: dict[int, dict[str, np.array]]): + def set_data(self, data_type: FieldDataType, data: dict[int, dict[str, np.ndarray]]): """Set data for graphics.""" self._data[data_type] = data def fetch(self): """Fetch data for graphics.""" + from ansys.fluent.visualization.containers import Monitor, Surface, XYPlot + if not self.post_object: return obj = self.post_object - if obj.__class__.__name__ == "Surface": + if isinstance(obj, Surface): self._fetch_surface(obj) - elif obj.__class__.__name__ == "XYPlot": + elif isinstance(obj, XYPlot): self._fetch_xy_data(obj) - elif obj.__class__.__name__ == "MonitorPlot": + elif isinstance(obj, Monitor): self._fetch_monitor_data(obj) else: - self._fetch_data(obj, FieldDataType(obj.__class__.__name__)) + self._fetch_data(obj, FieldDataType(obj.__name__)) def render(self): """Render graphics.""" @@ -155,25 +157,35 @@ def render(self): def _render_graphics(self, obj_dict=None): """Render graphics.""" + from ansys.fluent.visualization.containers import ( + Contour, + Mesh, + Monitor, + Pathline, + Surface, + Vector, + XYPlot, + ) + if not self.post_object: return obj = self.post_object if not self.overlay: self.renderer._clear_plotter(in_jupyter()) - if obj.__class__.__name__ == "Mesh": + if isinstance(obj, Mesh): self._display_mesh(obj, obj_dict) - elif obj.__class__.__name__ == "Surface": + elif isinstance(obj, Surface): self._display_surface(obj, obj_dict) - elif obj.__class__.__name__ == "Contour": + elif isinstance(obj, Contour): self._display_contour(obj, obj_dict) - elif obj.__class__.__name__ == "Vector": + elif isinstance(obj, Vector): self._display_vector(obj, obj_dict) - elif obj.__class__.__name__ == "Pathlines": + elif isinstance(obj, Pathline): self._display_pathlines(obj, obj_dict) - elif obj.__class__.__name__ == "XYPlot": + elif isinstance(obj, XYPlot): self._display_xy_plot(obj_dict) - elif obj.__class__.__name__ == "MonitorPlot": + elif isinstance(obj, Monitor): self._display_monitor_plot(obj_dict) if self.animate: self.renderer.write_frame() @@ -1198,4 +1210,12 @@ def __setattr__(self, name, value): setattr(self._real_instance, name, value) +graphics_windows_manager = _GraphicsManagerProxy() + super().__setattr__(name, value) + else: + if self._real_instance is None: + self._initialize() + setattr(self._real_instance, name, value) + + graphics_windows_manager = _GraphicsManagerProxy() diff --git a/src/ansys/fluent/visualization/graphics/pyvista/renderer.py b/src/ansys/fluent/visualization/graphics/pyvista/renderer.py index efc3021e..58994864 100644 --- a/src/ansys/fluent/visualization/graphics/pyvista/renderer.py +++ b/src/ansys/fluent/visualization/graphics/pyvista/renderer.py @@ -44,7 +44,7 @@ def __init__( win_id: str, in_jupyter: bool, non_interactive: bool, - grid: tuple[int, int] | None = (1, 1), + grid: tuple[int, int] | str = (1, 1), ): self.plotter: BackgroundPlotter | pv.Plotter = ( pv.Plotter(title=f"PyFluent ({win_id})", shape=grid) diff --git a/src/ansys/fluent/visualization/plotter/plotter_windows_manager.py b/src/ansys/fluent/visualization/plotter/plotter_windows_manager.py index 2d066057..2e1c742c 100644 --- a/src/ansys/fluent/visualization/plotter/plotter_windows_manager.py +++ b/src/ansys/fluent/visualization/plotter/plotter_windows_manager.py @@ -131,10 +131,12 @@ def __init__( def plot(self, grid=(1, 1), position=(0, 0), show=True, subplot_titles=None): """Draw a plot.""" + from ansys.fluent.visualization.containers import XYPlot + if self.post_object is not None: plot = ( _XYPlot(self.post_object, self.plotter) - if self.post_object.__class__.__name__ == "XYPlot" + if isinstance(self.post_object, XYPlot) else _MonitorPlot(self.post_object, self.plotter) ) plot_data = plot() @@ -152,6 +154,8 @@ def plot(self, grid=(1, 1), position=(0, 0), show=True, subplot_titles=None): self.plotter.show() def plot_graphics(self, object_list): + from ansys.fluent.visualization.containers import XYPlot + self._obj_list = object_list if self.refresh: self._object_list_to_render = [] @@ -159,7 +163,7 @@ def plot_graphics(self, object_list): self.post_object = obj_dict["object"]._obj plot = ( _XYPlot(self.post_object, self.plotter) - if self.post_object.__class__.__name__ == "XYPlot" + if isinstance(self.post_object, XYPlot) else _MonitorPlot(self.post_object, self.plotter) ) diff --git a/src/ansys/fluent/visualization/post_data_extractor.py b/src/ansys/fluent/visualization/post_data_extractor.py index e8fcd438..542be409 100644 --- a/src/ansys/fluent/visualization/post_data_extractor.py +++ b/src/ansys/fluent/visualization/post_data_extractor.py @@ -68,18 +68,20 @@ def fetch_data(self, *args, **kwargs): Returns ------- - Dict[int: Dict[str: np.array]] + Dict[int: Dict[str: np.ndarray]] Return dictionary of surfaces id to field name to numpy array. """ - if self._post_object.__class__.__name__ == "Mesh": + from ansys.fluent.visualization.containers import Mesh, Surface, Contour, Vector, Pathline + + if isinstance(self._post_object, Mesh): return self._fetch_mesh_data(self._post_object, *args, **kwargs) - elif self._post_object.__class__.__name__ == "Surface": + elif isinstance(self._post_object, Surface): return self._fetch_surface_data(self._post_object, *args, **kwargs) - elif self._post_object.__class__.__name__ == "Contour": + elif isinstance(self._post_object, Contour): return self._fetch_contour_data(self._post_object, *args, **kwargs) - elif self._post_object.__class__.__name__ == "Vector": + elif isinstance(self._post_object, Vector): return self._fetch_vector_data(self._post_object, *args, **kwargs) - elif self._post_object.__class__.__name__ == "Pathlines": + elif isinstance(self._post_object, Pathline): return self._fetch_pathlines_data(self._post_object, *args, **kwargs) @staticmethod @@ -266,7 +268,7 @@ def __init__(self, post_object: PlotDefn): """ self._post_object: PlotDefn = post_object - def fetch_data(self) -> dict[str, dict[str, np.array]]: + def fetch_data(self) -> dict[str, dict[str, np.ndarray]] | None: """Fetch data for visualization object. Parameters @@ -275,11 +277,12 @@ def fetch_data(self) -> dict[str, dict[str, np.array]]: Returns ------- - Dict[str: Dict[str: np.array]] + Dict[str: Dict[str: np.ndarray]] Return dictionary of surfaces name to numpy array of x and y values. """ + from ansys.fluent.visualization.containers import XYPlot - if self._post_object.__class__.__name__ == "XYPlot": + if isinstance(self._post_object, XYPlot): return self._fetch_xy_data(self._post_object) def _fetch_xy_data(self, obj): diff --git a/src/ansys/fluent/visualization/renderer.py b/src/ansys/fluent/visualization/renderer.py index 46287ad8..09863650 100644 --- a/src/ansys/fluent/visualization/renderer.py +++ b/src/ansys/fluent/visualization/renderer.py @@ -21,6 +21,8 @@ # SOFTWARE. """A wrapper to improve the user interface of graphics.""" + +from collections.abc import Iterable import warnings from ansys.fluent.interface.post_objects.post_object_definitions import ( @@ -69,7 +71,7 @@ def __init__(self, renderer=None): def add_graphics( self, graphics_obj, - position: tuple = (0, 0), + position: tuple[int, int] = (0, 0), opacity: float = 1, **kwargs, ) -> None: @@ -94,7 +96,7 @@ def add_graphics( def add_plot( self, plot_obj, - position: tuple = (0, 0), + position: tuple[int, int] = (0, 0), **kwargs, ) -> None: """Add 2D plot-data to a window. @@ -122,7 +124,7 @@ def _all_plt_objs(self): return True @staticmethod - def _show_find_grid_size(points): + def _show_find_grid_size(points: Iterable[tuple[int, int]]) -> tuple[int, int]: # Extract x and y coordinates separately x_coords = {p[0] for p in points} y_coords = {p[1] for p in points} From 448e3851329c24aaddae65d991ac8c57d7e39585 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 27 Dec 2025 20:05:41 +0000 Subject: [PATCH 08/20] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../fluent/interface/post_objects/meta.py | 28 ++++++---- .../interface/post_objects/post_helper.py | 4 +- .../post_objects/post_object_definitions.py | 25 ++++++++- .../post_objects/post_objects_container.py | 55 +++++++++++++------ src/ansys/fluent/visualization/containers.py | 50 +++++++++++------ .../graphics/graphics_objects.py | 5 +- .../visualization/post_data_extractor.py | 10 +++- 7 files changed, 128 insertions(+), 49 deletions(-) diff --git a/src/ansys/fluent/interface/post_objects/meta.py b/src/ansys/fluent/interface/post_objects/meta.py index 8e07453c..c30194fb 100644 --- a/src/ansys/fluent/interface/post_objects/meta.py +++ b/src/ansys/fluent/interface/post_objects/meta.py @@ -134,8 +134,7 @@ def __get__(self, instance: None, _) -> Self: ... @overload def __get__( self, instance: _SelfT, _ # pyright: ignore[reportGeneralTypeIssues] - ) -> _T_co: - ... + ) -> _T_co: ... def __get__(self, instance: _SelfT | None, _) -> _T_co | Self: if instance is None: @@ -231,6 +230,7 @@ def __get__(self, instance: _SelfT, _): # pyright: ignore[reportGeneralTypeIssu AccessorT = TypeVar("AccessorT", bound=BasePostObjectDefn) + class PyLocalBase: """Local base.""" @@ -245,7 +245,7 @@ def get_ancestors_by_type( parent = self.get_ancestors_by_type(instance, owner._parent) return parent - def get_root(self, instance = None) -> Container: + def get_root(self, instance=None) -> Container: instance = self if instance is None else instance parent = instance if getattr(instance, "_parent", None): @@ -337,6 +337,7 @@ def __call__(self) -> T: return rv if TYPE_CHECKING: + def __set__(self, instance: object, value: T) -> None: ... def set_state(self, value: T): @@ -349,10 +350,10 @@ def _register_on_change_cb(self, on_change_cb: Callable[[], None]): @Attribute @overload - def allowed_values(self: "PyLocalProperty[Sequence[T2]]") -> Sequence[T2]:... + def allowed_values(self: "PyLocalProperty[Sequence[T2]]") -> Sequence[T2]: ... @Attribute @overload - def allowed_values(self: "PyLocalProperty[T2]") -> Sequence[T2]:... + def allowed_values(self: "PyLocalProperty[T2]") -> Sequence[T2]: ... @Attribute def allowed_values(self) -> Sequence[object]: """Get allowed values.""" @@ -402,12 +403,15 @@ def allowed_values(self) -> Sequence[object]: ParentT = TypeVar("ParentT") + # TODO try poking around this more cause it is kinda what we are doing? # @dataclass_transform(field_specifiers=(type,)) class PyLocalObject(PyLocalBase, Generic[ParentT]): """Local object classes.""" - def __init__(self, parent: ParentT, api_helper: type[PostAPIHelper], name: str = ""): + def __init__( + self, parent: ParentT, api_helper: type[PostAPIHelper], name: str = "" + ): """Create the initialization method for 'PyLocalObjectMeta'.""" self._parent = parent self._name = name @@ -529,6 +533,7 @@ def __setattr__(self, name: str, value: Any): CallKwargs = TypeVar("CallKwargs", bound=TypedDict) + class PyLocalCommand(PyLocalObject[ParentT], Generic[ParentT, CallKwargs]): """Local object metaclass.""" @@ -614,18 +619,23 @@ class PyLocalNamedObjectAbstract(ABC, PyLocalNamedObject): DefnT = TypeVar("DefnT", bound=Defns, default=Defns) -def if_type_checking_instantiate(type: type[T]) -> T: # the current behaviour has all of the classes that use this initialised in the XXX class + +def if_type_checking_instantiate( + type: type[T], +) -> ( + T +): # the current behaviour has all of the classes that use this initialised in the XXX class return cast(T, type) # this is hopefully obviously unsafe class _DeleteKwargs(TypedDict, total=False): names: list[str] + class _CreateKwargs(TypedDict, total=False): name: str | None - class PyLocalContainer(MutableMapping[str, DefnT]): """Local container for named objects.""" @@ -645,7 +655,6 @@ def __init__( self.type = "named-object" self._command_names = [] - if hasattr(object_class, "SHOW_AS_SEPARATE_OBJECT"): PyLocalContainer.show_as_separate_object = property( lambda self: self.__object_class.SHOW_AS_SEPARATE_OBJECT(self) @@ -791,4 +800,3 @@ class name(PyLocalProperty[str | None]): # added by __init__ delete: Delete create: Create - diff --git a/src/ansys/fluent/interface/post_objects/post_helper.py b/src/ansys/fluent/interface/post_objects/post_helper.py index cb3cad6a..892c1bc3 100644 --- a/src/ansys/fluent/interface/post_objects/post_helper.py +++ b/src/ansys/fluent/interface/post_objects/post_helper.py @@ -150,7 +150,9 @@ def delete_surface_on_server(self) -> None: def __init__(self, obj: PyLocalBase): """__init__ method of PostAPIHelper class.""" self.obj = obj - self.field_data = lambda: cast("LiveFieldData", obj.get_root().session.fields.field_data) + self.field_data = lambda: cast( + "LiveFieldData", obj.get_root().session.fields.field_data + ) if isinstance(obj, Surface): self.surface_api = PostAPIHelper._SurfaceAPI(obj) diff --git a/src/ansys/fluent/interface/post_objects/post_object_definitions.py b/src/ansys/fluent/interface/post_objects/post_object_definitions.py index c8b290b0..1dc33d69 100644 --- a/src/ansys/fluent/interface/post_objects/post_object_definitions.py +++ b/src/ansys/fluent/interface/post_objects/post_object_definitions.py @@ -26,7 +26,17 @@ from abc import abstractmethod from collections.abc import Callable, Sequence import logging -from typing import TYPE_CHECKING, Literal, NamedTuple, Protocol, Self, TypeAlias, cast, final, override +from typing import ( + TYPE_CHECKING, + Literal, + NamedTuple, + Protocol, + Self, + TypeAlias, + cast, + final, + override, +) from ansys.fluent.interface.post_objects.meta import ( Attribute, @@ -887,4 +897,15 @@ def value(self) -> float | None: def value(self, value: float | None) -> None: self._value = value -Defns: TypeAlias = GraphicsDefn | PlotDefn | MonitorDefn | XYPlotDefn | MeshDefn | PathlinesDefn | SurfaceDefn | ContourDefn | VectorDefn \ No newline at end of file + +Defns: TypeAlias = ( + GraphicsDefn + | PlotDefn + | MonitorDefn + | XYPlotDefn + | MeshDefn + | PathlinesDefn + | SurfaceDefn + | ContourDefn + | VectorDefn +) diff --git a/src/ansys/fluent/interface/post_objects/post_objects_container.py b/src/ansys/fluent/interface/post_objects/post_objects_container.py index b74d40ce..4ed8ee0e 100644 --- a/src/ansys/fluent/interface/post_objects/post_objects_container.py +++ b/src/ansys/fluent/interface/post_objects/post_objects_container.py @@ -29,7 +29,10 @@ from ansys.fluent.core.session import BaseSession -from ansys.fluent.interface.post_objects.meta import PyLocalContainer, PyLocalNamedObject +from ansys.fluent.interface.post_objects.meta import ( + PyLocalContainer, + PyLocalNamedObject, +) from ansys.fluent.interface.post_objects.post_helper import PostAPIHelper from ansys.fluent.visualization import Contour, Surface, Vector from ansys.fluent.visualization.containers import Pathline @@ -55,6 +58,7 @@ class Container: Provider of local surfaces, allowing access to surfaces created in external modules (e.g., PyVista). Defaults to ``None``. """ + _sessions_state: ClassVar[dict[BaseSession, dict[str, Any]]] def __init__( @@ -111,7 +115,9 @@ def __call__(self, show_attributes=False) -> dict[str, Any]: return state - def _init_module(self, obj, mod: types.ModuleType, post_api_helper: builtins.type[PostAPIHelper]): + def _init_module( + self, obj, mod: types.ModuleType, post_api_helper: builtins.type[PostAPIHelper] + ): """ Dynamically initializes and attaches containers for classes in a module. @@ -186,14 +192,16 @@ class Plots(Container): """ _sessions_state: ClassVar[dict[BaseSession, dict[str, Any]]] = {} - XYPlots: PyLocalContainer[XYPlot] # pyright: ignore[reportUninitializedInstanceVariable] - MonitorPlots: PyLocalContainer[MonitorPlot] # pyright: ignore[reportUninitializedInstanceVariable] + XYPlots: PyLocalContainer[ + XYPlot + ] # pyright: ignore[reportUninitializedInstanceVariable] + MonitorPlots: PyLocalContainer[ + MonitorPlot + ] # pyright: ignore[reportUninitializedInstanceVariable] def __init__(self, session, module, post_api_helper, local_surfaces_provider=None): """__init__ method of Plots class.""" - super().__init__( - session, module, post_api_helper, local_surfaces_provider - ) + super().__init__(session, module, post_api_helper, local_surfaces_provider) class Graphics(Container): @@ -227,18 +235,31 @@ class Graphics(Container): """ _sessions_state: ClassVar[dict[BaseSession, dict[str, Any]]] = {} - Meshes: PyLocalContainer[Mesh] # pyright: ignore[reportUninitializedInstanceVariable] - Surfaces: PyLocalContainer[Surface] # pyright: ignore[reportUninitializedInstanceVariable] - Contours: PyLocalContainer[Contour] # pyright: ignore[reportUninitializedInstanceVariable] - Vectors: PyLocalContainer[Vector] # pyright: ignore[reportUninitializedInstanceVariable] - Pathlines: PyLocalContainer[Pathline] # pyright: ignore[reportUninitializedInstanceVariable] + Meshes: PyLocalContainer[ + Mesh + ] # pyright: ignore[reportUninitializedInstanceVariable] + Surfaces: PyLocalContainer[ + Surface + ] # pyright: ignore[reportUninitializedInstanceVariable] + Contours: PyLocalContainer[ + Contour + ] # pyright: ignore[reportUninitializedInstanceVariable] + Vectors: PyLocalContainer[ + Vector + ] # pyright: ignore[reportUninitializedInstanceVariable] + Pathlines: PyLocalContainer[ + Pathline + ] # pyright: ignore[reportUninitializedInstanceVariable] - - def __init__(self, session: BaseSession, module: types.ModuleType, post_api_helper: type[PostAPIHelper], local_surfaces_provider=None): + def __init__( + self, + session: BaseSession, + module: types.ModuleType, + post_api_helper: type[PostAPIHelper], + local_surfaces_provider=None, + ): """__init__ method of Graphics class.""" - super().__init__( - session, module, post_api_helper, local_surfaces_provider - ) + super().__init__(session, module, post_api_helper, local_surfaces_provider) def add_outline_mesh(self) -> Mesh | None: """Add a mesh outline. diff --git a/src/ansys/fluent/visualization/containers.py b/src/ansys/fluent/visualization/containers.py index f47434cd..699bdcdd 100644 --- a/src/ansys/fluent/visualization/containers.py +++ b/src/ansys/fluent/visualization/containers.py @@ -1,5 +1,6 @@ -# pyright: reportIncompatibleVariableOverride=false -# this cannot be enabled really and typing out the _obj as a property is annoying until ReadOnly[T] works on concrete classes +# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# # Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # @@ -44,21 +45,20 @@ from ansys.fluent.visualization.graphics import Graphics from ansys.fluent.visualization.plotter import Plots - if TYPE_CHECKING: from ansys.fluent.core.session import BaseSession from ansys.fluent.core.session_solver import Solver - from ansys.fluent.interface.post_objects.post_objects_container import Container + from ansys.fluent.interface.post_objects.meta import _DeleteKwargs from ansys.fluent.interface.post_objects.post_object_definitions import ( - Defns, - SurfaceDefn, ContourDefn, + Defns, GraphicsDefn, MonitorDefn, + SurfaceDefn, VectorDefn, ) - from ansys.fluent.interface.post_objects.meta import _DeleteKwargs + from ansys.fluent.interface.post_objects.post_objects_container import Container class _GraphicsContainer: @@ -81,14 +81,17 @@ def __init__(self, solver: BaseSession | None, **kwargs: Any): self.kwargs["vectors_of"] ) - if TYPE_CHECKING: # we have these due to inheriting from the ABCs at type time but the attributes coming from ._obj # the type checker thinks they aren't valid to instantiate otherwise def get_root(self) -> Container: ... def display(self, window_id: str | None = None) -> None: ... - surfaces: Callable[[], list[str]] # pyright: ignore[reportUninitializedInstanceVariable] + + surfaces: Callable[ + [], list[str] + ] # pyright: ignore[reportUninitializedInstanceVariable] else: + def __getattr__(self, attr): return getattr(self._obj, attr) @@ -102,7 +105,10 @@ def __setattr__(self, attr, value): def __dir__(self) -> list[str]: return sorted(set(super().__dir__()) | set(dir(self._obj))) -class Mesh(_GraphicsContainer, GraphicsDefn if TYPE_CHECKING else object, abc.ABC): # pyright: ignore[reportUnsafeMultipleInheritance] + +class Mesh( + _GraphicsContainer, GraphicsDefn if TYPE_CHECKING else object, abc.ABC +): # pyright: ignore[reportUnsafeMultipleInheritance] """Mesh visualization object. Creates a Fluent mesh graphic object on the specified surfaces. @@ -171,7 +177,9 @@ class SurfaceKwargs(TypedDict, total=False): normal: tuple[float, float, float] | None -class Surface(_GraphicsContainer, SurfaceDefn if TYPE_CHECKING else object, abc.ABC): # pyright: ignore[reportUnsafeMultipleInheritance] +class Surface( + _GraphicsContainer, SurfaceDefn if TYPE_CHECKING else object, abc.ABC +): # pyright: ignore[reportUnsafeMultipleInheritance] """Surface definition for Fluent post-processing. The ``Surface`` class represents any Fluent surface generated for @@ -486,7 +494,9 @@ def __init__( ) -class Contour(_GraphicsContainer, ContourDefn if TYPE_CHECKING else object, abc.ABC): # pyright: ignore[reportUnsafeMultipleInheritance] +class Contour( + _GraphicsContainer, ContourDefn if TYPE_CHECKING else object, abc.ABC +): # pyright: ignore[reportUnsafeMultipleInheritance] """ Contour visualization object. @@ -534,7 +544,9 @@ def __init__(self, *, solver=None, **kwargs): ) -class Vector(_GraphicsContainer, VectorDefn if TYPE_CHECKING else object, abc.ABC): # pyright: ignore[reportUnsafeMultipleInheritance] +class Vector( + _GraphicsContainer, VectorDefn if TYPE_CHECKING else object, abc.ABC +): # pyright: ignore[reportUnsafeMultipleInheritance] """Vector visualization object. Parameters @@ -624,7 +636,9 @@ def __setattr__(self, attr, value): setattr(self._obj, attr, value) -class Pathline(_GraphicsContainer, GraphicsDefn if TYPE_CHECKING else object, abc.ABC): # pyright: ignore[reportUnsafeMultipleInheritance] +class Pathline( + _GraphicsContainer, GraphicsDefn if TYPE_CHECKING else object, abc.ABC +): # pyright: ignore[reportUnsafeMultipleInheritance] """Pathline visualization object. The ``Pathline`` class generates pathlines, which represent the trajectories @@ -683,7 +697,9 @@ def __init__( ) -class XYPlot(_GraphicsContainer, GraphicsDefn if TYPE_CHECKING else object, abc.ABC): # pyright: ignore[reportUnsafeMultipleInheritance] +class XYPlot( + _GraphicsContainer, GraphicsDefn if TYPE_CHECKING else object, abc.ABC +): # pyright: ignore[reportUnsafeMultipleInheritance] """XY plot visualization object. The ``XYPlot`` class creates a Fluent XY plot of a scalar field evaluated @@ -746,7 +762,9 @@ def __init__( ).XYPlots.create(**self.kwargs) -class Monitor(_GraphicsContainer, MonitorDefn if TYPE_CHECKING else object, abc.ABC): # pyright: ignore[reportUnsafeMultipleInheritance] +class Monitor( + _GraphicsContainer, MonitorDefn if TYPE_CHECKING else object, abc.ABC +): # pyright: ignore[reportUnsafeMultipleInheritance] """Monitor visualization object. The ``Monitor`` class provides access to Fluent monitor data for plotting, diff --git a/src/ansys/fluent/visualization/graphics/graphics_objects.py b/src/ansys/fluent/visualization/graphics/graphics_objects.py index 6206c17d..caa798b0 100644 --- a/src/ansys/fluent/visualization/graphics/graphics_objects.py +++ b/src/ansys/fluent/visualization/graphics/graphics_objects.py @@ -48,7 +48,10 @@ class Graphics(GraphicsContainer): """ def __init__( - self, session, post_api_helper: type[PostAPIHelper]=PostAPIHelper, local_surfaces_provider=None + self, + session, + post_api_helper: type[PostAPIHelper] = PostAPIHelper, + local_surfaces_provider=None, ): super().__init__( session, sys.modules[__name__], post_api_helper, local_surfaces_provider diff --git a/src/ansys/fluent/visualization/post_data_extractor.py b/src/ansys/fluent/visualization/post_data_extractor.py index 542be409..4efdaff4 100644 --- a/src/ansys/fluent/visualization/post_data_extractor.py +++ b/src/ansys/fluent/visualization/post_data_extractor.py @@ -71,8 +71,14 @@ def fetch_data(self, *args, **kwargs): Dict[int: Dict[str: np.ndarray]] Return dictionary of surfaces id to field name to numpy array. """ - from ansys.fluent.visualization.containers import Mesh, Surface, Contour, Vector, Pathline - + from ansys.fluent.visualization.containers import ( + Contour, + Mesh, + Pathline, + Surface, + Vector, + ) + if isinstance(self._post_object, Mesh): return self._fetch_mesh_data(self._post_object, *args, **kwargs) elif isinstance(self._post_object, Surface): From 322c611b29fe2fe9284ed182253a60ffdcf6f3bd Mon Sep 17 00:00:00 2001 From: Gobot1234 Date: Tue, 13 Jan 2026 10:27:14 +0000 Subject: [PATCH 09/20] fix some more types --- pyproject.toml | 3 +- .../post_objects/post_object_definitions.py | 10 +-- .../post_objects/post_objects_container.py | 80 +++++++++++-------- src/ansys/fluent/visualization/containers.py | 4 +- 4 files changed, 54 insertions(+), 43 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 864f05c2..88271fce 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,8 @@ packages = [ [tool.poetry.dependencies] python = ">=3.10,<3.14" importlib-metadata = {version = "^4.0", python = "<3.9"} -ansys-fluent-core = "~=0.38.dev0" +ansys-fluent-core = { git = "https://github.com/ansys/pyfluent", branch = "jhilton/typing-improvements" } +ansys-units = { git = "https://github.com/ansys/pyansys-units", branch = "jhilton/variable-descriptor-script" } pyvista = ">=0.44.0" matplotlib = ">=3.6.0" pyvistaqt = { version = "~=0.11.1", optional = true } diff --git a/src/ansys/fluent/interface/post_objects/post_object_definitions.py b/src/ansys/fluent/interface/post_objects/post_object_definitions.py index 1dc33d69..2df842ec 100644 --- a/src/ansys/fluent/interface/post_objects/post_object_definitions.py +++ b/src/ansys/fluent/interface/post_objects/post_object_definitions.py @@ -56,7 +56,7 @@ class BasePostObjectDefn(Protocol, metaclass=abc.ABCMeta): """Base class for visualization objects.""" @abc.abstractmethod - def get_root(self) -> Container: + def get_root(self, instance: object = None) -> Container: raise NotImplementedError surfaces: Callable[[], Sequence[str]] @@ -78,7 +78,7 @@ def _post_display(self) -> None: surf_api.delete_surface_on_server() -class GraphicsDefn(BasePostObjectDefn, PyLocalNamedObject, abc.ABC): +class GraphicsDefn(BasePostObjectDefn, PyLocalNamedObject["Container"], abc.ABC): """Abstract base class for graphics objects.""" @abstractmethod @@ -93,7 +93,7 @@ def display(self, window_id: str | None = None) -> None: pass -class PlotDefn(BasePostObjectDefn, PyLocalNamedObject, abc.ABC): +class PlotDefn(BasePostObjectDefn, PyLocalNamedObject["Container"], abc.ABC): """Abstract base class for plot objects.""" @abstractmethod @@ -525,7 +525,7 @@ class iso_value(PyLocalProperty[float | None]): _value = None - def _reset_on_change(self) -> list: + def _reset_on_change(self) -> list[str | None]: return [self._parent.field] @property @@ -545,7 +545,7 @@ def range(self) -> tuple[float, float] | None: """Iso value range.""" field = self._parent.field() if field: - return self.field_data.scalar_fields.range(field, True) + return cast(tuple[float, float], cast(object, self.field_data.scalar_fields.range(field, True))) class ContourDefn(GraphicsDefn, abc.ABC): diff --git a/src/ansys/fluent/interface/post_objects/post_objects_container.py b/src/ansys/fluent/interface/post_objects/post_objects_container.py index 4ed8ee0e..fb595f6d 100644 --- a/src/ansys/fluent/interface/post_objects/post_objects_container.py +++ b/src/ansys/fluent/interface/post_objects/post_objects_container.py @@ -25,9 +25,11 @@ import builtins import inspect import types -from typing import Any, ClassVar +from typing import Any, Callable, ClassVar, Literal, TypeVar from ansys.fluent.core.session import BaseSession +from numpy import isin +from typing_extensions import TypeIs from ansys.fluent.interface.post_objects.meta import ( PyLocalContainer, @@ -39,6 +41,14 @@ from ansys.fluent.visualization.graphics.graphics_objects import Mesh from ansys.fluent.visualization.plotter.plotter_objects import MonitorPlot, XYPlot +LocalSurfacesProvider = PyLocalContainer[Surface] + +T = TypeVar("T") + + +def is_container(obj: Any) -> TypeIs["PyLocalContainer"]: + return isinstance(obj, PyLocalContainer) + class Container: """ @@ -66,7 +76,7 @@ def __init__( session: BaseSession, module: types.ModuleType, post_api_helper: type[PostAPIHelper], - local_surfaces_provider=None, + local_surfaces_provider: LocalSurfacesProvider | None = None, ): """__init__ method of Container class.""" session_state = self.__class__._sessions_state.get(session) @@ -87,31 +97,25 @@ def get_path(self) -> str: return self._path @property - def type(self): + def type(self) -> Literal["object"]: """Type.""" return "object" - def update(self, value: dict[str, Any]): + def update(self, value: dict[str, Any]) -> None: """Update the value.""" for name, val in value.items(): o = getattr(self, name) o.update(val) - def __call__(self, show_attributes=False) -> dict[str, Any]: - state = {} - for name, cls in self.__dict__.items(): - o = getattr(self, name) - if o is None or name.startswith("_") or name.startswith("__"): - continue - - if isinstance(cls, type) and isinstance(o, PyLocalContainer): - container = o - if getattr(container, "is_active", True): - state[name] = {} - for child_name in container: - o = container[child_name] - if getattr(o, "is_active", True): - state[name][child_name] = o() + def __call__(self, show_attributes: bool = False) -> dict[str, Any]: + state: dict[str, Any] = {} + for name, container in inspect.getmembers(self, predicate=is_container): + if getattr(container, "is_active", True): + state[name] = {} + for child_name in container: + o = container[child_name] + if getattr(o, "is_active", True): + state[name][child_name] = o() return state @@ -192,14 +196,20 @@ class Plots(Container): """ _sessions_state: ClassVar[dict[BaseSession, dict[str, Any]]] = {} - XYPlots: PyLocalContainer[ + XYPlots: PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] XYPlot - ] # pyright: ignore[reportUninitializedInstanceVariable] - MonitorPlots: PyLocalContainer[ + ] + MonitorPlots: PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] MonitorPlot - ] # pyright: ignore[reportUninitializedInstanceVariable] + ] - def __init__(self, session, module, post_api_helper, local_surfaces_provider=None): + def __init__( + self, + session, + module, + post_api_helper: type[PostAPIHelper], + local_surfaces_provider: LocalSurfacesProvider | None = None, + ): """__init__ method of Plots class.""" super().__init__(session, module, post_api_helper, local_surfaces_provider) @@ -235,28 +245,28 @@ class Graphics(Container): """ _sessions_state: ClassVar[dict[BaseSession, dict[str, Any]]] = {} - Meshes: PyLocalContainer[ + Meshes: PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] Mesh - ] # pyright: ignore[reportUninitializedInstanceVariable] - Surfaces: PyLocalContainer[ + ] + Surfaces: PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] Surface - ] # pyright: ignore[reportUninitializedInstanceVariable] - Contours: PyLocalContainer[ + ] + Contours: PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] Contour - ] # pyright: ignore[reportUninitializedInstanceVariable] - Vectors: PyLocalContainer[ + ] + Vectors: PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] Vector - ] # pyright: ignore[reportUninitializedInstanceVariable] - Pathlines: PyLocalContainer[ + ] + Pathlines: PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] Pathline - ] # pyright: ignore[reportUninitializedInstanceVariable] + ] def __init__( self, session: BaseSession, module: types.ModuleType, post_api_helper: type[PostAPIHelper], - local_surfaces_provider=None, + local_surfaces_provider: LocalSurfacesProvider | None = None, ): """__init__ method of Graphics class.""" super().__init__(session, module, post_api_helper, local_surfaces_provider) diff --git a/src/ansys/fluent/visualization/containers.py b/src/ansys/fluent/visualization/containers.py index 699bdcdd..632a060e 100644 --- a/src/ansys/fluent/visualization/containers.py +++ b/src/ansys/fluent/visualization/containers.py @@ -494,9 +494,9 @@ def __init__( ) -class Contour( +class Contour( # pyright: ignore[reportUnsafeMultipleInheritance, reportIncompatibleVariableOverride] _GraphicsContainer, ContourDefn if TYPE_CHECKING else object, abc.ABC -): # pyright: ignore[reportUnsafeMultipleInheritance] +): """ Contour visualization object. From e601d66e375f4774a72b55ab1d5953da99825fa3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 13 Jan 2026 10:27:57 +0000 Subject: [PATCH 10/20] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../interface/post_objects/post_object_definitions.py | 7 ++++++- .../interface/post_objects/post_objects_container.py | 8 +++++--- src/ansys/fluent/visualization/containers.py | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/ansys/fluent/interface/post_objects/post_object_definitions.py b/src/ansys/fluent/interface/post_objects/post_object_definitions.py index 2df842ec..be4207de 100644 --- a/src/ansys/fluent/interface/post_objects/post_object_definitions.py +++ b/src/ansys/fluent/interface/post_objects/post_object_definitions.py @@ -545,7 +545,12 @@ def range(self) -> tuple[float, float] | None: """Iso value range.""" field = self._parent.field() if field: - return cast(tuple[float, float], cast(object, self.field_data.scalar_fields.range(field, True))) + return cast( + tuple[float, float], + cast( + object, self.field_data.scalar_fields.range(field, True) + ), + ) class ContourDefn(GraphicsDefn, abc.ABC): diff --git a/src/ansys/fluent/interface/post_objects/post_objects_container.py b/src/ansys/fluent/interface/post_objects/post_objects_container.py index fb595f6d..17d2f281 100644 --- a/src/ansys/fluent/interface/post_objects/post_objects_container.py +++ b/src/ansys/fluent/interface/post_objects/post_objects_container.py @@ -199,9 +199,11 @@ class Plots(Container): XYPlots: PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] XYPlot ] - MonitorPlots: PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] - MonitorPlot - ] + MonitorPlots: ( + PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] + MonitorPlot + ] + ) def __init__( self, diff --git a/src/ansys/fluent/visualization/containers.py b/src/ansys/fluent/visualization/containers.py index 632a060e..e9c451d3 100644 --- a/src/ansys/fluent/visualization/containers.py +++ b/src/ansys/fluent/visualization/containers.py @@ -494,7 +494,7 @@ def __init__( ) -class Contour( # pyright: ignore[reportUnsafeMultipleInheritance, reportIncompatibleVariableOverride] +class Contour( # pyright: ignore[reportUnsafeMultipleInheritance, reportIncompatibleVariableOverride] _GraphicsContainer, ContourDefn if TYPE_CHECKING else object, abc.ABC ): """ From 6d5c563b634b19ba53a100a890d1691ba0017055 Mon Sep 17 00:00:00 2001 From: Gobot1234 Date: Fri, 16 Jan 2026 10:18:17 +0000 Subject: [PATCH 11/20] attempt to use more inheritance --- .../fluent/interface/post_objects/meta.py | 133 +++++++++--------- 1 file changed, 65 insertions(+), 68 deletions(-) diff --git a/src/ansys/fluent/interface/post_objects/meta.py b/src/ansys/fluent/interface/post_objects/meta.py index c30194fb..86ea7691 100644 --- a/src/ansys/fluent/interface/post_objects/meta.py +++ b/src/ansys/fluent/interface/post_objects/meta.py @@ -22,9 +22,8 @@ """Metaclasses used in various explicit classes in PyFluent.""" -from abc import ABC -from collections.abc import Callable, Iterator, MutableMapping, Sequence import inspect +from collections.abc import Callable, Iterator, MutableMapping, Sequence from typing import ( TYPE_CHECKING, Any, @@ -124,7 +123,9 @@ def __set_name__(self, owner: HasAttributes, name: str): owner.attributes.add(name) def __set__( - self, instance: _SelfT, value: _T_co # pyright: ignore[reportGeneralTypeIssues] + self, + instance: _SelfT, # pyright: ignore[reportGeneralTypeIssues] + value: _T_co, # pyright: ignore[reportGeneralTypeIssues] ) -> Never: raise AttributeError("Attributes are read only.") @@ -133,7 +134,9 @@ def __get__(self, instance: None, _) -> Self: ... @overload def __get__( - self, instance: _SelfT, _ # pyright: ignore[reportGeneralTypeIssues] + self, + instance: _SelfT, # pyright: ignore[reportGeneralTypeIssues] + _, ) -> _T_co: ... def __get__(self, instance: _SelfT | None, _) -> _T_co | Self: @@ -230,25 +233,31 @@ def __get__(self, instance: _SelfT, _): # pyright: ignore[reportGeneralTypeIssu AccessorT = TypeVar("AccessorT", bound=BasePostObjectDefn) +ParentT = TypeVar("ParentT") -class PyLocalBase: +class PyLocalBase(Generic[ParentT]): """Local base.""" + def __init__(self, parent: ParentT, name: str = ""): + self._parent = parent + self._name = name + def get_ancestors_by_type( - self, instance: type[AccessorT], owner: "PyLocalBase | None" = None + self, instance: type[AccessorT], owner: "PyLocalBase[Any] | None" = None ) -> AccessorT: owner = self if owner is None else owner parent = None - if getattr(owner, "_parent", None): + if hasattr(owner, "_parent"): if isinstance(owner._parent, instance): return owner._parent parent = self.get_ancestors_by_type(instance, owner._parent) + assert parent is not None return parent def get_root(self, instance=None) -> Container: instance = self if instance is None else instance parent = instance - if getattr(instance, "_parent", None): + if hasattr(instance, "_parent"): parent = self.get_root(instance._parent) return parent @@ -257,12 +266,12 @@ def get_session(self, instance) -> Solver: return root.session def get_path(self) -> str: - if getattr(self, "_parent", None): + if hasattr(self, "_parent"): return self._parent.get_path() + "/" + self._name return self._name @property - def root(self) -> "PyLocalBase": + def root(self) -> Container: """Top-most parent object.""" return self.get_root(self) @@ -287,17 +296,16 @@ def monitors(self) -> "MonitorsManager": return self.session.monitors -class PyLocalProperty(PyLocalBase, Generic[T]): +class PyLocalProperty(PyLocalBase[ParentT], Generic[ParentT, T]): """Local property classes.""" value: T # pyright: ignore[reportUninitializedInstanceVariable] - def __init__(self, parent, api_helper: type[PostAPIHelper], name: str = ""): - self._name = name + def __init__(self, parent: ParentT, api_helper: type[PostAPIHelper], name: str = ""): + super().__init__(parent, name) self._api_helper = api_helper(self) - self._parent = parent self._on_change_cbs = [] - self.type = get_args(get_original_bases(self.__class__)[0])[ + self.type: type[T] = get_args(get_original_bases(self.__class__)[0])[ 0 ] # T for the class reset_on_change = ( @@ -350,10 +358,10 @@ def _register_on_change_cb(self, on_change_cb: Callable[[], None]): @Attribute @overload - def allowed_values(self: "PyLocalProperty[Sequence[T2]]") -> Sequence[T2]: ... + def allowed_values(self: "PyLocalProperty[Any, Sequence[T2]]") -> Sequence[T2]: ... @Attribute @overload - def allowed_values(self: "PyLocalProperty[T2]") -> Sequence[T2]: ... + def allowed_values(self: "PyLocalProperty[Any, T2]") -> Sequence[T2]: ... @Attribute def allowed_values(self) -> Sequence[object]: """Get allowed values.""" @@ -379,7 +387,7 @@ def allowed_values(self) -> Sequence[object]: # name, # cls(self, lambda arg: None, name), # ) -# if issubclass(cls, (PyLocalNamedObject, PyLocalNamedObjectAbstract)): +# if issubclass(cls, PyLocalNamedObject): # setattr( # self, # cls.PLURAL, @@ -401,51 +409,48 @@ def allowed_values(self) -> Sequence[object]: # delattr(self, "_object") -ParentT = TypeVar("ParentT") -# TODO try poking around this more cause it is kinda what we are doing? -# @dataclass_transform(field_specifiers=(type,)) -class PyLocalObject(PyLocalBase, Generic[ParentT]): + +class PyLocalObject(PyLocalBase[ParentT]): """Local object classes.""" def __init__( self, parent: ParentT, api_helper: type[PostAPIHelper], name: str = "" ): """Create the initialization method for 'PyLocalObjectMeta'.""" - self._parent = parent - self._name = name + super().__init__(parent, name) self._api_helper = api_helper(self) self._command_names = [] self.type = "object" - def update(clss: type[PyLocalBase]): - for name, cls in inspect.getmembers(clss, predicate=inspect.isclass): - if issubclass(cls, PyLocalCommand): - self._command_names.append(name) + update(self.__class__) - if issubclass(cls, (PyLocalProperty, PyLocalObject, PyLocalCommand)): - setattr( - self, - name, - cls(self, api_helper, name), - ) - if issubclass(cls, (PyLocalNamedObject, PyLocalNamedObjectAbstract)): - setattr( - self, - cls.PLURAL, - PyLocalContainer(self, cls, api_helper, cls.PLURAL), - ) - # if issubclass(cls, PyReferenceObject): - # setattr( - # self, - # name, - # cls(self, cls.PATH, cls.LOCATION, cls.SESSION, name), - # ) - for base_class in clss.__bases__: - update(base_class) + def _add_classes_to_instance(self, clss: type[PyLocalBase[object]], api_helper: type[PostAPIHelper]) -> None: + for name, cls in inspect.getmembers(clss, predicate=inspect.isclass): + if issubclass(cls, PyLocalCommand): + self._command_names.append(name) - update(self.__class__) + if issubclass(cls, (PyLocalProperty, PyLocalObject, PyLocalCommand)): + setattr( + self, + name, + cls(self, api_helper, name), + ) + if issubclass(cls, PyLocalNamedObject): + setattr( + self, + cls.PLURAL, + PyLocalContainer(self, cls, api_helper, cls.PLURAL), + ) + # if issubclass(cls, PyReferenceObject): + # setattr( + # self, + # name, + # cls(self, cls.PATH, cls.LOCATION, cls.SESSION, name), + # ) + for base_class in clss.__bases__: + update(base_class) def update(self, value: dict[str, Any]): """Update object.""" @@ -498,7 +503,7 @@ def update_state(clss): if issubclass(cls, PyLocalObject): if getattr(o, "is_active", True): state[name] = o(show_attributes) - elif issubclass(cls, (PyLocalNamedObject, PyLocalNamedObjectAbstract)): + elif issubclass(cls, PyLocalNamedObject): container = getattr(self, cls.PLURAL) if getattr(container, "is_active", True): state[cls.PLURAL] = {} @@ -537,7 +542,7 @@ def __setattr__(self, name: str, value: Any): class PyLocalCommand(PyLocalObject[ParentT], Generic[ParentT, CallKwargs]): """Local object metaclass.""" - def __init__(self, parent: ParentT, api_helper: type[PostAPIHelper], name=""): + def __init__(self, parent: ParentT, api_helper: type[PostAPIHelper], name: str = ""): self._parent = parent self._name = name self._api_helper = api_helper(self) @@ -546,7 +551,8 @@ def __init__(self, parent: ParentT, api_helper: type[PostAPIHelper], name=""): self._command_names = [] self._exe_cmd = getattr(self, "_exe_cmd") - def update(clss): + def _update(cls): + def update(clss) -> None: for name, cls in inspect.getmembers(clss, predicate=inspect.isclass): if issubclass(cls, PyLocalProperty): self._args.append(name) @@ -558,8 +564,6 @@ def update(clss): for base_class in clss.__bases__: update(base_class) - update(self.__class__) - def __call__(self, **kwargs: Unpack[CallKwargs]): for arg_name, arg_value in kwargs.items(): getattr(self, arg_name).set_state(arg_value) @@ -593,7 +597,7 @@ def update(clss): name, cls(self, api_helper, name), ) - elif issubclass(cls, (PyLocalNamedObject, PyLocalNamedObjectAbstract)): + elif issubclass(cls, PyLocalNamedObject): setattr( self, cls.PLURAL, @@ -611,20 +615,13 @@ def update(clss): def create(self) -> Self: ... -class PyLocalNamedObjectAbstract(ABC, PyLocalNamedObject): - """Local named object abstract class.""" - - pass - DefnT = TypeVar("DefnT", bound=Defns, default=Defns) def if_type_checking_instantiate( type: type[T], -) -> ( - T -): # the current behaviour has all of the classes that use this initialised in the XXX class +) -> T: # the current behaviour has all of the classes that use this initialised in the XXX class return cast(T, type) # this is hopefully obviously unsafe @@ -642,7 +639,7 @@ class PyLocalContainer(MutableMapping[str, DefnT]): def __init__( self, parent: "Container", - object_class: type[PyLocalNamedObject[object]], + object_class: type[PyLocalNamedObject[Any]], api_helper: type[PostAPIHelper], name: str = "", ): @@ -754,7 +751,7 @@ def __delitem__(self, name: str) -> None: if on_delete: on_delete(self, name) - def _get_unique_chid_name(self) -> str: + def _get_unique_child_name(self) -> str: children = list(self) index = 0 while True: @@ -772,7 +769,7 @@ def _exe_cmd(self, names: list[str]) -> None: self._parent.__delitem__(item) @if_type_checking_instantiate - class names(PyLocalProperty[list[str]]): + class names(PyLocalProperty["Delete", list[str]]): """Local names property.""" value = [] @@ -787,12 +784,12 @@ class Create(PyLocalCommand["PyLocalContainer", _CreateKwargs]): def _exe_cmd(self, name: str | None = None): if name is None: - name = self._parent._get_unique_chid_name() + name = self._parent._get_unique_child_name() new_object = self._parent.__getitem__(name) return new_object._name @if_type_checking_instantiate - class name(PyLocalProperty[str | None]): + class name(PyLocalProperty["Create", str | None]): """Local name property.""" value = None From 03dfeffb8c76ed1df608c630e0d80694ad3b3cde Mon Sep 17 00:00:00 2001 From: Gobot1234 Date: Fri, 16 Jan 2026 10:19:18 +0000 Subject: [PATCH 12/20] unnest the create method --- .../post_objects/post_objects_container.py | 45 +++++++++---------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/src/ansys/fluent/interface/post_objects/post_objects_container.py b/src/ansys/fluent/interface/post_objects/post_objects_container.py index 17d2f281..8ac14885 100644 --- a/src/ansys/fluent/interface/post_objects/post_objects_container.py +++ b/src/ansys/fluent/interface/post_objects/post_objects_container.py @@ -28,7 +28,7 @@ from typing import Any, Callable, ClassVar, Literal, TypeVar from ansys.fluent.core.session import BaseSession -from numpy import isin +from ansys.fluent.core.session_solver import Solver from typing_extensions import TypeIs from ansys.fluent.interface.post_objects.meta import ( @@ -73,7 +73,7 @@ class Container: def __init__( self, - session: BaseSession, + session: Solver, module: types.ModuleType, post_api_helper: type[PostAPIHelper], local_surfaces_provider: LocalSurfacesProvider | None = None, @@ -141,26 +141,23 @@ def _init_module( cont = PyLocalContainer(self, cls, post_api_helper, cls.PLURAL) # Define a method to add a "create" function to the container - def _add_create(py_cont: PyLocalContainer): - def _create(**kwargs): - new_object = py_cont[py_cont._get_unique_chid_name()] - new_object.__call__ - # Validate that all kwargs are valid attributes for the object - unexpected_args = set(kwargs) - set(new_object()) - if unexpected_args: - raise TypeError( - f"create() got an unexpected keyword argument '{next(iter(unexpected_args))}'." # noqa: E501 - ) - for key, value in kwargs.items(): - if key == "surfaces": - value = list(value) - setattr(new_object, key, value) - return new_object - - return _create + def _create(**kwargs): + new_object = cont[cont._get_unique_child_name()] + new_object.__call__ + # Validate that all kwargs are valid attributes for the object + unexpected_args = set(kwargs) - set(new_object()) + if unexpected_args: + raise TypeError( + f"create() got an unexpected keyword argument '{next(iter(unexpected_args))}'." # noqa: E501 + ) + for key, value in kwargs.items(): + if key == "surfaces": + value = list(value) + setattr(new_object, key, value) + return new_object # Attach the create method to the container - setattr(cont, "create", _add_create(cont)) + setattr(cont, "create", _create) # Attach the container to the parent object setattr( obj, @@ -199,11 +196,9 @@ class Plots(Container): XYPlots: PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] XYPlot ] - MonitorPlots: ( - PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] - MonitorPlot - ] - ) + MonitorPlots: PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] + MonitorPlot + ] def __init__( self, From 5bce65f9b588d9fd1d9c19614eb56d0ea5d2f0c8 Mon Sep 17 00:00:00 2001 From: Gobot1234 Date: Fri, 16 Jan 2026 10:47:51 +0000 Subject: [PATCH 13/20] get rid of more confusing api --- src/ansys/fluent/interface/post_objects/meta.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/ansys/fluent/interface/post_objects/meta.py b/src/ansys/fluent/interface/post_objects/meta.py index 86ea7691..01524983 100644 --- a/src/ansys/fluent/interface/post_objects/meta.py +++ b/src/ansys/fluent/interface/post_objects/meta.py @@ -22,6 +22,7 @@ """Metaclasses used in various explicit classes in PyFluent.""" +from abc import ABC, abstractmethod import inspect from collections.abc import Callable, Iterator, MutableMapping, Sequence from typing import ( @@ -539,7 +540,7 @@ def __setattr__(self, name: str, value: Any): CallKwargs = TypeVar("CallKwargs", bound=TypedDict) -class PyLocalCommand(PyLocalObject[ParentT], Generic[ParentT, CallKwargs]): +class PyLocalCommand(PyLocalObject[ParentT], Generic[ParentT, CallKwargs], ABC): """Local object metaclass.""" def __init__(self, parent: ParentT, api_helper: type[PostAPIHelper], name: str = ""): @@ -549,9 +550,13 @@ def __init__(self, parent: ParentT, api_helper: type[PostAPIHelper], name: str = self.type = "object" self._args = [] self._command_names = [] - self._exe_cmd = getattr(self, "_exe_cmd") - def _update(cls): + @abstractmethod + def _exe_cmd(self, **kwargs: Unpack[CallKwargs]) -> Any: + """Execute command.""" + raise NotImplementedError("not implemented") + + def _update(self, api_helper: type[PostAPIHelper]) -> None: def update(clss) -> None: for name, cls in inspect.getmembers(clss, predicate=inspect.isclass): if issubclass(cls, PyLocalProperty): @@ -764,6 +769,7 @@ def _get_unique_child_name(self) -> str: class Delete(PyLocalCommand["PyLocalContainer", _DeleteKwargs]): """Local delete command.""" + @override def _exe_cmd(self, names: list[str]) -> None: for item in names: self._parent.__delitem__(item) @@ -782,10 +788,11 @@ def allowed_values(self): class Create(PyLocalCommand["PyLocalContainer", _CreateKwargs]): """Local create command.""" + @override def _exe_cmd(self, name: str | None = None): if name is None: name = self._parent._get_unique_child_name() - new_object = self._parent.__getitem__(name) + new_object = self._parent[name] return new_object._name @if_type_checking_instantiate From 306d2777489c52f7d4d6479109ec357dae34a552 Mon Sep 17 00:00:00 2001 From: Gobot1234 Date: Mon, 19 Jan 2026 17:39:27 +0000 Subject: [PATCH 14/20] more work --- pyproject.toml | 2 + .../fluent/interface/post_objects/meta.py | 8 - .../post_objects/post_object_definitions.py | 113 +++---- .../post_objects/post_objects_container.py | 18 +- src/ansys/fluent/visualization/__init__.py | 41 ++- .../fluent/visualization/base/renderer.py | 20 +- src/ansys/fluent/visualization/containers.py | 281 +++++++++--------- .../graphics/pyvista/renderer.py | 139 +++++---- .../fluent/visualization/plotter/__init__.py | 6 +- .../visualization/plotter/plotter_objects.py | 5 +- src/ansys/fluent/visualization/registrar.py | 4 +- src/ansys/fluent/visualization/renderer.py | 28 +- 12 files changed, 357 insertions(+), 308 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 88271fce..42837ad7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -81,6 +81,7 @@ skips = [ ] [tool.basedpyright] +reportAny = false reportUnknownMemberType = false reportExplicitAny = false reportPrivateUsage = false @@ -88,3 +89,4 @@ reportUnusedCallResult = false reportUnannotatedClassAttribute = false reportPrivateImportUsage = false ignore = ["doc"] +reportMissingTypeStubs=false \ No newline at end of file diff --git a/src/ansys/fluent/interface/post_objects/meta.py b/src/ansys/fluent/interface/post_objects/meta.py index 01524983..adc39110 100644 --- a/src/ansys/fluent/interface/post_objects/meta.py +++ b/src/ansys/fluent/interface/post_objects/meta.py @@ -53,20 +53,12 @@ from ansys.fluent.interface.post_objects.post_helper import PostAPIHelper from ansys.fluent.interface.post_objects.post_object_definitions import ( BasePostObjectDefn, - ContourDefn, Defns, - MonitorDefn, - VectorDefn, ) if TYPE_CHECKING: from ansys.fluent.core.services.field_data import LiveFieldData from ansys.fluent.core.streaming_services.monitor_streaming import MonitorsManager - - from ansys.fluent.interface.post_objects.post_object_definitions import ( - GraphicsDefn, - PlotDefn, - ) from ansys.fluent.interface.post_objects.post_objects_container import Container # pylint: disable=unused-private-member diff --git a/src/ansys/fluent/interface/post_objects/post_object_definitions.py b/src/ansys/fluent/interface/post_objects/post_object_definitions.py index be4207de..af1f7527 100644 --- a/src/ansys/fluent/interface/post_objects/post_object_definitions.py +++ b/src/ansys/fluent/interface/post_objects/post_object_definitions.py @@ -23,15 +23,13 @@ """Module providing visualization objects definition.""" import abc +import logging from abc import abstractmethod from collections.abc import Callable, Sequence -import logging from typing import ( TYPE_CHECKING, Literal, - NamedTuple, Protocol, - Self, TypeAlias, cast, final, @@ -115,7 +113,7 @@ class MonitorDefn(PlotDefn, abc.ABC): @final @if_type_checking_instantiate - class monitor_set_name(PyLocalProperty[str | None]): + class monitor_set_name(PyLocalProperty["MonitorDefn", str | None]): """Monitor set name.""" value = None @@ -133,28 +131,28 @@ class XYPlotDefn(PlotDefn, abc.ABC): @final @if_type_checking_instantiate - class node_values(PyLocalProperty[bool]): + class node_values(PyLocalProperty["XYPlotDefn", bool]): """Plot nodal values.""" value = True @final @if_type_checking_instantiate - class boundary_values(PyLocalProperty[bool]): + class boundary_values(PyLocalProperty["XYPlotDefn", bool]): """Plot Boundary values.""" value = True @final @if_type_checking_instantiate - class direction_vector(PyLocalProperty[tuple[int, int, int]]): + class direction_vector(PyLocalProperty["XYPlotDefn", tuple[int, int, int]]): """Direction Vector.""" value = (1, 0, 0) @final @if_type_checking_instantiate - class y_axis_function(PyLocalProperty[str | None]): + class y_axis_function(PyLocalProperty["XYPlotDefn", str | None]): """Y Axis Function.""" value = None @@ -166,7 +164,7 @@ def allowed_values(self) -> list[str]: @final @if_type_checking_instantiate - class x_axis_function(PyLocalProperty[Literal["direction-vector"]]): + class x_axis_function(PyLocalProperty["XYPlotDefn", Literal["direction-vector"]]): """X Axis Function.""" value = "direction-vector" @@ -177,7 +175,7 @@ def allowed_values(self) -> Sequence[Literal["direction-vector"]]: return ["direction-vector"] @if_type_checking_instantiate - class surfaces(PyLocalProperty[list[str]]): + class surfaces(PyLocalProperty["XYPlotDefn", list[str]]): """List of surfaces for plotting.""" value = [] @@ -196,7 +194,7 @@ class MeshDefn(GraphicsDefn, abc.ABC): PLURAL = "Meshes" @if_type_checking_instantiate - class surfaces(PyLocalProperty[list[str]]): + class surfaces(PyLocalProperty["MeshDefn", list[str]]): """List of surfaces for mesh graphics.""" value = [] @@ -209,19 +207,19 @@ def allowed_values(self) -> list[str]: ) @if_type_checking_instantiate - class show_edges(PyLocalProperty[bool]): + class show_edges(PyLocalProperty["MeshDefn", bool]): """Show edges for mesh.""" value = False @if_type_checking_instantiate - class show_nodes(PyLocalProperty[bool]): + class show_nodes(PyLocalProperty["MeshDefn", bool]): """Show nodes for mesh.""" value = False @if_type_checking_instantiate - class show_faces(PyLocalProperty[bool]): + class show_faces(PyLocalProperty["MeshDefn", bool]): """Show faces for mesh.""" value = True @@ -233,7 +231,7 @@ class PathlinesDefn(GraphicsDefn, abc.ABC): PLURAL = "Pathlines" @if_type_checking_instantiate - class field(PyLocalProperty[str | None]): + class field(PyLocalProperty["PathlinesDefn", str | None]): """Pathlines field.""" value = None @@ -244,7 +242,7 @@ def allowed_values(self) -> list[str]: return list(self.field_data.scalar_fields()) @if_type_checking_instantiate - class surfaces(PyLocalProperty[list[str]]): + class surfaces(PyLocalProperty["PathlinesDefn", list[str]]): """List of surfaces for pathlines.""" value = [] @@ -268,7 +266,7 @@ def name(self) -> str: return self._name @if_type_checking_instantiate - class show_edges(PyLocalProperty[bool]): + class show_edges(PyLocalProperty["SurfaceDefn", bool]): """Show edges for surface.""" value = True @@ -278,7 +276,9 @@ class definition(PyLocalObject["SurfaceDefn"]): @final @if_type_checking_instantiate - class type(PyLocalProperty[Literal["plane-surface", "iso-surface"]]): + class type( + PyLocalProperty["definition", Literal["plane-surface", "iso-surface"]] + ): """Surface type.""" value = "iso-surface" @@ -303,7 +303,8 @@ def is_active(self) -> bool: @if_type_checking_instantiate class creation_method( PyLocalProperty[ - Literal["xy-plane", "yz-plane", "zx-plane", "point-and-normal"] + "plane_surface", + Literal["xy-plane", "yz-plane", "zx-plane", "point-and-normal"], ] ): """Creation Method.""" @@ -329,7 +330,7 @@ def is_active(self) -> bool: return self._parent.creation_method() == "point-and-normal" @if_type_checking_instantiate - class x(PyLocalProperty[float]): + class x(PyLocalProperty["point", float]): """X value.""" value = 0 @@ -348,7 +349,7 @@ def range(self) -> tuple[float, float]: ) @if_type_checking_instantiate - class y(PyLocalProperty[float]): + class y(PyLocalProperty["point", float]): """Y value.""" value = 0 @@ -367,7 +368,7 @@ def range(self) -> tuple[float, float]: ) @if_type_checking_instantiate - class z(PyLocalProperty[float]): + class z(PyLocalProperty["point", float]): """Z value.""" value = 0 @@ -395,7 +396,7 @@ def is_active(self) -> bool: return self._parent.creation_method() == "point-and-normal" @if_type_checking_instantiate - class x(PyLocalProperty[float]): + class x(PyLocalProperty["normal", float]): """X value.""" value = 0 @@ -406,7 +407,7 @@ def range(self) -> list[int]: return [-1, 1] @if_type_checking_instantiate - class y(PyLocalProperty[float]): + class y(PyLocalProperty["normal", float]): """Y value.""" value = 0 @@ -417,7 +418,7 @@ def range(self) -> list[int]: return [-1, 1] @if_type_checking_instantiate - class z(PyLocalProperty[float]): + class z(PyLocalProperty["normal", float]): """Z value.""" value = 0 @@ -437,7 +438,7 @@ def is_active(self) -> bool: return self._parent.creation_method() == "xy-plane" @if_type_checking_instantiate - class z(PyLocalProperty[float]): + class z(PyLocalProperty["xy_plane", float]): """Z value.""" value = 0 @@ -457,7 +458,7 @@ def is_active(self) -> bool: return self._parent.creation_method() == "yz-plane" @if_type_checking_instantiate - class x(PyLocalProperty[float]): + class x(PyLocalProperty["yz_plane", float]): """X value.""" value = 0 @@ -477,7 +478,7 @@ def is_active(self) -> bool: return self._parent.creation_method() == "zx-plane" @if_type_checking_instantiate - class y(PyLocalProperty[float]): + class y(PyLocalProperty["zx_plane", float]): """Y value.""" value = 0 @@ -497,7 +498,7 @@ def is_active(self) -> bool: return self._parent.type() == "iso-surface" @if_type_checking_instantiate - class field(PyLocalProperty[str | None]): + class field(PyLocalProperty["iso_surface", str | None]): """Iso surface field.""" value = None @@ -509,7 +510,7 @@ def allowed_values(self) -> list[str]: @final @if_type_checking_instantiate - class rendering(PyLocalProperty[Literal["mesh", "contour"]]): + class rendering(PyLocalProperty["iso_surface", Literal["mesh", "contour"]]): """Iso surface rendering.""" value = "mesh" @@ -520,7 +521,7 @@ def allowed_values(self) -> Sequence[Literal["mesh", "contour"]]: return ["mesh", "contour"] @if_type_checking_instantiate - class iso_value(PyLocalProperty[float | None]): + class iso_value(PyLocalProperty["iso_surface", float | None]): """Iso value for field.""" _value = None @@ -559,7 +560,7 @@ class ContourDefn(GraphicsDefn, abc.ABC): PLURAL = "Contours" @if_type_checking_instantiate - class field(PyLocalProperty[str | None]): + class field(PyLocalProperty["ContourDefn", str | None]): """Contour field.""" value = None @@ -570,7 +571,7 @@ def allowed_values(self) -> list[str]: return list(self.field_data.scalar_fields()) @if_type_checking_instantiate - class surfaces(PyLocalProperty[list[str]]): + class surfaces(PyLocalProperty["ContourDefn", list[str]]): """Contour surfaces.""" value = [] @@ -583,13 +584,13 @@ def allowed_values(self) -> list[str]: ) @if_type_checking_instantiate - class filled(PyLocalProperty[bool]): + class filled(PyLocalProperty["ContourDefn", bool]): """Draw filled contour.""" value = True @if_type_checking_instantiate - class node_values(PyLocalProperty[bool]): + class node_values(PyLocalProperty["ContourDefn", bool]): """Draw nodal data.""" _value = True @@ -624,19 +625,19 @@ def value(self, value: bool) -> None: self._value = value @if_type_checking_instantiate - class boundary_values(PyLocalProperty[bool]): + class boundary_values(PyLocalProperty["ContourDefn", bool]): """Draw boundary values.""" value = False @if_type_checking_instantiate - class contour_lines(PyLocalProperty[bool]): + class contour_lines(PyLocalProperty["ContourDefn", bool]): """Draw contour lines.""" value = False @if_type_checking_instantiate - class show_edges(PyLocalProperty[bool]): + class show_edges(PyLocalProperty["ContourDefn", bool]): """Show edges.""" value = False @@ -646,7 +647,9 @@ class range(PyLocalObject["ContourDefn"]): @final @if_type_checking_instantiate - class option(PyLocalProperty[Literal["auto-range-on", "auto-range-off"]]): + class option( + PyLocalProperty["range", Literal["auto-range-on", "auto-range-off"]] + ): """Range option.""" value = "auto-range-on" @@ -668,7 +671,7 @@ def is_active(self) -> bool: return self._parent.option() == "auto-range-on" @if_type_checking_instantiate - class global_range(PyLocalProperty[bool]): + class global_range(PyLocalProperty["auto_range_on", bool]): """Show global range.""" value = False @@ -683,13 +686,13 @@ def is_active(self) -> bool: return self._parent.option() == "auto-range-off" @if_type_checking_instantiate - class clip_to_range(PyLocalProperty[bool]): + class clip_to_range(PyLocalProperty["auto_range_off", bool]): """Clip contour within range.""" value = False @if_type_checking_instantiate - class minimum(PyLocalProperty[float | None]): + class minimum(PyLocalProperty["auto_range_off", float | None]): """Range minimum.""" _value = None @@ -720,7 +723,7 @@ def value(self, value: float | None) -> None: self._value = value @if_type_checking_instantiate - class maximum(PyLocalProperty[float | None]): + class maximum(PyLocalProperty["auto_range_off", float | None]): """Range maximum.""" _value = None @@ -758,7 +761,7 @@ class VectorDefn(GraphicsDefn, abc.ABC): PLURAL = "Vectors" @if_type_checking_instantiate - class vectors_of(PyLocalProperty[str | None]): + class vectors_of(PyLocalProperty["VectorDefn", str | None]): """Vector type.""" value = None @@ -769,7 +772,7 @@ def allowed_values(self) -> list[str]: return list(self.field_data.vector_fields()) @if_type_checking_instantiate - class field(PyLocalProperty[str | None]): + class field(PyLocalProperty["VectorDefn", str | None]): """Vector color field.""" value = None @@ -780,7 +783,7 @@ def allowed_values(self) -> list[str]: return list(self.field_data.scalar_fields()) @if_type_checking_instantiate - class surfaces(PyLocalProperty[list[str]]): + class surfaces(PyLocalProperty["VectorDefn", list[str]]): """List of surfaces for vector graphics.""" value = [] @@ -793,19 +796,19 @@ def allowed_values(self) -> list[str]: ) @if_type_checking_instantiate - class scale(PyLocalProperty[float]): + class scale(PyLocalProperty["VectorDefn", float]): """Vector scale.""" value = 1.0 @if_type_checking_instantiate - class skip(PyLocalProperty[int]): + class skip(PyLocalProperty["VectorDefn", int]): """Vector skip.""" value = 0 @if_type_checking_instantiate - class show_edges(PyLocalProperty[bool]): + class show_edges(PyLocalProperty["VectorDefn", bool]): """Show edges.""" value = False @@ -816,7 +819,9 @@ class range(PyLocalObject["VectorDefn"]): @final @if_type_checking_instantiate - class option(PyLocalProperty[Literal["auto-range-on", "auto-range-off"]]): + class option( + PyLocalProperty["range", Literal["auto-range-on", "auto-range-off"]] + ): """Range option.""" value = "auto-range-on" @@ -838,7 +843,7 @@ def is_active(self) -> bool: return self._parent.option() == "auto-range-on" @if_type_checking_instantiate - class global_range(PyLocalProperty[bool]): + class global_range(PyLocalProperty["auto_range_on", bool]): """Show global range.""" value = False @@ -853,13 +858,13 @@ def is_active(self) -> bool: return self._parent.option() == "auto-range-off" @if_type_checking_instantiate - class clip_to_range(PyLocalProperty[bool]): + class clip_to_range(PyLocalProperty["auto_range_off", bool]): """Clip vector within range.""" value = False @if_type_checking_instantiate - class minimum(PyLocalProperty[float | None]): + class minimum(PyLocalProperty["auto_range_off", float | None]): """Range minimum.""" _value = None @@ -881,7 +886,7 @@ def value(self, value: float | None) -> None: self._value = value @if_type_checking_instantiate - class maximum(PyLocalProperty[float | None]): + class maximum(PyLocalProperty["auto_range_off", float | None]): """Range maximum.""" _value = None diff --git a/src/ansys/fluent/interface/post_objects/post_objects_container.py b/src/ansys/fluent/interface/post_objects/post_objects_container.py index 8ac14885..2298dbf5 100644 --- a/src/ansys/fluent/interface/post_objects/post_objects_container.py +++ b/src/ansys/fluent/interface/post_objects/post_objects_container.py @@ -36,6 +36,7 @@ PyLocalNamedObject, ) from ansys.fluent.interface.post_objects.post_helper import PostAPIHelper +from ansys.fluent.interface.post_objects.post_object_definitions import ContourDefn, MeshDefn, SurfaceDefn, VectorDefn from ansys.fluent.visualization import Contour, Surface, Vector from ansys.fluent.visualization.containers import Pathline from ansys.fluent.visualization.graphics.graphics_objects import Mesh @@ -202,8 +203,8 @@ class Plots(Container): def __init__( self, - session, - module, + session: Solver, + module: types.ModuleType, post_api_helper: type[PostAPIHelper], local_surfaces_provider: LocalSurfacesProvider | None = None, ): @@ -241,18 +242,19 @@ class Graphics(Container): Container for vector objects. """ + # TODO double triple check these local container types are correct cause something seems off vs Mesh _sessions_state: ClassVar[dict[BaseSession, dict[str, Any]]] = {} Meshes: PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] - Mesh + MeshDefn ] Surfaces: PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] - Surface + SurfaceDefn ] Contours: PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] - Contour + ContourDefn ] Vectors: PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] - Vector + VectorDefn ] Pathlines: PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] Pathline @@ -260,7 +262,7 @@ class Graphics(Container): def __init__( self, - session: BaseSession, + session: Solver, module: types.ModuleType, post_api_helper: type[PostAPIHelper], local_surfaces_provider: LocalSurfacesProvider | None = None, @@ -268,7 +270,7 @@ def __init__( """__init__ method of Graphics class.""" super().__init__(session, module, post_api_helper, local_surfaces_provider) - def add_outline_mesh(self) -> Mesh | None: + def add_outline_mesh(self) -> MeshDefn | None: """Add a mesh outline. Returns diff --git a/src/ansys/fluent/visualization/__init__.py b/src/ansys/fluent/visualization/__init__.py index e306d05c..e66fb8af 100644 --- a/src/ansys/fluent/visualization/__init__.py +++ b/src/ansys/fluent/visualization/__init__.py @@ -22,13 +22,28 @@ """Python post processing integrations for the Fluent solver.""" -try: - import importlib.metadata as importlib_metadata -except ModuleNotFoundError: - import importlib_metadata +from importlib.metadata import version as _version + +from ansys.fluent.visualization.config import config as config +from ansys.fluent.visualization.config import get_config as get_config +from ansys.fluent.visualization.config import set_config as set_config +from ansys.fluent.visualization.containers import Contour as Contour +from ansys.fluent.visualization.containers import IsoSurface as IsoSurface +from ansys.fluent.visualization.containers import Mesh as Mesh +from ansys.fluent.visualization.containers import Monitor as Monitor +from ansys.fluent.visualization.containers import Pathline as Pathline +from ansys.fluent.visualization.containers import PlaneSurface as PlaneSurface +from ansys.fluent.visualization.containers import Surface as Surface +from ansys.fluent.visualization.containers import Vector as Vector +from ansys.fluent.visualization.containers import XYPlot as XYPlot +from ansys.fluent.visualization.graphics import Graphics as Graphics +from ansys.fluent.visualization.plotter import Plots as Plots +from ansys.fluent.visualization.registrar import register_renderer as register_renderer +from ansys.fluent.visualization.renderer import GraphicsWindow as GraphicsWindow + _VERSION_INFO = None -__version__ = importlib_metadata.version(__name__.replace(".", "-")) +__version__ = _version(__name__.replace(".", "-")) def version_info() -> str: @@ -46,19 +61,3 @@ def version_info() -> str: return _VERSION_INFO if _VERSION_INFO is not None else __version__ -from ansys.fluent.visualization.config import config as config -from ansys.fluent.visualization.config import get_config as get_config -from ansys.fluent.visualization.config import set_config as set_config -from ansys.fluent.visualization.containers import Contour as Contour -from ansys.fluent.visualization.containers import IsoSurface as IsoSurface -from ansys.fluent.visualization.containers import Mesh as Mesh -from ansys.fluent.visualization.containers import Monitor as Monitor -from ansys.fluent.visualization.containers import Pathline as Pathline -from ansys.fluent.visualization.containers import PlaneSurface as PlaneSurface -from ansys.fluent.visualization.containers import Surface as Surface -from ansys.fluent.visualization.containers import Vector as Vector -from ansys.fluent.visualization.containers import XYPlot as XYPlot -from ansys.fluent.visualization.graphics import Graphics as Graphics -from ansys.fluent.visualization.plotter import Plots as Plots -from ansys.fluent.visualization.registrar import register_renderer as register_renderer -from ansys.fluent.visualization.renderer import GraphicsWindow as GraphicsWindow diff --git a/src/ansys/fluent/visualization/base/renderer.py b/src/ansys/fluent/visualization/base/renderer.py index 1673b496..712b088c 100644 --- a/src/ansys/fluent/visualization/base/renderer.py +++ b/src/ansys/fluent/visualization/base/renderer.py @@ -23,27 +23,31 @@ """Abstract module providing rendering functionality.""" from abc import ABC, abstractmethod -from typing import Any, TypedDict +from collections.abc import Mapping, Sequence +from typing import Any, Generic, NotRequired, TypedDict +from typing_extensions import TypeVar -class SurfaceToRender(TypedDict): +DataT = TypeVar("DataT", default=Any) + +class SurfaceToRender(TypedDict, Generic[DataT]): """TypedDict for mesh surface definition.""" - data: object - position: tuple[int, int] - opacity: float + data: DataT + position: NotRequired[tuple[int, int]] + opacity: NotRequired[float] title: str - kwargs: dict[str, Any] + kwargs: Mapping[str, Any] -SubPlot = list[SurfaceToRender] +SubPlot = Sequence[SurfaceToRender[DataT]] class AbstractRenderer(ABC): """Abstract class for rendering graphics and plots.""" @abstractmethod - def render(self, meshes: list[SubPlot]) -> None: + def render(self, meshes: Sequence[SubPlot]) -> None: """Render graphics and plots in a window. Parameters diff --git a/src/ansys/fluent/visualization/containers.py b/src/ansys/fluent/visualization/containers.py index e9c451d3..676cef6e 100644 --- a/src/ansys/fluent/visualization/containers.py +++ b/src/ansys/fluent/visualization/containers.py @@ -26,10 +26,10 @@ """Containers for graphics.""" import abc -from collections.abc import Callable from typing import ( TYPE_CHECKING, Any, + Generic, Literal, Self, TypedDict, @@ -40,37 +40,42 @@ from ansys.fluent.core.field_data_interfaces import _to_field_name_str from ansys.fluent.core.utils.context_managers import _get_active_session from ansys.units import VariableDescriptor -from typing_extensions import override +from typing_extensions import TypeVar, override from ansys.fluent.visualization.graphics import Graphics from ansys.fluent.visualization.plotter import Plots if TYPE_CHECKING: - from ansys.fluent.core.session import BaseSession from ansys.fluent.core.session_solver import Solver from ansys.fluent.interface.post_objects.meta import _DeleteKwargs from ansys.fluent.interface.post_objects.post_object_definitions import ( ContourDefn, Defns, - GraphicsDefn, MonitorDefn, SurfaceDefn, VectorDefn, + MeshDefn, + PathlinesDefn, + XYPlotDefn, ) from ansys.fluent.interface.post_objects.post_objects_container import Container +DefnT = TypeVar("DefnT", bound="Defns", default="Defns") -class _GraphicsContainer: + +class _GraphicsContainer(Generic[DefnT]): """Base class for graphics containers.""" - solver: BaseSession # pyright: ignore[reportUninitializedInstanceVariable] - _obj: Defns # pyright: ignore[reportUninitializedInstanceVariable] + kwargs: dict[str, Any] # pyright: ignore[reportUninitializedInstanceVariable] + solver: Solver # pyright: ignore[reportUninitializedInstanceVariable] + _obj: DefnT # pyright: ignore[reportUninitializedInstanceVariable] - def __init__(self, solver: BaseSession | None, **kwargs: Any): + def __init__(self, solver: Solver | None, **kwargs: Any): + super().__init__() self.__dict__["solver"] = solver or _get_active_session() self.__dict__["kwargs"] = kwargs - if self.solver is None: + if self.solver is None: # pyright: ignore[reportUnnecessaryComparison] raise RuntimeError("No solver session provided and none found in context.") if "field" in self.kwargs: self.kwargs["field"] = kwargs["field"] = _to_field_name_str( @@ -84,12 +89,10 @@ def __init__(self, solver: BaseSession | None, **kwargs: Any): if TYPE_CHECKING: # we have these due to inheriting from the ABCs at type time but the attributes coming from ._obj # the type checker thinks they aren't valid to instantiate otherwise - def get_root(self) -> Container: ... - def display(self, window_id: str | None = None) -> None: ... + def get_root(self, instance: object = None) -> Container: ... # pyright: ignore[reportUnusedParameter] + def display(self, window_id: str | None = None) -> None: ...# pyright: ignore[reportUnusedParameter] - surfaces: Callable[ - [], list[str] - ] # pyright: ignore[reportUninitializedInstanceVariable] + surfaces: Any # pyright: ignore[reportUninitializedInstanceVariable] else: def __getattr__(self, attr): @@ -106,9 +109,9 @@ def __dir__(self) -> list[str]: return sorted(set(super().__dir__()) | set(dir(self._obj))) -class Mesh( - _GraphicsContainer, GraphicsDefn if TYPE_CHECKING else object, abc.ABC -): # pyright: ignore[reportUnsafeMultipleInheritance] +class Mesh( # pyright: ignore[reportUnsafeMultipleInheritance] + _GraphicsContainer["MeshDefn"], MeshDefn if TYPE_CHECKING else object, abc.ABC +): """Mesh visualization object. Creates a Fluent mesh graphic object on the specified surfaces. @@ -139,14 +142,12 @@ class Mesh( >>> ) """ - _obj: GraphicsDefn - def __init__( self, *, surfaces: list[str], show_edges: bool = False, - solver: BaseSession | None = None, + solver: Solver | None = None, **kwargs: Unpack[_DeleteKwargs], ): """__init__ method of Mesh class.""" @@ -159,27 +160,34 @@ def __init__( "show_edges": show_edges, }, ) - self.__dict__["_obj"] = Graphics(session=self.solver).Meshes.create( - **self.kwargs + super().__setattr__( + "_obj", Graphics(session=self.solver).Meshes.create(**self.kwargs) ) -class SurfaceKwargs(TypedDict, total=False): - type: str | None - creation_method: str | None - x: float | None - y: float | None - z: float | None - field: str | VariableDescriptor | None - iso_value: float | None - rendering: str | None - point: tuple[float, float, float] | None - normal: tuple[float, float, float] | None - - -class Surface( - _GraphicsContainer, SurfaceDefn if TYPE_CHECKING else object, abc.ABC -): # pyright: ignore[reportUnsafeMultipleInheritance] +SurfaceType = Literal['plane-surface', 'iso-surface'] +SurfaceCreationMethod = Literal[ + 'xy-plane', 'yz-plane', 'zx-plane', 'point-and-normal' +] +SurfaceRendering = Literal['mesh', 'contour'] + +class SurfaceKwargsNoType(TypedDict, total=False): + creation_method: SurfaceCreationMethod + x: float + y: float + z: float + field: str | VariableDescriptor + iso_value: float + rendering: SurfaceRendering + point: tuple[float, float, float] + normal: tuple[float, float, float] + +class SurfaceKwargs(SurfaceKwargsNoType): + type: SurfaceType + +class Surface( # pyright: ignore[reportUnsafeMultipleInheritance] + _GraphicsContainer["SurfaceDefn"], SurfaceDefn if TYPE_CHECKING else object, abc.ABC +): """Surface definition for Fluent post-processing. The ``Surface`` class represents any Fluent surface generated for @@ -228,46 +236,54 @@ class determines the session. >>> surf_outlet_plane.iso_value = -0.125017 """ - _obj: SurfaceDefn - def __init__( - self, *, solver: BaseSession | None = None, **kwargs: Unpack[SurfaceKwargs] + self, *, solver: Solver | None = None, **kwargs: Unpack[SurfaceKwargs] ): """__init__ method of Surface class.""" super().__init__(solver, **kwargs) super().__setattr__( - "_obj", Graphics(session=self.solver).Surfaces.create(**kwargs) + "_obj", Graphics(session=self.solver).Surfaces.create(**self.kwargs) ) - self.type = kwargs.get("type") - self.creation_method = kwargs.get("creation_method") - self.x = kwargs.get("x") - self.y = kwargs.get("y") - self.z = kwargs.get("z") - self.field = kwargs.get("field") - self.iso_value = kwargs.get("iso_value") - self.rendering = kwargs.get("rendering") - self.point = kwargs.get("point") - self.normal = kwargs.get("normal") + self.type = kwargs["type"] + if "creation_method" in kwargs: + self.creation_method = kwargs["creation_method"] + if "x" in kwargs: + self.x = kwargs["x"] + if "y" in kwargs: + self.y = kwargs["y"] + if "z" in kwargs: + self.z = kwargs["z"] + if "field" in kwargs: + self.field = kwargs["field"] + if "iso_value" in kwargs: + self.iso_value = kwargs["iso_value"] + if "rendering" in kwargs: + self.rendering = kwargs["rendering"] + if "point" in kwargs: + self.point = kwargs["point"] + if "normal" in kwargs: + self.normal = kwargs["normal"] @property - def type(self) -> Literal["plane-surface", "iso-surface"]: + @override + def type(self) -> SurfaceType: """Surface definition type.""" return self._obj.definition.type() @type.setter - def type(self, value: Literal["plane-surface", "iso-surface"]) -> None: + def type(self, value: SurfaceType) -> None: self._obj.definition.type = value @property def creation_method( self, - ) -> Literal["xy-plane", "yz-plane", "zx-plane", "point-and-normal"]: + ) -> SurfaceCreationMethod: """Plane surface creation method.""" return self._obj.definition.plane_surface.creation_method() @creation_method.setter def creation_method( - self, value: Literal["xy-plane", "yz-plane", "zx-plane", "point-and-normal"] + self, value: SurfaceCreationMethod ) -> None: self._obj.definition.plane_surface.creation_method = value @@ -323,12 +339,12 @@ def iso_value(self, value: float | None) -> None: self._obj.definition.iso_surface.iso_value = value @property - def rendering(self) -> Literal["mesh", "contour"]: + def rendering(self) -> SurfaceRendering: """Iso-surface rendering method.""" return self._obj.definition.iso_surface.rendering() @rendering.setter - def rendering(self, value: Literal["mesh", "contour"]) -> None: + def rendering(self, value: SurfaceRendering) -> None: self._obj.definition.iso_surface.rendering = value @property @@ -383,7 +399,7 @@ class PlaneSurface(Surface, abc.ABC): @classmethod def create_xy_plane( - cls, *, solver: BaseSession | None = None, z: float = 0.0, **kwargs: Any + cls, *, solver: Solver | None = None, z: float = 0.0, **kwargs: Any ) -> Self: """Create a plane surface in the XY plane at a given Z value.""" return cls( @@ -396,7 +412,7 @@ def create_xy_plane( @classmethod def create_yz_plane( - cls, solver: BaseSession | None = None, x: float = 0.0, **kwargs: Any + cls, solver: Solver | None = None, x: float = 0.0, **kwargs: Any ) -> Self: """Create a plane surface in the YZ plane at a given X value.""" return cls( @@ -409,7 +425,7 @@ def create_yz_plane( @classmethod def create_zx_plane( - cls, solver: BaseSession | None = None, y: float = 0.0, **kwargs: Any + cls, solver: Solver | None = None, y: float = 0.0, **kwargs: Any ): """Create a plane surface in the ZX plane at a given Y value.""" return cls( @@ -423,7 +439,7 @@ def create_zx_plane( @classmethod def create_from_point_and_normal( cls, - solver: BaseSession | None = None, + solver: Solver | None = None, point: tuple[float, float, float] = (0, 0, 0), normal: tuple[float, float, float] = (0, 0, 0), **kwargs: Any, @@ -477,25 +493,21 @@ class IsoSurface(Surface, abc.ABC): def __init__( self, - solver: BaseSession | None = None, - field: str | VariableDescriptor | None = None, - rendering: str | None = None, - iso_value: float | None = None, - **kwargs: Any, + solver: Solver | None = None, + **kwargs: Unpack[SurfaceKwargsNoType], ): """Create an iso-surface.""" super().__init__( solver=solver, type="iso-surface", - field=field, - rendering=rendering, - iso_value=iso_value, **kwargs, ) +class GenericCreateArgs(TypedDict, total=False): + name: str -class Contour( # pyright: ignore[reportUnsafeMultipleInheritance, reportIncompatibleVariableOverride] - _GraphicsContainer, ContourDefn if TYPE_CHECKING else object, abc.ABC +class Contour( # pyright: ignore[reportUnsafeMultipleInheritance] + _GraphicsContainer["ContourDefn"], ContourDefn if TYPE_CHECKING else object, abc.ABC ): """ Contour visualization object. @@ -531,22 +543,17 @@ class Contour( # pyright: ignore[reportUnsafeMultipleInheritance, reportIncompa >>> ) """ - _obj: ContourDefn - - def __init__(self, *, solver=None, **kwargs): + def __init__(self, *, solver: Solver | None = None, **kwargs: Unpack[SurfaceKwargsNoType]): """__init__ method of Contour class.""" - super().__init__( - solver, - **kwargs, - ) - self.__dict__["_obj"] = Graphics(session=self.solver).Contours.create( - **self.kwargs + super().__init__(solver, **kwargs) + super().__setattr__( + "_obj", Graphics(session=self.solver).Contours.create(**self.kwargs) ) -class Vector( - _GraphicsContainer, VectorDefn if TYPE_CHECKING else object, abc.ABC -): # pyright: ignore[reportUnsafeMultipleInheritance] +class Vector( # pyright: ignore[reportUnsafeMultipleInheritance] + _GraphicsContainer["VectorDefn"], VectorDefn if TYPE_CHECKING else object, abc.ABC +): """Vector visualization object. Parameters @@ -580,16 +587,15 @@ class Vector( >>> ) """ - _obj: VectorDefn - def __init__( self, *, field: str | VariableDescriptor, + surfaces: list[str], color_by: str | VariableDescriptor | None = None, scale: float = 1.0, - solver=None, - **kwargs, + solver: Solver | None = None, + **kwargs: Any, ): """__init__ method of Vector class.""" if color_by is None: @@ -604,9 +610,10 @@ def __init__( "scale": scale, }, ) - self.__dict__["_obj"] = Graphics(session=self.solver).Vectors.create( - **self.kwargs + super().__setattr__( + "_obj", Graphics(session=self.solver).Vectors.create(**self.kwargs) ) + if field not in self._obj.vectors_of.allowed_values: warnings.warn( "API update: `field` now represents the vector variable, and `color_by`" @@ -617,28 +624,32 @@ def __init__( "Please update your code to: field=, color_by=." ) - @staticmethod - def _get_mapped_attrs(attr: str) -> str | None: - _attr_map = { - "field": "vectors_of", - "color_by": "field", - } - return _attr_map.get(attr) + if not TYPE_CHECKING: + @staticmethod + def _get_mapped_attrs(attr: str) -> str | None: + _attr_map = { + "field": "vectors_of", + "color_by": "field", + } + return _attr_map.get(attr) - def __getattr__(self, attr: str) -> Any: - attr = self._get_mapped_attrs(attr) or attr - return getattr(self._obj, attr) + def __getattr__(self, attr: str) -> Any: + attr = self._get_mapped_attrs(attr) or attr + return getattr(self._obj, attr) - def __setattr__(self, attr, value): - attr = self._get_mapped_attrs(attr) or attr - if attr == "surfaces": - value = list(value) - setattr(self._obj, attr, value) + @override + def __setattr__(self, attr: str, value: Any) -> None: + attr = self._get_mapped_attrs(attr) or attr + if attr == "surfaces": + value = list(value) + setattr(self._obj, attr, value) -class Pathline( - _GraphicsContainer, GraphicsDefn if TYPE_CHECKING else object, abc.ABC -): # pyright: ignore[reportUnsafeMultipleInheritance] +class Pathline( # pyright: ignore[reportUnsafeMultipleInheritance] + _GraphicsContainer["PathlinesDefn"], + PathlinesDefn if TYPE_CHECKING else object, + abc.ABC, +): """Pathline visualization object. The ``Pathline`` class generates pathlines, which represent the trajectories @@ -674,15 +685,13 @@ class Pathline( >>> ) """ - _obj: GraphicsDefn - def __init__( self, *, field: str | VariableDescriptor, surfaces: list[str], - solver=None, - **kwargs, + solver: Solver | None = None, + **kwargs: Any, ): """__init__ method of Pathline class.""" kwargs.update( @@ -692,14 +701,14 @@ def __init__( } ) super().__init__(solver, **kwargs) - self.__dict__["_obj"] = Graphics(session=self.solver).Pathlines.create( - **self.kwargs + super().__setattr__( + "_obj", Graphics(session=self.solver).Pathlines.create(**self.kwargs) ) -class XYPlot( - _GraphicsContainer, GraphicsDefn if TYPE_CHECKING else object, abc.ABC -): # pyright: ignore[reportUnsafeMultipleInheritance] +class XYPlot( # pyright: ignore[reportUnsafeMultipleInheritance] + _GraphicsContainer["XYPlotDefn"], XYPlotDefn if TYPE_CHECKING else object, abc.ABC +): """XY plot visualization object. The ``XYPlot`` class creates a Fluent XY plot of a scalar field evaluated @@ -734,16 +743,13 @@ class XYPlot( >>> ) """ - _obj: GraphicsDefn - def __init__( self, *, surfaces: list[str], y_axis_function: str | VariableDescriptor, - solver: BaseSession | None = None, - local_surfaces_provider=None, - **kwargs, + solver: Solver | None = None, + **kwargs: Any, ): """__init__ method of XYPlot class.""" kwargs.update( @@ -757,14 +763,17 @@ def __init__( self.kwargs["y_axis_function"] = _to_field_name_str( self.kwargs["y_axis_function"] ) - self.__dict__["_obj"] = Plots( - session=self.solver, local_surfaces_provider=Graphics(solver).Surfaces - ).XYPlots.create(**self.kwargs) + super().__setattr__( + "_obj", + Plots( + session=self.solver, local_surfaces_provider=Graphics(solver).Surfaces + ).XYPlots.create(**self.kwargs), + ) -class Monitor( - _GraphicsContainer, MonitorDefn if TYPE_CHECKING else object, abc.ABC -): # pyright: ignore[reportUnsafeMultipleInheritance] +class Monitor( # pyright: ignore[reportUnsafeMultipleInheritance] + _GraphicsContainer["MonitorDefn"], MonitorDefn if TYPE_CHECKING else object, abc.ABC +): """Monitor visualization object. The ``Monitor`` class provides access to Fluent monitor data for plotting, @@ -792,15 +801,12 @@ class Monitor( >>> residual = Monitor(solver=solver_session, monitor_set_name="residual") """ - _obj: MonitorDefn - def __init__( self, *, monitor_set_name: str, - solver=None, - local_surfaces_provider=None, - **kwargs, + solver: Solver | None = None, + **kwargs: Any, ): """__init__ method of Monitor class.""" kwargs.update( @@ -809,6 +815,9 @@ def __init__( } ) super().__init__(solver, **kwargs) - self.__dict__["_obj"] = Plots( - session=self.solver, local_surfaces_provider=Graphics(solver).Surfaces - ).Monitors.create(**self.kwargs) + super().__setattr__( + "_obj", + Plots( + session=self.solver, local_surfaces_provider=Graphics(solver).Surfaces + ).MonitorPlots.create(**self.kwargs), + ) diff --git a/src/ansys/fluent/visualization/graphics/pyvista/renderer.py b/src/ansys/fluent/visualization/graphics/pyvista/renderer.py index 58994864..080368db 100644 --- a/src/ansys/fluent/visualization/graphics/pyvista/renderer.py +++ b/src/ansys/fluent/visualization/graphics/pyvista/renderer.py @@ -21,21 +21,51 @@ # SOFTWARE. """Module for pyVista windows management.""" + +from collections.abc import Mapping, Sequence +from typing import TYPE_CHECKING, Any, TypedDict, cast +import importlib.util + +from typing_extensions import override import numpy as np +import numpy.typing as npt import pyvista as pv import ansys.fluent.visualization as pyviz +from ansys.fluent.visualization.base.renderer import AbstractRenderer, SubPlot + +if TYPE_CHECKING: + from ansys.fluent.visualization.config import View + + +if importlib.util.find_spec("pyvistaqt") is None and pyviz.config.interactive: + raise ModuleNotFoundError( + "Missing dependencies, use 'pip install ansys-fluent-visualization[interactive]' to install them.", + name="pyvistaqt", + ) + + +class CurveData(TypedDict): + """TypedDict for individual curve data in a 2D chart.""" + + xvalues: npt.NDArray[np.floating[Any]] + yvalues: npt.NDArray[np.floating[Any]] + + +class MeshProperties(TypedDict, total=False): + """TypedDict for mesh properties.""" -try: - from pyvistaqt import BackgroundPlotter -except ModuleNotFoundError as ex: - if pyviz.config.interactive: - raise ModuleNotFoundError( - "Missing dependencies, " - "use 'pip install ansys-fluent-visualization[interactive]' to install them." - ) from ex + title: str + xlabel: str + ylabel: str + yscale: str -from ansys.fluent.visualization.base.renderer import AbstractRenderer + +class MeshDict(TypedDict, total=False): + """TypedDict for mesh dictionary containing chart data.""" + + properties: MeshProperties + kwargs: dict[str, Any] class Renderer(AbstractRenderer): @@ -46,15 +76,16 @@ def __init__( non_interactive: bool, grid: tuple[int, int] | str = (1, 1), ): - self.plotter: BackgroundPlotter | pv.Plotter = ( - pv.Plotter(title=f"PyFluent ({win_id})", shape=grid) - if in_jupyter or non_interactive - else BackgroundPlotter( + if in_jupyter or non_interactive: + self.plotter = pv.Plotter(title=f"PyFluent ({win_id})", shape=grid) + else: + from pyvistaqt import BackgroundPlotter # pyright: ignore[reportMissingTypeStubs] + + self.plotter = BackgroundPlotter( title=f"PyFluent ({win_id})", shape=grid, show=False if pyviz.config.single_window else True, ) - ) self._init_properties() self._colors = { "red": [255, 0, 0], @@ -76,45 +107,53 @@ def __init__( "white": [255, 255, 255], } - def _init_properties(self): + def _init_properties(self) -> None: self.plotter.theme.cmap = "jet" - self.plotter.background_color = "white" + self.plotter.background_color = "white" # pyright: ignore[reportAttributeAccessIssue] # types are inferred wrong self.plotter.theme.font.color = "black" - def _scalar_bar_default_properties(self) -> dict: - return dict( - title_font_size=20, - label_font_size=16, - shadow=True, - fmt="%.6e", - font_family="arial", - vertical=True, - position_x=0.06, - position_y=0.3, - ) - - def _clear_plotter(self, in_jupyter): + def _scalar_bar_default_properties(self) -> Mapping[str, object]: + return { + "title_font_size": 20, + "label_font_size": 16, + "shadow": True, + "fmt": "%.6e", + "font_family": "arial", + "vertical": True, + "position_x": 0.06, + "position_y": 0.3, + } + + def _clear_plotter(self, in_jupyter: bool) -> None: if in_jupyter and self.plotter.theme._jupyter_backend == "pythreejs": - self.plotter.remove_actor(self.plotter.renderer.actors.copy()) + assert isinstance( + self.plotter, pv.Plotter + ) # not sure why this isn't narrowing + plotter = cast(pv.Plotter, self.plotter) + plotter.remove_actor(plotter.renderer.actors.copy()) # pyright: ignore[reportArgumentType] # remove_actor uses functools.wraps internally which isn't typed for methods else: self.plotter.clear() - def _set_camera(self, view: str): - camera = self.plotter.camera.copy() - view_fun = getattr(self.plotter, f"view_{view}", None) + def _set_camera(self, view: View) -> None: + assert isinstance(self.plotter, pv.Plotter) # not sure why this isn't narrowing + plotter = cast(pv.Plotter, self.plotter) + camera = plotter.camera.copy() + view_fun = getattr(plotter, f"view_{view}", None) if view_fun: view_fun() else: - self.plotter.camera = camera.copy() + plotter.camera = camera.copy() def write_frame(self): self.plotter.write_frame() + @override def show(self): """Show graphics.""" self.plotter.show() - def render(self, meshes: list[list[dict]]): + @override + def render(self, meshes: Sequence[SubPlot[pv.DataSet | Mapping[str, CurveData]]]): """Render graphics in window. Parameters @@ -126,16 +165,16 @@ def render(self, meshes: list[list[dict]]): self.plotter.clear() for mesh_sub_item in meshes: for mesh_dict in mesh_sub_item: - mesh = mesh_dict.pop("data") - if "position" in mesh_dict: - self.plotter.subplot( - mesh_dict["position"][0], mesh_dict["position"][1] - ) - del mesh_dict["position"] + mesh = mesh_dict["data"] + position = mesh_dict.get("position") + kwargs = mesh_dict.get("kwargs", {}) + + if position: + self.plotter.subplot(position[0], position[1]) + if isinstance(mesh, pv.DataSet): if mesh.n_points > 0: - mesh_dict.update(mesh_dict.pop("kwargs")) - self.plotter.add_mesh(mesh, **mesh_dict) + self.plotter.add_mesh(mesh, **kwargs) # pyright: ignore[reportAny] else: y_range = None chart = pv.Chart2D() @@ -145,7 +184,6 @@ def render(self, meshes: list[list[dict]]): if mesh["properties"].get("yscale") == "log": chart.y_axis.log_scale = True y_range = 0 - del mesh["properties"] color_list = ["b", "r", "g", "c", "m", "y", "k"] style_list = ["-", "--", "-.", "-.."] @@ -153,8 +191,8 @@ def render(self, meshes: list[list[dict]]): min_y_value = max_y_value = min_x_value = max_x_value = None for count, curve in enumerate(mesh): chart.line( - mesh[curve]["xvalues"].tolist(), - mesh[curve]["yvalues"].tolist(), + mesh[curve]["xvalues"], + mesh[curve]["yvalues"], width=2.5, color=color_list[count % len(color_list)], style=style_list[count % len(style_list)], @@ -189,11 +227,11 @@ def render(self, meshes: list[list[dict]]): min_y_value - y_range * 0.2, max_y_value + y_range * 0.2, ] - mesh_dict.update(mesh_dict.pop("kwargs")) - if "title" in mesh_dict: - chart.title = mesh_dict.pop("title") - self.plotter.add_chart(chart, **mesh_dict) + chart.title = mesh_dict["title"] + self.plotter.add_chart(chart, **kwargs) # pyright: ignore[reportArgumentType, reportAny] # add_chart uses functools.wraps internally which isn't typed for methods + + @override def save_graphic(self, file_name: str): """Save graphics to the specified file. @@ -214,6 +252,7 @@ def get_animation(self, win_id: str): """ self.plotter.open_gif(f"{win_id}.gif") + @override def close(self): """Close graphics window.""" self.plotter.close() diff --git a/src/ansys/fluent/visualization/plotter/__init__.py b/src/ansys/fluent/visualization/plotter/__init__.py index e02f402b..c8bb94c0 100644 --- a/src/ansys/fluent/visualization/plotter/__init__.py +++ b/src/ansys/fluent/visualization/plotter/__init__.py @@ -22,7 +22,7 @@ """A package that provides interfacing Fluent with plotters (matplotlib or pyvista).""" -from ansys.fluent.visualization.plotter.plotter_objects import Plots # noqa: F401 -from ansys.fluent.visualization.plotter.plotter_windows_manager import ( # noqa: F401 - plotter_windows_manager, +from ansys.fluent.visualization.plotter.plotter_objects import Plots as Plots +from ansys.fluent.visualization.plotter.plotter_windows_manager import ( + plotter_windows_manager as plotter_windows_manager, ) diff --git a/src/ansys/fluent/visualization/plotter/plotter_objects.py b/src/ansys/fluent/visualization/plotter/plotter_objects.py index 87bb9f06..4a488ff5 100644 --- a/src/ansys/fluent/visualization/plotter/plotter_objects.py +++ b/src/ansys/fluent/visualization/plotter/plotter_objects.py @@ -32,6 +32,7 @@ XYPlotDefn, ) from ansys.fluent.interface.post_objects.post_objects_container import ( + LocalSurfacesProvider, Plots as PlotsContainer, ) from ansys.fluent.visualization.plotter.plotter_windows_manager import ( @@ -48,8 +49,8 @@ class Plots(PlotsContainer): def __init__( self, session, - post_api_helper=PostAPIHelper, - local_surfaces_provider: SurfaceDefn | None = None, + post_api_helper: type[PostAPIHelper]=PostAPIHelper, + local_surfaces_provider: LocalSurfacesProvider | None = None, ): super().__init__( session, sys.modules[__name__], post_api_helper, local_surfaces_provider diff --git a/src/ansys/fluent/visualization/registrar.py b/src/ansys/fluent/visualization/registrar.py index ff9d2e61..ee71709e 100644 --- a/src/ansys/fluent/visualization/registrar.py +++ b/src/ansys/fluent/visualization/registrar.py @@ -32,11 +32,11 @@ _renderer = {"matplotlib": MatplotlibPlotter, "pyvista": PyVistaPlotter} -def register_renderer(name, renderer): +def register_renderer(name: str, renderer: type) -> None: """Register a plotter or graphics renderer.""" _renderer[name] = renderer -def get_renderer(key: str): +def get_renderer(key: str) -> type: """Get a registered plotter or graphics renderer by name.""" return _renderer[key] diff --git a/src/ansys/fluent/visualization/renderer.py b/src/ansys/fluent/visualization/renderer.py index 09863650..3c225801 100644 --- a/src/ansys/fluent/visualization/renderer.py +++ b/src/ansys/fluent/visualization/renderer.py @@ -23,13 +23,16 @@ """A wrapper to improve the user interface of graphics.""" from collections.abc import Iterable +from typing import Any, Literal import warnings from ansys.fluent.interface.post_objects.post_object_definitions import ( GraphicsDefn, PlotDefn, + XYPlotDefn, ) import ansys.fluent.visualization as pyviz +from ansys.fluent.visualization.containers import Mesh, Monitor from ansys.fluent.visualization.graphics import graphics_windows_manager from ansys.fluent.visualization.graphics.graphics_windows import _GraphicsWindow from ansys.fluent.visualization.plotter.plotter_windows import _PlotterWindow @@ -60,7 +63,7 @@ class GraphicsWindow: >>> graphics_window.show() """ - def __init__(self, renderer=None): + def __init__(self, renderer: Literal["pyvista", "matplotlib"] | str | None = None): """__init__ method of GraphicsWindow class.""" self._graphics_objs = [] self.window_id = None @@ -70,10 +73,10 @@ def __init__(self, renderer=None): def add_graphics( self, - graphics_obj, + graphics_obj: Mesh, position: tuple[int, int] = (0, 0), opacity: float = 1, - **kwargs, + **kwargs: Any, ) -> None: """Add graphics-data to a window. @@ -87,17 +90,14 @@ def add_graphics( Transparency of the sub-plot. """ self._list_of_positions.append(position) - if isinstance(graphics_obj._obj, GraphicsDefn): - locals()["object"] = locals().pop("graphics_obj") - self._graphics_objs.append({**locals()}) - else: - warnings.warn("Only graphics objects are supported.") + self._graphics_objs.append(kwargs | {"object": graphics_obj, "position": position, "opacity": opacity}) def add_plot( self, - plot_obj, + plot_obj: Monitor | XYPlotDefn, position: tuple[int, int] = (0, 0), - **kwargs, + title: str | None = None, + **kwargs: Any, ) -> None: """Add 2D plot-data to a window. @@ -111,13 +111,9 @@ def add_plot( Title of the sub-plot. """ self._list_of_positions.append(position) - if isinstance(plot_obj._obj, PlotDefn): - locals()["object"] = locals().pop("plot_obj") - self._graphics_objs.append({**locals()}) - else: - warnings.warn("Only 2D plot objects are supported.") + self._graphics_objs.append(kwargs | {"object": plot_obj, "position": position, "title": title}) - def _all_plt_objs(self): + def _all_plt_objs(self) -> bool: for obj in self._graphics_objs: if not isinstance(obj["object"]._obj, PlotDefn): return False From 70f764bf943b140010aac233d71490f343eb0773 Mon Sep 17 00:00:00 2001 From: James Hilton-Balfe Date: Thu, 22 Jan 2026 13:36:45 +0000 Subject: [PATCH 15/20] Update pyproject.toml --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 42837ad7..68f0f367 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ packages = [ python = ">=3.10,<3.14" importlib-metadata = {version = "^4.0", python = "<3.9"} ansys-fluent-core = { git = "https://github.com/ansys/pyfluent", branch = "jhilton/typing-improvements" } -ansys-units = { git = "https://github.com/ansys/pyansys-units", branch = "jhilton/variable-descriptor-script" } +ansys-units = "0.10.0" pyvista = ">=0.44.0" matplotlib = ">=3.6.0" pyvistaqt = { version = "~=0.11.1", optional = true } @@ -89,4 +89,4 @@ reportUnusedCallResult = false reportUnannotatedClassAttribute = false reportPrivateImportUsage = false ignore = ["doc"] -reportMissingTypeStubs=false \ No newline at end of file +reportMissingTypeStubs=false From a5c6193298423963c73f2109aee088063aeca71a Mon Sep 17 00:00:00 2001 From: Gobot1234 Date: Fri, 23 Jan 2026 09:50:34 +0000 Subject: [PATCH 16/20] fix more type issues --- .../post_objects/check_in_notebook.py | 4 +-- .../fluent/interface/post_objects/meta.py | 16 ++++++++---- .../post_objects/post_object_definitions.py | 25 +++++++++++++------ .../post_objects/post_objects_container.py | 13 +++++----- src/ansys/fluent/visualization/containers.py | 16 +++++++++--- .../graphics/graphics_objects.py | 14 ++++++----- 6 files changed, 58 insertions(+), 30 deletions(-) diff --git a/src/ansys/fluent/interface/post_objects/check_in_notebook.py b/src/ansys/fluent/interface/post_objects/check_in_notebook.py index 894b77ff..a0d8e9d5 100644 --- a/src/ansys/fluent/interface/post_objects/check_in_notebook.py +++ b/src/ansys/fluent/interface/post_objects/check_in_notebook.py @@ -32,8 +32,8 @@ def in_jupyter() -> bool: from IPython import get_ipython return ( - "IPKernelApp" in get_ipython().config - ) # pyright: ignore[reportOptionalMemberAccess] + "IPKernelApp" in get_ipython().config # pyright: ignore[reportOptionalMemberAccess] + ) except (ImportError, AttributeError): return False diff --git a/src/ansys/fluent/interface/post_objects/meta.py b/src/ansys/fluent/interface/post_objects/meta.py index adc39110..00ac880b 100644 --- a/src/ansys/fluent/interface/post_objects/meta.py +++ b/src/ansys/fluent/interface/post_objects/meta.py @@ -288,6 +288,8 @@ def monitors(self) -> "MonitorsManager": """Monitors associated with the current object.""" return self.session.monitors +ParentT = TypeVar("ParentT") + class PyLocalProperty(PyLocalBase[ParentT], Generic[ParentT, T]): """Local property classes.""" @@ -298,8 +300,8 @@ def __init__(self, parent: ParentT, api_helper: type[PostAPIHelper], name: str = super().__init__(parent, name) self._api_helper = api_helper(self) self._on_change_cbs = [] - self.type: type[T] = get_args(get_original_bases(self.__class__)[0])[ - 0 + self.type: type[T] = get_args(get_original_bases(self.__class__)[1])[ + 1 ] # T for the class reset_on_change = ( hasattr(self, "_reset_on_change") and getattr(self, "_reset_on_change")() @@ -404,7 +406,6 @@ def allowed_values(self) -> Sequence[object]: - class PyLocalObject(PyLocalBase[ParentT]): """Local object classes.""" @@ -572,6 +573,7 @@ def __call__(self, **kwargs: Unpack[CallKwargs]): class PyLocalNamedObject(PyLocalObject[ParentT]): """Base class for local named object classes.""" + PLURAL: str def __init__(self, name: str, parent: ParentT, api_helper: type[PostAPIHelper]): self._name = name @@ -687,15 +689,16 @@ def __init__( cls(self, api_helper, name), ) - def get_root(self, obj=None): + def get_root(self, obj: "PyLocalContainer | None" = None) -> Container: """Returns the top-most parent object.""" obj = self if obj is None else obj parent = obj if getattr(obj, "_parent", None): parent = self.get_root(obj._parent) + assert isinstance(parent, Container) return parent - def get_session(self, obj=None) -> "Solver": + def get_session(self, obj: "PyLocalContainer | None" = None) -> "Solver": """Returns the session object.""" root = self.get_root(obj) return root.session @@ -758,6 +761,9 @@ def _get_unique_child_name(self) -> str: index += 1 return unique_name + if TYPE_CHECKING: + def create(self, ): ... + class Delete(PyLocalCommand["PyLocalContainer", _DeleteKwargs]): """Local delete command.""" diff --git a/src/ansys/fluent/interface/post_objects/post_object_definitions.py b/src/ansys/fluent/interface/post_objects/post_object_definitions.py index af1f7527..6898430e 100644 --- a/src/ansys/fluent/interface/post_objects/post_object_definitions.py +++ b/src/ansys/fluent/interface/post_objects/post_object_definitions.py @@ -38,6 +38,7 @@ from ansys.fluent.interface.post_objects.meta import ( Attribute, + Command, PyLocalNamedObject, PyLocalObject, PyLocalProperty, @@ -79,6 +80,7 @@ def _post_display(self) -> None: class GraphicsDefn(BasePostObjectDefn, PyLocalNamedObject["Container"], abc.ABC): """Abstract base class for graphics objects.""" + @Command @abstractmethod def display(self, window_id: str | None = None) -> None: """Display graphics. @@ -402,9 +404,9 @@ class x(PyLocalProperty["normal", float]): value = 0 @Attribute - def range(self) -> list[int]: + def range(self) -> tuple[int, int]: """X value range.""" - return [-1, 1] + return (-1, 1) @if_type_checking_instantiate class y(PyLocalProperty["normal", float]): @@ -413,9 +415,9 @@ class y(PyLocalProperty["normal", float]): value = 0 @Attribute - def range(self) -> list[int]: + def range(self) -> tuple[int, int]: """Y value range.""" - return [-1, 1] + return (-1, 1) @if_type_checking_instantiate class z(PyLocalProperty["normal", float]): @@ -424,9 +426,9 @@ class z(PyLocalProperty["normal", float]): value = 0 @Attribute - def range(self) -> list[int]: + def range(self) -> tuple[int, int]: """Z value range.""" - return [-1, 1] + return (-1, 1) @if_type_checking_instantiate class xy_plane(PyLocalObject["plane_surface"]): @@ -446,7 +448,15 @@ class z(PyLocalProperty["xy_plane", float]): @Attribute def range(self) -> tuple[float, float]: """Z value range.""" - return self.field_data.scalar_fields.range("z-coordinate", True) + return cast( + tuple[float, float], + cast( + object, + self.field_data.scalar_fields.range( + "z-coordinate", True + ), + ), + ) @if_type_checking_instantiate class yz_plane(PyLocalObject["plane_surface"]): @@ -870,6 +880,7 @@ class minimum(PyLocalProperty["auto_range_off", float | None]): _value = None @property + @override def value(self) -> float | None: """Range minimum property setter.""" if getattr(self, "_value", None) is None: diff --git a/src/ansys/fluent/interface/post_objects/post_objects_container.py b/src/ansys/fluent/interface/post_objects/post_objects_container.py index 2298dbf5..191ab834 100644 --- a/src/ansys/fluent/interface/post_objects/post_objects_container.py +++ b/src/ansys/fluent/interface/post_objects/post_objects_container.py @@ -25,7 +25,7 @@ import builtins import inspect import types -from typing import Any, Callable, ClassVar, Literal, TypeVar +from typing import Any, ClassVar, Literal, TypeVar from ansys.fluent.core.session import BaseSession from ansys.fluent.core.session_solver import Solver @@ -70,7 +70,7 @@ class Container: external modules (e.g., PyVista). Defaults to ``None``. """ - _sessions_state: ClassVar[dict[BaseSession, dict[str, Any]]] + _sessions_state: ClassVar[dict[Solver, dict[str, Any]]] def __init__( self, @@ -90,7 +90,7 @@ def __init__( else: self.__dict__ = session_state self._local_surfaces_provider = lambda: local_surfaces_provider or getattr( - self, "Surfaces", [] + self, "Surfaces", {} ) def get_path(self) -> str: @@ -144,9 +144,10 @@ def _init_module( # Define a method to add a "create" function to the container def _create(**kwargs): new_object = cont[cont._get_unique_child_name()] - new_object.__call__ + state = new_object() + assert state is not None # Validate that all kwargs are valid attributes for the object - unexpected_args = set(kwargs) - set(new_object()) + unexpected_args = set(kwargs) - set(state) if unexpected_args: raise TypeError( f"create() got an unexpected keyword argument '{next(iter(unexpected_args))}'." # noqa: E501 @@ -242,7 +243,7 @@ class Graphics(Container): Container for vector objects. """ - # TODO double triple check these local container types are correct cause something seems off vs Mesh + # TODO double triple check these local container types are correct cause something seems off vs Mesh _sessions_state: ClassVar[dict[BaseSession, dict[str, Any]]] = {} Meshes: PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] MeshDefn diff --git a/src/ansys/fluent/visualization/containers.py b/src/ansys/fluent/visualization/containers.py index 676cef6e..3625a243 100644 --- a/src/ansys/fluent/visualization/containers.py +++ b/src/ansys/fluent/visualization/containers.py @@ -67,9 +67,9 @@ class _GraphicsContainer(Generic[DefnT]): """Base class for graphics containers.""" - kwargs: dict[str, Any] # pyright: ignore[reportUninitializedInstanceVariable] solver: Solver # pyright: ignore[reportUninitializedInstanceVariable] - _obj: DefnT # pyright: ignore[reportUninitializedInstanceVariable] + _obj: Defns # pyright: ignore[reportUninitializedInstanceVariable] + kwargs: dict[str, Any] # pyright: ignore[reportUninitializedInstanceVariable] def __init__(self, solver: Solver | None, **kwargs: Any): super().__init__() @@ -92,7 +92,7 @@ def __init__(self, solver: Solver | None, **kwargs: Any): def get_root(self, instance: object = None) -> Container: ... # pyright: ignore[reportUnusedParameter] def display(self, window_id: str | None = None) -> None: ...# pyright: ignore[reportUnusedParameter] - surfaces: Any # pyright: ignore[reportUninitializedInstanceVariable] + surfaces: Any # pyright: ignore[reportUninitializedInstanceVariable] £ something is definitely bugged here in the type checker as () -> list[str doesn't work] else: def __getattr__(self, attr): @@ -497,6 +497,13 @@ def __init__( **kwargs: Unpack[SurfaceKwargsNoType], ): """Create an iso-surface.""" + init_kwargs: SurfaceKwargs = kwargs + if field is not None: + init_kwargs["field"] = field + if rendering is not None: + init_kwargs["rendering"] = rendering + if iso_value is not None: + init_kwargs["iso_value"] = iso_value super().__init__( solver=solver, type="iso-surface", @@ -749,7 +756,8 @@ def __init__( surfaces: list[str], y_axis_function: str | VariableDescriptor, solver: Solver | None = None, - **kwargs: Any, + local_surfaces_provider=None, + **kwargs, ): """__init__ method of XYPlot class.""" kwargs.update( diff --git a/src/ansys/fluent/visualization/graphics/graphics_objects.py b/src/ansys/fluent/visualization/graphics/graphics_objects.py index caa798b0..1144670b 100644 --- a/src/ansys/fluent/visualization/graphics/graphics_objects.py +++ b/src/ansys/fluent/visualization/graphics/graphics_objects.py @@ -22,6 +22,7 @@ """Module providing visualization objects for PyVista.""" +from abc import ABC import sys from ansys.fluent.interface.post_objects.meta import Command, PyLocalContainer @@ -35,6 +36,7 @@ ) from ansys.fluent.interface.post_objects.post_objects_container import ( Graphics as GraphicsContainer, + LocalSurfacesProvider, ) from ansys.fluent.visualization.graphics.graphics_windows_manager import ( graphics_windows_manager, @@ -51,14 +53,14 @@ def __init__( self, session, post_api_helper: type[PostAPIHelper] = PostAPIHelper, - local_surfaces_provider=None, + local_surfaces_provider: LocalSurfacesProvider |None =None, ): super().__init__( session, sys.modules[__name__], post_api_helper, local_surfaces_provider ) -class Mesh(MeshDefn): +class Mesh(MeshDefn, ABC): """Provides for displaying mesh graphics. Parameters @@ -99,7 +101,7 @@ def display(self, window_id: str | None = None, overlay: bool | None = False): ) -class Pathlines(PathlinesDefn): +class Pathlines(PathlinesDefn, ABC): """Pathlines definition for PyVista. .. code-block:: python @@ -131,7 +133,7 @@ def display(self, window_id: str | None = None, overlay: bool | None = False): ) -class Surface(SurfaceDefn): +class Surface(SurfaceDefn, ABC): """Provides for displaying surface graphics. Parameters @@ -176,7 +178,7 @@ def display( ) -class Contour(ContourDefn): +class Contour(ContourDefn, ABC): """Provides for displaying contour graphics. Parameters @@ -219,7 +221,7 @@ def display( ) -class Vector(VectorDefn): +class Vector(VectorDefn, ABC): """Provides for displaying vector graphics. Parameters From 3b97e651416e388c9d7a7cd4d21502c1a68363ba Mon Sep 17 00:00:00 2001 From: Gobot1234 Date: Wed, 4 Feb 2026 16:00:43 +0000 Subject: [PATCH 17/20] Add baseline --- .ci/basedpyright.json | 10946 ++++++++++++++++++++++++++++++++++++++++ pyproject.toml | 1 + 2 files changed, 10947 insertions(+) create mode 100644 .ci/basedpyright.json diff --git a/.ci/basedpyright.json b/.ci/basedpyright.json new file mode 100644 index 00000000..0ea8f892 --- /dev/null +++ b/.ci/basedpyright.json @@ -0,0 +1,10946 @@ +{ + "files": { + "./examples/00-post_processing/post_processing.py": [ + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 9, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 17, + "endColumn": 1, + "lineCount": 5 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 11, + "endColumn": 70, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 11, + "endColumn": 70, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 17, + "endColumn": 82, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 17, + "endColumn": 82, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 18, + "endColumn": 84, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 18, + "endColumn": 84, + "lineCount": 1 + } + } + ], + "./examples/00-post_processing/post_processing_callbacks_and_animation.py": [ + { + "code": "reportCallIssue", + "range": { + "startColumn": 11, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 5, + "endColumn": 56, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 5, + "endColumn": 56, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 11, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 11, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 6, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 6, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 6, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 6, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 17, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 25, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 25, + "endColumn": 39, + "lineCount": 1 + } + } + ], + "./examples/00-post_processing/post_processing_context_manager.py": [ + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 4, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 4, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 4, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 4, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 4, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 4, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 4, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 4, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 4, + "endColumn": 9, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 9, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 42, + "endColumn": 58, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 25, + "endColumn": 41, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 52, + "endColumn": 68, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 59, + "endColumn": 75, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 21, + "endColumn": 5, + "lineCount": 3 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 17, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 15, + "endColumn": 51, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 15, + "endColumn": 51, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 21, + "endColumn": 63, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 21, + "endColumn": 63, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 22, + "endColumn": 65, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 22, + "endColumn": 65, + "lineCount": 1 + } + } + ], + "./examples/00-post_processing/post_processing_plotter_apis.py": [ + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 4, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 4, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 4, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 4, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 9, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 13, + "endColumn": 59, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 36, + "endColumn": 82, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 25, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 25, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 25, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 25, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 25, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 25, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 17, + "endColumn": 1, + "lineCount": 5 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 13, + "endColumn": 60, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 11, + "endColumn": 70, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 11, + "endColumn": 70, + "lineCount": 1 + } + } + ], + "./examples/00-post_processing/post_processing_plotter_apis_context_manager.py": [ + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 4, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 4, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 4, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 4, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 4, + "endColumn": 9, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 9, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 42, + "endColumn": 58, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 25, + "endColumn": 41, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 29, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 29, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 29, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 29, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 29, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 29, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 21, + "endColumn": 5, + "lineCount": 3 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 17, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 15, + "endColumn": 51, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 15, + "endColumn": 51, + "lineCount": 1 + } + } + ], + "./src/ansys/fluent/interface/post_objects/check_in_notebook.py": [ + { + "code": "reportMissingImports", + "range": { + "startColumn": 13, + "endColumn": 20, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 28, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportUnnecessaryTypeIgnoreComment", + "range": { + "startColumn": 55, + "endColumn": 81, + "lineCount": 1 + } + } + ], + "./src/ansys/fluent/interface/post_objects/meta.py": [ + { + "code": "reportImportCycles", + "range": { + "startColumn": 0, + "endColumn": 0, + "lineCount": 1 + } + }, + { + "code": "reportImportCycles", + "range": { + "startColumn": 0, + "endColumn": 0, + "lineCount": 1 + } + }, + { + "code": "reportImportCycles", + "range": { + "startColumn": 0, + "endColumn": 0, + "lineCount": 1 + } + }, + { + "code": "reportImportCycles", + "range": { + "startColumn": 0, + "endColumn": 0, + "lineCount": 1 + } + }, + { + "code": "reportUnusedImport", + "range": { + "startColumn": 4, + "endColumn": 15, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 33, + "endColumn": 36, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 33, + "endColumn": 36, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 18, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 21, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 33, + "endColumn": 60, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 68, + "endColumn": 71, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 24, + "endColumn": 28, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 30, + "endColumn": 40, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 28, + "endColumn": 42, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 62, + "endColumn": 65, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 63, + "endColumn": 67, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 40, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 45, + "endColumn": 54, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 56, + "endColumn": 70, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 40, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 56, + "endColumn": 70, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 28, + "endColumn": 35, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 37, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 64, + "endColumn": 67, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 36, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 52, + "endColumn": 66, + "lineCount": 1 + } + }, + { + "code": "reportPossiblyUnboundVariable", + "range": { + "startColumn": 52, + "endColumn": 66, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 26, + "endColumn": 35, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 32, + "endColumn": 35, + "lineCount": 1 + } + }, + { + "code": "reportUnknownLambdaType", + "range": { + "startColumn": 27, + "endColumn": 32, + "lineCount": 1 + } + }, + { + "code": "reportUnknownLambdaType", + "range": { + "startColumn": 34, + "endColumn": 47, + "lineCount": 1 + } + }, + { + "code": "reportUnknownLambdaType", + "range": { + "startColumn": 49, + "endColumn": 58, + "lineCount": 1 + } + }, + { + "code": "reportUnknownLambdaType", + "range": { + "startColumn": 60, + "endColumn": 43, + "lineCount": 3 + } + }, + { + "code": "reportUnknownLambdaType", + "range": { + "startColumn": 36, + "endColumn": 41, + "lineCount": 1 + } + }, + { + "code": "reportUnknownLambdaType", + "range": { + "startColumn": 43, + "endColumn": 76, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 48, + "endColumn": 75, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 58, + "endColumn": 71, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 23, + "endColumn": 31, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 23, + "endColumn": 31, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 19, + "endColumn": 27, + "lineCount": 1 + } + }, + { + "code": "reportReturnType", + "range": { + "startColumn": 15, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 15, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 26, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 26, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 29, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 19, + "endColumn": 61, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 32, + "endColumn": 40, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 29, + "endColumn": 38, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 40, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 24, + "endColumn": 36, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 31, + "endColumn": 48, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 15, + "endColumn": 17, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 8, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 37, + "endColumn": 41, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 43, + "endColumn": 46, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 12, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 27, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 27, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 43, + "endColumn": 47, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 30, + "endColumn": 47, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 25, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 25, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 48, + "endColumn": 52, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 26, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 29, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportInvalidTypeForm", + "range": { + "startColumn": 41, + "endColumn": 50, + "lineCount": 1 + } + }, + { + "code": "reportMissingSuperCall", + "range": { + "startColumn": 8, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 25, + "endColumn": 31, + "lineCount": 1 + } + }, + { + "code": "reportGeneralTypeIssues", + "range": { + "startColumn": 33, + "endColumn": 51, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 19, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 19, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 48, + "endColumn": 52, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 26, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 23, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 25, + "endColumn": 31, + "lineCount": 1 + } + }, + { + "code": "reportGeneralTypeIssues", + "range": { + "startColumn": 33, + "endColumn": 51, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 22, + "endColumn": 31, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 20, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 47, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 31, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportUninitializedInstanceVariable", + "range": { + "startColumn": 4, + "endColumn": 10, + "lineCount": 1 + } + }, + { + "code": "reportMissingSuperCall", + "range": { + "startColumn": 8, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 19, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 19, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 48, + "endColumn": 52, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 41, + "endColumn": 45, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 47, + "endColumn": 50, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 26, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 23, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 35, + "endColumn": 46, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 16, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportReturnType", + "range": { + "startColumn": 15, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 17, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportRedeclaration", + "range": { + "startColumn": 12, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleMethodOverride", + "range": { + "startColumn": 12, + "endColumn": 20, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 37, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 16, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 23, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 28, + "endColumn": 48, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleMethodOverride", + "range": { + "startColumn": 12, + "endColumn": 20, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 36, + "endColumn": 42, + "lineCount": 1 + } + } + ], + "./src/ansys/fluent/interface/post_objects/post_helper.py": [ + { + "code": "reportImportCycles", + "range": { + "startColumn": 0, + "endColumn": 0, + "lineCount": 1 + } + }, + { + "code": "reportImportCycles", + "range": { + "startColumn": 0, + "endColumn": 0, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 45, + "endColumn": 76, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 12, + "endColumn": 27, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 19, + "endColumn": 63, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 33, + "endColumn": 54, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 33, + "endColumn": 54, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 23, + "endColumn": 26, + "lineCount": 1 + } + }, + { + "code": "reportMissingTypeArgument", + "range": { + "startColumn": 29, + "endColumn": 40, + "lineCount": 1 + } + }, + { + "code": "reportUnnecessaryCast", + "range": { + "startColumn": 34, + "endColumn": 9, + "lineCount": 3 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 19, + "endColumn": 87, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 51, + "endColumn": 86, + "lineCount": 1 + } + } + ], + "./src/ansys/fluent/interface/post_objects/post_object_definitions.py": [ + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleMethodOverride", + "range": { + "startColumn": 10, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 19, + "endColumn": 13, + "lineCount": 3 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 50, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleMethodOverride", + "range": { + "startColumn": 10, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 19, + "endColumn": 13, + "lineCount": 3 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 50, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleMethodOverride", + "range": { + "startColumn": 10, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 19, + "endColumn": 13, + "lineCount": 3 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 50, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 29, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 43, + "endColumn": 53, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 23, + "endColumn": 61, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 21, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 39, + "endColumn": 52, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 27, + "endColumn": 79, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 41, + "endColumn": 46, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 41, + "endColumn": 46, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 41, + "endColumn": 46, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 40, + "endColumn": 53, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 27, + "endColumn": 79, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 41, + "endColumn": 47, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 41, + "endColumn": 47, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 41, + "endColumn": 47, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 42, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 27, + "endColumn": 71, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 41, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 42, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 27, + "endColumn": 71, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 41, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportReturnType", + "range": { + "startColumn": 31, + "endColumn": 88, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 42, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 27, + "endColumn": 71, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 41, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportReturnType", + "range": { + "startColumn": 31, + "endColumn": 88, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 41, + "endColumn": 51, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 23, + "endColumn": 59, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 41, + "endColumn": 52, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 32, + "endColumn": 63, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 45, + "endColumn": 56, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 45, + "endColumn": 56, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 20, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleVariableOverride", + "range": { + "startColumn": 20, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 20, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 76, + "endColumn": 81, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleMethodOverride", + "range": { + "startColumn": 10, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 19, + "endColumn": 13, + "lineCount": 3 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 50, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 12, + "endColumn": 17, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleVariableOverride", + "range": { + "startColumn": 12, + "endColumn": 17, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 23, + "endColumn": 63, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 36, + "endColumn": 42, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 48, + "endColumn": 61, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 23, + "endColumn": 64, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 36, + "endColumn": 42, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 49, + "endColumn": 63, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 43, + "endColumn": 57, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleVariableOverride", + "range": { + "startColumn": 20, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 43, + "endColumn": 57, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleVariableOverride", + "range": { + "startColumn": 20, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleMethodOverride", + "range": { + "startColumn": 10, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 19, + "endColumn": 13, + "lineCount": 3 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 50, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 23, + "endColumn": 63, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 36, + "endColumn": 42, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 48, + "endColumn": 61, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 23, + "endColumn": 64, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 36, + "endColumn": 42, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 49, + "endColumn": 63, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 43, + "endColumn": 57, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleVariableOverride", + "range": { + "startColumn": 20, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 43, + "endColumn": 57, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 20, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleVariableOverride", + "range": { + "startColumn": 20, + "endColumn": 25, + "lineCount": 1 + } + } + ], + "./src/ansys/fluent/interface/post_objects/post_objects_container.py": [ + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 14, + "endColumn": 17, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 14, + "endColumn": 17, + "lineCount": 1 + } + }, + { + "code": "reportUnusedVariable", + "range": { + "startColumn": 12, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 78, + "endColumn": 81, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 46, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 30, + "endColumn": 36, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 30, + "endColumn": 36, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 42, + "endColumn": 48, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 29, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 28, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 41, + "endColumn": 46, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 20, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleVariableOverride", + "range": { + "startColumn": 4, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUninitializedInstanceVariable", + "range": { + "startColumn": 4, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportUnnecessaryTypeIgnoreComment", + "range": { + "startColumn": 45, + "endColumn": 80, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleVariableOverride", + "range": { + "startColumn": 4, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 20, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 23, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 53, + "endColumn": 63, + "lineCount": 1 + } + } + ], + "./src/ansys/fluent/visualization/__init__.py": [ + { + "code": "reportImportCycles", + "range": { + "startColumn": 0, + "endColumn": 0, + "lineCount": 1 + } + }, + { + "code": "reportImportCycles", + "range": { + "startColumn": 0, + "endColumn": 0, + "lineCount": 1 + } + }, + { + "code": "reportImportCycles", + "range": { + "startColumn": 0, + "endColumn": 0, + "lineCount": 1 + } + }, + { + "code": "reportImportCycles", + "range": { + "startColumn": 0, + "endColumn": 0, + "lineCount": 1 + } + } + ], + "./src/ansys/fluent/visualization/config.py": [ + { + "code": "reportImplicitStringConcatenation", + "range": { + "startColumn": 16, + "endColumn": 54, + "lineCount": 2 + } + }, + { + "code": "reportImplicitStringConcatenation", + "range": { + "startColumn": 16, + "endColumn": 57, + "lineCount": 2 + } + }, + { + "code": "reportPropertyTypeMismatch", + "range": { + "startColumn": 24, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportUnnecessaryIsInstance", + "range": { + "startColumn": 11, + "endColumn": 31, + "lineCount": 1 + } + }, + { + "code": "reportImplicitStringConcatenation", + "range": { + "startColumn": 20, + "endColumn": 61, + "lineCount": 2 + } + }, + { + "code": "reportUnnecessaryIsInstance", + "range": { + "startColumn": 11, + "endColumn": 31, + "lineCount": 1 + } + }, + { + "code": "reportImplicitStringConcatenation", + "range": { + "startColumn": 20, + "endColumn": 61, + "lineCount": 2 + } + } + ], + "./src/ansys/fluent/visualization/containers.py": [ + { + "code": "reportUnnecessaryTypeIgnoreComment", + "range": { + "startColumn": 51, + "endColumn": 78, + "lineCount": 1 + } + }, + { + "code": "reportUnusedParameter", + "range": { + "startColumn": 18, + "endColumn": 26, + "lineCount": 1 + } + }, + { + "code": "reportUnnecessaryTypeIgnoreComment", + "range": { + "startColumn": 47, + "endColumn": 68, + "lineCount": 1 + } + }, + { + "code": "reportUnusedParameter", + "range": { + "startColumn": 18, + "endColumn": 27, + "lineCount": 1 + } + }, + { + "code": "reportUnnecessaryTypeIgnoreComment", + "range": { + "startColumn": 42, + "endColumn": 63, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleVariableOverride", + "range": { + "startColumn": 6, + "endColumn": 10, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 37, + "endColumn": 48, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleVariableOverride", + "range": { + "startColumn": 6, + "endColumn": 13, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 37, + "endColumn": 48, + "lineCount": 1 + } + }, + { + "code": "reportPropertyTypeMismatch", + "range": { + "startColumn": 27, + "endColumn": 58, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleVariableOverride", + "range": { + "startColumn": 6, + "endColumn": 13, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 37, + "endColumn": 48, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleVariableOverride", + "range": { + "startColumn": 6, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 37, + "endColumn": 48, + "lineCount": 1 + } + }, + { + "code": "reportImplicitStringConcatenation", + "range": { + "startColumn": 16, + "endColumn": 80, + "lineCount": 6 + } + }, + { + "code": "reportIncompatibleVariableOverride", + "range": { + "startColumn": 6, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 37, + "endColumn": 48, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 35, + "lineCount": 1 + } + }, + { + "code": "reportGeneralTypeIssues", + "range": { + "startColumn": 18, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 35, + "lineCount": 1 + } + } + ], + "./src/ansys/fluent/visualization/contour.py": [ + { + "code": "reportDeprecated", + "range": { + "startColumn": 19, + "endColumn": 27, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 27, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 27, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 56, + "endColumn": 62, + "lineCount": 1 + } + }, + { + "code": "reportMissingTypeArgument", + "range": { + "startColumn": 64, + "endColumn": 72, + "lineCount": 1 + } + }, + { + "code": "reportInvalidTypeForm", + "range": { + "startColumn": 64, + "endColumn": 72, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 30, + "endColumn": 41, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 19, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 19, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 27, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 27, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 26, + "endColumn": 32, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 16, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 23, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 23, + "endColumn": 68, + "lineCount": 1 + } + }, + { + "code": "reportUnreachable", + "range": { + "startColumn": 16, + "endColumn": 68, + "lineCount": 1 + } + } + ], + "./src/ansys/fluent/visualization/graphics/graphics_objects.py": [ + { + "code": "reportUnusedImport", + "range": { + "startColumn": 62, + "endColumn": 78, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleVariableOverride", + "range": { + "startColumn": 8, + "endColumn": 15, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleVariableOverride", + "range": { + "startColumn": 8, + "endColumn": 15, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleVariableOverride", + "range": { + "startColumn": 8, + "endColumn": 15, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleVariableOverride", + "range": { + "startColumn": 8, + "endColumn": 15, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleVariableOverride", + "range": { + "startColumn": 8, + "endColumn": 15, + "lineCount": 1 + } + } + ], + "./src/ansys/fluent/visualization/graphics/graphics_windows.py": [ + { + "code": "reportUnusedClass", + "range": { + "startColumn": 6, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 14, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 14, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 25, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportMissingTypeArgument", + "range": { + "startColumn": 31, + "endColumn": 36, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 47, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 47, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 62, + "endColumn": 75, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 62, + "endColumn": 75, + "lineCount": 1 + } + }, + { + "code": "reportImplicitStringConcatenation", + "range": { + "startColumn": 20, + "endColumn": 38, + "lineCount": 3 + } + }, + { + "code": "reportUnusedExpression", + "range": { + "startColumn": 16, + "endColumn": 57, + "lineCount": 1 + } + } + ], + "./src/ansys/fluent/visualization/graphics/graphics_windows_manager.py": [ + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 28, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 28, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 40, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 77, + "endColumn": 87, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 29, + "endColumn": 56, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 31, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 31, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 28, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 28, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 20, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 46, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 29, + "endColumn": 56, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 26, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 26, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 55, + "endColumn": 58, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 40, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 40, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 58, + "endColumn": 66, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 58, + "endColumn": 66, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 20, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 33, + "endColumn": 40, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 45, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 33, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 35, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 29, + "endColumn": 32, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 29, + "endColumn": 32, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 39, + "endColumn": 42, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 29, + "endColumn": 32, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 29, + "endColumn": 32, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 51, + "endColumn": 54, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 8, + "endColumn": 42, + "lineCount": 1 + } + }, + { + "code": "reportOptionalSubscript", + "range": { + "startColumn": 8, + "endColumn": 28, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 27, + "endColumn": 47, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 34, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 34, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 15, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 17, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 25, + "endColumn": 36, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 27, + "endColumn": 41, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 33, + "endColumn": 42, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 33, + "endColumn": 42, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 16, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 22, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 16, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 22, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 30, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 30, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 35, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 35, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 13, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 13, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportUnusedVariable", + "range": { + "startColumn": 12, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 24, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 20, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 31, + "endColumn": 41, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 35, + "endColumn": 45, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 43, + "endColumn": 52, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 48, + "endColumn": 57, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 59, + "endColumn": 69, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 35, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 46, + "endColumn": 57, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 56, + "endColumn": 65, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 67, + "endColumn": 77, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 48, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 48, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 20, + "endColumn": 26, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 23, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportPossiblyUnboundVariable", + "range": { + "startColumn": 35, + "endColumn": 50, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 16, + "endColumn": 36, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 33, + "endColumn": 36, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 33, + "endColumn": 36, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 38, + "endColumn": 46, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 38, + "endColumn": 46, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 13, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 13, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportUnusedVariable", + "range": { + "startColumn": 12, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 24, + "endColumn": 36, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 31, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 16, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 22, + "endColumn": 40, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportPossiblyUnboundVariable", + "range": { + "startColumn": 35, + "endColumn": 50, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 31, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 31, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 36, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 36, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 13, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 13, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 20, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportUnusedVariable", + "range": { + "startColumn": 12, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 24, + "endColumn": 36, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 36, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 43, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 49, + "endColumn": 61, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 63, + "endColumn": 74, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 48, + "endColumn": 60, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 62, + "endColumn": 73, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 36, + "endColumn": 41, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 34, + "endColumn": 58, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 27, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 34, + "endColumn": 54, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 34, + "endColumn": 54, + "lineCount": 1 + } + }, + { + "code": "reportIndexIssue", + "range": { + "startColumn": 34, + "endColumn": 47, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 34, + "endColumn": 54, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 28, + "endColumn": 41, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 58, + "endColumn": 69, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 40, + "endColumn": 45, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 62, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 32, + "endColumn": 42, + "lineCount": 1 + } + }, + { + "code": "reportPossiblyUnboundVariable", + "range": { + "startColumn": 55, + "endColumn": 70, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 32, + "endColumn": 60, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 39, + "endColumn": 59, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 39, + "endColumn": 59, + "lineCount": 1 + } + }, + { + "code": "reportIndexIssue", + "range": { + "startColumn": 39, + "endColumn": 52, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 39, + "endColumn": 59, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 35, + "endColumn": 63, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 42, + "endColumn": 62, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 42, + "endColumn": 62, + "lineCount": 1 + } + }, + { + "code": "reportIndexIssue", + "range": { + "startColumn": 42, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 42, + "endColumn": 62, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 32, + "endColumn": 42, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 58, + "endColumn": 65, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 24, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportPossiblyUnboundVariable", + "range": { + "startColumn": 47, + "endColumn": 62, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 24, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 24, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportPossiblyUnboundVariable", + "range": { + "startColumn": 47, + "endColumn": 62, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 24, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportPossiblyUnboundVariable", + "range": { + "startColumn": 47, + "endColumn": 62, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 31, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 31, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 36, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 36, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 12, + "endColumn": 15, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 28, + "endColumn": 31, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 28, + "endColumn": 31, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 33, + "endColumn": 41, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 33, + "endColumn": 41, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 24, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 43, + "endColumn": 52, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 31, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 31, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 36, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 36, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 65, + "endColumn": 82, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 65, + "endColumn": 82, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 53, + "endColumn": 70, + "lineCount": 1 + } + }, + { + "code": "reportGeneralTypeIssues", + "range": { + "startColumn": 33, + "endColumn": 51, + "lineCount": 1 + } + }, + { + "code": "reportInvalidTypeArguments", + "range": { + "startColumn": 33, + "endColumn": 51, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 49, + "endColumn": 53, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 42, + "endColumn": 46, + "lineCount": 1 + } + }, + { + "code": "reportReturnType", + "range": { + "startColumn": 19, + "endColumn": 58, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 19, + "endColumn": 58, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 19, + "endColumn": 65, + "lineCount": 1 + } + }, + { + "code": "reportUnnecessaryIsInstance", + "range": { + "startColumn": 15, + "endColumn": 47, + "lineCount": 1 + } + }, + { + "code": "reportUnreachable", + "range": { + "startColumn": 12, + "endColumn": 70, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 31, + "endColumn": 46, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 31, + "endColumn": 46, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 38, + "endColumn": 54, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 38, + "endColumn": 54, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 32, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnusedParameter", + "range": { + "startColumn": 8, + "endColumn": 15, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 25, + "endColumn": 38, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 20, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 24, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 35, + "endColumn": 41, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 35, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleMethodOverride", + "range": { + "startColumn": 6, + "endColumn": 35, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportMissingTypeArgument", + "range": { + "startColumn": 14, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleMethodOverride", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 60, + "endColumn": 70, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 72, + "endColumn": 79, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 28, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 28, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 46, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 46, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 43, + "endColumn": 59, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 44, + "endColumn": 53, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 19, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 19, + "endColumn": 26, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 19, + "endColumn": 32, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportMissingTypeArgument", + "range": { + "startColumn": 14, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 47, + "endColumn": 51, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 53, + "endColumn": 57, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 68, + "endColumn": 76, + "lineCount": 1 + } + }, + { + "code": "reportReturnType", + "range": { + "startColumn": 15, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 15, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleMethodOverride", + "range": { + "startColumn": 6, + "endColumn": 32, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportMissingTypeArgument", + "range": { + "startColumn": 14, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleMethodOverride", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 68, + "endColumn": 78, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 80, + "endColumn": 87, + "lineCount": 1 + } + }, + { + "code": "reportUnnecessaryComparison", + "range": { + "startColumn": 56, + "endColumn": 73, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 32, + "endColumn": 81, + "lineCount": 1 + } + }, + { + "code": "reportUnnecessaryComparison", + "range": { + "startColumn": 15, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportIndexIssue", + "range": { + "startColumn": 16, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnusedParameter", + "range": { + "startColumn": 28, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 20, + "endColumn": 26, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 20, + "endColumn": 27, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 20, + "endColumn": 27, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 69, + "endColumn": 79, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 44, + "endColumn": 47, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 32, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 27, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 27, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 27, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 27, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 20, + "endColumn": 27, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 15, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 32, + "endColumn": 35, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 20, + "endColumn": 27, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 26, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 26, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 44, + "endColumn": 48, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 26, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 26, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 32, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 32, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 41, + "endColumn": 45, + "lineCount": 1 + } + } + ], + "./src/ansys/fluent/visualization/graphics/pyvista/renderer.py": [ + { + "code": "reportUnnecessaryTypeIgnoreComment", + "range": { + "startColumn": 55, + "endColumn": 77, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 16, + "endColumn": 46, + "lineCount": 1 + } + }, + { + "code": "reportUnnecessaryTypeIgnoreComment", + "range": { + "startColumn": 33, + "endColumn": 51, + "lineCount": 1 + } + }, + { + "code": "reportUnnecessaryTypeIgnoreComment", + "range": { + "startColumn": 45, + "endColumn": 54, + "lineCount": 1 + } + } + ], + "./src/ansys/fluent/visualization/graphics/single_qt_windows.py": [ + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 23, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 23, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 32, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 29, + "endColumn": 36, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 29, + "endColumn": 47, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 25, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 25, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 19, + "lineCount": 1 + } + } + ], + "./src/ansys/fluent/visualization/matplotlib/__init__.py": [ + { + "code": "reportUnusedImport", + "range": { + "startColumn": 63, + "endColumn": 68, + "lineCount": 1 + } + } + ], + "./src/ansys/fluent/visualization/plotter/matplotlib/renderer.py": [ + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 26, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportMissingTypeArgument", + "range": { + "startColumn": 36, + "endColumn": 41, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 9, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 9, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 15, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 15, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 15, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleMethodOverride", + "range": { + "startColumn": 8, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 21, + "endColumn": 27, + "lineCount": 1 + } + }, + { + "code": "reportMissingTypeArgument", + "range": { + "startColumn": 39, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 40, + "endColumn": 67, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 20, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 24, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 24, + "endColumn": 35, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 46, + "endColumn": 68, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 24, + "endColumn": 35, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 46, + "endColumn": 68, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 24, + "endColumn": 35, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 46, + "endColumn": 68, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 24, + "endColumn": 35, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 46, + "endColumn": 68, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 32, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 45, + "endColumn": 56, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 32, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 45, + "endColumn": 56, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 32, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 45, + "endColumn": 56, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 32, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 45, + "endColumn": 56, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 39, + "endColumn": 50, + "lineCount": 1 + } + }, + { + "code": "reportOptionalSubscript", + "range": { + "startColumn": 24, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportOptionalSubscript", + "range": { + "startColumn": 24, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 47, + "endColumn": 68, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 43, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 29, + "endColumn": 35, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 44, + "endColumn": 60, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 30, + "endColumn": 41, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 31, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 31, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 28, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 32, + "endColumn": 60, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 32, + "endColumn": 60, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 45, + "endColumn": 56, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 58, + "endColumn": 69, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 24, + "endColumn": 31, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 28, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 57, + "endColumn": 84, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 13, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 20, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 29, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportMissingTypeArgument", + "range": { + "startColumn": 41, + "endColumn": 45, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 48, + "endColumn": 60, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 17, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 17, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportMissingTypeArgument", + "range": { + "startColumn": 14, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 25, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 83, + "endColumn": 87, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 20, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 24, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 44, + "endColumn": 54, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 24, + "endColumn": 28, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 42, + "endColumn": 46, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 43, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleMethodOverride", + "range": { + "startColumn": 8, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 23, + "endColumn": 27, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 23, + "endColumn": 27, + "lineCount": 1 + } + } + ], + "./src/ansys/fluent/visualization/plotter/plotter_objects.py": [ + { + "code": "reportUnusedImport", + "range": { + "startColumn": 4, + "endColumn": 15, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 15, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 15, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 12, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportImplicitAbstractClass", + "range": { + "startColumn": 6, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleMethodOverride", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportImplicitAbstractClass", + "range": { + "startColumn": 6, + "endColumn": 17, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleMethodOverride", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + } + ], + "./src/ansys/fluent/visualization/plotter/plotter_windows.py": [ + { + "code": "reportUnusedClass", + "range": { + "startColumn": 6, + "endColumn": 20, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 23, + "endColumn": 32, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 23, + "endColumn": 32, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 34, + "endColumn": 38, + "lineCount": 1 + } + }, + { + "code": "reportMissingTypeArgument", + "range": { + "startColumn": 40, + "endColumn": 45, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 56, + "endColumn": 64, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 56, + "endColumn": 64, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 71, + "endColumn": 80, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 71, + "endColumn": 80, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 22, + "endColumn": 31, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 59, + "endColumn": 67, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 43, + "endColumn": 50, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 24, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 24, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportUnusedParameter", + "range": { + "startColumn": 24, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 32, + "endColumn": 40, + "lineCount": 1 + } + }, + { + "code": "reportUnusedParameter", + "range": { + "startColumn": 32, + "endColumn": 40, + "lineCount": 1 + } + }, + { + "code": "reportMissingTypeArgument", + "range": { + "startColumn": 42, + "endColumn": 47, + "lineCount": 1 + } + }, + { + "code": "reportUnusedParameter", + "range": { + "startColumn": 58, + "endColumn": 63, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 24, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 20, + "lineCount": 1 + } + }, + { + "code": "reportOptionalIterable", + "range": { + "startColumn": 24, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 44, + "endColumn": 65, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 25, + "endColumn": 52, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 20, + "endColumn": 66, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 32, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportUnusedParameter", + "range": { + "startColumn": 8, + "endColumn": 15, + "lineCount": 1 + } + } + ], + "./src/ansys/fluent/visualization/plotter/plotter_windows_manager.py": [ + { + "code": "reportDeprecated", + "range": { + "startColumn": 19, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 17, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 17, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportCallInDefaultInitializer", + "range": { + "startColumn": 15, + "endColumn": 17, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 13, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 12, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 23, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 59, + "endColumn": 63, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 41, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 21, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 21, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportMissingTypeArgument", + "range": { + "startColumn": 14, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 24, + "endColumn": 28, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 46, + "endColumn": 53, + "lineCount": 1 + } + }, + { + "code": "reportMissingTypeArgument", + "range": { + "startColumn": 37, + "endColumn": 41, + "lineCount": 1 + } + }, + { + "code": "reportMissingTypeArgument", + "range": { + "startColumn": 24, + "endColumn": 28, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 19, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 19, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 32, + "endColumn": 40, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 32, + "endColumn": 40, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 49, + "endColumn": 53, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 60, + "endColumn": 74, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 60, + "endColumn": 74, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 34, + "endColumn": 50, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportOptionalSubscript", + "range": { + "startColumn": 32, + "endColumn": 41, + "lineCount": 1 + } + }, + { + "code": "reportOptionalSubscript", + "range": { + "startColumn": 38, + "endColumn": 47, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 28, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 28, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 20, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 34, + "endColumn": 50, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportOptionalSubscript", + "range": { + "startColumn": 32, + "endColumn": 41, + "lineCount": 1 + } + }, + { + "code": "reportOptionalSubscript", + "range": { + "startColumn": 38, + "endColumn": 47, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 27, + "endColumn": 41, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 27, + "endColumn": 41, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 35, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 39, + "endColumn": 46, + "lineCount": 1 + } + }, + { + "code": "reportDeprecated", + "range": { + "startColumn": 48, + "endColumn": 53, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 78, + "endColumn": 85, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 46, + "endColumn": 53, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 27, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 40, + "endColumn": 47, + "lineCount": 1 + } + }, + { + "code": "reportDeprecated", + "range": { + "startColumn": 49, + "endColumn": 54, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 79, + "endColumn": 86, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 46, + "endColumn": 53, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 27, + "endColumn": 41, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 52, + "endColumn": 68, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 52, + "endColumn": 68, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 15, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportMissingTypeArgument", + "range": { + "startColumn": 14, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleMethodOverride", + "range": { + "startColumn": 8, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportUnnecessaryIsInstance", + "range": { + "startColumn": 15, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportUnreachable", + "range": { + "startColumn": 12, + "endColumn": 57, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleMethodOverride", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportUnnecessaryIsInstance", + "range": { + "startColumn": 15, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportUnreachable", + "range": { + "startColumn": 12, + "endColumn": 60, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 26, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 28, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 28, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 46, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 46, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 32, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 40, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 72, + "endColumn": 81, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 28, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 29, + "endColumn": 45, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 20, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 20, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportMissingTypeArgument", + "range": { + "startColumn": 14, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportDeprecated", + "range": { + "startColumn": 9, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 16, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 61, + "endColumn": 69, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 16, + "endColumn": 32, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 72, + "endColumn": 79, + "lineCount": 1 + } + } + ], + "./src/ansys/fluent/visualization/plotter/pyvista/renderer.py": [ + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportMissingTypeArgument", + "range": { + "startColumn": 14, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportIncompatibleMethodOverride", + "range": { + "startColumn": 8, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 21, + "endColumn": 27, + "lineCount": 1 + } + }, + { + "code": "reportMissingTypeArgument", + "range": { + "startColumn": 39, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 65, + "endColumn": 75, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 36, + "endColumn": 63, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 20, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 20, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 20, + "endColumn": 31, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 42, + "endColumn": 64, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 20, + "endColumn": 31, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 42, + "endColumn": 64, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 20, + "endColumn": 31, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 42, + "endColumn": 64, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 20, + "endColumn": 31, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 42, + "endColumn": 64, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 28, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 41, + "endColumn": 52, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 28, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 41, + "endColumn": 52, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 28, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 41, + "endColumn": 52, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 28, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 41, + "endColumn": 52, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 33, + "endColumn": 40, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 48, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 50, + "endColumn": 74, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 33, + "endColumn": 42, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 43, + "endColumn": 53, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 46, + "endColumn": 58, + "lineCount": 1 + } + }, + { + "code": "reportUnusedVariable", + "range": { + "startColumn": 20, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 52, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 52, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 13, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 21, + "endColumn": 26, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 20, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 21, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 29, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportMissingTypeArgument", + "range": { + "startColumn": 41, + "endColumn": 45, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 48, + "endColumn": 60, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 30, + "endColumn": 34, + "lineCount": 1 + } + } + ], + "./src/ansys/fluent/visualization/post_data_extractor.py": [ + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 26, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 26, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 34, + "endColumn": 40, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 34, + "endColumn": 40, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 19, + "endColumn": 76, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 61, + "endColumn": 65, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 69, + "endColumn": 75, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 19, + "endColumn": 79, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 64, + "endColumn": 68, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 72, + "endColumn": 78, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 19, + "endColumn": 79, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 64, + "endColumn": 68, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 72, + "endColumn": 78, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 19, + "endColumn": 78, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 63, + "endColumn": 67, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 71, + "endColumn": 77, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 19, + "endColumn": 81, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 66, + "endColumn": 70, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 74, + "endColumn": 80, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 25, + "endColumn": 28, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 25, + "endColumn": 28, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 31, + "endColumn": 35, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 31, + "endColumn": 35, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 39, + "endColumn": 45, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 39, + "endColumn": 45, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 15, + "endColumn": 28, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 27, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 34, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 34, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 40, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 40, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnusedParameter", + "range": { + "startColumn": 40, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 48, + "endColumn": 54, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 48, + "endColumn": 54, + "lineCount": 1 + } + }, + { + "code": "reportUnusedParameter", + "range": { + "startColumn": 48, + "endColumn": 54, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 20, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 52, + "endColumn": 59, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 49, + "endColumn": 53, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 15, + "endColumn": 27, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 27, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 28, + "endColumn": 31, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 28, + "endColumn": 31, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 34, + "endColumn": 38, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 34, + "endColumn": 38, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 42, + "endColumn": 48, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 42, + "endColumn": 48, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 13, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 13, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 15, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 20, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 23, + "endColumn": 28, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 15, + "endColumn": 27, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 30, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 30, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 36, + "endColumn": 40, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 36, + "endColumn": 40, + "lineCount": 1 + } + }, + { + "code": "reportUnusedParameter", + "range": { + "startColumn": 36, + "endColumn": 40, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 44, + "endColumn": 50, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 44, + "endColumn": 50, + "lineCount": 1 + } + }, + { + "code": "reportUnusedParameter", + "range": { + "startColumn": 44, + "endColumn": 50, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 13, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 26, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 15, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 26, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 33, + "endColumn": 36, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 33, + "endColumn": 36, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 39, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 39, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 47, + "endColumn": 53, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 47, + "endColumn": 53, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 13, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 17, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 19, + "endColumn": 20, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 27, + "endColumn": 32, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 27, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 15, + "endColumn": 27, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 19, + "endColumn": 57, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 29, + "endColumn": 32, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 29, + "endColumn": 32, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 13, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 20, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 28, + "endColumn": 63, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 65, + "endColumn": 79, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 16, + "endColumn": 17, + "lineCount": 5 + } + }, + { + "code": "reportUnknownLambdaType", + "range": { + "startColumn": 23, + "endColumn": 41, + "lineCount": 1 + } + }, + { + "code": "reportUnknownLambdaType", + "range": { + "startColumn": 43, + "endColumn": 50, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 27, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 59, + "endColumn": 61, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 16, + "endColumn": 17, + "lineCount": 10 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 24, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 45, + "endColumn": 63, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 74, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 28, + "endColumn": 63, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 65, + "endColumn": 73, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 24, + "endColumn": 32, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 27, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 20, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 24, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 20, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 16, + "endColumn": 73, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 16, + "endColumn": 32, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 15, + "endColumn": 28, + "lineCount": 1 + } + } + ], + "./src/ansys/fluent/visualization/pyvista/__init__.py": [ + { + "code": "reportUnusedImport", + "range": { + "startColumn": 65, + "endColumn": 73, + "lineCount": 1 + } + } + ], + "./src/ansys/fluent/visualization/renderer.py": [ + { + "code": "reportUnusedImport", + "range": { + "startColumn": 4, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 15, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 47, + "endColumn": 70, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 47, + "endColumn": 70, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 22, + "endColumn": 26, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 22, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 20, + "endColumn": 42, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 35, + "endColumn": 42, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 31, + "endColumn": 38, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 39, + "endColumn": 46, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 19, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 34, + "endColumn": 41, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 42, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 15, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 30, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportImplicitStringConcatenation", + "range": { + "startColumn": 16, + "endColumn": 57, + "lineCount": 2 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 27, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 27, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 27, + "endColumn": 32, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 31, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 31, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 30, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 30, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 39, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 39, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportUnusedParameter", + "range": { + "startColumn": 39, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 33, + "endColumn": 43, + "lineCount": 1 + } + } + ], + "./src/ansys/fluent/visualization/visualization_windows_manager.py": [ + { + "code": "reportInvalidAbstractMethod", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportCallInDefaultInitializer", + "range": { + "startColumn": 39, + "endColumn": 41, + "lineCount": 1 + } + }, + { + "code": "reportCallInDefaultInitializer", + "range": { + "startColumn": 43, + "endColumn": 45, + "lineCount": 1 + } + }, + { + "code": "reportCallInDefaultInitializer", + "range": { + "startColumn": 43, + "endColumn": 45, + "lineCount": 1 + } + } + ], + "./tests/test_post.py": [ + { + "code": "reportMissingImports", + "range": { + "startColumn": 7, + "endColumn": 13, + "lineCount": 1 + } + }, + { + "code": "reportUntypedFunctionDecorator", + "range": { + "startColumn": 1, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 26, + "endColumn": 32, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 26, + "endColumn": 32, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 23, + "endColumn": 35, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 23, + "endColumn": 35, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 37, + "endColumn": 50, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 37, + "endColumn": 50, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 28, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportMissingTypeArgument", + "range": { + "startColumn": 38, + "endColumn": 42, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 26, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportPossiblyUnboundVariable", + "range": { + "startColumn": 44, + "endColumn": 50, + "lineCount": 1 + } + }, + { + "code": "reportPossiblyUnboundVariable", + "range": { + "startColumn": 44, + "endColumn": 50, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 20, + "endColumn": 27, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 20, + "endColumn": 36, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 58, + "endColumn": 65, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 44, + "endColumn": 83, + "lineCount": 1 + } + }, + { + "code": "reportPossiblyUnboundVariable", + "range": { + "startColumn": 67, + "endColumn": 73, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 15, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 23, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 23, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 36, + "endColumn": 54, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 56, + "endColumn": 78, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportMissingTypeArgument", + "range": { + "startColumn": 9, + "endColumn": 13, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 26, + "endColumn": 38, + "lineCount": 1 + } + }, + { + "code": "reportUndefinedVariable", + "range": { + "startColumn": 39, + "endColumn": 59, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 15, + "endColumn": 9, + "lineCount": 6 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 16, + "endColumn": 45, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 16, + "endColumn": 26, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 27, + "endColumn": 38, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 27, + "endColumn": 38, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 19, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 19, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportUnusedParameter", + "range": { + "startColumn": 19, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 27, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 27, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnusedParameter", + "range": { + "startColumn": 27, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 29, + "endColumn": 69, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportMissingTypeArgument", + "range": { + "startColumn": 31, + "endColumn": 35, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 15, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportMissingTypeArgument", + "range": { + "startColumn": 26, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 15, + "endColumn": 50, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 27, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 27, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 23, + "endColumn": 26, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 23, + "endColumn": 26, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 23, + "endColumn": 26, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 23, + "endColumn": 26, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 40, + "endColumn": 51, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 69, + "endColumn": 82, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 4, + "endColumn": 15, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 42, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportUnusedVariable", + "range": { + "startColumn": 42, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 45, + "endColumn": 46, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 48, + "endColumn": 54, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 56, + "endColumn": 80, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 4, + "endColumn": 5, + "lineCount": 6 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 8, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 8, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 8, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 42, + "endColumn": 57, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 59, + "endColumn": 72, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 42, + "endColumn": 57, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 59, + "endColumn": 72, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 4, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportIndexIssue", + "range": { + "startColumn": 15, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 4, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportIndexIssue", + "range": { + "startColumn": 15, + "endColumn": 21, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 4, + "endColumn": 13, + "lineCount": 1 + } + }, + { + "code": "reportIndexIssue", + "range": { + "startColumn": 16, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 4, + "endColumn": 16, + "lineCount": 1 + } + }, + { + "code": "reportIndexIssue", + "range": { + "startColumn": 19, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 34, + "endColumn": 42, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 32, + "endColumn": 41, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 32, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 41, + "endColumn": 54, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 41, + "endColumn": 54, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 42, + "endColumn": 56, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 4, + "endColumn": 43, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 20, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 40, + "endColumn": 53, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 21, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 36, + "endColumn": 50, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 27, + "endColumn": 52, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 11, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 11, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 11, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 11, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 11, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnreachable", + "range": { + "startColumn": 8, + "endColumn": 9, + "lineCount": 4 + } + }, + { + "code": "reportImplicitStringConcatenation", + "range": { + "startColumn": 12, + "endColumn": 76, + "lineCount": 2 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 40, + "endColumn": 53, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 51, + "endColumn": 79, + "lineCount": 1 + } + }, + { + "code": "reportUnreachable", + "range": { + "startColumn": 8, + "endColumn": 9, + "lineCount": 4 + } + }, + { + "code": "reportImplicitStringConcatenation", + "range": { + "startColumn": 12, + "endColumn": 76, + "lineCount": 2 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 40, + "endColumn": 53, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 21, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 68, + "endColumn": 81, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 47, + "endColumn": 60, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 24, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 69, + "endColumn": 82, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 69, + "endColumn": 82, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 68, + "endColumn": 81, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 46, + "endColumn": 74, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 53, + "endColumn": 79, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 25, + "endColumn": 63, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 44, + "endColumn": 58, + "lineCount": 1 + } + } + ], + "./tests/test_visualization.py": [ + { + "code": "reportMissingImports", + "range": { + "startColumn": 7, + "endColumn": 13, + "lineCount": 1 + } + }, + { + "code": "reportDuplicateImport", + "range": { + "startColumn": 0, + "endColumn": 13, + "lineCount": 1 + } + }, + { + "code": "reportMissingImports", + "range": { + "startColumn": 7, + "endColumn": 13, + "lineCount": 1 + } + }, + { + "code": "reportUntypedFunctionDecorator", + "range": { + "startColumn": 1, + "endColumn": 31, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 4, + "endColumn": 22, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 4, + "endColumn": 10, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 4, + "endColumn": 10, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 38, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportUntypedFunctionDecorator", + "range": { + "startColumn": 1, + "endColumn": 31, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 4, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 50, + "endColumn": 68, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 50, + "endColumn": 68, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 4, + "endColumn": 10, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 11, + "endColumn": 17, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 4, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 4, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 40, + "endColumn": 59, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 27, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 4, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 4, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 40, + "endColumn": 59, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 27, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 27, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 4, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 4, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 40, + "endColumn": 59, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 39, + "endColumn": 45, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 43, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 4, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 4, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 40, + "endColumn": 59, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 19, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 4, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 4, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 40, + "endColumn": 59, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 19, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 4, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 4, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 40, + "endColumn": 59, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 19, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 4, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 4, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 36, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 25, + "endColumn": 9, + "lineCount": 5 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 19, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 4, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 4, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 36, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 25, + "endColumn": 9, + "lineCount": 5 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 19, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 4, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 4, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 36, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 19, + "endColumn": 70, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 19, + "endColumn": 70, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 4, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 4, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 4, + "endColumn": 10, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 19, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 29, + "endColumn": 35, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 31, + "endColumn": 40, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 35, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 11, + "endColumn": 32, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 35, + "endColumn": 44, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 11, + "endColumn": 32, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 4, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 4, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 4, + "endColumn": 10, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 29, + "endColumn": 35, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 43, + "endColumn": 66, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 38, + "endColumn": 56, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 27, + "endColumn": 72, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 27, + "endColumn": 72, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 4, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 26, + "endColumn": 55, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 19, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 15, + "endColumn": 29, + "lineCount": 1 + } + } + ] + } +} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 68f0f367..7712cb15 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -90,3 +90,4 @@ reportUnannotatedClassAttribute = false reportPrivateImportUsage = false ignore = ["doc"] reportMissingTypeStubs=false +baselineFile = ".ci/basedpyright.json" From ba9ab7012f76c5a8bb095cb818dcbf536c5d4041 Mon Sep 17 00:00:00 2001 From: Gobot1234 Date: Wed, 4 Feb 2026 16:01:25 +0000 Subject: [PATCH 18/20] remove importlib-metadata --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7712cb15..ef7b0e52 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,6 @@ packages = [ [tool.poetry.dependencies] python = ">=3.10,<3.14" -importlib-metadata = {version = "^4.0", python = "<3.9"} ansys-fluent-core = { git = "https://github.com/ansys/pyfluent", branch = "jhilton/typing-improvements" } ansys-units = "0.10.0" pyvista = ">=0.44.0" From d291a53ec3e99d9182c27d8b3f1fcf921cdd71a7 Mon Sep 17 00:00:00 2001 From: Gobot1234 Date: Wed, 4 Feb 2026 16:06:42 +0000 Subject: [PATCH 19/20] final round of changes --- .ci/basedpyright.json | 1558 ++++++++++++----- .../post_objects/check_in_notebook.py | 3 +- .../fluent/interface/post_objects/meta.py | 63 +- .../interface/post_objects/post_helper.py | 11 +- .../post_objects/post_object_definitions.py | 2 +- .../post_objects/post_objects_container.py | 28 +- src/ansys/fluent/visualization/__init__.py | 3 - .../fluent/visualization/base/renderer.py | 3 +- src/ansys/fluent/visualization/config.py | 3 +- src/ansys/fluent/visualization/containers.py | 175 +- .../graphics/graphics_objects.py | 12 +- .../graphics/graphics_windows.py | 1 + .../graphics/graphics_windows_manager.py | 18 +- .../graphics/pyvista/renderer.py | 13 +- .../plotter/matplotlib/renderer.py | 1 - .../visualization/plotter/plotter_objects.py | 4 +- .../plotter/plotter_windows_manager.py | 2 +- .../visualization/post_data_extractor.py | 2 +- src/ansys/fluent/visualization/renderer.py | 22 +- tests/test_post.py | 4 +- tests/test_visualization.py | 4 +- 21 files changed, 1350 insertions(+), 582 deletions(-) diff --git a/.ci/basedpyright.json b/.ci/basedpyright.json index 0ea8f892..0afd2579 100644 --- a/.ci/basedpyright.json +++ b/.ci/basedpyright.json @@ -9,271 +9,815 @@ "lineCount": 1 } }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 0, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 0, + "endColumn": 61, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 19, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 19, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 11, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 11, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 11, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 35, + "endColumn": 49, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 11, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 11, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 11, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 11, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 10, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 26, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 11, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 11, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 17, + "endColumn": 1, + "lineCount": 5 + } + }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 11, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 11, + "endColumn": 70, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 11, + "endColumn": 70, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 17, + "endColumn": 82, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 17, + "endColumn": 82, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 18, + "endColumn": 84, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 18, + "endColumn": 84, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 19, + "lineCount": 1 + } + } + ], + "./examples/00-post_processing/post_processing_callbacks_and_animation.py": [ + { + "code": "reportCallIssue", + "range": { + "startColumn": 11, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 5, + "endColumn": 56, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 5, + "endColumn": 56, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 11, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 11, + "endColumn": 34, + "lineCount": 1 + } + }, + { + "code": "reportAbstractUsage", + "range": { + "startColumn": 6, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 6, + "endColumn": 29, + "lineCount": 1 + } + }, { "code": "reportAbstractUsage", "range": { - "startColumn": 17, - "endColumn": 1, - "lineCount": 5 + "startColumn": 6, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 6, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 17, + "endColumn": 24, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 25, + "endColumn": 39, + "lineCount": 1 + } + }, + { + "code": "reportOptionalMemberAccess", + "range": { + "startColumn": 25, + "endColumn": 39, + "lineCount": 1 + } + } + ], + "./examples/00-post_processing/post_processing_context_manager.py": [ + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 4, + "endColumn": 9, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 9, + "endColumn": 29, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 0, + "endColumn": 14, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 0, + "endColumn": 61, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 } }, { - "code": "reportAbstractUsage", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 11, - "endColumn": 70, + "startColumn": 15, + "endColumn": 23, "lineCount": 1 } }, { - "code": "reportCallIssue", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 11, - "endColumn": 70, + "startColumn": 15, + "endColumn": 23, "lineCount": 1 } }, { - "code": "reportAbstractUsage", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 17, - "endColumn": 82, + "startColumn": 15, + "endColumn": 23, "lineCount": 1 } }, { - "code": "reportCallIssue", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 17, - "endColumn": 82, + "startColumn": 15, + "endColumn": 23, "lineCount": 1 } }, { - "code": "reportAbstractUsage", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 18, - "endColumn": 84, + "startColumn": 15, + "endColumn": 23, "lineCount": 1 } }, { - "code": "reportCallIssue", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 18, - "endColumn": 84, + "startColumn": 15, + "endColumn": 23, "lineCount": 1 } - } - ], - "./examples/00-post_processing/post_processing_callbacks_and_animation.py": [ + }, { - "code": "reportCallIssue", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 11, - "endColumn": 34, + "startColumn": 15, + "endColumn": 23, "lineCount": 1 } }, { - "code": "reportAbstractUsage", + "code": "reportUnknownArgumentType", "range": { - "startColumn": 5, - "endColumn": 56, + "startColumn": 14, + "endColumn": 48, "lineCount": 1 } }, { - "code": "reportCallIssue", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 5, - "endColumn": 56, + "startColumn": 30, + "endColumn": 48, "lineCount": 1 } }, { - "code": "reportAbstractUsage", + "code": "reportUnknownArgumentType", "range": { - "startColumn": 11, - "endColumn": 34, + "startColumn": 14, + "endColumn": 41, "lineCount": 1 } }, { - "code": "reportCallIssue", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 11, - "endColumn": 34, + "startColumn": 30, + "endColumn": 41, "lineCount": 1 } }, { - "code": "reportAbstractUsage", + "code": "reportUnknownArgumentType", "range": { - "startColumn": 6, - "endColumn": 29, + "startColumn": 14, + "endColumn": 41, "lineCount": 1 } }, { - "code": "reportCallIssue", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 6, - "endColumn": 29, + "startColumn": 30, + "endColumn": 41, "lineCount": 1 } }, { - "code": "reportAbstractUsage", + "code": "reportUnknownArgumentType", "range": { - "startColumn": 6, - "endColumn": 29, + "startColumn": 17, + "endColumn": 43, "lineCount": 1 } }, { - "code": "reportCallIssue", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 6, - "endColumn": 29, + "startColumn": 33, + "endColumn": 43, "lineCount": 1 } }, { - "code": "reportOptionalMemberAccess", + "code": "reportUnknownArgumentType", "range": { - "startColumn": 17, - "endColumn": 24, + "startColumn": 14, + "endColumn": 48, "lineCount": 1 } }, { "code": "reportAttributeAccessIssue", "range": { - "startColumn": 25, - "endColumn": 39, + "startColumn": 30, + "endColumn": 48, "lineCount": 1 } }, { - "code": "reportOptionalMemberAccess", + "code": "reportAbstractUsage", "range": { - "startColumn": 25, - "endColumn": 39, + "startColumn": 21, + "endColumn": 5, + "lineCount": 3 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 52, + "endColumn": 79, "lineCount": 1 } - } - ], - "./examples/00-post_processing/post_processing_context_manager.py": [ + }, { "code": "reportAttributeAccessIssue", "range": { - "startColumn": 4, - "endColumn": 19, + "startColumn": 68, + "endColumn": 79, "lineCount": 1 } }, { - "code": "reportUnknownVariableType", + "code": "reportAbstractUsage", "range": { - "startColumn": 4, - "endColumn": 19, + "startColumn": 15, + "endColumn": 51, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 15, + "endColumn": 51, "lineCount": 1 } }, { "code": "reportAttributeAccessIssue", "range": { - "startColumn": 4, - "endColumn": 18, + "startColumn": 19, + "endColumn": 27, "lineCount": 1 } }, { - "code": "reportUnknownVariableType", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 4, - "endColumn": 18, + "startColumn": 19, + "endColumn": 27, "lineCount": 1 } }, { "code": "reportAttributeAccessIssue", "range": { - "startColumn": 4, - "endColumn": 18, + "startColumn": 19, + "endColumn": 27, "lineCount": 1 } }, { - "code": "reportUnknownVariableType", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 4, - "endColumn": 18, + "startColumn": 19, + "endColumn": 27, "lineCount": 1 } }, { "code": "reportAttributeAccessIssue", "range": { - "startColumn": 4, - "endColumn": 16, + "startColumn": 19, + "endColumn": 27, "lineCount": 1 } }, { - "code": "reportUnknownVariableType", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 4, - "endColumn": 16, + "startColumn": 19, + "endColumn": 27, "lineCount": 1 } }, { - "code": "reportUnknownVariableType", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 4, - "endColumn": 9, + "startColumn": 19, + "endColumn": 27, "lineCount": 1 } }, { "code": "reportAttributeAccessIssue", "range": { - "startColumn": 9, - "endColumn": 29, + "startColumn": 19, + "endColumn": 27, "lineCount": 1 } }, { - "code": "reportUnknownArgumentType", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 42, - "endColumn": 58, + "startColumn": 19, + "endColumn": 27, "lineCount": 1 } }, { - "code": "reportUnknownArgumentType", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 25, - "endColumn": 41, + "startColumn": 19, + "endColumn": 27, "lineCount": 1 } }, { - "code": "reportUnknownArgumentType", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 52, - "endColumn": 68, + "startColumn": 19, + "endColumn": 27, "lineCount": 1 } }, { - "code": "reportUnknownArgumentType", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 59, - "endColumn": 75, + "startColumn": 19, + "endColumn": 27, "lineCount": 1 } }, @@ -281,80 +825,88 @@ "code": "reportAbstractUsage", "range": { "startColumn": 21, - "endColumn": 5, - "lineCount": 3 + "endColumn": 63, + "lineCount": 1 } }, { - "code": "reportUnknownArgumentType", + "code": "reportCallIssue", "range": { - "startColumn": 17, - "endColumn": 34, + "startColumn": 21, + "endColumn": 63, "lineCount": 1 } }, { "code": "reportAbstractUsage", "range": { - "startColumn": 15, - "endColumn": 51, + "startColumn": 22, + "endColumn": 65, "lineCount": 1 } }, { "code": "reportCallIssue", "range": { - "startColumn": 15, - "endColumn": 51, + "startColumn": 22, + "endColumn": 65, + "lineCount": 1 + } + } + ], + "./examples/00-post_processing/post_processing_plotter_apis.py": [ + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 9, + "endColumn": 29, "lineCount": 1 } }, { - "code": "reportAbstractUsage", + "code": "reportUnknownVariableType", "range": { - "startColumn": 21, - "endColumn": 63, + "startColumn": 0, + "endColumn": 14, "lineCount": 1 } }, { - "code": "reportCallIssue", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 21, - "endColumn": 63, + "startColumn": 15, + "endColumn": 19, "lineCount": 1 } }, { - "code": "reportAbstractUsage", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 22, - "endColumn": 65, + "startColumn": 15, + "endColumn": 19, "lineCount": 1 } }, { - "code": "reportCallIssue", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 22, - "endColumn": 65, + "startColumn": 15, + "endColumn": 19, "lineCount": 1 } - } - ], - "./examples/00-post_processing/post_processing_plotter_apis.py": [ + }, { "code": "reportAttributeAccessIssue", "range": { - "startColumn": 4, + "startColumn": 15, "endColumn": 19, "lineCount": 1 } }, { - "code": "reportUnknownVariableType", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 4, + "startColumn": 15, "endColumn": 19, "lineCount": 1 } @@ -362,40 +914,40 @@ { "code": "reportAttributeAccessIssue", "range": { - "startColumn": 4, - "endColumn": 18, + "startColumn": 15, + "endColumn": 19, "lineCount": 1 } }, { - "code": "reportUnknownVariableType", + "code": "reportArgumentType", "range": { - "startColumn": 4, - "endColumn": 18, + "startColumn": 11, + "endColumn": 25, "lineCount": 1 } }, { - "code": "reportAttributeAccessIssue", + "code": "reportCallIssue", "range": { - "startColumn": 9, - "endColumn": 29, + "startColumn": 28, + "endColumn": 43, "lineCount": 1 } }, { - "code": "reportUnknownArgumentType", + "code": "reportArgumentType", "range": { - "startColumn": 13, - "endColumn": 59, + "startColumn": 11, + "endColumn": 25, "lineCount": 1 } }, { - "code": "reportUnknownArgumentType", + "code": "reportCallIssue", "range": { - "startColumn": 36, - "endColumn": 82, + "startColumn": 51, + "endColumn": 66, "lineCount": 1 } }, @@ -455,11 +1007,35 @@ "lineCount": 5 } }, + { + "code": "reportArgumentType", + "range": { + "startColumn": 11, + "endColumn": 25, + "lineCount": 1 + } + }, + { + "code": "reportCallIssue", + "range": { + "startColumn": 29, + "endColumn": 44, + "lineCount": 1 + } + }, { "code": "reportUnknownArgumentType", "range": { - "startColumn": 13, - "endColumn": 60, + "startColumn": 20, + "endColumn": 47, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 36, + "endColumn": 47, "lineCount": 1 } }, @@ -478,21 +1054,19 @@ "endColumn": 70, "lineCount": 1 } - } - ], - "./examples/00-post_processing/post_processing_plotter_apis_context_manager.py": [ + }, { "code": "reportAttributeAccessIssue", "range": { - "startColumn": 4, + "startColumn": 15, "endColumn": 19, "lineCount": 1 } }, { - "code": "reportUnknownVariableType", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 4, + "startColumn": 15, "endColumn": 19, "lineCount": 1 } @@ -500,19 +1074,37 @@ { "code": "reportAttributeAccessIssue", "range": { - "startColumn": 4, - "endColumn": 18, + "startColumn": 15, + "endColumn": 19, "lineCount": 1 } }, { - "code": "reportUnknownVariableType", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 4, - "endColumn": 18, + "startColumn": 15, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 19, "lineCount": 1 } }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 19, + "lineCount": 1 + } + } + ], + "./examples/00-post_processing/post_processing_plotter_apis_context_manager.py": [ { "code": "reportUnknownVariableType", "range": { @@ -530,18 +1122,82 @@ } }, { - "code": "reportUnknownArgumentType", + "code": "reportUnknownVariableType", "range": { - "startColumn": 42, - "endColumn": 58, + "startColumn": 0, + "endColumn": 14, "lineCount": 1 } }, { - "code": "reportUnknownArgumentType", + "code": "reportCallIssue", "range": { - "startColumn": 25, - "endColumn": 41, + "startColumn": 0, + "endColumn": 61, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 15, + "endColumn": 23, "lineCount": 1 } }, @@ -604,8 +1260,16 @@ { "code": "reportUnknownArgumentType", "range": { - "startColumn": 17, - "endColumn": 34, + "startColumn": 52, + "endColumn": 79, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 68, + "endColumn": 79, "lineCount": 1 } }, @@ -646,8 +1310,8 @@ { "code": "reportUnnecessaryTypeIgnoreComment", "range": { - "startColumn": 55, - "endColumn": 81, + "startColumn": 68, + "endColumn": 94, "lineCount": 1 } } @@ -1583,6 +2247,14 @@ "lineCount": 1 } }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 47, + "endColumn": 54, + "lineCount": 1 + } + }, { "code": "reportUnknownVariableType", "range": { @@ -1632,11 +2304,19 @@ } }, { - "code": "reportUnnecessaryCast", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 34, - "endColumn": 9, - "lineCount": 3 + "startColumn": 52, + "endColumn": 58, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 33, + "endColumn": 39, + "lineCount": 1 } }, { @@ -1650,16 +2330,40 @@ { "code": "reportUnknownVariableType", "range": { - "startColumn": 19, - "endColumn": 87, + "startColumn": 19, + "endColumn": 87, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 51, + "endColumn": 86, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 30, + "endColumn": 36, "lineCount": 1 } }, { "code": "reportUnknownArgumentType", "range": { - "startColumn": 51, - "endColumn": 86, + "startColumn": 60, + "endColumn": 67, "lineCount": 1 } } @@ -2395,22 +3099,6 @@ "lineCount": 1 } }, - { - "code": "reportUninitializedInstanceVariable", - "range": { - "startColumn": 4, - "endColumn": 16, - "lineCount": 1 - } - }, - { - "code": "reportUnnecessaryTypeIgnoreComment", - "range": { - "startColumn": 45, - "endColumn": 80, - "lineCount": 1 - } - }, { "code": "reportIncompatibleVariableOverride", "range": { @@ -2537,46 +3225,6 @@ } ], "./src/ansys/fluent/visualization/containers.py": [ - { - "code": "reportUnnecessaryTypeIgnoreComment", - "range": { - "startColumn": 51, - "endColumn": 78, - "lineCount": 1 - } - }, - { - "code": "reportUnusedParameter", - "range": { - "startColumn": 18, - "endColumn": 26, - "lineCount": 1 - } - }, - { - "code": "reportUnnecessaryTypeIgnoreComment", - "range": { - "startColumn": 47, - "endColumn": 68, - "lineCount": 1 - } - }, - { - "code": "reportUnusedParameter", - "range": { - "startColumn": 18, - "endColumn": 27, - "lineCount": 1 - } - }, - { - "code": "reportUnnecessaryTypeIgnoreComment", - "range": { - "startColumn": 42, - "endColumn": 63, - "lineCount": 1 - } - }, { "code": "reportIncompatibleVariableOverride", "range": { @@ -2585,14 +3233,6 @@ "lineCount": 1 } }, - { - "code": "reportUnknownArgumentType", - "range": { - "startColumn": 37, - "endColumn": 48, - "lineCount": 1 - } - }, { "code": "reportIncompatibleVariableOverride", "range": { @@ -2601,14 +3241,6 @@ "lineCount": 1 } }, - { - "code": "reportUnknownArgumentType", - "range": { - "startColumn": 37, - "endColumn": 48, - "lineCount": 1 - } - }, { "code": "reportPropertyTypeMismatch", "range": { @@ -2625,14 +3257,6 @@ "lineCount": 1 } }, - { - "code": "reportUnknownArgumentType", - "range": { - "startColumn": 37, - "endColumn": 48, - "lineCount": 1 - } - }, { "code": "reportIncompatibleVariableOverride", "range": { @@ -2641,14 +3265,6 @@ "lineCount": 1 } }, - { - "code": "reportUnknownArgumentType", - "range": { - "startColumn": 37, - "endColumn": 48, - "lineCount": 1 - } - }, { "code": "reportImplicitStringConcatenation", "range": { @@ -2665,22 +3281,6 @@ "lineCount": 1 } }, - { - "code": "reportUnknownArgumentType", - "range": { - "startColumn": 37, - "endColumn": 48, - "lineCount": 1 - } - }, - { - "code": "reportUnknownArgumentType", - "range": { - "startColumn": 24, - "endColumn": 35, - "lineCount": 1 - } - }, { "code": "reportGeneralTypeIssues", "range": { @@ -2688,14 +3288,6 @@ "endColumn": 39, "lineCount": 1 } - }, - { - "code": "reportUnknownArgumentType", - "range": { - "startColumn": 24, - "endColumn": 35, - "lineCount": 1 - } } ], "./src/ansys/fluent/visualization/contour.py": [ @@ -2835,14 +3427,6 @@ "lineCount": 1 } }, - { - "code": "reportUnknownVariableType", - "range": { - "startColumn": 16, - "endColumn": 23, - "lineCount": 1 - } - }, { "code": "reportCallIssue", "range": { @@ -2851,14 +3435,6 @@ "lineCount": 1 } }, - { - "code": "reportUnknownVariableType", - "range": { - "startColumn": 23, - "endColumn": 30, - "lineCount": 1 - } - }, { "code": "reportUnknownVariableType", "range": { @@ -2999,6 +3575,22 @@ "lineCount": 1 } }, + { + "code": "reportMissingImports", + "range": { + "startColumn": 21, + "endColumn": 38, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 46, + "endColumn": 58, + "lineCount": 1 + } + }, { "code": "reportImplicitStringConcatenation", "range": { @@ -5186,145 +5778,249 @@ } }, { - "code": "reportAttributeAccessIssue", + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 32, + "endColumn": 35, + "lineCount": 1 + } + }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 20, + "endColumn": 27, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 8, + "endColumn": 12, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 26, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 26, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 44, + "endColumn": 48, + "lineCount": 1 + } + }, + { + "code": "reportImplicitOverride", + "range": { + "startColumn": 8, + "endColumn": 19, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 26, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 26, + "endColumn": 30, + "lineCount": 1 + } + }, + { + "code": "reportUnknownParameterType", + "range": { + "startColumn": 32, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportMissingParameterType", + "range": { + "startColumn": 32, + "endColumn": 37, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 41, + "endColumn": 45, + "lineCount": 1 + } + } + ], + "./src/ansys/fluent/visualization/graphics/pyvista/renderer.py": [ + { + "code": "reportMissingImports", "range": { - "startColumn": 32, - "endColumn": 35, + "startColumn": 17, + "endColumn": 26, "lineCount": 1 } }, { - "code": "reportAttributeAccessIssue", + "code": "reportUnknownVariableType", "range": { - "startColumn": 20, - "endColumn": 27, + "startColumn": 34, + "endColumn": 51, "lineCount": 1 } }, { - "code": "reportUnknownParameterType", + "code": "reportUnnecessaryTypeIgnoreComment", "range": { - "startColumn": 8, - "endColumn": 12, + "startColumn": 71, + "endColumn": 93, "lineCount": 1 } }, { - "code": "reportMissingParameterType", + "code": "reportUnnecessaryCast", "range": { - "startColumn": 8, - "endColumn": 12, + "startColumn": 22, + "endColumn": 52, "lineCount": 1 } }, { - "code": "reportUnknownParameterType", + "code": "reportUnnecessaryCast", "range": { - "startColumn": 26, - "endColumn": 30, + "startColumn": 18, + "endColumn": 48, "lineCount": 1 } }, { - "code": "reportMissingParameterType", + "code": "reportUnnecessaryTypeIgnoreComment", "range": { - "startColumn": 26, - "endColumn": 30, + "startColumn": 81, + "endColumn": 90, "lineCount": 1 } }, { - "code": "reportUnknownArgumentType", + "code": "reportUnnecessaryTypeIgnoreComment", "range": { - "startColumn": 44, - "endColumn": 48, + "startColumn": 99, + "endColumn": 108, "lineCount": 1 } - }, + } + ], + "./src/ansys/fluent/visualization/graphics/single_qt_windows.py": [ { - "code": "reportImplicitOverride", + "code": "reportMissingImports", "range": { - "startColumn": 8, - "endColumn": 19, + "startColumn": 5, + "endColumn": 22, "lineCount": 1 } }, { - "code": "reportUnknownParameterType", + "code": "reportUnknownVariableType", "range": { - "startColumn": 26, - "endColumn": 30, + "startColumn": 4, + "endColumn": 16, "lineCount": 1 } }, { - "code": "reportMissingParameterType", + "code": "reportUnknownVariableType", "range": { - "startColumn": 26, - "endColumn": 30, + "startColumn": 4, + "endColumn": 15, "lineCount": 1 } }, { - "code": "reportUnknownParameterType", + "code": "reportUnknownVariableType", "range": { - "startColumn": 32, - "endColumn": 37, + "startColumn": 4, + "endColumn": 14, "lineCount": 1 } }, { - "code": "reportMissingParameterType", + "code": "reportUnknownVariableType", "range": { - "startColumn": 32, - "endColumn": 37, + "startColumn": 4, + "endColumn": 15, "lineCount": 1 } }, { - "code": "reportUnknownArgumentType", + "code": "reportUnknownVariableType", "range": { - "startColumn": 41, - "endColumn": 45, + "startColumn": 4, + "endColumn": 11, "lineCount": 1 } - } - ], - "./src/ansys/fluent/visualization/graphics/pyvista/renderer.py": [ + }, { - "code": "reportUnnecessaryTypeIgnoreComment", + "code": "reportUntypedBaseClass", "range": { - "startColumn": 55, - "endColumn": 77, + "startColumn": 17, + "endColumn": 28, "lineCount": 1 } }, { - "code": "reportArgumentType", + "code": "reportUnknownVariableType", "range": { - "startColumn": 16, - "endColumn": 46, + "startColumn": 8, + "endColumn": 14, "lineCount": 1 } }, { - "code": "reportUnnecessaryTypeIgnoreComment", + "code": "reportUnknownArgumentType", "range": { - "startColumn": 33, - "endColumn": 51, + "startColumn": 20, + "endColumn": 41, "lineCount": 1 } }, { - "code": "reportUnnecessaryTypeIgnoreComment", + "code": "reportUnknownArgumentType", "range": { - "startColumn": 45, - "endColumn": 54, + "startColumn": 21, + "endColumn": 43, "lineCount": 1 } - } - ], - "./src/ansys/fluent/visualization/graphics/single_qt_windows.py": [ + }, { "code": "reportUnknownParameterType", "range": { @@ -5350,26 +6046,26 @@ } }, { - "code": "reportUnknownArgumentType", + "code": "reportUnknownVariableType", "range": { - "startColumn": 29, - "endColumn": 36, + "startColumn": 8, + "endColumn": 11, "lineCount": 1 } }, { - "code": "reportUnknownArgumentType", + "code": "reportUnknownVariableType", "range": { - "startColumn": 29, - "endColumn": 47, + "startColumn": 8, + "endColumn": 14, "lineCount": 1 } }, { - "code": "reportImplicitOverride", + "code": "reportUnknownArgumentType", "range": { - "startColumn": 8, - "endColumn": 18, + "startColumn": 29, + "endColumn": 36, "lineCount": 1 } }, @@ -6743,35 +7439,75 @@ "lineCount": 1 } }, + { + "code": "reportAttributeAccessIssue", + "range": { + "startColumn": 33, + "endColumn": 41, + "lineCount": 1 + } + }, { "code": "reportUnknownVariableType", "range": { "startColumn": 8, - "endColumn": 18, + "endColumn": 16, "lineCount": 1 } }, { - "code": "reportUnknownArgumentType", + "code": "reportAttributeAccessIssue", "range": { - "startColumn": 27, - "endColumn": 41, + "startColumn": 44, + "endColumn": 52, "lineCount": 1 } }, { - "code": "reportArgumentType", + "code": "reportUnknownVariableType", "range": { - "startColumn": 52, - "endColumn": 68, + "startColumn": 12, + "endColumn": 19, "lineCount": 1 } }, { - "code": "reportArgumentType", + "code": "reportUnknownVariableType", "range": { - "startColumn": 52, - "endColumn": 68, + "startColumn": 21, + "endColumn": 33, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 23, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 25, + "endColumn": 36, + "lineCount": 1 + } + }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 8, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 27, + "endColumn": 41, "lineCount": 1 } }, @@ -9547,14 +10283,6 @@ "lineCount": 1 } }, - { - "code": "reportArgumentType", - "range": { - "startColumn": 40, - "endColumn": 51, - "lineCount": 1 - } - }, { "code": "reportArgumentType", "range": { @@ -9595,6 +10323,14 @@ "lineCount": 1 } }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 4, + "endColumn": 17, + "lineCount": 1 + } + }, { "code": "reportArgumentType", "range": { @@ -9750,16 +10486,16 @@ { "code": "reportUnknownArgumentType", "range": { - "startColumn": 15, - "endColumn": 23, + "startColumn": 44, + "endColumn": 84, "lineCount": 1 } }, { "code": "reportUnknownArgumentType", "range": { - "startColumn": 32, - "endColumn": 41, + "startColumn": 68, + "endColumn": 81, "lineCount": 1 } }, @@ -9775,23 +10511,23 @@ "code": "reportUnknownArgumentType", "range": { "startColumn": 32, - "endColumn": 44, + "endColumn": 41, "lineCount": 1 } }, { - "code": "reportArgumentType", + "code": "reportUnknownArgumentType", "range": { - "startColumn": 41, - "endColumn": 54, + "startColumn": 15, + "endColumn": 23, "lineCount": 1 } }, { - "code": "reportArgumentType", + "code": "reportUnknownArgumentType", "range": { - "startColumn": 41, - "endColumn": 54, + "startColumn": 32, + "endColumn": 44, "lineCount": 1 } }, @@ -9819,14 +10555,6 @@ "lineCount": 1 } }, - { - "code": "reportArgumentType", - "range": { - "startColumn": 40, - "endColumn": 53, - "lineCount": 1 - } - }, { "code": "reportAttributeAccessIssue", "range": { @@ -9907,14 +10635,6 @@ "lineCount": 2 } }, - { - "code": "reportArgumentType", - "range": { - "startColumn": 40, - "endColumn": 53, - "lineCount": 1 - } - }, { "code": "reportUnknownArgumentType", "range": { @@ -9939,14 +10659,6 @@ "lineCount": 2 } }, - { - "code": "reportArgumentType", - "range": { - "startColumn": 40, - "endColumn": 53, - "lineCount": 1 - } - }, { "code": "reportAttributeAccessIssue", "range": { @@ -9963,14 +10675,6 @@ "lineCount": 1 } }, - { - "code": "reportArgumentType", - "range": { - "startColumn": 47, - "endColumn": 60, - "lineCount": 1 - } - }, { "code": "reportArgumentType", "range": { diff --git a/src/ansys/fluent/interface/post_objects/check_in_notebook.py b/src/ansys/fluent/interface/post_objects/check_in_notebook.py index a0d8e9d5..f645926b 100644 --- a/src/ansys/fluent/interface/post_objects/check_in_notebook.py +++ b/src/ansys/fluent/interface/post_objects/check_in_notebook.py @@ -21,6 +21,7 @@ # SOFTWARE. """Provides a module to check if the library is being used in a Jupyter environment.""" + import warnings from ansys.fluent.core import PyFluentDeprecationWarning @@ -32,7 +33,7 @@ def in_jupyter() -> bool: from IPython import get_ipython return ( - "IPKernelApp" in get_ipython().config # pyright: ignore[reportOptionalMemberAccess] + "IPKernelApp" in get_ipython().config # pyright: ignore[reportOptionalMemberAccess] ) except (ImportError, AttributeError): return False diff --git a/src/ansys/fluent/interface/post_objects/meta.py b/src/ansys/fluent/interface/post_objects/meta.py index 00ac880b..1f1b9d29 100644 --- a/src/ansys/fluent/interface/post_objects/meta.py +++ b/src/ansys/fluent/interface/post_objects/meta.py @@ -22,8 +22,8 @@ """Metaclasses used in various explicit classes in PyFluent.""" -from abc import ABC, abstractmethod import inspect +from abc import ABC, abstractmethod from collections.abc import Callable, Iterator, MutableMapping, Sequence from typing import ( TYPE_CHECKING, @@ -50,15 +50,15 @@ get_original_bases, ) -from ansys.fluent.interface.post_objects.post_helper import PostAPIHelper -from ansys.fluent.interface.post_objects.post_object_definitions import ( - BasePostObjectDefn, - Defns, -) - if TYPE_CHECKING: from ansys.fluent.core.services.field_data import LiveFieldData from ansys.fluent.core.streaming_services.monitor_streaming import MonitorsManager + + from ansys.fluent.interface.post_objects.post_helper import PostAPIHelper + from ansys.fluent.interface.post_objects.post_object_definitions import ( + BasePostObjectDefn, + Defns, + ) from ansys.fluent.interface.post_objects.post_objects_container import Container # pylint: disable=unused-private-member @@ -117,7 +117,7 @@ def __set_name__(self, owner: HasAttributes, name: str): def __set__( self, - instance: _SelfT, # pyright: ignore[reportGeneralTypeIssues] + instance: _SelfT, # pyright: ignore[reportGeneralTypeIssues] value: _T_co, # pyright: ignore[reportGeneralTypeIssues] ) -> Never: raise AttributeError("Attributes are read only.") @@ -128,7 +128,7 @@ def __get__(self, instance: None, _) -> Self: ... @overload def __get__( self, - instance: _SelfT, # pyright: ignore[reportGeneralTypeIssues] + instance: _SelfT, # pyright: ignore[reportGeneralTypeIssues] _, ) -> _T_co: ... @@ -224,10 +224,11 @@ def __get__(self, instance: _SelfT, _): # pyright: ignore[reportGeneralTypeIssu T = TypeVar("T") T2 = TypeVar("T2") -AccessorT = TypeVar("AccessorT", bound=BasePostObjectDefn) +AccessorT = TypeVar("AccessorT", bound="BasePostObjectDefn") ParentT = TypeVar("ParentT") + class PyLocalBase(Generic[ParentT]): """Local base.""" @@ -247,7 +248,7 @@ def get_ancestors_by_type( assert parent is not None return parent - def get_root(self, instance=None) -> Container: + def get_root(self, instance=None) -> "Container": instance = self if instance is None else instance parent = instance if hasattr(instance, "_parent"): @@ -264,7 +265,7 @@ def get_path(self) -> str: return self._name @property - def root(self) -> Container: + def root(self) -> "Container": """Top-most parent object.""" return self.get_root(self) @@ -288,6 +289,7 @@ def monitors(self) -> "MonitorsManager": """Monitors associated with the current object.""" return self.session.monitors + ParentT = TypeVar("ParentT") @@ -296,7 +298,9 @@ class PyLocalProperty(PyLocalBase[ParentT], Generic[ParentT, T]): value: T # pyright: ignore[reportUninitializedInstanceVariable] - def __init__(self, parent: ParentT, api_helper: type[PostAPIHelper], name: str = ""): + def __init__( + self, parent: ParentT, api_helper: "type[PostAPIHelper]", name: str = "" + ): super().__init__(parent, name) self._api_helper = api_helper(self) self._on_change_cbs = [] @@ -404,13 +408,11 @@ def allowed_values(self) -> Sequence[object]: # delattr(self, "_object") - - class PyLocalObject(PyLocalBase[ParentT]): """Local object classes.""" def __init__( - self, parent: ParentT, api_helper: type[PostAPIHelper], name: str = "" + self, parent: ParentT, api_helper: "type[PostAPIHelper]", name: str = "" ): """Create the initialization method for 'PyLocalObjectMeta'.""" super().__init__(parent, name) @@ -420,7 +422,9 @@ def __init__( update(self.__class__) - def _add_classes_to_instance(self, clss: type[PyLocalBase[object]], api_helper: type[PostAPIHelper]) -> None: + def _add_classes_to_instance( + self, clss: type[PyLocalBase[object]], api_helper: "type[PostAPIHelper]" + ) -> None: for name, cls in inspect.getmembers(clss, predicate=inspect.isclass): if issubclass(cls, PyLocalCommand): self._command_names.append(name) @@ -536,7 +540,9 @@ def __setattr__(self, name: str, value: Any): class PyLocalCommand(PyLocalObject[ParentT], Generic[ParentT, CallKwargs], ABC): """Local object metaclass.""" - def __init__(self, parent: ParentT, api_helper: type[PostAPIHelper], name: str = ""): + def __init__( + self, parent: ParentT, api_helper: "type[PostAPIHelper]", name: str = "" + ): self._parent = parent self._name = name self._api_helper = api_helper(self) @@ -549,7 +555,7 @@ def _exe_cmd(self, **kwargs: Unpack[CallKwargs]) -> Any: """Execute command.""" raise NotImplementedError("not implemented") - def _update(self, api_helper: type[PostAPIHelper]) -> None: + def _update(self, api_helper: "type[PostAPIHelper]") -> None: def update(clss) -> None: for name, cls in inspect.getmembers(clss, predicate=inspect.isclass): if issubclass(cls, PyLocalProperty): @@ -573,9 +579,10 @@ def __call__(self, **kwargs: Unpack[CallKwargs]): class PyLocalNamedObject(PyLocalObject[ParentT]): """Base class for local named object classes.""" + PLURAL: str - def __init__(self, name: str, parent: ParentT, api_helper: type[PostAPIHelper]): + def __init__(self, name: str, parent: ParentT, api_helper: "type[PostAPIHelper]"): self._name = name self._api_helper = api_helper(self) self._parent = parent @@ -614,8 +621,7 @@ def update(clss): def create(self) -> Self: ... - -DefnT = TypeVar("DefnT", bound=Defns, default=Defns) +DefnT = TypeVar("DefnT", bound="Defns", default="Defns") def if_type_checking_instantiate( @@ -639,7 +645,7 @@ def __init__( self, parent: "Container", object_class: type[PyLocalNamedObject[Any]], - api_helper: type[PostAPIHelper], + api_helper: "type[PostAPIHelper]", name: str = "", ): """Initialize the 'PyLocalContainer' object.""" @@ -689,14 +695,14 @@ def __init__( cls(self, api_helper, name), ) - def get_root(self, obj: "PyLocalContainer | None" = None) -> Container: + def get_root(self, obj: "PyLocalContainer | None" = None) -> "Container": """Returns the top-most parent object.""" obj = self if obj is None else obj parent = obj if getattr(obj, "_parent", None): parent = self.get_root(obj._parent) - assert isinstance(parent, Container) - return parent + + return cast("Container", parent) def get_session(self, obj: "PyLocalContainer | None" = None) -> "Solver": """Returns the session object.""" @@ -762,7 +768,10 @@ def _get_unique_child_name(self) -> str: return unique_name if TYPE_CHECKING: - def create(self, ): ... + + def create( + self, + ): ... class Delete(PyLocalCommand["PyLocalContainer", _DeleteKwargs]): """Local delete command.""" diff --git a/src/ansys/fluent/interface/post_objects/post_helper.py b/src/ansys/fluent/interface/post_objects/post_helper.py index 892c1bc3..4a929d27 100644 --- a/src/ansys/fluent/interface/post_objects/post_helper.py +++ b/src/ansys/fluent/interface/post_objects/post_helper.py @@ -23,14 +23,15 @@ """Provides a module for post objects.""" import re -from typing import cast +from typing import TYPE_CHECKING, cast from ansys.fluent.core.services import LiveFieldData from ansys.fluent.core.solver.flunits import get_si_unit_for_fluent_quantity from ansys.fluent.core.utils.fluent_version import FluentVersion -from ansys.fluent.interface.post_objects.meta import PyLocalBase -from ansys.fluent.visualization import Surface +if TYPE_CHECKING: + from ansys.fluent.interface.post_objects.meta import PyLocalBase + from ansys.fluent.visualization import Surface class IncompleteISOSurfaceDefinition(RuntimeError): @@ -55,7 +56,7 @@ class PostAPIHelper: class _SurfaceAPI: """Class providing APIs for surface operations.""" - def __init__(self, obj: Surface): + def __init__(self, obj: "Surface"): self.obj = obj self._surface_name_on_server = self.surface_name_on_server(obj._name) @@ -147,7 +148,7 @@ def delete_surface_on_server(self) -> None: elif self.obj.definition.type() == "plane-surface": del self._get_api_handle().plane_surface[self._surface_name_on_server] - def __init__(self, obj: PyLocalBase): + def __init__(self, obj: "PyLocalBase"): """__init__ method of PostAPIHelper class.""" self.obj = obj self.field_data = lambda: cast( diff --git a/src/ansys/fluent/interface/post_objects/post_object_definitions.py b/src/ansys/fluent/interface/post_objects/post_object_definitions.py index 6898430e..11a3d2f6 100644 --- a/src/ansys/fluent/interface/post_objects/post_object_definitions.py +++ b/src/ansys/fluent/interface/post_objects/post_object_definitions.py @@ -55,7 +55,7 @@ class BasePostObjectDefn(Protocol, metaclass=abc.ABCMeta): """Base class for visualization objects.""" @abc.abstractmethod - def get_root(self, instance: object = None) -> Container: + def get_root(self, instance: object = None) -> "Container": raise NotImplementedError surfaces: Callable[[], Sequence[str]] diff --git a/src/ansys/fluent/interface/post_objects/post_objects_container.py b/src/ansys/fluent/interface/post_objects/post_objects_container.py index 191ab834..04ea2918 100644 --- a/src/ansys/fluent/interface/post_objects/post_objects_container.py +++ b/src/ansys/fluent/interface/post_objects/post_objects_container.py @@ -25,7 +25,7 @@ import builtins import inspect import types -from typing import Any, ClassVar, Literal, TypeVar +from typing import Any, ClassVar, Literal, TypeAlias, TypeVar from ansys.fluent.core.session import BaseSession from ansys.fluent.core.session_solver import Solver @@ -36,13 +36,17 @@ PyLocalNamedObject, ) from ansys.fluent.interface.post_objects.post_helper import PostAPIHelper -from ansys.fluent.interface.post_objects.post_object_definitions import ContourDefn, MeshDefn, SurfaceDefn, VectorDefn -from ansys.fluent.visualization import Contour, Surface, Vector -from ansys.fluent.visualization.containers import Pathline -from ansys.fluent.visualization.graphics.graphics_objects import Mesh -from ansys.fluent.visualization.plotter.plotter_objects import MonitorPlot, XYPlot +from ansys.fluent.interface.post_objects.post_object_definitions import ( + ContourDefn, + MeshDefn, + MonitorDefn, + PathlinesDefn, + SurfaceDefn, + VectorDefn, + XYPlotDefn, +) -LocalSurfacesProvider = PyLocalContainer[Surface] +LocalSurfacesProvider: TypeAlias = PyLocalContainer[SurfaceDefn] T = TypeVar("T") @@ -89,8 +93,8 @@ def __init__( self._init_module(self, module, post_api_helper) else: self.__dict__ = session_state - self._local_surfaces_provider = lambda: local_surfaces_provider or getattr( - self, "Surfaces", {} + self._local_surfaces_provider = lambda: ( + local_surfaces_provider or getattr(self, "Surfaces", {}) ) def get_path(self) -> str: @@ -196,10 +200,10 @@ class Plots(Container): _sessions_state: ClassVar[dict[BaseSession, dict[str, Any]]] = {} XYPlots: PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] - XYPlot + XYPlotDefn ] MonitorPlots: PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] - MonitorPlot + MonitorDefn ] def __init__( @@ -258,7 +262,7 @@ class Graphics(Container): VectorDefn ] Pathlines: PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] - Pathline + PathlinesDefn ] def __init__( diff --git a/src/ansys/fluent/visualization/__init__.py b/src/ansys/fluent/visualization/__init__.py index e66fb8af..25e15c73 100644 --- a/src/ansys/fluent/visualization/__init__.py +++ b/src/ansys/fluent/visualization/__init__.py @@ -41,7 +41,6 @@ from ansys.fluent.visualization.registrar import register_renderer as register_renderer from ansys.fluent.visualization.renderer import GraphicsWindow as GraphicsWindow - _VERSION_INFO = None __version__ = _version(__name__.replace(".", "-")) @@ -59,5 +58,3 @@ def version_info() -> str: Only available in packaged versions. Otherwise it will return __version__. """ return _VERSION_INFO if _VERSION_INFO is not None else __version__ - - diff --git a/src/ansys/fluent/visualization/base/renderer.py b/src/ansys/fluent/visualization/base/renderer.py index 712b088c..1dee40de 100644 --- a/src/ansys/fluent/visualization/base/renderer.py +++ b/src/ansys/fluent/visualization/base/renderer.py @@ -25,11 +25,12 @@ from abc import ABC, abstractmethod from collections.abc import Mapping, Sequence from typing import Any, Generic, NotRequired, TypedDict -from typing_extensions import TypeVar +from typing_extensions import TypeVar DataT = TypeVar("DataT", default=Any) + class SurfaceToRender(TypedDict, Generic[DataT]): """TypedDict for mesh surface definition.""" diff --git a/src/ansys/fluent/visualization/config.py b/src/ansys/fluent/visualization/config.py index a47d270c..82fb2f27 100644 --- a/src/ansys/fluent/visualization/config.py +++ b/src/ansys/fluent/visualization/config.py @@ -20,9 +20,10 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Configuration variables for visualization.""" -from enum import Enum + import os import warnings +from enum import Enum from ansys.fluent.core import PyFluentDeprecationWarning diff --git a/src/ansys/fluent/visualization/containers.py b/src/ansys/fluent/visualization/containers.py index 3625a243..5db53db4 100644 --- a/src/ansys/fluent/visualization/containers.py +++ b/src/ansys/fluent/visualization/containers.py @@ -26,16 +26,17 @@ """Containers for graphics.""" import abc +import warnings from typing import ( TYPE_CHECKING, Any, Generic, Literal, + Required, Self, TypedDict, Unpack, ) -import warnings from ansys.fluent.core.field_data_interfaces import _to_field_name_str from ansys.fluent.core.utils.context_managers import _get_active_session @@ -52,11 +53,11 @@ from ansys.fluent.interface.post_objects.post_object_definitions import ( ContourDefn, Defns, + MeshDefn, MonitorDefn, + PathlinesDefn, SurfaceDefn, VectorDefn, - MeshDefn, - PathlinesDefn, XYPlotDefn, ) from ansys.fluent.interface.post_objects.post_objects_container import Container @@ -67,11 +68,11 @@ class _GraphicsContainer(Generic[DefnT]): """Base class for graphics containers.""" - solver: Solver # pyright: ignore[reportUninitializedInstanceVariable] - _obj: Defns # pyright: ignore[reportUninitializedInstanceVariable] + solver: "Solver" # pyright: ignore[reportUninitializedInstanceVariable] + _obj: "Defns" # pyright: ignore[reportUninitializedInstanceVariable] kwargs: dict[str, Any] # pyright: ignore[reportUninitializedInstanceVariable] - def __init__(self, solver: Solver | None, **kwargs: Any): + def __init__(self, solver: "Solver | None", **kwargs: Any): super().__init__() self.__dict__["solver"] = solver or _get_active_session() self.__dict__["kwargs"] = kwargs @@ -90,9 +91,9 @@ def __init__(self, solver: Solver | None, **kwargs: Any): # we have these due to inheriting from the ABCs at type time but the attributes coming from ._obj # the type checker thinks they aren't valid to instantiate otherwise def get_root(self, instance: object = None) -> Container: ... # pyright: ignore[reportUnusedParameter] - def display(self, window_id: str | None = None) -> None: ...# pyright: ignore[reportUnusedParameter] + def display(self, window_id: str | None = None) -> None: ... # pyright: ignore[reportUnusedParameter] - surfaces: Any # pyright: ignore[reportUninitializedInstanceVariable] £ something is definitely bugged here in the type checker as () -> list[str doesn't work] + surfaces: Any # pyright: ignore[reportUninitializedInstanceVariable] # something is definitely bugged here in the type checker as () -> list[str doesn't work] else: def __getattr__(self, attr): @@ -110,7 +111,7 @@ def __dir__(self) -> list[str]: class Mesh( # pyright: ignore[reportUnsafeMultipleInheritance] - _GraphicsContainer["MeshDefn"], MeshDefn if TYPE_CHECKING else object, abc.ABC + _GraphicsContainer["MeshDefn"], MeshDefn if TYPE_CHECKING else abc.ABC ): """Mesh visualization object. @@ -147,8 +148,8 @@ def __init__( *, surfaces: list[str], show_edges: bool = False, - solver: Solver | None = None, - **kwargs: Unpack[_DeleteKwargs], + solver: "Solver | None" = None, + **kwargs: Unpack["_DeleteKwargs"], ): """__init__ method of Mesh class.""" @@ -165,11 +166,10 @@ def __init__( ) -SurfaceType = Literal['plane-surface', 'iso-surface'] -SurfaceCreationMethod = Literal[ - 'xy-plane', 'yz-plane', 'zx-plane', 'point-and-normal' -] -SurfaceRendering = Literal['mesh', 'contour'] +SurfaceType = Literal["plane-surface", "iso-surface"] +SurfaceCreationMethod = Literal["xy-plane", "yz-plane", "zx-plane", "point-and-normal"] +SurfaceRendering = Literal["mesh", "contour"] + class SurfaceKwargsNoType(TypedDict, total=False): creation_method: SurfaceCreationMethod @@ -182,11 +182,13 @@ class SurfaceKwargsNoType(TypedDict, total=False): point: tuple[float, float, float] normal: tuple[float, float, float] + class SurfaceKwargs(SurfaceKwargsNoType): type: SurfaceType + class Surface( # pyright: ignore[reportUnsafeMultipleInheritance] - _GraphicsContainer["SurfaceDefn"], SurfaceDefn if TYPE_CHECKING else object, abc.ABC + _GraphicsContainer["SurfaceDefn"], SurfaceDefn if TYPE_CHECKING else abc.ABC ): """Surface definition for Fluent post-processing. @@ -236,8 +238,10 @@ class determines the session. >>> surf_outlet_plane.iso_value = -0.125017 """ + _obj: "SurfaceDefn" # pyright: ignore[reportIncompatibleVariableOverride] + def __init__( - self, *, solver: Solver | None = None, **kwargs: Unpack[SurfaceKwargs] + self, *, solver: "Solver | None" = None, **kwargs: Unpack[SurfaceKwargs] ): """__init__ method of Surface class.""" super().__init__(solver, **kwargs) @@ -282,9 +286,7 @@ def creation_method( return self._obj.definition.plane_surface.creation_method() @creation_method.setter - def creation_method( - self, value: SurfaceCreationMethod - ) -> None: + def creation_method(self, value: SurfaceCreationMethod) -> None: self._obj.definition.plane_surface.creation_method = value @property @@ -399,7 +401,7 @@ class PlaneSurface(Surface, abc.ABC): @classmethod def create_xy_plane( - cls, *, solver: Solver | None = None, z: float = 0.0, **kwargs: Any + cls, *, solver: "Solver | None" = None, z: float = 0.0, **kwargs: Any ) -> Self: """Create a plane surface in the XY plane at a given Z value.""" return cls( @@ -412,7 +414,7 @@ def create_xy_plane( @classmethod def create_yz_plane( - cls, solver: Solver | None = None, x: float = 0.0, **kwargs: Any + cls, solver: "Solver | None" = None, x: float = 0.0, **kwargs: Any ) -> Self: """Create a plane surface in the YZ plane at a given X value.""" return cls( @@ -425,7 +427,7 @@ def create_yz_plane( @classmethod def create_zx_plane( - cls, solver: Solver | None = None, y: float = 0.0, **kwargs: Any + cls, solver: "Solver | None" = None, y: float = 0.0, **kwargs: Any ): """Create a plane surface in the ZX plane at a given Y value.""" return cls( @@ -439,7 +441,7 @@ def create_zx_plane( @classmethod def create_from_point_and_normal( cls, - solver: Solver | None = None, + solver: "Solver | None" = None, point: tuple[float, float, float] = (0, 0, 0), normal: tuple[float, float, float] = (0, 0, 0), **kwargs: Any, @@ -493,28 +495,35 @@ class IsoSurface(Surface, abc.ABC): def __init__( self, - solver: Solver | None = None, + solver: "Solver | None" = None, **kwargs: Unpack[SurfaceKwargsNoType], ): """Create an iso-surface.""" - init_kwargs: SurfaceKwargs = kwargs - if field is not None: - init_kwargs["field"] = field - if rendering is not None: - init_kwargs["rendering"] = rendering - if iso_value is not None: - init_kwargs["iso_value"] = iso_value super().__init__( solver=solver, type="iso-surface", **kwargs, ) + class GenericCreateArgs(TypedDict, total=False): name: str + +class ContourKwargs(TypedDict, total=False): + field: str | VariableDescriptor + surfaces: list[str] + filled: bool + node_values: bool + boundary_values: bool + contour_lines: bool + show_edges: bool + + class Contour( # pyright: ignore[reportUnsafeMultipleInheritance] - _GraphicsContainer["ContourDefn"], ContourDefn if TYPE_CHECKING else object, abc.ABC + _GraphicsContainer["ContourDefn"], + ContourDefn if TYPE_CHECKING else abc.ABC, + abc.ABC, ): """ Contour visualization object. @@ -550,7 +559,11 @@ class Contour( # pyright: ignore[reportUnsafeMultipleInheritance] >>> ) """ - def __init__(self, *, solver: Solver | None = None, **kwargs: Unpack[SurfaceKwargsNoType]): + _obj: "ContourDefn" # pyright: ignore[reportIncompatibleVariableOverride] + + def __init__( + self, *, solver: "Solver | None" = None, **kwargs: Unpack[ContourKwargs] + ): """__init__ method of Contour class.""" super().__init__(solver, **kwargs) super().__setattr__( @@ -558,8 +571,17 @@ def __init__(self, *, solver: Solver | None = None, **kwargs: Unpack[SurfaceKwar ) +# class VectorKwargs(TypedDict, total=False): +# field: Required[str | VariableDescriptor] +# surfaces: Required[list[str]] +# vectors_of: str | VariableDescriptor | None +# scale: float +# skip: int +# show_edges: bool + + class Vector( # pyright: ignore[reportUnsafeMultipleInheritance] - _GraphicsContainer["VectorDefn"], VectorDefn if TYPE_CHECKING else object, abc.ABC + _GraphicsContainer["VectorDefn"], VectorDefn if TYPE_CHECKING else abc.ABC, abc.ABC ): """Vector visualization object. @@ -594,6 +616,8 @@ class Vector( # pyright: ignore[reportUnsafeMultipleInheritance] >>> ) """ + _obj: "VectorDefn" # pyright: ignore[reportIncompatibleVariableOverride] + def __init__( self, *, @@ -601,8 +625,10 @@ def __init__( surfaces: list[str], color_by: str | VariableDescriptor | None = None, scale: float = 1.0, - solver: Solver | None = None, - **kwargs: Any, + skip: int = 0, + show_edges: bool = False, + solver: "Solver | None" = None, + # **kwargs: Unpack[VectorKwargs], ): """__init__ method of Vector class.""" if color_by is None: @@ -610,12 +636,11 @@ def __init__( super().__init__( solver, - **kwargs - | { - "vectors_of": field, - "field": color_by, - "scale": scale, - }, + vectors_of=field, + field=color_by, + scale=scale, + skip=skip, + show_edges=show_edges, ) super().__setattr__( "_obj", Graphics(session=self.solver).Vectors.create(**self.kwargs) @@ -632,6 +657,7 @@ def __init__( ) if not TYPE_CHECKING: + @staticmethod def _get_mapped_attrs(attr: str) -> str | None: _attr_map = { @@ -652,9 +678,14 @@ def __setattr__(self, attr: str, value: Any) -> None: setattr(self._obj, attr, value) +class PathlineKwargs(TypedDict, total=False): + field: Required[str | VariableDescriptor] + surfaces: Required[list[str]] + + class Pathline( # pyright: ignore[reportUnsafeMultipleInheritance] _GraphicsContainer["PathlinesDefn"], - PathlinesDefn if TYPE_CHECKING else object, + PathlinesDefn if TYPE_CHECKING else abc.ABC, abc.ABC, ): """Pathline visualization object. @@ -692,29 +723,32 @@ class Pathline( # pyright: ignore[reportUnsafeMultipleInheritance] >>> ) """ + _obj: "PathlinesDefn" # pyright: ignore[reportIncompatibleVariableOverride] + def __init__( self, *, - field: str | VariableDescriptor, - surfaces: list[str], - solver: Solver | None = None, - **kwargs: Any, + solver: "Solver | None" = None, + **kwargs: Unpack[PathlineKwargs], ): """__init__ method of Pathline class.""" - kwargs.update( - { - "field": field, - "surfaces": surfaces, - } - ) super().__init__(solver, **kwargs) super().__setattr__( "_obj", Graphics(session=self.solver).Pathlines.create(**self.kwargs) ) +class XYPlotKwargs(TypedDict, total=False): + direction_vector: tuple[int, int, int] + node_values: bool + boundary_values: bool + x_axis_function: Literal["direction-vector"] + y_axis_function: Required[str | VariableDescriptor] + surfaces: Required[list[str]] + + class XYPlot( # pyright: ignore[reportUnsafeMultipleInheritance] - _GraphicsContainer["XYPlotDefn"], XYPlotDefn if TYPE_CHECKING else object, abc.ABC + _GraphicsContainer["XYPlotDefn"], XYPlotDefn if TYPE_CHECKING else abc.ABC, abc.ABC ): """XY plot visualization object. @@ -750,22 +784,15 @@ class XYPlot( # pyright: ignore[reportUnsafeMultipleInheritance] >>> ) """ + _obj: "XYPlotDefn" # pyright: ignore[reportIncompatibleVariableOverride] + def __init__( self, *, - surfaces: list[str], - y_axis_function: str | VariableDescriptor, - solver: Solver | None = None, - local_surfaces_provider=None, - **kwargs, + solver: "Solver | None" = None, + **kwargs: Unpack[XYPlotKwargs], ): """__init__ method of XYPlot class.""" - kwargs.update( - { - "y_axis_function": y_axis_function, - "surfaces": surfaces, - } - ) super().__init__(solver, **kwargs) if "y_axis_function" in self.kwargs: self.kwargs["y_axis_function"] = _to_field_name_str( @@ -779,8 +806,14 @@ def __init__( ) +class MonitorKwargs(TypedDict, total=False): + monitor_set_name: Required[str] + + class Monitor( # pyright: ignore[reportUnsafeMultipleInheritance] - _GraphicsContainer["MonitorDefn"], MonitorDefn if TYPE_CHECKING else object, abc.ABC + _GraphicsContainer["MonitorDefn"], + MonitorDefn if TYPE_CHECKING else abc.ABC, + abc.ABC, ): """Monitor visualization object. @@ -809,12 +842,14 @@ class Monitor( # pyright: ignore[reportUnsafeMultipleInheritance] >>> residual = Monitor(solver=solver_session, monitor_set_name="residual") """ + _obj: "MonitorDefn" # pyright: ignore[reportIncompatibleVariableOverride] + def __init__( self, *, monitor_set_name: str, - solver: Solver | None = None, - **kwargs: Any, + solver: "Solver | None" = None, + **kwargs: Unpack[MonitorKwargs], ): """__init__ method of Monitor class.""" kwargs.update( diff --git a/src/ansys/fluent/visualization/graphics/graphics_objects.py b/src/ansys/fluent/visualization/graphics/graphics_objects.py index 1144670b..eaa8907c 100644 --- a/src/ansys/fluent/visualization/graphics/graphics_objects.py +++ b/src/ansys/fluent/visualization/graphics/graphics_objects.py @@ -22,8 +22,9 @@ """Module providing visualization objects for PyVista.""" -from abc import ABC import sys +from abc import ABC +from typing import TYPE_CHECKING from ansys.fluent.interface.post_objects.meta import Command, PyLocalContainer from ansys.fluent.interface.post_objects.post_helper import PostAPIHelper @@ -36,12 +37,17 @@ ) from ansys.fluent.interface.post_objects.post_objects_container import ( Graphics as GraphicsContainer, +) +from ansys.fluent.interface.post_objects.post_objects_container import ( LocalSurfacesProvider, ) from ansys.fluent.visualization.graphics.graphics_windows_manager import ( graphics_windows_manager, ) +if TYPE_CHECKING: + from ansys.fluent.core.session_solver import Solver + class Graphics(GraphicsContainer): """ @@ -51,9 +57,9 @@ class Graphics(GraphicsContainer): def __init__( self, - session, + session: "Solver", post_api_helper: type[PostAPIHelper] = PostAPIHelper, - local_surfaces_provider: LocalSurfacesProvider |None =None, + local_surfaces_provider: LocalSurfacesProvider | None = None, ): super().__init__( session, sys.modules[__name__], post_api_helper, local_surfaces_provider diff --git a/src/ansys/fluent/visualization/graphics/graphics_windows.py b/src/ansys/fluent/visualization/graphics/graphics_windows.py index 4888080b..222503a5 100644 --- a/src/ansys/fluent/visualization/graphics/graphics_windows.py +++ b/src/ansys/fluent/visualization/graphics/graphics_windows.py @@ -21,6 +21,7 @@ # SOFTWARE. """A wrapper to improve the user interface of graphics.""" + import ansys.fluent.visualization as pyviz from ansys.fluent.visualization.graphics import graphics_windows_manager diff --git a/src/ansys/fluent/visualization/graphics/graphics_windows_manager.py b/src/ansys/fluent/visualization/graphics/graphics_windows_manager.py index 9f11374a..3a3129ed 100644 --- a/src/ansys/fluent/visualization/graphics/graphics_windows_manager.py +++ b/src/ansys/fluent/visualization/graphics/graphics_windows_manager.py @@ -22,20 +22,20 @@ """Module for graphics windows management.""" -from enum import Enum import itertools import threading +from enum import Enum import numpy as np import pyvista as pv +import ansys.fluent.visualization as pyviz from ansys.fluent.interface.post_objects.check_in_notebook import in_jupyter from ansys.fluent.interface.post_objects.post_object_definitions import ( GraphicsDefn, PlotDefn, ) from ansys.fluent.interface.post_objects.singleton_meta import AbstractSingletonMeta -import ansys.fluent.visualization as pyviz from ansys.fluent.visualization.post_data_extractor import ( FieldDataExtractor, XYPlotDataExtractor, @@ -129,7 +129,9 @@ def _get_renderer(self, renderer_string=None): raise KeyError(error_message) from ex return renderer(self.id, in_jupyter(), not pyviz.config.interactive, self._grid) - def set_data(self, data_type: FieldDataType, data: dict[int, dict[str, np.ndarray]]): + def set_data( + self, data_type: FieldDataType, data: dict[int, dict[str, np.ndarray]] + ): """Set data for graphics.""" self._data[data_type] = data @@ -895,7 +897,6 @@ def _get_unique_window_id(self) -> str: class NonInteractiveGraphicsManager( GraphicsWindowsManager, VisualizationWindowsManager ): - def open_window( self, window_id: str | None = None, @@ -1006,7 +1007,6 @@ def _show_graphics_in_notebook(self, window_id: str): class InteractiveGraphicsManager(GraphicsWindowsManager, VisualizationWindowsManager): - def open_window( self, window_id: str | None = None, @@ -1210,12 +1210,4 @@ def __setattr__(self, name, value): setattr(self._real_instance, name, value) -graphics_windows_manager = _GraphicsManagerProxy() - super().__setattr__(name, value) - else: - if self._real_instance is None: - self._initialize() - setattr(self._real_instance, name, value) - - graphics_windows_manager = _GraphicsManagerProxy() diff --git a/src/ansys/fluent/visualization/graphics/pyvista/renderer.py b/src/ansys/fluent/visualization/graphics/pyvista/renderer.py index 080368db..624c9ee6 100644 --- a/src/ansys/fluent/visualization/graphics/pyvista/renderer.py +++ b/src/ansys/fluent/visualization/graphics/pyvista/renderer.py @@ -22,14 +22,14 @@ """Module for pyVista windows management.""" +import importlib.util from collections.abc import Mapping, Sequence from typing import TYPE_CHECKING, Any, TypedDict, cast -import importlib.util -from typing_extensions import override import numpy as np import numpy.typing as npt import pyvista as pv +from typing_extensions import override import ansys.fluent.visualization as pyviz from ansys.fluent.visualization.base.renderer import AbstractRenderer, SubPlot @@ -79,7 +79,9 @@ def __init__( if in_jupyter or non_interactive: self.plotter = pv.Plotter(title=f"PyFluent ({win_id})", shape=grid) else: - from pyvistaqt import BackgroundPlotter # pyright: ignore[reportMissingTypeStubs] + from pyvistaqt import ( # pyright: ignore[reportMissingTypeStubs] + BackgroundPlotter, + ) self.plotter = BackgroundPlotter( title=f"PyFluent ({win_id})", @@ -229,7 +231,10 @@ def render(self, meshes: Sequence[SubPlot[pv.DataSet | Mapping[str, CurveData]]] ] chart.title = mesh_dict["title"] - self.plotter.add_chart(chart, **kwargs) # pyright: ignore[reportArgumentType, reportAny] # add_chart uses functools.wraps internally which isn't typed for methods + self.plotter.add_chart( # add_chart uses functools.wraps internally which isn't typed for methods + chart, + **kwargs, # pyright: ignore[reportArgumentType] + ) @override def save_graphic(self, file_name: str): diff --git a/src/ansys/fluent/visualization/plotter/matplotlib/renderer.py b/src/ansys/fluent/visualization/plotter/matplotlib/renderer.py index ef378abd..4801139d 100644 --- a/src/ansys/fluent/visualization/plotter/matplotlib/renderer.py +++ b/src/ansys/fluent/visualization/plotter/matplotlib/renderer.py @@ -22,7 +22,6 @@ """Module providing matplotlib plotter functionality.""" - import matplotlib.pyplot as plt import numpy as np diff --git a/src/ansys/fluent/visualization/plotter/plotter_objects.py b/src/ansys/fluent/visualization/plotter/plotter_objects.py index 4a488ff5..54c6878f 100644 --- a/src/ansys/fluent/visualization/plotter/plotter_objects.py +++ b/src/ansys/fluent/visualization/plotter/plotter_objects.py @@ -33,6 +33,8 @@ ) from ansys.fluent.interface.post_objects.post_objects_container import ( LocalSurfacesProvider, +) +from ansys.fluent.interface.post_objects.post_objects_container import ( Plots as PlotsContainer, ) from ansys.fluent.visualization.plotter.plotter_windows_manager import ( @@ -49,7 +51,7 @@ class Plots(PlotsContainer): def __init__( self, session, - post_api_helper: type[PostAPIHelper]=PostAPIHelper, + post_api_helper: type[PostAPIHelper] = PostAPIHelper, local_surfaces_provider: LocalSurfacesProvider | None = None, ): super().__init__( diff --git a/src/ansys/fluent/visualization/plotter/plotter_windows_manager.py b/src/ansys/fluent/visualization/plotter/plotter_windows_manager.py index 2e1c742c..dbbee14f 100644 --- a/src/ansys/fluent/visualization/plotter/plotter_windows_manager.py +++ b/src/ansys/fluent/visualization/plotter/plotter_windows_manager.py @@ -28,6 +28,7 @@ from ansys.fluent.core.fluent_connection import FluentConnection +import ansys.fluent.visualization as pyviz from ansys.fluent.interface.post_objects.check_in_notebook import in_jupyter from ansys.fluent.interface.post_objects.post_object_definitions import ( MonitorDefn, @@ -35,7 +36,6 @@ XYPlotDefn, ) from ansys.fluent.interface.post_objects.singleton_meta import AbstractSingletonMeta -import ansys.fluent.visualization as pyviz from ansys.fluent.visualization.plotter.matplotlib.renderer import ProcessPlotter from ansys.fluent.visualization.post_data_extractor import XYPlotDataExtractor from ansys.fluent.visualization.visualization_windows_manager import ( diff --git a/src/ansys/fluent/visualization/post_data_extractor.py b/src/ansys/fluent/visualization/post_data_extractor.py index 4efdaff4..d4657c29 100644 --- a/src/ansys/fluent/visualization/post_data_extractor.py +++ b/src/ansys/fluent/visualization/post_data_extractor.py @@ -24,6 +24,7 @@ import itertools +import numpy as np from ansys.fluent.core.field_data_interfaces import ( PathlinesFieldDataRequest, ScalarFieldDataRequest, @@ -31,7 +32,6 @@ SurfaceFieldDataRequest, VectorFieldDataRequest, ) -import numpy as np from ansys.fluent.interface.post_objects.post_object_definitions import ( GraphicsDefn, diff --git a/src/ansys/fluent/visualization/renderer.py b/src/ansys/fluent/visualization/renderer.py index 3c225801..c231322c 100644 --- a/src/ansys/fluent/visualization/renderer.py +++ b/src/ansys/fluent/visualization/renderer.py @@ -24,15 +24,21 @@ from collections.abc import Iterable from typing import Any, Literal -import warnings +import ansys.fluent.visualization as pyviz from ansys.fluent.interface.post_objects.post_object_definitions import ( GraphicsDefn, PlotDefn, XYPlotDefn, ) -import ansys.fluent.visualization as pyviz -from ansys.fluent.visualization.containers import Mesh, Monitor +from ansys.fluent.visualization.containers import ( + Contour, + Mesh, + Monitor, + Pathline, + Surface, + Vector, +) from ansys.fluent.visualization.graphics import graphics_windows_manager from ansys.fluent.visualization.graphics.graphics_windows import _GraphicsWindow from ansys.fluent.visualization.plotter.plotter_windows import _PlotterWindow @@ -73,7 +79,7 @@ def __init__(self, renderer: Literal["pyvista", "matplotlib"] | str | None = Non def add_graphics( self, - graphics_obj: Mesh, + graphics_obj: Mesh | Surface | Contour | Vector | Pathline, position: tuple[int, int] = (0, 0), opacity: float = 1, **kwargs: Any, @@ -90,7 +96,9 @@ def add_graphics( Transparency of the sub-plot. """ self._list_of_positions.append(position) - self._graphics_objs.append(kwargs | {"object": graphics_obj, "position": position, "opacity": opacity}) + self._graphics_objs.append( + kwargs | {"object": graphics_obj, "position": position, "opacity": opacity} + ) def add_plot( self, @@ -111,7 +119,9 @@ def add_plot( Title of the sub-plot. """ self._list_of_positions.append(position) - self._graphics_objs.append(kwargs | {"object": plot_obj, "position": position, "title": title}) + self._graphics_objs.append( + kwargs | {"object": plot_obj, "position": position, "title": title} + ) def _all_plt_objs(self) -> bool: for obj in self._graphics_objs: diff --git a/tests/test_post.py b/tests/test_post.py index a8cc8b3a..26ba7907 100644 --- a/tests/test_post.py +++ b/tests/test_post.py @@ -20,13 +20,13 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from pathlib import Path import pickle import sys +from pathlib import Path -from ansys.fluent.core.field_data_interfaces import SurfaceDataType import numpy as np import pytest +from ansys.fluent.core.field_data_interfaces import SurfaceDataType from ansys.fluent.visualization import Graphics, Plots diff --git a/tests/test_visualization.py b/tests/test_visualization.py index f60188f7..68e3fbdf 100644 --- a/tests/test_visualization.py +++ b/tests/test_visualization.py @@ -22,8 +22,8 @@ import sys -from ansys.units import VariableCatalog import pytest +from ansys.units import VariableCatalog from ansys.fluent.interface.post_objects.post_object_definitions import ContourDefn @@ -40,10 +40,10 @@ from unittest.mock import patch import ansys.fluent.core as pyfluent -from ansys.fluent.core import examples import numpy as np import pytest import pyvista as pv +from ansys.fluent.core import examples from ansys.fluent.visualization import ( Contour, From a28c18314fb79d1f99f045633c43096ce60c56e4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 4 Feb 2026 16:10:07 +0000 Subject: [PATCH 20/20] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../fluent/interface/post_objects/check_in_notebook.py | 3 ++- src/ansys/fluent/interface/post_objects/meta.py | 6 ++++-- .../interface/post_objects/post_object_definitions.py | 2 +- .../interface/post_objects/post_objects_container.py | 8 +++++--- src/ansys/fluent/visualization/config.py | 2 +- src/ansys/fluent/visualization/containers.py | 10 +++++++--- .../fluent/visualization/graphics/graphics_objects.py | 2 +- .../visualization/graphics/graphics_windows_manager.py | 4 ++-- .../fluent/visualization/graphics/pyvista/renderer.py | 10 +++++++--- .../visualization/plotter/plotter_windows_manager.py | 2 +- src/ansys/fluent/visualization/post_data_extractor.py | 2 +- src/ansys/fluent/visualization/renderer.py | 2 +- tests/test_post.py | 4 ++-- tests/test_visualization.py | 4 ++-- 14 files changed, 37 insertions(+), 24 deletions(-) diff --git a/src/ansys/fluent/interface/post_objects/check_in_notebook.py b/src/ansys/fluent/interface/post_objects/check_in_notebook.py index d438e4eb..0d76d143 100644 --- a/src/ansys/fluent/interface/post_objects/check_in_notebook.py +++ b/src/ansys/fluent/interface/post_objects/check_in_notebook.py @@ -33,7 +33,8 @@ def in_jupyter() -> bool: from IPython import get_ipython return ( - "IPKernelApp" in get_ipython().config # pyright: ignore[reportOptionalMemberAccess] + "IPKernelApp" + in get_ipython().config # pyright: ignore[reportOptionalMemberAccess] ) except (ImportError, AttributeError): return False diff --git a/src/ansys/fluent/interface/post_objects/meta.py b/src/ansys/fluent/interface/post_objects/meta.py index 37b57268..f8e17157 100644 --- a/src/ansys/fluent/interface/post_objects/meta.py +++ b/src/ansys/fluent/interface/post_objects/meta.py @@ -22,9 +22,9 @@ """Metaclasses used in various explicit classes in PyFluent.""" -import inspect from abc import ABC, abstractmethod from collections.abc import Callable, Iterator, MutableMapping, Sequence +import inspect from typing import ( TYPE_CHECKING, Any, @@ -626,7 +626,9 @@ def create(self) -> Self: ... def if_type_checking_instantiate( type: type[T], -) -> T: # the current behaviour has all of the classes that use this initialised in the XXX class +) -> ( + T +): # the current behaviour has all of the classes that use this initialised in the XXX class return cast(T, type) # this is hopefully obviously unsafe diff --git a/src/ansys/fluent/interface/post_objects/post_object_definitions.py b/src/ansys/fluent/interface/post_objects/post_object_definitions.py index 15735489..0960d254 100644 --- a/src/ansys/fluent/interface/post_objects/post_object_definitions.py +++ b/src/ansys/fluent/interface/post_objects/post_object_definitions.py @@ -23,9 +23,9 @@ """Module providing visualization objects definition.""" import abc -import logging from abc import abstractmethod from collections.abc import Callable, Sequence +import logging from typing import ( TYPE_CHECKING, Literal, diff --git a/src/ansys/fluent/interface/post_objects/post_objects_container.py b/src/ansys/fluent/interface/post_objects/post_objects_container.py index fff0a656..6d15fea5 100644 --- a/src/ansys/fluent/interface/post_objects/post_objects_container.py +++ b/src/ansys/fluent/interface/post_objects/post_objects_container.py @@ -202,9 +202,11 @@ class Plots(Container): XYPlots: PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] XYPlotDefn ] - MonitorPlots: PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] - MonitorDefn - ] + MonitorPlots: ( + PyLocalContainer[ # pyright: ignore[reportUninitializedInstanceVariable] + MonitorDefn + ] + ) def __init__( self, diff --git a/src/ansys/fluent/visualization/config.py b/src/ansys/fluent/visualization/config.py index df8951bd..d93439ba 100644 --- a/src/ansys/fluent/visualization/config.py +++ b/src/ansys/fluent/visualization/config.py @@ -21,9 +21,9 @@ # SOFTWARE. """Configuration variables for visualization.""" +from enum import Enum import os import warnings -from enum import Enum from ansys.fluent.core import PyFluentDeprecationWarning diff --git a/src/ansys/fluent/visualization/containers.py b/src/ansys/fluent/visualization/containers.py index c1d01366..d2b5e88c 100644 --- a/src/ansys/fluent/visualization/containers.py +++ b/src/ansys/fluent/visualization/containers.py @@ -26,7 +26,6 @@ """Containers for graphics.""" import abc -import warnings from typing import ( TYPE_CHECKING, Any, @@ -37,6 +36,7 @@ TypedDict, Unpack, ) +import warnings from ansys.fluent.core.field_data_interfaces import _to_field_name_str from ansys.fluent.core.utils.context_managers import _get_active_session @@ -98,8 +98,12 @@ def get_field_data(self): if TYPE_CHECKING: # we have these due to inheriting from the ABCs at type time but the attributes coming from ._obj # the type checker thinks they aren't valid to instantiate otherwise - def get_root(self, instance: object = None) -> Container: ... # pyright: ignore[reportUnusedParameter] - def display(self, window_id: str | None = None) -> None: ... # pyright: ignore[reportUnusedParameter] + def get_root( + self, instance: object = None + ) -> Container: ... # pyright: ignore[reportUnusedParameter] + def display( + self, window_id: str | None = None + ) -> None: ... # pyright: ignore[reportUnusedParameter] surfaces: Any # pyright: ignore[reportUninitializedInstanceVariable] # something is definitely bugged here in the type checker as () -> list[str doesn't work] else: diff --git a/src/ansys/fluent/visualization/graphics/graphics_objects.py b/src/ansys/fluent/visualization/graphics/graphics_objects.py index 5a7644db..fb3b164e 100644 --- a/src/ansys/fluent/visualization/graphics/graphics_objects.py +++ b/src/ansys/fluent/visualization/graphics/graphics_objects.py @@ -22,8 +22,8 @@ """Module providing visualization objects for PyVista.""" -import sys from abc import ABC +import sys from typing import TYPE_CHECKING from ansys.fluent.interface.post_objects.meta import Command, PyLocalContainer diff --git a/src/ansys/fluent/visualization/graphics/graphics_windows_manager.py b/src/ansys/fluent/visualization/graphics/graphics_windows_manager.py index 56896f6a..67eee731 100644 --- a/src/ansys/fluent/visualization/graphics/graphics_windows_manager.py +++ b/src/ansys/fluent/visualization/graphics/graphics_windows_manager.py @@ -22,20 +22,20 @@ """Module for graphics windows management.""" +from enum import Enum import itertools import threading -from enum import Enum import numpy as np import pyvista as pv -import ansys.fluent.visualization as pyviz from ansys.fluent.interface.post_objects.check_in_notebook import in_jupyter from ansys.fluent.interface.post_objects.post_object_definitions import ( GraphicsDefn, PlotDefn, ) from ansys.fluent.interface.post_objects.singleton_meta import AbstractSingletonMeta +import ansys.fluent.visualization as pyviz from ansys.fluent.visualization.post_data_extractor import ( FieldDataExtractor, XYPlotDataExtractor, diff --git a/src/ansys/fluent/visualization/graphics/pyvista/renderer.py b/src/ansys/fluent/visualization/graphics/pyvista/renderer.py index 9d0ddf38..474d40e2 100644 --- a/src/ansys/fluent/visualization/graphics/pyvista/renderer.py +++ b/src/ansys/fluent/visualization/graphics/pyvista/renderer.py @@ -22,8 +22,8 @@ """Module for pyVista windows management.""" -import importlib.util from collections.abc import Mapping, Sequence +import importlib.util from typing import TYPE_CHECKING, Any, TypedDict, cast import numpy as np @@ -132,7 +132,9 @@ def _clear_plotter(self, in_jupyter: bool) -> None: self.plotter, pv.Plotter ) # not sure why this isn't narrowing plotter = cast(pv.Plotter, self.plotter) - plotter.remove_actor(plotter.renderer.actors.copy()) # pyright: ignore[reportArgumentType] # remove_actor uses functools.wraps internally which isn't typed for methods + plotter.remove_actor( + plotter.renderer.actors.copy() + ) # pyright: ignore[reportArgumentType] # remove_actor uses functools.wraps internally which isn't typed for methods else: self.plotter.clear() @@ -176,7 +178,9 @@ def render(self, meshes: Sequence[SubPlot[pv.DataSet | Mapping[str, CurveData]]] if isinstance(mesh, pv.DataSet): if mesh.n_points > 0: - self.plotter.add_mesh(mesh, **kwargs) # pyright: ignore[reportAny] + self.plotter.add_mesh( + mesh, **kwargs + ) # pyright: ignore[reportAny] else: y_range = None chart = pv.Chart2D() diff --git a/src/ansys/fluent/visualization/plotter/plotter_windows_manager.py b/src/ansys/fluent/visualization/plotter/plotter_windows_manager.py index 0e5bb5b4..6d8d81c5 100644 --- a/src/ansys/fluent/visualization/plotter/plotter_windows_manager.py +++ b/src/ansys/fluent/visualization/plotter/plotter_windows_manager.py @@ -28,7 +28,6 @@ from ansys.fluent.core.fluent_connection import FluentConnection -import ansys.fluent.visualization as pyviz from ansys.fluent.interface.post_objects.check_in_notebook import in_jupyter from ansys.fluent.interface.post_objects.post_object_definitions import ( MonitorDefn, @@ -36,6 +35,7 @@ XYPlotDefn, ) from ansys.fluent.interface.post_objects.singleton_meta import AbstractSingletonMeta +import ansys.fluent.visualization as pyviz from ansys.fluent.visualization.plotter.matplotlib.renderer import ProcessPlotter from ansys.fluent.visualization.post_data_extractor import XYPlotDataExtractor from ansys.fluent.visualization.visualization_windows_manager import ( diff --git a/src/ansys/fluent/visualization/post_data_extractor.py b/src/ansys/fluent/visualization/post_data_extractor.py index 1d8b7510..46747e2b 100644 --- a/src/ansys/fluent/visualization/post_data_extractor.py +++ b/src/ansys/fluent/visualization/post_data_extractor.py @@ -24,7 +24,6 @@ import itertools -import numpy as np from ansys.fluent.core.field_data_interfaces import ( PathlinesFieldDataRequest, ScalarFieldDataRequest, @@ -32,6 +31,7 @@ SurfaceFieldDataRequest, VectorFieldDataRequest, ) +import numpy as np from ansys.fluent.interface.post_objects.post_object_definitions import ( GraphicsDefn, diff --git a/src/ansys/fluent/visualization/renderer.py b/src/ansys/fluent/visualization/renderer.py index 11684511..7852011f 100644 --- a/src/ansys/fluent/visualization/renderer.py +++ b/src/ansys/fluent/visualization/renderer.py @@ -25,12 +25,12 @@ from collections.abc import Iterable from typing import Any, Literal -import ansys.fluent.visualization as pyviz from ansys.fluent.interface.post_objects.post_object_definitions import ( GraphicsDefn, PlotDefn, XYPlotDefn, ) +import ansys.fluent.visualization as pyviz from ansys.fluent.visualization.containers import ( Contour, Mesh, diff --git a/tests/test_post.py b/tests/test_post.py index 6129e782..d85e2962 100644 --- a/tests/test_post.py +++ b/tests/test_post.py @@ -20,13 +20,13 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +from pathlib import Path import pickle import sys -from pathlib import Path +from ansys.fluent.core.field_data_interfaces import SurfaceDataType import numpy as np import pytest -from ansys.fluent.core.field_data_interfaces import SurfaceDataType from ansys.fluent.visualization import Graphics, Plots diff --git a/tests/test_visualization.py b/tests/test_visualization.py index 6de57c39..2e304fdf 100644 --- a/tests/test_visualization.py +++ b/tests/test_visualization.py @@ -22,8 +22,8 @@ import sys -import pytest from ansys.units import VariableCatalog +import pytest from ansys.fluent.interface.post_objects.post_object_definitions import ContourDefn @@ -40,10 +40,10 @@ from unittest.mock import patch import ansys.fluent.core as pyfluent +from ansys.fluent.core import examples import numpy as np import pytest import pyvista as pv -from ansys.fluent.core import examples from ansys.fluent.visualization import ( Contour,