Normalizes the given node url
768997
def normalize_url(node):
    """"""
    if not node:
        node = DEFAULT_NODE
    elif '://' not in node:
        node = '//{}'.format(node)
    parts = urlparse(node, scheme='http', allow_fragments=False)
    port = parts.port if parts.port else _get_default_port(parts.scheme)
    netloc = '{}:{}'.format(parts.hostname, port)
    return urlunparse((parts.scheme, netloc, parts.path, '', '', ''))
255528
def get_normalized_url(url):
        
        scheme, netloc, path, params, query, fragment = urlparse(url)

        # Exclude default port numbers.
        if scheme == 'http' and netloc[-3:] == ':80':
            netloc = netloc[:-3]
        elif scheme == 'https' and netloc[-4:] == ':443':
            netloc = netloc[:-4]
        if scheme not in ('http', 'https'):
            raise ValueError("Unsupported URL %s (%s)." % (url, scheme))

        # Normalized URL excludes params, query, and fragment.
        return urlunparse((scheme, netloc, path, None, None, None))
901070
def normalize(url):
    
    url = url.strip()
    if url == '':
        return ''
    parts = split(url)
    if parts.scheme:
        netloc = parts.netloc
        if parts.scheme in SCHEMES:
            path = normalize_path(parts.path)
        else:
            path = parts.path
    # url is relative, netloc (if present) is part of path
    else:
        netloc = parts.path
        path = ''
        if '/' in netloc:
            netloc, path_raw = netloc.split('/', 1)
            path = normalize_path('/' + path_raw)
    username, password, host, port = split_netloc(netloc)
    host = normalize_host(host)
    port = _normalize_port(parts.scheme, port)
    query = normalize_query(parts.query)
    fragment = normalize_fragment(parts.fragment)
    return construct(URL(parts.scheme, username, password, None, host, None,
                         port, path, query, fragment, None))
1318915
function normalize(result) {
  return {
    relevance: result.relevance || 0,
    language: result.language || null,
    value: result.value || []
  }
}
388683
def normalize_url(url: str) -> str:
    
    if url.startswith('/'):
        url = url[1:]

    if url.endswith('/'):
        url = url[:-1]

    return url
999623
function normalize(route) {
  const normalized = { ...route };

  if (is.not.array(normalized.path) && is.not.string(normalized.path)) {
    throw new Error("The route's path must be a String or [String]");
  }

  if (is.array(normalized.method)) {
    /* If method is an array */
    for (let method of normalized.method) {
      method = clean(method);
    }
  }

  /* If method is a string */
  if (is.string(normalized.method)) {
    normalized.method = clean(normalized.method);
  }

  return normalized;
}
1120210
function normalize (url, opts, callback) {
  url = typeof url === 'string' ? {url: url} : url
  opts = extend(url, opts)

  if (typeof opts.url !== 'string') {
    throw new TypeError('request-all: missing request url')
  }
  if (typeof callback !== 'function') {
    throw new TypeError('request-all: expect a callback')
  }

  opts.url = normalizeUrl(opts.url)
  opts.json = typeof opts.json === 'boolean' ? opts.json : true
  opts.headers = extend({
    'accept': 'application/json',
    'user-agent': 'https://github.com/tunnckoCore/request-all'
  }, opts.headers)

  return opts
}
275312
private function normalizeUrl(string $url): string
    {
        if ($url[0] !== '/') $url = '/' . $url;

        while (\substr($url, -1) === '/') {
            $url = \substr($url, 0, -1);
        }

        return $url;
    }
1203059
private static String normalize(String url) {
        if (StringUtils.isBlank(url)) {
            return null;
        }
        // Strip "/tree/..."
        if (url.contains("/tree/")) {
            url = url.replaceFirst("/tree/.*$", "");
        }
        if (!url.endsWith("/")) {
            url += '/';
        }
        return url;
    }
1035640
void normalize(String expression)
    {
        final XPath xPath = XPathFactory.newInstance().newXPath();
        try
        {
            final NodeList nodeList = (NodeList) xPath.evaluate(expression, document, XPathConstants.NODESET);
            for (int i = 0; i < nodeList.getLength(); ++i)
            {
                final Node node = nodeList.item(i);
                node.getParentNode().removeChild(node);
            }
        }
        catch (final XPathExpressionException exception)
        {
            Verbose.exception(exception);
        }
    }
1243566
function (baseUrl) {
    var fullUrl = url.parse(String(baseUrl || '/'));
    fullUrl.pathname = normalizePath(this.path, fullUrl.pathname);
    fullUrl = url.format(fullUrl);

    var routes = {};
    Object.keys(this.children).forEach(function (child) {
      routes[child.replace(/^\//, '')] = nodepath.join(fullUrl, child);
    });
    return routes;
  }
795804
private void normalizeBlocks(Node n) {
    if (NodeUtil.isControlStructure(n)
        && !n.isLabel()
        && !n.isSwitch()) {
      for (Node c = n.getFirstChild(); c != null; c = c.getNext()) {
        if (NodeUtil.isControlStructureCodeBlock(n, c) && !c.isBlock()) {
          Node newBlock = IR.block().srcref(n);
          n.replaceChild(c, newBlock);
          newBlock.setIsAddedBlock(true);
          if (!c.isEmpty()) {
            newBlock.addChildrenToFront(c);
          }
          c = newBlock;
          reportChange();
        }
      }
    }
  }
1149047
function normalizeContent(content) {
  var fragment = document.createDocumentFragment();
  var i, len;

  if (isNode(content)) {
    return content;
  } else {
    len = content.length;
    for (i = 0; i < len; i++) { fragment.appendChild(content[i]); }
    return fragment;
  }
}
354041
final static function normalize(string $url):string{#{{{

    if(isset(
      $_SERVER['REQUEST_SCHEME'],
      $_SERVER['REQUEST_HOST'],
      $_SERVER['REQUEST_PORT'],
      $_SERVER['REQUEST_URI'],
      $_SERVER['SERVER_PORT']
    ) || PHP_SAPI ==='cli')
      return $url;

    $arr = parse_url($url);
    if($arr===false) return '';

    $a = [
      $arr['scheme']??$_SERVER['REQUEST_SCHEME'],
      '://',
      $arr['user']??'',
      ':',
      $arr['pass']??'',
      '@',
      $arr['host']??$_SERVER['HTTP_HOST'],
      ':',
      $arr['port']??$_SERVER['SERVER_PORT'],
      substr($_SERVER['REQUEST_URI'],0, strrpos($_SERVER['REQUEST_URI'],'/')+1),
      $arr['path']??'',
      '?',
      $arr['query']??'',
      '#',
      $arr['fragment']??'',
    ];

    if(!in_array($a[0], ['http','https'])) return '';

    if($a[12]==='')            unset($a[11],$a[12]);
    if($a[14]==='')            unset($a[13],$a[14]);
    if($a[8]==80)              unset($a[7],$a[8]);
    if($a[4]==='')             unset($a[3],$a[4]);
    if($a[2]==='')             unset($a[2],$a[3],$a[4],$a[5]);
    if(strpos($a[10],'/')===0) unset($a[9]);

    while(strpos($a[10],'../')===0){
      $a[10] = substr($a[10],3);
      $a[9] = dirname($a[9]);
      if($a[9]!=='/') $a[9] .= '/';
    }

    while(strpos($a[10],'./')===0){
      $a[10] = substr($a[10],2);
    }

    if($a[10]==='.') unset($a[10]);

    return implode($a);
  }
330070
def _show_normalized_node(full_node):
    '''
    
    '''
    public_ips = full_node.get('eip', [])
    if public_ips:
        public_ip = public_ips['eip_addr']
        public_ips = [public_ip, ]

    private_ips = []
    for vxnet in full_node.get('vxnets', []):
        private_ip = vxnet.get('private_ip', None)
        if private_ip:
            private_ips.append(private_ip)

    normalized_node = {
        'id': full_node['instance_id'],
        'image': full_node['image']['image_id'],
        'size': full_node['instance_type'],
        'state': full_node['status'],
        'private_ips': private_ips,
        'public_ips': public_ips,
    }

    return normalized_node
818284
def normaliseURL(url):
    
    url = unicode_safe(url).strip()
    # XXX: brutal hack
    url = unescape(url)

    pu = list(urlparse(url))
    segments = pu[2].split('/')
    while segments and segments[0] in ('', '..'):
        del segments[0]
    pu[2] = '/' + '/'.join(segments)
    # remove leading '&' from query
    if pu[4].startswith('&'):
        pu[4] = pu[4][1:]
    # remove anchor
    pu[5] = ""
    return urlunparse(pu)
1268524
private Url parseUrl(Node el) {
        return new Url(
                nodeAttribute(el, TAG_VAR_ATTR_NAME, Url.DEFAULT_NAME),
                nodeAttribute(el, TAG_ATTR_GHOST, PatternElement.DEFAULT_GHOST_VALUE),
                nodeAttribute(el, TAG_URL_ATTR_LOCAL, Url.DEFAULT_LOCAL),
                nodeAttribute(el, TAG_URL_ATTR_SCHEMALESS, Url.DEFAULT_SCHEMALESS)
        );
    }