def write(connection, skip, directory, force):
    """Write all as BEL."""
    os.makedirs(directory, exist_ok=True)
    from .manager.bel_manager import BELManagerMixin
    import pybel
    for idx, name, manager in _iterate_managers(connection, skip):
        if not isinstance(manager, BELManagerMixin):
            continue
        click.secho(name, fg='cyan', bold=True)
        path = os.path.join(directory, f'{name}.bel.pickle')
        if os.path.exists(path) and not force:
            click.echo('👍 already exported')
            continue

        if not manager.is_populated():
            click.echo('👎 unpopulated')
        else:
            graph = manager.to_bel()
            pybel.to_pickle(graph, path)
            pybel.to_json_path(graph, os.path.join(directory, f'{name}.bel.json'))
def write(connection, skip, directory, force):
    """Write all as BEL."""
    os.makedirs(directory, exist_ok=True)
    from .manager.bel_manager import BELManagerMixin
    import pybel
    for idx, name, manager in _iterate_managers(connection, skip):
        if not isinstance(manager, BELManagerMixin):
            continue
        click.secho(name, fg='cyan', bold=True)
        path = os.path.join(directory, f'{name}.bel.pickle')
        if os.path.exists(path) and not force:
            click.echo('👍 already exported')
            continue

        if not manager.is_populated():
            click.echo('👎 unpopulated')
        else:
            graph = manager.to_bel()
            pybel.to_pickle(graph, path)
            pybel.to_json_path(graph, os.path.join(directory, f'{name}.bel.json'))
def write ( connection , skip , directory , force ) : os . makedirs ( directory , exist_ok = True ) from . manager . bel_manager import BELManagerMixin import pybel for idx , name , manager in _iterate_managers ( connection , skip ) : if not isinstance ( manager , BELManagerMixin ) : continue click . secho ( name , fg = 'cyan' , bold = True ) path = os . path . join ( directory , f'{name}.bel.pickle' ) if os . path . exists ( path ) and not force : click . echo ( '👍 already exported') continue if not manager . is_populated ( ) : click . echo ( '👎 unpopulated') else : graph = manager . to_bel ( ) pybel . to_pickle ( graph , path ) pybel . to_json_path ( graph , os . path . join ( directory , f'{name}.bel.json' ) )
Write all as BEL.
Write all as BEL .