just wraps os walk for easier use and extensionas well as generic searchvisitor class that generalizes the notion of directory searches by itselfsearchvisitor simply does what search_all didbut it also opens up the search process to customization--bits of its behavior can be modified by overloading its methods in subclasses moreoverits core search logic can be reused everywhere we need to search simply define subclass that adds extensions for specific task the same goes for filevisitor--by redefining its methods and using its attributeswe can tap into tree search using oop coding techniques as is usual in programmingonce you repeat tactical tasks often enoughthey tend to inspire this kind of strategic thinking example - pp \tools\visitor py ""###################################################################################test"python \tools\visitor py dir testmask [string]uses classes and subclasses to wrap some of the details of os walk call usage to walk and searchtestmask is an integer bitmask with bit per available self-testsee alsovisitor_*py subclasses use casesframeworks should generally use__x pseudo private namesbut all names here are exported for use in subclasses and clientsredefine reset to support multiple independent walks that require subclass updates###################################################################################""import ossys class filevisitor""visits all nondirectory files below startdir (default ')override visitmethods to provide custom file/dir handlerscontext arg/attribute is optional subclass-specific statetrace switch is silent is directories adds files ""def __init__(selfcontext=nonetrace= )self fcount self dcount self context context self trace trace def run(selfstartdir=os curdirreset=true)if resetself reset(for (thisdirdirsherefilesherein os walk(startdir)self visitdir(thisdirfor fname in filesherefor non-dir files fpath os path join(thisdirfnamefnames have no path self visitfile(fpathdef reset(self)self fcount self dcount to reuse walker for independent walks def visitdir(selfdirpath)called for each dir visitorwalking directories "++