本文整理汇总了Python中pypy.translator.translator.TranslationContext.annotator方法的典型用法代码示例。如果您正苦于以下问题:Python TranslationContext.annotator方法的具体用法?Python TranslationContext.annotator怎么用?Python TranslationContext.annotator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pypy.translator.translator.TranslationContext
的用法示例。
在下文中一共展示了TranslationContext.annotator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pypy.translator.translator import TranslationContext [as 别名]
# 或者: from pypy.translator.translator.TranslationContext import annotator [as 别名]
def __init__(self, translator=None, policy=None, bookkeeper=None):
import pypy.rpython.ootypesystem.ooregistry # has side effects
import pypy.rpython.extfuncregistry # has side effects
import pypy.rlib.nonconst # has side effects
if translator is None:
# interface for tests
from pypy.translator.translator import TranslationContext
translator = TranslationContext()
translator.annotator = self
self.translator = translator
self.pendingblocks = {} # map {block: graph-containing-it}
self.bindings = {} # map Variables to SomeValues
self.annotated = {} # set of blocks already seen
self.added_blocks = None # see processblock() below
self.links_followed = {} # set of links that have ever been followed
self.notify = {} # {block: {positions-to-reflow-from-when-done}}
self.fixed_graphs = {} # set of graphs not to annotate again
self.blocked_blocks = {} # set of {blocked_block: graph}
# --- the following information is recorded for debugging only ---
# --- and only if annotation.model.DEBUG is kept to True
self.why_not_annotated = {
} # {block: (exc_type, exc_value, traceback)}
# records the location of BlockedInference
# exceptions that blocked some blocks.
self.blocked_graphs = {} # set of graphs that have blocked blocks
self.bindingshistory = {} # map Variables to lists of SomeValues
self.binding_caused_by = {} # map Variables to position_keys
# records the caller position that caused bindings of inputargs
# to be updated
self.binding_cause_history = {} # map Variables to lists of positions
# history of binding_caused_by, kept in sync with
# bindingshistory
self.reflowcounter = {}
self.return_bindings = {} # map return Variables to their graphs
# --- end of debugging information ---
self.frozen = False
if policy is None:
from pypy.annotation.policy import AnnotatorPolicy
self.policy = AnnotatorPolicy()
else:
self.policy = policy
if bookkeeper is None:
bookkeeper = Bookkeeper(self)
self.bookkeeper = bookkeeper