本文整理汇总了Python中sphinx.util.import_object函数的典型用法代码示例。如果您正苦于以下问题:Python import_object函数的具体用法?Python import_object怎么用?Python import_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了import_object函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get_supported_format
def get_supported_format(suffix):
parser_class = app.config.source_parsers.get(suffix)
if parser_class is None:
return ('restructuredtext',)
if isinstance(parser_class, string_types):
parser_class = import_object(parser_class, 'source parser')
return parser_class.supported
开发者ID:jean,项目名称:sphinx,代码行数:7,代码来源:__init__.py
示例2: __init__
def __init__(self, module_path, base_module=None):
self.module = import_object(module_path)
self.base_module = base_module or self.module.__name__
self.module_classes = set()
self.inheritances = []
self._populate_tree()
开发者ID:mgaitan,项目名称:sphinxcontrib-mermaid,代码行数:7,代码来源:autoclassdiag.py
示例3: get_supported_format
def get_supported_format(suffix):
# type: (unicode) -> Tuple[unicode]
parser_class = app.registry.get_source_parsers().get(suffix)
if parser_class is None:
return ('restructuredtext',)
if isinstance(parser_class, string_types):
parser_class = import_object(parser_class, 'source parser') # type: ignore
return parser_class.supported
开发者ID:atodorov,项目名称:sphinx,代码行数:8,代码来源:__init__.py
示例4: get_parser_type
def get_parser_type(source_path):
# type: (unicode) -> Tuple[unicode]
for suffix, parser_class in iteritems(self.app.registry.get_source_parsers()):
if source_path.endswith(suffix):
if isinstance(parser_class, string_types):
parser_class = import_object(parser_class, 'source parser') # type: ignore # NOQA
return parser_class.supported
return ('restructuredtext',)
开发者ID:hagenw,项目名称:sphinx,代码行数:8,代码来源:io.py
示例5: get_supported_format
def get_supported_format(suffix):
# type: (str) -> Tuple[str, ...]
parser_class = app.registry.get_source_parsers().get(suffix)
if parser_class is None:
return ('restructuredtext',)
if isinstance(parser_class, str):
parser_class = import_object(parser_class, 'source parser')
return parser_class.supported
开发者ID:olivier-heurtier,项目名称:sphinx,代码行数:8,代码来源:__init__.py
示例6: get_parser_type
def get_parser_type(source_path):
for suffix in self.env.config.source_parsers:
if source_path.endswith(suffix):
parser_class = self.env.config.source_parsers[suffix]
if isinstance(parser_class, string_types):
parser_class = import_object(parser_class, 'source parser')
return parser_class.supported
else:
return ('restructuredtext',)
开发者ID:Anlim,项目名称:sphinx,代码行数:9,代码来源:io.py
示例7: create_template_bridge
def create_template_bridge(self):
# type: () -> None
"""Return the template bridge configured."""
if self.config.template_bridge:
self.templates = import_object(self.config.template_bridge,
'template_bridge setting')()
else:
from sphinx.jinja2glue import BuiltinTemplateLoader
self.templates = BuiltinTemplateLoader()
开发者ID:willingc,项目名称:sphinx,代码行数:9,代码来源:__init__.py
示例8: __init__
def __init__(self, app, parsers={}, *args, **kwargs):
standalone.Reader.__init__(self, *args, **kwargs)
self.parser_map = {}
for suffix, parser_class in parsers.items():
if isinstance(parser_class, string_types):
parser_class = import_object(parser_class, 'source parser')
parser = parser_class()
if hasattr(parser, 'set_application'):
parser.set_application(app)
self.parser_map[suffix] = parser
开发者ID:Anlim,项目名称:sphinx,代码行数:10,代码来源:io.py
示例9: deprecate_source_parsers
def deprecate_source_parsers(app, config):
# type: (Sphinx, Config) -> None
if config.source_parsers:
warnings.warn('The config variable "source_parsers" is deprecated. '
'Please use app.add_source_parser() API instead.',
RemovedInSphinx30Warning)
for suffix, parser in config.source_parsers.items():
if isinstance(parser, str):
parser = import_object(parser, 'source parser')
app.add_source_parser(suffix, parser)
开发者ID:lmregus,项目名称:Portfolio,代码行数:10,代码来源:compat.py
示例10: __init__
def __init__(self, app, parsers={}, *args, **kwargs):
# type: (Sphinx, Dict[unicode, Parser], Any, Any) -> None
standalone.Reader.__init__(self, *args, **kwargs)
self.parser_map = {} # type: Dict[unicode, Parser]
for suffix, parser_class in parsers.items():
if isinstance(parser_class, string_types):
parser_class = import_object(parser_class, 'source parser') # type: ignore
parser = parser_class()
if hasattr(parser, 'set_application'):
parser.set_application(app)
self.parser_map[suffix] = parser
开发者ID:hagenw,项目名称:sphinx,代码行数:11,代码来源:io.py
示例11: import_object
def import_object(self, objname, source=None):
# type: (str, str) -> Any
"""Import an object from a ``module.name`` string.
.. deprecated:: 1.8
Use ``sphinx.util.import_object()`` instead.
"""
warnings.warn('app.import_object() is deprecated. '
'Use sphinx.util.add_object_type() instead.',
RemovedInSphinx30Warning, stacklevel=2)
return import_object(objname, source=None)
开发者ID:lmregus,项目名称:Portfolio,代码行数:11,代码来源:application.py
示例12: init
def init(self, options):
type = options.get('type', 'default')
if type in self.splitters:
dotted_path = self.splitters[type]
else:
dotted_path = type
try:
self.splitter = import_object(dotted_path)(options)
except ExtensionError:
raise ExtensionError("Splitter module %r can't be imported" %
dotted_path)
开发者ID:AlexEshoo,项目名称:sphinx,代码行数:11,代码来源:ja.py
示例13: init
def init(self, options):
# type: (Dict) -> None
type = options.get('type', 'sphinx.search.ja.DefaultSplitter')
if type in self.splitters:
dotted_path = self.splitters[type]
warnings.warn('html_search_options["type"]: %s is deprecated. '
'Please give "%s" instead.' % (type, dotted_path),
RemovedInSphinx30Warning)
else:
dotted_path = type
try:
self.splitter = import_object(dotted_path)(options)
except ExtensionError:
raise ExtensionError("Splitter module %r can't be imported" %
dotted_path)
开发者ID:mgeier,项目名称:sphinx,代码行数:15,代码来源:ja.py
示例14: import_object
def import_object(self, objname, source=None):
"""Import an object from a 'module.name' string."""
return import_object(objname, source=None)
开发者ID:861008761,项目名称:standard_flask_web,代码行数:3,代码来源:application.py
注:本文中的sphinx.util.import_object函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论