Skip to content

environment

Environment utility functions.

Functions

has_command

has_command(cmd: str) -> bool

Test if given command exists in the environment.

This function is mostly a convenience alias.

Parameters:

  • cmd

    (str) –

    command to test

Returns:

  • bool

    True if the command exists, False otherwise

Source code in ipsl_common/environment.py
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
def has_command(cmd: str) -> bool:
    """Test if given command exists in the environment.

    This function is mostly a convenience alias.

    Args:
        cmd: command to test

    Returns:
        True if the command exists, False otherwise
    """
    return which(cmd) is not None