return hash with all titles, h1 and h2
548116
def all_titles_h1_h2
      return unless @page
      out = []
      out << @page.css('title').text << { @page_url => @page.css('h1').text }
      out << { @page_url => @page.css('h2').text }
      out
    end
1359686
def to_h
      keys.map { |k| [k, map { |h| h[k] }] }.to_h
    end
672150
def hbp_namespace(name: str, sha: Optional[str] = None) -> str:
    """"""
    return HBP_NAMESPACE_URL.format(sha=sha or LAST_HASH, keyword=name)
631634
function findIssueByTitle (client, repo, title) {
  title = title.toLowerCase();
  return allIssues(client, repo).then(_.partialRight(_.find, function (issue) {
    return issue.title.toLowerCase() === title;
  }));
}
10961
def find_by_hash(self, hash=None, book=-1):
        ''''''
        if hash:
            self.fyi("nota.find_by_hash() with abbreviated hash %s; book=%s" % (hash, book))
        try:
            if book < 0:
                rows = self.cur.execute("SELECT noteId, hash FROM note WHERE book > 0;").fetchall()
            else:
                rows = self.cur.execute("SELECT noteId, hash FROM note WHERE book=?;", [book]).fetchall()
        except:
            self.error("nota.find_by_hash() cannot look up note list")
        # Possibly save time by finding IDs first.
        noteIds = []
        if hash:
            l = len(hash)
            for r in rows:
                if hash == r[1][0:l]:
                    noteIds.append((r[0],))
        else:
            for r in rows:
                noteIds.append((r[0],))
        self.fyi("noteIds: %s" % noteIds)
        rval = []
        for n in noteIds:
            try:
                note = self.cur.execute("SELECT noteId, authorId, date, title, content, due, privacy, modified, hash, book FROM note WHERE noteId=?;", n).fetchone()
            except:
                self.warning("Problem extracting note %s from database" % n)
                next
            if note:
                date = note[2]
                due = note[5]
                privacy = note[6]
                keywordIds = []
                keywordIds.extend(self.con.execute("SELECT keywordid FROM notekeyword WHERE notekeyword.noteid=?;", n))
                keywords = []
                for k in keywordIds:
                    keywords.append(self.cur.execute("SELECT keyword FROM keyword WHERE keywordId=?;", k).fetchone()[0])
                rval.append({"noteId":note[0], "title":note[3], "keywords":keywords,
                    "content":note[4], "due":note[5], "privacy":note[6],
                    "date":note[2], "modified":note[7], "hash":note[8], "book":note[9]})
        return rval
1265789
def find_header(header)
      {}.tap do |returning|
        contents.scan(header_with_content_regexp(header)).flatten.first.split("\n").each do |setting|
          name, value = *setting.split('=').map(&:strip)
          returning[name] = value
        end
      end
    end
1216082
def to_hash(retain_references=false)
      if retain_references then
        canton        = @canton
        agglomeration = @agglomeration
      else
        canton        = @canton && @canton.license_tag
        agglomeration = @agglomeration && @agglomeration.community_number
      end

      {
        :community_number => @community_number,
        :name             => @name,
        :canton           => canton,
        :agglomeration    => agglomeration,
      }
    end
398390
def process_headers(data, filename):
    """"""
    headers = []
    if 'toc' in data:
        for element in PyQuery(data['toc'])('a'):
            headers.append(recurse_while_none(element))
        if None in headers:
            log.info('Unable to index file headers for: %s', filename)
    return headers
1079151
def to_hash(val)
      if @options[:humidity] then
        return {"humidity" => val.humidity}
      end

      if @options[:unit] == :c then
        if @options[:temperature] then
          return {"temperature" => val.temp}
        else
          return {"temperature" => val.temp, "humidity" => val.humidity}
        end
      else
        if @options[:temperature] then
          return {"temperature" => val.temp_f}
        else
          return {"temperature" => val.temp_f, "humidity" => val.humidity}
        end
      end
    end
919935
def read_and_hash(fname, **kw):
    '''
    
    '''
    return [addhash(frame, **kw) for frame in read(fname, **kw)];
233384
def get_hash_for_filename(filename, hashfile_path):
    """"""
    filehash = ''
    with open(hashfile_path, 'r') as stream:
        for _cnt, line in enumerate(stream):
            if line.rstrip().endswith(filename):
                filehash = re.match(r'^[A-Za-z0-9]*', line).group(0)
                break
    if filehash:
        return filehash
    raise AttributeError("Filename %s not found in hash file" % filename)
234845
def title_and_h1_good?
      return unless @page
      arr = []
      @page.css('h1').each { |node| arr << node.text }
      @page.css('title').size == 1 && arr.uniq.size == arr.size
    end
1064113
def all_h2
      result = []
      @pages.each do |page|
        result << [page.page_url, page.h2_text] unless page.page_a_tags
      end
      result
    end
613997
def hashes
      all_rows = rows.locate
      header_row = all_rows.first || raise(Error, 'no rows in table')

      all_rows.entries[1..-1].map do |row|
        cell_size_check(header_row, row)
        Hash[headers(header_row).map(&:text).zip(row.cells.map(&:text))]
      end
    end
1245168
def headers
      list = @response.header_str.split(/[\r\n]+/).map(&:strip)
      Hash[list.flat_map{ |s| s.scan(/^(\S+): (.+)/) }.map { |pair|
        [pair.first.to_s.camelcase, pair.second]
      }]
    end
355910
def process_hash_row(hsh)
      if @headers.any?
        keys_or_values = hsh.values
        @row_id = hsh[:row_id]
      else
        keys_or_values = hsh.keys.map(&:to_s)
      end

      file_line = keys_or_values.join(',')
      validated_line = utf_filter(check_utf(file_line))
      res = line_parse(validated_line)
      res
    end
1272835
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'title') and self.title is not None:
            _dict['title'] = self.title
        if hasattr(self, 'hash') and self.hash is not None:
            _dict['hash'] = self.hash
        return _dict