                      self.faces_detected[os.path.basename(filename)] = faces
              else:
                  try:
                      for filename in tqdm(self.read_directory()):
                           self.faces_detected[os.path.basename(filename)] = self.handleImage(filename)[1]
                  except Exception as e:
                      print('Failed to extract from image: {}. Reason: {}'.format(filename, e))
          finally:
              self.write_alignments()
  
 
</s> remove             return self.handleImage(filename)
 </s> add             image = cv2.imread(filename)
            return filename, self.handleImage(image) </s> remove     def handleImage(self, filename):
 </s> add     def handleImage(self, image): </s> remove         image = cv2.imread(filename)
 </s> add  </s> remove         return filename, rvals
 </s> add         return rvals
                        image = cv2.imread(filename)
                        self.faces_detected[os.path.basename(filename)] = self.handleImage(self, image)
                      self.faces_detected[os.path.basename(filename)] = faces
              else:
                  try:
                      for filename in tqdm(self.read_directory()):
                        image = cv2.imread(filename)
                        self.faces_detected[os.path.basename(filename)] = self.handleImage(self, image)
                  except Exception as e:
                      print('Failed to extract from image: {}. Reason: {}'.format(filename, e))
          finally:
              self.write_alignments()
  
keep keep keep keep replace keep keep keep keep keep
 Refactoring scripts/extract.py (#216)

Refactored extract to have handleImage take in a image instead of a filename. This will be useful for writing future extensions for extract where you may not have a file on disk but you do have a image in memory. For example extracting faces from a video. 
scripts/extract.py