chore(prophet): ignore logged warning for missing plotly package (#11334)

* chore(prophet): ignore logged warning for missing plotly package

* reset log level after import
This commit is contained in:
Ville Brofeldt 2020-10-22 07:27:02 +03:00 committed by GitHub
parent a2a614d760
commit dcf12762b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -14,6 +14,7 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
import logging
from functools import partial from functools import partial
from typing import Any, Callable, cast, Dict, List, Optional, Tuple, Union from typing import Any, Callable, cast, Dict, List, Optional, Tuple, Union
@ -590,7 +591,12 @@ def _prophet_fit_and_predict( # pylint: disable=too-many-arguments
Fit a prophet model and return a DataFrame with predicted results. Fit a prophet model and return a DataFrame with predicted results.
""" """
try: try:
prophet_logger = logging.getLogger("fbprophet.plot")
prophet_logger.setLevel(logging.CRITICAL)
from fbprophet import Prophet # pylint: disable=import-error from fbprophet import Prophet # pylint: disable=import-error
prophet_logger.setLevel(logging.NOTSET)
except ModuleNotFoundError: except ModuleNotFoundError:
raise QueryObjectValidationError(_("`fbprophet` package not installed")) raise QueryObjectValidationError(_("`fbprophet` package not installed"))
model = Prophet( model = Prophet(