Repository: AntonOsika/gpt-engineer
File: gpt_engineer/file_selector.py (Python)

Code before:
        self.file_path_list = file_path_list
        self.selectable_file_paths = file_path_enumeration

    def ask_for_selection(self) -> List[str]:
        """
        Ask user to select files from the terminal after displaying it

        Returns:
            List[str]: list of selected paths
        """
        user_input = input(
            "\nSelect files by entering the numbers separated by commas/spaces or "
            + "specify range with a dash. "
            + "Example: 1,2,3-5,7,9,13-15,18,20 (enter 'all' to select everything)"
            + "\n\nSelect files:"
        )
        selected_paths = []
        regex = r"\d+(-\d+)?([, ]\d+(-\d+)?)*"

        if user_input.lower() == "all":
            selected_paths = self.file_path_list
        elif re.match(regex, user_input):
            try:
                user_input = (
                    user_input.replace(
                        "", ",") if " " in user_input else user_input
                )
                selected_files = user_input.split(",")
                for file_number_str in selected_files:
                    if "-" in file_number_str:
                        start_str, end_str = file_number_str.split("-")
                        start = int(start_str)
                        end = int(end_str)
                        for num in range(start, end + 1):
                            selected_paths.append(
                                str(self.selectable_file_paths[num]))
                    else:
                        num = int(file_number_str)
                        selected_paths.append(
                            str(self.selectable_file_paths[num]))

            except ValueError:
                pass
        else:
            print("Please use a valid number/series of numbers.\n")
            sys.exit(1)

        return selected_paths


def is_in_ignoring_extensions(path: Path) -> bool:

Review comment (suggestion):
Not sure what this is for but shouldn't it be this:

```suggestion
                        " ", ",") if " " in user_input else user_input
```

Code after:
        self.file_path_list = file_path_list
        self.selectable_file_paths = file_path_enumeration

    def ask_for_selection(self) -> List[str]:
        """
        Ask user to select files from the terminal after displaying it

        Returns:
            List[str]: list of selected paths
        """
        user_input = input(
            "\nSelect files by entering the numbers separated by commas/spaces or "
            + "specify range with a dash. "
            + "Example: 1,2,3-5,7,9,13-15,18,20 (enter 'all' to select everything)"
            + "\n\nSelect files:"
        )
        selected_paths = []
        regex = r"\d+(-\d+)?([, ]\d+(-\d+)?)*"

        if user_input.lower() == "all":
            selected_paths = self.file_path_list
        elif re.match(regex, user_input):
            try:
                user_input = (
                    user_input.replace(" ", ",") if " " in user_input else user_input
                )
                selected_files = user_input.split(",")
                for file_number_str in selected_files:
                    if "-" in file_number_str:
                        start_str, end_str = file_number_str.split("-")
                        start = int(start_str)
                        end = int(end_str)
                        for num in range(start, end + 1):
                            selected_paths.append(str(self.selectable_file_paths[num]))
                    else:
                        num = int(file_number_str)
                        selected_paths.append(str(self.selectable_file_paths[num]))

            except ValueError:
                pass
        else:
            print("Please use a valid number/series of numbers.\n")
            sys.exit(1)

        return selected_paths


def is_in_ignoring_extensions(path: Path) -> bool:
    """
    Check if a path is not hidden or in the __pycache__ directory.