Read pattern from string and return an instance of the appropriate implementation class.
(pattern, fallback=FnmatchPattern, recurse_dir=True)
| 329 | |
| 330 | |
| 331 | def parse_pattern(pattern, fallback=FnmatchPattern, recurse_dir=True): |
| 332 | """Read pattern from string and return an instance of the appropriate implementation class.""" |
| 333 | if len(pattern) > 2 and pattern[2] == ":" and pattern[:2].isalnum(): |
| 334 | (style, pattern) = (pattern[:2], pattern[3:]) |
| 335 | cls = get_pattern_class(style) |
| 336 | else: |
| 337 | cls = fallback |
| 338 | return cls(pattern, recurse_dir) |
| 339 | |
| 340 | |
| 341 | def parse_exclude_pattern(pattern_str, fallback=FnmatchPattern): |