mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-03-26 21:33:05 +00:00
pylint: Ignore usage of 'unicode' before assignment
New versions of pylint ignore Python 2 functions and types, evaluating 'unicode' as "undefined". ansible-freeipa will always define 'unicode' when running under Python 3, and it is always defined under Python 2. This patch fixes these false positives.
This commit is contained in:
@@ -663,7 +663,9 @@ def main():
|
||||
|
||||
check_parameters(ansible_module, state, action)
|
||||
|
||||
elif isinstance(group_name, (str, unicode)):
|
||||
elif (
|
||||
isinstance(group_name, (str, unicode)) # pylint: disable=E0606
|
||||
):
|
||||
name = group_name
|
||||
else:
|
||||
ansible_module.fail_json(msg="Group '%s' is not valid" %
|
||||
|
||||
@@ -988,7 +988,7 @@ def main():
|
||||
sshpubkey = [str(normalize_sshpubkey(key)) for
|
||||
key in sshpubkey]
|
||||
|
||||
elif isinstance(host, (str, unicode)):
|
||||
elif isinstance(host, (str, unicode)): # pylint: disable=E0606
|
||||
name = host
|
||||
else:
|
||||
ansible_module.fail_json(msg="Host '%s' is not valid" %
|
||||
|
||||
@@ -293,7 +293,7 @@ def result_get_value_lowercase(res_find, key, default=None):
|
||||
if existing is not None:
|
||||
if isinstance(existing, (list, tuple)):
|
||||
existing = [to_text(item).lower() for item in existing]
|
||||
if isinstance(existing, (str, unicode)):
|
||||
if isinstance(existing, (str, unicode)): # pylint: disable=E0606
|
||||
existing = existing.lower()
|
||||
else:
|
||||
existing = default
|
||||
|
||||
@@ -693,7 +693,7 @@ def main():
|
||||
|
||||
delete_continue = service.get("delete_continue")
|
||||
|
||||
elif isinstance(service, (str, unicode)):
|
||||
elif isinstance(service, (str, unicode)): # pylint: disable=E0606
|
||||
name = service
|
||||
else:
|
||||
ansible_module.fail_json(msg="Service '%s' is not valid" %
|
||||
|
||||
@@ -1382,7 +1382,7 @@ def main():
|
||||
|
||||
email = extend_emails(email, default_email_domain)
|
||||
|
||||
elif isinstance(user, (str, unicode)):
|
||||
elif isinstance(user, (str, unicode)): # pylint: disable=E0606
|
||||
name = user
|
||||
else:
|
||||
ansible_module.fail_json(msg="User '%s' is not valid" %
|
||||
|
||||
Reference in New Issue
Block a user