当前位置: 首页>>代码示例>>Python>>正文


Python six.binary_type方法代码示例

本文整理汇总了Python中setuptools.extern.six.binary_type方法的典型用法代码示例。如果您正苦于以下问题:Python six.binary_type方法的具体用法?Python six.binary_type怎么用?Python six.binary_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在setuptools.extern.six的用法示例。


在下文中一共展示了six.binary_type方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: glob1

# 需要导入模块: from setuptools.extern import six [as 别名]
# 或者: from setuptools.extern.six import binary_type [as 别名]
def glob1(dirname, pattern):
    if not dirname:
        if isinstance(pattern, binary_type):
            dirname = os.curdir.encode('ASCII')
        else:
            dirname = os.curdir
    try:
        names = os.listdir(dirname)
    except OSError:
        return []
    return fnmatch.filter(names, pattern) 
开发者ID:sofia-netsurv,项目名称:python-netsurv,代码行数:13,代码来源:glob.py

示例2: _rlistdir

# 需要导入模块: from setuptools.extern import six [as 别名]
# 或者: from setuptools.extern.six import binary_type [as 别名]
def _rlistdir(dirname):
    if not dirname:
        if isinstance(dirname, binary_type):
            dirname = binary_type(os.curdir, 'ASCII')
        else:
            dirname = os.curdir
    try:
        names = os.listdir(dirname)
    except os.error:
        return
    for x in names:
        yield x
        path = os.path.join(dirname, x) if dirname else x
        for y in _rlistdir(path):
            yield os.path.join(x, y) 
开发者ID:sofia-netsurv,项目名称:python-netsurv,代码行数:17,代码来源:glob.py

示例3: has_magic

# 需要导入模块: from setuptools.extern import six [as 别名]
# 或者: from setuptools.extern.six import binary_type [as 别名]
def has_magic(s):
    if isinstance(s, binary_type):
        match = magic_check_bytes.search(s)
    else:
        match = magic_check.search(s)
    return match is not None 
开发者ID:sofia-netsurv,项目名称:python-netsurv,代码行数:8,代码来源:glob.py

示例4: _isrecursive

# 需要导入模块: from setuptools.extern import six [as 别名]
# 或者: from setuptools.extern.six import binary_type [as 别名]
def _isrecursive(pattern):
    if isinstance(pattern, binary_type):
        return pattern == b'**'
    else:
        return pattern == '**' 
开发者ID:sofia-netsurv,项目名称:python-netsurv,代码行数:7,代码来源:glob.py

示例5: escape

# 需要导入模块: from setuptools.extern import six [as 别名]
# 或者: from setuptools.extern.six import binary_type [as 别名]
def escape(pathname):
    """Escape all special characters.
    """
    # Escaping is done by wrapping any of "*?[" between square brackets.
    # Metacharacters do not work in the drive part and shouldn't be escaped.
    drive, pathname = os.path.splitdrive(pathname)
    if isinstance(pathname, binary_type):
        pathname = magic_check_bytes.sub(br'[\1]', pathname)
    else:
        pathname = magic_check.sub(r'[\1]', pathname)
    return drive + pathname 
开发者ID:sofia-netsurv,项目名称:python-netsurv,代码行数:13,代码来源:glob.py


注:本文中的setuptools.extern.six.binary_type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。