def METHOD_NAME(self, mode):
    modes = {
        'directory': QFileDialog.Directory,
        QFileDialog.Directory: QFileDialog.Directory,
        'file': QFileDialog.ExistingFile,
        QFileDialog.ExistingFile: QFileDialog.ExistingFile,
        'anyfile': QFileDialog.AnyFile,
        QFileDialog.AnyFile: QFileDialog.AnyFile
    }
    self.fileDialog().METHOD_NAME(modes[mode])