Parse resource identifier.
429789
def parse(self) -> InstanceRoute:
        """"""
        res = InstanceRoute()
        if self.at_end():
            return res
        if self.peek() == "/":
            self.offset += 1
        if self.at_end():
            return res
        sn = self.schema_node
        while True:
            name, ns = self.prefixed_name()
            cn = sn.get_data_child(name, ns)
            if cn is None:
                for cn in sn.children:
                    if (isinstance(cn, RpcActionNode) and cn.name == name and
                            (ns is None or cn.ns == ns)):
                        res.append(ActionName(name, ns))
                        return res
                raise NonexistentSchemaNode(sn.qual_name, name, ns)
            res.append(MemberName(name, ns))
            if self.at_end():
                return res
            if isinstance(cn, SequenceNode):
                self.char("=")
                res.append(self._key_values(cn))
                if self.at_end():
                    return res
            else:
                self.char("/")
            sn = cn
811168
def user_parse(data):
        """"""
        yield 'id', data.get('id')
        yield 'email', data.get('email')
        yield 'first_name', data.get('given_name')
        yield 'last_name', data.get('family_name')
        yield 'link', data.get('link')
        yield 'locale', data.get('locale')
        yield 'picture', data.get('picture')
        yield 'gender', data.get('gender')
1323022
def _identifiers(self):
        """"""
        for handle in self._storage_broker.iter_item_handles():
            yield dtoolcore.utils.generate_identifier(handle)
117526
def get_parse(self, uri, params={}):
        '''
        '''
        return self._request_parse(self.get, uri, params)
1251517
def get_resource_data(incoming_request):
    """"""
    content_type = incoming_request.headers['Content-type'].split(';')[0]
    if ('Content-type' not in incoming_request.headers or
            content_type in JSON_CONTENT_TYPES):
        return incoming_request.json
    elif content_type in HTML_CONTENT_TYPES:
        if not incoming_request.form:
            raise InvalidAPIUsage(400)
        return incoming_request.form
    else:
        # HTTP 415: Unsupported Media Type
        raise InvalidAPIUsage(
            415,
            UNSUPPORTED_CONTENT_TYPE_MESSAGE.format(
                types=incoming_request.headers['Content-type']))
927362
def Parse(self):
    """"""
    for data in self.Query(self.EVENTS_QUERY):
      (timestamp, agent_bundle_identifier, agent_name, url, sender,
       sender_address, type_number, title, referrer, referrer_alias) = data
      yield [
          timestamp, "OSX_QUARANTINE", url, referrer, title, agent_name,
          agent_bundle_identifier, sender, sender_address, type_number,
          referrer_alias
      ]
1258682
def get_resource(id_or_uri, opts = {})
      data, _status_code, _headers = get_resource_with_http_info(id_or_uri, opts)
      return data
    end
544747
def get_resources(cls):
        """"""
        my_plurals = resource_helper.build_plural_mappings(
            {}, RESOURCE_ATTRIBUTE_MAP)
        attributes.PLURALS.update(my_plurals)
        attr_map = RESOURCE_ATTRIBUTE_MAP
        resources = resource_helper.build_resource_info(my_plurals,
                                                        attr_map,
                                                        constants.A10_DEVICE_INSTANCE)

        return resources
269848
def Parse(self, stat, knowledge_base):
    """"""
    value = stat.registry_data.GetValue()
    if not value:
      raise parser.ParseError("Invalid value for key %s" % stat.pathspec.path)
    value = artifact_utils.ExpandWindowsEnvironmentVariables(
        value, knowledge_base)
    if value:
      yield rdfvalue.RDFString(value)
1207706
def resource(resource_id):
    """"""
    resource_obj = app.db.resource(resource_id)

    if 'raw' in request.args:
        return send_from_directory(os.path.dirname(resource_obj.path),
                                   os.path.basename(resource_obj.path))

    return render_template('resource.html', resource=resource_obj)
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
309982
def __parse(self, stream):
        """"""

        if not stream:
            raise InvalidFormatError(cause="stream cannot be empty or None")

        json = self.__load_json(stream)

        self.__parse_organizations(json)
        self.__parse_identities(json)
        self.__parse_blacklist(json)
642345
def parse_href(href):
    """"""
    url = urlparse(href)
    path = url.path.split('/')
    collection_name = path[1]
    id_ = path[2]
    return collection_name, id_
51779
def _parse_plugin_id(self, plugin_id):
        """"""
        m = re.match("(.+)(_\d{4}_\d{2}_\d{2}_)(.+)", plugin_id)
        if m:
            return m.group(1)
        m = re.match("(.+)(_release_)(.+)", plugin_id)
        if m:
            return m.group(1)

        raise RuntimeError("Repository could not be determined from "
                           "the upgrade identifier: %s." % plugin_id)
1332191
public Url fromIdentifier(String identifier) {
        Matcher matcher = identifierPattern.matcher(identifier);
        if (!matcher.matches()) {
            throw new RuntimeException(String.format("Couldn't parse identifier %s", identifier));
        }

        String resourceType = matcher.group(1);
        if (resourceType != null) {
            resourceType(resourceType);
        }

        String type = matcher.group(2);
        if (type != null) {
            type(type);
        }

        String version = matcher.group(3);
        if (version != null) {
            version(version);
        }

        String publicId = matcher.group(4);
        if (publicId != null) {
            publicId(publicId);
        }

        String format = matcher.group(5);
        if (format != null) {
            format(format);
        }

        // Signature (group 6) is not used

        return this;
    }
453136
def _resource(resource, pretty: bool = None, **data):
    """"""
    data = clean_data(data)

    ctx = click.get_current_context()
    if ctx.obj.get("env_prefix"):
        data["env_prefix"] = ctx.obj["env_prefix"]

    rsp = resource(**data)
    dump = partial(json.dumps, indent=4) if pretty else partial(json.dumps)
    click.echo(dump(rsp))
34907
def parse_resource(name):
    
    with closing(pkg_resources.resource_stream(__name__, name)) as fp:
        rbytes = fp.read()

    return _load(StringIO(rbytes.decode('utf-8')))