def safe_init(self) -> Callable:
    """Return a modified __init__ function that checks type expectations."""

    def _safe_init(*args, **kwargs):
      """Wrapper around pd.concat

      Args:
        args: non-keyword arguments to pass through to merge.
        kwargs: keyword arguments to pass through to merge.
      """
      df = args[0]
      assert isinstance(df, pd.DataFrame), f"unexpected type: {type(df)}"
      retVal = self._origInit(*args, **kwargs)
      assert retVal is None
      lines = self._validate_dataframe(df)
      self._log_errors("INIT", self._get_callsite(), lines)
      return retVal

    return _safe_init
Return a modified __init__ function that checks type expectations.
sourcecode/scoring/pandas_utils.py