Remove various sys.version_info >= 3 checks

This commit is contained in:
Chris Hennes
2022-11-07 21:52:24 -06:00
committed by Uwe
parent d02bb1b7ea
commit fa8e0a6865
3 changed files with 3 additions and 11 deletions

View File

@@ -359,8 +359,6 @@ class FCADLogger(object):
build.
'''
_string_type = str if sys.version_info[0] >= 3 else basestring
_levels = { 'Error':0, 'error':0,
'Warning':1, 'warn':1,
'Message':2, 'msg':2, 'info':2,
@@ -529,7 +527,7 @@ class FCADLogger(object):
string.format()
'''
if (args or kargs) and isinstance(msg,self.__class__._string_type):
if (args or kargs) and isinstance(msg,str):
if not kargs:
msg = msg.format(*args)
else:

View File

@@ -155,13 +155,7 @@ Py::Object Vector2dPy::getattro(const Py::String &name_)
//
std::string name( name_.as_std_string( "utf-8" ) );
if (name == "__members__") { // Py2
Py::List attr;
attr.append(Py::String("x"));
attr.append(Py::String("y"));
return attr;
}
else if (name == "__dict__") { // Py3
if (name == "__dict__") {
Py::Dict attr;
attr.setItem(Py::String("x"), Py::Float(v.x));
attr.setItem(Py::String("y"), Py::Float(v.y));

View File

@@ -95,7 +95,7 @@ def searchforopenscadexe():
stdout=subprocess.PIPE,stderr=subprocess.PIPE)
stdout, stderr = p1.communicate(ascript)
if p1.returncode == 0:
opathl = stdout.decode().split('\n') if sys.version_info.major >= 3 else stdout.split('\n')
opathl = stdout.decode().split('\n')
if len(opathl) >= 1:
return opathl[0]+'Contents/MacOS/OpenSCAD'
#test the default path