def _copy_future_state(source, dest):
 assert source.done()
 if dest.cancelled():
  return
 assert (not dest.done())
 if source.cancelled():
  dest.cancel()
 else:
  exception = source.exception()
  if (exception is not None):
   dest.set_exception(exception)
  else:
   result = source.result()
   dest.set_result(result)

def _copy_future_state ( source , dest ) : assert source . done ( ) if dest . cancelled ( ) : return assert ( not dest . done ( ) ) if source . cancelled ( ) : dest . cancel ( ) else : exception = source . exception ( ) if ( exception is not None ) : dest . set_exception ( exception ) else : result = source . result ( ) dest . set_result ( result )
internal helper to copy state from another future .