def find_source_folders(self, folder):
 for resource in folder.get_folders():
  if self._is_package(resource):
   return [folder]
 for resource in folder.get_files():
  if resource.name.endswith('.py'):
   return [folder]
 return []

def find_source_folders ( self , folder ) : for resource in folder . get_folders ( ) : if self . _is_package ( resource ) : return [ folder ] for resource in folder . get_files ( ) : if resource . name . endswith ( '.py' ) : return [ folder ] return [ ]
look only python files an packages .