mercurial/demandload.py
changeset 2310 d01eac5968c6
parent 1826 f3abe0bdccdd
child 2821 a8a7ce1a01a5
equal deleted inserted replaced
2309:b2f37c7026ca 2310:d01eac5968c6
    79         importer = object.__getattribute__(self, 'importer')
    79         importer = object.__getattribute__(self, 'importer')
    80         target = object.__getattribute__(self, 'target')
    80         target = object.__getattribute__(self, 'target')
    81 
    81 
    82         return getattr(importer.module(), target)
    82         return getattr(importer.module(), target)
    83 
    83 
       
    84     def __call__(self, *args, **kwargs):
       
    85         target = object.__getattribute__(self, 'module')()
       
    86         return target(*args, **kwargs)
       
    87 
    84 def demandload(scope, modules):
    88 def demandload(scope, modules):
    85     '''import modules into scope when each is first used.
    89     '''import modules into scope when each is first used.
    86 
    90 
    87     scope should be the value of globals() in the module calling this
    91     scope should be the value of globals() in the module calling this
    88     function, or locals() in the calling function.
    92     function, or locals() in the calling function.