Get a transform in the chain from its name.
327910
def get(self, class_name):
        """"""
        for transform in self.cpu_transforms + self.gpu_transforms:
            if transform.__class__.__name__ == class_name:
                return transform
1236225
def extract_chain_id(raw_v):
    '''
    
    '''
    above_id_offset = raw_v - CHAIN_ID_OFFSET
    if above_id_offset < 0:
        if raw_v in {0, 1}:
            return (None, raw_v + V_OFFSET)
        elif raw_v in {27, 28}:
            return (None, raw_v)
        else:
            raise ValueError("v %r is invalid, must be one of: 0, 1, 27, 28, 35+")
    else:
        (chain_id, v_bit) = divmod(above_id_offset, 2)
        return (chain_id, v_bit + V_OFFSET)
1274985
def get_chain(self, name, table="filter"):
        
        return [r for r in self.rules if r["table"] == table and r["chain"] == name]
1017790
def _get_mainchain(df, invert):
        """"""
        if invert:
            mc = df[(df['atom_name'] != 'C') &
                    (df['atom_name'] != 'O') &
                    (df['atom_name'] != 'N') &
                    (df['atom_name'] != 'CA')]
        else:
            mc = df[(df['atom_name'] == 'C') |
                    (df['atom_name'] == 'O') |
                    (df['atom_name'] == 'N') |
                    (df['atom_name'] == 'CA')]
        return mc
358401
double getChainArea(int chain) {
		int chainIndex = getChainIndex_(chain);
		double v = m_chainAreas.read(chainIndex);
		if (NumberUtils.isNaN(v)) {
			updateChainAreaAndPerimeter_(chain);
			v = m_chainAreas.read(chainIndex);
		}

		return v;
	}
832637
def get(self, block, name):
        
        return self._kvs.get(self._key(block, name))
623976
function getTransformer(name) {
    if (name in transformers) {
      return transformers[name]
    }
    const transformer = toTransformer(name)
    transformers[name] = transformer ? jstransformer(transformer) : false
    return transformers[name]
  }
1137214
def transform_incoming(self, son, collection):
        

        def transform_value(value):
            if isinstance(value, collections.MutableMapping):
                if "_id" in value and "_ns" in value:
                    return DBRef(value["_ns"], transform_value(value["_id"]))
                else:
                    return transform_dict(SON(value))
            elif isinstance(value, list):
                return [transform_value(v) for v in value]
            return value

        def transform_dict(object):
            for (key, value) in object.items():
                object[key] = transform_value(value)
            return object

        return transform_dict(SON(son))
1214695
def get_chain_mapping(self, pdb_name1, pdb_name2):
        ''''''
        raise Exception('Implement. Map pdb_namex to its equivalence class, call get_representative_chain_mapping, and something something.')
        pprint.pprint(self.chain_mapping)

        d = {}
        for pdb1_chain_id, matched_chain_list in self.chain_mapping[(pdb_name1, pdb_name2)].iteritems():
            d[pdb1_chain_id] = matched_chain_list.get_related_chains_ids(pdb_name2)
        return d
1087042
def get_next_name(old, fmt='%i'):
    """"""
    nums = re.findall('\d+', old)
    if not nums:
        raise ValueError("Could not get the next name because the old name "
                         "has no numbers in it")
    num0 = nums[-1]
    num1 = str(int(num0) + 1)
    return old[::-1].replace(num0[::-1], num1[::-1], 1)[::-1]
290043
private String transformPropertyName(Object property) {
    if (property == null) {
      return null;
    }

    String propertyStr = property.toString();
    if (propertyStr.indexOf('_') == -1) {
      return propertyStr;
    }
    return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, propertyStr);
  }
1063148
def get_index_by_name(self, name):
        """"""
        for i in range(self.n_blocks):
            if self.get_block_name(i) == name:
                return i
        raise KeyError('Block name ({}) not found'.format(name))
506961
def transform(elem, chain_CT_CQ, max_gap):
    """"""
    (chain, CT, CQ) = chain_CT_CQ
    start, end = max(elem['start'], chain.tStart) - chain.tStart, min(elem['end'], chain.tEnd) - chain.tStart

    assert np.all( (CT[:,1] - CT[:,0]) == (CQ[:,1] - CQ[:,0]) )
    to_chrom = chain.qName
    to_gab_start = chain.qStart

    start_idx = np.where( CT[:,1] > start )[0][0]
    end_idx = np.where( CT[:,0] < end )[0][-1]

    if start_idx > end_idx: #maps to a gap region on the other species
        return []

    ## apply the gap threshold
    if max_gap >= 0 and start_idx < end_idx - 1:
        if np.max(CT[(start_idx+1):end_idx,0] - CT[start_idx:(end_idx-1),1]) > max_gap or np.max(CQ[(start_idx+1):end_idx,0] - CQ[start_idx:(end_idx-1),1]) > max_gap:
            return []

    assert start < CT[start_idx, 1]
    assert  CT[end_idx, 0] < end
    to_start = CQ[start_idx, 0] + max(0, start - CT[start_idx,0]) # correct if on middle of interval
    to_end = CQ[end_idx, 1] - max(0, CT[end_idx, 1] - end)        # idem

    if start_idx == end_idx: #elem falls in a single run of matches
        slices = [(to_start, to_end)]
    else:
        slices = [(to_start, CQ[start_idx,1])]
        slices += [(CQ[i,0], CQ[i,1]) for i in range(start_idx+1, end_idx)]
        slices.append( (CQ[end_idx,0], to_end) )
    if chain.qStrand == '-':
        Sz = chain.qEnd - chain.qStart
        slices =  [(Sz-t[1], Sz-t[0]) for t in slices]
    return [(to_chrom, to_gab_start + t[0], to_gab_start + t[1], elem['id']) for t in slices]
249486
public Transform getTransform(String functionName) {
        Function function = Function.fromString(functionName);

        switch (function) {
            case DIVIDE:
                return new MetricReducerOrMappingTransform(new DivideValueReducerOrMapping());
            case SUM:
                return new MetricReducerOrMappingTransform(new SumValueReducerOrMapping());
            case MULTIPLY:
            case SCALE:
                return new MetricReducerOrMappingTransform(new ScaleValueReducerOrMapping());
            case DIFF:
                return new MetricReducerOrMappingTransform(new DiffValueReducerOrMapping());
            case PERCENTILE:
                return new MetricReducerOrMappingWithConstantTransform(new PercentileValueReducerOrMapping());
            case DEVIATION:
                return new MetricReducerOrMappingWithConstantTransform(new DeviationValueReducerOrMapping());
            case AVERAGE:
                return new MetricReducerTransform(new AverageValueReducer());
            case MIN:
                return new MetricReducerTransform(new MinValueReducer());
            case MAX:
                return new MetricReducerTransform(new MaxValueReducer());
            case PROPAGATE:
                return new PropagateTransform();
            case UNION:
                return new MetricUnionTransform(new UnionValueUnionReducer());
            case GROUP:
                return new GroupTransformWrapUnion();
            case COUNT:
                return new CountTransformWrapUnion();
            case SORT:
                return new SortTransformWrapAboveAndBelow();
            case DOWNSAMPLE:
                return new DownsampleTransform();
            case INTEGRAL:
                return new IntegralTransform();
            case JOIN:
                return new JoinTransform();
            case LIMIT:
                return new LimitTransform();
            case RANGE:
                return new RangeTransformWrap();
            case NORMALIZE:
                return new NormalizeTransformWrap();
            case FILL:
                return new FillTransform();
            case FILL_CALCULATE:
                return new FillCalculateTransform();
            case ALIAS:
                return new AliasTransform();
            case ALIASBYTAG:
                return new AliasByTagTransform();
            case INCLUDE:
                return new IncludeTransform();
            case EXCLUDE:
                return new ExcludeTransformWrap();
            case HW_FORECAST:
                return new HoltWintersForecast(_tsdbService);
            case HW_DEVIATION:
                return new HoltWintersDeviation(_tsdbService);
            case IDENTITY:
                return new IdentityTransform();
            case ZEROIFMISSINGSUM:
                return new ZeroIfMissingSum();
            case ABOVE:
                return new MetricFilterWithInteralReducerTransform(new AboveValueFilter());
            case BELOW:
                return new MetricFilterWithInteralReducerTransform(new BelowValueFilter());
            case HIGHEST:
                return new MetricFilterWithInteralReducerTransform(new HighestValueFilter());
            case LOWEST:
                return new MetricFilterWithInteralReducerTransform(new LowestValueFilter());
            case ABSOLUTE:
                return new MetricMappingTransform(new AbsoluteValueMapping());
            case DERIVATIVE:
                return new MetricMappingTransform(new DerivativeValueMapping());
            case CULL_ABOVE:
                return new MetricMappingTransform(new CullAboveValueMapping());
            case CULL_BELOW:
                return new MetricMappingTransform(new CullBelowValueMapping());
            case CONSECUTIVE:
                return new MetricMappingTransform(new ConsecutiveValueMapping());
            case LOG:
                return new MetricMappingTransform(new LogValueMapping());
            case SHIFT:
                return new MetricMappingTransform(new ShiftValueMapping());
            case MOVING:
                return new MetricMappingTransform(new MovingValueMapping());
            case SUM_V:
                return new MetricZipperTransform(new SumValueZipper());
            case SCALE_V:
                return new MetricZipperTransform(new ScaleValueZipper());
            case DIFF_V:
                return new MetricZipperTransform(new DiffValueZipper());
            case DIVIDE_V:
                return new MetricZipperTransform(new DivideValueZipper());
            case NORMALIZE_V:
                return new MetricZipperTransform(new DivideValueZipper());
            case ANOMALY_STL:
                return new AnomalySTLTransform();
            case GROUPBY:
            	return new GroupByTransform(this);
            case GROUPBYTAG:
                return new GroupByTagTransform(this);
            case ANOMALY_DENSITY:
                return new AnomalyDetectionGaussianDensityTransform();
            case ANOMALY_ZSCORE:
                return new AnomalyDetectionGaussianZScoreTransform();
            case ANOMALY_KMEANS:
                return new AnomalyDetectionKMeansTransform();
            case ANOMALY_RPCA:
                return new AnomalyDetectionRPCATransform();
            case INTERPOLATE:
                return new InterpolateTransform();
            default:
                throw new UnsupportedOperationException(functionName);
        } // end switch
    }
621599
private <IN1, IN2, OUT> Collection<Integer> transformTwoInputTransform(TwoInputTransformation<IN1, IN2, OUT> transform) {

		Collection<Integer> inputIds1 = transform(transform.getInput1());
		Collection<Integer> inputIds2 = transform(transform.getInput2());

		// the recursive call might have already transformed this
		if (alreadyTransformed.containsKey(transform)) {
			return alreadyTransformed.get(transform);
		}

		List<Integer> allInputIds = new ArrayList<>();
		allInputIds.addAll(inputIds1);
		allInputIds.addAll(inputIds2);

		String slotSharingGroup = determineSlotSharingGroup(transform.getSlotSharingGroup(), allInputIds);

		streamGraph.addCoOperator(
				transform.getId(),
				slotSharingGroup,
				transform.getCoLocationGroupKey(),
				transform.getOperator(),
				transform.getInputType1(),
				transform.getInputType2(),
				transform.getOutputType(),
				transform.getName());

		if (transform.getStateKeySelector1() != null || transform.getStateKeySelector2() != null) {
			TypeSerializer<?> keySerializer = transform.getStateKeyType().createSerializer(env.getConfig());
			streamGraph.setTwoInputStateKey(transform.getId(), transform.getStateKeySelector1(), transform.getStateKeySelector2(), keySerializer);
		}

		streamGraph.setParallelism(transform.getId(), transform.getParallelism());
		streamGraph.setMaxParallelism(transform.getId(), transform.getMaxParallelism());

		for (Integer inputId: inputIds1) {
			streamGraph.addEdge(inputId,
					transform.getId(),
					1
			);
		}

		for (Integer inputId: inputIds2) {
			streamGraph.addEdge(inputId,
					transform.getId(),
					2
			);
		}

		return Collections.singleton(transform.getId());
	}
377795
def by_alias(cls, name: str) -> "TxType":
        """"""
        return {
            "get": TxType.Get,
            "check": TxType.Check,
            "delete": TxType.Delete,
            "save": TxType.Update,
        }[name]
240195
def obj(extract=None, child_transform=None, transform=None):
  """"""
  return lambda source: get_obj(source, extract, child_transform, transform)