yt.exthook module


Redirect imports for extensions. This module basically makes it possible for us to transition from to yt_foo without having to force all extensions to upgrade at the same time.

When a user does from import bar it will attempt to import from yt_foo import bar first and when that fails it will try to import from import bar.

We’re switching from namespace packages because it was just too painful for everybody involved.

This is used by yt.extensions.

  1. 2015 by Armin Ronacher.


BSD, see LICENSE for more details.

class yt.exthook.ExtensionImporter(module_choices, wrapper_module)[source]

Bases: object

This importer redirects imports from this submodule to other locations. This makes it possible to transition from the old to the newer flask_name without people having a hard time.

find_module(fullname, path=None)[source]
is_important_frame(important_module, tb)[source]

Checks a single frame if it’s important.

is_important_traceback(important_module, tb)[source]

Walks a traceback’s frames and checks if any of the frames originated in the given important module. If that is the case then we were able to import the module itself but apparently something went wrong when the module was imported. (Eg: import of an import failed).