def autoload():
    """Find assets by looking for an ``assets`` module within each
    installed application, similar to how, e.g., the admin autodiscover
    process works. This is were this code has been adapted from, too.

    Only runs once.
    """
    global _ASSETS_LOADED
    if _ASSETS_LOADED:
        return False

    # Import this locally, so that we don't have a global Django
    # dependency.
    from django.conf import settings

    for app in apps.get_app_configs():
        # For each app, we need to look for an assets.py inside that
        # app's package. We can't use os.path here -- recall that
        # modules may be imported different ways (think zip files) --
        # so we need to get the app's __path__ and look for
        # admin.py on that path.

        # Step 1: find out the app's __path__ Import errors here will
        # (and should) bubble up, but a missing __path__ (which is
        # legal, but weird) fails silently -- apps that do weird things
        # with __path__ might need to roll their own registration.
        try:
            app_path = app.path
        except AttributeError:
            continue

        # Step 2: use imp.find_module to find the app's assets.py.
        # For some reason imp.find_module raises ImportError if the
        # app can't be found but doesn't actually try to import the
        # module. So skip this app if its assets.py doesn't exist
        try:
            imp.find_module('assets', [app_path])
        except ImportError:
            continue

        # Step 3: import the app's assets file. If this has errors we
        # want them to bubble up.
        #app_name = deduce_app_name(app)
        import_module("{}.assets".format(app.name))

    # Load additional modules.
    for module in getattr(settings, 'ASSETS_MODULES', []):
        import_module(module % "%s")

    _ASSETS_LOADED = True
dataset/ETHPy150Open miracle2k/django-assets/django_assets/env.py/autoload/swapped operands of `%`