From 15babab61d2d6f684e31bc4cb5ef7e9eb4975dfe Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Wed, 22 Nov 2017 01:13:42 +0800 Subject: [PATCH] Drop usage of future and past module FC Windows distribution doesn't have these modules --- constraint.py | 4 ++-- gui.py | 4 ++-- proxy.py | 3 +-- sys_slvs.py | 4 ++-- sys_sympy.py | 10 ++++++---- system.py | 4 ++-- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/constraint.py b/constraint.py index 815f535..a5062ad 100644 --- a/constraint.py +++ b/constraint.py @@ -1,4 +1,3 @@ -from future.utils import with_metaclass from collections import namedtuple import FreeCAD, FreeCADGui import asm3 @@ -310,7 +309,8 @@ def cstrName(obj): return '{}<{}>'.format(objName(obj),Constraint.getTypeName(obj)) -class Base(with_metaclass(Constraint,object)): +class Base(object): + __metaclass__ = Constraint _id = -1 _entityDef = () _workplane = False diff --git a/gui.py b/gui.py index 07ac9bb..184ac6e 100644 --- a/gui.py +++ b/gui.py @@ -1,4 +1,3 @@ -from future.utils import with_metaclass from collections import OrderedDict import FreeCAD, FreeCADGui import asm3 @@ -101,7 +100,8 @@ class AsmCmdManager(ProxyType): def onClearSelection(cls): pass -class AsmCmdBase(with_metaclass(AsmCmdManager,object)): +class AsmCmdBase(object): + __metaclass__ = AsmCmdManager _id = -1 _active = None _toolbarName = 'Assembly3' diff --git a/proxy.py b/proxy.py index 6eefa37..49e9bcc 100644 --- a/proxy.py +++ b/proxy.py @@ -1,4 +1,3 @@ -import past.builtins as pb from collections import namedtuple from asm3.utils import proxylogger as logger, objName @@ -60,7 +59,7 @@ class ProxyType(type): @classmethod def getType(mcs,tp): - if isinstance(tp,pb.basestring): + if isinstance(tp,basestring): return mcs.getInfo().TypeNameMap[tp] if not isinstance(tp,int): tp = mcs.getTypeID(tp) diff --git a/sys_slvs.py b/sys_slvs.py index 7de0579..f8502c4 100644 --- a/sys_slvs.py +++ b/sys_slvs.py @@ -1,9 +1,9 @@ -from future.utils import with_metaclass from asm3.system import System, SystemBase, SystemExtension from asm3.utils import syslogger as logger, objName import asm3.py_slvs.slvs as slvs -class SystemSlvs(with_metaclass(System,SystemBase)): +class SystemSlvs(SystemBase): + __metaclass__ = System _id = 1 def __init__(self,obj): diff --git a/sys_sympy.py b/sys_sympy.py index 4871dec..2f77f9b 100644 --- a/sys_sympy.py +++ b/sys_sympy.py @@ -1,5 +1,4 @@ from collections import namedtuple -from future.utils import with_metaclass, iteritems import pprint from asm3.proxy import ProxyType, PropertyInfo from asm3.system import System, SystemBase, SystemExtension @@ -25,7 +24,8 @@ def _makeProp(name,doc='',tp='App::PropertyFloat',group=None): _makeProp('Tolerance','','App::PropertyPrecision','Solver') -class _AlgoBase(with_metaclass(_AlgoType,object)): +class _AlgoBase(object): + __metaclass__ = _AlgoType _id = -2 _common_options = [_makeProp('maxiter', 'Maximum number of function evaluations','App::PropertyInteger')] @@ -201,7 +201,8 @@ class _Algodogleg(_AlgoNeedHessian): class _Algotrust_ncg(_Algodogleg): _id = 10 -class SystemSymPy(with_metaclass(System,SystemBase)): +class SystemSymPy(SystemBase): + __metaclass__ = System _id = 2 def __init__(self,obj): @@ -297,7 +298,8 @@ class _MetaType(type): return issubclass(cls,_Constraint) -class _MetaBase(with_metaclass(_MetaType,_Base)): +class _MetaBase(_Base): + __metaclass__ = _MetaType _args = () _opts = () _vargs = () diff --git a/system.py b/system.py index 886c9e0..e51a93a 100644 --- a/system.py +++ b/system.py @@ -1,5 +1,4 @@ import os -from future.utils import with_metaclass import asm3.utils as utils from asm3.utils import syslogger as logger, objName from asm3.proxy import ProxyType, PropertyInfo @@ -70,7 +69,8 @@ def _makePropInfo(name,tp,doc=''): _makePropInfo('Verbose','App::PropertyBool') -class SystemBase(with_metaclass(System,object)): +class SystemBase(object): + __metaclass__ = System _id = 0 _props = ['Verbose']