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:
Toshio Kuratomi 2017-03-26 09:24:30 -07:00
parent 64fe7402ff
commit 6bad4e57bd
12 changed files with 49 additions and 34 deletions

View file

@ -17,9 +17,10 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from io import StringIO
import os
import re
from collections import MutableSequence
from io import StringIO
from ansible.errors import AnsibleError
from ansible.module_utils.six.moves import configparser
@ -110,7 +111,7 @@ class LookupModule(LookupBase):
else:
var = self.read_ini(path, key, paramvals['section'], paramvals['default'], paramvals['re'])
if var is not None:
if type(var) is list:
if isinstance(var, MutableSequence):
for v in var:
ret.append(v)
else: