diff --git a/flow/record/adapter/text.py b/flow/record/adapter/text.py index 7df23792..91512a95 100644 --- a/flow/record/adapter/text.py +++ b/flow/record/adapter/text.py @@ -26,6 +26,16 @@ class DefaultMissing(dict): + """A dictionary subclass that returns a formatted string for missing keys. + + Example: + >>> d = DefaultMissing({"foo": "bar"}) + >>> d['foo'] + 'bar' + >>> d['missing_key'] + '{missing_key}' + """ + def __missing__(self, key: str) -> str: return key.join("{}") diff --git a/tests/docs/Makefile b/tests/docs/Makefile index 69e00981..e693b42d 100644 --- a/tests/docs/Makefile +++ b/tests/docs/Makefile @@ -3,7 +3,7 @@ # You can set these variables from the command line, and also # from the environment for the first two. -SPHINXOPTS ?= -jauto +SPHINXOPTS ?= -jauto -w $(BUILDDIR)/warnings.log --fail-on-warning SPHINXBUILD ?= sphinx-build SOURCEDIR = . BUILDDIR = build diff --git a/tests/docs/conf.py b/tests/docs/conf.py index 021c44e5..7a368176 100644 --- a/tests/docs/conf.py +++ b/tests/docs/conf.py @@ -32,3 +32,8 @@ autodoc_member_order = "groupwise" autosectionlabel_prefix_document = True + +suppress_warnings = [ + # https://github.com/readthedocs/sphinx-autoapi/issues/285 + "autoapi.python_import_resolution", +]