import os

class PathUtil:
    @staticmethod   
    def filter_hidden_inplace(item_list):

        if(not len(item_list)): 
            return
                    
        wanted = filter(
        lambda item:
         not ((item.startswith('.') and item != ".htaccess") or item.endswith('~')), item_list)
         
        count = len(item_list)
        good_item_count = len(wanted)

        if(count == good_item_count): 
            return
            
        item_list[:good_item_count] = wanted
        for i in range(good_item_count, count):
            item_list.pop()

    @staticmethod
    def get_path_fragment(root_dir, a_dir):
        current_dir = a_dir
        current_fragment = ''
        while not current_dir == root_dir:
            (current_dir, current_fragment_part) = os.path.split(current_dir)
            current_fragment = os.path.join(
                                current_fragment_part, current_fragment)
        return current_fragment
        
    @staticmethod
    def get_mirror_dir(directory, 
    source_root, mirror_root, ignore_root = False):
    
        current_fragment = PathUtil.get_path_fragment(
                            source_root, directory)
                            
        if not current_fragment: 
            return mirror_root
            
        mirror_directory = mirror_root
        if not ignore_root:
            mirror_directory = os.path.join(
                                mirror_root, 
                                os.path.basename(source_root))
                                
        mirror_directory = os.path.join(
                            mirror_directory, current_fragment)
        return mirror_directory
        

    @staticmethod
    def mirror_dir_tree(directory,
    source_root, mirror_root, ignore_root = False):
    
        mirror_directory = PathUtil.get_mirror_dir(
                            directory, source_root, 
                            mirror_root, ignore_root)
        try:
            os.makedirs(mirror_directory)
        except:
            pass
        return mirror_directory
@@ -37,19 +37,16 @@
 icmethod
-   
 %0A    def
@@ -84,60 +84,304 @@
 t):%0A
-%0A        if(not len(item_list)): %0A            return
+        %22%22%22%0A        Given a list of filenames, removes filenames for invisible files (whose%0A        names begin with dots) or files whose names end in tildes '~'.%0A        Does not remove files with the filname '.htaccess'.%0A        The list is modified in-place; this function has no return value.
 %0A   
@@ -381,32 +381,37 @@
 ue.%0A        
+%22%22%22%0A%0A
         
     %0A       
@@ -390,36 +390,69 @@
    %22%22%22%0A%0A        
-    
+if not item_list:%0A            return%0A
 %0A        wanted 
@@ -469,16 +469,20 @@
         
+    
 lambda i
@@ -495,16 +495,23 @@
         
+      
+ 
 not ((it
@@ -553,16 +553,37 @@
 access%22)
+%0A                    
  or item
@@ -598,16 +598,28 @@
 h('~')),
+%0A           
  item_li
@@ -622,25 +622,16 @@
 m_list)%0A
-         
 %0A       
@@ -703,17 +703,17 @@
       if
-(
+ 
 count ==
@@ -732,11 +732,9 @@
 ount
-): 
+:
 %0A   
@@ -749,28 +749,16 @@
  return%0A
-            
 %0A       
@@ -807,17 +807,17 @@
     for 
-i
+_
  in rang

Document filter_hidden_inplace() in path_util.py