handle rally add
760756
def cmd_rally_add(self, args):
        ''''''
        if len(args) < 1:
            alt = self.settings.rallyalt
        else:
            alt = float(args[0])

        if len(args) < 2:
            break_alt = self.settings.rally_breakalt
        else:
            break_alt = float(args[1])

        if len(args) < 3:
            flag = self.settings.rally_flags
        else:
            flag = int(args[2])
            #currently only supporting autoland values:
            #True (nonzero) and False (zero)
            if (flag != 0):
                flag = 2

        if not self.have_list:
            print("Please list rally points first")
            return

        if (self.rallyloader.rally_count() > 4):
            print ("Only 5 rally points possible per flight plan.")
            return

        try:
            latlon = self.module('map').click_position
        except Exception:
            print("No map available")
            return
        if latlon is None:
            print("No map click position available")
            return

        land_hdg = 0.0

        self.rallyloader.create_and_append_rally_point(latlon[0] * 1e7, latlon[1] * 1e7, alt, break_alt, land_hdg, flag)
        self.send_rally_points()
        print("Added Rally point at %s %f %f, autoland: %s" % (str(latlon), alt, break_alt, bool(flag & 2)))
322876
function() {
      _.bindAll(this, 'addOne', 'addAll', 'render');

      this.input    = this.$("#new-todo");

      Todos.bind('add',     this.addOne);
      Todos.bind('refresh', this.addAll);
      Todos.bind('all',     this.render);

      Todos.fetch();
    }
990005
def rallyloader(self):
        ''''''
        if not self.target_system in self.rallyloader_by_sysid:
            self.rallyloader_by_sysid[self.target_system] = mavwp.MAVRallyLoader(self.settings.target_system,
                                                                                 self.settings.target_component)
        return self.rallyloader_by_sysid[self.target_system]
923758
def add(self, name, handler, group_by=None, aggregator=None):
        """"""
        assert self.batch is not None, "No active batch, call start() first"

        items = self.batch.setdefault(name, collections.OrderedDict())
        if group_by is None:
            # None is special as it means no grouping. In this case we must store all
            # the different handlers and call them all.
            items.setdefault(group_by, []).append((None, handler))
        elif aggregator is not None:
            agg = items.get(group_by, [(None, None)])[0][0]
            items[group_by] = [(aggregator(agg), handler)]
        else:
            items[group_by] = [(None, handler)]
105202
function pushData(entry, data, token) {
  if (entry.con === 2) {
    throw injectError(new Error('Finished pair cannot have more values'),
      token);
  }
  if (token) {
    data.line = token.line;
    data.column = token.column;
  }
  let wrappedData = wrapData(entry, data, token);
  if (entry.comment) {
    entry.comment = false;
    return;
  }
  if (entry.con === 1) {
    if (entry.tail == null) {
      // Welp, if tail is missing, head is missing too (of course)
      // I don't think this will ever be called..
      entry.head = entry.tail = new PairValue(null, wrappedData);
    } else {
      // If not, just attach the value.
      entry.tail.cdr = wrappedData;
    }
    entry.con = 2;
  } else {
    let pair = new PairValue(wrappedData, null);
    if (entry.tail == null) {
      // Welp, if tail is missing, head is missing too (of course)
      entry.head = entry.tail = pair;
    } else {
      // If not, just attach the value.
      entry.tail.cdr = pair;
      entry.tail = pair;
    }
  }
  if (token) {
    entry.head.line = token.line;
    entry.head.column = token.column;
  }
}
1231321
def reindex(self):
        ''''''
        for i in range(self.rally_count()):
            self.rally_points[i].count = self.rally_count()
            self.rally_points[i].idx = i
        self.last_change = time.time()
167362
def add(self, handler):
        ''' 

        '''
        self._handlers.append(handler)

        # make sure there is at most one static path
        static_paths = set(h.static_path() for h in self.handlers)
        static_paths.discard(None)
        if len(static_paths) > 1:
            raise RuntimeError("More than one static path requested for app: %r" % list(static_paths))
        elif len(static_paths) == 1:
            self._static_path = static_paths.pop()
        else:
            self._static_path = None
422414
function addEvent(eventName, {
    onElement,
    withCallback,
    avoidDuplicate = true,
    once = false,
    useCapture = false} = { }, thisArg) {
    let element = onElement || []
    if (utils.isString(element)) {
        element =  document.querySelectorAll(element)
    }
    function handler(event) {
        if (utils.isFunction(withCallback)) {
            withCallback.call(thisArg, event, this)
        }
        if (once) {
            handler.destroy();
        }
    }
    handler.destroy = function() {
        each(element, (el) => {
            const events = getNodeEvents(el, eventName, handler);
            if (events.found) { events.all.splice(events.evt, 1); }
            if (el.removeEventListener) el.removeEventListener(eventName, handler, useCapture)
        })
    }
    each(element, (el) => {
        const events = getNodeEvents(el, eventName, handler);
        if (el.addEventListener && (avoidDuplicate && !events.found) || !avoidDuplicate) {
            el.addEventListener(eventName, handler, useCapture)
            events.all.push({ eventName: eventName, fn: handler});
        }
    })
    return handler
}
161271
function handler(instance, context, func, index, callback) {
	return function() {
		var old = instance.results[index];
		instance.results[index] = tryExpr(func, context);
		if (old === instance.results[index])
			return;
		if (instance.dependenciesCount === 1 || !Interpolable.allowDelayedUpdate)
			callback(instance.output(context), 'set');
		else if (!instance.willFire)
			instance.willFire = context.delay(function() { // call on nextTick to manage other dependencies update without multiple rerender
				if (instance.willFire) {
					instance.willFire = null;
					callback(instance.output(context), 'set');
				}
			}, 0);
	};
}
17542
function handleNotifyNext(e) {
  if (notifyOfNextSubs[e.type].length === 0) return;
  e.persist = blankFunction;
  const reNotifyOfNext = [];
  const reNotifyOfNextIDs = {};
  notifyOfNextSubs[e.type].forEach(sub => {
    if (sub.callback(e) === 'reNotifyOfNext') {
      reNotifyOfNextIDs[sub.id] = reNotifyOfNext.push(sub) - 1;
    }
  });
  notifyOfNextSubs[e.type] = reNotifyOfNext;
  subsIDs[e.type] = reNotifyOfNextIDs;
}
130552
function pushToRP (event) {
    if (source) {
      console.log('updating RP: changed')
      source.postMessage('changed', origin)
    } else {
      console.log('updateRP called but source undefined')
    }
  }
454606
def add_handler(self, handler):
        """"""
        if not callable(handler):
            raise TypeError("'%s' is not callable." % handler)

        self.append(handler)
676124
def add_action_callback(self, *event):
        """"""
        if react_to_event(self.view, self.tree_view, event) and self.active_entry_widget is None:
            self.on_add(None)
            return True
1164026
function checkAdd(list, key, func) {
    list.push({key: key, func: func});
  }
257259
def handle_new_events(self, events):
        """"""
        for event in events:
            self.events.append(
                self.create_event_object(
                    event[0],
                    event[1],
                    int(event[2])))
619857
def push_event(self, event_name, event_type, block_id):
        """"""
        self._db.rpush(event_name, dict(type=event_type, id=block_id))
210502
function(type, callbacks) {
        $.each(callbacks, function(i, callback) {
            this.addHook(type, callback);
        }.bind(this));
    }