The function for generating the CLI output header.

        Args:
            query_type (:obj:`str`): The IPWhois query type. Defaults to
                'RDAP'.

        Returns:
            str: The generated output.
173371
def generate_output_header(self, query_type='RDAP'):
        

        output = '\n{0}{1}{2} query for {3}:{4}\n\n'.format(
            ANSI['ul'],
            ANSI['b'],
            query_type,
            self.obj.address_str,
            ANSI['end']
        )

        return output
1263802
def _build_query(self, ip_address):
        
        return '{}.{}.{}'.format(
            self.key, self._reverse_ip(ip_address), DNSBL_SUFFIX)
504179
def _include_query_example(self, f, method, path, api_version, server_type):
        """"""
        m = method["method"].lower()
        query_path = "{}_{}_{}.txt".format(server_type, m, self._file_path(path))
        if os.path.isfile(os.path.join(self._directory, "api", "examples", query_path)):
            f.write("Sample session\n***************\n")
            f.write("\n\n.. literalinclude:: ../../../examples/{}\n\n".format(query_path))
15856
def _map_query_path_to_outputs(construct_result, query_path_to_location_info):
    """"""
    query_path_to_output_fields = {}
    for output_name, field in six.iteritems(construct_result.fields):
        field_name = field.location.field
        output_query_path = field.location.query_path
        output_field_info = constants.SqlOutput(
            field_name=field_name,
            output_name=output_name,
            graphql_type=query_path_to_location_info[output_query_path].type)
        output_field_mapping = query_path_to_output_fields.setdefault(output_query_path, [])
        output_field_mapping.append(output_field_info)
    return query_path_to_output_fields
1043147
def query(
        self, queryEngine, query_str, vendorSpecific=None, do_post=False, **kwargs
    ):
        
        response = self.queryResponse(
            queryEngine, query_str, vendorSpecific, do_post, **kwargs
        )
        if self._content_type_is_json(response):
            return self._read_json_response(response)
        else:
            return self._read_stream_response(response)
479975
public List<T> query(String query, QueryType type)
    {
        switch (type)
        {
        case JPQL:
            return query(query);

        case NATIVE:
            return nativeQuery(query);

        default:
            throw new KunderaException("invalid query type");
        }
    }
586199
def get_query(query_name):
    
    query_file_match = list(
        filter(lambda i: query_name == i.stem, FLAT_QUERIES))
    if not query_file_match:
        return None
    # TODO: Log warning if more than one match
    query_file = query_file_match[0]
    with open(query_file) as f:
        metadata, query_body = frontmatter.parse(f.read())
    result_mod = query_file.suffix.strip('.')
    query_obj = SimpleNamespace(
        name=query_name,
        metadata=metadata,
        path=query_file,
        result_mod=result_mod,
        body=query_body,
        error=False,
        executed=datetime.utcnow().isoformat())
    return query_obj
817578
def per_callback_query_chat_id(types='all'):
    
    def f(msg):
        if (flavor(msg) == 'callback_query' and 'message' in msg
            and (types == 'all' or msg['message']['chat']['type'] in types)):
            return msg['message']['chat']['id']
        else:
            return None
    return f
1278852
def get_query_builder(self, *args, **kwargs):
        
        query_builder = self.get_query_builder_class()
        return query_builder(*args, **kwargs)
539226
def query(self,sql):
    

    msg = "QUERY\0" + sql + "\0"
    self.sfile.write(msg)

    ret, output = self.__response__()
    reply = str(output[0])

    if ret:
      msg = "Error executing query on server %d:%s" % (ret, reply)
      raise LDBDClientException, msg

    return reply
436118
def getTypeInfo(self, sql_type):  # nopep8
        
        fut = self._run_operation(self._impl.getTypeInfo, sql_type)
        return fut
533788
def result(self, *args, **kwargs):
        
        prettify = kwargs.get('pretty', False)

        sql = 'CREATE %s %s' % (self._type, self._class)
        
        if prettify:
            sql += '\n'
        else:
            sql += ' '

        if self._type.lower() == 'edge':
            sql += " FROM %s TO %s " % (self._from, self._to)
        
        if self._cluster:
            sql += 'CLUSTER %s' % self._cluster
            if prettify:
                sql += '\n'
            else:
                sql += ' '
        
        if self.data:
            sql += 'CONTENT ' + json.dumps(self.data)
        return sql
679742
def _parse_prefix_query(self, query_str):
        
        sp = smart_parsing.PrefixSmartParser()
        query = sp.parse(query_str)
        return query
704525
def base_query_url(query)
      domain = configuration.api_key ? "pro.ip-api.com" : "ip-api.com"
      url = "#{protocol}://#{domain}/json/#{query.sanitized_text}"
      url << "?" if not url_query_string(query).empty?
      url
    end
274845
def search(search_type, klass, query, options = false)
      header = {}

      # Required Data
      data = {
        'SearchType' => search_type,
        'Class'      => klass,
        'Query'      => query,
        'QueryType'  => 'DMQL2',
        'Format'     => format,
        'Count'      => '0'
      }

      # Options
      #--
      # We might want to switch this to merge!, but I've kept it like this for now because it
      # explicitly casts each value as a string prior to performing the search, so we find out now
      # if can't force a value into the string context. I suppose it doesn't really matter when
      # that happens, though...
      #++
      options.each { |k,v| data[k] = v.to_s } if options

      response = request(@urls.search, data, header)

      # TODO: make parser configurable
      results = RETS4R::Client::CompactNokogiriParser.new(response.body)

      if block_given?
        results.each {|result| yield result}
      else
        return results.to_a
      end
    end
742172
async def query_handler(service, action_type, payload, props, **kwds):
    
    # check that the action type indicates a query
    if action_type == query_action_type():
        print('encountered query event {!r} '.format(payload))
        # perform the query
        result = await parse_string(payload,
            service.object_resolver,
            service.connection_resolver,
            service.mutation_resolver,
            obey_auth=False
        )

        # the props for the reply message
        reply_props = {'correlation_id': props['correlation_id']} if 'correlation_id' in props else {}

        # publish the success event
        await service.event_broker.send(
            payload=result,
            action_type=change_action_status(action_type, success_status()),
            **reply_props
        )
701263
def data_from_query(self, cmd):
        
        res  = None
        ckey = "%s /%s" % (self.command, cmd)

        if not isinstance(self._query_params, dict):
            self._query_params = {}

        if ckey in _NCMD:
            self._cmd = _NCMD[ckey]
        else:
            for key in sorted(_RCMD, key=len, reverse=True):
                if not key.startswith("%s " % self.command):
                    continue

                m = _RCMD[key].name.match(cmd)
                if m:
                    self._cmd = _RCMD[key]
                    self._query_params.update(m.groupdict())
                    break

        try:
            if not self._cmd:
                raise self.req_error(404)

            if not self._cmd.to_log:
                self._to_log = False

            if self._cmd.to_auth:
                self.authenticate(self._cmd.auth_users)

            if self._cmd.static:
                if self._cmd.handler:
                    res = self._cmd.handler(self)

                return self.static_file(cmd, res)

            res = self._cmd.handler(self)

            if not isinstance(res, HttpResponse):
                return self.response_dumps(res)

            return res
        finally:
            self._query_params = {}