From 5831c845165ef0d34e7ffcf5ae949f934c8d9129 Mon Sep 17 00:00:00 2001 From: MaxJPRey Date: Mon, 20 Jun 2022 18:23:49 +0200 Subject: [PATCH 1/4] Import of BitmapImage is duplicated in the toolkit. --- pyaedt/generic/toolkit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyaedt/generic/toolkit.py b/pyaedt/generic/toolkit.py index 4705347371d..0d984890f80 100644 --- a/pyaedt/generic/toolkit.py +++ b/pyaedt/generic/toolkit.py @@ -121,7 +121,6 @@ from System.Windows.Media.Imaging import BitmapImage, BitmapCacheOption, BitmapCreateOptions from System import Uri, UriKind, Environment -from System.Windows.Media.Imaging import BitmapImage @pyaedt_function_handler() @@ -200,6 +199,7 @@ def copy_files_mkdir(root, files_in_subdir): Returns ------- bool + ``True`` when successful, ``False`` when failed. """ if not os.path.exists(root): os.mkdir(root) From f1f0523a9989ebadd799ff6ed5fb19e82ea9e3ca Mon Sep 17 00:00:00 2001 From: MaxJPRey Date: Mon, 20 Jun 2022 18:25:19 +0200 Subject: [PATCH 2/4] Use 'not in' condition in a pythonic way. --- pyaedt/maxwell.py | 2 +- pyaedt/modules/report_templates.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyaedt/maxwell.py b/pyaedt/maxwell.py index 4af9e9c874a..92e50ed2ab7 100644 --- a/pyaedt/maxwell.py +++ b/pyaedt/maxwell.py @@ -239,7 +239,7 @@ def assign_matrix( self.logger.info("Infinite is the only return path option in EddyCurrent") return_path = ["infinite"] * len(sources) - if not self.solution_type in ["Transient", "ElectricTransient"]: + if self.solution_type not in ["Transient", "ElectricTransient"]: if not matrix_name: matrix_name = generate_unique_name("Matrix") if not turns or len(sources) != len(self.modeler.convert_to_selections(turns, True)): diff --git a/pyaedt/modules/report_templates.py b/pyaedt/modules/report_templates.py index 58cb160320a..032c0190b59 100644 --- a/pyaedt/modules/report_templates.py +++ b/pyaedt/modules/report_templates.py @@ -1998,11 +1998,11 @@ def __init__(self, app, report_type, setup_name): self.domain = "Sweep" self.primary_sweep = "Phi" self.secondary_sweep = "Theta" - if not "Phi" in self.variations: + if "Phi" not in self.variations: self.variations["Phi"] = ["All"] - if not "Theta" in self.variations: + if "Theta" not in self.variations: self.variations["Theta"] = ["All"] - if not "Freq" in self.variations: + if "Freq" not in self.variations: self.variations["Freq"] = ["Nominal"] @property From ee6b0c5a35e36b8a17ea6973a62a9e5562cd62e3 Mon Sep 17 00:00:00 2001 From: MaxJPRey Date: Mon, 20 Jun 2022 18:27:39 +0200 Subject: [PATCH 3/4] Comparison to None should use 'is' and not '=='. --- pyaedt/icepak.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyaedt/icepak.py b/pyaedt/icepak.py index 5e4cfd05563..ad79e99ecf0 100644 --- a/pyaedt/icepak.py +++ b/pyaedt/icepak.py @@ -1489,9 +1489,9 @@ def assign_em_losses( >>> oModule.AssignEMLoss """ - if surface_objects == None: + if surface_objects is None: surface_objects = [] - if object_list == None: + if object_list is None: object_list = [] self.logger.info("Mapping HFSS EM losses.") From c108d781562354996e8e5525adad2c18c7747c52 Mon Sep 17 00:00:00 2001 From: MaxJPRey Date: Mon, 20 Jun 2022 18:30:04 +0200 Subject: [PATCH 4/4] Local variable 'point' was never used. --- pyaedt/generic/plot.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pyaedt/generic/plot.py b/pyaedt/generic/plot.py index 8e60c47ed5b..d9328a88958 100644 --- a/pyaedt/generic/plot.py +++ b/pyaedt/generic/plot.py @@ -1191,7 +1191,6 @@ def _read_mesh_files(self, read_frames=False): field.is_vector = False field.log = log1 else: - points = [] nodes = [] values = [] is_vector = False