decide if the status is retweetable
6163
def retweet?(status)
      filters = load_filters
      retweet = true
      if !filters.nil?
        filters.each_pair do |path, value|
          array = []
          array << value
          array.flatten.each do |filter_value|
            path_value = StreamBot::ArrayPath.get_path(status, path)
            if path_value.eql?(filter_value) || path_value.include?(filter_value)
              on_match.trigger(status, path, filter_value)
              retweet = false
            end
          end
        end
      end
      retweet
    end
65476
def on_data(self, raw_data):
        
        data = json.loads(raw_data)

        if 'in_reply_to_status_id' in data:
            status = Status.parse(self.api, data)
            if self.on_status(status) is False:
                return False
        elif 'delete' in data:
            delete = data['delete']['status']
            if self.on_delete(delete['id'], delete['user_id']) is False:
                return False
        elif 'event' in data:
            status = Status.parse(self.api, data)
            if self.on_event(status) is False:
                return False
        elif 'direct_message' in data:
            status = Status.parse(self.api, data)
            if self.on_direct_message(status) is False:
                return False
        elif 'friends' in data:
            if self.on_friends(data['friends']) is False:
                return False
        elif 'limit' in data:
            if self.on_limit(data['limit']['track']) is False:
                return False
        elif 'disconnect' in data:
            if self.on_disconnect(data['disconnect']) is False:
                return False
        elif 'warning' in data:
            if self.on_warning(data['warning']) is False:
                return False
        else:
            logging.error("Unknown message type: " + str(raw_data))
661191
def _check_for_pending(self, *args, **kwargs):
        
        if self._notification_pending and not self._processing:
            self._processing = True
            args, kwargs = self._data
            self._notify(*args, **kwargs)
            self._notification_pending = False
            self._processing = False
415709
def status(self):
        """"""
        status = self.receiver.status(self)
        return status if status else (
            self.response_code, self.response.get('message')
        )
957966
def status(cls):
        """"""
        return cls.json_get('%s/status' % cls.api_url, empty_key=True,
                            send_key=False)
234270
def status(self, reference_id, **params):
        
        return self.get(MESSAGING_STATUS_RESOURCE.format(reference_id=reference_id),
                        **params)
162849
@Override
    public void getRetweets(final long statusId) {
        getDispatcher().invokeLater(new AsyncTask(RETWEETS, listeners) {
            @Override
            public void invoke(List<TwitterListener> listeners) throws TwitterException {
                ResponseList<Status> statuses = twitter.getRetweets(statusId);
                for (TwitterListener listener : listeners) {
                    try {
                        listener.gotRetweets(statuses);
                    } catch (Exception e) {
                        logger.warn("Exception at getRetweets", e);
                    }
                }
            }
        });
    }
177553
def status(self, message, *args, **kwargs):
    """"""
    if self.isEnabledFor(GNUPG_STATUS_LEVEL):
        self._log(GNUPG_STATUS_LEVEL, message, args, **kwargs)
362609
def get_status(self, json_status=None):
        
        if json_status:
            self.json_status = json_status

        if self.json_status not in AjaxResponseStatus.choices:
            raise ValueError(
                "Invalid status selected: '{}'".format(self.json_status))

        return self.json_status
629817
def is_pending(self):
        """"""
        return self.status == Status.published and self.timestamp >= arrow.now()
707671
def parse_one(tweet)
      puts "==> #{tweet['id']}" if @options.verbose
      retdict = {
        mentions: {},
        hashtags: {},
        time_of_day: 0,
        retweet: false,
        client: {
          name: "",
          url: "",
        },
        smileys: {}
      }

      # check if the tweet is actually a retweet and ignore the status text
      unless tweet['retweeted_status'].nil?
        retdict[:retweet] = true
      else
        # scan for mentions
        tweet['text'].scan USERNAME_REGEX do |user|
          hash_user = user[0].downcase
          puts "===> mentioned: #{user[0]}" if @options.verbose
          unless @config[:ignored_users].include? hash_user
            if @config[:renamed_users].include? hash_user.to_sym
              hash_user = @config[:renamed_users][hash_user.to_sym]
            end
            retdict[:mentions][hash_user] ||= {}
            retdict[:mentions][hash_user][:name] ||= user[0]
            retdict[:mentions][hash_user][:count] = retdict[:mentions][hash_user][:count].to_i.succ
            retdict[:mentions][hash_user][:example] ||= { text: tweet['text'], id: tweet['id'] }
          end
        end

        # scan for hashtags
        tweet['text'].scan HASHTAG_REGEX do |hashtag|
          hash_hashtag = hashtag[0].downcase
          puts "===> hashtag: ##{hashtag[0]}" if @options.verbose
          retdict[:hashtags][hash_hashtag] ||= {}
          retdict[:hashtags][hash_hashtag][:hashtag] ||= hashtag[0]
          retdict[:hashtags][hash_hashtag][:count] = retdict[:hashtags][hash_hashtag][:count].to_i.succ
          retdict[:hashtags][hash_hashtag][:example] ||= { text: tweet['text'], id: tweet['id'] }
        end

        # Smileys :^)
        eyes = "[xX8;:=%]"
        nose = "[-oc*^]"
        smile_regex = /(>?#{eyes}'?#{nose}[\)pPD\}\]>]|[\(\{\[<]#{nose}'?#{eyes}<?|[;:][\)pPD\}\]\>]|\([;:]|\^[_o-]*\^[';]|\\[o.]\/)/
        frown_regex = /(#{eyes}'?#{nose}[\(\[\\\/\{|]|[\)\]\\\/\}|]#{nose}'?#{eyes}|[;:][\(\/]|[\)D]:|;_+;|T_+T|-[._]+-)/

        unescaped_tweet = tweet['text'].gsub("&amp;", "&").gsub("&lt;", "<").gsub("&gt;", ">")

        unescaped_tweet.scan smile_regex do |smile|
          smile = smile[0]
          puts "===> smile: #{smile}" if @options.verbose
          retdict[:smileys][smile] ||= {frown: false}
          retdict[:smileys][smile][:smiley] ||= smile
          retdict[:smileys][smile][:count] = retdict[:smileys][smile][:count].to_i.succ
          retdict[:smileys][smile][:example] ||= { text: tweet['text'], id: tweet['id'] }
        end

        unescaped_tweet.scan frown_regex do |frown|
          break unless unescaped_tweet !~ /\w+:\/\// # http:// :^)
          frown = frown[0]
          puts "===> frown: #{frown}" if @options.verbose
          retdict[:smileys][frown] ||= {frown: true}
          retdict[:smileys][frown][:smiley] ||= frown
          retdict[:smileys][frown][:count] = retdict[:smileys][frown][:count].to_i.succ
          retdict[:smileys][frown][:example] ||= { text: tweet['text'], id: tweet['id'] }
        end
      end

      # Tweet source (aka. the client the (re)tweet was made with)
      source_matches = tweet['source'].match SOURCE_REGEX
      retdict[:client][:url]  = source_matches[1]
      retdict[:client][:name] = source_matches[2]

      # Time of day
      retdict[:time_of_day] = (tweet['created_at'].match(/^\d{4}-\d{2}-\d{2} (\d{2})/)[1].to_i + @config[:timezone_difference]) % 24

      retdict
    end
1218246
def next(self):
        """"""
        if self.limit and self.limit == self.num_tweets:
            raise StopIteration

        if self.index >= len(self.results) - 1:
            data = self.method(max_id=self.max_id, parser=RawParser(), *self.args, **self.kargs)

            if hasattr(self.method, '__self__'):
                old_parser = self.method.__self__.parser
                # Hack for models which expect ModelParser to be set
                self.method.__self__.parser = ModelParser()

            # This is a special invocation that returns the underlying
            # APIMethod class
            model = ModelParser().parse(self.method(create=True), data)
            if hasattr(self.method, '__self__'):
                self.method.__self__.parser = old_parser
                result = self.method.__self__.parser.parse(self.method(create=True), data)
            else:
                result = model

            if len(self.results) != 0:
                self.index += 1
            self.results.append(result)
            self.model_results.append(model)
        else:
            self.index += 1
            result = self.results[self.index]
            model = self.model_results[self.index]

        if len(result) == 0:
            raise StopIteration
        # TODO: Make this not dependant on the parser making max_id and
        # since_id available
        self.max_id = model.max_id
        self.num_tweets += 1
        return result
82719
def cmd(send, msg, args):
    
    if not msg:
        send('What do you think I am, a bird?')
        return

    parser = arguments.ArgParser(args['config'])
    parser.add_argument('query', nargs='*')
    group = parser.add_mutually_exclusive_group()
    group.add_argument('--user', dest='user', default=None)
    group.add_argument('--count', dest='count', type=int, default=1)
    group.add_argument('--random', action='store_true', default=False)

    try:
        cmdargs = parser.parse_args(msg)
    except arguments.ArgumentException as e:
        send(str(e))
        return

    api = get_search_api(args['config'])

    query = TwitterSearchOrder()
    keywords = [' '.join(cmdargs.query)]
    if cmdargs.user:
        keywords += ['from:{}'.format(cmdargs.user)]
    query.set_keywords(keywords)
    query.set_language('en')
    query.set_result_type('recent')
    query.set_include_entities(False)
    query.set_count(cmdargs.count)

    results = list(api.search_tweets_iterable(query))
    if not results:
        send('No tweets here!')
        return

    if cmdargs.random:
        shuffle(results)

    max_chan_tweets = 5
    max_pm_tweets = 25
    if cmdargs.count > max_pm_tweets:
        send("That's too many tweets! The maximum allowed through PM is {}".format(max_pm_tweets))
        return

    if cmdargs.count > max_chan_tweets:
        send("That's a lot of tweets! The maximum allowed in a channel is {}".format(max_chan_tweets))

    for i in range(0, min(cmdargs.count, max_pm_tweets)):
        if cmdargs.count <= max_chan_tweets:
            send(tweet_text(results[i]))
        else:
            send(tweet_text(results[i]), target=args['nick'])
991514
def get_current_status(self):
        """"""
        url = get_url("/remote/status.json")
        params = {"oauth": self._oauth_token, "csrf": self._csrf_token}
        r = self._request(url=url, params=params)
        return r.json()
1353742
def say_status(status, message, log_status = true)
      Strainer.log.info("status: #{status}, message: #{message}")

      return if quiet?
      super(status, message, log_status)
    end
595433
def on_error(self, status_code):
        """"""
        logger.error('Twitter returned error code %s', status_code)
        self.error = status_code
        return False
779962
def _tweepy_status_to_tweet(self, status):
        
        tweet = Tweet()
        tweet.published_at = status.created_at
        tweet.content = status.text

        return tweet