lazy_load_template.py 385 B

123456789101112131415161718
  1. # encoding: utf-8
  2. # flake8: noqa
  3. from __future__ import unicode_literals
  4. import re
  5. class LazyLoadExtractor(object):
  6. _module = None
  7. @classmethod
  8. def ie_key(cls):
  9. return cls.__name__[:-2]
  10. def __new__(cls):
  11. mod = __import__(cls._module, fromlist=(cls.__name__,))
  12. real_cls = getattr(mod, cls.__name__)
  13. return real_cls.__new__(real_cls)