Skip to content

Commit

Permalink
Fix log filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
grst committed Apr 12, 2021
1 parent 4e922df commit 8187b26
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions docs/tutorials/tutorial_io.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,11 @@ jupyter:
%load_ext autoreload
%autoreload 2
import anndata
import logging


class NoCategoricalWarningFilter(logging.Filter):
"""suppress "storing XXX as categorical" warnings."""

def filter(self, record):
m = record.getMessage()
return not m.startswith("storing") and m.endswith("as categorical.")


anndata.logging.anndata_logger.addFilter(NoCategoricalWarningFilter)
anndata.logging.anndata_logger.addFilter(
lambda r: not r.getMessage().startswith("storing")
and r.getMessage().endswith("as categorical.")
)
```

```python
Expand Down

0 comments on commit 8187b26

Please sign in to comment.