aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpmikus <pmikus@cisco.com>2021-02-17 14:27:12 +0000
committerVratko Polak <vrpolak@cisco.com>2021-02-17 16:05:58 +0000
commit0e47925aa6d0e0e0eef7e543c2d5b2c885fd65a9 (patch)
tree66cca2af8e63bb594beb09c7e96b4dbd2837166f
parent6b4b75acf819a8a7c68d0f57365bbd6e0b4d3933 (diff)
PAPI: Python 3.8 compatibilityrls2009
Signed-off-by: pmikus <pmikus@cisco.com> Change-Id: I33fefddda9055524c1817b13b5c99bb1b97ebff4 (cherry picked from commit 96c5f5ef45cf039691404a4451b1c6d9260d6ea0)
-rw-r--r--resources/libraries/python/PapiExecutor.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/resources/libraries/python/PapiExecutor.py b/resources/libraries/python/PapiExecutor.py
index 46fe5d583b..f4d01704b3 100644
--- a/resources/libraries/python/PapiExecutor.py
+++ b/resources/libraries/python/PapiExecutor.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2020 Cisco and/or its affiliates.
+# Copyright (c) 2021 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -23,6 +23,8 @@ import subprocess
import sys
import tempfile
import time
+from collections import UserDict
+
from pprint import pformat
from robot.api import logger
@@ -63,11 +65,11 @@ def dictize(obj):
"""
if not hasattr(obj, u"_asdict"):
return obj
- ret = obj._asdict()
- old_get = ret.__getitem__
+ overriden = UserDict(obj._asdict())
+ old_get = overriden.__getitem__
new_get = lambda self, key: dictize(old_get(self, key))
- ret.__getitem__ = new_get
- return ret
+ overriden.__getitem__ = new_get
+ return overriden
class PapiSocketExecutor: