Replace some for loops with map functions

Delete unnecessary comment
This commit is contained in:
Marcel Schwarz 2020-01-11 04:13:36 +01:00
parent 3478379f5b
commit 92fad36fce

View File

@ -21,7 +21,6 @@ class VimModule(AbstractModule):
self.json_config = json.load(plugins) self.json_config = json.load(plugins)
def create_folder_structure(self): def create_folder_structure(self):
# Create necessary folder structure for vim
os.makedirs(str(get_vim_root().joinpath("autoload")), exist_ok=True) os.makedirs(str(get_vim_root().joinpath("autoload")), exist_ok=True)
os.makedirs(str(get_vim_root().joinpath("plugged")), exist_ok=True) os.makedirs(str(get_vim_root().joinpath("plugged")), exist_ok=True)
@ -40,19 +39,14 @@ class VimModule(AbstractModule):
def create_plugin_section(self): def create_plugin_section(self):
vimrc_content = [] vimrc_content = []
mapped_list = []
plugins = self.json_config['plugins'] plugins = self.json_config['plugins']
for choice in plugins.keys():
mapped_list.append({
"name": choice
})
print("Available Plugins:") print("Available Plugins:")
plugin_selection = [ plugin_selection = [
{ {
'type': 'checkbox', 'type': 'checkbox',
'message': 'Select plugins', 'message': 'Select plugins',
'name': 'modules', 'name': 'modules',
'choices': mapped_list 'choices': list(map(lambda x: {"name": x}, plugins.keys()))
} }
] ]
selected_plugins = prompt(plugin_selection)['modules'] selected_plugins = prompt(plugin_selection)['modules']
@ -73,14 +67,12 @@ class VimModule(AbstractModule):
return vimrc_content return vimrc_content
def create_setting_section(self): def create_setting_section(self):
vimrc_content = [] default_settings = list(self.json_config['settings'].values())
settings = self.json_config['settings']
default_settings = list(settings.values())
print("\n\033[4mDefault settings:\033[0m") print("\n\033[4mDefault settings:\033[0m")
[print(i) for i in default_settings] [print(i) for i in default_settings]
for setting in default_settings: vimrc_content = list(map(lambda x: x + "\n", default_settings))
vimrc_content.append(setting + "\n")
return vimrc_content return vimrc_content
def get_vimfile_working_copy(self): def get_vimfile_working_copy(self):