Esempio n. 1
0
    def is_changed_context_path(self):
        # type: () -> bool
        """Check if a context path as been changed.

        Returns:
            bool. Whether a context path as been changed.
        """
        current_command_to_context_paths = self._get_command_to_context_paths(
            self.current_file)
        old_command_to_context_paths = self._get_command_to_context_paths(
            self.old_file)
        # if old integration command has no outputs, no change of context will occur.
        if not old_command_to_context_paths:
            return False
        # if new integration command has no outputs, and old one does, a change of context will occur.
        if not current_command_to_context_paths and old_command_to_context_paths:
            return True
        for old_command, old_context_paths in old_command_to_context_paths.items(
        ):
            if old_command in current_command_to_context_paths.keys():
                if not self._is_sub_set(
                        current_command_to_context_paths[old_command],
                        old_context_paths):
                    print_error(
                        Errors.breaking_backwards_command(
                            self.file_path, old_command))
                    self.is_valid = False
                    return True
        return False
Esempio n. 2
0
    def is_changed_context_path(self):
        # type: () -> bool
        """Check if a context path as been changed.

        Returns:
            bool. Whether a context path as been changed.
        """
        current_command_to_context_paths = self._get_command_to_context_paths(
            self.current_file)
        old_command_to_context_paths = self._get_command_to_context_paths(
            self.old_file)

        for old_command, old_context_paths in old_command_to_context_paths.items(
        ):
            if old_command in current_command_to_context_paths.keys():
                if not self._is_sub_set(
                        current_command_to_context_paths[old_command],
                        old_context_paths):
                    print_error(
                        Errors.breaking_backwards_command(
                            self.file_path, old_command))
                    self.is_valid = False
                    return True
        return False