Merge pull request #9067 from Pesc0/removesix
remove remaining six dependencies
This commit is contained in:
@@ -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"]:
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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"]:
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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_"))
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user