          return retval
  
      @property
      def hashes_to_frame(self):
          """ Return :attr:`_hashes_to_frame`. Generate it if it does not exist.
              The dict is of each face_hash with their parent frame name(s) and their index
              in the frame
          """
          if not self._hashes_to_frame:
              logger.debug("Generating hashes to frame")
              for frame_name, faces in self.data.items():
                  for idx, face in enumerate(faces):
 
</s> remove             for frame_name, faces in self.data.items():
                for idx, face in enumerate(faces):
 </s> add             for frame_name, val in self._data.items():
                for idx, face in enumerate(val["faces"]): </s> remove     @property
    def mask_summary(self):
        """ Dict: The mask types and the number of faces which have each type that exist with in
        the loaded alignments """
        masks = dict()
        for faces in self.data.values():
            for face in faces:
                if face.get("mask", None) is None:
                    masks["none"] = masks.get("none", 0) + 1
                for key in face.get("mask", dict()):
                    masks[key] = masks.get(key, 0) + 1
        return masks

 </s> add  </s> remove         """ Yield face alignments for one image """
        for frame_fullname, alignments in self.data.items():
 </s> add         """ Generator to obtain all faces with meta information from :attr:`data`. The results
        are yielded by frame.

        Notes
        -----
        The yielded order is non-deterministic.

        Yields
        ------
        frame_name: str
            The frame name that the face belongs to. This is the base name of the frame, as it
            appears in :attr:`data`, not the full path
        faces: list
            The list of face `dict` objects that exist for this frame
        face_count: int
            The number of faces that exist within :attr:`data` for this frame
        frame_fullname: str
            The full path (folder and filename) for the yielded frame
        """
        for frame_fullname, val in self._data.items(): </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     """ Holds processes pertaining to the alignments file.

        folder:     folder alignments file is stored in
        filename:   Filename of alignments file. If a
                    valid extension is provided, then it will be used to
                    decide the serializer otherwise compressed pickle is used.
 </s> add     """ The alignments file is a custom serialized ``.fsa`` file that holds information for each
    frame for a video or series of images.

    Specifically, it holds a list of faces that appear in each frame. Each face contains
    information detailing their detected bounding box location within the frame, the 68 point
    facial landmarks and any masks that have been extracted.

    Additionally it can also hold video meta information (timestamp and whether a frame is a
    key frame.)

    Parameters
    ----------
    folder: str
        The folder that contains the alignments ``.fsa`` file
    filename: str, optional
        The filename of the ``.fsa`` alignments file. If not provided then the given folder will be
        checked for a default alignments file filename. Default: "alignments"
        """ dict: The SHA1 hash of the face mapped to the frame(s) and face index within the frame
        that the hash corresponds to. The structure of the dictionary is:

        {**SHA1_hash** (`str`): {**filename** (`str`): **face_index** (`int`)}}.

        Notes
        -----
        The first time this property is referenced, the dictionary will be created and cached.
        Subsequent references will be made to this cached dictionary.
          return retval
  
      @property
      def hashes_to_frame(self):
        """ dict: The SHA1 hash of the face mapped to the frame(s) and face index within the frame
        that the hash corresponds to. The structure of the dictionary is:

        {**SHA1_hash** (`str`): {**filename** (`str`): **face_index** (`int`)}}.

        Notes
        -----
        The first time this property is referenced, the dictionary will be created and cached.
        Subsequent references will be made to this cached dictionary.
        """ dict: The SHA1 hash of the face mapped to the frame(s) and face index within the frame
        that the hash corresponds to. The structure of the dictionary is:

        {**SHA1_hash** (`str`): {**filename** (`str`): **face_index** (`int`)}}.

        Notes
        -----
        The first time this property is referenced, the dictionary will be created and cached.
        Subsequent references will be made to this cached dictionary.
        """ dict: The SHA1 hash of the face mapped to the frame(s) and face index within the frame
        that the hash corresponds to. The structure of the dictionary is:

        {**SHA1_hash** (`str`): {**filename** (`str`): **face_index** (`int`)}}.

        Notes
        -----
        The first time this property is referenced, the dictionary will be created and cached.
        Subsequent references will be made to this cached dictionary.
          """
          if not self._hashes_to_frame:
              logger.debug("Generating hashes to frame")
              for frame_name, faces in self.data.items():
                  for idx, face in enumerate(faces):
keep keep keep keep replace replace 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