mylogging.my_warnings package

Module filter warnings from used libraries.

mylogging.my_warnings.filter_always(messages: None | list = None, messages_and_categories: None | list = None) Filter[source]

Also other libraries you use can raise warnings. This function can filter warnings from such a libraries.

Note

Default warnings function is overwritten, do not forget to reset original filters.

Parameters
  • messages (None | list, optional) – List of warnings (any part of inner string) that will be ignored even if debug is set. Example [“AR coefficients are not stationary.”, “Mean of empty slice”,]. Defaults to None.

  • messages_and_categories (None | list, optional) – List of tuples (string of module that raise it and warning type) that will be ignored even if debug is set. Example [(‘statsmodels.tsa.arima_model’, FutureWarning)]. Defaults to None.

Returns

Object containing reset function.

Return type

Filter

mylogging.my_warnings.filter_once(level: typing_extensions.Literal[DEBUG, INFO, WARNING, ERROR, CRITICAL] = 'WARNING')[source]

If filter (once) in warnings from 3rd party libraries don’t work, this implements own filter.

Note

Default warnings function is overwritten, do not forget to reset original filters.

Parameters

level (Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"], optional) – Used level in filter. Defaults to “WARNING”.

Returns

Object containing reset function.

Return type

FilterOnce

mylogging.my_warnings.reset_filter_always() None[source]

Reset custom warnings filter.

mylogging.my_warnings.reset_filter_once() None[source]

Reset custom warnings filter.

Submodules