]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Disallow duplicate statement tags in docs
authorPetr Špaček <pspacek@isc.org>
Fri, 23 Aug 2024 13:23:10 +0000 (15:23 +0200)
committerPetr Špaček <pspacek@isc.org>
Fri, 23 Aug 2024 13:34:54 +0000 (15:34 +0200)
I can't think of a use-case for them, so let's simplify code and treat
them as an invalid input.

doc/arm/_ext/iscconf.py

index 32bbec2bf22b99c55d126028232ef8a2e613fc90..1ecd37cb8b65cc3d37c2e95c922a12336e4d4990 100644 (file)
@@ -41,18 +41,14 @@ logger = logging.getLogger(__name__)
 
 def split_csv(argument, required):
     argument = argument or ""
-    values = list(filter(len, (s.strip() for s in argument.split(","))))
-    if required and not values:
+    outlist = list(filter(len, (s.strip() for s in argument.split(","))))
+    if required and not outlist:
         raise ValueError(
             "a non-empty list required; provide at least one value or remove"
             " this option"
         )
-    # Order-preserving de-duplication
-    outlist, seen = list(), set()  # pylint: disable=use-list-literal
-    for value in values:
-        if value not in seen:
-            seen.add(value)
-            outlist.append(value)
+    if not len(outlist) == len(set(outlist)):
+        raise ValueError("duplicate value detected")
     return outlist