yt.exthook module

yt.exthook

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

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

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

This is used by yt.extensions.

copyright:
  1. 2015 by Armin Ronacher.
license:

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 flaskext.name to the newer flask_name without people having a hard time.

find_module(fullname, path=None)[source]
install()[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).

load_module(fullname)[source]