diff --git a/src/Mod/Fem/femsolver/calculix/write_constraint_centrif.py b/src/Mod/Fem/femsolver/calculix/write_constraint_centrif.py index b5a0b98753..7de90b5aa5 100644 --- a/src/Mod/Fem/femsolver/calculix/write_constraint_centrif.py +++ b/src/Mod/Fem/femsolver/calculix/write_constraint_centrif.py @@ -27,7 +27,6 @@ __url__ = "https://www.freecadweb.org" import math -import six import FreeCAD @@ -62,8 +61,7 @@ def get_after_write_constraint(): def write_meshdata_constraint(f, femobj, centrif_obj, ccxwriter): f.write("*ELSET,ELSET={}\n".format(centrif_obj.Name)) - # use six to be sure to be Python 2.7 and 3.x compatible - if isinstance(femobj["FEMElements"], six.string_types): + if isinstance(femobj["FEMElements"], str): f.write("{}\n".format(femobj["FEMElements"])) else: for e in femobj["FEMElements"]: diff --git a/src/Mod/Fem/femsolver/calculix/write_constraint_fluidsection.py b/src/Mod/Fem/femsolver/calculix/write_constraint_fluidsection.py index b5819bcbd7..1127456a56 100644 --- a/src/Mod/Fem/femsolver/calculix/write_constraint_fluidsection.py +++ b/src/Mod/Fem/femsolver/calculix/write_constraint_fluidsection.py @@ -28,7 +28,6 @@ __url__ = "https://www.freecadweb.org" import codecs import os -import six from os.path import join import FreeCAD @@ -61,8 +60,7 @@ def handle_fluidsection_liquid_inlet_outlet(inpfile, ccxwriter): def get_fluidsection_inoutlet_obj_if_setdata(matgeoset): if ( matgeoset["ccx_elset"] - # use six to be sure to be Python 2.7 and 3.x compatible - and not isinstance(matgeoset["ccx_elset"], six.string_types) + and not isinstance(matgeoset["ccx_elset"], str) and "fluidsection_obj" in matgeoset # fluid mesh ): fluidsec_obj = matgeoset["fluidsection_obj"] diff --git a/src/Mod/Fem/femsolver/calculix/write_femelement_matgeosets.py b/src/Mod/Fem/femsolver/calculix/write_femelement_matgeosets.py index daa27e6749..4953a313a1 100644 --- a/src/Mod/Fem/femsolver/calculix/write_femelement_matgeosets.py +++ b/src/Mod/Fem/femsolver/calculix/write_femelement_matgeosets.py @@ -26,7 +26,6 @@ __author__ = "Bernd Hahnebach" __url__ = "https://www.freecadweb.org" -import six def write_femelement_matgeosets(f, ccxwriter): @@ -39,8 +38,7 @@ def write_femelement_matgeosets(f, ccxwriter): f.write("*ELSET,ELSET={}\n".format(matgeoset["ccx_elset_name"])) - # use six to be sure to be Python 2.7 and 3.x compatible - if isinstance(matgeoset["ccx_elset"], six.string_types): + if isinstance(matgeoset["ccx_elset"], str): f.write("{}\n".format(matgeoset["ccx_elset"])) else: for elid in matgeoset["ccx_elset"]: diff --git a/src/Mod/Fem/femsolver/elmer/sifio.py b/src/Mod/Fem/femsolver/elmer/sifio.py index 63169f92ea..4003c2cf95 100644 --- a/src/Mod/Fem/femsolver/elmer/sifio.py +++ b/src/Mod/Fem/femsolver/elmer/sifio.py @@ -29,7 +29,6 @@ __url__ = "https://www.freecadweb.org" # @{ import collections -import six SIMULATION = "Simulation" CONSTANTS = "Constants" @@ -334,7 +333,7 @@ class _Writer(object): def _isCollection(self, data): return ( - not isinstance(data, six.string_types) + not isinstance(data, str) and isinstance(data, collections.abc.Iterable) ) @@ -418,16 +417,14 @@ class _Writer(object): return _TYPE_INTEGER if issubclass(dataType, float): return _TYPE_REAL - # use six to be sure to be Python 2.7 and 3.x compatible - if issubclass(dataType, six.string_types): + if issubclass(dataType, str): return _TYPE_STRING raise ValueError("Unsupported data type: %s" % dataType) def _preprocess(self, data, dataType): if issubclass(dataType, Section): return str(self._idMgr.getId(data)) - # use six to be sure to be Python 2.7 and 3.x compatible - if issubclass(dataType, six.string_types): + if issubclass(dataType, str): return '"%s"' % data return str(data) diff --git a/src/Mod/Fem/femviewprovider/view_base_femobject.py b/src/Mod/Fem/femviewprovider/view_base_femobject.py index f55b85ff87..4e05728210 100644 --- a/src/Mod/Fem/femviewprovider/view_base_femobject.py +++ b/src/Mod/Fem/femviewprovider/view_base_femobject.py @@ -30,7 +30,6 @@ __url__ = "https://www.freecadweb.org" # \ingroup FEM # \brief view provider as base for all FEM objects -from six import string_types import FreeCAD import FreeCADGui @@ -61,7 +60,7 @@ class VPBaseFemObject(object): ) return "" if ( - isinstance(self.Object.Proxy.Type, string_types) + isinstance(self.Object.Proxy.Type, str) and self.Object.Proxy.Type.startswith("Fem::") ): icon_path = "/icons/{}.svg".format(self.Object.Proxy.Type.replace("Fem::", "FEM_")) diff --git a/src/Mod/Import/stepZ.py b/src/Mod/Import/stepZ.py index 2b84c488a9..9b1a8817fd 100644 --- a/src/Mod/Import/stepZ.py +++ b/src/Mod/Import/stepZ.py @@ -11,7 +11,6 @@ # OCC7 doesn't support non-ASCII characters at the moment # https://forum.freecadweb.org/viewtopic.php?t=20815 -import six import FreeCAD import FreeCADGui @@ -31,7 +30,7 @@ ___stpZversion___ = "1.3.9" import gzip as gz -import builtins as builtin #py3 +import builtins import importlib @@ -78,8 +77,7 @@ def import_stpz(fn,fc,doc): tempdir = tempfile.gettempdir() # get the current temporary directory tempfilepath = os.path.join(tempdir,fname + u'.stp') - #with six.builtins.open(tempfilepath, 'wb') as f: #py3 - with builtin.open(tempfilepath, 'wb') as f: #py3 + with builtins.open(tempfilepath, 'wb') as f: #py3 f.write(fc) #ImportGui.insert(filepath) if doc is None: diff --git a/src/Mod/Path/Path/Base/Util.py b/src/Mod/Path/Path/Base/Util.py index 291a47c340..41c3c1a23b 100644 --- a/src/Mod/Path/Path/Base/Util.py +++ b/src/Mod/Path/Path/Base/Util.py @@ -31,7 +31,6 @@ other than Path.Log, then it probably doesn't belong here. """ import FreeCAD -import six import Path translate = FreeCAD.Qt.translate @@ -160,16 +159,17 @@ def clearExpressionEngine(obj): obj.setExpression(attr, None) +#TODO remove functions below, leftover from using six def toUnicode(string): """toUnicode(string) ... returns a unicode version of string regardless of the python version.""" - return six.text_type(string) + return str(string) def isString(string): """isString(string) ... return True if string is a string, regardless of string type and python version.""" - return isinstance(string, six.string_types) + return isinstance(string, str) def keyValueIter(dictionary): """keyValueIter(dict) ... return iterable object over dictionary's (key,value) tuples.""" - return six.iteritems(dictionary) + return dictionary.items()