Observable wrapper
193034
function dummyObsWrap(fn) {
    return function() {
        return Rx.Observable.create(function(observer) {
            fn(function(err, res) {
                if(err) 
                    return observer.onError(err);
                observer.onNext(res);
                observer.onCompleted();
            });
        });
    }
}
577771
public void subscribe(Observable<M> observable, final boolean pullToRefresh) {

    if (isViewAttached()) {
      getView().showLoading(pullToRefresh);
    }

    unsubscribe();

    subscriber = new Subscriber<M>() {
      private boolean ptr = pullToRefresh;

      @Override public void onCompleted() {
        BaseRxLcePresenter.this.onCompleted();
      }

      @Override public void onError(Throwable e) {
        BaseRxLcePresenter.this.onError(e, ptr);
      }

      @Override public void onNext(M m) {
        BaseRxLcePresenter.this.onNext(m);
      }
    };

    observable.subscribeOn(Schedulers.io())
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe(subscriber);
  }
573218
def create_with(
            cls, event: str = None, observable: T.Union[str, Observable] = None
    ) -> T.Callable[..., "ObservableProperty"]:
        """"""

        return functools.partial(cls, event=event, observable=observable)
226529
def filter(self, predicate) -> 'Observable':
        """"""
        source = self

        def subscribe(on_next):
            def _next(x):
                if predicate(x):
                    on_next(x)

            return source.subscribe(_next)
        return Observable(subscribe)
567483
@NonNull
    public ObservableAdapterBuilder<T> prepends(@Nullable Observable<? extends Collection<? extends T>> prepends) {
        mPrepends = prepends;
        return this;
    }
936853
function(context, expr, callback, callbackContext) {
    if (typeof context === 'string') {
      callbackContext = callback;
      callback = expr;
      expr = context;
      context = null;
    }
    var observer = this.observations.createObserver(expr, callback, callbackContext);
    if (context) {
      observer.bind(context, true);
    }
    return observer;
  }
1222733
function () { $assertEveryCalled (function (
                                            fromConstructor,
                                            fromConfig,
                                            fromLateBoundListener,
                                            fromDefinition,
                                            fromListenerOnlyVariant) {

        var Compo = $component ({
                        color: $observableProperty (),
                        smell: $observableProperty (),
                        shape: $observableProperty ('round', function (now) { $assert (now, 'round'); fromDefinition () }),
                        size:  $observableProperty (function (x) { $assert (x, 42); fromListenerOnlyVariant () }),
                        init: function () {
                            this.colorChange (function (now, was) { if (was) { fromConstructor ()
                                $assert ([now, was], ['green', 'blue']) } }) } })

        var compo = new Compo ({
            color: 'blue',
            size: 42,
            colorChange: function (now, was) { if (was) {   fromConfig ()
                                                            $assert ([now, was], ['green', 'blue']) } } })

        //console.log (compo.constructor.$definition)

        compo.smellChange (function (now, was) { fromLateBoundListener ()
            $assert (compo.smell, now, 'bad')
            $assert (undefined,   was) })

        compo.color = 'green'
        compo.smell = 'bad' }) }
445697
Observable<ChatResult> getPreviousMessages(final String conversationId) {

        return persistenceController.getConversation(conversationId)
                .map(conversation -> conversation != null ? conversation.getFirstLocalEventId() : null)
                .flatMap(from -> {

                    final Long queryFrom;

                    if (from != null) {

                        if (from == 0) {
                            return Observable.fromCallable(() -> new ChatResult(true, null));
                        } else if (from > 0) {
                            queryFrom = from - 1;
                        } else {
                            queryFrom = null;
                        }
                    } else {
                        queryFrom = null;
                    }

                    return checkState().flatMap(client -> client.service().messaging().queryMessages(conversationId, queryFrom, messagesPerQuery))
                            .flatMap(result -> persistenceController.processMessageQueryResponse(conversationId, result))
                            .flatMap(result -> persistenceController.processOrphanedEvents(result, orphanedEventsToRemoveListener))
                            .flatMap((Func1<ComapiResult<MessagesQueryResponse>, Observable<ChatResult>>) result -> (result.isSuccessful() && result.getResult().getMessages().isEmpty() && result.getResult().getEarliestEventId() > 0) ?
                                    getPreviousMessages(conversationId) :
                                    Observable.fromCallable(() -> new ChatResult(result.isSuccessful(), result.isSuccessful() ? null : new ChatResult.Error(result))));
                });
    }
827573
function injectableWrapper(obj, provide, injects, isTransientScope) {
    // TODO(@davequick): discuss with @halfspiral whether isTransientScope might just better
    // be an array of Annotations
    var wrappedObject = function wrapOrCreateObject() {
      if(isFunction(obj) && (exists(obj.$provide) || exists(obj.$inject) || provide || injects)){
        var instance = Object.create(obj.prototype);
        return obj.apply(instance,arguments) || instance;
      }
      return obj;
    };
    return _wrapper(obj, wrappedObject, provide, injects, isTransientScope);
  }
230777
function createViewmodel(name,component,params,pre,post)
      {
        /* creates blank observable data set */
        var obsv = _mixed({},name);

        /* Attach Pre properties, or pre designed attachments for every Data set */
        for(var x=0,keys=Object.keys(pre),len=keys.length;x<len;x++)
        {
          if(_ignoreList.indexOf(keys[x]) !== -1)
          {
            Object.defineProperty(obsv,keys[x],setDescriptor(pre[keys[x]],(keys[x] !== 'filters')));
          }
          else
          {
            if(pre.pointers)
            {
              if(pre.pointers[keys[x]] === undefined) obsv.set(keys[x],pre[keys[x]]);
            }
            else
            {
              obsv.set(keys[x],pre[keys[x]]);
            }
          }
        }
        
        if(pre.pointers)
        {
          if(!obsv.pointers) Object.defineProperty(obsv,'pointers',setDescriptor({},false,true));
          for(var x=0,keys=Object.keys(pre.pointers),len=keys.length;x<len;x++)
          {
            obsv.pointers[keys[x]] = pre.pointers[keys[x]];
            obsv.addPointer(obsv.pointers[keys[x]].point,obsv.pointers[keys[x]].key,keys[x]);
          }
        }
        
        /* if there are any prototypes on this component they are added to the Data sets prototype */
        for(var x=0,keys=Object.keys(component.prototype),len=keys.length;x<len;x++)
        {
          Object.defineProperty(obsv,[keys[x]],setDescriptor(component.prototype[keys[x]],true));
        }
        
        /* we then apply the component constructor to the data set in order to add the 'this' properties from it and pass in the params */
        component.apply(obsv,params);
        
        /* Post attachments, overwritables, for data or pointers */
        for(var x=0,keys=Object.keys(post),len=keys.length;x<len;x++)
        {
          if(_ignoreList.indexOf(keys[x]) !== -1)
          {
            Object.defineProperty(obsv,keys[x],setDescriptor(post[keys[x]],(keys[x] !== 'filters')));
          }
          else
          {
            if(post.pointers)
            {
              if(post.pointers[keys[x]] === undefined) obsv.set(keys[x],post[keys[x]]);
            }
            else
            {
              obsv.set(keys[x],post[keys[x]]);
            }
          }
        }
        
        /* post pointers */
        if(post.pointers)
        {
          if(!obsv.pointers) Object.defineProperty(obsv,'pointers',setDescriptor({},false,true));
          for(var x=0,keys=Object.keys(post.pointers),len=keys.length;x<len;x++)
          {
            obsv.pointers[keys[x]] = post.pointers[keys[x]];
            obsv.addPointer(obsv.pointers[keys[x]].point,obsv.pointers[keys[x]].key,keys[x]);
          }
        }
        
        /* map filters as binded to vm */
        for(var x=0,keys=Object.keys(obsv.filters),len=keys.length;x<len;x++)
        {
          obsv.filters[keys[x]] = obsv.filters[keys[x]].bind(obsv);
        }

        /* Apply session storage if set, this allows for storing this vm in session storage, only those values that are enumerable */
        if(obsv.sessionStorage)
        {
            var storage = sessionStorage.getItem((obsv.id || name));
            
            /* load storage into the data set if it is set */
            if(storage)
            {
                storage = JSON.parse(storage);
                for(var x=0,keys=Object.keys(storage),len=keys.length;x<len;x++)
                {
                    obsv.set(keys[x],storage[keys[x]]);
                }
            }
          
            /* set the storage object with the defaults */
            else
            {
                sessionStorage.setItem((obsv.id || name),obsv.stringify());
            }
          
            /* if any data updates then the storage will be updated along with it */
            obsv.addChildDataUpdateListener('*',function(){
                sessionStorage.setItem((obsv.id || name),obsv.stringify());
            });
        }

        /* Apply local storage if set, similiar to session Storage except this persists even after browser is closed */
        if(obsv.localStorage)
        {
            var storage = localStorage.getItem((obsv.id || name));
          
            /* load storage into the data set if it is set */
            if(storage)
            {
                storage = JSON.parse(storage);
                for(var x=0,keys=Object.keys(storage),len=keys.length;x<len;x++)
                {
                    obsv.set(keys[x],storage[keys[x]]);
                }
            }
          
            /* set the storage object with the defaults */
            else
            {
                localStorage.setItem((obsv.id || name),obsv.stringify());
            }
          
            /* if any data updates then the storage will be updated along with it */
            obsv.addChildDataUpdateListener('*',function(){
                localStorage.setItem((obsv.id || name),obsv.stringify());
            });
        }
        
        if(obsv.store)
        {
            /* adds a pointer in model to this viewmodel, look into using id as an id from component: <test id="storeid"></test> */
            _model.set((obsv.id || name),obsv);
        }

        return obsv;
      }
529237
def map(self, mapper: Callable[[Any], Any]) -> 'Observable':
        
        """
        source = self
        return Observable(lambda on_next: source.subscribe(compose(on_next, mapper)))
916569
private <T> Observable<T> executeOnce(final List<Parameter> params,
            ResultSetMapper<? extends T> function) {
        return QuerySelectOnSubscribe.execute(this, params, function)
                .subscribeOn(context.scheduler());
    }
1143514
function createObservable (cfg) {
    const {dir, taskSet, tasksToRun, watchMode, spawn, env, log} = cfg;

    const tasks = tasksToRun.map(taskName => {
        const commandList = taskSet[taskName];
        if (!commandList)
            throw new Error (`No such task name: ${taskName} was configured`);
        return commandList;
    });

    return createParallellCommandsExecutor (
        tasks,
        dir,
        env,
        watchMode,
        {spawn, log});
}
312352
function(obj){
      if(ko.isWriteableObservable(obj)) return ko.observable(obj());
      if(obj === null || typeof obj !== 'object') return obj;

      var temp = obj.constructor();
      for (var key in obj) {
        temp[key] = Utils.cloneObjKnockout(obj[key]);
      }

      return temp;
    }
572569
function subscribe(observable, observer, options) {
	if (typeof observable !== 'object' || !observable)
		throw new TypeError('observable argument must be an Object');
	if (typeof observable.on !== 'function')
		throw new TypeError('observable.on must be a Function');
	if (typeof observer !== 'object' || !observer)
		throw new TypeError('observer argument must be an Object');

	const { masterHandler, messageTypes, queueName } = options;
	if (masterHandler && typeof masterHandler !== 'function')
		throw new TypeError('masterHandler parameter, when provided, must be a Function');
	if (queueName && typeof observable.queue !== 'function')
		throw new TypeError('observable.queue, when queueName is specified, must be a Function');

	const subscribeTo = messageTypes
		|| observer.handles
		|| Object.getPrototypeOf(observer).constructor.handles;
	if (!Array.isArray(subscribeTo))
		throw new TypeError('either options.messageTypes, observer.handles or ObserverType.handles is required');

	unique(subscribeTo).forEach(messageType => {
		const handler = masterHandler || getHandler(observer, messageType);
		if (!handler)
			throw new Error(`'${messageType}' handler is not defined or not a function`);

		if (queueName)
			observable.queue(queueName).on(messageType, handler.bind(observer));
		else
			observable.on(messageType, handler.bind(observer));
	});
}
166793
function (obj, resolve, reject) {
        // if promise like
        if (obj && typeof obj.then === 'function') {
            return Promise.resolve(obj).then(resolve).catch(reject);
        }
        // if observable
        if (obj && typeof obj.subscribe === 'function') {
            var obs_1 = obj;
            return new SafeSubscription(function (sub) { return obs_1.subscribe({
                next: function () {
                    if (sub.subscribed) {
                        sub.unsubscribe();
                        resolve(obj);
                    }
                },
                error: function (error) {
                    if (sub.subscribed) {
                        sub.unsubscribe();
                        reject(error);
                    }
                },
                complete: function () {
                    if (sub.subscribed) {
                        sub.unsubscribe();
                        resolve(obj);
                    }
                }
            }); });
        }
        // else just resolve
        try {
            return resolve(obj);
        }
        catch (error) {
            return reject(error);
        }
    }
800652
function andObservables(observables) {
    return observables.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeAll"])(), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["every"])(function (result) { return result === true; }));
}