diff options
author | Tibor Frank <tifrank@cisco.com> | 2016-12-15 10:52:33 +0100 |
---|---|---|
committer | Tibor Frank <tifrank@cisco.com> | 2016-12-16 08:35:32 +0100 |
commit | cf561a6e3d4c4fbd78ab6c9d0a9aa817bb3300fc (patch) | |
tree | 0b4d5d2dbda78223d77d76e237285396d42c868e /resources/libraries/python/honeycomb | |
parent | 677ae40a2be6db9f49b19ada3c4299a8904f7784 (diff) |
Pylint fixes
- Fix PyLint errors
- Fix comments in touched python modules
Change-Id: I26db2d292a41969cf38b9b0bdd49c4fb15349102
Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/libraries/python/honeycomb')
4 files changed, 20 insertions, 26 deletions
diff --git a/resources/libraries/python/honeycomb/HcAPIKwACL.py b/resources/libraries/python/honeycomb/HcAPIKwACL.py index 8d1746d0ad..0cde6d4824 100644 --- a/resources/libraries/python/honeycomb/HcAPIKwACL.py +++ b/resources/libraries/python/honeycomb/HcAPIKwACL.py @@ -289,8 +289,7 @@ class ACLKeywords(object): suffix_dict = {"l2": "eth", "l3_ip4": "ipv4", "l3_ip6": "ipv6", - "mixed": "mixed" - } + "mixed": "mixed"} try: suffix = suffix_dict[layer] except KeyError: @@ -385,8 +384,8 @@ class ACLKeywords(object): } except KeyError: raise ValueError("Unknown network layer {0}. " - "Valid options are: {1}".format( - layer, layers.keys())) + "Valid options are: {1}". + format(layer, layers.keys())) status_code, resp = HcUtil.put_honeycomb_data( node, "config_vpp_interfaces", data, path) diff --git a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py index 01a2eba0ad..5658eea146 100644 --- a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py +++ b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py @@ -27,8 +27,6 @@ from resources.libraries.python.honeycomb.HoneycombUtil \ import HoneycombUtil as HcUtil -# pylint: disable=too-many-public-methods -# pylint: disable=too-many-lines class InterfaceKeywords(object): """Keywords for Interface manipulation. @@ -1291,7 +1289,7 @@ class InterfaceKeywords(object): node, super_interface, path, address) @staticmethod - def remove_all_ipv4_addresses_from_sub_interface(node, super_interface, # pylint: disable=invalid-name + def remove_all_ipv4_addresses_from_sub_interface(node, super_interface, identifier): """Remove all ipv4 addresses from the specified sub-interface. diff --git a/resources/libraries/python/honeycomb/HoneycombUtil.py b/resources/libraries/python/honeycomb/HoneycombUtil.py index f607c2439a..747c9dae8e 100644 --- a/resources/libraries/python/honeycomb/HoneycombUtil.py +++ b/resources/libraries/python/honeycomb/HoneycombUtil.py @@ -126,7 +126,7 @@ class HoneycombUtil(object): :param url_file: URL file. The argument contains only the name of file without extension, not the full path. :type url_file: str - :return: Requested path. + :returns: Requested path. :rtype: str """ @@ -178,7 +178,7 @@ class HoneycombUtil(object): :param path: Path to data we want to find. :type data: dict :type path: tuple - :return: Data represented by path. + :returns: Data represented by path. :rtype: str, dict, or list :raises HoneycombError: If the data has not been found. """ @@ -205,7 +205,7 @@ class HoneycombUtil(object): :param path: Path to data we want to remove. :type data: dict :type path: tuple - :return: Original data without removed part. + :returns: Original data without removed part. :rtype: dict """ @@ -245,7 +245,7 @@ class HoneycombUtil(object): :type data: dict :type path: tuple :type new_value: str, dict or list - :return: Original data with the new value. + :returns: Original data with the new value. :rtype: dict """ @@ -295,14 +295,14 @@ class HoneycombUtil(object): :type node: dict :type url_file: str :type path: str - :return: Status code and content of response. + :returns: Status code and content of response. :rtype tuple """ base_path = HoneycombUtil.read_path_from_url_file(url_file) path = base_path + path status_code, resp = HTTPRequest.get(node, path) - (status_node, response) = status_code, loads(resp) + response = loads(resp) if status_code != HTTPCodes.OK: HoneycombUtil.read_log_tail(node) return status_code, response @@ -324,7 +324,7 @@ class HoneycombUtil(object): :type data: dict, str :type path: str :type data_representation: DataRepresentation - :return: Status code and content of response. + :returns: Status code and content of response. :rtype: tuple :raises HoneycombError: If the given data representation is not defined in HEADERS. @@ -368,7 +368,7 @@ class HoneycombUtil(object): :type data: dict, str :type data_representation: DataRepresentation :type timeout: int - :return: Status code and content of response. + :returns: Status code and content of response. :rtype: tuple :raises HoneycombError: If the given data representation is not defined in HEADERS. @@ -401,7 +401,7 @@ class HoneycombUtil(object): :type node: dict :type url_file: str :type path: str - :return: Status code and content of response. + :returns: Status code and content of response. :rtype tuple """ @@ -422,7 +422,7 @@ class HoneycombUtil(object): :param lines: Number of lines to read. :type node: dict :type lines: int - :return: Last N log lines. + :returns: Last N log lines. :rtype: str """ diff --git a/resources/libraries/python/honeycomb/Netconf.py b/resources/libraries/python/honeycomb/Netconf.py index 3c98387334..e3cdbe5dce 100644 --- a/resources/libraries/python/honeycomb/Netconf.py +++ b/resources/libraries/python/honeycomb/Netconf.py @@ -14,10 +14,10 @@ """Keywords used to connect to Honeycomb through Netconf, send messages and receive replies.""" +import socket from time import time import paramiko -import socket from robot.api import logger from interruptingcow import timeout @@ -61,8 +61,7 @@ class Netconf(object): password=node['honeycomb']['passwd'], pkey=None, port=node['honeycomb']['netconf_port'], - timeout=time_out, - ) + timeout=time_out) logger.trace('Connect took {0} seconds'.format(time() - start)) logger.debug('New ssh: {0}'.format(client)) @@ -102,7 +101,7 @@ class Netconf(object): :type size:int :type time_out:int :type err:str - :return: Content of response. + :returns: Content of response. :rtype: str :raises HoneycombError: If the read process times out. """ @@ -123,13 +122,11 @@ class Netconf(object): break except socket.timeout: raise HoneycombError("Socket timeout.", - enable_logging=False - ) + enable_logging=False) except RuntimeError: raise HoneycombError(err + " Content of buffer: {0}".format(reply), - enable_logging=False - ) + enable_logging=False) logger.trace(reply) return reply.replace(self.delimiter, "") @@ -142,7 +139,7 @@ class Netconf(object): :param time_out: Timeout value for getting the complete response. :type size:int :type time_out:int - :return: Content of response. + :returns: Content of response. :rtype: str """ |