def set(self, i, val):
        assert(i >= 0)
        if i < SIZE:
            if self.direct[i] == val:
                return self

            temp = self.direct[:]
            temp[i] = val
            return _TreeListSub(self.default, temp, self.children)

        i -= SIZE
        i, ci = divmod(i, SPLIT)
        child = self.children[ci]

        if child is None:
            if val == self.default:
                return self
            child = _TreeListSub(self.default).set(i, val)
        else:
            if val == child[i]:
                return self
            child = child.set(i, val)

        temp = self.children[:]
        temp[ci] = child
        return _TreeListSub(self.default, self.direct, temp)
dataset/ETHPy150Open ajinabraham/Mobile-Security-Framework-MobSF/StaticAnalyzer/tools/enjarify/enjarify/treelist.py/_TreeListSub.set/original