          self.arguments = None
          self.opts = self.extract_options(subparsers)
          self.utils = Utils(self.opts, calling_file=cmd[0])
          self.root = FaceswapGui(self.utils, calling_file=cmd[0])
          self.parse_arguments(description, subparser, command)
  
      @staticmethod
      def check_display(command):
          """ Check whether there is a display to output the GUI. If running on
              Windows then assume not running in headless mode """
 
</s> remove     def check_display(command):
 </s> add     def check_display(): </s> remove             if 'gui' in command:
                print('Could not detect a display. The GUI has been disabled.')
                if os.name == 'posix':
                    print('macOS users need to install XQuartz. '
                          'See https://support.apple.com/en-gb/HT201341')
 </s> add             if os.name == 'posix':
                print('macOS users need to install XQuartz. '
                      'See https://support.apple.com/en-gb/HT201341') </s> remove         self.arguments = None
 </s> add         cmd = sys.argv

        self.args = arguments </s> remove         cmd = sys.argv
        if not self.check_display(cmd) or not self.check_tkinter_available(cmd):
 </s> add         if not self.check_display() or not self.check_tkinter_available(): </s> remove         args = {'prog': self.prog, 'message': message}
        self.exit(2, '%(prog)s: error: %(message)s\n' % args)

class DirectoryProcessor(object):
    '''
    Abstract class that processes a directory of images
    and writes output to the specified folder
    '''
    arguments = None
    parser = None

    input_dir = None
    output_dir = None

    images_found = 0
    num_faces_detected = 0
    faces_detected = dict()
    verify_output = False
    rotation_angles = None

    def __init__(self, subparser, command, description='default'):
 </s> add         args = {"prog": self.prog, "message": message}
        self.exit(2, "%(prog)s: error: %(message)s\n" % args)

class FaceSwapArgs(object):
    """ Faceswap argument parser functions that are universal
        to all commands. Should be the parent function of all
        subsequent argparsers """
    def __init__(self, subparser, command, description="default", subparsers=None):
          self.arguments = None
          self.opts = self.extract_options(subparsers)
          self.utils = Utils(self.opts, calling_file=cmd[0])
          self.root = FaceswapGui(self.utils, calling_file=cmd[0])

  
      @staticmethod
      def check_display(command):
          """ Check whether there is a display to output the GUI. If running on
              Windows then assume not running in headless mode """
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 
scripts/gui.py