              for idx, face in reversed(list(enumerate(frame))):
                  if ((filter_out and face.get("hash", None) in hashset) or
                          (not filter_out and face.get("hash", None) not in hashset)):
                      logger.verbose("Filtering out face: (filename: %s, index: %s)", filename, idx)
                      del frame[idx]
                  else:
                      logger.trace("Not filtering out face: (filename: %s, index: %s)",
                                   filename, idx)
  
      # << GENERATORS >> #
 
</s> remove         hashset = set(hashlist)
        for filename, frame in self.data.items():
            for idx, face in reversed(list(enumerate(frame))):
 </s> add         hashset = set(hash_list)
        for filename, val in self._data.items():
            for idx, face in reversed(list(enumerate(val["faces"]))): </s> remove             filter_out=True: Remove faces that match in the hash list
            filter_out=False: Remove faces that are not in the hash list
 </s> add         Parameters
        ----------
        hash_list: list
            List of SHA1 hashes in `str` format to use as a filter against :attr:`data`
        filter_out: bool, optional
            ``True`` if faces should be removed from :attr:`data` when there is a corresponding
            match in the given hash_list. ``False`` if faces should be kept in :attr:`data` when
            there is a corresponding match in the given hash_list, but removed if there is no
            match. Default: ``False`` </s> remove         del self.data[frame][idx]
        logger.debug("Deleted face: (frame: '%s', idx %s)", frame, idx)
 </s> add         del self._data[frame_name]["faces"][face_index]
        logger.debug("Deleted face: (frame_name: '%s', face_index %s)", frame_name, face_index) </s> remove     def add_face(self, frame, alignment):
        """ Add a new face for a frame and return it's index """
        logger.debug("Adding face to frame: '%s'", frame)
        if frame not in self.data:
            self.data[frame] = []
        self.data[frame].append(alignment)
        retval = self.count_faces_in_frame(frame) - 1
 </s> add     def add_face(self, frame_name, face):
        """ Add a new face for the given frame_name in :attr:`data` and return it's index.

        Parameters
        ----------
        frame_name: str
            The frame name to add the face to. This should be the base name of the frame, not the
            full path
        face: dict
            The face information to add to the given frame_name, correctly formatted for storing in
            :attr:`data`

        Returns
        -------
        int
            The index of the newly added face within :attr:`data` for the given frame_name
        """
        logger.debug("Adding face to frame_name: '%s'", frame_name)
        if frame_name not in self._data:
            self._data[frame_name] = dict(faces=[])
        self._data[frame_name]["faces"].append(face)
        retval = self._count_faces_in_frame(frame_name) - 1 </s> remove     def delete_face_at_index(self, frame, idx):
        """ Delete the face alignment for given frame at given index """
        logger.debug("Deleting face %s for frame '%s'", idx, frame)
        idx = int(idx)
        if idx + 1 > self.count_faces_in_frame(frame):
            logger.debug("No face to delete: (frame: '%s', idx %s)", frame, idx)
 </s> add     def delete_face_at_index(self, frame_name, face_index):
        """ Delete the face for the given frame_name at the given face index from :attr:`data`.

        Parameters
        ----------
        frame_name: str
            The frame name to remove the face from. This should be the base name of the frame, not
            the full path
        face_index: int
            The index number of the face within the given frame_name to remove

        Returns
        -------
        bool
            ``True`` if a face was successfully deleted otherwise ``False``
        """
        logger.debug("Deleting face %s for frame_name '%s'", face_index, frame_name)
        face_index = int(face_index)
        if face_index + 1 > self._count_faces_in_frame(frame_name):
            logger.debug("No face to delete: (frame_name: '%s', face_index %s)",
                         frame_name, face_index)
                    del val["faces"][idx]
              for idx, face in reversed(list(enumerate(frame))):
                  if ((filter_out and face.get("hash", None) in hashset) or
                          (not filter_out and face.get("hash", None) not in hashset)):
                      logger.verbose("Filtering out face: (filename: %s, index: %s)", filename, idx)
                    del val["faces"][idx]
                  else:
                      logger.trace("Not filtering out face: (filename: %s, index: %s)",
                                   filename, idx)
  
      # << GENERATORS >> #
keep keep keep keep replace keep keep keep keep keep
 lib.alignments - Slight update (#978)

* lib.alignments update:
  - Minor structure change (faces to nested dictionary)
  - Refactor internal and external methods
  - Documentation 
lib/alignments.py