[FEM] remove checks for Python 2

This commit is contained in:
Uwe
2022-07-23 15:15:00 +02:00
parent 5f82cfb39f
commit a035d650b6
9 changed files with 2 additions and 46 deletions

View File

@@ -153,8 +153,6 @@ class _TaskPanel:
self.form.cb_order.setCurrentIndex(index_order)
def console_log(self, message="", color="#000000"):
if (not isinstance(message, bytes)) and (sys.version_info.major < 3):
message = message.encode("utf-8", "replace")
self.console_message_gmsh = self.console_message_gmsh + (
'<font color="#0000FF">{0:4.1f}:</font> <font color="{1}">{2}</font><br>'
.format(time.time() - self.Start, color, message)

View File

@@ -173,8 +173,6 @@ class _TaskPanel:
return
def femConsoleMessage(self, message="", color="#000000"):
if sys.version_info.major < 3:
message = message.encode("utf-8", "replace")
self.fem_console_message = self.fem_console_message + (
'<font color="#0000FF">{0:4.1f}:</font> <font color="{1}">{2}</font><br>'
.format(time.time() - self.Start, color, message)

View File

@@ -124,13 +124,6 @@ class TestFemCommon(unittest.TestCase):
# import all collected modules
# fcc_print(pymodules)
for mod in pymodules:
# migrate modules do not import on Python 2
if (
mod == "femtools.migrate_app"
or mod == "femguiutils.migrate_gui"
) and sys.version_info.major < 3:
continue
if (
mod == "femsolver.solver_taskpanel"
or mod == "femexamples.examplesgui"

View File

@@ -129,10 +129,6 @@ class TestObjectOpen(unittest.TestCase):
def test_femobjects_open_de9b3fb438(
self
):
# migration modules do not import on Python 2 thus this can not work
if sys.version_info.major < 3:
return
# the number in method name is the FreeCAD commit the document was created with
# https://github.com/FreeCAD/FreeCAD/commit/de9b3fb438
# the document was created by running the object create unit test

View File

@@ -175,13 +175,6 @@ class TestSolverElmer(unittest.TestCase):
def test_ccxcantilever_faceload_1_si(
self
):
if sys.version_info.major < 3:
# TODO does not pass on Python 2
# https://travis-ci.org/github/FreeCAD/FreeCAD/builds/707885742
# https://api.travis-ci.org/v3/job/707885745/log.txt
fcc_print("Python 2: test aborted.")
return
fcc_print("")
self.set_unit_schema(1) # SI-units m/kg/s
from femexamples.ccx_cantilever_faceload import setup

View File

@@ -115,13 +115,6 @@ class TestSolverZ88(unittest.TestCase):
self,
base_name
):
if sys.version_info.major < 3:
# TODO does not pass on Python 2
# https://travis-ci.org/github/FreeCAD/FreeCAD/builds/707780320
# https://api.travis-ci.org/v3/job/707780323/log.txt
fcc_print("Python 2: test aborted.")
return
self.document.recompute()
# start

View File

@@ -126,10 +126,6 @@ class TestObjectOpen(unittest.TestCase):
def test_femobjects_open_de9b3fb438(
self
):
# migration modules do not import on Python 2 thus this can not work
if sys.version_info.major < 3:
return
# the number in method name is the FreeCAD commit the document was created with
# https://github.com/FreeCAD/FreeCAD/commit/de9b3fb438
# the document was created by running the object create unit test

View File

@@ -378,16 +378,8 @@ def get_refshape_type(fem_doc_object):
def pydecode(bytestring):
""" Return *bytestring* as a unicode string for python 2 and 3.
For python 2 *bytestring* is converted to a string of type ``unicode``. For
python 3 it is returned as is because it uses unicode for it's ``str`` type
already.
"""
if sys.version_info.major < 3:
return bytestring
else:
return bytestring.decode("utf-8")
""" Return *bytestring* as a unicode string """
return bytestring.decode("utf-8")
def startProgramInfo(code):

View File

@@ -543,9 +543,6 @@ class MaterialEditor:
group = item.parent()
it = group.child(item.row(), 1)
name = it.text()
if sys.version_info.major < 3:
if isinstance(name, unicode):
name = name.encode("utf8")
if not name:
name = "Material"
filetuple = QtGui.QFileDialog.getSaveFileName(