def gettempdir():
"""Accessor for tempfile.tempdir."""
global tempdir
if tempdir is None:
_once_lock.acquire()
try:
if tempdir is None:
tempdir = _get_default_tempdir()
finally:
_once_lock.release()
return tempdir
# now see how fast it is for a little one small=arange(10) st=time() from tempfile import gettempdir, gettempprefix, mkstemp #tmp=gettempdir()+gettempprefix() tmpfd=mkstemp(suffix='.npz')
src/n/e/NeuroTools-0.1.0/examples/parameter_search/parameter_search.py NeuroTools(Download)
"""
import subprocess, tempfile
if furl_dir is None:
furl_dir = tempfile.gettempdir()
(fd, engine_furl) = tempfile.mkstemp(dir = furl_dir,
prefix = 'furl_engine_')
(fd, multiengine_furl) = tempfile.mkstemp(dir = furl_dir,
src/w/s/WsgiDAV-0.4.0b2/wsgidav/server/server_sample.py WsgiDAV(Download)
# (c) 2009 Martin Wendt and contributors; see WsgiDAV http://wsgidav.googlecode.com/ # Author of original PyFileServer: Ho Chun Wei, fuzzybr80(at)gmail.com # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php """ Simple example how to a run WsgiDAV in a 3rd-party WSGI server. """ from tempfile import gettempdir
__docformat__ = "reStructuredText" rootpath = gettempdir() provider = FilesystemProvider(rootpath) config = DEFAULT_CONFIG.copy()
src/g/r/grailbrowser-HEAD/src/SampleGrailDir/user/rcgrail.py grailbrowser(Download)
def rc_filename(user=None, display=None):
tmpdir = tempfile.gettempdir()
user = os.environ['USER'] or os.environ['LOGNAME']
if not display:
display = os.environ['DISPLAY'] or ':0'
display = normalize_display(display)
sfile = '%s-%s' % (user, display)
src/p/y/PyMT-0.5.1/examples/apps/mtwitter/twitter.py PyMT(Download)
def _GetTmpCachePath(self):
username = self._GetUsername()
cache_directory = 'python.cache_' + username
return os.path.join(tempfile.gettempdir(), cache_directory)
def _InitializeRootDirectory(self, root_directory):
if not root_directory:
src/f/i/fileconveyor-HEAD/code/transporters/transporter_sample.py fileconveyor(Download)
none.sync_file("drupal-5-6.png")
none.sync_file("subdir/bmi-chart.png")
subprocess.call("echo yarhar > $TMPDIR/foobar.txt", shell=True, stdout=subprocess.PIPE)
none.sync_file(os.path.join(tempfile.gettempdir(), "foobar.txt"))
none.sync_file("subdir/bmi-chart.png", "subdir/bmi-chart.png", Transporter.DELETE)
time.sleep(5)
none.stop()
src/p/y/pyshareflow-HEAD/examples/google-docs/google_docs_example.py pyshareflow(Download)
print "Found Google Doc: {0}".format(title)
path = os.path.join(tempfile.gettempdir(),
'{0}.{1}'.format(title.lower().replace(' ', '_'),
EXTENSIONS[type]))
src/p/y/PyZ3950-HEAD/example/zmarc_example.py PyZ3950(Download)
#for each record in the resultset, save as file
ifilecount = 0
for r in res:
sSaveAs = os.path.join(tempfile.gettempdir(),
"PyZ3950 search resultset %d.bin" % ifilecount)
print "Saving as file:", sSaveAs
fx = open(sSaveAs, "wb")
src/w/e/WebStack-1.2.7/examples/Common/Calendar/__init__.py WebStack(Download)
def __init__(self, fsencoding=None):
try:
self.repository = DirectoryRepository(self.resource_dir, fsencoding)
except OSError:
self.resource_dir = os.path.join(tempfile.gettempdir(), "calendars")
self.repository = DirectoryRepository(self.resource_dir, fsencoding)
src/c/l/clojure-nltk-HEAD/src/clojure_nltk/python-nltk-src/nltk-2.0b7/nltk/parse/malt.py clojure-nltk(Download)
if not self._trained:
raise Exception("Parser has not been trained. Call train() first.")
input_file = os.path.join(tempfile.gettempdir(), 'malt_input.conll')
output_file = os.path.join(tempfile.gettempdir(), 'malt_output.conll')
execute_string = 'java -jar %s -w %s -c %s -i %s -o %s -m parse'
if not verbose:
execute_string += ' > ' + os.path.join(tempfile.gettempdir(), "malt.out")
f.write('\n')
f.close()
cmd = ['java', '-jar %s' % self._malt_bin, '-w %s' % tempfile.gettempdir(),
'-c %s' % self.mco, '-i %s' % input_file, '-o %s' % output_file, '-m parse']
self._execute(cmd, 'parse', verbose)
def train(self, depgraphs, verbose=False):
"""
Train MaltParser from a list of C{DependencyGraph}s
@param depgraphs: C{list} of C{DependencyGraph}s for training input data
"""
input_file = os.path.join(tempfile.gettempdir(),'malt_train.conll')
f = None
if hasattr(conll_file, 'zipfile'):
zip_conll_file = conll_file
conll_file = os.path.join(tempfile.gettempdir(),'malt_train.conll')
conll_str = zip_conll_file.open().read()
f = open(conll_file,'w')
f.write(conll_str)
f.close()
cmd = ['java', '-jar %s' % self._malt_bin, '-w %s' % tempfile.gettempdir(),
def _execute(self, cmd, type, verbose=False):
if not verbose:
temp_dir = os.path.join(tempfile.gettempdir(), '')
cmd.append(' > %smalt_%s.out 2> %smalt_%s.err' % ((temp_dir, type)*2))
malt_exit = os.system(' '.join(cmd))
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next