def get_metatab_doc(nb_path):
    """Read a notebook and extract the metatab document. Only returns the first document"""

    from metatab.generate import CsvDataRowGenerator
    from metatab.rowgenerators import TextRowGenerator
    from metatab import MetatabDoc

    with open(nb_path) as f:
        nb = nbformat.reads(f.read(), as_version=4)

    for cell in nb.cells:
        source = ''.join(cell['source']).strip()
        if source.startswith('%%metatab'):
            return MetatabDoc(TextRowGenerator(source))
def get_metatab_doc ( nb_path ) : from metatab . generate import CsvDataRowGenerator from metatab . rowgenerators import TextRowGenerator from metatab import MetatabDoc with open ( nb_path ) as f : nb = nbformat . reads ( f . read ( ) , as_version = 4 ) for cell in nb . cells : source = '' . join ( cell [ 'source' ] ) . strip ( ) if source . startswith ( '%%metatab' ) : return MetatabDoc ( TextRowGenerator ( source ) )
Read a notebook and extract the metatab document. Only returns the first document