All Samples(1540) | Call(1425) | Derive(0) | Import(115)
Create and return a temporary file. Arguments: 'prefix', 'suffix', 'dir' -- as for mkstemp. 'mode' -- the mode argument to os.fdopen (default "w+b"). 'bufsize' -- the buffer size argument to os.fdopen (default -1). 'delete' -- whether the file is deleted on close (default True). The file is created as mkstemp() would do it. Returns an object with a file-like interface; the name of the file is accessible as file.name. The file will be automatically deleted when it is closed unless the 'delete' argument is set to False.
def NamedTemporaryFile(mode='w+b', bufsize=-1, suffix="",
prefix=template, dir=None, delete=True):
"""Create and return a temporary file.
Arguments:
'prefix', 'suffix', 'dir' -- as for mkstemp.
'mode' -- the mode argument to os.fdopen (default "w+b").
'bufsize' -- the buffer size argument to os.fdopen (default -1).
'delete' -- whether the file is deleted on close (default True).
The file is created as mkstemp() would do it.
Returns an object with a file-like interface; the name of the file
is accessible as file.name. The file will be automatically deleted
when it is closed unless the 'delete' argument is set to False.
"""
if dir is None:
dir = gettempdir()
if 'b' in mode:
flags = _bin_openflags
else:
flags = _text_openflags
# Setting O_TEMPORARY in the flags causes the OS to delete
# the file when it is closed. This is only supported by Windows.
if _os.name == 'nt' and delete:
flags |= _os.O_TEMPORARY
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
file = _os.fdopen(fd, mode, bufsize)
return _TemporaryFileWrapper(file, name, delete)
# Stdlib import warnings from tempfile import NamedTemporaryFile from os.path import join as pjoin # Third party
for n in tcons:
tempdict = {}
for v in ['sd', 't', 'effect']:
tempdict[v] = np.memmap(NamedTemporaryFile(prefix='%s%s.nii' \
% (n,v)), dtype=np.float,
shape=volshape, mode='w+')
output[n] = tempdict
for n in fcons:
output[n] = np.memmap(NamedTemporaryFile(prefix='%s%s.nii' \
src/n/i/NiPy-OLD-HEAD/examples/fiac/fiac_example.py NiPy-OLD(Download)
# Stdlib import warnings from tempfile import NamedTemporaryFile from os.path import join as pjoin # Third party
for n in tcons:
tempdict = {}
for v in ['sd', 't', 'effect']:
tempdict[v] = np.memmap(NamedTemporaryFile(prefix='%s%s.nii' \
% (n,v)), dtype=np.float,
shape=volshape, mode='w+')
output[n] = tempdict
for n in fcons:
output[n] = np.memmap(NamedTemporaryFile(prefix='%s%s.nii' \
src/f/i/fileinfo-0.3.3/src/fileinfo/guidjango/tmpfile.py fileinfo(Download)
from os.path import expanduser, normpath
from tempfile import NamedTemporaryFile
pickledDataPath = normpath(expanduser("~/fileinfo_data_for_django.pickle"))
if False:
homeDir = normpath(expanduser("~"))
f = NamedTemporaryFile(
mode="w", suffix=".pickle", prefix="fileinfo_data_", dir=homeDir)
src/p/l/Plml-HEAD/util.py Plml(Download)
from tempfile import NamedTemporaryFile from anydbm import open as dbopen from xml.parsers import expat from urllib2 import urlopen from zlib import crc32 import collections import subprocess
def verify_gnupg(self, sig):
sigfile = NamedTemporaryFile('w',suffix='.sig',prefix='plml',delete=False)
name = sigfile.name
sigfile.close()
gnupg = subprocess.Popen(['gpg', '--verify', name, '-'],
stdin=subprocess.PIPE,
stderr=subprocess.PIPE,
src/p/y/pyload-HEAD/pyLoadCore.py pyload(Download)
from sys import exit from sys import path from sys import stdout from tempfile import NamedTemporaryFile import thread import time from time import sleep
def upload_container(self, filename, type, content):
th = NamedTemporaryFile(mode="w", suffix="." + type, delete=False)
th.write(content)
path = th.name
th.close()
pid = self.core.file_list.packager.addNewPackage(filename)
cid = self.core.file_list.collector.addLink(path)
src/f/l/flunc-0.7/flunc/fake_form.py flunc(Download)
import os from tempfile import NamedTemporaryFile import flunc import twill from twill.namespaces import get_twill_glocals from logging import log_info from parser import substitute_vars
lookup = get_twill_glocals()[0]
fake_form_data = substitute_vars(fake_form_template, lookup)
fake_form = NamedTemporaryFile(mode="w", prefix="flunc-", suffix=".html")
fake_form.write(fake_form_data)
fake_form.flush()
src/c/l/clearversion-HEAD/trunk/clearVersion/etc/subversion/hooks/examples/mailer.py clearversion(Download)
try: from tempfile import NamedTemporaryFile except ImportError: # NamedTemporaryFile was added in Python 2.3, so we need to emulate it # for older Pythons.
src/c/l/clearversion-HEAD/clearVersion/etc/subversion/hooks/examples/mailer.py clearversion(Download)
try: from tempfile import NamedTemporaryFile except ImportError: # NamedTemporaryFile was added in Python 2.3, so we need to emulate it # for older Pythons.
src/s/c/Scrapy-0.10.3/scrapyd/eggutils.py Scrapy(Download)
from __future__ import with_statement
import os, sys, shutil, pkg_resources
from subprocess import Popen, PIPE
from tempfile import NamedTemporaryFile, mkdtemp
def get_spider_list_from_eggfile(eggfile, project):
# FIXME: we use a temporary directory here to avoid permissions problems
# when running as system service, as "scrapy list" command tries to write
# the scrapy.db sqlite database in current directory
tmpdir = mkdtemp()
try:
with NamedTemporaryFile(suffix='.egg', dir=tmpdir) as f:
src/s/s/ssplone-HEAD/ssIdManagement/trunk/content/exporter/ldap.py ssplone(Download)
from DateTime import DateTime import transaction from tempfile import mkstemp, NamedTemporaryFile from commands import getstatusoutput import base64
# has no children
if out is None:
out = NamedTemporaryFile(prefix=LDIF_FILENAME_PREFIX, suffix='.ldif')
# create the sub-trees under root for people and groups
if out is None:
out = \
NamedTemporaryFile(prefix=LDIF_FILENAME_PREFIX, suffix='.ldif')
if err is None:
err = NamedTemporaryFile(
prefix=LDIF_FILENAME_PREFIX, suffix='.ldif-errors')
if out is None:
out = \
NamedTemporaryFile(prefix=LDIF_FILENAME_PREFIX, suffix='.ldif')
if err is None:
err = NamedTemporaryFile(
prefix=LDIF_FILENAME_PREFIX, suffix='.ldif-errors')
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next