'Why am I getting a soft error for type when the type of the variable can only ever be an Integer?

def store_exists(self, str_obj):
    """
    Checks if an instance of a given store object exists already in the __store_obj_list.

    Parameters
    ----------
    str_obj : Store
        Store object to check existence of.

    Returns
    -------
    index : int
        The index of __store_obj_list where the given Store object already exists.
    int
        -1 if the given Store object does not exist in __store_obj_list.
    """

    for store in self.__store_obj_list:
        if store.get_store_name() == str_obj.get_store_name():
            if store.get_city() == str_obj.get_city():
                if store.get_area() == str_obj.get_area():
                    index = self.__store_obj_list.index(store)
                    return index
    return -1

def add_store_products(self):
    """
    Creates new Store object then adds it to the __store_obj_list if it does not already exist and adds its respective products.

    Returns
    -------
    None
    """

    for data in self.__store_dict.values():
        new_store = Store(data[0], data[1], data[2])
        index = self.store_exists(new_store)
        if index == -1:
            self.__store_obj_list.append(new_store)
            new_store.add_product(data[3], int(data[4]), int(data[5]), float(data[6]), float(data[7]))
        else:
            self.__store_obj_list[index].add_product(data[3], int(data[4]), int(data[5]), float(data[6]), float(data[7]))
    print(f"{len(self.__store_dict)} records added to unique {len(self.__store_obj_list)} stores.")

In the line self.__store_obj_list[index].add_product(data[3], int(data[4]), int(data[5]), float(data[6]), float(data[7])) I am getting a soft error on index which says:

Unexpected type(s):
(tuple[int, int])
Possible type(s):
(SupportsIndex)
(slice)

This shouldn't be the case since self.store_exists(new_store) can only ever return an integer. If anyone can give me some insight as to why this is happening or a possible solution would be greatly appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source