Skip to content

Commit

Permalink
fixup! pylint: Ignore usage of 'unicode' before assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
rjeffman committed May 22, 2024
1 parent 52241fe commit 77c1d20
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion plugins/module_utils/ansible_freeipa_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ def module_params_get(module, name, allow_empty_list_item=False):
if isinstance(value, list):
for val in value:
if (
isinstance(val, (str, unicode)) # pylint: disable=E0606
isinstance(val, (str, unicode)) # pylint: disable=W0012,E0606
and not val
):
if not allow_empty_list_item:
Expand Down
4 changes: 3 additions & 1 deletion plugins/modules/ipagroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,9 @@ def main():
check_parameters(ansible_module, state, action)

elif (
isinstance(group_name, (str, unicode)) # pylint: disable=E0606
isinstance(
group_name, (str, unicode) # pylint: disable=W0012,E0606
)
):
name = group_name
else:
Expand Down
4 changes: 3 additions & 1 deletion plugins/modules/ipahost.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,9 @@ def main():
sshpubkey = [str(normalize_sshpubkey(key)) for
key in sshpubkey]

elif isinstance(host, (str, unicode)): # pylint: disable=E0606
elif (
isinstance(host, (str, unicode)) # pylint: disable=W0012,E0606
):
name = host
else:
ansible_module.fail_json(msg="Host '%s' is not valid" %
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/iparole.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)): # pylint: disable=E0606
if isinstance(existing, (str, unicode)): # pylint: disable=W0012,E0606
existing = existing.lower()
else:
existing = default
Expand Down
6 changes: 5 additions & 1 deletion plugins/modules/ipaservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,11 @@ def main():

delete_continue = service.get("delete_continue")

elif isinstance(service, (str, unicode)): # pylint: disable=E0606
elif (
isinstance(
service, (str, unicode) # pylint: disable=W0012,E0606
)
):
name = service
else:
ansible_module.fail_json(msg="Service '%s' is not valid" %
Expand Down
6 changes: 5 additions & 1 deletion plugins/modules/ipauser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1382,7 +1382,11 @@ def main():

email = extend_emails(email, default_email_domain)

elif isinstance(user, (str, unicode)): # pylint: disable=E0606
elif (
isinstance(
user, (str, unicode) # pylint: disable=W0012,E0606
)
):
name = user
else:
ansible_module.fail_json(msg="User '%s' is not valid" %
Expand Down
2 changes: 1 addition & 1 deletion roles/ipareplica/library/ipareplica_add_to_ipaservers.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def main():
conn.connect(ccache=installer._ccache)
remote_api.Command['hostgroup_add_member'](
u'ipaservers',
host=[unicode(api.env.host)], # pylint: disable=E0606
host=[unicode(api.env.host)], # pylint: disable=W0012,E0606
)
finally:
if conn.isconnected():
Expand Down
2 changes: 1 addition & 1 deletion roles/ipareplica/library/ipareplica_prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ def main():
# Check authorization
result = remote_api.Command['hostgroup_find'](
cn=u'ipaservers',
host=[unicode(api.env.host)] # pylint: disable=E0606
host=[unicode(api.env.host)] # pylint: disable=W0012,E0606
)['result']
add_to_ipaservers = not result

Expand Down

0 comments on commit 77c1d20

Please sign in to comment.