#NEWLINE# def _items( self , visited , recurse = False , **metadata ) : #NEWLINE# #INDENT# 'Return an iterator that returns a list of tuples of the form\n        (rel_pathname, obj) for each trait of this VariableTree that matches\n        the given metadata. If recurse is True, also iterate through all\n        child Containers of each Container found.\n        ' #NEWLINE# if ( id ( self ) not in visited ) : #NEWLINE# #INDENT# visited . add ( id ( self ) ) #NEWLINE# if ( 'iotype' in metadata ) : #NEWLINE# #INDENT# meta_io = metadata [ 'iotype' ] #NEWLINE# matches_io = False #NEWLINE# if ( type ( meta_io ) is FunctionType ) : #NEWLINE# #INDENT# if meta_io ( self . iotype ) : #NEWLINE# #INDENT# matches_io = True #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( meta_io == self . iotype ) : #NEWLINE# #INDENT# matches_io = True #NEWLINE# #UNINDENT# #UNINDENT# if matches_io : #NEWLINE# #INDENT# newdict = metadata . copy ( ) #NEWLINE# del newdict [ 'iotype' ] #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# matches_io = True #NEWLINE# newdict = metadata #NEWLINE# #UNINDENT# if matches_io : #NEWLINE# #INDENT# for name in self . _alltraits ( ** newdict ) : #NEWLINE# #INDENT# if name . startswith ( '_' ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# obj = getattr ( self , name ) #NEWLINE# ( yield ( name , obj ) ) #NEWLINE# if ( recurse and is_instance ( obj , VariableTree ) and ( id ( obj ) not in visited ) ) : #NEWLINE# #INDENT# for ( chname , child ) in obj . _items ( visited , recurse , ** metadata ) : #NEWLINE# #INDENT# ( yield ( '.' . join ( ( visited , chname ) ) , child ) )