Return (hosts, path) tuple
357193
def _parse_path(self, path):
        """"""
        # Support specifying another host via hdfs://host:port/path syntax
        # We ignore the scheme and piece together the query and fragment
        # Note that HDFS URIs are not URL encoded, so a '?' or a '#' in the URI is part of the
        # path
        parts = urlsplit(path, allow_fragments=False)
        if not parts.path.startswith('/'):
            raise ValueError("Path must be absolute, was given {}".format(path))
        if parts.scheme not in ('', 'hdfs', 'hftp', 'webhdfs'):
            warnings.warn("Unexpected scheme {}".format(parts.scheme))
        assert not parts.fragment
        path = parts.path
        if parts.query:
            path += '?' + parts.query
        if parts.netloc:
            hosts = self._parse_hosts(parts.netloc)
        else:
            hosts = self.hosts
        return hosts, path
394965
def _get_pathcost_func(
    name: str
) -> Callable[[int, int, int, int, Any], float]:
    """"""
    return ffi.cast(  # type: ignore
        "TCOD_path_func_t", ffi.addressof(lib, name)
    )
718596
def path_ok(match_tuple: MatchTuple) -> bool:
    """"""
    relative_path = match_tuple.link.split("#")[0]
    full_path = os.path.join(os.path.dirname(str(match_tuple.source)), relative_path)
    return os.path.exists(full_path)
1114472
def hostloc(self):
        """"""
        hostloc = self.hostname
        if self.port:
            hostloc = '{hostloc}:{port}'.format(hostloc=hostloc, port=self.port)

        return hostloc
178542
def _hosts_in_unenumerated_pattern(self, pattern):
        

        hosts = {}
        # ignore any negative checks here, this is handled elsewhere
        pattern = pattern.replace("!","").replace("&", "")

        groups = self.get_groups()
        for group in groups:
            for host in group.get_hosts():
                if pattern == 'all' or self._match(group.name, pattern) or self._match(host.name, pattern):
                    hosts[host.name] = host
        return sorted(hosts.values(), key=lambda x: x.name)
1212025
def all_my_hosts_and_services(self):
        
        for what in (self.hosts, self.services):
            for item in what:
                yield item
788562
def getHostsFromSGE():
    """"""
    with open(os.environ["PE_HOSTFILE"], 'r') as hosts:
        return [(host.split()[0], int(host.split()[1])) for host in hosts]
146821
def path(self, *names):
        

        path = [self]
        for name in names:
            path.append(path[-1][name, ])
        return path[1:]
1055021
def url(self, host):
        """"""
        path = '/'.join(str(v) for v in self._path)
        return 'coaps://{}:5684/{}'.format(host, path)
1079461
def _hosts_by_success(self, hosts=[]):
        
        hosts = hosts if hosts else self.hosts
        return sorted(hosts, key=lambda h: self._host_errors[h])
981777
def subst_path(self, env, target, source):
        
        result = []
        for type, value in self.pathlist:
            if type == TYPE_STRING_SUBST:
                value = env.subst(value, target=target, source=source,
                                  conv=node_conv)
                if SCons.Util.is_Sequence(value):
                    result.extend(SCons.Util.flatten(value))
                elif value:
                    result.append(value)
            elif type == TYPE_OBJECT:
                value = node_conv(value)
                if value:
                    result.append(value)
            elif value:
                result.append(value)
        return tuple(result)
1038795
def list_hosts():
    ''''''
    with Session() as session:
        try:
            resp = session.VFolder.list_hosts()
            print(f"Default vfolder host: {resp['default']}")
            print(f"Usable hosts: {', '.join(resp['allowed'])}")
        except Exception as e:
            print_error(e)
            sys.exit(1)
134973
def _get_hosts(self, patterns):
        

        hosts = set()
        for p in patterns:
            if p.startswith("!"):
                # Discard excluded hosts
                hosts.difference_update(self.__get_hosts(p))
            elif p.startswith("&"):
                # Only leave the intersected hosts
                hosts.intersection_update(self.__get_hosts(p))
            else:
                # Get all hosts from both patterns
                hosts.update(self.__get_hosts(p))
        return hosts
1295518
def __get_container_path(self, host_path):
    
    libname = os.path.split(host_path)[1]
    return os.path.join(_container_lib_location, libname)
997113
def path_to_list(pathstr):
    """"""
    return [elem for elem in pathstr.split(os.path.pathsep) if elem]
254081
def templates_for_host(templates):
    
    if not isinstance(templates, (list, tuple)):
        templates = [templates]
    theme_dir = host_theme_path()
    host_templates = []
    if theme_dir:
        for template in templates:
            host_templates.append("%s/templates/%s" % (theme_dir, template))
            host_templates.append(template)
        return host_templates
    return templates
302142
def parse_host(self, tup_tree):
        

        self.check_node(tup_tree, 'HOST', (), (), (), allow_pcdata=True)

        return self.pcdata(tup_tree)