giraffez/config.py
def unset_value(self, key):
        """
        Remove a value at the given key -- and any nested values --
        from the configuration.
        *Note*: In order to write changes to the file, ensure that
        :meth:`~giraffez.config.Config.write` is called prior to exit.

        :param str key: A path to the value destination, with nested levels joined by '.'
        :raises `giraffez.errors.ConfigurationError`: if the key specifies an invalid path, or does not exist
        """
        if key.endswith("."):
            key = key[:-1]
        path = key.split(".")
        curr = self.settings
        for p in path[:-1]:
            if p not in curr:
                raise ConfigurationError("Cannot unset '{}', nested key '{}' does not exist.".format(key, p))
            curr = curr[p]
        if not isinstance(curr, dict):
            raise ConfigurationError("Cannot unset nested key '{}' in configuration value '{}'.".format(path[-1], key))
        if path[-1] not in curr:
            raise ConfigurationError("Cannot unset '{}', nested key '{}' does not exist.".format(key, path[-1]))
        del curr[path[-1]]
def unset_value(self, key):
        """
        Remove a value at the given key -- and any nested values --
        from the configuration.
        *Note*: In order to write changes to the file, ensure that
        :meth:`~giraffez.config.Config.write` is called prior to exit.

        :param str key: A path to the value destination, with nested levels joined by '.'
        :raises `giraffez.errors.ConfigurationError`: if the key specifies an invalid path, or does not exist
        """
        if key.endswith("."):
            key = key[:-1]
        path = key.split(".")
        curr = self.settings
        for p in path[:-1]:
            if p not in curr:
                raise ConfigurationError("Cannot unset '{}', nested key '{}' does not exist.".format(key, p))
            curr = curr[p]
        if not isinstance(curr, dict):
            raise ConfigurationError("Cannot unset nested key '{}' in configuration value '{}'.".format(path[-1], key))
        if path[-1] not in curr:
            raise ConfigurationError("Cannot unset '{}', nested key '{}' does not exist.".format(key, path[-1]))
        del curr[path[-1]]
Remove a value at the given key -- and any nested values --
        from the configuration.
        *Note*: In order to write changes to the file, ensure that
        :meth:`~giraffez.config.Config.write` is called prior to exit.

        :param str key: A path to the value destination, with nested levels joined by '.'
        :raises `giraffez.errors.ConfigurationError`: if the key specifies an invalid path, or does not exist