Handles a object yielded from a Twitter::Streaming::Client.
 @param object [Object] The object yielded from a Twitter::Streaming::Client connection.
 @param type [Symbol] The type of the streamer.  Should be either :user or :filter.
326825
def handle_stream_object(object, type)
      opts = {
          stream_type: type
      }
      case object
        when Twitter::Streaming::FriendList
          # object: Array with IDs
          do_callbacks :friend_list, object
        when Twitter::Tweet
          # object: Twitter::Tweet
          is_mention = (object.user.screen_name != $bot[:config][:screen_name] and object.text.include?("@" + $bot[:config][:screen_name]) and not object.retweet?)
          do_callbacks :retweet, object, opts if object.retweet? and object.retweeted_tweet.user.screen_name == $bot[:config][:screen_name]
          do_callbacks :mention, object, opts if is_mention
          do_callbacks :tweet, object, opts.merge({ mention: is_mention, retweet: object.retweet?, favorite: object.favorited? })
        when Twitter::Streaming::Event
          case object.name
            when :follow, :favorite
              # :follow   -- object: Twitter::Streaming::Event(name: :follow,   source: Twitter::User, target: Twitter::User)
              # :favorite -- object: Twitter::Streaming::Event(name: :favorite, source: Twitter::User, target: Twitter::User, target_object: Twitter::Tweet)
              do_callbacks object.name, object, opts
            else
              puts "no handler for #{object.class.to_s}/#{object.name}\n  -- object data:"
              require 'pp'
              pp object
              do_callbacks object.name, object, opts
          end
        when Twitter::DirectMessage
          do_direct_message object, opts
        when Twitter::Streaming::DeletedTweet
          do_callbacks :deleted, object, opts
        else
          puts "no handler for #{object.class.to_s}\n  -- object data:"
          require 'pp'
          pp object
      end
    end
1013342
function Proxy(proxy) {
  stream.Duplex.call(this);

  this.proxy = proxy ? proxy : { type: 'direct' };

  this.on('error', function () {
    this.push(null);
    this.socket && this.socket.end();
  });
}
539232
def <<(object)
            unless object.generation == 0
                raise InvalidObjectError, "Cannot store an object with generation > 0 in an ObjectStream"
            end

            if object.is_a?(Stream)
                raise InvalidObjectError, "Cannot store a Stream in an ObjectStream"
            end

            # We must have an associated document to generate new object numbers.
            if @document.nil?
                raise InvalidObjectError, "The ObjectStream must be added to a document before inserting objects"
            end

            # The object already belongs to a document.
            unless object.document.nil?
                object = import_object_from_document(object)
            end

            load!

            object.no, object.generation = @document.allocate_new_object_number if object.no == 0
            store_object(object)

            Reference.new(object.no, 0)
        end
981713
def cast_with_puppet_resource(object, type)
      cast = cast_without_puppet_resource(object, type)
      # check the object to see if it has an acestor (< ) of the specified type
      if defined?(::Puppet::Type) && (object.class < ::Puppet::Type)
        cast = :puppet_type
      elsif defined?(::Puppet::Pops::Types) && (object.class < ::Puppet::Pops::Types)
        cast = :puppet_type
      elsif defined?(::Puppet::Parser::Resource) && (object.class < ::Puppet::Parser::Resource)
        cast = :puppet_resource
      elsif /Puppet::Pops::Types/.match(object.class.to_s)
        cast = :puppet_type
      end
      cast
    end
1028503
def delete(stream)
      case stream_type(stream)
      when :client then
        return unless stream.connected?
        jid = stream.user.jid.bare
        streams = @clients[jid] || []
        streams.delete(stream)
        @clients.delete(jid) if streams.empty?
      when :server then @servers.delete(stream)
      when :component then @components.delete(stream)
      end
    end
6954
def call(object)
      current = target = object.class
      while current != Object
        if registry.key?(current)
          return registry.fetch(current)
        end
        current = current.superclass
      end

      fail TypeNotFoundError, target
    end
244207
protected Response streamResponse(byte[] data, String type) {
    try (InputStream byteStream = new ByteArrayInputStream(data)) {
      return streamResponse(type, byteStream, data.length);
    } catch (IOException e) {
      logger.error("Failed to stream data to client", e);
      return createInternalServerError("Failed to stream data to client");
    }
  }
1308205
def stream(self, entity, callback):
        
        with self._lock:
            self._stream(entity, callback)
318557
function amqpObjectType( instance ) {
    if ( instance && instance.subscribeRaw )
        return 'Queue';
    if ( instance && instance.cleanup )
        return 'Exchange';
    if ( instance && instance.addListener )
        return 'Connection';
    return null;
}
263222
def _get_results_by_type(self, type):
        
        instance = self._create_model_by_type(type)

        key = instance.get_key_name()

        query = instance.new_query()

        query = self._use_with_trashed(query)

        return query.where_in(key, self._gather_keys_by_type(type).all()).get()
896459
function(type, handler) {
		var id = type.$instanceid;
		var obs = this._observers;
		var handlers = obs[id] || (obs[id] = []);
		if (handlers.indexOf(handler) === -1) {
			handlers.push(handler);
		}
		return type;
	}
331251
function(type, handler) {
      if (!this.listeners_)
        this.listeners_ = Object.create(null);
      if (!(type in this.listeners_)) {
        this.listeners_[type] = [handler];
      } else {
        var handlers = this.listeners_[type];
        if (handlers.indexOf(handler) < 0)
          handlers.push(handler);
      }
    }
971286
def getObjectFromUrl(url,type=nil)
      method = 'getObjectFromUrl'
      type = BaseObj if not type
      args = {:url=>url}
      return_object type,method,args,true
    end
1177977
def is_typing_handler(stream):
    
    while True:
        packet = yield from stream.get()
        session_id = packet.get('session_key')
        user_opponent = packet.get('username')
        typing = packet.get('typing')
        if session_id and user_opponent and typing is not None:
            user_owner = get_user_from_session(session_id)
            if user_owner:
                opponent_socket = ws_connections.get((user_opponent, user_owner.username))
                if typing and opponent_socket:
                    yield from target_message(opponent_socket,
                                              {'type': 'opponent-typing', 'username': user_opponent})
            else:
                pass  # invalid session id
        else:
            pass
391217
def _handle_typename(self, node, scope, ctxt, stream):
        
        self._dlog("handling typename")

        return self._handle_node(node.type, scope, ctxt, stream)
30243
private void startTwitterStream() {
        logger.info("starting {} twitter stream", streamType);

        if (stream == null) {
            logger.debug("creating twitter stream");

            stream = new TwitterStreamFactory(buildTwitterConfiguration()).getInstance();
            if (streamType.equals("user")) {
                stream.addListener(new UserStreamHandler());
            } else {
                stream.addListener(new StatusHandler());
            }

            logger.debug("twitter stream created");
        }

        if (riverStatus != RiverStatus.STOPPED && riverStatus != RiverStatus.STOPPING) {
            if (streamType.equals("filter") || filterQuery != null) {
                stream.filter(filterQuery);
            } else if (streamType.equals("firehose")) {
                stream.firehose(0);
            } else if (streamType.equals("user")) {
                stream.user();
            } else {
                stream.sample();
            }
        }
        logger.debug("{} twitter stream started!", streamType);
    }
181605
def put(self, type: Type[T], item: T) -> None:
        
        LOGGER.info("Getting SinkHandlers for \"{type}\"".format(type=type.__name__))
        try:
            handlers = self._put_types[type]
        except KeyError:
            try:
                LOGGER.info("Building new SinkHandlers for \"{type}\"".format(type=type.__name__))
                handlers = self._put_handlers(type)
            except NoConversionError:
                handlers = None
            self._get_types[type] = handlers

        LOGGER.info("Creating new PipelineContext")
        context = self._new_context()

        LOGGER.info("Sending item \"{item}\" to SourceHandlers".format(item=item))
        if handlers is not None:
            for handler in handlers:
                handler.put(item, context)