MCPcopy Create free account
hub / github.com/agent0ai/agent-zero / _get_explicit_patterns

Method _get_explicit_patterns

helpers/backup.py:175–191  ·  view source on GitHub ↗

Extract explicit (non-wildcard) patterns that should always be included

(self, include_patterns: List[str])

Source from the content-addressed store, hash-verified

173 return len(directories)
174
175 def _get_explicit_patterns(self, include_patterns: List[str]) -> set[str]:
176 """Extract explicit (non-wildcard) patterns that should always be included"""
177 explicit_patterns = set()
178
179 for pattern in include_patterns:
180 # If pattern doesn't contain wildcards, it's explicit
181 if '*' not in pattern and '?' not in pattern:
182 # Remove leading slash for comparison
183 explicit_patterns.add(pattern.lstrip('/'))
184
185 # Also add parent directories as explicit (so hidden dirs can be traversed)
186 path_parts = pattern.lstrip('/').split('/')
187 for i in range(1, len(path_parts)):
188 parent_path = '/'.join(path_parts[:i])
189 explicit_patterns.add(parent_path)
190
191 return explicit_patterns
192
193 def _is_explicitly_included(self, file_path: str, explicit_patterns: set[str]) -> bool:
194 """Check if a file/directory is explicitly included in patterns"""

Callers 1

test_patternsMethod · 0.95

Calls 3

setFunction · 0.85
addMethod · 0.45
joinMethod · 0.45

Tested by 1

test_patternsMethod · 0.76