Adds the subjects/visits used to generate the derivatives iff there are
        any joins over them in the pipeline
498082
def _joined_ids(self):
        
        joined_prov = {}
        if self.joins_subjects:
            joined_prov['subject_ids'] = list(self.study.subject_ids)
        if self.joins_visits:
            joined_prov['visit_ids'] = list(self.study.visit_ids)
        return joined_prov
544326
def addSource(self, source, data):
    """"""
    self._aggregate(source, self._aggregators, data, self._result)
669595
function makerelation (model, relation) {
	let options = {
		as: relation.As,
		foreignKey: relation.key
	};
	let target = exp.databases[inflector.pluralize(relation.Children)];
	if (relation.Rel !== 'manyToMany') {
		exp.databases[model][relation.Rel](target, options);
	} else {
		exp.databases[model].prototype.many2many = exp.databases[model].prototype.many2many || {};
		exp.databases[model].prototype.many2many[relation.Parent] = function (id, id2) {
			if (id && id2) {
				return exp.databases[relation.Children].findcre({
					[`${model}ID`]: id,
					[`${relation.Parent}ID`]: id2
				});
			}
			return exp.databases[relation.Children].find({
				where: {
					[`${model}ID`]: id
				}
			}).then(records => {
				let all = [];
				for (const record of records) {
					all.push(exp.databases[relation.Parent].findById(record[`${relation.Parent}ID`]));
				}
				return Promise.all(all);
			});
		};
	}
}
904728
def add_implemented_interfaces(cls, interfaces):
    
    implemented = set(
        six.moves.reduce(
            lambda x, y: x.union(y),
            map(operator.attrgetter('implied'), interfaces),
            set()
        )
    )
    implemented.update(*map(
        get_implemented_interfaces,
        inspect.getmro(cls)
    ))
    setattr(cls, '__interfaces__', frozenset(implemented))
853258
protected function _addJoinTables()
    {
        $this->addTable('gems__respondents', array('gap_id_user' => 'grs_id_user'));

        if ($this->has('gap_id_organization')) {
            $this->addTable(
                    'gems__organizations',
                    array('gap_id_organization' => 'gor_id_organization'),
                    'gor',
                    false
                    );
        }
        if ($this->has('gap_id_attended_by')) {
            $this->addLeftTable(
                    'gems__agenda_staff',
                    array('gap_id_attended_by' => 'gas_id_staff'),
                    'gas',
                    false
                    );
        }
        /*
        if ($this->has('gap_id_referred_by')) {
            $this->addLeftTable(
                    array('ref_staff' => 'gems__agenda_staff'),
                    array('gap_id_referred_by' => 'ref_staff.gas_id_staff')
                    );
        } // */
        if ($this->has('gap_id_activity')) {
            $this->addLeftTable(
                    'gems__agenda_activities',
                    array('gap_id_activity' => 'gaa_id_activity'),
                    'gap',
                    false
                    );
        }
        if ($this->has('gap_id_procedure')) {
            $this->addLeftTable(
                    'gems__agenda_procedures',
                    array('gap_id_procedure' => 'gapr_id_procedure'),
                    'gapr',
                    false
                    );
        }
        if ($this->has('gap_id_location')) {
            $this->addLeftTable(
                    'gems__locations',
                    array('gap_id_location' => 'glo_id_location'),
                    'glo',
                    false
                    );
        }
    }
808300
def addRelation(self, link):
        '''
        
        '''
        if isinstance(link, Relation):
            self.internalLinks.append(link)
        else:
            raise TypeError(
                'link Type should be InternalLink, not %s' % type(link))
1121643
def addRelation(sourceSynset,relationName,targetSynset):
    
    if not isinstance(sourceSynset, Synset):
        raise TypeError("sourceSynset not Synset instance")
    elif not isinstance(targetSynset, Synset):
        raise TypeError("targetSynset not Synset instance")
    elif relationName not in RELATION_NAMES:
        raise TypeError("relationName not in RELATION_NAMES")
    else:
        sourceSynset.addRelation(
            Relation(relationName,targetSynset)
            )
        return sourceSynset
125943
def _fill_empty_sessions(self, fill_subjects, fill_visits):
        
        if fill_subjects is None:
            fill_subjects = [s.id for s in self.subjects]
        if fill_visits is None:
            fill_visits = [v.id for v in self.complete_visits]
        for subject_id in fill_subjects:
            try:
                subject = self.subject(subject_id)
            except ArcanaNameError:
                subject = self._subjects[subject_id] = Subject(
                    subject_id, [], [], [])
            for visit_id in fill_visits:
                try:
                    subject.session(visit_id)
                except ArcanaNameError:
                    session = Session(subject_id, visit_id, [], [])
                    subject._sessions[visit_id] = session
                    try:
                        visit = self.visit(visit_id)
                    except ArcanaNameError:
                        visit = self._visits[visit_id] = Visit(
                            visit_id, [], [], [])
                    visit._sessions[subject_id] = session
201116
public void addPrimaryQuerySources(Collection<AliasedQuerySource> sources) {
        for (AliasedQuerySource source : sources) {
            internalAddQuerySource(source);
            if (source.getResultType() instanceof ListType) {
                isSingularValue = false;
            }
        }
    }
593087
def add_copies(self, node, parent, elem, minel):
        """"""
        rep = 0 if minel is None else int(minel.arg) - 1
        for i in range(rep):
            parent.append(copy.deepcopy(elem))
1008713
def _add_scheme():
    
    lists = [
        urllib.parse.uses_relative,
        urllib.parse.uses_netloc,
        urllib.parse.uses_query,
    ]
    for l in lists:
        l.append('mongodb')
656253
def add_eager_constraints(self, models):
        
        self._query.where_in(self.get_foreign_key(), self.get_keys(models))
908970
private void createMissingSpanningRelations(SDocumentGraph graph,
    FastInverseMap<Long, SNode> nodeByRankID,
    TreeMap<Long, SToken> tokenByIndex,
    Map<String, ComponentEntry> componentForSpan,
    AtomicInteger numberOfRelations)
  {

    // add the missing spanning relations for each continuous span of the graph
    for (SSpan span : graph.getSpans())
    {
      long pre=1;
      RelannisNodeFeature featSpan = RelannisNodeFeature.extract(span);      
      ComponentEntry spanComponent = componentForSpan.get(span.getId());
      if (spanComponent != null && featSpan != null 
        && featSpan.getLeftToken() >= 0 && featSpan.getRightToken() >= 0)
      {
        for (long i = featSpan.getLeftToken(); i <= featSpan.getRightToken();
          i++)
        {
          SToken tok = tokenByIndex.get(i);
          if (tok != null)
          {
            boolean missing = true;
            List<SRelation<SNode, SNode>> existingRelations = graph.getRelations(span.getId(),
              tok.getId());
            if (existingRelations != null)
            {
              for (Relation e : existingRelations)
              {
                if (e instanceof SSpanningRelation)
                {
                  missing = false;
                  break;
                }
              }
            } // end if relations exist

            if (missing)
            {
              String type = "c";

              SLayer layer
                = findOrAddSLayer(spanComponent.getNamespace(), graph);

              createNewRelation(graph, span, tok, null, type,
                spanComponent.getId(), layer,
                pre++, nodeByRankID, numberOfRelations);
            }
          } // end if token exists
        } // end for each covered token index
      }
    } // end for each span
  }
1079984
private Map<String, Object> populateRelations(List<String> relations, Object[] o)
    {
        Map<String, Object> relationVal = new HashMap<String, Object>(relations.size());
        int counter = 1;
        for (String r : relations)
        {
            relationVal.put(r, o[counter++]);
        }
        return relationVal;
    }
1218348
function addTracingToResolvers(schema) {
  // XXX this is a hacky way of making sure that the schema only gets decorated
  // with tracer once.
  if (schema._apolloTracerApplied) {
    // console.log('Tracing already added to resolve functions. Not adding again.');
    return;
  }
  // eslint-disable-next-line no-param-reassign
  schema._apolloTracerApplied = true;

  forEachField(schema, (field, typeName, fieldName) => {
    const functionName = `${typeName}.${fieldName}`;
    if (field.resolve) {
      // eslint-disable-next-line no-param-reassign
      field.resolve = decorateWithTracer(
        field.resolve,
        { type: 'resolve', functionName },
      );
    }
  });
}
824334
def addReferences(self, reference, service_uids):
        
        # TODO Workflow - Analyses. Assignment of refanalysis to Instrument
        addedanalyses = []
        wf = getToolByName(self, 'portal_workflow')
        bsc = getToolByName(self, 'bika_setup_catalog')
        bac = getToolByName(self, 'bika_analysis_catalog')
        ref_type = reference.getBlank() and 'b' or 'c'
        ref_uid = reference.UID()
        postfix = 1
        for refa in reference.getReferenceAnalyses():
            grid = refa.getReferenceAnalysesGroupID()
            try:
                cand = int(grid.split('-')[2])
                if cand >= postfix:
                    postfix = cand + 1
            except:
                pass
        postfix = str(postfix).zfill(int(3))
        refgid = 'I%s-%s' % (reference.id, postfix)
        for service_uid in service_uids:
            # services with dependents don't belong in references
            service = bsc(portal_type='AnalysisService', UID=service_uid)[0].getObject()
            calc = service.getCalculation()
            if calc and calc.getDependentServices():
                continue
            ref_analysis = reference.addReferenceAnalysis(service)

            # Set ReferenceAnalysesGroupID (same id for the analyses from
            # the same Reference Sample and same Worksheet)
            # https://github.com/bikalabs/Bika-LIMS/issues/931
            ref_analysis.setReferenceAnalysesGroupID(refgid)
            ref_analysis.setInstrument(self)
            ref_analysis.reindexObject()
            addedanalyses.append(ref_analysis)

        # Set DisposeUntilNextCalibrationTest to False
        if (len(addedanalyses) > 0):
            self.getField('DisposeUntilNextCalibrationTest').set(self, False)

        return addedanalyses
1184913
public function addExtraIndices()
	{
		/**
		 * A collection of indexed columns. The keys is the column name
		 * (concatenated with a comma in the case of multi-col index), the value is
		 * an array with the names of the indexes that index these columns. We use
		 * it to determine which additional indexes must be created for foreign
		 * keys. It could also be used to detect duplicate indexes, but this is not
		 * implemented yet.
		 * @var array
		 */
		$_indices = array();

		$this->collectIndexedColumns('PRIMARY', $this->getPrimaryKey(), $_indices);

		$_tableIndices = array_merge($this->getIndices(), $this->getUnices());
		foreach ($_tableIndices as $_index) {
		  $this->collectIndexedColumns($_index->getName(), $_index->getColumns(), $_indices);
		}

		// we're determining which tables have foreign keys that point to this table,
		// since MySQL needs an index on any column that is referenced by another table
		// (yep, MySQL _is_ a PITA)
		$counter = 0;
		foreach ($this->getReferrers() as $foreignKey) {
			$referencedColumns = $foreignKey->getForeignColumnObjects();
			$referencedColumnsHash = $this->getColumnList($referencedColumns);
		  if (!array_key_exists($referencedColumnsHash, $_indices)) {
				// no matching index defined in the schema, so we have to create one
				$index = new Index();
				$index->setName(sprintf('I_referenced_%s_%s', $foreignKey->getName(), ++$counter));
				$index->setColumns($referencedColumns);
				$index->resetColumnSize();
				$this->addIndex($index);
				// Add this new index to our collection, otherwise we might add it again (bug #725)
				$this->collectIndexedColumns($index->getName(), $referencedColumns, $_indices);
			}
		}

		// we're adding indices for this table foreign keys
		foreach ($this->getForeignKeys() as $foreignKey) {
			$localColumns = $foreignKey->getLocalColumnObjects();
			$localColumnsHash = $this->getColumnList($localColumns);
			if (!array_key_exists($localColumnsHash, $_indices)) {
				// no matching index defined in the schema, so we have to create one. MySQL needs indices on any columns that serve as foreign keys. these are not auto-created prior to 4.1.2
				$index = new Index();
				$index->setName(substr_replace($foreignKey->getName(), 'FI_',  strrpos($foreignKey->getName(), 'FK_'), 3));
				$index->setColumns($localColumns);
				$index->resetColumnSize();
				$this->addIndex($index);
				$this->collectIndexedColumns($index->getName(), $localColumns, $_indices);
			}
		}
	}