Lines Matching refs:_os

42 import os as _os
52 _text_openflags = _os.O_RDWR | _os.O_CREAT | _os.O_EXCL
53 if hasattr(_os, 'O_NOFOLLOW'):
54 _text_openflags |= _os.O_NOFOLLOW
57 if hasattr(_os, 'O_BINARY'):
58 _bin_openflags |= _os.O_BINARY
60 if hasattr(_os, 'TMP_MAX'):
61 TMP_MAX = _os.TMP_MAX
78 _os.lstat(fn)
92 if isinstance(arg, _os.PathLike):
93 arg = _os.fspath(arg)
123 prefix = _os.fsencode(template)
144 cur_pid = _os.getpid()
164 dirname = _os.getenv(envname)
168 if _os.name == 'nt':
169 dirlist.extend([ _os.path.expanduser(r'~\AppData\Local\Temp'),
170 _os.path.expandvars(r'%SYSTEMROOT%\Temp'),
177 dirlist.append(_os.getcwd())
179 dirlist.append(_os.curdir)
196 if dir != _os.curdir:
197 dir = _os.path.abspath(dir)
201 filename = _os.path.join(dir, name)
203 fd = _os.open(filename, _bin_openflags, 0o600)
206 _os.write(fd, b'blat')
208 _os.close(fd)
210 _os.unlink(filename)
217 if (_os.name == 'nt' and _os.path.isdir(dir) and
218 _os.access(dir, _os.W_OK)):
246 dir = _os.path.abspath(dir)
249 names = map(_os.fsencode, names)
253 file = _os.path.join(dir, pre + name + suf)
256 fd = _os.open(file, flags, 0o600)
262 if (_os.name == 'nt' and _os.path.isdir(dir) and
263 _os.access(dir, _os.W_OK)):
274 if func in _os.supports_follow_symlinks:
276 elif _os.name == 'nt' or not _os.path.islink(path):
281 chflags = _os.chflags
286 _dont_follow_symlinks(_os.chmod, path, 0o700)
293 return _os.fsdecode(template)
297 return _os.fsencode(template)
315 return _os.fsdecode(_gettempdir())
319 return _os.fsencode(_gettempdir())
377 names = map(_os.fsencode, names)
381 file = _os.path.join(dir, prefix + name + suffix)
384 _os.mkdir(file, 0o700)
390 if (_os.name == 'nt' and _os.path.isdir(dir) and
391 _os.access(dir, _os.W_OK)):
424 file = _os.path.join(dir, prefix + name + suffix)
448 if _os.name != 'nt':
455 def close(self, unlink=_os.unlink):
567 if _os.name == 'nt' and delete:
568 flags |= _os.O_TEMPORARY
591 if name is not None and not (_os.name == 'nt' and delete):
592 _os.unlink(name)
595 if _os.name != 'posix' or _sys.platform == 'cygwin':
604 _O_TMPFILE_WORKS = hasattr(_os, 'O_TMPFILE')
634 flags2 = (flags | _os.O_TMPFILE) & ~_os.O_CREAT
635 fd = _os.open(dir, flags2, 0o600)
668 _os.unlink(name)
670 _os.close(fd)
883 _resetperms(_os.path.dirname(path))
887 _os.unlink(path)
916 if self._finalizer.detach() or _os.path.exists(self.name):