def close(*args):
 if (len(args) == 0):
  figManager = _pylab_helpers.Gcf.get_active()
  if (figManager is None):
   return
  else:
   figManager.canvas.mpl_disconnect(figManager._cidgcf)
   _pylab_helpers.Gcf.destroy(figManager.num)
 elif (len(args) == 1):
  arg = args[0]
  if (arg == 'all'):
   for manager in _pylab_helpers.Gcf.get_all_fig_managers():
    manager.canvas.mpl_disconnect(manager._cidgcf)
    _pylab_helpers.Gcf.destroy(manager.num)
  elif isinstance(arg, int):
   _pylab_helpers.Gcf.destroy(arg)
  elif isinstance(arg, Figure):
   for manager in _pylab_helpers.Gcf.get_all_fig_managers():
    if (manager.canvas.figure == arg):
     manager.canvas.mpl_disconnect(manager._cidgcf)
     _pylab_helpers.Gcf.destroy(manager.num)
  else:
   raise TypeError(('Unrecognized argument type %s to close' % type(arg)))
 else:
  raise TypeError('close takes 0 or 1 arguments')

def close ( * args ) : if ( len ( args ) == 0 ) : figManager = _pylab_helpers . Gcf . get_active ( ) if ( figManager is None ) : return else : figManager . canvas . mpl_disconnect ( figManager . _cidgcf ) _pylab_helpers . Gcf . destroy ( figManager . num ) elif ( len ( args ) == 1 ) : arg = args [ 0 ] if ( arg == 'all' ) : for manager in _pylab_helpers . Gcf . get_all_fig_managers ( ) : manager . canvas . mpl_disconnect ( manager . _cidgcf ) _pylab_helpers . Gcf . destroy ( manager . num ) elif isinstance ( arg , int ) : _pylab_helpers . Gcf . destroy ( arg ) elif isinstance ( arg , Figure ) : for manager in _pylab_helpers . Gcf . get_all_fig_managers ( ) : if ( manager . canvas . figure == arg ) : manager . canvas . mpl_disconnect ( manager . _cidgcf ) _pylab_helpers . Gcf . destroy ( manager . num ) else : raise TypeError ( ( 'Unrecognized argument type %s to close' % type ( arg ) ) ) else : raise TypeError ( 'close takes 0 or 1 arguments' )
explicitly clears all contexts in the current thread .