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


Python utils.isbytes方法代码示例

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


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

示例1: join

# 需要导入模块: from future import utils [as 别名]
# 或者: from future.utils import isbytes [as 别名]
def join(self, iterable_of_bytes):
        errmsg = 'sequence item {0}: expected bytes, {1} found'
        if isbytes(iterable_of_bytes) or istext(iterable_of_bytes):
            raise TypeError(errmsg.format(0, type(iterable_of_bytes)))
        for i, item in enumerate(iterable_of_bytes):
            if istext(item):
                raise TypeError(errmsg.format(i, type(item)))
        return newbytes(super(newbytes, self).join(iterable_of_bytes)) 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:10,代码来源:newbytes.py

示例2: __lt__

# 需要导入模块: from future import utils [as 别名]
# 或者: from future.utils import isbytes [as 别名]
def __lt__(self, other):
        if not isbytes(other):
            raise TypeError(self.unorderable_err.format(type(other)))
        return super(newbytes, self).__lt__(other) 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:6,代码来源:newbytes.py

示例3: __le__

# 需要导入模块: from future import utils [as 别名]
# 或者: from future.utils import isbytes [as 别名]
def __le__(self, other):
        if not isbytes(other):
            raise TypeError(self.unorderable_err.format(type(other)))
        return super(newbytes, self).__le__(other) 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:6,代码来源:newbytes.py

示例4: __gt__

# 需要导入模块: from future import utils [as 别名]
# 或者: from future.utils import isbytes [as 别名]
def __gt__(self, other):
        if not isbytes(other):
            raise TypeError(self.unorderable_err.format(type(other)))
        return super(newbytes, self).__gt__(other) 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:6,代码来源:newbytes.py

示例5: __ge__

# 需要导入模块: from future import utils [as 别名]
# 或者: from future.utils import isbytes [as 别名]
def __ge__(self, other):
        if not isbytes(other):
            raise TypeError(self.unorderable_err.format(type(other)))
        return super(newbytes, self).__ge__(other) 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:6,代码来源:newbytes.py

示例6: __call__

# 需要导入模块: from future import utils [as 别名]
# 或者: from future.utils import isbytes [as 别名]
def __call__(cls, lib, *args, **kwargs):

        # Identify the library path.
        if istext(lib) or isbytes(lib):
            if os.sep not in lib:
                lib_path = find_library(lib).path
            else:
                lib_path = os.path.realpath(lib)
                assert os.path.isfile(lib_path),\
                    'Provided path does not point to a file'
            backend_cls = cls.backends[kwargs.get('backend', 'ctypes')]

            lib_arch = LibraryPath(lib_path).arch
            py_bitness = 64 if sys.maxsize > 2**32 else 32
            if lib_arch and py_bitness not in lib_arch:
                raise OSError("Library bitness does not match Python's")
            lib = lib_path
        else:
            from .backends import identify_library, get_library_path
            backend = identify_library(lib)
            backend_cls = cls.backends[backend]
            lib_path = get_library_path(lib, backend)

        # Check whether or not this library has already been opened.
        if lib_path in cls.libs:
            return cls.libs[lib_path]

        else:
            obj = super(CLibraryMeta, backend_cls).__call__(lib, *args,
                                                            **kwargs)
            cls.libs[lib_path] = obj
            return obj 
开发者ID:MatthieuDartiailh,项目名称:pyclibrary,代码行数:34,代码来源:c_library.py

示例7: __init__

# 需要导入模块: from future import utils [as 别名]
# 或者: from future.utils import isbytes [as 别名]
def __init__(self, lib, headers, prefix=None, lock_calls=False,
                 convention='cdll', backend='ctypes', **kwargs):
        # name everything using underscores to avoid name collisions with
        # library

        # Build or store the parser from the header files.
        if isinstance(headers, list):
            self._headers_ = self._build_parser(headers, kwargs)
        elif isinstance(headers, CParser):
            self._headers_ = headers
        else:
            msg = 'Expected a CParser instance or list for headers, not {}'
            raise ValueError(msg.format(type(headers)))
        self._defs_ = self._headers_.defs

        # Create or store the internal representation of the library.
        if istext(lib) or isbytes(lib):
            self._lib_ = self._link_library(lib, convention)
        else:
            self._lib_ = lib

        # Store the list of prefix.
        if prefix is None:
            self._prefix_ = []
        elif isinstance(prefix, list):
            self._prefix_ = prefix
        else:
            self._prefix_ = [prefix]

        self._lock_calls_ = lock_calls
        if lock_calls:
            self._lock_ = RLock()

        self._objs_ = {}
        for k in ['values', 'functions', 'types', 'structs', 'unions',
                  'enums']:
            self._objs_[k] = {}
        self._all_objs_ = {}
        self._structs_ = {}
        self._unions_ = {} 
开发者ID:MatthieuDartiailh,项目名称:pyclibrary,代码行数:42,代码来源:c_library.py

示例8: arg_c_type

# 需要导入模块: from future import utils [as 别名]
# 或者: from future.utils import isbytes [as 别名]
def arg_c_type(self, arg):
        """Return the type required for the specified argument.

        Parameters
        ----------
        arg : int or unicode
            Name or index of the argument whose type should be returned.

        """
        if istext(arg) or isbytes(arg):
            arg = self.arg_inds[arg]
        return self.lib._get_type(self.sig[1][arg][1]) 
开发者ID:MatthieuDartiailh,项目名称:pyclibrary,代码行数:14,代码来源:c_library.py

示例9: __getitem__

# 需要导入模块: from future import utils [as 别名]
# 或者: from future.utils import isbytes [as 别名]
def __getitem__(self, n):
        if isinstance(n, int):
            arg = self.args[n]
        elif istext(n) or isbytes(n):
            n = self.find_arg(n)
            arg = self.args[n]
        else:
            raise ValueError("Index must be int or str.")

        if n in self.guessed:
            arg = arg[0]

        return self.lib._extract_val_(arg) 
开发者ID:MatthieuDartiailh,项目名称:pyclibrary,代码行数:15,代码来源:c_library.py


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