Python nt._getfullpathname() Examples
The following are 30
code examples of nt._getfullpathname().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
nt
, or try the search function
.
Example #1
Source File: pathlib.py From Imogen with MIT License | 6 votes |
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
Example #2
Source File: pathlib.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
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
Example #3
Source File: ntpath.py From python2017 with MIT License | 6 votes |
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
Example #4
Source File: test_os.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
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)
Example #5
Source File: __init__.py From pyRevit with GNU General Public License v3.0 | 6 votes |
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
Example #6
Source File: pathlib.py From odoo13-x64 with GNU General Public License v3.0 | 6 votes |
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
Example #7
Source File: ntpath.py From python with Apache License 2.0 | 6 votes |
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
Example #8
Source File: ntpath.py From odoo13-x64 with GNU General Public License v3.0 | 6 votes |
def _abspath_fallback(path): """Return the absolute version of a path as a fallback function in case `nt._getfullpathname` is not available or raises OSError. See bpo-31047 for more. """ path = os.fspath(path) if not isabs(path): if isinstance(path, bytes): cwd = os.getcwdb() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path) # Return an absolute path.
Example #9
Source File: test_os.py From ironpython3 with Apache License 2.0 | 6 votes |
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)
Example #10
Source File: pathlib.py From ironpython3 with Apache License 2.0 | 6 votes |
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
Example #11
Source File: pathlib.py From Carnets with BSD 3-Clause "New" or "Revised" License | 6 votes |
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
Example #12
Source File: ntpath.py From Imogen with MIT License | 6 votes |
def _abspath_fallback(path): """Return the absolute version of a path as a fallback function in case `nt._getfullpathname` is not available or raises OSError. See bpo-31047 for more. """ path = os.fspath(path) if not isabs(path): if isinstance(path, bytes): cwd = os.getcwdb() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path) # Return an absolute path.
Example #13
Source File: pathlib2.py From pyFileFixity with MIT License | 6 votes |
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
Example #14
Source File: test_os.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
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)
Example #15
Source File: ntpath.py From Carnets with BSD 3-Clause "New" or "Revised" License | 6 votes |
def _abspath_fallback(path): """Return the absolute version of a path as a fallback function in case `nt._getfullpathname` is not available or raises OSError. See bpo-31047 for more. """ path = os.fspath(path) if not isabs(path): if isinstance(path, bytes): cwd = os.getcwdb() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path) # Return an absolute path.
Example #16
Source File: ntpath.py From GraphicDesignPatternByPython with MIT License | 6 votes |
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
Example #17
Source File: __init__.py From python-netsurv with MIT License | 6 votes |
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
Example #18
Source File: __init__.py From python-netsurv with MIT License | 6 votes |
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
Example #19
Source File: pathlib.py From PySnooper with MIT License | 6 votes |
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
Example #20
Source File: ntpath.py From android_universal with MIT License | 6 votes |
def _abspath_fallback(path): """Return the absolute version of a path as a fallback function in case `nt._getfullpathname` is not available or raises OSError. See bpo-31047 for more. """ path = os.fspath(path) if not isabs(path): if isinstance(path, bytes): cwd = os.getcwdb() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path) # Return an absolute path.
Example #21
Source File: pathlib.py From android_universal with MIT License | 6 votes |
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
Example #22
Source File: __init__.py From pipenv with MIT License | 6 votes |
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
Example #23
Source File: pathlib.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
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
Example #24
Source File: ntpath.py From RevitBatchProcessor with GNU General Public License v3.0 | 5 votes |
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
Example #25
Source File: ntpath.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
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
Example #26
Source File: ntpath.py From unity-python with MIT License | 5 votes |
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
Example #27
Source File: ntpath.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
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
Example #28
Source File: ntpath.py From PokemonGo-DesktopMap with MIT License | 5 votes |
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
Example #29
Source File: ntpath.py From odoo13-x64 with GNU General Public License v3.0 | 5 votes |
def abspath(path): """Return the absolute version of a path.""" try: return normpath(_getfullpathname(path)) except (OSError, ValueError): return _abspath_fallback(path) # realpath is a no-op on systems without islink support
Example #30
Source File: ntpath.py From Carnets with BSD 3-Clause "New" or "Revised" License | 5 votes |
def abspath(path): """Return the absolute version of a path.""" try: return _getfullpathname(path) except OSError: return _abspath_fallback(path) # realpath is a no-op on systems without islink support