def _convertToNewStyle(newClass, oldInstance):
 if (oldInstance.__class__.__name__ == 'ExperimentHandler'):
  newHandler = psychopy.data.ExperimentHandler()
 else:
  newHandler = newClass([], 0)
 for thisAttrib in dir(oldInstance):
  if ('instancemethod' in str(type(getattr(oldInstance, thisAttrib)))):
   continue
  elif (thisAttrib == '__weakref__'):
   continue
  else:
   value = getattr(oldInstance, thisAttrib)
   setattr(newHandler, thisAttrib, value)
 return newHandler

def _convertToNewStyle ( newClass , oldInstance ) : if ( oldInstance . __class__ . __name__ == 'ExperimentHandler' ) : newHandler = psychopy . data . ExperimentHandler ( ) else : newHandler = newClass ( [ ] , 0 ) for thisAttrib in dir ( oldInstance ) : if ( 'instancemethod' in str ( type ( getattr ( oldInstance , thisAttrib ) ) ) ) : continue elif ( thisAttrib == '__weakref__' ) : continue else : value = getattr ( oldInstance , thisAttrib ) setattr ( newHandler , thisAttrib , value ) return newHandler
converts un-pickled old-style compatibility classes to new-style ones by initializing a new-style class and copying the old compatibility instances attributes .