當前位置: 首頁>>代碼示例>>Python>>正文


Python nodes.system_message方法代碼示例

本文整理匯總了Python中docutils.nodes.system_message方法的典型用法代碼示例。如果您正苦於以下問題:Python nodes.system_message方法的具體用法?Python nodes.system_message怎麽用?Python nodes.system_message使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在docutils.nodes的用法示例。


在下文中一共展示了nodes.system_message方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: apply

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import system_message [as 別名]
def apply(self):
        pending = self.startnode
        parent = pending.parent
        child = pending
        while parent:
            # Check for appropriate following siblings:
            for index in range(parent.index(child) + 1, len(parent)):
                element = parent[index]
                if (isinstance(element, nodes.Invisible) or
                    isinstance(element, nodes.system_message)):
                    continue
                element['classes'] += pending.details['class']
                pending.parent.remove(pending)
                return
            else:
                # At end of section or container; apply to sibling
                child = parent
                parent = parent.parent
        error = self.document.reporter.error(
            'No suitable element following "%s" directive'
            % pending.details['directive'],
            nodes.literal_block(pending.rawsource, pending.rawsource),
            line=pending.line)
        pending.replace_self(error) 
開發者ID:skarlekar,項目名稱:faces,代碼行數:26,代碼來源:misc.py

示例2: system_message

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import system_message [as 別名]
def system_message(self, level, message, *children, **kwargs):
            self.messages.append((level, message, children, kwargs))
            return nodes.system_message(message, level=level,
                                        type=self.levels[level],
                                        *children, **kwargs) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:7,代碼來源:check.py

示例3: apply

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import system_message [as 別名]
def apply(self):
        for node in self.document.traverse(nodes.system_message):
            if node['level'] < self.document.reporter.report_level:
                node.parent.remove(node) 
開發者ID:skarlekar,項目名稱:faces,代碼行數:6,代碼來源:universal.py

示例4: __init__

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import system_message [as 別名]
def __init__(self, system_message, level):
        Exception.__init__(self, system_message.astext())
        self.level = level 
開發者ID:skarlekar,項目名稱:faces,代碼行數:5,代碼來源:__init__.py

示例5: attach_observer

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import system_message [as 別名]
def attach_observer(self, observer):
        """
        The `observer` parameter is a function or bound method which takes one
        argument, a `nodes.system_message` instance.
        """
        self.observers.append(observer) 
開發者ID:skarlekar,項目名稱:faces,代碼行數:8,代碼來源:__init__.py

示例6: debug

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import system_message [as 別名]
def debug(self, *args, **kwargs):
        """
        Level-0, "DEBUG": an internal reporting issue. Typically, there is no
        effect on the processing. Level-0 system messages are handled
        separately from the others.
        """
        if self.debug_flag:
            return self.system_message(self.DEBUG_LEVEL, *args, **kwargs) 
開發者ID:skarlekar,項目名稱:faces,代碼行數:10,代碼來源:__init__.py

示例7: info

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import system_message [as 別名]
def info(self, *args, **kwargs):
        """
        Level-1, "INFO": a minor issue that can be ignored. Typically there is
        no effect on processing, and level-1 system messages are not reported.
        """
        return self.system_message(self.INFO_LEVEL, *args, **kwargs) 
開發者ID:skarlekar,項目名稱:faces,代碼行數:8,代碼來源:__init__.py

示例8: warning

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import system_message [as 別名]
def warning(self, *args, **kwargs):
        """
        Level-2, "WARNING": an issue that should be addressed. If ignored,
        there may be unpredictable problems with the output.
        """
        return self.system_message(self.WARNING_LEVEL, *args, **kwargs) 
開發者ID:skarlekar,項目名稱:faces,代碼行數:8,代碼來源:__init__.py

示例9: error

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import system_message [as 別名]
def error(self, *args, **kwargs):
        """
        Level-3, "ERROR": an error that should be addressed. If ignored, the
        output will contain errors.
        """
        return self.system_message(self.ERROR_LEVEL, *args, **kwargs) 
開發者ID:skarlekar,項目名稱:faces,代碼行數:8,代碼來源:__init__.py

示例10: severe

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import system_message [as 別名]
def severe(self, *args, **kwargs):
        """
        Level-4, "SEVERE": a severe error that must be addressed. If ignored,
        the output will contain severe errors. Typically level-4 system
        messages are turned into exceptions which halt processing.
        """
        return self.system_message(self.SEVERE_LEVEL, *args, **kwargs) 
開發者ID:skarlekar,項目名稱:faces,代碼行數:9,代碼來源:__init__.py

示例11: run

# 需要導入模塊: from docutils import nodes [as 別名]
# 或者: from docutils.nodes import system_message [as 別名]
def run(self):
        if not isinstance(self.state, states.SubstitutionDef):
            raise self.error(
                'Invalid context: the "%s" directive can only be used within '
                'a substitution definition.' % self.name)
        self.assert_has_content()
        text = '\n'.join(self.content)
        element = nodes.Element(text)
        self.state.nested_parse(self.content, self.content_offset,
                                element)
        # element might contain [paragraph] + system_message(s)
        node = None
        messages = []
        for elem in element:
            if not node and isinstance(elem, nodes.paragraph):
                node = elem
            elif isinstance(elem, nodes.system_message):
                elem['backrefs'] = []
                messages.append(elem)
            else:
                return [
                    self.state_machine.reporter.error(
                        'Error in "%s" directive: may contain a single paragraph '
                        'only.' % (self.name), line=self.lineno) ]
        if node:
            return messages + node.children
        return messages 
開發者ID:skarlekar,項目名稱:faces,代碼行數:29,代碼來源:misc.py


注:本文中的docutils.nodes.system_message方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。