Python setuptools.extern.six 模块,binary_type() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用setuptools.extern.six.binary_type()

项目:python-    作者:secondtonone1    | 项目源码 | 文件源码
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)
项目:python-    作者:secondtonone1    | 项目源码 | 文件源码
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)
项目:python-    作者:secondtonone1    | 项目源码 | 文件源码
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
项目:python-    作者:secondtonone1    | 项目源码 | 文件源码
def _isrecursive(pattern):
    if isinstance(pattern, binary_type):
        return pattern == b'**'
    else:
        return pattern == '**'
项目:python-    作者:secondtonone1    | 项目源码 | 文件源码
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
项目:my-first-blog    作者:AnkurBegining    | 项目源码 | 文件源码
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)
项目:my-first-blog    作者:AnkurBegining    | 项目源码 | 文件源码
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)
项目:my-first-blog    作者:AnkurBegining    | 项目源码 | 文件源码
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
项目:my-first-blog    作者:AnkurBegining    | 项目源码 | 文件源码
def _isrecursive(pattern):
    if isinstance(pattern, binary_type):
        return pattern == b'**'
    else:
        return pattern == '**'
项目:my-first-blog    作者:AnkurBegining    | 项目源码 | 文件源码
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
项目:swjtu-pyscraper    作者:Desgard    | 项目源码 | 文件源码
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)
项目:swjtu-pyscraper    作者:Desgard    | 项目源码 | 文件源码
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)
项目:swjtu-pyscraper    作者:Desgard    | 项目源码 | 文件源码
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
项目:swjtu-pyscraper    作者:Desgard    | 项目源码 | 文件源码
def _isrecursive(pattern):
    if isinstance(pattern, binary_type):
        return pattern == b'**'
    else:
        return pattern == '**'
项目:swjtu-pyscraper    作者:Desgard    | 项目源码 | 文件源码
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
项目:jira_worklog_scanner    作者:pgarneau    | 项目源码 | 文件源码
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)
项目:jira_worklog_scanner    作者:pgarneau    | 项目源码 | 文件源码
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)
项目:jira_worklog_scanner    作者:pgarneau    | 项目源码 | 文件源码
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
项目:jira_worklog_scanner    作者:pgarneau    | 项目源码 | 文件源码
def _isrecursive(pattern):
    if isinstance(pattern, binary_type):
        return pattern == b'**'
    else:
        return pattern == '**'
项目:jira_worklog_scanner    作者:pgarneau    | 项目源码 | 文件源码
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
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
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)
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
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)
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
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
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def _isrecursive(pattern):
    if isinstance(pattern, binary_type):
        return pattern == b'**'
    else:
        return pattern == '**'
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
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
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
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)
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
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
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def _isrecursive(pattern):
    if isinstance(pattern, binary_type):
        return pattern == b'**'
    else:
        return pattern == '**'
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
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
项目:ascii-art-py    作者:blinglnav    | 项目源码 | 文件源码
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)
项目:ascii-art-py    作者:blinglnav    | 项目源码 | 文件源码
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)
项目:ascii-art-py    作者:blinglnav    | 项目源码 | 文件源码
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
项目:ascii-art-py    作者:blinglnav    | 项目源码 | 文件源码
def _isrecursive(pattern):
    if isinstance(pattern, binary_type):
        return pattern == b'**'
    else:
        return pattern == '**'
项目:ascii-art-py    作者:blinglnav    | 项目源码 | 文件源码
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
项目:aws-cfn-plex    作者:lordmuffin    | 项目源码 | 文件源码
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)
项目:aws-cfn-plex    作者:lordmuffin    | 项目源码 | 文件源码
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)
项目:aws-cfn-plex    作者:lordmuffin    | 项目源码 | 文件源码
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
项目:aws-cfn-plex    作者:lordmuffin    | 项目源码 | 文件源码
def _isrecursive(pattern):
    if isinstance(pattern, binary_type):
        return pattern == b'**'
    else:
        return pattern == '**'
项目:aws-cfn-plex    作者:lordmuffin    | 项目源码 | 文件源码
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
项目:RPoint    作者:george17-meet    | 项目源码 | 文件源码
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)
项目:RPoint    作者:george17-meet    | 项目源码 | 文件源码
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)
项目:RPoint    作者:george17-meet    | 项目源码 | 文件源码
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
项目:RPoint    作者:george17-meet    | 项目源码 | 文件源码
def _isrecursive(pattern):
    if isinstance(pattern, binary_type):
        return pattern == b'**'
    else:
        return pattern == '**'
项目:RPoint    作者:george17-meet    | 项目源码 | 文件源码
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
项目:AshsSDK    作者:thehappydinoa    | 项目源码 | 文件源码
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)
项目:AshsSDK    作者:thehappydinoa    | 项目源码 | 文件源码
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)
项目:AshsSDK    作者:thehappydinoa    | 项目源码 | 文件源码
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
项目:AshsSDK    作者:thehappydinoa    | 项目源码 | 文件源码
def _isrecursive(pattern):
    if isinstance(pattern, binary_type):
        return pattern == b'**'
    else:
        return pattern == '**'
项目:AshsSDK    作者:thehappydinoa    | 项目源码 | 文件源码
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
项目:habilitacion    作者:GabrielBD    | 项目源码 | 文件源码
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)