MCPcopy
hub / github.com/borgbackup/borg / parse_pattern

Function parse_pattern

src/borg/patterns.py:331–338  ·  view source on GitHub ↗

Read pattern from string and return an instance of the appropriate implementation class.

(pattern, fallback=FnmatchPattern, recurse_dir=True)

Source from the content-addressed store, hash-verified

329
330
331def 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
341def parse_exclude_pattern(pattern_str, fallback=FnmatchPattern):

Callers 6

add_includepathsMethod · 0.85
parse_exclude_patternFunction · 0.85
parse_inclexcl_commandFunction · 0.85
test_parse_patternFunction · 0.85
test_parse_pattern_errorFunction · 0.85
test_basicFunction · 0.85

Calls 1

get_pattern_classFunction · 0.85

Tested by 3

test_parse_patternFunction · 0.68
test_parse_pattern_errorFunction · 0.68
test_basicFunction · 0.68