mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 11:51:26 -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
|
@ -22,11 +22,12 @@ from ansible.plugins.lookup import LookupBase
|
|||
import socket
|
||||
|
||||
try:
|
||||
import dns.exception
|
||||
import dns.name
|
||||
import dns.resolver
|
||||
import dns.reversename
|
||||
from dns.rdatatype import (A, AAAA, CNAME, DLV, DNAME, DNSKEY, DS, HINFO, LOC,
|
||||
MX, NAPTR, NS, NSEC3PARAM, PTR, RP, SOA, SPF, SRV, SSHFP, TLSA, TXT)
|
||||
import dns.exception
|
||||
HAVE_DNS = True
|
||||
except ImportError:
|
||||
HAVE_DNS = False
|
||||
|
@ -70,7 +71,7 @@ def make_rdata_dict(rdata):
|
|||
for f in fields:
|
||||
val = rdata.__getattribute__(f)
|
||||
|
||||
if type(val) == dns.name.Name:
|
||||
if isinstance(val, dns.name.Name):
|
||||
val = dns.name.Name.to_text(val)
|
||||
|
||||
if rdata.rdtype == DLV and f == 'digest':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue