return 1 if armed, 0 if not
489893
def armed(HEARTBEAT):
    ''''''
    from . import mavutil
    if HEARTBEAT.type == mavutil.mavlink.MAV_TYPE_GCS:
        self = mavutil.mavfile_global
        if self.motors_armed():
            return 1
        return 0
    if HEARTBEAT.base_mode & mavutil.mavlink.MAV_MODE_FLAG_SAFETY_ARMED:
        return 1
    return 0
460466
def _call(self, x, out=None):
        """"""
        if out is None:
            out = self.range.zero()
        else:
            out.set_zero()

        out[self.index] = x
        return out
378991
def AA(n):
    """"""
    if (n<=1):return Context('10\n00')
    else:
        AA1=AA(n-1)
        r1 = C1(2**(n-1),2**(n-1)) - AA1
        r2 = AA1 - AA1
        return r1 + r2
506655
def choose_one(things):
    """"""
    choice = SystemRandom().randint(0, len(things) - 1)
    return things[choice].strip()
1031300
def one(self, command, params=None):
        
        dr = self.query(command, params)
        if dr['rows']:
            return dr['rows'][0]
        else:
            return None
959211
def check_candidate(a, d, n, s):
    """"""
    if pow(a, d, n) == 1:
        return False
    for i in range(s):
        if pow(a, 2 ** i * d, n) == n - 1:
            return False
    return True
66525
function onetime() {
        if (called) return value;

        called = 1;
        value = fn.apply(this, arguments);
        fn = null;

        return value;
      }
438214
def relMatches(rel_attr, target_rel):
    """"""
    # XXX: TESTME
    rels = rel_attr.strip().split()
    for rel in rels:
        rel = rel.lower()
        if rel == target_rel:
            return 1

    return 0
298979
def check_alpha(a):
    

    a = check_1d(a, "alpha")
    if any(map(lambda d: d <= 0, a)):
        raise Exception('Alpha cannot be 0 or negative')

    return a
378491
def uand(self):
        """"""
        return reduce(operator.and_, self._items, self.ftype.box(1))
823387
def get_damage(self, amount: int, target) -> int:
		
		if target.immune:
			self.log("%r is immune to %s for %i damage", target, self, amount)
			return 0
		return amount
86495
def p_if_statement_1(self, p):
        """"""
        p[0] = self.asttypes.If(predicate=p[3], consequent=p[5])
        p[0].setpos(p)
508107
function ( obj, arg ) {
		var min = 0,
		    max = obj.length - 1,
		    idx, val;

		while ( min <= max ) {
			idx = Math.floor( ( min + max ) / 2 );
			val = obj[idx];

			if ( val < arg ) {
				min = idx + 1;
			}
			else if ( val > arg ) {
				max = idx - 1;
			}
			else {
				return idx;
			}
		}

		return -1;
	}
435563
function (target, array) {
    if (array.length === 0) {
      return -1
    }
    var index = this.findLowerBound(target, array)
    if (index < 0) {
      return 0
    } else if (index >= array.length - 1) {
      return array.length - 1
    } else {
      var middle = (array[index] + array[index + 1]) / 2
      return target <= middle ? index : index + 1
    }
  }
727711
function (target, array) {
    var start = 0
    var length = array.length
    while (length > 0) {
      var half = length >> 1
      var middle = start + half
      if (array[middle] <= target) {
        length = length - 1 - half
        start = middle + 1
      } else {
        length = half
      }
    }
    return start - 1
  }
1374683
def _call(self, x):
        """"""

        sum_constr = abs(x.ufuncs.sum() / self.diameter - 1) <= self.sum_rtol

        nonneq_constr = x.ufuncs.greater_equal(0).asarray().all()

        if sum_constr and nonneq_constr:
            return 0
        else:
            return np.inf
1262983
def numberp(v):
    """"""
    return (not(isinstance(v, bool)) and
            (isinstance(v, int) or isinstance(v, float)))