def _get_default_tempdir():
 namer = _RandomNameSequence()
 dirlist = _candidate_tempdir_list()
 flags = _text_openflags
 for dir in dirlist:
  if (dir != _os.curdir):
   dir = _os.path.normcase(_os.path.abspath(dir))
  for seq in xrange(100):
   name = namer.next()
   filename = _os.path.join(dir, name)
   try:
    fd = _os.open(filename, flags, 384)
    try:
     try:
      with _io.open(fd, 'wb', closefd=False) as fp:
       fp.write('blat')
     finally:
      _os.close(fd)
    finally:
     _os.unlink(filename)
    return dir
   except (OSError, IOError) as e:
    if (e.args[0] != _errno.EEXIST):
     break
    pass
 raise IOError, (_errno.ENOENT, ('No usable temporary directory found in %s' % dirlist))

def _get_default_tempdir ( ) : namer = _RandomNameSequence ( ) dirlist = _candidate_tempdir_list ( ) flags = _text_openflags for dir in dirlist : if ( dir != _os . curdir ) : dir = _os . path . normcase ( _os . path . abspath ( dir ) ) for seq in xrange ( 100 ) : name = namer . next ( ) filename = _os . path . join ( dir , name ) try : fd = _os . open ( filename , flags , 384 ) try : try : with _io . open ( fd , 'wb' , closefd = False ) as fp : fp . write ( 'blat' ) finally : _os . close ( fd ) finally : _os . unlink ( filename ) return dir except ( OSError , IOError ) as e : if ( e . args [ 0 ] != _errno . EEXIST ) : break pass raise IOError , ( _errno . ENOENT , ( 'No usable temporary directory found in %s' % dirlist ) )
calculate the default directory to use for temporary files .