#client or #msg query: Looks for the given attribute in RTD.
329305
async def handler(event):
    """"""
    await event.delete()

    await event.respond(
        get_docs_message(kind=event.pattern_match.group(1),
                         query=event.pattern_match.group(2)),
        reply_to=event.reply_to_msg_id
    )
1350452
private void parseAttributes(Context context, AttributeSet attrs, int defStyle){
        int defaultColor = context.getResources().getColor(R.color.black26);
        final TypedArray a = context.obtainStyledAttributes(attrs,
                R.styleable.EmptyView, defStyle, 0);
        if (a == null) {
            mEmptyMessageColor = defaultColor;
            mEmptyActionColor = defaultColor;
            mEmptyMessageTextSize = (int) SizeUtils.dpToPx(context, 18);
            mEmptyActionTextSize = (int) SizeUtils.dpToPx(context, 14);
            mEmptyMessageTypeface = Face.ROBOTO_REGULAR;
            mEmptyIconPadding = getResources().getDimensionPixelSize(R.dimen.activity_padding);
            return;
        }

        // Parse attributes
        mEmptyIcon = a.getResourceId(R.styleable.EmptyView_emptyIcon, -1);
        mEmptyIconSize = a.getDimensionPixelSize(R.styleable.EmptyView_emptyIconSize, -1);
        mEmptyIconColor = a.getColor(R.styleable.EmptyView_emptyIconColor, defaultColor);
        mEmptyIconPadding = a.getDimensionPixelSize(R.styleable.EmptyView_emptyIconPadding, getResources().getDimensionPixelSize(R.dimen.activity_padding));

        mEmptyMessage = a.getString(R.styleable.EmptyView_emptyMessage);
        mEmptyMessageColor = a.getColor(R.styleable.EmptyView_emptyMessageColor, defaultColor);
        int typeface = a.getInt(R.styleable.EmptyView_emptyMessageTypeface, 0);
        mEmptyMessageTypeface = MessageTypeface.from(typeface).getTypeface();
        mEmptyMessageTextSize = a.getDimensionPixelSize(R.styleable.EmptyView_emptyMessageTextSize,
                (int) SizeUtils.dpToPx(context, 18));

        mEmptyActionColor = a.getColor(R.styleable.EmptyView_emptyActionColor, defaultColor);
        mEmptyActionText = a.getString(R.styleable.EmptyView_emptyActionText);
        mEmptyActionTextSize = a.getDimensionPixelSize(R.styleable.EmptyView_emptyActionTextSize,
                (int) SizeUtils.dpToPx(context, 14));

        mState = a.getInt(R.styleable.EmptyView_emptyState, STATE_EMPTY);

        a.recycle();
    }
1373055
def query_decl(self, **kwargs):
        """"""
        return self.session.query(Decl).filter_by(**kwargs).all()
927018
def query( self ):
        
        widget = self.uiWidgetAREA.widget()
        if ( widget and type(widget) != QWidget ):
            value = nativestring(widget.text())
        else:
            value = ''
        
        op = nativestring(self.uiOperatorDDL.currentText())
        if ( self.currentRule() ):
            op = self.currentRule().labelOperator(op)
        
        return (nativestring(self.uiTermDDL.currentText()), op, value)
693507
def find(value):
        
        value = str(value).lower()
        rtn_dict = RegistryDictionary()
        for attr in dir(MODULE.rdfclass):
            if value in attr.lower():
                try:
                    item = getattr(MODULE.rdfclass, attr)
                    if issubclass(item, RdfClassBase):
                        rtn_dict[attr] = item
                except TypeError:
                    pass
        return rtn_dict
250580
def get_current_client(self):
        """"""
        try:
            client = self.tabwidget.currentWidget()
        except AttributeError:
            client = None
        if client is not None:
            return client
610022
def Get(self):
    """"""
    try:
      with io.open(self.logfile, "rb") as fd:
        data = fd.read(self.max_log_size)
    except (IOError, OSError):
      return

    try:
      if data:
        return rdf_flows.GrrMessage.FromSerializedString(data)
    except (message.Error, rdfvalue.Error):
      return
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
178581
public void queryMessagesByType(int msgType, int limit, final AVIMMessagesQueryCallback callback) {
    queryMessagesByType(msgType, null, 0, limit, callback);
  }
221817
def GetLabelFromFleetspeak(client_id):
  """"""
  res = fleetspeak_connector.CONN.outgoing.ListClients(
      admin_pb2.ListClientsRequest(client_ids=[GRRIDToFleetspeakID(client_id)]))
  if not res.clients or not res.clients[0].labels:
    return fleetspeak_connector.unknown_label

  for label in res.clients[0].labels:
    if label.service_name != "client":
      continue
    if label.label in fleetspeak_connector.label_map:
      return fleetspeak_connector.label_map[label.label]

  return fleetspeak_connector.unknown_label
1207571
def CollectionItemToClientPath(item, client_id=None):
  """"""
  if isinstance(item, rdf_flows.GrrMessage):
    client_id = item.source
    item = item.payload
  elif isinstance(item, rdf_flow_objects.FlowResult):
    client_id = item.client_id
    item = item.payload

  if client_id is None:
    raise ValueError("Could not determine client_id.")
  elif isinstance(client_id, rdfvalue.RDFURN):
    client_id = client_id.Basename()

  if isinstance(item, rdf_client_fs.StatEntry):
    return db.ClientPath.FromPathSpec(client_id, item.pathspec)
  elif isinstance(item, rdf_file_finder.FileFinderResult):
    return db.ClientPath.FromPathSpec(client_id, item.stat_entry.pathspec)
  elif isinstance(item, collectors.ArtifactFilesDownloaderResult):
    if item.HasField("downloaded_file"):
      return db.ClientPath.FromPathSpec(client_id,
                                        item.downloaded_file.pathspec)

  raise ItemNotExportableError(item)
535293
def find(self, resource_id, query=None, **kwargs):
        """"""

        if query is None:
            query = {}
        return self.client._get(
            self._url(resource_id),
            query,
            **kwargs
        )
884807
def resource_type(self):
        
        value = "rt="
        lst = self._attributes.get("rt")
        if lst is None:
            value = ""
        else:
            value += "\"" + str(lst) + "\""
        return value
728931
def query(method='GET', profile_dict=None, url=None, path='api/v1',
          action=None, api_key=None, service=None, params=None,
          data=None, subdomain=None, client_url=None, description=None,
          opts=None, verify_ssl=True):
    '''
    
    '''
    user_agent = 'SaltStack {0}'.format(__version__)

    if opts is None:
        opts = {}

    if isinstance(profile_dict, dict):
        creds = profile_dict
    else:
        creds = {}

    if api_key is not None:
        creds['pagerduty.api_key'] = api_key

    if service is not None:
        creds['pagerduty.service'] = service

    if subdomain is not None:
        creds['pagerduty.subdomain'] = subdomain

    if client_url is None:
        client_url = 'https://{0}.pagerduty.com'.format(
            creds['pagerduty.subdomain']
        )

    if url is None:
        url = 'https://{0}.pagerduty.com/{1}/{2}'.format(
            creds['pagerduty.subdomain'],
            path,
            action
        )

    if params is None:
        params = {}

    if data is None:
        data = {}

    data['client'] = user_agent

    # pagerduty.service is not documented.  While it makes sense to have in
    # some cases, don't force it when it is not defined.
    if 'pagerduty.service' in creds and creds['pagerduty.service'] is not None:
        data['service_key'] = creds['pagerduty.service']
    data['client_url'] = client_url
    if 'event_type' not in data:
        data['event_type'] = 'trigger'
    if 'description' not in data:
        if not description:
            data['description'] = 'SaltStack Event Triggered'
        else:
            data['description'] = description

    headers = {
        'User-Agent': user_agent,
        'Authorization': 'Token token={0}'.format(creds['pagerduty.api_key'])
    }
    if method == 'GET':
        data = {}
    else:
        headers['Content-type'] = 'application/json'

    result = salt.utils.http.query(
        url,
        method,
        params=params,
        header_dict=headers,
        data=salt.utils.json.dumps(data),
        decode=False,
        text=True,
        opts=opts,
    )

    return result['text']
97368
function _getMessage(attribute, rule) {

    var message = _messages[rule];
    if (is_object(message)) {
      var value = _getValue(attribute);
      if (is_array(value) && message['array']) {
        return message['array'];
      } else if (_resolvers.numeric(value) && message['numeric']) {
        return message['numeric'];
      } else if (is_string(value) && message['string']){
        return message['string'];
      }
    };

    return message;
  }
274328
def find(self, name):
        

        try:
            att = self.attr(name)
            if att._index is None:
                att = None
        except HDF4Error:
            att = None
        return att
1259831
def get_motor_attr(motor_class, name, *defargs):
    
    attr = safe_getattr(motor_class, name)

    # Store some info for process_motor_nodes()
    full_name = '%s.%s.%s' % (
        motor_class.__module__, motor_class.__name__, name)

    full_name_legacy = 'motor.%s.%s.%s' % (
        motor_class.__module__, motor_class.__name__, name)

    # These sub-attributes are set in motor.asynchronize()
    has_coroutine_annotation = getattr(attr, 'coroutine_annotation', False)
    is_async_method = getattr(attr, 'is_async_method', False)
    is_cursor_method = getattr(attr, 'is_motorcursor_chaining_method', False)
    if is_async_method or is_cursor_method:
        pymongo_method = getattr(
            motor_class.__delegate_class__, attr.pymongo_method_name)
    else:
        pymongo_method = None

    # attr.doc is set by statement like 'error = AsyncRead(doc="OBSOLETE")'.
    is_pymongo_doc = pymongo_method and attr.__doc__ == pymongo_method.__doc__

    motor_info[full_name] = motor_info[full_name_legacy] = {
        'is_async_method': is_async_method or has_coroutine_annotation,
        'is_pymongo_docstring': is_pymongo_doc,
        'pymongo_method': pymongo_method,
    }

    return attr