Determine the relative path for request.
435327
def ExpandRelativePath(method_config, params, relative_path=None):
    """"""
    path = relative_path or method_config.relative_path or ''

    for param in method_config.path_params:
        param_template = '{%s}' % param
        # For more details about "reserved word expansion", see:
        #   http://tools.ietf.org/html/rfc6570#section-3.2.2
        reserved_chars = ''
        reserved_template = '{+%s}' % param
        if reserved_template in path:
            reserved_chars = _RESERVED_URI_CHARS
            path = path.replace(reserved_template, param_template)
        if param_template not in path:
            raise exceptions.InvalidUserInputError(
                'Missing path parameter %s' % param)
        try:
            # TODO(craigcitro): Do we want to support some sophisticated
            # mapping here?
            value = params[param]
        except KeyError:
            raise exceptions.InvalidUserInputError(
                'Request missing required parameter %s' % param)
        if value is None:
            raise exceptions.InvalidUserInputError(
                'Request missing required parameter %s' % param)
        try:
            if not isinstance(value, six.string_types):
                value = str(value)
            path = path.replace(param_template,
                                urllib_parse.quote(value.encode('utf_8'),
                                                   reserved_chars))
        except TypeError as e:
            raise exceptions.InvalidUserInputError(
                'Error setting required parameter %s to value %s: %s' % (
                    param, value, e))
    return path
41772
def make_relative_to_root(path):
  """"""
  return os.path.normpath(path.format(pex_root=ENV.PEX_ROOT))
939837
def request_path(request):
    """"""
    url = request.get_full_url()
    parts = urlsplit(url)
    path = escape_path(parts.path)
    if not path.startswith("/"):
        # fix bad RFC 2396 absoluteURI
        path = "/" + path
    return path
1047735
private URL getRelativePath(FacesContext facesContext, String path) throws IOException
    {
        URL url = (URL) _relativePaths.get(path);
        if (url == null)
        {
            url = _factory.resolveURL(facesContext, _src, path);
            if (url != null)
            {
                ViewResource viewResource = (ViewResource) facesContext.getAttributes().get(
                    FaceletFactory.LAST_RESOURCE_RESOLVED);
                if (viewResource != null)
                {
                    // If a view resource has been used to resolve a resource, the cache is in
                    // the ResourceHandler implementation. No need to cache in _relativeLocations.
                }
                else
                {
                    _relativePaths.put(path, url);
                }
            }
        }
        return url;
    }
682271
private function getRequestPath($request)
    {
        if (is_string($request)) {
            return $request;
        }

        if (is_array($request)) {
            return $request['path'];
        }

        return $request->path();
    }
888882
def path(pathname, relative_to = Pathname.pwd)
      if pathname
        path = Pathname(pathname).relative_path_from(relative_to)
        "`#{path}`"
      else
        ''
      end
    end
684014
def __ConstructRelativePath(self, method_config, request,
                                relative_path=None):
        """"""
        python_param_names = util.MapParamNames(
            method_config.path_params, type(request))
        params = dict([(param, getattr(request, param, None))
                       for param in python_param_names])
        params = util.MapRequestParams(params, type(request))
        return util.ExpandRelativePath(method_config, params,
                                       relative_path=relative_path)
746932
def make_relative(base, obj):
    """"""
    uri = obj.get("location", obj.get("path"))
    if ":" in uri.split("/")[0] and not uri.startswith("file://"):
        pass
    else:
        if uri.startswith("file://"):
            uri = uri_file_path(uri)
            obj["location"] = os.path.relpath(uri, base)
755772
def determine_path():
    """"""
    root = __file__
    if os.path.islink(root):
        root = os.path.realpath(root)
    return os.path.dirname(os.path.abspath(root))
853176
function findModulePath(request, parent) {
  var mainScriptDir = path.dirname(Module._resolveFilename(request, parent));
  var resolvedModule = Module._resolveLookupPaths(request, parent);
  var paths = resolvedModule[1];
  for (var i = 0, PL = paths.length; i < PL; i++) {
    if (mainScriptDir.indexOf(paths[i]) === 0) {
      return path.join(paths[i], request.replace('/', path.sep));
    }
  }
  return null;
}
1278378
def resource_path(relative):
    """"""
    if hasattr(sys, "_MEIPASS"):
        return os.path.join(sys._MEIPASS, relative)
    return os.path.join(relative)
369627
def request_uri(self):
        """"""
        uri = self.path or '/'

        if self.query is not None:
            uri += '?' + self.query

        return uri
788722
def relative_path(path):
    
    return os.path.join(os.path.dirname(__file__), path)
96976
private String getRelativePath(HttpServletRequest request) {

        String result = request.getPathInfo();
        if (result == null) {
            //result = request.getServletPath();
        }
        if ((result == null) || (result.equals(""))) {
            result = "/";
        }
        return (result);
    }
322963
function (context, callback) {

            var path = context.request.urlInfo.pathname,
                relativePath = this.$restHandler.$.path;

            if (path.indexOf(relativePath) !== 0) {
                callback(new Error("Handler path '" + relativePath + "' not at start of " + path));
                return;
            }

            // remove relative handler path from path
            path = path.substring(relativePath.length);

            var pathElements = path.split('/');

            // remove first empty path
            pathElements.shift();

            try {
                callback(null, this._getResourceForPath(pathElements));
            } catch (e) {
                callback(e);
            }
        }
799677
def _request(self, http_method, relative_url='', **kwargs):
        """"""
        # It could be possible to call api.resource.get('/index')
        # but it would be non-intuitive that the path would resolve
        # to root of domain
        relative_url = self._remove_leading_slash(relative_url)

        # Add default kwargs with possible custom kwargs returned by
        # before_request
        new_kwargs = self.default_kwargs().copy()
        custom_kwargs = self.before_request(
            http_method,
            relative_url,
            kwargs.copy()
        )
        new_kwargs.update(custom_kwargs)

        response = requests.request(
            http_method,
            self._join_url(relative_url),
            **new_kwargs
        )

        return self.after_request(response)
267465
def matches(self, request):
        
        return (
            partial_path_match(request.path_info, self.path) and
            request.method == self.method
        )