# Path: dataimporter/tools.py
# def find_or_create_item(L, name, subitems_name=None, error_absent=False):
#     try:
#         return list_find(L, lambda x: x['name'] == name)
#     except StopIteration:
#         if not error_absent:
#             d = {'id': genid(), 'name': name}
#             if subitems_name:
#                 d[subitems_name] = []
#             L.append(d)
#             return d
#         else:
#             raise
# 
# 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 find_or_create_item, changelog
from .fixer import WowToolsFixer
#!/usr/bin/env python3



IGNORE_FACTION_ID = [
    949,   # Test Faction 1

    # Never implemented
    1888,  # Jandvik Vryul
    2111,  # Zandalari Dinosaurs
    1351,  # The Brewmasters
    1416,  # Akama's Trust
    1440,  # Darkspear Rebellion

    # TODO: we probably should integrate those at some point, as they are all
    # real reputations that do display correctly in the reputation panel.

    # Brawlpub
    1691,  # Bizmo's Brawlpub (Season 2)

# Path: dataimporter/tools.py
# def find_or_create_item(L, name, subitems_name=None, error_absent=False):
#     try:
#         return list_find(L, lambda x: x['name'] == name)
#     except StopIteration:
#         if not error_absent:
#             d = {'id': genid(), 'name': name}
#             if subitems_name:
#                 d[subitems_name] = []
#             L.append(d)
#             return d
#         else:
#             raise
# 
# 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/factions.py
from .tools import find_or_create_item, changelog
from .fixer import WowToolsFixer

#!/usr/bin/env python3



IGNORE_FACTION_ID = [
    949,   # Test Faction 1

    # Never implemented
    1888,  # Jandvik Vryul
    2111,  # Zandalari Dinosaurs
    1351,  # The Brewmasters
    1416,  # Akama's Trust
    1440,  # Darkspear Rebellion

    # TODO: we probably should integrate those at some point, as they are all
    # real reputations that do display correctly in the reputation panel.

    # Brawlpub
    1691,  # Bizmo's Brawlpub (Season 2)

    2011,  # Bizmo's Brawlpub (Season 3)