changeset 541:25b61f0a1958

Docs for _split_ns() and _split_filters()
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 29 Dec 2021 13:33:11 +0100
parents 33856ae1cc0b
children f71d34dda19f
files configmix/config.py
diffstat 1 files changed, 22 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/configmix/config.py	Tue Dec 28 19:22:28 2021 +0100
+++ b/configmix/config.py	Wed Dec 29 13:33:11 2021 +0100
@@ -345,16 +345,34 @@
         return tuple()
 
 
-def _split_ns(s):
-    ns, sep, rest = s.partition(_NS_SEPARATOR)
+def _split_ns(varname):
+    """Split the variable name string `varname` into the namespace and
+    the namespace-specific name
+
+    :type varname: str
+    :return: A tuple containing the namespace (or `None`) and the
+             namespace-specific (variable-)name
+    :rtype: tuple(str or None, str)
+
+    """
+    
+    ns, sep, rest = varname.partition(_NS_SEPARATOR)
     if sep:
         return (unquote(ns), rest)
     else:
         return (None, ns)
 
 
-def _split_filters(s):
-    name, sep, filters = s.partition(_FILTER_SEPARATOR)
+def _split_filters(varname):
+    """Split off the filter part from the `varname` string
+
+    :type varname: str    
+    :return: The tuple of the variable name without the filters and a list
+             of filters
+    :rtype: tuple(str, list)
+
+    """
+    name, sep, filters = varname.partition(_FILTER_SEPARATOR)
     if sep:
         filters = filters.strip()
         if filters: