All Samples(5646) | Call(5267) | Derive(0) | Import(379)
User-callable function to create and return a unique temporary directory. The return value is the pathname of the directory. Arguments are as for mkstemp, except that the 'text' argument is not accepted. The directory is readable, writable, and searchable only by the creating user. Caller is responsible for deleting the directory when done with it.
def mkdtemp(suffix="", prefix=template, dir=None):
"""User-callable function to create and return a unique temporary
directory. The return value is the pathname of the directory.
Arguments are as for mkstemp, except that the 'text' argument is
not accepted.
The directory is readable, writable, and searchable only by the
creating user.
Caller is responsible for deleting the directory when done with it.
"""
if dir is None:
dir = gettempdir()
names = _get_candidate_names()
for seq in xrange(TMP_MAX):
name = names.next()
file = _os.path.join(dir, prefix + name + suffix)
try:
_os.mkdir(file, 0700)
return file
except OSError, e:
if e.errno == _errno.EEXIST:
continue # try again
raise
raise IOError, (_errno.EEXIST, "No usable temporary directory name found")
print 'bye!'
"""
fp = tempfile.mkdtemp(prefix = 'DemoTmp')
fd, filename = tempfile.mkstemp(prefix = 'demoExample1File', suffix = '.py',
dir = fp)
f = os.fdopen(fd, 'wt')
src/i/p/ipython-0.10/docs/examples/core/demo-exercizer.py ipython(Download)
print 'bye!'
"""
fp = tempfile.mkdtemp(prefix = 'DemoTmp')
fd, filename = tempfile.mkstemp(prefix = 'demoExample1File', suffix = '.py',
dir = fp)
f = os.fdopen(fd, 'wt')
src/x/h/xhtml2pdf-HEAD/tests/test_samples.py xhtml2pdf(Download)
def loadFile(self, file, folder=None, delete=True):
if folder is None:
folder = self.folder4del = tempfile.mkdtemp(prefix="visualdiff-tmp-")
delete = True
# print "FOLDER", folder, "DELETE", delete
source = os.path.abspath(file)
destination = os.path.join(folder, os.path.basename(file) + "-%04d" + self.SUFFIX)
src/p/y/pyrun-0.2.1a.dev/examples/_testutils.py pyrun(Download)
import os, sys
from os.path import join, isabs
from tempfile import mkdtemp
from distutils.dir_util import mkpath
def printitems(itr):
for i in itr:
"""
if tmpdir is None:
tmpdir = mkdtemp(prefix=prefix)
created = []
for p in filepaths:
src/p/i/pisa-3.0.33/tests/test_samples.py pisa(Download)
def loadFile(self, file, folder=None, delete=True):
if folder is None:
folder = self.folder4del = tempfile.mkdtemp(prefix="visualdiff-tmp-")
delete = True
# print "FOLDER", folder, "DELETE", delete
source = os.path.abspath(file)
destination = os.path.join(folder, os.path.basename(file) + "-%04d" + self.SUFFIX)
src/s/i/SimpleExampleEgg-0.2/ez_setup/__init__.py SimpleExampleEgg(Download)
import setuptools
except ImportError:
import tempfile, shutil
tmpdir = tempfile.mkdtemp(prefix="easy_install-")
try:
egg = download_setuptools(version, to_dir=tmpdir, delay=0)
sys.path.insert(0,egg)
src/n/i/nipy-HEAD/examples/neurospin/need_data/group_reproducibility_analysis.py nipy(Download)
for n in range(nsubj)]
contrast_images =[ op.join(data_dir,'con_%04d_subj_%02d.nii'%(nbeta,n))
for n in range(nsubj)]
swd = tempfile.mkdtemp('image')
##############################################################################
# main script
src/n/i/NiPy-OLD-HEAD/examples/neurospin/need_data/group_reproducibility_analysis.py NiPy-OLD(Download)
for n in range(nsubj)]
contrast_images =[ op.join(data_dir,'con_%04d_subj_%02d.nii'%(nbeta,n))
for n in range(nsubj)]
swd = tempfile.mkdtemp('image')
################################################################################
# Make a group mask
src/r/n/rnaspace-1.0/rnaspace/core/prediction/wrappers/wrapper.py rnaspace(Download)
def get_temporary_directory(self, suffix=None, prefix=None):
"""
Return a temporary directory
"""
if suffix is not None:
if prefix is not None:
tmp_dir = tempfile.mkdtemp(suffix=suffix, prefix=prefix, dir=self.tmp_dir)
else:
tmp_dir = tempfile.mkdtemp(suffix=suffix, dir=self.tmp_dir)
else:
if prefix is not None:
tmp_dir = tempfile.mkdtemp(prefix=prefix, dir=self.tmp_dir)
else:
tmp_dir = tempfile.mkdtemp(dir=self.tmp_dir)
src/w/a/waterworks-0.2.5/waterworks/Files.py waterworks(Download)
f = file(filename, mode)
return f
else: # dir
return tempfile.mkdtemp(suffix=suffix, prefix=prefix, dir=dir)
else:
return tempfile.NamedTemporaryFile(mode=mode, suffix=suffix,
prefix=prefix, dir=dir)
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next