From 7a3203391ad5e067ae85531bdad6f0356a9d50e3 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Wed, 20 May 2020 20:46:18 +0200 Subject: [modutils/doc] add docstring to LazyObject --- logilab/common/modutils.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/logilab/common/modutils.py b/logilab/common/modutils.py index 34419bd..868dfa0 100644 --- a/logilab/common/modutils.py +++ b/logilab/common/modutils.py @@ -79,6 +79,17 @@ class NoSourceFile(Exception): """ class LazyObject(object): + """ + This class allows to lazyly declare a object (most likely only a callable + according to the code) from a module without importing it. + + The import will be triggered when the user tries to access attributes of + the object/callable or call it. + + Trying to set or delete attributes of the wrapped object/callable will not + works as expected. + """ + def __init__(self, module, obj): self.module = module self.obj = obj -- cgit v1.2.1