lazy_load_template.py 456 B

1234567891011121314151617181920
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. class LazyLoadExtractor(object):
  5. _module = None
  6. @classmethod
  7. def ie_key(cls):
  8. return cls.__name__[:-2]
  9. def __new__(cls, *args, **kwargs):
  10. mod = __import__(cls._module, fromlist=(cls.__name__,))
  11. real_cls = getattr(mod, cls.__name__)
  12. instance = real_cls.__new__(real_cls)
  13. instance.__init__(*args, **kwargs)
  14. return instance