  from pathlib import Path
  from scandir import scandir
  import os
  
  image_extensions = [".jpg", ".jpeg", ".png", ".tif", ".tiff"]
  
  def get_folder(path):
      output_dir = Path(path)
      output_dir.mkdir(parents=True, exist_ok=True)
      return output_dir
 
</s> remove def get_image_paths(directory, exclude=[], debug=False):
    exclude_names = [basename(Path(x).stem[:-1] + Path(x).suffix) for x in exclude]
    dir_contents = []
 </s> add def get_image_paths(directory, exclude=list(), debug=False):
    """ Return a list of images that reside in a folder """
    image_extensions = [".jpg", ".jpeg", ".png", ".tif", ".tiff"]
    exclude_names = [basename(Path(x).stem[:-2] + Path(x).suffix) for x in exclude]
    dir_contents = list() </s> remove import time

from pathlib import Path
from lib.utils import get_image_paths, get_folder, rotate_image
from lib import Serializer
 </s> add  </s> remove import os
import numpy as np
 </s> add  </s> remove import cv2
 </s> add #!/usr/bin python3
""" The script to run the convert process of faceswap """

from pathlib import Path
  from pathlib import Path
  from scandir import scandir
  import os
  
from pathlib import Path
  
  def get_folder(path):
      output_dir = Path(path)
      output_dir.mkdir(parents=True, exist_ok=True)
      return output_dir
keep keep keep keep replace keep keep keep keep keep
 cli/scripts Refactor (#367)

* Refactor for PEP 8 and split process function

* Remove backwards compatibility for skip frames

* Split optional functions into own class. Make functions more modular

* Conform scripts folder to PEP 8

* train.py - Fix write image bug. Make more modular

* extract.py - Make more modular, Put optional actions into own class

* cli.py - start PEP 8

* cli,py - Pep 8. Refactor and make modular. Bugfixes

* 1st round refactor. Completely untested and probably broken.

* convert.py: Extract alignments from frames if they don't exist

* BugFix: SkipExisting broken since face name refactor

* Extract.py tested

* Minor formatting

* convert.py + train.py amended not tested

* train.py - Semi-fix for hang on reaching target iteration. Now quits on preview mode
Make tensorflow / system warning less verbose

* 2nd pass refactor. Semi tested

bugfixes

* Remove obsolete code. imread/write to Utils

* rename inout.py to fsmedia.py

* Final bugfixes 
lib/utils.py