From 6e5dd42727b40c6b5ba6235026a6cfc78f482ac9 Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Tue, 19 Jan 2016 18:51:11 +0200 Subject: wic: pylinted ksparser module Added missing docstrings, fixed wrong indentation and long lines. Final pylint score is 9.89/10 Signed-off-by: Ed Bartosh Signed-off-by: Richard Purdie --- scripts/lib/wic/ksparser.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py index 3722799b51..f2a0e04744 100644 --- a/scripts/lib/wic/ksparser.py +++ b/scripts/lib/wic/ksparser.py @@ -21,9 +21,9 @@ # This module provides parser for kickstart format # # AUTHORS -# Tom Zanussi # Ed Bartosh (at] linux.intel.com> +"""Kickstart parser module.""" import os import shlex @@ -33,6 +33,7 @@ from wic.partition import Partition from wic.utils.misc import find_canned class KickStartError(Exception): + """Custom exception.""" pass class KickStartParser(ArgumentParser): @@ -91,6 +92,8 @@ def cannedpathtype(arg): return result class KickStart(object): + """"Kickstart parser implementation.""" + def __init__(self, confpath): self.partitions = [] @@ -134,6 +137,9 @@ class KickStart(object): self._parse(parser, confpath) def _parse(self, parser, confpath): + """ + Parse file in .wks format using provided parser. + """ with open(confpath) as conf: lineno = 0 for line in conf: @@ -152,7 +158,8 @@ class KickStart(object): self._parse(parser, parsed.path) elif line.startswith('bootloader'): if not self.bootloader: - self.bootloader = parsed + self.bootloader = parsed else: - raise KickStartError("%s:%d: more than one bootloader "\ - "specified" % (confpath, lineno)) + err = "%s:%d: more than one bootloader specified" \ + % (confpath, lineno) + raise KickStartError(err) -- cgit 1.2.3-korg