Guesses the endpoint URI from (in this order):
    - An endpoint parameter in URL
    - An #+endpoint decorator
    - A endpoint.txt file in the repo
    Otherwise assigns a default one
776944
def guess_endpoint_uri(rq, gh_repo):
    
    auth = (static.DEFAULT_ENDPOINT_USER, static.DEFAULT_ENDPOINT_PASSWORD)
    if auth == ('none', 'none'):
        auth = None

    if has_request_context() and "endpoint" in request.args:
        endpoint = request.args['endpoint']
        glogger.info("Endpoint provided in request: " + endpoint)
        return endpoint, auth

    # Decorator
    try:
        decorators = get_yaml_decorators(rq)
        endpoint = decorators['endpoint']
        auth = None
        glogger.info("Decorator guessed endpoint: " + endpoint)
    except (TypeError, KeyError):
        # File
        try:
            endpoint_content = gh_repo.getTextFor({'download_url': 'endpoint.txt'})
            endpoint = endpoint_content.strip().splitlines()[0]
            auth = None
            glogger.info("File guessed endpoint: " + endpoint)
        # TODO: except all is really ugly
        except:
            # Default
            endpoint = static.DEFAULT_ENDPOINT
            auth = (static.DEFAULT_ENDPOINT_USER, static.DEFAULT_ENDPOINT_PASSWORD)
            if auth == ('none', 'none'):
                auth = None
            glogger.warning("No endpoint specified, using default ({})".format(endpoint))

    return endpoint, auth
74122
def get_perceval_params_from_url(cls, url):
        
        params = []

        tokens = url.split(' ')
        repo = tokens[0]

        owner = repo.split('/')[-2]
        repository = repo.split('/')[-1]

        params.append(owner)
        params.append(repository)

        if len(tokens) > 1:
            params.extend(tokens[1:])

        return params
1021799
def get(self, endpoint, **kwargs):
        
        return self._request(requests.get, endpoint, **kwargs)
1159202
private URI addEndPoint(String endPoint) throws URISyntaxException {

        if (StringUtils.isEmpty(endPoint) || endPoint.equals("/")) {
            return this.baseUri;
        }

        if (this.baseUri.getPath().endsWith("/") || endPoint.startsWith("/")) {
            endPoint = this.baseUri.getPath() + endPoint;
        } else {
            endPoint = this.baseUri.getPath() + "/" + endPoint;
        }

        URI uri = null;

        URIBuilder builder = new URIBuilder();

        builder.setScheme(this.baseUri.getScheme());
        builder.setHost(this.baseUri.getHost());
        builder.setPort(this.baseUri.getPort());
        builder.setPath(endPoint);

        uri = builder.build();
        return uri;
    }
1293102
def parse_endpoint(endpoint, identifier_type=None):
        
        # compute the operation
        parts = endpoint.split(".")
        operation = Operation.from_name(parts[1])

        # extract its parts
        matcher = match(operation.endpoint_pattern, endpoint)
        if not matcher:
            raise InternalServerError("Malformed operation endpoint: {}".format(endpoint))
        kwargs = matcher.groupdict()
        del kwargs["operation"]
        if identifier_type is not None:
            kwargs["identifier_type"] = identifier_type
        return operation, Namespace(**kwargs)
691156
def _build_url(self, endpoint):
        
        try:
            path = self.endpoints[endpoint]
        except KeyError:
            msg = 'Unknown endpoint `{0}`'
            raise ValueError(msg.format(endpoint))
        absolute_url = urljoin(self.target, path)
        return absolute_url
1312292
def as_url(self):
        '''
        
        '''
        if '' in self._scope:
            return self._finalize().as_url

        if not self._is_endpoint:
            raise UrlBuildingError('Not an endpoint {}'.format(repr(self)))

        if self._ready:
            path, host = self._path, self._host
        else:
            return self().as_url

        # XXX there is a little mess with `domain` and `host` terms
        if ':' in host:
            domain, port = host.split(':')
        else:
            domain = host
            port = None

        if self._bound_env:
            request = self._bound_env.request
            scheme_port = {'http': '80',
                           'https': '443'}.get(request.scheme, '80')

            # Domain to compare with the result of build.
            # If both values are equal, domain part can be hidden from result.
            # Take it from route_state, not from env.request, because
            # route_state contains domain values with aliased replaced by their
            # primary value
            primary_domain = self._bound_env._route_state.primary_domain
            host_split = request.host.split(':')
            request_domain = host_split[0]
            request_port = host_split[1] if len(host_split) > 1 else scheme_port
            port = port or request_port

            return URL(path, host=domain or request_domain,
                       port=port if port != scheme_port else None,
                       scheme=request.scheme, fragment=self._fragment,
                       show_host=host and (domain != primary_domain \
                                           or port != request_port))
        return URL(path, host=domain, port=port,
                   fragment=self._fragment, show_host=True)
384474
def get_endpoint(cls):
        
        if cls.endpoint is not None:
            return cls.endpoint
        s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', cls.__name__)
        return cls.sanitize_ep(
            re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower(),
            plural=True
        )
662154
def _determine_checkout_url(self, platform, action):
        
        api_version = settings.API_CHECKOUT_VERSION
        if platform == "test":
            base_uri = settings.ENDPOINT_CHECKOUT_TEST
        elif self.live_endpoint_prefix is not None and platform == "live":
            base_uri = settings.ENDPOINT_CHECKOUT_LIVE_SUFFIX.format(
                self.live_endpoint_prefix)
        elif self.live_endpoint_prefix is None and platform == "live":
            errorstring = """Please set your live suffix. You can set it
                   by running 'settings.
                   ENDPOINT_CHECKOUT_LIVE_SUFFIX = 'Your live suffix'"""
            raise AdyenEndpointInvalidFormat(errorstring)
        if action == "paymentsDetails":
            action = "payments/details"
        if action == "paymentsResult":
            action = "payments/result"
        if action == "originKeys":
            api_version = settings.API_CHECKOUT_UTILITY_VERSION

        return '/'.join([base_uri, api_version, action])
817814
function Endpoint(url) {
  if (!(this instanceof Endpoint)) return new Endpoint(url);

  var p;
  if (typeof url === 'string') {
    //parse url
    var rr = REGEXP_URL.exec(url);
    if (rr) {
      p = {
        protocol: rr[1],
        username: rr[2],
        password: rr[3],
        host: rr[4],
        port: rr[5],
        path: rr[6],
        url: rr[0]
      };
    }
  } else if (typeof url === 'object') {
    p = url;
  }
  p || (p = {});

  this.protocol = (p.protocol && p.protocol.toLowerCase()) || PROTOCOL.TCP;
  p.username && (this.username = p.username);
  p.password && (this.password = p.password);
  this.host = p.host || 'localhost';
  this.port = p.port || defaultPort(this.protocol);
  p.path && (this.path = p.path);
  p.url && (this.url = p.url);
}
1177223
def endpoint(self, value):
        # type: (StorageAccount, str) -> None
        
        tmp = value.split('.')
        if (len(tmp) <= 1 or not tmp[0].isalnum()):
            raise ValueError('endpoint is invalid: {}'.format(value))
        self._endpoint = value
551304
def get_url endpoint, method
      api = @wp_api ? 'wp-json' : 'wc-api'
      url = @url
      url = "#{url}/" unless url.end_with? "/"
      url = "#{url}#{api}/#{@version}/#{endpoint}"

      @is_ssl ? url : oauth_url(url, method)
    end
73826
function createUrlFromEndpointAndOptions (endpoint, options) {
  const query = qs.stringify(options);
  const baseURL = `${host}${endpoint}`;
  return query ? `${baseURL}?${query}` : baseURL;
}
490914
def get(self, endpoint):
        ''''''
        json_body = urlopen(self.url(endpoint)).read().decode('utf-8')
        return json.loads(json_body)
170806
def endpoint
      # get object that we want an oembed_response from
      # based on url
      # and get its oembed_response
      media_item = ::OembedProviderEngine::OembedProvider.find_provided_from(params[:url])
      options = Hash.new
      max_dimensions = [:maxwidth, :maxheight]
      unless media_item.class::OembedResponse.providable_oembed_type == :link
        max_dimensions.each { |dimension| options[dimension] = params[dimension] if params[dimension].present? }
      end

      @oembed_response = media_item.oembed_response(options)

      # to_xml and to_json overidden in oembed_providable module
      # to be properly formatted
      # TODO: handle unauthorized case
      respond_to do |format|
        if @oembed_response
          format.html { render_json @oembed_response.to_json } # return json for default
          format.json { render_json @oembed_response.to_json }
          format.xml  { render :xml => @oembed_response }
        else
          format.all { render_404 }
        end
      end
    end
158473
def default_endpoint_from_config(config, option=None):
    """"""
    default_endpoint = config.get('core', {}).get('default')
    project_endpoint = config.get('project',
                                  {}).get('core',
                                          {}).get('default', default_endpoint)
    return Endpoint(
        option or project_endpoint or default_endpoint,
        default=default_endpoint,
        project=project_endpoint,
        option=option
    )
533637
public function endpoint() {
		$endpoint = $this->getset('endpoint', func_get_args());
		return $this->validateEndpoint($endpoint ?: self::URI_API);
	}