def _warn(self, msg, category: Type[Warning]=RuntimeWarning): if self._show_warnings: warnings.warn(msg, category)