當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。