Example #1
0
def get_bel(repo: Repo, branch: str, manager: Optional[Manager] = None, use_tqdm: bool = False) -> BELGraph:
    """Get the BEL graph for the first BEL document found."""
    line_groups = list(get_bel_lines(repo, branch))
    file_name, lines = line_groups[0]
    graph = BELGraph(path=file_name)
    parse_lines(graph=graph, lines=lines, manager=manager, use_tqdm=use_tqdm)
    return graph
Example #2
0
 def test_thorough_upgrade(self):
     lines = to_bel_script_lines(self.thorough_graph, use_identifiers=True)
     reconstituted = BELGraph()
     parse_lines(reconstituted, lines, manager=self.manager)
     self.bel_thorough_reconstituted(reconstituted,
                                     check_citation_name=False,
                                     check_path=False)
Example #3
0
    def test_isolated_upgrade(self):
        lines = to_bel_script_lines(self.isolated_graph)

        with mock_bel_resources:
            reconstituted = BELGraph()
            parse_lines(graph=reconstituted, lines=lines, manager=self.manager)

        self.bel_isolated_reconstituted(reconstituted)
Example #4
0
def parse_graph(report: Report, manager: Manager, task: Task) -> BELGraph:
    """Parse a graph from a report while keeping a celery :class:`Task` informed of progress."""
    lines = iterate_report_lines_in_task(report, task)
    graph = BELGraph()
    parse_lines(
        graph=graph,
        lines=lines,
        manager=manager,
        citation_clearing=report.citation_clearing,
        no_identifier_validation=not report.identifier_validation,
    )
    return graph