diff configmix/config.py @ 333:5ec0ae3bb8db

Docs: quoting
author Franz Glasner <fzglas.hg@dom66.de>
date Fri, 07 May 2021 09:31:22 +0200
parents d81d2cdf4925
children a04cd5dbcd2c
line wrap: on
line diff
--- a/configmix/config.py	Fri May 07 09:30:46 2021 +0200
+++ b/configmix/config.py	Fri May 07 09:31:22 2021 +0200
@@ -79,6 +79,8 @@
 
         No variable interpolation is done and no filters are applied.
 
+        Quoting of `names` and `namespace` is *not* needed and wrong.
+
         """
         default = kwds.pop("default", _MARKER)
         namespace = kwds.pop("namespace", None)
@@ -105,6 +107,11 @@
 
         No variable interpolation is done and no filters are applied.
 
+        Special characters (e.g. ``:`` and ``.``) must be quoted when using
+        the default namespace.
+
+        See also :meth:`~.quote`.
+
         """
         varns, varname = self._split_ns(varname)
         if not varns:
@@ -375,8 +382,14 @@
 
     @classmethod
     def quote(klass, s):
-        """Quote a key to protect all dangerous chars: ``%``, ``.``, ``:``,
-        ``#`` and ``|``
+        """Replace important special characters in string `s` by replacing
+        them with ``%xNN`` where `NN` are the two hexadecimal digits of the
+        characters unicode codepoint value.
+
+        Handled are the important special chars: ``%``, ``.``, ``:``,
+        ``#``; ``'``, ``"`` and ``|``.
+
+        See also the :ref:`quoting` section.
 
         """
         qc = klass._QUOTE
@@ -390,8 +403,10 @@
 
     @classmethod
     def unquote(klass, s):
-        """Unquote the content of `s`: handle all patterns ``%xXX``,
-        ``%uXXXX`` or `%UXXXXXXXX``
+        """Unquote the content of `s`: handle all patterns ``%xNN``,
+        ``%uNNNN`` or ``%UNNNNNNNN``.
+
+        This is the inverse of :meth:`~.quote`.
 
         """
         if klass._QUOTE not in s: