# Path: dataimporter/tools.py
# def icat(dct, cat=None, subcat=None, error_absent=False):
#     if cat is not None:
#         res = find_or_create_item(dct, cat, 'subcats', error_absent)
#     if subcat is not None:
#         res = find_or_create_item(
#             res['subcats'], subcat, 'items', error_absent
#         )
#     return res
# 
# def changelog(*args, **kwargs):
#     print(*args, **kwargs, file=sys.stderr)
# 
# Path: dataimporter/fixer.py
# class WowToolsFixer:
#     """Base class for Wowtools-based data fixers."""
#     load_files = False
# 
#     def __init__(self, *args, build=None):
#         self.build = build
#         self._store_init(*args)
#         if self.load_files:
#             self.wt_files = {
#                 int(e['ID']): e for e in self.wt_get_table('files')
#             }
# 
#     def _store_init(self, *args):
#         raise NotImplementedError
# 
#     def run(self):
#         raise NotImplementedError
# 
#     def wt_get_table(self, table_name):
#         return wowtools.get_table(table_name, self.build)
# 
#     def get_icon_name(self, icon_id: int):
#         assert self.load_files
#         icon_name = str(icon_id)
#         if icon_id in self.wt_files:
#             icon_path = self.wt_files[icon_id]['Path']
#             if 'encrypted' not in icon_path:
#                 icon_name = icon_path.split('/')[-1].rsplit('.', 1)[0].lower()
#                 icon_name = icon_name.replace(' ', '-')
# 
#         return icon_name


from .tools import icat, changelog
from .fixer import WowToolsFixer
        except KeyError:
            item_id = None

        return {
            'ID': int(mount_id),
            'name': name,
            'icon': icon_name,
            'spellid': int(spell_id),
            **({'itemId': item_id} if item_id else {})
        }

    def get_mount_source(self, mount_id: int):
        return MOUNT_SOURCE_ENUM.get(
            int(self.wt_mount[mount_id]['SourceTypeEnum']),
            'Unknown'
        )

    def fix_missing_mount(self, mount_id: int):
        if (
            # No summon spell ID
            not int(self.wt_mount[mount_id]['SourceSpellID'])
            # Flag 0x100 : Invalid mount
            or int(self.wt_mount[mount_id]['Flags']) & 0x100
        ):
            return

        mount = self.get_mount(mount_id)
        if mount is None:
            return


# Path: dataimporter/tools.py
# def icat(dct, cat=None, subcat=None, error_absent=False):
#     if cat is not None:
#         res = find_or_create_item(dct, cat, 'subcats', error_absent)
#     if subcat is not None:
#         res = find_or_create_item(
#             res['subcats'], subcat, 'items', error_absent
#         )
#     return res
# 
# def changelog(*args, **kwargs):
#     print(*args, **kwargs, file=sys.stderr)
# 
# Path: dataimporter/fixer.py
# class WowToolsFixer:
#     """Base class for Wowtools-based data fixers."""
#     load_files = False
# 
#     def __init__(self, *args, build=None):
#         self.build = build
#         self._store_init(*args)
#         if self.load_files:
#             self.wt_files = {
#                 int(e['ID']): e for e in self.wt_get_table('files')
#             }
# 
#     def _store_init(self, *args):
#         raise NotImplementedError
# 
#     def run(self):
#         raise NotImplementedError
# 
#     def wt_get_table(self, table_name):
#         return wowtools.get_table(table_name, self.build)
# 
#     def get_icon_name(self, icon_id: int):
#         assert self.load_files
#         icon_name = str(icon_id)
#         if icon_id in self.wt_files:
#             icon_path = self.wt_files[icon_id]['Path']
#             if 'encrypted' not in icon_path:
#                 icon_name = icon_path.split('/')[-1].rsplit('.', 1)[0].lower()
#                 icon_name = icon_name.replace(' ', '-')
# 
#         return icon_name


# Path: dataimporter/mounts.py
from .tools import icat, changelog
from .fixer import WowToolsFixer

        except KeyError:
            item_id = None

        return {
            'ID': int(mount_id),
            'name': name,
            'icon': icon_name,
            'spellid': int(spell_id),
            **({'itemId': item_id} if item_id else {})
        }

    def get_mount_source(self, mount_id: int):
        return MOUNT_SOURCE_ENUM.get(
            int(self.wt_mount[mount_id]['SourceTypeEnum']),
            'Unknown'
        )

    def fix_missing_mount(self, mount_id: int):
        if (
            # No summon spell ID
            not int(self.wt_mount[mount_id]['SourceSpellID'])
            # Flag 0x100 : Invalid mount
            or int(self.wt_mount[mount_id]['Flags']) & 0x100
        ):
            return

        mount = self.get_mount(mount_id)
        if mount is None:
            return


        changelog(