class RowWrapper:
    def __init__(self, row: list):
        self.local_occurrence = self.__empty_to_none(row[0])
        self.rarity = self.__empty_to_none(row[1])
        self.superfamily = self.__empty_to_none(row[2])
        self.family = self.__empty_to_default(row[3], self.superfamily)
        self.subfamily = self.__empty_to_default(row[4], self.family)
        self.tribe = self.__empty_to_default(row[5], self.subfamily)
        self.kr_number = self.__empty_to_none(row[9])
        self.genus = self.__empty_to_default(row[10], self.tribe)
        self.species = self.__empty_to_none(row[11])

    def rarity_is_larger_than(self, limit: int):
        return self.rarity is not None and self.rarity.isnumeric() and limit < int(self.rarity)

    @staticmethod
    def __empty_to_none(val: str):
        return val if val.strip() else None

    @staticmethod
    def __empty_to_default(val: str, default: str):
        val = RowWrapper.__empty_to_none(val)
        if val is not None:
            return val

        return default
