return DatagramSocket(s)
elif socktype == socket.SOCK_STREAM:
stream = trio.SocketStream(s)
- s = None
tls = False
if ssl_context:
tls = True
class SSLSocket:
pass
- def create_default_context(self, *args, **kwargs):
+ @classmethod
+ def create_default_context(cls, *args, **kwargs):
raise Exception('no ssl support')
# Function used to create a socket. Can be overridden if needed in special
# Time went backwards, but only a little. This can
# happen, e.g. under vmware with older linux kernels.
# Pretend it didn't happen.
- now = start
+ duration = 0
if duration >= lifetime:
raise LifetimeTimeout(timeout=duration, errors=errors)
return min(lifetime - duration, self.timeout)
v6 = _resolver.resolve(host, dns.rdatatype.AAAA,
raise_on_no_answer=False)
# Note that setting host ensures we query the same name
- # for A as we did for AAAA.
+ # for A as we did for AAAA. (This is just in case search lists
+ # are active by default in the resolver configuration and
+ # we might be talking to a server that says NXDOMAIN when it
+ # wants to say NOERROR no data.
host = v6.qname
canonical_name = v6.canonical_name.to_text(True)
if v6.rrset is not None:
if family == socket.AF_INET or family == socket.AF_UNSPEC:
v4 = _resolver.resolve(host, dns.rdatatype.A,
raise_on_no_answer=False)
- host = v4.qname
canonical_name = v4.canonical_name.to_text(True)
if v4.rrset is not None:
for rdata in v4.rrset:
if not isinstance(other, Set):
raise ValueError('other must be a Set instance')
- if self is other:
+ if self is other: # lgtm[py/comparison-using-is]
return
for item in other.items:
self.add(item)
if not isinstance(other, Set):
raise ValueError('other must be a Set instance')
- if self is other:
+ if self is other: # lgtm[py/comparison-using-is]
return
# we make a copy of the list so that we can remove items from
# the list without breaking the iterator.
if not isinstance(other, Set):
raise ValueError('other must be a Set instance')
- if self is other:
+ if self is other: # lgtm[py/comparison-using-is]
self.items.clear()
else:
for item in other.items:
if not isinstance(other, Set):
raise ValueError('other must be a Set instance')
- if self is other:
+ if self is other: # lgtm[py/comparison-using-is]
self.items.clear()
else:
overlap = self.intersection(other)
if RELEASELEVEL == 0x0f: # pragma: no cover
#: version
- version = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
+ version = '%d.%d.%d' % \
+ (MAJOR, MINOR, MICRO) # lgtm[py/unreachable-statement]
elif RELEASELEVEL == 0x00: # pragma: no cover
version = '%d.%d.%ddev%d' % \
- (MAJOR, MINOR, MICRO, SERIAL)
+ (MAJOR, MINOR, MICRO, SERIAL) # lgtm[py/unreachable-statement]
elif RELEASELEVEL == 0x0c: # pragma: no cover
version = '%d.%d.%drc%d' % \
- (MAJOR, MINOR, MICRO, SERIAL)
+ (MAJOR, MINOR, MICRO, SERIAL) # lgtm[py/unreachable-statement]
else: # pragma: no cover
version = '%d.%d.%d%x%d' % \
- (MAJOR, MINOR, MICRO, RELEASELEVEL, SERIAL)
+ (MAJOR, MINOR, MICRO, RELEASELEVEL, SERIAL) # lgtm[py/unreachable-statement]
#: hexversion
hexversion = MAJOR << 24 | MINOR << 16 | MICRO << 8 | RELEASELEVEL << 4 | \
raise dns.exception.FormError("No answer or RRset not "
"for zone origin")
rrset = message.answer[0]
- name = rrset.name
rdataset = rrset
if rdataset.rdtype != dns.rdatatype.SOA:
raise dns.exception.FormError("first RRset is not an SOA")