MCPcopy Index your code
hub / github.com/RustPython/RustPython / mkstemp

Function mkstemp

Lib/tempfile.py:322–358  ·  view source on GitHub ↗

User-callable function to create and return a unique temporary file. The return value is a pair (fd, name) where fd is the file descriptor returned by os.open, and name is the filename. If 'suffix' is not None, the file name will end with that suffix, otherwise there will be no suf

(suffix=None, prefix=None, dir=None, text=False)

Source from the content-addressed store, hash-verified

320 return _os.fsencode(_gettempdir())
321
322def mkstemp(suffix=None, prefix=None, dir=None, text=False):
323 """User-callable function to create and return a unique temporary
324 file. The return value is a pair (fd, name) where fd is the
325 file descriptor returned by os.open, and name is the filename.
326
327 If 'suffix' is not None, the file name will end with that suffix,
328 otherwise there will be no suffix.
329
330 If 'prefix' is not None, the file name will begin with that prefix,
331 otherwise a default prefix is used.
332
333 If 'dir' is not None, the file will be created in that directory,
334 otherwise a default directory is used.
335
336 If 'text' is specified and true, the file is opened in text
337 mode. Else (the default) the file is opened in binary mode.
338
339 If any of 'suffix', 'prefix' and 'dir' are not None, they must be the
340 same type. If they are bytes, the returned name will be bytes; str
341 otherwise.
342
343 The file is readable and writable only by the creating user ID.
344 If the operating system uses permission bits to indicate whether a
345 file is executable, the file is executable by no one. The file
346 descriptor is not inherited by children of this process.
347
348 Caller is responsible for deleting the file when done with it.
349 """
350
351 prefix, suffix, dir, output_type = _sanitize_params(prefix, suffix, dir)
352
353 if text:
354 flags = _text_openflags
355 else:
356 flags = _bin_openflags
357
358 return _mkstemp_inner(dir, prefix, suffix, flags, output_type)
359
360
361def mkdtemp(suffix=None, prefix=None, dir=None):

Callers

nothing calls this directly

Calls 2

_sanitize_paramsFunction · 0.85
_mkstemp_innerFunction · 0.85

Tested by

no test coverage detected