From f9bb7b41f48663d4c38a613f3f0b21e59f26d8b1 Mon Sep 17 00:00:00 2001 From: Jirka Borovec Date: Thu, 8 Apr 2021 18:24:41 +0200 Subject: [PATCH] suppres warnings --- pl_bolts/utils/warnings.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pl_bolts/utils/warnings.py b/pl_bolts/utils/warnings.py index c81c58a440..60d3a82771 100644 --- a/pl_bolts/utils/warnings.py +++ b/pl_bolts/utils/warnings.py @@ -4,6 +4,8 @@ MISSING_PACKAGE_WARNINGS: Dict[str, int] = {} +WARN_MISSING_PACKAGE = int(os.environ.get('WARN_MISSING_PACKAGE', False)) + def warn_missing_pkg( pkg_name: str, @@ -23,6 +25,9 @@ def warn_missing_pkg( Returns: Number of warning calls """ + if not WARN_MISSING_PACKAGE: + return -1 + if pkg_name not in MISSING_PACKAGE_WARNINGS: extra_text = os.linesep + extra_text if extra_text else '' if not pypi_name: