def explode(req: str):
    """Returns the exploded dependency list for a requirements file.

    As requirements files can include other requirements files with the -r directive, it can be
    useful to see a flattened version of all the constraints. This method unrolls a requirement file
    and produces a list of strings for each constraint line in the order of inclusion.

    Args:
        req: path to a requirements file.
    Returns:
         list of lines of requirements
    """
    res = []
    d = os.path.dirname(req)
    with open(req) as f:
        for l in f.readlines():
            l = l.rstrip("\n")
            l = l.lstrip(" ")
            if l.startswith("-r"):
                include = l.lstrip(" ").lstrip("-r").lstrip(" ")
                # assuming relative includes always
                res += explode(os.path.join(d, include))
            elif l:
                res += [l]
    return res
Returns the exploded dependency list for a requirements file.

    As requirements files can include other requirements files with the -r directive, it can be
    useful to see a flattened version of all the constraints. This method unrolls a requirement file
    and produces a list of strings for each constraint line in the order of inclusion.

    Args:
        req: path to a requirements file.
    Returns:
         list of lines of requirements
    
dev_tools/requirements/reqs.py