MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / files_from_glob_pattern

Function files_from_glob_pattern

cmd2/utils.py:335–344  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

333
334
335def 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
347def files_from_glob_patterns(patterns: Iterable[str], access: int = os.F_OK) -> list[str]:

Callers 2

files_from_glob_patternsFunction · 0.85
get_exes_in_pathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…