:returns: a dictionary src_group_id -> source_model.samples
338576
def get_samples_by_grp(self):
        
        return {grp.id: sm.samples for sm in self.source_models
                for grp in sm.src_groups}
1336724
def get(self, sg_id):
        
        secgroup = self.client.show_security_group(sg_id).get('security_group')
        sg_dict = self._sg_name_dict(sg_id, secgroup['security_group_rules'])
        return SecurityGroup(secgroup, sg_dict)
16800
def as_dict(self):
        
        d = {}
        _add_string(d, 'obstory_name', self.obstory_name)
        _add_string(d, 'semantic_type', self.semantic_type)
        _add_value(d, 'time_min', self.time_min)
        _add_value(d, 'time_max', self.time_max)
        _add_string(d, 'group_id', self.group_id)
        _add_string(d, 'observation_id', self.observation_id)
        _add_value(d, 'skip', self.skip)
        _add_value(d, 'limit', self.limit)
        d['meta'] = list((x.as_dict() for x in self.meta_constraints))
        return d
1111737
def _get_sampleset(model):
    """"""
    if isinstance(model, Model):
        if hasattr(model, 'sampleset'):
            w = model.sampleset()
        else:
            w = None
    else:
        w = model  # Already a sampleset
    return w
64258
def _sourced_dict(self, source=None, **kwargs):
        
        if source:
            kwargs['source'] = source
        elif self.source:
            kwargs['source'] = self.source
        return kwargs
1103019
def parse_model_group_list(path, groups):
    

    context = FilePathContext(path)
    for model_group in groups:
        if 'include' in model_group:
            include_context = context.resolve(model_group['include'])
            for reaction_id in parse_model_file(include_context):
                yield reaction_id
        else:
            for reaction_id in parse_model_group(context, model_group):
                yield reaction_id
1165545
def as_id_dict(self):
		
		d = {}
		for row in self:
			if row.experiment_id not in d:
				d[row.experiment_id] = {}
			if (row.time_slide_id, row.veto_def_name, row.datatype, row.sim_proc_id) in d[row.experiment_id]:
				# entry already exists, raise error
				raise KeyError("duplicate entries in experiment_summary table")
			d[row.experiment_id][(row.time_slide_id, row.veto_def_name, row.datatype, row.sim_proc_id)] = row.experiment_summ_id

		return d
351176
def samples(self):
        
        if self._samples is None:
            self._samples = SampleList(
                self._version,
                assistant_sid=self._solution['assistant_sid'],
                task_sid=self._solution['sid'],
            )
        return self._samples
1116064
def _sample_data(self, sample):
        
        data = {}
        if sample:
            data = {'obj': sample,
                    'id': sample.id,
                    'url': sample.absolute_url(),
                    'date_sampled': self.ulocalized_time(
                        sample.getDateSampled(), long_format=True),
                    'date_received': self.ulocalized_time(
                        sample.getDateReceived(), long_format=0),
                    }

            if sample.portal_type == "ReferenceSample":
                data['sample_type'] = None
                data['sample_point'] = None
            else:
                data['sample_type'] = self._sample_type(sample)
                data['sample_point'] = self._sample_point(sample)
        return data
219972
def get_samples(self, md5='', sha1='', sha256=''):
        
        params = {'api_key': self.api_key, 'username': self.username}
        if md5:
            params['c-md5'] = md5
        if sha1:
            params['c-sha1'] = sha1
        if sha256:
            params['c-sha256'] = sha256
        r = requests.get('{0}/samples/'.format(self.url),
                         params=params,
                         verify=self.verify,
                         proxies=self.proxies)
        if r.status_code == 200:
            result_data = json.loads(r.text)
            if 'meta' in result_data:
                if 'total_count' in result_data['meta']:
                    if result_data['meta']['total_count'] > 0:
                        return result_data
        else:
            log.error('Non-200 status code: {}'.format(r.status_code))
        return None
954150
def _sample_type(self, sample=None):
        
        data = {}
        sampletype = sample.getSampleType() if sample else None
        if sampletype:
            data = {'obj': sampletype,
                    'id': sampletype.id,
                    'title': sampletype.Title(),
                    'url': sampletype.absolute_url()}
        return data
399389
def group(self):
        
        if self.api and self.group_id:
            return self.api._get_group(self.group_id)
208167
def _get_resampler_for_grouping(self, groupby, **kwargs):
        
        return self._resampler_for_grouping(self, groupby=groupby, **kwargs)
827768
def get_sample_info(self, obj):
        
        info = self.get_base_info(obj)

        # sample type
        sample_type = obj.getSampleType()
        sample_type_uid = sample_type and sample_type.UID() or ""
        sample_type_title = sample_type and sample_type.Title() or ""

        # sample condition
        sample_condition = obj.getSampleCondition()
        sample_condition_uid = sample_condition \
            and sample_condition.UID() or ""
        sample_condition_title = sample_condition \
            and sample_condition.Title() or ""

        # storage location
        storage_location = obj.getStorageLocation()
        storage_location_uid = storage_location \
            and storage_location.UID() or ""
        storage_location_title = storage_location \
            and storage_location.Title() or ""

        # sample point
        sample_point = obj.getSamplePoint()
        sample_point_uid = sample_point and sample_point.UID() or ""
        sample_point_title = sample_point and sample_point.Title() or ""

        # container type
        container_type = sample_type and sample_type.getContainerType() or None
        container_type_uid = container_type and container_type.UID() or ""
        container_type_title = container_type and container_type.Title() or ""

        # Sampling deviation
        deviation = obj.getSamplingDeviation()
        deviation_uid = deviation and deviation.UID() or ""
        deviation_title = deviation and deviation.Title() or ""

        info.update({
            "sample_id": obj.getId(),
            "batch_uid": obj.getBatchUID() or None,
            "date_sampled": self.to_iso_date(obj.getDateSampled()),
            "sampling_date": self.to_iso_date(obj.getSamplingDate()),
            "sample_type_uid": sample_type_uid,
            "sample_type_title": sample_type_title,
            "container_type_uid": container_type_uid,
            "container_type_title": container_type_title,
            "sample_condition_uid": sample_condition_uid,
            "sample_condition_title": sample_condition_title,
            "storage_location_uid": storage_location_uid,
            "storage_location_title": storage_location_title,
            "sample_point_uid": sample_point_uid,
            "sample_point_title": sample_point_title,
            "environmental_conditions": obj.getEnvironmentalConditions(),
            "composite": obj.getComposite(),
            "client_uid": obj.getClientUID(),
            "client_title": obj.getClientTitle(),
            "contact": self.get_contact_info(obj.getContact()),
            "client_order_number": obj.getClientOrderNumber(),
            "client_sample_id": obj.getClientSampleID(),
            "client_reference": obj.getClientReference(),
            "sampling_deviation_uid": deviation_uid,
            "sampling_deviation_title": deviation_title,
            "sampling_workflow_enabled": obj.getSamplingWorkflowEnabled(),
            "remarks": obj.getRemarks(),
        })
        return info
569499
def get_model(self, sm_id):
        
        sm = self.source_models[sm_id]
        if self.source_model_lt.num_samples:
            self.source_model_lt.num_samples = sm.samples
        new = self.__class__(self.gsim_lt, self.source_model_lt, [sm],
                             self.optimize_same_id)
        new.sm_id = sm_id
        return new
1185245
def to_dict(self):
        ''''''
        d = {'groupId': self.group_id}
        members = []
        for m in self.members:
            members.append(m.to_dict())
        if members:
            d['members'] = members
        return d
212701
def get_items(self, source=None, target=None):
        
        self._groups = self.shared_dict()
        self._target_coll = target.collection
        self._src = source
        return source.query()