mirror of
https://gerrit.ovirt.org/vdsm
synced 2026-02-05 12:46:23 +01:00
flake8: fix E305
Fixed E305: expected 2 blank lines after class or function definition, found 1 and re-enabled the test for it in tox. Change-Id: I4e9ef63491b6f4063880b8e2db64857cd8c826ee Related-To: https://bugzilla.redhat.com/show_bug.cgi?id=2004412 Signed-off-by: Sandro Bonazzola <sbonazzo@redhat.com>
This commit is contained in:
committed by
Marcin Sobczyk
parent
dd6b07f7c6
commit
955f78122a
@@ -69,5 +69,6 @@ def parse_args():
|
||||
action='store_true', default=False)
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv[1:]))
|
||||
|
||||
@@ -270,6 +270,7 @@ class Nfs(object):
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if os.geteuid() != 0:
|
||||
print("You must be root to run this script.")
|
||||
|
||||
@@ -60,6 +60,7 @@ def _scriptsPerDir(dir_name):
|
||||
return [s for s in glob.glob(path)
|
||||
if os.path.isfile(s) and os.access(s, os.X_OK)]
|
||||
|
||||
|
||||
_DOMXML_HOOK = 1
|
||||
_JSON_HOOK = 2
|
||||
|
||||
@@ -482,6 +483,7 @@ def installed():
|
||||
res[dir] = inf
|
||||
return res
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def usage():
|
||||
print('Usage: %s hook_name' % sys.argv[0])
|
||||
|
||||
@@ -216,4 +216,5 @@ def __close_connections():
|
||||
for conn in __connections.values():
|
||||
conn.close()
|
||||
|
||||
|
||||
atexit.register(__close_connections)
|
||||
|
||||
@@ -174,6 +174,7 @@ def decodePVInfo(value):
|
||||
del pvInfo["pv"]
|
||||
return pvInfo
|
||||
|
||||
|
||||
BLOCK_SD_MD_FIELDS = sd.SD_MD_FIELDS.copy()
|
||||
# TBD: Do we really need this key?
|
||||
BLOCK_SD_MD_FIELDS.update({
|
||||
|
||||
@@ -160,6 +160,7 @@ def removeMappingsHoldingDevice(slaveName):
|
||||
for holder in holders:
|
||||
removeMapping(getDevName(holder))
|
||||
|
||||
|
||||
PATH_STATUS_RE = re.compile(r"(?P<devnum>\d+:\d+)\s+(?P<status>[AF])")
|
||||
|
||||
|
||||
|
||||
@@ -193,6 +193,7 @@ class Unreadable(namedtuple("_Unreadable", "name")):
|
||||
"connections.", self.name)
|
||||
raise AttributeError("Failed reload: %s" % self.name)
|
||||
|
||||
|
||||
# VG states
|
||||
VG_OK = "OK"
|
||||
VG_PARTIAL = "PARTIAL"
|
||||
|
||||
@@ -342,6 +342,7 @@ def get_scsi_serial(physdev):
|
||||
return line.split("=", 1)[1]
|
||||
return "" # Fallback if command failed or no ID_SERIAL found
|
||||
|
||||
|
||||
HBTL = namedtuple("HBTL", "host bus target lun")
|
||||
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ class FORMAT:
|
||||
RAW = "raw"
|
||||
VMDK = "vmdk"
|
||||
|
||||
|
||||
_QCOW2_COMPAT_SUPPORTED = ("0.10", "1.1")
|
||||
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ def _init_configurators():
|
||||
setattr(modules[module_name], 'name', module_name)
|
||||
return modules
|
||||
|
||||
|
||||
_CONFIGURATORS = _init_configurators()
|
||||
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ class InvalidRun(UsageError):
|
||||
""" raise when the environment is not valid to run the command """
|
||||
pass
|
||||
|
||||
|
||||
# Declare state of configuration
|
||||
#
|
||||
# YES = Module configured.
|
||||
|
||||
@@ -466,6 +466,7 @@ def main(*args):
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
|
||||
|
||||
@@ -220,5 +220,6 @@ def main():
|
||||
print("Interrupted", file=sys.stderr)
|
||||
return 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
|
||||
@@ -28,6 +28,7 @@ class APIData(object):
|
||||
self.meth = meth
|
||||
self.data = data
|
||||
|
||||
|
||||
testPing_apidata = [
|
||||
APIData('Global', 'ping', {
|
||||
'status': {'code': 0, 'message': 'OK'}})
|
||||
|
||||
@@ -1066,6 +1066,7 @@ def glusterStorageDevData():
|
||||
devices.append(device)
|
||||
return devices
|
||||
|
||||
|
||||
GLUSTER_GEOREP_STATUS = {
|
||||
'vol1': {
|
||||
'sessions': [
|
||||
|
||||
@@ -486,6 +486,7 @@ class FakeMdevType(object):
|
||||
self.instances.append(mdev_uuid)
|
||||
self.available_instances -= 1
|
||||
|
||||
|
||||
FakeMdevDevice = namedtuple('FakeMdevDevice', ['name', 'vendor', 'mdev_types'])
|
||||
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ def mysum(lst, strategy):
|
||||
|
||||
return s
|
||||
|
||||
|
||||
SUM_PREMUTATIONS = (("recursive",),
|
||||
("builtin",),
|
||||
("loop",))
|
||||
|
||||
@@ -314,6 +314,7 @@ class ParsingHelperTests(XMLTestCase):
|
||||
xmlutils.fromstring(xml_data)
|
||||
)
|
||||
|
||||
|
||||
# the alias is not rendered by getXML, so having it would make
|
||||
# the test fail
|
||||
_CONTROLLERS_XML = [
|
||||
|
||||
3
tox.ini
3
tox.ini
@@ -221,13 +221,12 @@ timeout_method = thread
|
||||
# Ignore errors in current code to make the build pass
|
||||
# 31 E402 module level import not at top of file
|
||||
# 25 E731 do not assign a lambda expression, use a def
|
||||
# 43 E305 expected 2 blank lines after class or function definition, found 1
|
||||
# 173 E722 do not use bare except'
|
||||
# 4 E741 ambiguous variable name 'l'
|
||||
# TODO: fix the code and eliminate these ignores
|
||||
# !PEP8: W503 line break before binary operator
|
||||
# W504 line break after binary operator
|
||||
# !PEP8: E203 whitespace before ':'
|
||||
ignore = E402, E731, E305, E722, E741, W503, W504, E203
|
||||
ignore = E402, E731, E722, E741, W503, W504, E203
|
||||
|
||||
show_source = True
|
||||
|
||||
@@ -84,6 +84,7 @@ def _usage():
|
||||
print('\t-h, --help\t\tdisplay this help')
|
||||
print('\t-t, --test\t\trun tests')
|
||||
|
||||
|
||||
_SAP_PLACEHOLDER = set(['SAP'])
|
||||
_SAP_FLAGS = set(['+invtsc', '+rdtscp'])
|
||||
|
||||
@@ -125,6 +126,7 @@ _EXTRACT_FLAGS_TEST_DATA = {
|
||||
def _find_invalid_flags(flags):
|
||||
return list(filter(lambda flag: flag[0] not in ('+', '-'), flags))
|
||||
|
||||
|
||||
_FIND_INVALID_FLAGS_TEST_DATA = {
|
||||
(): [],
|
||||
('+syscall',): [],
|
||||
@@ -140,6 +142,7 @@ def _find_conflicting_flags(flags):
|
||||
Counter([flag[1:] for flag in flags]).items() if
|
||||
count > 1]
|
||||
|
||||
|
||||
_FIND_CONFLICTING_FLAGS_DATA = {
|
||||
(): [],
|
||||
('+syscall',): [],
|
||||
|
||||
@@ -108,6 +108,7 @@ def uuidDigest(uuid):
|
||||
idx = 0
|
||||
iteration += 1
|
||||
|
||||
|
||||
ETH_HW_ADDR_FORMAT = '%02x:%02x:%02x:%02x:%02x:%02x'
|
||||
|
||||
|
||||
|
||||
@@ -231,6 +231,7 @@ def main():
|
||||
if ret:
|
||||
hooking.log('Failed to restart fcoe service. err = %s' % (err))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
main()
|
||||
|
||||
@@ -54,6 +54,7 @@ def inject_file(filepath, content, drive, diskformat):
|
||||
|
||||
return injected
|
||||
|
||||
|
||||
if 'fileinject' in os.environ:
|
||||
try:
|
||||
pos = os.environ['fileinject'].find(':')
|
||||
|
||||
@@ -95,6 +95,7 @@ def add_disk(domxml, path):
|
||||
devices = domxml.getElementsByTagName('devices')[0]
|
||||
devices.appendChild(disk)
|
||||
|
||||
|
||||
if 'scratchpad' in os.environ:
|
||||
try:
|
||||
disks = os.environ['scratchpad']
|
||||
|
||||
@@ -74,6 +74,7 @@ def addBiosEntry(domxml, sysinfo, entry):
|
||||
e.appendChild(txt)
|
||||
bios.appendChild(e)
|
||||
|
||||
|
||||
if 'smbios' in os.environ:
|
||||
try:
|
||||
data = os.environ['smbios']
|
||||
|
||||
Reference in New Issue
Block a user