TrainingExtensions/torch/src/python/aimet_torch/meta/connectedgraph.py
def _flatten_lists(nested_list: List[List]) -> List:
    """
    Given a list which may contain either an item or a further list of items, generate a list that only contains items
    by bringing all elements of nested lists into the top level list.
    :param nested_list: List containing items or lists of items
    :return: List containing only items (no nested lists)
    """
    flattened_list = []
    for item in nested_list:
        if not isinstance(item, List):
            flattened_list.append(item)
        else:
            flattened_list.extend(_flatten_lists(item))
    return flattened_list

    Given a list which may contain either an item or a further list of items, generate a list that only contains items
    by bringing all elements of nested lists into the top level list.
    :param nested_list: List containing items or lists of items
    :return: List containing only items (no nested lists)
    
Given a list which may contain either an item or a further list of items, generate a list that only contains items
by bringing all elements of nested lists into the top level list.
Given a list which may contain either an item or a further list of items generate a list that only contains items by bringing all elements of nested lists into the top level list .
def _flatten_lists(nested_list: List[List]) -> List:
    flattened_list = []
    for item in nested_list:
        if not isinstance(item, List):
            flattened_list.append(item)
        else:
            flattened_list.extend(_flatten_lists(item))
    return flattened_list
def _flatten_lists ( nested_list : List [ List ] ) -> List : flattened_list = [ ] for item in nested_list : if not isinstance ( item , List ) : flattened_list . append ( item ) else : flattened_list . extend ( _flatten_lists ( item ) ) return flattened_list
Given a list which may contain either an item or a further list of items, generate a list that only contains items
by bringing all elements of nested lists into the top level list.
Given a list which may contain either an item or a further list of items generate a list that only contains items by bringing all elements of nested lists into the top level list .
"""
    Given a list which may contain either an item or a further list of items, generate a list that only contains items
    by bringing all elements of nested lists into the top level list.
    :param nested_list: List containing items or lists of items
    :return: List containing only items (no nested lists)
    """
List containing only items (no nested lists)
List containing only items ( no nested lists )
nested_list
List[List]
List containing items or lists of items
List containing items or lists of items