本文整理汇总了Python中numba.utils.iteritems函数的典型用法代码示例。如果您正苦于以下问题:Python iteritems函数的具体用法?Python iteritems怎么用?Python iteritems使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了iteritems函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, context, fndesc, interp):
self.context = context
self.fndesc = fndesc
self.blocks = utils.SortedMap(utils.iteritems(interp.blocks))
# Initialize LLVM
self.module = Module.new("module.%s" % self.fndesc.unique_name)
# Python execution environment (will be available to the compiled
# function).
self.env = _dynfunc.Environment(
globals=self.fndesc.lookup_module().__dict__)
# Setup function
self.function = context.declare_function(self.module, fndesc)
self.entry_block = self.function.append_basic_block('entry')
self.builder = Builder.new(self.entry_block)
# Internal states
self.blkmap = {}
self.varmap = {}
self.firstblk = min(self.blocks.keys())
self.loc = -1
# Subclass initialization
self.init()
示例2: inspect_types
def inspect_types(self, file=None, **kwargs):
"""
print or return annotated source with Numba intermediate IR
Pass `pretty=True` to attempt color highlighting, and HTML rendering in
Jupyter and IPython by returning an Annotate Object. `file` must be
None if used in conjunction with `pretty=True`.
"""
pretty = kwargs.get('pretty', False)
style = kwargs.get('style', 'default')
if not pretty:
if file is None:
file = sys.stdout
for ver, res in utils.iteritems(self.overloads):
print("%s %s" % (self.py_func.__name__, ver), file=file)
print('-' * 80, file=file)
print(res.type_annotation, file=file)
print('=' * 80, file=file)
else:
if file is not None:
raise ValueError("`file` must be None if `pretty=True`")
from .pretty_annotate import Annotate
return Annotate(self, style=style)
示例3: inspect_types
def inspect_types(self, file=None):
if file is None:
file = sys.stdout
for ver, res in utils.iteritems(self.overloads):
print("%s %s" % (self.py_func.__name__, ver), file=file)
print('-' * 80, file=file)
print(res.type_annotation, file=file)
print('=' * 80, file=file)
示例4: dump
def dump(self):
def label_marker(i):
if i[1].offset in self.labels:
return '>'
else:
return ' '
return '\n'.join('%s %10s\t%s' % ((label_marker(i),) + i)
for i in utils.iteritems(self.table))
示例5: inspect_types
def inspect_types(self, file=None):
'''
Produce a dump of the Python source of this function annotated with the
corresponding Numba IR and type information. The dump is written to
*file*, or *sys.stdout* if *file* is *None*.
'''
if file is None:
file = sys.stdout
for ver, defn in utils.iteritems(self.definitions):
defn.inspect_types(file=file)
示例6: insert_class
def insert_class(self, cls, attrs):
clsty = types.Object(cls)
for name, vtype in utils.iteritems(attrs):
imp = python_attr_impl(clsty, name, vtype)
self.attrs[imp.attr].append(imp)
示例7: run
def run(self):
for blkid, blk in utils.iteritems(self.interp.blocks):
self.run_block(blk)
示例8: inspect_types
def inspect_types(self, file=None):
if file is None:
file = sys.stdout
for ver, defn in utils.iteritems(self.definitions):
defn.inspect_types(file=file)