comparison 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
comparison
equal deleted inserted replaced
375:7044c2900890 376:54a6d4534ef4
211 @classmethod 211 @classmethod
212 def build_from_commandline_patterns(klass, filter_definitions): 212 def build_from_commandline_patterns(klass, filter_definitions):
213 matchers = [] 213 matchers = []
214 if filter_definitions: 214 if filter_definitions:
215 for action, kpattern in filter_definitions: 215 for action, kpattern in filter_definitions:
216 assert action in ("include", "exclude", "accept-treesum") 216 if action not in ("include", "exclude", "accept-treesum"):
217 raise ValueError(
218 "unknown action in filter definitions: {}"
219 .format(action))
217 kind, sep, pattern = kpattern.partition(':') 220 kind, sep, pattern = kpattern.partition(':')
218 if not sep: 221 if not sep:
219 # use the default 222 # use the default
220 kind = "glob" 223 kind = "glob"
221 pattern = kpattern 224 pattern = kpattern