# Path: src/core.py
# def packages_with_overrides(pkg_list, name_list=None):
#     """
#     Collect a list of package names from the given package list for which there
#     is at least a single (simple) override file and which is not in the list of
#     packages to ignore overrides in.
# 
#     Optionally, if name_list is provided, the list of package names will be
#     filtered to only include packages whose name also exists in the name list.
#     """
#     ignored = oa_setting("ignore_overrides_in")
#     items = [name for name, pkg in pkg_list if len(pkg.override_files()) > 0
#                                                and name not in ignored]
# 
#     if name_list is not None:
#         items = list(filter(lambda name: name in name_list, items))
# 
#     return items
# 
# def log(message, *args, status=False, dialog=False):
#     """
#     Simple logging method; writes to the console and optionally also the status
#     message as well.
#     """
#     message = message % args
#     print("OverrideAudit:", message)
#     if status:
#         sublime.status_message(message)
#     if dialog:
#         sublime.message_dialog(message)
# 
# Path: src/core.py
# class PackageListCollectionThread(BackgroundWorkerThread):
#     """
#     Collect the list of packages in a background thread. The collection can
#     optionally filter the list returned to only a set of names given and can
#     also optionally pre-fetch the list of overrides in found packages.
#     """
#     def _process(self):
#         self.pkg_list = PackageList(self.args.get("name_list", None))
#         if self.args.get("get_overrides", False) is True:
#             packages_with_overrides(self.pkg_list)


import sublime
from os.path import dirname, basename
from .core import packages_with_overrides, log
from .core import PackageListCollectionThread
            sublime.set_timeout(lambda: self.on_done(pkg_info, resource_name))

    def _res_select(self, pkg_info, file):
        if file == "..":
            return self._start_browse(thread=None)

        pkg_info = pkg_info if file is not None else None
        self._on_done(pkg_info, file)

    def _pkg_select(self, pkg_info, return_to_pkg):
        if pkg_info is not None:
            if self.resource is not None:
                return self._on_done(pkg_info, self.resource)

            self.res_browser.browse(pkg_info,
                return_to_pkg,
                lambda name: self._res_select(pkg_info, name))
        else:
            self._on_done(None, None)

    def _start_browse(self, thread):
        if thread is not None:
            self.pkg_list = thread.pkg_list

        if self.pkg_name is None:
            return self.pkg_browser.browse(self.pkg_list, lambda pkg_info: self._pkg_select(pkg_info, True))

        if self.pkg_name in self.pkg_list:
            return self._pkg_select(self.pkg_list[self.pkg_name], False)


# Path: src/core.py
# def packages_with_overrides(pkg_list, name_list=None):
#     """
#     Collect a list of package names from the given package list for which there
#     is at least a single (simple) override file and which is not in the list of
#     packages to ignore overrides in.
# 
#     Optionally, if name_list is provided, the list of package names will be
#     filtered to only include packages whose name also exists in the name list.
#     """
#     ignored = oa_setting("ignore_overrides_in")
#     items = [name for name, pkg in pkg_list if len(pkg.override_files()) > 0
#                                                and name not in ignored]
# 
#     if name_list is not None:
#         items = list(filter(lambda name: name in name_list, items))
# 
#     return items
# 
# def log(message, *args, status=False, dialog=False):
#     """
#     Simple logging method; writes to the console and optionally also the status
#     message as well.
#     """
#     message = message % args
#     print("OverrideAudit:", message)
#     if status:
#         sublime.status_message(message)
#     if dialog:
#         sublime.message_dialog(message)
# 
# Path: src/core.py
# class PackageListCollectionThread(BackgroundWorkerThread):
#     """
#     Collect the list of packages in a background thread. The collection can
#     optionally filter the list returned to only a set of names given and can
#     also optionally pre-fetch the list of overrides in found packages.
#     """
#     def _process(self):
#         self.pkg_list = PackageList(self.args.get("name_list", None))
#         if self.args.get("get_overrides", False) is True:
#             packages_with_overrides(self.pkg_list)


# Path: src/browse.py
import sublime
from os.path import dirname, basename
from .core import packages_with_overrides, log
from .core import PackageListCollectionThread

            sublime.set_timeout(lambda: self.on_done(pkg_info, resource_name))

    def _res_select(self, pkg_info, file):
        if file == "..":
            return self._start_browse(thread=None)

        pkg_info = pkg_info if file is not None else None
        self._on_done(pkg_info, file)

    def _pkg_select(self, pkg_info, return_to_pkg):
        if pkg_info is not None:
            if self.resource is not None:
                return self._on_done(pkg_info, self.resource)

            self.res_browser.browse(pkg_info,
                return_to_pkg,
                lambda name: self._res_select(pkg_info, name))
        else:
            self._on_done(None, None)

    def _start_browse(self, thread):
        if thread is not None:
            self.pkg_list = thread.pkg_list

        if self.pkg_name is None:
            return self.pkg_browser.browse(self.pkg_list, lambda pkg_info: self._pkg_select(pkg_info, True))

        if self.pkg_name in self.pkg_list:
            return self._pkg_select(self.pkg_list[self.pkg_name], False)


        log("Package '%s' does not exist" % self.pkg_name,