<commit_before>import os
import csv
import warnings

import numpy as np
import pandas as pd
from bokeh.io import export_png, output_notebook

from ConfigSpace.util import deactivate_inactive_hyperparameters, fix_types

from cave.utils.timing import timing


@timing
def export_bokeh(plot, path, logger):
    """Export bokeh-plot to png-file. Create directory if necessary

    Parameters
    ----------
    plot: bokeh.plotting.figure
        bokeh plot to export
    path: str
        path to save plot to
    logger: Logger
        logger for debugging
    """
    base = os.path.split(path)[0]
    logger.debug("Exporting to %s (base: %s)", path, base)
    plot.background_fill_color, plot.border_fill_color = None, None
    if base and not os.path.exists(base):
        logger.debug("%s does not exist. Creating...", base)
        os.makedirs(base)
    try:
        with warnings.catch_warnings(record=True) as list_of_warnings:
            warnings.simplefilter('always')
            export_png(plot, filename=path)
            for w in list_of_warnings:
                logger.debug("During export a %s was raised: %s", str(w.category), w.message)
    except (RuntimeError, TypeError) as err:
        logger.exception("Exporting failed with message \"%s\"", err)
        logger.warning("To activate automatic png-export, please follow instructions on CAVE's GitHub (install selenium and phantomjs-prebuilt).")
    except (SystemError) as err:
        logger.exception("Exporting failed with message \"%s\"", err)
        logger.warning("This issue is known, but not yet solved. However it seems to appear with too few data-points. "
                       "Feel free to report your example on https://github.com/automl/CAVE/issues.")
    except Exception as err:
        logger.exception("Exporting failed with message \"%s\"", err)
<commit_msg>MAINT log exception in failed bokeh-export as debug, increase verbosity of parallel warning<commit_after>import os
import csv
import warnings

import numpy as np
import pandas as pd
from bokeh.io import export_png, output_notebook

from ConfigSpace.util import deactivate_inactive_hyperparameters, fix_types

from cave.utils.timing import timing


@timing
def export_bokeh(plot, path, logger):
    """Export bokeh-plot to png-file. Create directory if necessary

    Parameters
    ----------
    plot: bokeh.plotting.figure
        bokeh plot to export
    path: str
        path to save plot to
    logger: Logger
        logger for debugging
    """
    base = os.path.split(path)[0]
    logger.debug("Exporting to %s (base: %s)", path, base)
    plot.background_fill_color, plot.border_fill_color = None, None
    if base and not os.path.exists(base):
        logger.debug("%s does not exist. Creating...", base)
        os.makedirs(base)
    try:
        with warnings.catch_warnings(record=True) as list_of_warnings:
            warnings.simplefilter('always')
            export_png(plot, filename=path)
            for w in list_of_warnings:
                logger.debug("During export a %s was raised: %s", str(w.category), w.message)
    except (RuntimeError, TypeError) as err:
        logger.debug("Exporting failed", exc_info=1)
        logger.warning("Exporting bokeh-plot to \"%s\" failed. "
                       "To activate automatic png-export, please follow instructions on CAVE's GitHub "
                       "(install selenium and phantomjs-prebuilt).", path)
    except (SystemError) as err:
        logger.debug("Exporting failed", exc_info=1)
        logger.warning("Exporting bokeh-plot to \"%s\" failed. "
                       "This issue is known, but not yet solved. However it seems to appear with too few data-points. "
                       "Feel free to report your example on https://github.com/automl/CAVE/issues.", path)
    except Exception as err:
        logger.debug("Exporting failed", exc_info=1)
        logger.warning("Exporting bokeh-plot to \"%s\" failed. (run --verbose DEBUG for more info)", path)

{'fraction_non_alphanumeric': 0.09915084915084915, 'fraction_numerical': 0.0012487512487512488, 'mean_word_length': 2.7783018867924527, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1150983', 'n_tokens_mistral': 1155, 'n_tokens_neox': 1119, 'n_words': 379}