Return an optional list of URIRefs for p
169244
def normalize_uriparm(p: URIPARM) -> List[URIRef]:
    
    return normalize_urilist(p) if isinstance(p, List) else \
        normalize_urilist([p]) if isinstance(p, (str, URIRef)) else p
103998
def base_url(root):
    """"""
    for attr, value in root.attrib.iteritems():
        if attr.endswith('base') and 'http' in value:
            return value
    return None
296812
function list(p) {
    var def = Q.defer();
    fs.readdir(p, def.makeNodeResolver());
    return def.promise;
}
143368
def list_remote(remote_uri, verbose=False):
    
    remote_uri1, remote_dpath = remote_uri.split(':')
    if not remote_dpath:
        remote_dpath = '.'
    import utool as ut
    out = ut.cmd('ssh', remote_uri1, 'ls -l %s' % (remote_dpath,), verbose=verbose)
    import re
    # Find lines that look like ls output
    split_lines = [re.split(r'\s+', t) for t in out[0].split('\n')]
    paths = [' '.join(t2[8:]) for t2 in split_lines if len(t2) > 8]
    return paths
667623
def _parse_uri_ssh(unt):
    """"""
    if '@' in unt.netloc:
        user, host_port = unt.netloc.split('@', 1)
    else:
        user, host_port = None, unt.netloc

    if ':' in host_port:
        host, port = host_port.split(':', 1)
    else:
        host, port = host_port, None

    if not user:
        user = None
    if not port:
        port = smart_open_ssh.DEFAULT_PORT
    else:
        port = int(port)

    return Uri(scheme=unt.scheme, uri_path=unt.path, user=user, host=host, port=port)
726829
def uriref_matches_iriref(v1: URIRef, v2: Union[str, ShExJ.IRIREF]) -> bool:
    
    return str(v1) == str(v2)
51098
def safe_parse_http_uri(path)
      raise ArgumentError.new("URI path cannot be empty") if path.to_s.empty?
      begin
        uri = URI.parse(path)
      rescue URI::InvalidURIError => e
        # URI raises an exception for paths like "<IP>:<port>"
        # (e.g. "127.0.0.1:123") unless they also have scheme (e.g. http)
        # prefix.
        raise e if path.start_with?("http://") || path.start_with?("https://")
        uri = URI.parse("http://" + path)
        uri = URI.parse("https://" + path) if uri.port == 443
        path = uri.to_s
      end

      # supply any missing default values to make URI as complete as possible.
      if uri.scheme.nil? || uri.host.nil?
        scheme = (uri.port == 443) ? 'https' : 'http'
        uri = URI.parse("#{scheme}://#{path}")
        path = uri.to_s
      end
      if uri.path.to_s.empty?
        uri = URI.parse("#{path}/")
        path = uri.to_s
      end

      return uri
    end
862573
def __parse_uri(self):
        """"""
        if self.scheme:
            scheme = '{}://'.format(self.scheme)
        else:
            scheme = ''

        credentials = self.username or ''
        password = self.password or ''

        if credentials and password:
            credentials = self.username + ':' + self.password
        if credentials:
            credentials += '@'

        if self.port:
            location = '{}:{}'.format(self.host, self.port)
        else:
            location = self.host

        path = self.path or ''

        if self.query:
            query = '?' + self.query
        else:
            query = ''

        if self.fragment:
            fragment = '#' + self.fragment
        else:
            fragment = ''

        return scheme + credentials + location + path + query + fragment
466495
function getUrls (opts) {

    var list    = [];

    var bsLocal = require("url").parse(opts.urls.local);

    list.push([bsLocal.protocol + "//", bsLocal.hostname, ":", opts.port].join(""));

    if (opts.urls.external) {
        var external = require("url").parse(opts.urls.external);
        list.push([bsLocal.protocol + "//", external.hostname, ":", opts.port].join(""));
    }

    return Immutable.List(list);
}
1356196
def _parse_uri(uri):
        """"""

        tokens = urlparse(uri)

        if tokens.netloc != '':
            logger.error("Invalid URI: %s", uri)
            raise ValueError("MediaFire URI format error: "
                             "host should be empty - mf:///path")

        if tokens.scheme != '' and tokens.scheme != URI_SCHEME:
            raise ValueError("MediaFire URI format error: "
                             "must start with 'mf:' or '/'")

        return posixpath.normpath(tokens.path)
1326878
private int[] checkURI (int p, int start, int end) {
        if (p>start && wikiChars[p-1]==':') { // "://" found
            int pb=p-1;
            while (pb>start && isLatinLetterOrDigit(wikiChars[pb-1])) pb--;
            int pe=p+2;
            while (pe<end && isUrlChar(wikiChars[pe])) pe++;
            String uri = null;
            do {
                // don't want these chars at the end of URI
                while (pe>p+2 && ",.;:?!%)".indexOf(wikiChars[pe-1])>=0) pe--;
                if (isURI(wikiText.substring(pb, pe))) {
                    uri = wikiText.substring(pb, pe);
                } else {
                    pe--; // try chopping from the end
                }
            } while (uri==null && pe>p+2);
            if (uri!=null && isAbsoluteURI(uri)) {
                int offs[]= {pb, pe};
                return offs;
            }
        }
        return null;
    }
606107
def url2fs(url):
    
    uri, extension = posixpath.splitext(url)
    return safe64.dir(uri) + extension
1023053
function getUri2() {
  const startPos = pos;
  let content = [];

  while (pos < tokens[startPos].uri_end) {
    if (checkSC(pos)) content = content.concat(getSC());
    else if (checkUnary(pos)) content.push(getUnary());
    else if (_checkValue(pos)) content.push(_getValue());
    else break;
  }

  return content;
}
334613
def list(self, filterfn=lambda x: True):
        
        return [self / p for p in self.listdir() if filterfn(self / p)]
402455
def list_dataset_uris(cls, base_uri, config_path):
        """"""

        parsed_uri = generous_parse_uri(base_uri)
        uri_list = []

        path = parsed_uri.path
        if IS_WINDOWS:
            path = unix_to_windows_path(parsed_uri.path, parsed_uri.netloc)

        for d in os.listdir(path):
            dir_path = os.path.join(path, d)

            if not os.path.isdir(dir_path):
                continue

            storage_broker = cls(dir_path, config_path)

            if not storage_broker.has_admin_metadata():
                continue

            uri = storage_broker.generate_uri(
                name=d,
                uuid=None,
                base_uri=base_uri
            )
            uri_list.append(uri)

        return uri_list
812945
def get_uri_parts(self, value):
        
        if value.startswith('pyuri_'):
            value = self.rpyhttp(value)
        parts = self.parse_uri(value)
        try:
            return (self.ns_dict[parts[0]], parts[1])
        except KeyError:
            try:
                return (self.ns_dict[parts[0].lower()], parts[1])
            except KeyError:
                return ((None, parts[0]), parts[1])
708210
def urlparse(uri):
    """"""
    scheme, netloc, path, params, query, fragment = parse.urlparse(uri)
    return (
        parse.unquote(scheme),
        parse.unquote(netloc),
        parse.unquote(path),
        parse.unquote(params),
        parse.unquote(query),
        parse.unquote(fragment)
    )