From 2e47d8704fa0fe56ced38ddb4fc94f111079bd82 Mon Sep 17 00:00:00 2001 From: yayogev Date: Wed, 21 Mar 2018 17:31:54 +0200 Subject: Python 3.4 backwards compatibility (for 'verify' job) cherry-picked from internal commit by ilia on 07/02/2018 19:49 Change-Id: I03caf42492785a9af5e8301ca202b00a7b4af787 Signed-off-by: yayogev --- app/utils/util.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'app/utils/util.py') diff --git a/app/utils/util.py b/app/utils/util.py index 17a31c0..788eba9 100644 --- a/app/utils/util.py +++ b/app/utils/util.py @@ -9,8 +9,6 @@ ############################################################################### import importlib import signal -from argparse import Namespace -from typing import Dict, Callable import os import re @@ -129,8 +127,8 @@ def generate_object_ids(keys, obj): # and convert them to dict to enforce uniformity. # Throws a TypeError if arguments can't be converted to dict. def setup_args(args: dict, - defaults: Dict[str, object], - get_cmd_args: Callable[[], Namespace] = None): + defaults, + get_cmd_args=None): if defaults is None: defaults = {} @@ -171,3 +169,10 @@ def decode_aci_dn(object_id): def get_object_path_part(path: str, part_name: str): match = re.match(".*/{}/(.+?)/.*".format(part_name), path) return match.group(1) if match else None + + +def merge_dicts(*dicts): + result = {} + for dictionary in dicts: + result.update(dictionary) + return result -- cgit 1.2.3-korg