def get_python_standard_modules(version=None):
    version = ('{}.{}'.format(sys.version_info[0], sys.version_info[1]) if (not version) else version)
    module_cache_file = 'python{}_modules.csv'.format(version.replace('.', '_'))
    if os.path.exists(module_cache_file):
        print('read python {} standard modules'.format(version))
        modules = list()
        with open(module_cache_file, 'r') as fr:
            while True:
                line = fr.readline()
                if (not line):
                    break
                modules.append(line.strip())
    else:
        from sphinx.ext.intersphinx import fetch_inventory
        print('fetch python {} standard modules'.format(version))
        url = 'http://docs.python.org/{}/objects.inv'.format(version)
        modules = sorted(list(fetch_inventory(DummyApp(), '', url).get('py:module').keys()))
        with open(module_cache_file, 'w') as fw:
            fw.write('\n'.join(modules))
    return modules
def get_python_standard_modules(version=None):
    version = ('{}.{}'.format(sys.version_info[0], sys.version_info[1]) if (not version) else version)
    module_cache_file = 'python{}_modules.csv'.format(version.replace('.', '_'))
    if os.path.exists(module_cache_file):
        print('read python {} standard modules'.format(version))
        modules = list()
        with open(module_cache_file, 'r') as fr:
            while True:
                line = fr.readline()
                if (not line):
                    break
                modules.append(line.strip())
    else:
        from sphinx.ext.intersphinx import fetch_inventory
        print('fetch python {} standard modules'.format(version))
        url = 'http://docs.python.org/{}/objects.inv'.format(version)
        modules = sorted(list(fetch_inventory(DummyApp(), , url).get('py:module').keys()))
        with open(module_cache_file, 'w') as fw:
            fw.write('\n'.join(modules))
    return modules