Example #1
0
    def _load_partial_samples(self, cls_name, samples_idxs, input_samples_idxs,
                              mover_idx, details_idx):
        cls = self.class_list[cls_name]
        obj = cls.__new__(cls)
        MoveChange.__init__(obj)

        if mover_idx[0] != '-':
            obj.mover = self.storage.pathmovers.load(int(UUID(mover_idx)))

        if len(samples_idxs) > 0:
            samples_idxs = self.storage.to_uuid_chunks(samples_idxs)
            obj.samples = [
                self.storage.samples.load(int(UUID(idx)))
                for idx in samples_idxs
            ]
        else:
            obj.samples = []

        if len(input_samples_idxs) > 0:
            input_samples_idxs = \
                self.storage.to_uuid_chunks(input_samples_idxs)
            obj.input_samples = [
                self.storage.samples.load(int(UUID(idx)))
                if idx[0] != '-' else None for idx in input_samples_idxs
            ]
        else:
            obj.input_samples = []

        if details_idx[0] != '-':
            obj.details = self.storage.details.proxy(int(UUID(details_idx)))

        return obj
Example #2
0
    def _load(self, idx):
        cls_name = self.vars['cls'][idx]

        cls = self.class_list[cls_name]
        obj = cls.__new__(cls)
        MoveChange.__init__(obj, mover=self.vars['mover'][idx])

        obj.samples = self.vars['samples'][idx]
        obj.subchanges = self.vars['subchanges'][idx]
        obj.details = self.vars['details'][idx]

        return obj
Example #3
0
    def _load(self, idx):
        cls_name = self.vars['cls'][idx]

        cls = self.class_list[cls_name]
        obj = cls.__new__(cls)
        MoveChange.__init__(obj, mover=self.vars['mover'][idx])

        obj.samples = self.vars['samples'][idx]
        obj.subchanges = self.vars['subchanges'][idx]
        obj.details = self.vars['details'][idx]
        try:
            obj.input_samples = self.vars['input_samples'][idx]
        except KeyError:  # BACKWARDS COMPATIBILITY; REMOVE IN 2.0
            obj.input_samples = None

        return obj
Example #4
0
    def _load_partial_samples(self, cls_name, samples_idxs,
                              mover_idx, details_idx):
        cls = self.class_list[cls_name]
        obj = cls.__new__(cls)
        if self.reference_by_uuid:
            if mover_idx[0] == '-':
                MoveChange.__init__(obj)
            else:
                MoveChange.__init__(
                    obj,
                    mover=self.storage.pathmovers[UUID(mover_idx)])
        else:
            MoveChange.__init__(
                obj,
                mover=self.storage.pathmovers[int(mover_idx)])

        if len(samples_idxs) > 0:
            if self.reference_by_uuid:
                samples_idxs = self.storage.to_uuid_chunks(samples_idxs)
                obj.samples = \
                    [self.storage.samples[UUID(idx)] for idx in samples_idxs]
                obj.details = self.storage.details.proxy(str(details_idx))
            else:
                obj.samples = \
                    [self.storage.samples[int(idx)] for idx in samples_idxs]
                obj.details = self.storage.details.proxy(int(details_idx))

        return obj
Example #5
0
    def _load_partial_samples(self, cls_name, samples_idxs,
                              input_samples_idxs, mover_idx, details_idx):
        cls = self.class_list[cls_name]
        obj = cls.__new__(cls)
        if self.reference_by_uuid:
            if mover_idx[0] == '-':
                MoveChange.__init__(obj)
            else:
                MoveChange.__init__(
                    obj,
                    mover=self.storage.pathmovers[UUID(mover_idx)])
        else:
            MoveChange.__init__(
                obj,
                mover=self.storage.pathmovers[int(mover_idx)])

        if self.reference_by_uuid:
            if len(samples_idxs) > 0:
                samples_idxs = self.storage.to_uuid_chunks(samples_idxs)
                input_samples_idxs = \
                    self.storage.to_uuid_chunks(input_samples_idxs)
                obj.samples = \
                    [self.storage.samples[UUID(idx)] for idx in samples_idxs]
            if len(input_samples_idxs) > 0:
                obj.input_samples = [
                    self.storage.samples[UUID(idx)]
                    for idx in input_samples_idxs]
            obj.details = self.storage.details.proxy(str(details_idx))
        else:
            if len(samples_idxs) > 0:
                obj.samples = \
                    [self.storage.samples[int(idx)] for idx in samples_idxs]
            if len(input_samples_idxs) > 0:
                obj.input_samples = [
                    self.storage.samples[int(idx)]
                    for idx in input_samples_idxs]
            obj.details = self.storage.details.proxy(int(details_idx))

        return obj