From 0868c9e9afae842b8d300ef5cfa1effe1ed8916b Mon Sep 17 00:00:00 2001 From: Johannes Buchner Date: Tue, 8 Oct 2024 23:42:17 +0200 Subject: [PATCH] handle python -OO (#2393) * handle python -OO * apply black --- arviz/plots/backends/__init__.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/arviz/plots/backends/__init__.py b/arviz/plots/backends/__init__.py index 76970226e1..bd08073377 100644 --- a/arviz/plots/backends/__init__.py +++ b/arviz/plots/backends/__init__.py @@ -213,10 +213,11 @@ def _copy_docstring(lib, function): # TODO: try copying substitutions too, or autoreplace them ourselves -output_notebook.__doc__ += "\n\n" + _copy_docstring("bokeh.plotting", "output_notebook").replace( - "|save|", "save" -).replace("|show|", "show") -output_file.__doc__ += "\n\n" + _copy_docstring("bokeh.plotting", "output_file").replace( - "|save|", "save" -).replace("|show|", "show") -ColumnDataSource.__doc__ += "\n\n" + _copy_docstring("bokeh.models", "ColumnDataSource") +if output_notebook.__doc__ is not None: # if run with python -OO, __doc__ is stripped + output_notebook.__doc__ += "\n\n" + _copy_docstring( + "bokeh.plotting", "output_notebook" + ).replace("|save|", "save").replace("|show|", "show") + output_file.__doc__ += "\n\n" + _copy_docstring("bokeh.plotting", "output_file").replace( + "|save|", "save" + ).replace("|show|", "show") + ColumnDataSource.__doc__ += "\n\n" + _copy_docstring("bokeh.models", "ColumnDataSource")