(self, key)
Delete a key.

        If no more keys are stored, it deletes the file.

        Args:
            key (str): The key to store.

        Raises:
            ValueError: If the key to delete is not found.
Delete a key.
Delete a key .
def delete(self, key):
        """Delete a key.

        If no more keys are stored, it deletes the file.

        Args:
            key (str): The key to store.

        Raises:
            ValueError: If the key to delete is not found.

        """
        try:
            with open(self.filename) as json_file:
                json_data = json.load(json_file)
        except (EnvironmentError, ValueError):
            raise ValueError("Key '%s' not found and cannot be deleted." % key)

        try:
            del json_data[key]
        except (KeyError):
            raise ValueError("Key '%s' not found and cannot be deleted." % key)

        if not json_data:                 # Empty dict.
            os.remove(self.filename)      # Remove the file.
        else:
            SecretIsbg._store_data(self.filename, json_data)
def delete ( self , key ) : try : with open ( self . filename ) as json_file : json_data = json . load ( json_file ) except ( EnvironmentError , ValueError ) : raise ValueError ( "Key '%s' not found and cannot be deleted." % key ) try : del json_data [ key ] except ( KeyError ) : raise ValueError ( "Key '%s' not found and cannot be deleted." % key ) if not json_data : # Empty dict. os . remove ( self . filename ) # Remove the file. else : SecretIsbg . _store_data ( self . filename , json_data )