seagull/lifeforms/wiki.py
def _get_metadata(lines: List[str]) -> Dict:
    """Parse meta-data stored in the comments of .cells file

    Args:
        lines (List[str]): comment lines to be parsed

    Returns:
        Dict of meta-data by keys. Curently supported keys:
        - name     : from line starting with "!Name: "
        - author   : from line starting with "!Author: "
        - comments : for all other comments
    """
    meta = {"comments": []}
    for line in lines:
        if line.startswith("!"):
            # parsing commented lines
            # @TODO: prettify? or delete this todo
            if line.startswith("!Name: "):
                meta["name"] = line[len("!Name: ") :]
            elif line.startswith("!Author: "):
                meta["author"] = line[len("!Author: ") :]
            else:
                meta["comments"].append(line[1:])
        elif line.startswith("#"):
            # parsing commented lines
            # @TODO: prettify? or delete this todo
            if line.startswith("#N "):
                meta["name"] = line[len("#N ") :]
            elif line.startswith("#O "):
                meta["author"] = line[len("#O ") :]
            elif line.startswith(("#R ", "#P ", "#r ")):
                # @TODO: decide whether add R, P, r parsing?
                raise NotImplementedError("#R, #r , #P tags not implemented")
            else:
                meta["comments"].append(
                    line[3:]
                )  # 3: for proper "#C <comment>" format
        else:
            # not a comment line
            pass

    meta["comments"] = "\n".join(meta["comments"])

    return meta
Parse meta-data stored in the comments of .cells file

    Args:
        lines (List[str]): comment lines to be parsed

    Returns:
        Dict of meta-data by keys. Curently supported keys:
        - name     : from line starting with "!Name: "
        - author   : from line starting with "!Author: "
        - comments : for all other comments
    
Parse meta-data stored in the comments of .cells file
Parse meta - data stored in the comments of . cells file
def _get_metadata(lines: List[str]) -> Dict:
    meta = {"comments": []}
    for line in lines:
        if line.startswith("!"):
            if line.startswith("!Name: "):
                meta["name"] = line[len("!Name: ") :]
            elif line.startswith("!Author: "):
                meta["author"] = line[len("!Author: ") :]
            else:
                meta["comments"].append(line[1:])
        elif line.startswith("#"):
            if line.startswith("#N "):
                meta["name"] = line[len("#N ") :]
            elif line.startswith("#O "):
                meta["author"] = line[len("#O ") :]
            elif line.startswith(("#R ", "#P ", "#r ")):
                raise NotImplementedError("#R, #r , #P tags not implemented")
            else:
                meta["comments"].append(
                    line[3:]
                )  
        else:
            pass
    meta["comments"] = "\n".join(meta["comments"])
    return meta
def _get_metadata ( lines : List [ str ] ) -> Dict : meta = { "comments" : [ ] } for line in lines : if line . startswith ( "!" ) : if line . startswith ( "!Name: " ) : meta [ "name" ] = line [ len ( "!Name: " ) : ] elif line . startswith ( "!Author: " ) : meta [ "author" ] = line [ len ( "!Author: " ) : ] else : meta [ "comments" ] . append ( line [ 1 : ] ) elif line . startswith ( "#" ) : if line . startswith ( "#N " ) : meta [ "name" ] = line [ len ( "#N " ) : ] elif line . startswith ( "#O " ) : meta [ "author" ] = line [ len ( "#O " ) : ] elif line . startswith ( ( "#R " , "#P " , "#r " ) ) : raise NotImplementedError ( "#R, #r , #P tags not implemented" ) else : meta [ "comments" ] . append ( line [ 3 : ] ) else : pass meta [ "comments" ] = "\n" . join ( meta [ "comments" ] ) return meta
Parse meta-data stored in the comments of .cells file
Parse meta - data stored in the comments of . cells file
"""Parse meta-data stored in the comments of .cells file

    Args:
        lines (List[str]): comment lines to be parsed

    Returns:
        Dict of meta-data by keys. Curently supported keys:
        - name     : from line starting with "!Name: "
        - author   : from line starting with "!Author: "
        - comments : for all other comments
    """ # parsing commented lines # @TODO: prettify? or delete this todo # parsing commented lines # @TODO: prettify? or delete this todo # @TODO: decide whether add R, P, r parsing? # 3: for proper "#C <comment>" format # not a comment line
Dict of meta-data by keys. Curently supported keys:
name     : from line starting with "!Name: "
author   : from line starting with "!Author: "
comments : for all other comments
Dict of meta - data by keys . Curently supported keys : name : from line starting with " !Name : " author : from line starting with " !Author : " comments : for all other comments
lines
List[str]
comment lines to be parsed
comment lines to be parsed