diff --git a/image_creator/dialog_wizard.py b/image_creator/dialog_wizard.py index 2c4e5d62f611b0c2eba448fe9a7ba515ec0e897e..6104c66209be7b492916bffcdd49175d885a1c6b 100644 --- a/image_creator/dialog_wizard.py +++ b/image_creator/dialog_wizard.py @@ -105,18 +105,19 @@ class WizardPage(object): NEXT = 1 PREV = -1 - def __init__(self, name, text, **kargs): + def __init__(self, name, text, **kwargs): self.name = name self.answer = None self.text = text - self.print_name = kargs['print_name'] if 'print_name' in kargs \ + self.print_name = kwargs['print_name'] if 'print_name' in kwargs \ else " ".join(re.findall('[A-Z][^A-Z]*', name)) - self.title = kargs['title'] if 'title' in kargs else self.print_name - self.default = kargs['default'] if 'default' in kargs else "" - self.extra = kargs['extra'] if 'extra' in kargs else None + self.title = kwargs['title'] if 'title' in kwargs else self.print_name + self.default = kwargs['default'] if 'default' in kwargs else "" + self.extra = kwargs['extra'] if 'extra' in kwargs else None self.validate = \ - kargs['validate'] if 'validate' in kargs else lambda x: x - self.display = kargs['display'] if 'display' in kargs else lambda x: x + kwargs['validate'] if 'validate' in kwargs else lambda x: x + self.display = \ + kwargs['display'] if 'display' in kwargs else lambda x: x self.dargs = {} self.dargs['ok_label'] = 'Next' @@ -124,10 +125,10 @@ class WizardPage(object): self.dargs['width'] = PAGE_WIDTH self.dargs['height'] = PAGE_HEIGHT - if 'extra' in kargs: + if 'extra' in kwargs: self.dargs['extra_button'] = 1 - self.extra_label = kargs['extra_label'] if 'extra_label' in kargs \ + self.extra_label = kwargs['extra_label'] if 'extra_label' in kwargs \ else lambda: "extra" def __str__(self): @@ -167,9 +168,9 @@ class WizardInfoPage(WizardPage): The user-defined information is created by the info function. """ - def __init__(self, name, text, info, **kargs): + def __init__(self, name, text, info, **kwargs): """Initialize the WizardInfoPage instance""" - super(WizardInfoPage, self).__init__(name, text, **kargs) + super(WizardInfoPage, self).__init__(name, text, **kwargs) self.info = info def show(self, dialog, title): @@ -194,9 +195,9 @@ class WizardInfoPage(WizardPage): class WizardFormPage(WizardPage): """Represents a Form in a wizard""" - def __init__(self, name, text, fields, **kargs): + def __init__(self, name, text, fields, **kwargs): """Initialize the WizardFormPage instance""" - super(WizardFormPage, self).__init__(name, text, **kargs) + super(WizardFormPage, self).__init__(name, text, **kwargs) self.fields = fields def show(self, dialog, title): @@ -227,11 +228,11 @@ class WizardPageWthChoices(WizardPage): the choices variable. If the choices function returns an empty list, a fallback function is executed if available. """ - def __init__(self, name, text, choices, **kargs): + def __init__(self, name, text, choices, **kwargs): """Initialize the WizardPageWthChoices instance""" - super(WizardPageWthChoices, self).__init__(name, text, **kargs) + super(WizardPageWthChoices, self).__init__(name, text, **kwargs) self.choices = choices - self.fallback = kargs['fallback'] if 'fallback' in kargs else None + self.fallback = kwargs['fallback'] if 'fallback' in kwargs else None class WizardRadioListPage(WizardPageWthChoices): diff --git a/image_creator/disk.py b/image_creator/disk.py index 0f1fdc46bd616d0a52a8ca2a317ec8a61bb9d514..39c856422ffe21e6e1e6c6adcb2ca65064df08e9 100644 --- a/image_creator/disk.py +++ b/image_creator/disk.py @@ -194,10 +194,10 @@ class Disk(object): self.out.success('done') return "/dev/mapper/%s" % snapshot - def get_image(self, media, **kargs): + def get_image(self, media, **kwargs): """Returns a newly created Image instance.""" - image = Image(media, self.out, **kargs) + image = Image(media, self.out, **kwargs) self._images.append(image) image.enable() return image diff --git a/image_creator/image.py b/image_creator/image.py index da3777df927ee34c828b19044972863e2514ebe9..364d12ae1dafaf023f968cfc23ed16a76c990354 100644 --- a/image_creator/image.py +++ b/image_creator/image.py @@ -28,16 +28,16 @@ from sendfile import sendfile class Image(object): """The instances of this class can create images out of block devices.""" - def __init__(self, device, output, **kargs): + def __init__(self, device, output, **kwargs): """Create a new Image instance""" self.device = device self.out = output self.info = image_info(device) - self.meta = kargs['meta'] if 'meta' in kargs else {} + self.meta = kwargs['meta'] if 'meta' in kwargs else {} self.sysprep_params = \ - kargs['sysprep_params'] if 'sysprep_params' in kargs else {} + kwargs['sysprep_params'] if 'sysprep_params' in kwargs else {} self.progress_bar = None self.guestfs_device = None diff --git a/image_creator/os_type/__init__.py b/image_creator/os_type/__init__.py index 2af3d044edcebf596b98a9c02c567f09c5980cdc..ea8a1938fb8aeddc3df8340fd4a7ebb730deae22 100644 --- a/image_creator/os_type/__init__.py +++ b/image_creator/os_type/__init__.py @@ -87,7 +87,7 @@ def sysprep(message, enabled=True, **kwargs): class SysprepParam(object): """This class represents a system preparation parameter""" - def __init__(self, type, default, description, **kargs): + def __init__(self, type, default, description, **kwargs): assert hasattr(self, "_check_%s" % type), "Invalid type: %s" % type @@ -96,8 +96,8 @@ class SysprepParam(object): self.description = description self.value = default self.error = None - self.check = kargs['check'] if 'check' in kargs else lambda x: x - self.hidden = kargs['hidden'] if 'hidden' in kargs else False + self.check = kwargs['check'] if 'check' in kwargs else lambda x: x + self.hidden = kwargs['hidden'] if 'hidden' in kwargs else False def set_value(self, value): """Update the value of the parameter""" @@ -160,11 +160,11 @@ class SysprepParam(object): raise ValueError("Invalid dirname") -def add_sysprep_param(name, type, default, descr, **kargs): +def add_sysprep_param(name, type, default, descr, **kwargs): """Decorator for __init__ that adds the definition for a system preparation parameter in an instance of an os_type class """ - extra = kargs + extra = kwargs def wrapper(init): @wraps(init) @@ -196,7 +196,7 @@ def del_sysprep_param(name): class OSBase(object): """Basic operating system class""" - def __init__(self, image, **kargs): + def __init__(self, image, **kwargs): self.image = image self.root = image.root @@ -206,8 +206,8 @@ class OSBase(object): if not hasattr(self, 'sysprep_params'): self.sysprep_params = {} - if 'sysprep_params' in kargs: - for key, val in kargs['sysprep_params'].items(): + if 'sysprep_params' in kwargs: + for key, val in kwargs['sysprep_params'].items(): if key not in self.sysprep_params: self.out.warn("Ignoring invalid `%s' parameter." % key) continue @@ -504,7 +504,7 @@ class OSBase(object): """List the name of all files recursively under a directory""" return self.image.g.find(directory) - def _foreach_file(self, directory, action, **kargs): + def _foreach_file(self, directory, action, **kwargs): """Perform an action recursively on all files under a directory. The following options are allowed: @@ -522,16 +522,16 @@ class OSBase(object): self.out.warn("Directory: `%s' does not exist!" % directory) return - maxdepth = None if 'maxdepth' not in kargs else kargs['maxdepth'] + maxdepth = None if 'maxdepth' not in kwargs else kwargs['maxdepth'] if maxdepth == 0: return # maxdepth -= 1 maxdepth = None if maxdepth is None else maxdepth - 1 - kargs['maxdepth'] = maxdepth + kwargs['maxdepth'] = maxdepth - exclude = None if 'exclude' not in kargs else kargs['exclude'] - ftype = None if 'ftype' not in kargs else kargs['ftype'] + exclude = None if 'exclude' not in kwargs else kwargs['exclude'] + ftype = None if 'ftype' not in kwargs else kwargs['ftype'] has_ftype = lambda x, y: y is None and True or x['ftyp'] == y for f in self.image.g.readdir(directory): @@ -544,7 +544,7 @@ class OSBase(object): continue if has_ftype(f, 'd'): - self._foreach_file(full_path, action, **kargs) + self._foreach_file(full_path, action, **kwargs) if has_ftype(f, ftype): action(full_path) diff --git a/image_creator/os_type/linux.py b/image_creator/os_type/linux.py index c5b82a0d8df0c385447a64eaa5b4a87af032fee2..cfaa1991f63897e536d06997322ff6599e6e467c 100644 --- a/image_creator/os_type/linux.py +++ b/image_creator/os_type/linux.py @@ -25,8 +25,8 @@ import time class Linux(Unix): """OS class for Linux""" - def __init__(self, image, **kargs): - super(Linux, self).__init__(image, **kargs) + def __init__(self, image, **kwargs): + super(Linux, self).__init__(image, **kwargs) self._uuid = dict() self._persistent = re.compile('/dev/[hsv]d[a-z][1-9]*') diff --git a/image_creator/os_type/unsupported.py b/image_creator/os_type/unsupported.py index 93b711f92ef8c16f42aa97f4a1fdaab4f388b9ef..6b8d9cba54ae306096f61ba267b6b19e3aed20d2 100644 --- a/image_creator/os_type/unsupported.py +++ b/image_creator/os_type/unsupported.py @@ -22,8 +22,8 @@ from image_creator.os_type import OSBase class Unsupported(OSBase): """OS class for unsupported OSs""" - def __init__(self, image, **kargs): - super(Unsupported, self).__init__(image, **kargs) + def __init__(self, image, **kwargs): + super(Unsupported, self).__init__(image, **kwargs) def collect_metadata(self): """Collect metadata about the OS""" diff --git a/image_creator/os_type/windows/__init__.py b/image_creator/os_type/windows/__init__.py index 2117d8b229e2a5a57a149bca8b5086c27cc766c8..b73ec7fdc51c684c3fefecf13d8bc3c9c3c2df37 100644 --- a/image_creator/os_type/windows/__init__.py +++ b/image_creator/os_type/windows/__init__.py @@ -241,8 +241,8 @@ class Windows(OSBase): check=virtio_dir_check, hidden=True) @add_sysprep_param( 'virtio_timeout', 'posint', 900, DESCR['virtio_timeout']) - def __init__(self, image, **kargs): - super(Windows, self).__init__(image, **kargs) + def __init__(self, image, **kwargs): + super(Windows, self).__init__(image, **kwargs) # The commit with the following message was added in # libguestfs 1.17.18 and was backported in version 1.16.11: diff --git a/image_creator/os_type/windows/registry.py b/image_creator/os_type/windows/registry.py index e8650c5024465828c2ddac1a52432d68c5771ae9..6b55927c9b062d0dfa970a2261211b8e57b18367 100644 --- a/image_creator/os_type/windows/registry.py +++ b/image_creator/os_type/windows/registry.py @@ -483,7 +483,7 @@ class Registry(object): return old - def _foreach_account(self, write=False, **kargs): + def _foreach_account(self, write=False, **kwargs): """Performs an action on the RID node of a user or a group in the registry, for every user/group found in the userlist/grouplist. If userlist/grouplist is empty, it performs the action on all @@ -516,11 +516,12 @@ class Registry(object): action(hive, name, rid_node) - userlist = kargs['userlist'] if 'userlist' in kargs else None - useraction = kargs['useraction'] if 'useraction' in kargs else None + userlist = kwargs['userlist'] if 'userlist' in kwargs else None + useraction = kwargs['useraction'] if 'useraction' in kwargs else None - grouplist = kargs['grouplist'] if 'grouplist' in kargs else None - groupaction = kargs['groupaction'] if 'groupaction' in kargs else None + grouplist = kwargs['grouplist'] if 'grouplist' in kwargs else None + groupaction = \ + kwargs['groupaction'] if 'groupaction' in kwargs else None if userlist is not None: assert useraction is not None