From 55ca609eba6eefd689ac6905f3c3de5eeb0888c6 Mon Sep 17 00:00:00 2001 From: JSCU-CNI <121175071+JSCU-CNI@users.noreply.github.com> Date: Thu, 13 Feb 2025 15:40:09 +0100 Subject: [PATCH 1/3] fix sphinx warnings --- flow/record/adapter/text.py | 2 ++ tests/docs/Makefile | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/flow/record/adapter/text.py b/flow/record/adapter/text.py index 7df23792..ea829c81 100644 --- a/flow/record/adapter/text.py +++ b/flow/record/adapter/text.py @@ -26,6 +26,8 @@ class DefaultMissing(dict): + """DefaultMissing""" + 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 From 14cbe1d02db3e8f75dfb77619bb716fa5336b803 Mon Sep 17 00:00:00 2001 From: Computer Network Investigation <121175071+JSCU-CNI@users.noreply.github.com> Date: Mon, 17 Feb 2025 11:05:17 +0100 Subject: [PATCH 2/3] Update flow/record/adapter/text.py Co-authored-by: Yun Zheng Hu --- flow/record/adapter/text.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/flow/record/adapter/text.py b/flow/record/adapter/text.py index ea829c81..91512a95 100644 --- a/flow/record/adapter/text.py +++ b/flow/record/adapter/text.py @@ -26,7 +26,15 @@ class DefaultMissing(dict): - """DefaultMissing""" + """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("{}") From ec84acd6127cf37541af0f814f808deb1b97a1f0 Mon Sep 17 00:00:00 2001 From: JSCU-CNI <121175071+JSCU-CNI@users.noreply.github.com> Date: Mon, 17 Feb 2025 11:07:11 +0100 Subject: [PATCH 3/3] ignore import resolution warnings --- tests/docs/conf.py | 5 +++++ 1 file changed, 5 insertions(+) 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", +]