Resolve all distinct files with their regexp from a list of glob patterns with optional regexp
(
patterns: Iterable[str], version: str
)
| 113 | |
| 114 | |
| 115 | def _resolve_files_and_regexes( |
| 116 | patterns: Iterable[str], version: str |
| 117 | ) -> Generator[tuple[str, re.Pattern], None, None]: |
| 118 | """ |
| 119 | Resolve all distinct files with their regexp from a list of glob patterns with optional regexp |
| 120 | """ |
| 121 | filepath_set: set[tuple[str, str]] = set() |
| 122 | for pattern in patterns: |
| 123 | drive, tail = os.path.splitdrive(pattern) |
| 124 | path, _, regex = tail.partition(":") |
| 125 | filepath = drive + path |
| 126 | regex = regex or re.escape(version) |
| 127 | |
| 128 | filepath_set.update((path, regex) for path in iglob(filepath)) |
| 129 | |
| 130 | return ((path, re.compile(regex)) for path, regex in sorted(filepath_set)) |
| 131 | |
| 132 | |
| 133 | def create_commit_message( |
no test coverage detected
searching dependent graphs…