diff cutils/util/fnmatch.py @ 376:54a6d4534ef4

Convert some further value checks from plain Python assertions into real checks
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 05 May 2025 13:04:49 +0200
parents 48430941c18c
children
line wrap: on
line diff
--- a/cutils/util/fnmatch.py	Mon May 05 09:21:55 2025 +0200
+++ b/cutils/util/fnmatch.py	Mon May 05 13:04:49 2025 +0200
@@ -213,7 +213,10 @@
         matchers = []
         if filter_definitions:
             for action, kpattern in filter_definitions:
-                assert action in ("include", "exclude", "accept-treesum")
+                if action not in ("include", "exclude", "accept-treesum"):
+                    raise ValueError(
+                        "unknown action in filter definitions: {}"
+                        .format(action))
                 kind, sep, pattern = kpattern.partition(':')
                 if not sep:
                     # use the default