jacinle.utils.env#

Functions

jac_get_dashdebug_arg()

Return if the --debug argument is given in the command line.

jac_getenv(name[, default, type, prefix])

Get the environment variable with the given name.

jac_is_debug([default, prefix])

Return if the debug mode is enabled.

jac_is_verbose([default, prefix])

Return if the verbose mode is enabled.

Functions

jac_get_dashdebug_arg()[source]#

Return if the --debug argument is given in the command line.

jac_getenv(name, default=None, type=None, prefix=None)[source]#

Get the environment variable with the given name.

Parameters:
  • name (str) – the name of the environment variable.

  • default (Any) – the default value if the environment variable is not set.

  • type (str | type | None) – the type of the environment variable. If not given, the type of the default value will be used. It supports a special type, denoted by a string 'bool', indicating that the value will be converted to a boolean value (‘true’/’false’, ‘yes’/’no’, ‘1’/’0’).

  • prefix (str) – the prefix of the environment variable. If not given, the prefix will be JAC_.

Returns:

the value of the environment variable.

Return type:

Any

jac_is_debug(default='n', prefix=None)[source]#

Return if the debug mode is enabled. This is controlled by the environment variable JAC_DEBUG or the --debug argument in the command line.

jac_is_verbose(default='n', prefix=None)[source]#

Return if the verbose mode is enabled. This is controlled by the environment variable JAC_VERBOSE.