catch_warnings_of

Full name: ase2sprkkr.common.warnings.catch_warnings_of

ase2sprkkr.common.warnings.catch_warnings_of(category)[source]

Record warnings of category without swallowing other warnings.

The standard warnings.catch_warnings() records every warning which passes the active filters; its category argument only installs another filter. This wrapper separates the requested category and re-emits all other recorded warnings after restoring the surrounding warning context.

The yielded list is populated when the context is left.

Parameters:

category (Type[Warning]) – Warning base class to collect; warnings outside this class are re-emitted.

Return type:

Generator[List[Warning], None, None]