@param {dav.CalendarObject} calendarObject target calendar object.
@return {Promise} promise will resolve when the calendar has been deleted.

Options:

(dav.Sandbox) sandbox - optional request sandbox.
(dav.Transport) xhr - request sender.
196976
function deleteCalendarObject(calendarObject, options) {
  return webdav.deleteObject(calendarObject.url, calendarObject.etag, options);
}
951126
function() {
    // Calendar widget
    if(YAHOO.widget.Calendar) {
        var calContainer = this.getContainerEl().appendChild(document.createElement("div"));
        calContainer.id = this.getId() + "-dateContainer"; // Needed for Calendar constructor
        var calendar =
                new YAHOO.widget.Calendar(this.getId() + "-date",
                calContainer.id, this.calendarOptions);
        calendar.render();
        calContainer.style.cssFloat = "none";

        if(ua.ie) {
            var calFloatClearer = this.getContainerEl().appendChild(document.createElement("div"));
            calFloatClearer.style.clear = "both";
        }
        
        this.calendar = calendar;

        if(this.disableBtns) {
            this.handleDisabledBtns();
        }
    }
    else {
        YAHOO.log("Could not find YUI Calendar", "error", this.toString());
    }
    
}
1117987
def get_calendar(self, calendar_id=None, calendar_name=None):
        
        if calendar_id and calendar_name:
            raise RuntimeError('Provide only one of the options')

        if not calendar_id and not calendar_name:
            raise RuntimeError('Provide one of the options')

        if calendar_id:
            # get calendar by it's id
            url = self.build_url(
                self._endpoints.get('get_calendar').format(id=calendar_id))
            params = None
        else:
            # get calendar by name
            url = self.build_url(self._endpoints.get('root_calendars'))
            params = {
                '$filter': "{} eq '{}'".format(self._cc('name'), calendar_name),
                '$top': 1}

        response = self.con.get(url, params=params)
        if not response:
            return None

        if calendar_id:
            data = response.json()
        else:
            data = response.json().get('value')
            data = data[0] if data else None
            if data is None:
                return None

        # Everything received from cloud must be passed as self._cloud_data_key
        return self.calendar_constructor(parent=self,
                                         **{self._cloud_data_key: data})
1006866
function() {

			// Remove any existing calendar (only one instance per node is allowed)
			var existing = this.el.one('.calendar')
			if (existing._node) {
				existing.remove()
			}

			this.calendarEl = n.node.create('<div class="calendar"></div>')

			var content = []

			for (var i=0;i<this.panes;i++) {
				var prevLink = ''
					, nextLink = ''

				if (i==0) {
					prevLink = '<span class="prev-month"><a href="#">&lt;</a></span>'
				}
				
				if (i+1 == this.panes) {
					nextLink = '<span class="next-month"><a href="#">&gt;</a></span>'
				}

				content = content.concat([
					'<div class="pane" data-month="', this.getOffsetMonth(i) ,'" data-year="', this.getOffsetYear(i), '">',
						'<div class="months">',
							prevLink,
							'<span class="current-month">' + this.renderMonth(i) + ' ' + this.renderYear(i) + '</span>',
							nextLink,
						'</div>',
						'<div class="days">',
							'<table><thead><tr class="weekdays">' + this.weekdayHeaderMarkup() + '</tr></thead>',
								'<tbody>' + this.calendarMarkup(i) + '</tbody>',
							'</table>',
						'</div>',
					'</div>'
				])
			}

			this.calendarEl.setHtml(content.join(''))

			// Position the calendar
			this.calendarEl.appendTo(this.el)

			this.doSelection()

			this.calendarEl.one('.prev-month').on('click', function(e){
				this.month--
				this.loadMonth()
				e.stop()
			}.bind(this))
	
			this.calendarEl.one('.next-month').on('click', function(e){
				this.month++
				this.loadMonth()
				e.stop()
			}.bind(this))
	
			this.calendarEl.on('click', function(e) {
				var dayNumber = parseInt(e.target.getHtml(), 10)
	
				if (isNaN(dayNumber)) {
					return
				}

				var paneEl = e.target.ancestor('.pane')

					, month = parseInt(paneEl.data('month'), 10)
					, year = parseInt(paneEl.data('year'), 10)

					, dateObj = new Date(year, month, dayNumber).getTime()
					, self = this

				function getdPickedDayEl() {
					return self.el.one('.pane[data-month="' + month + '"]').one('td[data-day="' + dayNumber + '"]')
				}

				// Handle single selection
				if (this.mode == 'single') {
					this.selected = [{year:year, month:month, day:dayNumber}]
					this.doSelection()
				}

				// Handle multiple selections
				if (this.mode == 'multiple') {

					if (this.selected.length > 1) {
						// Reset all nodes
						this.selected = [{year:year, month:month, day:dayNumber}]

					} else if (this.selected.length == 1 && this.selected[0].month == month && this.selected[0].year == year && this.selected[0].day == dayNumber ){
						// If the clicked square is the one in the selection, just clear the selection
						this.selected = []
						this.el.fire('pickClear')

					} else if (this.selected.length == 1){

						// Populate the selected array
						var dayI = this.selected[0].day+1,
							monthI = this.selected[0].month,
							yearI = this.selected[0].year

						// Swap values if the clicked day is before the start date
						if (dayI-1 > dayNumber || (monthI > month || yearI > year)) {
							var temp = {year:year, month:month, day:dayNumber}

							dayNumber = dayI-1
							month = monthI
							year = yearI
							
							this.selected = [temp]
							dayI = temp.day
							monthI = temp.month
							yearI = temp.year
						}


						while(true) {

							this.selected.push({year:yearI, month:monthI, day:dayI})

							if (dayI >= dayNumber && monthI >= month && yearI >= year) { break }

							if (dayI >= this.daysInMonth[monthI]) {
								dayI=0
								monthI++
							}
							if (monthI==11) {
								monthI=0
								yearI++
							}
							dayI++
						}

						this.el.fire('rangePick', {
							from: this.selected[0],
							to: {
								year: year,
								month: month,
								day: dayNumber
							}
						})

					} else {
						// First selection, so push something onto the selection stack
						this.selected.push({year:year, month:month, day:dayNumber})
					}

					this.doSelection()
				}

				this.el.fire('pick', {
					year: year,
					month: month,
					day: dayNumber,
					formatted: this.format(dateObj),
					date: dateObj
				})
				e.stop()
			}.bind(this))
		}
321802
function resolver(obj) {
  return new Promise(function(resolve, reject) {
    _.isEmpty(obj.results) ? reject(new Error(JSON.stringify(obj.errors))) : resolve(obj.results);
  })
}
1165766
function dateLastPaymentWasReceived(loan) {
    var d = Q.defer();
    var result = null;
    if (!loan || !loan.transactions) {
      d.reject('required dateLastPaymentWasReceived not provided');
    } else {
      loan.transactions.forEach(function (tx) {
        result = tx.receivedDate;
      });
      if (result) {
        loan.dateLastPaymentWasReceived = result;
        d.resolve(loan);
      } else d.reject('no transactions to determine dateLastPaymentWasReceived');
    }
    return d.promise;
  }
310028
function makeCalendar(char) {
    let calendar = function (id) {
        if (id === undefined) {
            return calendar.history();
        }
        else {
            return new EventImpl(char, id);
        }
    };
    calendar.history = function (fromId) {
        return char.agent.request('get_characters_character_id_calendar', {
            path: { character_id: char.id }, query: { from_event: fromId }
        }, char.ssoToken);
    };
    return calendar;
}
1172744
function deleteInstance() {
  var _this = this;

  expect(arguments).to.have.length(
    0,
    'Invalid arguments length when deleting a "' +
    this.Entity.specification.name +
    '" instance (it has to be passed 0 arguments)');

  return new Promise(function (resolve, reject) {

    var promise = _this.adapter.deleteObject(_this);

    expect(promise).to.respondTo(
      'then',
      'Function "delete" of an Adapter specialization should return a Promise'
    );

    expect(promise).to.respondTo(
      'catch',
      'Function "delete" of an Adapter specialization should return a Promise'
    );

    promise
      .then(resolve)
      .catch(reject);
  });
}
909554
function(date, allDay) { // this function is called when something is dropped
		
			// retrieve the dropped element's stored Event Object
			var originalEventObject = $(this).data('eventObject');
			var $extraEventClass = $(this).attr('data-class');
			
			
			// we need to copy it, so that multiple events don't have a reference to the same object
			var copiedEventObject = $.extend({}, originalEventObject);
			
			// assign it the date that was reported
			copiedEventObject.start = date;
			copiedEventObject.allDay = allDay;
			if($extraEventClass) copiedEventObject['className'] = [$extraEventClass];
			
			// render the event on the calendar
			// the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)
			$('#calendar').fullCalendar('renderEvent', copiedEventObject, true);
			
			// is the "remove after drop" checkbox checked?
			if ($('#drop-remove').is(':checked')) {
				// if so, remove the element from the "Draggable Events" list
				$(this).remove();
			}
			
		}
724131
function showCalendar(anchor) {
            try {
                this.$freezeCalendar = true;
                this.hideCalendar();

                var calendar = this.getCalendar();
                this.$anchor = anchor;

                var c = this.getCanvas(),
                    w = c.getLayer("win"),
                    p = zebkit.layout.toParentOrigin(0, 0, anchor, c);

                calendar.toPreferredSize();

                p.y = p.y + anchor.height;
                if (p.y + calendar.height > w.height - w.getBottom()) {
                    p.y = p.y - calendar.height - anchor.height - 1;
                }

                if (p.x + calendar.width > w.width - w.getRight()) {
                    p.x -= (p.x + calendar.width - w.width + w.getRight());
                }

                calendar.setLocation(p.x, p.y);
                ui.showWindow(this, "mdi", calendar);

                ui.activateWindow(calendar);
                calendar.monthDays.requestFocus();

                if (this.calendarShown !== undefined) {
                    this.calendarShown(this.calendar);
                }
            } finally {
                this.$freezeCalendar = false;
            }

            return this;
        }
701283
function(aSrc, aDeep) {
    if (!aSrc || typeof aSrc != "object") {
      return aSrc;
    } else if (aSrc instanceof Date) {
      return new Date(aSrc.getTime());
    } else if ("clone" in aSrc) {
      return aSrc.clone();
    } else if (Array.isArray(aSrc)) {
      var arr = [];
      for (var i = 0; i < aSrc.length; i++) {
        arr.push(aDeep ? ICAL.helpers.clone(aSrc[i], true) : aSrc[i]);
      }
      return arr;
    } else {
      var obj = {};
      for (var name in aSrc) {
        // uses prototype method to allow use of Object.create(null);
        /* istanbul ignore else */
        if (Object.prototype.hasOwnProperty.call(aSrc, name)) {
          if (aDeep) {
            obj[name] = ICAL.helpers.clone(aSrc[name], true);
          } else {
            obj[name] = aSrc[name];
          }
        }
      }
      return obj;
    }
  }
991498
function resolve(promise, x) {
  /*  sanity check arguments  */

  /*  [Promises/A+ 2.3.1]  */
  if (promise === x || promise.proxy === x) {
    promise.reject(new TypeError('cannot resolve promise with itself'));
    return;
  }
  /*  surgically check for a "then" method
    (mainly to just call the "getter" of "then" only once)  */


  var then;

  if (_typeof(x) === 'object' && x !== null || typeof x === 'function') {
    try {
      then = x.then;
    }
    /*  [Promises/A+ 2.3.3.1, 3.5]  */
    catch (e) {
      promise.reject(e);
      /*  [Promises/A+ 2.3.3.2]  */

      return;
    }
  }
  /*  handle own Thenables    [Promises/A+ 2.3.2]
    and similar "thenables" [Promises/A+ 2.3.3]  */


  if (typeof then === 'function') {
    var resolved = false;

    try {
      /*  call retrieved "then" method */

      /*  [Promises/A+ 2.3.3.3]  */
      then.call(x,
      /*  resolvePromise  */

      /*  [Promises/A+ 2.3.3.3.1]  */
      function (y) {
        if (resolved) return;
        resolved = true;
        /*  [Promises/A+ 2.3.3.3.3]  */

        if (y === x)
          /*  [Promises/A+ 3.6]  */
          promise.reject(new TypeError('circular thenable chain'));else resolve(promise, y);
      },
      /*  rejectPromise  */

      /*  [Promises/A+ 2.3.3.3.2]  */
      function (r) {
        if (resolved) return;
        resolved = true;
        /*  [Promises/A+ 2.3.3.3.3]  */

        promise.reject(r);
      });
    } catch (e) {
      if (!resolved)
        /*  [Promises/A+ 2.3.3.3.3]  */
        promise.reject(e);
      /*  [Promises/A+ 2.3.3.3.4]  */
    }

    return;
  }
  /*  handle other values  */


  promise.fulfill(x);
  /*  [Promises/A+ 2.3.4, 2.3.3.4]  */
}
1149835
function _sendEvent(client, room, event, callback) {
    // Add an extra Promise.resolve() to turn synchronous exceptions into promise rejections,
    // so that we can handle synchronous and asynchronous exceptions with the
    // same code path.
    return Promise.resolve().then(function() {
        const encryptionPromise = _encryptEventIfNeeded(client, event, room);

        if (!encryptionPromise) {
            return null;
        }

        _updatePendingEventStatus(room, event, EventStatus.ENCRYPTING);
        return encryptionPromise.then(() => {
            _updatePendingEventStatus(room, event, EventStatus.SENDING);
        });
    }).then(function() {
        let promise;
        // this event may be queued
        if (client.scheduler) {
            // if this returns a promsie then the scheduler has control now and will
            // resolve/reject when it is done. Internally, the scheduler will invoke
            // processFn which is set to this._sendEventHttpRequest so the same code
            // path is executed regardless.
            promise = client.scheduler.queueEvent(event);
            if (promise && client.scheduler.getQueueForEvent(event).length > 1) {
                // event is processed FIFO so if the length is 2 or more we know
                // this event is stuck behind an earlier event.
                _updatePendingEventStatus(room, event, EventStatus.QUEUED);
            }
        }

        if (!promise) {
            promise = _sendEventHttpRequest(client, event);
        }
        return promise;
    }).then(function(res) {  // the request was sent OK
        if (room) {
            room.updatePendingEvent(event, EventStatus.SENT, res.event_id);
        }
        if (callback) {
            callback(null, res);
        }
        return res;
    }, function(err) {
        // the request failed to send.
        console.error("Error sending event", err.stack || err);

        try {
            // set the error on the event before we update the status:
            // updating the status emits the event, so the state should be
            // consistent at that point.
            event.error = err;
            _updatePendingEventStatus(room, event, EventStatus.NOT_SENT);
            // also put the event object on the error: the caller will need this
            // to resend or cancel the event
            err.event = event;

            if (callback) {
                callback(err);
            }
        } catch (err2) {
            console.error("Exception in error handler!", err2.stack || err);
        }
        throw err;
    });
}
843730
function(providerObject) {
  const fixedProviderObject = Object.assign({}, providerObject);
  const oldGetAccountsMethod = providerObject.getAccounts;

  // fix get accounts
  if (typeof fixedProviderObject.getAccounts !== 'undefined') {
    fixedProviderObject.getAccounts = function(getAccountsCallback) {
      const oldCallback = getAccountsCallback;

      // build fixed callback with lowercased accounts
      const fixedCallback = function(accountsError, accountsResult) {
        const fixedAccountsResult = accountsResult.slice(0);

        // if no error, fixed result
        if (!accountsError) {
          fixedAccountsResult.map(function(item) {
            return String(item.toLowerCase());
          });
        }

        // fire oldd callback with new fix
        oldCallback(accountsError, fixedAccountsResult);
      }

      // fire get accounts method
      oldGetAccountsMethod(fixedCallback);
    };
  }

  // return fixed provider object
  return fixedProviderObject;
}
638543
public void deleteCalendar(GoogleCalendar calendar) throws IOException {
        dao.calendars().delete(calendar.getId()).execute();
    }
1141863
function doDelete(filter) {
    console.log('folder delete called', filter);
    return new Promise(function(resolve, reject) {
      var keysPromise;
      var deletes = [], deletedKeys = [];

      if (common.keyTypes.indexOf(typeof filter) !== -1) {
        filter = [filter];
      } else if (filter instanceof Array) {
      } else if (filter === true || typeof filter === 'object') {
        console.log('object/true delete handler');
        // Get the existing keys
        readKeys().then(function(existingKeys) {
          console.log('existing keys are', existingKeys);
          if (filter === true) {
            deletedKeys = existingKeys;
            existingKeys.forEach(function(key) {
              deletes.push(saveData(key));
            });
          } else {
            if (options.cacheValues) {
              console.log('processing filter', filter);
              common.processFilter(cachedData, filter, function(key) {
                console.log('deleting matching item', key);
                deletes.push(saveData(key).then(function() {
                  delete cachedData[key];
                  deletedKeys.push(key);
                }));
              });
            } else {
              console.log('processing filter on non-cached data');
              existingKeys.forEach(function(key) {
                deletes.push(readData(key).then(function(data) {
                  console.log('loaded data for', key);
                  if (common.runFilter(data, filter)) {
                    return saveData(key).then(function() {
                      if (options.cacheKeys) {
                        cachedKeys.splice(cachedKeys.indexOf(key), 1);
                      }
                      deletedKeys.push(key);
                    });
                  } else {
                    return Promise.resolve();
                  }
                }));
              });
            }
          }

          return Promise.all(deletes).then(function() {
            if (filter === true && options.cacheValues) {
              cachedData = {};
            }
            if (options.cacheValues && options.cacheKeys) {
              cachedKeys = Object.keys(cachedData);
            } else if (filter === true && options.cacheKeys) {
              cachedKeys = [];
            }
            resolve(deletedKeys);
          });
        }).catch(function(error) {
          reject(error);
        });

        return;
      } else {
        reject({
          message: 'filter needs to be an object containing a filter'
        });
        return;
      }

      /* Get the list of keys */
      if (options.cacheKeys) {
        keysPromise = Promise.resolve(cachedKeys);
      } else {
        keysPromise = readKeys();
      }

      keysPromise.then(function(keys) {
        console.log('got current keys', keys);
        filter.forEach(function(id) {
          if (keys.indexOf(id) !== -1) {
            // TODO XXX Remove once file watch implemented
            deletes.push(saveData(id).then(function() {
              if (options.cacheValues) {
                delete cachedData[id];
              } else if (options.cacheKeys) {
                // Delete remove key from cached keys if caching keys but not values
                cachedKeys.splice(cachedKeys.indexOf(id), 1);
              }

              deletedKeys.push(id);
            }));
          }
        });

        Promise.all(deletes).then(function() {
          // Redo cached keys if caching keys and values (otherwise done above)
          if (options.cacheKeys && options.cacheValues) {
            cachedKeys = Object.keys(cachedData);
          }
          resolve(deletedKeys);
        });
      }).catch(function(error) {
        reject(error);
      });
    });
  }
22691
function awaitDidNavigate() {
      return new Promise( resolve => {
         const unsubscribe = eventBusMock.subscribe( 'didNavigate', event => {
            resolve( event );
            unsubscribe();
         } );
      } );
   }