Skip to content

Commit bfa080b

Browse files
author
Ganesh Maharaj Mahalingam
committed
Pylint fixes
Signed-off-by: Ganesh Maharaj Mahalingam <[email protected]>
1 parent d251fb1 commit bfa080b

File tree

5 files changed

+18
-30
lines changed

5 files changed

+18
-30
lines changed

hwinfo/host/dmidecode.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,3 @@ class DmidecodeParser(CommandParser):
1919
# Processor Info
2020
r'Processor\ Information\n\tSocket\ Designation:\ (?P<socket_designation>.*)\n',
2121
]
22-
23-

hwinfo/pci/__init__.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,14 @@ def __init__(self, record):
1010
def lookup_value(self, k):
1111
if k in self.rec:
1212
return self.rec[k]
13-
else:
14-
return None
13+
return None
1514

1615
def _fmt(self, value, wrap=None):
1716
if not value:
1817
return self.NONE_VALUE
19-
else:
20-
if wrap:
21-
return "%s%s%s" % (wrap, value, wrap)
22-
else:
23-
return value
18+
if wrap:
19+
return "%s%s%s" % (wrap, value, wrap)
20+
return value
2421

2522
def get_device_name(self):
2623
wrap = None
@@ -35,8 +32,7 @@ def get_device_name(self):
3532
# If the input has come from lspci, this is the value for
3633
# not being able to find a key in the pciids db.
3734
return '[Device %s]' % self.get_device_id()
38-
else:
39-
return self._fmt(name, wrap)
35+
return self._fmt(name, wrap)
4036

4137

4238
def get_device_id(self):
@@ -64,8 +60,7 @@ def get_subdevice_name(self):
6460
# If the input has come from lspci, this is the value for
6561
# not being able to find a key in the pciids db.
6662
return '[Device %s]' % self.get_subdevice_id()
67-
else:
68-
return self._fmt(name, wrap)
63+
return self._fmt(name, wrap)
6964

7065
def get_subdevice_id(self):
7166
return self._fmt(self.lookup_value('pci_subdevice_id'))
@@ -88,14 +83,13 @@ def get_pci_class(self):
8883
return self._fmt(self.lookup_value('pci_device_class'))
8984

9085
def is_subdevice(self):
91-
return self.lookup_value('pci_subvendor_id') and self.lookup_value('pci_subdevice_id') or self.lookup_value('pci_device_sub_string')
86+
return self.lookup_value('pci_subdevice_id') if self.lookup_value('pci_subvendor_id') else self.lookup_value('pci_device_sub_string')
9287

9388
def get_info(self):
9489

9590
if self.is_subdevice():
9691
return "%s %s (%s %s)" % (self.get_subvendor_name(), self.get_subdevice_name(), self.get_vendor_name(), self.get_device_name())
97-
else:
98-
return "%s %s" % (self.get_vendor_name(), self.get_device_name())
92+
return "%s %s" % (self.get_vendor_name(), self.get_device_name())
9993

10094
def get_rec(self):
10195
rec = {}

hwinfo/pci/biosdevname.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,3 @@ class BiosdevnameDParser(CommandParser):
1313
r'Driver\ version:\ (?P<driver_version>.*)\n',
1414
r'Firmware\ version:\ (?P<firmware_version>.*)\n',
1515
]
16-
17-

hwinfo/tools/inspector.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
#!/usr/bin/env python
22

3+
from __future__ import print_function
34
from argparse import ArgumentParser
4-
import paramiko
55
import subprocess
66
import os
77
import sys
88
import tarfile
99
import tempfile
1010
import shutil
1111
import json
12+
import paramiko
1213

1314
from prettytable import PrettyTable
1415

@@ -121,8 +122,7 @@ def is_remote(self):
121122
def exec_command(self, cmd):
122123
if self.is_remote():
123124
return remote_command(self.client, cmd)
124-
else:
125-
return local_command(cmd)
125+
return local_command(cmd)
126126

127127
def get_lspci_data(self):
128128
return self.exec_command(['lspci', '-nnmm'])
@@ -273,9 +273,8 @@ def _load_from_file(self, filename):
273273
"""Find filename in tar, and load it"""
274274
if filename in self.fdata:
275275
return self.fdata[filename]
276-
else:
277-
filepath = find_in_tarball(self.tarloc, filename)
278-
return read_from_tarball(self.tarloc, filepath)
276+
filepath = find_in_tarball(self.tarloc, filename)
277+
return read_from_tarball(self.tarloc, filepath)
279278

280279
def pci_filter(devices, types):
281280
res = []

hwinfo/util/__init__.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,11 @@ def parse_item(self, item):
5858
def parse_items(self):
5959
if not self.ITEM_SEPERATOR:
6060
return [self.parse_item(self.DATA)]
61-
else:
62-
recs = []
63-
for data in str(self.DATA).split(self.ITEM_SEPERATOR):
64-
rec = self.parse_item(data)
65-
recs.append(rec)
66-
return recs
61+
recs = []
62+
for data in str(self.DATA).split(self.ITEM_SEPERATOR):
63+
rec = self.parse_item(data)
64+
recs.append(rec)
65+
return recs
6766

6867
def parse(self):
6968
if self.ITEM_SEPERATOR:

0 commit comments

Comments
 (0)