From 1813ab0dfcb779b0f1e3eb86061f63baddd3e618 Mon Sep 17 00:00:00 2001 From: Lorenzo Vecchietti <58366962+lorenzovecchietti@users.noreply.github.com> Date: Thu, 2 May 2024 09:37:02 +0200 Subject: [PATCH] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sébastien Morais <146729917+SMoraisAnsys@users.noreply.github.com> Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com> --- pyaedt/application/Design.py | 7 +++---- pyaedt/icepak.py | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/pyaedt/application/Design.py b/pyaedt/application/Design.py index 90d34fc41df..8bf840f3125 100644 --- a/pyaedt/application/Design.py +++ b/pyaedt/application/Design.py @@ -4058,7 +4058,8 @@ def __repr__(self): def __setitem__(self, key, value): if key in self.available_properties: - value = self.manipulate_inputs.execute(key, value) + if self.manipulate_inputs is not None: + value = self.manipulate_inputs.execute(key, value) key_choices = "{}/Choices".format(key) if key_choices in self.design_settings.GetPropNames(): value_choices = self.design_settings.GetPropValue(key_choices) @@ -4079,6 +4080,4 @@ def __getitem__(self, key): return None def __contains__(self, item): - if item in self.available_properties: - return True - return False + return item in self.available_properties diff --git a/pyaedt/icepak.py b/pyaedt/icepak.py index f85b288f210..f921a7b75df 100644 --- a/pyaedt/icepak.py +++ b/pyaedt/icepak.py @@ -1640,7 +1640,7 @@ def edit_design_settings( The default is ``0``. ambient_temperature : float, str, BoundaryDict or dict optional Ambient temperature. The default is ``20``. - The default unit is celsius for float or string including unit definition is accepted, e.g. ``325kel``. + The default unit is Celsius for a float or string value. You can include a unit for a string value. For example, ``325kel``. perform_validation : bool, optional Whether to perform validation. The default is ``False``. check_level : str, optional @@ -1654,16 +1654,16 @@ def edit_design_settings( Default surface material. The default is ``"Steel-oxidised-surface"``. export_monitor : bool, optional Whether to export monitor data. - The default value is ``False``. + The default is ``False``. export_sherlock : bool, optional Whether to export temperature data for Sherlock. - The default value is ``False``. + The default is ``False``. export_directory : str, optional - Default export directory for monitor point and sherlock data. - The default value is the current working directory. + Default export directory for monitor point and Sherlock data. + The default is the current working directory. gauge_pressure : float, str, optional - Set the Gauge pressure. It can be a float (units will be "n_per_meter_sq") or a string with units. - Default is ``0``. + Gauge pressure. It can be a float where "n_per_meter_sq" is assumed as the units or a string with the units specified. + The default is ``0``. radiation_temperature : float, str, optional Set the radiation temperature. It can be a float (units will be "cel") or a string with units. Default is ``20``. @@ -1684,7 +1684,7 @@ def edit_design_settings( >>> oDesign.SetDesignSettings """ # - # Configure design settings for gravity etc + # Configure design settings such as gravity ice_gravity = ["X", "Y", "Z"] gv_pos = False if int(gravity_dir) > 2: @@ -3084,7 +3084,7 @@ def apply_icepak_settings( """Apply Icepak default design settings. .. deprecated:: 0.8.9 - Use ``edit_design_settins`` method. + Use the ``edit_design_settins()`` method. Parameters ---------- @@ -3114,7 +3114,7 @@ def apply_icepak_settings( >>> oDesign.SetDesignSettings """ - warnings.warn("Use ``edit_design_settins`` method.", DeprecationWarning) + warnings.warn("Use the ``edit_design_settings()`` method.", DeprecationWarning) return self.edit_design_settings( ambient_temperature=ambienttemp, gravity_dir=gravityDir, @@ -3870,7 +3870,7 @@ def assign_stationary_wall_with_htc( radiate_surf_mat="Steel-oxidised-surface", shell_conduction=False, ): - """Assign a surface wall boundary condition with specified heat transfer coefficient. + """Assign a surface wall boundary condition with a given heat transfer coefficient. Parameters ---------- @@ -6433,7 +6433,7 @@ def execute(self, k, v): if k == "AmbTemp" and isinstance(v, (dict, BoundaryDictionary)): self.logger.error("Failed. Use `edit_design_settings` function.") return self.design_settings["AmbTemp"] - # Bug in native API. Uncomment when fixed + # FIXME: Bug in native API. Uncomment when fixed # if not self.solution_type == "Transient": # self.logger.error("Transient assignment is supported only in transient designs.") # return False