Python setuptools.extern.six.binary_type() Examples

The following are 30 code examples of setuptools.extern.six.binary_type(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module setuptools.extern.six , or try the search function .
Example #1
Source File: glob.py    From Hands-On-Deep-Learning-for-Games with MIT License 5 votes vote down vote up
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 
Example #2
Source File: glob.py    From Ansible with MIT License 5 votes vote down vote up
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 
Example #3
Source File: glob.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #4
Source File: glob.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #5
Source File: glob.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #6
Source File: glob.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def _isrecursive(pattern):
    if isinstance(pattern, binary_type):
        return pattern == b'**'
    else:
        return pattern == '**' 
Example #7
Source File: glob.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #8
Source File: glob.py    From jarvis with GNU General Public License v2.0 5 votes vote down vote up
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) 
Example #9
Source File: glob.py    From jarvis with GNU General Public License v2.0 5 votes vote down vote up
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) 
Example #10
Source File: glob.py    From jarvis with GNU General Public License v2.0 5 votes vote down vote up
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 
Example #11
Source File: glob.py    From jarvis with GNU General Public License v2.0 5 votes vote down vote up
def _isrecursive(pattern):
    if isinstance(pattern, binary_type):
        return pattern == b'**'
    else:
        return pattern == '**' 
Example #12
Source File: glob.py    From jarvis with GNU General Public License v2.0 5 votes vote down vote up
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 
Example #13
Source File: glob.py    From Hands-On-Deep-Learning-for-Games with MIT License 5 votes vote down vote up
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) 
Example #14
Source File: glob.py    From Hands-On-Deep-Learning-for-Games with MIT License 5 votes vote down vote up
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) 
Example #15
Source File: glob.py    From Ansible with MIT License 5 votes vote down vote up
def _isrecursive(pattern):
    if isinstance(pattern, binary_type):
        return pattern == b'**'
    else:
        return pattern == '**' 
Example #16
Source File: glob.py    From Hands-On-Deep-Learning-for-Games with MIT License 5 votes vote down vote up
def _isrecursive(pattern):
    if isinstance(pattern, binary_type):
        return pattern == b'**'
    else:
        return pattern == '**' 
Example #17
Source File: glob.py    From Hands-On-Deep-Learning-for-Games with MIT License 5 votes vote down vote up
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 
Example #18
Source File: glob.py    From aws-kube-codesuite with Apache License 2.0 5 votes vote down vote up
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) 
Example #19
Source File: glob.py    From aws-kube-codesuite with Apache License 2.0 5 votes vote down vote up
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) 
Example #20
Source File: glob.py    From aws-kube-codesuite with Apache License 2.0 5 votes vote down vote up
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 
Example #21
Source File: glob.py    From aws-kube-codesuite with Apache License 2.0 5 votes vote down vote up
def _isrecursive(pattern):
    if isinstance(pattern, binary_type):
        return pattern == b'**'
    else:
        return pattern == '**' 
Example #22
Source File: glob.py    From aws-kube-codesuite with Apache License 2.0 5 votes vote down vote up
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 
Example #23
Source File: glob.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #24
Source File: glob.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #25
Source File: glob.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #26
Source File: glob.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def _isrecursive(pattern):
    if isinstance(pattern, binary_type):
        return pattern == b'**'
    else:
        return pattern == '**' 
Example #27
Source File: glob.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #28
Source File: glob.py    From telegram-robot-rss with Mozilla Public License 2.0 5 votes vote down vote up
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) 
Example #29
Source File: glob.py    From python-netsurv with MIT License 5 votes vote down vote up
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) 
Example #30
Source File: glob.py    From python-netsurv with MIT License 5 votes vote down vote up
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