Arguments:

        rows:    get response data
        keyword: search keyword
423495
def pretty_print_domain(rows, keyword, domain):
    
    if len(rows.get('records')) == 0:
        return None

    # six columns; priority, name, content, ttl, change_date, type
    header_l = ['prio', 'name', 'content',
                'ttl', 'change date', 'type']
    # 0->4, 1->0, 2->2, 3->3, 4->5, 5->1
    header_l_sorted = ['name', 'type', 'content',
                       'ttl', 'prio', 'change date']
    header_l_sorted.reverse()

    cols_width = [len(i) for i in header_l]

    """
    if key == 'change_date':
        value = datetime.fromtimestamp(
            int(row_d.get(key))).strftime("%Y%m%d-%H%M%S")
            """

    cw_, soa = get_columns_width(rows.get('records'),
                                 cols_width, True)

    # sorted as name, type, content, ttl, priority, change_date
    cols_width_sorted = [cw_[1], cw_[5], cw_[2],
                         cw_[3], cw_[0], cw_[4]]

    if isinstance(soa, dict):
        soa_s = ('zone:        ' + soa.get('name') + '\n' +
                 'SOA record:  ' + soa.get('content') + '\n' +
                 'ttl:         ' + soa.get('ttl') + '\n' +
                 'change date: ' + soa.get('change_date'))
        domain = soa.get('name')
        print(soa_s)

    print domain

    if keyword != 'SOA':
        print_header(cols_width_sorted, header_l_sorted, len(domain))
        str_value = ''
        for row in rows.get('records'):
            if row.get('type') == 'SOA':
                pass
            else:
                # name
                if row.get('name'):
                    str_value = get_row_s(row, 'name',
                                          cols_width_sorted[0],
                                          domain=domain)
                    sys.stdout.write("|%s" % str_value)
                # type
                if row.get('type'):
                    str_value = get_row_s(row, 'type',
                                          cols_width_sorted[1])
                    sys.stdout.write("|%s" % str_value)
                # content
                if row.get('content'):
                    str_value = get_row_s(row, 'content',
                                          cols_width_sorted[2])
                    sys.stdout.write("|%s" % str_value)
                # ttl
                if row.get('ttl'):
                    str_value = get_row_s(row, 'ttl',
                                          cols_width_sorted[3])
                    sys.stdout.write("|%s" % str_value)
                # priority
                if row.get('priority') is None:
                    val = {'priority': '-'}
                else:
                    val = row.copy()
                str_value = get_row_s(val, 'priority',
                                      cols_width_sorted[4])
                sys.stdout.write("|%s" % str_value)
                if row.get('change_date') is None:
                    val = {'change_date': '-'}
                else:
                    val = row.copy()
                str_value = get_row_s(val, 'change_date',
                                      cols_width_sorted[5])
                print("|%s|" % str_value)

        print_bottom(cols_width_sorted, len(domain))
394952
def get_shots(self):
        """"""
        shots = self.response.json()['resultSets'][0]['rowSet']
        headers = self.response.json()['resultSets'][0]['headers']
        return pd.DataFrame(shots, columns=headers)
906089
def _get_data(self, kwargs):
        """"""
        if "ds" not in kwargs:
            raise ValueError("Keyword argument 'ds' missing.")

        ds = kwargs["ds"]

        if self.req_feature:
            if "feature" not in kwargs:
                raise ValueError("Keyword argument 'feature' missing.")
            return self.get_feature(ds, kwargs["feature"])
        else:
            return ds
426888
def get_row(self, row):
        ''''''

        if isinstance(self.fields, dict):
            return dict([
                (key, text_type(value).format(**row) if RE_FORMATTED.match(value) else row[value])
                for key, value in self.fields.items()
            ])
        else:
            return [text_type(field).format(**row) if RE_FORMATTED.match(field)
                    else row[field]
                    for field in self.fields]
637408
def rows(self):
        ''''''
        return (self.nested_row(o, n)
                for o in self.queryset
                for n in getattr(o, self.attribute, []))
758811
def results(self, request):
        ""
        results = {}
        form = self.form(request.GET)
        if form.is_valid():
            options = form.cleaned_data
            term = options.get('term', '')
            raw_data = self.get_query(request, term)
            results = self.format_results(raw_data, options)
        return self.response(results)
921127
def get_row_headers(rows, row_headers_count_value=0, column_headers_count=1):
    
    # TODO: REFACTOR ALGORITHM NEEDED
    partial_headers = []

    if row_headers_count_value:

        # Take partial data
        for k_index in range(0, len(rows) - column_headers_count):
            header = rows[k_index + column_headers_count][
                :row_headers_count_value]
            partial_headers.append(remove_list_duplicates(force_list(header)))

        # Populate headers
        populated_headers = populate_csv_headers(
            rows,
            partial_headers,
            column_headers_count)

        return populated_headers
959025
def getIds(self, query='*:*', fq=None, start=0, rows=1000):
        
        params = {'q': query, 'start': str(start), 'rows': str(rows), 'wt': 'python'}
        if fq is not None:
            params['fq'] = fq
        request = urllib.parse.urlencode(params, doseq=True)
        data = None
        response = {'matches': 0, 'start': start, 'failed': True, 'ids': []}
        try:
            rsp = self.doPost(self.solrBase + '', request, self.formheaders)
            data = eval(rsp.read())
        except Exception:
            pass
        if data is None:
            return response
        response['failed'] = False
        response['matches'] = data['response']['numFound']
        for doc in data['response']['docs']:
            response['ids'].append(doc['id'][0])
        return response
595123
def query(self, sql, **kwargs):
        
        if 'format' not in kwargs or kwargs['format'] == 'dataframe':
            resp = self.get('/v1/query', data={'q': sql, 'format': 'table'}).json()
            if len(resp) == 0:
                return pd.DataFrame()
            else:
                return pd.DataFrame.from_records(resp[1:], columns=resp[0],
                                                 index="_rowName")
        kwargs['q'] = sql
        return self.get('/v1/query', **kwargs).json()
1155234
def search(query, params = {})
      params = URI.escape(params.collect{|k,v| "#{k}=#{v}"}.join('&')).insert 0, "&"
      get("search/?q=#{query}#{params}")['sections'][0]['rows']
    end
335198
def search():
    """"""
    pattern = flask.request.args.get('pattern', "*").strip().lower()

    # if the pattern contains "in:<collection>" (eg: in:builtin),
    # filter results to only that (or those) collections
    # This was kind-of hacked together, but seems to work well enough
    collections = [c["name"].lower() for c in current_app.kwdb.get_collections()]
    words = []
    filters = []
    if pattern.startswith("name:"):
        pattern = pattern[5:].strip()
        mode = "name"
    else:
        mode="both"

    for word in pattern.split(" "):
        if word.lower().startswith("in:"):
            filters.extend([name for name in collections if name.startswith(word[3:])])
        else:
            words.append(word)
    pattern = " ".join(words)

    keywords = []
    for keyword in current_app.kwdb.search(pattern, mode):
        kw = list(keyword)
        collection_id = kw[0]
        collection_name = kw[1].lower()
        if len(filters) == 0 or collection_name in filters:
            url = flask.url_for(".doc_for_library", collection_id=kw[0], keyword=kw[2])
            row_id = "row-%s.%s" % (keyword[1].lower(), keyword[2].lower().replace(" ","-"))
            keywords.append({"collection_id": keyword[0],
                             "collection_name": keyword[1],
                             "name": keyword[2],
                             "synopsis": keyword[3],
                             "version": __version__,
                             "url": url,
                             "row_id": row_id
                         })

    keywords.sort(key=lambda kw: kw["name"])
    return flask.render_template("search.html",
                                 data={"keywords": keywords,
                                       "version": __version__,
                                       "pattern": pattern
                                   })
614241
def get_cell(self, row, column):
        
        url = self.build_url(self._endpoints.get('get_cell').format(row=row, column=column))
        response = self.session.get(url)
        if not response:
            return None
        return self.range_constructor(parent=self, **{self._cloud_data_key: response.json()})
1173510
def rows(self):
        
        with self.input().open('r') as fobj:
            for line in fobj:
                yield line.strip('\n').split('\t')
616290
def get_rows(self):
        
        possible_dataframes = ['F', 'FY', 'M', 'S',
                               'D_cba', 'D_pba',  'D_imp', 'D_exp',
                               'D_cba_reg', 'D_pba_reg',
                               'D_imp_reg', 'D_exp_reg',
                               'D_cba_cap', 'D_pba_cap',
                               'D_imp_cap', 'D_exp_cap', ]
        for df in possible_dataframes:
            if (df in self.__dict__) and (getattr(self, df) is not None):
                return getattr(self, df).index.get_values()
        else:
            logging.warn("No attributes available to get row names")
            return None
195487
def _parse_row(row):
        

        data = []

        labels = HtmlTable._get_row_tag(row, "th")
        if labels:
            data += labels

        columns = HtmlTable._get_row_tag(row, "td")
        if columns:
            data += columns

        return data
448874
def get_row(self, index, default=None):
        """"""
        if not isinstance(index, int) or index < 0 or index >= len(self._rows):
            return default
        return self._rows[index]
291687
def process_row(self):
        
        self.log_response_message("got ROW message")
        r = self._reader
        info = self.res_info
        info.row_count += 1
        for i, curcol in enumerate(info.columns):
            curcol.value = self.row[i] = curcol.serializer.read(r)