For GO terms, returns F, C, or P corresponding to its aspect
482399
def go_aspect(self, go_term):
        
        if not go_term.startswith("GO:"):
            return None
        else:
            # Check ancestors for root terms
            if self.is_molecular_function(go_term):
                return 'F'
            elif self.is_cellular_component(go_term):
                return 'C'
            elif self.is_biological_process(go_term):
                return 'P'
43955
def _or_join(self, terms):
        

        if isinstance(terms, (tuple, list)):
            if len(terms) > 1:
                return '(' + ' OR '.join(terms) + ')'
            else:
                return terms[0]
        else:
            return terms
1107053
def terms(self):
        """"""
        terms = PropertyTerms(
            self.name,
            self.__class__,
            self._args,
            self._kwargs,
            self.meta
        )
        return terms
65624
def p_foo_stmt(p):
    ""
    expr1 = p[1][1][0]
    expr2 = p[3][1][0]
    ident = expr1.ret
    args1 = expr1.args
    args2 = expr2.args
    p[0] = node.let(ret=ident,
                    args=node.expr("or", node.expr_list([args1, args2])))
924711
def obfn_fvar(self):
        

        if self.opt['fEvalX']:
            return self.X
        else:
            return self.cnst_c() - self.cnst_B(self.Y)
1301263
def color_func(func_name):
    
    if str(func_name).isdigit():
        return term_color(int(func_name))
    return globals()[func_name]
603347
def getAspect(obj1, obj2, aspList):
    
    ap = _getActivePassive(obj1, obj2)
    aspDict = _aspectDict(ap['active'], ap['passive'], aspList)
    if not aspDict:
        aspDict = {
            'type': const.NO_ASPECT,
            'orb': 0,
            'separation': 0,
        } 
    aspProp = _aspectProperties(ap['active'], ap['passive'], aspDict)
    return Aspect(aspProp)
919448
def get_aspect(self, xspan, yspan):
        
        if isinstance(self.aspect, (int, float)):
            return self.aspect
        elif self.aspect == 'square':
            return 1
        elif self.aspect == 'equal':
            return xspan/yspan
        return 1
444125
def p_expr_add_term(self, args):
        '  '
        op = 'add' if args[1].attr == '+' else 'subtract'
        return AST(op, [args[0], args[2]])
320584
def str2actfunc(act_func):
    """"""
    if act_func == 'sigmoid':
        return tf.nn.sigmoid

    elif act_func == 'tanh':
        return tf.nn.tanh

    elif act_func == 'relu':
        return tf.nn.relu
81036
def F(self, **kwargs):
        '''
        
        '''
        Eg = self.Eg_Gamma_0(**kwargs)
        Delta_SO = self.Delta_SO(**kwargs)
        Ep = self.Ep(**kwargs)
        meff = self.meff_e_Gamma_0(**kwargs)
        return (1./meff-1-(Ep*(Eg+2.*Delta_SO/3.))/(Eg*(Eg+Delta_SO)))/2
958092
private Term evalLangMatches(Function term) {
		final String SELECT_ALL = "*";
		
		/*
		 * Evaluate the first term
		 */
		Term teval1 = eval(term.getTerm(0));
		if (teval1 == null) {
			return valueNull; // ROMAN (10 Jan 2017): not valueFalse
		}
		/*
		 * Evaluate the second term
		 */
		Term innerTerm2 = term.getTerm(1);
		if (innerTerm2 == null) {
			return valueNull; // ROMAN (10 Jan 2017): not valueFalse
		}

		/*
		 * Term checks
		 */
		if (teval1 instanceof Constant && innerTerm2 instanceof Constant) {
			String lang1 = ((Constant) teval1).getValue();
			String lang2 = ((Constant) innerTerm2).getValue();	
			if (lang2.equals(SELECT_ALL)) {
				if (lang1.isEmpty()) 
					return termFactory.getFunctionIsNull(teval1);
				else 
					return termFactory.getFunctionIsNotNull(teval1);
			} 
			else {
				return termFactory.getBooleanConstant(lang1.equals(lang2));
			}
		} 
		else if (teval1 instanceof Variable && innerTerm2 instanceof Constant) {
			Variable var = (Variable) teval1;
			Constant lang = (Constant) innerTerm2;
			if (lang.getValue().equals(SELECT_ALL)) {
				// The char * means to get all languages
				return termFactory.getFunctionIsNotNull(var);
			} else {
				return termFactory.getFunctionEQ(var, lang);
			}
		} 
		else if (teval1 instanceof Function && innerTerm2 instanceof Function) {
			Function f1 = (Function) teval1;
			Function f2 = (Function) innerTerm2;
			if(f1.isOperation()){
				return term;
			}
			return evalLangMatches(termFactory.getLANGMATCHESFunction(f1.getTerm(0),
					f2.getTerm(0)));
		} 
		else {
			return term;
		}
	}
283968
def __or(funcs, args):
    
    results = []
    for f in funcs:
        result = f(args)
        if result:
            results.extend(result)
    return results
859243
def _get_go_name(self, goobj):
        """"""
        if 'goobj2fncname' not in self.kws:
            return goobj.name.replace(",", "\n")
        # Return GO Term name edited by user-provided function
        return self.kws['goobj2fncname'](goobj)
77415
def fmtd_sub_expr_str(self):
        """"""
        result = u"{}({}".format(self.normalized_func,
                                 self._metric_name)

        if self._dimensions is not None:
            result += "{" + self.dimensions_str + "}"

        if self._period != _DEFAULT_PERIOD:
            result += ", {}".format(self._period)

        result += ")"

        result += " {} {}".format(self._operator,
                                  self._threshold)

        if self._periods != _DEFAULT_PERIODS:
            result += " times {}".format(self._periods)

        return result
872709
def _compute_magnitude_term(self, C, rup):
        
        return C['c2'] * (rup.mag - 8.0) + C['c3'] * (rup.mag - 8.0) ** 2
883769
def handle_keywords(self, func, node, offset=0):
        '''
        
        '''
        func_argument_names = {}
        for i, arg in enumerate(func.args.args[offset:]):
            assert isinstance(arg, ast.Name)
            func_argument_names[arg.id] = i

        nargs = len(func.args.args) - offset
        defaults = func.args.defaults
        keywords = {func_argument_names[kw.arg]: kw.value
                    for kw in node.keywords}
        node.args.extend([None] * (1 + max(keywords.keys()) - len(node.args)))

        replacements = {}
        for index, arg in enumerate(node.args):
            if arg is None:
                if index in keywords:
                    replacements[index] = deepcopy(keywords[index])
                else:  # must be a default value
                    replacements[index] = deepcopy(defaults[index - nargs])
        return replacements