def read_python(path):
    '''Parses python scripts in a dictionary

    Parameters
    ----------
    path: str
        Path to file to parse

    Returns
    -------
    metadata:
        dictionary containing parsed file

    '''
    from six import exec_
    path = Path(path).absolute()
    assert path.is_file()
    with path.open('r') as f:
        contents = f.read()
    metadata = {}
    exec_(contents, {}, metadata)
    metadata = {k.lower(): v for (k, v) in metadata.items()}
    return metadata
def read_python ( path ) : from six import exec_ path = Path ( path ) . absolute ( ) assert path . is_file ( ) with path . open ( 'r' ) as f : contents = f . read ( ) metadata = { } exec_ ( contents , { } , metadata ) metadata = { k . lower ( ) : v for ( k , v ) in metadata . items ( ) } return metadata
Parses python scripts in a dictionary

    Parameters
    ----------
    path: str
        Path to file to parse

    Returns
    -------
    metadata:
        dictionary containing parsed file