Feed data to parser.
483329
def feed(self, data, o: int = 0, l: int = -1):
        """"""
        if l == -1:
            l = len(data) - o
        if o < 0 or l < 0:
            raise ValueError("negative input")
        if o + l > len(data):
            raise ValueError("input is larger than buffer size")
        self._parser.buf.extend(data[o:o+l])
195006
def user_parse(data):
        """"""
        user_ = data.get('user', {})
        yield 'id', data.get('user_nsid') or user_.get('id')
        yield 'username', user_.get('username', {}).get('_content')
        first_name, _, last_name = data.get(
            'fullname', {}).get('_content', '').partition(' ')
        yield 'first_name', first_name
        yield 'last_name', last_name
56261
def setup_parser():
    """"""
    parser = argparse.ArgumentParser()
    parser.add_argument('-p', '--port', type=int, default=5005)
    parser.add_argument('-i', '--interval', type=int, default=480)
    parser.add_argument('host', type=str, help='hostname')
    return parser
753320
def parse(text, showToc=True):
	""""""
	p = Parser(show_toc=showToc)
	return p.parse(text)
301087
final protected function parseRow(): void
    {
        // only parse the next row if only one in buffer
        if (\count($this->bufferedRow) > 1) {
            return;
        }
        if (feof($this->file)) {
            $this->currentRow = null;

            return;
        }

        $this->currentRowEnded = false;
        // read file until row is ended
        while (!$this->currentRowEnded && !feof($this->file)) {
            $data = fread($this->file, 1024);
            xml_parse($this->parser, $data);
        }
    }
819425
def main():
    """"""
    global config
    parser = OptionParser(version='%prog v' + __version__)
    parser.add_option('-c', '--config', default='config.ini',
                      help='Location of config file (default: %default)',
                      metavar='FILE')
    parser.add_option('-a', '--all', action='store_true', default=False,
                      dest='all',
                      help='Send all RSS items as tweet')
    parser.add_option('-l', '--limit', dest='limit',
                      default=10,
                      help='Use with all parameters, send the first 10 feeds as a tweet')
    (options, args) = parser.parse_args()
    config = SafeConfigParser()
    if not config.read(options.config):
        print 'Could not read config file'
        sys.exit(1)
    rss_uri = config.get('rss', 'uri')
    feed = feedparser.parse(rss_uri)
    # lots of scary warnings about possible security risk using this method
    # but for local use I'd rather do this than a try-catch with open()
    if not os.path.isfile('cache.dat'):
        # make a blank cache file
        cPickle.dump({'id': None}, open('cache.dat', 'wb'), -1)

    cache = cPickle.load(open('cache.dat'))
    if options.all:
        tweet_count = 0
        for entry in feed['entries']:
            rss = {
                'id': entry['id'],
                'link': entry['link'],
                'title': entry['title'],
                'summary': entry['summary'],
                'hashtag': ' '.join(['#%s' % i for i in entry['tags'][0]['term'].split()[:2]]),
            }
            post_update('%s %s %s' % (rss['title'], rss['link'], rss['hashtag']))

            # We keep the first feed in the cache, to use rss2twitter in normal mode the next time
            if tweet_count == 0:
                cPickle.dump(rss, open('cache.dat', 'wb'), -1)

            tweet_count += 1
            if tweet_count >= options.limit:
                break
    else:
        rss = {
            'id': feed['entries'][0]['id'],
            'link': feed['entries'][0]['link'],
            'title': feed['entries'][0]['title'],
            'summary': feed['entries'][0]['summary'],
            'hashtag': ' '.join(['#%s' % i for i in feed['entries'][0]['tags'][0]['term'].split()[:2]]),
        }
        # compare with cache
        if cache['id'] != rss['id']:
            #print 'new post'
            post_update('%s %s %s' % (rss['title'], rss['link'], rss['hashtag']))
            cPickle.dump(rss, open('cache.dat', 'wb'), -1)
557479
def _parse(self):
        """"""
        while self._cur_token['type'] in (TT.ws, TT.lbreak):
            self._skip_whitespace()
            self._skip_newlines()

        self._data = self._parse_value()

        return self._data
325028
def from_string(self, html_string):
        """"""
        self._html_parser._reset().feed(html_string)
        return self._html_parser.result
1277099
def feed(self, data):
        """"""
        self._buffers.append(data)
        self._buffer_size += len(data)
        self._maybe_pause_transport()
        self._can_read.set()
275278
def parse(data)
      rss = SimpleRSS.parse data
      news = Array.new

      rss.items.each do |item|
        news_item = NewsItem.new(item.title, item.link, item.description.force_encoding("UTF-8"), item.pubDate)

        news.push news_item
      end

      unless @limit.nil?
        news.take(@limit)
      else
        news
      end
    end
941693
def run_parser_plugins(self, url_data, pagetype):
        """"""
        run_plugins(self.parser_plugins, url_data, stop_after_match=True, pagetype=pagetype)
253749
def user_parse(data):
        """"""
        for email in data.get('emails', []):
            if email.get('primary'):
                yield 'id', email.get('email')
                yield 'email', email.get('email')
                break
624873
def feed(self, data):
        
        self.reset_purified()
        HTMLParser.feed(self, data)
        return self.html()
784078
def make_parser(stream_or_string):
    """"""

    if isinstance(stream_or_string, six.string_types):

        # XXX: the pulldom.parseString() function doesn't seem to
        # like operating on unicode strings!

        return pulldom.parseString(str(stream_or_string))

    else:

        return pulldom.parse(stream_or_string)
169338
def Parse(self, filename, feed):
    
    dom = minidom.parse(filename)
    self.ParseDom(dom, feed)
205758
def parser_feed(parser, text):
    """"""
    encoded_text = text.encode('utf-8')
    return _cmark.lib.cmark_parser_feed(
        parser, encoded_text, len(encoded_text))
637341
def user_parse(data):
        """"""
        user = data.get('response', {}).get('user', {})
        yield 'id', user.get('id')
        yield 'email', user.get('contact', {}).get('email')
        yield 'first_name', user.get('firstName')
        yield 'last_name', user.get('lastName')
        city, country = user.get('homeCity', ', ').split(', ')
        yield 'city', city
        yield 'country', country