# Path: ddsc/core/util.py
# class FilteredProject(object):
#     """
#     Adds ability to filter items when a visitor is visiting a project.
#     """
#     def __init__(self, filter_func, visitor):
#         """
#         Setup to let visitor walk a project filtering out items based on a function.
#         :param filter_func: function(item): returns True to let visitor see the item
#         :param visitor: object: object with visit_project,visit_folder,visit_file methods
#         """
#         self.filter_func = filter_func
#         self.visitor = visitor
# 
#     def walk_project(self, project):
#         """
#         Go through all nodes(RemoteProject,RemoteFolder,RemoteFile) in project and send them to visitor if filter allows.
#         :param project: RemoteProject: project we will walk
#         """
#         ProjectWalker.walk_project(project, self)
# 
#     def visit_project(self, item):
#         if self.filter_func(item):
#             self.visitor.visit_project(item)
# 
#     def visit_folder(self, item, parent):
#         if self.filter_func(item):
#             self.visitor.visit_folder(item, parent)
# 
#     def visit_file(self, item, parent):
#         if self.filter_func(item):
#             self.visitor.visit_file(item, parent)
# 
# REMOTE_PATH_SEP = '/'


import os
from ddsc.core.util import FilteredProject, REMOTE_PATH_SEP
        """
        Is parent_path a parent(or grandparent) directory of child_path.
        :param child_path: str: remote file path
        :param parent_path: str: remote file path
        :return: bool: True when parent_path is child_path's parent
        """
        parent_dir = os.path.join(parent_path, '')
        child_dir = os.path.join(child_path, '')
        return child_dir.startswith(parent_dir)

    @staticmethod
    def parent_child_paths(path, some_path):
        """
        Is path a parent of some_path or some_path is a parent of path.
        :param path: str: remote file path
        :param some_path: str: remote file path
        :return: bool: True when they are parents
        """
        return PathFilterUtil.is_child(path, some_path) or PathFilterUtil.is_child(some_path, path)

    @staticmethod
    def normalize_slashes(paths):
        """
        Removes trailing slashes and make sure paths begin with a leading slash.
        :param paths: [str]: paths to fix
        :return: [str]: array of normalized paths
        """
        normalized_paths = []
        for path in paths:
            path = path.rstrip(REMOTE_PATH_SEP)

# Path: ddsc/core/util.py
# class FilteredProject(object):
#     """
#     Adds ability to filter items when a visitor is visiting a project.
#     """
#     def __init__(self, filter_func, visitor):
#         """
#         Setup to let visitor walk a project filtering out items based on a function.
#         :param filter_func: function(item): returns True to let visitor see the item
#         :param visitor: object: object with visit_project,visit_folder,visit_file methods
#         """
#         self.filter_func = filter_func
#         self.visitor = visitor
# 
#     def walk_project(self, project):
#         """
#         Go through all nodes(RemoteProject,RemoteFolder,RemoteFile) in project and send them to visitor if filter allows.
#         :param project: RemoteProject: project we will walk
#         """
#         ProjectWalker.walk_project(project, self)
# 
#     def visit_project(self, item):
#         if self.filter_func(item):
#             self.visitor.visit_project(item)
# 
#     def visit_folder(self, item, parent):
#         if self.filter_func(item):
#             self.visitor.visit_folder(item, parent)
# 
#     def visit_file(self, item, parent):
#         if self.filter_func(item):
#             self.visitor.visit_file(item, parent)
# 
# REMOTE_PATH_SEP = '/'


# Path: ddsc/core/pathfilter.py
import os
from ddsc.core.util import FilteredProject, REMOTE_PATH_SEP

        """
        Is parent_path a parent(or grandparent) directory of child_path.
        :param child_path: str: remote file path
        :param parent_path: str: remote file path
        :return: bool: True when parent_path is child_path's parent
        """
        parent_dir = os.path.join(parent_path, '')
        child_dir = os.path.join(child_path, '')
        return child_dir.startswith(parent_dir)

    @staticmethod
    def parent_child_paths(path, some_path):
        """
        Is path a parent of some_path or some_path is a parent of path.
        :param path: str: remote file path
        :param some_path: str: remote file path
        :return: bool: True when they are parents
        """
        return PathFilterUtil.is_child(path, some_path) or PathFilterUtil.is_child(some_path, path)

    @staticmethod
    def normalize_slashes(paths):
        """
        Removes trailing slashes and make sure paths begin with a leading slash.
        :param paths: [str]: paths to fix
        :return: [str]: array of normalized paths
        """
        normalized_paths = []
        for path in paths:
            path = path.rstrip(REMOTE_PATH_SEP)

            if not path.startswith(REMOTE_PATH_SEP):