Skip to content

API


with_condition(condition: Callable[[os.DirEntry], bool], *, paths: list[str] | None = None, path: str | None = None, mode: int = os.F_OK | os.X_OK) -> list[str]

Parameters:

Name Type Description Default
condition Callable[[DirEntry], bool]

The condition used for searching.

required
paths list[str] | None

The list of paths to check. If None, the mutually exclusive path parameter is used.

None
path str | None

The PATH to check, with each path separated by os.pathsep. If None, the PATH environment variable is used. Mutually exclusive with paths.

None
mode int

The file mode used for checking access.

F_OK | X_OK

Returns:

Type Description
list[str]

A list of absolute paths to executables that satisfy the given condition.

with_pattern(pattern: str | re.Pattern[str], *, paths: list[str] | None = None, path: str | None = None, mode: int = os.F_OK | os.X_OK) -> list[str]

Parameters:

Name Type Description Default
pattern str | Pattern[str]

The pattern used for searching.

required
paths list[str] | None

The list of paths to check. If None, the mutually exclusive path parameter is used.

None
path str | None

The PATH to check, with each path separated by os.pathsep. If None, the PATH environment variable is used. Mutually exclusive with paths.

None
mode int

The file mode used for checking access.

F_OK | X_OK

Returns:

Type Description
list[str]

A list of absolute paths to executables that match the given pattern.

with_prefix(prefix: str, *, paths: list[str] | None = None, path: str | None = None, mode: int = os.F_OK | os.X_OK) -> list[str]

Parameters:

Name Type Description Default
prefix str

The prefix used for searching.

required
paths list[str] | None

The list of paths to check. If None, the mutually exclusive path parameter is used.

None
path str | None

The PATH to check, with each path separated by os.pathsep. If None, the PATH environment variable is used. Mutually exclusive with paths.

None
mode int

The file mode used for checking access.

F_OK | X_OK

Returns:

Type Description
list[str]

A list of absolute paths to executables that start with the given prefix.