• Home
  • Raw
  • Download

Lines Matching +full:- +full:- +full:directory +full:- +full:prefix

3 This module provides generic, low- and high-level interfaces for
19 TMP_MAX - maximum number of names that will be tried before
21 tempdir - If this is set to a string before the first use of
97 raise TypeError("Can't mix bytes and non-bytes in "
102 raise TypeError("Can't mix bytes and non-bytes in "
114 def _sanitize_params(prefix, suffix, dir): argument
116 output_type = _infer_return_type(prefix, suffix, dir)
119 if prefix is None:
121 prefix = template
123 prefix = _os.fsencode(template)
129 return prefix, suffix, dir, output_type
167 # Failing that, try OS-specific locations.
175 # As a last resort, the current directory.
184 """Calculate the default directory to use for temporary files.
188 trying to create and write to a file in that directory. If this
198 # Try only a few names per directory.
215 # This exception is thrown when a directory with the chosen name
220 break # no point trying more names in this directory
222 break # no point trying more names in this directory
224 "No usable temporary directory found in %s" %
230 """Common setup sequence for all user-callable interfaces."""
260 # This exception is thrown when a directory with the chosen name
292 """The default prefix for temporary directories as string."""
296 """The default prefix for temporary directories as bytes."""
321 def mkstemp(suffix=None, prefix=None, dir=None, text=False): argument
322 """User-callable function to create and return a unique temporary
329 If 'prefix' is not None, the file name will begin with that prefix,
330 otherwise a default prefix is used.
332 If 'dir' is not None, the file will be created in that directory,
333 otherwise a default directory is used.
338 If any of 'suffix', 'prefix' and 'dir' are not None, they must be the
350 prefix, suffix, dir, output_type = _sanitize_params(prefix, suffix, dir)
357 return _mkstemp_inner(dir, prefix, suffix, flags, output_type)
360 def mkdtemp(suffix=None, prefix=None, dir=None): argument
361 """User-callable function to create and return a unique temporary
362 directory. The return value is the pathname of the directory.
367 The directory is readable, writable, and searchable only by the
370 Caller is responsible for deleting the directory when done with it.
373 prefix, suffix, dir, output_type = _sanitize_params(prefix, suffix, dir)
381 file = _os.path.join(dir, prefix + name + suffix)
388 # This exception is thrown when a directory with the chosen name
398 "No usable temporary directory name found")
400 def mktemp(suffix="", prefix=template, dir=None): argument
401 """User-callable function to return a unique temporary file name. The
405 not accepted, and suffix=None, prefix=None and bytes file names are not
424 file = _os.path.join(dir, prefix + name + suffix)
454 # Windows provides delete-on-close as a primitive, in which
491 # and cached for non-numeric results
537 def NamedTemporaryFile(mode='w+b', buffering=-1, encoding=None,
538 newline=None, suffix=None, prefix=None, argument
543 'prefix', 'suffix', 'dir' -- as for mkstemp.
544 'mode' -- the mode argument to io.open (default "w+b").
545 'buffering' -- the buffer size argument to io.open (default -1).
546 'encoding' -- the encoding argument to io.open (default None)
547 'newline' -- the newline argument to io.open (default None)
548 'delete' -- whether the file is automatically deleted (default True).
549 'delete_on_close' -- if 'delete', whether the file is deleted on close
552 'errors' -- the errors argument to io.open (default None)
555 Returns an object with a file-like interface; the name of the file
564 prefix, suffix, dir, output_type = _sanitize_params(prefix, suffix, dir)
579 fd, name = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
600 # On non-POSIX and Cygwin systems, assume that we cannot unlink a file
610 def TemporaryFile(mode='w+b', buffering=-1, encoding=None,
611 newline=None, suffix=None, prefix=None, argument
615 'prefix', 'suffix', 'dir' -- as for mkstemp.
616 'mode' -- the mode argument to io.open (default "w+b").
617 'buffering' -- the buffer size argument to io.open (default -1).
618 'encoding' -- the encoding argument to io.open (default None)
619 'newline' -- the newline argument to io.open (default None)
620 'errors' -- the errors argument to io.open (default None)
623 Returns an object with a file-like interface. The file has no
631 prefix, suffix, dir, output_type = _sanitize_params(prefix, suffix, dir)
651 # O_TMPFILE is read as O_DIRECTORY. Trying to open a directory
653 # directory cannot be open to write. Set flag to False to not
657 # The filesystem of the directory does not support O_TMPFILE.
670 fd, name = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
692 def __init__(self, max_size=0, mode='w+b', buffering=-1,
694 suffix=None, prefix=None, dir=None, *, errors=None): argument
705 'suffix': suffix, 'prefix': prefix,
861 """Create and return a temporary directory. This has the same
868 Upon exiting the context, the directory and everything contained
873 suffix - A str suffix for the directory name. (see mkdtemp)
874 prefix - A str prefix for the directory name. (see mkdtemp)
875 dir - A directory to create this temp dir in. (see mkdtemp)
876 ignore_cleanup_errors - False; ignore exceptions during cleanup?
877 delete - True; whether the directory is automatically deleted.
880 def __init__(self, suffix=None, prefix=None, dir=None, argument
882 self.name = mkdtemp(suffix, prefix, dir)
912 # bpo-43153: Calling _rmtree again may
914 # So we must re-raise the current PermissionError if
915 # path is not a directory.