From d682d3ea6e20a632b8a42da42bf7853b05af4358 Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Mon, 27 May 2019 22:27:51 +0200 Subject: [PATCH] FEM: code formating, line length < 100, there still where some left --- src/Mod/Fem/femcommands/commands.py | 5 ++++- .../femguiobjects/_ViewProviderFemMeshGmsh.py | 3 ++- src/Mod/Fem/femsolver/calculix/writer.py | 15 +++++++++++--- src/Mod/Fem/femtest/utilstest.py | 20 ++++++++++++++----- 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/Mod/Fem/femcommands/commands.py b/src/Mod/Fem/femcommands/commands.py index 6153cba38a..4a08def59f 100644 --- a/src/Mod/Fem/femcommands/commands.py +++ b/src/Mod/Fem/femcommands/commands.py @@ -651,7 +651,10 @@ class _CommandFemMaterialMechanicalNonlinear(CommandManager): # CalculiX solver or new frame work CalculiX solver if solver_object \ and hasattr(solver_object, "Proxy") \ - and (solver_object.Proxy.Type == 'Fem::FemSolverCalculixCcxTools' or solver_object.Proxy.Type == 'Fem::FemSolverObjectCalculix'): + and ( + solver_object.Proxy.Type == 'Fem::FemSolverCalculixCcxTools' + or solver_object.Proxy.Type == 'Fem::FemSolverObjectCalculix' + ): print( 'Set MaterialNonlinearity and GeometricalNonlinearity to nonlinear for {}' .format(solver_object.Label) diff --git a/src/Mod/Fem/femguiobjects/_ViewProviderFemMeshGmsh.py b/src/Mod/Fem/femguiobjects/_ViewProviderFemMeshGmsh.py index 11543485d5..b286f2a682 100644 --- a/src/Mod/Fem/femguiobjects/_ViewProviderFemMeshGmsh.py +++ b/src/Mod/Fem/femguiobjects/_ViewProviderFemMeshGmsh.py @@ -207,7 +207,8 @@ class _ViewProviderFemMeshGmsh: return True def dragObject(self, selfvp, dragged_object): - if hasattr(dragged_object, "Proxy") and dragged_object.Proxy.Type == "Fem::FemMeshBoundaryLayer": + if hasattr(dragged_object, "Proxy") \ + and dragged_object.Proxy.Type == "Fem::FemMeshBoundaryLayer": objs = self.Object.MeshBoundaryLayerList objs.remove(dragged_object) self.Object.MeshBoundaryLayerList = objs diff --git a/src/Mod/Fem/femsolver/calculix/writer.py b/src/Mod/Fem/femsolver/calculix/writer.py index 92cfd8ed33..8d8032a32d 100644 --- a/src/Mod/Fem/femsolver/calculix/writer.py +++ b/src/Mod/Fem/femsolver/calculix/writer.py @@ -650,7 +650,10 @@ class FemInputWriterCcx(writerbase.FemInputWriter): f.write('** Young\'s modulus unit is MPa = N/mm2\n') if self.analysis_type == "frequency" \ or self.selfweight_objects \ - or (self.analysis_type == "thermomech" and not self.solver_obj.ThermoMechSteadyState): + or ( + self.analysis_type == "thermomech" + and not self.solver_obj.ThermoMechSteadyState + ): f.write('** Density\'s unit is t/mm^3\n') if self.analysis_type == "thermomech": f.write('** Thermal conductivity unit is kW/mm/K = t*mm/K*s^3\n') @@ -668,7 +671,10 @@ class FemInputWriterCcx(writerbase.FemInputWriter): PR = float(mat_obj.Material['PoissonRatio']) if self.analysis_type == "frequency" \ or self.selfweight_objects \ - or (self.analysis_type == "thermomech" and not self.solver_obj.ThermoMechSteadyState): + or ( + self.analysis_type == "thermomech" + and not self.solver_obj.ThermoMechSteadyState + ): density = FreeCAD.Units.Quantity(mat_obj.Material['Density']) density_in_tonne_per_mm3 = float(density.getValueAs('t/mm^3')) if self.analysis_type == "thermomech": @@ -695,7 +701,10 @@ class FemInputWriterCcx(writerbase.FemInputWriter): if self.analysis_type == "frequency" \ or self.selfweight_objects \ - or (self.analysis_type == "thermomech" and not self.solver_obj.ThermoMechSteadyState): + or ( + self.analysis_type == "thermomech" + and not self.solver_obj.ThermoMechSteadyState + ): f.write('*DENSITY\n') f.write('{0:.3e}\n'.format(density_in_tonne_per_mm3)) if self.analysis_type == "thermomech": diff --git a/src/Mod/Fem/femtest/utilstest.py b/src/Mod/Fem/femtest/utilstest.py index b0d4f88f5e..f9578339a2 100644 --- a/src/Mod/Fem/femtest/utilstest.py +++ b/src/Mod/Fem/femtest/utilstest.py @@ -139,13 +139,17 @@ def compare_inp_files( # for python3 problem with 1DFlow input # TODO as soon as the 1DFlow result reading is fixed # this should be triggered in the 1DFlow unit test - lf1 = [l for l in f1 if not (l.startswith('** written ') or l.startswith('** file ') or l.startswith('17671.0,1'))] + lf1 = [l for l in f1 if not ( + l.startswith('** written ') or l.startswith('** file ') or l.startswith('17671.0,1') + )] lf1 = force_unix_line_ends(lf1) file2 = open(file_name2, 'r') f2 = file2.readlines() file2.close() # TODO see comment on file1 - lf2 = [l for l in f2 if not (l.startswith('** written ') or l.startswith('** file ') or l.startswith('17671.0,1'))] + lf2 = [l for l in f2 if not ( + l.startswith('** written ') or l.startswith('** file ') or l.startswith('17671.0,1') + )] lf2 = force_unix_line_ends(lf2) import difflib diff = difflib.unified_diff(lf1, lf2, n=0) @@ -169,12 +173,16 @@ def compare_files( file1.close() # workaround to compare geos of elmer test and temporary file path # (not only names change, path changes with operating system) - lf1 = [l for l in f1 if not (l.startswith('Merge "') or l.startswith('Save "') or l.startswith('// '))] + lf1 = [l for l in f1 if not ( + l.startswith('Merge "') or l.startswith('Save "') or l.startswith('// ') + )] lf1 = force_unix_line_ends(lf1) file2 = open(file_name2, 'r') f2 = file2.readlines() file2.close() - lf2 = [l for l in f2 if not (l.startswith('Merge "') or l.startswith('Save "') or l.startswith('// '))] + lf2 = [l for l in f2 if not ( + l.startswith('Merge "') or l.startswith('Save "') or l.startswith('// ') + )] lf2 = force_unix_line_ends(lf2) import difflib diff = difflib.unified_diff(lf1, lf2, n=0) @@ -270,7 +278,9 @@ def collect_python_modules( ) else: collected_modules.append( - femsubdir.replace('/', '.') + '.' + os.path.splitext(os.path.basename(pyfile))[0] + femsubdir.replace('/', '.') + '.' + os.path.splitext( + os.path.basename(pyfile) + )[0] ) return collected_modules