Get static parent resource of :raml_resource: with HTTP
    method :method:.

    :param raml_resource:Instance of ramlfications.raml.ResourceNode.
    :param method: HTTP method name which matching static resource
        must have.
973257
def get_static_parent(raml_resource, method=None):
    
    parent = raml_resource.parent
    while is_dynamic_resource(parent):
        parent = parent.parent

    if parent is None:
        return parent

    match_method = method is not None
    if match_method:
        if parent.method.upper() == method.upper():
            return parent
    else:
        return parent

    for res in parent.root.resources:
        if res.path == parent.path:
            if res.method.upper() == method.upper():
                return res
248590
def parent(self, resource):
        
        resource.check()
        self['parent_type'] = resource.type
        self['parent_uuid'] = resource.uuid
1325944
def check_node_parent(
        self, resource_id, new_parent_id, db_session=None, *args, **kwargs
    ):
        
        return self.service.check_node_parent(
            resource_id=resource_id,
            new_parent_id=new_parent_id,
            db_session=db_session,
            *args,
            **kwargs
        )
1005970
def get(self, resource_id=None):
        
        if request.path.endswith('meta'):
            return self._meta()

        if resource_id is None:
            error_message = is_valid_method(self.__model__)
            if error_message:
                raise BadRequestException(error_message)

            if 'export' in request.args: 
                return self._export(self._all_resources())

            return flask.jsonify({
                self.__json_collection_name__: self._all_resources()
                })
        else:
            resource = self._resource(resource_id)
            error_message = is_valid_method(self.__model__, resource)
            if error_message:
                raise BadRequestException(error_message)
            return jsonify(resource)
566945
def get_resource_siblings(raml_resource):
    
    path = raml_resource.path
    return [res for res in raml_resource.root.resources
            if res.path == path]
884548
def get_all(cls, parent=None, **params):

        if parent is not None:
            route = copy(parent.route)
        else:
            route = {}
        if cls.ID_NAME is not None:
            # Empty string triggers "get all resources"
            route[cls.ID_NAME] = ""

        base_obj = cls(key=parent.key, route=route, config=parent.config)
        """"""

        start = datetime.now()
        r = requests.get(
            base_obj._url(), auth=(base_obj.key, ""), params=params)
        cls._delay_for_ratelimits(start)

        if r.status_code not in cls.TRUTHY_CODES:
            return base_obj._handle_request_exception(r)

        response = r.json()
        objects_data = response.get(base_obj.ENVELOPE or base_obj, [])

        return_objects = []
        for data in objects_data:
            # Note that this approach does not get meta data
            return_objects.append(
                cls.get(
                    parent=parent,
                    id=data.get(cls.ID_NAME, data.get("id")),
                    data=data))

        return return_objects
1337337
def get_method_name(resource, method_type):
        
        return '{}_{}'.format(method_type.lower(), resource.Meta.name.lower())
837778
def get_method(self, node):
        '''
        '''
        methods = self._methods
        for methodname in self.get_methodnames(node):
            if methodname in methods:
                return methods[methodname]
            else:
                cls = self.__class__
                method = getattr(cls, methodname, None)
                if method is not None:
                    methods[methodname] = method
                    return method
1121535
def method_missing(name, *args, &block)
      if self.class.resources.keys.include?(name)
        resources[name] ||= self.class.resources[name].new(self)
        resources[name]
      else
        super
      end
    end
63863
def get(cls, resource_id):
        
        res = Resource.get(resource_id)
        return cls(res) if res else None
527406
@Nullable
  public static MethodTree findMethod(MethodSymbol symbol, VisitorState state) {
    return JavacTrees.instance(state.context).getTree(symbol);
  }
725846
public static MethodHelpDto fromMethodClass(String parentPath, Method method) {
        String methodName = _getHttpMethod(method);
        Path path = method.getAnnotation(Path.class);
        Description description = method.getAnnotation(Description.class);
        Produces produces = method.getAnnotation(Produces.class);
        Consumes consumes = method.getAnnotation(Consumes.class);

        if ((path == null || !path.value().contains("help")) && description != null) {
            String relativePath = path == null ? "" : path.value();
            String fullPath = parentPath == null ? relativePath : parentPath + relativePath;
            MethodHelpDto result = new MethodHelpDto();

            result.setDescription(description.value());
            result.setMethod(methodName);
            result.setPath(fullPath);
            if (produces != null) {
                result.setProduces(produces.value());
            }
            if (consumes != null) {
                result.setConsumes(consumes.value());
            }

            List<MethodParameterDto> params = _getMethodParams(method);

            result.setParams(params);
            return result;
        } else {
            return null;
        }
    }
1253130
def get_resources(self, request, **resources):
        

        if self.parent:
            resources = self.parent.get_resources(request, **resources)

        pks = (
            resources.get(self._meta.name) or
            request.REQUEST.getlist(self._meta.name) or
            getattr(request, 'data', None) and request.data.get(
                self._meta.name))

        if not pks or self._meta.queryset is None:
            return resources

        pks = as_tuple(pks)

        try:
            if len(pks) == 1:
                resources[self._meta.name] = self._meta.queryset.get(pk=pks[0])

            else:
                resources[self._meta.name] = self._meta.queryset.filter(
                    pk__in=pks)

        except (ObjectDoesNotExist, ValueError, AssertionError):
            raise HttpError("Resource not found.",
                            status=status.HTTP_404_NOT_FOUND)

        except MultipleObjectsReturned:
            raise HttpError("Resources conflict.",
                            status=status.HTTP_409_CONFLICT)

        return resources
571123
def match(self, environ):
        '''  '''
        verb = environ['REQUEST_METHOD'].upper()
        path = environ['PATH_INFO'] or '/'
        target = None
        if verb == 'HEAD':
            methods = ['PROXY', verb, 'GET', 'ANY']
        else:
            methods = ['PROXY', verb, 'ANY']

        for method in methods:
            if method in self.static and path in self.static[method]:
                target, getargs = self.static[method][path]
                return target, getargs(path) if getargs else {}
            elif method in self.dyna_regexes:
                for combined, rules in self.dyna_regexes[method]:
                    match = combined(path)
                    if match:
                        target, getargs = rules[match.lastindex - 1]
                        return target, getargs(path) if getargs else {}

        # No matching route found. Collect alternative methods for 405 response
        allowed = set([])
        nocheck = set(methods)
        for method in set(self.static) - nocheck:
            if path in self.static[method]:
                allowed.add(verb)
        for method in set(self.dyna_regexes) - allowed - nocheck:
            for combined, rules in self.dyna_regexes[method]:
                match = combined(path)
                if match:
                    allowed.add(method)
        if allowed:
            allow_header = ",".join(sorted(allowed))
            raise HTTPError(405, "Method not allowed.", Allow=allow_header)

        # No matching route and no alternative method found. We give up
        raise HTTPError(404, "Not found: " + repr(path))
355064
def method_missing(method, *args, &block)
      load

      meth = method.to_s

      return get_embedded_resource(meth) if is_embedded?(meth)
      return get_linked_resource(meth) if is_link?(meth)
      return @_changed[meth[0...-1]] = args.first if meth.end_with?('=') and is_field?(meth[0...-1])
      return get_field_value(meth) if is_field?(meth)

      super(method, *args, &block)
    end
173611
def _get(self, url, method, host):
        
        url = host + url
        # Check against known static routes
        route = self.routes_static.get(url)
        method_not_supported = self._invalid_usage(
            'Method {} not allowed for URL {}'.format(
                method, url), status_code=405)
        if route:
            if route.methods and method not in route.methods:
                raise method_not_supported
            match = route.pattern.match(url)
        else:
            route_found = False
            # Move on to testing all regex routes
            for route in self.routes_dynamic[url_hash(url)]:
                match = route.pattern.match(url)
                route_found |= match is not None
                # Do early method checking
                if match and method in route.methods:
                    break
            else:
                # Lastly, check against all regex routes that cannot be hashed
                for route in self.routes_always_check:
                    match = route.pattern.match(url)
                    route_found |= match is not None
                    # Do early method checking
                    if match and method in route.methods:
                        break
                else:
                    # Route was found but the methods didn't match
                    if route_found:
                        raise method_not_supported
                    raise self._not_found(
                        'Requested URL {} not found'.format(url))

        kwargs = {p.name: p.cast(value)
                  for value, p
                  in zip(match.groups(1), route.parameters)}
        route_handler = route.handler
        if hasattr(route_handler, 'handlers'):
            route_handler = route_handler.handlers[method]
        return route_handler, [], kwargs, route.uri
1092010
def resource_name(resource, options = {})
      raise_unless_xpath!(resource)
      options = { return_expressions: false }.merge(options)
      if options[:return_expressions]
        name = resource.xpath("command/args_add_block")
        if name.xpath("descendant::string_add").size == 1 &&
            name.xpath("descendant::string_literal").size == 1 &&
            name.xpath(
              "descendant::*[self::call or self::string_embexpr]").empty?
          name.xpath("descendant::tstring_content/@value").to_s
        else
          name
        end
      else
        # Preserve existing behaviour
        resource.xpath("string(command//tstring_content/@value)")
      end
    end