pipeline.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:gransk 作者: pcbje 项目源码 文件源码
def produce(self, topic, doc, payload):
    """
    Produce a new event.

    :param topic: The topic of the produced event.
    :param doc: The document to which the event belongs.
    :param payload: The file pointer beloning to the document.
    :type topic: ``str``
    :type doc: ``gransk.core.Document``
    :type payload: ``file``
    """
    caller = inspect.currentframe().f_back.f_locals['self'].__module__
    listeners = self.listeners.get(topic, [])
    filename = os.path.basename(doc.path)

    for listener, callback in listeners:
      LOGGER.debug('[%s] %s -> %s (%s)', topic, caller, listener, filename)
      callback(doc, payload)

    if len(listeners) == 0:
      LOGGER.debug('[%s] %s -> no listeners (%s)', topic, caller, filename)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号