# -*- coding: utf-8 -*-
# UNCOMMENTING WHAT I THOUGHT SHOULD BE FINE IN AN INIT MODULE SEEMS TO
# BREAK THE IMPORT STRUCTURE. WERID

# ### __init__.py ###
# # flake8: noqa
# from wbia.init import main_commands
# from wbia.init import main_helpers
# from wbia.init import sysres
# import utool


# def reassign_submodule_attributes(verbose=True):
#    """
#    why reloading all the modules doesnt do this I don't know
#    """
#    import sys
#    if verbose and '--quiet' not in sys.argv:
#        print('dev reimport')
#    # Self import
#    import wbia.init
#    # Implicit reassignment.
#    seen_ = set([])
#    for tup in IMPORT_TUPLES:
#        if len(tup) > 2 and tup[2]:
#            continue  # dont import package names
#        submodname, fromimports = tup[0:2]
#        submod = getattr(wbia.init, submodname)
#        for attr in dir(submod):
#            if attr.startswith('_'):
#                continue
#            if attr in seen_:
#                # This just holds off bad behavior
#                # but it does mimic normal util_import behavior
#                # which is good
#                continue
#            seen_.add(attr)
#            setattr(wbia.init, attr, getattr(submod, attr))


# def reload_subs(verbose=True):
#    """ Reloads wbia.init and submodules """
#    rrr(verbose=verbose)
#    def fbrrr(*args, **kwargs):
#        """ fallback reload """
#        pass
#    getattr(main_commands, 'rrr', fbrrr)(verbose=verbose)
#    getattr(main_helpers, 'rrr', fbrrr)(verbose=verbose)
#    getattr(sysres, 'rrr', fbrrr)(verbose=verbose)
#    rrr(verbose=verbose)
#    try:
#        # hackish way of propogating up the new reloaded submodule attributes
#        reassign_submodule_attributes(verbose=verbose)
#    except Exception as ex:
#        print(ex)
# rrrr = reload_subs

# IMPORT_TUPLES = [
#    ('main_commands', None),
#    ('main_helpers', None),
#    ('sysres', None),
# ]
# """
# Regen Command:
#    cd /home/joncrall/code/wbia/wbia/init
#    makeinit.py
# """
# # autogenerated __init__.py for: '/home/joncrall/code/wbia/wbia/init'
