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


Python directives.unchanged方法代码示例

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


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

示例1: setup

# 需要导入模块: from docutils.parsers.rst import directives [as 别名]
# 或者: from docutils.parsers.rst.directives import unchanged [as 别名]
def setup(app):
    app.add_directive('autoplugin',
                      autoplugin_directive, 1, (1, 0, 1),
                      plugin=directives.unchanged)
    app.add_directive('autohelp', autohelp_directive, 0, (0, 0, 1)) 
开发者ID:singhj,项目名称:locality-sensitive-hashing,代码行数:7,代码来源:pluginopts.py

示例2: setup

# 需要导入模块: from docutils.parsers.rst import directives [as 别名]
# 或者: from docutils.parsers.rst.directives import unchanged [as 别名]
def setup(app):
    setup.app = app
    setup.config = app.config
    setup.confdir = app.confdir

    options = {'alt': directives.unchanged,
               'height': directives.length_or_unitless,
               'width': directives.length_or_percentage_or_unitless,
               'scale': directives.nonnegative_int,
               'align': _option_align,
               'class': directives.class_option,
               'include-source': _option_boolean,
               'format': _option_format,
               'context': directives.flag,
               'nofigs': directives.flag,
               'encoding': directives.encoding
               }

    app.add_directive('plot', plot_directive, True, (0, 2, False), **options)
    app.add_config_value('plot_pre_code', None, True)
    app.add_config_value('plot_include_source', False, True)
    app.add_config_value('plot_formats', ['png', 'hires.png', 'pdf'], True)
    app.add_config_value('plot_basedir', None, True)
    app.add_config_value('plot_html_show_formats', True, True)
    app.add_config_value('plot_rcparams', {}, True)
    app.add_config_value('plot_apply_rcparams', False, True)
    app.add_config_value('plot_working_directory', None, True)
    app.add_config_value('plot_template', None, True)

    app.connect('doctree-read', mark_plot_labels)

#------------------------------------------------------------------------------
# Doctest handling
#------------------------------------------------------------------------------ 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:36,代码来源:plot_directive.py

示例3: setup

# 需要导入模块: from docutils.parsers.rst import directives [as 别名]
# 或者: from docutils.parsers.rst.directives import unchanged [as 别名]
def setup(app):
    setup.app = app
    setup.config = app.config
    setup.confdir = app.confdir

    options = {'alt': directives.unchanged,
               'height': directives.length_or_unitless,
               'width': directives.length_or_percentage_or_unitless,
               'scale': directives.nonnegative_int,
               'align': _option_align,
               'class': directives.class_option,
               'include-source': _option_boolean,
               'format': _option_format,
               'context': _option_context,
               'nofigs': directives.flag,
               'encoding': directives.encoding
               }

    app.add_directive('plot', plot_directive, True, (0, 2, False), **options)
    app.add_config_value('plot_pre_code', None, True)
    app.add_config_value('plot_include_source', False, True)
    app.add_config_value('plot_html_show_source_link', True, True)
    app.add_config_value('plot_formats', ['png', 'hires.png', 'pdf'], True)
    app.add_config_value('plot_basedir', None, True)
    app.add_config_value('plot_html_show_formats', True, True)
    app.add_config_value('plot_rcparams', {}, True)
    app.add_config_value('plot_apply_rcparams', False, True)
    app.add_config_value('plot_working_directory', None, True)
    app.add_config_value('plot_template', None, True)

    app.connect(str('doctree-read'), mark_plot_labels)

    metadata = {'parallel_read_safe': True, 'parallel_write_safe': True}
    return metadata

#------------------------------------------------------------------------------
# Doctest handling
#------------------------------------------------------------------------------ 
开发者ID:statlab,项目名称:permute,代码行数:40,代码来源:plot_directive.py

示例4: raw_json

# 需要导入模块: from docutils.parsers.rst import directives [as 别名]
# 或者: from docutils.parsers.rst.directives import unchanged [as 别名]
def raw_json(argument):
    """Type of direction attribute."""
    if argument is None:
        return directives.unchanged(argument)
    try:
        json.loads(argument)
    except json.decoder.JSONDecodeError:
        return ""
    return argument 
开发者ID:attakei,项目名称:sphinx-revealjs,代码行数:11,代码来源:directives.py

示例5: setup

# 需要导入模块: from docutils.parsers.rst import directives [as 别名]
# 或者: from docutils.parsers.rst.directives import unchanged [as 别名]
def setup(app):
    setup.app = app
    setup.config = app.config
    setup.confdir = app.confdir

    options = {'alt': directives.unchanged,
               'height': directives.length_or_unitless,
               'width': directives.length_or_percentage_or_unitless,
               'scale': directives.nonnegative_int,
               'align': _option_align,
               'class': directives.class_option,
               'include-source': _option_boolean,
               'format': _option_format,
               'context': _option_context,
               'nofigs': directives.flag,
               'encoding': directives.encoding
               }

    app.add_directive('plot', plot_directive, True, (0, 2, False), **options)
    app.add_config_value('plot_pre_code', None, True)
    app.add_config_value('plot_include_source', False, True)
    app.add_config_value('plot_html_show_source_link', True, True)
    app.add_config_value('plot_formats', ['png', 'hires.png', 'pdf'], True)
    app.add_config_value('plot_basedir', None, True)
    app.add_config_value('plot_html_show_formats', True, True)
    app.add_config_value('plot_rcparams', {}, True)
    app.add_config_value('plot_apply_rcparams', False, True)
    app.add_config_value('plot_working_directory', None, True)
    app.add_config_value('plot_template', None, True)

    app.connect(str('doctree-read'), mark_plot_labels)

#------------------------------------------------------------------------------
# Doctest handling
#------------------------------------------------------------------------------ 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:37,代码来源:plot_directive.py

示例6: setup

# 需要导入模块: from docutils.parsers.rst import directives [as 别名]
# 或者: from docutils.parsers.rst.directives import unchanged [as 别名]
def setup(app):
    setup.app = app
    setup.config = app.config
    setup.confdir = app.confdir

    options = {'alt': directives.unchanged,
               'height': directives.length_or_unitless,
               'width': directives.length_or_percentage_or_unitless,
               'scale': directives.nonnegative_int,
               'align': _option_align,
               'class': directives.class_option,
               'include-source': _option_boolean,
               'format': _option_format,
               'context': _option_context,
               'nofigs': directives.flag,
               'encoding': directives.encoding
               }

    app.add_directive('plot', plot_directive, True, (0, 2, False), **options)
    app.add_config_value('plot_pre_code', None, True)
    app.add_config_value('plot_include_source', False, True)
    app.add_config_value('plot_html_show_source_link', True, True)
    app.add_config_value('plot_formats', ['png', 'hires.png', 'pdf'], True)
    app.add_config_value('plot_basedir', None, True)
    app.add_config_value('plot_html_show_formats', True, True)
    app.add_config_value('plot_rcparams', {}, True)
    app.add_config_value('plot_apply_rcparams', False, True)
    app.add_config_value('plot_working_directory', None, True)
    app.add_config_value('plot_template', None, True)

    app.connect('doctree-read', mark_plot_labels)

    metadata = {'parallel_read_safe': True, 'parallel_write_safe': True}
    return metadata

#------------------------------------------------------------------------------
# Doctest handling
#------------------------------------------------------------------------------ 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:40,代码来源:plot_directive.py

示例7: load_config

# 需要导入模块: from docutils.parsers.rst import directives [as 别名]
# 或者: from docutils.parsers.rst.directives import unchanged [as 别名]
def load_config(app, *args):
    """
    Register extra options and directive based on config from con.py
    """
    types = app.config.needs_types
    extra_options = getattr(app.config, "needs_extra_options", app.config.needs_extra_options)

    # Get extra links and create a dictionary of needed options.
    extra_links_raw = getattr(app.config, "needs_extra_links", app.config.needs_extra_links)
    extra_links = {}
    for extra_link in extra_links_raw:
        extra_links[extra_link['option']] = directives.unchanged

    title_optional = getattr(app.config, "needs_title_optional", app.config.needs_title_optional)
    title_from_content = getattr(app.config, "needs_title_from_content", app.config.needs_title_from_content)
    # app.needs_functions = getattr(app.config, "needs_functions", [])
    global NEEDS_FUNCTIONS_CONF
    NEEDS_FUNCTIONS_CONF = getattr(app.config, "needs_functions", [])
    # app.needs_functions = []

    # Update NeedDirective to use customized options
    NeedDirective.option_spec.update(extra_options)

    # Update NeedDirective to use customized links
    NeedDirective.option_spec.update(extra_links)

    if title_optional or title_from_content:
        NeedDirective.required_arguments = 0
        NeedDirective.optional_arguments = 1

    for type in types:
        # Register requested types of needs
        app.add_directive(type["directive"], NeedDirective) 
开发者ID:useblocks,项目名称:sphinxcontrib-needs,代码行数:35,代码来源:needs.py

示例8: setup

# 需要导入模块: from docutils.parsers.rst import directives [as 别名]
# 或者: from docutils.parsers.rst.directives import unchanged [as 别名]
def setup(app):
    setup.app = app
    setup.config = app.config
    setup.confdir = app.confdir

    options = {'height': directives.length_or_unitless,
               'width': directives.length_or_percentage_or_unitless,
               'align': directives.unchanged
               }

    app.add_directive('cq_plot', cq_directive, True, (0, 2, 0), **options) 
开发者ID:jmwright,项目名称:cadquery-freecad-module,代码行数:13,代码来源:cq_directive.py

示例9: setup

# 需要导入模块: from docutils.parsers.rst import directives [as 别名]
# 或者: from docutils.parsers.rst.directives import unchanged [as 别名]
def setup(app):
    setup.app = app
    setup.config = app.config
    setup.confdir = app.confdir

    options = {'alt': directives.unchanged,
               'height': directives.length_or_unitless,
               'width': directives.length_or_percentage_or_unitless,
               'scale': directives.nonnegative_int,
               'align': _option_align,
               'class': directives.class_option,
               'include-source': _option_boolean,
               'format': _option_format,
               'context': _option_context,
               'nofigs': directives.flag,
               'encoding': directives.encoding
               }

    app.add_directive('plot', plot_directive, True, (0, 2, False), **options)
    app.add_config_value('plot_pre_code', None, True)
    app.add_config_value('plot_include_source', False, True)
    app.add_config_value('plot_html_show_source_link', True, True)
    app.add_config_value('plot_formats', ['png', 'hires.png', 'pdf'], True)
    app.add_config_value('plot_basedir', None, True)
    app.add_config_value('plot_html_show_formats', True, True)
    app.add_config_value('plot_rcparams', {}, True)
    app.add_config_value('plot_apply_rcparams', False, True)
    app.add_config_value('plot_working_directory', None, True)
    app.add_config_value('plot_template', None, True)

    app.connect(str('doctree-read'), mark_plot_labels)

# -----------------------------------------------------------------------------
#  Doctest handling
# ----------------------------------------------------------------------------- 
开发者ID:msmbuilder,项目名称:msmexplorer,代码行数:37,代码来源:plot_directive.py

示例10: setup

# 需要导入模块: from docutils.parsers.rst import directives [as 别名]
# 或者: from docutils.parsers.rst.directives import unchanged [as 别名]
def setup(app):
    app.connect('autodoc-skip-member', skip_deprecated)
    try:
        from sphinx.ext.autosummary import Autosummary
        from sphinx.ext.autosummary import get_documenter
        from docutils.parsers.rst import directives
        from sphinx.util.inspect import safe_getattr

        class AutoAutoSummary(Autosummary):

            option_spec = {
                'methods': directives.unchanged,
                'attributes': directives.unchanged
            }

            required_arguments = 1

            @staticmethod
            def get_members(obj, typ, include_public=None):
                if not include_public:
                    include_public = []
                items = []
                for name in dir(obj):
                    try:
                        documenter = get_documenter(safe_getattr(obj, name),
                                                    obj)
                    except AttributeError:
                        continue
                    if documenter.objtype == typ:
                        items.append(name)
                public = [x for x in items
                          if x in include_public or not x.startswith('_')]
                return public, items

            def run(self):
                clazz = str(self.arguments[0])
                try:
                    (module_name, class_name) = clazz.rsplit('.', 1)
                    m = __import__(module_name, globals(), locals(),
                                   [class_name])
                    c = getattr(m, class_name)
                    if 'methods' in self.options:
                        _, methods = self.get_members(c,
                                                      'method', ['__init__'])

                        self.content = ["~%s.%s" % (clazz, method)
                                        for method in methods
                                        if not method.startswith('_')]
                    if 'attributes' in self.options:
                        _, attribs = self.get_members(c, 'attribute')
                        self.content = ["~%s.%s" % (clazz, attrib)
                                        for attrib in attribs
                                        if not attrib.startswith('_')]
                finally:
                    return super(AutoAutoSummary, self).run()

        app.add_directive('autoautosummary', AutoAutoSummary)
    except BaseException as e:
        raise e 
开发者ID:libvips,项目名称:pyvips,代码行数:61,代码来源:conf.py


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