當前位置: 首頁>>代碼示例>>Python>>正文


Python nt._getfullpathname方法代碼示例

本文整理匯總了Python中nt._getfullpathname方法的典型用法代碼示例。如果您正苦於以下問題:Python nt._getfullpathname方法的具體用法?Python nt._getfullpathname怎麽用?Python nt._getfullpathname使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在nt的用法示例。


在下文中一共展示了nt._getfullpathname方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: absolute

# 需要導入模塊: import nt [as 別名]
# 或者: from nt import _getfullpathname [as 別名]
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 
開發者ID:sofia-netsurv,項目名稱:python-netsurv,代碼行數:19,代碼來源:__init__.py

示例2: abspath

# 需要導入模塊: import nt [as 別名]
# 或者: from nt import _getfullpathname [as 別名]
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 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:18,代碼來源:ntpath.py

示例3: test_deprecated

# 需要導入模塊: import nt [as 別名]
# 或者: from nt import _getfullpathname [as 別名]
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) 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:27,代碼來源:test_os.py

示例4: _abspath_fallback

# 需要導入模塊: import nt [as 別名]
# 或者: from nt import _getfullpathname [as 別名]
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. 
開發者ID:CedricGuillemet,項目名稱:Imogen,代碼行數:19,代碼來源:ntpath.py

示例5: abspath

# 需要導入模塊: import nt [as 別名]
# 或者: from nt import _getfullpathname [as 別名]
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 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:17,代碼來源:ntpath.py

示例6: abspath

# 需要導入模塊: import nt [as 別名]
# 或者: from nt import _getfullpathname [as 別名]
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 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:17,代碼來源:ntpath.py

示例7: test__getfullpathname

# 需要導入模塊: import nt [as 別名]
# 或者: from nt import _getfullpathname [as 別名]
def test__getfullpathname(self):
        self.assertEqual(nt._getfullpathname('.'), nt.getcwd())
        self.assertEqual(nt._getfullpathname('<bad>'), os.path.join(nt.getcwd(), '<bad>'))
        self.assertEqual(nt._getfullpathname('bad:'), os.path.join(nt.getcwd(), 'bad:'))
        self.assertEqual(nt._getfullpathname(':bad:'), os.path.join(nt.getcwd(), ':bad:'))
        self.assertEqual(nt._getfullpathname('::'), '::\\')
        self.assertEqual(nt._getfullpathname('1:'), '1:\\')
        self.assertEqual(nt._getfullpathname('1:a'), '1:\\a')
        self.assertEqual(nt._getfullpathname('1::'), '1:\\:')
        self.assertEqual(nt._getfullpathname('1:\\'), '1:\\') 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:12,代碼來源:test_nt.py

示例8: test__getfullpathname_neg

# 需要導入模塊: import nt [as 別名]
# 或者: from nt import _getfullpathname [as 別名]
def test__getfullpathname_neg(self):
        for bad in [None, 0, 34, -12345L, 3.14, object, self.test__getfullpathname]:
            self.assertRaises(TypeError, nt._getfullpathname, bad) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:5,代碼來源:test_nt.py

示例9: abspath

# 需要導入模塊: import nt [as 別名]
# 或者: from nt import _getfullpathname [as 別名]
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 
開發者ID:awemulya,項目名稱:kobo-predict,代碼行數:17,代碼來源:ntpath.py


注:本文中的nt._getfullpathname方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。