def walkModuleNames(moduleName):
    """ Iterates the names of each module inside of and including moduleName.
        
        This only recognizes modules with the .py extension."""

    ignoreNames = ["project"]
    
    def iter(moduleName, modulePath, isDir):
        if isDir:
            names = os.listdir(modulePath)
            if not names in "__init__.py":
                return
        else:
            moduleName,baseName = moduleName.rsplit(".", 1)
            names = [baseName+".py"]
        
        for name in names:
            filePath = os.path.join(modulePath, name)
            if os.path.isdir(filePath):
                dirModuleName = ".".join((moduleName, name))
                dirPath = os.path.join(modulePath, name)
                for name in iter(dirModuleName, dirPath, True):
                    yield name
            
            else:
                baseName,ext = os.path.splitext(name)
                if ext == ".py":
                    if baseName == "__init__":
                        yield moduleName
                    elif baseName not in ignoreNames:
                        yield ".".join((moduleName, baseName))
    
    # Find the path of the module and then iterate all of the names in its directory
    modPath = findModule(moduleName)
    if modPath:
        isDir = os.path.isdir(modPath)
        if isDir:
            dirPath = modPath
            modPath = os.path.join(modPath, "__init__.py")
        else:
            dirPath = os.path.dirname(modPath)

        for name in iter(moduleName, dirPath, isDir):
            yield name

# **************************************************************************************************
dataset/ETHPy150Open joehewitt/devon/devon/importing.py/walkModuleNames/swapped operands of `in`