def is_added_required_fields(self): # type: () -> bool """Check if required field were added.""" current_field_to_required = self._get_field_to_required_dict(self.current_file) old_field_to_required = self._get_field_to_required_dict(self.old_file) is_added_required = False for field, required in current_field_to_required.items(): if field in old_field_to_required.keys(): # if required is True and old_field is False. if required and required != old_field_to_required[field]: print_error(Errors.added_required_fields(self.file_path, field)) self.is_valid = False is_added_required = True # if required is True but no old field. elif required: print_error(Errors.added_required_fields(self.file_path, field)) self.is_valid = False is_added_required = True return is_added_required
def is_added_required_args(self): """Check if required arg were added.""" current_args_to_required = self._get_arg_to_required_dict( self.current_file) old_args_to_required = self._get_arg_to_required_dict(self.old_file) for arg, required in current_args_to_required.items(): if required: if (arg not in old_args_to_required) or \ (arg in old_args_to_required and required != old_args_to_required[arg]): print_error( Errors.added_required_fields(self.file_path, arg)) return True return False