From b0adcf7b67311687561db1e91fb8cfdd5a3ae76f Mon Sep 17 00:00:00 2001 From: Mainak Kundu Date: Thu, 5 Oct 2023 11:26:14 -0400 Subject: [PATCH 1/4] Fix docformatter issue --- .pre-commit-config.yaml | 38 +++++++++++++++++++------------------- pyproject.toml | 19 ++++++++++++++++--- 2 files changed, 35 insertions(+), 22 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 928699afdb8..27ac6fd75ee 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,24 +10,24 @@ repos: hooks: - id: isort -- repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 - hooks: - - id: flake8 - additional_dependencies: [ - 'flake8-annotations==2.9.0' - ] - args: [ - --exclude, src/ansys/fluent/core/meshing/tui* src/ansys/fluent/core/solver/tui* src/ansys/fluent/core/datamodel_222/* src/ansys/fluent/core/datamodel_231/* src/ansys/fluent/core/datamodel_232/* src/ansys/fluent/core/datamodel_241/* src/ansys/fluent/core/solver/settings_222/* src/ansys/fluent/core/solver/settings_231/* src/ansys/fluent/core/solver/settings_232/* src/ansys/fluent/core/solver/settings_241/*, - --select, W191 W291 W293 W391 E115 E117 E122 E124 E125 E225 E231 E301 E303 F401 F403 N801 N802 N803 N804 N805 N806, - #--select, W191 W291 W293 W391 E115 E117 E122 E124 E125 E225 E231 E301 E303 F401 F403 N801 N802 N803 N804 N805 N806 ANN001 ANN201 ANN205 ANN206, - --count, - --statistics, - --max-complexity, "10", - --max-line-length, "88", - --extend-ignore, E203 E501, - ansys, codegen, doc, examples, tests - ] +# - repo: https://github.com/PyCQA/flake8 +# rev: 6.0.0 +# hooks: +# - id: flake8 +# additional_dependencies: [ +# 'flake8-annotations==2.9.0' +# ] +# args: [ +# --exclude, src/ansys/fluent/core/meshing/tui* src/ansys/fluent/core/solver/tui* src/ansys/fluent/core/datamodel_222/* src/ansys/fluent/core/datamodel_231/* src/ansys/fluent/core/datamodel_232/* src/ansys/fluent/core/datamodel_241/* src/ansys/fluent/core/solver/settings_222/* src/ansys/fluent/core/solver/settings_231/* src/ansys/fluent/core/solver/settings_232/* src/ansys/fluent/core/solver/settings_241/*, +# --select, W191 W291 W293 W391 E115 E117 E122 E124 E125 E225 E231 E301 E303 F401 F403 N801 N802 N803 N804 N805 N806, +# #--select, W191 W291 W293 W391 E115 E117 E122 E124 E125 E225 E231 E301 E303 F401 F403 N801 N802 N803 N804 N805 N806 ANN001 ANN201 ANN205 ANN206, +# --count, +# --statistics, +# --max-complexity, "10", +# --max-line-length, "88", +# --extend-ignore, E203 E501, +# ansys, codegen, doc, examples, tests +# ] - repo: https://github.com/codespell-project/codespell rev: v2.2.2 @@ -37,7 +37,7 @@ repos: additional_dependencies: ["tomli"] - repo: https://github.com/PyCQA/docformatter - rev: v1.5.1 + rev: v1.7.5 hooks: - id: docformatter args: ["--config", "pyproject.toml"] diff --git a/pyproject.toml b/pyproject.toml index 56ca6663ca9..0de8a999412 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -80,9 +80,22 @@ exclude = [ "src/ansys/fluent/core/solver/settings_241/", "src/ansys/fluent/core/datamodel_241/" ] -pre-summary-space = true -wrap-descriptions = 88 -wrap-summaries = 88 +black = "true" +non-cap = [ + "initDatamodel", + "getAttributeValue", + "getState", + "setState", + "updateDict", + "deleteObject", + "executeCommand", + "createCommandArguments", + "deleteCommandArguments", + "getSpecs", + "getStaticInfo", + "subscribeEvents", + "unsubscribeEvents" +] [tool.coverage.run] From 61de03181e9597fbd7af7d2de19876603b815d04 Mon Sep 17 00:00:00 2001 From: Mainak Kundu Date: Thu, 5 Oct 2023 11:42:10 -0400 Subject: [PATCH 2/4] Format docs using docformatter --- doc/settings_rstgen.py | 6 +- examples/00-fluent/radiation_headlamp.py | 1 - src/ansys/fluent/core/data_model_cache.py | 4 +- src/ansys/fluent/core/examples/downloads.py | 6 +- src/ansys/fluent/core/file_session.py | 8 +- src/ansys/fluent/core/filereader/case_file.py | 41 +-- src/ansys/fluent/core/filereader/data_file.py | 20 +- src/ansys/fluent/core/filereader/lispy.py | 6 +- src/ansys/fluent/core/fluent_connection.py | 23 +- .../fluent/core/launcher/fluent_container.py | 1 - src/ansys/fluent/core/launcher/launcher.py | 19 +- src/ansys/fluent/core/logging.py | 18 +- .../fluent/core/meshing/meshing_workflow.py | 6 +- .../fluent/core/post_objects/post_helper.py | 6 +- .../post_objects/post_objects_container.py | 7 +- src/ansys/fluent/core/rpvars.py | 3 +- .../fluent/core/scheduler/load_machines.py | 20 +- .../fluent/core/scheduler/machine_list.py | 13 +- src/ansys/fluent/core/services/batch_ops.py | 4 +- .../fluent/core/services/datamodel_se.py | 47 ++- .../fluent/core/services/datamodel_tui.py | 20 +- src/ansys/fluent/core/services/field_data.py | 13 +- .../fluent/core/services/interceptors.py | 7 +- .../fluent/core/services/meshing_queries.py | 340 ++++++------------ src/ansys/fluent/core/services/reduction.py | 8 +- src/ansys/fluent/core/services/svar.py | 1 - src/ansys/fluent/core/session.py | 13 +- src/ansys/fluent/core/session_meshing.py | 7 +- src/ansys/fluent/core/session_pure_meshing.py | 10 +- src/ansys/fluent/core/session_solver.py | 11 +- src/ansys/fluent/core/session_solver_icing.py | 4 +- src/ansys/fluent/core/solver/error_message.py | 4 +- src/ansys/fluent/core/solver/flobject.py | 30 +- .../fluent/core/solver/function/reduction.py | 61 ++-- .../field_data_streaming.py | 2 +- .../transcript_streaming.py | 3 +- src/ansys/fluent/core/systemcoupling.py | 4 +- src/ansys/fluent/core/utils/execution.py | 19 +- src/ansys/fluent/core/utils/networking.py | 7 +- src/ansys/fluent/core/utils/search.py | 3 +- src/ansys/fluent/core/workflow.py | 107 +++--- tests/test_meshing_workflow.py | 21 +- tests/test_scheduler.py | 13 +- 43 files changed, 403 insertions(+), 564 deletions(-) diff --git a/doc/settings_rstgen.py b/doc/settings_rstgen.py index de42d65b56e..ae759915f7b 100644 --- a/doc/settings_rstgen.py +++ b/doc/settings_rstgen.py @@ -1,6 +1,6 @@ -"""Provide a module to generate the documentation classes for Fluent settings -tree. -Running this module generates a .rst files for the Fluent +"""Provide a module to generate the documentation classes for Fluent settings tree. +Running this module generates a .rst files for the Fluent. + settings classes. The out is placed at: - doc/source/api/solver/_autosummary/settings Process diff --git a/examples/00-fluent/radiation_headlamp.py b/examples/00-fluent/radiation_headlamp.py index cd73cd42d68..cdf9cdd00f1 100644 --- a/examples/00-fluent/radiation_headlamp.py +++ b/examples/00-fluent/radiation_headlamp.py @@ -25,7 +25,6 @@ lens focuses incoming radiation onto the internal components of the headlamp, producing thermal hotspots that could cause damage due to thermal stresses or material degradation. - """ ############################################################################### diff --git a/src/ansys/fluent/core/data_model_cache.py b/src/ansys/fluent/core/data_model_cache.py index ba64ae0b6b6..9179e85af7d 100644 --- a/src/ansys/fluent/core/data_model_cache.py +++ b/src/ansys/fluent/core/data_model_cache.py @@ -195,7 +195,7 @@ def _dm_path_comp_list(obj): @staticmethod def get_state(rules: str, obj: object) -> Any: - """Retrieve state from datamodel cache + """Retrieve state from datamodel cache. Parameters ---------- @@ -234,7 +234,7 @@ def _set_state_at_path(cache, path, value): @staticmethod def set_state(rules: str, obj: object, value: Any): - """Set datamodel cache state + """Set datamodel cache state. Parameters ---------- diff --git a/src/ansys/fluent/core/examples/downloads.py b/src/ansys/fluent/core/examples/downloads.py index 26d21c98a75..fda6864ac57 100644 --- a/src/ansys/fluent/core/examples/downloads.py +++ b/src/ansys/fluent/core/examples/downloads.py @@ -11,11 +11,13 @@ def delete_downloads(): - """Delete all downloaded examples from the default examples folder to free space or update the files. + """Delete all downloaded examples from the default examples folder to free space or + update the files. Notes ----- - The default examples path is given by ``pyfluent.EXAMPLES_PATH``.""" + The default examples path is given by ``pyfluent.EXAMPLES_PATH``. + """ shutil.rmtree(pyfluent.EXAMPLES_PATH) os.makedirs(pyfluent.EXAMPLES_PATH) diff --git a/src/ansys/fluent/core/file_session.py b/src/ansys/fluent/core/file_session.py index 823d38ecb85..25d9050da99 100644 --- a/src/ansys/fluent/core/file_session.py +++ b/src/ansys/fluent/core/file_session.py @@ -46,8 +46,8 @@ def __init__(self, file_session, field_info): def add_surfaces_request( self, surface_ids, provide_vertices=True, provide_faces=True ) -> None: - """Add request to get surface data (vertices, face connectivity, - centroids, and normals). + """Add request to get surface data (vertices, face connectivity, centroids, and + normals). Parameters ---------- @@ -665,7 +665,7 @@ def get_surfaces_info(self): class FileSession: def __init__(self): - """__init__ method of FileSession class""" + """__init__ method of FileSession class.""" self._case_file = None self._data_file = None self.field_info = FileFieldInfo(self) @@ -678,5 +678,5 @@ def read_case(self, case_filepath): self._case_file = CaseFile(case_filepath) def read_data(self, data_filepath): - """Read Data file""" + """Read Data file.""" self._data_file = DataFile(data_filepath, case_file_handle=self._case_file) diff --git a/src/ansys/fluent/core/filereader/case_file.py b/src/ansys/fluent/core/filereader/case_file.py index c1346b81bca..749a5a465d8 100644 --- a/src/ansys/fluent/core/filereader/case_file.py +++ b/src/ansys/fluent/core/filereader/case_file.py @@ -13,7 +13,6 @@ >>> reader = CaseFile(case_filepath=case_filepath) # Instantiate a CaseFile class >>> input_parameters = reader.input_parameters() # Get lists of input parameters >>> output_parameters = reader.output_parameters() # Get lists of output parameters - """ import codecs import gzip @@ -345,8 +344,7 @@ def __init__( self._config_vars = {v[0]: v[1] for v in self._rp_vars["case-config"]} def input_parameters(self) -> Union[List[InputParameter], List[InputParameterOld]]: - """ - Get the input parameters. + """Get the input parameters. Returns ------- @@ -369,8 +367,7 @@ def input_parameters(self) -> Union[List[InputParameter], List[InputParameterOld return [InputParameterOld(param) for param in rp_var_params] def output_parameters(self) -> List[OutputParameter]: - """ - Get the output parameters. + """Get the output parameters. Returns ------- @@ -381,8 +378,7 @@ def output_parameters(self) -> List[OutputParameter]: return [OutputParameter(param) for param in parameters] def num_dimensions(self) -> int: - """ - Get the dimensionality associated with this case. + """Get the dimensionality associated with this case. Returns ------- @@ -394,8 +390,7 @@ def num_dimensions(self) -> int: return 3 if attr[1] is True else 2 def precision(self) -> int: - """ - Get the precision associated with this case (single or double). + """Get the precision associated with this case (single or double). Returns ------- @@ -407,8 +402,7 @@ def precision(self) -> int: return 2 if attr[1] is True else 1 def iter_count(self) -> int: - """ - Get the number of iterations associated with this case. + """Get the number of iterations associated with this case. Returns ------- @@ -418,8 +412,7 @@ def iter_count(self) -> int: return self._find_rp_var("number-of-iterations") def rp_vars(self) -> dict: - """ - Get the rpvars associated with this case. + """Get the rpvars associated with this case. Returns ------- @@ -430,8 +423,7 @@ def rp_vars(self) -> dict: @property def rp_var(self) -> CaseVariable: - """ - Access the rpvars associated with this case. + """Access the rpvars associated with this case. Returns ------- @@ -441,8 +433,7 @@ def rp_var(self) -> CaseVariable: return CaseVariable(self._rp_vars) def has_rp_var(self, name: str) -> bool: - """ - Find if this case has the given rpvar. + """Find if this case has the given rpvar. Parameters ---------- @@ -457,8 +448,7 @@ def has_rp_var(self, name: str) -> bool: return name in self._rp_vars def config_vars(self) -> dict: - """ - Get the config variables associated with this case. + """Get the config variables associated with this case. Returns ------- @@ -469,8 +459,7 @@ def config_vars(self) -> dict: @property def config_var(self) -> CaseVariable: - """ - Access the config variables associated with this case. + """Access the config variables associated with this case. Returns ------- @@ -497,7 +486,8 @@ class SettingsFile(RPVarProcessor): """Class to read a Fluent Settings file.""" def __init__(self, settings_filepath: Optional[str] = None) -> None: - """Initialize a SettingsFile object. Exactly one file path argument must be specified. + """Initialize a SettingsFile object. Exactly one file path argument must be + specified. Parameters ---------- @@ -543,7 +533,8 @@ def __init__( case_filepath: Optional[str] = None, project_filepath: Optional[str] = None, ) -> None: - """Initialize a CaseFile object. Exactly one file path argument must be specified. + """Initialize a CaseFile object. Exactly one file path argument must be + specified. Parameters ---------- @@ -612,8 +603,8 @@ def get_mesh(self): def _get_processed_string(input_string: bytes) -> str: - """Processes the input string (binary) with help of an identifier to return - it in a format which can be parsed by lispy.parse(). + """Processes the input string (binary) with help of an identifier to return it in a + format which can be parsed by lispy.parse(). Parameters ---------- diff --git a/src/ansys/fluent/core/filereader/data_file.py b/src/ansys/fluent/core/filereader/data_file.py index 2f263d70493..7a116458082 100644 --- a/src/ansys/fluent/core/filereader/data_file.py +++ b/src/ansys/fluent/core/filereader/data_file.py @@ -98,9 +98,7 @@ def __init__( @property def case_file(self) -> str: - """ - Returns the name of the associated case file in string format. - """ + """Returns the name of the associated case file in string format.""" return self._settings["Case File"][0].decode() def variables(self) -> dict: @@ -109,14 +107,11 @@ def variables(self) -> dict: return {v[0]: v[1] for v in lispy.parse(data_vars_str)[1]} def get_phases(self) -> list: - """ - Returns list of phases available. - """ + """Returns list of phases available.""" return list(self._field_data.keys()) def get_face_variables(self, phase_name) -> list: - """ - Extracts face variables available for a particular phase. + """Extracts face variables available for a particular phase. Parameters ---------- @@ -130,8 +125,7 @@ def get_face_variables(self, phase_name) -> list: return self._field_data[phase_name]["faces"]["fields"][0].decode().split(";") def get_cell_variables(self, phase_name) -> list: - """ - Extracts cell variables available for a particular phase. + """Extracts cell variables available for a particular phase. Parameters ---------- @@ -147,8 +141,7 @@ def get_cell_variables(self, phase_name) -> list: def get_face_scalar_field_data( self, phase_name: str, field_name: str, surface_id: int ) -> np.array: - """ - Gets scalar field data for face. + """Gets scalar field data for face. Parameters ---------- @@ -178,8 +171,7 @@ def get_face_scalar_field_data( return np.zeros(max_id + 1 - min_id) def get_face_vector_field_data(self, phase_name: str, surface_id: int) -> np.array: - """ - Gets vector field data for face. + """Gets vector field data for face. Parameters ---------- diff --git a/src/ansys/fluent/core/filereader/lispy.py b/src/ansys/fluent/core/filereader/lispy.py index 29a9448022f..710c7fe1881 100644 --- a/src/ansys/fluent/core/filereader/lispy.py +++ b/src/ansys/fluent/core/filereader/lispy.py @@ -90,8 +90,7 @@ def __init__(self, file): self.line = "" def next_token(self): - """Return the next token, reading new text into line buffer if - needed.""" + """Return the next token, reading new text into line buffer if needed.""" while True: if self.line == "": self.line = self.file.readline() @@ -400,8 +399,7 @@ def eval(x, env=global_env): def expand(x, toplevel=False): - """Walk tree of x, making optimizations/fixes, and signaling - SyntaxError.""" + """Walk tree of x, making optimizations/fixes, and signaling SyntaxError.""" # require(x, x!=[]) # () => Error if x == []: return x diff --git a/src/ansys/fluent/core/fluent_connection.py b/src/ansys/fluent/core/fluent_connection.py index 2781bdb5156..1b3aa909962 100644 --- a/src/ansys/fluent/core/fluent_connection.py +++ b/src/ansys/fluent/core/fluent_connection.py @@ -75,7 +75,6 @@ def get_container(container_id_or_name: str) -> Union[bool, Container, None]: See `Docker container`_ for more information. .. _Docker container: https://docker-py.readthedocs.io/en/stable/containers.html#docker.models.containers.Container - """ if not isinstance(container_id_or_name, str): container_id_or_name = str(container_id_or_name) @@ -134,7 +133,8 @@ def set(self, name: str, details: str): self._details = details def clear(self): - """Method to clear the current error state, emptying the error name and details properties.""" + """Method to clear the current error state, emptying the error name and details + properties.""" self._name = "" self._details = "" @@ -142,8 +142,8 @@ def clear(self): @dataclass(frozen=True) class FluentConnectionProperties: """Stores Fluent connection properties, including connection IP, port and password; - Fluent Cortex working directory, process ID and hostname; - and whether Fluent was launched in a docker container. + Fluent Cortex working directory, process ID and hostname; and whether Fluent was + launched in a docker container. Examples -------- @@ -372,9 +372,7 @@ def __init__( FluentConnection._monitor_thread.cbs.append(self._finalizer) def force_exit(self): - """ - Immediately terminates the Fluent client, - losing unsaved progress and data. + """Immediately terminates the Fluent client, losing unsaved progress and data. Notes ----- @@ -433,9 +431,8 @@ def force_exit(self): logger.error("Could not find cleanup file.") def force_exit_container(self): - """ - Immediately terminates the Fluent client running inside a container, - losing unsaved progress and data. + """Immediately terminates the Fluent client running inside a container, losing + unsaved progress and data. Notes ----- @@ -497,9 +494,9 @@ def check_health(self) -> str: return self.health_check_service.status() def wait_process_finished(self, wait: Union[float, int, bool] = 60): - """Returns ``True`` if local Fluent processes have finished, - ``False`` if they are still running when wait limit (default 60 seconds) is reached. - Immediately cancels and returns ``None`` if ``wait`` is set to ``False``. + """Returns ``True`` if local Fluent processes have finished, ``False`` if they + are still running when wait limit (default 60 seconds) is reached. Immediately + cancels and returns ``None`` if ``wait`` is set to ``False``. Parameters ---------- diff --git a/src/ansys/fluent/core/launcher/fluent_container.py b/src/ansys/fluent/core/launcher/fluent_container.py index d7fd977c8d7..7a747304fde 100644 --- a/src/ansys/fluent/core/launcher/fluent_container.py +++ b/src/ansys/fluent/core/launcher/fluent_container.py @@ -47,7 +47,6 @@ 'working_dir': '/mnt/pyfluent'} >>> config_dict.update(image_name='custom_fluent', image_tag='v23.1.0', mem_limit='1g') >>> session = pyfluent.launch_fluent(container_dict=config_dict) - """ import logging import os diff --git a/src/ansys/fluent/core/launcher/launcher.py b/src/ansys/fluent/core/launcher/launcher.py index 3e6c111dbc1..09533644a9f 100644 --- a/src/ansys/fluent/core/launcher/launcher.py +++ b/src/ansys/fluent/core/launcher/launcher.py @@ -1,7 +1,7 @@ """Provides a module for launching Fluent. -This module supports both starting Fluent locally and connecting to a -remote instance with gRPC. +This module supports both starting Fluent locally and connecting to a remote instance +with gRPC. """ from enum import Enum import json @@ -86,8 +86,10 @@ def __str__(self): def get_ansys_version() -> str: """Return the version string corresponding to the most recent, available ANSYS - installation. The returned value is the string component of one of the members - of the FluentVersion class. + installation. + + The returned value is the string component of one of the members of the + FluentVersion class. """ for v in FluentVersion: if "AWP_ROOT" + "".join(str(v).split("."))[:-1] in os.environ: @@ -331,8 +333,8 @@ def _raise_exception_g_gu_in_windows_os(additional_arguments: str) -> None: def _update_launch_string_wrt_gui_options( launch_string: str, show_gui: Optional[bool] = None, additional_arguments: str = "" ) -> str: - """Checks for all gui options in additional arguments and updates the - launch string with hidden, if none of the options are met.""" + """Checks for all gui options in additional arguments and updates the launch string + with hidden, if none of the options are met.""" if (show_gui is False) or ( show_gui is None and (os.getenv("PYFLUENT_SHOW_SERVER_GUI") != "1") @@ -470,8 +472,8 @@ def launch_fluent( start_watchdog: Optional[bool] = None, **kwargs, ) -> Union[Meshing, PureMeshing, Solver, SolverIcing, dict]: - """Launch Fluent locally in server mode or connect to a running Fluent - server instance. + """Launch Fluent locally in server mode or connect to a running Fluent server + instance. Parameters ---------- @@ -871,7 +873,6 @@ def connect_to_fluent( :class:`~ansys.fluent.core.session_solver.Solver`, \ :class:`~ansys.fluent.core.session_solver_icing.SolverIcing`] Session object. - """ ip, port, password = _get_server_info(server_info_filepath, ip, port, password) fluent_connection = FluentConnection( diff --git a/src/ansys/fluent/core/logging.py b/src/ansys/fluent/core/logging.py index 626e77922f1..54fff702a14 100644 --- a/src/ansys/fluent/core/logging.py +++ b/src/ansys/fluent/core/logging.py @@ -1,6 +1,7 @@ """Module controlling PyFluent's logging functionality. -For a basic user guide, see the :ref:`logging user guide `.""" +For a basic user guide, see the :ref:`logging user guide `. +""" import logging.config import os from typing import Optional, Union @@ -11,7 +12,8 @@ def root_config(): - """Sets up the root PyFluent logger that outputs messages to stdout, but not to files.""" + """Sets up the root PyFluent logger that outputs messages to stdout, but not to + files.""" logger = logging.getLogger("pyfluent") logger.setLevel("WARNING") formatter = logging.Formatter("%(name)s %(levelname)s: %(message)s") @@ -28,7 +30,8 @@ def is_active() -> bool: def get_default_config() -> dict: - """Returns the default configuration dictionary obtained from parsing from the PyFluent ``logging_config.yaml`` file. + """Returns the default configuration dictionary obtained from parsing from the + PyFluent ``logging_config.yaml`` file. Examples -------- @@ -119,7 +122,10 @@ def enable(level: Union[str, int] = "DEBUG", custom_config: Optional[dict] = Non def get_logger(*args, **kwargs): - """Retrieves logger. Convenience wrapper for Python's :func:`logging.getLogger` function.""" + """Retrieves logger. + + Convenience wrapper for Python's :func:`logging.getLogger` function. + """ return logging.getLogger(*args, **kwargs) @@ -195,8 +201,8 @@ def list_loggers(): def configure_env_var() -> None: - """Verifies whether ``PYFLUENT_LOGGING`` environment variable was defined in the system. - Executed once automatically on PyFluent initialization. + """Verifies whether ``PYFLUENT_LOGGING`` environment variable was defined in the + system. Executed once automatically on PyFluent initialization. Notes ----- diff --git a/src/ansys/fluent/core/meshing/meshing_workflow.py b/src/ansys/fluent/core/meshing/meshing_workflow.py index 4b42583d3d2..08e02d985fb 100644 --- a/src/ansys/fluent/core/meshing/meshing_workflow.py +++ b/src/ansys/fluent/core/meshing/meshing_workflow.py @@ -1,4 +1,5 @@ -"""Meshing workflow specialization of the Workflow module that wraps and extends the core functionality.""" +"""Meshing workflow specialization of the Workflow module that wraps and extends the +core functionality.""" from __future__ import annotations @@ -10,7 +11,8 @@ class MeshingWorkflow(WorkflowWrapper): - """Meshing specialization of the WorkflowWrapper that extends the core functionality.""" + """Meshing specialization of the WorkflowWrapper that extends the core + functionality.""" def __init__( self, diff --git a/src/ansys/fluent/core/post_objects/post_helper.py b/src/ansys/fluent/core/post_objects/post_helper.py index 90393efa0f7..2b002aaa19a 100644 --- a/src/ansys/fluent/core/post_objects/post_helper.py +++ b/src/ansys/fluent/core/post_objects/post_helper.py @@ -13,7 +13,7 @@ def __init__(self, obj): @staticmethod def surface_name_on_server(local_surface_name): - """Returns the surface name on server""" + """Returns the surface name on server.""" return "_dummy_surface_for_pyfluent:" + local_surface_name.lower() def _get_api_handle(self): @@ -26,7 +26,7 @@ def _delete_if_exist_on_server(self): self.delete_surface_on_server() def create_surface_on_server(self): - """Creates the surface on server""" + """Creates the surface on server.""" if self.obj.definition.type() == "iso-surface": iso_surface = self.obj.definition.iso_surface field = iso_surface.field() @@ -86,7 +86,7 @@ def create_surface_on_server(self): raise RuntimeError("Surface creation failed.") def delete_surface_on_server(self): - """Deletes the surface on server""" + """Deletes the surface on server.""" self._get_api_handle().delete_surface(self._surface_name_on_server) def __init__(self, obj): diff --git a/src/ansys/fluent/core/post_objects/post_objects_container.py b/src/ansys/fluent/core/post_objects/post_objects_container.py index 6d753a38f8b..777d9f98085 100644 --- a/src/ansys/fluent/core/post_objects/post_objects_container.py +++ b/src/ansys/fluent/core/post_objects/post_objects_container.py @@ -1,13 +1,12 @@ -"""Module providing visualization objects to facilitate - integration with libraries like Matplotlib and pyvista.""" +"""Module providing visualization objects to facilitate integration with libraries like +Matplotlib and pyvista.""" import inspect from ansys.fluent.core.meta import PyLocalContainer class Container: - """ - Base class for containers, e.g. Plots, Graphics. + """Base class for containers, e.g. Plots, Graphics. Parameters ---------- diff --git a/src/ansys/fluent/core/rpvars.py b/src/ansys/fluent/core/rpvars.py index 80afbcec87f..6b73273a53c 100644 --- a/src/ansys/fluent/core/rpvars.py +++ b/src/ansys/fluent/core/rpvars.py @@ -60,8 +60,7 @@ def __call__(self, var: Optional[str] = None, val: Optional[Any] = None) -> Any: ) def allowed_values(self) -> List[str]: - """ - Returns list with the allowed rpvars names. + """Returns list with the allowed rpvars names. Returns ------- diff --git a/src/ansys/fluent/core/scheduler/load_machines.py b/src/ansys/fluent/core/scheduler/load_machines.py index 85191f5fb76..0cac960b291 100644 --- a/src/ansys/fluent/core/scheduler/load_machines.py +++ b/src/ansys/fluent/core/scheduler/load_machines.py @@ -1,9 +1,8 @@ """A module that provides machine list construction for distributed parallel environments, including queueing systems. -Currently supports UGE, LSF, PBS and SLURM by parsing the contents of -the PE_HOSTFILE, LSB_MCPU_HOSTS, PBS_NODEFILE and SLURM_JOB_NODELIST -variables, respectively. +Currently supports UGE, LSF, PBS and SLURM by parsing the contents of the PE_HOSTFILE, +LSB_MCPU_HOSTS, PBS_NODEFILE and SLURM_JOB_NODELIST variables, respectively. """ import csv import os @@ -181,8 +180,8 @@ def _parse_machine_data(machine_data): def _get_local_machine(ncores): - """Provide private module function to convert a core count into a machine - list for a local job.""" + """Provide private module function to convert a core count into a machine list for a + local job.""" import socket @@ -194,8 +193,8 @@ def _get_local_machine(ncores): def _restrict_machines_to_core_count(old_machine_list, ncores): - """Provide private module function to adjust the number of cores used per - machine based on a user-supplied core count. + """Provide private module function to adjust the number of cores used per machine + based on a user-supplied core count. Parameters ---------- @@ -302,8 +301,7 @@ def _construct_machine_list_pbs(host_filename): def _construct_machine_list_slurm(host_list): - """Provide a private module function to parse the SLURM host and task - lists. + """Provide a private module function to parse the SLURM host and task lists. The SLURM system provides a comma separated list of host names. The host names may be listed individually or consecutive host names may have IDs that @@ -466,8 +464,8 @@ def _construct_machine_list_ccs(host_list): def _construct_machine_list_manual(machine_info): - """Provide a private module function to convert a machine information list - into a list of machine objects.""" + """Provide a private module function to convert a machine information list into a + list of machine objects.""" machineList = MachineList() for m in machine_info: machineList.add(Machine(m["machine-name"], m["core-count"])) diff --git a/src/ansys/fluent/core/scheduler/machine_list.py b/src/ansys/fluent/core/scheduler/machine_list.py index 94d5379d143..1ec7cb0b2fe 100644 --- a/src/ansys/fluent/core/scheduler/machine_list.py +++ b/src/ansys/fluent/core/scheduler/machine_list.py @@ -1,5 +1,4 @@ -"""A module used to provide abstract machine objects for queue system -interfaces. +"""A module used to provide abstract machine objects for queue system interfaces. This module provides two objects that help with interfacing Python scripts with job scheduler environments: @@ -21,8 +20,7 @@ class Machine(object): - """Provides an interface for a single machine allocated by a queue - system.""" + """Provides an interface for a single machine allocated by a queue system.""" def __init__(self, hostName, numberOfCores, queueName=None, coreList=None): """Constructs a machine from the information provided. @@ -80,8 +78,7 @@ def core_list(self): class MachineList(object): - """Provides an interface to list of machines allocated by a queue - system.""" + """Provides an interface to list of machines allocated by a queue system.""" def __init__(self, machinesIn=[]): """Constructs and initializes an empty machine file object.""" @@ -129,8 +126,8 @@ def remove_empty_machines(self): self._machines = [m for m in self._machines if m.number_of_cores > 0] def move_local_host_to_front(self): - """Moves the local host machine to the front of the machine list, - creating it if it does not exist.""" + """Moves the local host machine to the front of the machine list, creating it if + it does not exist.""" import socket localHostName = socket.gethostname() diff --git a/src/ansys/fluent/core/services/batch_ops.py b/src/ansys/fluent/core/services/batch_ops.py index 829c06aeb49..2b5f4617b23 100644 --- a/src/ansys/fluent/core/services/batch_ops.py +++ b/src/ansys/fluent/core/services/batch_ops.py @@ -159,8 +159,8 @@ def __exit__(self, exc_type, exc_value, exc_tb): self._ops[i].update_result(response.status, response.response_body) def add_op(self, package: str, service: str, method: str, request): - """Queue a single batch operation. Only the non-getter operations will - be queued. + """Queue a single batch operation. Only the non-getter operations will be + queued. Parameters ---------- diff --git a/src/ansys/fluent/core/services/datamodel_se.py b/src/ansys/fluent/core/services/datamodel_se.py index 1ea9e2fa3da..65ba3f86705 100644 --- a/src/ansys/fluent/core/services/datamodel_se.py +++ b/src/ansys/fluent/core/services/datamodel_se.py @@ -26,8 +26,8 @@ class Attribute(Enum): - """Contains the standard names of data model attributes associated with the - data model service.""" + """Contains the standard names of data model attributes associated with the data + model service.""" IS_ACTIVE = "isActive" EXPOSURE_LEVEL = "exposureLevel" @@ -313,8 +313,8 @@ def __del__(self): class PyStateContainer(PyCallableStateObject): - """Object class using StateEngine based DatamodelService as backend. Use - this class instead of directly calling DatamodelService's method. + """Object class using StateEngine based DatamodelService as backend. Use this class + instead of directly calling DatamodelService's method. Methods ------- @@ -452,7 +452,7 @@ def __call__(self, *args, **kwargs): def add_on_attribute_changed( self, attribute: str, cb: Callable ) -> EventSubscription: - """Register a callback for when an attribute is changed + """Register a callback for when an attribute is changed. Parameters ---------- @@ -477,7 +477,7 @@ def add_on_attribute_changed( def add_on_command_attribute_changed( self, command: str, attribute: str, cb: Callable ) -> EventSubscription: - """Register a callback for when an attribute is changed + """Register a callback for when an attribute is changed. Parameters ---------- @@ -504,8 +504,8 @@ def add_on_command_attribute_changed( class PyMenu(PyStateContainer): - """Object class using StateEngine based DatamodelService as backend. Use - this class instead of directly calling DatamodelService's method. + """Object class using StateEngine based DatamodelService as backend. Use this class + instead of directly calling DatamodelService's method. Methods ------- @@ -682,7 +682,7 @@ def add_on_affected(self, cb: Callable) -> EventSubscription: def add_on_affected_at_type_path( self, child_type: str, cb: Callable ) -> EventSubscription: - """Register a callback for when the object is affected at child type + """Register a callback for when the object is affected at child type. Parameters ---------- @@ -705,7 +705,7 @@ def add_on_affected_at_type_path( return subscription def add_on_command_executed(self, command: str, cb: Callable) -> EventSubscription: - """Register a callback for when a command is executed + """Register a callback for when a command is executed. Parameters ---------- @@ -731,8 +731,7 @@ def add_on_command_executed(self, command: str, cb: Callable) -> EventSubscripti class PyParameter(PyStateContainer): """Object class using StateEngine based DatamodelService as backend. - Use this class instead of directly calling DatamodelService's - method. + Use this class instead of directly calling DatamodelService's method. """ def default_value(self): @@ -813,10 +812,9 @@ class PyDictionary(PyParameter): """ def update_dict(self, dict_state: Dict[str, Any]) -> None: - """Update the state of the current object if the current object - is a Dict in the data model, else throws RuntimeError - (currently not showing up in Python). Update is executed according - to dict.update semantics. + """Update the state of the current object if the current object is a Dict in the + data model, else throws RuntimeError (currently not showing up in Python). + Update is executed according to dict.update semantics. Parameters ---------- @@ -833,9 +831,8 @@ def update_dict(self, dict_state: Dict[str, Any]) -> None: class PyNamedObjectContainer: - """Container class using the StateEngine-based DatamodelService as the - backend. Use this class instead of directly calling the DatamodelService's - method. + """Container class using the StateEngine-based DatamodelService as the backend. Use + this class instead of directly calling the DatamodelService's method. Methods ------- @@ -984,9 +981,8 @@ def __delitem__(self, key: str): class PyCommand: - """Command class using the StateEngine-based DatamodelService as the - backend. Use this class instead of directly calling the DatamodelService's - method. + """Command class using the StateEngine-based DatamodelService as the backend. Use + this class instead of directly calling the DatamodelService's method. Methods ------- @@ -1369,8 +1365,8 @@ def __getattr__(self, name: str): class PySimpleMenuGeneric(PyMenu, PyDictionary): """A simple implementation of PyMenuGeneric applicable only for SINGLETONS. - This is required for the stand-alone datamodel server to avoid the - usage of 'service.get_specs' + This is required for the stand-alone datamodel server to avoid the usage of + 'service.get_specs' """ attrs = ("service", "rules", "path") @@ -1387,7 +1383,8 @@ def __getattr__(self, name: str): class PyNamedObjectContainerGeneric(PyNamedObjectContainer): - """Generic PyNamedObjectContainer class for when generated API code is not available.""" + """Generic PyNamedObjectContainer class for when generated API code is not + available.""" def __iter__(self): for name in self._get_child_object_display_names(): diff --git a/src/ansys/fluent/core/services/datamodel_tui.py b/src/ansys/fluent/core/services/datamodel_tui.py index f677d251745..6044a9f6f28 100644 --- a/src/ansys/fluent/core/services/datamodel_tui.py +++ b/src/ansys/fluent/core/services/datamodel_tui.py @@ -87,8 +87,7 @@ def get_static_info(self, request): def _convert_value_to_gvalue(val: Any, gval: Variant): - """Convert Python datatype to Value type of - google/protobuf/struct.proto.""" + """Convert Python datatype to Value type of google/protobuf/struct.proto.""" if isinstance(val, bool): gval.bool_value = val elif isinstance(val, int) or isinstance(val, float): @@ -108,8 +107,7 @@ def _convert_value_to_gvalue(val: Any, gval: Variant): def _convert_gvalue_to_value(gval: Variant): - """Convert Value type of google/protobuf/struct.proto to Python - datatype.""" + """Convert Value type of google/protobuf/struct.proto to Python datatype.""" if gval.HasField("bool_value"): return gval.bool_value elif gval.HasField("number_value"): @@ -129,8 +127,8 @@ def _convert_gvalue_to_value(gval: Variant): class PyMenu: - """Pythonic wrapper of TUI-based DatamodelService class. Use this class - instead of directly calling the DatamodelService's method. + """Pythonic wrapper of TUI-based DatamodelService class. Use this class instead of + directly calling the DatamodelService's method. Methods ------- @@ -193,8 +191,7 @@ def _execute_query( return _convert_gvalue_to_value(ret.result) def execute(self, *args, **kwargs) -> Any: - """Execute a command or query at a path with positional or keyword - arguments. + """Execute a command or query at a path with positional or keyword arguments. Parameters ---------- @@ -325,8 +322,7 @@ def __getattribute__(self, name): class TUICommand(TUIMenu): - """Generic command class for when the explicit menu classes aren't - available.""" + """Generic command class for when the explicit menu classes aren't available.""" def __call__(self, *args, **kwargs): return PyMenu(self._service, self._version, self._mode, self._path).execute( @@ -355,8 +351,8 @@ def convert_tui_menu_to_func_name(menu: str) -> str: def convert_path_to_grpc_path(path: Path) -> str: - """Convert a path structure to a string that can be passed to the data - model gRPC service. + """Convert a path structure to a string that can be passed to the data model gRPC + service. Parameters ---------- diff --git a/src/ansys/fluent/core/services/field_data.py b/src/ansys/fluent/core/services/field_data.py index 23cd2e70a2c..745fd1b5388 100644 --- a/src/ansys/fluent/core/services/field_data.py +++ b/src/ansys/fluent/core/services/field_data.py @@ -469,8 +469,8 @@ def add_surfaces_request( provide_faces_centroid: Optional[bool] = False, provide_faces_normal: Optional[bool] = False, ) -> None: - """Add request to get surface data (vertices, face connectivity, - centroids, and normals). + """Add request to get surface data (vertices, face connectivity, centroids, and + normals). Parameters ---------- @@ -792,7 +792,6 @@ class ChunkParser: zone_id : int field_name : str field : numpy array - """ def __init__(self, callbacks_provider: object = None): @@ -800,8 +799,9 @@ def __init__(self, callbacks_provider: object = None): self._callbacks_provider = callbacks_provider def extract_fields(self, chunk_iterator) -> Dict[int, Dict[str, np.array]]: - """Extracts field data received from Fluent. if callbacks_provider is set - then callbacks are triggered with extracted data. + """Extracts field data received from Fluent. + + if callbacks_provider is set then callbacks are triggered with extracted data. """ def _get_tag_for_surface_request(): @@ -1253,8 +1253,7 @@ def get_surface_data( Union[Vertices, FacesConnectivity, FacesNormal, FacesCentroid], Dict[int, Union[Vertices, FacesConnectivity, FacesNormal, FacesCentroid]], ]: - """Get surface data (vertices, faces connectivity, centroids, and - normals). + """Get surface data (vertices, faces connectivity, centroids, and normals). Parameters ---------- diff --git a/src/ansys/fluent/core/services/interceptors.py b/src/ansys/fluent/core/services/interceptors.py index d940aa24784..a2dc6ba0414 100644 --- a/src/ansys/fluent/core/services/interceptors.py +++ b/src/ansys/fluent/core/services/interceptors.py @@ -62,7 +62,8 @@ def intercept_unary_unary( class ErrorStateInterceptor(grpc.UnaryUnaryClientInterceptor): - """Interceptor class to check Fluent server error state before gRPC calls are made.""" + """Interceptor class to check Fluent server error state before gRPC calls are + made.""" def __init__(self, fluent_error_state): """__init__ method of ErrorStateInterceptor class.""" @@ -95,8 +96,8 @@ def intercept_unary_unary( class BatchedFuture(grpc.Future): """Class implementing gRPC.Future interface. - An instance of BatchedFuture is returned if the gRPC method is - queued to be executed in batch later. + An instance of BatchedFuture is returned if the gRPC method is queued to be executed + in batch later. """ def __init__(self, result_cls): diff --git a/src/ansys/fluent/core/services/meshing_queries.py b/src/ansys/fluent/core/services/meshing_queries.py index 59bdb498b39..fc769dc0867 100644 --- a/src/ansys/fluent/core/services/meshing_queries.py +++ b/src/ansys/fluent/core/services/meshing_queries.py @@ -17,9 +17,7 @@ class MeshingQueriesService: - """ - Meshing Queries Service. - """ + """Meshing Queries Service.""" def __init__( self, channel: grpc.Channel, metadata: List[Tuple[str, str]], fluent_error_state @@ -209,7 +207,8 @@ def get_adjacent_interior_and_boundary_face_zones( self, request: MeshingQueriesProtoModule.GetAdjacentInteriorAndBoundaryFaceZonesRequest, ) -> MeshingQueriesProtoModule.GetAdjacentInteriorAndBoundaryFaceZonesResponse: - """get_adjacent_interior_and_boundary_face_zones rpc of MeshingQueriesService.""" + """get_adjacent_interior_and_boundary_face_zones rpc of + MeshingQueriesService.""" return self._stub.GetAdjacentInteriorAndBoundaryFaceZones( request, metadata=self._metadata ) @@ -257,7 +256,8 @@ def get_face_zones_with_zone_specific_prisms_applied( self, request: MeshingQueriesProtoModule.Empty, ) -> MeshingQueriesProtoModule.GetFaceZonesWithZoneSpecificPrismsAppliedResponse: - """get_face_zones_with_zone_specific_prisms_applied rpc of MeshingQueriesService.""" + """get_face_zones_with_zone_specific_prisms_applied rpc of + MeshingQueriesService.""" return self._stub.GetFaceZonesWithZoneSpecificPrismsApplied( request, metadata=self._metadata ) @@ -353,7 +353,8 @@ def get_unreferenced_edge_zone_id_list_of_pattern( self, request: MeshingQueriesProtoModule.GetUnreferencedEdgeZoneIdListOfPatternRequest, ) -> MeshingQueriesProtoModule.GetUnreferencedEdgeZoneIdListOfPatternResponse: - """get_unreferenced_edge_zone_id_list_of_pattern rpc of MeshingQueriesService.""" + """get_unreferenced_edge_zone_id_list_of_pattern rpc of + MeshingQueriesService.""" return self._stub.GetUnreferencedEdgeZoneIdListOfPattern( request, metadata=self._metadata ) @@ -363,7 +364,8 @@ def get_unreferenced_face_zone_id_list_of_pattern( self, request: MeshingQueriesProtoModule.GetUnreferencedFaceZoneIdListOfPatternRequest, ) -> MeshingQueriesProtoModule.GetUnreferencedFaceZoneIdListOfPatternResponse: - """get_unreferenced_face_zone_id_list_of_pattern rpc of MeshingQueriesService.""" + """get_unreferenced_face_zone_id_list_of_pattern rpc of + MeshingQueriesService.""" return self._stub.GetUnreferencedFaceZoneIdListOfPattern( request, metadata=self._metadata ) @@ -373,7 +375,8 @@ def get_unreferenced_cell_zone_id_list_of_pattern( self, request: MeshingQueriesProtoModule.GetUnreferencedCellZoneIdListOfPatternRequest, ) -> MeshingQueriesProtoModule.GetUnreferencedCellZoneIdListOfPatternResponse: - """get_unreferenced_cell_zone_id_list_of_pattern rpc of MeshingQueriesService.""" + """get_unreferenced_cell_zone_id_list_of_pattern rpc of + MeshingQueriesService.""" return self._stub.GetUnreferencedCellZoneIdListOfPattern( request, metadata=self._metadata ) @@ -606,9 +609,7 @@ def get_region_name_list_of_face_zones( class MeshingQueries: - """ - Meshing Queries. - """ + """Meshing Queries.""" def __init__(self, service: MeshingQueriesService): """__init__ method of MeshingQueries class.""" @@ -619,36 +620,28 @@ def __init__(self, service: MeshingQueriesService): docstring = None def __get_allowed_region_type(self, region_type): - """ - Check region_type in available regions. - """ + """Check region_type in available regions.""" if region_type not in self.region_types: raise ValueError(f"Allowed region types - {self.region_types}\n") def _get_allowed_orders(self, order): - """ - Check order in available orders. - """ + """Check order in available orders.""" if order not in self.orders: raise ValueError(f"Allowed orders - {self.orders}\n") def get_all_object_name_list(self) -> Any: - """ - Return a list of all objects. + """Return a list of all objects. .. code-block:: python >>> meshing_session.meshing_queries.get_all_object_name_list() - """ request = MeshingQueriesProtoModule.Empty() response = self.service.get_all_object_name_list(request) return response.objects def _get_allowed_object(self, object): - """ - Check object in available objects. - """ + """Check object in available objects.""" allowed_args = [args for args in self.get_all_object_name_list()] if isinstance(object, list): for obj in object: @@ -658,13 +651,11 @@ def _get_allowed_object(self, object): raise ValueError(f"Allowed objects - {allowed_args}\n") def get_region_name_list_of_object(self, object) -> Any: - """ - Return a list of regions in the specified object. + """Return a list of regions in the specified object. .. code-block:: python >>> meshing_session.meshing_queries.get_region_name_list_of_object("elbow-fluid") - """ self._get_allowed_object(object) request = MeshingQueriesProtoModule.GetRegionNameListOfObjectRequest() @@ -673,9 +664,7 @@ def get_region_name_list_of_object(self, object) -> Any: return response.regions def _get_allowed_region(self, region): - """ - Check region in available regions. - """ + """Check region in available regions.""" objects = [objs for objs in self.get_all_object_name_list()] regions = [] for obj in objects: @@ -688,15 +677,13 @@ def _get_allowed_region(self, region): raise ValueError(f"Allowed regions - {regions}\n") def get_face_zone_at_location(self, location) -> Any: - """ - Return face zone at or closest to a specified location. + """Return face zone at or closest to a specified location. Note: This function is not applicable to polyhedral meshes. .. code-block:: python >>> meshing_session.meshing_queries.get_face_zone_at_location([1.4, 1.4, 1.4]) - """ request = MeshingQueriesProtoModule.GetFaceZoneAtLocationRequest() request.location.x = location[0] @@ -706,13 +693,11 @@ def get_face_zone_at_location(self, location) -> Any: return response.face_zone_id def get_cell_zone_at_location(self, location) -> Any: - """ - Return cell zone at or closest to a specified location. + """Return cell zone at or closest to a specified location. .. code-block:: python >>> meshing_session.meshing_queries.get_cell_zone_at_location([1.4, 1.4, 1.4]) - """ request = MeshingQueriesProtoModule.GetCellZoneAtLocationRequest() request.location.x = location[0] @@ -722,13 +707,11 @@ def get_cell_zone_at_location(self, location) -> Any: return response.cell_zone_id def get_zones_of_type(self, type) -> Any: - """ - Return a list of zones of the specified default zone type. + """Return a list of zones of the specified default zone type. .. code-block:: python >>> meshing_session.meshing_queries.get_zones_of_type("velocity-inlet") - """ request = MeshingQueriesProtoModule.GetZonesOfTypeRequest() request.type = type @@ -736,13 +719,12 @@ def get_zones_of_type(self, type) -> Any: return response.zone_ids def get_zones_of_group(self, group) -> Any: - """ - Return a list of zones of the specified default zone group or user-defined group. + """Return a list of zones of the specified default zone group or user-defined + group. .. code-block:: python >>> meshing_session.meshing_queries.get_zones_of_group("inlet") - """ request = MeshingQueriesProtoModule.GetZonesOfGroupRequest() request.group = group @@ -750,13 +732,11 @@ def get_zones_of_group(self, group) -> Any: return response.zone_ids def get_face_zones_of_filter(self, filter) -> Any: - """ - Return a list of face zones whose names contain the specified filter string. + """Return a list of face zones whose names contain the specified filter string. .. code-block:: python >>> meshing_session.meshing_queries.get_face_zones_of_filter("*") - """ request = MeshingQueriesProtoModule.GetFaceZonesOfFilterRequest() request.filter = filter @@ -764,13 +744,11 @@ def get_face_zones_of_filter(self, filter) -> Any: return response.face_zone_ids def get_cell_zones_of_filter(self, filter) -> Any: - """ - Return a list of cell zones whose names contain the specified filter string. + """Return a list of cell zones whose names contain the specified filter string. .. code-block:: python >>> meshing_session.meshing_queries.get_cell_zones_of_filter("*") - """ request = MeshingQueriesProtoModule.GetCellZonesOfFilterRequest() request.filter = filter @@ -778,13 +756,11 @@ def get_cell_zones_of_filter(self, filter) -> Any: return response.cell_zone_ids def get_edge_zones_of_filter(self, filter) -> Any: - """ - Return a list of edge zones whose names contain the specified filter string. + """Return a list of edge zones whose names contain the specified filter string. .. code-block:: python >>> meshing_session.meshing_queries.get_edge_zones_of_filter("*") - """ request = MeshingQueriesProtoModule.GetEdgeZonesOfFilterRequest() request.filter = filter @@ -792,13 +768,11 @@ def get_edge_zones_of_filter(self, filter) -> Any: return response.edge_zone_ids def get_node_zones_of_filter(self, filter) -> Any: - """ - Return a list of node zones whose names contain the specified filter string. + """Return a list of node zones whose names contain the specified filter string. .. code-block:: python >>> meshing_session.meshing_queries.get_node_zones_of_filter("*") - """ request = MeshingQueriesProtoModule.GetNodeZonesOfFilterRequest() request.filter = filter @@ -806,13 +780,11 @@ def get_node_zones_of_filter(self, filter) -> Any: return response.node_zone_ids def get_objects_of_type(self, type) -> Any: - """ - Return a list of objects of the specified type. + """Return a list of objects of the specified type. .. code-block:: python >>> meshing_session.meshing_queries.get_objects_of_type("mesh") - """ request = MeshingQueriesProtoModule.GetObjectsOfTypeRequest() request.type = type @@ -820,13 +792,12 @@ def get_objects_of_type(self, type) -> Any: return response.objects def get_face_zone_id_list_of_object(self, object) -> Any: - """ - Return a list of face zones by ID in the specified face zone labels of an object. + """Return a list of face zones by ID in the specified face zone labels of an + object. .. code-block:: python >>> meshing_session.meshing_queries.get_face_zone_id_list_of_object("elbow-fluid") - """ self._get_allowed_object(object) request = MeshingQueriesProtoModule.GetFaceZoneIdListOfObjectRequest() @@ -835,13 +806,12 @@ def get_face_zone_id_list_of_object(self, object) -> Any: return response.face_zone_ids def get_edge_zone_id_list_of_object(self, object) -> Any: - """ - Return a list of edge zones by ID in the specified face zone labels of an object. + """Return a list of edge zones by ID in the specified face zone labels of an + object. .. code-block:: python >>> meshing_session.meshing_queries.get_edge_zone_id_list_of_object("elbow-fluid") - """ self._get_allowed_object(object) request = MeshingQueriesProtoModule.GetEdgeZoneIdListOfObjectRequest() @@ -850,13 +820,12 @@ def get_edge_zone_id_list_of_object(self, object) -> Any: return response.edge_zone_ids def get_cell_zone_id_list_of_object(self, object) -> Any: - """ - Return a list of cell zones by ID in the specified face zone labels of an object. + """Return a list of cell zones by ID in the specified face zone labels of an + object. .. code-block:: python >>> meshing_session.meshing_queries.get_cell_zone_id_list_of_object("elbow-fluid") - """ self._get_allowed_object(object) request = MeshingQueriesProtoModule.GetCellZoneIdListOfObjectRequest() @@ -865,14 +834,12 @@ def get_cell_zone_id_list_of_object(self, object) -> Any: return response.cell_zone_ids def get_face_zones_shared_by_regions_of_type(self, mesh_object, region_type) -> Any: - """ - Return a list of face zones shared by regions of specified types in the mesh object specified, - where region-type is fluid-fluid, solid-solid, or fluid-solid. + """Return a list of face zones shared by regions of specified types in the mesh + object specified, where region-type is fluid-fluid, solid-solid, or fluid-solid. .. code-block:: python >>> meshing_session.meshing_queries.get_face_zones_shared_by_regions_of_type("elbow-fluid", "fluid-fluid") - """ self._get_allowed_object(mesh_object) self.__get_allowed_region_type(region_type) @@ -883,13 +850,11 @@ def get_face_zones_shared_by_regions_of_type(self, mesh_object, region_type) -> return response.shared_face_zone_ids def get_face_zones_of_regions(self, object, region_name_list) -> Any: - """ - Return a list of face zones in the specified regions. + """Return a list of face zones in the specified regions. .. code-block:: python >>> meshing_session.meshing_queries.get_face_zones_of_regions("elbow-fluid", ["fluid"]) - """ self._get_allowed_object(object) self._get_allowed_region(region_name_list) @@ -901,13 +866,12 @@ def get_face_zones_of_regions(self, object, region_name_list) -> Any: return response.zone_ids def get_face_zones_of_labels(self, object, label_name_list) -> Any: - """ - Return a list of face zones in the specified face zone labels of the object specified. + """Return a list of face zones in the specified face zone labels of the object + specified. .. code-block:: python >>> meshing_session.meshing_queries.get_face_zones_of_labels("elbow-fluid", ["inlet", "outlet", "wall", "internal"]) - """ request = MeshingQueriesProtoModule.GetFaceZonesOfLabelsRequest() request.object = object @@ -917,13 +881,12 @@ def get_face_zones_of_labels(self, object, label_name_list) -> Any: return response.zone_ids def get_face_zone_id_list_of_labels(self, object, zone_label_list) -> Any: - """ - Return a list of face zones by ID in the specified face zone labels of an object. + """Return a list of face zones by ID in the specified face zone labels of an + object. .. code-block:: python >>> meshing_session.meshing_queries.get_face_zone_id_list_of_labels("elbow-fluid", ["outlet"]) - """ request = MeshingQueriesProtoModule.GetFaceZoneIdListOfLabelsRequest() request.object = object @@ -933,13 +896,11 @@ def get_face_zone_id_list_of_labels(self, object, zone_label_list) -> Any: return response.zone_ids def get_face_zones_of_objects(self, object_list) -> Any: - """ - Return a list of face zones in the specified objects. + """Return a list of face zones in the specified objects. .. code-block:: python >>> meshing_session.meshing_queries.get_face_zones_of_objects(["elbow-fluid"]) - """ self._get_allowed_object(object_list) request = MeshingQueriesProtoModule.GetFaceZonesOfObjectsRequest() @@ -949,13 +910,11 @@ def get_face_zones_of_objects(self, object_list) -> Any: return response.face_zone_ids def get_edge_zones_of_objects(self, object_list) -> Any: - """ - Return a list of edge zones in the specified objects. + """Return a list of edge zones in the specified objects. .. code-block:: python >>> meshing_session.meshing_queries.get_edge_zones_of_objects(["elbow-fluid"]) - """ self._get_allowed_object(object_list) request = MeshingQueriesProtoModule.GetEdgeZonesOfObjectsRequest() @@ -965,13 +924,11 @@ def get_edge_zones_of_objects(self, object_list) -> Any: return response.edge_zone_ids def get_face_zone_id_list_of_regions(self, object, region_list) -> Any: - """ - Return a list of face zones by ID in the specified regions of an object. + """Return a list of face zones by ID in the specified regions of an object. .. code-block:: python >>> meshing_session.meshing_queries.get_face_zone_id_list_of_regions("elbow-fluid", ["fluid"]) - """ self._get_allowed_object(object) self._get_allowed_region(region_list) @@ -983,15 +940,13 @@ def get_face_zone_id_list_of_regions(self, object, region_list) -> Any: return response.zone_ids def get_prism_cell_zones(self, list_or_pattern) -> Any: - """ - Return a list of prism cell zones. + """Return a list of prism cell zones. .. code-block:: python >>> meshing_session.meshing_queries.get_prism_cell_zones(["inlet", "outlet"]) >>> meshing_session.meshing_queries.get_prism_cell_zones("*") - """ request = MeshingQueriesProtoModule.GetPrismCellZonesRequest() if isinstance(list_or_pattern, str): @@ -1003,15 +958,13 @@ def get_prism_cell_zones(self, list_or_pattern) -> Any: return response.prism_cell_zones def get_tet_cell_zones(self, list_or_pattern) -> Any: - """ - Return a list of tet cell zones. + """Return a list of tet cell zones. .. code-block:: python >>> meshing_session.meshing_queries.get_tet_cell_zones(["inlet", "outlet"]) >>> meshing_session.meshing_queries.get_tet_cell_zones("*") - """ request = MeshingQueriesProtoModule.GetTetCellZonesRequest() if isinstance(list_or_pattern, str): @@ -1023,15 +976,13 @@ def get_tet_cell_zones(self, list_or_pattern) -> Any: return response.tet_cell_zones def get_adjacent_cell_zones(self, list_or_name_or_pattern) -> Any: - """ - Return adjacent cell zones for given face zone. + """Return adjacent cell zones for given face zone. .. code-block:: python >>> meshing_session.meshing_queries.get_adjacent_cell_zones([30]) >>> meshing_session.meshing_queries.get_adjacent_cell_zones("*") - """ request = MeshingQueriesProtoModule.GetAdjacentCellZonesRequest() if isinstance(list_or_name_or_pattern, str): @@ -1043,15 +994,13 @@ def get_adjacent_cell_zones(self, list_or_name_or_pattern) -> Any: return response.adjacent_cell_zones def get_adjacent_face_zones(self, list_or_name_or_pattern) -> Any: - """ - Return adjacent boundary face zones for given cell zones. + """Return adjacent boundary face zones for given cell zones. .. code-block:: python >>> meshing_session.meshing_queries.get_adjacent_face_zones([3460]) >>> meshing_session.meshing_queries.get_adjacent_face_zones("*") - """ request = MeshingQueriesProtoModule.GetAdjacentFaceZonesRequest() if isinstance(list_or_name_or_pattern, str): @@ -1065,8 +1014,7 @@ def get_adjacent_face_zones(self, list_or_name_or_pattern) -> Any: def get_adjacent_interior_and_boundary_face_zones( self, list_or_name_or_pattern ) -> Any: - """ - Return adjacent interior and boundary face zones for given cell zones. + """Return adjacent interior and boundary face zones for given cell zones. .. code-block:: python @@ -1075,7 +1023,6 @@ def get_adjacent_interior_and_boundary_face_zones( >>> meshing_session.meshing_queries.get_adjacent_interior_and_boundary_face_zones("fluid") >>> meshing_session.meshing_queries.get_adjacent_interior_and_boundary_face_zones("*") - """ request = ( MeshingQueriesProtoModule.GetAdjacentInteriorAndBoundaryFaceZonesRequest() @@ -1089,15 +1036,13 @@ def get_adjacent_interior_and_boundary_face_zones( return response.adjacent_interior_and_boundary_face_zones def get_adjacent_zones_by_edge_connectivity(self, list_or_name_or_pattern) -> Any: - """ - Return adjacent zones based on edge connectivity. + """Return adjacent zones based on edge connectivity. .. code-block:: python >>> meshing_session.meshing_queries.get_adjacent_zones_by_edge_connectivity([30]) >>> meshing_session.meshing_queries.get_adjacent_zones_by_edge_connectivity("*") - """ request = MeshingQueriesProtoModule.GetAdjacentZonesByEdgeConnectivityRequest() if isinstance(list_or_name_or_pattern, str): @@ -1109,15 +1054,13 @@ def get_adjacent_zones_by_edge_connectivity(self, list_or_name_or_pattern) -> An return response.adjacent_zone_ids def get_adjacent_zones_by_node_connectivity(self, list_or_name_or_pattern) -> Any: - """ - Return adjacent zones based on node connectivity. + """Return adjacent zones based on node connectivity. .. code-block:: python >>> meshing_session.meshing_queries.get_adjacent_zones_by_node_connectivity([30]) >>> meshing_session.meshing_queries.get_adjacent_zones_by_node_connectivity("*") - """ request = MeshingQueriesProtoModule.GetAdjacentZonesByNodeConnectivityRequest() if isinstance(list_or_name_or_pattern, str): @@ -1129,15 +1072,14 @@ def get_adjacent_zones_by_node_connectivity(self, list_or_name_or_pattern) -> An return response.adjacent_zone_ids def get_shared_boundary_zones(self, list_or_name_or_pattern) -> Any: - """ - Returns the number of faces and the boundary face zones that are shared with the specified cell zones. + """Returns the number of faces and the boundary face zones that are shared with + the specified cell zones. .. code-block:: python >>> meshing_session.meshing_queries.get_shared_boundary_zones("*") >>> meshing_session.meshing_queries.get_shared_boundary_zones([3460]) - """ request = MeshingQueriesProtoModule.GetSharedBoundaryZonesRequest() if isinstance(list_or_name_or_pattern, str): @@ -1151,15 +1093,13 @@ def get_shared_boundary_zones(self, list_or_name_or_pattern) -> Any: def get_interior_zones_connected_to_cell_zones( self, list_or_name_or_pattern ) -> Any: - """ - Returns interior face zones connected to given cell zones. + """Returns interior face zones connected to given cell zones. .. code-block:: python >>> meshing_session.meshing_queries.get_interior_zones_connected_to_cell_zones([3460]) >>> meshing_session.meshing_queries.get_interior_zones_connected_to_cell_zones("*") - """ request = ( MeshingQueriesProtoModule.GetInteriorZonesConnectedToCellZonesRequest() @@ -1173,13 +1113,11 @@ def get_interior_zones_connected_to_cell_zones( return response.interior_zone_ids def get_face_zones_with_zone_specific_prisms_applied(self) -> Any: - """ - Return a list of face zones with zone-specific prism settings applied. + """Return a list of face zones with zone-specific prism settings applied. .. code-block:: python >>> meshing_session.meshing_queries.get_face_zones_with_zone_specific_prisms_applied() - """ request = MeshingQueriesProtoModule.Empty() response = self.service.get_face_zones_with_zone_specific_prisms_applied( @@ -1188,13 +1126,11 @@ def get_face_zones_with_zone_specific_prisms_applied(self) -> Any: return response.face_zone_ids def get_face_zones_of_prism_controls(self, control_name) -> Any: - """ - Return a list of face zones to which the specified prism controls apply. + """Return a list of face zones to which the specified prism controls apply. .. code-block:: python >>> meshing_session.meshing_queries.get_face_zones_of_prism_controls("*") - """ request = MeshingQueriesProtoModule.GetFaceZonesOfPrismControlsRequest() request.control_name = control_name @@ -1202,13 +1138,11 @@ def get_face_zones_of_prism_controls(self, control_name) -> Any: return response.face_zone_ids def get_baffles(self, face_zone_list) -> Any: - """ - Return the baffle zones based on the face zone list specified. + """Return the baffle zones based on the face zone list specified. .. code-block:: python >>> meshing_session.meshing_queries.get_baffles([29, 30]) - """ request = MeshingQueriesProtoModule.GetBafflesRequest() for items in face_zone_list: @@ -1217,78 +1151,67 @@ def get_baffles(self, face_zone_list) -> Any: return response.baffle_zone_ids def get_embedded_baffles(self) -> Any: - """ - Return the embedded baffle zones. + """Return the embedded baffle zones. .. code-block:: python >>> meshing_session.meshing_queries.get_embedded_baffles() - """ request = MeshingQueriesProtoModule.Empty() response = self.service.get_embedded_baffles(request) return response.embedded_baffles_zone_ids def get_wrapped_zones(self) -> Any: - """ - Return a list of wrapped face zones. + """Return a list of wrapped face zones. .. code-block:: python >>> meshing_session.meshing_queries.get_wrapped_zones() - """ request = MeshingQueriesProtoModule.Empty() response = self.service.get_wrapped_zones(request) return response.wrapped_face_zone_ids def get_unreferenced_edge_zones(self) -> Any: - """ - Return a list of unreferenced edge zones. + """Return a list of unreferenced edge zones. .. code-block:: python >>> meshing_session.meshing_queries.get_unreferenced_edge_zones() - """ request = MeshingQueriesProtoModule.Empty() response = self.service.get_unreferenced_edge_zones(request) return response.unreferenced_edge_zone_ids def get_unreferenced_face_zones(self) -> Any: - """ - Return a list of unreferenced face zones. + """Return a list of unreferenced face zones. .. code-block:: python >>> meshing_session.meshing_queries.get_unreferenced_face_zones() - """ request = MeshingQueriesProtoModule.Empty() response = self.service.get_unreferenced_face_zones(request) return response.unreferenced_face_zone_ids def get_unreferenced_cell_zones(self) -> Any: - """ - Return a list of unreferenced cell zones. + """Return a list of unreferenced cell zones. .. code-block:: python >>> meshing_session.meshing_queries.get_unreferenced_cell_zones() - """ request = MeshingQueriesProtoModule.Empty() response = self.service.get_unreferenced_cell_zones(request) return response.unreferenced_cell_zone_ids def get_unreferenced_edge_zones_of_filter(self, filter) -> Any: - """ - Return a list of unreferenced edge zones whose names contain the specified filter string. + """Return a list of unreferenced edge zones whose names contain the specified + filter string. .. code-block:: python >>> meshing_session.meshing_queries.get_unreferenced_edge_zones_of_filter("*") - """ request = MeshingQueriesProtoModule.GetUnreferencedEdgeZonesOfFilterRequest() request.filter = filter @@ -1296,13 +1219,12 @@ def get_unreferenced_edge_zones_of_filter(self, filter) -> Any: return response.unreferenced_edge_zone_ids def get_unreferenced_face_zones_of_filter(self, filter) -> Any: - """ - Return a list of unreferenced face zones whose names contain the specified filter string. + """Return a list of unreferenced face zones whose names contain the specified + filter string. .. code-block:: python >>> meshing_session.meshing_queries.get_unreferenced_face_zones_of_filter("*") - """ request = MeshingQueriesProtoModule.GetUnreferencedFaceZonesOfFilterRequest() request.filter = filter @@ -1310,13 +1232,12 @@ def get_unreferenced_face_zones_of_filter(self, filter) -> Any: return response.unreferenced_face_zone_ids def get_unreferenced_cell_zones_of_filter(self, filter) -> Any: - """ - Return a list of unreferenced cell zones whose names contain the specified filter string. + """Return a list of unreferenced cell zones whose names contain the specified + filter string. .. code-block:: python >>> meshing_session.meshing_queries.get_unreferenced_cell_zones_of_filter("*") - """ request = MeshingQueriesProtoModule.GetUnreferencedCellZonesOfFilterRequest() request.filter = filter @@ -1324,13 +1245,12 @@ def get_unreferenced_cell_zones_of_filter(self, filter) -> Any: return response.unreferenced_cell_zone_ids def get_unreferenced_edge_zone_id_list_of_pattern(self, pattern) -> Any: - """ - Return a list of unreferenced edge zones by ID, whose names contain the specified pattern. + """Return a list of unreferenced edge zones by ID, whose names contain the + specified pattern. .. code-block:: python >>> meshing_session.meshing_queries.get_unreferenced_edge_zone_id_list_of_pattern("*") - """ request = ( MeshingQueriesProtoModule.GetUnreferencedEdgeZoneIdListOfPatternRequest() @@ -1340,13 +1260,12 @@ def get_unreferenced_edge_zone_id_list_of_pattern(self, pattern) -> Any: return response.unreferenced_edge_zone_ids def get_unreferenced_face_zone_id_list_of_pattern(self, pattern) -> Any: - """ - Return a list of unreferenced face zones by ID, whose names contain the specified pattern. + """Return a list of unreferenced face zones by ID, whose names contain the + specified pattern. .. code-block:: python >>> meshing_session.meshing_queries.get_unreferenced_face_zone_id_list_of_pattern("*") - """ request = ( MeshingQueriesProtoModule.GetUnreferencedFaceZoneIdListOfPatternRequest() @@ -1356,13 +1275,12 @@ def get_unreferenced_face_zone_id_list_of_pattern(self, pattern) -> Any: return response.unreferenced_face_zone_ids def get_unreferenced_cell_zone_id_list_of_pattern(self, pattern) -> Any: - """ - Return a list of unreferenced cell zones by ID, whose names contain the specified pattern. + """Return a list of unreferenced cell zones by ID, whose names contain the + specified pattern. .. code-block:: python >>> meshing_session.meshing_queries.get_unreferenced_cell_zone_id_list_of_pattern("*") - """ request = ( MeshingQueriesProtoModule.GetUnreferencedCellZoneIdListOfPatternRequest() @@ -1372,15 +1290,13 @@ def get_unreferenced_cell_zone_id_list_of_pattern(self, pattern) -> Any: return response.unreferenced_cell_zone_ids def get_maxsize_cell_zone_by_volume(self, list_or_pattern) -> Any: - """ - Return cell zone with maximum volume for given list or pattern of cell zones. + """Return cell zone with maximum volume for given list or pattern of cell zones. .. code-block:: python >>> meshing_session.meshing_queries.get_maxsize_cell_zone_by_volume("*") >>> meshing_session.meshing_queries.get_maxsize_cell_zone_by_volume([3460]) - """ request = MeshingQueriesProtoModule.GetMaxsizeCellZoneByVolumeRequest() if isinstance(list_or_pattern, str): @@ -1396,15 +1312,14 @@ def get_maxsize_cell_zone_by_volume(self, list_or_pattern) -> Any: return response.cell_zone_id def get_maxsize_cell_zone_by_count(self, list_or_pattern) -> Any: - """ - Return cell zone with maximum count of elements for given list or pattern of cell zones. + """Return cell zone with maximum count of elements for given list or pattern of + cell zones. .. code-block:: python >>> meshing_session.meshing_queries.get_maxsize_cell_zone_by_count("*") >>> meshing_session.meshing_queries.get_maxsize_cell_zone_by_count([3460]) - """ request = MeshingQueriesProtoModule.GetMaxsizeCellZoneByCountRequest() if isinstance(list_or_pattern, str): @@ -1420,15 +1335,13 @@ def get_maxsize_cell_zone_by_count(self, list_or_pattern) -> Any: return response.cell_zone_id def get_minsize_face_zone_by_area(self, list_or_pattern) -> Any: - """ - Return face zone with minimum area for given list or pattern of face zones. + """Return face zone with minimum area for given list or pattern of face zones. .. code-block:: python >>> meshing_session.meshing_queries.get_minsize_face_zone_by_area("*") >>> meshing_session.meshing_queries.get_minsize_face_zone_by_area([29, 30, 31, 32, 33, 34]) - """ request = MeshingQueriesProtoModule.GetMinsizeFaceZoneByAreaRequest() if isinstance(list_or_pattern, str): @@ -1444,15 +1357,14 @@ def get_minsize_face_zone_by_area(self, list_or_pattern) -> Any: return response.face_zone_id def get_minsize_face_zone_by_count(self, list_or_pattern) -> Any: - """ - Return face zone with minimum count of elements for given list or pattern of face zones. + """Return face zone with minimum count of elements for given list or pattern of + face zones. .. code-block:: python >>> meshing_session.meshing_queries.get_minsize_face_zone_by_count("*") >>> meshing_session.meshing_queries.get_minsize_face_zone_by_count([29, 30, 31, 32, 33, 34]) - """ request = MeshingQueriesProtoModule.GetMinsizeFaceZoneByCountRequest() if isinstance(list_or_pattern, str): @@ -1470,14 +1382,13 @@ def get_minsize_face_zone_by_count(self, list_or_pattern) -> Any: def get_face_zone_list_by_maximum_entity_count( self, max_entity_count, only_boundary ) -> Any: - """ - Return a list of face zones with a count below the maximum entity count (maximum-entity-count) specified. - You can choose to restrict the report to only boundary edge zones, if required (only-boundary? set to True or False). + """Return a list of face zones with a count below the maximum entity count + (maximum-entity-count) specified. You can choose to restrict the report to only + boundary edge zones, if required (only-boundary? set to True or False). .. code-block:: python >>> meshing_session.meshing_queries.get_face_zone_list_by_maximum_entity_count(20, True) - """ request = MeshingQueriesProtoModule.GetFaceZoneListByMaximumEntityCountRequest() request.maximum_entity_count = max_entity_count @@ -1488,14 +1399,13 @@ def get_face_zone_list_by_maximum_entity_count( def get_edge_zone_list_by_maximum_entity_count( self, max_entity_count, only_boundary ) -> Any: - """ - Return a list of edge zones with a count below the maximum entity count (maximum-entity-count) specified. - You can choose to restrict the report to only boundary edge zones, if required (only-boundary? set to True or False). + """Return a list of edge zones with a count below the maximum entity count + (maximum-entity-count) specified. You can choose to restrict the report to only + boundary edge zones, if required (only-boundary? set to True or False). .. code-block:: python >>> meshing_session.meshing_queries.get_edge_zone_list_by_maximum_entity_count(20, False) - """ request = MeshingQueriesProtoModule.GetEdgeZoneListByMaximumEntityCountRequest() request.maximum_entity_count = max_entity_count @@ -1504,13 +1414,12 @@ def get_edge_zone_list_by_maximum_entity_count( return response.edge_zone_ids def get_cell_zone_list_by_maximum_entity_count(self, maximum_entity_count) -> Any: - """ - Return a list of cell zones with a count below the maximum entity count (maximum-entity-count) specified. + """Return a list of cell zones with a count below the maximum entity count + (maximum-entity-count) specified. .. code-block:: python >>> meshing_session.meshing_queries.get_cell_zone_list_by_maximum_entity_count(1) - """ request = MeshingQueriesProtoModule.GetCellZoneListByMaximumEntityCountRequest() request.maximum_entity_count = maximum_entity_count @@ -1518,13 +1427,12 @@ def get_cell_zone_list_by_maximum_entity_count(self, maximum_entity_count) -> An return response.cell_zone_ids def get_face_zone_list_by_maximum_zone_area(self, maximum_zone_area) -> Any: - """ - Return a list of face zones with a maximum zone area below the maximum-zone-area specified. + """Return a list of face zones with a maximum zone area below the maximum-zone- + area specified. .. code-block:: python >>> meshing_session.meshing_queries.get_face_zone_list_by_maximum_zone_area(100) - """ request = MeshingQueriesProtoModule.GetFaceZoneListByMaximumZoneAreaRequest() request.maximum_zone_area = maximum_zone_area @@ -1532,13 +1440,12 @@ def get_face_zone_list_by_maximum_zone_area(self, maximum_zone_area) -> Any: return response.face_zone_ids def get_face_zone_list_by_minimum_zone_area(self, minimum_zone_area) -> Any: - """ - Return a list of face zones with a minimum zone area above the minimum-zone-area specified. + """Return a list of face zones with a minimum zone area above the minimum-zone- + area specified. .. code-block:: python >>> meshing_session.meshing_queries.get_face_zone_list_by_minimum_zone_area(10) - """ request = MeshingQueriesProtoModule.GetFaceZoneListByMinimumZoneAreaRequest() request.minimum_zone_area = minimum_zone_area @@ -1546,8 +1453,7 @@ def get_face_zone_list_by_minimum_zone_area(self, minimum_zone_area) -> Any: return response.face_zone_ids def get_zones_with_free_faces(self, list_or_pattern) -> Any: - """ - Return a list of zones with free faces for the face zones specified. + """Return a list of zones with free faces for the face zones specified. .. code-block:: python @@ -1556,7 +1462,6 @@ def get_zones_with_free_faces(self, list_or_pattern) -> Any: >>> meshing_session.meshing_queries.get_zones_with_free_faces([29, 30, 31, 32]) >>> meshing_session.meshing_queries.get_zones_with_free_faces(["inlet", "outlet"]) - """ request = MeshingQueriesProtoModule.GetZonesWithFreeFacesRequest() if isinstance(list_or_pattern, str): @@ -1572,8 +1477,8 @@ def get_zones_with_free_faces(self, list_or_pattern) -> Any: return response.zones_with_free_faces def get_zones_with_multi_faces(self, list_or_pattern) -> Any: - """ - Return a list of zones with multi-connected faces for the face zones specified. + """Return a list of zones with multi-connected faces for the face zones + specified. .. code-block:: python @@ -1582,7 +1487,6 @@ def get_zones_with_multi_faces(self, list_or_pattern) -> Any: >>> meshing_session.meshing_queries.get_zones_with_multi_faces([29, 30, 31, 32]) >>> meshing_session.meshing_queries.get_zones_with_multi_faces(["inlet", "outlet"]) - """ request = MeshingQueriesProtoModule.GetZonesWithMultiFacesRequest() if isinstance(list_or_pattern, str): @@ -1600,13 +1504,12 @@ def get_zones_with_multi_faces(self, list_or_pattern) -> Any: def get_overlapping_face_zones( self, zone_name_pattern, area_tolerance, distance_tolerance ) -> Any: - """ - Return a list of overlapping face zones based on the area-tolerance and distance-tolerance specified. + """Return a list of overlapping face zones based on the area-tolerance and + distance-tolerance specified. .. code-block:: python >>> meshing_session.meshing_queries.GetOverlappingFaceZones("*", 0.1, 0.1) - """ request = MeshingQueriesProtoModule.GetOverlappingFaceZonesRequest() request.face_zone_name_or_pattern = zone_name_pattern @@ -1616,8 +1519,7 @@ def get_overlapping_face_zones( return response.overlapping_face_zone_ids def get_zones_with_marked_faces(self, list_or_pattern) -> Any: - """ - Return a list of zones with marked faces for the face zones specified. + """Return a list of zones with marked faces for the face zones specified. .. code-block:: python @@ -1626,7 +1528,6 @@ def get_zones_with_marked_faces(self, list_or_pattern) -> Any: >>> meshing_session.meshing_queries.get_zones_with_marked_faces([29, 30, 31, 32]) >>> meshing_session.meshing_queries.get_zones_with_marked_faces(["inlet", "outlet"]) - """ request = MeshingQueriesProtoModule.GetZonesWithMarkedFacesRequest() if isinstance(list_or_pattern, str): @@ -1642,13 +1543,11 @@ def get_zones_with_marked_faces(self, list_or_pattern) -> Any: return response.zones_with_marked_faces def get_object_name_list_of_type(self, type) -> Any: - """ - Return a list of objects of the specified type. + """Return a list of objects of the specified type. .. code-block:: python >>> meshing_session.meshing_queries.get_object_name_list_of_type("mesh") - """ request = MeshingQueriesProtoModule.GetObjectNameListOfTypeRequest() request.type = type @@ -1656,13 +1555,11 @@ def get_object_name_list_of_type(self, type) -> Any: return response.objects def get_objects_of_filter(self, filter) -> Any: - """ - Return a list of objects whose names contain the specified filter string. + """Return a list of objects whose names contain the specified filter string. .. code-block:: python >>> meshing_session.meshing_queries.get_objects_of_filter("*") - """ request = MeshingQueriesProtoModule.GetObjectsOfFilterRequest() request.filter = filter @@ -1670,13 +1567,11 @@ def get_objects_of_filter(self, filter) -> Any: return response.objects def get_regions_of_object(self, object) -> Any: - """ - Return a list of regions in the specified object. + """Return a list of regions in the specified object. .. code-block:: python >>> meshing_session.meshing_queries.get_regions_of_object("elbow-fluid") - """ self._get_allowed_object(object) request = MeshingQueriesProtoModule.GetRegionsOfObjectRequest() @@ -1685,14 +1580,12 @@ def get_regions_of_object(self, object) -> Any: return response.regions def sort_regions_by_volume(self, object_name, order) -> Any: - """ - Returns a sorted list of volumetric regions by volume for the object specified. - Specify the order (ascending or descending). + """Returns a sorted list of volumetric regions by volume for the object + specified. Specify the order (ascending or descending). .. code-block:: python >>> meshing_session.meshing_queries.sort_regions_by_volume("elbow-fluid", "ascending") - """ self._get_allowed_object(object_name) self._get_allowed_orders(order) @@ -1703,13 +1596,11 @@ def sort_regions_by_volume(self, object_name, order) -> Any: return response.regions def get_region_volume(self, object_name, region_name) -> Any: - """ - Return the region volume for the specified region of an object. + """Return the region volume for the specified region of an object. .. code-block:: python >>> meshing_session.meshing_queries.get_region_volume("elbow-fluid", "fluid") - """ self._get_allowed_object(object_name) self._get_allowed_region(region_name) @@ -1720,13 +1611,12 @@ def get_region_volume(self, object_name, region_name) -> Any: return response.region_volume def get_regions_of_filter(self, object, filter) -> Any: - """ - Return a list of regions in the specified object, whose names contain the specified filter string. + """Return a list of regions in the specified object, whose names contain the + specified filter string. .. code-block:: python >>> meshing_session.meshing_queries.get_regions_of_filter("elbow-fluid", "*") - """ request = MeshingQueriesProtoModule.GetRegionsOfFilterRequest() request.object = object @@ -1735,13 +1625,12 @@ def get_regions_of_filter(self, object, filter) -> Any: return response.regions def get_region_name_list_of_pattern(self, object, region_name_or_pattern) -> Any: - """ - Return a list of regions in the specified object, whose names contain the specified name pattern. + """Return a list of regions in the specified object, whose names contain the + specified name pattern. .. code-block:: python >>> meshing_session.meshing_queries.get_region_name_list_of_pattern("elbow-fluid", "*") - """ request = MeshingQueriesProtoModule.GetRegionNameListOfPatternRequest() request.object = object @@ -1750,13 +1639,11 @@ def get_region_name_list_of_pattern(self, object, region_name_or_pattern) -> Any return response.regions def get_regions_of_face_zones(self, list_of_face_zone_ids) -> Any: - """ - Return a list of regions containing the face zones specified. + """Return a list of regions containing the face zones specified. .. code-block:: python >>> meshing_session.meshing_queries.get_regions_of_face_zones([29, 30, 31, 32, 33, 34]) - """ request = MeshingQueriesProtoModule.GetRegionsOfFaceZonesRequest() for id in list_of_face_zone_ids: @@ -1767,8 +1654,8 @@ def get_regions_of_face_zones(self, list_of_face_zone_ids) -> Any: def find_join_pairs( self, face_zone_list_or_pattern, join_tolerance, absolute_tolerance, join_angle ) -> Any: - """ - Return the pairs of overlapping face zones based on the join tolerance and feature angle. + """Return the pairs of overlapping face zones based on the join tolerance and + feature angle. .. code-block:: python @@ -1777,7 +1664,6 @@ def find_join_pairs( >>> meshing_session.meshing_queries.find_join_pairs([32], 0.1, True, 40)) >>> meshing_session.meshing_queries.find_join_pairs(["outlet"], 0.1, True, 40) - """ request = MeshingQueriesProtoModule.FindJoinPairsRequest() if isinstance(face_zone_list_or_pattern, str): @@ -1796,13 +1682,11 @@ def find_join_pairs( return response.pairs def get_region_name_list_of_face_zones(self, list_or_pattern) -> Any: - """ - Return a list of regions containing the face zones specified. + """Return a list of regions containing the face zones specified. .. code-block:: python >>> meshing_session.meshing_queries.get_region_name_list_of_face_zones([29, 30, 31, 32, 33, 34]) - """ request = MeshingQueriesProtoModule.GetRegionNameListOfFaceZonesRequest() if isinstance(list_or_pattern, str): diff --git a/src/ansys/fluent/core/services/reduction.py b/src/ansys/fluent/core/services/reduction.py index 2da836362c1..53481017fd7 100644 --- a/src/ansys/fluent/core/services/reduction.py +++ b/src/ansys/fluent/core/services/reduction.py @@ -18,9 +18,7 @@ class ReductionService: - """ - Reduction Service. - """ + """Reduction Service.""" def __init__( self, channel: grpc.Channel, metadata: List[Tuple[str, str]], fluent_error_state @@ -266,9 +264,7 @@ def _locns(locns, ctxt=None): class Reduction: - """ - Reduction. - """ + """Reduction.""" def __init__(self, service: ReductionService): """__init__ method of Reduction class.""" diff --git a/src/ansys/fluent/core/services/svar.py b/src/ansys/fluent/core/services/svar.py index 8ef8dfa5f2e..05b1217b468 100644 --- a/src/ansys/fluent/core/services/svar.py +++ b/src/ansys/fluent/core/services/svar.py @@ -72,7 +72,6 @@ class SVARInfo: >>> zone_info = zones_info['wall'] >>> zone_info >>> name:wall count: 3630 zone_id:3 zone_type:wall thread_type:Face - """ class SVARS: diff --git a/src/ansys/fluent/core/session.py b/src/ansys/fluent/core/session.py index d93f745aadd..b130f933c2e 100644 --- a/src/ansys/fluent/core/session.py +++ b/src/ansys/fluent/core/session.py @@ -1,5 +1,4 @@ -"""Module containing class encapsulating Fluent connection and the Base -Session.""" +"""Module containing class encapsulating Fluent connection and the Base Session.""" import importlib import json import logging @@ -273,11 +272,11 @@ def download(self, file_name: str, local_file_path: Optional[str] = None): class _Uploader: - """Instantiates a file uploader and downloader to have a seamless file - reading / writing in the cloud particularly in Ansys lab . Here we are - exposing upload and download methods on session objects. These would be no- - ops if PyPIM is not configured or not authorized with the appropriate - service. This will be used for internal purpose only. + """Instantiates a file uploader and downloader to have a seamless file reading / + writing in the cloud particularly in Ansys lab . Here we are exposing upload and + download methods on session objects. These would be no- ops if PyPIM is not + configured or not authorized with the appropriate service. This will be used for + internal purpose only. Attributes ---------- diff --git a/src/ansys/fluent/core/session_meshing.py b/src/ansys/fluent/core/session_meshing.py index 8f6d9d8045e..b2c26e35f9a 100644 --- a/src/ansys/fluent/core/session_meshing.py +++ b/src/ansys/fluent/core/session_meshing.py @@ -7,11 +7,14 @@ class Meshing(PureMeshing): - """Encapsulates a Fluent meshing session. A ``tui`` object + """Encapsulates a Fluent meshing session. + + A ``tui`` object for meshing TUI commanding, and ``meshing`` and ``workflow`` objects for access to task-based meshing workflows are all exposed here. A ``switch_to_solver`` method is available - in this mode.""" + in this mode. + """ def __init__( self, diff --git a/src/ansys/fluent/core/session_pure_meshing.py b/src/ansys/fluent/core/session_pure_meshing.py index 251dc9c6287..ec6a2b2a51f 100644 --- a/src/ansys/fluent/core/session_pure_meshing.py +++ b/src/ansys/fluent/core/session_pure_meshing.py @@ -1,5 +1,4 @@ -"""Module containing class encapsulating Fluent connection. -""" +"""Module containing class encapsulating Fluent connection.""" import functools @@ -19,11 +18,14 @@ class PureMeshing(BaseSession): - """Encapsulates a Fluent meshing session. A ``tui`` object + """Encapsulates a Fluent meshing session. + + A ``tui`` object for meshing TUI commanding, and ``meshing`` and ``workflow`` objects for access to task-based meshing workflows are all exposed here. No ``switch_to_solver`` method is available - in this mode.""" + in this mode. + """ rules = ["workflow", "meshing", "PartManagement", "PMFileManagement"] for r in rules: diff --git a/src/ansys/fluent/core/session_solver.py b/src/ansys/fluent/core/session_solver.py index 89b4e4179cd..710a87f3bbc 100644 --- a/src/ansys/fluent/core/session_solver.py +++ b/src/ansys/fluent/core/session_solver.py @@ -24,8 +24,11 @@ class Solver(BaseSession): - """Encapsulates a Fluent solver session. A ``tui`` object for solver TUI - commanding, and solver settings objects are all exposed here.""" + """Encapsulates a Fluent solver session. + + A ``tui`` object for solver TUI + commanding, and solver settings objects are all exposed here. + """ def __init__( self, @@ -202,8 +205,8 @@ def _sync_from_future(self, fut: Future): fut_session.exit() def read_case(self, file_name: str, lightweight_mode: bool = False): - """Read a case file using light IO mode if ``pyfluent.USE_LIGHT_IO`` is - set to ``True``. + """Read a case file using light IO mode if ``pyfluent.USE_LIGHT_IO`` is set to + ``True``. Parameters ---------- diff --git a/src/ansys/fluent/core/session_solver_icing.py b/src/ansys/fluent/core/session_solver_icing.py index 031baaae126..d96b56dcba1 100644 --- a/src/ansys/fluent/core/session_solver_icing.py +++ b/src/ansys/fluent/core/session_solver_icing.py @@ -12,8 +12,8 @@ class SolverIcing(Solver): """Encapsulates a Fluent server for Icing session connection. - SolverIcing(Session) holds the top-level objects for solver TUI, - settings and icing datamodel objects calls. + SolverIcing(Session) holds the top-level objects for solver TUI, settings and icing + datamodel objects calls. """ def __init__( diff --git a/src/ansys/fluent/core/solver/error_message.py b/src/ansys/fluent/core/solver/error_message.py index f65ab8b59a7..5e7938c60f7 100644 --- a/src/ansys/fluent/core/solver/error_message.py +++ b/src/ansys/fluent/core/solver/error_message.py @@ -12,8 +12,8 @@ def closest_allowed_names(trial_name: str, allowed_names: str) -> List[str]: def allowed_name_error_message( context: str, trial_name: str, allowed_values: List[str] ) -> str: - """Provide the closest names matching the 'trial_name' from the - 'allowed_values' list.""" + """Provide the closest names matching the 'trial_name' from the 'allowed_values' + list.""" message = f"{trial_name} is not an allowed {context} name.\n" matches = closest_allowed_names(trial_name, allowed_values) if matches: diff --git a/src/ansys/fluent/core/solver/flobject.py b/src/ansys/fluent/core/solver/flobject.py index fc72b769a18..d7a04f1fa12 100644 --- a/src/ansys/fluent/core/solver/flobject.py +++ b/src/ansys/fluent/core/solver/flobject.py @@ -112,8 +112,8 @@ def set_flproxy(self, flproxy): def flproxy(self): """Proxy object. - The proxy object is set at the root level and accessed via the - parent for the child classes. + The proxy object is set at the root level and accessed via the parent for the + child classes. """ if self._flproxy is None: return self._parent.flproxy @@ -131,8 +131,8 @@ def parent(self): def obj_name(self) -> str: """Name of the scheme of this object. - By default, this returns the object's static name. If the object - is a child of a named object, the object's name is returned. + By default, this returns the object's static name. If the object is a child of a + named object, the object's name is returned. """ if self._name is None: return self.fluent_name @@ -556,8 +556,7 @@ def __setattr__(self, name: str, value): class WildcardPath(Group): - """Class wrapping a wildcard path to perform get_var and set_var on - flproxy.""" + """Class wrapping a wildcard path to perform get_var and set_var on flproxy.""" def __init__(self, flproxy, path: str, state_cls, settings_cls, parent): """__init__ of WildcardPath class.""" @@ -626,8 +625,7 @@ def to_python_keys(self, value): class NamedObjectWildcardPath(WildcardPath): - """WildcardPath at a NamedObject path, so it can be looked up by wildcard - again.""" + """WildcardPath at a NamedObject path, so it can be looked up by wildcard again.""" def __getitem__(self, name: str): return WildcardPath( @@ -646,9 +644,8 @@ def __setitem__(self, name, value): class NamedObject(SettingsBase[DictStateType], Generic[ChildTypeT]): - """A ``NamedObject`` container is a container object similar to a Python - dictionary object. Generally, many such objects can be created with - different names. + """A ``NamedObject`` container is a container object similar to a Python dictionary + object. Generally, many such objects can be created with different names. Attributes ---------- @@ -807,8 +804,8 @@ def __getitem__(self, name: str) -> ChildTypeT: class ListObject(SettingsBase[ListStateType], Generic[ChildTypeT]): - """A ``ListObject`` container is a container object, similar to a Python - list object. Generally, many such objects can be created. + """A ``ListObject`` container is a container object, similar to a Python list + object. Generally, many such objects can be created. Attributes ---------- @@ -1013,10 +1010,9 @@ def _clean_helpinfo(helpinfo): class _ChildNamedObjectAccessorMixin(collections.abc.MutableMapping): - """A mixin class to provide a dictionary interface at a Group class level - if the Group has multiple named objects of a similar type. For example, - boundary conditions are grouped by type but quite often we want to access - them without the type context. + """A mixin class to provide a dictionary interface at a Group class level if the + Group has multiple named objects of a similar type. For example, boundary conditions + are grouped by type but quite often we want to access them without the type context. The following can be used: for name, boundary in setup.boundary_conditions.items(): diff --git a/src/ansys/fluent/core/solver/function/reduction.py b/src/ansys/fluent/core/solver/function/reduction.py index 62a86890e78..2ad39cdaebe 100644 --- a/src/ansys/fluent/core/solver/function/reduction.py +++ b/src/ansys/fluent/core/solver/function/reduction.py @@ -1,5 +1,5 @@ -"""Module providing reductions functions that can be applied to Fluent data -from one or across multiple remote Fluent sessions. +"""Module providing reductions functions that can be applied to Fluent data from one or +across multiple remote Fluent sessions. The following parameters are relevant for the reduction functions. The expr parameter is not relevant to all reductions functions. @@ -283,8 +283,8 @@ def _limit(limit, expr, locations, ctxt): def area_average(expression, locations, ctxt=None): - """Compute the area averaged value of the specified expression over the - specified locations. + """Compute the area averaged value of the specified expression over the specified + locations. Parameters ---------- @@ -299,8 +299,8 @@ def area_average(expression, locations, ctxt=None): def area_integral(expression, locations, ctxt=None): - """Compute the area integrated averaged of the specified expression over - the specified locations. + """Compute the area integrated averaged of the specified expression over the + specified locations. Parameters ---------- @@ -315,8 +315,8 @@ def area_integral(expression, locations, ctxt=None): def volume_average(expression, locations, ctxt=None): - """Compute the volume-weighted average value of the specified expression - over the specified locations. + """Compute the volume-weighted average value of the specified expression over the + specified locations. Parameters ---------- @@ -331,8 +331,8 @@ def volume_average(expression, locations, ctxt=None): def volume_integral(expression, locations, ctxt=None): - """Compute the volume-weighted total of the specified expression over the - specified locations. + """Compute the volume-weighted total of the specified expression over the specified + locations. Parameters ---------- @@ -403,8 +403,8 @@ def centroid(locations, ctxt=None): def force(locations, ctxt=None): - """Compute the force acting on the location(s) specified (should be walls) - as a vector. + """Compute the force acting on the location(s) specified (should be walls) as a + vector. Parameters ---------- @@ -418,8 +418,8 @@ def force(locations, ctxt=None): def pressure_force(locations, ctxt=None): - """Compute the pressure force acting on the location(s) specified (should - be walls) as a vector. + """Compute the pressure force acting on the location(s) specified (should be walls) + as a vector. Parameters ---------- @@ -433,8 +433,8 @@ def pressure_force(locations, ctxt=None): def viscous_force(locations, ctxt=None): - """Compute the viscous force acting on the location(s) specified (should be - walls) as a vector. + """Compute the viscous force acting on the location(s) specified (should be walls) + as a vector. Parameters ---------- @@ -448,8 +448,8 @@ def viscous_force(locations, ctxt=None): def moment(expression, locations, ctxt=None): - """Compute the moment vector about the specified point (which can be - single-valued expression) for the specified location(s). + """Compute the moment vector about the specified point (which can be single-valued + expression) for the specified location(s). Parameters ---------- @@ -464,8 +464,7 @@ def moment(expression, locations, ctxt=None): def minimum(expression, locations, ctxt=None): - """Compute the minimum of the specified expression over the specified - locations. + """Compute the minimum of the specified expression over the specified locations. Parameters ---------- @@ -480,8 +479,7 @@ def minimum(expression, locations, ctxt=None): def maximum(expression, locations, ctxt=None): - """Compute the maximum of the specified expression over the specified - locations. + """Compute the maximum of the specified expression over the specified locations. Parameters ---------- @@ -496,8 +494,8 @@ def maximum(expression, locations, ctxt=None): def mass_average(expression, locations, ctxt=None): - """Compute the mass-weighted average value of the specified expression over - the specified locations. + """Compute the mass-weighted average value of the specified expression over the + specified locations. Parameters ---------- @@ -512,8 +510,8 @@ def mass_average(expression, locations, ctxt=None): def mass_integral(expression, locations, ctxt=None): - """Compute the total mass-weighted value of the specified expression over - the specified locations. + """Compute the total mass-weighted value of the specified expression over the + specified locations. Parameters ---------- @@ -528,8 +526,8 @@ def mass_integral(expression, locations, ctxt=None): def mass_flow_average(expression, locations, ctxt=None): - """Compute the mass-flow-weighted average value of the specified expression - over the specified locations. + """Compute the mass-flow-weighted average value of the specified expression over the + specified locations. Parameters ---------- @@ -573,8 +571,7 @@ def mass_flow(locations, ctxt=None): def sum(expression, locations, weight, ctxt=None): - """Compute the sum of the specified expression over the - specified locations. + """Compute the sum of the specified expression over the specified locations. Parameters ---------- @@ -590,8 +587,8 @@ def sum(expression, locations, weight, ctxt=None): def sum_if(expression, condition, locations, weight, ctxt=None): - """Compute the sum of the specified expression over the - specified locations if a condition is satisfied. + """Compute the sum of the specified expression over the specified locations if a + condition is satisfied. Parameters ---------- diff --git a/src/ansys/fluent/core/streaming_services/field_data_streaming.py b/src/ansys/fluent/core/streaming_services/field_data_streaming.py index f207e1fcb92..c911b0db996 100644 --- a/src/ansys/fluent/core/streaming_services/field_data_streaming.py +++ b/src/ansys/fluent/core/streaming_services/field_data_streaming.py @@ -38,5 +38,5 @@ def _process_streaming(self, id, stream_begin_method, started_evt, *args, **kwar ) def callbacks(self) -> List[List[Union[Callable, List, Dict]]]: - """Get list of callbacks along with arguments and keyword arguments""" + """Get list of callbacks along with arguments and keyword arguments.""" return self._service_callbacks.values() diff --git a/src/ansys/fluent/core/streaming_services/transcript_streaming.py b/src/ansys/fluent/core/streaming_services/transcript_streaming.py index 72f3beb8267..a02033b5f7a 100644 --- a/src/ansys/fluent/core/streaming_services/transcript_streaming.py +++ b/src/ansys/fluent/core/streaming_services/transcript_streaming.py @@ -74,8 +74,7 @@ def stop(self) -> None: super().stop() def _process_streaming(self, id, stream_begin_method, started_evt, *args, **kwargs): - """Performs processes on transcript depending on the callback - functions.""" + """Performs processes on transcript depending on the callback functions.""" request = TranscriptModule.TranscriptRequest(*args, **kwargs) responses = self._streaming_service.begin_streaming( request, started_evt, id=id, stream_begin_method=stream_begin_method diff --git a/src/ansys/fluent/core/systemcoupling.py b/src/ansys/fluent/core/systemcoupling.py index 09a0215e8f6..cde96a37b31 100644 --- a/src/ansys/fluent/core/systemcoupling.py +++ b/src/ansys/fluent/core/systemcoupling.py @@ -26,8 +26,8 @@ class Region: class SystemCoupling: - """Wrap a System Coupling object, adding methods to discover more about the - System Coupling related setup and to help solving a System Coupling analysis. + """Wrap a System Coupling object, adding methods to discover more about the System + Coupling related setup and to help solving a System Coupling analysis. Methods ------- diff --git a/src/ansys/fluent/core/utils/execution.py b/src/ansys/fluent/core/utils/execution.py index 17250b203fd..d39d4dfba79 100644 --- a/src/ansys/fluent/core/utils/execution.py +++ b/src/ansys/fluent/core/utils/execution.py @@ -8,9 +8,9 @@ def asynchronous(f: Callable) -> Callable: - """Use for decorating functions that are to execute asynchronously. The - decorated function returns a `future`_ object. Calling `result()`_ on the - future object synchronizes the function execution. + """Use for decorating functions that are to execute asynchronously. The decorated + function returns a `future`_ object. Calling `result()`_ on the future object + synchronizes the function execution. Examples -------- @@ -42,8 +42,8 @@ def func(*args, **kwargs) -> Callable: def timeout_exec(obj, timeout, args=None, kwargs=None): - """Executes object with the timeout limit. Tries to return whatever the provided object returns. - If the object returns nothing, this function will return ``True``. + """Executes object with the timeout limit. Tries to return whatever the provided + object returns. If the object returns nothing, this function will return ``True``. If it times out, returns ``False``. Parameters @@ -98,10 +98,11 @@ def timeout_loop( idle_period: float = 0.2, expected: str = "truthy", ) -> Any: - """Loops while specified object does not return expected response. Timeouts after specified time has elapsed. - Tries to return whatever is returned by the specified object. - If nothing is returned before timeout, returns the opposite of the expected value, i.e. - ``True`` if ``expected == "falsy"`` and ``False`` if ``expected == "truthy"``. + """Loops while specified object does not return expected response. Timeouts after + specified time has elapsed. Tries to return whatever is returned by the specified + object. If nothing is returned before timeout, returns the opposite of the expected + value, i.e. ``True`` if ``expected == "falsy"`` and ``False`` if ``expected == + "truthy"``. Parameters ---------- diff --git a/src/ansys/fluent/core/utils/networking.py b/src/ansys/fluent/core/utils/networking.py index ea1567831d4..dac0803148d 100644 --- a/src/ansys/fluent/core/utils/networking.py +++ b/src/ansys/fluent/core/utils/networking.py @@ -10,8 +10,7 @@ def get_free_port() -> int: - """Identifies a free port to which a new socket connection can be - established. + """Identifies a free port to which a new socket connection can be established. Returns ------- @@ -46,8 +45,8 @@ def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any): def find_remoting_ip() -> str: - """Find an ip address at which a grpc connection can be established - by looping over getaddrinfo output. + """Find an ip address at which a grpc connection can be established by looping over + getaddrinfo output. Returns ------- diff --git a/src/ansys/fluent/core/utils/search.py b/src/ansys/fluent/core/utils/search.py index 736ce115790..5ce16713081 100644 --- a/src/ansys/fluent/core/utils/search.py +++ b/src/ansys/fluent/core/utils/search.py @@ -132,8 +132,7 @@ def search( version: Optional[str] = None, search_root: Optional[Any] = None, ): - """ - Search for a word through the Fluent's object hierarchy. + """Search for a word through the Fluent's object hierarchy. Parameters ---------- diff --git a/src/ansys/fluent/core/workflow.py b/src/ansys/fluent/core/workflow.py index 8be79d8b780..010ff590bcb 100644 --- a/src/ansys/fluent/core/workflow.py +++ b/src/ansys/fluent/core/workflow.py @@ -118,8 +118,8 @@ def __init__(self, command_source: WorkflowWrapper, task: str) -> None: ) def get_direct_upstream_tasks(self) -> list: - """Get the list of tasks upstream of this one and directly connected by - a data dependency. + """Get the list of tasks upstream of this one and directly connected by a data + dependency. Returns ------- @@ -131,7 +131,8 @@ def get_direct_upstream_tasks(self) -> list: ) def get_direct_upstream_tasks(self) -> list: - """Get the list of tasks upstream of this one and directly connected by a data dependency. + """Get the list of tasks upstream of this one and directly connected by a data + dependency. Returns ------- @@ -143,8 +144,8 @@ def get_direct_upstream_tasks(self) -> list: ) def get_direct_downstream_tasks(self) -> list: - """Get the list of tasks downstream of this one and directly connected - by a data dependency. + """Get the list of tasks downstream of this one and directly connected by a data + dependency. Returns ------- @@ -156,8 +157,8 @@ def get_direct_downstream_tasks(self) -> list: ) def ordered_children(self, recompute=True) -> list: - """Get the ordered task list held by this task. Sorting is in terms - of the workflow order and only includes this task's top-level tasks, while other tasks + """Get the ordered task list held by this task. Sorting is in terms of the + workflow order and only includes this task's top-level tasks, while other tasks can be obtained by calling ordered_children() on a parent task. Given the workflow:: @@ -221,8 +222,7 @@ def child_task_python_names(self) -> List[str]: return self._python_task_names def get_id(self) -> str: - """Get the unique string identifier of this task, as it is in the - application. + """Get the unique string identifier of this task, as it is in the application. Returns ------- @@ -238,8 +238,7 @@ def get_id(self) -> str: return id_ def get_idx(self) -> int: - """Get the unique integer index of this task, as it is in the - application. + """Get the unique integer index of this task, as it is in the application. Returns ------- @@ -249,8 +248,7 @@ def get_idx(self) -> int: return int(self.get_id()[len("TaskObject") :]) def python_name(self) -> str: - """Get the Pythonic name of this task, as it is in the underlying - application. + """Get the Pythonic name of this task, as it is in the underlying application. Returns ------- @@ -345,6 +343,7 @@ def __init__(self, command_source: WorkflowWrapper) -> None: def __iter__(self) -> Iterator[BaseTask]: """Yield the next child object. + Yields ------ Iterator[BaseTask] @@ -382,8 +381,7 @@ def __init__(self, task: BaseTask) -> None: self._task = task def set_state(self, args: dict) -> None: - """ - Overwrite arguments. + """Overwrite arguments. Parameters ---------- @@ -393,8 +391,7 @@ def set_state(self, args: dict) -> None: self._task.Arguments.set_state(args) def update_dict(self, args: dict) -> None: - """ - Merge with arguments. + """Merge with arguments. Parameters ---------- @@ -404,8 +401,7 @@ def update_dict(self, args: dict) -> None: self._task.Arguments.update_dict(args) def get_state(self, explicit_only=False) -> dict: - """ - Get arguments state. + """Get arguments state. Parameters ---------- @@ -444,8 +440,7 @@ def __init__(self, task: BaseTask, arg: str) -> None: raise RuntimeError(f"{arg} is not an argument") def set_state(self, value: Any) -> None: - """ - Set the state of this argument. + """Set the state of this argument. Parameters ---------- @@ -455,8 +450,7 @@ def set_state(self, value: Any) -> None: self._task.Arguments.update_dict({self._arg_name: value}) def get_state(self, explicit_only: bool = False) -> Any: - """ - Get argument state. + """Get argument state. Parameters ---------- @@ -471,8 +465,10 @@ def __getattr__(self, attr): class CommandTask(BaseTask): - """Intermediate base class task representation for wrapping a Workflow TaskObject instance, - adding attributes related to commanding. Classes without these attributes cannot be commanded. + """Intermediate base class task representation for wrapping a Workflow TaskObject + instance, adding attributes related to commanding. + + Classes without these attributes cannot be commanded. """ def __init__(self, command_source: WorkflowWrapper, task: str) -> None: @@ -535,9 +531,8 @@ def _command(self): class SimpleTask(CommandTask): - """Simple task representation for wrapping a Workflow TaskObject - instance of TaskType Simple. - """ + """Simple task representation for wrapping a Workflow TaskObject instance of + TaskType Simple.""" def __init__(self, command_source: WorkflowWrapper, task: str) -> None: """Initialize SimpleTask. @@ -552,14 +547,16 @@ def __init__(self, command_source: WorkflowWrapper, task: str) -> None: super().__init__(command_source, task) def ordered_children(self, recompute=True) -> list: - """Get the ordered task list held by the workflow. SimpleTasks have no TaskList.""" + """Get the ordered task list held by the workflow. + + SimpleTasks have no TaskList. + """ return [] class CompoundChild(SimpleTask): - """Compound Child representation for wrapping a Workflow TaskObject - instance of TaskType Compound Child. - """ + """Compound Child representation for wrapping a Workflow TaskObject instance of + TaskType Compound Child.""" def __init__(self, command_source: WorkflowWrapper, task: str) -> None: """Initialize CompoundChild. @@ -574,8 +571,7 @@ def __init__(self, command_source: WorkflowWrapper, task: str) -> None: super().__init__(command_source, task) def python_name(self) -> str: - """Get the Pythonic name of this task, as it is in the underlying - application. + """Get the Pythonic name of this task, as it is in the underlying application. Returns ------- @@ -586,9 +582,8 @@ def python_name(self) -> str: class CompositeTask(BaseTask): - """Composite task representation for wrapping a Workflow TaskObject - instance of TaskType Composite. - """ + """Composite task representation for wrapping a Workflow TaskObject instance of + TaskType Composite.""" def __init__(self, command_source: WorkflowWrapper, task: str) -> None: """Initialize CompositeTask. @@ -631,9 +626,8 @@ def arguments(self) -> dict: class ConditionalTask(CommandTask): - """Conditional task representation for wrapping a Workflow TaskObject - instance of TaskType Conditional. - """ + """Conditional task representation for wrapping a Workflow TaskObject instance of + TaskType Conditional.""" def __init__(self, command_source: WorkflowWrapper, task: str) -> None: """Initialize ConditionalTask. @@ -662,9 +656,8 @@ def inactive_ordered_children(self) -> list: class CompoundTask(CommandTask): - """Compound task representation for wrapping a Workflow TaskObject - instance of TaskType Compound. - """ + """Compound task representation for wrapping a Workflow TaskObject instance of + TaskType Compound.""" def __init__(self, command_source: WorkflowWrapper, task: str) -> None: """Initialize CompoundTask. @@ -755,8 +748,8 @@ def _makeTask(command_source, name: str) -> BaseTask: class WorkflowWrapper: - """Wrap a Workflow object, adding methods to discover more about the - relationships between TaskObjects. + """Wrap a Workflow object, adding methods to discover more about the relationships + between TaskObjects. Methods ------- @@ -807,18 +800,19 @@ def task(self, name: str) -> BaseTask: @property def TaskObject(self) -> TaskContainer: # missing from dir - """Get a TaskObject container wrapper that 'holds' the underlying - TaskObjects. + """Get a TaskObject container wrapper that 'holds' the underlying TaskObjects. The wrapper adds extra functionality. """ return TaskContainer(self) def ordered_children(self, recompute=True) -> list: - """Get the ordered task list held by the workflow. Sorting is in terms - of the workflow order and only includes the top-level tasks, while other tasks - can be obtained by calling ordered_children() on a parent task. Consider the - following workflow. + """Get the ordered task list held by the workflow. Sorting is in terms of the + workflow order and only includes the top-level tasks, while other tasks can be + obtained by calling ordered_children() on a parent task. Consider the following + workflow. + + Given the workflow:: Workflow ├── A @@ -827,8 +821,8 @@ def ordered_children(self, recompute=True) -> list: │ └── D └── E - The ordered children of the workflow are A, B, E, while B has ordered children - C and D. + The ordered children of the workflow are A, B, E, while B has ordered children C + and D. """ if recompute: workflow_state, task_list = self._workflow_and_task_list_state() @@ -875,7 +869,8 @@ def inactive_ordered_children(self) -> list: return [] def __getattr__(self, attr): - """Delegate attribute lookup to the wrapped workflow object + """Delegate attribute lookup to the wrapped workflow object. + Parameters ---------- attr : str @@ -890,8 +885,8 @@ def __getattr__(self, attr): return self._task_objects.get(attr, None) def __dir__(self): - """Override the behaviour of dir to include attributes in - WorkflowWrapper and the underlying workflow.""" + """Override the behaviour of dir to include attributes in WorkflowWrapper and + the underlying workflow.""" return sorted( set(list(self.__dict__.keys()) + dir(type(self)) + dir(self._workflow)) ) diff --git a/tests/test_meshing_workflow.py b/tests/test_meshing_workflow.py index cb0e8f6f900..93c42fe1b72 100644 --- a/tests/test_meshing_workflow.py +++ b/tests/test_meshing_workflow.py @@ -492,18 +492,15 @@ def downstream_names(task): # ordering test idxs = [int(id[len("TaskObject") :]) for id in task_ids] assert sorted(idxs) == idxs - """ - o Workflow - | - |--o Import Geometry - | - |--o Add Local Sizing - | - |--o Generate the Surface Mesh -- - /Insert Next Task> - |-- Add Boundary Type - |-- Update Boundaries - |-- ... + """Given the workflow:: + + Workflow + ├── Import Geometry + ├── Add Local Sizing + ├── Generate the Surface Mesh ── Insert Next Task + ├── Add Boundary Type + ├── Update Boundaries + ├── ... """ assert set(gen_surf_mesh.GetNextPossibleTasks()) == { "AddBoundaryType", diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py index 8d96b385f0d..ad00c99ddaa 100644 --- a/tests/test_scheduler.py +++ b/tests/test_scheduler.py @@ -1,5 +1,5 @@ -"""Provide a module to test the algorithms which parse job scheduler -environments for machines to run on.""" +"""Provide a module to test the algorithms which parse job scheduler environments for +machines to run on.""" from builtins import range import os import socket @@ -47,8 +47,7 @@ def test_modify_host(self): class TestMachineList(unittest.TestCase): - """Provide a test suite that checks that the MachineList object behaves - properly.""" + """Provide a test suite that checks that the MachineList object behaves properly.""" def setUp(self): self._machineList = MachineList() @@ -79,8 +78,7 @@ def test_add_to_machinelist(self): self.assertEqual(self._machineList.num_machines, 2) def test_number_of_cores_and_machines(self): - """Test that the total and max number of cores and machines is - working.""" + """Test that the total and max number of cores and machines is working.""" self._machineList.add(Machine("machine1", 20, "allq", "0:0")) self._machineList.add(Machine("machine2", 25, "allq", "0:0")) self._machineList.add(Machine("machine3", 15, "allq", "0:0")) @@ -90,8 +88,7 @@ def test_number_of_cores_and_machines(self): self.assertEqual(self._machineList.min_cores, 15) def test_sort_machine_list(self): - """Test that the machines are sorted in order of decreasing core - count.""" + """Test that the machines are sorted in order of decreasing core count.""" self._machineList.add(Machine("machine1", 15, "allq", "0:0")) self._machineList.add(Machine("machine2", 10, "allq", "0:0")) self._machineList.add(Machine("machine3", 5, "allq", "0:0")) From 2330b35260e0b73a03dcec45abdce4baa2dbe97e Mon Sep 17 00:00:00 2001 From: Mainak Kundu Date: Thu, 5 Oct 2023 11:48:34 -0400 Subject: [PATCH 3/4] Add back flake8 --- .pre-commit-config.yaml | 36 +++++++++++++------------- src/ansys/fluent/core/logging.py | 2 +- src/ansys/fluent/core/services/svar.py | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 27ac6fd75ee..a9ab7dda501 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,24 +10,24 @@ repos: hooks: - id: isort -# - repo: https://github.com/PyCQA/flake8 -# rev: 6.0.0 -# hooks: -# - id: flake8 -# additional_dependencies: [ -# 'flake8-annotations==2.9.0' -# ] -# args: [ -# --exclude, src/ansys/fluent/core/meshing/tui* src/ansys/fluent/core/solver/tui* src/ansys/fluent/core/datamodel_222/* src/ansys/fluent/core/datamodel_231/* src/ansys/fluent/core/datamodel_232/* src/ansys/fluent/core/datamodel_241/* src/ansys/fluent/core/solver/settings_222/* src/ansys/fluent/core/solver/settings_231/* src/ansys/fluent/core/solver/settings_232/* src/ansys/fluent/core/solver/settings_241/*, -# --select, W191 W291 W293 W391 E115 E117 E122 E124 E125 E225 E231 E301 E303 F401 F403 N801 N802 N803 N804 N805 N806, -# #--select, W191 W291 W293 W391 E115 E117 E122 E124 E125 E225 E231 E301 E303 F401 F403 N801 N802 N803 N804 N805 N806 ANN001 ANN201 ANN205 ANN206, -# --count, -# --statistics, -# --max-complexity, "10", -# --max-line-length, "88", -# --extend-ignore, E203 E501, -# ansys, codegen, doc, examples, tests -# ] +- repo: https://github.com/PyCQA/flake8 + rev: 6.1.0 + hooks: + - id: flake8 + additional_dependencies: [ + 'flake8-annotations==3.0.1' + ] + args: [ + --exclude, src/ansys/fluent/core/meshing/tui* src/ansys/fluent/core/solver/tui* src/ansys/fluent/core/datamodel_222/* src/ansys/fluent/core/datamodel_231/* src/ansys/fluent/core/datamodel_232/* src/ansys/fluent/core/datamodel_241/* src/ansys/fluent/core/solver/settings_222/* src/ansys/fluent/core/solver/settings_231/* src/ansys/fluent/core/solver/settings_232/* src/ansys/fluent/core/solver/settings_241/*, + --select, W191 W291 W293 W391 E115 E117 E122 E124 E125 E225 E231 E301 E303 F401 F403 N801 N802 N803 N804 N805 N806, + #--select, W191 W291 W293 W391 E115 E117 E122 E124 E125 E225 E231 E301 E303 F401 F403 N801 N802 N803 N804 N805 N806 ANN001 ANN201 ANN205 ANN206, + --count, + --statistics, + --max-complexity, "10", + --max-line-length, "88", + --extend-ignore, E203 E501, + ansys, codegen, doc, examples, tests + ] - repo: https://github.com/codespell-project/codespell rev: v2.2.2 diff --git a/src/ansys/fluent/core/logging.py b/src/ansys/fluent/core/logging.py index 54fff702a14..14cddf8a612 100644 --- a/src/ansys/fluent/core/logging.py +++ b/src/ansys/fluent/core/logging.py @@ -116,7 +116,7 @@ def enable(level: Union[str, int] = "DEBUG", custom_config: Optional[dict] = Non logging.config.dictConfig(config) filename = config["handlers"]["pyfluent_file"]["filename"] - print(f"PyFluent logging file {os.path.join(os.getcwd(),filename)}") + print(f"PyFluent logging file {os.path.join(os.getcwd(), filename)}") set_global_level(level) diff --git a/src/ansys/fluent/core/services/svar.py b/src/ansys/fluent/core/services/svar.py index 05b1217b468..f8fcfbb363f 100644 --- a/src/ansys/fluent/core/services/svar.py +++ b/src/ansys/fluent/core/services/svar.py @@ -145,7 +145,7 @@ def __repr__(self): partition_str = "" for i, partition_info in enumerate(self.partitions_info): partition_str += f"\n\t{i}. {partition_info.count}[{partition_info.start_index}:{partition_info.end_index}]" - return f"name:{self.name} count: {self.count} zone_id:{self.zone_id} zone_type:{self.zone_type} threadType:{'Cell' if self.thread_type==SvarProtoModule.ThreadType.CELL_THREAD else 'Face'}{partition_str}" + return f"name:{self.name} count: {self.count} zone_id:{self.zone_id} zone_type:{self.zone_type} threadType:{'Cell' if self.thread_type == SvarProtoModule.ThreadType.CELL_THREAD else 'Face'}{partition_str}" def __init__(self, zones_info, domains_info): self._zones_info = {} From c05ceca6f0741ed5c2792babd556e4faeff1821d Mon Sep 17 00:00:00 2001 From: Mainak Kundu Date: Thu, 5 Oct 2023 11:58:55 -0400 Subject: [PATCH 4/4] precommit autoupdate --- .github/styles/Vocab/ANSYS/accept.txt | 1 + .pre-commit-config.yaml | 4 ++-- tests/test_lispy.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/styles/Vocab/ANSYS/accept.txt b/.github/styles/Vocab/ANSYS/accept.txt index 5853bebee04..93a219eebd2 100644 --- a/.github/styles/Vocab/ANSYS/accept.txt +++ b/.github/styles/Vocab/ANSYS/accept.txt @@ -69,3 +69,4 @@ venv mass_flow mass_average mass_integrated_average +caf \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a9ab7dda501..6a4d0d8101e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ repos: - repo: https://github.com/psf/black - rev: 23.1.0 + rev: 23.9.1 hooks: - id: black @@ -30,7 +30,7 @@ repos: ] - repo: https://github.com/codespell-project/codespell - rev: v2.2.2 + rev: v2.2.6 hooks: - id: codespell args: ["--toml", "pyproject.toml"] diff --git a/tests/test_lispy.py b/tests/test_lispy.py index 2537ad7a771..0ec1c902429 100644 --- a/tests/test_lispy.py +++ b/tests/test_lispy.py @@ -36,5 +36,5 @@ def test_scm_to_py(): def test_py_to_scm(): for scm_py in scm_pys: - expec = scm_py[2] if len(scm_py) == 3 else scm_py[0] - assert lispy.to_string(scm_py[1]) == expec + expected = scm_py[2] if len(scm_py) == 3 else scm_py[0] + assert lispy.to_string(scm_py[1]) == expected