]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
manager/utils/modelling: multiline strings in docstring for attributes description...
authorAleš <ales.mrazek@nic.cz>
Mon, 7 Feb 2022 15:52:42 +0000 (16:52 +0100)
committerAleš Mrázek <ales.mrazek@nic.cz>
Fri, 8 Apr 2022 14:17:54 +0000 (16:17 +0200)
manager/knot_resolver_manager/utils/modelling.py

index 3299e52822f5664471b991049982c326feff82c0..81acd37ef55148c49e6e53698f3fda4a927b2d12 100644 (file)
@@ -80,10 +80,10 @@ def _split_docstring(docstring: str) -> Tuple[str, Optional[str]]:
     if "---" not in docstring:
         return (docstring, None)
 
-    first, last = docstring.split("---", maxsplit=1)
+    doc, attrs_doc = docstring.split("---", maxsplit=1)
     return (
-        "\n".join([s.strip() for s in first.splitlines()]).strip(),
-        "\n".join([s.strip() for s in last.splitlines()]).strip(),
+        "\n".join([s.strip() for s in doc.splitlines()]).strip(),
+        attrs_doc,
     )
 
 
@@ -104,7 +104,7 @@ def _parse_attrs_docstrings(docstring: str) -> Optional[Dict[str, str]]:
 
 def _get_properties_schema(typ: Type[Any]) -> Dict[Any, Any]:
     schema: Dict[Any, Any] = {}
-    annot = typ.__dict__.get("__annotations__", {})
+    annot: Dict[str, Any] = typ.__dict__.get("__annotations__", {})
     docstring: str = typ.__dict__.get("__doc__", "") or ""
     attribute_documentation = _parse_attrs_docstrings(docstring)
     for field_name, python_type in annot.items():