Recursively traverse all paths inside this entity, including the entity
        itself.

        :param base: The base path to prepend to the entity name.
        :return: An iterator of paths.
494301
def walk_paths(self,
                   base: Optional[pathlib.PurePath] = pathlib.PurePath()) \
            -> Iterator[pathlib.PurePath]:
        
        raise NotImplementedError()
1316432
def get_paths(self, key):
        
        final_paths = []

        if key in self.__cli:
            paths = self.__cli[key] or []
            from_conf = False
        else:
            paths = self.__config.get(key) or []
            from_conf = True

        for path in flatten_list(paths):
            final_path = self.__abspath(path, from_conf)
            if final_path:
                final_paths.append(final_path)

        return final_paths
301447
def generate_base(path: str) -> str:
    
    if ':' in path:
        parts = urlparse(path)
        parts_dict = parts._asdict()
        parts_dict['path'] = os.path.split(parts.path)[0] if '/' in parts.path else ''
        return urlunparse(ParseResult(**parts_dict)) + '/'
    else:
        return (os.path.split(path)[0] if '/' in path else '') + '/'
369400
def list_traverse(self, *args, **kwargs):
        
        out = IterableList(self._id_attribute_)
        out.extend(self.traverse(*args, **kwargs))
        return out
397674
def _get_path(cls, path, depth, newstep):
        
        parentpath = cls._get_basepath(path, depth - 1)
        key = cls._int2str(newstep)
        return '{0}{1}{2}'.format(
            parentpath,
            cls.alphabet[0] * (cls.steplen - len(key)),
            key
        )
662038
def set_base_path(self, value):
        
        if config.PATHS not in self.config.application:
            self.config.application[config.PATHS] = dict()

        if config.BASE not in self.config.application[config.PATHS]:
            self.config.application[config.PATHS][config.BASE] = value
539445
def rel_path(base, path):
    """"""
    if base == path:
        return ''
    assert is_prefix(base, path), "{} not a prefix of {}".format(base, path)
    return path[len(base):].strip('.')
398983
def relpath(path, start):
    
    path_items = path_list(path)
    start_items = path_list(start)

    # Find common parts of path.
    common = []
    for pth, stt in zip(path_items, start_items):
        if pth != stt:
            break
        common.append(pth)

    # Shared parts index in both lists.
    common_ind = len(common)
    parent_num = len(start_items) - common_ind

    # Start with parent traversal and add relative parts.
    rel_items = [PARENT] * parent_num + path_items[common_ind:]
    return path_join(*rel_items)
793694
def iglob(pathname):
    
    if not has_magic(pathname):
        yield pathname
        return
    dirname, basename = os.path.split(pathname)
    if not dirname:
        for name in glob1(dirname, basename):
            yield name
        return
    if has_magic(dirname):
        dirs = iglob(dirname)
    else:
        dirs = [dirname]
    if has_magic(basename):
        glob_in_dir = glob1
    else:
        glob_in_dir = glob0
    for dirname in dirs:
        for name in glob_in_dir(dirname, basename):
            yield os.path.join(dirname, name)
229356
def find_base_path(paths)
      return nil if paths.length <= 1
      paths.sort!
      first = paths.first.split('/')
      last  = paths.last.split('/')
      i = 0
      while first[i] == last[i] && i <= first.length
        i += 1
      end
      res = first.slice(0, i).join('/')
      res.empty? ? nil : res
    end
86808
def path(self, startLayer, endLayer):
        
        next = {startLayer.name : startLayer}
        visited = {}
        while next != {}:
            for item in list(next.items()):
                # item[0] : name, item[1] : layer reference
                # add layer to visited dict and del from next 
                visited[item[0]] = item[1]
                del next[item[0]]
                for connection in self.connections:
                    if connection.fromLayer.name == item[0]:
                        if connection.toLayer.name == endLayer.name:
                            return 1 # a path!
                        elif connection.toLayer.name in next:
                            pass # already in the list to be traversed
                        elif connection.toLayer.name in visited:
                            pass # already been there
                        else:
                            # add to next
                            next[connection.toLayer.name] = connection.toLayer
        return 0 # didn't find it and ran out of places to go
1305747
def recurse(self):
        
        json = self._json(self._get(self._api, params={'recursive': '1'}),
                          200)
        return Tree(json, self._session) if json else None
66992
def traverse(self):
        '''
        
        '''
        yield self, 0
        if self.name in self.expanded:
            for path in self.getpaths():
                for child, depth in path.traverse():
                    yield child, depth + 1
1084565
def traverse(self, callback):
        ''' 
        '''
        def _traverse_node(path, node, callback):
            ret_val = callback(path, node)
            if ret_val is not None:
                # replace node with the return value
                node = ret_val
            else:
                # traverse deep into the hierarchy
                if isinstance(node, YAMLDict):
                    for k, v in node.items():
                        node[k] = _traverse_node(path + [k], v,
                                                 callback)
                elif isinstance(node, list):
                    for i, v in enumerate(node):
                        node[i] = _traverse_node(path + ['[{0}]'.format(i)], v,
                                                 callback)
                else:
                    pass
            return node
        _traverse_node([], self, callback)
146821
def path(self, *names):
        

        path = [self]
        for name in names:
            path.append(path[-1][name, ])
        return path[1:]
1056542
def get_tree(cls, parent=None):
        
        if parent:
            depth = parent.get_depth() + 1
            results = [parent]
        else:
            depth = 1
            results = []
        cls._get_tree_recursively(results, parent, depth)
        return results
516385
def path(self) -> Path:
        """"""
        args = list(self._iter_translated_field_names(self.get_path_pattern_list()))
        args.append(self.get_name())
        return Path(*args)