def get_boolean()

in container-images/gerrit-init/tools/gerrit-initializer/initializer/helpers/git.py [0:0]


    def get_boolean(self, key, default=False):
        """
    Returns boolean value of given key in the configuration file. If the key
    appears multiple times, the last value is returned.
    """
        if not isinstance(default, bool):
            raise TypeError("Default has to be a boolean.")

        try:
            value = self._get_value(key)[-1].lower()
            if value not in ["true", "false"]:
                raise TypeError("Value is not a boolean.")
            return value == "true"
        except subprocess.CalledProcessError:
            return default