lines.py 文件源码

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

项目:pybel 作者: pybel 项目源码 文件源码
def from_path(path, manager=None, allow_nested=False, citation_clearing=True, encoding='utf-8', **kwargs):
    """Loads a BEL graph from a file resource. This function is a thin wrapper around :func:`from_lines`.

    :param str path: A file path
    :param manager: database connection string to cache, pre-built :class:`Manager`, or None to use default cache
    :type manager: None or str or pybel.manager.Manager
    :param bool allow_nested: if true, turn off nested statement failures
    :param bool citation_clearing: Should :code:`SET Citation` statements clear evidence and all annotations?
                                Delegated to :class:`pybel.parser.ControlParser`
    :param str encoding: the encoding to use when reading this file. Is passed to :code:`codecs.open`.
                     See the python `docs <https://docs.python.org/3/library/codecs.html#standard-encodings>`_ for a
                     list of standard encodings. For example, files starting with a UTF-8 BOM should use
                     :code:`utf_8_sig`
    :param dict kwargs: keyword arguments to :func:`pybel.io.line_utils.parse_lines`
    :rtype: BELGraph
    """
    log.info('Loading from path: %s', path)
    with codecs.open(os.path.expanduser(path), encoding=encoding) as file:
        return from_lines(
            lines=file,
            manager=manager,
            allow_nested=allow_nested,
            citation_clearing=citation_clearing,
            **kwargs
        )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号