Return a list of file paths based on a glob pattern. Only files are returned, not directories, and optionally only files for which the user has a specified access to. :param pattern: file name or glob pattern :param access: file access type to verify (os.* where * is F_OK, R_OK, W_OK,
(pattern: str, access: int = os.F_OK)
| 333 | |
| 334 | |
| 335 | def files_from_glob_pattern(pattern: str, access: int = os.F_OK) -> list[str]: |
| 336 | """Return a list of file paths based on a glob pattern. |
| 337 | |
| 338 | Only files are returned, not directories, and optionally only files for which the user has a specified access to. |
| 339 | |
| 340 | :param pattern: file name or glob pattern |
| 341 | :param access: file access type to verify (os.* where * is F_OK, R_OK, W_OK, or X_OK) |
| 342 | :return: list of files matching the name or glob pattern |
| 343 | """ |
| 344 | return [f for f in glob.glob(pattern) if os.path.isfile(f) and os.access(f, access)] |
| 345 | |
| 346 | |
| 347 | def files_from_glob_patterns(patterns: Iterable[str], access: int = os.F_OK) -> list[str]: |
no outgoing calls
no test coverage detected
searching dependent graphs…