9from .composite_filedirentry 
import FileDirEntry, FileDirTypes, FileDirEntryList
 
   10from .composite_fileaccess 
import Composite_FileAccess
 
   23    NAME_PADDING_SIZE = 20
 
   25    spaces = 
' ' * (depth * 2)
 
   26    output.write(
"{0}{1}".format(spaces, entry.Name))
 
   27    padding = NAME_PADDING_SIZE - len(entry.Name) - (depth * 2)
 
   28    if entry.FileDirType == FileDirTypes.Directory:
 
   31    output.write(
' ' * padding)
 
   32    output.write(
"{0:4}".format(entry.Length))
 
   33    output.write(
"  {0}".format(entry.WhenModified.strftime(
"%m/%d/%Y %I:%M:%S %p")))
 
   36    children = entry.Children
 
   38        for index 
in range(0, len(children)):
 
   41    return output.getvalue()
 
   68    print(
"Composite Exercise")
 
   72        rootEntry = Composite_FileAccess.GetEntry(filepath)
 
   73        print(
"  Showing object '{}'".format(filepath))
 
   76        filepath = 
"root/subdir1/FileD.txt" 
   77        rootEntry = Composite_FileAccess.GetEntry(filepath)
 
   78        print(
"  Showing object '{}'".format(filepath))
 
   80    except FileNotFoundError 
as ex:
 
   81        print(
"Error! {} ".format(ex))
 
str Composite_Exercise_FormatEntry(FileDirEntry entry, int depth)
Format the specified entry for display.
def Composite_Exercise()
Example of using the Composite Pattern.
None Composite_Exercise_ShowEntry(FileDirEntry entry)
Recursively display the contents of the hierarchical list of objects starting with the given object.