Skip to content

Commit de9cf4d

Browse files
authored
Add suppress_warning parameter to the load function
1 parent 5d2a084 commit de9cf4d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lazy_loader/__init__.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def __getattr__(self, x):
118118
)
119119

120120

121-
def load(fullname, *, require=None, error_on_import=False):
121+
def load(fullname, *, require=None, error_on_import=False, suppress_warning=False):
122122
"""Return a lazily imported proxy for a module.
123123
124124
We often see the following pattern::
@@ -174,6 +174,10 @@ def myfunc():
174174
Whether to postpone raising import errors until the module is accessed.
175175
If set to `True`, import errors are raised as soon as `load` is called.
176176
177+
suppress_warning : bool
178+
Whether to prevent emitting a warning when loading subpackages.
179+
If set to `True`, no warning will occur.
180+
177181
Returns
178182
-------
179183
pm : importlib.util._LazyModule

0 commit comments

Comments
 (0)