def run(self, edit, command_line=''):

        if not command_line:
            raise ValueError('no command line passed; that seems wrong')

        # ST commands only accept Json-encoded parameters.
        # We parse the command line again because the alternative is to
        # serialize the parsed command line before calling this command.
        # Parsing twice seems simpler.
        parsed = parse_command_line(command_line)
        pattern = parsed.command.pattern
        replacement = parsed.command.replacement
        count = parsed.command.count
        flags = parsed.command.flags

        # :s
        if not pattern:
            pattern = ExSubstitute.last_pattern
            replacement = ExSubstitute.last_replacement
            # TODO: Don't we have to reuse the previous flags?
            flags = []
            count = 0

        if not pattern:
            sublime.status_message("Vintageous: no previous pattern available")
            print("Vintageous: no previous pattern available")
            return

        ExSubstitute.last_pattern = pattern
        ExSubstitute.last_replacement = replacement
        ExSubstitute.last_flags = flags

        computed_flags = re.MULTILINE
        computed_flags |= re.IGNORECASE if ('i' in flags) else 0

        try:
            compiled_rx = re.compile(pattern, flags=computed_flags)
        except Exception as e:
            sublime.status_message(
                "Vintageous: bad pattern '%s'" % (e.message, pattern))
            print("Vintageous [regex error]: %s ... in pattern '%s'"
                % (e.message, pattern))
            return

        # TODO: Implement 'count'
        replace_count = 0 if (flags and flags in 'g') else 1

        target_region = parsed.line_range.resolve(self.view)

        if 'c' in flags:
            self.replace_confirming(edit, pattern, compiled_rx, replacement, replace_count, target_region)
            return

        line_text = self.view.substr(target_region)
        new_text = re.sub(compiled_rx, replacement, line_text, count=replace_count)
        self.view.replace(edit, target_region, new_text)
dataset/ETHPy150Open guillermooo/Vintageous/ex_commands.py/ExSubstitute.run/swapped operands of `in`