          self.training_opts = training_opts
          self.mask_function = self.set_mask_function()
          self.landmarks = self.training_opts.get("landmarks", None)
          self.processing = ImageManipulation(model_input_size,
                                              model_output_size,
                                              training_opts.get("coverage_ratio", 0.625))
          logger.debug("Initialized %s", self.__class__.__name__)
 
</s> remove         dst_points = self.landmarks["a"] if side == "b" else self.landmarks["b"]
        dst_points = list(dst_points.values())
        closest = (np.mean(np.square(src_points - dst_points),
                           axis=(1, 2))).argsort()[:10]
        closest = np.random.choice(closest)
        dst_points = dst_points[closest]
 </s> add         landmarks = self.landmarks["a"] if side == "b" else self.landmarks["b"]
        closest_hashes = self._nearest_landmarks.get(filename)
        if not closest_hashes:
            dst_points_items = list(landmarks.items())
            dst_points = list(x[1] for x in dst_points_items)
            closest = (np.mean(np.square(src_points - dst_points),
                               axis=(1, 2))).argsort()[:10]
            closest_hashes = tuple(dst_points_items[i][0] for i in closest)
            self._nearest_landmarks[filename] = closest_hashes
        dst_points = landmarks[choice(closest_hashes)] </s> remove from random import shuffle
 </s> add from random import shuffle, choice
        self._nearest_landmarks = None
          self.training_opts = training_opts
          self.mask_function = self.set_mask_function()
          self.landmarks = self.training_opts.get("landmarks", None)
        self._nearest_landmarks = None
          self.processing = ImageManipulation(model_input_size,
                                              model_output_size,
                                              training_opts.get("coverage_ratio", 0.625))
          logger.debug("Initialized %s", self.__class__.__name__)
keep keep add keep keep keep keep
 Added cache for nearest landmarks (#690)

* Added cache for nearest landmarks

* linting 
lib/training_data.py