diff --git a/pyproject.toml b/pyproject.toml index c0443473a7..d1c429c236 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,7 +66,7 @@ indent-style = "space" [tool.ruff.lint] select = [ # "E", # pycodestyle, see https://beta.ruff.rs/docs/rules/#pycodestyle-e-w -# "D", # pydocstyle, see https://beta.ruff.rs/docs/rules/#pydocstyle-d + "D", # pydocstyle, see https://beta.ruff.rs/docs/rules/#pydocstyle-d # "F", # pyflakes, see https://beta.ruff.rs/docs/rules/#pyflakes-f # "I", # isort, see https://beta.ruff.rs/docs/rules/#isort-i # "N", # pep8-naming, see https://beta.ruff.rs/docs/rules/#pep8-naming-n diff --git a/src/ansys/dpf/core/_version.py b/src/ansys/dpf/core/_version.py index 37236517dd..313a4c17cd 100644 --- a/src/ansys/dpf/core/_version.py +++ b/src/ansys/dpf/core/_version.py @@ -20,7 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Version for ansys-dpf-core""" +"""Version for ansys-dpf-core.""" # Minimal DPF server version supported min_server_version = "4.0" diff --git a/src/ansys/dpf/core/animation.py b/src/ansys/dpf/core/animation.py index 26746d53aa..3c9b1e15a9 100644 --- a/src/ansys/dpf/core/animation.py +++ b/src/ansys/dpf/core/animation.py @@ -20,6 +20,8 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +"""Module contains the function for modal animation creation.""" + import ansys.dpf.core as dpf import numpy as np @@ -34,8 +36,7 @@ def animate_mode( **kwargs, ): # other option: instead of `type` use `min_factor` and `max_factor`. - - """Creates a modal animation based on Fields contained in the FieldsContainer. + """Create a modal animation based on Fields contained in the FieldsContainer. This method creates a movie or a gif based on the time ids of a ``FieldsContainer``. For kwargs see pyvista.Plotter.open_movie/add_text/show. diff --git a/src/ansys/dpf/core/animator.py b/src/ansys/dpf/core/animator.py index 9bedb85433..260dfe2a44 100644 --- a/src/ansys/dpf/core/animator.py +++ b/src/ansys/dpf/core/animator.py @@ -21,7 +21,7 @@ # SOFTWARE. """ -Animator +Animator. This module contains the DPF animator class. @@ -37,8 +37,7 @@ class _InternalAnimatorFactory: - """ - Factory for _InternalAnimator based on the backend.""" + """Factory for _InternalAnimator based on the backend.""" @staticmethod def get_animator_class(): @@ -46,7 +45,7 @@ def get_animator_class(): class _PyVistaAnimator(_PyVistaPlotter): - """This _InternalAnimator class is based on PyVista""" + """An InternalAnimator class based on PyVista.""" def __init__(self, **kwargs): super().__init__(**kwargs) @@ -190,6 +189,8 @@ def animation(): class Animator: + """The DPF animator class.""" + def __init__(self, workflow=None, **kwargs): """ Create an Animator object. @@ -228,6 +229,7 @@ def __init__(self, workflow=None, **kwargs): def workflow(self) -> core.Workflow: """ Workflow used to generate a Field at each frame of the animation. + By default, the "to_render" Field output will be plotted, and the "loop_over" input defines what the animation iterates on. Optionally, the workflow can also have a "deform_by" Field output, @@ -267,7 +269,7 @@ def animate( **kwargs, ): """ - Animate the workflow of the Animator, using inputs + Animate the workflow of the Animator, using inputs. Parameters ---------- @@ -316,6 +318,16 @@ def animate( def scale_factor_to_fc(scale_factor, fc): + """Scale the fields being animated by a factor. + + Parameters + ---------- + scale_factor : int, float, list + Scale factor to apply to the animated field. + fc : FieldsContainer + FieldsContainer containing the fields being animated. + """ + def int_to_field(value, shape, scoping): field = core.fields_factory.field_from_array(np.full(shape=shape, fill_value=value)) field.scoping = scoping diff --git a/src/ansys/dpf/core/any.py b/src/ansys/dpf/core/any.py index 6b0ce4f89a..13bfe21632 100644 --- a/src/ansys/dpf/core/any.py +++ b/src/ansys/dpf/core/any.py @@ -216,7 +216,6 @@ def new_from(obj, server=None): any : Any Wrapped any type. """ - inner_server = server if server is not None else obj._server if not inner_server.meet_version("7.0"): @@ -295,7 +294,6 @@ def cast(self, output_type=None): type Original object instance """ - self._internal_type = output_type if output_type is not None else self._internal_type type_tuple = self._type_to_new_from_get_as_method(self._internal_type) diff --git a/src/ansys/dpf/core/check_version.py b/src/ansys/dpf/core/check_version.py index b9504aae82..3e43814e68 100644 --- a/src/ansys/dpf/core/check_version.py +++ b/src/ansys/dpf/core/check_version.py @@ -76,7 +76,6 @@ def server_meet_version_and_raise(required_version, server, msg=None): bool ``True`` when successful, ``False`` when failed. """ - if not server_meet_version(required_version, server): if msg is not None: raise dpf_errors.DpfVersionNotSupported(required_version, msg=msg) @@ -143,7 +142,6 @@ def decorator(func): @wraps(func) def wrapper(self, *args, **kwargs): """Call the original function""" - if isinstance(self._server, weakref.ref): server = self._server() else: diff --git a/src/ansys/dpf/core/collection_base.py b/src/ansys/dpf/core/collection_base.py index 3d6e18de29..87afb4443c 100644 --- a/src/ansys/dpf/core/collection_base.py +++ b/src/ansys/dpf/core/collection_base.py @@ -447,7 +447,7 @@ def _data_processing_core_api(self): def _add_entry(self, label_space, entry): """Update or add an entry at a requested label space. - parameters + Parameters ---------- label_space : list[str,int] Label space of the requested fields. For example, ``{"time":1, "complex":0}``. diff --git a/src/ansys/dpf/core/common.py b/src/ansys/dpf/core/common.py index ea4323ef44..8742132142 100644 --- a/src/ansys/dpf/core/common.py +++ b/src/ansys/dpf/core/common.py @@ -23,7 +23,6 @@ """ Common - .. autoclass:: locations :members: @@ -348,7 +347,8 @@ def _common_percentage_progress_bar(text): class SubClassSmartDict(dict): def __getitem__(self, item): """If found returns the item of key == ìtem`, else returns item with key matching `issubclass(item, - key)`.""" + key)`. + """ if item in self: return super().__getitem__(item) else: diff --git a/src/ansys/dpf/core/config.py b/src/ansys/dpf/core/config.py index 837b79098d..734842d479 100644 --- a/src/ansys/dpf/core/config.py +++ b/src/ansys/dpf/core/config.py @@ -211,7 +211,7 @@ def config_option_value(self, config_name): Name of the configuration option. Returns - ---------- + ------- str Value for the configuration option. """ @@ -236,7 +236,7 @@ def config_option_documentation(self, config_name): Name of the configuration option. Returns - ---------- + ------- str Documentation for the configuration option. """ @@ -254,7 +254,7 @@ def config_option_accepted_types(self, config_name): Name of the configuration option. Returns - ---------- + ------- list, str One or more accepted types for the configuration option. """ @@ -271,7 +271,7 @@ def config_option_default_value(self, config_name): Name of the configuration option. Returns - ---------- + ------- str Default value for the configuration option. """ @@ -285,7 +285,7 @@ def available_config_options(self): """Available configuration options for the operator. Returns - ---------- + ------- list, str One or more available configuration options for the operator. """ diff --git a/src/ansys/dpf/core/custom_fields_container.py b/src/ansys/dpf/core/custom_fields_container.py index f979cfc26e..c30079efe7 100644 --- a/src/ansys/dpf/core/custom_fields_container.py +++ b/src/ansys/dpf/core/custom_fields_container.py @@ -88,7 +88,6 @@ def solid_fields(self, timeid=None, complexid=None): Examples -------- - >>> from ansys.dpf import core as dpf >>> from ansys.dpf.core import examples >>> model = dpf.Model(examples.download_all_kinds_of_complexity_modal()) diff --git a/src/ansys/dpf/core/custom_type_field.py b/src/ansys/dpf/core/custom_type_field.py index 26e0324826..3f92c3255f 100644 --- a/src/ansys/dpf/core/custom_type_field.py +++ b/src/ansys/dpf/core/custom_type_field.py @@ -211,7 +211,7 @@ def location(self, location): """Change the field location. Parameters - ------- + ---------- location : str or locations Location string, which can be ``"Nodal"``, ``"Elemental"``, ``"ElementalNodal"``... See :class:`ansys.dpf.core.common.locations`. @@ -449,7 +449,7 @@ def unit(self): """Units for the field. Returns - ---------- + ------- str Units for the field. diff --git a/src/ansys/dpf/core/cyclic_support.py b/src/ansys/dpf/core/cyclic_support.py index 5ef78c7316..be0c5022b8 100644 --- a/src/ansys/dpf/core/cyclic_support.py +++ b/src/ansys/dpf/core/cyclic_support.py @@ -317,7 +317,6 @@ def cs(self) -> field.Field: >>> cs = cyc_support.cs() """ - cs = self._api.cyclic_support_get_cs(self) return field.Field(field=cs, server=self._server) diff --git a/src/ansys/dpf/core/data_sources.py b/src/ansys/dpf/core/data_sources.py index 6375a7c616..0d68b96fcc 100644 --- a/src/ansys/dpf/core/data_sources.py +++ b/src/ansys/dpf/core/data_sources.py @@ -173,7 +173,6 @@ def guess_result_key(filepath: str) -> str: @staticmethod def guess_second_key(filepath: str) -> str: """For files with an h5 or cff extension, look for another extension.""" - # These files usually end with .cas.h5 or .dat.h5 accepted = ["cas", "dat"] new_split = Path(filepath).suffixes @@ -233,6 +232,7 @@ def add_file_path(self, filepath, key="", is_domain: bool = False, domain_id=0): domain_id: int, optional Domain ID for the distributed files. The default is ``0``. For this parameter to be taken into account, ``domain_path=True`` must be set. + Examples -------- >>> from ansys.dpf import core as dpf @@ -275,6 +275,7 @@ def add_domain_file_path(self, filepath, key, domain_id): plugin when a result is requested by an operator. domain_id: Domain ID for the distributed files. + Examples -------- >>> from ansys.dpf import core as dpf @@ -378,7 +379,7 @@ def result_files(self): """List of result files contained in the data sources. Returns - ---------- + ------- list List of result files. """ diff --git a/src/ansys/dpf/core/dpf_array.py b/src/ansys/dpf/core/dpf_array.py index 90f74da456..94db79625e 100644 --- a/src/ansys/dpf/core/dpf_array.py +++ b/src/ansys/dpf/core/dpf_array.py @@ -24,7 +24,6 @@ DPFArray - .. autoclass:: DPFArray :members: diff --git a/src/ansys/dpf/core/dpf_operator.py b/src/ansys/dpf/core/dpf_operator.py index 723efecf67..73dee9d45d 100644 --- a/src/ansys/dpf/core/dpf_operator.py +++ b/src/ansys/dpf/core/dpf_operator.py @@ -209,7 +209,6 @@ def _add_sub_res_operators(self, sub_results): >>> disp_z = model.results.displacement().Z() """ - for result_type in sub_results: try: setattr( @@ -235,7 +234,8 @@ def _outputs(self, value): @version_requires("3.0") def progress_bar(self) -> bool: """With this property, the user can choose to print a progress bar when - the operator's output is requested, default is False""" + the operator's output is requested, default is False + """ return self._progress_bar @progress_bar.setter @@ -316,6 +316,7 @@ def connect(self, pin, inpt, pin_out=0): @version_requires("6.2") def connect_operator_as_input(self, pin, op): """Connects an operator as an input on a pin. + Parameters ---------- pin : int @@ -630,7 +631,7 @@ def config(self): For information on an operator's options, see the documentation for that operator. Returns - ---------- + ------- :class:`ansys.dpf.core.config.Config` Copy of the operator's current configuration. @@ -691,7 +692,7 @@ def inputs(self): """Inputs connected to the operator. Returns - -------- + ------- :class:`ansys.dpf.core.inputs` Inputs connected to the operator. @@ -706,7 +707,6 @@ def inputs(self): >>> disp_op.inputs.data_sources(data_src) """ - return self._inputs @property @@ -714,7 +714,7 @@ def outputs(self): """Outputs from the operator's evaluation. Returns - -------- + ------- :class:`ansys.dpf.core.outputs` Outputs from the operator's evaluation. @@ -811,7 +811,6 @@ def eval(self, pin=None): >>> normfc = math.norm_fc(disp_op).eval() """ - if not pin: if self.outputs != None and len(self.outputs._outputs) > 0: return self.outputs._outputs[0]() @@ -919,7 +918,8 @@ def __mul__(self, value): @staticmethod def operator_specification(op_name, server=None): """Documents an Operator with its description (what the Operator does), - its inputs and outputs and some properties""" + its inputs and outputs and some properties + """ return Specification(operator_name=op_name, server=server) @property diff --git a/src/ansys/dpf/core/elements.py b/src/ansys/dpf/core/elements.py index 7e6c923325..0e01dd9ecd 100644 --- a/src/ansys/dpf/core/elements.py +++ b/src/ansys/dpf/core/elements.py @@ -85,7 +85,7 @@ def node_ids(self): IDs of all nodes in the element. Returns - -------- + ------- list List of IDs for all nodes in the element. @@ -132,8 +132,9 @@ def index(self) -> int: def nodes(self): """ All nodes in the element. + Returns - -------- + ------- list List of all nodes in the element. @@ -238,7 +239,7 @@ def connectivity(self): Ordered list of node indices of the element. Returns - -------- + ------- list Ordered list of node indices. @@ -789,7 +790,6 @@ def is_solid(self) -> bool: ------- bool """ - return self._shape_info["solid"] @is_solid.setter @@ -807,7 +807,6 @@ def is_shell(self) -> bool: ------- bool """ - return self._shape_info["shell"] @is_shell.setter @@ -825,7 +824,6 @@ def is_beam(self) -> bool: ------- bool """ - return self._shape_info["beam"] @is_beam.setter @@ -843,7 +841,6 @@ def is_point(self) -> bool: ------- bool """ - return self._shape_info["point"] @is_point.setter @@ -858,7 +855,7 @@ def shape(self) -> str: Shape of the element. Returns - -------- + ------- str Shape of the element. Options are ``"solid"``, ``"shell"``, ``"beam"`` and ``"unknown_shape"``. @@ -879,7 +876,7 @@ def shape(self, value): Set the shape of the element. Parameters - -------- + ---------- value : str Shape of the element. Options are ``"solid"``, ``"shell"``, ``"beam"`` and ``"unknown_shape"``. diff --git a/src/ansys/dpf/core/errors.py b/src/ansys/dpf/core/errors.py index cbf7c725a7..ad284b1fa3 100644 --- a/src/ansys/dpf/core/errors.py +++ b/src/ansys/dpf/core/errors.py @@ -85,7 +85,8 @@ def __init__(self, msg=_COMPLEX_PLOTTING_ERROR_MSG): class FieldContainerPlottingError(ValueError): """Error raised when attempting to plot a fields_container containing - multiple fields.""" + multiple fields. + """ def __init__(self, msg=_FIELD_CONTAINER_PLOTTING_MSG): ValueError.__init__(self, msg) diff --git a/src/ansys/dpf/core/examples/downloads.py b/src/ansys/dpf/core/examples/downloads.py index 8228d7b99f..1d90c3dd71 100644 --- a/src/ansys/dpf/core/examples/downloads.py +++ b/src/ansys/dpf/core/examples/downloads.py @@ -23,7 +23,8 @@ """ Downloads -Download example datasets from https://github.com/ansys/example-data""" +Download example datasets from https://github.com/ansys/example-data +""" import os from pathlib import Path @@ -1664,7 +1665,6 @@ def find_simple_bar(should_upload: bool = True, server=None, return_local_path=F Examples -------- - >>> from ansys.dpf.core import examples >>> path = examples.find_simple_bar() >>> path @@ -1698,7 +1698,6 @@ def find_static_rst(should_upload: bool = True, server=None, return_local_path=F Examples -------- - >>> from ansys.dpf.core import examples >>> path = examples.find_static_rst() >>> path @@ -1730,7 +1729,6 @@ def find_complex_rst(should_upload: bool = True, server=None, return_local_path= Examples -------- - >>> from ansys.dpf.core import examples >>> path = examples.find_complex_rst() >>> path @@ -1762,7 +1760,6 @@ def find_multishells_rst(should_upload: bool = True, server=None, return_local_p Examples -------- - >>> from ansys.dpf.core import examples >>> path = examples.find_multishells_rst() >>> path @@ -1796,7 +1793,6 @@ def find_electric_therm(should_upload: bool = True, server=None, return_local_pa Examples -------- - >>> from ansys.dpf.core import examples >>> path = examples.find_electric_therm() >>> path @@ -1830,7 +1826,6 @@ def find_steady_therm(should_upload: bool = True, server=None, return_local_path Examples -------- - >>> from ansys.dpf.core import examples >>> path = examples.find_steady_therm() >>> path @@ -1864,7 +1859,6 @@ def find_transient_therm(should_upload: bool = True, server=None, return_local_p Examples -------- - >>> from ansys.dpf.core import examples >>> path = examples.find_transient_therm() >>> path @@ -1898,7 +1892,6 @@ def find_msup_transient(should_upload: bool = True, server=None, return_local_pa Examples -------- - >>> from ansys.dpf.core import examples >>> path = examples.find_msup_transient() >>> path @@ -1932,7 +1925,6 @@ def find_simple_cyclic(should_upload: bool = True, server=None, return_local_pat Examples -------- - >>> from ansys.dpf.core import examples >>> path = examples.find_simple_cyclic() >>> path @@ -1968,7 +1960,6 @@ def find_distributed_msup_folder( Examples -------- - >>> from ansys.dpf.core import examples >>> path = examples.find_distributed_msup_folder() >>> path @@ -2029,7 +2020,6 @@ def download_average_filter_plugin( Examples -------- - >>> from ansys.dpf.core import examples >>> path = examples.download_average_filter_plugin() @@ -2072,7 +2062,6 @@ def download_gltf_plugin( Examples -------- - >>> from ansys.dpf.core import examples >>> path = examples.download_gltf_plugin() @@ -2118,7 +2107,6 @@ def download_easy_statistics( Examples -------- - >>> from ansys.dpf.core import examples >>> path = examples.download_easy_statistics() diff --git a/src/ansys/dpf/core/examples/examples.py b/src/ansys/dpf/core/examples/examples.py index b6285df9bf..0d6693a40a 100644 --- a/src/ansys/dpf/core/examples/examples.py +++ b/src/ansys/dpf/core/examples/examples.py @@ -117,7 +117,6 @@ def fluid_axial_model() -> DataSources: Examples -------- - >>> from ansys.dpf.core import examples >>> ds = examples.fluid_axial_model() """ diff --git a/src/ansys/dpf/core/faces.py b/src/ansys/dpf/core/faces.py index 77a75b11fe..ec9b15ad5d 100644 --- a/src/ansys/dpf/core/faces.py +++ b/src/ansys/dpf/core/faces.py @@ -86,7 +86,7 @@ def node_ids(self): IDs of all nodes in the face. Returns - -------- + ------- list List of IDs for all nodes in the face. @@ -133,8 +133,9 @@ def index(self) -> int: def nodes(self): """ All nodes in the face. + Returns - -------- + ------- list List of all nodes in the face. @@ -206,7 +207,7 @@ def connectivity(self): Ordered list of node indices of the face. Returns - -------- + ------- list Ordered list of node indices. diff --git a/src/ansys/dpf/core/field.py b/src/ansys/dpf/core/field.py index 1bcd9a9234..ea04b6a529 100644 --- a/src/ansys/dpf/core/field.py +++ b/src/ansys/dpf/core/field.py @@ -81,6 +81,7 @@ class Field(_FieldBase): Server with the channel connected to the remote or local instance. The default is ``None``, in which case an attempt is made to use the global server. + Examples -------- Create a field from scratch. @@ -298,7 +299,7 @@ def location(self, value): """Change the field location. Parameters - ------- + ---------- location : str or locations Location string, Options are in :class:`locations `. @@ -539,7 +540,7 @@ def unit(self): """Units for the field. Returns - ---------- + ------- str Units for the field. @@ -839,7 +840,6 @@ def deep_copy(self, server=None): >>> deep_copy = field.deep_copy(server=other_server) """ - f = Field( nentities=len(self.scoping), location=self.location, diff --git a/src/ansys/dpf/core/field_base.py b/src/ansys/dpf/core/field_base.py index 8a35397596..75154dcf02 100644 --- a/src/ansys/dpf/core/field_base.py +++ b/src/ansys/dpf/core/field_base.py @@ -297,7 +297,6 @@ def scoping(self): >>> #The fourth elementary data of the field corresponds to >>> #the element id number 586 in the mesh """ - return self._get_scoping() @scoping.setter @@ -309,7 +308,7 @@ def get_entity_data(self, index): """Retrieves the elementary data of the scoping's index in an array. Returns - -------- + ------- numpy.ndarray Examples @@ -763,7 +762,6 @@ def data(self): [ 1.03542516e-02 -3.53018374e-03 -3.98914380e-05]] """ - if self._ncomp > 1: return np.array(self._data_copy).reshape( len(self._data_copy) // self._ncomp, self._ncomp @@ -815,7 +813,6 @@ def component_count(self): int Number of components in each elementary data of the field. """ - return self._ncomp @property diff --git a/src/ansys/dpf/core/fields_container.py b/src/ansys/dpf/core/fields_container.py index f939d12eef..cb28a0c86e 100644 --- a/src/ansys/dpf/core/fields_container.py +++ b/src/ansys/dpf/core/fields_container.py @@ -222,7 +222,6 @@ def get_fields(self, label_space): 2 """ - return super()._get_entries(label_space) def get_field(self, label_space_or_index): diff --git a/src/ansys/dpf/core/fields_container_factory.py b/src/ansys/dpf/core/fields_container_factory.py index 079175f3b3..34921a0267 100644 --- a/src/ansys/dpf/core/fields_container_factory.py +++ b/src/ansys/dpf/core/fields_container_factory.py @@ -23,7 +23,6 @@ """ fields_container_factory - Contains functions to simplify creating a fields container. """ diff --git a/src/ansys/dpf/core/fields_factory.py b/src/ansys/dpf/core/fields_factory.py index eac1d5c396..bed1d049ab 100644 --- a/src/ansys/dpf/core/fields_factory.py +++ b/src/ansys/dpf/core/fields_factory.py @@ -23,7 +23,6 @@ """ fields_factory - Contains functions to simplify creating fields. """ diff --git a/src/ansys/dpf/core/generic_data_container.py b/src/ansys/dpf/core/generic_data_container.py index b5e3a281fc..a8e8bb7dbd 100644 --- a/src/ansys/dpf/core/generic_data_container.py +++ b/src/ansys/dpf/core/generic_data_container.py @@ -137,7 +137,6 @@ def set_property( prop: Property object. """ - self._prop_description_instance = None if not isinstance(prop, (int, float, str, bytes, list, np.ndarray)) and server_meet_version( "8.1", self._server diff --git a/src/ansys/dpf/core/geometry.py b/src/ansys/dpf/core/geometry.py index 3ea8d1ca39..624d10fa03 100644 --- a/src/ansys/dpf/core/geometry.py +++ b/src/ansys/dpf/core/geometry.py @@ -387,7 +387,6 @@ def n_cells_y(self): def _discretize(self): """Discretize plane with a certain size and number of cells per direction.""" - # Get plane axis (local) from reference axis (global) and plane's normal self._axes_plane = get_plane_local_axis(self._normal_dir) diff --git a/src/ansys/dpf/core/help.py b/src/ansys/dpf/core/help.py index 519819aed6..ff55dfcfd9 100644 --- a/src/ansys/dpf/core/help.py +++ b/src/ansys/dpf/core/help.py @@ -195,6 +195,7 @@ def _norm_fc(fields): def _norm_op(oper): """Retrieve a chained norm operator. + Returns ------- oper : ansys.dpf.core.Operator @@ -288,7 +289,6 @@ def _min_max(field): oper : ansys.dpf.core.Operator Component-wise minimum/maximum operator over the input. """ - oper = dpf.core.Operator("min_max") oper.inputs.connect(field) return oper @@ -316,7 +316,6 @@ def _min_max_oper(oper): oper : ansys.dpf.core.Operator Component-wise minimum/maximum operator. """ - min_max_oper = dpf.core.Operator("min_max_fc") min_max_oper.connect(0, oper, 0) return min_max_oper @@ -424,7 +423,6 @@ def sqr(field): [ 1. 64.] """ - _check_type(field, (dpf.core.Field, dpf.core.FieldsContainer)) op = dpf.core.Operator("sqr") op.connect(0, field) diff --git a/src/ansys/dpf/core/log.py b/src/ansys/dpf/core/log.py index feb71afba0..2e941cf134 100644 --- a/src/ansys/dpf/core/log.py +++ b/src/ansys/dpf/core/log.py @@ -31,7 +31,6 @@ def setup_logger(loglevel="INFO"): loglevel : str, optional The level of the logger to set up. The default is ``"INFO"``. """ - # return existing log if this function has already been called if hasattr(setup_logger, "log"): setup_logger.log.setLevel(loglevel) diff --git a/src/ansys/dpf/core/mesh_info.py b/src/ansys/dpf/core/mesh_info.py index de40c9a980..ace555e976 100644 --- a/src/ansys/dpf/core/mesh_info.py +++ b/src/ansys/dpf/core/mesh_info.py @@ -109,7 +109,6 @@ def generic_data_container(self) -> GenericDataContainer: :class:`ansys.dpf.core.generic_data_container.GenericDataContainer` """ - return self._generic_data_container @generic_data_container.setter @@ -117,7 +116,6 @@ def generic_data_container(self, value: GenericDataContainer): """GenericDataContainer wrapped into the MeshInfo that contains all the relative information of the derived class. """ - if not isinstance(value, GenericDataContainer): raise ValueError("Input value must be a GenericDataContainer.") self._generic_data_container = value @@ -167,7 +165,6 @@ def set_property(self, property_name, prop): prop : Int, String, Float, Field, StringField, GenericDataContainer, Scoping object instance. """ - return self.generic_data_container.set_property(property_name, prop) @property @@ -178,7 +175,6 @@ def number_nodes(self): number_nodes : int Number of nodes of the mesh. """ - return self.generic_data_container.get_property("num_nodes") @property @@ -202,7 +198,6 @@ def number_elements(self): number_elements : int Number of elements of the mesh. """ - if "num_cells" in self._generic_data_container.get_property_description(): return self.generic_data_container.get_property("num_cells") else: @@ -216,7 +211,6 @@ def splittable_by(self): splittable by which entity : StringField Name of the properties according to which the mesh can be split by. """ - if "splittable_by" in self._generic_data_container.get_property_description(): return self.generic_data_container.get_property("splittable_by") else: @@ -230,7 +224,6 @@ def available_elem_types(self): available element types : Scoping element type available for the mesh. """ - if "available_elem_types" in self._generic_data_container.get_property_description(): return self.generic_data_container.get_property("available_elem_types") else: @@ -244,7 +237,6 @@ def part_names(self): part_names : StringField part names of the mesh (if it can be split by parts) """ - if "part_names" in self._generic_data_container.get_property_description(): return self.generic_data_container.get_property("part_names") else: @@ -284,7 +276,6 @@ def part_scoping(self): .. warning: Currently unavailable for LegacyGrpc servers. """ - if "part_scoping" in self._generic_data_container.get_property_description(): return self.generic_data_container.get_property("part_scoping") else: @@ -298,7 +289,6 @@ def body_names(self): body_names : StringField body names of the mesh (if it can be split by bodies) """ - if "body_names" in self._generic_data_container.get_property_description(): return self.generic_data_container.get_property("body_names") else: @@ -312,7 +302,6 @@ def body_scoping(self): body_scoping : Scoping body Scoping of the mesh (if it can be split by bodies) """ - if "body_scoping" in self._generic_data_container.get_property_description(): return self.generic_data_container.get_property("body_scoping") else: @@ -352,7 +341,6 @@ def zone_names(self): .. warning: Currently unavailable for LegacyGrpc servers. """ - if "zone_names" in self._generic_data_container.get_property_description(): return self.generic_data_container.get_property("zone_names") else: @@ -444,7 +432,6 @@ def zone_scoping(self): .. warning: Currently unavailable for LegacyGrpc servers. """ - if "zone_scoping" in self._generic_data_container.get_property_description(): return self.generic_data_container.get_property("zone_scoping") else: @@ -453,23 +440,19 @@ def zone_scoping(self): @number_nodes.setter def number_nodes(self, value): """Set the number of nodes in the mesh""" - self.generic_data_container.set_property("num_nodes", value) @number_elements.setter def number_elements(self, value): """Set the number of elements in the mesh""" - self.generic_data_container.set_property("num_elements", value) @splittable_by.setter def splittable_by(self, value): """Set name of the properties according to which the mesh can be split by""" - self.generic_data_container.set_property("splittable_by", value) @available_elem_types.setter def available_elem_types(self, value): """Set the available element types""" - self.generic_data_container.set_property("available_elem_types", value) diff --git a/src/ansys/dpf/core/mesh_scoping_factory.py b/src/ansys/dpf/core/mesh_scoping_factory.py index 51712f7f57..93927f2d06 100644 --- a/src/ansys/dpf/core/mesh_scoping_factory.py +++ b/src/ansys/dpf/core/mesh_scoping_factory.py @@ -23,7 +23,6 @@ """ mesh_scoping_factory - Contains functions to simplify creating mesh scopings. """ diff --git a/src/ansys/dpf/core/meshed_region.py b/src/ansys/dpf/core/meshed_region.py index fbd437fdfd..c6522fbcf6 100644 --- a/src/ansys/dpf/core/meshed_region.py +++ b/src/ansys/dpf/core/meshed_region.py @@ -481,6 +481,7 @@ def deform_by(self, deform_by, scale_factor=1.0): scale_factor : float, Field, FieldsContainer, optional Used to scale the mesh deformation. Defaults to 1.0. Can be a scalar Field (or a FieldsContainer with only one Field) to get a spatially non-homogeneous scaling. + Returns ------- diff --git a/src/ansys/dpf/core/misc.py b/src/ansys/dpf/core/misc.py index bc0b7354b7..13c202907e 100644 --- a/src/ansys/dpf/core/misc.py +++ b/src/ansys/dpf/core/misc.py @@ -201,6 +201,7 @@ def is_pypim_configured(): """Check if the environment is configured for PyPIM, without using pypim. This method is equivalent to ansys.platform.instancemanagement.is_configured(). It's reproduced here to avoid having hard dependencies. + Returns ------- bool diff --git a/src/ansys/dpf/core/model.py b/src/ansys/dpf/core/model.py index 88c4b4bf1f..1789cdceb2 100644 --- a/src/ansys/dpf/core/model.py +++ b/src/ansys/dpf/core/model.py @@ -66,7 +66,6 @@ class Model: def __init__(self, data_sources=None, server=None): """Initialize connection with DPF server.""" - if server is None: server = dpf.core._global_server() @@ -147,8 +146,8 @@ def results(self): Result provider helper wrapping all types of provider available for a given result file. - Examples - -------- + Examples + -------- >>> from ansys.dpf import core as dpf >>> from ansys.dpf.core import examples >>> model = dpf.Model(examples.find_electric_therm()) diff --git a/src/ansys/dpf/core/operator_specification.py b/src/ansys/dpf/core/operator_specification.py index 4b5bddecdd..0790cc3316 100644 --- a/src/ansys/dpf/core/operator_specification.py +++ b/src/ansys/dpf/core/operator_specification.py @@ -310,7 +310,7 @@ def __str__(self): @property def properties(self) -> dict: - """some additional properties of the Operator, like the category, the exposure, + """Some additional properties of the Operator, like the category, the exposure, the scripting and user names, and the plugin Examples @@ -768,7 +768,8 @@ def config_specification(self, val: list): @version_requires("4.0") def properties(self) -> SpecificationProperties: """Returns some additional properties of the Operator, like the category, the exposure, - the scripting and user names and the plugin""" + the scripting and user names and the plugin + """ return SpecificationProperties(**super().properties, spec=self) @properties.setter diff --git a/src/ansys/dpf/core/plotter.py b/src/ansys/dpf/core/plotter.py index 4f37685e3d..cddf0cba25 100644 --- a/src/ansys/dpf/core/plotter.py +++ b/src/ansys/dpf/core/plotter.py @@ -437,7 +437,7 @@ def labels(self): """Return a list of labels. Returns - -------- + ------- list List of Label(s). Each list member or member group will share same properties. diff --git a/src/ansys/dpf/core/results.py b/src/ansys/dpf/core/results.py index 98238f9e88..52cd158180 100644 --- a/src/ansys/dpf/core/results.py +++ b/src/ansys/dpf/core/results.py @@ -26,7 +26,8 @@ Results This module contains the Results and Result classes that are created by the model -to easily access results in result files.""" +to easily access results in result files. +""" import functools @@ -51,8 +52,8 @@ class Results: With this wrapper, time and mesh scopings can easily be customized. - Examples - -------- + Examples + -------- Create a displacement result from the model and choose its time and mesh scopings. >>> from ansys.dpf import core as dpf @@ -66,8 +67,8 @@ class Results: With this wrapper, time and mesh scopings, location, and more can easily be customized. - Examples - -------- + Examples + -------- Create a stress result from the model and choose its time and mesh scopings. >>> from ansys.dpf import core as dpf @@ -80,8 +81,8 @@ class Results: Result provider helper wrapping all types of providers available for a given result file. - Examples - -------- + Examples + -------- >>> from ansys.dpf import core as dpf >>> from ansys.dpf.core import examples >>> model = dpf.Model(examples.find_electric_therm()) @@ -428,7 +429,6 @@ def on_named_selection(self, named_selection): 40 """ - self._mesh_scoping = self._connector.named_selection(named_selection) return self diff --git a/src/ansys/dpf/core/scoping.py b/src/ansys/dpf/core/scoping.py index b91dc392b1..ec82109321 100644 --- a/src/ansys/dpf/core/scoping.py +++ b/src/ansys/dpf/core/scoping.py @@ -62,6 +62,7 @@ class Scoping: Server with channel connected to the remote or local instance. The default is ``None``, in which case an attempt is made to use the global server. + Examples -------- Create a mesh scoping. diff --git a/src/ansys/dpf/core/server.py b/src/ansys/dpf/core/server.py index 02ecefe77a..592f7a426e 100644 --- a/src/ansys/dpf/core/server.py +++ b/src/ansys/dpf/core/server.py @@ -338,7 +338,6 @@ def connect_to_server( Examples -------- - >>> from ansys.dpf import core as dpf Create a server. @@ -422,7 +421,6 @@ def available_servers(): Examples -------- - >>> from ansys.dpf import core as dpf >>> #out = dpf.server.available_servers() diff --git a/src/ansys/dpf/core/server_context.py b/src/ansys/dpf/core/server_context.py index 4bc602e361..0ccd59b573 100644 --- a/src/ansys/dpf/core/server_context.py +++ b/src/ansys/dpf/core/server_context.py @@ -23,7 +23,6 @@ """ ServerContext - Gives the ability to choose the context with which the server should be started. The context allows you to choose the licensing logic for operators. For every context, DPF always checks if an Ansys license is available. diff --git a/src/ansys/dpf/core/server_factory.py b/src/ansys/dpf/core/server_factory.py index 493fa5e094..9885147686 100644 --- a/src/ansys/dpf/core/server_factory.py +++ b/src/ansys/dpf/core/server_factory.py @@ -23,7 +23,6 @@ """ Server factory, server configuration and communication protocols - Contains the server factory as well as the communication protocols and server configurations available. """ diff --git a/src/ansys/dpf/core/server_types.py b/src/ansys/dpf/core/server_types.py index 398b7ce3bc..d56222d9e7 100644 --- a/src/ansys/dpf/core/server_types.py +++ b/src/ansys/dpf/core/server_types.py @@ -1036,7 +1036,7 @@ class LegacyGrpcServer(BaseServer): Kept for backward-compatibility with dpf servers <0.5.0. Parameters - ----------- + ---------- ansys_path : str Path for the DPF executable. ip : str diff --git a/src/ansys/dpf/core/settings.py b/src/ansys/dpf/core/settings.py index f5b61c1f1c..f4f921d16b 100644 --- a/src/ansys/dpf/core/settings.py +++ b/src/ansys/dpf/core/settings.py @@ -105,7 +105,6 @@ def set_dynamic_available_results_capability(value) -> None: Examples -------- - >>> from ansys.dpf import core as dpf >>> dpf.settings.set_dynamic_available_results_capability(False) >>> dpf.settings.set_dynamic_available_results_capability(True) diff --git a/src/ansys/dpf/core/time_freq_scoping_factory.py b/src/ansys/dpf/core/time_freq_scoping_factory.py index 985b10c67b..eacbaa313e 100644 --- a/src/ansys/dpf/core/time_freq_scoping_factory.py +++ b/src/ansys/dpf/core/time_freq_scoping_factory.py @@ -23,7 +23,6 @@ """ time_freq_scoping_factory - Contains functions to simplify creating time frequency scopings. """ @@ -188,7 +187,8 @@ def scoping_by_step_and_substep_from_model(load_step_id, subset_id, model, serve Returns ------- scoping : Scoping - Scoping based on a given step/substep of a model's time_freq_support.""" + Scoping based on a given step/substep of a model's time_freq_support. + """ return scoping_by_step_and_substep(load_step_id, subset_id, model.metadata.time_freq_support) diff --git a/src/ansys/dpf/core/time_freq_support.py b/src/ansys/dpf/core/time_freq_support.py index fe0afff160..3f8cef3633 100644 --- a/src/ansys/dpf/core/time_freq_support.py +++ b/src/ansys/dpf/core/time_freq_support.py @@ -337,7 +337,8 @@ def get_cumulative_index(self, step=0, substep=0, freq=None, cplx=False): def _get_cumulative_index(self, step, substep, freq, cplx): """Retrieve the cumulative index corresponding to the requested step/substep - or frequency.""" + or frequency. + """ if freq is None: if cplx is False: return self._api.time_freq_support_get_time_freq_cummulative_index_by_step( @@ -381,7 +382,6 @@ def _get_frequencies(self, cplx=False): field : dpf.core.Field Field of all the frequencies in the model (complex or real). """ - # attributes_list = self._get_attributes_list() if cplx: # and "freq_complex" in attributes_list: # return attributes_list["freq_complex"] @@ -471,7 +471,6 @@ def append_step( >>> tfq3.append_step(1, [0.1, 0.21, 1.0], rpm_value = 2.0, step_harmonic_indices = {1: [1.0, 2.0, 3.0], 2: [1.0, 2.0, 2.5]}) """ # noqa: E501 - time_frequencies = self.time_frequencies if time_frequencies is None: time_frequencies = core.Field( diff --git a/src/ansys/dpf/core/unit_system.py b/src/ansys/dpf/core/unit_system.py index 369b65bc3d..9b27a93322 100644 --- a/src/ansys/dpf/core/unit_system.py +++ b/src/ansys/dpf/core/unit_system.py @@ -126,7 +126,7 @@ class unit_systems: Class available with server's version starting at 6.1 (Ansys 2023R2). Attributes - ----------- + ---------- solver_mks : Metric (m, kg, N, s, J, Pa, degC, C, rad) solver_cgs : Metric (cm, g, dyne, s, erg, dyne*cm^-2, degC, C, rad) diff --git a/src/ansys/dpf/core/workflow.py b/src/ansys/dpf/core/workflow.py index 37deda3b89..415318ab33 100644 --- a/src/ansys/dpf/core/workflow.py +++ b/src/ansys/dpf/core/workflow.py @@ -133,7 +133,8 @@ def _api(self) -> workflow_abstract_api.WorkflowAbstractAPI: @version_requires("3.0") def progress_bar(self) -> bool: """With this property, the user can choose to print a progress bar when - the workflow's output is requested, default is True""" + the workflow's output is requested, default is True + """ return self._progress_bar @progress_bar.setter @@ -642,7 +643,7 @@ def get_recorded_workflow(id, server=None): ID given by the method "record". Returns - ---------- + ------- workflow : core.Workflow() workflow registered in dpf's registry (server side) @@ -672,7 +673,7 @@ def info(self): """Dictionary with the operator names and the exposed input and output names. Returns - ---------- + ------- info : dictionarry str->list str Dictionary with ``"operator_names"``, ``"input_names"``, and ``"output_names"`` key. """ @@ -687,7 +688,7 @@ def operator_names(self): """List of the names of operators added in the workflow. Returns - ---------- + ------- names : list str """ num = self._api.work_flow_number_of_operators(self) @@ -701,7 +702,7 @@ def input_names(self): """List of the input names exposed in the workflow with set_input_name. Returns - ---------- + ------- names : list str """ num = self._api.work_flow_number_of_input(self) @@ -715,7 +716,7 @@ def output_names(self): """List of the output names exposed in the workflow with set_output_name. Returns - ---------- + ------- names : list str """ num = self._api.work_flow_number_of_output(self)