我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用nt._getfullpathname()。
def abspath(path): """Return the absolute version of a path.""" if path: # Empty path must return current working directory. path = os.fspath(path) try: path = _getfullpathname(path) except OSError: pass # Bad path - return unchanged. elif isinstance(path, bytes): path = os.getcwdb() else: path = os.getcwd() return normpath(path) # realpath is a no-op on systems without islink support
def absolute(self): """Return an absolute version of this path. This function works even if the path doesn't point to anything. No normalization is done, i.e. all '.' and '..' will be kept along. Use resolve() to get the canonical path to a file. """ # XXX untested yet! if self._closed: self._raise_closed() if self.is_absolute(): return self # FIXME this must defer to the specific flavour (and, under Windows, # use nt._getfullpathname()) obj = self._from_parts([os.getcwd()] + self._parts, init=False) obj._init(template=self) return obj
def test_deprecated(self): import nt filename = os.fsencode(support.TESTFN) with warnings.catch_warnings(): warnings.simplefilter("error", DeprecationWarning) for func, *args in ( (nt._getfullpathname, filename), (nt._isdir, filename), (os.access, filename, os.R_OK), (os.chdir, filename), (os.chmod, filename, 0o777), (os.getcwdb,), (os.link, filename, filename), (os.listdir, filename), (os.lstat, filename), (os.mkdir, filename), (os.open, filename, os.O_RDONLY), (os.rename, filename, filename), (os.rmdir, filename), (os.startfile, filename), (os.stat, filename), (os.unlink, filename), (os.utime, filename), ): self.assertRaises(DeprecationWarning, func, *args)
def abspath(path): """Return the absolute version of a path.""" if path: # Empty path must return current working directory. try: path = _getfullpathname(path) except WindowsError: pass # Bad path - return unchanged. elif isinstance(path, unicode): path = os.getcwdu() else: path = os.getcwd() return normpath(path) # realpath is a no-op on systems without islink support
def abspath(path): """Return the absolute version of a path.""" if path: # Empty path must return current working directory. try: path = _getfullpathname(path) except WindowsError: pass # Bad path - return unchanged. elif isinstance(path, _unicode): path = os.getcwdu() else: path = os.getcwd() return normpath(path) # realpath is a no-op on systems without islink support
def abspath(path): """Return the absolute version of a path.""" if path: # Empty path must return current working directory. try: path = _getfullpathname(path) except WindowsError: pass # Bad path - return unchanged. elif isinstance(path, bytes): path = os.getcwdb() else: path = os.getcwd() return normpath(path) # realpath is a no-op on systems without islink support
def absolute(self): """Return an absolute version of this path. This function works even if the path doesn't point to anything. No normalization is done, i.e. all '.' and '..' will be kept along. Use resolve() to get the canonical path to a file. """ # XXX untested yet! if self.is_absolute(): return self # FIXME this must defer to the specific flavour (and, under Windows, # use nt._getfullpathname()) obj = self._from_parts([os.getcwd()] + self._parts, init=False) obj._init(template=self) return obj
def abspath(path): """Return the absolute version of a path.""" if path: # Empty path must return current working directory. try: path = _getfullpathname(path) except OSError: pass # Bad path - return unchanged. elif isinstance(path, bytes): path = os.getcwdb() else: path = os.getcwd() return normpath(path) # realpath is a no-op on systems without islink support