You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.1 KiB
62 lines
1.1 KiB
3 years ago
|
# Imports
|
||
|
|
||
|
from .centos import centos
|
||
|
from .django import django
|
||
|
from .messages import messages
|
||
|
from .mysql import mysql
|
||
|
from .pgsql import pgsql
|
||
|
from .posix import posix
|
||
|
from .python import python
|
||
|
from .ubuntu import ubuntu
|
||
|
|
||
|
# Exports
|
||
|
|
||
3 years ago
|
__all__ = (
|
||
|
"MAPPINGS",
|
||
|
"merge",
|
||
|
"merge_dictionaries",
|
||
|
)
|
||
|
|
||
3 years ago
|
# Functions
|
||
|
|
||
|
|
||
|
def merge(first: dict, *others) -> dict:
|
||
|
"""Merge all other dictionaries into the first.
|
||
|
|
||
|
:param first: The first dictionary.
|
||
|
:type first: dict
|
||
|
|
||
|
:param others: A list of other dictionaries to be merged.
|
||
|
|
||
|
"""
|
||
|
for d in others:
|
||
|
first = merge_dictionaries(first, d)
|
||
|
|
||
|
return first
|
||
|
|
||
|
|
||
|
def merge_dictionaries(first: dict, second: dict) -> dict:
|
||
|
"""Merge the second dictionary into the first.
|
||
|
|
||
|
:param first: The first dictionary.
|
||
|
:type first: dict
|
||
|
|
||
|
:param second: The second dictionary.
|
||
|
:type second: dict
|
||
|
|
||
|
:rtype: dict
|
||
|
|
||
|
"""
|
||
|
for key, values in second.items():
|
||
|
first[key] = values
|
||
|
|
||
|
return first
|
||
|
|
||
|
# Mappings
|
||
|
|
||
|
|
||
|
MAPPINGS = {
|
||
3 years ago
|
'centos': merge(centos, django, messages, mysql, pgsql, posix, python),
|
||
3 years ago
|
'ubuntu': merge(ubuntu, django, messages, mysql, pgsql, posix, python),
|
||
|
}
|