1
0
mirror of https://github.com/altlinux/gpupdate.git synced 2025-03-21 18:50:38 +03:00

create_dconf_ini_file function moved

This commit is contained in:
Valery Sinelnikov 2023-07-13 16:32:56 +04:00
parent 83e70d5e7a
commit c26fbf8042
2 changed files with 18 additions and 17 deletions

View File

@ -65,3 +65,21 @@ def load_preg_dconf(preg):
dd_target.setdefault(all_list_key[-1], []).append(i.data)
# Update the global registry dictionary with the contents of dd
update_dict(Dconf_registry.global_registry_dict, dd)
def create_dconf_ini_file(filename, data):
'''
Create an ini-file based on a dictionary of dictionaries.
Args:
data (dict): The dictionary of dictionaries containing the data for the ini-file.
filename (str): The filename to save the ini-file.
Returns:
None
Raises:
None
'''
with open(filename, 'w') as file:
for section, section_data in data.items():
file.write(f'[{section}]\n')
for key, value in section_data.items():
file.write(f'{key} = "{value}"\n')
file.write('\n')

View File

@ -180,20 +180,3 @@ def touch_file(filename):
path.parent.mkdir(parents=True, exist_ok=True)
path.touch()
def create_ini_file(filename, data):
"""
Create an ini-file based on a dictionary of dictionaries.
Args:
data (dict): The dictionary of dictionaries containing the data for the ini-file.
filename (str): The filename to save the ini-file.
Returns:
None
Raises:
None
"""
with open(filename, 'w') as file:
for section, section_data in data.items():
file.write(f"[{section}]\n")
for key, value in section_data.items():
file.write(f"{key} = {value}\n")
file.write("\n")