def add_dev(self, dev):
        if 'id' not in dev:
            dev['id'] = 0
            if self.devs:
                try:
                    dev['id'] = self.devs.index(None)
                except ValueError:
                    dev['id'] = len(self.devs)
        if dev['id'] < len(self.devs) and self.devs[dev['id']] is not None:
            raise exceptions.DuplicateDeviceError(
                'Duplicate device id: %d' % dev['id'])
        # Add holes to self.devs to ensure self.devs[dev['id']] will be the dev
        while dev['id'] >= len(self.devs):
            self.devs.append(None)
        dev['weight'] = float(dev['weight'])
        dev['parts'] = 0
        self.devs[dev['id']] = dev
        self.devs_changed = True
        self.version += 1
        return dev['id']
Delete a directory.
dataset/ETHPy150Open openstack/swift/swift/common/ring/builder.py/RingBuilder.add_dev--crossover with--dataset/ETHPy150Open kdart/pycopia/QA/pycopia/remote/PosixServer.py/PosixAgent.rmdir