Promise an object of class `cls` with content `members`.
165022
def create_object(cls, members):
    """"""
    obj = cls.__new__(cls)
    obj.__dict__ = members
    return obj
1018098
def Decorate(cls, class_name, member, parent_member):
    """"""
    if isinstance(member, property):
      fget = cls.DecorateMethod(class_name, member.fget, parent_member)
      fset = None
      if member.fset:
        fset = cls.DecorateMethod(class_name, member.fset, parent_member)
      fdel = None
      if member.fdel:
        fdel = cls.DecorateMethod(class_name, member.fdel, parent_member)
      return property(fget, fset, fdel, member.__doc__)
    else:
      return cls.DecorateMethod(class_name, member, parent_member)
361767
function(object, callback) {
      return inject(object, [], function(memo, key, value){
        memo.push(callIterator(callback, key, value))
      })
    }
99156
def populate_class_members(self, element_cls, prop_name):
        
        self._element_cls = element_cls
        self._prop_name = prop_name

        self._add_attr_property()
675515
function contentsAsync(file, options, cb) {
  if (typeof options === 'function') {
    cb = options;
    options = {};
  }

  if (typeof cb !== 'function') {
    throw new TypeError('expected a callback function');
  }

  if (!utils.isObject(file)) {
    cb(new TypeError('expected file to be an object'));
    return;
  }

  contentsSync(file, options);
  cb(null, file);
}
1285821
function sismember(key, member, req) {
  var val = this.getKey(key, req);
  if(val === undefined) return 0;
  return val.sismember(member);
}
1373731
function detect_class_members_from_array(cls, ast) {
  cls["members"] = [];
  return _.each(ast["elements"], function(el) {
    detect_method_or_property(cls, key_value(el), el, el);
  });
}
1080787
function(cb, next, method) {
        return function(value) {
            if (typeof cb !== 'function')                            /*  [Promises/A+ 2.2.1, 2.2.7.3, 2.2.7.4]  */
                next[method].call(next, value);                      /*  [Promises/A+ 2.2.7.3, 2.2.7.4]  */
            else {
                var result;
                try {
                    if (value instanceof Promise) {
                        result = value.then(cb);
                    }
                    else result = cb(value);
                }                          /*  [Promises/A+ 2.2.2.1, 2.2.3.1, 2.2.5, 3.2]  */
                catch (e) {
                    next.reject(e);                                  /*  [Promises/A+ 2.2.7.2]  */
                    return;
                }
                resolve(next, result);                               /*  [Promises/A+ 2.2.7.1]  */
            }
        };
    }
455823
function(instance) {
    var self = this;
    var result = Promise.bind();
    var fk = instance.getAttribute(this.foreignKeyAttr);
    if (fk) {
      result = result.then(function() {
        return self.objectsQuery(instance).execute();
      })
      .then(function(result) {
        self.validateFetchedObjects(instance, result);
        return result[0];
      });
    }
    else {
      result = result.then(function() {
        // pretend like we actually did the whole fetch & got back nothing
        self.associateFetchedObjects(instance, [null]);
      });
    }
    return result;
  }
995452
function Promise(resolver) {
  if (!(this instanceof Promise)) {
    throw new TypeError('Constructor Promise requires `new`');
  }
  if (!isFunction(resolver)) {
    throw new TypeError('Must pass resolver function');
  }

  /**
   * @type {function(this:Promise,*=,function(*=),function(*=),Deferred):!Promise}
   * @private
   */
  this._state = PendingPromise;

  /**
   * @type {*}
   * @private
   */
  this._value = [];

  /**
   * @type {boolean}
   * @private
   */
  this._isChainEnd = true;

  doResolve(
    this,
    adopter(this, FulfilledPromise),
    adopter(this, RejectedPromise),
    { then: resolver }
  );
}
246751
function _each( object, callback, thisObj ) {

		if ( !object ) {
			return Promise.resolve();
		}

		var results;
		var fns = [];

		if ( Object.prototype.toString.call( object ) === '[object Array]' ) {

			results = [];

			var length = object.length;
			for ( var idx = 0; idx < length; idx ++ ) {
				var value = callback.call( thisObj || this, object[ idx ], idx );
				if ( value ) {
					fns.push( value );
					if ( value instanceof Promise ) {
						value.then( function( key, value ) {
							results[ idx ] = value;
						}.bind( this, key ));
					} else {
						results[ idx ] = value;
					}
				}
			}

		} else {

			results = {};

			for ( var key in object ) {
				if ( object.hasOwnProperty( key ) ) {
					var value = callback.call( thisObj || this, object[ key ], key );
					if ( value ) {
						fns.push( value );
						if ( value instanceof Promise ) {
							value.then( function( key, value ) {
								results[ key ] = value;
							}.bind( this, key ));
						} else {
							results[ key ] = value;
						}
					}
				}
			}

		}

		return Promise.all( fns ).then( function() {
			return results;
		});

	}
191950
def promise_method(func):
    
    name = func.__name__

    @wraps(func)
    def wrapped(self, *args, **kwargs):
        cls_name = type(self).__name__
        if getattr(self, '_%s__resolved' % (cls_name,)):
            return getattr(getattr(self, '_%s__wrapped' % (cls_name,)), name)(*args, **kwargs)
        return func(self, *args, **kwargs)
    return wrapped
256882
function thennable (ref, cb, ec, cn) {
      // Promises can be rejected with other promises, which should pass through
      if (state == 2) {
        return cn()
      }
      if ((typeof val == 'object' || typeof val == 'function') && typeof ref == 'function') {
        try {

          // cnt protects against abuse calls from spec checker
          var cnt = 0
          ref.call(val, function (v) {
            if (cnt++) return
            val = v
            cb()
          }, function (v) {
            if (cnt++) return
            val = v
            ec()
          })
        } catch (e) {
          val = e
          ec()
        }
      } else {
        cn()
      }
    }
759171
function extendClass(parent, members) {
        var object = function () { return UNDEFINED; };
        object.prototype = new parent();
        extend(object.prototype, members);
        return object;
    }
60808
def _isPromise(obj):
    
    return hasattr(obj, "fulfill") and \
        _isFunction(getattr(obj, "fulfill")) and \
        hasattr(obj, "reject") and \
        _isFunction(getattr(obj, "reject")) and \
        hasattr(obj, "then") and \
        _isFunction(getattr(obj, "then"))
82298
def from_def(cls, obj):
        
        prof = cls(obj["steamid"])
        prof._cache = obj

        return prof
1315938
def promise(*args, &callback)
      parent, headers, flags = *args
      promise = new_stream(parent: parent)
      promise.send(
        type: :push_promise,
        flags: flags,
        stream: parent.id,
        promise_stream: promise.id,
        payload: headers.to_a,
      )

      callback.call(promise)
    end