Skip to content

Commit

Permalink
DOC: Suppress duplicate obj description warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mferrera committed Jun 27, 2024
1 parent 63b6b3e commit fede792
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions docs/src/conf.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#!/usr/bin/env python3

# flake8: noqa
# pylint: skip-file
import logging
import os
import sys
from pathlib import Path

from datetime import date

import fmu.dataio
Expand All @@ -15,6 +12,19 @@
sys.path.insert(1, os.path.abspath("../ext"))


class PydanticAutodocFilter(logging.Filter):
"""A logging filter to suppress warnings about duplicate object descriptions when
generating Pydantic model documentation. These warnings are a result of generating a
new nested model document wherever one occurs, even if this Pydantic model is used
in multiple places."""

def filter(self, record: logging.LogRecord) -> bool:
return "duplicate object description" not in record.getMessage()


logging.getLogger("sphinx").addFilter(PydanticAutodocFilter())


# -- General configuration ---------------------------------------------

# The full version, including alpha/beta/rc tags.
Expand Down

0 comments on commit fede792

Please sign in to comment.