mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-23 04:24:00 -07:00
Migrate most uses of if type() to if isinstance()
Also convert those checks to use abcs instead of dict and list. Make a sentinel class for strategies to report when they've reache the end
This commit is contained in:
parent
64fe7402ff
commit
6bad4e57bd
12 changed files with 49 additions and 34 deletions
|
@ -1378,7 +1378,7 @@ class Ec2Inventory(object):
|
|||
elif key == 'ec2__previous_state':
|
||||
instance_vars['ec2_previous_state'] = instance.previous_state or ''
|
||||
instance_vars['ec2_previous_state_code'] = instance.previous_state_code
|
||||
elif type(value) in [int, bool]:
|
||||
elif isinstance(value, (int, bool)):
|
||||
instance_vars[key] = value
|
||||
elif isinstance(value, six.string_types):
|
||||
instance_vars[key] = value.strip()
|
||||
|
@ -1483,7 +1483,7 @@ class Ec2Inventory(object):
|
|||
|
||||
# Target: Everything
|
||||
# Preserve booleans and integers
|
||||
elif type(value) in [int, bool]:
|
||||
elif isinstance(value, (int, bool)):
|
||||
host_info[key] = value
|
||||
|
||||
# Target: Everything
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue