| 237 | ) |
| 238 | |
| 239 | class SourcePathEntry(_BaseValueEntry): |
| 240 | def __init__(self, source_path=None, source_path_regex=None, prefix=''): |
| 241 | _BaseValueEntry.__init__(self, prefix=prefix) |
| 242 | if source_path is not None: |
| 243 | assert source_path_regex is None |
| 244 | |
| 245 | self.source_path = source_path |
| 246 | self.source_path_regex = (None if source_path_regex is None else |
| 247 | re.compile(source_path_regex)) |
| 248 | |
| 249 | _preamble_pattern = re.compile( |
| 250 | r"""^Source path$""" |
| 251 | ) |
| 252 | |
| 253 | def _check_preamble(self, preamble): |
| 254 | return bool(self._preamble_pattern.match(preamble)) |
| 255 | |
| 256 | def _check_content(self, source_path): |
| 257 | if self.source_path is not None: |
| 258 | return source_path == self.source_path |
| 259 | elif self.source_path_regex is not None: |
| 260 | return self.source_path_regex.match(source_path) |
| 261 | else: |
| 262 | return True |
| 263 | |
| 264 | |
| 265 | class _BaseEventEntry(_BaseEntry): |
no outgoing calls