# Path: wordinserter/operations.py
# class BaseList(Operation):
#     allowed_children = {"ListElement", "BulletList", "NumberedList"}
#     requires_children = True
# 
#     @property
#     def depth(self):
#         return sum(1 for p in self.ancestors if isinstance(p, BaseList))
# 
#     @property
#     def sub_lists(self):
#         return sum(1 for p in self.children if isinstance(p, BaseList))
# 
# class ListElement(Operation):
#     requires_children = True
#     pass


from wordinserter.operations import BaseList, ListElement


def normalize_list_elements(tokens):
    for token in tokens:
        if isinstance(token, BaseList):
            normalize_list(token)
        else:
            normalize_list_elements(token.children)


def normalize_list(op: BaseList):
    # If there are > 1 lists to move out then we need to insert it after previously moved ones,
    # instead of before. `moved` tracks this.
    children = list(op)

    for child in children:

# Path: wordinserter/operations.py
# class BaseList(Operation):
#     allowed_children = {"ListElement", "BulletList", "NumberedList"}
#     requires_children = True
# 
#     @property
#     def depth(self):
#         return sum(1 for p in self.ancestors if isinstance(p, BaseList))
# 
#     @property
#     def sub_lists(self):
#         return sum(1 for p in self.children if isinstance(p, BaseList))
# 
# class ListElement(Operation):
#     requires_children = True
#     pass


# Path: wordinserter/parsers/fixes/list_elements.py
from wordinserter.operations import BaseList, ListElement



def normalize_list_elements(tokens):
    for token in tokens:
        if isinstance(token, BaseList):
            normalize_list(token)
        else:
            normalize_list_elements(token.children)


def normalize_list(op: BaseList):
    # If there are > 1 lists to move out then we need to insert it after previously moved ones,
    # instead of before. `moved` tracks this.
    children = list(op)

    for child in children:

        if isinstance(child, ListElement):