当前位置: 首页>>代码示例>>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;未经允许,请勿转载。