PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END
965261
function defaultIfEmpty(defaultValue) {
    if (defaultValue === void 0) {
        defaultValue = null;
    }
    return function (source) { return source.lift(new DefaultIfEmptyOperator(defaultValue)); };
}
261890
function main() {
    var program = require('commander')
    program.usage('FILE.d.ts... [options]')
    program.commandHelp = function() { return "  Convert *.d.ts files to TypeScript Declaration Core\n" }
    program.option('--pretty', 'Print pretty JSON, for human inspection')
        .option('--silent', 'Print nothing')
        .option('--lib', "Include TypeScript\'s lib.d.ts file")
    program.parse(process.argv)

    if (program.args.length < 1) {
        program.help()
    }

    var inputs = program.args.map(function(file) {
        return {
            file: file,
            text: fs.readFileSync(file, 'utf8')
        }
    })
    if (program.lib) {
        inputs.unshift({
            file: ">lib.d.ts",
            text: fs.readFileSync(__dirname + '/lib/lib.d.ts', 'utf8')
        })
    }
    var json = convert(inputs)
    if (program.silent)
        {}
    else if (program.pretty)
        console.log(util.inspect(json, {depth:null}))
    else
        console.log(JSON.stringify(json))
}
177794
function pairs(obj, scheduler) {
    if (!scheduler) {
        return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) {
            var keys = Object.keys(obj);
            for (var i = 0; i < keys.length && !subscriber.closed; i++) {
                var key = keys[i];
                if (obj.hasOwnProperty(key)) {
                    subscriber.next([key, obj[key]]);
                }
            }
            subscriber.complete();
        });
    }
    else {
        return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) {
            var keys = Object.keys(obj);
            var subscription = new _Subscription__WEBPACK_IMPORTED_MODULE_1__["Subscription"]();
            subscription.add(scheduler.schedule(dispatch, 0, { keys: keys, index: 0, subscriber: subscriber, subscription: subscription, obj: obj }));
            return subscription;
        });
    }
}
337290
def make_subscriber(self, my_args=None):
        
        LOGGER.debug("zeromq.Driver.make_subscriber")
        if my_args is None:
            raise exceptions.ArianeConfError('subscriber arguments')
        if not self.configuration_OK or self.connection_args is None:
            raise exceptions.ArianeConfError('zeromq connection arguments')
        subscriber = Subscriber.start(my_args, self.connection_args).proxy()
        self.subscribers_registry.append(subscriber)
        return subscriber
805121
static Fix createFix(
      ImmutableList<ImportTree> wildcardImports,
      Set<TypeToImport> typesToImport,
      VisitorState state) {
    Map<Symbol, List<TypeToImport>> toFix =
        typesToImport.stream().collect(Collectors.groupingBy(TypeToImport::owner));
    final SuggestedFix.Builder fix = SuggestedFix.builder();
    for (ImportTree importToDelete : wildcardImports) {
      String importSpecification = importToDelete.getQualifiedIdentifier().toString();
      if (importToDelete.isStatic()) {
        fix.removeStaticImport(importSpecification);
      } else {
        fix.removeImport(importSpecification);
      }
    }
    for (Map.Entry<Symbol, List<TypeToImport>> entry : toFix.entrySet()) {
      final Symbol owner = entry.getKey();
      if (entry.getKey().getKind() != ElementKind.PACKAGE
          && entry.getValue().size() > MAX_MEMBER_IMPORTS) {
        qualifiedNameFix(fix, owner, state);
      } else {
        for (TypeToImport toImport : entry.getValue()) {
          toImport.addFix(fix);
        }
      }
    }
    return fix.build();
  }
640414
def import_subscribers(self, list_id, subscribers, resubscribe, queue_subscription_based_autoresponders=False, restart_subscription_based_autoresponders=False):
        """"""
        body = {
            "Subscribers": subscribers,
            "Resubscribe": resubscribe,
            "QueueSubscriptionBasedAutoresponders": queue_subscription_based_autoresponders,
            "RestartSubscriptionBasedAutoresponders": restart_subscription_based_autoresponders}
        try:
            response = self._post("/subscribers/%s/import.json" %
                                  list_id, json.dumps(body))
        except BadRequest as br:
            # Subscriber import will throw BadRequest if some subscribers are not imported
            # successfully. If this occurs, we want to return the ResultData property of
            # the BadRequest exception (which is of the same "form" as the response we'd
            # receive upon a completely successful import)
            if hasattr(br.data, 'ResultData'):
                return br.data.ResultData
            else:
                raise br
        return json_to_py(response)
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));
	});
}
434957
function (currentEl, nameFn, valueFn) {
  var attrName = subscribe.call(this, nameFn, null, function (value) {
    VM.removeAttribute(currentEl(), this.value);
    VM.setAttribute(currentEl(), this.value = value, attrValue.value);
  });

  var attrValue = subscribe.call(this, valueFn, null, function (value) {
    VM.setAttribute(currentEl(), attrName.value, this.value = value);
  });

  return VM.setAttribute(currentEl(), attrName.value, attrValue.value);
}
44673
def subscribe(self,
                  event_type: Type[TSubscribeEvent],
                  handler: Callable[[TSubscribeEvent], None]) -> Subscription:
        
        if event_type not in self._handler:
            self._handler[event_type] = []

        casted_handler = cast(Callable[[BaseEvent], Any], handler)

        self._handler[event_type].append(casted_handler)

        return Subscription(lambda: self._handler[event_type].remove(casted_handler))
1257191
function importTypes(names: Array<string>, module: string) {
  const importDeclaration = t.importDeclaration(
    names.map(name =>
      t.importSpecifier(t.identifier(name), t.identifier(name)),
    ),
    t.stringLiteral(module),
  );
  importDeclaration.importKind = 'type';
  return importDeclaration;
}
392646
function subscribeToResult(outerSubscriber, result, outerValue, outerIndex) {
    var destination = new _InnerSubscriber__WEBPACK_IMPORTED_MODULE_0__["InnerSubscriber"](outerSubscriber, outerValue, outerIndex);
    return Object(_subscribeTo__WEBPACK_IMPORTED_MODULE_1__["subscribeTo"])(result)(destination);
}
583255
async function subscribe (ant, field, directiveArgs, fieldArgs) {
  if (ant && field && directiveArgs && directiveArgs.to) {
    const antFunction =  ant.functionController.getFunction(directiveArgs.to);
    if (!antFunction) {
      logger.error(new AntError(
        `Could not find "${directiveArgs.to}" function`
      ));
      return null;
    }
    try {
      const currentValue = antFunction.run(fieldArgs);
      if (currentValue instanceof Observable) {
        return new AsyncIterableObserver(field.fieldName, currentValue);
      }
      return currentValue;
    } catch (e) {
      logger.error(new AntError(
        `Could not run "${directiveArgs.to}" function`,
        e
      ));
    }
  }
  return null;
}
578959
function importerAsync(options, handler) {
    var modulePath, recursive = false, parent = '';

    if (typeof options === 'string') {
        modulePath = options;

    } else {
        modulePath = options.path;
        recursive = options.recursive || recursive;
        parent = options.parent || parent;
        if (!modulePath) throw new Error("module directory path must be given.");
    }

    // absolute path? or relevant path?
    if (modulePath.indexOf('/') != 0) {
        // relevant. join with parent module's path
        modulePath = path.join(path.dirname(module.parent.parent.filename), modulePath);
    }

    fs.readdir(modulePath, function(err, files) {
        files.forEach(function(name) {
            if (name.lastIndexOf('.js') != name.length - 3) return;

            if (recursive && fs.lstatSync(path.join(modulePath, name)).isDirectory()) {
                importerAsync({
                    path: path.join(modulePath, name),
                    recursive: true,
                    parent: path.join(parent, name)
                }, handler);
            }

            name = name.substring(0, name.lastIndexOf('.')); // remove ext
            var moduleObj = require(path.join(modulePath, name));
            if (handler) handler(moduleObj, path.join(parent, name));
        });
    });
}
338743
function endWith() {
    var array = [];
    for (var _i = 0; _i < arguments.length; _i++) {
        array[_i] = arguments[_i];
    }
    return function (source) {
        var scheduler = array[array.length - 1];
        if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_4__["isScheduler"])(scheduler)) {
            array.pop();
        }
        else {
            scheduler = null;
        }
        var len = array.length;
        if (len === 1 && !scheduler) {
            return Object(_observable_concat__WEBPACK_IMPORTED_MODULE_3__["concat"])(source, Object(_observable_scalar__WEBPACK_IMPORTED_MODULE_1__["scalar"])(array[0]));
        }
        else if (len > 0) {
            return Object(_observable_concat__WEBPACK_IMPORTED_MODULE_3__["concat"])(source, Object(_observable_fromArray__WEBPACK_IMPORTED_MODULE_0__["fromArray"])(array, scheduler));
        }
        else {
            return Object(_observable_concat__WEBPACK_IMPORTED_MODULE_3__["concat"])(source, Object(_observable_empty__WEBPACK_IMPORTED_MODULE_2__["empty"])(scheduler));
        }
    };
}
457645
function subscribeBrowser (client, subscriptions, backlog, channel, callback, done_callback) {
    if ( addToBacklog(client, backlog, subscribeBrowser, [client, subscriptions, backlog, channel, callback, done_callback]) ) return;
    if (subscriptions[channel]===undefined) {
        subscriptions[channel] = [callback];
        client.subscribe(channel, {qos: 0, onSuccess: function() {
            // If there is a done_callback defined, execute it
            if (done_callback!==undefined) done_callback();
        }});
    } else {
        subscriptions[channel].push(callback);
        // If there is a done_callback defined, execute it
        if (done_callback!==undefined) done_callback();
    }
}
1288539
function(path, fn, upstream, binds) {
		this.assertNotDestroyed('subscribe', path);
		path = parsePath(path);

		if (path[path.length - 1] === '*')
			throw new Error('no more * subscribe allowed - use upstreams instead : ' + path.join('.'));

		var space;
		switch (path[0]) {
			case '$this':
				space = this.map;
				break;
			case '$env':
				return this.env.subscribe(path.slice(1), fn, upstream, binds);
			case '$parent':
				this.assertHasParent(path);
				return this.parent.subscribe(path.slice(1), fn, upstream, binds);
			default:
				space = utils.getProp(this.map, path);
		}
		if (upstream) {
			if (!space)
				utils.setProp(this.map, path, {
					_upstreams: [fn]
				});
			else
				(space._upstreams = space._upstreams || []).push(fn);
		} else if (!space)
			utils.setProp(this.map, path, {
				_listeners: [fn]
			});
		else
			(space._listeners = space._listeners || []).push(fn);
		if (binds)
			binds.push(unsub(this, path, fn, upstream));
		return this;
	}
645512
def get_module_imports_on_top_of_file(source, import_line_index):
    
    def is_string_literal(line):
        if line[0] in 'uUbB':
            line = line[1:]
        if line and line[0] in 'rR':
            line = line[1:]
        return line and (line[0] == '"' or line[0] == "'")

    def is_future_import(line):
        nodes = ast.parse(line)
        for n in nodes.body:
            if isinstance(n, ast.ImportFrom) and n.module == '__future__':
                return True
        return False

    allowed_try_keywords = ('try', 'except', 'else', 'finally')
    in_docstring = False
    docstring_kind = '"""'
    for cnt, line in enumerate(source):
        if not in_docstring:
            m = DOCSTRING_START_REGEX.match(line.lstrip())
            if m is not None:
                in_docstring = True
                docstring_kind = m.group('kind')
                remain = line[m.end(): m.endpos].rstrip()
                if remain[-3:] == docstring_kind:  # one line doc
                    in_docstring = False
                continue
        if in_docstring:
            if line.rstrip()[-3:] == docstring_kind:
                in_docstring = False
            continue

        if not line.rstrip():
            continue
        elif line.startswith('#'):
            continue

        if line.startswith('import ') or line.startswith('from '):
            if cnt == import_line_index or is_future_import(line):
                continue
            return cnt
        elif pycodestyle.DUNDER_REGEX.match(line):
            continue
        elif any(line.startswith(kw) for kw in allowed_try_keywords):
            continue
        elif is_string_literal(line):
            return cnt
        else:
            return cnt
    return 0