mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -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
|
@ -19,6 +19,7 @@ __metaclass__ = type
|
|||
|
||||
import codecs
|
||||
import csv
|
||||
from collections import MutableSequence
|
||||
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.plugins.lookup import LookupBase
|
||||
|
@ -102,7 +103,7 @@ class LookupModule(LookupBase):
|
|||
lookupfile = self.find_file_in_search_path(variables, 'files', paramvals['file'])
|
||||
var = self.read_csv(lookupfile, key, paramvals['delimiter'], paramvals['encoding'], paramvals['default'], paramvals['col'])
|
||||
if var is not None:
|
||||
if type(var) is list:
|
||||
if isinstance(var, MutableSequence):
|
||||
for v in var:
|
||||
ret.append(v)
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue