  
  _HASHES_SEEN = dict()
  
  
  def update_legacy_png_header(filename, alignments):
      """ Update a legacy extracted face from pre v2.1 alignments by placing the alignment data for
      the face in the png exif header for the given filename with the given alignment data.
  
      If the given file is not a .png then a png is created and the original file is removed
  
 
</s> remove _HASHES_SEEN = dict()
 </s> add _HASHES_SEEN: Dict[str, Dict[str, int]] = {} </s> remove         alignment = dict(x=self.x,
                         w=self.w,
                         y=self.y,
                         h=self.h,
                         landmarks_xy=self.landmarks_xy.tolist(),
                         mask={name: mask.to_png_meta() for name, mask in self.mask.items()})
 </s> add         if (self.left is None or self.width is None or self.top is None or self.height is None):
            raise AssertionError("Some detected face variables have not been initialized")
        alignment = PNGHeaderAlignmentsDict(
            x=self.left,
            w=self.width,
            y=self.top,
            h=self.height,
            landmarks_xy=self.landmarks_xy.tolist(),
            mask={name: mask.to_png_meta() for name, mask in self.mask.items()}) </s> remove     def _get_kernel_size(self, kernel, is_ratio):
 </s> add     def _get_kernel_size(self, kernel: Union[int, float], is_ratio: bool) -> int: </s> remove         alignment = dict(x=self.x,
                         w=self.w,
                         y=self.y,
                         h=self.h,
                         landmarks_xy=self.landmarks_xy,
                         mask={name: mask.to_dict() for name, mask in self.mask.items()})
        if self.thumbnail is not None:
            alignment["thumb"] = self.thumbnail
        logger.trace("Returning: %s", alignment)
 </s> add         if (self.left is None or self.width is None or self.top is None or self.height is None):
            raise AssertionError("Some detected face variables have not been initialized")
        alignment = AlignmentFileDict(x=self.left,
                                      w=self.width,
                                      y=self.top,
                                      h=self.height,
                                      landmarks_xy=self.landmarks_xy,
                                      mask={name: mask.to_dict()
                                            for name, mask in self.mask.items()},
                                      thumb=self.thumbnail)
        logger.trace("Returning: %s", alignment)  # type: ignore
def update_legacy_png_header(filename: str, alignments: Alignments
                             ) -> Optional[PNGHeaderDict]:
  
  _HASHES_SEEN = dict()
  
  
def update_legacy_png_header(filename: str, alignments: Alignments
                             ) -> Optional[PNGHeaderDict]:
      """ Update a legacy extracted face from pre v2.1 alignments by placing the alignment data for
      the face in the png exif header for the given filename with the given alignment data.
  
      If the given file is not a .png then a png is created and the original file is removed
  
keep keep keep keep replace keep keep keep keep keep
 lib.align updates:
  - alignments.py
    - Add typed dicts for imported alignments
    - Explicitly check for presence of thumb value in alignments dict
    - linting
  - detected_face.py
    - Typing
    - Linting
    - Legacy support for pre-aligned face
    - Update dependencies to new property names 
lib/align/detected_face.py