From 2ee028b0bd961c3b7c2aa797d6c4d4b24b867f91 Mon Sep 17 00:00:00 2001 From: Bartek Grzybowski Date: Thu, 5 Mar 2020 14:35:29 +0100 Subject: Fix Python linting issues in Python scripts Fixed pylint issues for categories trailing-whitespace, trailing-newlines, syntax-error, unused-import. Change-Id: Iccbdb0c9538a6b8299c0517bafa1ec1be30f07cd Issue-ID: INT-1427 Signed-off-by: Bartek Grzybowski --- test/s3p/collector/get_resource_stats.py | 1 - test/s3p/util/docker_util.py | 22 ++++++++++------------ 2 files changed, 10 insertions(+), 13 deletions(-) (limited to 'test/s3p') diff --git a/test/s3p/collector/get_resource_stats.py b/test/s3p/collector/get_resource_stats.py index aca2514c8..db377a766 100755 --- a/test/s3p/collector/get_resource_stats.py +++ b/test/s3p/collector/get_resource_stats.py @@ -6,7 +6,6 @@ import datetime import collections import re import tzlocal -from decimal import Decimal sys.path.append('../util') import docker_util diff --git a/test/s3p/util/docker_util.py b/test/s3p/util/docker_util.py index a0e688199..021e48c98 100644 --- a/test/s3p/util/docker_util.py +++ b/test/s3p/util/docker_util.py @@ -22,7 +22,7 @@ def get_container_list(ip): Args: param1 (str): host ip - Returns: + Returns: list of containers in string """ @@ -35,7 +35,7 @@ def get_container_list(ip): containers = [] if result == []: error = ssh.stderr.readlines() - print error + print(error) else: for line in result: token = line.decode('ascii').strip() @@ -47,12 +47,12 @@ def get_container_list(ip): def get_container_volume_size(ip, container): """ Get container total volume usage - Args: + Args: param1 (str): host ip param2 (str): container name - + Returns: - float number in GB if the container has volume(s), None otherwise + float number in GB if the container has volume(s), None otherwise """ cmd = ['ssh', '-i', 'onap_dev'] @@ -65,7 +65,7 @@ def get_container_volume_size(ip, container): total = None if result == []: error = ssh.stderr.readlines() - print error + print(error) else: data = json.loads(result[0]) for entry in data: @@ -83,10 +83,10 @@ def get_container_volume_size(ip, container): def get_volume_size(ip, volume): """ Get a volume size - Args: + Args: param1 (str): host ip param2 (str): volume name - + Returns: float number in GB """ @@ -98,7 +98,7 @@ def get_volume_size(ip, volume): p2 = subprocess.Popen(['grep', volume], stdin=p1.stdout, stdout=subprocess.PIPE) p1.stdout.close() - (output, err) = p2.communicate() + (output, err) = p2.communicate() # pylint: disable=W0612 size = output.split()[2] return convert_to_GB(size) @@ -109,7 +109,7 @@ def convert_to_GB(s): Args: param1 (str): volume size with unit - Returns: + Returns: float number representing volume size in GB """ @@ -122,5 +122,3 @@ def convert_to_GB(s): d = round(Decimal(float(re.sub('[^0-9\\.]', '', s)) / 1000000.0), 1) return d - - -- cgit 1.2.3-korg