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


Python builtins.complex方法代码示例

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


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

示例1: _set_array_types

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import complex [as 别名]
def _set_array_types():
    ibytes = [1, 2, 4, 8, 16, 32, 64]
    fbytes = [2, 4, 8, 10, 12, 16, 32, 64]
    for bytes in ibytes:
        bits = 8*bytes
        _add_array_type('int', bits)
        _add_array_type('uint', bits)
    for bytes in fbytes:
        bits = 8*bytes
        _add_array_type('float', bits)
        _add_array_type('complex', 2*bits)
    _gi = dtype('p')
    if _gi.type not in sctypes['int']:
        indx = 0
        sz = _gi.itemsize
        _lst = sctypes['int']
        while (indx < len(_lst) and sz >= _lst[indx](0).itemsize):
            indx += 1
        sctypes['int'].insert(indx, _gi.type)
        sctypes['uint'].insert(indx, dtype('P').type) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:22,代码来源:numerictypes.py

示例2: _add_aliases

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import complex [as 别名]
def _add_aliases():
    for type_name, info in typeinfo.items():
        if isinstance(info, type):
            continue
        name = english_lower(type_name)

        # insert bit-width version for this class (if relevant)
        base, bit, char = bitname(info.type)
        if base[-3:] == 'int' or char[0] in 'ui':
            continue
        if base != '':
            myname = "%s%d" % (base, bit)
            if (name not in ('longdouble', 'clongdouble') or
                   myname not in allTypes):
                base_capitalize = english_capitalize(base)
                if base == 'complex':
                    na_name = '%s%d' % (base_capitalize, bit//2)
                elif base == 'bool':
                    na_name = base_capitalize
                else:
                    na_name = "%s%d" % (base_capitalize, bit)

                allTypes[myname] = info.type

                # add mapping for both the bit name and the numarray name
                sctypeDict[myname] = info.type
                sctypeDict[na_name] = info.type

                # add forward, reverse, and string mapping to numarray
                sctypeNA[na_name] = info.type
                sctypeNA[info.type] = na_name
                sctypeNA[info.char] = na_name
        if char != '':
            sctypeDict[char] = info.type
            sctypeNA[char] = na_name 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:37,代码来源:numerictypes.py

示例3: _bytes_to_complex

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import complex [as 别名]
def _bytes_to_complex(s):
        return complex(s.decode('ascii')) 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:4,代码来源:_iotools.py

示例4: _add_aliases

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import complex [as 别名]
def _add_aliases():
    for a in typeinfo.keys():
        name = english_lower(a)
        if not isinstance(typeinfo[a], tuple):
            continue
        typeobj = typeinfo[a][-1]
        # insert bit-width version for this class (if relevant)
        base, bit, char = bitname(typeobj)
        if base[-3:] == 'int' or char[0] in 'ui':
            continue
        if base != '':
            myname = "%s%d" % (base, bit)
            if ((name != 'longdouble' and name != 'clongdouble') or
                   myname not in allTypes.keys()):
                allTypes[myname] = typeobj
                sctypeDict[myname] = typeobj
                if base == 'complex':
                    na_name = '%s%d' % (english_capitalize(base), bit//2)
                elif base == 'bool':
                    na_name = english_capitalize(base)
                    sctypeDict[na_name] = typeobj
                else:
                    na_name = "%s%d" % (english_capitalize(base), bit)
                    sctypeDict[na_name] = typeobj
                sctypeNA[na_name] = typeobj
                sctypeDict[na_name] = typeobj
                sctypeNA[typeobj] = na_name
                sctypeNA[typeinfo[a][0]] = na_name
        if char != '':
            sctypeDict[char] = typeobj
            sctypeNA[char] = na_name 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:33,代码来源:numerictypes.py

示例5: _add_aliases

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import complex [as 别名]
def _add_aliases():
    for a in typeinfo.keys():
        name = english_lower(a)
        if not isinstance(typeinfo[a], tuple):
            continue
        typeobj = typeinfo[a][-1]
        # insert bit-width version for this class (if relevant)
        base, bit, char = bitname(typeobj)
        if base[-3:] == 'int' or char[0] in 'ui': continue
        if base != '':
            myname = "%s%d" % (base, bit)
            if (name != 'longdouble' and name != 'clongdouble') or \
                   myname not in allTypes.keys():
                allTypes[myname] = typeobj
                sctypeDict[myname] = typeobj
                if base == 'complex':
                    na_name = '%s%d' % (english_capitalize(base), bit//2)
                elif base == 'bool':
                    na_name = english_capitalize(base)
                    sctypeDict[na_name] = typeobj
                else:
                    na_name = "%s%d" % (english_capitalize(base), bit)
                    sctypeDict[na_name] = typeobj
                sctypeNA[na_name] = typeobj
                sctypeDict[na_name] = typeobj
                sctypeNA[typeobj] = na_name
                sctypeNA[typeinfo[a][0]] = na_name
        if char != '':
            sctypeDict[char] = typeobj
            sctypeNA[char] = na_name 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:32,代码来源:numerictypes.py

示例6: test_ignore_constructors

# 需要导入模块: import builtins [as 别名]
# 或者: from builtins import complex [as 别名]
def test_ignore_constructors():
    visitor = Visitor(
        ignore=('complex', 'dict', 'float', 'int', 'list', 'str', 'tuple'),
    )
    visitor.visit(ast.parse(BUILTIN_CONSTRUCTORS))
    assert visitor.builtin_type_calls == [] 
开发者ID:pre-commit,项目名称:pre-commit-hooks,代码行数:8,代码来源:check_builtin_literals_test.py


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