diff options
author | Jan Gelety <jgelety@cisco.com> | 2019-11-12 05:27:43 +0100 |
---|---|---|
committer | Jan Gelety <jgelety@cisco.com> | 2019-11-28 18:26:21 +0100 |
commit | d68951ac245150eeefa6e0f4156e4c1b5c9e9325 (patch) | |
tree | 487554a7547218d27f0a61ec02b70502c32cdcb4 /resources/libraries/python/PapiHistory.py | |
parent | ed0258a440cfad7023d643f717ab78ac568dc59b (diff) |
Python3: resources and libraries
Change-Id: I1392c06b1d64f62b141d24c0d42a8e36913b15e2
Signed-off-by: Jan Gelety <jgelety@cisco.com>
Diffstat (limited to 'resources/libraries/python/PapiHistory.py')
-rw-r--r-- | resources/libraries/python/PapiHistory.py | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/resources/libraries/python/PapiHistory.py b/resources/libraries/python/PapiHistory.py index c4ee4ee495..cacfbd6b19 100644 --- a/resources/libraries/python/PapiHistory.py +++ b/resources/libraries/python/PapiHistory.py @@ -17,13 +17,13 @@ from robot.api import logger from resources.libraries.python.topology import NodeType, DICT__nodes -__all__ = ["DICT__DUTS_PAPI_HISTORY", "PapiHistory"] +__all__ = [u"DICT__DUTS_PAPI_HISTORY", u"PapiHistory"] DICT__DUTS_PAPI_HISTORY = dict() -class PapiHistory(object): +class PapiHistory: """Contains methods to set up DUT PAPI command history. """ @@ -34,7 +34,7 @@ class PapiHistory(object): :param node: DUT node to reset PAPI command history for. :type node: dict """ - DICT__DUTS_PAPI_HISTORY[node['host']] = list() + DICT__DUTS_PAPI_HISTORY[node[u"host"]] = list() @staticmethod def reset_papi_history_on_all_duts(nodes): @@ -44,7 +44,7 @@ class PapiHistory(object): :type nodes: dict """ for node in nodes.values(): - if node['type'] == NodeType.DUT: + if node[u"type"] == NodeType.DUT: PapiHistory.reset_papi_history(node) @staticmethod @@ -85,16 +85,15 @@ class PapiHistory(object): """ if papi: args = list() - for key, val in kwargs.iteritems(): - args.append("{key}={val!r}".format(key=key, val=val)) - item = "{cmd}({args})".format(cmd=csit_papi_command, - args=",".join(args)) + for key, val in kwargs.items(): + args.append(f"{key}={val!r}") + item = f"{csit_papi_command}({u','.join(args)})" else: # This else part is here to store VAT commands. # VAT history is not used. # TODO: Remove when VatExecutor is completely removed. - item = "{cmd}".format(cmd=csit_papi_command) - DICT__DUTS_PAPI_HISTORY[node['host']].append(item) + item = f"{csit_papi_command}" + DICT__DUTS_PAPI_HISTORY[node[u"host"]].append(item) @staticmethod def show_papi_history(node): @@ -103,12 +102,11 @@ class PapiHistory(object): :param node: DUT node to show PAPI command history for. :type node: dict """ - history_list = DICT__DUTS_PAPI_HISTORY[node['host']] + history_list = DICT__DUTS_PAPI_HISTORY[node[u"host"]] if not history_list: - history_list = ("No PAPI command executed", ) - logger.info( - "{0} PAPI command history:\n{1}\n".format( - node['host'], "\n".join(history_list))) + history_list = (u"No PAPI command executed", ) + history = u'\n'.join(history_list) + logger.info(f"{node[u'host']} PAPI command history:\n{history}\n") @staticmethod def show_papi_history_on_all_duts(nodes): @@ -118,7 +116,7 @@ class PapiHistory(object): :type nodes: dict """ for node in nodes.values(): - if node['type'] == NodeType.DUT: + if node[u"type"] == NodeType.DUT: PapiHistory.show_papi_history(node) |