def _process_configuration(self, project_and_group: str, configuration: dict):
    for file in sorted(configuration['files']):
        debug("Processing file '%s'...", file)
        if configuration.get((('files|' + file) + '|skip')):
            debug("Skipping file '%s'", file)
            continue
        if (configuration['files'][file]['branches'] == 'all'):
            all_branches = self.gitlab.get_branches(project_and_group)
            branches = sorted(all_branches)
        elif (configuration['files'][file]['branches'] == 'protected'):
            protected_branches = self.gitlab.get_protected_branches(project_and_group)
            branches = sorted(protected_branches)
        else:
            all_branches = self.gitlab.get_branches(project_and_group)
            branches = []
            for branch in configuration['files'][file]['branches']:
                if (branch in all_branches):
                    branches.append(branch)
                else:
                    message = f"! Branch '{branch}' not found, not processing file '{file}' in it"
                    if self.strict:
                        fatal(message, exit_code=EXIT_INVALID_INPUT)
                    else:
                        warning(message)
        for branch in branches:
            verbose(f"Processing file '{file}' in branch '{branch}'")
            if (configuration.get((('files|' + file) + '|content')) and configuration.get((('files|' + file) + '|file'))):
                fatal(f"File '{file}' in '{project_and_group}' has both `content` and `file` set - use only one of these keys.", exit_code=EXIT_INVALID_INPUT)
            if configuration.get((('files|' + file) + '|delete')):
                try:
                    self.gitlab.get_file(project_and_group, branch, file)
                    debug("Deleting file '%s' in branch '%s'", file, branch)
                    self.modify_file_dealing_with_branch_protection(project_and_group, branch, file, 'delete', configuration)
                except NotFoundException:
                    debug("Not deleting file '%s' in branch '%s' (already doesn't exist)", file, branch)
            else:
                if configuration.get((('files|' + file) + '|content')):
                    new_content = configuration.get((('files|' + file) + '|content'))
                else:
                    path_in_config = Path(configuration.get((('files|' + file) + '|file')))
                    if path_in_config.is_absolute():
                        path = path_in_config.read_text()
                    else:
                        path = Path(os.path.join(self.config.config_dir, str(path_in_config)))
                    new_content = path.read_text()
                if configuration.get((('files|' + file) + '|template'), True):
                    new_content = self.get_file_content_as_template(new_content, project_and_group, **configuration.get((('files|' + file) + '|jinja_env'), dict()))
                try:
                    current_content = self.gitlab.get_file(project_and_group, branch, file)
                    if (current_content != new_content):
                        if configuration.get((('files|' + file) + '|overwrite')):
                            debug("Changing file '%s' in branch '%s'", file, branch)
                            self.modify_file_dealing_with_branch_protection(project_and_group, branch, file, 'modify', configuration, new_content)
                        else:
                            debug("Not changing file '%s' in branch '%s' - overwrite flag not set.", file, branch)
                    else:
                        debug("Not changing file '%s' in branch '%s' - it's content is already as provided)", file, branch)
                except NotFoundException:
                    debug("Creating file '%s' in branch '%s'", file, branch)
                    self.modify_file_dealing_with_branch_protection(project_and_group, branch, file, 'add', configuration, new_content)
            if configuration.get((('files|' + file) + '|only_first_branch')):
                verbose('Skipping other branches for this file, as configured.')
                break
def _process_configuration(self, project_and_group: str, configuration: dict):
    for file in sorted(configuration['files']):
        debug("Processing file '%s'...", file)
        if configuration.get((('files|' + file) + '|skip')):
            debug("Skipping file '%s'", file)
            continue
        if (configuration['files'][file]['branches'] == 'all'):
            all_branches = self.gitlab.get_branches(project_and_group)
            branches = sorted(all_branches)
        elif (configuration['files'][file]['branches'] == 'protected'):
            protected_branches = self.gitlab.get_protected_branches(project_and_group)
            branches = sorted(protected_branches)
        else:
            all_branches = self.gitlab.get_branches(project_and_group)
            branches = []
            for branch in configuration['files'][file]['branches']:
                if (branch in all_branches):
                    branches.append(branch)
                else:
                    message = f"! Branch '{branch}' not found, not processing file '{file}' in it"
                    if self.strict:
                        fatal(message, exit_code=EXIT_INVALID_INPUT)
                    else:
                        warning(message)
        for branch in branches:
            verbose(f"Processing file '{file}' in branch '{branch}'")
            if (configuration.get((('files|' + file) + '|content')) and configuration.get((('files|' + file) + '|file'))):
                fatal(f"File '{file}' in '{project_and_group}' has both `content` and `file` set - use only one of these keys.", exit_code=EXIT_INVALID_INPUT)
            if configuration.get((('files|' + file) + '|delete')):
                try:
                    self.gitlab.get_file(project_and_group, branch, file)
                    debug("Deleting file '%s' in branch '%s'", file, branch)
                    self.modify_file_dealing_with_branch_protection(project_and_group, branch, file, 'delete', configuration)
                except NotFoundException:
                    debug("Not deleting file '%s' in branch '%s' (already doesn't exist)", file, branch)
            else:
                if configuration.get((('files|' + file) + '|content')):
                    new_content = configuration.get((('files|' + file) + '|content'))
                else:
                    path_in_config = Path(configuration.get((('files|' + file) + '|file')))
                    if path_in_config.is_absolute():
                        path = path_in_config.read_text()
                    else:
                        path = Path(os.path.join(self.config.config_dir, str(path_in_config)))
                    new_content = path.read_text()
                if configuration.get((('files|' + file) + '|template'), True):
                    new_content = self.get_file_content_as_template(new_content, project_and_group, **configuration.get((('files|' + file) + '|jinja_env'), dict()))
                try:
                    current_content = self.gitlab.get_file(project_and_group, branch, file)
                    if (current_content != new_content):
                        if configuration.get((('files|' + file) + '|overwrite')):
                            debug("Changing file '%s' in branch '%s'", file, branch)
                            self.modify_file_dealing_with_branch_protection(project_and_group, branch, file, 'modify', configuration, new_content)
                        else:
                            debug("Not changing file '%s' in branch '%s' - overwrite flag not set.", file, branch)
                    else:
                        debug("Not changing file '%s' in branch '%s' - it's content is already as provided)", file, branch)
                except NotFoundException:
                    debug("Creating file '%s' in branch '%s'", file, branch)
                    self.modify_file_dealing_with_branch_protection(project_and_group, branch, file, 'add', configuration, new_content)
            if configuration.get((('files|' + file) + '|only_first_branch')):
                verbose('Skipping other branches for this file, as configured.')
                break