Resolve SyntaxWarning literal comparison in py3.8

Comparison with literals should be done using != and == and not 'is
not' and 'is'.
Found the files using:
find . -name \*.py -exec pylint --disable=all --enable=R0123 --score=no {} \;

Python 3.8 prints out SyntaxWarnings when reading the files, this
would happen for example on every installation.
This commit is contained in:
Sebastian Bachmann
2020-04-09 20:05:50 +02:00
committed by Yorik van Havre
parent f692494ada
commit c2a2effac2
3 changed files with 4 additions and 4 deletions

View File

@@ -67,7 +67,7 @@ def run_analysis(doc, base_name, filepath=""):
# print([obj.Name for obj in doc.Objects])
# filepath
if filepath is "":
if filepath == "":
filepath = join(gettmp(), "FEM_examples")
if not exists(filepath):
makedirs(filepath)
@@ -78,7 +78,7 @@ def run_analysis(doc, base_name, filepath=""):
from femtools.femutils import is_derived_from
if (
is_derived_from(m, "Fem::FemSolverObjectPython")
and m.Proxy.Type is not "Fem::FemSolverCalculixCcxTools"
and m.Proxy.Type != "Fem::FemSolverCalculixCcxTools"
):
solver = m
break

View File

@@ -186,7 +186,7 @@ def export(objectslist, fileString, group_values_dict_nogui=None):
writeFenicsXML.write_fenics_mesh_xml(obj, fileString)
elif fileExtension.lower() == ".xdmf":
mesh_groups = importToolsFem.get_FemMeshObjectMeshGroups(obj)
if mesh_groups is not ():
if mesh_groups != ():
# if there are groups found, make task panel available if GuiUp
if FreeCAD.GuiUp == 1:
panel = WriteXDMFTaskPanel(obj, fileString)

View File

@@ -317,7 +317,7 @@ def write_fenics_mesh_xdmf(
fem_mesh = fem_mesh_obj.FemMesh
gmshgroups = get_FemMeshObjectMeshGroups(fem_mesh_obj)
if gmshgroups is not ():
if gmshgroups != ():
Console.PrintMessage("found mesh groups\n")
for g in gmshgroups: